From 2d392adf8491fbc6a75d160bbc41755a54da7921 Mon Sep 17 00:00:00 2001 From: George Hung Date: Tue, 14 Jul 2020 20:58:04 +0800 Subject: meta-quanta: gbs: add YAML paths/whitelist config/watchdog patch 1. set gbs YAML config paths for sensors and FRUs 2. add gbs IPMI whitelist config 3. add pre-timeout interrupt patch for IPMI watchdog commands (From meta-quanta rev: fee51df037779d09b18d2ae0e7c864182d40c43c) Signed-off-by: George Hung Change-Id: I06decf7f95ebd25153cefa7a12be45bbde63aee6 Signed-off-by: Andrew Geissler --- ...he-pre-timeout-interrupt-in-dbus-property.patch | 138 +++++++++++++++++++++ .../phosphor-ipmi-host/gbs-ipmid-whitelist.conf | 79 ++++++++++++ .../ipmi/phosphor-ipmi-host_%.bbappend | 18 +++ 3 files changed, 235 insertions(+) create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch new file mode 100644 index 000000000..d815cde72 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch @@ -0,0 +1,138 @@ +From 9deb72959477700216326c033c930236e58f965f Mon Sep 17 00:00:00 2001 +From: Ren Yu +Date: Tue, 28 May 2019 17:11:17 +0800 +Subject: [PATCH] Save the pre-timeout interrupt in dbus property + +Get the watchdog pre-timeout interrupt value from ipmi watchdog set command, +and store it into dbus property. + +Tested: +Config IPMI watchdog: BIOS FRB2 Power Cycle after 1 seconds: +ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00 +Start watchdog: +Ipmitool mc watchdog reset +Check the watchdog pre-timeout interrupt in below: +https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries + +Signed-off-by: Ren Yu + +--- + app/watchdog.cpp | 47 ++++++++++++++++++++++++++++++++++++++++ + app/watchdog_service.cpp | 6 +++++ + app/watchdog_service.hpp | 9 ++++++++ + 3 files changed, 62 insertions(+) + +diff --git a/app/watchdog.cpp b/app/watchdog.cpp +index 03c373e..cb0b1fd 100644 +--- a/app/watchdog.cpp ++++ b/app/watchdog.cpp +@@ -80,6 +80,7 @@ ipmi::RspType<> ipmiAppResetWatchdogTimer() + + static constexpr uint8_t wd_dont_stop = 0x1 << 6; + static constexpr uint8_t wd_timeout_action_mask = 0x3; ++static constexpr uint8_t wdPreTimeoutInterruptMask = 0x3; + + static constexpr uint8_t wdTimerUseResTimer1 = 0x0; + static constexpr uint8_t wdTimerUseResTimer2 = 0x6; +@@ -127,6 +128,45 @@ WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmi_action) + } + } + ++enum class IpmiPreTimeoutInterrupt : uint8_t ++{ ++ None = 0x0, ++ SMI = 0x1, ++ NMI = 0x2, ++ MI = 0x3, ++}; ++/** @brief Converts an IPMI Watchdog PreTimeoutInterrupt to DBUS defined action ++ * @param[in] ipmi_action The IPMI Watchdog PreTimeoutInterrupt ++ * @return The Watchdog PreTimeoutInterrupt that the ipmi_action maps to ++ */ ++WatchdogService::PreTimeoutInterruptAction ipmiPreTimeoutInterruptToWdAction( ++ IpmiPreTimeoutInterrupt ipmiPreTimeOutInterrupt) ++{ ++ switch (ipmiPreTimeOutInterrupt) ++ { ++ case IpmiPreTimeoutInterrupt::None: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::None; ++ } ++ case IpmiPreTimeoutInterrupt::SMI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::SMI; ++ } ++ case IpmiPreTimeoutInterrupt::NMI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::NMI; ++ } ++ case IpmiPreTimeoutInterrupt::MI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::MI; ++ } ++ default: ++ { ++ throw std::domain_error("IPMI PreTimeoutInterrupt is invalid"); ++ } ++ } ++} ++ + enum class IpmiTimerUse : uint8_t + { + Reserved = 0x0, +@@ -250,6 +290,13 @@ ipmi::RspType<> + // Mark as initialized so that future resets behave correctly + wd_service.setInitialized(true); + ++ // pretimeOutAction ++ const auto ipmiPreTimeoutInterrupt = ++ static_cast(wdPreTimeoutInterruptMask & ++ (static_cast(preTimeoutInterrupt))); ++ wd_service.setPreTimeoutInterrupt( ++ ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt)); ++ + lastCallSuccessful = true; + return ipmi::responseSuccess(); + } +diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp +index 3534e89..4df1ab6 100644 +--- a/app/watchdog_service.cpp ++++ b/app/watchdog_service.cpp +@@ -198,3 +198,9 @@ void WatchdogService::setInterval(uint64_t interval) + { + setProperty("Interval", interval); + } ++ ++void WatchdogService::setPreTimeoutInterrupt( ++ PreTimeoutInterruptAction preTimeoutInterrupt) ++{ ++ setProperty("PreTimeoutInterrupt", convertForMessage(preTimeoutInterrupt)); ++} +\ No newline at end of file +diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp +index 141bdb7..32b7461 100644 +--- a/app/watchdog_service.hpp ++++ b/app/watchdog_service.hpp +@@ -15,6 +15,8 @@ class WatchdogService + + using Action = + sdbusplus::xyz::openbmc_project::State::server::Watchdog::Action; ++ using PreTimeoutInterruptAction = sdbusplus::xyz::openbmc_project::State:: ++ server::Watchdog::PreTimeoutInterruptAction; + using TimerUse = + sdbusplus::xyz::openbmc_project::State::server::Watchdog::TimerUse; + +@@ -92,6 +94,13 @@ class WatchdogService + */ + void setInterval(uint64_t interval); + ++ /** @brief Sets the value of the PreTimeoutInterrupt property on the host ++ * watchdog ++ * ++ * @param[in] PreTimeoutInterrupt - The new PreTimeoutInterrupt value ++ */ ++ void setPreTimeoutInterrupt(PreTimeoutInterruptAction preTimeoutInterrupt); ++ + private: + /** @brief sdbusplus handle */ + sdbusplus::bus::bus bus; diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf new file mode 100644 index 000000000..359c7dbeb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf @@ -0,0 +1,79 @@ +#: +0x00:0x00 //: +0x00:0x01 //: +0x00:0x02 //: +0x00:0x04 //: +0x00:0x05 //: +0x00:0x06 //: +0x00:0x08 //: +0x00:0x09 //: +0x00:0x0F //: +0x04:0x02 //: +0x04:0x20 //: +0x04:0x21 //: +0x04:0x22 //: +0x04:0x27 //: +0x04:0x29 //: +0x04:0x2B //: +0x04:0x2D //: +0x04:0x2F //: +0x04:0x30 //: +0x06:0x01 //: +0x06:0x02 //: +0x06:0x03 //: +0x06:0x04 //: +0x06:0x06 //: +0x06:0x07 //: +0x06:0x08 //: +0x06:0x22 //: +0x06:0x24 //: +0x06:0x25 //: +0x06:0x35 //: +0x06:0x3D //: +0x06:0x40 //: +0x06:0x41 //: +0x06:0x42 //: +0x06:0x43 //: +0x06:0x44 //: +0x06:0x45 //: +0x06:0x46 //: +0x06:0x47 //: +0x06:0x48 //: +0x06:0x49 //: +0x06:0x4A //: +0x06:0x4B //: +0x06:0x54 //: +0x06:0x58 //: +0x06:0x59 //: +0x0A:0x10 //: +0x0A:0x11 //: +0x0A:0x20 //: +0x0A:0x22 //: +0x0A:0x23 //: +0x0A:0x40 //: +0x0A:0x42 //: +0x0A:0x43 //: +0x0A:0x44 //: +0x0A:0x46 //: +0x0A:0x47 //: +0x0A:0x48 //: +0x0A:0x49 //: +0x0C:0x01 //: +0x0C:0x02 //: +0x2C:0x00 //: +0x2C:0x01 //: +0x2C:0x02 //: +0x2C:0x03 //: +0x2C:0x06 //: +0x2C:0x07 //: +0x2C:0x09 //: +0x2C:0x0A //: +0x2C:0x10 //: +0x2C:0x12 //: +0x2C:0x13 //: +0x2C:0x3E //: +0x2E:0x02 //: +0x2E:0x04 //: +0x2E:0x30 //: +0x2E:0x32 //: +0x2E:0x80 //: 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 new file mode 100644 index 000000000..a19702223 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -0,0 +1,18 @@ +DEPENDS_append_gbs = " gbs-yaml-config" + +SRC_URI_remove_gbs = "git://github.com/openbmc/phosphor-host-ipmid" +SRC_URI_prepend_gbs = "git://github.com/quanta-bmc/phosphor-host-ipmid.git" + +SRCREV_gbs = "675d587abd8b068aa1816176221237ac6172a0bc" + +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \ + file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ + " + +WHITELIST_CONF_gbs = "${WORKDIR}/gbs-ipmid-whitelist.conf" + +EXTRA_OECONF_append_gbs = " --with-journal-sel \ + SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-sensors.yaml \ + FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-fru-read.yaml \ + " -- cgit v1.2.3