Add support for HDD LED assert/deassert mfg cmd
Support added for HDD LED assert / deassert in Set SM Signal
command.
Tested:
1. Verified that drive asserted state being updated accordingly
after
ipmitool raw 0x30 0x15 3 0 1 --> Drive 1 LED assert
ipmitool raw 0x30 0x15 3 0 0 --> Drive 1 LED deassert
Change-Id: Ic568d4bdc8b9de87eba4f8b0da61233494131d4c
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index 051f5be..c96d9f4 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -627,6 +627,66 @@
}
}
break;
+ case SmSignalSet::smDiskFaultLed:
+ {
+ boost::system::error_code ec;
+ using objPaths = std::vector<std::string>;
+ std::string driveBasePath =
+ "/xyz/openbmc_project/inventory/item/drive/";
+ static constexpr const char* driveLedIntf =
+ "xyz.openbmc_project.Led.Group";
+ static constexpr const char* hsbpService =
+ "xyz.openbmc_project.HsbpManager";
+
+ auto driveList = ctx->bus->yield_method_call<objPaths>(
+ ctx->yield, ec, "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ driveBasePath, 0, std::array<const char*, 1>{driveLedIntf});
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Failed to query HSBP drive sub tree objects");
+ return ipmi::responseUnspecifiedError();
+ }
+ std::string driveObjPath =
+ driveBasePath + "Drive_" + std::to_string(instance + 1);
+ if (std::find(driveList.begin(), driveList.end(), driveObjPath) ==
+ driveList.end())
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ bool driveLedState = false;
+ switch (action)
+ {
+ case SmActionSet::forceAsserted:
+ {
+ driveLedState = true;
+ }
+ break;
+ case SmActionSet::revert:
+ {
+ driveLedState = false;
+ }
+ break;
+ case SmActionSet::forceDeasserted:
+ {
+ driveLedState = false;
+ }
+ break;
+ default:
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ }
+ ret = mtm.setProperty(hsbpService, driveObjPath, driveLedIntf,
+ "Asserted", driveLedState);
+ if (ret < 0)
+ {
+ return ipmi::responseUnspecifiedError();
+ }
+ }
+ break;
default:
{
return ipmi::responseInvalidFieldRequest();