From 456380bb272d3a301c887eee513a3937cc1f48e1 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Tue, 22 Oct 2019 14:01:54 -0700 Subject: Update to internal 10-22-19 Signed-off-by: Jason M. Bills --- .../recipes-phosphor/beepcode-mgr/beepcode-mgr.bb | 2 +- .../configuration/entity-manager_%.bbappend | 2 +- ...ost-code-interfaces-for-post-code-manager.patch | 64 --- ...-Intf-Security-modes-property-intf-update.patch | 80 ---- .../dbus/phosphor-dbus-interfaces_%.bbappend | 7 +- .../fans/phosphor-pid-control_%.bbappend | 2 +- .../0007-PFR-images-support.patch | 435 +++++++++++++++++++++ .../flash/phosphor-software-manager_%.bbappend | 3 + .../recipes-phosphor/fru/default-fru.bb | 30 ++ .../fru/default-fru/CMakeLists.txt | 7 + .../fru/default-fru/SetBaseboardFru.service | 9 + .../recipes-phosphor/fru/default-fru/checkFru.sh | 44 +++ .../recipes-phosphor/fru/default-fru/mkfru.cpp | 219 +++++++++++ .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 5 +- .../ipmi/phosphor-ipmi-config/channel_config.json | 6 +- .../0009-IPv6-Network-changes.patch | 170 ++++---- .../0057-Add-timer-use-actions-support.patch | 190 +-------- ...ve-Set-SOL-config-parameter-to-host-ipmid.patch | 132 +++---- ...he-pre-timeout-interrupt-in-dbus-property.patch | 4 +- ...hdog-to-save-useflag-after-host-power-off.patch | 57 ++- ...NID-should-be-1-4095-as-in-802.1VLAN-spec.patch | 44 --- .../phosphor-ipmi-host/host-ipmid-whitelist.conf | 198 ++++++++-- .../ipmi/phosphor-ipmi-host_%.bbappend | 13 +- .../ipmi/phosphor-ipmi-net_%.bbappend | 2 +- .../ipmi/phosphor-node-manager-proxy_git.bb | 2 +- .../phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb | 2 +- .../preinit-mounts/preinit-mounts/init | 33 +- .../prov-mode-mgr/prov-mode-mgr_git.bb | 2 +- .../sel-logger/phosphor-sel-logger_%.bbappend | 2 +- ...nable-disable-control-code-into-cpusensor.patch | 50 --- .../sensors/dbus-sensors_%.bbappend | 5 +- .../recipes-phosphor/settings/settings_git.bb | 2 +- .../special-mode-mgr/special-mode-mgr_git.bb | 2 +- .../srvcfg-manager/srvcfg-manager_git.bb | 2 +- .../0001-Implement-post-code-manager.patch | 8 +- .../recipes-phosphor/system/callback-manager.bb | 2 +- .../virtual-media/virtual-media.bb | 4 +- .../recipes-phosphor/watchdog/frb2-watchdog.bb | 2 +- ...ize-phosphor-watchdog-for-Intel-platforms.patch | 316 +++++++++++++++ ...hosphor-Watchdog-to-Not-Use-Service-Files.patch | 198 ---------- ...he-watchdog-when-the-host-is-going-to-off.patch | 118 ------ ...-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch | 45 --- ...-watchdog-redfish-format-according-to-EPS.patch | 211 ---------- .../watchdog/phosphor-watchdog_%.bbappend | 5 +- .../recipes-phosphor/watchdog/system-watchdog.bb | 8 + .../system-watchdog/watchdog-reset.service | 3 +- .../watchdog/system-watchdog/watchdog-reset.sh | 13 + ...orce-boot-to-bios-in-server-power-control.patch | 176 --------- .../webui/phosphor-webui_%.bbappend | 8 +- 49 files changed, 1514 insertions(+), 1430 deletions(-) delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service create mode 100755 meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor') diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb index 347ba7cdd..1bf81d953 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb @@ -9,7 +9,7 @@ SRC_URI = "\ PV = "0.1" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" S = "${WORKDIR}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index 080ae9f58..7819c90f6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,6 +1,6 @@ # this is here just to bump faster than upstream SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "fff050a355041d2848b8a126a19a6cb81daebe6b" +SRCREV = "978fcadadc8320ff5356ed1a5dc25e3284e3745f" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch deleted file mode 100644 index ce23c222b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f88cac8364d5312e29208018909827d2da4a0f87 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Tue, 19 Feb 2019 16:52:51 +0800 -Subject: [PATCH] Define post code interfaces for post code manager - -It includes one method and 2 properties. -properties: - - name: CurrentBootCycleIndex - description: > - It is used to indicate current boot cycle index. - - name: MaxBootCycleNum - description: > - The max cached boot cycles for post code. -methods: - - name: GetPostCodes - description: > - Method to get the cached post code for each boot cycle. -TestBy: bitbake build - -Signeoff-by: Kuiying Wang ---- - .../State/Boot/PostCode.interface.yaml | 30 ++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - create mode 100644 xyz/openbmc_project/State/Boot/PostCode.interface.yaml - -diff --git a/xyz/openbmc_project/State/Boot/PostCode.interface.yaml b/xyz/openbmc_project/State/Boot/PostCode.interface.yaml -new file mode 100644 -index 0000000..711749d ---- /dev/null -+++ b/xyz/openbmc_project/State/Boot/PostCode.interface.yaml -@@ -0,0 +1,30 @@ -+description: > -+ Monitor Post code coming and buffer all of them based on boot cycle -+ into file system. -+ -+properties: -+ - name: CurrentBootCycleIndex -+ type: uint16 -+ description: > -+ It is used to indicate current boot cycle index. -+ - name: MaxBootCycleNum -+ type: uint16 -+ description: > -+ The max cached boot cycles for post code. -+methods: -+ - name: GetPostCodes -+ description: > -+ Method to get the cached post code for each boot cycle. -+ parameters: -+ - name: Index -+ type: uint16 -+ description: > -+ Index indicates which boot cycle of post codes is requested. -+ returns: -+ - name: codes -+ type: array[uint64] -+ description: > -+ An array of post codes of one boot cycle. -+ errors: -+ - xyz.openbmc_project.Common.Error.InternalFailure -+ - xyz.openbmc_project.Common.Error.InvalidArgument --- -2.16.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch deleted file mode 100644 index 62d5376d6..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 9b0630f40c7fb1143901f7d114c376426cc03501 Mon Sep 17 00:00:00 2001 -From: Richard Marian Thomaiyar -Date: Sat, 15 Jun 2019 01:04:41 +0530 -Subject: [PATCH] [D-Bus Intf] Security modes property & intf update - -Defined new values for RestrictionMode property and defined -SpecialMode interfaces to handle special cases like manufacturing -and validation mode in OpenBMC. - -Note: Please refer Security mode design doc under review for more -details -https://gerrit.openbmc-project.xyz/#/c/openbmc/docs/+/21195/ - -Change-Id: I270e7d23ca2ed260f2d121e3844c2ca79150070e -Signed-off-by: Richard Marian Thomaiyar ---- - .../Security/RestrictionMode.interface.yaml | 16 +++++++++++++ - .../Control/Security/SpecialMode.interface.yaml | 26 ++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - create mode 100644 xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml - -diff --git a/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml b/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -index 8e4fd8d..afd2279 100644 ---- a/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -+++ b/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -@@ -21,3 +21,19 @@ enumerations: - - name: Blacklist - description: > - Prevent, if in the blacklist. -+ - name: Provisioning -+ description: > -+ Indicate that system is in provisioning mode -+ and all commands are allowed in system inteface -+ in both pre and post BIOS boot. -+ - name: ProvisionedHostWhitelist -+ description: > -+ Commands in the whitelist will only be executed -+ through system interface after BIOS POST complete. -+ All KCS commands are supported before POST complete. -+ - name: ProvisionedHostDisabled -+ description: > -+ Commands through system interface are executed only -+ till BIOS POST complete notification, after -+ which no system interface commands will be executed(other -+ than BIOS SMI based ones). -diff --git a/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml b/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml -new file mode 100644 -index 0000000..6760076 ---- /dev/null -+++ b/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml -@@ -0,0 +1,26 @@ -+description: > -+ Implement to specify a special mode of operation -+ -+properties: -+ - name: SpecialMode -+ type: enum[self.Modes] -+ description: > -+ The special mode. -+ -+enumerations: -+ - name: Modes -+ description: > -+ Possible modes available. -+ values: -+ - name: None -+ description: > -+ BMC is under normal working condition. -+ - name: Manufacturing -+ description: > -+ Indicate that BMC is in manufacturing mode -+ and is allowed to perform any manufacturing related -+ activity -+ - name: ValidationUnsecure -+ description: > -+ Indicate that BMC is in validation mode, and can -+ execute any special validation related commands --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend index 79a67ee79..c306e5afc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -1,5 +1,6 @@ -SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "ddc9e9f9d6ed0282ec6c1421a706b45f3c09ebcc" +# todo Johnathan, undo nobranch once phosphor-networking is working +SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git;nobranch=1" +SRCREV = "9cb4a711cff999b373cf98b44cc18b9001c1395a" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -9,8 +10,6 @@ SRC_URI += "file://0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch file://0012-Add-RestoreDelay-interface-for-power-restore-delay.patch \ file://0013-Add-ErrConfig.yaml-interface-for-processor-error-config.patch \ file://0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch \ - file://0018-Define-post-code-interfaces-for-post-code-manager.patch \ - file://0021-D-Bus-Intf-Security-modes-property-intf-update.patch \ file://0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch \ file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \ file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index 30044eb6e..842d89f03 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -5,6 +5,6 @@ SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "a7ec8350d17b70153cebe666d3fbe88bddd02a1a" +SRCREV = "6b9f59991b7f694866c98775b4179ae97c5e69a8" FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch new file mode 100644 index 000000000..34d5b6e67 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -0,0 +1,435 @@ +From 030f918b90ea45104bccf68082c2d634c6694238 Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy +Date: Tue, 13 Aug 2019 22:43:12 +0530 +Subject: [PATCH] PFR images support in phosphor-software-manager + +This commit adds support for handling the PFR images +upload and processing. + +Testing: +tested PFR image uploads and updates + +Signed-off-by: Vikram Bodireddy +--- + Makefile.am | 18 +++- + activation.cpp | 2 +- + configure.ac | 7 ++ + item_updater.cpp | 6 +- + pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ + pfr_image_manager.hpp | 75 +++++++++++++++ + 6 files changed, 320 insertions(+), 5 deletions(-) + create mode 100644 pfr_image_manager.cpp + create mode 100644 pfr_image_manager.hpp + +diff --git a/Makefile.am b/Makefile.am +index 6c3ec16..59ebecc 100755 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,13 +6,20 @@ noinst_HEADERS = \ + watch.hpp \ + version.hpp \ + images.hpp \ +- image_manager.hpp \ + item_updater.hpp \ + activation.hpp \ + flash.hpp \ + item_updater_helper.hpp \ + utils.hpp + ++if PFR_UPDATE ++noinst_HEADERS += \ ++ pfr_image_manager.hpp ++else ++noinst_HEADERS += \ ++ image_manager.hpp ++endif ++ + bin_PROGRAMS = \ + phosphor-version-software-manager \ + phosphor-download-manager \ +@@ -24,8 +31,15 @@ dist_bin_SCRIPTS = \ + phosphor_version_software_manager_SOURCES = \ + image_manager_main.cpp \ + watch.cpp \ +- version.cpp \ ++ version.cpp ++ ++if PFR_UPDATE ++phosphor_version_software_manager_SOURCES += \ ++ pfr_image_manager.cpp ++else ++phosphor_version_software_manager_SOURCES += \ + image_manager.cpp ++endif + + BUILT_SOURCES = \ + xyz/openbmc_project/Software/Image/error.cpp \ +diff --git a/activation.cpp b/activation.cpp +index cea1e50..7ff4196 100644 +--- a/activation.cpp ++++ b/activation.cpp +@@ -197,7 +197,7 @@ auto Activation::activation(Activations value) -> Activations + } + else if (activationProgress->progress() == 100) + { +- log("[Jennifer] progress == 100..."); ++ log("progress == 100..."); + if (!redundancyPriority) + { + redundancyPriority = +diff --git a/configure.ac b/configure.ac +index 720e704..e527682 100755 +--- a/configure.ac ++++ b/configure.ac +@@ -191,6 +191,13 @@ AS_IF([test "x$enable_fwupd_script" == "xyes"], \ + [AC_DEFINE([FWUPD_SCRIPT],[],[Enable fwupd script support.])]) + AM_CONDITIONAL([FWUPD_SCRIPT], [test "x$enable_fwupd_script" == "xyes"]) + ++# setup pfr image update support ++AC_ARG_ENABLE([pfr_update], ++ AS_HELP_STRING([--enable-pfr_update], [Enable pfr image update support.])) ++AS_IF([test "x$enable_pfr_update" == "xyes"], \ ++ [AC_DEFINE([PFR_UPDATE],[],[Enable pfr image update support.])]) ++AM_CONDITIONAL([PFR_UPDATE], [test "x$enable_pfr_update" == "xyes"]) ++ + # Check for header files. + AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) + AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) +diff --git a/item_updater.cpp b/item_updater.cpp +index 21fb6e0..fd76a7f 100644 +--- a/item_updater.cpp ++++ b/item_updater.cpp +@@ -64,7 +64,8 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) + auto value = SVersion::convertVersionPurposeFromString( + variant_ns::get(property.second)); + if (value == VersionPurpose::BMC || +- value == VersionPurpose::System) ++ value == VersionPurpose::Host || ++ value == VersionPurpose::Other) + { + purpose = value; + } +@@ -356,6 +357,7 @@ void ItemUpdater::deleteAll() + ItemUpdater::ActivationStatus + ItemUpdater::validateSquashFSImage(const std::string& filePath) + { ++#ifndef PFR_UPDATE + bool invalid = false; + + for (auto& bmcImage : bmcImages) +@@ -375,7 +377,7 @@ ItemUpdater::ActivationStatus + { + return ItemUpdater::ActivationStatus::invalid; + } +- ++#endif + return ItemUpdater::ActivationStatus::ready; + } + +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +new file mode 100644 +index 0000000..242a6ca +--- /dev/null ++++ b/pfr_image_manager.cpp +@@ -0,0 +1,217 @@ ++#include "config.h" ++ ++#include "pfr_image_manager.hpp" ++ ++#include "version.hpp" ++#include "watch.hpp" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace phosphor ++{ ++namespace software ++{ ++namespace manager ++{ ++ ++using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; ++namespace Software = phosphor::logging::xyz::openbmc_project::Software; ++ ++static constexpr const uint32_t pfmPos = 2054; ++ ++static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, ++ std::string& version) ++{ ++ struct pfrImgBlock0 block0Data; ++ uint8_t verData[2]; ++ ++ if (std::filesystem::exists(imgPath)) ++ { ++ try ++ { ++ std::ifstream imgFile(imgPath, std::ios::binary | std::ios::in); ++ ++ if (!imgFile.good()) ++ { ++ phosphor::logging::log( ++ "Image file read failed"); ++ return -1; ++ } ++ ++ imgFile.read(reinterpret_cast(&block0Data), ++ sizeof(block0Data)); ++ imgType = block0Data.pcType[0]; ++ imgFile.seekg(pfmPos, ++ std::ios::beg); // Version is at 0x806 in the PFM ++ imgFile.read(reinterpret_cast(&verData), sizeof(verData)); ++ imgFile.close(); ++ version = ++ std::to_string(verData[0]) + "." + std::to_string(verData[1]); ++ phosphor::logging::log( ++ "PFR image", ++ phosphor::logging::entry("PCType=%d", block0Data.pcType[0]), ++ phosphor::logging::entry("VERSION=%s", version.c_str())); ++ } ++ catch (std::exception& e) ++ { ++ phosphor::logging::log(e.what()); ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++int Manager::processImage(const std::string& imgFilePath) ++{ ++ std::filesystem::path imgPath(imgFilePath); ++ ++ if (!std::filesystem::exists(imgPath)) ++ return -1; ++ ++ uint8_t imgType; ++ int retry = 3; ++ std::string ver; ++ std::string purposeString; ++ ++ if (0 != getPFRImgInfo(imgFilePath, imgType, ver)) ++ { ++ phosphor::logging::log( ++ "Error reading uploaded image type and version"); ++ return -1; ++ } ++ ++ if (ver.empty()) ++ { ++ phosphor::logging::log( ++ "Empty version from image file"); ++ return -1; ++ } ++ ++ if (imgType == pfrBMCUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"; ++ } ++ else if (imgType == pfrPCHUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Host"; ++ } ++ else if (imgType == pfrCPLDUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Other"; ++ } ++ else ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Unknown"; ++ ++ phosphor::logging::log( ++ "Unknown image type"); ++ return -1; ++ } ++ ++ sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose ++ purpose = Version::VersionPurpose::Unknown; ++ try ++ { ++ purpose = Version::convertVersionPurposeFromString(purposeString); ++ } ++ catch (const sdbusplus::exception::InvalidEnumString& e) ++ { ++ phosphor::logging::log( ++ "Error: Failed to convert purpose to enum." ++ " Setting to Unknown."); ++ } ++ ++ // Compute id ++ std::string id = Version::getId(ver); ++ ++ // Append a random number after the original version hash ++ // This will allow forcing image update onto the same version ++ // with 3 retries on random number generation. ++ do ++ { ++ srand(time(NULL)); ++ id = id + "_" + std::to_string(rand()); ++ } while ((versions.find(id) != versions.end()) && retry--); ++ ++ if (versions.find(id) != versions.end()) ++ { ++ phosphor::logging::log( ++ "Software Object with the same version already exists, exiting " ++ "the update", ++ phosphor::logging::entry("VERSION_ID=%s", id.c_str())); ++ ++ return -1; ++ } ++ ++ std::filesystem::path imageDirPath(IMG_UPLOAD_DIR); ++ imageDirPath /= id; ++ ++ std::filesystem::create_directory(imageDirPath); ++ ++ std::filesystem::path newFileName = imageDirPath / "image-runtime"; ++ std::filesystem::rename(imgFilePath, newFileName); ++ ++ // Create Version object ++ std::string objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; ++ ++ auto versionPtr = std::make_unique( ++ bus, objPath, ver, purpose, imageDirPath.string(), ++ std::bind(&Manager::erase, this, std::placeholders::_1)); ++ versionPtr->deleteObject = ++ std::make_unique(bus, objPath, ++ *versionPtr); ++ versions.insert(std::make_pair(id, std::move(versionPtr))); ++ ++ return 0; ++} ++ ++void Manager::erase(std::string entryId) ++{ ++ auto it = versions.find(entryId); ++ if (it == versions.end()) ++ { ++ return; ++ } ++ ++ if (it->second->isFunctional()) ++ { ++ phosphor::logging::log( ++ ("Error: Version " + entryId + ++ " is currently running on the BMC." ++ " Unable to remove.") ++ .c_str()); ++ return; ++ } ++ ++ // Delete image dir ++ std::filesystem::path imageDirPath = (*(it->second)).path(); ++ if (std::filesystem::exists(imageDirPath)) ++ { ++ std::filesystem::remove_all(imageDirPath); ++ } ++ this->versions.erase(entryId); ++} ++ ++} // namespace manager ++} // namespace software ++} // namespace phosphor +diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp +new file mode 100644 +index 0000000..c6ee6a4 +--- /dev/null ++++ b/pfr_image_manager.hpp +@@ -0,0 +1,75 @@ ++#pragma once ++#include "version.hpp" ++ ++#include ++ ++namespace phosphor ++{ ++namespace software ++{ ++namespace manager ++{ ++ ++enum pfrImgPCType { ++ pfrCPLDUpdateCap = 0x00, ++ pfrPCHPFM = 0x01, ++ pfrPCHUpdateCap = 0x02, ++ pfrBMCPFM = 0x03, ++ pfrBMCUpdateCap = 0x04 ++}; ++ ++/* PFR image block 0 - As defined in HAS */ ++struct pfrImgBlock0 { ++ uint8_t tag[4]; ++ uint8_t pcLength[4]; ++ uint8_t pcType[4]; ++ uint8_t reserved1[4]; ++ uint8_t hash256[32]; ++ uint8_t hash384[48]; ++ uint8_t reserved2[32]; ++}__attribute__((packed)); ++ ++/** @class Manager ++ * @brief Contains a map of Version dbus objects. ++ * @details The software image manager class that contains the Version dbus ++ * objects and their version ids. ++ */ ++class Manager ++{ ++ public: ++ /** @brief Constructs Manager Class ++ * ++ * @param[in] bus - The Dbus bus object ++ */ ++ Manager(sdbusplus::bus::bus& bus) : bus(bus){}; ++ ++ /** ++ * @brief Verify the image and provide the image to updater. ++ * Create and populate the version and file path interfaces. ++ * ++ * @param[in] uploaded image. ++ * @param[out] result - 0 if successful. ++ */ ++ int processImage(const std::string& imageFilePath); ++ ++ /** ++ * @brief Erase specified entry d-bus object ++ * and deletes the image file. ++ * ++ * @param[in] entryId - unique identifier of the entry ++ */ ++ void erase(std::string entryId); ++ ++ private: ++ /** @brief Persistent map of Version dbus objects and their ++ * version id */ ++ std::map> versions; ++ ++ /** @brief Persistent sdbusplus DBus bus connection. */ ++ sdbusplus::bus::bus& bus; ++ ++}; ++ ++} // namespace manager ++} // namespace software ++} // namespace phosphor +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 2efe911ae..90da32ac2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -3,9 +3,12 @@ EXTRA_OECONF += "--enable-fwupd_script" SYSTEMD_SERVICE_${PN}-updater += "fwupd@.service" +EXTRA_OECONF += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '--enable-pfr_update', '', d)}" SRC_URI += "file://0002-Redfish-firmware-activation.patch \ file://0004-Changed-the-condition-of-software-version-service-wa.patch \ file://0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch \ file://0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch \ " + +SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0007-PFR-images-support.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb new file mode 100644 index 000000000..53cec437d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb @@ -0,0 +1,30 @@ +SUMMARY = "Default Fru" +DESCRIPTION = "Builds a default FRU file at runtime based on board ID" + +inherit systemd +inherit cmake + +SYSTEMD_SERVICE_${PN} = "SetBaseboardFru.service" + +S = "${WORKDIR}" +SRC_URI = "file://checkFru.sh \ + file://SetBaseboardFru.service \ + file://mkfru.cpp \ + file://CMakeLists.txt \ + " + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "\ + file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658 \ + file://mkfru.cpp;beginline=2;endline=14;md5=c451359f18a13ee69602afce1588c01a \ + " + +RDEPENDS_${PN} = "bash" + +do_install_append() { + install -d ${D}${bindir} + install -m 0755 ${S}/checkFru.sh ${D}/${bindir}/checkFru.sh + + install -d ${D}${base_libdir}/systemd/system + install -m 0644 ${S}/SetBaseboardFru.service ${D}${base_libdir}/systemd/system +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt new file mode 100644 index 000000000..a8e633644 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) +project(mkfru CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +add_executable(mkfru mkfru.cpp) +install(TARGETS mkfru DESTINATION bin) + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service new file mode 100644 index 000000000..d8c2a75ac --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service @@ -0,0 +1,9 @@ +[Unit] +Description=Check for FRU presence + +[Service] +ExecStart=/usr/bin/checkFru.sh +Type=oneshot + +[Install] +WantedBy=basic.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh new file mode 100755 index 000000000..908e4b51e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# this script checks the gpio id and loads the correct baseboard fru +FRUPATH="/etc/fru" +fruFile="$FRUPATH/baseboard.fru.bin" +if [ -f $fruFile ]; then + exit 0 +fi + +read_id() { + local idx=0 + local result=0 + local value=0 + for ((idx=0; idx<6; idx++)) + do + typeset -i value=$(gpioget $(gpiofind "FM_BMC_BOARD_SKU_ID${idx}_N")) + value=$((value << idx)) + result=$((result | value)) + done + echo $result +} + +BOARD_ID=$(read_id) +if grep -q 'CPU part\s*: 0xb76' /proc/cpuinfo; then + # AST2500 + case $BOARD_ID in + 12) NAME="D50TNP1SB";; + 40) NAME="CooperCity";; + 45) NAME="WilsonCity";; + 60) NAME="M50CYP2SB2U";; + 62) NAME="WilsonPoint";; + *) NAME="S2600WFT";; + esac +fi + +if [ -z "$NAME" ]; then + NAME="Unknown" +fi + +cd /tmp +mkdir -p $FRUPATH +mkfru $NAME +mv $NAME.fru.bin $fruFile + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp new file mode 100644 index 000000000..afadbd324 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp @@ -0,0 +1,219 @@ +/* +// Copyright (c) 2019 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Abstract: default FRU generation +// +*/ + +#include +#include +#include +#include +#include +#include + +constexpr uint8_t fillChar = '.'; +constexpr uint8_t eof = 0xc1; +const std::string intel = "Intel Corporation"; + +// round up to nearest block size (power of 2) +constexpr size_t blockRound(size_t len, size_t blk) +{ + return ((len) + (((blk) - ((len) & ((blk)-1))) & ((blk)-1))); +} + +uint8_t mklen(uint8_t len) +{ + return static_cast((0x3 << 6) | len); +} + +struct FruEntry +{ + static constexpr size_t fruBlockSize = 8; // type, length, checksum + static constexpr size_t fixedBytes = 3; // type, length, checksum + FruEntry() = delete; + FruEntry(const std::vector& contents) + { + constexpr size_t verOffset = 0; + constexpr size_t lenOffset = 1; + value.resize(blockRound(fixedBytes + contents.size(), fruBlockSize)); + value[verOffset] = 1; + value[lenOffset] = blocks(); + std::copy(contents.begin(), contents.end(), value.begin() + 2); + addChecksum(); + } + + void addChecksum() + { + int sum = std::accumulate(value.begin(), value.end(), 0); + value.back() = static_cast(256 - sum & 0xff); + } + + uint8_t blocks() const + { + return static_cast(value.size() / 8); + } + + std::vector value; +}; + +size_t fillDots(std::vector::iterator start, size_t count) +{ + *start++ = mklen(count); // prefix with (0xc0 | count) + auto end = start + count++; + std::fill(start, end, '.'); + return count; +} + +size_t fillStr(std::vector::iterator start, const std::string& str) +{ + size_t count = str.size(); + *start++ = mklen(count++); // prefix with (0xc0 | count) + std::copy(str.begin(), str.end(), start); + return count; +} + +std::vector genChassisContents() +{ + constexpr size_t pnSize = 18; + constexpr size_t snSize = 18; + constexpr size_t amSize = 31; + constexpr size_t headerSize = 1; + constexpr size_t contentSize = headerSize + 1 + pnSize + 1 + snSize + 1 + + amSize + 1 + amSize + sizeof(eof); + std::vector data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0x17; + // chassis part number + offset += fillDots(data.begin() + offset, pnSize); + // chassis serial number + offset += fillDots(data.begin() + offset, snSize); + // info am1 + offset += fillDots(data.begin() + offset, amSize); + // info am2 + offset += fillDots(data.begin() + offset, amSize); + data[offset] = eof; + + return data; +} + +std::vector genBoardContents(const std::string& name) +{ + constexpr size_t headerSize = 4; + constexpr size_t snSize = 12; + constexpr size_t pnSize = 10; + const std::string version = "FRU Ver 0.01"; + size_t contentSize = headerSize + 1 + name.size() + 1 + intel.size() + 1 + + snSize + 1 + pnSize + 1 + version.size() + sizeof(eof); + std::vector data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0; // language code + data[offset++] = 0; // mfg date/time + data[offset++] = 0; // mfg date/time + data[offset++] = 0; // mfg date/time + // manufacturer name + offset += fillStr(data.begin() + offset, intel); + // product name + offset += fillStr(data.begin() + offset, name); + // board sn + offset += fillDots(data.begin() + offset, snSize); + // board pn + offset += fillDots(data.begin() + offset, pnSize); + // fru version string + offset += fillStr(data.begin() + offset, version); + data[offset] = eof; + + return data; +} + +std::vector genProductContents(const std::string& name) +{ + constexpr size_t headerSize = 1; + constexpr size_t pnSize = 10; + constexpr size_t pvSize = 20; + constexpr size_t snSize = 12; + constexpr size_t atSize = 20; + constexpr size_t idSize = 0; + const std::string version = "FRU Ver 0.01"; + size_t contentSize = headerSize + 1 + intel.size() + 1 + name.size() + 1 + + pnSize + 1 + pvSize + 1 + snSize + 1 + atSize + 1 + + idSize + sizeof(eof); + std::vector data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0; // language code + // manufacturer name + offset += fillStr(data.begin() + offset, intel); + // product name + offset += fillStr(data.begin() + offset, name); + // product part number + offset += fillDots(data.begin() + offset, pnSize); + // product version + offset += fillDots(data.begin() + offset, pvSize); + // product serial number + offset += fillDots(data.begin() + offset, snSize); + // product asset tag + offset += fillDots(data.begin() + offset, atSize); + // empty fru file id + offset += fillDots(data.begin() + offset, idSize); + data[offset] = eof; + + return data; +} + +int createFru(const std::string& name) +{ + std::vector internal{1, 0, 0, 0, 0, 0, 0, 1}; // fixed data + FruEntry chassis(genChassisContents()); + FruEntry board(genBoardContents(name)); + FruEntry product(genProductContents(name)); + uint8_t offset = 1; // room for header's offset + FruEntry header({ + offset += 1, // internal size + offset += chassis.blocks(), + offset += board.blocks(), + }); + std::string filename = name + ".fru.bin"; + std::ofstream output(filename); + std::ostream_iterator outputIter(output); + std::copy(header.value.begin(), header.value.end(), outputIter); + std::copy(internal.begin(), internal.end(), outputIter); + std::copy(chassis.value.begin(), chassis.value.end(), outputIter); + std::copy(board.value.begin(), board.value.end(), outputIter); + std::copy(product.value.begin(), product.value.end(), outputIter); + constexpr size_t minFruSize = 0x1ff; + size_t fruSize = header.value.size() + internal.size() + + chassis.value.size() + board.value.size() + + product.value.size(); + if (fruSize < minFruSize) + { + std::vector padding(minFruSize - fruSize); + std::copy(padding.begin(), padding.end(), outputIter); + } + output.close(); + return 0; +} + +int main(int argc, const char* argv[]) +{ + if (argc != 2) + { + std::cerr << "Usage: " << argv[0] << " <'Product Name'>\n"; + return 1; + } + return createFru(argv[1]); +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index 53cd944c6..5a2e55497 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "b76f9ca126d5c1abcd8b833a511d784531dbb3a1" +SRCREV = "c80fee55c3663e5ac620a4d11378799c91867b76" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -15,3 +15,6 @@ EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_RAW_PECI=ON" # Enable Redfish BMC Journal support EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL=ON" + +# Enable PFR support +EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DBMCWEB_ENABLE_REDFISH_PFR_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json index 92731f439..dc9c2ce20 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -44,12 +44,12 @@ } }, "4" : { - "name" : "EMP", + "name" : "RESERVED", "is_valid" : true, "active_sessions" : 0, "channel_info" : { - "medium_type" : "ipmb", - "protocol_type" : "ipmb-1.0", + "medium_type" : "reserved", + "protocol_type" : "na", "session_supported" : "session-less", "is_ipmi" : true } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch index b54b22213..c862a306a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch @@ -17,11 +17,11 @@ Change-Id: If5528d3b7294c5f8c17db5919439235d0fad0446 transporthandler.hpp | 50 +++ 4 files changed, 713 insertions(+), 1 deletion(-) -diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp -index 57c5873..c06fd8c 100644 ---- a/include/ipmid/types.hpp -+++ b/include/ipmid/types.hpp -@@ -224,6 +224,7 @@ constexpr auto ADDR_TYPE_FORMAT = "%hhx"; +Index: phosphor-host-ipmid.clean/include/ipmid/types.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/include/ipmid/types.hpp ++++ phosphor-host-ipmid.clean/include/ipmid/types.hpp +@@ -224,6 +224,7 @@ constexpr auto ADDR_TYPE_FORMAT = "%hhx" constexpr auto IPV4_ADDRESS_SIZE_BYTE = 4; constexpr auto IPV6_ADDRESS_SIZE_BYTE = 16; @@ -50,10 +50,10 @@ index 57c5873..c06fd8c 100644 + } // namespace network } // namespace ipmi -diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp -index 9ef1488..8b91b12 100644 ---- a/include/ipmid/utils.hpp -+++ b/include/ipmid/utils.hpp +Index: phosphor-host-ipmid.clean/include/ipmid/utils.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/include/ipmid/utils.hpp ++++ phosphor-host-ipmid.clean/include/ipmid/utils.hpp @@ -256,6 +256,7 @@ namespace network constexpr auto ROOT = "/xyz/openbmc_project/network"; constexpr auto SERVICE = "xyz.openbmc_project.Network"; @@ -62,11 +62,11 @@ index 9ef1488..8b91b12 100644 constexpr auto IPV4_PREFIX = "169.254"; constexpr auto IPV6_PREFIX = "fe80"; constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP"; -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 8172cc4..12d224a 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -30,6 +30,12 @@ std::unique_ptr networkTimer = nullptr; +Index: phosphor-host-ipmid.clean/transporthandler.cpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/transporthandler.cpp ++++ phosphor-host-ipmid.clean/transporthandler.cpp +@@ -29,6 +29,12 @@ std::unique_ptr network const int SIZE_MAC = 18; // xx:xx:xx:xx:xx:xx constexpr auto ipv4Protocol = "xyz.openbmc_project.Network.IP.Protocol.IPv4"; @@ -79,29 +79,23 @@ index 8172cc4..12d224a 100644 std::map> channelConfig; -@@ -389,7 +395,6 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - ipmi_context_t context) - { - ipmi_ret_t rc = IPMI_CC_OK; -- *data_len = 0; - - using namespace std::chrono_literals; - -@@ -403,6 +408,9 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - auto reqptr = reinterpret_cast(request); - sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection()); - -+ size_t reqLen = *data_len; -+ *data_len = 0; +@@ -445,6 +451,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n + { + case LanParam::IP: + { ++ if (reqLen != lanParamIPSize) ++ { ++ return IPMI_CC_REQ_DATA_LEN_INVALID; ++ } + - // channel number is the lower nibble - int channel = reqptr->channel & CHANNEL_MASK; - auto ethdevice = ipmi::getChannelName(channel); -@@ -426,6 +434,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, + std::snprintf(ipaddr, INET_ADDRSTRLEN, + ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], + reqptr->data[1], reqptr->data[2], reqptr->data[3]); +@@ -455,6 +466,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::IPSRC: { -+ if (reqLen != LAN_PARAM_IPSRC_SIZE) ++ if (reqLen != lanParamIPSrcSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -109,11 +103,11 @@ index 8172cc4..12d224a 100644 uint8_t ipsrc{}; std::memcpy(&ipsrc, reqptr->data, ipmi::network::IPSRC_SIZE_BYTE); channelConf->ipsrc = static_cast(ipsrc); -@@ -434,6 +447,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -463,6 +479,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::MAC: { -+ if (reqLen != LAN_PARAM_MAC_SIZE) ++ if (reqLen != lanParamMACSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -121,11 +115,11 @@ index 8172cc4..12d224a 100644 char mac[SIZE_MAC]; std::snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT, -@@ -454,6 +472,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -483,6 +504,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::SUBNET: { -+ if (reqLen != LAN_PARAM_SUBNET_SIZE) ++ if (reqLen != lanParamSubnetSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -133,11 +127,11 @@ index 8172cc4..12d224a 100644 std::snprintf(netmask, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -463,6 +486,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -492,6 +518,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::GATEWAY: { -+ if (reqLen != LAN_PARAM_GATEWAY_SIZE) ++ if (reqLen != lanParamGatewaySize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -145,23 +139,11 @@ index 8172cc4..12d224a 100644 std::snprintf(gateway, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -472,6 +500,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - case LanParam::VLAN: - { -+ if (reqLen != LAN_PARAM_VLAN_SIZE) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - uint16_t vlan{}; - std::memcpy(&vlan, reqptr->data, ipmi::network::VLAN_SIZE_BYTE); - // We are not storing the enable bit -@@ -484,6 +517,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -522,6 +553,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::INPROGRESS: { -+ if (reqLen != LAN_PARAM_INPROGRESS_SIZE) ++ if (reqLen != lanParamInProgressSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -169,13 +151,13 @@ index 8172cc4..12d224a 100644 if (reqptr->data[0] == SET_COMPLETE) { channelConf->lan_set_in_progress = SET_COMPLETE; -@@ -512,6 +550,122 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -540,6 +576,122 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n } break; + case LanParam::IPV6_AND_IPV4_ENABLES: + { -+ if (reqLen != LAN_PARAM_IPV6_AND_IPV4_ENABLES_SIZE) ++ if (reqLen != lanParamIPv6AndIPv4EnablesSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -186,7 +168,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ADDRESSES: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ADDRESSES_SIZE) ++ if (reqLen != lanParamIPv6StaticAddressesSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -202,7 +184,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_ROUTER_ADDRESS_CONF_CTRL: + { -+ if (reqLen != LAN_PARAM_IPV6_ROUTER_ADDRESS_CONF_CTRL_SIZE) ++ if (reqLen != lanParamIPv6RouterAddressConfCtrlSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -213,7 +195,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_IP_ADDR: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_IP_ADDR_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1IPAddrSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -227,7 +209,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_LEN: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_LEN_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1PrefixLenSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -238,7 +220,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_VAL: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_VAL_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1PrefixValSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -252,7 +234,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_IP_ADDR: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_IP_ADDR_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2IPAddrSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -266,7 +248,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_LEN: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_LEN_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2PrefixLenSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -277,7 +259,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_VAL: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_VAL_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2PrefixValSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -292,7 +274,7 @@ index 8172cc4..12d224a 100644 default: { rc = IPMI_CC_PARM_NOT_SUPPORTED; -@@ -538,6 +692,7 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -568,6 +720,7 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n ipmi_ret_t rc = IPMI_CC_OK; *data_len = 0; const uint8_t current_revision = 0x11; // Current rev per IPMI Spec 2.0 @@ -300,7 +282,7 @@ index 8172cc4..12d224a 100644 get_lan_t* reqptr = (get_lan_t*)request; // channel number is the lower nibble -@@ -676,6 +831,476 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -713,6 +866,476 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n static_cast(cipherList.size()); break; } @@ -777,7 +759,7 @@ index 8172cc4..12d224a 100644 default: log("Unsupported parameter", entry("PARAMETER=0x%x", reqptr->parameter)); -@@ -921,6 +1546,16 @@ void applyChanges(int channel) +@@ -957,6 +1580,16 @@ void applyChanges(int channel) ipaddress, prefix); } @@ -794,7 +776,7 @@ index 8172cc4..12d224a 100644 if (!gateway.empty()) { ipmi::setDbusProperty(bus, systemObject.second, -@@ -928,7 +1563,24 @@ void applyChanges(int channel) +@@ -964,7 +1597,24 @@ void applyChanges(int channel) ipmi::network::SYSTEMCONFIG_INTERFACE, "DefaultGateway", std::string(gateway)); } @@ -817,42 +799,41 @@ index 8172cc4..12d224a 100644 + ipmi::network::ETHERNET_INTERFACE, "IPv6AcceptRA", + (bool)channelConf->ipv6RouterAddressConfigControl); } - catch (InternalFailure& e) + catch (sdbusplus::exception::exception& e) { -diff --git a/transporthandler.hpp b/transporthandler.hpp -index 04d4673..bd23391 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -79,6 +79,28 @@ enum class LanParam : uint8_t +Index: phosphor-host-ipmid.clean/transporthandler.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/transporthandler.hpp ++++ phosphor-host-ipmid.clean/transporthandler.hpp +@@ -79,8 +79,27 @@ enum class LanParam : uint8_t IPV6_NEIGHBOR_TIMING_CONFIGURATION = 80, }; -+// Data length of parameters -+constexpr size_t LAN_PARAM_INPROGRESS_SIZE = 3; -+constexpr size_t LAN_PARAM_IP_SIZE = 6; -+constexpr size_t LAN_PARAM_IPSRC_SIZE = 3; -+constexpr size_t LAN_PARAM_MAC_SIZE = 8; -+constexpr size_t LAN_PARAM_SUBNET_SIZE = 6; -+constexpr size_t LAN_PARAM_GATEWAY_SIZE = 6; -+constexpr size_t LAN_PARAM_VLAN_SIZE = 4; -+constexpr size_t LAN_PARAM_IPV6_AND_IPV4_ENABLES_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ADDRESSES_SIZE = 23; -+constexpr size_t LAN_PARAM_IPV6_ROUTER_ADDRESS_CONF_CTRL_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_IP_ADDR_SIZE = 18; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_LEN_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_VAL_SIZE = 19; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_IP_ADDR_SIZE = 18; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_LEN_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_VAL_SIZE = 19; -+ +constexpr uint8_t DUID_LEN = 10; +constexpr uint8_t DUID_LL_TYPE = 3; +constexpr uint8_t DUIC_ETH_HW_TYPE = 1; + + // Data length of parameters + constexpr size_t lanParamVLANSize = 4; ++constexpr size_t lanParamInProgressSize = 3; ++constexpr size_t lanParamIPSize = 6; ++constexpr size_t lanParamIPSrcSize = 3; ++constexpr size_t lanParamMACSize = 8; ++constexpr size_t lanParamSubnetSize = 6; ++constexpr size_t lanParamGatewaySize = 6; ++constexpr size_t lanParamIPv6AndIPv4EnablesSize = 3; ++constexpr size_t lanParamIPv6StaticAddressesSize = 23; ++constexpr size_t lanParamIPv6RouterAddressConfCtrlSize = 3; ++constexpr size_t lanParamIPv6StaticRouter1IPAddrSize = 18; ++constexpr size_t lanParamIPv6StaticRouter1PrefixLenSize = 3; ++constexpr size_t lanParamIPv6StaticRouter1PrefixValSize = 19; ++constexpr size_t lanParamIPv6StaticRouter2IPAddrSize = 18; ++constexpr size_t lanParamIPv6StaticRouter2PrefixLenSize = 3; ++constexpr size_t lanParamIPv6StaticRouter2PrefixValSize = 19; constexpr uint8_t SET_COMPLETE = 0; constexpr uint8_t SET_IN_PROGRESS = 1; constexpr uint8_t SET_COMMIT_WRITE = 2; // Optional -@@ -101,6 +123,20 @@ struct ChannelConfig_t +@@ -103,6 +122,20 @@ struct ChannelConfig_t uint8_t lan_set_in_progress = SET_COMPLETE; bool flush = false; @@ -873,7 +854,7 @@ index 04d4673..bd23391 100644 void clear() { ipaddr.clear(); -@@ -111,6 +147,20 @@ struct ChannelConfig_t +@@ -113,6 +146,20 @@ struct ChannelConfig_t ipsrc = ipmi::network::IPOrigin::UNSPECIFIED; lan_set_in_progress = SET_COMPLETE; flush = false; @@ -894,6 +875,3 @@ index 04d4673..bd23391 100644 } }; --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch index a96707d44..f091b31fa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch @@ -1,6 +1,6 @@ -From 6e37e02a4f200507627a82f6dba00a9c9d877cb2 Mon Sep 17 00:00:00 2001 +From 3c69c94eed1a0c6eecfd53e739fade6596c6f3e5 Mon Sep 17 00:00:00 2001 From: Yong Li -Date: Mon, 18 Mar 2019 23:05:16 +0800 +Date: Thu, 12 Sep 2019 17:37:05 +0800 Subject: [PATCH] Add timer use/actions support Based on IPMI spec, add timer use/actions support, @@ -8,188 +8,24 @@ and add input data checking Signed-off-by: Yong Li --- - app/watchdog.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++----- - app/watchdog_service.cpp | 8 +++++++ - app/watchdog_service.hpp | 8 +++++++ - 3 files changed, 72 insertions(+), 6 deletions(-) + app/watchdog.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/watchdog.cpp b/app/watchdog.cpp -index 1a5d19c..3b61055 100644 +index c4e594d..18e7e3a 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp -@@ -89,6 +89,13 @@ static constexpr uint8_t wd_dont_stop = 0x1 << 6; - static constexpr uint8_t wd_timeout_action_mask = 0x3; +@@ -251,8 +251,8 @@ ipmi::RspType<> ipmiSetWatchdogTimer( + return ipmi::responseInvalidFieldRequest(); + } - static constexpr uint8_t wdTimerUseMask = 0x7; -+static constexpr uint8_t wdTimerUseResTimer1 = 0x0; -+static constexpr uint8_t wdTimerUseResTimer2 = 0x6; -+static constexpr uint8_t wdTimerUseResTimer3 = 0x7; -+static constexpr uint8_t wdTimerUseRes = 0x38; -+ -+static constexpr uint8_t wdTimerActionMask = 0xcc; -+static constexpr uint8_t wdTimerUseExpMask = 0xc1; +- timerLogFlags = static_cast(dontLog); +- timerActions &= static_cast(timeoutAction) | ++ timerLogFlags = (static_cast(dontLog)) << 7; ++ timerActions = static_cast(timeoutAction) | + static_cast(preTimeoutInterrupt) << 4; - enum class IpmiAction : uint8_t - { -@@ -186,6 +193,11 @@ static_assert(sizeof(wd_set_req) == 6, "wd_set_req has invalid size."); - static_assert(sizeof(wd_set_req) <= MAX_IPMI_BUFFER, - "wd_get_res can't fit in request buffer."); - -+static uint8_t timerLogFlags = 0; -+static uint8_t timerActions = 0; -+ -+static uint8_t timerUseExpirationFlags = 0; -+ - ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - ipmi_request_t request, - ipmi_response_t response, -@@ -203,6 +215,24 @@ ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - req.initial_countdown = le16toh(req.initial_countdown); - *data_len = 0; - -+ if (((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer1) || -+ ((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer2) || -+ ((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer3) || -+ (req.timer_use & wdTimerUseRes) || -+ (req.timer_action & wdTimerActionMask) || -+ (req.expire_flags & wdTimerUseExpMask)) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } -+ -+ if (req.pretimeout > (req.initial_countdown / 10)) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } -+ -+ timerLogFlags = req.timer_use & 0x80; -+ timerActions = req.timer_action; -+ try - { - WatchdogService wd_service; -@@ -221,6 +251,10 @@ ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - static_cast(req.timer_use & wdTimerUseMask); - wd_service.setTimerUse(ipmiTimerUseToWdTimerUse(ipmiTimerUse)); - -+ wd_service.setExpiredTimerUse(WatchdogService::TimerUse::Reserved); -+ -+ timerUseExpirationFlags &= ~req.expire_flags; -+ - // Set the new interval and the time remaining deci -> mill seconds - const uint64_t interval = req.initial_countdown * 100; - wd_service.setInterval(interval); -@@ -339,7 +373,6 @@ static_assert(sizeof(wd_get_res) == 8, "wd_get_res has invalid size."); - static_assert(sizeof(wd_get_res) <= MAX_IPMI_BUFFER, - "wd_get_res can't fit in response buffer."); - --static constexpr uint8_t wd_dont_log = 0x1 << 7; - static constexpr uint8_t wd_running = 0x1 << 6; - - ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, -@@ -358,20 +391,37 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - // Build and return the response - wd_get_res res; -- res.timer_use = wd_dont_log; -- res.timer_action = -- static_cast(wdActionToIpmiAction(wd_prop.expireAction)); -+ res.timer_use |= timerLogFlags; -+ res.timer_action = timerActions; - - // Interval and timeRemaining need converted from milli -> deci seconds - res.initial_countdown = htole16(wd_prop.interval / 100); -+ -+ if (wd_prop.expiredTimerUse != WatchdogService::TimerUse::Reserved) -+ { -+ timerUseExpirationFlags |= -+ 1 << static_cast( -+ wdTimerUseToIpmiTimerUse(wd_prop.expiredTimerUse)); -+ } -+ - if (wd_prop.enabled) - { - res.timer_use |= wd_running; - res.present_countdown = htole16(wd_prop.timeRemaining / 100); -+ res.expire_flags = 0; - } - else - { -- res.present_countdown = res.initial_countdown; -+ if (wd_prop.expiredTimerUse == WatchdogService::TimerUse::Reserved) -+ { -+ res.present_countdown = res.initial_countdown; -+ res.expire_flags = 0; -+ } -+ else -+ { -+ res.present_countdown = 0; -+ res.expire_flags = timerUseExpirationFlags; -+ } - } - - res.timer_use |= -@@ -379,7 +429,7 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - // TODO: Do something about having pretimeout support - res.pretimeout = 0; -- res.expire_flags = 0; -+ - memcpy(response, &res, sizeof(res)); - *data_len = sizeof(res); - lastCallSuccessful = true; -diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp -index e65ea63..8b1aa47 100644 ---- a/app/watchdog_service.cpp -+++ b/app/watchdog_service.cpp -@@ -83,6 +83,9 @@ WatchdogService::Properties WatchdogService::getProperties() - wd_prop.timerUse = Watchdog::convertTimerUseFromString( - std::get(properties.at("CurrentTimerUse"))); - -+ wd_prop.expiredTimerUse = Watchdog::convertTimerUseFromString( -+ std::get(properties.at("ExpiredTimerUse"))); -+ - wd_prop.interval = std::get(properties.at("Interval")); - wd_prop.timeRemaining = - std::get(properties.at("TimeRemaining")); -@@ -187,6 +190,11 @@ void WatchdogService::setTimerUse(TimerUse timerUse) - setProperty("CurrentTimerUse", convertForMessage(timerUse)); - } - -+void WatchdogService::setExpiredTimerUse(TimerUse timerUse) -+{ -+ setProperty("ExpiredTimerUse", convertForMessage(timerUse)); -+} -+ - void WatchdogService::setInterval(uint64_t interval) - { - setProperty("Interval", interval); -diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp -index 75afc1e..d0cc1a8 100644 ---- a/app/watchdog_service.hpp -+++ b/app/watchdog_service.hpp -@@ -36,6 +36,7 @@ class WatchdogService - bool enabled; - Action expireAction; - TimerUse timerUse; -+ TimerUse expiredTimerUse; - uint64_t interval; - uint64_t timeRemaining; - }; -@@ -79,6 +80,13 @@ class WatchdogService - */ - void setTimerUse(TimerUse timerUse); - -+ /** @brief Sets the value of the ExpiredTimerUse property on the host -+ * watchdog -+ * -+ * @param[in] timerUse - The new timerUse value -+ */ -+ void setExpiredTimerUse(TimerUse timerUse); -+ - /** @brief Sets the value of the interval property on the host watchdog - * - * @param[in] interval - The new interval value -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch index 5623d246d..2dad2fc16 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch @@ -1,6 +1,6 @@ -From 55db62a92dff4bfc3d34c590b33d9da4e7706b9d Mon Sep 17 00:00:00 2001 +From 27b94aa1df83abad63cbba69525273194b14ab9c Mon Sep 17 00:00:00 2001 From: Cheng C Yang -Date: Wed, 3 Jul 2019 06:12:55 +0800 +Date: Wed, 16 Oct 2019 14:24:20 +0800 Subject: [PATCH] Move Set SOL config parameter to host-ipmid Move Set SOL config parameter command from net-ipmid to host-ipmid, @@ -23,15 +23,14 @@ to 0 and other properties will not reset to default value. Signed-off-by: Cheng C Yang --- host-ipmid-whitelist.conf | 1 + - transporthandler.cpp | 289 ++++++++++++++++++++++++++++++++++++++++++++++ - transporthandler.hpp | 33 ++++++ - 3 files changed, 323 insertions(+) + transporthandler.cpp | 322 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 323 insertions(+) diff --git a/host-ipmid-whitelist.conf b/host-ipmid-whitelist.conf -index 2b72d23..856588e 100644 +index e8df7c7..f030ef4 100644 --- a/host-ipmid-whitelist.conf +++ b/host-ipmid-whitelist.conf -@@ -42,6 +42,7 @@ +@@ -41,6 +41,7 @@ 0x0A:0x48 //: 0x0A:0x49 //: 0x0C:0x02 //: @@ -40,22 +39,17 @@ index 2b72d23..856588e 100644 0x2C:0x01 //: 0x2C:0x02 //: diff --git a/transporthandler.cpp b/transporthandler.cpp -index bb624c4..25062ae 100644 +index e88eb63..4a42e7b 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp -@@ -36,6 +36,9 @@ static const std::array ipAddressEnablesType = { - "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv6Only", - "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv4AndIPv6"}; +@@ -1168,8 +1168,323 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, + } // namespace transport + } // namespace ipmi +constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL"; +constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/"; + - std::map> channelConfig; - - using namespace phosphor::logging; -@@ -1631,6 +1634,285 @@ void createNetworkTimer() - } - } + void register_netfn_transport_functions() __attribute__((constructor)); +static std::string + getSOLService(std::shared_ptr dbus, @@ -194,6 +188,37 @@ index bb624c4..25062ae 100644 + +} // namespace ipmi + ++namespace sol ++{ ++enum class Parameter ++{ ++ progress, //!< Set In Progress. ++ enable, //!< SOL Enable. ++ authentication, //!< SOL Authentication. ++ accumulate, //!< Character Accumulate Interval & Send Threshold. ++ retry, //!< SOL Retry. ++ nvbitrate, //!< SOL non-volatile bit rate. ++ vbitrate, //!< SOL volatile bit rate. ++ channel, //!< SOL payload channel. ++ port, //!< SOL payload port. ++}; ++ ++enum class Privilege : uint8_t ++{ ++ highestPriv, ++ callbackPriv, ++ userPriv, ++ operatorPriv, ++ adminPriv, ++ oemPriv, ++}; ++ ++} // namespace sol ++ ++constexpr uint8_t progressMask = 0x03; ++constexpr uint8_t enableMask = 0x01; ++constexpr uint8_t retryMask = 0x07; ++ +ipmi::RspType<> setSOLConfParams(ipmi::Context::ptr ctx, uint4_t chNum, + uint4_t reserved, uint8_t paramSelector, + uint8_t configParamData1, @@ -312,8 +337,10 @@ index bb624c4..25062ae 100644 + { + return ipmi::responseReqDataLenInvalid(); + } -+ if ((setSOLParameter("RetryCount", (configParamData1 & 0x7), -+ channelNum) < 0) || ++ if ((setSOLParameter( ++ "RetryCount", ++ static_cast(configParamData1 & retryMask), ++ channelNum) < 0) || + (setSOLParameter("RetryIntervalMS", *configParamData2, + channelNum) < 0)) + { @@ -338,74 +365,19 @@ index bb624c4..25062ae 100644 + void register_netfn_transport_functions() { - // As this timer is only for transport handler -@@ -1648,5 +1930,12 @@ void register_netfn_transport_functions() - ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_GET_LAN, NULL, - ipmi_transport_get_lan, PRIVILEGE_OPERATOR); - + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, +@@ -1178,4 +1493,11 @@ void register_netfn_transport_functions() + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, + ipmi::transport::cmdGetLanConfigParameters, + ipmi::Privilege::Admin, ipmi::transport::getLan); ++ + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, + ipmi::transport::cmdSetSolConfigParameters, + ipmi::Privilege::Admin, setSOLConfParams); + + // Initialize dbus property progress to 0 every time sol manager restart. + initializeSOLInProgress(); -+ - return; } -diff --git a/transporthandler.hpp b/transporthandler.hpp -index bd23391..1237658 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -1,5 +1,6 @@ - #pragma once - -+#include - #include - #include - // IPMI commands for Transport net functions. -@@ -8,6 +9,8 @@ enum ipmi_netfn_storage_cmds - // Get capability bits - IPMI_CMD_SET_LAN = 0x01, - IPMI_CMD_GET_LAN = 0x02, -+ IPMI_CMD_SET_SOL_CONF_PARAMS = 0x21, -+ IPMI_CMD_GET_SOL_CONF_PARAMS = 0x22, - }; - - // Command specific completion codes -@@ -186,3 +189,33 @@ void commitNetworkChanges(); - * @param[in] channel: channel number. - */ - void applyChanges(int channel); -+ -+namespace sol -+{ -+enum class Parameter -+{ -+ progress, //!< Set In Progress. -+ enable, //!< SOL Enable. -+ authentication, //!< SOL Authentication. -+ accumulate, //!< Character Accumulate Interval & Send Threshold. -+ retry, //!< SOL Retry. -+ nvbitrate, //!< SOL non-volatile bit rate. -+ vbitrate, //!< SOL volatile bit rate. -+ channel, //!< SOL payload channel. -+ port, //!< SOL payload port. -+}; -+ -+enum class Privilege : uint8_t -+{ -+ highestPriv, -+ callbackPriv, -+ userPriv, -+ operatorPriv, -+ adminPriv, -+ oemPriv, -+}; -+ -+} // namespace sol -+ -+constexpr uint8_t progressMask = 0x03; -+constexpr uint8_t enableMask = 0x01; -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch index 685e7c39d..aac0850ea 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch @@ -85,8 +85,8 @@ index 2ffaae3..e9b7a9c 100644 + // pretimeOutAction + const auto ipmiPreTimeoutInterrupt = -+ static_cast((req.timer_action >> 4) & -+ wdPreTimeoutInterruptMask); ++ static_cast(wdPreTimeoutInterruptMask & ++ (static_cast(preTimeoutInterrupt))); + wd_service.setPreTimeoutInterrupt( + ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt)); + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch index 6a7b056ab..4ee28bb5c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch @@ -1,29 +1,66 @@ +From e7b86ade7db1e9ae86ea39a957bead9090f4ccbf Mon Sep 17 00:00:00 2001 +From: Yong Li +Date: Thu, 12 Sep 2019 13:18:42 +0800 +Subject: [PATCH] Enable watchdog to save useflag after host power off + +Get the right useflag after host power off. + +Tested: +Set a watchdog (Timer action is none and Time Use is BIOS FRB2) +ipmitool raw 0x06 0x24 0x01 0x00 0x00 0x00 0x40 0x00 +Get watchdog +ipmitool mc watchdog get +Start watchdog +ipmitool mc watchdog reset +Get watchdog +ipmitool mc watchdog get +After timer is stop, set a watchdog again +(Timer action is none and Time Use is BIOS/POST) +ipmitool raw 0x06 0x24 0x02 0x00 0x00 0x00 0x40 0x00 +Start watchdog and wait until timer is stop, +Get watchdog +ipmitool mc watchdog get +Timer Expiration Flags should be 0x06(BIOS FRB2, BIOS/POST) +Power down the Host +Ipmitool chassis power off +Check the Timer Expiration Flags(User Flags) +ipmitool mc watchdog get +Timer Expiration Flags should be 0x06(BIOS FRB2, BIOS/POST) + +Signed-off-by: Yong Li +--- + app/watchdog.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + diff --git a/app/watchdog.cpp b/app/watchdog.cpp -index 2938d23..bc5df29 100644 +index 4650d89..1562f5e 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp -@@ -445,23 +445,21 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -435,23 +435,21 @@ ipmi::RspType -Date: Fri, 2 Aug 2019 14:18:31 +0530 -Subject: [PATCH] Valid VLANID should be 1-4095 as in 802.1VLAN spec - -Added the VLAN ID checking condition in Set LAN configuration - -Unit test: -Verified VLAN ID 1-4095 is allowed and CC returns for 0 & > 4095 - -Change-Id: I1737986ed7adb727758dedb84b851ba2c208cea3 -Signed-off-by: Suryakanth Sekar ---- - transporthandler.cpp | 4 ++++ - transporthandler.hpp | 1 + - 2 files changed, 5 insertions(+) - -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 44ddcef..ede6472 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -536,6 +536,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - // We assume that ipmitool always send enable - // bit as 1. - vlan = le16toh(vlan); -+ if (vlan == 0 || vlan > maxValidVLANIDValue) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } - channelConf->vlanID = vlan; - } - break; -diff --git a/transporthandler.hpp b/transporthandler.hpp -index 1237658..d8805e1 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -219,3 +219,4 @@ enum class Privilege : uint8_t - - constexpr uint8_t progressMask = 0x03; - constexpr uint8_t enableMask = 0x01; -+constexpr uint16_t maxValidVLANIDValue = 4095; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf index deed53b0b..f3218d8d8 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf @@ -1,50 +1,196 @@ -#:: +#: +#IPMI whitelist command list version 9b +0x00:0x00 //: 0x00:0x01 //: +0x00:0x04 //: 0x00:0x07 //: 0x00:0x09 //: -0x00:0x0F //: -0x04:0x02 //: -0x04:0x2D //: +0x00:0x0A //: +0x00:0x0F //: +0x04:0x01 //: +0x04:0x02 //: +0x04:0x10 //: +0x04:0x13 //: +0x04:0x15 //: +0x04:0x20 //: +0x04:0x21 //: +0x04:0x23 //: +0x04:0x25 //: +0x04:0x27 //: +0x04:0x29 //: +0x04:0x2B //: +0x04:0x2D //: 0x04:0x2F //: 0x06:0x01 //: -0x06:0x04 //: +0x06:0x04 //: +0x06:0x06 //: 0x06:0x07 //: 0x06:0x08 //: 0x06:0x22 //: 0x06:0x24 //: 0x06:0x25 //: 0x06:0x2F //: +0x06:0x30 //: 0x06:0x31 //: +0x06:0x33 //: 0x06:0x35 //: -0x06:0x36 //: 0x06:0x37 //: -0x06:0x42 //: +0x06:0x38 //: +0x06:0x39 //: +0x06:0x3D //: +0x06:0x3F //: +0x06:0x41 //: +0x06:0x42 //: +0x06:0x44 //: +0x06:0x46 //: +0x06:0x4A //: +0x06:0x4B //: +0x06:0x4D //: 0x06:0x4E //: +0x06:0x4F //: +0x06:0x50 //: 0x06:0x54 //: +0x06:0x57 //: +0x08:0x20 //: +0x08:0x21 //: +0x08:0x22 //: +0x08:0x23 //: +0x08:0x24 //: +0x08:0x25 //: +0x08:0x26 //: +0x08:0x27 //: +0x08:0x28 //: +0x08:0x29 //: +0x08:0x2A //: +0x08:0x2B //: +0x08:0x2C //: +0x08:0x2D //: +0x08:0xE0 //: 0x0A:0x10 //: 0x0A:0x11 //: 0x0A:0x20 //: -0x0A:0x22 //: +0x0A:0x21 //: 0x0A:0x23 //: +0x0A:0x28 //: 0x0A:0x40 //: -0x0A:0x42 //: -0x0A:0x44 //: +0x0A:0x41 //: +0x0A:0x43 //: 0x0A:0x48 //: -0x0A:0x49 //: +0x0A:0x5A //: +0x0A:0x5C //: 0x0C:0x02 //: +0x0C:0x04 //: +0x0C:0x11 //: 0x0C:0x22 //: -0x2C:0x00 //: -0x2C:0x01 //: -0x2C:0x02 //: -0x2C:0x03 //: -0x2C:0x06 //: -0x2C:0x07 //: -0x2C:0x10 //: -0x30:0x27 //: -0x30:0x31 //: -0x30:0x55 //: -0x30:0x9A //: -0x30:0xB0 //: -0x30:0xE9 //: - +0x2C:0x1F //: +0x2C:0x20 //: +0x2C:0x21 //: +0x2C:0x22 //: +0x2C:0x23 //: +0x2C:0x24 //: +0x2C:0x25 //: +0x2C:0x29 //: +0x2C:0x37 //: +0x30:0x04 //: +0x30:0x05 //: +0x30:0x09 //: +0x30:0x14 //: +0x30:0x19 //: +0x30:0x1A //: +0x30:0x1B //: +0x30:0x1D //: +0x30:0x1F //: +0x30:0x20 //: +0x30:0x21 //: +0x30:0x22 //: +0x30:0x23 //: +0x30:0x26 //: +0x30:0x27 //: +0x30:0x2E //: +0x30:0x30 //: +0x30:0x31 //: +0x30:0x33 //: +0x30:0x38 //: +0x30:0x39 //: +0x30:0x3C //: +0x30:0x41 //: +0x30:0x43 //: +0x30:0x44 //: +0x30:0x47 //: +0x30:0x55 //: +0x30:0x58 //: +0x30:0x62 //: +0x30:0x63 //: +0x30:0x65 //: +0x30:0x66 //: +0x30:0x71 //: +0x30:0x73 //: +0x30:0x74 //: +0x30:0x75 //: +0x30:0x80 //: +0x30:0x81 //: +0x30:0x82 //: +0x30:0x85 //: +0x30:0x8A //: +0x30:0x8B //: +0x30:0x8D //: +0x30:0x8F //: +0x30:0x91 //: +0x30:0x92 //: +0x30:0x93 //: +0x30:0x94 //: +0x30:0x95 //: +0x30:0x9A //: +0x30:0x9D //: +0x30:0xB0 //: +0x30:0xB2 //: +0x30:0xB3 //: +0x30:0xBB //: +0x30:0xC2 //: +0x30:0xC6 //: +0x30:0xC7 //: +0x30:0xC9 //: +0x30:0xCA //: +0x30:0xCB //: +0x30:0xCC //: +0x30:0xCD //: +0x30:0xD0 //: +0x30:0xD1 //: +0x30:0xD4 //: +0x30:0xE2 //: +0x30:0xE5 //: +0x30:0xE8 //: +0x30:0xE9 //: +0x30:0xF9 //: +0x30:0xFD //: +0x32:0x60 //: +0x32:0x63 //: +0x32:0x8D //: +0x3E:0x02 //: +0x3E:0x20 //: +0x3E:0x21 //: +0x3E:0x22 //: +0x3E:0x23 //: +0x3E:0x24 //: +0x3E:0x25 //: +0x3E:0x28 //: +0x3E:0x30 //: +0x3E:0x31 //: +0x3E:0x32 //: +0x3E:0x33 //: +0x3E:0x34 //: +0x3E:0x35 //: +0x3E:0x38 //: +0x3E:0x39 //: +0x3E:0x3A //: +0x3E:0x3B //: +0x3E:0x3C //: +0x3E:0x3D //: +0x3E:0x41 //: +0x3E:0x42 //: +0x3E:0x43 //: +0x3E:0x44 //: +0x3E:0x50 //: +0x3E:0x51 //: +0x3E:0x52 //: +0x3E:0x75 //: diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index 16bd9f757..a50d5fd7f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -1,13 +1,11 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -# TODO: This should be removed, once up-stream bump up -# issue is resolved -#SRC_URI = "git://github.com/openbmc/phosphor-host-ipmid" -SRCREV = "9da3a75091e0bf0849e2555447e64a70f1dc3bfb" +#todo yong unpin this +SRC_URI = "git://github.com/openbmc/phosphor-host-ipmid;nobranch=1" +SRCREV = "c514d874e4ce3ed1f747cfcb4bab5990393c55e8" SRC_URI += "file://phosphor-ipmi-host.service \ file://host-ipmid-whitelist.conf \ - file://0009-IPv6-Network-changes.patch \ file://0010-fix-get-system-GUID-ipmi-command.patch \ file://0013-ipmi-add-set-bios-id-to-whitelist.patch \ file://0039-ipmi-add-oem-command-get-AIC-FRU-to-whitelist.patch \ @@ -21,9 +19,12 @@ SRC_URI += "file://phosphor-ipmi-host.service \ file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ file://0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch \ file://0064-Update-provisioning-mode-filter-logic.patch \ - file://0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch \ " +EXTRA_OECONF_append = " --disable-i2c-whitelist-check" + +RDEPENDS_${PN}_remove = "clear-once" + # remove the softpoweroff service since we do not need it SYSTEMD_SERVICE_${PN}_remove += " \ xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index 24037a4cb..7f7d89105 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "35ca150beb7d5faf2fe0ca44c87bc7b0ade0aee7" +SRCREV = "dafe36444fa438030fdf27089b0e94d8d88411dc" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb index b27961109..fd0a6562b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb @@ -3,7 +3,7 @@ DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicat with Management Engine via IPMB" SRC_URI = "git://git@github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "06e8a1072b05d42e63cf70e2ceac7390578c051d" +SRCREV = "cceeff9cd35aa548cba039b8ad47c20c5870fa27" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb index d20da7b35..66530e01d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.U_Boot.Environment.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init index e97c40c1c..9de00fd2f 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init @@ -25,12 +25,18 @@ log() { # start with /proc and /tmp mounted [ -e /proc/mounts ] || mount -t proc proc /proc +# FIXME: add size limits to /tmp grep -q /tmp /proc/mounts || mount -t tmpfs -o rw,nosuid,nodev tmp /tmp grep -q /sys /proc/mounts || mount -t sysfs -o rw,nosuid,nodev,noexec sys /sys +# fix up /srv to be RW +mkdir -p /tmp/srv +mount --bind /tmp/srv /srv + if grep -q debug-init /proc/cmdline; then exec > /tmp/init.log 2>&1 set -x + env else # silent bob exec >/dev/null 2>&1 @@ -127,23 +133,29 @@ prepare_ubi_volume() { reformat_ubi_volume() { local nv_num="$1" local mnt="$2" + local mtd="/dev/mtd${nv_num}" local ubi="/dev/ubi${nv_num}" local vol="${ubi}_0" # unmount the volume to reformat it umount -f "$mnt" ubidetach -m $nv_num - ubiformat -y "$ubi" + ubiformat -y "$mtd" prepare_ubi_volume $nv_num # remount the UBIFS on the UBI volume - mount -t ubifs "$vol" "$mnt" + mount -t ubifs -o sync "$vol" "$mnt" if [ $? -ne 0 ]; then log "Failed to mount reformatted NV volume; system unstable" fi } +clear_ubenv() { + log "Clearing U-Boot environment" + flash_erase /dev/mtd/u-boot-env 0 0 +} + # mount a UBIFS on the UBI volume prepare_ubi_volume $NV_MTD_NUM -mount -t ubifs "/dev/ubi${NV_MTD_NUM}_0" "$RWFS_MNT" +mount -t ubifs -o sync "/dev/ubi${NV_MTD_NUM}_0" "$RWFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount NV volume; attempting recovery" reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT @@ -158,9 +170,11 @@ if [ $restore_op -eq 1 ]; then targeted_clean elif [ $restore_op -eq 2 ]; then full_clean + clear_ubenv elif [ $restore_op -eq 3 ]; then log "restore-defaults: reformat" reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT + clear_ubenv fi rm -f $RESTORE_FLAG @@ -168,6 +182,17 @@ for FS in $NV_OVERLAYS; do nvrw "$FS" done +# at first boot, fix up /var/volatile/{log,tmp} to be RW (due to yocto nonsense) +if [ -L /var/log ]; then + # remove symlink /var/log -> volatile/log; make /var/log non-volatile + rm /var/log + mkdir -p /var/log + # remove symlink /var/tmp -> volatile/tmp; symlink to /tmp/var + rm /var/tmp + ln -s /tmp/var /var/tmp +fi +mkdir -p /tmp/var + # work around bug where /etc/machine-id will be mounted with a temporary file # if rootfs is read-only and the file is empty MACHINE_ID=/etc/machine-id @@ -205,7 +230,7 @@ if ! grep -q sofs /proc/mounts; then # mount a UBIFS on the UBI volume prepare_ubi_volume $SOFS_MTD_NUM - mount -t ubifs "/dev/ubi${SOFS_MTD_NUM}_0" "$SOFS_MNT" + mount -t ubifs -o sync "/dev/ubi${SOFS_MTD_NUM}_0" "$SOFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount SOFS volume; attempting recovery" reformat_ubi_volume $SOFS_MTD_NUM $SOFS_MNT diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb index 53f42dbdf..7ceff1798 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.RestrictionMode.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend index fcdef4e02..ad14d1d65 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git" -SRCREV = "3d300fca24b30864b3e9a4f5768cfe5e769458ae" +SRCREV = "6afe9560852c6431c43c8e79a28e2b7cb498e355" # Enable threshold monitoring EXTRA_OECMAKE += "-DSEL_LOGGER_MONITOR_THRESHOLD_EVENTS=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch deleted file mode 100644 index 1e1fc9625..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f9b4545af42fc673f81d043a8512db8ebfe58660 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Fri, 2 Aug 2019 12:02:58 -0700 -Subject: [PATCH] Add WA enable/disable control code into cpusensor - -This commit adds a PECI WA enable/disable control code. If 'UseWA' -isn't in CPU configuration or the setting is 0, the WA will be -disabled by writing 'N' on the peci_core module parameter. - -This is a temporary WA. - -Change-Id: I73ae9ac49c9382f3ebdc800c360e078418b124e9 -Signed-off-by: Jae Hyun Yoo ---- - src/CPUSensorMain.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 2a3ff16f8294..b4085fd1038d 100644 ---- a/src/CPUSensorMain.cpp -+++ b/src/CPUSensorMain.cpp -@@ -629,6 +629,25 @@ bool getCpuConfig( - std::cout << "type: " << type << "\n"; - } - -+ // Temporary WA -+ uint64_t useWA = 0; -+ auto findUseWA = config.second.find("UseWA"); -+ if (findUseWA != config.second.end()) -+ { -+ useWA = std::visit(VariantToUnsignedIntVisitor(), -+ findUseWA->second); -+ } -+ if (useWA == 0) -+ { -+ std::ofstream deviceFile( -+ "/sys/module/peci_core/parameters/use_wa"); -+ if (deviceFile.good()) -+ { -+ deviceFile << 'N'; -+ } -+ deviceFile.close(); -+ } -+ - cpuConfigs.emplace(bus, addr, name, State::OFF); - } - } --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index 082c87055..ce487dd0d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,10 +1,7 @@ -SRCREV = "7fa475d3f27ec6c37503ff7ec0496acc2215da29" +SRCREV = "432d1edf7ac86f69558273307a59e4b1cf86b8a6" SRC_URI = "git://github.com/openbmc/dbus-sensors.git" DEPENDS_append = " libgpiod" FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" -SRC_URI += "file://0001-Add-WA-enable-disable-control-code-into-cpusensor.patch" -#todo(cheng) remove this when synced upstream -SYSTEMD_SERVICE_${PN} += " xyz.openbmc_project.mcutempsensor.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb index 1a34e2478..c23d86a38 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb @@ -1,7 +1,7 @@ SUMMARY = "Settings" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index d6d9d2d20..eb8f6ac34 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "specialmodemgr.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb index 12fd75226..12619a88e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "srvcfg-manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch index 8915484cd..56bb8d1c3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch @@ -311,7 +311,7 @@ index 0000000..67bc43f +BusName=xyz.openbmc_project.State.Boot.PostCode + +[Install] -+WantedBy=obmc-standby.target ++WantedBy=multi-user.target diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..4a74b29 @@ -426,21 +426,21 @@ index 0000000..983eeee + std::ofstream os(fullPath.c_str(), std::ios::binary); + cereal::JSONOutputArchive oarchive(os); + oarchive(index); -+ + std::ofstream osPostCodes((path + std::to_string(currentBootCycleIndex())).c_str(), std::ios::binary); + cereal::JSONOutputArchive oarchivePostCodes(osPostCodes); + oarchivePostCodes(postCodes); -+ -+ return path; + } + catch (cereal::Exception& e) + { + phosphor::logging::log(e.what()); ++ return ""; + } + catch (const fs::filesystem_error& e) + { + phosphor::logging::log(e.what()); ++ return ""; + } ++ return path; +} + +bool PostCode::deserialize(const fs::path& path, uint16_t& index) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 921352a5b..7e69f41c5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb @@ -7,7 +7,7 @@ inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb index f50ec86d1..9f7be9434 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb @@ -1,8 +1,8 @@ SUMMARY = "Virtual Media Service" DESCRIPTION = "Virtual Media Service" -SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh;nobranch=1" -SRCREV = "0de77d616866a6251ce7e36db3285fda76b13873" +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/virtual-media/" PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb index 950f4932d..ebd795e83 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb @@ -10,7 +10,7 @@ SRC_URI = "\ PV = "0.1" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" S = "${WORKDIR}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch new file mode 100644 index 000000000..736431e9e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -0,0 +1,316 @@ +From a65701eabcf205203d6363d54730a6a497c0e6fc Mon Sep 17 00:00:00 2001 +From: James Feist +Date: Mon, 17 Jun 2019 12:00:58 -0700 +Subject: [PATCH] Customize phosphor-watchdog for Intel platforms + +This patch adds various changes to phosphor-watchdog that are +required for compatibility with Intel platforms. + + 1. Add Redfish messages for watchdog timeout and pre-interrupt + 2. Use dbus properties for power control insted of service files + 3. Use host status to enable/disable watchdog + 4. Set preTimeoutInterruptOccurFlag + +Signed-off-by: James Feist +Signed-off-by: Ren Yu +Signed-off-by: Yong Li +Signed-off-by: Jason M. Bills +--- + watchdog.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- + watchdog.hpp | 23 ++++++- + 2 files changed, 206 insertions(+), 10 deletions(-) + +diff --git a/watchdog.cpp b/watchdog.cpp +index 9090760..68b4246 100644 +--- a/watchdog.cpp ++++ b/watchdog.cpp +@@ -1,11 +1,14 @@ + #include "watchdog.hpp" + ++#include ++ + #include + #include + #include + #include + #include + #include ++#include + + namespace phosphor + { +@@ -18,10 +21,69 @@ using namespace phosphor::logging; + using sdbusplus::exception::SdBusError; + using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; + +-// systemd service to kick start a target. +-constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; +-constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; +-constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; ++const static constexpr char* currentHostState = "CurrentHostState"; ++const static constexpr char* hostStatusOff = ++ "xyz.openbmc_project.State.Host.HostState.Off"; ++ ++const static constexpr char* actionDescription = " due to Watchdog timeout"; ++const static constexpr char* hardResetDescription = "Hard Reset - System reset"; ++const static constexpr char* powerOffDescription = ++ "Power Down - System power down"; ++const static constexpr char* powerCycleDescription = ++ "Power Cycle - System power cycle"; ++const static constexpr char* timerExpiredDescription = "Timer expired"; ++ ++const static constexpr char* preInterruptActionNone = ++ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; ++ ++const static constexpr char* preInterruptDescriptionSMI = "SMI"; ++const static constexpr char* preInterruptDescriptionNMI = "NMI"; ++const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; ++ ++const static constexpr char* reservedDescription = "Reserved"; ++ ++const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; ++const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; ++const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; ++const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; ++const static constexpr char* timerUseDescriptionOEM = "OEM"; ++ ++namespace restart ++{ ++static constexpr const char* busName = ++ "xyz.openbmc_project.Control.Host.RestartCause"; ++static constexpr const char* path = ++ "/xyz/openbmc_project/control/host0/restart_cause"; ++static constexpr const char* interface = ++ "xyz.openbmc_project.Control.Host.RestartCause"; ++static constexpr const char* property = "RequestedRestartCause"; ++} // namespace restart ++ ++// chassis state manager service ++namespace chassis ++{ ++static constexpr const char* busName = "xyz.openbmc_project.State.Chassis"; ++static constexpr const char* path = "/xyz/openbmc_project/state/chassis0"; ++static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; ++static constexpr const char* request = "RequestedPowerTransition"; ++} // namespace chassis ++ ++void Watchdog::powerStateChangedHandler( ++ const std::map>& props) ++{ ++ const auto iter = props.find(currentHostState); ++ if (iter != props.end()) ++ { ++ const std::string* powerState = std::get_if(&iter->second); ++ if (powerState && (*powerState == hostStatusOff)) ++ { ++ if (timerEnabled()) ++ { ++ enabled(false); ++ } ++ } ++ } ++} + + void Watchdog::resetTimeRemaining(bool enableWatchdog) + { +@@ -102,13 +164,102 @@ uint64_t Watchdog::interval(uint64_t value) + // Optional callback function on timer expiration + void Watchdog::timeOutHandler() + { ++ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); ++ std::string preInterruptActionMessageArgs{}; ++ + Action action = expireAction(); ++ std::string actionMessageArgs{}; ++ ++ expiredTimerUse(currentTimerUse()); ++ ++ TimerUse timeUser = expiredTimerUse(); ++ std::string timeUserMessage{}; ++ + if (!this->enabled()) + { + action = fallback->action; + } + +- expiredTimerUse(currentTimerUse()); ++ switch (timeUser) ++ { ++ case Watchdog::TimerUse::BIOSFRB2: ++ timeUserMessage = timerUseDescriptionBIOSFRB2; ++ break; ++ case Watchdog::TimerUse::BIOSPOST: ++ timeUserMessage = timerUseDescriptionBIOSPOST; ++ break; ++ case Watchdog::TimerUse::OSLoad: ++ timeUserMessage = timerUseDescriptionOSLoad; ++ break; ++ case Watchdog::TimerUse::SMSOS: ++ timeUserMessage = timerUseDescriptionSMSOS; ++ break; ++ case Watchdog::TimerUse::OEM: ++ timeUserMessage = timerUseDescriptionOEM; ++ break; ++ default: ++ timeUserMessage = reservedDescription; ++ break; ++ } ++ ++ switch (action) ++ { ++ case Watchdog::Action::HardReset: ++ actionMessageArgs = std::string(hardResetDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerOff: ++ actionMessageArgs = std::string(powerOffDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerCycle: ++ actionMessageArgs = std::string(powerCycleDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::None: ++ actionMessageArgs = timerExpiredDescription; ++ break; ++ default: ++ actionMessageArgs = reservedDescription; ++ break; ++ } ++ ++ // Log into redfish event log ++ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", ++ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", ++ "REDFISH_MESSAGE_ARGS=%s. timer use: %s", ++ actionMessageArgs.c_str(), timeUserMessage.c_str(), NULL); ++ ++ switch (preTimeoutInterruptAction) ++ { ++ case Watchdog::PreTimeoutInterruptAction::SMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionSMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::NMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionNMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::MI: ++ preInterruptActionMessageArgs = preInterruptDescriptionMI; ++ break; ++ default: ++ preInterruptActionMessageArgs = reservedDescription; ++ break; ++ } ++ ++ if (preInterruptActionNone != convertForMessage(preTimeoutInterruptAction)) ++ { ++ preTimeoutInterruptOccurFlag(true); ++ ++ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", ++ convertForMessage(preTimeoutInterruptAction).c_str(), ++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.IPMIWatchdog", ++ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " ++ "Watchdog timeout. timer use: %s", ++ preInterruptActionMessageArgs.c_str(), ++ timeUserMessage.c_str(), NULL); ++ } + + auto target = actionTargetMap.find(action); + if (target == actionTargetMap.end()) +@@ -128,10 +279,11 @@ void Watchdog::timeOutHandler() + + try + { +- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_ROOT, +- SYSTEMD_INTERFACE, "StartUnit"); +- method.append(target->second); +- method.append("replace"); ++ auto method = ++ bus.new_method_call(chassis::busName, chassis::path, ++ "org.freedesktop.DBus.Properties", "Set"); ++ method.append(chassis::interface, chassis::request, ++ std::variant(target->second)); + + bus.call_noreply(method); + } +@@ -142,6 +294,29 @@ void Watchdog::timeOutHandler() + entry("ERROR=%s", e.what())); + commit(); + } ++ ++ // set restart cause for watchdog HardReset & PowerCycle actions ++ if ((action == Watchdog::Action::HardReset) || ++ (action == Watchdog::Action::PowerCycle)) ++ { ++ try ++ { ++ auto method = bus.new_method_call( ++ restart::busName, restart::path, ++ "org.freedesktop.DBus.Properties", "Set"); ++ method.append( ++ restart::interface, restart::property, ++ std::variant("xyz.openbmc_project.State.Host." ++ "RestartCause.WatchdogTimer")); ++ bus.call(method); ++ } ++ catch (sdbusplus::exception_t& e) ++ { ++ log("Failed to set HostRestartCause property", ++ entry("ERROR=%s", e.what())); ++ commit(); ++ } ++ } + } + + tryFallbackOrDisable(); +diff --git a/watchdog.hpp b/watchdog.hpp +index 7de9bb3..b004b7a 100644 +--- a/watchdog.hpp ++++ b/watchdog.hpp +@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits + WatchdogInherits(bus, objPath), + bus(bus), actionTargetMap(std::move(actionTargetMap)), + fallback(std::move(fallback)), minInterval(minInterval), +- timer(event, std::bind(&Watchdog::timeOutHandler, this)) ++ timer(event, std::bind(&Watchdog::timeOutHandler, this)), ++ powerStateChangedSignal( ++ bus, ++ sdbusplus::bus::match::rules::propertiesChanged( ++ "/xyz/openbmc_project/state/host0", ++ "xyz.openbmc_project.State.Host"), ++ [this](sdbusplus::message::message& msg) { ++ std::string objectName; ++ std::map> props; ++ msg.read(objectName, props); ++ powerStateChangedHandler(props); ++ }) + { + // We set the watchdog interval with the default value. + interval(interval()); +@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits + tryFallbackOrDisable(); + } + ++ /** @brief Disable watchdog when power status change meet ++ * the specific requirement ++ */ ++ void powerStateChangedHandler( ++ const std::map>& props); ++ + /** @brief Resets the TimeRemaining to the configured Interval + * Optionally enables the watchdog. + * +@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits + /** @brief Contained timer object */ + sdeventplus::utility::Timer timer; + ++ /** @brief Optional Callback handler when power status change meet ++ * the specific requirement */ ++ sdbusplus::bus::match_t powerStateChangedSignal; ++ + /** @brief Optional Callback handler on timer expirartion */ + void timeOutHandler(); + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch deleted file mode 100644 index 627dacef1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch +++ /dev/null @@ -1,198 +0,0 @@ -From d15cf914ad51207021451b12863d4b7585f4666c Mon Sep 17 00:00:00 2001 -From: James Feist -Date: Mon, 17 Jun 2019 12:00:58 -0700 -Subject: [PATCH] Move Phosphor-Watchdog to Not Use Service Files - -Our power control does not use service files, update it -so that it calls properties directly. - -According to EPS, change the messageArgs in redfish about watchdog -action and pre-interrupt action. - -Tested: used ipmi to create watchdog event and system -was restarted. - -Set a watchdog (Timer action and pre-interrupt action both are none). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -When timer expired, check messageArgs in Redfish with below url: -https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries. - -Signed-off-by: James Feist -Signed-off-by: Ren Yu ---- - watchdog.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 108 insertions(+), 8 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 9090760..4c8e480 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -1,11 +1,14 @@ - #include "watchdog.hpp" - -+#include -+ - #include - #include - #include - #include - #include - #include -+#include - - namespace phosphor - { -@@ -18,10 +21,44 @@ using namespace phosphor::logging; - using sdbusplus::exception::SdBusError; - using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; - --// systemd service to kick start a target. --constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; --constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; --constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; -+const static constexpr char* powerActionHardReset = -+ "xyz.openbmc_project.State.Watchdog.Action.HardReset"; -+const static constexpr char* powerActionOff = -+ "xyz.openbmc_project.State.Watchdog.Action.PowerOff"; -+const static constexpr char* powerActionPowerCycle = -+ "xyz.openbmc_project.State.Watchdog.Action.PowerCycle"; -+const static constexpr char* powerActionNone = -+ "xyz.openbmc_project.State.Watchdog.Action.None"; -+const static constexpr char* preInterruptNoAction = -+ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -+ -+const static constexpr char* hardResteDescription = -+ "Hard Reset - System reset due to Watchdog timeout"; -+const static constexpr char* powerOffDescription = -+ "Power Down - System power down due to Watchdog timeout"; -+const static constexpr char* powerCycleDescription = -+ "Power Cycle - System power cycle due to Watchdog timeout"; -+const static constexpr char* timerExpiredDescription = "Timer expired"; -+const static constexpr char* preInterruptDescription = "Timer interrupt"; -+ -+namespace restart -+{ -+static constexpr const char* busName = "xyz.openbmc_project.Settings"; -+static constexpr const char* path = -+ "/xyz/openbmc_project/control/host0/restart_cause"; -+static constexpr const char* interface = -+ "xyz.openbmc_project.Common.RestartCause"; -+static constexpr const char* property = "RestartCause"; -+} // namespace restart -+ -+// chassis state manager service -+namespace chassis -+{ -+static constexpr const char* busName = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* path = "/xyz/openbmc_project/state/chassis0"; -+static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* request = "RequestedPowerTransition"; -+} // namespace chassis - - void Watchdog::resetTimeRemaining(bool enableWatchdog) - { -@@ -102,12 +139,51 @@ uint64_t Watchdog::interval(uint64_t value) - // Optional callback function on timer expiration - void Watchdog::timeOutHandler() - { -+ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); - Action action = expireAction(); -+ std::string actionMessageArgs{}; -+ - if (!this->enabled()) - { - action = fallback->action; - } - -+ if (convertForMessage(action) == powerActionHardReset) -+ { -+ actionMessageArgs = hardResteDescription; -+ } -+ else if (convertForMessage(action) == powerActionOff) -+ { -+ actionMessageArgs = powerOffDescription; -+ } -+ else if (convertForMessage(action) == powerActionPowerCycle) -+ { -+ actionMessageArgs = powerCycleDescription; -+ } -+ else if (convertForMessage(action) == powerActionNone) -+ { -+ actionMessageArgs = timerExpiredDescription; -+ } -+ else -+ { -+ actionMessageArgs = "Reserved"; -+ } -+ -+ // Log into redfish event log -+ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", -+ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, -+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", -+ "REDFISH_MESSAGE_ARGS=%s", actionMessageArgs.c_str(), NULL); -+ -+ if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) -+ { -+ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", -+ convertForMessage(preTimeoutInterruptAction).c_str(), -+ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", -+ "OpenBMC.0.1.IPMIWatchdog", "REDFISH_MESSAGE_ARGS=%s", -+ preInterruptDescription, NULL); -+ } -+ - expiredTimerUse(currentTimerUse()); - - auto target = actionTargetMap.find(action); -@@ -128,10 +204,11 @@ void Watchdog::timeOutHandler() - - try - { -- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_ROOT, -- SYSTEMD_INTERFACE, "StartUnit"); -- method.append(target->second); -- method.append("replace"); -+ auto method = -+ bus.new_method_call(chassis::busName, chassis::path, -+ "org.freedesktop.DBus.Properties", "Set"); -+ method.append(chassis::interface, chassis::request, -+ std::variant(target->second)); - - bus.call_noreply(method); - } -@@ -142,6 +219,29 @@ void Watchdog::timeOutHandler() - entry("ERROR=%s", e.what())); - commit(); - } -+ -+ // set restart cause for watchdog HardReset & PowerCycle actions -+ if ((action == Watchdog::Action::HardReset) || -+ (action == Watchdog::Action::PowerCycle)) -+ { -+ try -+ { -+ auto method = bus.new_method_call( -+ restart::busName, restart::path, -+ "org.freedesktop.DBus.Properties", "Set"); -+ method.append( -+ restart::interface, restart::property, -+ std::variant("xyz.openbmc_project.State.Host." -+ "RestartCause.WatchdogTimer")); -+ bus.call(method); -+ } -+ catch (sdbusplus::exception_t& e) -+ { -+ log("Failed to set HostRestartCause property", -+ entry("ERROR=%s", e.what())); -+ commit(); -+ } -+ } - } - - tryFallbackOrDisable(); --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch deleted file mode 100644 index 016cf063a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch +++ /dev/null @@ -1,118 +0,0 @@ -From b05da90d7023199e23daf8fbb49455138332f241 Mon Sep 17 00:00:00 2001 -From: Ren Yu -Date: Wed, 24 Jul 2019 16:21:13 +0800 -Subject: [PATCH] Stop the watchdog when the host is going to off - -After the host is off, check the WDT status, if it is running, -needs to stop it - -Tested: -Set a watchdog with a long time expiration(Timer action is none, -Timer Use is OEM and Initial Countdown is 435.1 second). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0xff 0x10 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -Host off. - ipmitool chassis power off -Get the watchdog. - ipmitool mc watchdog get -Check the watchdog status, expect watchdog is stoped. - -Signed-off-by: Ren Yu ---- - watchdog.cpp | 21 +++++++++++++++++++++ - watchdog.hpp | 23 ++++++++++++++++++++++- - 2 files changed, 43 insertions(+), 1 deletion(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 4c8e480..fa58ef4 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -21,6 +21,10 @@ using namespace phosphor::logging; - using sdbusplus::exception::SdBusError; - using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; - -+const static constexpr char* currentPowerState = "CurrentPowerState"; -+const static constexpr char* powerStatusOff = -+ "xyz.openbmc_project.State.Chassis.PowerState.Off"; -+ - const static constexpr char* powerActionHardReset = - "xyz.openbmc_project.State.Watchdog.Action.HardReset"; - const static constexpr char* powerActionOff = -@@ -60,6 +64,23 @@ static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; - static constexpr const char* request = "RequestedPowerTransition"; - } // namespace chassis - -+void Watchdog::powerStateChangedHandler( -+ const std::map>& props) -+{ -+ const auto iter = props.find(currentPowerState); -+ if (iter != props.end()) -+ { -+ const std::string* powerState = std::get_if(&iter->second); -+ if (powerState && (*powerState == powerStatusOff)) -+ { -+ if (timerEnabled()) -+ { -+ enabled(false); -+ } -+ } -+ } -+} -+ - void Watchdog::resetTimeRemaining(bool enableWatchdog) - { - timeRemaining(interval()); -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..dcbecd1 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp -@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits - WatchdogInherits(bus, objPath), - bus(bus), actionTargetMap(std::move(actionTargetMap)), - fallback(std::move(fallback)), minInterval(minInterval), -- timer(event, std::bind(&Watchdog::timeOutHandler, this)) -+ timer(event, std::bind(&Watchdog::timeOutHandler, this)), -+ powerStateChangedSignal( -+ bus, -+ sdbusplus::bus::match::rules::propertiesChanged( -+ "/xyz/openbmc_project/state/chassis0", -+ "xyz.openbmc_project.State.Chassis"), -+ [this](sdbusplus::message::message& msg) { -+ std::string objectName; -+ std::map> props; -+ msg.read(objectName, props); -+ powerStateChangedHandler(props); -+ }) - { - // We set the watchdog interval with the default value. - interval(interval()); -@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits - tryFallbackOrDisable(); - } - -+ /** @brief Disable watchdog when power status change meet -+ * the specific requirement -+ */ -+ void powerStateChangedHandler( -+ const std::map>& props); -+ - /** @brief Resets the TimeRemaining to the configured Interval - * Optionally enables the watchdog. - * -@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits - /** @brief Contained timer object */ - sdeventplus::utility::Timer timer; - -+ /** @brief Optional Callback handler when power status change meet -+ * the specific requirement */ -+ sdbusplus::bus::match_t powerStateChangedSignal; -+ - /** @brief Optional Callback handler on timer expirartion */ - void timeOutHandler(); - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch deleted file mode 100644 index 60b605418..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 41f71ecfa2b8339281a33c260d78102453d4ac97 Mon Sep 17 00:00:00 2001 -From: Ren Yu -Date: Tue, 30 Jul 2019 15:31:09 +0800 -Subject: [PATCH] Set PreTimeoutInterruptOccurFlag in DBUS - -Set preTimeoutInterruptOccurFlag in DBUS as 'true' when -watchdog pre-timeout interrupt occurred. -This property is use for recording PreTimeoutInterruptOccurFlag. -In command get message flag, need verify whether pre-timeout -interrupt occurred by it. - -Tested: -Set watchdog timer -(Pre-timeout interrupt is Messaging, Initial Countdown is 2 second). -ipmitool raw 0x06 0x24 0x5 0x30 0x1 0x3e 0x14 0x00 -Start watchdog timer. -ipmitool mc watchdog reset -Wait watchdog timer expired, log into below: -http://BMC-IP:3000/ -xyz.openbmc_project.Watchdog -/xyz/openbmc_project/watchdog/host0 -xyz.openbmc_project.State.Watchdog -check whether the value of PreTimeoutInterruptOccurFlag is true. - -Signed-off-by: Ren Yu ---- - watchdog.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/watchdog.cpp b/watchdog.cpp -index fa58ef4..bdf65da 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -198,6 +198,8 @@ void Watchdog::timeOutHandler() - - if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) - { -+ preTimeoutInterruptOccurFlag(true); -+ - sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", - convertForMessage(preTimeoutInterruptAction).c_str(), - "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch deleted file mode 100644 index 578fa1257..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 3bead6316f653f14773e65b2f6b8facb08f200e7 Mon Sep 17 00:00:00 2001 -From: Ren Yu -Date: Fri, 9 Aug 2019 14:54:13 +0800 -Subject: [PATCH] Standardize watchdog redfish format according to EPS - -According to EPS and test requirement, change the messageArgs -in redfish about watchdog action and pre-interrupt action and -add timer user display. - -Tested: -Set a watchdog (Timer action and pre-interrupt action both are none). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -When timer expired, check messageArgs in Redfish with below url: -https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries. - - "Message": "Host Watchdog Event: Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS", - "MessageArgs": [ - "Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS" - ], - - "Message": "Host Watchdog Event: Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM", - "MessageArgs": [ - "Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM" - ], - -Signed-off-by: Ren Yu ---- - watchdog.cpp | 127 +++++++++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 89 insertions(+), 38 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index bdf65da..7cfcc75 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -25,25 +25,28 @@ const static constexpr char* currentPowerState = "CurrentPowerState"; - const static constexpr char* powerStatusOff = - "xyz.openbmc_project.State.Chassis.PowerState.Off"; - --const static constexpr char* powerActionHardReset = -- "xyz.openbmc_project.State.Watchdog.Action.HardReset"; --const static constexpr char* powerActionOff = -- "xyz.openbmc_project.State.Watchdog.Action.PowerOff"; --const static constexpr char* powerActionPowerCycle = -- "xyz.openbmc_project.State.Watchdog.Action.PowerCycle"; --const static constexpr char* powerActionNone = -- "xyz.openbmc_project.State.Watchdog.Action.None"; --const static constexpr char* preInterruptNoAction = -- "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -- --const static constexpr char* hardResteDescription = -- "Hard Reset - System reset due to Watchdog timeout"; -+const static constexpr char* actionDescription = " due to Watchdog timeout"; -+const static constexpr char* hardResetDescription = "Hard Reset - System reset"; - const static constexpr char* powerOffDescription = -- "Power Down - System power down due to Watchdog timeout"; -+ "Power Down - System power down"; - const static constexpr char* powerCycleDescription = -- "Power Cycle - System power cycle due to Watchdog timeout"; -+ "Power Cycle - System power cycle"; - const static constexpr char* timerExpiredDescription = "Timer expired"; --const static constexpr char* preInterruptDescription = "Timer interrupt"; -+ -+const static constexpr char* preInterruptActionNone = -+ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -+ -+const static constexpr char* preInterruptDescriptionSMI = "SMI"; -+const static constexpr char* preInterruptDescriptionNMI = "NMI"; -+const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; -+ -+const static constexpr char* reservedDescription = "Reserved"; -+ -+const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; -+const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; -+const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; -+const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; -+const static constexpr char* timerUseDescriptionOEM = "OEM"; - - namespace restart - { -@@ -161,54 +164,102 @@ uint64_t Watchdog::interval(uint64_t value) - void Watchdog::timeOutHandler() - { - PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); -+ std::string preInterruptActionMessageArgs{}; -+ - Action action = expireAction(); - std::string actionMessageArgs{}; - -+ expiredTimerUse(currentTimerUse()); -+ -+ TimerUse timeUser = expiredTimerUse(); -+ std::string timeUserMessage{}; -+ - if (!this->enabled()) - { - action = fallback->action; - } - -- if (convertForMessage(action) == powerActionHardReset) -- { -- actionMessageArgs = hardResteDescription; -- } -- else if (convertForMessage(action) == powerActionOff) -- { -- actionMessageArgs = powerOffDescription; -- } -- else if (convertForMessage(action) == powerActionPowerCycle) -+ switch (timeUser) - { -- actionMessageArgs = powerCycleDescription; -+ case Watchdog::TimerUse::BIOSFRB2: -+ timeUserMessage = timerUseDescriptionBIOSFRB2; -+ break; -+ case Watchdog::TimerUse::BIOSPOST: -+ timeUserMessage = timerUseDescriptionBIOSPOST; -+ break; -+ case Watchdog::TimerUse::OSLoad: -+ timeUserMessage = timerUseDescriptionOSLoad; -+ break; -+ case Watchdog::TimerUse::SMSOS: -+ timeUserMessage = timerUseDescriptionSMSOS; -+ break; -+ case Watchdog::TimerUse::OEM: -+ timeUserMessage = timerUseDescriptionOEM; -+ break; -+ default: -+ timeUserMessage = reservedDescription; -+ break; - } -- else if (convertForMessage(action) == powerActionNone) -- { -- actionMessageArgs = timerExpiredDescription; -- } -- else -+ -+ switch (action) - { -- actionMessageArgs = "Reserved"; -+ case Watchdog::Action::HardReset: -+ actionMessageArgs = std::string(hardResetDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::PowerOff: -+ actionMessageArgs = std::string(powerOffDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::PowerCycle: -+ actionMessageArgs = std::string(powerCycleDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::None: -+ actionMessageArgs = timerExpiredDescription; -+ break; -+ default: -+ actionMessageArgs = reservedDescription; -+ break; - } - - // Log into redfish event log - sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", - convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, - "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", -- "REDFISH_MESSAGE_ARGS=%s", actionMessageArgs.c_str(), NULL); -+ "REDFISH_MESSAGE_ARGS=%s. timer use: %s", -+ actionMessageArgs.c_str(), timeUserMessage.c_str(), NULL); -+ -+ switch (preTimeoutInterruptAction) -+ { -+ case Watchdog::PreTimeoutInterruptAction::SMI: -+ preInterruptActionMessageArgs = preInterruptDescriptionSMI; -+ break; -+ case Watchdog::PreTimeoutInterruptAction::NMI: -+ preInterruptActionMessageArgs = preInterruptDescriptionNMI; -+ break; -+ case Watchdog::PreTimeoutInterruptAction::MI: -+ preInterruptActionMessageArgs = preInterruptDescriptionMI; -+ break; -+ default: -+ preInterruptActionMessageArgs = reservedDescription; -+ break; -+ } - -- if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) -+ if (preInterruptActionNone != convertForMessage(preTimeoutInterruptAction)) - { - preTimeoutInterruptOccurFlag(true); - - sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", - convertForMessage(preTimeoutInterruptAction).c_str(), - "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", -- "OpenBMC.0.1.IPMIWatchdog", "REDFISH_MESSAGE_ARGS=%s", -- preInterruptDescription, NULL); -+ "OpenBMC.0.1.IPMIWatchdog", -+ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " -+ "Watchdog timeout. timer use: %s", -+ preInterruptActionMessageArgs.c_str(), -+ timeUserMessage.c_str(), NULL); - } - -- expiredTimerUse(currentTimerUse()); -- - auto target = actionTargetMap.find(action); - if (target == actionTargetMap.end()) - { --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend index 0e221a6b5..f0b8e8f23 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend @@ -1,10 +1,7 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" SRCREV = "c35135d32f9cb84b62de7b72eee3a2e87b4b3d4d" -SRC_URI += "file://0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch \ - file://0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch \ - file://0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch \ - file://0004-Standardize-watchdog-redfish-format-according-to-EPS.patch \ +SRC_URI += "file://0001-Customize-phosphor-watchdog-for-Intel-platforms.patch \ " # Remove the override to keep service running after DC cycle diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb index 2ed120659..45c2c5364 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb @@ -5,6 +5,8 @@ DESCRIPTION = "BMC hardware watchdog service that is used to reset BMC \ inherit allarch inherit obmc-phosphor-systemd +RDEPENDS_${PN} = "bash" + LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" @@ -14,3 +16,9 @@ SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/system-watchdog/system-watchdog.conf" SYSTEMD_SERVICE_${PN} += "watchdog-reset.service" SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.service" SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.timer" +SRC_URI += "file://watchdog-reset.sh" + +do_install_append(){ + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/watchdog-reset.sh ${D}${bindir} +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service index 6f33b36d7..6a5ffb4ba 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service @@ -1,8 +1,7 @@ [Unit] Description=Reset BMC Using Hardware Watchdog -Conflicts=system-watchdog.service [Service] -ExecStart=/sbin/watchdog -T 0 -F /dev/watchdog1 +ExecStart=/usr/bin/watchdog-reset.sh Type=oneshot diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh new file mode 100644 index 000000000..b3afd73d3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if /sbin/fw_printenv bootfailures -n | grep -q 3; then + exit 0 # passed boot limit, user started again on purpose +fi + +echo "Watchdog Failure Limit Reached, Failed Processes:" > /dev/kmsg +systemctl --failed --no-pager | grep failed > /dev/kmsg +echo "Log as follows:" > /dev/kmsg +journalctl -r -n 100 | while read line; do echo $line > /dev/kmsg; done + +systemctl stop system-watchdog.service +/sbin/watchdog -T 0 -F /dev/watchdog1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch deleted file mode 100644 index 3885318de..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 5a6e97bdca6db517eabb94a926623e2f662b1315 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Thu, 1 Aug 2019 17:37:17 +0800 -Subject: [PATCH] force to bios fix bump fail - -Signed-off-by: Kuiying Wang ---- - app/common/services/api-utils.js | 30 ++++++++++++++++++ - app/common/services/constants.js | 4 +++ - app/common/services/dataService.js | 1 + - .../controllers/power-operations-controller.html | 11 +++++++ - .../controllers/power-operations-controller.js | 36 ++++++++++++++++++++-- - 5 files changed, 80 insertions(+), 2 deletions(-) - -diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js -index d485016..3d64406 100644 ---- a/app/common/services/api-utils.js -+++ b/app/common/services/api-utils.js -@@ -29,12 +29,42 @@ window.angular && (function(angular) { - HOST_STATE_TEXT: Constants.HOST_STATE, - LED_STATE: Constants.LED_STATE, - LED_STATE_TEXT: Constants.LED_STATE_TEXT, -+ FORCE_TO_BIOS_STATE_TEXT: Constants.FORCE_TO_BIOS_STATE_TEXT, - HOST_SESSION_STORAGE_KEY: Constants.API_CREDENTIALS.host_storage_key, - validIPV4IP: function(ip) { - // Checks for [0-255].[0-255].[0-255].[0-255] - return ip.match( - /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/); - }, -+ setForceToBIOSState: function(state) { -+ console.log(state); -+ var data = JSON.stringify({'Boot': -+ { -+ 'BootSourceOverrideTarget': state -+ } -+ }); -+ return $http({ -+ method: 'PATCH', -+ url: DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true, -+ data: data -+ }); -+ }, -+ getForceToBIOSState: function() { -+ -+ return $http({ -+ method: 'GET', -+ url: DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true -+ }).then( -+ function(response) { -+ console.log(JSON.stringify(response.data.Boot.BootSourceOverrideTarget)); -+ return response.data.Boot.BootSourceOverrideTarget; -+ }, -+ function(error) { -+ console.log(error); -+ }); -+ }, - getRedfishSysName: function() { - return $http({ - method: 'GET', -diff --git a/app/common/services/constants.js b/app/common/services/constants.js -index ae82e76..e594570 100644 ---- a/app/common/services/constants.js -+++ b/app/common/services/constants.js -@@ -42,6 +42,10 @@ window.angular && (function(angular) { - }, - LED_STATE: {on: true, off: false}, - LED_STATE_TEXT: {on: 'on', off: 'off'}, -+ FORCE_TO_BIOS_STATE_TEXT: { -+ on: 'BiosSetup', -+ off: 'None' -+ }, - SEVERITY_TO_PRIORITY_MAP: { - Emergency: 'High', - Alert: 'High', -diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js -index 87fddba..cc9c0b3 100644 ---- a/app/common/services/dataService.js -+++ b/app/common/services/dataService.js -@@ -16,6 +16,7 @@ window.angular && (function(angular) { - this.server_health = Constants.SERVER_HEALTH.unknown; - this.server_state = 'Unreachable'; - this.LED_state = Constants.LED_STATE_TEXT.off; -+ this.ForceToBIOS_state = Constants.FORCE_TO_BIOS_STATE_TEXT.off; - this.last_updated = new Date(); - - this.loading = false; -diff --git a/app/server-control/controllers/power-operations-controller.html b/app/server-control/controllers/power-operations-controller.html -index ddf8bda..ea46e00 100644 ---- a/app/server-control/controllers/power-operations-controller.html -+++ b/app/server-control/controllers/power-operations-controller.html -@@ -10,6 +10,17 @@ -
-
-

{{dataService.hostname}} - {{dataService.server_id}}

-+
-+ -+ -+

Boot to BIOS

-+
-

{{dataService.server_state | quiescedToError}}

-
-
-diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js -index 986ac3b..2c29093 100644 ---- a/app/server-control/controllers/power-operations-controller.js -+++ b/app/server-control/controllers/power-operations-controller.js -@@ -10,10 +10,10 @@ window.angular && (function(angular) { - 'use strict'; - - angular.module('app.serverControl').controller('powerOperationsController', [ -- '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', -+ '$route', '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', - 'toastService', - function( -- $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { -+ $route, $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { - $scope.dataService = dataService; - // Is a || of the other 4 "confirm" variables to ensure only - // one confirm is shown at a time. -@@ -57,6 +57,17 @@ window.angular && (function(angular) { - }, Constants.POLL_INTERVALS.POWER_OP); - return deferred.promise; - }; -+ APIUtils.getForceToBIOSState().then( -+ function(data) { -+ if (data == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) { -+ dataService.ForceToBIOS_state = APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ } else { -+ dataService.ForceToBIOS_state = APIUtils.FORCE_TO_BIOS_STATE_TEXT.off; -+ } -+ }, -+ function(error) { -+ console.log(JSON.stringify(error)); -+ }); - - APIUtils.getLastPowerTime() - .then( -@@ -74,6 +85,27 @@ window.angular && (function(angular) { - $scope.loading = false; - }); - -+ $scope.toggleForceToBIOS = function() { -+ var toggleState = -+ (dataService.ForceToBIOS_state == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) ? -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.off : -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ dataService.ForceToBIOS_state = -+ (dataService.ForceToBIOS_state == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) ? -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.off : -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ APIUtils.setForceToBIOSState(toggleState) -+ .then( -+ function(response) {}, -+ function(errors) { -+ toastService.error( -+ 'Failed to set Boot to BIOS '); -+ console.log(JSON.stringify(errors)); -+ // Reload to get correct current state -+ $route.reload(); -+ }) -+ }; -+ - $scope.toggleState = function() { - dataService.server_state = - (dataService.server_state == 'Running') ? 'Off' : 'Running'; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index 5f18206c8..7133892e9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,6 +1,2 @@ -FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" - -#SRC_URI = "git://github.com/openbmc/phosphor-webui.git" -SRCREV = "30d7c6377f70382088436c7a4830663eb522d588" - -SRC_URI += "file://0004-Implement-force-boot-to-bios-in-server-power-control.patch" +SRC_URI = "git://git@github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel" +SRCREV = "2e0bc44e0c5552395f10e95f66a0874f14403ceb" -- cgit v1.2.3