From 1d7fe62be329e47b0e7baeb0f06ba077b0fe5ab8 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 3 Jun 2021 17:17:53 +0800 Subject: meta-quanta: gbs: remove patches for phosphor-ipmi-host remove patches: - Update IPMI Chassis Control command transition requests - Add Chassis State Transition interface - Update Host State Transition function - Fix issues and support signed sensor values Signed-off-by: George Hung Change-Id: I8f9f7d576ef7f7672bedf803ee73f331f96768ff --- ...01-Add-Chassis-State-Transition-interface.patch | 79 --------- ...x-issues-and-support-signed-sensor-values.patch | 169 ------------------- ...002-Update-Host-State-Transition-function.patch | 137 ---------------- ...-Chassis-Control-command-transition-reque.patch | 180 --------------------- .../ipmi/phosphor-ipmi-host_%.bbappend | 7 +- 5 files changed, 1 insertion(+), 571 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch (limited to 'meta-quanta/meta-gbs') diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch deleted file mode 100644 index 74f982b33..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a1f9d797753e32b36e08e7d611ff88b10e9bbad2 Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" -Date: Thu, 30 Jan 2020 16:18:33 -0800 -Subject: [PATCH 1/3] Add Chassis State Transition interface - -This adds the Chassis State Transition interface in preparation -to support the mapping defined in the design document below. - -ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 - -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: I6acfb795a9a33ff5227a5d6e1830774ab732ac0c -Signed-off-by: Jason M. Bills ---- - chassishandler.cpp | 33 +++++++++++++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index 0d318647..fdbb9fa5 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -865,6 +866,38 @@ int initiate_state_transition(State::Host::Transition transition) - return rc; - } - -+//------------------------------------------ -+// 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); -+ -+ try -+ { -+ ipmi::setDbusProperty(*getSdBus(), service, chassisStatePath, -+ chassisStateIntf, "RequestedPowerTransition", -+ request); -+ } -+ catch (std::exception& e) -+ { -+ log( -+ "Failed to initiate transition", -+ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); -+ return -1; -+ } -+ -+ return 0; -+} -+ - //------------------------------------------ - // Set Enabled property to inform NMI source - // handling to trigger a NMI_OUT BSOD. --- -2.21.0 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch deleted file mode 100644 index 6d13f9297..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 8ce91a760fca8c945540679c92770f841629e179 Mon Sep 17 00:00:00 2001 -From: Tony Lee -Date: Thu, 31 Oct 2019 17:24:16 +0800 -Subject: [PATCH] Fix issues and support signed sensor values - -Sensor will get "disable" when the command "ipmitool sdr elist" is -executed that if sensorReadingType is 0x6F. - -sensor_units_1 is always set to 0 currently. To support the display of -signed sensor values, we add the attribute "sensorUnits1" to the sensor -mapping yaml. This attribute can be used to determine whether the -sensor is signed. - -It were making negative values 0 in get::readingData(). Fix the issue -by using a int32_t and add an overflow check. - -Change-Id: I705defcf18805db9ada7d0de0738a59aedab61df -Signed-off-by: Tony Lee ---- - include/ipmid/types.hpp | 2 ++ - scripts/sensor-example.yaml | 2 ++ - scripts/writesensor.mako.cpp | 2 ++ - sensordatahandler.cpp | 2 -- - sensordatahandler.hpp | 31 ++++++++++++++++++++++++++++--- - sensorhandler.cpp | 5 ++--- - 6 files changed, 36 insertions(+), 8 deletions(-) - -diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp -index e62c8192..bd1fac2b 100644 ---- a/include/ipmid/types.hpp -+++ b/include/ipmid/types.hpp -@@ -133,6 +133,7 @@ using Unit = std::string; - using EntityType = uint8_t; - using EntityInst = uint8_t; - using SensorName = std::string; -+using SensorUnits1 = uint8_t; - - enum class Mutability - { -@@ -167,6 +168,7 @@ struct Info - Exponent exponentR; - bool hasScale; - Scale scale; -+ SensorUnits1 sensorUnits1; - Unit unit; - std::function updateFunc; - std::function getFunc; -diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml -index 9760cd01..bddd2e6d 100644 ---- a/scripts/sensor-example.yaml -+++ b/scripts/sensor-example.yaml -@@ -112,6 +112,8 @@ - # Applies for analog sensors, the actual reading value for the sensor is - # Value * 10^N - scale: -3 -+ # Indicate Analog Data Format, Rate unit, Modifier unit and Percentage -+ sensorUnits1 : 0x80 - mutability: Mutability::Write|Mutability::Read - serviceInterface: org.freedesktop.DBus.Properties - readingType: readingData -diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp -index 8b268052..813f9404 100644 ---- a/scripts/writesensor.mako.cpp -+++ b/scripts/writesensor.mako.cpp -@@ -49,6 +49,7 @@ extern const IdInfoMap sensors = { - offsetB = sensor.get("offsetB", 0) - bExp = sensor.get("bExp", 0) - rExp = sensor.get("rExp", 0) -+ sensorUnits1 = sensor.get("sensorUnits1", 0) - unit = sensor.get("unit", "") - scale = sensor.get("scale", 0) - hasScale = "true" if "scale" in sensor.keys() else "false" -@@ -91,6 +92,7 @@ extern const IdInfoMap sensors = { - .exponentR = ${rExp}, - .hasScale = ${hasScale}, - .scale = ${scale}, -+ .sensorUnits1 = ${sensorUnits1}, - .unit = "${unit}", - .updateFunc = ${updateFunc}, - .getFunc = ${getFunc}, -diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp -index 06f5f429..fc74b8f8 100644 ---- a/sensordatahandler.cpp -+++ b/sensordatahandler.cpp -@@ -7,8 +7,6 @@ - #include - #include - #include --#include --#include - #include - #include - -diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp -index 5cad58c5..c48140a3 100644 ---- a/sensordatahandler.hpp -+++ b/sensordatahandler.hpp -@@ -8,6 +8,8 @@ - #include - #include - #include -+#include -+#include - #include - - namespace ipmi -@@ -28,6 +30,7 @@ using ServicePath = std::pair; - using Interfaces = std::vector; - - using MapperResponseType = std::map>; -+using namespace phosphor::logging; - - /** @brief get the D-Bus service and service path - * @param[in] bus - The Dbus bus object -@@ -225,10 +228,32 @@ GetSensorResponse readingData(const Info& sensorInfo) - - double value = std::get(propValue) * - std::pow(10, sensorInfo.scale - sensorInfo.exponentR); -+ int32_t rawData = -+ (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM; - -- auto rawData = static_cast((value - sensorInfo.scaledOffset) / -- sensorInfo.coefficientM); -- setReading(rawData, &response); -+ constexpr uint8_t sensorUnitsSignedBits = 2 << 6; -+ constexpr uint8_t signedDataFormat = 0x80; -+ // if sensorUnits1 [7:6] = 10b, sensor is signed -+ if ((sensorInfo.sensorUnits1 & sensorUnitsSignedBits) == signedDataFormat) -+ { -+ if (rawData > std::numeric_limits::max() || -+ rawData < std::numeric_limits::lowest()) -+ { -+ log("Value out of range"); -+ throw std::out_of_range("Value out of range"); -+ } -+ setReading(static_cast(rawData), &response); -+ } -+ else -+ { -+ if (rawData > std::numeric_limits::max() || -+ rawData < std::numeric_limits::lowest()) -+ { -+ log("Value out of range"); -+ throw std::out_of_range("Value out of range"); -+ } -+ setReading(static_cast(rawData), &response); -+ } - - return response; - } -diff --git a/sensorhandler.cpp b/sensorhandler.cpp -index 36998715..260331a0 100644 ---- a/sensorhandler.cpp -+++ b/sensorhandler.cpp -@@ -700,9 +700,8 @@ ipmi_ret_t populate_record_from_dbus(get_sdr::SensorDataFullRecordBody* body, - /* Functional sensor case */ - if (isAnalogSensor(info->propertyInterfaces.begin()->first)) - { -- -- body->sensor_units_1 = 0; // unsigned, no rate, no modifier, not a % -- -+ body->sensor_units_1 = info->sensorUnits1; // default is 0. unsigned, no -+ // rate, no modifier, not a % - /* Unit info */ - setUnitFieldsForObject(info, body); - --- -2.21.0 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch deleted file mode 100644 index 156327b9c..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 8079e1e39e1953458bd2e59c7f546a3d879558db Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" -Date: Thu, 30 Jan 2020 16:02:39 -0800 -Subject: [PATCH 2/3] Update Host State Transition function - -This updates the Host State Transition function to use the new -IPMI DBus APIs for transition requests. - -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: Id2253a9c0060e892bc318dd02a6221ac1a2ae2d9 -Signed-off-by: Jason M. Bills ---- - chassishandler.cpp | 64 +++++++++++++--------------------------------- - 1 file changed, 18 insertions(+), 46 deletions(-) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index fdbb9fa5..af9cba72 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -811,59 +811,31 @@ ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout, - //------------------------------------------ - // 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; -- -- // SD Bus error report mechanism. -- sd_bus_error bus_error = SD_BUS_ERROR_NULL; -- -- // 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) -- { -- log( -- "Failed to get bus name", -- entry("ERRNO=0x%X, OBJPATH=%s", -rc, HOST_STATE_MANAGER_ROOT)); -- return rc; -- } -+ auto service = ipmi::getService(*getSdBus(), hostStateIntf, hostStatePath); - - // 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, hostStatePath, -+ hostStateIntf, "RequestedHostTransition", -+ 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; - } - - //------------------------------------------ -@@ -1411,7 +1383,7 @@ 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. -@@ -1439,7 +1411,7 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) - indicate_no_softoff_needed(); - - // Now request the shutdown -- rc = initiate_state_transition(State::Host::Transition::Off); -+ rc = initiateHostStateTransition(State::Host::Transition::Off); - } - else - { -@@ -1460,12 +1432,12 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) - // originating via a soft power off SMS request) - indicate_no_softoff_needed(); - -- rc = initiate_state_transition(State::Host::Transition::Reboot); -+ rc = initiateHostStateTransition(State::Host::Transition::Reboot); - 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: --- -2.21.0 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch deleted file mode 100644 index 271af3f5b..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 291629d5c3e5bea31925c9d025688897c90eb783 Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" -Date: Thu, 30 Jan 2020 16:22:24 -0800 -Subject: [PATCH 3/3] Update IPMI Chassis Control command transition requests - -This change updates the IPMI Chassis Control command to use the new -host state transitions and chassis off transition based on the -mapping in the design document below. This allows each chassis -control action to more closely follow the behavior defined in the -IPMI spec. - -ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 - -Tested: -Ran each IPMI chassis control command to confirm the expected -behavior: -ipmitool power on: system is powered-on using Host.On -ipmitool power off: system is forced off using Chassis.Off -ipmitool power cycle: system is forced off then powered-on using - Host.Reboot -ipmitool power reset: system is hard reset using Host.ForceWarmReboot -ipmitool power soft: soft power-off requested from system software - using Host.Off - -Change-Id: Ieb42722102fde0e51a49dc4aaa3ff227a3394066 -Signed-off-by: Jason M. Bills ---- - chassishandler.cpp | 121 ++------------------------------------------- - 1 file changed, 5 insertions(+), 116 deletions(-) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index af9cba72..663081de 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -1301,76 +1301,6 @@ ipmi::RspType("Failed to set property in SoftPowerOff object", -- entry("ERRNO=0x%X", -rc)); -- } -- -- // TODO openbmc/openbmc#1661 - Mapper refactor -- // free(busname); -- return rc; --} -- --//---------------------------------------------------------------------- --// Create file to indicate there is no need for softoff notification to host --//---------------------------------------------------------------------- --void indicate_no_softoff_needed() --{ -- fs::path path{HOST_INBAND_REQUEST_DIR}; -- if (!fs::is_directory(path)) -- { -- fs::create_directory(path); -- } -- -- // Add the host instance (default 0 for now) to the file name -- std::string file{HOST_INBAND_REQUEST_FILE}; -- auto size = std::snprintf(nullptr, 0, file.c_str(), 0); -- size++; // null -- std::unique_ptr buf(new char[size]); -- std::snprintf(buf.get(), size, file.c_str(), 0); -- -- // Append file name to directory and create it -- path /= buf.get(); -- std::ofstream(path.c_str()); --} -- - /** @brief Implementation of chassis control command - * - * @param - chassisControl command byte -@@ -1386,60 +1316,19 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) - 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 = initiateHostStateTransition(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 = initiateHostStateTransition( -+ State::Host::Transition::ForceWarmReboot); -+ 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 = initiateHostStateTransition(State::Host::Transition::Reboot); - break; -- - case CMD_SOFT_OFF_VIA_OVER_TEMP: -- // Request Host State Manager to do a soft power off - rc = initiateHostStateTransition(State::Host::Transition::Off); - break; -- - case CMD_PULSE_DIAGNOSTIC_INTR: - rc = setNmiProperty(true); - break; --- -2.21.0 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index af5fb1356..78fa57039 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -1,12 +1,7 @@ DEPENDS_append_gbs = " gbs-yaml-config" FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" -SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \ - file://0001-Add-Chassis-State-Transition-interface.patch \ - file://0002-Update-Host-State-Transition-function.patch \ - file://0003-Update-IPMI-Chassis-Control-command-transition-reque.patch \ - file://0001-Fix-issues-and-support-signed-sensor-values.patch \ - " +SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf" WHITELIST_CONF_gbs = "${WORKDIR}/gbs-ipmid-whitelist.conf" -- cgit v1.2.3