From 10bc2ef852277cf8e9858f75cea9f55b482bf85b Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Thu, 6 Jun 2019 09:43:20 -0700 Subject: Update to internal 6-6-19 Signed-off-by: Ed Tanous --- .../0012-ipmi-set-get-boot-options.patch | 62 ------ ...3-Fix-keep-looping-issue-when-entering-OS.patch | 16 +- ...nbmc_project.State.Chassis-for-IPMI-chass.patch | 127 ++++++++++++ .../0062-Update-IPMI-Chassis-Control-command.patch | 214 +++++++++++++++++++++ 4 files changed, 349 insertions(+), 70 deletions(-) delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0012-ipmi-set-get-boot-options.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0061-Use-xyz.openbmc_project.State.Chassis-for-IPMI-chass.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host') diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0012-ipmi-set-get-boot-options.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0012-ipmi-set-get-boot-options.patch deleted file mode 100644 index fb5dcee09..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0012-ipmi-set-get-boot-options.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 7b5c6a54c049a447b1fd3a42f9d63322dcee4dc7 Mon Sep 17 00:00:00 2001 -From: Yong Li -Date: Sun, 16 Sep 2018 19:45:10 +0800 -Subject: [PATCH] [ipmi] set/get boot options - -1. fix issue for handling unsupported paramter -2. add support for floppy/USB boot - -Change-Id: I2b888c1ad67fec7924dd5825f78622cd216a55f4 -Signed-off-by: Jia, Chunhui -Signed-off-by: Yong Li ---- - chassishandler.cpp | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index 666addb..77af2dc 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -1244,7 +1244,8 @@ constexpr auto ipmiDefault = 0; - std::map sourceIpmiToDbus = { - {0x01, Source::Sources::Network}, - {0x02, Source::Sources::Disk}, - {0x05, Source::Sources::ExternalMedia}, -+ {0x0f, Source::Sources::RemovableMedia}, - {ipmiDefault, Source::Sources::Default}}; - - std::map modeIpmiToDbus = { -@@ -1255,7 +1256,8 @@ std::map modeIpmiToDbus = { - std::map sourceDbusToIpmi = { - {Source::Sources::Network, 0x01}, - {Source::Sources::Disk, 0x02}, - {Source::Sources::ExternalMedia, 0x05}, -+ {Source::Sources::RemovableMedia, 0x0f}, - {Source::Sources::Default, ipmiDefault}}; - - std::map modeDbusToIpmi = { -@@ -1533,7 +1535,7 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - setBootMode(Mode::Modes::Regular); - } - } -- if (modeIpmiToDbus.end() != modeItr) -+ else if (modeIpmiToDbus.end() != modeItr) - { - rc = setBootMode(modeItr->second); - if (rc != IPMI_CC_OK) -@@ -1550,6 +1552,12 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - setBootSource(Source::Sources::Default); - } - } -+ else -+ { -+ // if boot option is not in support list, return error -+ *data_len = 0; -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } - } - catch (InternalFailure& e) - { --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch index 2a4cc9bb1..903ae96a7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch @@ -1,4 +1,4 @@ -From 9ed3fd11047f8c360b7d808946939ef280813811 Mon Sep 17 00:00:00 2001 +From ad93a6e17310d92ef07b8d367b23c93793562d0f Mon Sep 17 00:00:00 2001 From: Cheng C Yang Date: Wed, 23 Jan 2019 17:02:40 +0800 Subject: [PATCH] Fix keep looping issue when entering OS @@ -20,19 +20,19 @@ correctly through KCS channel. 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/host-cmd-manager.cpp b/host-cmd-manager.cpp -index 0a61e63..6e50684 100644 +index f3aba7f..465eb81 100644 --- a/host-cmd-manager.cpp +++ b/host-cmd-manager.cpp @@ -26,6 +26,8 @@ constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper"; constexpr auto HOST_STATE_PATH = "/xyz/openbmc_project/state/host0"; constexpr auto HOST_STATE_INTERFACE = "xyz.openbmc_project.State.Host"; constexpr auto HOST_TRANS_PROP = "RequestedHostTransition"; -+constexpr const char* IPMI_PATH = "/org/openbmc/HostIpmi/1"; -+constexpr const char* IPMI_INTERFACE = "org.openbmc.HostIpmi"; ++constexpr const char* IPMI_PATH = "/xyz/openbmc_project/Ipmi/Channel/ipmi_kcs3"; ++constexpr const char* IPMI_INTERFACE = "xyz.openbmc_project.Ipmi.Channel.SMS"; // For throwing exceptions using namespace phosphor::logging; -@@ -107,6 +109,20 @@ void Manager::clearQueue() +@@ -106,6 +108,20 @@ void Manager::clearQueue() // `false` indicating Failure std::get(command)(ipmiCmdData, false); } @@ -53,7 +53,7 @@ index 0a61e63..6e50684 100644 } // Called for alerting the host -@@ -116,9 +132,6 @@ void Manager::checkQueueAndAlertHost() +@@ -115,9 +131,6 @@ void Manager::checkQueueAndAlertHost() { log("Asserting SMS Attention"); @@ -63,7 +63,7 @@ index 0a61e63..6e50684 100644 auto host = ::ipmi::getService(this->bus, IPMI_INTERFACE, IPMI_PATH); // Start the timer for this transaction -@@ -132,9 +145,8 @@ void Manager::checkQueueAndAlertHost() +@@ -131,9 +144,8 @@ void Manager::checkQueueAndAlertHost() return; } @@ -76,5 +76,5 @@ index 0a61e63..6e50684 100644 if (reply.is_method_error()) -- -2.16.2 +2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0061-Use-xyz.openbmc_project.State.Chassis-for-IPMI-chass.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0061-Use-xyz.openbmc_project.State.Chassis-for-IPMI-chass.patch new file mode 100644 index 000000000..877c5336a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0061-Use-xyz.openbmc_project.State.Chassis-for-IPMI-chass.patch @@ -0,0 +1,127 @@ +From 514b76d1c05d7ed7fb7e1df27833e423e04c9a1c Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" +Date: Tue, 21 May 2019 09:57:16 -0700 +Subject: [PATCH] Use xyz.openbmc_project.State.Chassis for IPMI chassis status + +Instead of directly using pgood on dbus, this change uses the +xyz.openbmc_project.State.Chassis "CurrentPowerState" property +for the IPMI chassis status command. This will allow us to +remove pgood from dbus. + +Tested: +Ran IPMI chassis commands and confirmed that they behave as +expected: +ipmitool power status +Chassis Power is on + +ipmitool power off +Chassis Power Control: Down/Off + +ipmitool power status +Chassis Power is off + +ipmitool power on +Chassis Power Control: Up/On + +ipmitool power status +Chassis Power is on + +Change-Id: I7836c16b76c3b309f176186f3e2453082e4cd1af +Signed-off-by: Jason M. Bills +--- + chassishandler.cpp | 61 ++++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 41 insertions(+), 20 deletions(-) + +diff --git a/chassishandler.cpp b/chassishandler.cpp +index 1738ccc..e4e842d 100644 +--- a/chassishandler.cpp ++++ b/chassishandler.cpp +@@ -824,44 +824,65 @@ std::optional getPowerRestorePolicy() + */ + std::optional getPowerStatus() + { +- constexpr const char* powerControlObj = +- "/xyz/openbmc_project/Chassis/Control/Power0"; +- constexpr const char* powerControlIntf = +- "xyz.openbmc_project.Chassis.Control.Power"; + bool powerGood = false; + std::shared_ptr busp = getSdBus(); + try + { ++ constexpr const char* chassisStatePath = ++ "/xyz/openbmc_project/state/chassis0"; ++ constexpr const char* chassisStateIntf = ++ "xyz.openbmc_project.State.Chassis"; + auto service = +- ipmi::getService(*busp, powerControlIntf, powerControlObj); ++ ipmi::getService(*busp, chassisStateIntf, chassisStatePath); + +- ipmi::Value variant = ipmi::getDbusProperty( +- *busp, service, powerControlObj, powerControlIntf, "pgood"); +- powerGood = static_cast(std::get(variant)); ++ ipmi::Value variant = ++ ipmi::getDbusProperty(*busp, service, chassisStatePath, ++ chassisStateIntf, "CurrentPowerState"); ++ std::string powerState = std::get(variant); ++ if (powerState == "xyz.openbmc_project.State.Chassis.PowerState.On") ++ { ++ powerGood = true; ++ } + } + catch (const std::exception& e) + { + try + { +- // FIXME: some legacy modules use the older path; try that next +- constexpr const char* legacyPwrCtrlObj = +- "/org/openbmc/control/power0"; +- constexpr const char* legacyPwrCtrlIntf = +- "org.openbmc.control.Power"; ++ // FIXME: some modules use pgood; try that next ++ constexpr const char* powerControlObj = ++ "/xyz/openbmc_project/Chassis/Control/Power0"; ++ constexpr const char* powerControlIntf = ++ "xyz.openbmc_project.Chassis.Control.Power"; + auto service = +- ipmi::getService(*busp, legacyPwrCtrlIntf, legacyPwrCtrlObj); ++ ipmi::getService(*busp, powerControlIntf, powerControlObj); + + ipmi::Value variant = ipmi::getDbusProperty( +- *busp, service, legacyPwrCtrlObj, legacyPwrCtrlIntf, "pgood"); ++ *busp, service, powerControlObj, powerControlIntf, "pgood"); + powerGood = static_cast(std::get(variant)); + } + catch (const std::exception& e) + { +- log("Failed to fetch pgood property", +- entry("ERROR=%s", e.what()), +- entry("PATH=%s", powerControlObj), +- entry("INTERFACE=%s", powerControlIntf)); +- return std::nullopt; ++ try ++ { ++ // FIXME: some legacy modules use the older path; try that next ++ constexpr const char* legacyPwrCtrlObj = ++ "/org/openbmc/control/power0"; ++ constexpr const char* legacyPwrCtrlIntf = ++ "org.openbmc.control.Power"; ++ auto service = ipmi::getService(*busp, legacyPwrCtrlIntf, ++ legacyPwrCtrlObj); ++ ++ ipmi::Value variant = ++ ipmi::getDbusProperty(*busp, service, legacyPwrCtrlObj, ++ legacyPwrCtrlIntf, "pgood"); ++ powerGood = static_cast(std::get(variant)); ++ } ++ catch (const std::exception& e) ++ { ++ log("Failed to fetch pgood property", ++ entry("ERROR=%s", e.what())); ++ return std::nullopt; ++ } + } + } + return std::make_optional(powerGood); +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch new file mode 100644 index 000000000..498233881 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch @@ -0,0 +1,214 @@ +From f11928c6b39052c679c9300e9d836837ef60be06 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" +Date: Mon, 3 Jun 2019 17:01:47 -0700 +Subject: [PATCH] Update IPMI Chassis Control command + +This change updates the IPMI Chassis Control command to use the new +chassis state transitions. This allows each chassis control action +to more closely follow the behavior defined in the IPMI spec. + +Tested: +Ran each IPMI chassis control command to confirm the expected +behavior: +ipmitool power on: system is powered-on +ipmitool power off: system is forced off +ipmitool power cycle: system is forced off then powered-on +ipmitool power reset: system is hard reset +ipmitool power soft: soft power-off requested from system software + +Change-Id: Ic9fba3ca4abd9a758eb88f1e6ee09f7ca64ff80a +Signed-off-by: Jason M. Bills +--- + chassishandler.cpp | 138 +++++++++++++++++++++-------------------------------- + 1 file changed, 54 insertions(+), 84 deletions(-) + +diff --git a/chassishandler.cpp b/chassishandler.cpp +index e4e842d..d71b95f 100644 +--- a/chassishandler.cpp ++++ b/chassishandler.cpp +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -712,59 +713,63 @@ ipmi_ret_t ipmi_set_chassis_cap(ipmi_netfn_t netfn, ipmi_cmd_t cmd, + //------------------------------------------ + // Calls into Host State Manager Dbus object + //------------------------------------------ +-int initiate_state_transition(State::Host::Transition transition) ++int initiateHostStateTransition(State::Host::Transition transition) + { + // OpenBMC Host State Manager dbus framework +- constexpr auto HOST_STATE_MANAGER_ROOT = "/xyz/openbmc_project/state/host0"; +- constexpr auto HOST_STATE_MANAGER_IFACE = "xyz.openbmc_project.State.Host"; +- constexpr auto DBUS_PROPERTY_IFACE = "org.freedesktop.DBus.Properties"; +- constexpr auto PROPERTY = "RequestedHostTransition"; ++ constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0"; ++ constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host"; + +- // sd_bus error +- int rc = 0; +- char* busname = NULL; ++ auto service = ipmi::getService(*getSdBus(), hostStateIntf, hostStatePath); + +- // SD Bus error report mechanism. +- sd_bus_error bus_error = SD_BUS_ERROR_NULL; ++ // Convert to string equivalent of the passed in transition enum. ++ auto request = State::convertForMessage(transition); + +- // Gets a hook onto either a SYSTEM or SESSION bus +- sd_bus* bus_type = ipmid_get_sd_bus_connection(); +- rc = mapper_get_service(bus_type, HOST_STATE_MANAGER_ROOT, &busname); +- if (rc < 0) ++ try ++ { ++ ipmi::setDbusProperty(*getSdBus(), service, hostStatePath, ++ hostStateIntf, "RequestedHostTransition", ++ request); ++ } ++ catch (std::exception& e) + { + log( +- "Failed to get bus name", +- entry("ERRNO=0x%X, OBJPATH=%s", -rc, HOST_STATE_MANAGER_ROOT)); +- return rc; ++ "Failed to initiate transition", ++ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); ++ return -1; + } ++ return 0; ++} ++ ++//------------------------------------------ ++// Calls into Chassis State Manager Dbus object ++//------------------------------------------ ++int initiateChassisStateTransition(State::Chassis::Transition transition) ++{ ++ // OpenBMC Chassis State Manager dbus framework ++ constexpr auto chassisStatePath = "/xyz/openbmc_project/state/chassis0"; ++ constexpr auto chassisStateIntf = "xyz.openbmc_project.State.Chassis"; ++ ++ auto service = ++ ipmi::getService(*getSdBus(), chassisStateIntf, chassisStatePath); + + // Convert to string equivalent of the passed in transition enum. + auto request = State::convertForMessage(transition); + +- rc = sd_bus_call_method(bus_type, // On the system bus +- busname, // Service to contact +- HOST_STATE_MANAGER_ROOT, // Object path +- DBUS_PROPERTY_IFACE, // Interface name +- "Set", // Method to be called +- &bus_error, // object to return error +- nullptr, // Response buffer if any +- "ssv", // Takes 3 arguments +- HOST_STATE_MANAGER_IFACE, PROPERTY, "s", +- request.c_str()); +- if (rc < 0) ++ try + { +- log("Failed to initiate transition", +- entry("ERRNO=0x%X, REQUEST=%s", -rc, request.c_str())); ++ ipmi::setDbusProperty(*getSdBus(), service, chassisStatePath, ++ chassisStateIntf, "RequestedPowerTransition", ++ request); + } +- else ++ catch (std::exception& e) + { +- log("Transition request initiated successfully"); ++ log( ++ "Failed to initiate transition", ++ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); ++ return -1; + } + +- sd_bus_error_free(&bus_error); +- free(busname); +- +- return rc; ++ return 0; + } + + namespace power_policy +@@ -1138,61 +1143,26 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) + switch (chassisControl) + { + case CMD_POWER_ON: +- rc = initiate_state_transition(State::Host::Transition::On); ++ rc = initiateHostStateTransition(State::Host::Transition::On); + break; + case CMD_POWER_OFF: +- // This path would be hit in 2 conditions. +- // 1: When user asks for power off using ipmi chassis command 0x04 +- // 2: Host asking for power off post shutting down. +- +- // If it's a host requested power off, then need to nudge Softoff +- // application that it needs to stop the watchdog timer if running. +- // If it is a user requested power off, then this is not really +- // needed. But then we need to differentiate between user and host +- // calling this same command +- +- // For now, we are going ahead with trying to nudge the soft off and +- // interpret the failure to do so as a non softoff case +- rc = stop_soft_off_timer(); +- +- // Only request the Off transition if the soft power off +- // application is not running +- if (rc < 0) +- { +- // First create a file to indicate to the soft off application +- // that it should not run. Not doing this will result in State +- // manager doing a default soft power off when asked for power +- // off. +- indicate_no_softoff_needed(); +- +- // Now request the shutdown +- rc = initiate_state_transition(State::Host::Transition::Off); +- } +- else +- { +- log("Soft off is running, so let shutdown target " +- "stop the host"); +- } ++ rc = ++ initiateChassisStateTransition(State::Chassis::Transition::Off); + break; +- + case CMD_HARD_RESET: ++ rc = initiateChassisStateTransition( ++ State::Chassis::Transition::Reset); ++ break; + case CMD_POWER_CYCLE: +- // SPEC has a section that says certain implementations can trigger +- // PowerOn if power is Off when a command to power cycle is +- // requested +- +- // First create a file to indicate to the soft off application +- // that it should not run since this is a direct user initiated +- // power reboot request (i.e. a reboot request that is not +- // originating via a soft power off SMS request) +- indicate_no_softoff_needed(); +- +- rc = initiate_state_transition(State::Host::Transition::Reboot); ++ rc = initiateChassisStateTransition( ++ State::Chassis::Transition::PowerCycle); + break; +- + case CMD_SOFT_OFF_VIA_OVER_TEMP: +- // Request Host State Manager to do a soft power off +- rc = initiate_state_transition(State::Host::Transition::Off); ++ rc = initiateHostStateTransition(State::Host::Transition::Off); ++ break; ++ case CMD_PULSE_DIAGNOSTIC_INTR: ++ rc = ++ initiateHostStateTransition(State::Host::Transition::Interrupt); + break; + + default: +-- +2.7.4 + -- cgit v1.2.3