Clearing ACFail bit after next restart.
Issue: ACFail bit in Get chassis command never resets
after being set to 1.
Fix:Reset AcBoot Property whenever powered on via IPMI
command and also during soft reset.
Tested: 1.Plug off the AC power and power ON again.
2. ipmitool raw 00 01
00 01 40 70 // ACFail bit is 1.
3. Chassis power off via IPMI command
ipmitool 00 02 00
4. ipmitool raw 00 01
00 10 40 70 // ACFail bit is 0.
Signed-off-by: Rashmi RV <rashmi.r.v@linux.intel.com>
Change-Id: Ib143fd5ba1ad0f00b0ad8cf01afabdcc93797c7a
diff --git a/power-control-x86/src/power_control.cpp b/power-control-x86/src/power_control.cpp
index b8497e0..be0f8de 100644
--- a/power-control-x86/src/power_control.cpp
+++ b/power-control-x86/src/power_control.cpp
@@ -514,6 +514,27 @@
std::cerr << "RestartCause set to " << cause << "\n";
restartCauseIface->set_property("RestartCause", cause);
}
+
+static void resetACBootProperty()
+{
+ if ((causeSet.contains(RestartCause::command)) ||
+ (causeSet.contains(RestartCause::softReset)))
+ {
+ conn->async_method_call(
+ [](boost::system::error_code ec) {
+ if (ec)
+ {
+ std::cerr << "failed to reset ACBoot property\n";
+ }
+ },
+ "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/control/host0/ac_boot",
+ "org.freedesktop.DBus.Properties", "Set",
+ "xyz.openbmc_project.Common.ACBoot", "ACBoot",
+ std::variant<std::string>{"False"});
+ }
+}
+
static void setRestartCause()
{
// Determine the actual restart cause based on the set of causes
@@ -1315,6 +1336,7 @@
// Set the restart cause set for this restart
setRestartCause();
+ resetACBootProperty();
sd_journal_send("MESSAGE=Host system DC power is off",
"PRIORITY=%i", LOG_INFO,
"REDFISH_MESSAGE_ID=%s",