Add Asserted property for mem thermtrip
Add "Asserted" property in dbus to make phosphor-ipmi-host could know
whether the memory thermaltrip error is asserted or not.
Tested:
1.
Add in startMonitors:
'''
mem1ThermtripMonitor = std::make_unique<
host_error_monitor::mem_thermtrip_monitor::MemThermtripMonitor>(
io, conn, "CPU1_MEM_THERM_EVENT", 1, "CPU0_MEMTrip");
'''
Result:
'''
root@qbmc:~# busctl get-property xyz.openbmc_project.HostErrorMonitor \
> /xyz/openbmc_project/host_error_monitor/processor/CPU0_MEMTrip \
> xyz.openbmc_project.HostErrorMonitor.Processor.ThermalTrip Asserted
b false
'''
2.
Add in startMonitors:
'''
mem1ThermtripMonitor = std::make_unique<
host_error_monitor::mem_thermtrip_monitor::MemThermtripMonitor>(
io, conn, "CPU1_MEM_THERM_EVENT", 1);
'''
and the objectPath is
"/xyz/openbmc_project/host_error_monitor/processor/CPU1_MEM_THERM_EVENT"
Signed-off-by: JinFuLin <JeffLin2@quantatw.com>
Change-Id: I351b4379cf0f67ba667c72fa3046f5d96dc18096
diff --git a/include/error_monitors/mem_thermtrip_monitor.hpp b/include/error_monitors/mem_thermtrip_monitor.hpp
index 7d87fe1..fea3e21 100644
--- a/include/error_monitors/mem_thermtrip_monitor.hpp
+++ b/include/error_monitors/mem_thermtrip_monitor.hpp
@@ -26,6 +26,7 @@
const static host_error_monitor::base_gpio_monitor::AssertValue
assertValue =
host_error_monitor::base_gpio_monitor::AssertValue::lowAssert;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> assertInterface;
size_t cpuNum;
void logEvent() override
@@ -37,15 +38,32 @@
LOG_ERR, "REDFISH_MESSAGE_ID=%s",
"OpenBMC.0.1.MemoryThermTrip",
"REDFISH_MESSAGE_ARGS=%s", cpuNumber.c_str(), NULL);
+ assertInterface->set_property("Asserted", true);
+ }
+
+ void deassertHandler() override
+ {
+ assertInterface->set_property("Asserted", false);
}
public:
MemThermtripMonitor(boost::asio::io_service& io,
std::shared_ptr<sdbusplus::asio::connection> conn,
- const std::string& signalName, const size_t cpuNum) :
+ const std::string& signalName, const size_t cpuNum,
+ const std::string& customName = std::string()) :
BaseGPIOMonitor(io, conn, signalName, assertValue),
cpuNum(cpuNum)
{
+ sdbusplus::asio::object_server server =
+ sdbusplus::asio::object_server(conn);
+ std::string objectName = customName.empty() ? signalName : customName;
+ std::string path =
+ "/xyz/openbmc_project/host_error_monitor/processor/" + objectName;
+
+ assertInterface = server.add_interface(
+ path, "xyz.openbmc_project.HostErrorMonitor.Processor.ThermalTrip");
+ assertInterface->register_property("Asserted", false);
+ assertInterface->initialize();
if (valid)
{
startMonitoring();