91 lines
3.1 KiB
Diff
91 lines
3.1 KiB
Diff
|
|
From fd9fd44b8adda86cc292943fbb477293b321f390 Mon Sep 17 00:00:00 2001
|
||
|
|
From: "Wang.Bin" <Bin-B.Wang@luxshare-ict.com>
|
||
|
|
Date: Tue, 5 Nov 2024 19:15:22 +0800
|
||
|
|
Subject: [PATCH 8/8] Add ACPI_State event monitoring Test ACPI_State |
|
||
|
|
FBh | ok | 7.70 | S4/S5: soft-off 3 | 04/03/23 | 20:59:16 UTC | System
|
||
|
|
ACPI Power State ACPI_State | S4/S5: soft-off | Asserted ipmitool power on
|
||
|
|
reboot ACPI_State | FBh | ok | 7.70 | S0/G0: working 5 | 04/03/23 |
|
||
|
|
21:03:14 UTC | System ACPI Power State ACPI_State | S0/G0: working | Asserted
|
||
|
|
|
||
|
|
---
|
||
|
|
...bmc_project.Chassis.Control.Power@.service | 4 ++-
|
||
|
|
src/power_control.cpp | 26 +++++++++++++++++++
|
||
|
|
2 files changed, 29 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/service_files/xyz.openbmc_project.Chassis.Control.Power@.service b/service_files/xyz.openbmc_project.Chassis.Control.Power@.service
|
||
|
|
index 4d676c2..03a1782 100644
|
||
|
|
--- a/service_files/xyz.openbmc_project.Chassis.Control.Power@.service
|
||
|
|
+++ b/service_files/xyz.openbmc_project.Chassis.Control.Power@.service
|
||
|
|
@@ -1,6 +1,8 @@
|
||
|
|
[Unit]
|
||
|
|
Description=Intel Power Control for the Host %i
|
||
|
|
ConditionPathExists=/usr/share/x86-power-control/power-config-host%i.json
|
||
|
|
+Wants=obmc-fru-fault-monitor.service
|
||
|
|
+After=obmc-fru-fault-monitor.service
|
||
|
|
|
||
|
|
[Service]
|
||
|
|
Restart=always
|
||
|
|
@@ -10,4 +12,4 @@ Type=dbus
|
||
|
|
BusName=xyz.openbmc_project.State.Host%i
|
||
|
|
|
||
|
|
[Install]
|
||
|
|
-WantedBy=sysinit.target
|
||
|
|
+WantedBy=sysinit.target
|
||
|
|
\ No newline at end of file
|
||
|
|
diff --git a/src/power_control.cpp b/src/power_control.cpp
|
||
|
|
index fbc9605..bfb55ef 100644
|
||
|
|
--- a/src/power_control.cpp
|
||
|
|
+++ b/src/power_control.cpp
|
||
|
|
@@ -177,6 +177,8 @@ static boost::asio::steady_timer pohCounterTimer(io);
|
||
|
|
// Time when to allow restart cause updates
|
||
|
|
static boost::asio::steady_timer restartCauseTimer(io);
|
||
|
|
static boost::asio::steady_timer slotPowerCycleTimer(io);
|
||
|
|
+// SEL timer
|
||
|
|
+static boost::asio::steady_timer selTimer(io);
|
||
|
|
|
||
|
|
// Map containing timers used for D-Bus get-property retries
|
||
|
|
static boost::container::flat_map<std::string, boost::asio::steady_timer>
|
||
|
|
@@ -2810,8 +2812,31 @@ void reschedulePropertyRead(const ConfigData& configData)
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
+
|
||
|
|
+static void ACPIStateSel(void)
|
||
|
|
+{
|
||
|
|
+ const static constexpr int TimeMs = 20000;
|
||
|
|
+ selTimer.expires_after(std::chrono::milliseconds(TimeMs));
|
||
|
|
+ selTimer.async_wait([](const boost::system::error_code ec) {
|
||
|
|
+ if (ec)
|
||
|
|
+ {
|
||
|
|
+ // operation_aborted is expected if timer is canceled before
|
||
|
|
+ // completion.
|
||
|
|
+ if (ec != boost::asio::error::operation_aborted)
|
||
|
|
+ {
|
||
|
|
+ lg2::info("ACPI State timer error: {ERROR}", "ERROR",
|
||
|
|
+ ec.message());
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+ lg2::info("ACPI State sel");
|
||
|
|
+ powerStateLog(powerState);
|
||
|
|
+ });
|
||
|
|
+
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
} // namespace power_control
|
||
|
|
|
||
|
|
+
|
||
|
|
int main(int argc, char* argv[])
|
||
|
|
{
|
||
|
|
using namespace power_control;
|
||
|
|
@@ -3106,6 +3131,7 @@ int main(int argc, char* argv[])
|
||
|
|
powerState = PowerState::on;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
+ ACPIStateSel();
|
||
|
|
// Check if we need to start the Power Restore policy
|
||
|
|
if (powerState != PowerState::on)
|
||
|
|
{
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|