diff options
author | Ed Tanous <ed.tanous@intel.com> | 2019-07-31 20:43:37 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-08-01 18:19:38 +0300 |
commit | d0f63ef62c76c932a2003eaa42c0b250065ae06f (patch) | |
tree | 4c0e3cb32dc80f80460bdbf82ff6d401d4ff194f /meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch | |
parent | b4f66bacb1b8e661d794fa7a189e2f66f5092e2e (diff) | |
download | openbmc-d0f63ef62c76c932a2003eaa42c0b250065ae06f.tar.xz |
Update to internal 7-31-19
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch deleted file mode 100644 index cba0cde32..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0021-Implement-IPMI-Commmand-Get-Host-Restart-Cause.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 6d5a372e0cf98de4d97a88d2cd42a00b7a8f034f Mon Sep 17 00:00:00 2001 -From: Yong Li <yong.b.li@linux.intel.com> -Date: Sun, 16 Sep 2018 21:32:38 +0800 -Subject: [PATCH] Implement IPMI Commmand - Get Host Restart Cause. - -It supports to track the information about what -action last caused the system to restart. -Return value includes: restart_cause and channel_number. - -According to IPMI Spec, it includes 12 types as following: -1. Unknown 0x0 -2. IpmiCommand 0x1 -3. ResetButton 0x2 -4. PowerButton 0x3 -5. WatchdogTimer 0x4 -6. OEM 0x5 -7. PowerPolicyAlwaysOn 0x6 -8. PowerPolicyPreviousState 0x7 -9. PEF-Reset 0x8 -10. PEF-PowerCycle 0x9 -11. SoftReset 0xA -12. RTC-Wakeup 0xB - -Change-Id: Id3b32e271b85b5fc4c69d5ca40227f8f9c08ce48 -Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> -Signed-off-by: Yong Li <yong.b.li@linux.intel.com> ---- - chassishandler.cpp | 54 +++++++++++++++++++++++++++++++++++++++ - chassishandler.hpp | 1 + - host-ipmid-whitelist.conf | 1 + - 3 files changed, 56 insertions(+) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index d20b220..8a8cb26 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -90,6 +90,11 @@ static constexpr auto chassisPOHStateIntf = - "xyz.openbmc_project.State.PowerOnHours"; - static constexpr auto pOHCounterProperty = "POHCounter"; - static constexpr auto match = "chassis0"; -+const static constexpr char* stateHostInterface = -+ "xyz.openbmc_project.State.Host"; -+const static constexpr char* hostRestartCauseInterface = -+ "xyz.openbmc_project.State.Host.HostRestartCause"; -+const static constexpr char* hostRestartCause = "HostRestartCause"; - const static constexpr char chassisCapIntf[] = - "xyz.openbmc_project.Control.ChassisCapabilities"; - const static constexpr char chassisCapFlagsProp[] = "CapabilitiesFlags"; -@@ -176,6 +181,13 @@ struct set_sys_boot_options_t - uint8_t data[SIZE_BOOT_OPTION]; - } __attribute__((packed)); - -+struct GetSysRestartCauseResponse -+{ -+ uint8_t restartCause; -+ uint8_t channelNum; -+ -+} __attribute__((packed)); -+ - int getHostNetworkData(get_sys_boot_options_response_t* respptr) - { - ipmi::PropertyMap properties; -@@ -1584,6 +1596,44 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - return rc; - } - -+ipmi_ret_t ipmi_chassis_get_sys_restart_cause( -+ ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request, -+ ipmi_response_t response, ipmi_data_len_t data_len, ipmi_context_t context) -+{ -+ ipmi_ret_t rc = IPMI_CC_OK; -+ -+ GetSysRestartCauseResponse* resp = (GetSysRestartCauseResponse*)response; -+ std::fill(reinterpret_cast<uint8_t*>(resp), -+ reinterpret_cast<uint8_t*>(resp) + sizeof(*resp), 0); -+ if (*data_len != 0) -+ { -+ rc = IPMI_CC_REQ_DATA_LEN_INVALID; -+ return rc; -+ } -+ -+ try -+ { -+ sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; -+ ipmi::DbusObjectInfo hostObject = -+ ipmi::getDbusObject(bus, stateHostInterface); -+ ipmi::Value variant = -+ ipmi::getDbusProperty(bus, hostObject.second, hostObject.first, -+ hostRestartCauseInterface, hostRestartCause); -+ resp->restartCause = variant.get<uint8_t>(); -+ } -+ -+ catch (std::exception& e) -+ { -+ log<level::ERR>(e.what()); -+ rc = IPMI_CC_UNSPECIFIED_ERROR; -+ return rc; -+ } -+ resp->channelNum = 0; // Fix to primary channel. -+ *data_len = sizeof(GetSysRestartCauseResponse); -+ -+ return rc; -+} -+ - /** @brief implements Get POH counter command - * @parameter - * - none -@@ -1739,4 +1789,8 @@ void register_netfn_chassis_functions() - ipmi::chassis::cmdSetPowerRestorePolicy, - ipmi::Privilege::Operator, - ipmiChassisSetPowerRestorePolicy); -+ -+ // <get Host Restart Cause> -+ ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_GET_SYS_RESTART_CAUSE, NULL, -+ ipmi_chassis_get_sys_restart_cause, PRIVILEGE_USER); - } -diff --git a/chassishandler.hpp b/chassishandler.hpp -index 49b5ef8..2c42b11 100644 ---- a/chassishandler.hpp -+++ b/chassishandler.hpp -@@ -17,6 +17,7 @@ enum ipmi_netfn_chassis_cmds - // Set Power Restore Policy - IPMI_CMD_SET_RESTORE_POLICY = 0x06, - // Get capability bits -+ IPMI_CMD_GET_SYS_RESTART_CAUSE = 0x07, - IPMI_CMD_SET_SYS_BOOT_OPTIONS = 0x08, - IPMI_CMD_GET_SYS_BOOT_OPTIONS = 0x09, - IPMI_CMD_GET_POH_COUNTER = 0x0F, -diff --git a/host-ipmid-whitelist.conf b/host-ipmid-whitelist.conf -index c1fca1d..94232de 100644 ---- a/host-ipmid-whitelist.conf -+++ b/host-ipmid-whitelist.conf -@@ -4,6 +4,7 @@ - 0x00:0x02 //<Chassis>:<Chassis Control> - 0x00:0x05 //<Chassis>:<Set Chassis Capabilities> - 0x00:0x06 //<Chassis>:<Set Power Restore Policy> -+0x00:0x07 //<Chassis>:<Get System Restart Cause> - 0x00:0x08 //<Chassis>:<Set System Boot Options> - 0x00:0x09 //<Chassis>:<Get System Boot Options> - 0x00:0x0F //<Chassis>:<Get POH Counter Command> --- -2.17.1 - |