111 lines
4.2 KiB
Diff
111 lines
4.2 KiB
Diff
|
|
From 16a84c977b6a360d7f6a12f578d0480f4c00ec76 Mon Sep 17 00:00:00 2001
|
|||
|
|
From: "Wang.Bin" <Bin-B.Wang@luxshare-ict.com>
|
|||
|
|
Date: Thu, 19 Dec 2024 15:42:26 +0800
|
|||
|
|
Subject: [PATCH 6/6] Fix sensor status being cleared due to warm reset during
|
|||
|
|
the power on
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
fault-monitor/fru-fault-monitor.cpp | 36 +++++++++++++++++++++++++++++
|
|||
|
|
fault-monitor/fru-fault-monitor.hpp | 12 +++++++++-
|
|||
|
|
2 files changed, 47 insertions(+), 1 deletion(-)
|
|||
|
|
|
|||
|
|
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
|
|||
|
|
index 1bc41aa..f8cac9b 100644
|
|||
|
|
--- a/fault-monitor/fru-fault-monitor.cpp
|
|||
|
|
+++ b/fault-monitor/fru-fault-monitor.cpp
|
|||
|
|
@@ -1632,6 +1632,37 @@ void Add::clearFirmwareProgressAlarm(SensorStatusInfo& statusInfo)
|
|||
|
|
|
|||
|
|
void Add::deassertOnPowerReset(void)
|
|||
|
|
{
|
|||
|
|
+ std::cout << "Get the current host state" <<std::endl;
|
|||
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
|||
|
|
+ // Get the current host state
|
|||
|
|
+ constexpr auto HOST_INTERFACE = "xyz.openbmc_project.State.Host";
|
|||
|
|
+ std::string HOST_PATH = "/xyz/openbmc_project/state/host0";
|
|||
|
|
+ std::string HOST_PROP = "CurrentHostState";
|
|||
|
|
+ sdbusplus::bus_t bus= sdbusplus::bus::new_default();;
|
|||
|
|
+ std::string settingService = "xyz.openbmc_project.State.Host";
|
|||
|
|
+ auto method = bus.new_method_call(settingService.c_str(), HOST_PATH.c_str(),
|
|||
|
|
+ "org.freedesktop.DBus.Properties", "Get");
|
|||
|
|
+ method.append(HOST_INTERFACE, HOST_PROP);
|
|||
|
|
+ std::variant<std::string> propertyValue{};
|
|||
|
|
+ std::string value;
|
|||
|
|
+ try
|
|||
|
|
+ {
|
|||
|
|
+ auto reply = bus.call(method);
|
|||
|
|
+ reply.read(propertyValue);
|
|||
|
|
+ value = std::get<std::string>(propertyValue);
|
|||
|
|
+ std::cerr << "value:" << value << "\n";
|
|||
|
|
+ }
|
|||
|
|
+ catch (const std::exception& e)
|
|||
|
|
+ {
|
|||
|
|
+ std::cerr << "exception:" << e.what() << "\n";
|
|||
|
|
+ }
|
|||
|
|
+
|
|||
|
|
+ if (value == "xyz.openbmc_project.State.Host.HostState.Running"){
|
|||
|
|
+ std::cout << "power on:Do not clear the sensor status" <<std::endl;
|
|||
|
|
+ return;
|
|||
|
|
+ }
|
|||
|
|
+ // Clear the sensor status
|
|||
|
|
+ std::cout << "Clear the sensor status" <<std::endl;
|
|||
|
|
for (auto& [sensorObj, statusInfo] : sensorStatusRec)
|
|||
|
|
{
|
|||
|
|
if (statusInfo.eventType != SPECIFIC_SENSOR_TYPE)
|
|||
|
|
@@ -1641,18 +1672,22 @@ void Add::deassertOnPowerReset(void)
|
|||
|
|
|
|||
|
|
if (SENSOR_TYPE_PROCESSOR == statusInfo.sensorType)
|
|||
|
|
{
|
|||
|
|
+ std::cout << "clearCPUStatusAlarm" <<std::endl;
|
|||
|
|
clearCPUStatusAlarm(statusInfo);
|
|||
|
|
}
|
|||
|
|
else if (SENSOR_TYPE_MEMORY == statusInfo.sensorType)
|
|||
|
|
{
|
|||
|
|
+ std::cout << "clearMEMStatusAlarm" <<std::endl;
|
|||
|
|
clearMEMStatusAlarm(statusInfo);
|
|||
|
|
}
|
|||
|
|
else if (SENSOR_TYPE_CRITICAL_INTERRUPT == statusInfo.sensorType)
|
|||
|
|
{
|
|||
|
|
+ std::cout << "clearPCIEStatusAlarm" <<std::endl;
|
|||
|
|
clearPCIEStatusAlarm(statusInfo);
|
|||
|
|
}
|
|||
|
|
else if (SENSOR_TYPE_SYSTEM_FIRMWARE_PROGRESS == statusInfo.sensorType)
|
|||
|
|
{
|
|||
|
|
+ std::cout << "clearFirmwareProgressAlarm" <<std::endl;
|
|||
|
|
clearFirmwareProgressAlarm(statusInfo);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
@@ -1701,6 +1736,7 @@ void Add::createAssociation(sdbusplus::asio::object_server& objectServer)
|
|||
|
|
|
|||
|
|
void Add::initPowerStatus()
|
|||
|
|
{
|
|||
|
|
+ std::cout << "initPowerStatus." <<std::endl;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
auto ret = dBusHandler.getProperty(hostPath, hostInterface,
|
|||
|
|
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
|
|||
|
|
index 185693b..8eeb6e5 100644
|
|||
|
|
--- a/fault-monitor/fru-fault-monitor.hpp
|
|||
|
|
+++ b/fault-monitor/fru-fault-monitor.hpp
|
|||
|
|
@@ -175,7 +175,17 @@ class Add
|
|||
|
|
auto findState = values.find(hostProperty);
|
|||
|
|
if (findState != values.end())
|
|||
|
|
{
|
|||
|
|
- deassertOnPowerReset();
|
|||
|
|
+ auto status = std::get<std::string>(findState->second);
|
|||
|
|
+ if (status.size() >= running.size())
|
|||
|
|
+ {
|
|||
|
|
+ isPoweredOn =
|
|||
|
|
+ (status.compare(status.size() - running.size(),
|
|||
|
|
+ running.size(), running.data()) == 0);
|
|||
|
|
+ if (!isPoweredOn)
|
|||
|
|
+ {
|
|||
|
|
+ deassertOnPowerReset();
|
|||
|
|
+ }
|
|||
|
|
+ }
|
|||
|
|
}
|
|||
|
|
}),
|
|||
|
|
dimmLEDMatch(bus,
|
|||
|
|
--
|
|||
|
|
2.25.1
|
|||
|
|
|