summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuiying Wang <kuiying.wang@intel.com>2019-11-05 15:13:40 +0800
committerKuiying Wang <kuiying.wang@intel.com>2019-11-13 01:05:30 +0000
commit6b0ceaa402f685b060ba6358ff4ae631e6c32fab (patch)
tree2a4e076c6a0b67a77fe455ec48d5662a62c48ac3
parent79b4eeaa0c97b40d9ab12b48694083cec2b13d79 (diff)
downloadphosphor-host-ipmid-6b0ceaa402f685b060ba6358ff4ae631e6c32fab.tar.gz
phosphor-host-ipmid-6b0ceaa402f685b060ba6358ff4ae631e6c32fab.zip
Implement NMI command in Chassis Control command.
Set NMI (Diagnostic Interrupt) signal source to Chassis command. Please refer ipmi spec 1.3 table 1 for details. Set Enabled property to inform NMI source handling to trigger a NMI_OUT BSOD. Tested: NMI is actived(host is hang) due to NMI command ipmitool chassis power diag Change-Id: I8066aa19ba1f5a81897857de2a5fe551876101b3 Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
-rw-r--r--chassishandler.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 305897b..053f29a 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -767,6 +767,38 @@ int initiate_state_transition(State::Host::Transition transition)
return rc;
}
+//------------------------------------------
+// Set Enabled property to inform NMI source
+// handling to trigger a NMI_OUT BSOD.
+//------------------------------------------
+int setNmiProperty(const bool value)
+{
+ constexpr const char* nmiSourceObjPath =
+ "/xyz/openbmc_project/Chassis/Control/NMISource";
+ constexpr const char* nmiSourceIntf =
+ "xyz.openbmc_project.Chassis.Control.NMISource";
+ std::string bmcSourceSignal = "xyz.openbmc_project.Chassis.Control."
+ "NMISource.BMCSourceSignal.ChassisCmd";
+ std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
+
+ try
+ {
+ auto service = ipmi::getService(*busp, nmiSourceIntf, nmiSourceObjPath);
+ ipmi::setDbusProperty(*busp, service, nmiSourceObjPath, nmiSourceIntf,
+ "BMCSource", bmcSourceSignal);
+ ipmi::setDbusProperty(*busp, service, nmiSourceObjPath, nmiSourceIntf,
+ "Enabled", value);
+ }
+ catch (std::exception& e)
+ {
+ log<level::ERR>("Failed to trigger NMI_OUT",
+ entry("EXCEPTION=%s", e.what()));
+ return -1;
+ }
+
+ return 0;
+}
+
namespace power_policy
{
@@ -1172,6 +1204,10 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl)
rc = initiate_state_transition(State::Host::Transition::Off);
break;
+ case CMD_PULSE_DIAGNOSTIC_INTR:
+ rc = setNmiProperty(true);
+ break;
+
default:
{
log<level::ERR>("Invalid Chassis Control command",
OpenPOWER on IntegriCloud