Support PCH TControl
Add PCH TControl to set/get fsc parameter command.
Tested: used get TControl, powered on system, and
when called get tcontrol again value changed.
Change-Id: I12ae44e9e866c487a3efc0f1ef2736b13a9a591c
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 5edc82a..05bd0b5 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1310,10 +1310,13 @@
"/xyz/openbmc_project/control/cfm_limit";
constexpr const char* cfmLimitIface = "xyz.openbmc_project.Control.CFMLimit";
constexpr const size_t legacyExitAirSensorNumber = 0x2e;
+constexpr const size_t legacyPCHSensorNumber = 0x22;
+constexpr const char* exitAirPathName = "Exit_Air";
+constexpr const char* pchPathName = "SSB_Temp";
constexpr const char* pidConfigurationIface =
"xyz.openbmc_project.Configuration.Pid";
-static std::string getExitAirConfigPath()
+static std::string getConfigPath(const std::string& name)
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
auto method =
@@ -1334,9 +1337,10 @@
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMGetFscParameter: mapper error");
};
- auto config = std::find_if(resp.begin(), resp.end(), [](const auto& pair) {
- return pair.first.find("Exit_Air") != std::string::npos;
- });
+ auto config =
+ std::find_if(resp.begin(), resp.end(), [&name](const auto& pair) {
+ return pair.first.find(name) != std::string::npos;
+ });
if (config != resp.end())
{
path = std::move(config->first);
@@ -1495,18 +1499,24 @@
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
if (command == static_cast<uint8_t>(setFscParamFlags::tcontrol))
{
+ std::string pathName;
if (param1 == legacyExitAirSensorNumber)
{
- std::string path = getExitAirConfigPath();
- ipmi::setDbusProperty(*dbus, "xyz.openbmc_project.EntityManager",
- path, pidConfigurationIface, "SetPoint",
- static_cast<double>(param2));
- return ipmi::responseSuccess();
+ pathName = exitAirPathName;
+ }
+ else if (param1 == legacyPCHSensorNumber)
+ {
+ pathName = pchPathName;
}
else
{
return ipmi::responseParmOutOfRange();
}
+ std::string path = getConfigPath(pathName);
+ ipmi::setDbusProperty(*dbus, "xyz.openbmc_project.EntityManager", path,
+ pidConfigurationIface, "SetPoint",
+ static_cast<double>(param2));
+ return ipmi::responseSuccess();
}
else if (command == static_cast<uint8_t>(setFscParamFlags::cfm))
{
@@ -1586,7 +1596,7 @@
std::variant<uint8_t, std::array<uint8_t, 2>, std::array<uint16_t, 2>>>
ipmiOEMGetFscParameter(uint8_t command, std::optional<uint8_t> param)
{
- constexpr uint8_t legacyDefaultExitAirLimit = -128;
+ constexpr uint8_t legacyDefaultSetpoint = -128;
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
if (command == static_cast<uint8_t>(setFscParamFlags::tcontrol))
@@ -1596,12 +1606,23 @@
return ipmi::responseReqDataLenInvalid();
}
- if (*param != legacyExitAirSensorNumber)
+ std::string pathName;
+
+ if (*param == legacyExitAirSensorNumber)
+ {
+ pathName = exitAirPathName;
+ }
+ else if (*param == legacyPCHSensorNumber)
+ {
+ pathName = pchPathName;
+ }
+ else
{
return ipmi::responseParmOutOfRange();
}
- uint8_t setpoint = legacyDefaultExitAirLimit;
- std::string path = getExitAirConfigPath();
+
+ uint8_t setpoint = legacyDefaultSetpoint;
+ std::string path = getConfigPath(pathName);
if (path.size())
{
Value val = ipmi::getDbusProperty(