move PowerRestoreDelay to RestorePolicy interface
The `xyz.openbmc_project.Control.Power.RestoreDelay` is undocumented
which prevents to use phosphor-settings to handle this parameter.
This property looks good fit to
`xyz.openbmc_project.Control.Power.RestorePolicy` interface, so it was
included there.
Type of the value was changed from uint16 to uint64 and units changes
from seconds to microseconds.
See https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/50231
for details.
Tested: Jason M. Bills confirmed that the commands to get and set the
power restore delay correctly convert to and from unit64_t.
Signed-off-by: Andrei Kartashev <a.kartashev@yadro.com>
Change-Id: I58dd601e561b53660ddb50e2b2c2b77ee2083030
diff --git a/include/oemcommands.hpp b/include/oemcommands.hpp
index b2ff97c..0047517 100644
--- a/include/oemcommands.hpp
+++ b/include/oemcommands.hpp
@@ -172,9 +172,9 @@
static constexpr const char* biosVersionProp = "Version";
static constexpr const char* powerRestoreDelayObjPath =
- "/xyz/openbmc_project/control/power_restore_delay";
+ "/xyz/openbmc_project/control/host0/power_restore_policy";
static constexpr const char* powerRestoreDelayIntf =
- "xyz.openbmc_project.Control.Power.RestoreDelay";
+ "xyz.openbmc_project.Control.Power.RestorePolicy";
static constexpr const char* powerRestoreDelayProp = "PowerRestoreDelay";
static constexpr const char* processorErrConfigObjPath =
"/xyz/openbmc_project/control/processor_error_config";
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 21ba22d..b258e21 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -686,7 +686,9 @@
getDbusProperty(*dbus, service, powerRestoreDelayObjPath,
powerRestoreDelayIntf, powerRestoreDelayProp);
- uint16_t delay = std::get<uint16_t>(variant);
+ uint64_t val = std::get<uint64_t>(variant);
+ val /= 1000000UL;
+ uint16_t delay = val;
resp->byteLSB = delay;
resp->byteMSB = delay >> 8;
@@ -863,11 +865,12 @@
}
delay = data->byteMSB;
delay = (delay << 8) | data->byteLSB;
+ uint64_t val = delay * 1000000;
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
std::string service =
getService(*dbus, powerRestoreDelayIntf, powerRestoreDelayObjPath);
setDbusProperty(*dbus, service, powerRestoreDelayObjPath,
- powerRestoreDelayIntf, powerRestoreDelayProp, delay);
+ powerRestoreDelayIntf, powerRestoreDelayProp, val);
*dataLen = 0;
return IPMI_CC_OK;