Support Nmi reset in redfish
Nmi is one of new reset source in redfish, need to support in intel platforms.
"Actions": {
"#ComputerSystem.Reset": {
"ResetType@Redfish.AllowableValues": [
"On",
"ForceOff",
"ForceOn",
"ForceRestart",
"GracefulRestart",
"GracefulShutdown",
"PowerCycle",
"Nmi"
],
"target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
}
},
it's to add a method in NMI out interface to support Nmi reset action.
tested:
by Postman, send POST request in "https://IP_address/redfish/v1/Systems/
system/Actions/ComputerSystem.Reset" with the script:
{
"ResetType": "Nmi"
}
and get successful response.
Change-Id: Ia5392409f3182524c651b2e8380eb29bb62e7f94
Signed-off-by: Chen Yugang <yugang.chen@linux.intel.com>
diff --git a/power-control-x86/src/power_control.cpp b/power-control-x86/src/power_control.cpp
index 07f6a30..b211d6b 100644
--- a/power-control-x86/src/power_control.cpp
+++ b/power-control-x86/src/power_control.cpp
@@ -38,6 +38,7 @@
static std::shared_ptr<sdbusplus::asio::dbus_interface> nmiButtonIface;
static std::shared_ptr<sdbusplus::asio::dbus_interface> osIface;
static std::shared_ptr<sdbusplus::asio::dbus_interface> idButtonIface;
+static std::shared_ptr<sdbusplus::asio::dbus_interface> nmiOutIface;
static gpiod::line powerButtonMask;
static gpiod::line resetButtonMask;
@@ -1812,6 +1813,7 @@
power_control::conn->request_name(
"xyz.openbmc_project.State.OperatingSystem");
power_control::conn->request_name("xyz.openbmc_project.Chassis.Buttons");
+ power_control::conn->request_name("xyz.openbmc_project.Control.Host.NMI");
// Request PS_PWROK GPIO events
if (!power_control::requestGPIOEvents(
@@ -2152,6 +2154,17 @@
power_control::nmiButtonIface->initialize();
+ // NMI out Service
+ sdbusplus::asio::object_server nmiOutServer =
+ sdbusplus::asio::object_server(power_control::conn);
+
+ // NMI out Interface
+ power_control::nmiOutIface =
+ nmiOutServer.add_interface("/xyz/openbmc_project/control/host0/nmi",
+ "xyz.openbmc_project.Control.Host.NMI");
+ power_control::nmiOutIface->register_method("NMI", power_control::nmiReset);
+ power_control::nmiOutIface->initialize();
+
// ID Button Interface
power_control::idButtonIface =
buttonsServer.add_interface("/xyz/openbmc_project/chassis/buttons/id",