From 1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Thu, 6 Jan 2022 13:50:19 -0800 Subject: Update to internal 0.86 Signed-off-by: Jason M. Bills --- meta-openbmc-mods/conf/machine/include/intel.inc | 18 +- ...e-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch | 62 + ...clock-stretching-and-multi-master-support.patch | 143 +++ .../u-boot/u-boot-aspeed-sdk_%.bbappend | 2 + ...round-to-cover-UART-interrupt-bug-in-AST2.patch | 178 --- ...-Add-Aspeed-UART-driver-with-DMA-supporte.patch | 1184 ++++++++++++++++++++ ...-serial-8250-Fix-RX-DMA-time-out-property.patch | 29 + ...3-serial-8250_aspeed-Make-port-type-fixed.patch | 57 + ...round-to-cover-UART-interrupt-bug-in-AST2.patch | 269 +++++ .../linux/linux-aspeed/intel-ast2600.cfg | 4 +- .../recipes-kernel/linux/linux-aspeed_%.bbappend | 5 +- .../classes/image_types_intel_pfr.bbclass | 9 +- .../classes/obmc-phosphor-image-common.bbclass | 1 - .../ac-boot-check/ac-boot-check/ac-boot-check.sh | 3 + .../at-scale-debug/at-scale-debug_git.bb | 10 +- .../recipes-core/at-scale-debug/files/asm/rwonce.h | 90 ++ .../recipes-core/dropbear/dropbear_%.bbappend | 22 +- ...-mux-setting-before-SOL-activation-via-SS.patch | 43 + .../recipes-core/dropbear/files/enable-ssh.sh | 33 +- .../recipes-core/fw-update/intel-fw-update.bb | 10 +- .../host-error-monitor_%.bbappend | 2 +- .../recipes-core/interfaces/libmctp/asm/rwonce.h | 89 ++ .../recipes-core/interfaces/libmctp_git.bb | 12 +- .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 2 +- .../recipes-core/libpeci/libpeci_%.bbappend | 2 +- .../recipes-core/os-release/version-vars.inc | 16 +- .../meta-common/recipes-core/safec/safec_3.4.bb | 2 +- ...-Modfiy-system.conf-DefaultTimeoutStopSec.patch | 28 - .../systemd/systemd/systemd-time-wait-sync.service | 36 - .../recipes-core/systemd/systemd_%.bbappend | 17 +- .../boost-url/boost-url_%.bbappend | 4 + .../recipes-devtools/mtd-util/mtd-util.bb | 2 +- .../sdbusplus/sdbusplus_%.bbappend | 3 + .../libvncserver/libvncserver_%.bbappend | 2 +- .../obmc-ikvm/obmc-ikvm_%.bbappend | 2 +- .../host-misc-comm-manager_git.bb | 2 +- .../recipes-intel/hsbp/hsbp-manager_git.bb | 2 +- .../recipes-intel/images/intel-platforms.bb | 1 + .../intel-pfr/intel-blocksign-native.bb | 20 - .../intel-pfr/intel-pfr-signing-utility-native.bb | 20 + .../intel-pfr/obmc-intel-pfr-image-native.bb | 2 +- .../recipes-intel/intel-pfr/pfr-manager_%.bbappend | 2 +- .../recipes-intel/psu-manager/psu-manager.bb | 2 +- .../recipes-intel/smbios/smbios-mdrv2.bb | 2 +- ...ci-Add-debug-printing-to-check-caller-PID.patch | 43 - ...add-AST2600-A0-specific-fix-into-mbox-dri.patch | 42 - .../0003-Fix-libmctp-build-error.patch | 116 -- ...quick-fix-to-resolve-USB-gadget-DMA-issue.patch | 33 - ...05-Die_CPU-filter-first-zero-from-GetTemp.patch | 61 - ...CPU-filter-first-zero-from-RdPkgConfig-10.patch | 66 -- ...p-filter-the-first-zero-from-RdPkgConfig-.patch | 70 -- ...-vegman-kernel-add-RTC-driver-for-PCHC620.patch | 205 ---- ...-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch | 49 - .../recipes-kernel/linux/linux-aspeed_%.bbappend | 17 +- ...ing-channel-specific-privilege-to-network.patch | 52 +- ...Fix-for-updating-MAC-address-from-RedFish.patch | 40 +- ...-logs-to-isolate-the-coredump-issue-of-RT.patch | 261 ----- .../network/phosphor-network_%.bbappend | 3 +- .../biosconfig-manager/biosconfig-manager_git.bb | 2 +- ...dd-HSBP-FRU-details-in-json-configuration.patch | 78 ++ .../configuration/entity-manager_%.bbappend | 3 +- .../console/obmc-console/obmc-console@.service | 2 +- .../dbus/phosphor-dbus-interfaces_%.bbappend | 2 +- .../fans/phosphor-pid-control_%.bbappend | 2 +- ...ish-errors-on-all-pfr-image-auth-failures.patch | 100 ++ .../flash/phosphor-software-manager_%.bbappend | 1 + .../host/phosphor-host-postd_git.bbappend | 2 +- ...001-Firmware-update-configuration-changes.patch | 72 +- ...uting-logic-into-host-console-connection-.patch | 2 +- ...Add-state-sensor-messages-to-the-registry.patch | 14 +- ...registry-for-subscription-related-actions.patch | 10 +- ...b-Add-BMC-Time-update-log-to-the-registry.patch | 12 +- ...-Add-generic-message-PropertySizeExceeded.patch | 25 +- ...-registry-entry-for-FirmwareResiliencyErr.patch | 84 -- .../bmcweb/0024-Add-count-sensor-type.patch | 10 +- ...5-Add-Model-CoreCount-to-ProcessorSummary.patch | 288 +++++ ...-Define-Redfish-interface-Registries-Bios.patch | 260 +++-- .../0003-Add-support-to-ResetBios-action.patch | 64 +- ...0004-Add-support-to-ChangePassword-action.patch | 39 +- ...fix-for-broken-feature-Pending-Attributes.patch | 149 +-- ...d-unmerged-changes-for-http-retry-support.patch | 121 ++ ...ervice-Fix-retry-handling-for-http-client.patch | 546 --------- .../0002-EventService-https-client-support.patch | 166 ++- .../0004-Add-Server-Sent-Events-support.patch | 56 +- ...tyle-subscription-support-to-eventservice.patch | 50 +- .../0006-Add-EventService-SSE-filter-support.patch | 18 +- ...010-Remove-Terminated-Event-Subscriptions.patch | 34 +- ...h-while-deleting-terminated-subscriptions.patch | 141 +++ .../interfaces/bmcweb/eventservice/README | 28 +- ...dd-asyncResp-support-during-handleUpgrade.patch | 202 ++++ .../0002-Move-privileges-to-separate-entity.patch | 109 ++ ...port-for-privilege-check-in-handleUpgrade.patch | 218 ++++ .../0004-Add-Privileges-to-Websockets.patch | 140 +++ .../0005-Add-Privileges-to-SseSockets.patch | 63 ++ ...1-Add-support-for-MetricDefinition-scheme.patch | 489 +++++--- ...2-Sync-Telmetry-service-with-EventService.patch | 9 +- ...d-bmcweb-to-use-new-telemetry-service-API.patch | 2 +- ...MetricDefinition-property-in-MetricReport.patch | 21 +- ...t-Remove-LogService-from-TelemetryService.patch | 22 +- ...eneralize-ReadingType-in-MetricDefinition.patch | 93 -- .../interfaces/bmcweb/telemetry/README | 8 +- ...1-Revert-Disable-nbd-proxy-from-the-build.patch | 26 +- ...edVia-property-to-virtual-media-item-temp.patch | 10 +- .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 21 +- .../ipmi/phosphor-ipmi-host_%.bbappend | 3 + .../ipmi/phosphor-ipmi-ipmb_%.bbappend | 2 +- .../ipmi/phosphor-ipmi-kcs_%.bbappend | 2 +- .../ipmi/phosphor-ipmi-net_%.bbappend | 2 +- .../ipmi/phosphor-node-manager-proxy_git.bb | 2 +- .../network/phosphor-snmp_%.bbappend | 4 + .../recipes-phosphor/peci/peci-pcie_%.bbappend | 2 +- .../recipes-phosphor/pmci/libmctp-intel_git.bb | 2 +- .../recipes-phosphor/pmci/libpldm-intel_git.bb | 2 +- .../recipes-phosphor/pmci/mctp-emulator.bb | 2 +- .../recipes-phosphor/pmci/mctp-wrapper.bb | 2 +- .../meta-common/recipes-phosphor/pmci/mctpd.bb | 2 +- .../meta-common/recipes-phosphor/pmci/mctpwplus.bb | 2 +- .../recipes-phosphor/pmci/nvmemi-daemon.bb | 2 +- .../meta-common/recipes-phosphor/pmci/pldmd.bb | 2 +- .../recipes-phosphor/pmci/pmci-launcher.bb | 2 +- .../prov-mode-mgr/prov-mode-mgr_git.bb | 2 +- .../sel-logger/phosphor-sel-logger_%.bbappend | 2 +- ...004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch | 18 +- ...sor-create-RequirediTempSensor-if-defined.patch | 33 +- ...007-Add-support-for-the-energy-hwmon-type.patch | 49 +- .../sensors/dbus-sensors_%.bbappend | 2 +- .../special-mode-mgr/special-mode-mgr_git.bb | 2 +- .../state/phosphor-post-code-manager_git.bbappend | 2 +- .../recipes-phosphor/system/callback-manager.bb | 2 +- .../telemetry/telemetry_%.bbappend | 2 +- .../users/phosphor-user-manager_%.bbappend | 6 +- .../recipes-phosphor/watchdog/frb2-watchdog.bb | 31 - .../watchdog/frb2-watchdog/.clang-format | 98 -- .../watchdog/frb2-watchdog/CMakeLists.txt | 52 - .../watchdog/frb2-watchdog/cmake-format.json | 12 - .../watchdog/frb2-watchdog/frb2-watchdog.cpp | 264 ----- .../webui/phosphor-webui_%.bbappend | 2 +- ...related-package-changes-from-the-axios-up.patch | 125 --- .../webui/webui-vue/login-company-logo.svg | 32 + .../webui/webui-vue/logo-header.svg | 31 + .../recipes-phosphor/webui/webui-vue_%.bbappend | 7 +- .../recipes-support/curl/curl_7.78.0.bb | 89 -- .../recipes-support/curl/curl_7.79.1.bb | 89 ++ .../nbdkit/0002-Add-support-for-ssl-config.patch | 66 -- .../0003-Add-support-for-tls13-ciphers.patch | 39 - ...dle-empty-CAInfo-in-curl-plugin-correctly.patch | 35 - .../recipes-utilities/nbdkit/nbdkit_git.bb | 7 +- .../0001-Extend-VR-Watchdog-timeout.patch | 16 +- .../chassis/x86-power-control_%.bbappend | 2 +- .../intel-pfr/obmc-intel-pfr-image-native.bbappend | 2 + .../obmc-intel-pfr-image-native/rk_cert.pem | 15 + 151 files changed, 4785 insertions(+), 3700 deletions(-) create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0037-Enable-I2C-clock-stretching-and-multi-master-support.patch delete mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-serial-8250-Add-Aspeed-UART-driver-with-DMA-supporte.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0002-serial-8250-Fix-RX-DMA-time-out-property.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0003-serial-8250_aspeed-Make-port-type-fixed.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/asm/rwonce.h create mode 100644 meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/asm/rwonce.h delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-time-wait-sync.service create mode 100644 meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-Add-debug-printing-to-check-caller-PID.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Fix-libmctp-build-error.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-peci-cputemp-filter-the-first-zero-from-RdPkgConfig-.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-vegman-kernel-add-RTC-driver-for-PCHC620.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-ARM-dts-add-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg delete mode 100644 meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.78.0.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.79.1.bb delete mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0003-Add-support-for-tls13-ciphers.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0004-Handle-empty-CAInfo-in-curl-plugin-correctly.patch create mode 100644 meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native/rk_cert.pem diff --git a/meta-openbmc-mods/conf/machine/include/intel.inc b/meta-openbmc-mods/conf/machine/include/intel.inc index 8f1c9403e..bab124a06 100644 --- a/meta-openbmc-mods/conf/machine/include/intel.inc +++ b/meta-openbmc-mods/conf/machine/include/intel.inc @@ -1,12 +1,12 @@ -OBMC_MACHINE_FEATURES += "\ - obmc-phosphor-fan-mgmt \ - obmc-phosphor-chassis-mgmt \ - obmc-phosphor-flash-mgmt \ - obmc-host-ipmi \ - obmc-host-state-mgmt \ - obmc-chassis-state-mgmt \ - obmc-bmc-state-mgmt \ - " +MACHINE_FEATURES += "\ + obmc-phosphor-fan-mgmt \ + obmc-phosphor-chassis-mgmt \ + obmc-phosphor-flash-mgmt \ + obmc-host-ipmi \ + obmc-host-state-mgmt \ + obmc-chassis-state-mgmt \ + obmc-bmc-state-mgmt \ + " VIRTUAL-RUNTIME_skeleton_workbook = "${MACHINE}-config" VIRTUAL-RUNTIME_obmc-inventory-manager = "entity-manager" diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch new file mode 100644 index 000000000..f48532102 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch @@ -0,0 +1,62 @@ +From 700d71d2c9ef669583acb6900a913620bbb68ce0 Mon Sep 17 00:00:00 2001 +From: sureshv1 +Date: Mon, 20 Sep 2021 11:27:46 +0530 +Subject: [PATCH] Disable BMC MMIO Decode on VGA SCU register bit + +This patch is required to avoid un-necessary logging of +redfish log(P2A Bridge Enabled) as the default value of +SCUC20 has this bit set causing the default/init value +to be taken into consideration and logging the event. + +Tested: +Flashed the image and performed AC Power cycle multiple +times also to check whether any critical events related +to P2A Bridge enabled log, this redfish log is not being +logged after this changes. + +Change-Id: If24fbea338ce17e3b4f1ba93b4d11c7843ddb952 +Signed-off-by: sureshv1 +--- + board/aspeed/ast2600_intel/intel.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c +index 1791045ee8..103bf538b5 100644 +--- a/board/aspeed/ast2600_intel/intel.c ++++ b/board/aspeed/ast2600_intel/intel.c +@@ -478,6 +478,23 @@ static void pwm_init(void) + } + } + ++/* ++ * Description: Disable BMC MMIO Decode on VGA ++ * which is not being used. ++ */ ++void disable_bmc_mmio_decode_vga() ++{ ++#define AST_SCU_BASE 0x1E6E2000 ++#define AST_PCI_CONFIG_REG 0xC20 ++ ++ u32 pcie_config_val = readl(AST_SCU_BASE + AST_PCI_CONFIG_REG); ++ ++ if (pcie_config_val & BIT(1)) { ++ writel(pcie_config_val & ~BIT(1), ++ AST_SCU_BASE + AST_PCI_CONFIG_REG); ++ } ++} ++ + int board_early_init_f(void) + { + /* This is called before relocation; beware! */ +@@ -680,6 +697,8 @@ int board_late_init(void) + + pwm_init(); + ++ disable_bmc_mmio_decode_vga(); ++ + /* Add reset reason to bootargs */ + snprintf(value, sizeof(value), "0x%x", gd->reset_reason); + update_bootargs_cmd("resetreason", value); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0037-Enable-I2C-clock-stretching-and-multi-master-support.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0037-Enable-I2C-clock-stretching-and-multi-master-support.patch new file mode 100644 index 000000000..014915772 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0037-Enable-I2C-clock-stretching-and-multi-master-support.patch @@ -0,0 +1,143 @@ +From 292700faccff983b60a6bf210af36d9bf7a0ac1a Mon Sep 17 00:00:00 2001 +From: Jan Sowinski +Date: Fri, 15 Oct 2021 23:34:10 +0200 +Subject: [PATCH] Enable I2C clock stretching and multi-master support for + AST2600 + +Enabled I2C clock stretching by default to +improve general compatibility with various devices. + +Added support for multi-master mode enabled with +"multi-master" property set in DTS for every i2c node. + +Signed-off-by: Jan Sowinski +--- + arch/arm/dts/ast2600-intel.dts | 8 ++++++++ + drivers/i2c/ast_i2c.c | 19 ++++++++++++------- + 2 files changed, 20 insertions(+), 7 deletions(-) + +diff --git a/arch/arm/dts/ast2600-intel.dts b/arch/arm/dts/ast2600-intel.dts +index a76193716d..dba62fd254 100644 +--- a/arch/arm/dts/ast2600-intel.dts ++++ b/arch/arm/dts/ast2600-intel.dts +@@ -168,6 +168,7 @@ + + &i2c4 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c5_default>; +@@ -175,6 +176,7 @@ + + &i2c5 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c6_default>; +@@ -182,6 +184,7 @@ + + &i2c6 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c7_default>; +@@ -189,6 +192,7 @@ + + &i2c7 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c8_default>; +@@ -196,6 +200,7 @@ + + &i2c8 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c9_default>; +@@ -203,6 +208,7 @@ + + &i2c9 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c10_default>; +@@ -210,6 +216,7 @@ + + &i2c12 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c13_default>; +@@ -217,6 +224,7 @@ + + &i2c13 { + status = "okay"; ++ multi-master; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c14_default>; +diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c +index bbc32d6cdb..974641220b 100644 +--- a/drivers/i2c/ast_i2c.c ++++ b/drivers/i2c/ast_i2c.c +@@ -31,6 +31,8 @@ struct ast_i2c_priv { + struct ast_i2c_regs *regs; + /* I2C speed in Hz */ + int speed; ++ /* Multi-master mode */ ++ bool multi_master; + }; + + /* +@@ -67,14 +69,14 @@ static void ast_i2c_clear_interrupts(struct udevice *dev) + static void ast_i2c_init_bus(struct udevice *dev) + { + struct ast_i2c_priv *priv = dev_get_priv(dev); ++ u32 fun_ctrl_reg = I2CD_MASTER_EN; + + /* Reset device */ + writel(0, &priv->regs->fcr); +- /* Enable Master Mode. Assuming single-master */ +- writel(I2CD_MASTER_EN +- | I2CD_M_SDA_LOCK_EN +- | I2CD_MULTI_MASTER_DIS | I2CD_M_SCL_DRIVE_EN, +- &priv->regs->fcr); ++ /* Enable Single-Master or Multi-Master Mode. */ ++ if (!priv->multi_master) ++ fun_ctrl_reg |= I2CD_MULTI_MASTER_DIS; ++ writel(fun_ctrl_reg, &priv->regs->fcr); + /* Enable Interrupts */ + writel(I2CD_INTR_TX_ACK + | I2CD_INTR_TX_NAK +@@ -100,6 +102,9 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev) + return ret; + } + ++ if (dev_read_bool(dev, "multi-master")) ++ priv->multi_master = true; ++ + return 0; + } + +@@ -246,8 +251,8 @@ static int ast_i2c_deblock(struct udevice *dev) + bool scl_high = csr & I2CD_SCL_LINE_STS; + int ret = 0; + +- if (sda_high && scl_high) { +- /* Bus is idle, no deblocking needed. */ ++ if ((sda_high && scl_high) || priv->multi_master) { ++ /* Bus is idle or multi-master mode enabled, no deblocking needed. */ + return 0; + } else if (sda_high) { + /* Send stop command */ +-- +2.25.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend index 5b4885c2e..1e20585bc 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend @@ -39,6 +39,8 @@ SRC_URI:append:intel-ast2600 = " \ file://0032-Disable-eSPI-initialization-in-u-boot-for-normal-boo.patch \ file://0033-Disable-debug-interfaces.patch \ file://0034-Implement-the-IPMI-commands-in-FFUJ-mode-in-u-boot.patch \ + file://0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch \ + file://0037-Enable-I2C-clock-stretching-and-multi-master-support.patch \ " # CVE-2020-10648 vulnerability fix diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch deleted file mode 100644 index 05e40afb3..000000000 --- a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch +++ /dev/null @@ -1,178 +0,0 @@ -From a136d2c30b850f94ee7b39f842eaede8c0a1c490 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Mon, 27 Apr 2020 12:11:06 -0700 -Subject: [PATCH] Add a workaround to cover UART interrupt bug in AST2600 A0 - -This commit adds a workaround to cover UART interrupt bug in -AST2600 A0 revision. It makes infinite reading on the UART +0x7c -register for clearing abnormal interrupts in every milli-second. - -Signed-off-by: Jae Hyun Yoo ---- - .../arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 8 +++ - drivers/tty/serial/8250/8250_early.c | 1 + - drivers/tty/serial/8250/8250_of.c | 63 +++++++++++++++++++ - 3 files changed, 72 insertions(+) - -diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -index 3218884b90f4..08e1f060341e 100644 ---- a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -+++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -@@ -375,6 +375,8 @@ - }; - - &uart1 { -+ compatible = "aspeed,ast2600-uart"; -+ reg = <0x1e783000 0x20>, <0x1e6e2014 0x4>, <0x1e78307c 0x4>; - status = "okay"; - pinctrl-0 = <&pinctrl_txd1_default - &pinctrl_rxd1_default -@@ -387,6 +389,8 @@ - }; - - &uart2 { -+ compatible = "aspeed,ast2600-uart"; -+ reg = <0x1e78d000 0x20>, <0x1e6e2014 0x4>, <0x1e78d07c 0x4>; - status = "okay"; - pinctrl-0 = <&pinctrl_txd2_default - &pinctrl_rxd2_default -@@ -399,11 +403,15 @@ - }; - - &uart3 { -+ compatible = "aspeed,ast2600-uart"; -+ reg = <0x1e78e000 0x20>, <0x1e6e2014 0x4>, <0x1e78e07c 0x4>; - status = "okay"; - pinctrl-0 = <>; - }; - - &uart4 { -+ compatible = "aspeed,ast2600-uart"; -+ reg = <0x1e78f000 0x20>, <0x1e6e2014 0x4>, <0x1e78f07c 0x4>; - status = "okay"; - pinctrl-0 = <>; - }; -diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c -index 70d7826788f5..56c4725e1b04 100644 ---- a/drivers/tty/serial/8250/8250_early.c -+++ b/drivers/tty/serial/8250/8250_early.c -@@ -180,6 +180,7 @@ OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup); - OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup); - OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup); - OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup); -+OF_EARLYCON_DECLARE(uart, "aspeed,ast2600-uart", early_serial8250_setup); - - #ifdef CONFIG_SERIAL_8250_OMAP - -diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c -index 65e9045dafe6..4d94c9f6a422 100644 ---- a/drivers/tty/serial/8250/8250_of.c -+++ b/drivers/tty/serial/8250/8250_of.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include "8250.h" - -@@ -23,6 +24,9 @@ struct of_serial_info { - struct reset_control *rst; - int type; - int line; -+ struct workqueue_struct *work_queue; -+ struct delayed_work work_handler; -+ void __iomem *wa_base; - }; - - /* -@@ -181,6 +185,18 @@ static int of_platform_serial_setup(struct platform_device *ofdev, - return ret; - } - -+#define WA_DELAY_JIFFIES msecs_to_jiffies(1) -+static void clear_abnormal_int_flags(struct work_struct *work) -+{ -+ struct delayed_work *dwork = to_delayed_work(work); -+ struct of_serial_info *info = container_of(dwork, struct of_serial_info, -+ work_handler); -+ -+ (void) readl(info->wa_base); -+ queue_delayed_work(info->work_queue, &info->work_handler, -+ WA_DELAY_JIFFIES); -+} -+ - /* - * Try to register a serial port - */ -@@ -229,6 +245,47 @@ static int of_platform_serial_probe(struct platform_device *ofdev) - if (ret < 0) - goto err_dispose; - -+ if (of_device_is_compatible(ofdev->dev.of_node, -+ "aspeed,ast2600-uart")) { -+ #define REV_ID_AST2600A0 0x05000303 -+ void __iomem *chip_id_base; -+ struct resource *res = platform_get_resource(ofdev, -+ IORESOURCE_MEM, 1); -+ -+ if (!res || resource_size(res) < 2) -+ goto skip_wa; -+ -+ info->wa_base = devm_platform_ioremap_resource(ofdev, 2); -+ if (IS_ERR(info->wa_base)) -+ goto skip_wa; -+ -+ chip_id_base = devm_ioremap_resource(&ofdev->dev, res); -+ if (IS_ERR(chip_id_base)) -+ goto skip_wa; -+ -+ if (readl(chip_id_base) == REV_ID_AST2600A0) { -+ info->work_queue = alloc_ordered_workqueue(ofdev->name, -+ 0); -+ if (info->work_queue) { -+ INIT_DELAYED_WORK(&info->work_handler, -+ clear_abnormal_int_flags); -+ queue_delayed_work(info->work_queue, -+ &info->work_handler, -+ WA_DELAY_JIFFIES); -+ dev_info(&ofdev->dev, -+ "AST2600 A0 WA initiated\n"); -+ } else { -+ dev_err(&ofdev->dev, -+ "Can't enable AST2600 A0 UART WA\n"); -+ } -+ } -+ -+ devm_iounmap(&ofdev->dev, chip_id_base); -+ devm_release_mem_region(&ofdev->dev, res->start, -+ resource_size(res)); -+ } -+ -+skip_wa: - info->type = port_type; - info->line = ret; - platform_set_drvdata(ofdev, info); -@@ -250,6 +307,11 @@ static int of_platform_serial_remove(struct platform_device *ofdev) - { - struct of_serial_info *info = platform_get_drvdata(ofdev); - -+ if (info->work_queue) { -+ cancel_delayed_work_sync(&info->work_handler); -+ destroy_workqueue(info->work_queue); -+ } -+ - serial8250_unregister_port(info->line); - - reset_control_assert(info->rst); -@@ -319,6 +381,7 @@ static const struct of_device_id of_platform_serial_table[] = { - .data = (void *)PORT_XSCALE, }, - { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, }, - { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, }, -+ { .compatible = "aspeed,ast2600-uart", .data = (void *)PORT_16550A, }, - { /* end of list */ }, - }; - MODULE_DEVICE_TABLE(of, of_platform_serial_table); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-serial-8250-Add-Aspeed-UART-driver-with-DMA-supporte.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-serial-8250-Add-Aspeed-UART-driver-with-DMA-supporte.patch new file mode 100644 index 000000000..525b910d0 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0001-serial-8250-Add-Aspeed-UART-driver-with-DMA-supporte.patch @@ -0,0 +1,1184 @@ +From a4897aed25195742ec9fd992a52a6e7bf872f318 Mon Sep 17 00:00:00 2001 +From: "Chia-Wei, Wang" +Date: Wed, 22 Jul 2020 13:46:21 +0800 +Subject: [PATCH] serial: 8250: Add Aspeed UART driver with DMA supported + +This patch adds drivers for Aspeed UARTs, which are 16550A compatible. +The drivers includes an wrapper to support the extended DMA feature of +UART devices and another UDMA driver to control the UART DMA engine. + +Signed-off-by: Chia-Wei, Wang +--- + arch/arm/boot/dts/aspeed-ast2600-evb.dts | 5 - + .../arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 2 - + arch/arm/boot/dts/aspeed-g6.dtsi | 28 +- + drivers/soc/aspeed/Kconfig | 8 + + drivers/soc/aspeed/Makefile | 1 + + drivers/soc/aspeed/aspeed-udma.c | 441 ++++++++++++++++ + drivers/tty/serial/8250/8250_aspeed.c | 494 ++++++++++++++++++ + drivers/tty/serial/8250/Kconfig | 8 + + drivers/tty/serial/8250/Makefile | 1 + + include/linux/soc/aspeed/aspeed-udma.h | 30 ++ + 10 files changed, 997 insertions(+), 21 deletions(-) + create mode 100644 drivers/soc/aspeed/aspeed-udma.c + create mode 100644 drivers/tty/serial/8250/8250_aspeed.c + create mode 100644 include/linux/soc/aspeed/aspeed-udma.h + +diff --git a/arch/arm/boot/dts/aspeed-ast2600-evb.dts b/arch/arm/boot/dts/aspeed-ast2600-evb.dts +index acbd1c947465..913749205c1d 100644 +--- a/arch/arm/boot/dts/aspeed-ast2600-evb.dts ++++ b/arch/arm/boot/dts/aspeed-ast2600-evb.dts +@@ -180,11 +180,6 @@ + }; + }; + +-&uart5 { +- // Workaround for A0 +- compatible = "snps,dw-apb-uart"; +-}; +- + &i2c0 { + status = "okay"; + +diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts +index 02c837c3e2c4..210d2bbdf836 100644 +--- a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts ++++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts +@@ -427,8 +427,6 @@ + + &uart5 { + status = "okay"; +- // Workaround for A0 +- compatible = "snps,dw-apb-uart"; + }; + + &uart_routing { +diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi +index e76dfb73430e..001ecf9ad33c 100644 +--- a/arch/arm/boot/dts/aspeed-g6.dtsi ++++ b/arch/arm/boot/dts/aspeed-g6.dtsi +@@ -524,23 +524,22 @@ + }; + + uart1: serial@1e783000 { +- compatible = "ns16550a"; ++ compatible = "aspeed,ast2600-uart"; + reg = <0x1e783000 0x20>; +- reg-shift = <2>; +- reg-io-width = <4>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_UART1CLK>; + resets = <&lpc_reset 4>; + no-loopback-test; ++ dma-mode; ++ dma-channel = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_txd1_default &pinctrl_rxd1_default>; + status = "disabled"; + }; + + uart5: serial@1e784000 { +- compatible = "ns16550a"; ++ compatible = "aspeed,ast2600-uart"; + reg = <0x1e784000 0x1000>; +- reg-shift = <2>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_UART5CLK>; + no-loopback-test; +@@ -754,10 +753,8 @@ + }; + + uart2: serial@1e78d000 { +- compatible = "ns16550a"; ++ compatible = "aspeed,ast2600-uart"; + reg = <0x1e78d000 0x20>; +- reg-shift = <2>; +- reg-io-width = <4>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_UART2CLK>; + resets = <&lpc_reset 5>; +@@ -768,10 +765,8 @@ + }; + + uart3: serial@1e78e000 { +- compatible = "ns16550a"; ++ compatible = "aspeed,ast2600-uart"; + reg = <0x1e78e000 0x20>; +- reg-shift = <2>; +- reg-io-width = <4>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_UART3CLK>; + resets = <&lpc_reset 6>; +@@ -782,10 +777,8 @@ + }; + + uart4: serial@1e78f000 { +- compatible = "ns16550a"; ++ compatible = "aspeed,ast2600-uart"; + reg = <0x1e78f000 0x20>; +- reg-shift = <2>; +- reg-io-width = <4>; + interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_UART4CLK>; + resets = <&lpc_reset 7>; +@@ -834,6 +827,13 @@ + clocks = <&syscon ASPEED_CLK_GATE_FSICLK>; + status = "disabled"; + }; ++ ++ udma: uart-dma@1e79e000 { ++ compatible = "aspeed,ast2600-udma"; ++ reg = <0x1e79e000 0x400>; ++ interrupts = ; ++ }; ++ + }; + }; + }; +diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig +index d36ee43451a5..ca284ac2f0ab 100644 +--- a/drivers/soc/aspeed/Kconfig ++++ b/drivers/soc/aspeed/Kconfig +@@ -90,6 +90,14 @@ config ASPEED_XDMA + SoCs. The XDMA engine can perform PCIe DMA operations between the BMC + and a host processor. + ++config ASPEED_UDMA ++ tristate "Aspeed UDMA Engine Driver" ++ depends on SOC_ASPEED && REGMAP && MFD_SYSCON && HAS_DMA ++ help ++ Enable support for the Aspeed UDMA Engine found on the Aspeed AST2XXX ++ SOCs. The UDMA engine can perform UART DMA operations between the memory ++ buffer and the UART/VUART devices. ++ + config ASPEED_VGA_SHAREDMEM + tristate "Aspeed VGA Shared memory" + help +diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile +index f3afc32b58b9..e6248ecdeee3 100644 +--- a/drivers/soc/aspeed/Makefile ++++ b/drivers/soc/aspeed/Makefile +@@ -8,5 +8,6 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o + obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o + obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o + obj-$(CONFIG_ASPEED_XDMA) += aspeed-xdma.o ++obj-$(CONFIG_ASPEED_UDMA) += aspeed-udma.o + obj-$(CONFIG_ASPEED_VGA_SHAREDMEM) += aspeed-vga-sharedmem.o + obj-$(CONFIG_ASPEED_MCTP) += aspeed-mctp.o +diff --git a/drivers/soc/aspeed/aspeed-udma.c b/drivers/soc/aspeed/aspeed-udma.c +new file mode 100644 +index 000000000000..01b73ebe1880 +--- /dev/null ++++ b/drivers/soc/aspeed/aspeed-udma.c +@@ -0,0 +1,441 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DEVICE_NAME "aspeed-udma" ++ ++/* UART DMA registers offset */ ++#define UDMA_TX_DMA_EN 0x000 ++#define UDMA_RX_DMA_EN 0x004 ++#define UDMA_TIMEOUT_TIMER 0x00c ++#define UDMA_TX_DMA_RST 0x020 ++#define UDMA_RX_DMA_RST 0x024 ++#define UDMA_TX_DMA_INT_EN 0x030 ++#define UDMA_TX_DMA_INT_STAT 0x034 ++#define UDMA_RX_DMA_INT_EN 0x038 ++#define UDMA_RX_DMA_INT_STAT 0x03c ++ ++#define UDMA_CHX_OFF(x) ((x) * 0x20) ++#define UDMA_CHX_TX_RD_PTR(x) (0x040 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_TX_WR_PTR(x) (0x044 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_TX_BUF_BASE(x) (0x048 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_TX_CTRL(x) (0x04c + UDMA_CHX_OFF(x)) ++#define UDMA_TX_CTRL_TMOUT_DISABLE BIT(4) ++#define UDMA_TX_CTRL_BUFSZ_MASK GENMASK(3, 0) ++#define UDMA_TX_CTRL_BUFSZ_SHIFT 0 ++#define UDMA_CHX_RX_RD_PTR(x) (0x050 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_RX_WR_PTR(x) (0x054 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_RX_BUF_BASE(x) (0x058 + UDMA_CHX_OFF(x)) ++#define UDMA_CHX_RX_CTRL(x) (0x05c + UDMA_CHX_OFF(x)) ++#define UDMA_RX_CTRL_TMOUT_DISABLE BIT(4) ++#define UDMA_RX_CTRL_BUFSZ_MASK GENMASK(3, 0) ++#define UDMA_RX_CTRL_BUFSZ_SHIFT 0 ++ ++#define UDMA_MAX_CHANNEL 14 ++#define UDMA_TIMEOUT 0x200 ++ ++enum aspeed_udma_bufsz_code { ++ UDMA_BUFSZ_CODE_1KB, ++ UDMA_BUFSZ_CODE_4KB, ++ UDMA_BUFSZ_CODE_16KB, ++ UDMA_BUFSZ_CODE_64KB, ++ ++ /* ++ * 128KB and above are supported ONLY for ++ * virtual UARTs. For physical UARTs, the ++ * size code is wrapped around at the 64K ++ * boundary. ++ */ ++ UDMA_BUFSZ_CODE_128KB, ++ UDMA_BUFSZ_CODE_256KB, ++ UDMA_BUFSZ_CODE_512KB, ++ UDMA_BUFSZ_CODE_1024KB, ++ UDMA_BUFSZ_CODE_2048KB, ++ UDMA_BUFSZ_CODE_4096KB, ++ UDMA_BUFSZ_CODE_8192KB, ++ UDMA_BUFSZ_CODE_16384KB, ++}; ++ ++struct aspeed_udma_chan { ++ dma_addr_t dma_addr; ++ ++ struct circ_buf *rb; ++ u32 rb_sz; ++ ++ aspeed_udma_cb_t cb; ++ void *cb_arg; ++ ++ bool dis_tmout; ++}; ++ ++struct aspeed_udma { ++ struct device *dev; ++ u8 __iomem *regs; ++ u32 irq; ++ struct aspeed_udma_chan tx_chs[UDMA_MAX_CHANNEL]; ++ struct aspeed_udma_chan rx_chs[UDMA_MAX_CHANNEL]; ++ spinlock_t lock; ++}; ++ ++struct aspeed_udma udma[1]; ++ ++static int aspeed_udma_get_bufsz_code(u32 buf_sz) ++{ ++ switch (buf_sz) { ++ case 0x400: ++ return UDMA_BUFSZ_CODE_1KB; ++ case 0x1000: ++ return UDMA_BUFSZ_CODE_4KB; ++ case 0x4000: ++ return UDMA_BUFSZ_CODE_16KB; ++ case 0x10000: ++ return UDMA_BUFSZ_CODE_64KB; ++ case 0x20000: ++ return UDMA_BUFSZ_CODE_128KB; ++ case 0x40000: ++ return UDMA_BUFSZ_CODE_256KB; ++ case 0x80000: ++ return UDMA_BUFSZ_CODE_512KB; ++ case 0x100000: ++ return UDMA_BUFSZ_CODE_1024KB; ++ case 0x200000: ++ return UDMA_BUFSZ_CODE_2048KB; ++ case 0x400000: ++ return UDMA_BUFSZ_CODE_4096KB; ++ case 0x800000: ++ return UDMA_BUFSZ_CODE_8192KB; ++ case 0x1000000: ++ return UDMA_BUFSZ_CODE_16384KB; ++ default: ++ return -1; ++ } ++ ++ return -1; ++} ++ ++static u32 aspeed_udma_get_tx_rptr(u32 ch_no) ++{ ++ return readl(udma->regs + UDMA_CHX_TX_RD_PTR(ch_no)); ++} ++ ++static u32 aspeed_udma_get_rx_wptr(u32 ch_no) ++{ ++ return readl(udma->regs + UDMA_CHX_RX_WR_PTR(ch_no)); ++} ++ ++static void aspeed_udma_set_ptr(u32 ch_no, u32 ptr, bool is_tx) ++{ ++ writel(ptr, udma->regs + ++ ((is_tx) ? ++ UDMA_CHX_TX_WR_PTR(ch_no) : ++ UDMA_CHX_RX_RD_PTR(ch_no))); ++} ++ ++void aspeed_udma_set_tx_wptr(u32 ch_no, u32 wptr) ++{ ++ aspeed_udma_set_ptr(ch_no, wptr, true); ++} ++EXPORT_SYMBOL(aspeed_udma_set_tx_wptr); ++ ++void aspeed_udma_set_rx_rptr(u32 ch_no, u32 rptr) ++{ ++ aspeed_udma_set_ptr(ch_no, rptr, false); ++} ++EXPORT_SYMBOL(aspeed_udma_set_rx_rptr); ++ ++static int aspeed_udma_free_chan(u32 ch_no, bool is_tx) ++{ ++ u32 reg; ++ unsigned long flags; ++ ++ if (ch_no > UDMA_MAX_CHANNEL) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&udma->lock, flags); ++ ++ reg = readl(udma->regs + ++ ((is_tx) ? UDMA_TX_DMA_INT_EN : UDMA_RX_DMA_INT_EN)); ++ reg &= ~(0x1 << ch_no); ++ ++ writel(reg, udma->regs + ++ ((is_tx) ? UDMA_TX_DMA_INT_EN : UDMA_RX_DMA_INT_EN)); ++ ++ spin_unlock_irqrestore(&udma->lock, flags); ++ ++ return 0; ++} ++ ++int aspeed_udma_free_tx_chan(u32 ch_no) ++{ ++ return aspeed_udma_free_chan(ch_no, true); ++} ++EXPORT_SYMBOL(aspeed_udma_free_tx_chan); ++ ++int aspeed_udma_free_rx_chan(u32 ch_no) ++{ ++ return aspeed_udma_free_chan(ch_no, false); ++} ++EXPORT_SYMBOL(aspeed_udma_free_rx_chan); ++ ++static int aspeed_udma_request_chan(u32 ch_no, dma_addr_t addr, ++ struct circ_buf *rb, u32 rb_sz, ++ aspeed_udma_cb_t cb, void *id, bool dis_tmout, bool is_tx) ++{ ++ int retval = 0; ++ int rbsz_code; ++ ++ u32 reg; ++ unsigned long flags; ++ struct aspeed_udma_chan *ch; ++ ++ if (ch_no > UDMA_MAX_CHANNEL) { ++ retval = -EINVAL; ++ goto out; ++ } ++ ++ if (IS_ERR_OR_NULL(rb) || IS_ERR_OR_NULL(rb->buf)) { ++ retval = -EINVAL; ++ goto out; ++ } ++ ++ rbsz_code = aspeed_udma_get_bufsz_code(rb_sz); ++ if (rbsz_code < 0) { ++ retval = -EINVAL; ++ goto out; ++ } ++ ++ spin_lock_irqsave(&udma->lock, flags); ++ ++ if (is_tx) { ++ reg = readl(udma->regs + UDMA_TX_DMA_INT_EN); ++ if (reg & (0x1 << ch_no)) { ++ retval = -EBUSY; ++ goto unlock_n_out; ++ } ++ ++ reg |= (0x1 << ch_no); ++ writel(reg, udma->regs + UDMA_TX_DMA_INT_EN); ++ ++ reg = readl(udma->regs + UDMA_CHX_TX_CTRL(ch_no)); ++ reg |= (dis_tmout) ? UDMA_TX_CTRL_TMOUT_DISABLE : 0; ++ reg |= (rbsz_code << UDMA_TX_CTRL_BUFSZ_SHIFT) & UDMA_TX_CTRL_BUFSZ_MASK; ++ writel(reg, udma->regs + UDMA_CHX_TX_CTRL(ch_no)); ++ ++ writel(addr, udma->regs + UDMA_CHX_TX_BUF_BASE(ch_no)); ++ } ++ else { ++ reg = readl(udma->regs + UDMA_RX_DMA_INT_EN); ++ if (reg & (0x1 << ch_no)) { ++ retval = -EBUSY; ++ goto unlock_n_out; ++ } ++ ++ reg |= (0x1 << ch_no); ++ writel(reg, udma->regs + UDMA_RX_DMA_INT_EN); ++ ++ reg = readl(udma->regs + UDMA_CHX_RX_CTRL(ch_no)); ++ reg |= (dis_tmout) ? UDMA_RX_CTRL_TMOUT_DISABLE : 0; ++ reg |= (rbsz_code << UDMA_RX_CTRL_BUFSZ_SHIFT) & UDMA_RX_CTRL_BUFSZ_MASK; ++ writel(reg, udma->regs + UDMA_CHX_RX_CTRL(ch_no)); ++ ++ writel(addr, udma->regs + UDMA_CHX_RX_BUF_BASE(ch_no)); ++ } ++ ++ ch = (is_tx) ? &udma->tx_chs[ch_no] : &udma->rx_chs[ch_no]; ++ ch->rb = rb; ++ ch->rb_sz = rb_sz; ++ ch->cb = cb; ++ ch->cb_arg = id; ++ ch->dma_addr = addr; ++ ch->dis_tmout = dis_tmout; ++ ++unlock_n_out: ++ spin_unlock_irqrestore(&udma->lock, flags); ++out: ++ return 0; ++} ++ ++int aspeed_udma_request_tx_chan(u32 ch_no, dma_addr_t addr, ++ struct circ_buf *rb, u32 rb_sz, ++ aspeed_udma_cb_t cb, void *id, bool dis_tmout) ++{ ++ return aspeed_udma_request_chan(ch_no, addr, rb, rb_sz, cb, id, ++ dis_tmout, true); ++} ++EXPORT_SYMBOL(aspeed_udma_request_tx_chan); ++ ++int aspeed_udma_request_rx_chan(u32 ch_no, dma_addr_t addr, ++ struct circ_buf *rb, u32 rb_sz, ++ aspeed_udma_cb_t cb, void *id, bool dis_tmout) ++{ ++ return aspeed_udma_request_chan(ch_no, addr, rb, rb_sz, cb, id, ++ dis_tmout, false); ++} ++EXPORT_SYMBOL(aspeed_udma_request_rx_chan); ++ ++static void aspeed_udma_chan_ctrl(u32 ch_no, u32 op, bool is_tx) ++{ ++ unsigned long flags; ++ u32 reg_en, reg_rst; ++ u32 reg_en_off = (is_tx) ? UDMA_TX_DMA_EN : UDMA_RX_DMA_EN; ++ u32 reg_rst_off = (is_tx) ? UDMA_TX_DMA_RST : UDMA_TX_DMA_RST; ++ ++ if (ch_no > UDMA_MAX_CHANNEL) ++ return; ++ ++ spin_lock_irqsave(&udma->lock, flags); ++ ++ reg_en = readl(udma->regs + reg_en_off); ++ reg_rst = readl(udma->regs + reg_rst_off); ++ ++ switch (op) { ++ case ASPEED_UDMA_OP_ENABLE: ++ reg_en |= (0x1 << ch_no); ++ writel(reg_en, udma->regs + reg_en_off); ++ break; ++ case ASPEED_UDMA_OP_DISABLE: ++ reg_en &= ~(0x1 << ch_no); ++ writel(reg_en, udma->regs + reg_en_off); ++ break; ++ case ASPEED_UDMA_OP_RESET: ++ reg_en &= ~(0x1 << ch_no); ++ writel(reg_en, udma->regs + reg_en_off); ++ reg_rst |= (0x1 << ch_no); ++ writel(reg_rst, udma->regs + reg_rst_off); ++ reg_rst &= ~(0x1 << ch_no); ++ writel(reg_rst, udma->regs + reg_rst_off); ++ break; ++ default: ++ break; ++ } ++ ++ spin_unlock_irqrestore(&udma->lock, flags); ++} ++ ++void aspeed_udma_tx_chan_ctrl(u32 ch_no, enum aspeed_udma_ops op) ++{ ++ aspeed_udma_chan_ctrl(ch_no, op, true); ++} ++EXPORT_SYMBOL(aspeed_udma_tx_chan_ctrl); ++ ++void aspeed_udma_rx_chan_ctrl(u32 ch_no, enum aspeed_udma_ops op) ++{ ++ aspeed_udma_chan_ctrl(ch_no, op, false); ++} ++EXPORT_SYMBOL(aspeed_udma_rx_chan_ctrl); ++ ++static irqreturn_t aspeed_udma_isr(int irq, void *arg) ++{ ++ u32 bit; ++ unsigned long tx_stat = readl(udma->regs + UDMA_TX_DMA_INT_STAT); ++ unsigned long rx_stat = readl(udma->regs + UDMA_RX_DMA_INT_STAT); ++ ++ if (udma != (struct aspeed_udma *)arg) ++ return IRQ_NONE; ++ ++ if (tx_stat == 0 && rx_stat == 0) ++ return IRQ_NONE; ++ ++ for_each_set_bit(bit, &tx_stat, UDMA_MAX_CHANNEL) { ++ writel((0x1 << bit), udma->regs + UDMA_TX_DMA_INT_STAT); ++ if (udma->tx_chs[bit].cb) ++ udma->tx_chs[bit].cb(aspeed_udma_get_tx_rptr(bit), ++ udma->tx_chs[bit].cb_arg); ++ } ++ ++ for_each_set_bit(bit, &rx_stat, UDMA_MAX_CHANNEL) { ++ writel((0x1 << bit), udma->regs + UDMA_RX_DMA_INT_STAT); ++ if (udma->rx_chs[bit].cb) ++ udma->rx_chs[bit].cb(aspeed_udma_get_rx_wptr(bit), ++ udma->rx_chs[bit].cb_arg); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int aspeed_udma_probe(struct platform_device *pdev) ++{ ++ int i, rc; ++ struct resource *res; ++ struct device *dev = &pdev->dev; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (IS_ERR_OR_NULL(res)) { ++ dev_err(dev, "failed to get register base\n"); ++ return -ENODEV; ++ } ++ ++ udma->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR_OR_NULL(udma->regs)) { ++ dev_err(dev, "failed to map registers\n"); ++ return PTR_ERR(udma->regs); ++ } ++ ++ /* disable for safety */ ++ writel(0x0, udma->regs + UDMA_TX_DMA_EN); ++ writel(0x0, udma->regs + UDMA_RX_DMA_EN); ++ ++ udma->irq = platform_get_irq(pdev, 0); ++ if (udma->irq < 0) { ++ dev_err(dev, "failed to get IRQ number\n"); ++ return -ENODEV; ++ } ++ ++ rc = devm_request_irq(dev, udma->irq, aspeed_udma_isr, ++ IRQF_SHARED, DEVICE_NAME, udma); ++ if (rc) { ++ dev_err(dev, "failed to request IRQ handler\n"); ++ return rc; ++ } ++ ++ for (i = 0; i < UDMA_MAX_CHANNEL; ++i) { ++ writel(0, udma->regs + UDMA_CHX_TX_WR_PTR(i)); ++ writel(0, udma->regs + UDMA_CHX_RX_RD_PTR(i)); ++ } ++ ++ writel(0xffffffff, udma->regs + UDMA_TX_DMA_RST); ++ writel(0x0, udma->regs + UDMA_TX_DMA_RST); ++ ++ writel(0xffffffff, udma->regs + UDMA_RX_DMA_RST); ++ writel(0x0, udma->regs + UDMA_RX_DMA_RST); ++ ++ writel(0x0, udma->regs + UDMA_TX_DMA_INT_EN); ++ writel(0xffffffff, udma->regs + UDMA_TX_DMA_INT_STAT); ++ writel(0x0, udma->regs + UDMA_RX_DMA_INT_EN); ++ writel(0xffffffff, udma->regs + UDMA_RX_DMA_INT_STAT); ++ ++ writel(UDMA_TIMEOUT, udma->regs + UDMA_TIMEOUT_TIMER); ++ ++ spin_lock_init(&udma->lock); ++ ++ dev_set_drvdata(dev, udma); ++ ++ return 0; ++} ++ ++static const struct of_device_id aspeed_udma_match[] = { ++ { .compatible = "aspeed,ast2500-udma" }, ++ { .compatible = "aspeed,ast2600-udma" }, ++}; ++ ++static struct platform_driver aspeed_udma_driver = { ++ .driver = { ++ .name = DEVICE_NAME, ++ .of_match_table = aspeed_udma_match, ++ ++ }, ++ .probe = aspeed_udma_probe, ++}; ++ ++module_platform_driver(aspeed_udma_driver); ++ ++MODULE_AUTHOR("Chia-Wei Wang "); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Aspeed UDMA Engine Driver"); +diff --git a/drivers/tty/serial/8250/8250_aspeed.c b/drivers/tty/serial/8250/8250_aspeed.c +new file mode 100644 +index 000000000000..1dc798298fca +--- /dev/null ++++ b/drivers/tty/serial/8250/8250_aspeed.c +@@ -0,0 +1,494 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) ASPEED Technology Inc. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "8250.h" ++ ++#define DEVICE_NAME "aspeed-uart" ++ ++/* offsets for the aspeed virtual uart registers */ ++#define VUART_GCRA 0x20 ++#define VUART_GCRA_VUART_EN BIT(0) ++#define VUART_GCRA_SIRQ_POLARITY BIT(1) ++#define VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) ++#define VUART_GCRB 0x24 ++#define VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) ++#define VUART_GCRB_HOST_SIRQ_SHIFT 4 ++#define VUART_ADDRL 0x28 ++#define VUART_ADDRH 0x2c ++ ++#define DMA_TX_BUFSZ PAGE_SIZE ++#define DMA_RX_BUFSZ (64 * 1024) ++ ++struct uart_ops ast8250_pops; ++ ++struct ast8250_vuart { ++ u32 port; ++ u32 sirq; ++ u32 sirq_pol; ++}; ++ ++struct ast8250_udma { ++ u32 ch; ++ ++ u32 tx_rbsz; ++ u32 rx_rbsz; ++ ++ dma_addr_t tx_addr; ++ dma_addr_t rx_addr; ++ ++ struct circ_buf *tx_rb; ++ struct circ_buf *rx_rb; ++ ++ bool tx_tmout_dis; ++ bool rx_tmout_dis; ++}; ++ ++struct ast8250_data { ++ int line; ++ ++ u8 __iomem *regs; ++ ++ bool is_vuart; ++ bool use_dma; ++ ++ struct reset_control *rst; ++ struct clk *clk; ++ ++ struct ast8250_vuart vuart; ++ struct ast8250_udma dma; ++}; ++ ++static void ast8250_dma_tx_complete(int tx_rb_rptr, void *id) ++{ ++ u32 count; ++ unsigned long flags; ++ struct uart_port *port = (struct uart_port*)id; ++ struct ast8250_data *data = port->private_data; ++ ++ spin_lock_irqsave(&port->lock, flags); ++ ++ count = CIRC_CNT(tx_rb_rptr, port->state->xmit.tail, data->dma.tx_rbsz); ++ port->state->xmit.tail = tx_rb_rptr; ++ port->icount.tx += count; ++ ++ if (uart_circ_chars_pending(&port->state->xmit) < WAKEUP_CHARS) ++ uart_write_wakeup(port); ++ ++ spin_unlock_irqrestore(&port->lock, flags); ++} ++ ++static void ast8250_dma_rx_complete(int rx_rb_wptr, void *id) ++{ ++ unsigned long flags; ++ struct uart_port *up = (struct uart_port*)id; ++ struct tty_port *tp = &up->state->port; ++ struct ast8250_data *data = up->private_data; ++ struct ast8250_udma *dma = &data->dma; ++ struct circ_buf *rx_rb = dma->rx_rb; ++ u32 rx_rbsz = dma->rx_rbsz; ++ u32 count = 0; ++ ++ spin_lock_irqsave(&up->lock, flags); ++ ++ rx_rb->head = rx_rb_wptr; ++ ++ dma_sync_single_for_cpu(up->dev, ++ dma->rx_addr, dma->rx_rbsz, DMA_FROM_DEVICE); ++ ++ while (CIRC_CNT(rx_rb->head, rx_rb->tail, rx_rbsz)) { ++ count = CIRC_CNT_TO_END(rx_rb->head, rx_rb->tail, rx_rbsz); ++ ++ tty_insert_flip_string(tp, rx_rb->buf + rx_rb->tail, count); ++ ++ rx_rb->tail += count; ++ rx_rb->tail %= rx_rbsz; ++ ++ up->icount.rx += count; ++ } ++ ++ if (count) { ++ aspeed_udma_set_rx_rptr(data->dma.ch, rx_rb->tail); ++ tty_flip_buffer_push(tp); ++ } ++ ++ spin_unlock_irqrestore(&up->lock, flags); ++} ++ ++static void ast8250_dma_start_tx(struct uart_port *port) ++{ ++ struct ast8250_data *data = port->private_data; ++ struct ast8250_udma *dma = &data->dma; ++ struct circ_buf *tx_rb = dma->tx_rb; ++ ++ dma_sync_single_for_device(port->dev, ++ dma->tx_addr, dma->tx_rbsz, DMA_TO_DEVICE); ++ ++ aspeed_udma_set_tx_wptr(dma->ch, tx_rb->head); ++} ++ ++static void ast8250_dma_pops_hook(struct uart_port *port) ++{ ++ static int first = 1; ++ ++ if (first) { ++ ast8250_pops = *port->ops; ++ ast8250_pops.start_tx = ast8250_dma_start_tx; ++ } ++ ++ first = 0; ++ port->ops = &ast8250_pops; ++} ++ ++static void ast8250_vuart_init(struct ast8250_data *data) ++{ ++ u8 reg; ++ struct ast8250_vuart *vuart = &data->vuart; ++ ++ /* IO port address */ ++ writeb((u8)(vuart->port >> 0), data->regs + VUART_ADDRL); ++ writeb((u8)(vuart->port >> 8), data->regs + VUART_ADDRH); ++ ++ /* SIRQ number */ ++ reg = readb(data->regs + VUART_GCRB); ++ reg &= ~VUART_GCRB_HOST_SIRQ_MASK; ++ reg |= ((vuart->sirq << VUART_GCRB_HOST_SIRQ_SHIFT) & VUART_GCRB_HOST_SIRQ_MASK); ++ writeb(reg, data->regs + VUART_GCRB); ++ ++ /* SIRQ polarity */ ++ reg = readb(data->regs + VUART_GCRA); ++ if (vuart->sirq_pol) ++ reg |= VUART_GCRA_SIRQ_POLARITY; ++ else ++ reg &= ~VUART_GCRA_SIRQ_POLARITY; ++ writeb(reg, data->regs + VUART_GCRA); ++} ++ ++static void ast8250_vuart_set_host_tx_discard(struct ast8250_data *data, bool discard) ++{ ++ u8 reg; ++ ++ reg = readb(data->regs + VUART_GCRA); ++ if (discard) ++ reg &= ~VUART_GCRA_DISABLE_HOST_TX_DISCARD; ++ else ++ reg |= VUART_GCRA_DISABLE_HOST_TX_DISCARD; ++ writeb(reg, data->regs + VUART_GCRA); ++} ++ ++static void ast8250_vuart_set_enable(struct ast8250_data *data, bool enable) ++{ ++ u8 reg; ++ ++ reg = readb(data->regs + VUART_GCRA); ++ if (enable) ++ reg |= VUART_GCRA_VUART_EN; ++ else ++ reg &= ~VUART_GCRA_VUART_EN; ++ writeb(reg, data->regs + VUART_GCRA); ++} ++ ++static int ast8250_handle_irq(struct uart_port *port) ++{ ++ u32 iir = port->serial_in(port, UART_IIR); ++ return serial8250_handle_irq(port, iir); ++} ++ ++static int ast8250_startup(struct uart_port *port) ++{ ++ int rc = 0; ++ struct ast8250_data *data = port->private_data; ++ struct ast8250_udma *dma; ++ ++ if (data->is_vuart) ++ ast8250_vuart_set_host_tx_discard(data, false); ++ ++ if (data->use_dma) { ++ dma = &data->dma; ++ ++ dma->tx_rbsz = DMA_TX_BUFSZ; ++ dma->rx_rbsz = DMA_RX_BUFSZ; ++ ++ /* ++ * We take the xmit buffer passed from upper layers as ++ * the DMA TX buffer and allocate a new buffer for the ++ * RX use. ++ * ++ * To keep the TX/RX operation consistency, we use the ++ * streaming DMA interface instead of the coherent one ++ */ ++ dma->tx_rb = &port->state->xmit; ++ dma->rx_rb->buf = kzalloc(data->dma.rx_rbsz, GFP_KERNEL); ++ if (IS_ERR_OR_NULL(dma->rx_rb->buf)) { ++ dev_err(port->dev, "failed to allcoate RX DMA buffer\n"); ++ rc = -ENOMEM; ++ goto out; ++ } ++ ++ dma->tx_addr = dma_map_single(port->dev, dma->tx_rb->buf, ++ dma->tx_rbsz, DMA_TO_DEVICE); ++ if (dma_mapping_error(port->dev, dma->tx_addr)) { ++ dev_err(port->dev, "failed to map streaming TX DMA region\n"); ++ rc = -ENOMEM; ++ goto free_dma_n_out; ++ } ++ ++ dma->rx_addr = dma_map_single(port->dev, dma->rx_rb->buf, ++ dma->rx_rbsz, DMA_FROM_DEVICE); ++ if (dma_mapping_error(port->dev, dma->rx_addr)) { ++ dev_err(port->dev, "failed to map streaming RX DMA region\n"); ++ rc = -ENOMEM; ++ goto free_dma_n_out; ++ } ++ ++ rc = aspeed_udma_request_tx_chan(dma->ch, dma->tx_addr, ++ dma->tx_rb, dma->tx_rbsz, ast8250_dma_tx_complete, port, dma->tx_tmout_dis); ++ if (rc) { ++ dev_err(port->dev, "failed to request DMA TX channel\n"); ++ goto free_dma_n_out; ++ } ++ ++ rc = aspeed_udma_request_rx_chan(dma->ch, dma->rx_addr, ++ dma->rx_rb, dma->rx_rbsz, ast8250_dma_rx_complete, port, dma->tx_tmout_dis); ++ if (rc) { ++ dev_err(port->dev, "failed to request DMA RX channel\n"); ++ goto free_dma_n_out; ++ } ++ ++ ast8250_dma_pops_hook(port); ++ ++ aspeed_udma_tx_chan_ctrl(dma->ch, ASPEED_UDMA_OP_ENABLE); ++ aspeed_udma_rx_chan_ctrl(dma->ch, ASPEED_UDMA_OP_ENABLE); ++ } ++ ++ memset(&port->icount, 0, sizeof(port->icount)); ++ return serial8250_do_startup(port); ++ ++free_dma_n_out: ++ kfree(dma->rx_rb->buf); ++out: ++ return rc; ++} ++ ++static void ast8250_shutdown(struct uart_port *port) ++{ ++ int rc; ++ struct ast8250_data *data = port->private_data; ++ struct ast8250_udma *dma; ++ ++ if (data->use_dma) { ++ dma = &data->dma; ++ ++ aspeed_udma_tx_chan_ctrl(dma->ch, ASPEED_UDMA_OP_DISABLE); ++ aspeed_udma_rx_chan_ctrl(dma->ch, ASPEED_UDMA_OP_DISABLE); ++ ++ rc = aspeed_udma_free_tx_chan(dma->ch); ++ if (rc) ++ dev_err(port->dev, "failed to free DMA TX channel, rc=%d\n", rc); ++ ++ rc = aspeed_udma_free_rx_chan(dma->ch); ++ if (rc) ++ dev_err(port->dev, "failed to free DMA TX channel, rc=%d\n", rc); ++ ++ dma_unmap_single(port->dev, dma->tx_addr, ++ dma->tx_rbsz, DMA_TO_DEVICE); ++ dma_unmap_single(port->dev, dma->rx_addr, ++ dma->rx_rbsz, DMA_FROM_DEVICE); ++ ++ if (dma->rx_rb->buf) ++ kfree(dma->rx_rb->buf); ++ } ++ ++ if (data->is_vuart) ++ ast8250_vuart_set_host_tx_discard(data, true); ++ ++ serial8250_do_shutdown(port); ++} ++ ++static int __maybe_unused ast8250_suspend(struct device *dev) ++{ ++ struct ast8250_data *data = dev_get_drvdata(dev); ++ serial8250_suspend_port(data->line); ++ return 0; ++} ++ ++static int __maybe_unused ast8250_resume(struct device *dev) ++{ ++ struct ast8250_data *data = dev_get_drvdata(dev); ++ serial8250_resume_port(data->line); ++ return 0; ++} ++ ++static int ast8250_probe(struct platform_device *pdev) ++{ ++ int rc; ++ struct uart_8250_port uart = {}; ++ struct uart_port *port = &uart.port; ++ struct device *dev = &pdev->dev; ++ struct ast8250_data *data; ++ ++ struct resource *res; ++ u32 irq; ++ ++ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); ++ if (data == NULL) ++ return -ENOMEM; ++ ++ data->dma.rx_rb = devm_kzalloc(dev, sizeof(data->dma.rx_rb), GFP_KERNEL); ++ if (data->dma.rx_rb == NULL) ++ return -ENOMEM; ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ if (irq != -EPROBE_DEFER) ++ dev_err(dev, "failed to get IRQ number\n"); ++ return irq; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (res == NULL) { ++ dev_err(dev, "failed to get register base\n"); ++ return -ENODEV; ++ } ++ ++ data->regs = devm_ioremap(dev, res->start, resource_size(res)); ++ if (IS_ERR(data->regs)) { ++ dev_err(dev, "failed to map registers\n"); ++ return PTR_ERR(data->regs); ++ } ++ ++ data->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(data->clk)) { ++ dev_err(dev, "failed to get clocks\n"); ++ return -ENODEV; ++ } ++ ++ rc = clk_prepare_enable(data->clk); ++ if (rc) { ++ dev_err(dev, "failed to enable clock\n"); ++ return rc; ++ } ++ ++ data->rst = devm_reset_control_get_optional_exclusive(dev, NULL); ++ if (!IS_ERR(data->rst)) ++ reset_control_deassert(data->rst); ++ ++ data->is_vuart = of_property_read_bool(dev->of_node, "virtual"); ++ if (data->is_vuart) { ++ rc = of_property_read_u32(dev->of_node, "port", &data->vuart.port); ++ if (rc) { ++ dev_err(dev, "failed to get VUART port address\n"); ++ return -ENODEV; ++ } ++ ++ rc = of_property_read_u32(dev->of_node, "sirq", &data->vuart.sirq); ++ if (rc) { ++ dev_err(dev, "failed to get VUART SIRQ number\n"); ++ return -ENODEV; ++ } ++ ++ rc = of_property_read_u32(dev->of_node, "sirq-polarity", &data->vuart.sirq_pol); ++ if (rc) { ++ dev_err(dev, "failed to get VUART SIRQ polarity\n"); ++ return -ENODEV; ++ } ++ ++ ast8250_vuart_init(data); ++ ast8250_vuart_set_host_tx_discard(data, true); ++ ast8250_vuart_set_enable(data, true); ++ } ++ ++ data->use_dma = of_property_read_bool(dev->of_node, "dma-mode"); ++ if (data->use_dma) { ++ rc = of_property_read_u32(dev->of_node, "dma-channel", &data->dma.ch); ++ if (rc) { ++ dev_err(dev, "failed to get DMA channel\n"); ++ return -ENODEV; ++ } ++ ++ data->dma.tx_tmout_dis = of_property_read_bool(dev->of_node, "dma-tx-timeout-disable"); ++ data->dma.rx_tmout_dis = of_property_read_bool(dev->of_node, "dma-rx-timeout-disable"); ++ } ++ ++ spin_lock_init(&port->lock); ++ port->dev = dev; ++ port->type = PORT_16550; ++ port->irq = irq; ++ port->line = of_alias_get_id(dev->of_node, "serial"); ++ port->handle_irq = ast8250_handle_irq; ++ port->mapbase = res->start; ++ port->mapsize = resource_size(res); ++ port->membase = data->regs; ++ port->uartclk = clk_get_rate(data->clk); ++ port->regshift = 2; ++ port->iotype = UPIO_MEM32; ++ port->flags = UPF_FIXED_PORT | UPF_SHARE_IRQ; ++ port->startup = ast8250_startup; ++ port->shutdown = ast8250_shutdown; ++ port->private_data = data; ++ ++ data->line = serial8250_register_8250_port(&uart); ++ if (data->line < 0) { ++ dev_err(dev, "failed to register 8250 port\n"); ++ return data->line; ++ } ++ ++ pm_runtime_set_active(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ ++ platform_set_drvdata(pdev, data); ++ return 0; ++} ++ ++static int ast8250_remove(struct platform_device *pdev) ++{ ++ struct ast8250_data *data = platform_get_drvdata(pdev); ++ ++ if (data->is_vuart) ++ ast8250_vuart_set_enable(data, false); ++ ++ serial8250_unregister_port(data->line); ++ return 0; ++} ++ ++static const struct dev_pm_ops ast8250_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(ast8250_suspend, ast8250_resume) ++}; ++ ++static const struct of_device_id ast8250_of_match[] = { ++ { .compatible = "aspeed,ast2500-uart" }, ++ { .compatible = "aspeed,ast2600-uart" }, ++}; ++ ++static struct platform_driver ast8250_platform_driver = { ++ .driver = { ++ .name = DEVICE_NAME, ++ .pm = &ast8250_pm_ops, ++ .of_match_table = ast8250_of_match, ++ }, ++ .probe = ast8250_probe, ++ .remove = ast8250_remove, ++}; ++ ++module_platform_driver(ast8250_platform_driver); ++ ++MODULE_AUTHOR("Chia-Wei Wang "); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Aspeed UART Driver"); +diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig +index d1b3c2373fa4..b62a972c9c97 100644 +--- a/drivers/tty/serial/8250/Kconfig ++++ b/drivers/tty/serial/8250/Kconfig +@@ -249,6 +249,14 @@ config SERIAL_8250_ACCENT + To compile this driver as a module, choose M here: the module + will be called 8250_accent. + ++config SERIAL_8250_ASPEED ++ tristate "Aspeed serial port support" ++ depends on SERIAL_8250 && ARCH_ASPEED ++ select ASPEED_UDMA ++ help ++ If you have a system using an Aspeed ASTXXXX SoCs and wish to make use ++ of its UARTs, say Y to this option. If unsure, say N. ++ + config SERIAL_8250_ASPEED_VUART + tristate "Aspeed Virtual UART" + depends on SERIAL_8250 +diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile +index b9bcd73c8997..310375fe8d7e 100644 +--- a/drivers/tty/serial/8250/Makefile ++++ b/drivers/tty/serial/8250/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_SERIAL_8250_EXAR) += 8250_exar.o + obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o + obj-$(CONFIG_SERIAL_8250_CS) += serial_cs.o + obj-$(CONFIG_SERIAL_8250_ACORN) += 8250_acorn.o ++obj-$(CONFIG_SERIAL_8250_ASPEED) += 8250_aspeed.o + obj-$(CONFIG_SERIAL_8250_ASPEED_VUART) += 8250_aspeed_vuart.o + obj-$(CONFIG_SERIAL_8250_BCM2835AUX) += 8250_bcm2835aux.o + obj-$(CONFIG_SERIAL_8250_CONSOLE) += 8250_early.o +diff --git a/include/linux/soc/aspeed/aspeed-udma.h b/include/linux/soc/aspeed/aspeed-udma.h +new file mode 100644 +index 000000000000..33acea745f1c +--- /dev/null ++++ b/include/linux/soc/aspeed/aspeed-udma.h +@@ -0,0 +1,30 @@ ++#ifndef __ASPEED_UDMA_H__ ++#define __ASPEED_UDMA_H__ ++ ++#include ++ ++typedef void (*aspeed_udma_cb_t)(int rb_rwptr, void *id); ++ ++enum aspeed_udma_ops { ++ ASPEED_UDMA_OP_ENABLE, ++ ASPEED_UDMA_OP_DISABLE, ++ ASPEED_UDMA_OP_RESET, ++}; ++ ++void aspeed_udma_set_tx_wptr(u32 ch_no, u32 wptr); ++void aspeed_udma_set_rx_rptr(u32 ch_no, u32 rptr); ++ ++void aspeed_udma_tx_chan_ctrl(u32 ch_no, enum aspeed_udma_ops op); ++void aspeed_udma_rx_chan_ctrl(u32 ch_no, enum aspeed_udma_ops op); ++ ++int aspeed_udma_request_tx_chan(u32 ch_no, dma_addr_t addr, ++ struct circ_buf *rb, u32 rb_sz, ++ aspeed_udma_cb_t cb, void *id, bool en_tmout); ++int aspeed_udma_request_rx_chan(u32 ch_no, dma_addr_t addr, ++ struct circ_buf *rb, u32 rb_sz, ++ aspeed_udma_cb_t cb, void *id, bool en_tmout); ++ ++int aspeed_udma_free_tx_chan(u32 ch_no); ++int aspeed_udma_free_rx_chan(u32 ch_no); ++ ++#endif +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0002-serial-8250-Fix-RX-DMA-time-out-property.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0002-serial-8250-Fix-RX-DMA-time-out-property.patch new file mode 100644 index 000000000..bbadb8b01 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0002-serial-8250-Fix-RX-DMA-time-out-property.patch @@ -0,0 +1,29 @@ +From 64897e97edeefc7fbc89b07aaece760009ba76a0 Mon Sep 17 00:00:00 2001 +From: "Chia-Wei, Wang" +Date: Mon, 21 Dec 2020 16:27:20 +0800 +Subject: [PATCH] serial: 8250: Fix RX DMA time out property + +Fix the typo that passing the TX DMA time out property +to the RX configuration. + +Signed-off-by: Chia-Wei, Wang +--- + drivers/tty/serial/8250/8250_aspeed.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/8250/8250_aspeed.c b/drivers/tty/serial/8250/8250_aspeed.c +index 1dc798298fca..fc14c86d3761 100644 +--- a/drivers/tty/serial/8250/8250_aspeed.c ++++ b/drivers/tty/serial/8250/8250_aspeed.c +@@ -266,7 +266,7 @@ static int ast8250_startup(struct uart_port *port) + } + + rc = aspeed_udma_request_rx_chan(dma->ch, dma->rx_addr, +- dma->rx_rb, dma->rx_rbsz, ast8250_dma_rx_complete, port, dma->tx_tmout_dis); ++ dma->rx_rb, dma->rx_rbsz, ast8250_dma_rx_complete, port, dma->rx_tmout_dis); + if (rc) { + dev_err(port->dev, "failed to request DMA RX channel\n"); + goto free_dma_n_out; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0003-serial-8250_aspeed-Make-port-type-fixed.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0003-serial-8250_aspeed-Make-port-type-fixed.patch new file mode 100644 index 000000000..4a0e221b6 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0003-serial-8250_aspeed-Make-port-type-fixed.patch @@ -0,0 +1,57 @@ +From a7a8bf2f7df17f69a407abe21a14b3f0f2c7338c Mon Sep 17 00:00:00 2001 +From: Chia-Wei Wang +Date: Mon, 31 May 2021 15:39:59 +0800 +Subject: [PATCH] serial/8250_aspeed: Make port type fixed + +Make the UART port type fixed to 16550A to +avoid redundant probing. + +Signed-off-by: Chia-Wei Wang +Change-Id: Id179725b1cd475cd52c18c43b6c312dcd912fc20 +--- + drivers/tty/serial/8250/8250_aspeed.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_aspeed.c b/drivers/tty/serial/8250/8250_aspeed.c +index fc14c86d3761..bb3955bb8c24 100644 +--- a/drivers/tty/serial/8250/8250_aspeed.c ++++ b/drivers/tty/serial/8250/8250_aspeed.c +@@ -25,12 +25,12 @@ + + /* offsets for the aspeed virtual uart registers */ + #define VUART_GCRA 0x20 +-#define VUART_GCRA_VUART_EN BIT(0) +-#define VUART_GCRA_SIRQ_POLARITY BIT(1) +-#define VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) ++#define VUART_GCRA_VUART_EN BIT(0) ++#define VUART_GCRA_SIRQ_POLARITY BIT(1) ++#define VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) + #define VUART_GCRB 0x24 +-#define VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) +-#define VUART_GCRB_HOST_SIRQ_SHIFT 4 ++#define VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) ++#define VUART_GCRB_HOST_SIRQ_SHIFT 4 + #define VUART_ADDRL 0x28 + #define VUART_ADDRH 0x2c + +@@ -429,7 +429,7 @@ static int ast8250_probe(struct platform_device *pdev) + + spin_lock_init(&port->lock); + port->dev = dev; +- port->type = PORT_16550; ++ port->type = PORT_16550A; + port->irq = irq; + port->line = of_alias_get_id(dev->of_node, "serial"); + port->handle_irq = ast8250_handle_irq; +@@ -439,7 +439,7 @@ static int ast8250_probe(struct platform_device *pdev) + port->uartclk = clk_get_rate(data->clk); + port->regshift = 2; + port->iotype = UPIO_MEM32; +- port->flags = UPF_FIXED_PORT | UPF_SHARE_IRQ; ++ port->flags = UPF_FIXED_TYPE | UPF_FIXED_PORT | UPF_SHARE_IRQ; + port->startup = ast8250_startup; + port->shutdown = ast8250_shutdown; + port->private_data = data; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch new file mode 100644 index 000000000..757b00a25 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch @@ -0,0 +1,269 @@ +From a9b43dbf68a4b5650dd98332243d4a2951717eb5 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Mon, 27 Apr 2020 12:11:06 -0700 +Subject: [PATCH] Add a workaround to cover UART interrupt bug in AST2600 A0 + +This commit adds a workaround to cover UART interrupt bug in +AST2600 A0 revision. It makes infinite reading on the UART +0x7c +register for clearing abnormal interrupts in every milli-second. + +Signed-off-by: Jae Hyun Yoo +--- + .../arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 4 ++ + drivers/tty/serial/8250/8250_aspeed.c | 56 ++++++++++++++++- + drivers/tty/serial/8250/8250_early.c | 1 + + drivers/tty/serial/8250/8250_of.c | 63 +++++++++++++++++++ + 4 files changed, 123 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts +index c648c123c315..bf375634082c 100644 +--- a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts ++++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts +@@ -392,6 +392,7 @@ + }; + + &uart1 { ++ reg = <0x1e783000 0x20>, <0x1e6e2014 0x4>, <0x1e78307c 0x4>; + status = "okay"; + pinctrl-0 = <&pinctrl_txd1_default + &pinctrl_rxd1_default +@@ -404,6 +405,7 @@ + }; + + &uart2 { ++ reg = <0x1e78d000 0x20>, <0x1e6e2014 0x4>, <0x1e78d07c 0x4>; + status = "okay"; + pinctrl-0 = <&pinctrl_txd2_default + &pinctrl_rxd2_default +@@ -416,11 +418,13 @@ + }; + + &uart3 { ++ reg = <0x1e78e000 0x20>, <0x1e6e2014 0x4>, <0x1e78e07c 0x4>; + status = "okay"; + pinctrl-0 = <>; + }; + + &uart4 { ++ reg = <0x1e78f000 0x20>, <0x1e6e2014 0x4>, <0x1e78f07c 0x4>; + status = "okay"; + pinctrl-0 = <>; + }; +diff --git a/drivers/tty/serial/8250/8250_aspeed.c b/drivers/tty/serial/8250/8250_aspeed.c +index bb3955bb8c24..1ba4423d5e2f 100644 +--- a/drivers/tty/serial/8250/8250_aspeed.c ++++ b/drivers/tty/serial/8250/8250_aspeed.c +@@ -74,6 +74,10 @@ struct ast8250_data { + + struct ast8250_vuart vuart; + struct ast8250_udma dma; ++ ++ struct workqueue_struct *work_queue; ++ struct delayed_work work_handler; ++ void __iomem *wa_base; + }; + + static void ast8250_dma_tx_complete(int tx_rb_rptr, void *id) +@@ -336,12 +340,25 @@ static int __maybe_unused ast8250_resume(struct device *dev) + return 0; + } + ++#define WA_DELAY_JIFFIES msecs_to_jiffies(1) ++static void ast8250_clear_abnormal_int_flags(struct work_struct *work) ++{ ++ struct delayed_work *dwork = to_delayed_work(work); ++ struct ast8250_data *data = container_of(dwork, struct ast8250_data, ++ work_handler); ++ ++ (void) readl(data->wa_base); ++ queue_delayed_work(data->work_queue, &data->work_handler, ++ WA_DELAY_JIFFIES); ++} ++ + static int ast8250_probe(struct platform_device *pdev) + { + int rc; + struct uart_8250_port uart = {}; + struct uart_port *port = &uart.port; + struct device *dev = &pdev->dev; ++ void __iomem *chip_id_base; + struct ast8250_data *data; + + struct resource *res; +@@ -454,6 +471,37 @@ static int ast8250_probe(struct platform_device *pdev) + pm_runtime_enable(&pdev->dev); + + platform_set_drvdata(pdev, data); ++ ++ #define REV_ID_AST2600A0 0x05000303 ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ if (!res || resource_size(res) < 2) ++ return 0; ++ ++ data->wa_base = devm_platform_ioremap_resource(pdev, 2); ++ if (IS_ERR(data->wa_base)) ++ return 0; ++ ++ chip_id_base = devm_ioremap_resource(dev, res); ++ if (IS_ERR(chip_id_base)) ++ return 0; ++ ++ if (readl(chip_id_base) == REV_ID_AST2600A0) { ++ data->work_queue = alloc_ordered_workqueue(pdev->name, 0); ++ if (data->work_queue) { ++ INIT_DELAYED_WORK(&data->work_handler, ++ ast8250_clear_abnormal_int_flags); ++ queue_delayed_work(data->work_queue, ++ &data->work_handler, ++ WA_DELAY_JIFFIES); ++ dev_info(dev, "AST2600 A0 WA initiated\n"); ++ } else { ++ dev_err(dev, "Can't enable AST2600 A0 UART WA\n"); ++ } ++ } ++ ++ devm_iounmap(dev, chip_id_base); ++ devm_release_mem_region(dev, res->start, resource_size(res)); ++ + return 0; + } + +@@ -464,7 +512,13 @@ static int ast8250_remove(struct platform_device *pdev) + if (data->is_vuart) + ast8250_vuart_set_enable(data, false); + +- serial8250_unregister_port(data->line); ++ if (data->work_queue) { ++ cancel_delayed_work_sync(&data->work_handler); ++ destroy_workqueue(data->work_queue); ++ } ++ ++ serial8250_unregister_port(data->line); ++ + return 0; + } + +diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c +index c171ce6db691..6d7bb63fe0c6 100644 +--- a/drivers/tty/serial/8250/8250_early.c ++++ b/drivers/tty/serial/8250/8250_early.c +@@ -180,6 +180,7 @@ OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup); + OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup); + OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup); + OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup); ++OF_EARLYCON_DECLARE(uart, "aspeed,ast2600-uart", early_serial8250_setup); + + #ifdef CONFIG_SERIAL_8250_OMAP + +diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c +index bce28729dd7b..6159d8af6fef 100644 +--- a/drivers/tty/serial/8250/8250_of.c ++++ b/drivers/tty/serial/8250/8250_of.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include "8250.h" + +@@ -23,6 +24,9 @@ struct of_serial_info { + struct reset_control *rst; + int type; + int line; ++ struct workqueue_struct *work_queue; ++ struct delayed_work work_handler; ++ void __iomem *wa_base; + }; + + /* +@@ -181,6 +185,18 @@ static int of_platform_serial_setup(struct platform_device *ofdev, + return ret; + } + ++#define WA_DELAY_JIFFIES msecs_to_jiffies(1) ++static void clear_abnormal_int_flags(struct work_struct *work) ++{ ++ struct delayed_work *dwork = to_delayed_work(work); ++ struct of_serial_info *info = container_of(dwork, struct of_serial_info, ++ work_handler); ++ ++ (void) readl(info->wa_base); ++ queue_delayed_work(info->work_queue, &info->work_handler, ++ WA_DELAY_JIFFIES); ++} ++ + /* + * Try to register a serial port + */ +@@ -233,6 +249,47 @@ static int of_platform_serial_probe(struct platform_device *ofdev) + if (ret < 0) + goto err_dispose; + ++ if (of_device_is_compatible(ofdev->dev.of_node, ++ "aspeed,ast2600-uart")) { ++ #define REV_ID_AST2600A0 0x05000303 ++ void __iomem *chip_id_base; ++ struct resource *res = platform_get_resource(ofdev, ++ IORESOURCE_MEM, 1); ++ ++ if (!res || resource_size(res) < 2) ++ goto skip_wa; ++ ++ info->wa_base = devm_platform_ioremap_resource(ofdev, 2); ++ if (IS_ERR(info->wa_base)) ++ goto skip_wa; ++ ++ chip_id_base = devm_ioremap_resource(&ofdev->dev, res); ++ if (IS_ERR(chip_id_base)) ++ goto skip_wa; ++ ++ if (readl(chip_id_base) == REV_ID_AST2600A0) { ++ info->work_queue = alloc_ordered_workqueue(ofdev->name, ++ 0); ++ if (info->work_queue) { ++ INIT_DELAYED_WORK(&info->work_handler, ++ clear_abnormal_int_flags); ++ queue_delayed_work(info->work_queue, ++ &info->work_handler, ++ WA_DELAY_JIFFIES); ++ dev_info(&ofdev->dev, ++ "AST2600 A0 WA initiated\n"); ++ } else { ++ dev_err(&ofdev->dev, ++ "Can't enable AST2600 A0 UART WA\n"); ++ } ++ } ++ ++ devm_iounmap(&ofdev->dev, chip_id_base); ++ devm_release_mem_region(&ofdev->dev, res->start, ++ resource_size(res)); ++ } ++ ++skip_wa: + info->type = port_type; + info->line = ret; + platform_set_drvdata(ofdev, info); +@@ -254,6 +311,11 @@ static int of_platform_serial_remove(struct platform_device *ofdev) + { + struct of_serial_info *info = platform_get_drvdata(ofdev); + ++ if (info->work_queue) { ++ cancel_delayed_work_sync(&info->work_handler); ++ destroy_workqueue(info->work_queue); ++ } ++ + serial8250_unregister_port(info->line); + + reset_control_assert(info->rst); +@@ -324,6 +386,7 @@ static const struct of_device_id of_platform_serial_table[] = { + { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, }, + { .compatible = "nuvoton,wpcm450-uart", .data = (void *)PORT_NPCM, }, + { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, }, ++ { .compatible = "aspeed,ast2600-uart", .data = (void *)PORT_16550A, }, + { /* end of list */ }, + }; + MODULE_DEVICE_TABLE(of, of_platform_serial_table); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/intel-ast2600.cfg b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/intel-ast2600.cfg index 4770e5825..9bd1535be 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/intel-ast2600.cfg +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/intel-ast2600.cfg @@ -4,7 +4,6 @@ CONFIG_SPI_ASPEED_SMC=y CONFIG_SPI_FMC=y CONFIG_I3C=y CONFIG_DW_I3C_MASTER=y -CONFIG_ASPEED_I3C_MASTER=y CONFIG_I3CDEV=y CONFIG_U_SERIAL_CONSOLE=n CONFIG_HIGHMEM=n @@ -19,3 +18,6 @@ CONFIG_SUSPEND=n CONFIG_ASPEED_MCTP=y CONFIG_KERNEL_LZO=n CONFIG_KERNEL_XZ=y +CONFIG_SERIAL_8250_DW=n +CONFIG_SERIAL_8250_ASPEED=y +CONFIG_ASPEED_UDMA=y diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend index e5687d4d1..df3901d77 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -3,5 +3,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += " \ file://intel-ast2600.cfg \ - file://0001-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch \ + file://0001-serial-8250-Add-Aspeed-UART-driver-with-DMA-supporte.patch \ + file://0002-serial-8250-Fix-RX-DMA-time-out-property.patch \ + file://0003-serial-8250_aspeed-Make-port-type-fixed.patch \ + file://0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch \ " diff --git a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass index 470d5a10d..866766f2a 100644 --- a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass +++ b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass @@ -2,7 +2,7 @@ inherit obmc-phosphor-full-fitimage inherit image_types_phosphor_auto -DEPENDS += "obmc-intel-pfr-image-native python3-native intel-blocksign-native" +DEPENDS += "obmc-intel-pfr-image-native python3-native intel-pfr-signing-utility-native" require recipes-core/os-release/version-vars.inc @@ -41,13 +41,14 @@ do_image_pfr_internal () { local unsigned_cap_bin="bmc_unsigned_cap${bld_suffix}.bin" local unsigned_cap_align_bin="bmc_unsigned_cap${bld_suffix}.bin_aligned" local output_bin="image-mtd-pfr${bld_suffix}" + local SIGN_UTILITY=${PFR_SCRIPT_DIR}/intel-pfr-signing-utility # python script that does creating PFM & BMC unsigned, compressed image (from BMC 128MB raw binary file). ${PFR_SCRIPT_DIR}/pfr_image.py -m ${PFR_CFG_DIR}/${manifest_json} -i ${DEPLOY_DIR_IMAGE}/image-mtd -n ${build_version} -b ${build_number} \ -h ${build_hash} -s ${SHA} -o ${output_bin} # sign the PFM region - ${PFR_SCRIPT_DIR}/blocksign -c ${PFR_CFG_DIR}/${pfmconfig_xml} -o ${PFR_IMAGES_DIR}/${pfm_signed_bin} ${PFR_IMAGES_DIR}/pfm.bin -v + ${SIGN_UTILITY} -c ${PFR_CFG_DIR}/${pfmconfig_xml} -o ${PFR_IMAGES_DIR}/${pfm_signed_bin} ${PFR_IMAGES_DIR}/pfm.bin -v # Add the signed PFM to rom image dd bs=1k conv=notrunc seek=${PFM_OFFSET_PAGE} if=${PFR_IMAGES_DIR}/${pfm_signed_bin} of=${PFR_IMAGES_DIR}/${output_bin} @@ -60,7 +61,7 @@ do_image_pfr_internal () { dd if=${PFR_IMAGES_DIR}/bmc_compressed.bin bs=1k >> ${PFR_IMAGES_DIR}/${unsigned_cap_bin} # Sign the BMC update capsule - ${PFR_SCRIPT_DIR}/blocksign -c ${PFR_CFG_DIR}/${bmcconfig_xml} -o ${PFR_IMAGES_DIR}/${signed_cap_bin} ${PFR_IMAGES_DIR}/${unsigned_cap_bin} -v + ${SIGN_UTILITY} -c ${PFR_CFG_DIR}/${bmcconfig_xml} -o ${PFR_IMAGES_DIR}/${signed_cap_bin} ${PFR_IMAGES_DIR}/${unsigned_cap_bin} -v # Add the signed bmc update capsule to full rom image @ 0x2a00000 dd bs=1k conv=notrunc seek=${RC_IMAGE_PAGE} if=${PFR_IMAGES_DIR}/${signed_cap_bin} of=${PFR_IMAGES_DIR}/${output_bin} @@ -118,7 +119,7 @@ do_image_pfr[vardepsexclude] += "do_image_pfr_internal DATE DATETIME BUILD_SEGD" do_image_pfr[vardeps] += "IPMI_MAJOR IPMI_MINOR IPMI_AUX13 IPMI_AUX14 IPMI_AUX15 IPMI_AUX16" do_image_pfr[depends] += " \ obmc-intel-pfr-image-native:do_populate_sysroot \ - intel-blocksign-native:do_populate_sysroot \ + intel-pfr-signing-utility-native:do_populate_sysroot \ " python() { diff --git a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass index 6de324049..bc20e5a29 100644 --- a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass +++ b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass @@ -47,7 +47,6 @@ IMAGE_INSTALL:append = " \ smbios-mdrv2 \ obmc-ikvm \ system-watchdog \ - frb2-watchdog \ srvcfg-manager \ callback-manager \ phosphor-post-code-manager \ diff --git a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh index b9ea1127c..bf5377482 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh @@ -21,3 +21,6 @@ done < /proc/cmdline busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/ac_boot xyz.openbmc_project.Common.ACBoot ACBoot s "$ACBOOT" +source /etc/os-release + +echo "VERSION INFO - BMC - ${VERSION_ID}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb index 2c18cc0ec..74db92917 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb @@ -30,4 +30,12 @@ SYSTEMD_SERVICE:${PN} += "com.intel.AtScaleDebug.service" EXTRA_OECMAKE = "-DBUILD_UT=OFF" CFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include/uapi" -CFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include/" +CFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include" + +# Copying the depricated header from kernel as a temporary fix to resolve build breaks. +# It should be removed later after fixing the header dependency in this repository. +SRC_URI += "file://asm/rwonce.h" +do_configure:prepend() { + cp -r ${WORKDIR}/asm ${S}/asm +} +CFLAGS:append = " -I ${S}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/asm/rwonce.h b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/asm/rwonce.h new file mode 100644 index 000000000..11619bdbe --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/asm/rwonce.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Prevent the compiler from merging or refetching reads or writes. The + * compiler is also forbidden from reordering successive instances of + * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some + * particular ordering. One way to make the compiler aware of ordering is to + * put the two invocations of READ_ONCE or WRITE_ONCE in different C + * statements. + * + * These two macros will also work on aggregate data types like structs or + * unions. + * + * Their two major use cases are: (1) Mediating communication between + * process-level code and irq/NMI handlers, all running on the same CPU, + * and (2) Ensuring that the compiler does not fold, spindle, or otherwise + * mutilate accesses that either do not require ordering or that interact + * with an explicit memory barrier or atomic instruction that provides the + * required ordering. + */ +#ifndef __ASM_GENERIC_RWONCE_H +#define __ASM_GENERIC_RWONCE_H + +#ifndef __ASSEMBLY__ + +#include +#include +#include + +/* + * Yes, this permits 64-bit accesses on 32-bit architectures. These will + * actually be atomic in some cases (namely Armv7 + LPAE), but for others we + * rely on the access being split into 2x32-bit accesses for a 32-bit quantity + * (e.g. a virtual address) and a strong prevailing wind. + */ +#define compiletime_assert_rwonce_type(t) \ + compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ + "Unsupported access size for {READ,WRITE}_ONCE().") + +/* + * Use __READ_ONCE() instead of READ_ONCE() if you do not require any + * atomicity. Note that this may result in tears! + */ +#ifndef __READ_ONCE +#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x)) +#endif + +#define READ_ONCE(x) \ +({ \ + compiletime_assert_rwonce_type(x); \ + __READ_ONCE(x); \ +}) + +#define __WRITE_ONCE(x, val) \ +do { \ + *(volatile typeof(x) *)&(x) = (val); \ +} while (0) + +#define WRITE_ONCE(x, val) \ +do { \ + compiletime_assert_rwonce_type(x); \ + __WRITE_ONCE(x, val); \ +} while (0) + +static __always_inline +unsigned long __read_once_word_nocheck(const void *addr) +{ + return __READ_ONCE(*(unsigned long *)addr); +} + +/* + * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need to load a + * word from memory atomically but without telling KASAN/KCSAN. This is + * usually used by unwinding code when walking the stack of a running process. + */ +#define READ_ONCE_NOCHECK(x) \ +({ \ + compiletime_assert(sizeof(x) == sizeof(unsigned long), \ + "Unsupported access size for READ_ONCE_NOCHECK()."); \ + (typeof(x))__read_once_word_nocheck(&(x)); \ +}) + +static __always_inline +unsigned long read_word_at_a_time(const void *addr) +{ + kasan_check_read(addr, 1); + return *(unsigned long *)addr; +} + +#endif /* __ASSEMBLY__ */ +#endif /* __ASM_GENERIC_RWONCE_H */ diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend index 9d5dcf6b0..029defb67 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend @@ -1,22 +1,12 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI += "file://enable-ssh.sh" - -add_manual_ssh_enable() { - install -d ${D}/usr/share/misc - install -m 0755 ${D}/${systemd_unitdir}/system/dropbear@.service ${D}/usr/share/misc/dropbear@.service - install -m 0755 ${D}/${systemd_unitdir}/system/dropbear.socket ${D}/usr/share/misc/dropbear.socket - install -m 0755 ${WORKDIR}/enable-ssh.sh ${D}${bindir}/enable-ssh.sh - # Remove dropbear service and socket by default, if debug-tweaks is disabled - rm ${D}/${systemd_unitdir}/system/dropbear@.service - rm ${D}/${systemd_unitdir}/system/dropbear.socket -} +SRC_URI += "file://enable-ssh.sh \ + file://0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch \ + " do_install:append() { - # Add manual ssh enable script if debug-tweaks is disabled - ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '', 'add_manual_ssh_enable', d)} + install -m 0755 ${WORKDIR}/enable-ssh.sh ${D}${bindir}/ } -FILES:${PN} += "/usr/share/misc" -SYSTEMD_SERVICE:${PN} += "dropbearkey.service" -SYSTEMD_SERVICE:${PN}:remove += " ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '', 'dropbear.socket', d)}" +# Enable dropbear.socket and dropbearkey.service only for debug-tweaks +SYSTEMD_AUTO_ENABLE:${PN} = "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', 'enable', 'disable', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch new file mode 100644 index 000000000..22aed3a07 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch @@ -0,0 +1,43 @@ +From 41a43e4b149af0bbfa82ca1b9479dd7dfb2455de Mon Sep 17 00:00:00 2001 +From: Chalapathi Venkataramashetty +Date: Wed, 13 Oct 2021 22:52:34 +0000 +Subject: [PATCH] Enable UART mux setting before SOL activation via SSH + +Switching UART routing when starting obmc-service introduces garbled +character printing out on physical host serial output and it's +inevitable so this commit moves the routing logic into host console +connection flow in SSH SOL to avoid the issue until SOL is actually +activated. + +Tested: SOL activation is working fine via SSH + +Signed-off-by: Chalapathi Venkataramashetty +--- + svr-runopts.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/svr-runopts.c b/svr-runopts.c +index 2c905dd..6fc25e8 100644 +--- a/svr-runopts.c ++++ b/svr-runopts.c +@@ -414,6 +414,17 @@ void svr_getopts(int argc, char ** argv) { + } + + if (svr_opts.forced_command) { ++ if (strcmp(svr_opts.forced_command, "/usr/bin/obmc-console-client") == 0) { ++ FILE *fp; ++ fp = fopen("/sys/bus/platform/drivers/aspeed-uart-routing/" ++ "1e789098.uart-routing/hicra", ++ "w"); ++ if (fp != NULL) { ++ char *uartMuxCtrlVal = "0x03450003"; ++ fprintf(fp, "%s", uartMuxCtrlVal); ++ fclose(fp); ++ } ++ } + dropbear_log(LOG_INFO, "Forced command set to '%s'", svr_opts.forced_command); + } + #if DROPBEAR_PLUGIN +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh index 922aa09f5..01ebe098f 100755 --- a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh @@ -1,38 +1,21 @@ #!/bin/sh -usage="$(basename "$0") [-h] [-d] -- Enable/Disable ssh for root user +usage="$(basename $0) [-h] [-d] -- Enable/Disable ssh for root user where: -h help -d disable ssh and remove priv-admin permission for root user" enable_ssh() { - if [ -e /etc/systemd/system/dropbear@.service ] && - [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then - echo "SSH is already enabled" - else - cp /usr/share/misc/dropbear@.service /etc/systemd/system/dropbear@.service - cp /usr/share/misc/dropbear.socket /etc/systemd/system/dropbear.socket - ln -s /etc/systemd/system/dropbear.socket /etc/systemd/system/sockets.target.wants/dropbear.socket - groupmems -g priv-admin -a root - systemctl daemon-reload - systemctl restart dropbear.socket - echo "Enabled SSH service for root user successful" - fi + systemctl enable --now dropbear.socket + groupmems -g priv-admin -a root + echo "Enabled SSH service for root user successful" } disable_ssh() { - if [ -e /etc/systemd/system/dropbear@.service ] && - [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then - systemctl stop dropbear.socket - systemctl stop dropbear@*.service - rm -rf /etc/systemd/system/sockets.target.wants/dropbear.socket - rm -rf /etc/systemd/system/dropbear.socket - rm -rf /etc/systemd/system/dropbear@.service - groupmems -g priv-admin -d root - echo "SSH disabled" - else - echo "SSH is already disabled" - fi + systemctl disable --now dropbear.socket + systemctl stop dropbear@*.service + groupmems -g priv-admin -d root + echo "Disabled SSH service" } case "$1" in diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb index df7d6e7f1..fb76cfb3c 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb @@ -18,7 +18,11 @@ PFR_EN = "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'pfr', '', d)}" SRC_URI += "file://fwupd.sh" SRC_URI += "file://usb-ctrl" -FILES:${PN} += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '${datadir}/pfr', '', d)}" +DEPENDS += "obmc-intel-pfr-image-native" + +# runtime authentication of some features requires the root key certificate +FILES:${PN} += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '${datadir}/pfr/rk_cert.pem', '', d)}" +PFR_CFG_DIR = "${STAGING_DIR_NATIVE}${datadir}/pfrconfig" do_install() { install -d ${D}${bindir} @@ -26,7 +30,7 @@ do_install() { install -m 0755 ${WORKDIR}/usb-ctrl ${D}${bindir} if [ "${PFR_EN}" = "pfr" ]; then - install -d ${D}${datadir} - touch ${D}${datadir}/pfr + install -d ${D}${datadir}/pfr + install -m 0644 ${PFR_CFG_DIR}/rk_cert.pem ${D}${datadir}/pfr fi } diff --git a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend index eec234e96..4b0ce63f9 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_%.bbappend @@ -1,4 +1,4 @@ SRC_URI = "git://github.com/openbmc/host-error-monitor" -SRCREV = "4a6e45c4c2f38bc64afe5faac05ea82b3adb8d93" +SRCREV = "1c208480e6de77a5a41b0733c595e8d4a99e5311" EXTRA_OECMAKE = "-DYOCTO=1" diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/asm/rwonce.h b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/asm/rwonce.h new file mode 100644 index 000000000..c8beb875d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/asm/rwonce.h @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Prevent the compiler from merging or refetching reads or writes. The + * compiler is also forbidden from reordering successive instances of + * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some + * particular ordering. One way to make the compiler aware of ordering is to + * put the two invocations of READ_ONCE or WRITE_ONCE in different C + * statements. + * + * These two macros will also work on aggregate data types like structs or + * unions. + * + * Their two major use cases are: (1) Mediating communication between + * process-level code and irq/NMI handlers, all running on the same CPU, + * and (2) Ensuring that the compiler does not fold, spindle, or otherwise + * mutilate accesses that either do not require ordering or that interact + * with an explicit memory barrier or atomic instruction that provides the + * required ordering. + */ +#ifndef __ASM_GENERIC_RWONCE_H +#define __ASM_GENERIC_RWONCE_H + +#ifndef __ASSEMBLY__ + +#include +#include +#include + +/* + * Yes, this permits 64-bit accesses on 32-bit architectures. These will + * actually be atomic in some cases (namely Armv7 + LPAE), but for others we + * rely on the access being split into 2x32-bit accesses for a 32-bit quantity + * (e.g. a virtual address) and a strong prevailing wind. + */ +#define compiletime_assert_rwonce_type(t) \ + compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ + "Unsupported access size for {READ,WRITE}_ONCE().") + +/* + * Use __READ_ONCE() instead of READ_ONCE() if you do not require any + * atomicity. Note that this may result in tears! + */ +#ifndef __READ_ONCE +#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x)) +#endif + +#define READ_ONCE(x) \ + ({ \ + compiletime_assert_rwonce_type(x); \ + __READ_ONCE(x); \ + }) + +#define __WRITE_ONCE(x, val) \ + do { \ + *(volatile typeof(x) *)&(x) = (val); \ + } while (0) + +#define WRITE_ONCE(x, val) \ + do { \ + compiletime_assert_rwonce_type(x); \ + __WRITE_ONCE(x, val); \ + } while (0) + +static __always_inline unsigned long __read_once_word_nocheck(const void *addr) +{ + return __READ_ONCE(*(unsigned long *)addr); +} + +/* + * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need to load a + * word from memory atomically but without telling KASAN/KCSAN. This is + * usually used by unwinding code when walking the stack of a running process. + */ +#define READ_ONCE_NOCHECK(x) \ + ({ \ + compiletime_assert( \ + sizeof(x) == sizeof(unsigned long), \ + "Unsupported access size for READ_ONCE_NOCHECK()."); \ + (typeof(x)) __read_once_word_nocheck(&(x)); \ + }) + +static __always_inline unsigned long read_word_at_a_time(const void *addr) +{ + kasan_check_read(addr, 1); + return *(unsigned long *)addr; +} + +#endif /* __ASSEMBLY__ */ +#endif /* __ASM_GENERIC_RWONCE_H */ diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index 5ca73964c..eba56f829 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" SRC_URI = "git://github.com/openbmc/libmctp.git" -SRCREV = "ae59f4fe3a3ceaf52a682ada2a2b54855fad2408" +SRCREV = "663ec39ea107c2a736f9bcb20cbfdfa623092ab1" PV = "0.1+git${SRCPV}" @@ -15,9 +15,6 @@ S = "${WORKDIR}/git" DEPENDS += "i2c-tools" -CFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include/uapi" -CFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include" - FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-Smbus-changes-for-libmctp.patch \ @@ -41,3 +38,10 @@ CXXFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include/uapi" CXXFLAGS:append = " -I ${STAGING_KERNEL_DIR}/include" do_configure[depends] += "virtual/kernel:do_shared_workdir" + +# Copying the depricated header from kernel as a temporary fix to resolve build breaks. +# It should be removed later after fixing the header dependency in this repository. +SRC_URI += "file://asm/rwonce.h" +do_configure:prepend() { + cp -r ${WORKDIR}/asm ${S}/asm +} diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index 4811778ca..ac61d983c 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -2,7 +2,7 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PF EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "e83c70aab0479a8103638166b330a06e499f4449" +SRCREV = "9e58cfe1ba5ca5bcd5263b50730c5a231eabdd4f" FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_%.bbappend index 817e164a4..cea8fd6ed 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_%.bbappend @@ -1,3 +1,3 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/libpeci" -SRCREV = "ff44e549c44c7658ec11e0c19c13c4c45900cfe4" +SRCREV = "6a00e9aa72f75d66eb8b9572c7fd3894f91c6bba" diff --git a/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc b/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc index 872e78eba..df43dae89 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc +++ b/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc @@ -55,12 +55,24 @@ python() { # If no tag, provide default version if meta_vers.startswith('fatal:'): - meta_vers = '{}-0.0-0-g0'.format(gen) + ver_list = obmc_vers.split('-') + obmc_tag_list = ver_list[1].split('.') + obmc_major_revision = 0 + obmc_minor_revision = 0 + obmc_minor_spare = 0 + try: + obmc_major_revision = int(obmc_tag_list[0]) + obmc_minor_revision = int(obmc_tag_list[1]) + obmc_minor_spare = int(ver_list[2]) + except ValueError: + bb.warn("Invalid obmc_vers: {}".format(obmc_vers)) + meta_vers = '{}-{}.{}-{}-g{}'.format(gen,obmc_major_revision, + obmc_minor_revision,obmc_minor_spare,obmc_hash[0:6]) meta_hash = irun_git(d, mibase, 'rev-parse HEAD') # If no hash, provide default if meta_hash.startswith('fatal:'): - meta_hash = '00000000' + meta_hash = obmc_hash[0:7] version_id = '{}-{}'.format(meta_vers, obmc_hash[0:7]) if version_id: d.setVar('VERSION_ID', version_id) diff --git a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb index 92d0f7cd2..cf83203ec 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb @@ -7,7 +7,7 @@ SECTION = "lib" inherit autotools pkgconfig S = "${WORKDIR}/git" -SRCREV = "bfc9f8bb8a9bfd02fde8ef3fd78fcd61411d070d" +SRCREV = "e8bf1fff157ba931692130a0ec6f2833fa7d5f87" SRC_URI = "git://github.com/rurban/safeclib.git" COMPATIBLE_HOST = '(x86_64|i.86|powerpc|powerpc64|arm|aarch64).*-linux' diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch deleted file mode 100644 index 5b9f17006..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch +++ /dev/null @@ -1,28 +0,0 @@ -From e02932693f92d6230b5520f431e127f7b6e2183e Mon Sep 17 00:00:00 2001 -From: James Feist -Date: Tue, 6 Mar 2018 16:06:33 -0800 -Subject: [PATCH 1/1] Modfiy system.conf DefaultTimeoutStopSec - -Current time is 5 minutes, change it to 10 seconds. - -Signed-off-by: James Feist ---- - src/core/system.conf.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/core/system.conf.in b/src/core/system.conf.in -index 8112125468..f7a35a56bb 100644 ---- a/src/core/system.conf.in -+++ b/src/core/system.conf.in -@@ -39,7 +39,7 @@ - #DefaultStandardOutput=journal - #DefaultStandardError=inherit - #DefaultTimeoutStartSec=90s --#DefaultTimeoutStopSec=90s -+DefaultTimeoutStopSec=10s - #DefaultTimeoutAbortSec= - #DefaultRestartSec=100ms - #DefaultStartLimitIntervalSec=10s --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-time-wait-sync.service b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-time-wait-sync.service deleted file mode 100644 index f71aea39d..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-time-wait-sync.service +++ /dev/null @@ -1,36 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Wait Until Kernel Time Synchronized -Documentation=man:systemd-time-wait-sync.service(8) - -# Note that this tool doesn't need CAP_SYS_TIME itself, but it's primary -# usecase is to run in conjunction with a local NTP service such as -# systemd-timesyncd.service, which is conditioned this way. There might be -# niche usecases where running this service independently is desired, but let's -# make this all "just work" for the general case, and leave it to local -# modifications to make it work in the remaining cases. - -ConditionCapability=CAP_SYS_TIME -ConditionVirtualization=!container - -DefaultDependencies=no -Before=time-sync.target shutdown.target -Wants=time-sync.target -Conflicts=shutdown.target - -[Service] -Type=oneshot -ExecStart=/lib/systemd/systemd-time-wait-sync -TimeoutStartSec=10 -RemainAfterExit=yes - -[Install] -WantedBy=sysinit.target diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend index 50f82d21e..2eb5330d8 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend @@ -1,20 +1,11 @@ # add some configuration overrides for systemd defaults -LICENSE = "GPL-2.0" - FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch \ - file://systemd-time-wait-sync.service \ - file://0002-Add-event-log-for-system-time-synchronization.patch \ +SRC_URI += "file://0002-Add-event-log-for-system-time-synchronization.patch \ " -USERADD_PACKAGES:remove = "${PN}-journal-gateway ${PN}-journal-upload ${PN}-journal-remote" - -do_install:append(){ - rm -rf ${D}/lib/udev/rules.d/80-drivers.rules - cp -f ${WORKDIR}/systemd-time-wait-sync.service ${D}/lib/systemd/system/ -} - -PACKAGECONFIG:remove = " kmod" +# We don't support loadable modules in kernel config +PACKAGECONFIG:remove = "kmod" +# Add systemd-logind service to get shutdown inhibition support PACKAGECONFIG:append = " logind" diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend b/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend new file mode 100644 index 000000000..323788fe8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" + +# Temporary pin to resolve build breaks +SRCREV = "2c867fbe284ae532f1329b87a86ad3f8cd382867" diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb index fc7577db4..5b59dd909 100644 --- a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb +++ b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb @@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b77c43ae4eaf67bd73fb6452b2f113a3" SRC_URI = "git://github.com/Intel-BMC/mtd-util;protocol=ssh" PV = "1.0+git${SRCPV}" -SRCREV = "3e12f8493b8f261c2e6df607b3ffab2f5875e642" +SRCREV = "708072b62a3cecb520eeaacac88b4f2c2e101fe4" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend index 8413ae3bc..a33c265f6 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend @@ -4,3 +4,6 @@ SRC_URI += " \ file://0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch \ file://0002-Skip-decoding-some-dbus-identifiers.patch \ " + +# Temporary pin to resolve build breaks +SRCREV="dfb5642201699dc42a7dda12d72718a8b9568151" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index d687b1124..dbd591c86 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "b889248659efa83cadf313e10493f4c9a3ac61ad" +SRCREV = "c1f29b73e4f111fc3d4b5941936218be0c6c430f" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend index ba7a7821c..faee3bf4c 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend @@ -1,4 +1,4 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/obmc-ikvm" -SRCREV = "2d2f3dab4253a3d6edf6bef98c5f880f51d2394b" +SRCREV = "f90f68d1e9bc6c53f49ebac6d0b8e11257de77a9" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb index 2bd500677..6b54189e6 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/host-misc-comm-manager.git;protocol=ssh" -SRCREV = "da65b239e6622fbf913a904480fe3ff87ee02dec" +SRCREV = "470facc6e94ecbd01ca9c3f0749ae603dffff0e9" inherit cmake systemd SYSTEMD_SERVICE:${PN} = "xyz.openbmc_project.Host.Misc.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb index 7c7c483c2..a2ce25369 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb @@ -2,7 +2,7 @@ SUMMARY = "HSBP Manager" DESCRIPTION = "HSBP Manager monitors HSBPs through SMBUS" SRC_URI = "git://github.com/openbmc/s2600wf-misc.git" -SRCREV = "1a9dde9b193a34392ab11a14d9cd0310f9abb930" +SRCREV = "0c5059f685f6df0704a4b773f2e617cf10d03210" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb index 086832b9e..d0b324239 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb @@ -7,6 +7,7 @@ inherit ${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'image_types_intel_pf DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'obmc-intel-pfr-image-native', '', d)}" DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'pfr-manager', '', d)}" +DEPENDS += "dtc-native" FEATURE_PACKAGES_obmc-sensors = "" FEATURE_PACKAGES_obmc-debug-collector = "" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb deleted file mode 100644 index 51c5fdf74..000000000 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "Intel Blocksign tool for PFR image" -DESCRIPTION = "Image signing tool for BMC PFR image" - -inherit cmake native - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" - -DEPENDS = "openssl-native libxml2-native " - -SRC_URI = "git://git@github.com/Intel-BMC/blocksign;protocol=ssh" - -SRCREV = "966d16f680c1b14c338640d35a12d5e2f9a6937a" - -S = "${WORKDIR}/git" - -do_install:append() { - install -d ${D}/${bindir} - install -m 775 ${B}/blocksign ${D}/${bindir} -} diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb new file mode 100644 index 000000000..72e7857ef --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb @@ -0,0 +1,20 @@ +SUMMARY = "Intel(R) Platform Firmware Resilience Signing Utility" +DESCRIPTION = "Image signing tool for building Intel(R) PFR image" + +inherit cmake native + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" + +DEPENDS = "openssl-native libxml2-native " + +SRC_URI = "git://github.com/Intel-BMC/intel-pfr-signing-utility;protocol=ssh" + +SRCREV = "33b8e02e9b25d5150b744fcbda4cf1e508813194" + +S = "${WORKDIR}/git" + +do_install:append() { + install -d ${D}/${bindir} + install -m 775 ${B}/intel-pfr-signing-utility ${D}/${bindir} +} diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb index bb0f9ba7e..be7251555 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb @@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit native -DEPENDS += " intel-blocksign-native" +DEPENDS += " intel-pfr-signing-utility-native" SRC_URI = " \ file://pfr_image.py \ diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend index 020c8d53f..2ae1e372b 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend @@ -1,5 +1,5 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/pfr-manager" -SRCREV = "bcc7ce1f418c1a16a7868fee62499fa677242254" +SRCREV = "8491692089f9295cf2efab456d4747f3cf1fb098" DEPENDS += " libgpiod \ " diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb index d957147de..9cd2eec6f 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb @@ -2,7 +2,7 @@ SUMMARY = "Power supply manager for Intel based platform" DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" SRC_URI = "git://github.com/Intel-BMC/psu-manager.git;protocol=ssh" -SRCREV = "139981b813f2d480ca55f60e6b129d55d6adcbc3" +SRCREV = "30788892792c302b1317bac4e7f837ca1374d789" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index e40148a91..683497208 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://github.com/openbmc/smbios-mdr.git" -SRCREV = "ecbd71baa68d0c2834614d84f24de7d369a51ce4" +SRCREV = "631388e621abad855abbe4abbfb20111da9056f1" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-Add-debug-printing-to-check-caller-PID.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-Add-debug-printing-to-check-caller-PID.patch deleted file mode 100644 index fbd51df7a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-Add-debug-printing-to-check-caller-PID.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7474fe190f770e064a5ce5e939bd713ce2aa1de5 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 3 Feb 2021 16:18:37 -0800 -Subject: [PATCH] peci: Add debug printing to check caller PID - -This commit adds debug printing out to check caller PID for traffic -profiling. - -The printing can be enabled by this command: -echo -n 'file drivers/peci/peci-core.c line 218 +p' > /sys/kernel/debug/dynamic_debug/control -echo '8' > /proc/sys/kernel/printk - -Signed-off-by: Jae Hyun Yoo ---- - drivers/peci/peci-core.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c -index 10375e6087a5..02c8502fd846 100644 ---- a/drivers/peci/peci-core.c -+++ b/drivers/peci/peci-core.c -@@ -194,6 +194,7 @@ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, - bool do_retry, bool has_aw_fcs) - { - uint interval_us = PECI_DEV_RETRY_INTERVAL_MIN_USEC; -+ char task_name[TASK_COMM_LEN]; - ulong timeout = jiffies; - u8 aw_fcs; - int ret; -@@ -214,6 +215,10 @@ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, - } - } - -+ get_task_comm(task_name, current); -+ dev_dbg(&adapter->dev, "%s is called by %s(%d) through %s\n", -+ __func__, task_name, current->pid, adapter->name); -+ - /* - * For some commands, the PECI originator may need to retry a command if - * the processor PECI client responds with a 0x8x completion code. In --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch deleted file mode 100644 index 1e1dac7a8..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ae96ce5f2a5bd76b234cea6fc3f0bf1df74387f3 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Thu, 4 Feb 2021 00:29:55 -0800 -Subject: [PATCH] soc: aspeed: add AST2600 A0 specific fix into mbox driver - -AST2600 A0 has the same LPC mbox register structure with AST2500 -but AST2600 A1 and later revision is different so this commit adds -AST2600 A0 specific fix into the mbox driver. - -Signed-off-by: Jae Hyun Yoo ---- - drivers/soc/aspeed/aspeed-lpc-mbox.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/drivers/soc/aspeed/aspeed-lpc-mbox.c b/drivers/soc/aspeed/aspeed-lpc-mbox.c -index 8dd3345682c7..12bb436dda78 100644 ---- a/drivers/soc/aspeed/aspeed-lpc-mbox.c -+++ b/drivers/soc/aspeed/aspeed-lpc-mbox.c -@@ -363,6 +363,20 @@ static int aspeed_mbox_probe(struct platform_device *pdev) - return -EINVAL; - - config = match->data; -+ -+ if (of_device_is_compatible(pdev->dev.of_node, -+ "aspeed,ast2600-mbox")) { -+ #define REV_ID_IO_OFFSET 0x1e6e2014 -+ #define REV_ID_AST2600A0 0x05000303 -+ void __iomem *chip_id_base = devm_ioremap(&pdev->dev, -+ REV_ID_IO_OFFSET, -+ sizeof(u32)); -+ -+ if (!IS_ERR(chip_id_base) && -+ readl(chip_id_base) == REV_ID_AST2600A0) -+ config = &ast2500_config; -+ } -+ - memcpy(&mbox->configs, config, sizeof(mbox->configs)); - - rc = of_property_read_u32(dev->of_node, "reg", &mbox->base); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Fix-libmctp-build-error.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Fix-libmctp-build-error.patch deleted file mode 100644 index b9a6ca527..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Fix-libmctp-build-error.patch +++ /dev/null @@ -1,116 +0,0 @@ -From af414e45bade3cf7277215d82b59a31c9b459cea Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Mon, 22 Feb 2021 15:27:22 -0800 -Subject: [PATCH] Fix libmctp build error - -This is a quick fix for libmctp building which includes staging -kernel headers. It's a temporary fix until kernel tree fixes the -rwonce.h including issue. - -Note: Do not upstream it. - -Signed-off-by: Jae Hyun Yoo ---- - include/asm/rwonce.h | 90 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 90 insertions(+) - create mode 100644 include/asm/rwonce.h - -diff --git a/include/asm/rwonce.h b/include/asm/rwonce.h -new file mode 100644 -index 000000000000..11619bdbebae ---- /dev/null -+++ b/include/asm/rwonce.h -@@ -0,0 +1,90 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+/* -+ * Prevent the compiler from merging or refetching reads or writes. The -+ * compiler is also forbidden from reordering successive instances of -+ * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some -+ * particular ordering. One way to make the compiler aware of ordering is to -+ * put the two invocations of READ_ONCE or WRITE_ONCE in different C -+ * statements. -+ * -+ * These two macros will also work on aggregate data types like structs or -+ * unions. -+ * -+ * Their two major use cases are: (1) Mediating communication between -+ * process-level code and irq/NMI handlers, all running on the same CPU, -+ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise -+ * mutilate accesses that either do not require ordering or that interact -+ * with an explicit memory barrier or atomic instruction that provides the -+ * required ordering. -+ */ -+#ifndef __ASM_GENERIC_RWONCE_H -+#define __ASM_GENERIC_RWONCE_H -+ -+#ifndef __ASSEMBLY__ -+ -+#include -+#include -+#include -+ -+/* -+ * Yes, this permits 64-bit accesses on 32-bit architectures. These will -+ * actually be atomic in some cases (namely Armv7 + LPAE), but for others we -+ * rely on the access being split into 2x32-bit accesses for a 32-bit quantity -+ * (e.g. a virtual address) and a strong prevailing wind. -+ */ -+#define compiletime_assert_rwonce_type(t) \ -+ compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ -+ "Unsupported access size for {READ,WRITE}_ONCE().") -+ -+/* -+ * Use __READ_ONCE() instead of READ_ONCE() if you do not require any -+ * atomicity. Note that this may result in tears! -+ */ -+#ifndef __READ_ONCE -+#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x)) -+#endif -+ -+#define READ_ONCE(x) \ -+({ \ -+ compiletime_assert_rwonce_type(x); \ -+ __READ_ONCE(x); \ -+}) -+ -+#define __WRITE_ONCE(x, val) \ -+do { \ -+ *(volatile typeof(x) *)&(x) = (val); \ -+} while (0) -+ -+#define WRITE_ONCE(x, val) \ -+do { \ -+ compiletime_assert_rwonce_type(x); \ -+ __WRITE_ONCE(x, val); \ -+} while (0) -+ -+static __always_inline -+unsigned long __read_once_word_nocheck(const void *addr) -+{ -+ return __READ_ONCE(*(unsigned long *)addr); -+} -+ -+/* -+ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need to load a -+ * word from memory atomically but without telling KASAN/KCSAN. This is -+ * usually used by unwinding code when walking the stack of a running process. -+ */ -+#define READ_ONCE_NOCHECK(x) \ -+({ \ -+ compiletime_assert(sizeof(x) == sizeof(unsigned long), \ -+ "Unsupported access size for READ_ONCE_NOCHECK()."); \ -+ (typeof(x))__read_once_word_nocheck(&(x)); \ -+}) -+ -+static __always_inline -+unsigned long read_word_at_a_time(const void *addr) -+{ -+ kasan_check_read(addr, 1); -+ return *(unsigned long *)addr; -+} -+ -+#endif /* __ASSEMBLY__ */ -+#endif /* __ASM_GENERIC_RWONCE_H */ --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch deleted file mode 100644 index 2d435c796..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch +++ /dev/null @@ -1,33 +0,0 @@ -From cdd7104850d34cfe22902c45d69dac6cb506b087 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Fri, 26 Feb 2021 11:00:54 -0800 -Subject: [PATCH] Add a quick fix to resolve USB gadget DMA issue. - -This is a quick fix to resolve USB gadget DMA issue and it should -be removed when a real fix is added. - -Tested: Keyboard and mouse in KVM feature worked. - -Signed-off-by: Jae Hyun Yoo ---- - kernel/dma/mapping.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c -index 51bb8fa8eb89..7bcfedeb1e30 100644 ---- a/kernel/dma/mapping.c -+++ b/kernel/dma/mapping.c -@@ -146,8 +146,10 @@ dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page, - - BUG_ON(!valid_dma_direction(dir)); - -+#if 0 /* Quick fix to resolve USB gadget issue */ - if (WARN_ON_ONCE(!dev->dma_mask)) - return DMA_MAPPING_ERROR; -+#endif - - if (dma_map_direct(dev, ops)) - addr = dma_direct_map_page(dev, page, offset, size, dir, attrs); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch deleted file mode 100644 index 54dced64f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-Die_CPU-filter-first-zero-from-GetTemp.patch +++ /dev/null @@ -1,61 +0,0 @@ -From b0740cbafa468ece35d26a797e7cf80f04fb5102 Mon Sep 17 00:00:00 2001 -From: Zhikui Ren -Date: Mon, 11 Jan 2021 16:31:36 -0800 -Subject: [PATCH] Die_CPU: filter first zero from GetTemp - -Peci command GetTemp can return 0 during CPU reset. -It does not have a have completion code either. -Discard the first zero reading and return -ENODATA. -Consecutive zeros will be returned so that real hot -condition will still be detected and logged but possibly delayed -by the sensor polling period, which is normally 500ms-1s. - -Signed-off-by: Zhikui Ren ---- - drivers/hwmon/peci-cputemp.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c -index c5d92d1d2c25..49670bc80530 100644 ---- a/drivers/hwmon/peci-cputemp.c -+++ b/drivers/hwmon/peci-cputemp.c -@@ -15,6 +15,7 @@ - - struct temp_group { - struct peci_sensor_data die; -+ u32 die_raw_prev; - struct peci_sensor_data dts; - struct peci_sensor_data tcontrol; - struct peci_sensor_data tthrottle; -@@ -119,6 +120,7 @@ static int get_die_temp(struct peci_cputemp *priv) - { - struct peci_get_temp_msg msg; - int ret; -+ bool discard = false; - - if (!peci_sensor_need_update(&priv->temp.die)) - return 0; -@@ -129,6 +131,20 @@ static int get_die_temp(struct peci_cputemp *priv) - if (ret) - return ret; - -+ /* -+ * GET_TEMP command does not have cc and can return zero during -+ * cpu reset. Treat the first zero reading as data not available. -+ * Consecutive zeros will be returned so true hot condition -+ * is not be missed. -+ */ -+ if (msg.temp_raw == 0 && priv->temp.die_raw_prev != 0) { -+ dev_err(priv->dev, "discard first 0 reading from GetTemp\n"); -+ discard = true; -+ } -+ priv->temp.die_raw_prev = msg.temp_raw; -+ if (discard) -+ return -ENODATA; -+ - /* Note that the tjmax should be available before calling it */ - priv->temp.die.value = priv->temp.tjmax.value + - (msg.temp_raw * 1000 / 64); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch deleted file mode 100644 index a498f9c19..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 4d4e68e0eed7ccf899bc1b3799a93ed8eb44270d Mon Sep 17 00:00:00 2001 -From: Zhikui Ren -Date: Tue, 2 Feb 2021 14:49:28 -0800 -Subject: [PATCH] DTS_CPU: filter first zero from RdPkgConfig 10 - -Peci command GetPkgConfig 10 can return 0 (hot) with cc 0x40 -after cpu reset. Once pcode run time image is loaded -and it returns 0x8000 as DTS margin data not ready -Discard the first zero reading and return -ENODATA. -Consecutive zeros will be returned so that real hot -condition will still be detected and logged but possibly delayed -by the sensor polling period, which is normally one second. - -Signed-off-by: Zhikui Ren ---- - drivers/hwmon/peci-cputemp.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c -index 49670bc80530..af1c09741120 100644 ---- a/drivers/hwmon/peci-cputemp.c -+++ b/drivers/hwmon/peci-cputemp.c -@@ -17,6 +17,7 @@ struct temp_group { - struct peci_sensor_data die; - u32 die_raw_prev; - struct peci_sensor_data dts; -+ u32 dts_raw_prev; - struct peci_sensor_data tcontrol; - struct peci_sensor_data tthrottle; - struct peci_sensor_data tjmax; -@@ -159,6 +160,7 @@ static int get_dts(struct peci_cputemp *priv) - s32 dts_margin; - u8 pkg_cfg[4]; - int ret; -+ bool discard = false; - - if (!peci_sensor_need_update(&priv->temp.dts)) - return 0; -@@ -172,6 +174,24 @@ static int get_dts(struct peci_cputemp *priv) - - dts_margin = le16_to_cpup((__le16 *)pkg_cfg); - -+ /* -+ * There is a small window (500us) for read dts_margin (RdPkgConfig 10) -+ * to return cc 0x40, and dts_margin of 0 after cpu reset, before -+ * runtime image is loaded to set it to 0x8000 (dts reading not ready). -+ * DTS sensor is polled by user application at a slower rate than this -+ * window. Treat the first zero reading as data not available. -+ * Consecutive zeros will be returned so true hot condition is not be -+ * missed. -+ */ -+ if (dts_margin == 0 && priv->temp.dts_raw_prev != 0) { -+ dev_err(priv->dev, -+ "discard first 0 reading from RdPkgConfig 10\n"); -+ discard = true; -+ } -+ priv->temp.dts_raw_prev = dts_margin; -+ if (discard) -+ return -ENODATA; -+ - /** - * Processors return a value of DTS reading in 10.6 format - * (10 bits signed decimal, 6 bits fractional). --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-peci-cputemp-filter-the-first-zero-from-RdPkgConfig-.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-peci-cputemp-filter-the-first-zero-from-RdPkgConfig-.patch deleted file mode 100644 index 1ee3be689..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-peci-cputemp-filter-the-first-zero-from-RdPkgConfig-.patch +++ /dev/null @@ -1,70 +0,0 @@ -From d622c220351def5c8b3fa5540473a4d3ca685233 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Thu, 29 Jul 2021 11:07:31 -0700 -Subject: [PATCH] peci: cputemp: filter the first zero from RdPkgConfig 16 - -Peci command GetPkgConfig 16 can return 0 with cc 0x40 after a CPU -reset. Once pcode run time image is loaded and it returns 0x8000 -as a data not ready. This commit makes it discard the first zero -reading and return -ENODATA. Consecutive zeros will be returned -so that real invalid temperature target setting condition will -still be detected and logged but possibly delayed by the sensor -polling period which is one second (UPDATE_INTERVAL_DEFAULT). - -Signed-off-by: Zhikui Ren -Signed-off-by: Jae Hyun Yoo ---- - drivers/hwmon/peci-cputemp.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c -index af1c09741120..8d5d579ccb1a 100644 ---- a/drivers/hwmon/peci-cputemp.c -+++ b/drivers/hwmon/peci-cputemp.c -@@ -21,6 +21,7 @@ struct temp_group { - struct peci_sensor_data tcontrol; - struct peci_sensor_data tthrottle; - struct peci_sensor_data tjmax; -+ u32 temp_target_raw_prev; - struct peci_sensor_data module[MODTEMP_CHANNEL_NUMS]; - }; - -@@ -89,6 +90,8 @@ static int get_temp_targets(struct peci_cputemp *priv) - s32 tcontrol_margin; - u8 pkg_cfg[4]; - int ret; -+ bool discard = false; -+ u32 temp_target_raw; - - /* - * Just use only the tcontrol marker to determine if target values need -@@ -103,6 +106,26 @@ static int get_temp_targets(struct peci_cputemp *priv) - if (ret) - return ret; - -+ /* -+ * There is a small window (500us) for read temperature target -+ * (RdPkgConfig 16) to return cc 0x40, and temperature target of 0 after -+ * cpu reset, before runtime image is loaded to set it to 0x8000 -+ * Since update interval of the temperature target value is slower than -+ * this window, treat the first zero reading as data not available. -+ * Consecutive zeros will be returned so true invalid temperature target -+ * setting condition will not be missed. -+ */ -+ temp_target_raw = le32_to_cpup((__le32 *)pkg_cfg); -+ if (temp_target_raw == 0 && -+ priv->temp.temp_target_raw_prev != 0) { -+ dev_err(priv->dev, -+ "discard first 0 reading from RdPkgConfig 16\n"); -+ discard = true; -+ } -+ priv->temp.temp_target_raw_prev = temp_target_raw; -+ if (discard) -+ return -ENODATA; -+ - priv->temp.tjmax.value = pkg_cfg[2] * 1000; - - tcontrol_margin = pkg_cfg[1]; --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-vegman-kernel-add-RTC-driver-for-PCHC620.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-vegman-kernel-add-RTC-driver-for-PCHC620.patch deleted file mode 100644 index 1622a01e5..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-vegman-kernel-add-RTC-driver-for-PCHC620.patch +++ /dev/null @@ -1,205 +0,0 @@ -From b80e1dea7595519edbabf3e12b6d31f0e128f901 Mon Sep 17 00:00:00 2001 -From: Ivan Mikhaylov -Date: Mon, 12 Jul 2021 10:46:22 +0300 -Subject: [PATCH] vegman: kernel: add RTC driver for PCHC620 - -Signed-off-by: Ivan Mikhaylov ---- - drivers/rtc/Kconfig | 10 +++ - drivers/rtc/Makefile | 1 + - drivers/rtc/rtc-pchc620.c | 150 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 161 insertions(+) - create mode 100644 drivers/rtc/rtc-pchc620.c - -diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig -index 1adf9f815652..79aba84dd19f 100644 ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -564,6 +564,16 @@ config RTC_DRV_PALMAS - This driver can also be built as a module. If so, the module - will be called rtc-palma. - -+config RTC_DRV_PCHC620 -+ tristate "PCH C620 RTC driver" -+ help -+ If you say yes here you get support for the Intel C620 Series PCH -+ built-in read-only RTC. This driver is not for in-system use on x86, -+ but rather is for external access over I2C from a BMC. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-pchc620. -+ - config RTC_DRV_TPS6586X - tristate "TI TPS6586X RTC driver" - depends on MFD_TPS6586X -diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile -index 4ac8f19fb631..87ab76563a59 100644 ---- a/drivers/rtc/Makefile -+++ b/drivers/rtc/Makefile -@@ -118,6 +118,7 @@ obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o - obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o - obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o - obj-$(CONFIG_RTC_DRV_PALMAS) += rtc-palmas.o -+obj-$(CONFIG_RTC_DRV_PCHC620) += rtc-pchc620.o - obj-$(CONFIG_RTC_DRV_PCAP) += rtc-pcap.o - obj-$(CONFIG_RTC_DRV_PCF2123) += rtc-pcf2123.o - obj-$(CONFIG_RTC_DRV_PCF2127) += rtc-pcf2127.o -diff --git a/drivers/rtc/rtc-pchc620.c b/drivers/rtc/rtc-pchc620.c -new file mode 100644 -index 000000000000..a944b327ca67 ---- /dev/null -+++ b/drivers/rtc/rtc-pchc620.c -@@ -0,0 +1,150 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * RTC driver for PCHC620 -+ * Copyright (C) 2021 YADRO -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define PCH_REG_FORCE_OFF 0x00 -+#define PCH_REG_SC 0x09 -+#define PCH_REG_MN 0x0a -+#define PCH_REG_HR 0x0b -+#define PCH_REG_DW 0x0c -+#define PCH_REG_DM 0x0d -+#define PCH_REG_MO 0x0e -+#define PCH_REG_YR 0x0f -+ -+#define NUM_TIME_REGS (PCH_REG_YR - PCH_REG_SC + 1) -+ -+struct pch { -+ struct rtc_device *rtc; -+ struct regmap *regmap; -+}; -+ -+static int pchc620_rtc_read_time(struct device *dev, struct rtc_time *tm) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ struct pch *pch = i2c_get_clientdata(client); -+ unsigned char rtc_data[NUM_TIME_REGS] = {0}; -+ int rc; -+ -+ rc = regmap_bulk_read(pch->regmap, PCH_REG_SC, rtc_data, NUM_TIME_REGS); -+ if (rc < 0) { -+ dev_err(dev, "Fail to read time reg(%d)\n", rc); -+ return rc; -+ } -+ -+ tm->tm_sec = bcd2bin(rtc_data[0]); -+ tm->tm_min = bcd2bin(rtc_data[1]); -+ tm->tm_hour = bcd2bin(rtc_data[2]); -+ tm->tm_wday = rtc_data[3]; -+ tm->tm_mday = bcd2bin(rtc_data[4]); -+ tm->tm_mon = bcd2bin(rtc_data[5]) - 1; -+ tm->tm_year = bcd2bin(rtc_data[6]) + 100; -+ -+ return 0; -+} -+ -+static ssize_t pch_force_off(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ struct pch *pch = i2c_get_clientdata(client); -+ unsigned long val; -+ int rc; -+ -+ if (kstrtoul(buf, 10, &val)) -+ return -EINVAL; -+ -+ if (val) { -+ /* 0x02 host force off */ -+ rc = regmap_write(pch->regmap, PCH_REG_FORCE_OFF, 0x2); -+ if (rc < 0) { -+ dev_err(dev, "Fail to read time reg(%d)\n", rc); -+ return rc; -+ } -+ } -+ -+ return 0; -+} -+static DEVICE_ATTR(force_off, S_IWUSR | S_IWGRP, NULL, pch_force_off); -+ -+static const struct rtc_class_ops pchc620_rtc_ops = { -+ .read_time = pchc620_rtc_read_time, -+}; -+ -+static const struct regmap_config pchc620_rtc_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, -+ .use_single_read = true, -+}; -+ -+static int pchc620_rtc_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct pch *pch; -+ int rc; -+ -+ pch = devm_kzalloc(&client->dev, sizeof(*pch), GFP_KERNEL); -+ if (!pch) -+ return -ENOMEM; -+ -+ pch->regmap = devm_regmap_init_i2c(client, &pchc620_rtc_regmap_config); -+ if (IS_ERR(pch->regmap)) { -+ dev_err(&client->dev, "regmap_init failed\n"); -+ return PTR_ERR(pch->regmap); -+ } -+ -+ i2c_set_clientdata(client, pch); -+ -+ pch->rtc = devm_rtc_device_register(&client->dev, "pch-rtc", -+ &pchc620_rtc_ops, THIS_MODULE); -+ if (IS_ERR(pch->rtc)) -+ return PTR_ERR(pch->rtc); -+ -+ rc = sysfs_create_file(&client->dev.kobj, &dev_attr_force_off.attr); -+ if (rc) -+ return rc; -+ -+ return 0; -+} -+ -+static int pchc620_rtc_remove(struct i2c_client *client) -+{ -+ sysfs_remove_file(&client->dev.kobj, &dev_attr_force_off.attr); -+ return 0; -+} -+ -+static const struct i2c_device_id pchc620_rtc_id[] = { -+ { "pchc620-rtc", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, pchc620_rtc_id); -+ -+static const struct of_device_id pchc620_rtc_of_match[] = { -+ { .compatible = "rtc,pchc620", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, pchc620_rtc_of_match); -+ -+static struct i2c_driver pchc620_rtc_driver = { -+ .driver = { -+ .name = "pchc620-rtc", -+ .of_match_table = pchc620_rtc_of_match, -+ }, -+ .probe = pchc620_rtc_probe, -+ .remove = pchc620_rtc_remove, -+ .id_table = pchc620_rtc_id, -+}; -+module_i2c_driver(pchc620_rtc_driver); -+ -+MODULE_DESCRIPTION("RTC PCHC620 driver"); -+MODULE_AUTHOR("Ivan Mikhaylov "); -+MODULE_LICENSE("GPL"); --- -2.31.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-ARM-dts-add-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-ARM-dts-add-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch deleted file mode 100644 index ef2196c44..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-ARM-dts-add-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch +++ /dev/null @@ -1,49 +0,0 @@ -From aed87d1ffe2d22986e38b22b1c77beadcd3376c8 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Fri, 30 Jul 2021 14:17:24 -0700 -Subject: [PATCH] ARM: dts: add rtc-pch node into aspeed-bmc-intel-ast2xxx - -This commit adds rtc-pch node into aspeed-bmc-intel-ast2500 and -aspeed-bmc-intel-ast2600 to enable PCH RTC driver. - -Signed-off-by: Jae Hyun Yoo ---- - arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts | 5 +++++ - arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts -index 2efa67f08dcb..a460169e1b7b 100644 ---- a/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts -+++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts -@@ -383,6 +383,11 @@ - aspeed,dma-buf-size = <4095>; - aspeed,hw-timeout-ms = <300>; - status = "okay"; -+ -+ rtc-pch@44 { -+ compatible = "rtc,pchc620"; -+ reg = <0x44>; -+ }; - }; - - &i2c4 { -diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -index 02a671ca0f19..9bc859f69307 100644 ---- a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -+++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -@@ -491,6 +491,11 @@ - multi-master; - aspeed,hw-timeout-ms = <300>; - status = "okay"; -+ -+ rtc-pch@44 { -+ compatible = "rtc,pchc620"; -+ reg = <0x44>; -+ }; - }; - - &i2c12 { --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index b5165c73c..fb05aa1a0 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -1,12 +1,12 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -LINUX_VERSION = "5.10.60" +LINUX_VERSION = "5.15" -KBRANCH = "dev-5.10-intel" +KBRANCH = "dev-5.15-intel" KSRC = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=${KBRANCH}" # Include this as a comment only for downstream auto-bump -# SRC_URI = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=dev-5.10-intel" -SRCREV="c6e2963874ca7454eb901b4ac668f05b36cf03c8" +# SRC_URI = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=dev-5.15-intel" +SRCREV="c7981259e359523e74044f926b69a804c61c86b1" do_compile:prepend(){ # device tree compiler flags @@ -15,15 +15,6 @@ do_compile:prepend(){ SRC_URI += " \ file://intel.cfg \ - file://0001-peci-Add-debug-printing-to-check-caller-PID.patch \ - file://0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch \ - file://0003-Fix-libmctp-build-error.patch \ - file://0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch \ - file://0005-Die_CPU-filter-first-zero-from-GetTemp.patch \ - file://0006-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch \ - file://0007-peci-cputemp-filter-the-first-zero-from-RdPkgConfig-.patch \ - file://0008-vegman-kernel-add-RTC-driver-for-PCHC620.patch \ - file://0009-ARM-dts-add-rtc-pch-node-into-aspeed-bmc-intel-ast2x.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://1000-128MB-flashmap-for-PFR.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch index 2cfa380ef..f21283a75 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch @@ -1,4 +1,4 @@ -From 29c6b0a294e2c32c9617d243d71d202e926262d0 Mon Sep 17 00:00:00 2001 +From 145778897e36f407773844b3b96847ff10306ee8 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Thu, 2 Apr 2020 17:06:07 +0530 Subject: [PATCH] Adding channel specific privilege to network @@ -18,18 +18,19 @@ Change-Id: I3b592a19363eef684e31d5f7c34dad8f2f9211df Signed-off-by: AppaRao Puli Signed-off-by: Yong Li Signed-off-by: Johnathan Mantey +Signed-off-by: Ramya Narayana --- src/ethernet_interface.cpp | 124 +++++++++++++++++++++++++++++++++++++ - src/ethernet_interface.hpp | 36 ++++++++++- + src/ethernet_interface.hpp | 37 ++++++++++- src/network_manager.cpp | 102 ++++++++++++++++++++++++++++++ src/network_manager.hpp | 9 +++ - 4 files changed, 270 insertions(+), 1 deletion(-) + 4 files changed, 271 insertions(+), 1 deletion(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 5ce4349..4c52fc8 100644 +index 2e15803..1145773 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp -@@ -49,6 +49,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; +@@ -48,6 +48,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; constexpr auto RESOLVED_SERVICE_PATH = "/org/freedesktop/resolve1/link/"; constexpr auto METHOD_GET = "Get"; @@ -40,7 +41,7 @@ index 5ce4349..4c52fc8 100644 struct EthernetIntfSocket { EthernetIntfSocket(int domain, int type, int protocol) -@@ -133,6 +137,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, +@@ -132,6 +136,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); #endif @@ -48,8 +49,8 @@ index 5ce4349..4c52fc8 100644 // Emit deferred signal. if (emitSignal) -@@ -1248,5 +1253,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) - manager.writeToConfigurationFile(); +@@ -1322,5 +1327,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) + return gw; } + @@ -174,7 +175,7 @@ index 5ce4349..4c52fc8 100644 } // namespace network } // namespace phosphor diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 12d307f..d764b2b 100644 +index 0fe3778..fa5c889 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -190,9 +191,9 @@ index 12d307f..d764b2b 100644 #include +#include #include - #include #include -@@ -35,7 +38,8 @@ using Ifaces = sdbusplus::server::object::object< + #include +@@ -23,7 +26,8 @@ using Ifaces = sdbusplus::server::object::object< sdbusplus::xyz::openbmc_project::Network::server::MACAddress, sdbusplus::xyz::openbmc_project::Network::IP::server::Create, sdbusplus::xyz::openbmc_project::Network::Neighbor::server::CreateStatic, @@ -202,7 +203,7 @@ index 12d307f..d764b2b 100644 using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; -@@ -43,11 +47,14 @@ using EthernetInterfaceIntf = +@@ -31,11 +35,14 @@ using EthernetInterfaceIntf = sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; using MacAddressIntf = sdbusplus::xyz::openbmc_project::Network::server::MACAddress; @@ -217,7 +218,7 @@ index 12d307f..d764b2b 100644 class Manager; // forward declaration of network manager. -@@ -247,6 +254,14 @@ class EthernetInterface : public Ifaces +@@ -240,6 +247,14 @@ class EthernetInterface : public Ifaces std::string defaultGateway6(std::string gateway) override; using EthernetInterfaceIntf::dhcpEnabled; @@ -231,11 +232,12 @@ index 12d307f..d764b2b 100644 + using ChannelAccessIntf::maxPrivilege; using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; - using EthernetInterfaceIntf::nicEnabled; -@@ -374,6 +389,25 @@ class EthernetInterface : public Ifaces + using EthernetInterfaceIntf::mtu; +@@ -372,6 +387,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the NIC is enabled */ bool queryNicEnabled() const; ++ + /** @brief gets the channel privilege. + * @param[in] interfaceName - Network interface name. + * @returns privilege of the interface @@ -259,10 +261,10 @@ index 12d307f..d764b2b 100644 } // namespace network diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index 9ae9c5b..2f5097a 100644 +index fe59f0b..01a99a3 100644 --- a/src/network_manager.cpp +++ b/src/network_manager.cpp -@@ -36,6 +36,13 @@ extern std::unique_ptr restartTimer; +@@ -39,6 +39,13 @@ extern std::unique_ptr refreshObjectTimer; using namespace phosphor::logging; using namespace sdbusplus::xyz::openbmc_project::Common::Error; @@ -276,7 +278,7 @@ index 9ae9c5b..2f5097a 100644 Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, const std::string& path) : details::VLANCreateIface(bus, objPath, true), -@@ -43,6 +50,101 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, +@@ -46,6 +53,101 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, { fs::path confDir(path); setConfDir(confDir); @@ -379,11 +381,11 @@ index 9ae9c5b..2f5097a 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/src/network_manager.hpp b/src/network_manager.hpp -index 227955c..9f5b7a9 100644 +index fb3cc32..0c3d49b 100644 --- a/src/network_manager.hpp +++ b/src/network_manager.hpp -@@ -155,6 +155,12 @@ class Manager : public details::VLANCreateIface - return (interfaces.find(intf) != interfaces.end()); +@@ -156,6 +156,12 @@ class Manager : public details::VLANCreateIface + return routeTable; } + /** supported privilege list **/ @@ -395,10 +397,10 @@ index 227955c..9f5b7a9 100644 protected: /** @brief Persistent sdbusplus DBus bus connection. */ sdbusplus::bus::bus& bus; -@@ -177,6 +183,9 @@ class Manager : public details::VLANCreateIface +@@ -181,6 +187,9 @@ class Manager : public details::VLANCreateIface - /** @brief Network Configuration directory. */ - fs::path confDir; + /** @brief The routing table */ + route::Table routeTable; + + /** Get the user management service name dynamically **/ + std::string getUserServiceName(); @@ -406,5 +408,5 @@ index 227955c..9f5b7a9 100644 } // namespace network -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch index fe7c45532..90bbc1d5b 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch @@ -1,4 +1,4 @@ -From f6240a81c0ed87c128d454fa9c4023b9062efe5e Mon Sep 17 00:00:00 2001 +From cbd034daf844529eb7f098c990dc8f44c12f6b97 Mon Sep 17 00:00:00 2001 From: sunitakx Date: Tue, 13 Jul 2021 12:54:01 +0000 Subject: [PATCH] Fix for updating MAC address from RedFish @@ -25,16 +25,17 @@ Body: Response code: {"200 OK"} received. Signed-off-by: sunitakx +Signed-off-by: Ramya Narayana --- - src/ethernet_interface.cpp | 19 +++++++++++++------ + src/ethernet_interface.cpp | 17 ++++++++++++----- src/ethernet_interface.hpp | 5 +++++ - 2 files changed, 18 insertions(+), 6 deletions(-) + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 666173e6587e..95bc8db9cd3a 100644 +index 1145773..129905e 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp -@@ -144,6 +144,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, +@@ -143,6 +143,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, { this->emit_object_added(); } @@ -43,18 +44,17 @@ index 666173e6587e..95bc8db9cd3a 100644 } static IP::Protocol convertFamily(int family) -@@ -1129,8 +1131,18 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) +@@ -1209,8 +1211,17 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) } } +void EthernetInterface::macAddressTimeoutHandler() +{ + macUpdateTimer->stop(); -+ // TODO: would remove the call below and -+ // just restart systemd-netwokd -+ // through https://github.com/systemd/systemd/issues/6696 -+ execute("/sbin/ip", "ip", "link", "set", "dev", interfaceName().c_str(), -+ "down"); ++ // The MAC and LLADDRs will only update if the NIC is already down ++ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ++ setNICAdminState(eifSocket.sock, interfaceName().c_str(), false); ++ manager.reloadConfigs(); +} std::string EthernetInterface::macAddress(std::string value) { @@ -62,22 +62,22 @@ index 666173e6587e..95bc8db9cd3a 100644 ether_addr newMAC; try { -@@ -1164,12 +1176,7 @@ std::string EthernetInterface::macAddress(std::string value) +@@ -1244,12 +1255,8 @@ std::string EthernetInterface::macAddress(std::string value) intf->MacAddressIntf::macAddress(validMAC); } MacAddressIntf::macAddress(validMAC); - -- // TODO: would remove the call below and -- // just restart systemd-netwokd -- // through https://github.com/systemd/systemd/issues/6696 -- execute("/sbin/ip", "ip", "link", "set", "dev", interface.c_str(), -- "down"); + macUpdateTimer->start(usec); - manager.writeToConfigurationFile(); + writeConfigurationFile(); +- // The MAC and LLADDRs will only update if the NIC is already down +- EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); +- setNICAdminState(eifSocket.sock, interface.c_str(), false); +- manager.reloadConfigs(); } + #ifdef HAVE_UBOOT_ENV diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 6c7bd69ef987..acf6b6792b75 100644 +index fa5c889..70f4756 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -11,11 +11,14 @@ @@ -95,7 +95,7 @@ index 6c7bd69ef987..acf6b6792b75 100644 namespace phosphor { namespace network -@@ -83,6 +86,8 @@ class EthernetInterface : public Ifaces +@@ -84,6 +87,8 @@ class EthernetInterface : public Ifaces EthernetInterface& operator=(EthernetInterface&&) = delete; virtual ~EthernetInterface() = default; diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch deleted file mode 100644 index 255ae4836..000000000 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch +++ /dev/null @@ -1,261 +0,0 @@ -From f898e4512e7907ba185a1178ad36cb7af6ad0811 Mon Sep 17 00:00:00 2001 -From: sureshv1 -Date: Tue, 10 Aug 2021 16:38:42 +0530 -Subject: [PATCH] Added Debug logs to isolate coredump of RTNETLink Packet - Processing Clang Format updated - -Tested: -Flashed the BMC firmware image with logs included and observed that -the logs are logged during the boot up time and not flooding serial -console.After the BMC is booted up, logs were logged in when ever a -RT Net Link Packet is received and not flooding the journalctl logs. - -Change-Id: I5e1d152b18df17e5351c498210dae5c45f551f7b -Signed-off-by: sureshv1 ---- - src/network_manager.cpp | 15 ++++++++ - src/network_manager_main.cpp | 12 +++++++ - src/rtnetlink_server.cpp | 70 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 97 insertions(+) - -diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index 2f5097a..ec48f2a 100644 ---- a/src/network_manager.cpp -+++ b/src/network_manager.cpp -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -26,6 +27,8 @@ constexpr char SYSTEMD_PATH[] = "/org/freedesktop/systemd1"; - constexpr char SYSTEMD_INTERFACE[] = "org.freedesktop.systemd1.Manager"; - constexpr auto FirstBootFile = "/var/lib/network/firstBoot_"; - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -273,6 +276,12 @@ void Manager::createInterfaces() - - void Manager::createChildObjects() - { -+ if (debug) -+ { -+ std::cout -+ << "Create Child Objects called(restart system conf and DHCP conf)" -+ << "\n"; -+ } - // creates the ethernet interface dbus object. - createInterfaces(); - -@@ -289,6 +298,12 @@ void Manager::createChildObjects() - objPath /= "dhcp"; - dhcpConf = std::make_unique( - bus, objPath.string(), *this); -+ -+ if (debug) -+ { -+ std::cout << "Create Child Objects Exiting" -+ << "\n"; -+ } - } - - ObjectPath Manager::vlan(IntfName interfaceName, uint32_t id) -diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp -index 983616f..c9bdb15 100644 ---- a/src/network_manager_main.cpp -+++ b/src/network_manager_main.cpp -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #ifdef SYNC_MAC_FROM_INVENTORY - #include -@@ -41,6 +42,8 @@ constexpr auto configFile = "/usr/share/network/config.json"; - constexpr auto invNetworkIntf = - "xyz.openbmc_project.Inventory.Item.NetworkInterface"; - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -255,10 +258,19 @@ void restartNetwork() - - void initializeTimers() - { -+ if (debug) -+ std::cout -+ << "Initialize Timer for Refresh Object Timer and Restart Timer" -+ << "\n"; -+ - auto event = sdeventplus::Event::get_default(); - refreshObjectTimer = - std::make_unique(event, std::bind(refreshObjects)); - restartTimer = std::make_unique(event, std::bind(restartNetwork)); -+ -+ if (debug) -+ std::cout << "Initialize Timer Exiting" -+ << "\n"; - } - - } // namespace network -diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp -index 07ca08c..74f08b3 100644 ---- a/src/rtnetlink_server.cpp -+++ b/src/rtnetlink_server.cpp -@@ -11,12 +11,15 @@ - #include - #include - -+#include - #include - #include - #include - #include - #include - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -29,6 +32,9 @@ namespace rtnetlink - - static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) - { -+ if (debug) -+ std::cout << "Should Refresh the Received Header with Data" -+ << "\n"; - switch (hdr.nlmsg_type) - { - case RTM_NEWADDR: -@@ -36,22 +42,43 @@ static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) - case RTM_NEWROUTE: - case RTM_DELROUTE: - { -+ if (debug) -+ std::cout << "Don't Copy Data as the Message Type is:" -+ << hdr.nlmsg_type << "\n"; - return true; - } - case RTM_NEWNEIGH: - case RTM_DELNEIGH: - { -+ if (debug) -+ std::cout << "Message Type is" << hdr.nlmsg_type << "\n"; - struct ndmsg ndm; - if (data.size() < sizeof(ndm)) - { -+ if (debug) -+ std::cout << "Data Size:" << data.size() -+ << " NDM Size:" << sizeof(ndm) << "\n"; - return false; - } -+ if (debug) -+ std::cout -+ << "Processing/Copying the received Data for MLMSG_TYPE:" -+ << hdr.nlmsg_type << " Data Size:" << data.size() << "\n"; - memcpy(&ndm, data.data(), sizeof(ndm)); -+ if (debug) -+ std::cout << "Copied the received Data for MLMSG_TYPE:" -+ << hdr.nlmsg_type -+ << " and NDM Message Size is:" << sizeof(ndm) << "\n"; - // We only want to refresh for static neighbors - return ndm.ndm_state & NUD_PERMANENT; - } - } - -+ if (debug) -+ std::cout << "Should Refresh Object is verified and done without any " -+ "known header type" -+ << "\n"; -+ - return false; - } - -@@ -62,25 +89,58 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, - char buffer[phosphor::network::rtnetlink::BUFSIZE]{}; - int len{}; - -+ if (debug) -+ std::cout << "\n" -+ << "RTNETLINK event Handler is called to read the RTNETLINK " -+ "Packet and Refresh it for a buffer size:" -+ << phosphor::network::rtnetlink::BUFSIZE << "\n"; - auto netLinkHeader = reinterpret_cast(buffer); - while ((len = recv(fd, netLinkHeader, phosphor::network::rtnetlink::BUFSIZE, - 0)) > 0) - { -+ if (debug) -+ { -+ std::cout << "Received the Packet with a Length:" << len << "\n"; -+ } - for (; (NLMSG_OK(netLinkHeader, len)) && - (netLinkHeader->nlmsg_type != NLMSG_DONE); - netLinkHeader = NLMSG_NEXT(netLinkHeader, len)) - { -+ if (debug) -+ std::cout << "NetLinkHeader Message Type is:" -+ << netLinkHeader->nlmsg_type -+ << " with total length(len):" << len -+ << " and block data packet " -+ "length(netLinkHeader->nlmsg_len - NLMSG_HDRLEN):" -+ << netLinkHeader->nlmsg_len - NLMSG_HDRLEN -+ << " and Message Length(netLinkHeader->nlmsg_len):" -+ << netLinkHeader->nlmsg_len << "\n"; - std::string_view data( - reinterpret_cast(NLMSG_DATA(netLinkHeader)), - netLinkHeader->nlmsg_len - NLMSG_HDRLEN); -+ if (debug) -+ { -+ if (netLinkHeader) -+ std::cout << "NetLinkHeader is valid" -+ << "\n"; -+ } - if (shouldRefresh(*netLinkHeader, data)) - { - // starting the timer here to make sure that we don't want - // create the child objects multiple times. -+ if (debug) -+ std::cout << "Check Refresh Object Timer is enabled?" -+ << "\n"; - if (!refreshObjectTimer->isEnabled()) - { - // if start timer throws exception then let the application - // crash -+ if (debug) -+ std::cout -+ << "Call Restart Once with a Timeout seconds:" -+ << std::chrono::seconds(refreshTimeout).count() -+ << "\n"; -+ - refreshObjectTimer->restartOnce(refreshTimeout); - } // end if - } // end if -@@ -89,6 +149,16 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, - - } // end while - -+ if (debug) -+ { -+ std::cout << "RTNETLINK Event Handler completed read of packets and " -+ "processed it" -+ << " with an length(exit):" << len << "\n"; -+ -+ if (errno) -+ std::cout << "Error Number:" << errno << "\n"; -+ } -+ - return 0; - } - --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend index 63746d8be..4828c9ea0 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend @@ -3,11 +3,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "2c0fc568057c5575a75ad638ea91bc8c65b57160" +SRCREV = "ee2cba8a7d22ef4a251181087e9ef9bfc5c4b165" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ file://0004-Fix-for-updating-MAC-address-from-RedFish.patch \ - file://0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch \ " EXTRA_OECONF:append = " --enable-nic-ethtool=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb index 53ba2eeac..711e4eced 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit meson systemd SRC_URI = "git://github.com/openbmc/bios-settings-mgr.git" -SRCREV = "b5984b87eb93f57f8bc2c123717527076a560753" +SRCREV = "29656f07b7e81c0bb13ca119b4c6ef62f5e79a18" SYSTEMD_SERVICE:${PN} += " \ xyz.openbmc_project.biosconfig_manager.service \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch new file mode 100644 index 000000000..9ad2641bc --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch @@ -0,0 +1,78 @@ +From ff4b6cab1dead31bad114321c211797ac28b36b1 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Wed, 10 Nov 2021 15:17:13 +0000 +Subject: [PATCH] Add HSBP FRU details in json configuration + +Added Intel specific HSBP CPLD FRU details in json configuration file. + +Tested: +1. Detected and read the HSBP FRU with new address on reworked board. +2. busctl tree xyz.openbmc_project.HsbpManager +└─/xyz + └─/xyz/openbmc_project + ├─/xyz/openbmc_project/inventory + │ └─/xyz/openbmc_project/inventory/item + │ ├─/xyz/openbmc_project/inventory/item/drive + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_1 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_10 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_11 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_12 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_13 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_14 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_15 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_16 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_2 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_3 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_4 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_5 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_6 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_7 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_8 + │ │ └─/xyz/openbmc_project/inventory/item/drive/Drive_9 + │ └─/xyz/openbmc_project/inventory/item/hsbp + │ ├─/xyz/openbmc_project/inventory/item/hsbp/HSBP_1 + │ └─/xyz/openbmc_project/inventory/item/hsbp/HSBP_2 + └─/xyz/openbmc_project/software + ├─/xyz/openbmc_project/software/HSBP_1 + └─/xyz/openbmc_project/software/HSBP_2 + +Signed-off-by: Jayaprakash Mutyala +--- + configurations/F2U8X25 HSBP.json | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/configurations/F2U8X25 HSBP.json b/configurations/F2U8X25 HSBP.json +index 60e7817..cdf9076 100644 +--- a/configurations/F2U8X25 HSBP.json ++++ b/configurations/F2U8X25 HSBP.json +@@ -7,6 +7,13 @@ + "Name": "F2U8X25 HSBP1 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x68", ++ "Bus": "$bus", ++ "Index": 1, ++ "Name": "HSBP 1", ++ "Type": "Intel HSBP CPLD" ++ }, + { + "Address": "0x70", + "Bus": "$bus", +@@ -84,6 +91,13 @@ + "Name": "F2U8X25 HSBP2 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x69", ++ "Bus": "$bus", ++ "Index": 2, ++ "Name": "HSBP 2", ++ "Type": "Intel HSBP CPLD" ++ }, + { + "Address": "0x73", + "Bus": "$bus", +-- +2.17.1 + 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 a31b5ba93..ba51f9454 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 = "8bb94ed6c9d64042ef367b5ff679336ff4d75093" +SRCREV = "2c412eef8eb76bf2a998c9d193f2dc92aaec39f8" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" @@ -9,5 +9,6 @@ SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch \ file://0005-Allow-MUX-idle-state-to-be-configured-as-DISCONNECT.patch \ file://0006-Change-HSBP-FRU-address-and-add-MUX-mode-configurati.patch \ + file://0007-Add-HSBP-FRU-details-in-json-configuration.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service index a242dba08..4ec453d9e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service @@ -6,7 +6,7 @@ After=dev-%i.device [Service] ExecStartPre=/usr/bin/sol-option-check.sh ExecStart=/usr/bin/env obmc-console-server --config {sysconfdir}/obmc-console.conf %i -ExecStopPost=/bin/sh -c 'echo -n "0" > /sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart_routing/raw' +ExecStopPost=/bin/sh -c 'echo -n "0" > /sys/bus/platform/drivers/aspeed-uart-routing/1e789098.uart-routing/hicra' SyslogIdentifier=obmc-console-server Restart=always 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 ba07f4736..b8e0e7741 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,7 +1,7 @@ # Keep this as a comment to enable the auto-bump script without # stomping on SRC_URI from previous .bbappend files #SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "3a665b28dcc0d9f6926a1f5eb20bc0d9d768418d" +SRCREV = "e0764cf41d16b823a519e9d4f508b588e3e84aba" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 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 41e824545..328176aca 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,7 +5,7 @@ SYSTEMD_SERVICE:${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "e7507a8b55136accc501408d691bd816abc4833f" +SRCREV = "cca9c659889d149c06e95bab4b8808db4f1e3eab" SRC_URI += "\ file://0001-allow-dbus-sensors-without-thresholds.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch new file mode 100644 index 000000000..3a245c944 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch @@ -0,0 +1,100 @@ +From 8d3eb2a57a70715b2cc6088904e8be007ab921b2 Mon Sep 17 00:00:00 2001 +From: Vernon Mauery +Date: Fri, 27 Aug 2021 11:44:02 -0700 +Subject: [PATCH 1/4] log redfish errors on all pfr image auth failures + +Previous code was doing a 'mtd-util pfr authenticate' prior to manually +calculating and comparing the hashes. This is incorrect behavior. There +is no need to manually calculate hashes since that is part of the pfr +authentication process. + +An unintended side effect of this is that if pfr authenticate fails for +some reason other than hash compare, the redfish log does not happen. + +Tested: phosphor-version-software-mananger logs a redfish log on rom id + mismatch as expected. + +Signed-off-by: Vernon Mauery +--- + pfr_image_manager.cpp | 51 +++++-------------------------------------- + 1 file changed, 5 insertions(+), 46 deletions(-) + +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index ce850cb..aa96a99 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -53,13 +53,10 @@ int Manager::verifyImage(const std::filesystem::path imgPath, + uint8_t imgType = 0; + uint32_t imgMagic = 0; + uint8_t verData[2] = {0}; +- uint32_t hashLen = 0; + struct pfrImgBlock0 block0Data = {}; + + std::string imageName; + +- EVP_MD_CTX* ctx; +- + if (std::filesystem::exists(imgPath)) + { + try +@@ -227,52 +224,14 @@ int Manager::verifyImage(const std::filesystem::path imgPath, + ImageFail::FAIL( + "Security violation: image authentication failure"), + ImageFail::PATH(imgPath.c_str())); +- return -1; +- } +- +- imgFile.seekg(pfmPos, +- std::ios::beg); // Version is at 0x806 in the PFM +- imgFile.read(reinterpret_cast(&verData), sizeof(verData)); +- imgFile.close(); +- +- auto size = std::filesystem::file_size(imgPath); +- +- phosphor::logging::log( +- "Image Size", phosphor::logging::entry("IMAGESIZE=0x%x", +- static_cast(size))); +- +- // Adds all digest algorithms to the internal table +- OpenSSL_add_all_digests(); +- +- ctx = EVP_MD_CTX_create(); +- EVP_DigestInit(ctx, EVP_sha256()); + +- // Hash the image file and update the digest +- auto dataPtr = mapFile(imgPath, size); +- +- EVP_DigestUpdate(ctx, ((uint8_t*)dataPtr() + lengthBlk0Blk1), +- (size - lengthBlk0Blk1)); +- +- std::vector digest(EVP_MD_size(EVP_sha256())); +- std::vector expectedDigest(block0Data.hash256, +- &block0Data.hash256[0] + 32); +- +- EVP_DigestFinal(ctx, digest.data(), &hashLen); +- EVP_MD_CTX_destroy(ctx); +- +- std::string redfishMsgID = "OpenBMC.0.1"; +- +- if (expectedDigest != digest) +- { +- redfishMsgID += ".GeneralFirmwareSecurityViolation"; ++ constexpr const char* redfishMsgID = ++ "OpenBMC.0.1.GeneralFirmwareSecurityViolation"; + sd_journal_send("MESSAGE=%s", +- "Firmware image HASH verification failed", ++ "Firmware image authentication failed", + "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", +- redfishMsgID.c_str(), "REDFISH_MESSAGE_ARGS=%s", +- "Image HASH check fail", NULL); +- phosphor::logging::report( +- ImageFail::FAIL("Security violation: hash mismatch"), +- ImageFail::PATH(imgPath.c_str())); ++ redfishMsgID, "REDFISH_MESSAGE_ARGS=%s", ++ "Image authentication check fail", NULL); + return -1; + } + +-- +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 5745cb87c..53d09387b 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 @@ -24,6 +24,7 @@ SRC_URI_PFR = " \ file://0016-Process-PLDM-image-type.patch \ file://0017-Fix-build-error.patch \ file://0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch \ + file://0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', SRC_URI_PFR, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend index ff30bacfb..0c97b0b86 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend @@ -1,4 +1,4 @@ DEPENDS += " gtest" #SRC_URI = "git://github.com/openbmc/phosphor-host-postd.git" -SRCREV = "2a744b2d70ce9de8519a7c716da5009cb049db17" +SRCREV = "996facb65d554f7c0f14c10e3c9252d67a01e21a" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch index b689748ea..6621d2512 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch @@ -1,4 +1,4 @@ -From c65d6f4a6d2939335608957fba25e5c8a445813e Mon Sep 17 00:00:00 2001 +From 7c005c318a12c53ed887b3081bd4b34ea0213053 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Mon, 28 Jun 2021 21:56:18 +0530 Subject: [PATCH] Firmware update configuration changes @@ -39,18 +39,20 @@ Tested: - Successfully ran redfish validater with no new errors. +Change-Id: I25ef6d64af3f1dcea3acba93d7fd2b505130142e Signed-off-by: Vikram Bodireddy +Signed-off-by: AppaRao Puli --- - redfish-core/lib/update_service.hpp | 456 ++++++++++++++---- + redfish-core/lib/update_service.hpp | 462 ++++++++++++++---- static/redfish/v1/$metadata/index.xml | 3 + .../JsonSchemas/OemUpdateService/index.json | 69 +++ .../redfish/v1/schema/OemUpdateService_v1.xml | 40 ++ - 4 files changed, 481 insertions(+), 87 deletions(-) + 4 files changed, 484 insertions(+), 90 deletions(-) create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 663d48b..70c58d4 100644 +index e420130..b3270f0 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -26,7 +26,9 @@ @@ -211,9 +213,9 @@ index 663d48b..70c58d4 100644 softwareInterfaceAdded(const std::shared_ptr& asyncResp, + const std::vector imgUriTargets, sdbusplus::message::message& m, - const crow::Request& req) + task::Payload&& payload) { -@@ -76,22 +181,24 @@ static void +@@ -76,23 +181,25 @@ static void m.read(objPath, interfacesProperties); @@ -228,11 +230,15 @@ index 663d48b..70c58d4 100644 { // Retrieve service and activate crow::connections::systemBus->async_method_call( -- [objPath, asyncResp, +- [objPath, asyncResp, payload(std::move(payload))]( + [objPath, asyncResp, imgTargets{imgUriTargets}, - req](const boost::system::error_code errorCode, - const std::vector>>& objInfo) { ++ payload(std::move(payload))]( + const boost::system::error_code errorCode, +- const std::vector< +- std::pair>>& +- objInfo) mutable { ++ const std::vector>>& objInfo) { if (errorCode) { - BMCWEB_LOG_DEBUG << "error_code = " << errorCode; @@ -242,7 +248,7 @@ index 663d48b..70c58d4 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -118,7 +225,7 @@ static void +@@ -119,7 +226,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -251,7 +257,7 @@ index 663d48b..70c58d4 100644 if (asyncResp) { std::shared_ptr task = -@@ -250,8 +357,7 @@ static void +@@ -251,8 +358,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -261,7 +267,7 @@ index 663d48b..70c58d4 100644 } } } -@@ -261,7 +367,7 @@ static void +@@ -262,7 +368,7 @@ static void static void monitorForSoftwareAvailable( const std::shared_ptr& asyncResp, const crow::Request& req, const std::string& url, @@ -270,20 +276,22 @@ index 663d48b..70c58d4 100644 { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -301,9 +407,10 @@ static void monitorForSoftwareAvailable( +@@ -301,11 +407,12 @@ static void monitorForSoftwareAvailable( + redfish::messages::internalError(asyncResp->res); } }); - -- auto callback = [asyncResp, req](sdbusplus::message::message& m) { ++ + task::Payload payload(req); +- auto callback = [asyncResp, + auto callback = [asyncResp, imgTargets{imgUriTargets}, -+ req](sdbusplus::message::message& m) { + payload](sdbusplus::message::message& m) mutable { BMCWEB_LOG_DEBUG << "Match fired"; -- softwareInterfaceAdded(asyncResp, m, req); -+ softwareInterfaceAdded(asyncResp, imgTargets, m, req); +- softwareInterfaceAdded(asyncResp, m, std::move(payload)); ++ softwareInterfaceAdded(asyncResp, imgTargets, m, std::move(payload)); }; fwUpdateInProgress = true; -@@ -468,12 +575,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) +@@ -470,12 +577,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -300,7 +308,7 @@ index 663d48b..70c58d4 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -522,6 +632,9 @@ inline void requestRoutesUpdateService(App& app) +@@ -524,6 +634,9 @@ inline void requestRoutesUpdateService(App& app) asyncResp->res.jsonValue["Name"] = "Update Service"; asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; @@ -310,7 +318,7 @@ index 663d48b..70c58d4 100644 // UpdateService cannot be disabled asyncResp->res.jsonValue["ServiceEnabled"] = true; asyncResp->res.jsonValue["FirmwareInventory"] = { -@@ -536,7 +649,8 @@ inline void requestRoutesUpdateService(App& app) +@@ -538,7 +651,8 @@ inline void requestRoutesUpdateService(App& app) asyncResp->res .jsonValue["Actions"]["#UpdateService.SimpleUpdate"]; updateSvcSimpleUpdate["target"] = @@ -320,7 +328,7 @@ index 663d48b..70c58d4 100644 updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] = {"TFTP"}; #endif -@@ -578,89 +692,258 @@ inline void requestRoutesUpdateService(App& app) +@@ -580,89 +694,258 @@ inline void requestRoutesUpdateService(App& app) "/xyz/openbmc_project/software/apply_time", "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); @@ -457,13 +465,13 @@ index 663d48b..70c58d4 100644 - applyTime)) + std::string applyTimeNewVal; + if (applyTime == "Immediate") -+ { + { + applyTimeNewVal = + "xyz.openbmc_project.Software.ApplyTime." + "RequestedApplyTimes.Immediate"; + } + else if (applyTime == "OnReset") - { ++ { + applyTimeNewVal = + "xyz.openbmc_project.Software.ApplyTime." + "RequestedApplyTimes.OnReset"; @@ -636,7 +644,7 @@ index 663d48b..70c58d4 100644 BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") .privileges(redfish::privileges::postUpdateService) .methods(boost::beast::http::verb::post)( -@@ -670,7 +953,8 @@ inline void requestRoutesUpdateService(App& app) +@@ -672,7 +955,8 @@ inline void requestRoutesUpdateService(App& app) // Setup callback for when new software detected monitorForSoftwareAvailable(asyncResp, req, @@ -646,7 +654,7 @@ index 663d48b..70c58d4 100644 std::string filepath("/tmp/images/" + boost::uuids::to_string( -@@ -683,7 +967,7 @@ inline void requestRoutesUpdateService(App& app) +@@ -685,7 +969,7 @@ inline void requestRoutesUpdateService(App& app) out.close(); BMCWEB_LOG_DEBUG << "file upload complete!!"; }); @@ -655,7 +663,7 @@ index 663d48b..70c58d4 100644 inline void requestRoutesSoftwareInventoryCollection(App& app) { -@@ -746,8 +1030,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app) +@@ -748,8 +1032,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app) "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast(0), @@ -665,7 +673,7 @@ index 663d48b..70c58d4 100644 }); } /* Fill related item links (i.e. bmc, bios) in for inventory */ -@@ -911,7 +1194,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -913,7 +1196,7 @@ inline void requestRoutesSoftwareInventory(App& app) }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -674,7 +682,7 @@ index 663d48b..70c58d4 100644 } if (!found) { -@@ -935,8 +1218,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -937,8 +1220,7 @@ inline void requestRoutesSoftwareInventory(App& app) "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", static_cast(0), @@ -685,10 +693,10 @@ index 663d48b..70c58d4 100644 } diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index eba38bf..876ebfb 100644 +index 66b6faf..f0919c9 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2346,6 +2346,9 @@ +@@ -2444,6 +2444,9 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch index 8b0d90fe0..41acb6057 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch @@ -25,7 +25,7 @@ index cdb19901e82d..9c4ae8821074 100644 static bool doingWrite = false; -+constexpr char const* uartMuxCtrlPath = "/sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart_routing/raw"; ++constexpr char const* uartMuxCtrlPath = "/sys/bus/platform/drivers/aspeed-uart-routing/1e789098.uart-routing/hicra"; +constexpr char const* uartMuxCtrlVal = "0x03450003"; + inline void doWrite() diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch index b171a8b2c..1193fe9d1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch @@ -1,4 +1,4 @@ -From df571ddf0596f73c0318da3a90b9813e6df19dd9 Mon Sep 17 00:00:00 2001 +From b468b508176dfffe2e8e4adb3052577b9ff70d2f Mon Sep 17 00:00:00 2001 From: "Arun P. Mohanan" Date: Wed, 27 Jan 2021 18:22:58 +0530 Subject: [PATCH] Add state sensor messages to the registry @@ -34,19 +34,19 @@ Signed-off-by: Arun P. Mohanan 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index 5eb9380..dbea97c 100644 +index 6cf503f..87b2913 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { - "0.1.0", + "0.2.0", "OpenBMC", }; --constexpr std::array registry = { -+constexpr std::array registry = { +-constexpr std::array registry = { ++constexpr std::array registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -2318,6 +2318,39 @@ constexpr std::array registry = { +@@ -2331,6 +2331,39 @@ constexpr std::array registry = { {}, "None.", }}, @@ -86,7 +86,7 @@ index 5eb9380..dbea97c 100644 MessageEntry{"SystemInterfaceDisabledProvisioned", { "Indicates that the system interface is in the disabled " -@@ -2410,6 +2443,5 @@ constexpr std::array registry = { +@@ -2423,6 +2456,5 @@ constexpr std::array registry = { {"string"}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch index d0cfd1c44..35ac7a114 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch @@ -1,4 +1,4 @@ -From 7282ab7756cdb8c844bef9affd8a8e894828678c Mon Sep 17 00:00:00 2001 +From 40895934bdedb978e8cfd47930ae5a190e19b440 Mon Sep 17 00:00:00 2001 From: Ayushi Smriti Date: Mon, 10 May 2021 12:32:30 +0530 Subject: [PATCH] Add msg registry for subscription related actions @@ -18,19 +18,19 @@ Signed-off-by: Ayushi Smriti 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index e12a138..2f981db 100644 +index 87b2913..1e493ca 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { "0.2.0", "OpenBMC", }; --constexpr std::array registry = { -+constexpr std::array registry = { +-constexpr std::array registry = { ++constexpr std::array registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -417,6 +417,45 @@ constexpr std::array registry = { +@@ -417,6 +417,45 @@ constexpr std::array registry = { {}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch index 829384305..54636cb3d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch @@ -1,7 +1,7 @@ -From 3ec1f79d1cb29724e345586f0baefca81d98d3ae Mon Sep 17 00:00:00 2001 +From eeac51ebaaad82bb4ac65a029c81c221e32b33ea Mon Sep 17 00:00:00 2001 From: mansijos Date: Wed, 26 May 2021 17:40:04 +0530 -Subject: [PATCH] [bmcweb] Add BMC Time update log to the registry +Subject: [PATCH] Add BMC Time update log to the registry Add message in registry to log an event that indicates BMC time is set via NTP, Host or Manually. @@ -20,19 +20,19 @@ Signed-off-by: mansijos 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index 2f981db..a00d235 100644 +index 1e493ca..967713f 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { "0.2.0", "OpenBMC", }; --constexpr std::array registry = { -+constexpr std::array registry = { +-constexpr std::array registry = { ++constexpr std::array registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -286,6 +286,39 @@ constexpr std::array registry = { +@@ -286,6 +286,39 @@ constexpr std::array registry = { {}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch index 028119249..522f04886 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch @@ -1,6 +1,6 @@ -From 2b865ad20ce0616b79a453d1571976bb2303050c Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny -Date: Wed, 14 Jul 2021 13:55:27 +0000 +From 6bc3ec77e062e8f2108f755e9f0089a014031f91 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Wed, 6 Oct 2021 21:51:16 +0000 Subject: [PATCH] Add generic message - PropertySizeExceeded Adding a generic error message "PropertySizeExceeded" @@ -12,6 +12,7 @@ Verified by explicitly sending this message as a response. Change-Id: I0e9f85f82a69c598e169fc8e9a68c3f66c0084d8 Signed-off-by: Nitin Wankhade +Signed-off-by: AppaRao Puli --- redfish-core/include/error_messages.hpp | 12 +++++++++ .../registries/base_message_registry.hpp | 17 +++++++++++- @@ -19,7 +20,7 @@ Signed-off-by: Nitin Wankhade 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp -index 922dae9..f29e326 100644 +index 3d11cc4..051cff1 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -222,6 +222,18 @@ nlohmann::json propertyValueFormatError(const std::string& arg1, @@ -42,19 +43,19 @@ index 922dae9..f29e326 100644 * @brief Formats PropertyValueNotInList message into JSON * Message body: "The value for the property is not in the list of diff --git a/redfish-core/include/registries/base_message_registry.hpp b/redfish-core/include/registries/base_message_registry.hpp -index 58156c8..ab9b046 100644 +index 702cd6f..193df16 100644 --- a/redfish-core/include/registries/base_message_registry.hpp +++ b/redfish-core/include/registries/base_message_registry.hpp -@@ -36,7 +36,7 @@ const Header header = { +@@ -22,7 +22,7 @@ const Header header = { constexpr const char* url = - "https://redfish.dmtf.org/registries/Base.1.10.0.json"; + "https://redfish.dmtf.org/registries/Base.1.11.0.json"; --constexpr std::array registry = { -+constexpr std::array registry = { +-constexpr std::array registry = { ++constexpr std::array registry = { MessageEntry{ "AccessDenied", { -@@ -664,6 +664,21 @@ constexpr std::array registry = { +@@ -692,6 +692,21 @@ constexpr std::array registry = { "Remove the property from the request body and resubmit " "the request if the operation failed.", }}, @@ -77,7 +78,7 @@ index 58156c8..ab9b046 100644 { "Indicates that an unknown property was included in the " diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 409adb1..bebb6d8 100644 +index 9c28e8f..854a1a5 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -514,6 +514,33 @@ void propertyValueFormatError(crow::Response& res, const std::string& arg1, @@ -115,5 +116,5 @@ index 409adb1..bebb6d8 100644 * @internal * @brief Formats PropertyValueNotInList message into JSON for the specified -- -2.25.1 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch deleted file mode 100644 index 2b8f8987c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 35c9f6f0f4e1254f0512154cc46116d8047fe19b Mon Sep 17 00:00:00 2001 -From: Chalapathi Venkataramashetty -Date: Wed, 14 Jul 2021 20:44:06 +0000 -Subject: [PATCH] Add message registry entry for FirmwareResiliencyError - -Add an event log in redfish when firmware update failed due to -FirmwareResiliencyError. - -The existing message entries BMCFirmwareResiliencyError(for BMC update -failures) and BIOSFirmwareResiliencyError(for BIOS update failures) are -not useful for the new platform. The new platform's CPLD report common -error code for BMC, PCH or CPLD firmware update failures. Hence a common -message entry is required to capture the firmware update failure events. - -This event is Implemented in the following review. -https://gerrit.openbmc-project.xyz/c/openbmc/pfr-manager/+/43281 - -Tested: -Redfish Service Validator passed for this change. - -Update BMC firmware with mismatched SVN -POST: https:///redfish/v1/UpdateService/ - with binary file -After BMC reboots check for Event log in Redfish -Command: GET: https:///redfish/v1/Systems/system/LogServices/ - EventLog/Entries -Response: -{ - "@odata.id": "/redfish/v1/Systems/system/LogServices/ - EventLog/Entries/1621435142_1", - "@odata.type": "#LogEntry.v1_4_0.LogEntry", - "Created": "2021-05-19T14:39:02+00:00", - "EntryType": "Event", - "Id": "1621435142_1", - "Message": "Firmware resiliency error. Error reason: - Firmware update failed(MinorCode:0x02).", - "MessageArgs": [ - "Firmware update failed(MinorCode:0x02)" - ], - "MessageId": "OpenBMC.0.1.FirmwareResiliencyError", - "Name": "System Event Log Entry", - "Severity": "Critical" - }, - -Signed-off-by: Chalapathi Venkataramashetty ---- - .../registries/openbmc_message_registry.hpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index a00d235..967713f 100644 ---- a/redfish-core/include/registries/openbmc_message_registry.hpp -+++ b/redfish-core/include/registries/openbmc_message_registry.hpp -@@ -29,7 +29,7 @@ const Header header = { - "0.2.0", - "OpenBMC", - }; --constexpr std::array registry = { -+constexpr std::array registry = { - MessageEntry{ - "ADDDCCorrectable", - { -@@ -560,6 +560,18 @@ constexpr std::array registry = { - {"string"}, - "None.", - }}, -+ MessageEntry{"FirmwareResiliencyError", -+ { -+ "Indicates firmware encountered resilience error.", -+ "Firmware resiliency error. Error reason: %1.", -+ "Critical", -+ "Critical", -+ 1, -+ { -+ "string", -+ }, -+ "None.", -+ }}, - MessageEntry{"FirmwareUpdateCompleted", - { - "Indicates a firmware update has completed successfully.", --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch index a9a4ab151..22ae05fa3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch @@ -1,4 +1,4 @@ -From fb337f868543f72bd8ba24db3c4b09b4c1d888ab Mon Sep 17 00:00:00 2001 +From 94a0ae774933b7801d0c8d843b3ac3a39a5e5646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Ambro=C5=BCewicz?= Date: Fri, 30 Jul 2021 15:25:29 +0200 Subject: [PATCH] Add 'count' sensor type @@ -13,7 +13,7 @@ Testing: 1 file changed, 1 insertion(+) diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index cb7ea15..d72a572 100644 +index 45a1eb6..7405e5a 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -63,6 +63,7 @@ static const boost::container::flat_map +Date: Fri, 3 Sep 2021 02:33:43 -0500 +Subject: [PATCH] Add Model & CoreCount to ProcessorSummary + +In Redfish ComputerSystem schema, the ProcessorSummary parameter +lists summary information of the Processors on the system. This commit +adds the 'Model' and 'CoreCount' properties to ProcessorSummary. + +If the CPU Models are different, then the 'Model' field takes the first +entry in alphabetical order. + +Testing: +1. Redfish Validator Testing successfully passed. +2. Curl testing: + +curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system + +... + "ProcessorSummary": { + "CoreCount": 24, + "Count": 2, + "Model": "test_name", + "Status": { + "Health": "OK", + "HealthRollup": "OK", + "State": "Disabled" + } + }, +... + +Change-Id: I39cbf6ed35c35ce3a3551c9689237d5023775326 +Signed-off-by: Ali Ahmed +Signed-off-by: AppaRao Puli +--- + redfish-core/lib/systems.hpp | 229 ++++++++++++++++++++++------------- + 1 file changed, 147 insertions(+), 82 deletions(-) + +diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp +index 680a0ee..3b5f9e4 100644 +--- a/redfish-core/lib/systems.hpp ++++ b/redfish-core/lib/systems.hpp +@@ -139,6 +139,152 @@ inline void + } + } + ++inline void getProcessorProperties( ++ const std::shared_ptr& aResp, const std::string& service, ++ const std::string& path, ++ const std::vector>>& ++ properties) ++{ ++ ++ BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties."; ++ ++ auto getCpuPresenceState = ++ [aResp](const boost::system::error_code ec3, ++ const std::variant& cpuPresenceCheck) { ++ if (ec3) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; ++ return; ++ } ++ modifyCpuPresenceState(aResp, cpuPresenceCheck); ++ }; ++ ++ auto getCpuFunctionalState = ++ [aResp](const boost::system::error_code ec3, ++ const std::variant& cpuFunctionalCheck) { ++ if (ec3) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; ++ return; ++ } ++ modifyCpuFunctionalState(aResp, cpuFunctionalCheck); ++ }; ++ ++ // Get the Presence of CPU ++ crow::connections::systemBus->async_method_call( ++ std::move(getCpuPresenceState), service, path, ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.Inventory.Item", "Present"); ++ ++ // Get the Functional State ++ crow::connections::systemBus->async_method_call( ++ std::move(getCpuFunctionalState), service, path, ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional"); ++ ++ for (const auto& property : properties) ++ { ++ if (property.first == "Family") ++ { ++ // Get the CPU Model ++ const std::string* modelStr = ++ std::get_if(&property.second); ++ if (!modelStr) ++ { ++ BMCWEB_LOG_DEBUG << "Failed to get CPU Family"; ++ // Skip it and continue with other properties ++ continue; ++ } ++ if ((*modelStr).size() < 1) ++ { ++ BMCWEB_LOG_DEBUG << "Empty CPU Family info, skipping..."; ++ continue; ++ } ++ nlohmann::json& prevModel = ++ aResp->res.jsonValue["ProcessorSummary"]["Model"]; ++ std::string* prevModelPtr = prevModel.get_ptr(); ++ ++ // If CPU Models are different, use the first entry in ++ // alphabetical order ++ ++ // If Model has never been set ++ // before, set it to *modelStr ++ if (prevModelPtr == nullptr) ++ { ++ prevModel = *modelStr; ++ } ++ // If Model has been set before, only change if new Model is ++ // higher in alphabetical order ++ else ++ { ++ if (*modelStr < *prevModelPtr) ++ { ++ prevModel = *modelStr; ++ } ++ } ++ } ++ else if (property.first == "CoreCount") ++ { ++ // Get CPU CoreCount and add it to the total ++ const uint16_t* coreCountVal = ++ std::get_if(&property.second); ++ ++ if (!coreCountVal) ++ { ++ BMCWEB_LOG_DEBUG << "Failed to get CPU Core count"; ++ // Skip it and continue with other properties ++ continue; ++ } ++ ++ nlohmann::json& coreCount = ++ aResp->res.jsonValue["ProcessorSummary"]["CoreCount"]; ++ uint64_t* coreCountPtr = coreCount.get_ptr(); ++ ++ if (coreCountPtr == nullptr) ++ { ++ coreCount = *coreCountVal; ++ } ++ else ++ { ++ *coreCountPtr += *coreCountVal; ++ } ++ } ++ } ++} ++ ++/* ++ * @brief Get ProcessorSummary fields ++ * ++ * @param[in] aResp Shared pointer for completing asynchronous calls ++ * @param[in] service dbus service for Cpu Information ++ * @param[in] path dbus path for Cpu ++ * ++ * @return None. ++ */ ++inline void getProcessorSummary(const std::shared_ptr& aResp, ++ const std::string& service, ++ const std::string& path) ++{ ++ ++ crow::connections::systemBus->async_method_call( ++ [aResp, service, ++ path](const boost::system::error_code ec2, ++ const std::vector>>& properties) { ++ if (ec2) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec2; ++ messages::internalError(aResp->res); ++ return; ++ } ++ getProcessorProperties(aResp, service, path, properties); ++ }, ++ service, path, "org.freedesktop.DBus.Properties", "GetAll", ++ "xyz.openbmc_project.Inventory.Item.Cpu"); ++} ++ + /* + * @brief Retrieves computer system properties over dbus + * +@@ -309,88 +455,7 @@ inline void + BMCWEB_LOG_DEBUG + << "Found Cpu, now get its properties."; + +- crow::connections::systemBus->async_method_call( +- [aResp, service{connection.first}, +- path](const boost::system::error_code ec2, +- const std::vector< +- std::pair>& +- properties) { +- if (ec2) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " << ec2; +- messages::internalError(aResp->res); +- return; +- } +- BMCWEB_LOG_DEBUG << "Got " +- << properties.size() +- << " Cpu properties."; +- +- auto getCpuPresenceState = +- [aResp]( +- const boost::system::error_code ec3, +- const std::variant& +- cpuPresenceCheck) { +- if (ec3) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " +- << ec3; +- return; +- } +- modifyCpuPresenceState( +- aResp, cpuPresenceCheck); +- }; +- +- auto getCpuFunctionalState = +- [aResp]( +- const boost::system::error_code ec3, +- const std::variant& +- cpuFunctionalCheck) { +- if (ec3) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " +- << ec3; +- return; +- } +- modifyCpuFunctionalState( +- aResp, cpuFunctionalCheck); +- }; +- +- // Get the Presence of CPU +- crow::connections::systemBus +- ->async_method_call( +- std::move(getCpuPresenceState), +- service, path, +- "org.freedesktop.DBus." +- "Properties", +- "Get", +- "xyz.openbmc_project.Inventory." +- "Item", +- "Present"); +- +- // Get the Functional State +- crow::connections::systemBus +- ->async_method_call( +- std::move(getCpuFunctionalState), +- service, path, +- "org.freedesktop.DBus." +- "Properties", +- "Get", +- "xyz.openbmc_project.State." +- "Decorator." +- "OperationalStatus", +- "Functional"); +- +- // Get the MODEL from +- // xyz.openbmc_project.Inventory.Decorator.Asset +- // support it later as Model is Empty +- // currently. +- }, +- connection.first, path, +- "org.freedesktop.DBus.Properties", "GetAll", +- "xyz.openbmc_project.Inventory.Item.Cpu"); ++ getProcessorSummary(aResp, connection.first, path); + + cpuHealth->inventory.emplace_back(path); + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch index 93bbb7494..19a392873 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch @@ -1,7 +1,7 @@ -From 501003876765f51799152bace657d97b7fa2b60e Mon Sep 17 00:00:00 2001 +From bde7f728d5a87522674bcd5515baaa02bf7b9373 Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Fri, 4 Sep 2020 19:24:25 +0800 -Subject: [PATCH 1/5] Define Redfish interface "/Registries/Bios" and enable +Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable Attributes property 1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry @@ -225,33 +225,36 @@ Oem - Resource.Oem No Optional Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 Signed-off-by: Kuiying Wang +Signed-off-by: Snehalatha Venkatesh --- - redfish-core/include/redfish.hpp | 2 + - .../include/registries/bios_registry.hpp | 31 + - redfish-core/lib/bios.hpp | 528 ++++++++++++++++++ - redfish-core/lib/message_registries.hpp | 6 + - 4 files changed, 567 insertions(+) + redfish-core/include/redfish.hpp | 3 + + .../include/registries/bios_registry.hpp | 41 ++ + redfish-core/lib/bios.hpp | 511 ++++++++++++++++++ + redfish-core/lib/message_registries.hpp | 11 +- + 4 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 redfish-core/include/registries/bios_registry.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index c15062d..3388498 100644 +index 0a97150..07a9417 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -152,6 +152,8 @@ class RedfishService +@@ -148,7 +148,10 @@ class RedfishService requestRoutesSystemActionsReset(app); requestRoutesSystemResetActionInfo(app); requestRoutesBiosService(app); + requestRoutesBiosSettings(app); + requestRoutesBiosAttributeRegistry(app); requestRoutesBiosReset(app); ++ requestRoutesBiosChangePassword(app); #ifdef BMCWEB_ENABLE_VM_NBDPROXY + requestNBDVirtualMediaRoutes(app); diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp new file mode 100644 -index 0000000..88ef782 +index 0000000..c80937a --- /dev/null +++ b/redfish-core/include/registries/bios_registry.hpp -@@ -0,0 +1,31 @@ +@@ -0,0 +1,41 @@ +/* +// Copyright (c) 2020 Intel Corporation +// @@ -268,6 +271,7 @@ index 0000000..88ef782 +// limitations under the License. +*/ +#pragma once ++#include + +namespace redfish::message_registries::bios +{ @@ -282,10 +286,18 @@ index 0000000..88ef782 + "1.0.0", + "OpenBMC", +}; ++// BiosAttributeRegistry registry is not defined in DMTF, We should use ++// OEM defined registries for this purpose. ++// Below link is wrong - We need to define OEM registries and use ++// appropriate data here. ++constexpr const char* url = ++ "https://redfish.dmtf.org/registries/BiosAttributeRegistry.1.0.0.json"; ++ ++constexpr std::array registry = { ++}; +} // namespace redfish::message_registries::bios -\ No newline at end of file diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 604b8e7..c1a5c56 100644 +index c2fb284..87536d6 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -3,8 +3,140 @@ @@ -429,109 +441,96 @@ index 604b8e7..c1a5c56 100644 /** * BiosService class supports handle get method for bios. */ -@@ -29,8 +161,404 @@ inline void requestRoutesBiosService(App& app) - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation( - asyncResp, fw_util::biosPurpose, "", true); -+ asyncResp->res.jsonValue["@Redfish.Settings"] = { -+ {"@odata.type", "#Settings.v1_3_0.Settings"}, -+ {"SettingsObject", -+ {{"@odata.id", -+ "/redfish/v1/Systems/system/Bios/Settings"}}}}; -+ asyncResp->res.jsonValue["AttributeRegistry"] = -+ "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["Attributes"] = {}; +@@ -23,6 +155,85 @@ inline void + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "", + true); + -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) ++ asyncResp->res.jsonValue["@Redfish.Settings"] = { ++ {"@odata.type", "#Settings.v1_3_0.Settings"}, ++ {"SettingsObject", ++ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}}; ++ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["Attributes"] = {}; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ ++ return; ++ } ++ const std::string& service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp]( ++ const boost::system::error_code ec, ++ const std::variant& retBiosTable) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if(&retBiosTable); ++ nlohmann::json& attributesJson = ++ asyncResp->res.jsonValue["Attributes"]; ++ if (baseBiosTable == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const BiosBaseTableItemType& item : *baseBiosTable) ++ { ++ const std::string& key = item.first; ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = mapAttrTypeToRedfish(itemType); ++ if (attrType == "String") + { -+ BMCWEB_LOG_ERROR -+ << "ObjectMapper::GetObject call failed: " -+ << ec; ++ const std::string* currValue = ++ std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : ""); ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : 0); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Unsupported attribute type."; + messages::internalError(asyncResp->res); -+ -+ return; + } -+ const std::string& service = -+ getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const std::variant& -+ retBiosTable) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR -+ << "getBiosAttributes DBUS error: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if( -+ &retBiosTable); -+ nlohmann::json& attributesJson = -+ asyncResp->res.jsonValue["Attributes"]; -+ if (baseBiosTable == nullptr) -+ { -+ BMCWEB_LOG_ERROR -+ << "baseBiosTable == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const BiosBaseTableItemType& item : -+ *baseBiosTable) -+ { -+ const std::string& key = item.first; -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr -+ ? *currValue -+ : ""); -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr -+ ? *currValue -+ : 0); -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ } -+ } -+ }, -+ service, "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.BIOSConfig.Manager", -+ "BaseBIOSTable"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); - }); ++ } ++ }, ++ service, "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); } -+ + inline void requestRoutesBiosService(App& app) + { +@@ -31,6 +242,306 @@ inline void requestRoutesBiosService(App& app) + .methods(boost::beast::http::verb::get)(handleBiosServiceGet); + } + +/** + * BiosSettings class supports handle GET/PATCH method for + * BIOS configuration pending settings. @@ -831,11 +830,12 @@ index 604b8e7..c1a5c56 100644 + std::array()); + }); +} ++ /** * BiosReset class supports handle POST method for Reset bios. * The class retrieves and sends data directly to D-Bus. diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index e3bd5bf..f1f130a 100644 +index 43359e3..b2fb43c 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -17,6 +17,7 @@ @@ -846,18 +846,30 @@ index e3bd5bf..f1f130a 100644 #include "registries/openbmc_message_registry.hpp" #include "registries/resource_event_message_registry.hpp" #include "registries/task_event_message_registry.hpp" -@@ -87,6 +88,11 @@ inline void requestRoutesMessageRegistryFile(App& app) - header = &message_registries::resource_event::header; - url = message_registries::resource_event::url; - } -+ else if (registry == "BiosAttributeRegistry") -+ { -+ header = &message_registries::bios::header; -+ dmtf.clear(); -+ } - else - { - messages::resourceNotFound( +@@ -125,7 +126,6 @@ inline void requestRoutesMessageRegistryFile(App& app) + inline void handleMessageRegistryGet( + const crow::Request&, const std::shared_ptr& asyncResp, + const std::string& registry, const std::string& registryMatch) +- + { + const message_registries::Header* header; + std::vector registryEntries; +@@ -165,6 +165,15 @@ inline void handleMessageRegistryGet( + registryEntries.emplace_back(&entry); + } + } ++ else if (registry == "BiosAttributeRegistry") ++ { ++ header = &message_registries::bios::header; ++ for (const message_registries::MessageEntry& entry : ++ message_registries::bios::registry) ++ { ++ registryEntries.emplace_back(&entry); ++ } ++ } + else + { + messages::resourceNotFound( -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch index a5c55afd1..5ed92cc3e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch @@ -1,6 +1,6 @@ -From 415b5079ff45c1dabad15e0f751001a6265412e4 Mon Sep 17 00:00:00 2001 +From b7adca60dd69ac9566dc8f417065e244198fc711 Mon Sep 17 00:00:00 2001 From: AppaRao Puli -Date: Fri, 27 Aug 2021 13:02:20 +0000 +Date: Wed, 6 Oct 2021 22:27:20 +0000 Subject: [PATCH] Add support to ResetBios action Tested: @@ -10,44 +10,44 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios Change-Id: Ic719c55705e5f634539b3dd858b60922e505a8d0 Signed-off-by: Kuiying Wang +Signed-off-by: AppaRao Puli + Signed-off-by: AppaRao Puli --- - redfish-core/lib/bios.hpp | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) + redfish-core/lib/bios.hpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 85ccaaa..360a749 100644 +index f5aa7b7..f613613 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -737,18 +737,24 @@ inline void requestRoutesBiosReset(App& app) - .methods(boost::beast::http::verb::post)( - [](const crow::Request&, - const std::shared_ptr& asyncResp) { -+ std::string resetFlag = "xyz.openbmc_project.BIOSConfig." -+ "Manager.ResetFlag.FactoryDefaults"; +@@ -648,17 +648,23 @@ inline void + handleBiosResetPost(const crow::Request&, + const std::shared_ptr& asyncResp) + { ++ std::string resetFlag = ++ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"; + - crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; -+ BMCWEB_LOG_ERROR << "doPost bios reset got error " -+ << ec; - messages::internalError(asyncResp->res); - return; - } - }, -- "org.open_power.Software.Host.Updater", -- "/xyz/openbmc_project/software", -- "xyz.openbmc_project.Common.FactoryReset", "Reset"); -+ "xyz.openbmc_project.BIOSConfigManager", -+ "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.BIOSConfig.Manager", -+ "ResetBIOSSettings", std::variant(resetFlag)); - }); + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) + { +- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; ++ BMCWEB_LOG_ERROR << "doPost bios reset got error " << ec; + messages::internalError(asyncResp->res); + return; + } + }, +- "org.open_power.Software.Host.Updater", "/xyz/openbmc_project/software", +- "xyz.openbmc_project.Common.FactoryReset", "Reset"); ++ "xyz.openbmc_project.BIOSConfigManager", ++ "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.BIOSConfig.Manager", "ResetBIOSSettings", ++ std::variant(resetFlag)); } - } // namespace redfish + + inline void requestRoutesBiosReset(App& app) -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch index 9a2fada9e..4bfca3006 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch @@ -1,7 +1,7 @@ -From 34f8680b21a134e2133bdcf41e1e83e4b4a05d28 Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny -Date: Wed, 30 Jun 2021 15:37:47 +0000 -Subject: [PATCH 4/5] Add support to ChangePassword action +From 22956921a228f6f1cbbbd3045a3cc3969732dca3 Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Fri, 8 Oct 2021 20:56:00 +0000 +Subject: [PATCH] Add support to ChangePassword action Tested: @@ -29,28 +29,29 @@ root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData "UserName": "Administrator" } -Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 +Signed-off-by: Arun Lal K M Signed-off-by: Kuiying Wang --- - redfish-core/lib/bios.hpp | 58 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 58 insertions(+) + redfish-core/lib/bios.hpp | 59 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 59 insertions(+) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 49c0fd0..0250c59 100644 +index f613613..b06a904 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -180,6 +180,9 @@ inline void requestRoutesBiosService(App& app) - asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { - {"target", - "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; -+ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { -+ {"target", "/redfish/v1/Systems/system/Bios/Actions/" -+ "Bios.ChangePassword"}}; +@@ -175,6 +175,10 @@ inline void + asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { + {"target", "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation( -@@ -283,6 +286,61 @@ inline void requestRoutesBiosService(App& app) - }); ++ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { ++ {"target", "/redfish/v1/Systems/system/Bios/Actions/" ++ "Bios.ChangePassword"}}; ++ + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "", + true); +@@ -265,6 +269,61 @@ inline void requestRoutesBiosService(App& app) + .methods(boost::beast::http::verb::get)(handleBiosServiceGet); } +/** diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch index 0e4fc4903..2e72a639d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch @@ -1,6 +1,6 @@ -From 9814f83f36afafffa55bd19481654c064840e73d Mon Sep 17 00:00:00 2001 +From f75beb0472a42d5af512661470aadf12ac460470 Mon Sep 17 00:00:00 2001 From: Arun Lal K M -Date: Mon, 16 Aug 2021 17:49:11 +0000 +Date: Fri, 8 Oct 2021 21:30:33 +0000 Subject: [PATCH] Add fix for broken feature 'Pending Attributes'. Fix is added for the following: @@ -8,6 +8,8 @@ Fix is added for the following: 2) PATCH to 'redfish/v1/Systems/system/Bios/Settings'. 3) GET to 'redfish/v1/Systems/system/Bios/Settings'. 4) Fix for incremental duplicate values in BiosAttributeRegistry. +5) POST to '/redfish/v1/Systems/system/Bios/Actions + /Bios.ChangePassword/'. Tested: By giving PATCH to 'redfish/v1/Systems/system/Bios/Settings' @@ -105,6 +107,10 @@ Response: "Name": "Bios Settings Version 1" } +By giving POST to '/redfish/v1/Systems/system/Bios/Actions +/Bios.ChangePassword/' +Response: Success + By running Redfish-Service-Validator Result: Elapsed time: 0:09:36 @@ -124,14 +130,14 @@ warnDeprecated: 230 warningPresent: 54 Validation has succeeded. -Change-Id: Ib92eb7a1b81bef5adaf432b9225a183d7a78ebef Signed-off-by: Arun Lal K M +Signed-off-by: Snehalatha Venkatesh --- - redfish-core/lib/bios.hpp | 583 ++++++++++++++++++++++++-------------- - 1 file changed, 374 insertions(+), 209 deletions(-) + redfish-core/lib/bios.hpp | 586 ++++++++++++++++++++++++-------------- + 1 file changed, 376 insertions(+), 210 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 360a749..a927772 100644 +index 0bb0b9e..de79be2 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -12,13 +12,15 @@ map{attributeName,struct{attributeType,readonlyStatus,displayname, @@ -249,49 +255,52 @@ index 360a749..a927772 100644 static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) { std::string ret; -@@ -208,6 +170,15 @@ inline void requestRoutesBiosService(App& app) +@@ -201,6 +163,15 @@ inline void - return; - } + return; + } + -+ if (getObjectType.empty()) -+ { -+ BMCWEB_LOG_ERROR << "getObjectType is empty."; -+ messages::internalError(asyncResp->res); ++ if (getObjectType.empty()) ++ { ++ BMCWEB_LOG_ERROR << "getObjectType is empty."; ++ messages::internalError(asyncResp->res); + -+ return; -+ } ++ return; ++ } + - const std::string& service = - getObjectType.begin()->first; + const std::string& service = getObjectType.begin()->first; -@@ -231,7 +202,7 @@ inline void requestRoutesBiosService(App& app) - if (baseBiosTable == nullptr) - { - BMCWEB_LOG_ERROR -- << "baseBiosTable == nullptr "; -+ << "baseBiosTable is empty"; - messages::internalError(asyncResp->res); - return; - } -@@ -269,7 +240,6 @@ inline void requestRoutesBiosService(App& app) - { - BMCWEB_LOG_ERROR - << "Unsupported attribute type."; -- messages::internalError(asyncResp->res); - } - } - }, -@@ -293,7 +263,7 @@ inline void requestRoutesBiosService(App& app) + crow::connections::systemBus->async_method_call( +@@ -220,7 +191,7 @@ inline void + asyncResp->res.jsonValue["Attributes"]; + if (baseBiosTable == nullptr) + { +- BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ BMCWEB_LOG_ERROR << "baseBiosTable is empty"; + messages::internalError(asyncResp->res); + return; + } +@@ -248,7 +219,6 @@ inline void + else + { + BMCWEB_LOG_ERROR << "Unsupported attribute type."; +- messages::internalError(asyncResp->res); + } + } + }, +@@ -275,8 +245,9 @@ inline void requestRoutesBiosService(App& app) + */ inline void requestRoutesBiosChangePassword(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/") +- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/") - .privileges({{"ConfigureComponents"}}) ++ BMCWEB_ROUTE(app, ++ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") + .privileges(redfish::privileges::postBios) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr& asyncResp) { -@@ -359,180 +329,298 @@ inline void requestRoutesBiosSettings(App& app) +@@ -342,180 +313,298 @@ inline void requestRoutesBiosSettings(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings") .privileges(redfish::privileges::getBios) @@ -341,9 +350,7 @@ index 360a749..a927772 100644 - return; - } - std::string service = getObjectType.begin()->first; -+ return; -+ } - +- - crow::connections::systemBus->async_method_call( - [asyncResp]( - const boost::system::error_code ec, @@ -372,6 +379,9 @@ index 360a749..a927772 100644 - } - for (const PendingAttributesItemType& item : - *pendingAttributes) ++ return; ++ } ++ + if (getObjectType.empty()) + { + BMCWEB_LOG_ERROR << "getObjectType is empty."; @@ -525,32 +535,24 @@ index 360a749..a927772 100644 - [](const crow::Request& req, - const std::shared_ptr& asyncResp) { - nlohmann::json inpJson; -- -- if (!redfish::json_util::readJson(req, asyncResp->res, "data", -- inpJson)) -- { -- return; -- } + .privileges(redfish::privileges::patchBios) + .methods( + boost::beast::http::verb:: + patch)([](const crow::Request& req, + const std::shared_ptr& asyncResp) { + nlohmann::json inpJson; -+ + +- if (!redfish::json_util::readJson(req, asyncResp->res, "data", +- inpJson)) +- { +- return; +- } + if (!redfish::json_util::readJson(req, asyncResp->res, "data", + inpJson)) + { + BMCWEB_LOG_ERROR << "No 'data' in req!"; + return; + } -+ -+ if (inpJson.empty()) -+ { -+ messages::invalidObject(asyncResp->res, "data"); -+ BMCWEB_LOG_ERROR << "No input in req!"; -+ return; -+ } - for (auto& attrInfo : inpJson) - { @@ -573,6 +575,13 @@ index 360a749..a927772 100644 - } - if (!json_util::getValueFromJsonObject( - attrInfo, "AttributeValue", attrValue)) ++ if (inpJson.empty()) ++ { ++ messages::invalidObject(asyncResp->res, "data"); ++ BMCWEB_LOG_ERROR << "No input in req!"; ++ return; ++ } ++ + crow::connections::systemBus->async_method_call( + [asyncResp, inpJson](const boost::system::error_code ec, + const GetObjectType& getObjectType) { @@ -616,9 +625,9 @@ index 360a749..a927772 100644 BMCWEB_LOG_ERROR - << "doPatch resp_handler got error " << ec; + << "getBiosAttributes DBUS error: " << ec; - messages::internalError(asyncResp->res); - return; - } ++ messages::internalError(asyncResp->res); ++ return; ++ } + + const BiosBaseTableType* baseBiosTable = + std::get_if(&retBiosTable); @@ -626,9 +635,9 @@ index 360a749..a927772 100644 + if (baseBiosTable == nullptr) + { + BMCWEB_LOG_ERROR << "baseBiosTable is empty."; -+ messages::internalError(asyncResp->res); -+ return; -+ } + messages::internalError(asyncResp->res); + return; + } + + PendingAttributesType pendingAttributes{}; + @@ -732,7 +741,7 @@ index 360a749..a927772 100644 } /** * BiosAttributeRegistry class supports handle get method for BIOS attribute -@@ -572,6 +660,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -555,6 +644,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) return; } @@ -748,7 +757,7 @@ index 360a749..a927772 100644 std::string service = getObjectType.begin()->first; crow::connections::systemBus->async_method_call( -@@ -592,8 +689,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -575,8 +673,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) nlohmann::json& attributeArray = asyncResp->res .jsonValue["RegistryEntries"]["Attributes"]; @@ -757,7 +766,7 @@ index 360a749..a927772 100644 if (baseBiosTable == nullptr) { BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -@@ -609,10 +704,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -592,10 +688,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) mapAttrTypeToRedfish(itemType); if (attrType == "UNKNOWN") { @@ -772,7 +781,7 @@ index 360a749..a927772 100644 nlohmann::json attributeItem; attributeItem["AttributeName"] = item.first; attributeItem["Type"] = attrType; -@@ -632,10 +728,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -615,10 +712,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( item.second)); @@ -803,7 +812,7 @@ index 360a749..a927772 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : ""; attributeItem["DefaultValue"] = -@@ -647,10 +763,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -630,10 +747,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( item.second)); @@ -834,7 +843,7 @@ index 360a749..a927772 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : 0; attributeItem["DefaultValue"] = -@@ -658,12 +794,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -641,12 +778,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) } else { @@ -852,7 +861,7 @@ index 360a749..a927772 100644 const std::vector& optionsVector = std::get(item.second); -@@ -678,9 +815,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -661,9 +799,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) if (optItemTypeRedfish == "UNKNOWN") { BMCWEB_LOG_ERROR @@ -865,7 +874,7 @@ index 360a749..a927772 100644 } if (optItemTypeRedfish == "OneOf") { -@@ -688,6 +825,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -671,6 +809,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); @@ -883,7 +892,7 @@ index 360a749..a927772 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : ""; -@@ -698,6 +846,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -681,6 +830,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); @@ -901,7 +910,7 @@ index 360a749..a927772 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : 0; -@@ -706,6 +865,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -689,6 +849,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) optionsArray.push_back(optItemJson); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch new file mode 100644 index 000000000..52135e255 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch @@ -0,0 +1,121 @@ +From 6ff897d2b5513f15445f18aae16d8439ed94f377 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 11 Oct 2021 18:41:27 +0530 +Subject: [PATCH] Add unmerged changes for http retry support + +The http retry support added upstream as a single patch was slpit into +3 patches, but only 2 of them was merged. +This commit pulls in the differentail changes required to complete the +entire http retry support. and also allow for other subsequent patches +to be appplied easily. + +Change-Id: Id8ccd991b7ffc505196b1a92b23e1cd51e00bc89 +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/http_client.hpp | 44 +++++++++++-------- + .../include/event_service_manager.hpp | 2 +- + 2 files changed, 27 insertions(+), 19 deletions(-) + +diff --git a/http/http_client.hpp b/http/http_client.hpp +index ab20eb0..aad1cce 100644 +--- a/http/http_client.hpp ++++ b/http/http_client.hpp +@@ -68,7 +68,6 @@ class HttpClient : public std::enable_shared_from_this + std::optional< + boost::beast::http::response_parser> + parser; +- std::vector> headers; + boost::circular_buffer_space_optimized requestDataQueue{}; + + ConnState state; +@@ -137,18 +136,6 @@ class HttpClient : public std::enable_shared_from_this + + BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; + +- req.version(static_cast(11)); // HTTP 1.1 +- req.target(uri); +- req.method(boost::beast::http::verb::post); +- +- // Set headers +- for (const auto& [key, value] : headers) +- { +- req.set(key, value); +- } +- req.set(boost::beast::http::field::host, host); +- req.keep_alive(true); +- + req.body() = data; + req.prepare_payload(); + +@@ -204,6 +191,17 @@ class HttpClient : public std::enable_shared_from_this + BMCWEB_LOG_DEBUG << "recvMessage() data: " + << self->parser->get(); + ++ // Check if the response and header are received ++ if (!self->parser->is_done()) ++ { ++ // The parser failed to receive the response ++ BMCWEB_LOG_ERROR ++ << "recvMessage() parser failed to receive response"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ + unsigned int respCode = self->parser->get().result_int(); + BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " + << respCode; +@@ -398,11 +396,17 @@ class HttpClient : public std::enable_shared_from_this + const std::string& destIP, const std::string& destPort, + const std::string& destUri) : + conn(ioc), +- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), +- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), ++ timer(ioc), req(boost::beast::http::verb::post, destUri, 11), ++ state(ConnState::initialized), subId(id), host(destIP), port(destPort), ++ uri(destUri), retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), + retryPolicyAction("TerminateAfterRetries"), runningTimer(false) + { +- state = ConnState::initialized; ++ // Set the request header ++ req.set(boost::beast::http::field::host, host); ++ req.set(boost::beast::http::field::content_type, "application/json"); ++ req.keep_alive(true); ++ ++ requestDataQueue.set_capacity(maxRequestQueueSize); + } + + void sendData(const std::string& data) +@@ -425,10 +429,14 @@ class HttpClient : public std::enable_shared_from_this + return; + } + +- void setHeaders( ++ void addHeaders( + const std::vector>& httpHeaders) + { +- headers = httpHeaders; ++ // Set custom headers ++ for (const auto& [key, value] : httpHeaders) ++ { ++ req.set(key, value); ++ } + } + + void setRetryConfig(const uint32_t retryAttempts, +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 8042803..0a63b8c 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -412,7 +412,7 @@ class Subscription : public persistent_data::UserSubscription + reqHeaders.emplace_back(std::pair(key, val)); + } + } +- conn->setHeaders(reqHeaders); ++ conn->addHeaders(reqHeaders); + conn->sendData(msg); + this->eventSeqNum++; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch deleted file mode 100644 index 7a6818008..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch +++ /dev/null @@ -1,546 +0,0 @@ -From f74393a9bca899e353be3d0e2dc5c224539fe432 Mon Sep 17 00:00:00 2001 -From: Sunitha Harish -Date: Fri, 19 Feb 2021 13:38:31 +0530 -Subject: [PATCH] EventService : Fix retry handling for http-client - -When the event send/receive is failed, the bmcweb does not handle -the failure to tear-down the complete connection and start a fresh - -The keep-alive header from the event listener is read to update -the connection states, so that the connection will be kept alive -or closed as per the subscriber's specifications - -Updated the connection state machine to handle retry logic properly. -Avoided multiple simultaneous async calls which crashes the bmcweb. So -added connBusy flag which protects simultaneous async calls. - -Used boost http response parser as parser for producing the response -message. Set the parser skip option to handle the empty response message -from listening server. - -Tested by: - - Subscribe for the events at BMC using DMTF event listener - - Generate an event and see the same is received at the listener's console - - Update the listner to change the keep-alive to true/false and - observe the http-client connection states at bmcweb - - Changed listener client to return non success HTTP status code - and observed retry logic gets trigrred in http-client. - - Gave wrong fqdn and observed async resolve failure and retry logc. - - Stopped listener after connect and verified timeouts on http-client - side. - -Change-Id: Ibb45691f139916ba2954da37beda9d4f91c7cef3 -Signed-off-by: Sunitha Harish -Signed-off-by: AppaRao Puli ---- - http/http_client.hpp | 288 ++++++++++-------- - .../include/event_service_manager.hpp | 2 +- - 2 files changed, 162 insertions(+), 128 deletions(-) - -diff --git a/http/http_client.hpp b/http/http_client.hpp -index 992ac2b..feabbba 100644 ---- a/http/http_client.hpp -+++ b/http/http_client.hpp -@@ -34,22 +34,28 @@ namespace crow - { - - static constexpr uint8_t maxRequestQueueSize = 50; -+static constexpr unsigned int httpReadBodyLimit = 8192; - - enum class ConnState - { - initialized, - resolveInProgress, - resolveFailed, -+ resolved, - connectInProgress, - connectFailed, - connected, - sendInProgress, - sendFailed, -+ recvInProgress, - recvFailed, - idle, -- suspended, -+ closeInProgress, - closed, -- terminated -+ suspended, -+ terminated, -+ abortConnection, -+ retry - }; - - class HttpClient : public std::enable_shared_from_this -@@ -58,11 +64,13 @@ class HttpClient : public std::enable_shared_from_this - crow::async_resolve::Resolver resolver; - boost::beast::tcp_stream conn; - boost::asio::steady_timer timer; -- boost::beast::flat_buffer buffer; -+ boost::beast::flat_static_buffer buffer; - boost::beast::http::request req; -- boost::beast::http::response res; -- std::vector> headers; -- std::queue requestDataQueue; -+ std::optional< -+ boost::beast::http::response_parser> -+ parser; -+ boost::circular_buffer_space_optimized requestDataQueue{}; -+ std::vector endPoints; - ConnState state; - std::string subId; - std::string host; -@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this - - void doResolve() - { -- if (state == ConnState::resolveInProgress) -- { -- return; -- } - state = ConnState::resolveInProgress; -- - BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; - - auto respHandler = -@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this - const boost::beast::error_code ec, - const std::vector& - endpointList) { -- if (ec) -+ if (ec || (endpointList.size() == 0)) - { - BMCWEB_LOG_ERROR << "Resolve failed: " << ec.message(); - self->state = ConnState::resolveFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "Resolved"; -- self->doConnect(endpointList); -+ self->endPoints.assign(endpointList.begin(), -+ endpointList.end()); -+ self->state = ConnState::resolved; -+ self->handleConnState(); - }; - resolver.asyncResolve(host, port, std::move(respHandler)); - } - -- void doConnect( -- const std::vector& endpointList) -+ void doConnect() - { -- if (state == ConnState::connectInProgress) -- { -- return; -- } - state = ConnState::connectInProgress; - - BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; - - conn.expires_after(std::chrono::seconds(30)); - conn.async_connect( -- endpointList, [self(shared_from_this())]( -- const boost::beast::error_code ec, -- const boost::asio::ip::tcp::endpoint& endpoint) { -+ endPoints, [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const boost::asio::ip::tcp::endpoint& endpoint) { - if (ec) - { - BMCWEB_LOG_ERROR << "Connect " << endpoint - << " failed: " << ec.message(); - self->state = ConnState::connectFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } -- self->state = ConnState::connected; - BMCWEB_LOG_DEBUG << "Connected to: " << endpoint; -- -- self->checkQueue(); -+ self->state = ConnState::connected; -+ self->handleConnState(); - }); - } - - void sendMessage(const std::string& data) - { -- if (state == ConnState::sendInProgress) -- { -- return; -- } - state = ConnState::sendInProgress; - - BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; - -- req.version(static_cast(11)); // HTTP 1.1 -- req.target(uri); -- req.method(boost::beast::http::verb::post); -- -- // Set headers -- for (const auto& [key, value] : headers) -- { -- req.set(key, value); -- } -- req.set(boost::beast::http::field::host, host); -- req.keep_alive(true); -- - req.body() = data; - req.prepare_payload(); - -- // Set a timeout on the operation -- conn.expires_after(std::chrono::seconds(30)); -- - // Send the HTTP request to the remote host - boost::beast::http::async_write( - conn, req, -@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this - BMCWEB_LOG_ERROR << "sendMessage() failed: " - << ec.message(); - self->state = ConnState::sendFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this - - void recvMessage() - { -+ state = ConnState::recvInProgress; -+ -+ parser.emplace(std::piecewise_construct, std::make_tuple()); -+ parser->body_limit(httpReadBodyLimit); -+ -+ // Check only for the response header -+ parser->skip(true); -+ - // Receive the HTTP response - boost::beast::http::async_read( -- conn, buffer, res, -+ conn, buffer, *parser, - [self(shared_from_this())](const boost::beast::error_code& ec, - const std::size_t& bytesTransferred) { - if (ec) -@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this - BMCWEB_LOG_ERROR << "recvMessage() failed: " - << ec.message(); - self->state = ConnState::recvFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " - << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -- -- // Discard received data. We are not interested. -- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " -+ << self->parser->get(); - - // Send is successful, Lets remove data from queue - // check for next request data in queue. -- self->requestDataQueue.pop(); -+ if (!self->requestDataQueue.empty()) -+ { -+ self->requestDataQueue.pop_front(); -+ } - self->state = ConnState::idle; -- self->checkQueue(); -+ -+ // Keep the connection alive if server supports it -+ // Else close the connection -+ BMCWEB_LOG_DEBUG << "recvMessage() keepalive : " -+ << self->parser->keep_alive(); -+ if (!self->parser->keep_alive()) -+ { -+ // Abort the connection since server is not keep-alive -+ // enabled -+ self->state = ConnState::abortConnection; -+ } -+ -+ // Returns ownership of the parsed message -+ self->parser->release(); -+ -+ self->handleConnState(); - }); - } - - void doClose() - { -+ state = ConnState::closeInProgress; - boost::beast::error_code ec; - conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -+ conn.close(); - -- state = ConnState::closed; - // not_connected happens sometimes so don't bother reporting it. - if (ec && ec != boost::beast::errc::not_connected) - { -@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this - return; - } - BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -- } -- -- void checkQueue(const bool newRecord = false) -- { -- if (requestDataQueue.empty()) -+ if ((state != ConnState::suspended) && (state != ConnState::terminated)) - { -- // TODO: Having issue in keeping connection alive. So lets close if -- // nothing to be transferred. -- doClose(); -- -- BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; -- return; -+ state = ConnState::closed; -+ handleConnState(); - } -+ } - -+ void waitAndRetry() -+ { - if (retryCount >= maxRetryAttempts) - { -- BMCWEB_LOG_ERROR << "Maximum number of retries is reached."; -+ BMCWEB_LOG_ERROR << "Maximum number of retries reached."; - - // Clear queue. - while (!requestDataQueue.empty()) - { -- requestDataQueue.pop(); -+ requestDataQueue.pop_front(); - } - -- BMCWEB_LOG_DEBUG << "Retry policy is set to " << retryPolicyAction; -+ BMCWEB_LOG_DEBUG << "Retry policy: " << retryPolicyAction; - if (retryPolicyAction == "TerminateAfterRetries") - { - // TODO: delete subscription - state = ConnState::terminated; -- return; - } - if (retryPolicyAction == "SuspendRetries") - { - state = ConnState::suspended; -- return; - } -- // keep retrying, reset count and continue. -+ // Reset the retrycount to zero so that client can try connecting -+ // again if needed - retryCount = 0; -+ handleConnState(); -+ return; - } - -- if ((state == ConnState::connectFailed) || -- (state == ConnState::sendFailed) || -- (state == ConnState::recvFailed)) -+ if (runningTimer) - { -- if (newRecord) -- { -- // We are already running async wait and retry. -- // Since record is added to queue, it gets the -- // turn in FIFO. -- return; -- } -- -- if (runningTimer) -- { -- BMCWEB_LOG_DEBUG << "Retry timer is already running."; -- return; -- } -- runningTimer = true; -- -- retryCount++; -- -- BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs -- << " seconds. RetryCount = " << retryCount; -- timer.expires_after(std::chrono::seconds(retryIntervalSecs)); -- timer.async_wait( -- [self = shared_from_this()](const boost::system::error_code&) { -- self->runningTimer = false; -- self->connStateCheck(); -- }); -+ BMCWEB_LOG_DEBUG << "Retry timer is already running."; - return; - } -- // reset retry count. -- retryCount = 0; -- connStateCheck(); -+ runningTimer = true; -+ -+ retryCount++; -+ -+ BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs -+ << " seconds. RetryCount = " << retryCount; -+ timer.expires_after(std::chrono::seconds(retryIntervalSecs)); -+ timer.async_wait( -+ [self = shared_from_this()](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "async_wait failed: " << ec.message(); -+ // Ignore the error and continue the retry loop to attempt -+ // sending the event as per the retry policy -+ } -+ self->runningTimer = false; - -+ // Lets close connection and start from resolve. -+ self->doClose(); -+ }); - return; - } - -- void connStateCheck() -+ void handleConnState() - { - switch (state) - { - case ConnState::resolveInProgress: - case ConnState::connectInProgress: - case ConnState::sendInProgress: -- case ConnState::suspended: -- case ConnState::terminated: -- // do nothing -+ case ConnState::recvInProgress: -+ case ConnState::closeInProgress: -+ { -+ BMCWEB_LOG_DEBUG << "Async operation is already in progress"; - break; -+ } - case ConnState::initialized: - case ConnState::closed: -+ { -+ if (requestDataQueue.empty()) -+ { -+ BMCWEB_LOG_DEBUG << "requestDataQueue is empty"; -+ return; -+ } -+ doResolve(); -+ break; -+ } -+ case ConnState::resolved: -+ { -+ doConnect(); -+ break; -+ } -+ case ConnState::suspended: -+ case ConnState::terminated: -+ { -+ doClose(); -+ break; -+ } -+ case ConnState::resolveFailed: - case ConnState::connectFailed: - case ConnState::sendFailed: - case ConnState::recvFailed: -- case ConnState::resolveFailed: -+ case ConnState::retry: - { -- doResolve(); -+ // In case of failures during connect and handshake -+ // the retry policy will be applied -+ waitAndRetry(); - break; - } - case ConnState::connected: - case ConnState::idle: - { -+ // State idle means, previous attempt is successful -+ // State connected means, client connection is established -+ // successfully -+ if (requestDataQueue.empty()) -+ { -+ BMCWEB_LOG_DEBUG << "requestDataQueue is empty"; -+ return; -+ } - std::string data = requestDataQueue.front(); - sendMessage(data); - break; - } -+ case ConnState::abortConnection: -+ { -+ // Server did not want to keep alive the session -+ doClose(); -+ break; -+ } -+ default: -+ break; - } - } - -@@ -339,37 +372,38 @@ class HttpClient : public std::enable_shared_from_this - const std::string& destIP, const std::string& destPort, - const std::string& destUri) : - conn(ioc), -- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), -- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), -+ timer(ioc), req(boost::beast::http::verb::post, destUri, 11), -+ state(ConnState::initialized), subId(id), host(destIP), port(destPort), -+ uri(destUri), retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), - retryPolicyAction("TerminateAfterRetries"), runningTimer(false) - { -- state = ConnState::initialized; -+ // Set the request header -+ req.set(boost::beast::http::field::host, host); -+ req.set(boost::beast::http::field::content_type, "application/json"); -+ req.keep_alive(true); -+ -+ requestDataQueue.set_capacity(maxRequestQueueSize); - } - - void sendData(const std::string& data) - { -- if (state == ConnState::suspended) -+ if ((state == ConnState::suspended) || (state == ConnState::terminated)) - { - return; - } -- -- if (requestDataQueue.size() <= maxRequestQueueSize) -- { -- requestDataQueue.push(data); -- checkQueue(true); -- } -- else -- { -- BMCWEB_LOG_ERROR << "Request queue is full. So ignoring data."; -- } -- -+ requestDataQueue.push_back(data); -+ handleConnState(); - return; - } - -- void setHeaders( -+ void addHeaders( - const std::vector>& httpHeaders) - { -- headers = httpHeaders; -+ // Set custom headers -+ for (const auto& [key, value] : httpHeaders) -+ { -+ req.set(key, value); -+ } - } - - void setRetryConfig(const uint32_t retryAttempts, -diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 11190ef..a8f7517 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -422,7 +422,7 @@ class Subscription - reqHeaders.emplace_back(std::pair(key, val)); - } - } -- conn->setHeaders(reqHeaders); -+ conn->addHeaders(reqHeaders); - conn->sendData(msg); - this->eventSeqNum++; - } --- -2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch index eef0ff065..aeeafc421 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch @@ -1,28 +1,27 @@ -From 4df4a36d6d2cc11c51cc9d53cd441178cc97e39b Mon Sep 17 00:00:00 2001 +From 3f2ad28e6e124249cde3df50c9e18c283fbcbf3e Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Mon, 22 Feb 2021 17:07:47 +0000 Subject: [PATCH] EventService: https client support -Add https client support for push style -eventing. Using this BMC can push the event -logs/telemetry data to event listener over -secure http channel. +Add https client support for push style eventing. Using this BMC can +push the event logs/telemetry data to event listener over secure http +channel. Tested: - - Created subscription with https destination - url. Using SubmitTestEvent action set the - event and can see event on event listener. + - Created subscription with https destination url. Using + SubmitTestEvent action set the event and can see event on event + listener. - Validator passed. Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli --- - http/http_client.hpp | 257 ++++++++++++------ + http/http_client.hpp | 307 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 176 insertions(+), 83 deletions(-) + 2 files changed, 202 insertions(+), 107 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index feabbba..aaf1b2d 100644 +index aad1cce..5e7ff47 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -33,8 +32,8 @@ index feabbba..aaf1b2d 100644 #include #include -@@ -44,6 +45,8 @@ enum class ConnState - resolved, +@@ -43,6 +44,8 @@ enum class ConnState + resolveFailed, connectInProgress, connectFailed, + handshakeInProgress, @@ -42,7 +41,7 @@ index feabbba..aaf1b2d 100644 connected, sendInProgress, sendFailed, -@@ -62,7 +65,9 @@ class HttpClient : public std::enable_shared_from_this +@@ -61,7 +64,9 @@ class HttpClient : public std::enable_shared_from_this { private: crow::async_resolve::Resolver resolver; @@ -52,8 +51,8 @@ index feabbba..aaf1b2d 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer buffer; boost::beast::http::request req; -@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this - void doConnect() +@@ -108,23 +113,52 @@ class HttpClient : public std::enable_shared_from_this + const std::vector& endpointList) { state = ConnState::connectInProgress; + sslConn.emplace(conn, ctx); @@ -83,10 +82,10 @@ index feabbba..aaf1b2d 100644 + }; conn.expires_after(std::chrono::seconds(30)); - conn.async_connect( -- endPoints, [self(shared_from_this())]( -- const boost::beast::error_code ec, -- const boost::asio::ip::tcp::endpoint& endpoint) { -+ conn.async_connect(endPoints, std::move(respHandler)); +- endpointList, [self(shared_from_this())]( +- const boost::beast::error_code ec, +- const boost::asio::ip::tcp::endpoint& endpoint) { ++ conn.async_connect(endpointList, std::move(respHandler)); + } + + void performHandshake() @@ -113,7 +112,7 @@ index feabbba..aaf1b2d 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this +@@ -132,132 +166,187 @@ class HttpClient : public std::enable_shared_from_this void sendMessage(const std::string& data) { @@ -125,6 +124,19 @@ index feabbba..aaf1b2d 100644 req.body() = data; req.prepare_payload(); +- // Set a timeout on the operation +- conn.expires_after(std::chrono::seconds(30)); ++ auto respHandler = [self(shared_from_this())]( ++ const boost::beast::error_code ec, ++ const std::size_t& bytesTransferred) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); ++ self->state = ConnState::sendFailed; ++ self->handleConnState(); ++ return; ++ } + - // Send the HTTP request to the remote host - boost::beast::http::async_write( - conn, req, @@ -141,26 +153,15 @@ index feabbba..aaf1b2d 100644 - BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " - << bytesTransferred; - boost::ignore_unused(bytesTransferred); -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); -+ self->state = ConnState::sendFailed; -+ self->handleConnState(); -+ return; -+ } - -- self->recvMessage(); -- }); -- } + BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); + self->recvMessage(); + }; +- self->recvMessage(); +- }); ++ // Set a timeout on the operation + conn.expires_after(std::chrono::seconds(30)); + if (sslConn) + { @@ -171,7 +172,8 @@ index feabbba..aaf1b2d 100644 + { + boost::beast::http::async_write(conn, req, std::move(respHandler)); + } -+ } + } +- void recvMessage() { state = ConnState::recvInProgress; @@ -191,6 +193,33 @@ index feabbba..aaf1b2d 100644 + BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); ++ ++ // Check if the response and header are received ++ if (!self->parser->is_done()) ++ { ++ // The parser failed to receive the response ++ BMCWEB_LOG_ERROR ++ << "recvMessage() parser failed to receive response"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ ++ unsigned int respCode = self->parser->get().result_int(); ++ BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " ++ << respCode; ++ ++ // 2XX response is considered to be successful ++ if ((respCode < 200) || (respCode >= 300)) ++ { ++ // The listener failed to receive the Sent-Event ++ BMCWEB_LOG_ERROR << "recvMessage() Listener Failed to " ++ "receive Sent-Event"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ + // Send is successful, Lets remove data from queue + // check for next request data in queue. + if (!self->requestDataQueue.empty()) @@ -271,34 +300,56 @@ index feabbba..aaf1b2d 100644 - BMCWEB_LOG_DEBUG << "recvMessage() data: " - << self->parser->get(); - -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- if (!self->requestDataQueue.empty()) +- // Check if the response and header are received +- if (!self->parser->is_done()) + else { -- self->requestDataQueue.pop_front(); +- // The parser failed to receive the response +- BMCWEB_LOG_ERROR +- << "recvMessage() parser failed to receive response"; +- self->state = ConnState::recvFailed; +- self->handleConnState(); +- return; + BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; } -- self->state = ConnState::idle; + self->conn.close(); +- unsigned int respCode = self->parser->get().result_int(); +- BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " +- << respCode; +- +- // 2XX response is considered to be successful +- if ((respCode < 200) || (respCode >= 300)) ++ if ((self->state != ConnState::suspended) && ++ (self->state != ConnState::terminated)) + { +- // The listener failed to receive the Sent-Event +- BMCWEB_LOG_ERROR << "recvMessage() Listener Failed to " +- "receive Sent-Event"; +- self->state = ConnState::recvFailed; ++ self->state = ConnState::closed; + self->handleConnState(); +- return; + } +- +- // Send is successful, Lets remove data from queue +- // check for next request data in queue. +- if (!self->requestDataQueue.empty()) +- { +- self->requestDataQueue.pop_front(); +- } +- self->state = ConnState::idle; +- - // Keep the connection alive if server supports it - // Else close the connection - BMCWEB_LOG_DEBUG << "recvMessage() keepalive : " - << self->parser->keep_alive(); - if (!self->parser->keep_alive()) -+ if ((self->state != ConnState::suspended) && -+ (self->state != ConnState::terminated)) - { +- { - // Abort the connection since server is not keep-alive - // enabled - self->state = ConnState::abortConnection; -+ self->state = ConnState::closed; -+ self->handleConnState(); - } -- -- // Returns ownership of the parsed message -- self->parser->release(); +- } - - self->handleConnState(); }); @@ -345,7 +396,7 @@ index feabbba..aaf1b2d 100644 } } -@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -330,6 +419,7 @@ class HttpClient : public std::enable_shared_from_this { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -353,7 +404,7 @@ index feabbba..aaf1b2d 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -356,6 +446,7 @@ class HttpClient : public std::enable_shared_from_this } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -361,7 +412,7 @@ index feabbba..aaf1b2d 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -370,7 +459,8 @@ class HttpClient : public std::enable_shared_from_this +@@ -394,7 +485,8 @@ class HttpClient : public std::enable_shared_from_this public: explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, const std::string& destIP, const std::string& destPort, @@ -371,7 +422,7 @@ index feabbba..aaf1b2d 100644 conn(ioc), timer(ioc), req(boost::beast::http::verb::post, destUri, 11), state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this +@@ -407,8 +499,11 @@ class HttpClient : public std::enable_shared_from_this req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -385,10 +436,10 @@ index feabbba..aaf1b2d 100644 { if ((state == ConnState::suspended) || (state == ConnState::terminated)) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index a8f7517..d4a5bc5 100644 +index 08d0b98..f1ce0c0 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -397,7 +397,7 @@ class Subscription +@@ -385,7 +385,7 @@ class Subscription : public persistent_data::UserSubscription { conn = std::make_shared( crow::connections::systemBus->get_io_context(), id, host, port, @@ -398,4 +449,5 @@ index a8f7517..d4a5bc5 100644 Subscription(const std::shared_ptr& adaptor) : -- -2.25.1 +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch index da281467e..ea521a7e4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch @@ -1,4 +1,4 @@ -From 54bdd897bd416fef4c043224b398b1b6d47fd271 Mon Sep 17 00:00:00 2001 +From d7a2660f200c38e74bfcbfe55b8da1b8bed08833 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Fri, 12 Mar 2021 18:53:25 +0000 Subject: [PATCH] Add Server-Sent-Events support @@ -21,47 +21,37 @@ Tested: Change-Id: I36956565cbba30c2007852c9471f477f6d1736e9 Signed-off-by: AppaRao Puli +Signed-off-by: P Dheeraj Srujan Kumar --- - http/http_connection.hpp | 14 +- + http/http_connection.hpp | 10 +- http/http_response.hpp | 7 +- http/routing.hpp | 71 ++++++++++ http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 365 insertions(+), 6 deletions(-) + 4 files changed, 362 insertions(+), 5 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index a1a7045..90535c5 100644 +index 8e53afa..a1bbfce 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -331,7 +331,7 @@ class Connection : - BMCWEB_LOG_INFO << "Request: " - << " " << this << " HTTP/" << req->version() / 10 << "." - << req->version() % 10 << ' ' << req->methodString() -- << " " << req->target() << " " << req->ipAddress; -+ << " " << req->url << " " << req->ipAddress; +@@ -378,11 +378,13 @@ class Connection : + [self] { self->completeRequest(); }); + }); - needToCallAfterHandlers = false; - -@@ -350,11 +350,15 @@ class Connection : - boost::asio::post(self->adaptor.get_executor(), - [self] { self->completeRequest(); }); - }); -- if (req->isUpgrade() && -- boost::iequals( -- req->getHeaderValue(boost::beast::http::field::upgrade), -- "websocket")) -+ -+ if ((req->isUpgrade() && -+ boost::iequals(req->getHeaderValue( -+ boost::beast::http::field::upgrade), -+ "websocket")) || -+ (req->url == "/sse")) - { -+ BMCWEB_LOG_DEBUG << "Request: " << this -+ << " is getting upgraded"; - handler->handleUpgrade(*req, res, std::move(adaptor)); - // delete lambda with self shared_ptr - // to enable connection destruction +- if (thisReq.isUpgrade() && +- boost::iequals( +- thisReq.getHeaderValue(boost::beast::http::field::upgrade), +- "websocket")) ++ if ((thisReq.isUpgrade() && ++ boost::iequals( ++ thisReq.getHeaderValue(boost::beast::http::field::upgrade), ++ "websocket")) || ++ (req->url == "/sse")) + { ++ BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; + handler->handleUpgrade(thisReq, res, std::move(adaptor)); + // delete lambda with self shared_ptr + // to enable connection destruction diff --git a/http/http_response.hpp b/http/http_response.hpp index a983d4a..07b0265 100644 --- a/http/http_response.hpp @@ -93,7 +83,7 @@ index a983d4a..07b0265 100644 // In case of a JSON object, set the Content-Type header void jsonMode() diff --git a/http/routing.hpp b/http/routing.hpp -index d2a10b2..25e4ce8 100644 +index 5d9c8e3..bfff107 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -6,6 +6,7 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch index 42a1ebbf0..ee69081ef 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch @@ -1,4 +1,4 @@ -From 36c1391749e19e4a25ca6e57d369457f48e6bb11 Mon Sep 17 00:00:00 2001 +From 799e47842e179f7c752712004f0e96d3219eee11 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 16 Mar 2021 15:37:24 +0000 Subject: [PATCH] Add SSE style subscription support to eventservice @@ -18,33 +18,33 @@ Tested: response. - Ran RedfishValidation and its passed. -Signed-off-by: AppaRao Puli -Signed-off-by: Nitin Wankhade Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de +Signed-off-by: AppaRao Puli +Signed-off-by: P Dheeraj Srujan Kumar --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 111 +++++-- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 290 ------------------ redfish-core/lib/event_service.hpp | 8 +- src/webserver_main.cpp | 2 + - 6 files changed, 165 insertions(+), 323 deletions(-) + 6 files changed, 164 insertions(+), 322 deletions(-) create mode 100644 include/eventservice_sse.hpp delete mode 100644 redfish-core/include/server_sent_events.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 90535c5..37c0a0b 100644 +index a1bbfce..2d08501 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -355,7 +355,7 @@ class Connection : - boost::iequals(req->getHeaderValue( - boost::beast::http::field::upgrade), - "websocket")) || -- (req->url == "/sse")) -+ (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) - { - BMCWEB_LOG_DEBUG << "Request: " << this - << " is getting upgraded"; +@@ -382,7 +382,7 @@ class Connection : + boost::iequals( + thisReq.getHeaderValue(boost::beast::http::field::upgrade), + "websocket")) || +- (req->url == "/sse")) ++ (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) + { + BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; + handler->handleUpgrade(thisReq, res, std::move(adaptor)); diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp new file mode 100644 index 0000000..14daf00 @@ -127,7 +127,7 @@ index 0000000..14daf00 +} // namespace eventservice_sse +} // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index ca46aa7..9397271 100644 +index 3f398d7..dd833ce 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -22,15 +22,17 @@ @@ -217,23 +217,23 @@ index ca46aa7..9397271 100644 ~Subscription() = default; -@@ -412,13 +412,14 @@ class Subscription : public persistent_data::UserSubscription - } - conn->addHeaders(reqHeaders); - conn->sendData(msg); -- this->eventSeqNum++; - } +@@ -417,7 +417,7 @@ class Subscription : public persistent_data::UserSubscription if (sseConn != nullptr) { - sseConn->sendData(eventSeqNum, msg); + sseConn->sendEvent(std::to_string(eventSeqNum), msg); } -+ + } + +@@ -508,6 +508,7 @@ class Subscription : public persistent_data::UserSubscription + + this->sendEvent( + msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + this->eventSeqNum++; } + #endif - void sendTestEventLog() @@ -578,14 +579,39 @@ class Subscription : public persistent_data::UserSubscription return eventSeqNum; } @@ -622,7 +622,7 @@ index 7613d7b..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 67ad014..f8a2dac 100644 +index 8609862..249e594 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -37,8 +37,6 @@ static constexpr const std::array supportedResourceTypes = { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch index 9043bd0b9..3914cc81a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch @@ -1,4 +1,4 @@ -From 22c6b6cfb468f8de9ff3ea051dffdba05778645e Mon Sep 17 00:00:00 2001 +From 769f0e20d0a7e786d7091ffb7ee57d35204dfa28 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Wed, 17 Mar 2021 01:16:50 +0000 Subject: [PATCH] Add EventService SSE filter support @@ -41,7 +41,7 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 5 files changed, 181 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp -index 14daf00..2f22f98 100644 +index 14daf00..fed7fec 100644 --- a/include/eventservice_sse.hpp +++ b/include/eventservice_sse.hpp @@ -23,16 +23,153 @@ static bool createSubscription(std::shared_ptr& conn, @@ -203,7 +203,7 @@ index 14daf00..2f22f98 100644 std::string id = redfish::EventServiceManager::getInstance().addSubscription(subValue, diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp -index 10567d1..f29e326 100644 +index 3d11cc4..90084e3 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -971,6 +971,15 @@ nlohmann::json mutualExclusiveProperties(const std::string& arg1, @@ -223,10 +223,10 @@ index 10567d1..f29e326 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 5886d81..c3e7f61 100644 +index dd833ce..861f4cb 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -56,6 +56,11 @@ static constexpr const char* eventServiceFile = +@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = static constexpr const uint8_t maxNoOfSubscriptions = 20; static constexpr const uint8_t maxNoOfSSESubscriptions = 10; @@ -239,10 +239,10 @@ index 5886d81..c3e7f61 100644 static std::optional inotifyConn; static constexpr const char* redfishEventLogDir = "/var/log"; diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 2e7c3f3..9def549 100644 +index 249e594..6f01707 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -25,11 +25,6 @@ +@@ -21,11 +21,6 @@ namespace redfish { @@ -255,10 +255,10 @@ index 2e7c3f3..9def549 100644 "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 48edaf1..bebb6d8 100644 +index 9c28e8f..2394398 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp -@@ -2174,6 +2174,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, +@@ -2173,6 +2173,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2)); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch index 7fcc235d2..9af5a066b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch @@ -1,6 +1,6 @@ -From adaa5cb4c494148430b90edb248260eb2e66bca7 Mon Sep 17 00:00:00 2001 -From: P Dheeraj Srujan Kumar -Date: Wed, 8 Sep 2021 15:42:52 +0530 +From f665ba085bb2310f008b7534f827fb401ad973c2 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny +Date: Tue, 12 Oct 2021 08:19:51 +0000 Subject: [PATCH] Delete/Remove Terminated Event Subscription(s) Added functionality to delete/remove event subscription(s) which are @@ -23,14 +23,14 @@ Change-Id: If447acb2db74fb29a5d1cfe6194b77cda82bc8a1 Signed-off-by: P Dheeraj Srujan Kumar --- http/http_client.hpp | 43 +++++++++++++++---- - .../include/event_service_manager.hpp | 37 ++++++++++++++++ - 2 files changed, 71 insertions(+), 9 deletions(-) + .../include/event_service_manager.hpp | 36 ++++++++++++++++ + 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index aaf1b2d..4f62c40 100644 +index 5e7ff47..54ae2c3 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp -@@ -56,6 +56,8 @@ enum class ConnState +@@ -55,6 +55,8 @@ enum class ConnState closeInProgress, closed, suspended, @@ -39,7 +39,7 @@ index aaf1b2d..4f62c40 100644 terminated, abortConnection, retry -@@ -263,7 +265,14 @@ class HttpClient : public std::enable_shared_from_this +@@ -288,7 +290,14 @@ class HttpClient : public std::enable_shared_from_this } void doClose() { @@ -55,7 +55,7 @@ index aaf1b2d..4f62c40 100644 // Set the timeout on the tcp stream socket for the async operation conn.expires_after(std::chrono::seconds(30)); -@@ -293,8 +302,11 @@ class HttpClient : public std::enable_shared_from_this +@@ -318,8 +327,11 @@ class HttpClient : public std::enable_shared_from_this } self->conn.close(); @@ -69,7 +69,7 @@ index aaf1b2d..4f62c40 100644 { self->state = ConnState::closed; self->handleConnState(); -@@ -316,8 +328,11 @@ class HttpClient : public std::enable_shared_from_this +@@ -341,8 +353,11 @@ class HttpClient : public std::enable_shared_from_this } conn.close(); @@ -83,7 +83,7 @@ index aaf1b2d..4f62c40 100644 { state = ConnState::closed; handleConnState(); -@@ -340,8 +355,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -365,8 +380,7 @@ class HttpClient : public std::enable_shared_from_this BMCWEB_LOG_DEBUG << "Retry policy: " << retryPolicyAction; if (retryPolicyAction == "TerminateAfterRetries") { @@ -93,7 +93,7 @@ index aaf1b2d..4f62c40 100644 } if (retryPolicyAction == "SuspendRetries") { -@@ -392,6 +406,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -423,6 +437,7 @@ class HttpClient : public std::enable_shared_from_this case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: @@ -101,7 +101,7 @@ index aaf1b2d..4f62c40 100644 { BMCWEB_LOG_DEBUG << "Async operation is already in progress"; break; -@@ -413,7 +428,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -439,7 +454,7 @@ class HttpClient : public std::enable_shared_from_this break; } case ConnState::suspended: @@ -110,7 +110,7 @@ index aaf1b2d..4f62c40 100644 { doClose(); break; -@@ -480,7 +495,8 @@ class HttpClient : public std::enable_shared_from_this +@@ -506,7 +521,8 @@ class HttpClient : public std::enable_shared_from_this } void sendData(const std::string& data) { @@ -120,7 +120,7 @@ index aaf1b2d..4f62c40 100644 { return; } -@@ -489,6 +505,15 @@ class HttpClient : public std::enable_shared_from_this +@@ -524,6 +540,15 @@ class HttpClient : public std::enable_shared_from_this return; } @@ -137,7 +137,7 @@ index aaf1b2d..4f62c40 100644 const std::vector>& httpHeaders) { diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 8d7067b..79618f6 100644 +index 6f60a31..363adb0 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -591,6 +591,14 @@ class Subscription : public persistent_data::UserSubscription @@ -254,5 +254,5 @@ index 8d7067b..79618f6 100644 { std::shared_ptr entry = it.second; -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch new file mode 100644 index 000000000..585f7bf09 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch @@ -0,0 +1,141 @@ +From 5b87bb61b58e92a8c5af37a7959347747409a65c Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Thu, 14 Oct 2021 02:56:11 +0530 +Subject: [PATCH] Fix bmcweb crash while deleting terminated subscriptions + +This commit fixes bmcweb crash while deleting the terminated +subscriptions. In the earlier implementation, detection of subscription +to be deleted and the deletion(erase) was happening in the same loop. +Due to this, if the Subscription to be deleted is the last one in the +list, the loop will enter into infinite loop. The fix is to keep the +detection and deletion loop separate. +Also, this commit adds code to : + - Delete from persistent storage + - Add journal entry for deleted entry + - update number of subcribers and update persistent storage. + +Apart from this, this commit also moves the retry timer check to the top +to avoid multiple calls to close when the retry count is 3 and timer is +running. + +Tested: + - Checked journal logs to confirm each retry is actually spanned to be + 30 secs + - Verified Journal entry for deleted subscription after retires. + - Verified Event service functionality by making three subscriptions: + retry for ever, terminate after retires and suspend after retries. + +Change-Id: I425a6c749923ce86c457a36394deb0fbbee232db +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/http_client.hpp | 11 ++-- + .../include/event_service_manager.hpp | 59 ++++++++++++++++--- + 2 files changed, 58 insertions(+), 12 deletions(-) + +diff --git a/http/http_client.hpp b/http/http_client.hpp +index 54ae2c3..162cb09 100644 +--- a/http/http_client.hpp ++++ b/http/http_client.hpp +@@ -367,6 +367,12 @@ class HttpClient : public std::enable_shared_from_this + + void waitAndRetry() + { ++ if (runningTimer) ++ { ++ BMCWEB_LOG_DEBUG << "Retry timer is already running."; ++ return; ++ } ++ + if (retryCount >= maxRetryAttempts) + { + BMCWEB_LOG_ERROR << "Maximum number of retries reached."; +@@ -393,11 +399,6 @@ class HttpClient : public std::enable_shared_from_this + return; + } + +- if (runningTimer) +- { +- BMCWEB_LOG_DEBUG << "Retry timer is already running."; +- return; +- } + runningTimer = true; + + retryCount++; +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 363adb0..7af7a4d 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -857,18 +857,63 @@ class EventServiceManager + + void deleteTerminatedSubcriptions() + { +- boost::container::flat_map>::iterator it = +- subscriptionsMap.begin(); +- while (it != subscriptionsMap.end()) ++ BMCWEB_LOG_ERROR << "Map size Before Delete : " ++ << subscriptionsMap.size(); ++ ++ std::vector deleteIds; ++ ++ // Determine Subscription ID's to be deleted. ++ for (const auto& it : subscriptionsMap) + { +- std::shared_ptr entry = it->second; ++ std::shared_ptr entry = it.second; + if (entry->isTerminated()) + { +- subscriptionsMap.erase(it); ++ deleteIds.emplace_back(it.first); ++ } ++ } ++ ++ // Delete the Terminated Subcriptions ++ for (std::string& id : deleteIds) ++ { ++ auto map1 = subscriptionsMap.find(id); ++ if (map1 != subscriptionsMap.end()) ++ { ++ subscriptionsMap.erase(map1); ++ auto map2 = persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.find(id); ++ if (map2 != persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.end()) ++ { ++ persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.erase(map2); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Couldn't find ID: " << id ++ << " in subscriptionsConfigMap"; ++ } ++ ++ /* Log event for subscription delete. */ ++ sd_journal_send("MESSAGE=Event subscription removed.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionRemoved", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Couldn't find ID: " << id ++ << " in subscriptionsMap"; + } +- it++; + } ++ if (deleteIds.size()) ++ { ++ updateNoOfSubscribersCount(); ++ persistSubscriptionData(); ++ } ++ ++ BMCWEB_LOG_ERROR << "Map size After Delete : " ++ << subscriptionsMap.size(); + } + + void updateNoOfSubscribersCount() +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README index cd2e1c2bc..c09967456 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README @@ -3,26 +3,32 @@ the upstream patches. These will be remove as soon as thee gets merged upstream. Upstream revision information: - - EventService : Fix retry handling for http-client - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/21 + - EventService : Add unmerged changes for http retry support (Downstream patch) + file://eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch - EventService: https client support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/40 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/40 (Rebased on latest bmcweb) - Add Server-Sent-Events support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/7 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/9 - Add SSE style subscription support to eventservice - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/8 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/10 - Add EventService SSE filter support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/7 (Modified boost::urls::query_params_view to boost::urls::url_view::params_type) - - EventService Log events for subscription actions - file://telemetry/0007-EventService-Log-events-for-subscription-actions.patch + - EventService Log events for subscription actions (Downstream patch) + file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch - - Add checks on Event-Subscription input parameters - file://telemetry/0008-Add-checks-on-Event-Subscription-input-parameters.patch + - Add checks on Event-Subscription input parameters (Downstream patch) + file://eventservice//0008-Add-checks-on-Event-Subscription-input-parameters.patch - Restructure Redifsh EventLog Transmit code flow - file://telemetry/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44449/3 + + - Remove Terminated Event Subscriptions (Downstream patch) + file://eventservice/0010-Remove-Terminated-Event-Subscriptions.patch + + - Fix bmcweb crash while deleting terminated subscriptions (Downstream patch) + file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch new file mode 100644 index 000000000..b3aa11774 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch @@ -0,0 +1,202 @@ +From f2c3271c8eb405a05a3ec383791e1adc3c4a7f86 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 18 Oct 2021 22:45:37 +0530 +Subject: [PATCH] Add asyncResp support during handleUpgrade + +The current implementation uses the earlier method of using the response +object and calling response.end() to initiate completion handler. +This commit modifies the implementation to use asyncResp, where the +completion handler gets called asynchronously as the response object +goes out of scope. + +Tested : + - websocket_test.py Passed + - KVM was functional in WebUI. + - POST to /redfish/v1/EventService/Subscriptions/SSE returned an error + message as expected and the connection was kept alive. + - GET on /redfish/v1/EventService/Subscriptions/SSE (SSE subscription) + was successful. The existing connection was successfully closed and + upgraded to SSE connection. + +Change-Id: I2d76b34a49a6432c507d939b21b37c1ced761f8e +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/app.hpp | 6 ++++-- + http/http_connection.hpp | 30 +++++++++++++++++++++++++----- + http/routing.hpp | 37 +++++++++++++++++++++---------------- + 3 files changed, 50 insertions(+), 23 deletions(-) + +diff --git a/http/app.hpp b/http/app.hpp +index 4735197..c46dcf7 100644 +--- a/http/app.hpp ++++ b/http/app.hpp +@@ -45,9 +45,11 @@ class App + } + + template +- void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor) ++ void handleUpgrade(const Request& req, ++ const std::shared_ptr& asyncResp, ++ Adaptor&& adaptor) + { +- router.handleUpgrade(req, res, std::move(adaptor)); ++ router.handleUpgrade(req, asyncResp, std::move(adaptor)); + } + + void handle(Request& req, +diff --git a/http/http_connection.hpp b/http/http_connection.hpp +index 9d53c17..cdd3707 100644 +--- a/http/http_connection.hpp ++++ b/http/http_connection.hpp +@@ -361,6 +361,7 @@ class Connection : + boost::asio::post(self->adaptor.get_executor(), + [self] { self->completeRequest(); }); + }); ++ auto asyncResp = std::make_shared(res); + + if ((thisReq.isUpgrade() && + boost::iequals( +@@ -369,13 +370,32 @@ class Connection : + (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) + { + BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; +- handler->handleUpgrade(thisReq, res, std::move(adaptor)); +- // delete lambda with self shared_ptr +- // to enable connection destruction +- res.setCompleteRequestHandler(nullptr); ++ res.setCompleteRequestHandler([self(shared_from_this())] { ++ if (self->res.resultInt() != 200) ++ { ++ // When any error occurs during handle upgradation, ++ // the result in response will be set to respective ++ // error. By default the Result will be OK (200), ++ // which implies successful handle upgrade. Response ++ // needs to be sent over this connection only on ++ // failure. ++ boost::asio::post(self->adaptor.get_executor(), ++ [self] { self->completeRequest(); }); ++ } ++ else ++ { ++ // Set Complete request handler to NULL to remove ++ // the shared pointer of connection to enable ++ // connection destruction. As the connection would ++ // get upgraded, we wouldn't need this connection ++ // any longer ++ self->res.setCompleteRequestHandler(nullptr); ++ } ++ }); ++ handler->handleUpgrade(thisReq, asyncResp, std::move(adaptor)); + return; + } +- auto asyncResp = std::make_shared(res); ++ + handler->handle(thisReq, asyncResp); + } + +diff --git a/http/routing.hpp b/http/routing.hpp +index 25e4ce8..858f146 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -1202,12 +1202,13 @@ class Router + } + + template +- void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor) ++ void handleUpgrade(const Request& req, ++ const std::shared_ptr& asyncResp, ++ Adaptor&& adaptor) + { + if (static_cast(req.method()) >= perMethods.size()) + { +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1220,8 +1221,7 @@ class Router + if (!ruleIndex) + { + BMCWEB_LOG_DEBUG << "Cannot match rules " << req.url; +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1234,23 +1234,24 @@ class Router + { + BMCWEB_LOG_INFO << "Redirecting to a url with trailing slash: " + << req.url; +- res.result(boost::beast::http::status::moved_permanently); ++ asyncResp->res.result( ++ boost::beast::http::status::moved_permanently); + + // TODO absolute url building + if (req.getHeaderValue("Host").empty()) + { +- res.addHeader("Location", std::string(req.url) + "/"); ++ asyncResp->res.addHeader("Location", ++ std::string(req.url) + "/"); + } + else + { +- res.addHeader( ++ asyncResp->res.addHeader( + "Location", + req.isSecure + ? "https://" + : "http://" + std::string(req.getHeaderValue("Host")) + + std::string(req.url) + "/"); + } +- res.end(); + return; + } + +@@ -1261,8 +1262,7 @@ class Router + << " with " << req.methodString() << "(" + << static_cast(req.method()) << ") / " + << rules[ruleIndex]->getMethods(); +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1273,13 +1273,18 @@ class Router + // any uncaught exceptions become 500s + try + { +- rules[ruleIndex]->handleUpgrade(req, res, std::move(adaptor)); ++ // Creating temporary response object to call handleUpgrade ++ // We cannot pass the asyncResp as it will be destroyed ++ // The response object is not initialized as handleUpgrade wouldn't ++ // be using this object ++ crow::Response resp; ++ rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); + } + catch (std::exception& e) + { + BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); +- res.result(boost::beast::http::status::internal_server_error); +- res.end(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); + return; + } + catch (...) +@@ -1287,8 +1292,8 @@ class Router + BMCWEB_LOG_ERROR + << "An uncaught exception occurred. The type was unknown " + "so no information was available."; +- res.result(boost::beast::http::status::internal_server_error); +- res.end(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); + return; + } + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch new file mode 100644 index 000000000..1217147b4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch @@ -0,0 +1,109 @@ +From 6483f0af926391e8d1f256ba0f23f3640260cfd1 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 18 Oct 2021 22:52:17 +0530 +Subject: [PATCH] Move privileges to separate entity + +The privilege property of a rule is currently part of RuleParameterTraits +structure. Moving this property (member function) out into a separate +entity PrivilegeParameterTraits. +This move is required to enable inheriting this entity into Weksockets +and SseSockets. + +Tested: + - bmcweb is functional and is responding to Redfish URI's + - User Privilege check for URI's is functional. + +Change-Id: I288ab12258c15ae5a626f4409fc3b4a9cc574ea3 +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/routing.hpp | 53 +++++++++++++++++++++++++++--------------------- + 1 file changed, 30 insertions(+), 23 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index 858f146..acc99dc 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -102,6 +102,8 @@ class BaseRule + friend class Router; + template + friend struct RuleParameterTraits; ++ template ++ friend struct PrivilegeParameterTraits; + }; + + namespace detail +@@ -316,6 +318,33 @@ struct Wrapped + } // namespace routing_handler_call_helper + } // namespace detail + ++template ++struct PrivilegeParameterTraits ++{ ++ using self_t = T; ++ self_t& privileges( ++ const std::initializer_list>& p) ++ { ++ self_t* self = static_cast(this); ++ for (const std::initializer_list& privilege : p) ++ { ++ self->privilegesSet.emplace_back(privilege); ++ } ++ return *self; ++ } ++ ++ template ++ self_t& privileges(const std::array& p) ++ { ++ self_t* self = static_cast(this); ++ for (const redfish::Privileges& privilege : p) ++ { ++ self->privilegesSet.emplace_back(privilege); ++ } ++ return *self; ++ } ++}; ++ + class WebSocketRule : public BaseRule + { + using self_t = WebSocketRule; +@@ -462,7 +491,7 @@ class SseSocketRule : public BaseRule + }; + + template +-struct RuleParameterTraits ++struct RuleParameterTraits : public PrivilegeParameterTraits + { + using self_t = T; + WebSocketRule& websocket() +@@ -503,28 +532,6 @@ struct RuleParameterTraits + self->methodsBitfield |= 1U << static_cast(method); + return *self; + } +- +- self_t& privileges( +- const std::initializer_list>& p) +- { +- self_t* self = static_cast(this); +- for (const std::initializer_list& privilege : p) +- { +- self->privilegesSet.emplace_back(privilege); +- } +- return *self; +- } +- +- template +- self_t& privileges(const std::array& p) +- { +- self_t* self = static_cast(this); +- for (const redfish::Privileges& privilege : p) +- { +- self->privilegesSet.emplace_back(privilege); +- } +- return *self; +- } + }; + + class DynamicRule : public BaseRule, public RuleParameterTraits +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch new file mode 100644 index 000000000..1ba584616 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch @@ -0,0 +1,218 @@ +From aabe4718b8e6c1f7b91af29cbaf85d5fa1fa0a99 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 18 Oct 2021 22:55:38 +0530 +Subject: [PATCH] Add Support for privilege check in handleUpgrade + +This commit enables privilege check for user(s) in case of upgraded +connections. +Currently users with no privileges will also be able to access +Websockets connections (Ex: KVM). + +Tested: + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: Id9d33aeca24d8fafb2e9dcc28c46a48930740cd6 +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/app.hpp | 2 +- + http/routing.hpp | 162 +++++++++++++++++++++++++++++++++++++++-------- + 2 files changed, 136 insertions(+), 28 deletions(-) + +diff --git a/http/app.hpp b/http/app.hpp +index c46dcf7..dd51eee 100644 +--- a/http/app.hpp ++++ b/http/app.hpp +@@ -45,7 +45,7 @@ class App + } + + template +- void handleUpgrade(const Request& req, ++ void handleUpgrade(Request& req, + const std::shared_ptr& asyncResp, + Adaptor&& adaptor) + { +diff --git a/http/routing.hpp b/http/routing.hpp +index acc99dc..e2a8fbb 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -1209,7 +1209,7 @@ class Router + } + + template +- void handleUpgrade(const Request& req, ++ void handleUpgrade(Request& req, + const std::shared_ptr& asyncResp, + Adaptor&& adaptor) + { +@@ -1277,32 +1277,140 @@ class Router + << "' " << static_cast(req.method()) << " / " + << rules[ruleIndex]->getMethods(); + +- // any uncaught exceptions become 500s +- try +- { +- // Creating temporary response object to call handleUpgrade +- // We cannot pass the asyncResp as it will be destroyed +- // The response object is not initialized as handleUpgrade wouldn't +- // be using this object +- crow::Response resp; +- rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); +- } +- catch (std::exception& e) +- { +- BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); +- asyncResp->res.result( +- boost::beast::http::status::internal_server_error); +- return; +- } +- catch (...) +- { +- BMCWEB_LOG_ERROR +- << "An uncaught exception occurred. The type was unknown " +- "so no information was available."; +- asyncResp->res.result( +- boost::beast::http::status::internal_server_error); +- return; +- } ++ crow::connections::systemBus->async_method_call( ++ [&req, asyncResp, &rules, ruleIndex, &adaptor]( ++ const boost::system::error_code ec, ++ std::map>> ++ userInfo) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "GetUserInfo failed..."; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ ++ const std::string* userRolePtr = nullptr; ++ auto userInfoIter = userInfo.find("UserPrivilege"); ++ if (userInfoIter != userInfo.end()) ++ { ++ userRolePtr = ++ std::get_if(&userInfoIter->second); ++ } ++ ++ std::string userRole{}; ++ if (userRolePtr != nullptr) ++ { ++ userRole = *userRolePtr; ++ BMCWEB_LOG_DEBUG << "userName = " << req.session->username ++ << " userRole = " << *userRolePtr; ++ } ++ ++ bool* remoteUserPtr = nullptr; ++ auto remoteUserIter = userInfo.find("RemoteUser"); ++ if (remoteUserIter != userInfo.end()) ++ { ++ remoteUserPtr = std::get_if(&remoteUserIter->second); ++ } ++ if (remoteUserPtr == nullptr) ++ { ++ BMCWEB_LOG_ERROR ++ << "RemoteUser property missing or wrong type"; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ bool remoteUser = *remoteUserPtr; ++ ++ bool passwordExpired = false; // default for remote user ++ if (!remoteUser) ++ { ++ bool* passwordExpiredPtr = nullptr; ++ auto passwordExpiredIter = ++ userInfo.find("UserPasswordExpired"); ++ if (passwordExpiredIter != userInfo.end()) ++ { ++ passwordExpiredPtr = ++ std::get_if(&passwordExpiredIter->second); ++ } ++ if (passwordExpiredPtr != nullptr) ++ { ++ passwordExpired = *passwordExpiredPtr; ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "UserPasswordExpired property is expected for" ++ " local user but is missing or wrong type"; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ } ++ ++ // Get the userprivileges from the role ++ redfish::Privileges userPrivileges = ++ redfish::getUserPrivileges(userRole); ++ ++ // Set isConfigureSelfOnly based on D-Bus results. This ++ // ignores the results from both pamAuthenticateUser and the ++ // value from any previous use of this session. ++ req.session->isConfigureSelfOnly = passwordExpired; ++ ++ // Modifyprivileges if isConfigureSelfOnly. ++ if (req.session->isConfigureSelfOnly) ++ { ++ // Remove allprivileges except ConfigureSelf ++ userPrivileges = userPrivileges.intersection( ++ redfish::Privileges{"ConfigureSelf"}); ++ BMCWEB_LOG_DEBUG << "Operation limited to ConfigureSelf"; ++ } ++ ++ if (!rules[ruleIndex]->checkPrivileges(userPrivileges)) ++ { ++ asyncResp->res.result( ++ boost::beast::http::status::forbidden); ++ if (req.session->isConfigureSelfOnly) ++ { ++ redfish::messages::passwordChangeRequired( ++ asyncResp->res, ++ "/redfish/v1/AccountService/Accounts/" + ++ req.session->username); ++ } ++ return; ++ } ++ ++ req.userRole = userRole; ++ ++ // any uncaught exceptions become 500s ++ try ++ { ++ crow::Response resp; ++ rules[ruleIndex]->handleUpgrade(req, resp, ++ std::move(adaptor)); ++ } ++ catch (std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "An uncaught exception occurred: " ++ << e.what(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ catch (...) ++ { ++ BMCWEB_LOG_ERROR ++ << "An uncaught exception occurred. The type was " ++ "unknown so no information was available."; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user", ++ "xyz.openbmc_project.User.Manager", "GetUserInfo", ++ req.session->username); + } + + void handle(Request& req, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch new file mode 100644 index 000000000..64e235ce3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch @@ -0,0 +1,140 @@ +From 9b27d3e7c1670d53cfb1c0a88cc75155ebfba71a Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 18 Oct 2021 22:58:29 +0530 +Subject: [PATCH] Add Privileges to Websockets + +This commit adds Privileges to Websockets. +In the current implementation, once a rule is upgraded (i.e. from +BaseRule to WebSocket), there is no provosion to add priviliges. +In this commit, WebSocket inherits PrivilegeParameterTraits to enable +privileges. + +Also, in the earlier implementation, .privilege() was called after +BMCWEB_ROUTE(). This results in adding those privileges to the Base rule +that is created. By moving the privileges() below websocket(), the +privileges are applied to the websocket. + +Tested: + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: Iff2051dbb7d363c902fd463fa446f280adc6d648 +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/routing.hpp | 4 +++- + include/dbus_monitor.hpp | 3 ++- + include/kvm_websocket.hpp | 4 +++- + include/obmc_console.hpp | 4 +++- + include/vm_websocket.hpp | 4 +++- + 5 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index e2a8fbb..6ea3185 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -345,7 +345,9 @@ struct PrivilegeParameterTraits + } + }; + +-class WebSocketRule : public BaseRule ++class WebSocketRule : ++ public BaseRule, ++ public PrivilegeParameterTraits + { + using self_t = WebSocketRule; + +diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp +index a6c86c6..163f884 100644 +--- a/include/dbus_monitor.hpp ++++ b/include/dbus_monitor.hpp +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -105,8 +106,8 @@ inline int onPropertyUpdate(sd_bus_message* m, void* userdata, + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/subscribe") +- .privileges({{"Login"}}) + .websocket() ++ .privileges(redfish::privileges::privilegeSetLogin) + .onopen([&](crow::websocket::Connection& conn, + const std::shared_ptr&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp +index a9dc8ea..3f124a2 100644 +--- a/include/kvm_websocket.hpp ++++ b/include/kvm_websocket.hpp +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include + + namespace crow +@@ -159,8 +160,9 @@ inline void requestRoutes(App& app) + sessions.reserve(maxSessions); + + BMCWEB_ROUTE(app, "/kvm/0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp +index ff0a51f..22a49a8 100644 +--- a/include/obmc_console.hpp ++++ b/include/obmc_console.hpp +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + + namespace crow +@@ -136,8 +137,9 @@ inline void connectHandler(const boost::system::error_code& ec) + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/console0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp +index 02f958a..ebbe68f 100644 +--- a/include/vm_websocket.hpp ++++ b/include/vm_websocket.hpp +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -156,8 +157,9 @@ static std::shared_ptr handler; + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/vm/0/0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch new file mode 100644 index 000000000..06ffb3a46 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch @@ -0,0 +1,63 @@ +From 0ceb343809ff498cbfa389c54a158d255a2cca88 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar +Date: Mon, 18 Oct 2021 23:02:00 +0530 +Subject: [PATCH] Add Privileges to SseSockets + +This commit adds Privileges to Ssesockets. +In the current implementation, once a rule is upgraded (i.e. from +BaseRule to SseSocket), there is no provision to add priviliges. +In this commit, SseSocket inherits PrivilegeParameterTraits to +enable privileges. + +Also, in the earlier implementation, .privilege() was called after +BMCWEB_ROUTE(). This results in adding those privileges to the Base +rule that is created. By moving the privileges() below websocket(), +the privileges are applied to the Ssesocket. + +Tested: + - SSE Subscription was successful with Admin and Operator Users + - SSE Subscription was rejected while using Readonly User + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: I41739401893b1c2bf718e11ec7676d69f954c98f +Signed-off-by: P Dheeraj Srujan Kumar +--- + http/routing.hpp | 4 +++- + include/eventservice_sse.hpp | 3 ++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index 6ea3185..13174b2 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -430,7 +430,9 @@ class WebSocketRule : + std::function errorHandler; + }; + +-class SseSocketRule : public BaseRule ++class SseSocketRule : ++ public BaseRule, ++ public PrivilegeParameterTraits + { + using self_t = SseSocketRule; + +diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp +index 2f22f98..f880344 100644 +--- a/include/eventservice_sse.hpp ++++ b/include/eventservice_sse.hpp +@@ -192,8 +192,9 @@ static void deleteSubscription(std::shared_ptr& conn) + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/SSE") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .serverSentEvent() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](std::shared_ptr& conn, + const crow::Request& req, crow::Response& res) { + BMCWEB_LOG_DEBUG << "Connection " << conn << " opened."; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch index c19691cdc..f5226fe6e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch @@ -1,4 +1,4 @@ -From 80608f0d72da62426bb00e03a42fbf5daed931c9 Mon Sep 17 00:00:00 2001 +From 32e557279450226ed9c06312649d90b802f3d4c5 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny Date: Tue, 13 Apr 2021 13:00:18 +0000 Subject: [PATCH] Add support for MetricDefinition scheme @@ -11,10 +11,11 @@ MetricDefinitions contains all physical sensors supported by redfish, algorithm iterates through all chassis and collects results for each node available in that chassis (Power, Thermal, Sensors). -When https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40169 will -be merge it will be possible to optimize this algorithm to only get -sensors from Sensors node. Currently Sensors node doesn't contain all -available sensors. +When BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM will be enabled by +default (meson option redfish-new-powersubsystem-thermalsubsystem) it +will be possible to optimize this algorithm to only get sensors from +Sensors node. Currently Sensors node doesn't contain all available +sensors. Tested: - MetricDefinitions response is filled with existing sensors, it works @@ -30,47 +31,54 @@ GET /redfish/v1/TelemetryService/MetricDefinitions "@odata.type": "#MetricDefinitionCollection.MetricDefinitionCollection", "Members": [ { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Rotational" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Pwm" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Percent" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Temperature" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostCpuUtilization" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Power" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostMemoryBandwidthUtilization" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/AirFlow" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostPciBandwidthUtilization" + }, + { + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Inlet_BRD_Temp" + }, + { + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Left_Rear_Board_Temp" } ], - "Members@odata.count": 5, + "Members@odata.count": 7, "Name": "Metric Definition Collection" } -GET /redfish/v1/TelemetryService/MetricDefinitions/Rotational +GET /redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Rotational", + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach", "@odata.type": "#MetricDefinition.v1_0_3.MetricDefinition", - "Id": "Rotational", - "Implementation": "PhysicalSensor", + "Id": "Fan_Tach", "IsLinear": true, + "MaxReadingRange": 25000.0, "MetricDataType": "Decimal", "MetricProperties": [ - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/0/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/1/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/2/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/3/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/4/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/5/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/6/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/7/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/8/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/9/Reading" + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/1/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/2/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/3/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/4/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/5/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/6/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/7/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/8/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/9/Reading" ], - "MetricType": "Numeric", - "Name": "Rotational", + "MetricType": "Gauge", + "MinReadingRange": 0.0, + "Name": "Fan_Tach", "Units": "RPM" } @@ -109,16 +117,16 @@ Signed-off-by: Krzysztof Grobelny Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + - .../include/utils/get_chassis_names.hpp | 58 ++++ + .../include/utils/get_chassis_names.hpp | 58 +++ .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 258 ++++++++++++++++++ - redfish-core/lib/telemetry_service.hpp | 2 + - 5 files changed, 323 insertions(+) + redfish-core/lib/metric_definition.hpp | 368 ++++++++++++++++++ + redfish-core/lib/telemetry_service.hpp | 3 +- + 5 files changed, 433 insertions(+), 1 deletion(-) create mode 100644 redfish-core/include/utils/get_chassis_names.hpp create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 1c7b695..9983b88 100644 +index 0a97150..67c5af2 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -26,6 +26,7 @@ @@ -129,7 +137,7 @@ index 1c7b695..9983b88 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -199,6 +200,8 @@ class RedfishService +@@ -200,6 +201,8 @@ class RedfishService requestRoutesMetricReportDefinition(app); requestRoutesMetricReportCollection(app); requestRoutesMetricReport(app); @@ -217,10 +225,10 @@ index 5872350..1b4f75d 100644 constexpr const char* metricReportUri = diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp new file mode 100644 -index 0000000..019168b +index 0000000..347c297 --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,258 @@ +@@ -0,0 +1,368 @@ +#pragma once + +#include "async_resp.hpp" @@ -236,55 +244,160 @@ index 0000000..019168b +namespace telemetry +{ + -+bool containsOdata(const nlohmann::json& json, const std::string& odataId) ++struct ValueVisitor +{ -+ const auto it = std::find_if( -+ json.begin(), json.end(), [&odataId](const nlohmann::json& item) { -+ auto kt = item.find("@odata.id"); -+ if (kt == item.end()) ++ ValueVisitor(boost::system::error_code& ec) : ec(ec) ++ {} ++ ++ template ++ double operator()(T value) const ++ { ++ return static_cast(value); ++ } ++ ++ double operator()(std::monostate) const ++ { ++ ec = boost::system::errc::make_error_code( ++ boost::system::errc::invalid_argument); ++ return double{}; ++ } ++ ++ boost::system::error_code& ec; ++}; ++ ++inline void getReadingRange( ++ const std::string& service, const std::string& path, ++ const std::string& property, ++ std::function callback) ++{ ++ crow::connections::systemBus->async_method_call( ++ [callback = std::move(callback)]( ++ boost::system::error_code ec, ++ const std::variant& ++ valueVariant) { ++ if (ec) + { -+ return false; ++ callback(ec, double{}); ++ return; + } -+ const std::string* value = kt->get_ptr(); -+ if (!value) ++ ++ const double value = std::visit(ValueVisitor(ec), valueVariant); ++ ++ callback(ec, value); ++ }, ++ service, path, "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.Sensor.Value", property); ++} ++ ++inline void ++ fillMinMaxReadingRange(const std::shared_ptr& asyncResp, ++ const std::string& serviceName, ++ const std::string& sensorPath) ++{ ++ asyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ ++ telemetry::getReadingRange( ++ serviceName, sensorPath, "MinValue", ++ [asyncResp](boost::system::error_code ec, double readingRange) { ++ if (ec) + { -+ return false; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ if (std::isfinite(readingRange)) ++ { ++ asyncResp->res.jsonValue["MetricType"] = "Gauge"; ++ ++ asyncResp->res.jsonValue["MinReadingRange"] = readingRange; + } -+ return *value == odataId; + }); + -+ return it != json.end(); ++ telemetry::getReadingRange( ++ serviceName, sensorPath, "MaxValue", ++ [asyncResp](boost::system::error_code ec, double readingRange) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ if (std::isfinite(readingRange)) ++ { ++ asyncResp->res.jsonValue["MetricType"] = "Gauge"; ++ ++ asyncResp->res.jsonValue["MaxReadingRange"] = readingRange; ++ } ++ }); +} + -+void addMembers(crow::Response& res, -+ const boost::container::flat_map& el) ++inline void getSensorService( ++ const std::string& sensorPath, ++ std::function callback) +{ -+ for (const auto& [_, dbusSensor] : el) -+ { -+ sdbusplus::message::object_path path(dbusSensor); -+ sdbusplus::message::object_path parentPath = path.parent_path(); -+ const std::string type = parentPath.filename(); ++ using ResultType = std::pair< ++ std::string, ++ std::vector>>>; + -+ if (type.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " -+ << dbusSensor; -+ continue; -+ } ++ crow::connections::systemBus->async_method_call( ++ [sensorPath, callback = std::move(callback)]( ++ boost::system::error_code ec, ++ const std::vector& result) { ++ if (ec) ++ { ++ callback(ec, std::string{}); ++ return; ++ } ++ ++ for (const auto& [path, serviceToInterfaces] : result) ++ { ++ if (path == sensorPath) ++ { ++ for (const auto& [service, interfaces] : ++ serviceToInterfaces) ++ { ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::success), ++ service); ++ return; ++ } ++ } ++ } + -+ nlohmann::json& members = res.jsonValue["Members"]; ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::no_such_file_or_directory), ++ std::string{}); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetSubTree", ++ "/xyz/openbmc_project/sensors", 2, ++ std::array{"xyz.openbmc_project.Sensor.Value"}); ++} + -+ const std::string odataId = -+ std::string(telemetry::metricDefinitionUri) + -+ sensors::toReadingType(type); ++constexpr auto metricDefinitionMapping = std::array{ ++ std::pair{"fan_pwm", "Fan_Pwm"}, std::pair{"fan_tach", "Fan_Tach"}}; + -+ if (!containsOdata(members, odataId)) -+ { -+ members.push_back({{"@odata.id", odataId}}); -+ } ++std::string mapSensorToMetricDefinition(const std::string& sensorPath) ++{ ++ sdbusplus::message::object_path sensorObjectPath{sensorPath}; ++ ++ const auto it = std::find_if( ++ metricDefinitionMapping.begin(), metricDefinitionMapping.end(), ++ [&sensorObjectPath](const auto& item) { ++ return item.first == sensorObjectPath.parent_path().filename(); ++ }); ++ ++ const char* metricDefinitionPath = ++ "/redfish/v1/TelemetryService/MetricDefinitions/"; + -+ res.jsonValue["Members@odata.count"] = members.size(); ++ if (it != metricDefinitionMapping.end()) ++ { ++ return std::string{metricDefinitionPath} + it->second; + } ++ ++ return metricDefinitionPath + sensorObjectPath.filename(); +} + +template @@ -300,8 +413,11 @@ index 0000000..019168b + return; + } + ++ auto counter = std::make_shared, size_t>>(); ++ + auto handleRetrieveUriToDbusMap = -+ [callback = std::move(callback)]( ++ [counter, callback = std::move(callback)]( + const boost::beast::http::status status, + const boost::container::flat_map& + uriToDbus) { @@ -310,21 +426,31 @@ index 0000000..019168b + BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " + "sensors map with err " + << static_cast(status); ++ counter->second = 0u; + callback(boost::system::errc::make_error_code( + boost::system::errc::io_error), + {}); + return; + } + -+ callback(boost::system::errc::make_error_code( -+ boost::system::errc::success), -+ uriToDbus); ++ for (const auto& [key, value] : uriToDbus) ++ { ++ counter->first[key] = value; ++ } ++ ++ if (--counter->second == 0u) ++ { ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::success), ++ counter->first); ++ } + }; + + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, dbusPaths] : sensors::dbus::paths) + { ++ ++counter->second; + retrieveUriToDbusMap(chassisName, sensorNode.data(), + handleRetrieveUriToDbusMap); + } @@ -354,7 +480,23 @@ index 0000000..019168b + return; + } + -+ telemetry::addMembers(asyncResp->res, uriToDbus); ++ std::set members; ++ ++ for (const auto& [uri, dbusPath] : uriToDbus) ++ { ++ members.insert( ++ telemetry::mapSensorToMetricDefinition( ++ dbusPath)); ++ } ++ ++ for (const std::string& odataId : members) ++ { ++ asyncResp->res.jsonValue["Members"].push_back( ++ {{"@odata.id", odataId}}); ++ } ++ ++ asyncResp->res.jsonValue["Members@odata.count"] = ++ asyncResp->res.jsonValue["Members"].size(); + }); + + asyncResp->res.jsonValue["@odata.type"] = @@ -369,128 +511,109 @@ index 0000000..019168b + }); +} + -+namespace telemetry -+{ -+ -+bool isSensorIdSupported(std::string_view readingType) -+{ -+ for (const std::pair>& -+ typeToPaths : sensors::dbus::paths) -+ { -+ for (const char* supportedPath : typeToPaths.second) -+ { -+ if (readingType == -+ sensors::toReadingType( -+ sdbusplus::message::object_path(supportedPath).filename())) -+ { -+ return true; -+ } -+ } -+ } -+ return false; -+} -+ -+void addMetricProperty( -+ bmcweb::AsyncResp& asyncResp, const std::string& readingType, -+ const boost::container::flat_map& el) -+{ -+ nlohmann::json& metricProperties = -+ asyncResp.res.jsonValue["MetricProperties"]; -+ -+ for (const auto& [redfishSensor, dbusSensor] : el) -+ { -+ std::string sensorId; -+ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) -+ { -+ if (sensors::toReadingType(sensorId) == readingType) -+ { -+ metricProperties.push_back(redfishSensor); -+ } -+ } -+ } -+} -+ -+inline const char* readingTypeToReadingUnits(const std::string& readingType) -+{ -+ for (const auto& [node, paths] : sensors::dbus::paths) -+ { -+ for (const char* path : paths) -+ { -+ const sdbusplus::message::object_path sensorPath = -+ sdbusplus::message::object_path(path); -+ if (sensors::toReadingType(sensorPath.filename()) == readingType) -+ { -+ return sensors::toReadingUnits(sensorPath.filename()); -+ } -+ } -+ } -+ return ""; -+} -+ -+} // namespace telemetry -+ +inline void requestRoutesMetricDefinition(App& app) +{ + BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricDefinitions//") + .privileges(privileges::getTelemetryService) -+ .methods(boost::beast::http::verb::get)( -+ [](const crow::Request&, -+ const std::shared_ptr& asyncResp, -+ const std::string& readingType) { -+ if (!telemetry::isSensorIdSupported(readingType)) -+ { -+ messages::resourceNotFound(asyncResp->res, -+ "MetricDefinition", readingType); -+ return; -+ } -+ -+ telemetry::mapRedfishUriToDbusPath( -+ [asyncResp, -+ readingType](boost::system::error_code ec, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (ec) ++ .methods( ++ boost::beast::http::verb::get)([](const crow::Request&, ++ const std::shared_ptr< ++ bmcweb::AsyncResp>& asyncResp, ++ const std::string& name) { ++ telemetry::mapRedfishUriToDbusPath( ++ [asyncResp, name]( ++ boost::system::error_code ec, ++ const boost::container::flat_map& ++ uriToDbus) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "mapRedfishUriToDbusPath error: " ++ << ec.value(); ++ return; ++ } ++ ++ std::string odataId = telemetry::metricDefinitionUri + name; ++ boost::container::flat_map ++ matchingUris; ++ ++ for (const auto& [uri, dbusPath] : uriToDbus) ++ { ++ if (telemetry::mapSensorToMetricDefinition(dbusPath) == ++ odataId) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_ERROR -+ << "mapRedfishUriToDbusPath error: " -+ << ec.value(); -+ return; ++ matchingUris.emplace(uri, dbusPath); + } -+ -+ asyncResp->res.jsonValue["Id"] = readingType; -+ asyncResp->res.jsonValue["Name"] = readingType; -+ asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + readingType; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#MetricDefinition.v1_0_3.MetricDefinition"; -+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal"; -+ asyncResp->res.jsonValue["MetricType"] = "Numeric"; -+ asyncResp->res.jsonValue["IsLinear"] = true; -+ asyncResp->res.jsonValue["Implementation"] = -+ "PhysicalSensor"; -+ asyncResp->res.jsonValue["Units"] = -+ telemetry::readingTypeToReadingUnits(readingType); -+ -+ telemetry::addMetricProperty(*asyncResp, readingType, -+ uriToDbus); -+ }); -+ }); ++ } ++ ++ if (matchingUris.empty()) ++ { ++ messages::resourceNotFound(asyncResp->res, ++ "MetricDefinition", name); ++ return; ++ } ++ ++ std::string sensorPath = matchingUris.begin()->second; ++ ++ telemetry::getSensorService( ++ sensorPath, ++ [asyncResp, name, odataId = std::move(odataId), ++ sensorPath, matchingUris = std::move(matchingUris)]( ++ boost::system::error_code ec, ++ const std::string& serviceName) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getServiceSensorFailed: " ++ << ec.value(); ++ return; ++ } ++ ++ asyncResp->res.jsonValue["Id"] = name; ++ asyncResp->res.jsonValue["Name"] = name; ++ asyncResp->res.jsonValue["@odata.id"] = odataId; ++ asyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ asyncResp->res.jsonValue["MetricDataType"] = ++ "Decimal"; ++ asyncResp->res.jsonValue["IsLinear"] = true; ++ asyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits( ++ sdbusplus::message::object_path{sensorPath} ++ .parent_path() ++ .filename()); ++ ++ for (const auto& [uri, dbusPath] : matchingUris) ++ { ++ asyncResp->res.jsonValue["MetricProperties"] ++ .push_back(uri); ++ } ++ ++ telemetry::fillMinMaxReadingRange( ++ asyncResp, serviceName, sensorPath); ++ }); ++ }); ++ }); +} + +} // namespace redfish diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index ad86d5c..c4962e9 100644 +index 8ecc591..027b51b 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp -@@ -29,6 +29,8 @@ inline void requestRoutesTelemetryService(App& app) - "/redfish/v1/TelemetryService/MetricReportDefinitions"; - asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = - "/redfish/v1/TelemetryService/MetricReports"; -+ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = -+ "/redfish/v1/TelemetryService/MetricDefinitions"; +@@ -18,11 +18,12 @@ inline void handleTelemetryServiceGet( + asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TelemetryService"; + asyncResp->res.jsonValue["Id"] = "TelemetryService"; + asyncResp->res.jsonValue["Name"] = "Telemetry Service"; +- + asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricReportDefinitions"; + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricReports"; ++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = ++ "/redfish/v1/TelemetryService/MetricDefinitions"; - crow::connections::systemBus->async_method_call( - [asyncResp]( + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, -- 2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch index d32c85356..3088a7f9d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch @@ -1,4 +1,4 @@ -From 77e8a0b5037a555b1520823b667595ac8780c675 Mon Sep 17 00:00:00 2001 +From 541353a4e4b06de42b6a9a400629f5a5fba04e86 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" Date: Tue, 15 Dec 2020 12:30:31 +0100 Subject: [PATCH] Sync Telmetry service with EventService @@ -16,13 +16,14 @@ Tested: Change-Id: I2fc1841a6c9259a8bff30b34bddc0d4aabd41912 Signed-off-by: Wludzik, Jozef +Signed-off-by: Lukasz Kazmierczak --- .../include/event_service_manager.hpp | 156 ++++++------------ redfish-core/lib/metric_report.hpp | 28 ++-- 2 files changed, 69 insertions(+), 115 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index d89b789..4faaddd 100644 +index 3f398d7..cf9f658 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -212,12 +213,12 @@ index d89b789..4faaddd 100644 + }); + if (found == props.end()) + { -+ BMCWEB_LOG_ERROR ++ BMCWEB_LOG_INFO + << "Failed to get Readings from Report properties"; + return; + } + -+ std::variant& readings = ++ const std::variant& readings = + found->second; + for (const auto& it : + EventServiceManager::getInstance().subscriptionsMap) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch index 20bcbabfa..5dd2f51bc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch @@ -1,4 +1,4 @@ -From fca6f5b951a363916a83a25f6578f95a6cf32a3e Mon Sep 17 00:00:00 2001 +From 8ba1bcc3503cafb33b1a06356d4f8f92ae23e39a Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny Date: Thu, 17 Jun 2021 13:37:57 +0000 Subject: [PATCH] Switched bmcweb to use new telemetry service API diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch index 3d60ae293..bf5a09d9d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch @@ -1,6 +1,6 @@ -From 79b3d35b864a2b545b4c9b2ac9390ea5dec169f5 Mon Sep 17 00:00:00 2001 -From: Szymon Dompke -Date: Mon, 28 Jun 2021 11:10:23 +0200 +From dab3c96f9e39a89d7c359e22655650c7c16952ec Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny +Date: Tue, 12 Oct 2021 08:06:13 +0000 Subject: [PATCH] Add support for MetricDefinition property in MetricReport Added MetricDefinition as part of MetricValues array returned by @@ -73,19 +73,19 @@ Signed-off-by: Szymon Dompke 4 files changed, 95 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build -index f6a66f1..6b5d9af 100644 +index 6b6a8ab..218ea49 100644 --- a/meson.build +++ b/meson.build -@@ -355,6 +355,8 @@ srcfiles_unittest = ['include/ut/dbus_utility_test.cpp', - 'redfish-core/ut/time_utils_test.cpp', - 'http/ut/utility_test.cpp'] +@@ -377,6 +377,8 @@ srcfiles_unittest = [ + 'http/ut/utility_test.cpp' + ] -+srcfiles_unittest_dependencies = ['redfish-core/src/error_messages.cpp'] ++srcfiles_unittest_dependencies = ['redfish-core/src/error_messages.cpp', 'src/boost_url.cpp'] + # Gather the Configuration data conf_data = configuration_data() -@@ -412,7 +414,7 @@ executable('bmcweb',srcfiles_bmcweb, +@@ -434,7 +436,7 @@ executable('bmcweb',srcfiles_bmcweb, if(get_option('tests').enabled()) foreach src_test : srcfiles_unittest testname = src_test.split('/')[-1].split('.')[0] @@ -251,7 +251,7 @@ index 7fe281d..13bf792 100644 } } // namespace telemetry diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index cb7ea15..44c2129 100644 +index 7405e5a..9850b24 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -21,6 +21,8 @@ @@ -265,3 +265,4 @@ index cb7ea15..44c2129 100644 -- 2.25.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch index 987a43b4c..a80ac61c7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch @@ -1,6 +1,6 @@ -From 472ac5f15a19917042852b243e8b668b3ab49e32 Mon Sep 17 00:00:00 2001 +From da575aaf0bdcb15be261d58314cf7bbbcd92dd74 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny -Date: Tue, 22 Jun 2021 13:59:48 +0000 +Date: Tue, 12 Oct 2021 08:08:06 +0000 Subject: [PATCH] Revert "Remove LogService from TelemetryService" This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. @@ -9,18 +9,18 @@ This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. 1 file changed, 2 insertions(+) diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 37221c3..f3a1efb 100644 +index 027b51b..49471fe 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp -@@ -30,6 +30,8 @@ inline void requestRoutesTelemetryService(App& app) - "/redfish/v1/TelemetryService/MetricReports"; - asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = - "/redfish/v1/TelemetryService/MetricDefinitions"; -+ asyncResp->res.jsonValue["LogService"]["@odata.id"] = -+ "/redfish/v1/Managers/bmc/LogServices/Journal"; +@@ -24,6 +24,8 @@ inline void handleTelemetryServiceGet( + "/redfish/v1/TelemetryService/MetricReports"; + asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; ++ asyncResp->res.jsonValue["LogService"]["@odata.id"] = ++ "/redfish/v1/Managers/bmc/LogServices/Journal"; - crow::connections::systemBus->async_method_call( - [asyncResp]( + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, -- 2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch deleted file mode 100644 index bd6e64346..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch +++ /dev/null @@ -1,93 +0,0 @@ -From d9baec3ccdff5ed4d1620f374a252c769de5b45b Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny -Date: Thu, 19 Aug 2021 10:55:38 +0000 -Subject: [PATCH] Generalize ReadingType in MetricDefinition - -Recent addition of PMT required adding new type of sensor 'count', which -doesnt comply with any of Redfish-defined Sensor.ReadingType values. - -To support property of this kind MetricDefinition implementation was -altered to support sensor types not covered by Redfish types by -a 'fallback' to direct usage of sensor type. Populating 'Units' was also -modified, so it won't be shown if value does not have any units mapped. - -Testing: -- PMT counters are shown properly in MetricDefinitions/Count -- Redfish Validator passes ---- - redfish-core/lib/metric_definition.hpp | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp -index 019168b..df29b65 100644 ---- a/redfish-core/lib/metric_definition.hpp -+++ b/redfish-core/lib/metric_definition.hpp -@@ -33,6 +33,18 @@ bool containsOdata(const nlohmann::json& json, const std::string& odataId) - return it != json.end(); - } - -+std::string groupName(const std::string& sensorType) -+{ -+ std::string group = sensors::toReadingType(sensorType); -+ if (group.empty()) -+ { -+ // Fallback for types not covered by standard Redfish Sensor.ReadingType -+ group = sensorType; -+ group[0] = static_cast(std::toupper(group[0])); -+ } -+ return group; -+} -+ - void addMembers(crow::Response& res, - const boost::container::flat_map& el) - { -@@ -52,8 +64,7 @@ void addMembers(crow::Response& res, - nlohmann::json& members = res.jsonValue["Members"]; - - const std::string odataId = -- std::string(telemetry::metricDefinitionUri) + -- sensors::toReadingType(type); -+ std::string(telemetry::metricDefinitionUri) + groupName(type); - - if (!containsOdata(members, odataId)) - { -@@ -149,15 +160,15 @@ inline void requestRoutesMetricDefinitionCollection(App& app) - namespace telemetry - { - --bool isSensorIdSupported(std::string_view readingType) -+bool isSensorIdSupported(std::string_view group) - { - for (const std::pair>& - typeToPaths : sensors::dbus::paths) - { - for (const char* supportedPath : typeToPaths.second) - { -- if (readingType == -- sensors::toReadingType( -+ if (group == -+ groupName( - sdbusplus::message::object_path(supportedPath).filename())) - { - return true; -@@ -168,7 +179,7 @@ bool isSensorIdSupported(std::string_view readingType) - } - - void addMetricProperty( -- bmcweb::AsyncResp& asyncResp, const std::string& readingType, -+ bmcweb::AsyncResp& asyncResp, const std::string& group, - const boost::container::flat_map& el) - { - nlohmann::json& metricProperties = -@@ -179,7 +190,7 @@ void addMetricProperty( - std::string sensorId; - if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) - { -- if (sensors::toReadingType(sensorId) == readingType) -+ if (groupName(sensorId) == group) - { - metricProperties.push_back(redfishSensor); - } --- -2.25.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README index fd88e9e18..90916ecec 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README @@ -3,16 +3,16 @@ Until change is integrated they will be manually merged here to enable feature i Current revisions: - Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/93 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/102 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/40 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/53 - Switched bmcweb to use new telemetry service API - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/19 - Add support for MetricDefinition property in MetricReport - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44512/9 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44512/24 - Add GET method for TriggerCollection file://telemetry/0005-Add-GET-method-for-TriggerCollection.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch index d41383836..de316c4fa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch @@ -1,4 +1,4 @@ -From 3ee7fe58b2acec0a6ae4eabad91a9dd609268870 Mon Sep 17 00:00:00 2001 +From b6863f9a0c1c36705eba0c3181541f67cd1a202a Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny Date: Wed, 14 Jul 2021 09:04:42 +0000 Subject: [PATCH] Revert "Disable nbd proxy from the build" @@ -15,21 +15,21 @@ Change-Id: I19a88b30c1074dd376f2df8f5668245b638b881f 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build -index bdc514b..19364a8 100644 +index 650a5ec..5738b10 100644 --- a/meson.build +++ b/meson.build -@@ -78,7 +78,8 @@ feature_map = { - 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', - 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', - 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', --#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', -+'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', -+'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', - 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', +@@ -83,7 +83,8 @@ feature_map = { + 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', + 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', + 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', +- #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++ 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', ++ 'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', + 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', } diff --git a/meson_options.txt b/meson_options.txt -index 0ab31b8..ea0f2fc 100644 +index ff5b887..645f224 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,14 +3,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT @@ -48,7 +48,7 @@ index 0ab31b8..ea0f2fc 100644 option('rest', type : 'feature', value : 'enabled', description : '''Enable Phosphor REST (D-Bus) APIs. Paths directly map Phosphor D-Bus object paths, for example, \'/xyz/openbmc_project/logging/entry/enumerate\'. See https://github.com/openbmc/docs/blob/master/rest-api.md.''') option('redfish', type : 'feature',value : 'enabled', description: 'Enable Redfish APIs. Paths are under \'/redfish/v1/\'. See https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#redfish.') option('host-serial-socket', type : 'feature', value : 'enabled', description : 'Enable host serial console WebSocket. Path is \'/console0\'. See https://github.com/openbmc/docs/blob/master/console.md.') -@@ -37,6 +30,7 @@ option ('https_port', type : 'integer', min : 1, max : 65535, value : 443, descr +@@ -39,6 +32,7 @@ option ('https_port', type : 'integer', min : 1, max : 65535, value : 443, descr # the implications of doing so.In general, enabling these options will cause security # problems of varying degrees @@ -57,5 +57,5 @@ index 0ab31b8..ea0f2fc 100644 option ('insecure-disable-ssl', type : 'feature', value : 'disabled', description : 'Disable SSL ports. Should be set to false for production systems.') option ('insecure-disable-auth', type : 'feature', value : 'disabled', description : 'Disable authentication on all ports. Should be set to false for production systems') -- -2.25.1 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch index 41c1c9836..c8af3a659 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch @@ -1,4 +1,4 @@ -From d303bfdd6778c43096401ff78fab70f9041cd4cf Mon Sep 17 00:00:00 2001 +From 1abf9a1d336eed835472fe933210d3be7ad5ba7a Mon Sep 17 00:00:00 2001 From: Karol Wachowski Date: Thu, 11 Feb 2021 08:35:41 +0000 Subject: [PATCH] Add ConnectedVia property to virtual media item template @@ -12,12 +12,12 @@ Signed-off-by: Karol Wachowski 1 file changed, 1 insertion(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index c45fed2..aa7c639 100644 +index 57c2bd2..de1cc94 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -193,6 +193,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, - item["@odata.id"] = - "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; +@@ -200,6 +200,7 @@ inline nlohmann::json vmItemTemplate(const std::string& name, + item["@odata.id"] = std::move(id); + item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; + item["ConnectedVia"] = "NotConnected"; item["Name"] = "Virtual Removable Media"; 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 7806b5481..a716e612d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,8 +1,7 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "abb93cdd0a49be03bf2fe95f07823686b289ecd5" +SRCREV = "b7ff344535c42af074c60bfb272ef66a2ba157b4" DEPENDS += "boost-url" -RDEPENDS:${PN} += "phosphor-nslcd-authority-cert-config" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" @@ -25,9 +24,9 @@ SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch \ file://0019-Add-generic-message-PropertySizeExceeded.patch \ file://0020-Redfish-Deny-set-AccountLockDuration-to-zero.patch \ - file://0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch \ file://0023-Add-get-IPMI-session-id-s-to-Redfish.patch \ file://0024-Add-count-sensor-type.patch \ + file://0025-Add-Model-CoreCount-to-ProcessorSummary.patch \ " # OOB Bios Config: @@ -50,7 +49,7 @@ SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details -SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch \ +SRC_URI += "file://eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch \ file://eventservice/0002-EventService-https-client-support.patch \ file://eventservice/0004-Add-Server-Sent-Events-support.patch \ file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ @@ -59,6 +58,7 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch \ file://eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch \ file://eventservice/0010-Remove-Terminated-Event-Subscriptions.patch \ + file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details @@ -69,20 +69,23 @@ SRC_URI += " file://telemetry/0001-Add-support-for-MetricDefinition-scheme.patch file://telemetry/0005-Add-GET-method-for-TriggerCollection.patch \ file://telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch \ file://telemetry/0007-event-service-fix-added-Context-field-to-response.patch \ - file://telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch \ file://telemetry/0009-Add-support-for-deleting-terminated-subscriptions.patch \ " +# Temporary downstream patch for routing and privilege changes +SRC_URI += " file://http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch \ + file://http_routing/0002-Move-privileges-to-separate-entity.patch \ + file://http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch \ + file://http_routing/0004-Add-Privileges-to-Websockets.patch \ + file://http_routing/0005-Add-Privileges-to-SseSockets.patch \ +" + # Temporary fix: Move it to service file do_install:append() { install -d ${D}/var/lib/bmcweb install -d ${D}/etc/ssl/certs/authority } -# Temporary fix:Enable new power and thermal subsystem -EXTRA_OEMESON += " -Dredfish-new-powersubsystem-thermalsubsystem=enabled" -EXTRA_OEMESON += " -Dredfish-allow-deprecated-power-thermal=disabled" - # Enable PFR support EXTRA_OEMESON += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-Dredfish-provisioning-feature=enabled', '', d)}" 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 fd45b0e1c..87aab6f79 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,6 +1,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" +#SRC_URI += "git://github.com/openbmc/phosphor-host-ipmid" +SRCREV = "78fe1b14f60d55ae335369fb2c6e81ed9ac6d865" + SRC_URI += "file://phosphor-ipmi-host.service \ file://0010-fix-get-system-GUID-ipmi-command.patch \ file://0053-Fix-keep-looping-issue-when-entering-OS.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend index 1ddd13477..caf25fdd6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/ipmbbridge.git" -SRCREV = "bd78df6be9f677136ca190d50101c328267ddcd2" +SRCREV = "8227626764edf13350c5f5a5857298a905fb43f7" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch \ file://0002-Add-log-count-limitation-to-requestAdd.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index 08b96ad71..fd1677543 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -11,7 +11,7 @@ SMM_DEVICE = "ipmi_kcs4" SYSTEMD_SERVICE:${PN}:append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" -SRCREV = "03e6defcbca99c9c00cd37c4afb1d2b415a92acd" +SRCREV = "7580a8e60d868b5bcb1a8f8d276374afe7c0983a" SRC_URI += "file://99-ipmi-kcs.rules" 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 bde839859..a0b507cb8 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 = "1c5b3ab05817d62a11f75c2a90b6891b18bf62cc" +SRCREV = "5819666c23ee1d01a54fc5fb2c068bb1da1f29c7" 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 3be0d30b4..14093cf3e 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://github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "928d0994c7d8c1cc20dc69b763ecd62dcf8ab276" +SRCREV = "9aca80fa2a405938de99aae777e6cfcf08525563" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend new file mode 100644 index 000000000..6d9294635 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" + +# SRC_URI = "git://github.com/openbmc/phosphor-snmp" +SRCREV = "d560529eb7e22c0b78fb0def20f57c6f35be9dfe" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend index 119cd9657..e7c5d1af3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/peci-pcie" -SRCREV = "8e96603605eebd574bb00cd35e7fa118071aeeae" +SRCREV = "de624395a587be555463a14a3db90500b4e0521c" EXTRA_OECMAKE += "-DWAIT_FOR_OS_STANDBY=1 -DUSE_RDENDPOINTCFG=1" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb index 770870f1e..592d6ae0c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp:intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "52117fa04e6afabe8eb1285c702f1400fecfb992" +SRCREV = "d530c2271e1f9ff5d76a170c0abd64bd03ef40fd" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb index 3e2bfc603..162b4ed74 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/libpldm_intel" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index 128f6b544..fda4d6b79 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctp_emulator" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb index 10dd1cf29..05e64ed46 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctp_wrapper" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 4ab99cae9..8b088be23 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb index 87ac63624..b1c40ab61 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctpwplus" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb index 351d584d1..84c2c8066 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "29b49789236b89910af816e4606aab4126a56a4b" +SRCREV = "c3d5021fb60cd46d5c948c69f3d57ac9648b5be5" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb index 091865b39..16253b5d0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/pldmd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb index dc4c03ae8..c640c5664 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/pmci_launcher" 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 a7df530cd..79971942a 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://github.com/Intel-BMC/provisioning-mode-manager.git;protocol=ssh" -SRCREV = "ea03e4e87f5d5f0d873624b46ebc3deabb8d6ebe" +SRCREV = "0aca01b4ce9b303e12ba0f757f56390da139c8bb" 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 1fcbd958e..8c2eeb83f 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,4 +1,4 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git" -SRCREV = "a138ebd3c759f95c53d61170c05e69bf31718114" +SRCREV = "87e3fcf439f2b943272365e1d294984f39bb52b8" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch index 65558aba5..214fbe888 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch @@ -1,4 +1,4 @@ -From 8f850ea8745aa7aafcb504aa50686ba00fdfcfee Mon Sep 17 00:00:00 2001 +From 221aaf1431a01fefb5e7df2461a1c691738a50a7 Mon Sep 17 00:00:00 2001 From: Zhikui Ren Date: Fri, 19 Feb 2021 12:14:05 -0800 Subject: [PATCH] Fan Tach Sensor Threshold Ignore Zero @@ -22,22 +22,18 @@ No cr event for the missing fans. Signed-off-by: Zhikui Ren --- - src/TachSensor.cpp | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) + src/TachSensor.cpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp -index 1ec979f..b17be98 100644 +index c375dbf..e85a2a2 100644 --- a/src/TachSensor.cpp +++ b/src/TachSensor.cpp -@@ -185,12 +185,18 @@ void TachSensor::handleResponse(const boost::system::error_code& err) +@@ -186,10 +186,16 @@ void TachSensor::checkThresholds(void) + // WA - treat value <= 0 as not present + bool status = false; - void TachSensor::checkThresholds(void) - { -- bool status = thresholds::checkThresholds(this); -- - if (redundancy && *redundancy) -+ // WA - treat value <= 0 as not present -+ bool status = false; + if (value > 0) { - (*redundancy) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch index 0a6e73708..2083adfef 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -1,4 +1,4 @@ -From ba069b63307352ae0dc0a94a837306dc0bc51e94 Mon Sep 17 00:00:00 2001 +From 6ace96be5a7b6763545c1dfc572f8e2790d99d4b Mon Sep 17 00:00:00 2001 From: Zhikui Ren Date: Tue, 11 May 2021 11:14:55 -0700 Subject: [PATCH] CPUSensor: create RequiredTempSensor if defined @@ -23,12 +23,12 @@ failure case. More work will follow to support a more generic Signed-off-by: Zhikui Ren --- include/CPUSensor.hpp | 9 ++++++ - src/CPUSensor.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ - src/CPUSensorMain.cpp | 54 ++++++++++++++++++++++++++++----- - 3 files changed, 124 insertions(+), 8 deletions(-) + src/CPUSensor.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++ + src/CPUSensorMain.cpp | 54 +++++++++++++++++++++++++++++----- + 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 29b8209..5d09e4e 100644 +index 8b51b76..93b7fcc 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp @@ -26,6 +26,15 @@ class CPUSensor : public Sensor @@ -48,10 +48,10 @@ index 29b8209..5d09e4e 100644 static constexpr unsigned int sensorScaleFactor = 1000; static constexpr unsigned int sensorPollMs = 1000; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index c882698..277dd3f 100644 +index c330088..3861ade 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, +@@ -98,6 +98,74 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, setupRead(); } @@ -64,9 +64,8 @@ index c882698..277dd3f 100644 + boost::asio::io_service& io, const std::string& sensorName, + std::vector&& thresholdsIn, + const std::string& sensorConfiguration) : -+ Sensor(boost::replace_all_copy(sensorName, " ", "_"), -+ std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, -+ 0, conn, PowerState::on), ++ Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration, ++ objectType, false, false, 0, 0, conn, PowerState::on), + objServer(objectServer), inputDev(io), waitTimer(io), + privTcontrol(std::numeric_limits::quiet_NaN()), dtsOffset(0), + show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) @@ -128,10 +127,10 @@ index c882698..277dd3f 100644 { // close the input dev to cancel async operations diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index c565890..a28a5be 100644 +index 0d94e4b..1d12fa6 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -333,10 +333,9 @@ bool createSensors(boost::asio::io_service& io, +@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, { if (debug) { @@ -144,7 +143,7 @@ index c565890..a28a5be 100644 } // check hidden properties -@@ -637,9 +636,9 @@ void detectCpuAsync( +@@ -636,9 +635,9 @@ void detectCpuAsync( }); } @@ -156,7 +155,7 @@ index c565890..a28a5be 100644 sdbusplus::asio::object_server& objectServer) { bool useCache = false; -@@ -701,6 +700,45 @@ bool getCpuConfig(const std::shared_ptr& systemBus, +@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr& systemBus, iface->register_property("Present", *present); iface->initialize(); inventoryIfaces[name] = std::move(iface); @@ -202,7 +201,7 @@ index c565890..a28a5be 100644 } auto findBus = config.second.find("Bus"); -@@ -729,7 +767,6 @@ bool getCpuConfig(const std::shared_ptr& systemBus, +@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr& systemBus, std::cout << "name: " << name << "\n"; std::cout << "type: " << type << "\n"; } @@ -210,7 +209,7 @@ index c565890..a28a5be 100644 cpuConfigs.emplace(bus, addr, name, State::OFF); } } -@@ -765,7 +802,8 @@ int main() +@@ -764,7 +801,8 @@ int main() return; // we're being canceled } @@ -220,7 +219,7 @@ index c565890..a28a5be 100644 { detectCpuAsync(pingTimer, creationTimer, io, objectServer, systemBus, cpuConfigs, sensorConfigs); -@@ -793,7 +831,7 @@ int main() +@@ -792,7 +830,7 @@ int main() return; // we're being canceled } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch index dbe851fde..daaca7fae 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch @@ -1,4 +1,4 @@ -From b839028a4dda6fcec027f3a26887e0de0e8172bb Mon Sep 17 00:00:00 2001 +From 9f5ef2e8d9c34d9d9ddce34d450aaedd5c122b22 Mon Sep 17 00:00:00 2001 From: Szymon Dompke Date: Tue, 18 May 2021 05:22:33 +0200 Subject: [PATCH] Add support for the energy hwmon type @@ -31,13 +31,13 @@ Tested: Authored-by: Zbigniew Kurzynski Signed-off-by: Szymon Dompke --- - include/CPUSensor.hpp | 13 ++++++-- - src/CPUSensor.cpp | 69 +++++++++++++++---------------------------- + include/CPUSensor.hpp | 13 +++++++-- + src/CPUSensor.cpp | 68 +++++++++++++++---------------------------- src/CPUSensorMain.cpp | 30 ++++++++++++++++--- - 3 files changed, 60 insertions(+), 52 deletions(-) + 3 files changed, 60 insertions(+), 51 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 5d09e4e..cb3742a 100644 +index 93b7fcc..76e43dc 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp @@ -16,6 +16,15 @@ @@ -82,21 +82,20 @@ index 5d09e4e..cb3742a 100644 void handleResponse(const boost::system::error_code& err); void checkThresholds(void) override; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 277dd3f..0621e04 100644 +index 3861ade..6737151 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -39,59 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, +@@ -39,58 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, boost::asio::io_service& io, const std::string& sensorName, std::vector&& thresholdsIn, const std::string& sensorConfiguration, int cpuId, - bool show, double dtsOffset) : + bool show, double dtsOffset, + const SensorProperties& sensorProperties) : - Sensor(boost::replace_all_copy(sensorName, " ", "_"), -- std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, -- 0, conn, PowerState::on), -+ std::move(thresholdsIn), sensorConfiguration, objectType, false, -+ sensorProperties.max, sensorProperties.min, conn, PowerState::on), + Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration, +- objectType, false, false, 0, 0, conn, PowerState::on), ++ objectType, false, false, sensorProperties.max, sensorProperties.min, ++ conn, PowerState::on), objServer(objectServer), inputDev(io), waitTimer(io), path(path), privTcontrol(std::numeric_limits::quiet_NaN()), dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), @@ -152,12 +151,12 @@ index 277dd3f..0621e04 100644 - setInitialProperties(conn, units); + thresholdInterfaceWarning = objectServer.add_interface( + interfacePath, "xyz.openbmc_project.Sensor.Threshold.Warning"); -+ } + } + if (thresholds::hasCriticalInterface(thresholds)) + { + thresholdInterfaceCritical = objectServer.add_interface( + interfacePath, "xyz.openbmc_project.Sensor.Threshold.Critical"); - } ++ } + association = + objectServer.add_interface(interfacePath, association::interface); + @@ -165,7 +164,7 @@ index 277dd3f..0621e04 100644 } // call setup always as not all sensors call setInitialProperties -@@ -248,7 +226,7 @@ void CPUSensor::updateMinMaxValues(void) +@@ -248,7 +227,7 @@ void CPUSensor::updateMinMaxValues(void) auto& [suffix, oldValue, dbusName, newValue] = vectorItem; auto attrPath = boost::replace_all_copy(path, fileItem, suffix); @@ -174,7 +173,7 @@ index 277dd3f..0621e04 100644 { newValue.get() = *tmp; } -@@ -302,7 +280,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -302,7 +281,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) std::getline(responseStream, response); rawValue = std::stod(response); responseStream.clear(); @@ -183,7 +182,7 @@ index 277dd3f..0621e04 100644 if (show) { -@@ -328,8 +306,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -328,8 +307,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) { std::vector newThresholds; if (parseThresholdsFromAttr(newThresholds, path, @@ -194,12 +193,12 @@ index 277dd3f..0621e04 100644 if (!std::equal(thresholds.begin(), thresholds.end(), newThresholds.begin(), diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index a28a5be..baa2bb6 100644 +index 1d12fa6..e348aa7 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -94,6 +94,18 @@ static constexpr std::array sensorTypes = {"XeonCPU"}; - static constexpr std::array hiddenProps = { - CPUSensor::labelTcontrol, "Tthrottle", "Tjmax"}; +@@ -94,6 +94,18 @@ static constexpr auto sensorTypes{std::to_array({"XeonCPU"})}; + static constexpr auto hiddenProps{std::to_array( + {CPUSensor::labelTcontrol, "Tthrottle", "Tjmax"})}; +static const boost::container::flat_map + sensorPropertiesMap = { @@ -216,7 +215,7 @@ index a28a5be..baa2bb6 100644 void detectCpuAsync( boost::asio::deadline_timer& pingTimer, boost::asio::deadline_timer& creationTimer, boost::asio::io_service& io, -@@ -297,7 +309,8 @@ bool createSensors(boost::asio::io_service& io, +@@ -296,7 +308,8 @@ bool createSensors(boost::asio::io_service& io, auto directory = hwmonNamePath.parent_path(); std::vector inputPaths; @@ -226,7 +225,7 @@ index a28a5be..baa2bb6 100644 inputPaths, 0)) { std::cerr << "No temperature sensors in system\n"; -@@ -365,6 +378,16 @@ bool createSensors(boost::asio::io_service& io, +@@ -364,6 +377,16 @@ bool createSensors(boost::asio::io_service& io, } } @@ -243,7 +242,7 @@ index a28a5be..baa2bb6 100644 std::vector sensorThresholds; std::string labelHead = label.substr(0, label.find(' ')); parseThresholdsFromConfig(*sensorData, sensorThresholds, -@@ -372,8 +395,7 @@ bool createSensors(boost::asio::io_service& io, +@@ -371,8 +394,7 @@ bool createSensors(boost::asio::io_service& io, if (sensorThresholds.empty()) { if (!parseThresholdsFromAttr(sensorThresholds, inputPathStr, @@ -253,7 +252,7 @@ index a28a5be..baa2bb6 100644 { std::cerr << "error populating thresholds for " << sensorName << "\n"; -@@ -385,7 +407,7 @@ bool createSensors(boost::asio::io_service& io, +@@ -384,7 +406,7 @@ bool createSensors(boost::asio::io_service& io, sensorPtr = std::make_unique( inputPathStr, sensorType, objectServer, dbusConnection, io, sensorName, std::move(sensorThresholds), *interfacePath, cpuId, 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 ccffb1e58..765ad3739 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,7 +1,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "1e34cecad498e89fb52b4c73cb19e62a297f2329" +SRCREV = "77518b28db824e01af18351094680a99b1ba3cae" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ 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 7820d805b..d17aebf00 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://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "5f413eec673f3e6e5e754e2c55048abf0a146e5b" +SRCREV = "42a0ba3c61ae38cc84b06705159065860492fc2e" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend index 8732ccd40..a4e894cbc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend @@ -1,2 +1,2 @@ #SRC_URI = "git://github.com/openbmc/phosphor-post-code-manager.git" -SRCREV = "aed7b3de090005433b16ca986ed3df4dbc81446f" +SRCREV = "9ce5a645f50c0ab94e582abbf95474f636aba678" 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 0483ced61..b123ddb35 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 = "1a9dde9b193a34392ab11a14d9cd0310f9abb930" +SRCREV = "0c5059f685f6df0704a4b773f2e617cf10d03210" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend index 68e8ee6ac..ebd808168 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "93064d8fcef2c6fde1f61c0cedacb46b21eab039" +SRCREV = "e28aa53dc1492f09a64dc9f1dbfd5b6dba06e31f" EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend index 718829194..21c7991bd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "372c5668c0ed893f53edc0f9fa880cb50b48f203" +SRCREV = "c0760c9109a0d847fd77d54c6b7948322a375d1d" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" @@ -10,7 +10,7 @@ SRC_URI += " \ file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ " -FILES:${PN} += "/dbus-1/system.d/phosphor-nslcd-cert-config.conf" +FILES:${PN} += "${datadir}/dbus-1/system.d/phosphor-nslcd-cert-config.conf" FILES:${PN} += "/usr/share/phosphor-certificate-manager/nslcd" FILES:${PN} += "\ - /lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service" \ No newline at end of file + /lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service" 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 deleted file mode 100644 index f8ddf7892..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb +++ /dev/null @@ -1,31 +0,0 @@ - -SUMMARY = "FRB2 timer service" -DESCRIPTION = "The FRB2 timer service will monitor the mailbox register 0\ -and start a watchdog for FRB2 if the data is 1(BIOS will write this value)" - -SRC_URI = "\ - file://CMakeLists.txt;subdir=${BP} \ - file://frb2-watchdog.cpp;subdir=${BP} \ - " -PV = "0.1" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" - -inherit cmake -inherit pkgconfig - -DEPENDS += " \ - systemd \ - sdbusplus \ - phosphor-logging \ - phosphor-dbus-interfaces \ - boost \ - " - -RDEPENDS:${PN} += " \ - libsystemd \ - sdbusplus \ - phosphor-logging \ - phosphor-dbus-interfaces \ - " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format deleted file mode 100644 index dd2770837..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format +++ /dev/null @@ -1,98 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlinesLeft: false -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -BreakBeforeTernaryOperators: true -BreakConstructorInitializers: AfterColon -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: true -PointerAlignment: Left -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^[<"](gtest|gmock)' - Priority: 5 - - Regex: '^"config.h"' - Priority: -1 - - Regex: '^".*\.hpp"' - Priority: 1 - - Regex: '^<.*\.h>' - Priority: 2 - - Regex: '^<.*' - Priority: 3 - - Regex: '.*' - Priority: 4 -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -ReflowComments: true -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never -... diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt deleted file mode 100644 index bd5567d31..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -cmake_minimum_required (VERSION 3.5 FATAL_ERROR) -project (frb2-watchdog CXX) -set (CMAKE_CXX_STANDARD 17) -set (CMAKE_CXX_STANDARD_REQUIRED ON) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") - -include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - -# boost support -find_package (Boost REQUIRED) -# pkg_check_modules(Boost boost REQUIRED) -include_directories (${Boost_INCLUDE_DIRS}) -add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) -add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) -add_definitions (-DBOOST_ALL_NO_LIB) -add_definitions (-DBOOST_NO_RTTI) -add_definitions (-DBOOST_NO_TYPEID) -add_definitions (-DBOOST_ASIO_DISABLE_THREADS) - -# import libsystemd -find_package (PkgConfig REQUIRED) -pkg_check_modules (SYSTEMD libsystemd REQUIRED) -include_directories (${SYSTEMD_INCLUDE_DIRS}) -link_directories (${SYSTEMD_LIBRARY_DIRS}) - -# import sdbusplus -find_package (PkgConfig REQUIRED) -pkg_check_modules (SDBUSPLUSPLUS sdbusplus REQUIRED) -include_directories (${SDBUSPLUSPLUS_INCLUDE_DIRS}) -link_directories (${SDBUSPLUSPLUS_LIBRARY_DIRS}) - -# import phosphor-logging -find_package (PkgConfig REQUIRED) -pkg_check_modules (LOGGING phosphor-logging REQUIRED) -include_directories (${LOGGING_INCLUDE_DIRS}) -link_directories (${LOGGING_LIBRARY_DIRS}) - -# import phosphor-dbus-interfaces -find_package (PkgConfig REQUIRED) -pkg_check_modules (DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) -include_directories (${DBUSINTERFACE_INCLUDE_DIRS}) -link_directories (${DBUSINTERFACE_LIBRARY_DIRS}) - -add_executable (frb2-watchdog frb2-watchdog.cpp) - -target_link_libraries (${PROJECT_NAME} systemd) -target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES}) -target_link_libraries (${PROJECT_NAME} ${SDBUSPLUSPLUS_LIBRARIES}) -target_link_libraries (${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES} - phosphor_logging) -install (TARGETS frb2-watchdog DESTINATION bin) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json deleted file mode 100644 index 583c255a3..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "enum_char": ".", - "line_ending": "unix", - "bullet_char": "*", - "max_subargs_per_line": 99, - "command_case": "lower", - "tab_size": 4, - "line_width": 80, - "separate_fn_name_with_space": true, - "dangle_parens": true, - "separate_ctrl_name_with_space": true -} \ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp deleted file mode 100644 index bae54f335..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright 2018 Intel - * - * 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. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void handleResponse(const boost::system::error_code &err, - std::size_t bytes_transferred); - -static int mailboxDevFd = -1; - -static boost::asio::io_service io; -static auto conn = std::make_shared(io); -boost::asio::ip::tcp::socket mailBoxDevSocket(io); -boost::asio::deadline_timer pollTimer(io); -boost::asio::posix::stream_descriptor inputDevice(io); - -// mailbox registre data[0:0] for FRB2 enable bit -boost::asio::streambuf readBuf(1); -std::string dataRead; - -// FRB2 watchdog timeout is 6 minutes -static constexpr unsigned int frb2TimerIntervalMs = 360 * 1000; - -// mailbox device polling time interval is 2 seconds -static constexpr unsigned int pollMs = 2000; - -static constexpr unsigned int frb2Started = 1; -static constexpr unsigned int frb2Stopped = 0; - -// FRB2 status -static uint8_t frb2Status = frb2Stopped; - -static constexpr const char *mailboxDevName = "/dev/aspeed-mbox"; - -static constexpr const char frb2Bus[] = "xyz.openbmc_project.FRB2"; -static constexpr const char frb2Obj[] = "/xyz/openbmc_project/FRB2"; -static constexpr const char frb2Intf[] = "xyz.openbmc_project.FRB2"; - -static constexpr char powerBus[] = "xyz.openbmc_project.Chassis.Control.Power"; -static constexpr char powerPath[] = - "/xyz/openbmc_project/Chassis/Control/Power0"; -static constexpr char powerIntf[] = "xyz.openbmc_project.Chassis.Control.Power"; - -static constexpr char wdBus[] = "xyz.openbmc_project.Watchdog"; -static constexpr char wdPath[] = "/xyz/openbmc_project/watchdog/host0"; -static constexpr char wdIntf[] = "xyz.openbmc_project.State.Watchdog"; -static constexpr char propIntf[] = "org.freedesktop.DBus.Properties"; - -typedef boost::asio::buffers_iterator iterator; - -// check if FRB2 bit is 0x1 -std::pair matchFRB2(iterator begin, iterator end) -{ - unsigned char ch = 0; - iterator i = begin; - - while (i != end) - { - ch = static_cast(*i); - if (ch & 0x1) - { - return std::make_pair(i, true); - } - i++; - } - - return std::make_pair(i, false); -} - -static void startRead() -{ - boost::asio::async_read_until(inputDevice, readBuf, matchFRB2, - [&](const boost::system::error_code &ec, - std::size_t bytes_transferred) { - handleResponse(ec, bytes_transferred); - }); -} - -template void setProperty(const std::string &key, const T &val) -{ - phosphor::logging::log( - "setProperty", phosphor::logging::entry("KEY=%s", key.c_str())); - - try - { - conn->async_method_call( - [](const boost::system::error_code &err) { - if (err) - { - phosphor::logging::log( - "async_method_call error!", - phosphor::logging::entry( - "ERROR=%s", - boost::system::system_error(err).what())); - } - }, - wdBus, wdPath, propIntf, "Set", wdIntf, key, std::variant(val)); - } - catch (sdbusplus::exception::SdBusError &e) - { - phosphor::logging::log( - "Dbus error!", phosphor::logging::entry("ERROR=%s", e.what())); - } -} -void handleResponse(const boost::system::error_code &err, - std::size_t bytes_transferred) -{ - std::istream responseStream(&readBuf); - std::string response; - int n = 0; - uint64_t interval = frb2TimerIntervalMs; - - std::getline(responseStream, response); - responseStream.clear(); - - if (err == boost::system::errc::bad_file_descriptor) - { - - phosphor::logging::log( - "bad file descriptor"); - return; // we're being destroyed - } - - if (!err) - { - // FRB2 is set by BIOS - if (frb2Stopped == frb2Status) - { - // start FRB2 watchdog - frb2Status = frb2Started; - phosphor::logging::log( - "FRB2 enable, start FRB2 watchdog"); - setProperty( - "ExpireAction", - std::string( - "xyz.openbmc_project.State.Watchdog.Action.HardReset")); - setProperty("Interval", interval); - setProperty("TimeRemaining", interval); - setProperty("Initialized", true); - setProperty("Enabled", true); - } - } - else if (err == boost::asio::error::misc_errors::not_found) - { - // FRB2 is clear, stop FRB2 watchdog if it is started - if (frb2Started == frb2Status) - { - frb2Status = frb2Stopped; - phosphor::logging::log( - "FRB2 is unset, stop FRB2 watchdog"); - setProperty("Enabled", false); - } - } - else - { - phosphor::logging::log( - "handleResponse error!", - phosphor::logging::entry("ERROR=%s", - boost::system::system_error(err).what())); - } - - pollTimer.expires_from_now(boost::posix_time::milliseconds(pollMs)); - pollTimer.async_wait( - [](const boost::system::error_code &ec) { startRead(); }); -} - -int main(int argc, char **argv) -{ - phosphor::logging::log( - "Monitor FRB2 signal"); - - sdbusplus::bus::match_t biosPostSignal( - static_cast(*conn), - sdbusplus::bus::match::rules::type::signal() + - sdbusplus::bus::match::rules::member("PostCompleted") + - sdbusplus::bus::match::rules::path(powerPath) + - sdbusplus::bus::match::rules::interface(powerIntf), - [](sdbusplus::message::message &msg) { - uint8_t value = 0; - ssize_t rc = 0; - phosphor::logging::log( - "BIOS post completed signal"); - // stop FRB2 and clean mailbox - value = 0; - rc = ::pwrite(mailboxDevFd, &value, 1, 0); - if (rc != 1) - { - phosphor::logging::log( - "mailbox write error!"); - } - setProperty("Enabled", false); - frb2Status = frb2Stopped; - return; - }); - - conn->request_name(frb2Bus); - - auto server = sdbusplus::asio::object_server(conn); - - std::shared_ptr frb2Iface = - server.add_interface(frb2Obj, frb2Intf); - - frb2Iface->register_property("frb2Status", frb2Status); - - frb2Iface->initialize(); - - mailboxDevFd = ::open(mailboxDevName, O_RDWR | O_CLOEXEC); - if (mailboxDevFd < 0) - { - phosphor::logging::log( - "mailbox device open fail!"); - return -1; - } - - inputDevice.assign(mailboxDevFd); - - startRead(); - - io.run(); - - ::close(mailboxDevFd); - - return 0; -} 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 a403c4ec8..19db93805 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,4 +1,4 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS:prepend:intel := "${THISDIR}/${PN}:" -SRCREV = "2397c142c0d75c7705757a52848945b00928232d" +SRCREV = "b5707d7648de19350b3f308b9602c888c6418d6f" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch deleted file mode 100644 index 1068f8518..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 3b32612a73088b48486d38f46c780dfe3b8d463f Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" -Date: Fri, 24 Sep 2021 14:46:36 -0700 -Subject: [PATCH] Undo the unrelated package changes from the axios update - -When I pushed the update to axios, the npm commands changed other -packages as well. I assumed this was expected but have since been -seeing issues with nlf able to get license information. - -This reverts the non-axios changes from the previous update. - -Tested: -Built and logged into the web UI successfully. Also successfully -ran nlf a few times to get node license info. - -Change-Id: Idc03c1154861ccd493322e226814b20cc988bb00 -Signed-off-by: Jason M. Bills ---- - package-lock.json | 62 ++++++++++++++++++++--------------------------- - 1 file changed, 26 insertions(+), 36 deletions(-) - -diff --git a/package-lock.json b/package-lock.json -index df71815..413dd62 100644 ---- a/package-lock.json -+++ b/package-lock.json -@@ -4155,6 +4155,18 @@ - "supports-color": "^7.0.0" - } - }, -+ "loader-utils": { -+ "version": "2.0.0", -+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", -+ "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", -+ "dev": true, -+ "optional": true, -+ "requires": { -+ "big.js": "^5.2.2", -+ "emojis-list": "^3.0.0", -+ "json5": "^2.1.2" -+ } -+ }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", -@@ -4188,6 +4200,18 @@ - "webpack-sources": "^1.4.3" - } - }, -+ "vue-loader-v16": { -+ "version": "npm:vue-loader@16.1.2", -+ "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz", -+ "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==", -+ "dev": true, -+ "optional": true, -+ "requires": { -+ "chalk": "^4.1.0", -+ "hash-sum": "^2.0.0", -+ "loader-utils": "^2.0.0" -+ } -+ }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", -@@ -5552,14 +5576,7 @@ - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { -- "follow-redirects": "^1.14.0" -- }, -- "dependencies": { -- "follow-redirects": { -- "version": "1.14.4", -- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", -- "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==" -- } -+ "follow-redirects": "^1.10.0" - } - }, - "babel-code-frame": { -@@ -10030,8 +10047,7 @@ - "follow-redirects": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", -- "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==", -- "dev": true -+ "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" - }, - "for-each": { - "version": "0.3.3", -@@ -19486,32 +19502,6 @@ - } - } - }, -- "vue-loader-v16": { -- "version": "npm:vue-loader@16.8.1", -- "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz", -- "integrity": "sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ==", -- "dev": true, -- "optional": true, -- "requires": { -- "chalk": "^4.1.0", -- "hash-sum": "^2.0.0", -- "loader-utils": "^2.0.0" -- }, -- "dependencies": { -- "loader-utils": { -- "version": "2.0.0", -- "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", -- "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", -- "dev": true, -- "optional": true, -- "requires": { -- "big.js": "^5.2.2", -- "emojis-list": "^3.0.0", -- "json5": "^2.1.2" -- } -- } -- } -- }, - "vue-router": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.1.tgz", --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg new file mode 100644 index 000000000..0976f72e8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg new file mode 100644 index 000000000..dc449a1b6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg @@ -0,0 +1,31 @@ + + + + + + + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend index ed29c89df..1273ebb29 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend @@ -1,12 +1,15 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "6a192d526c9efebf7a614a9aa473eee62e555fc5" +SRCREV = "2a2e1021f48e2a939859ba7f4ae86c5de6df5655" FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" SRC_URI += " \ - file://0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch \ + file://login-company-logo.svg \ + file://logo-header.svg \ " do_compile:prepend() { cp -vf ${S}/.env.intel ${S}/.env + cp -vf ${WORKDIR}/login-company-logo.svg ${S}/src/assets/images + cp -vf ${WORKDIR}/logo-header.svg ${S}/src/assets/images } diff --git a/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.78.0.bb b/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.78.0.bb deleted file mode 100644 index 5b62fe2e7..000000000 --- a/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.78.0.bb +++ /dev/null @@ -1,89 +0,0 @@ -SUMMARY = "Command line tool and library for client-side URL transfers" -DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \ -curl is a widely used because of its ability to be flexible and complete \ -complex tasks. For example, you can use curl for things like user authentication, \ -HTTP post, SSL connections, proxy support, FTP uploads, and more!" -HOMEPAGE = "http://curl.haxx.se/" -BUGTRACKER = "http://curl.haxx.se/mail/list.cgi?list=curl-tracker" -SECTION = "console/network" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=425f6fdc767cc067518eef9bbdf4ab7b" - -SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \ - file://0001-replace-krb5-config-with-pkg-config.patch \ -" - -SRC_URI[sha256sum] = "98530b317dc95ccb324bbe4f834f07bb642fbc393b794ddf3434f246a71ea44a" - -# Curl has used many names over the years... -CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" - -inherit autotools pkgconfig binconfig multilib_header - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} ssl libidn proxy threaded-resolver verbose zlib" -PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver verbose zlib" -PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl threaded-resolver verbose zlib" - -# 'ares' and 'threaded-resolver' are mutually exclusive -PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares,,,threaded-resolver" -PACKAGECONFIG[brotli] = "--with-brotli,--without-brotli,brotli" -PACKAGECONFIG[builtinmanual] = "--enable-manual,--disable-manual" -PACKAGECONFIG[dict] = "--enable-dict,--disable-dict," -PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls" -PACKAGECONFIG[gopher] = "--enable-gopher,--disable-gopher," -PACKAGECONFIG[imap] = "--enable-imap,--disable-imap," -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," -PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5" -PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap," -PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps," -PACKAGECONFIG[libgsasl] = "--with-libgsasl,--without-libgsasl,libgsasl" -PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2" -PACKAGECONFIG[libssh2] = "--with-libssh2,--without-libssh2,libssh2" -PACKAGECONFIG[mbedtls] = "--with-mbedtls=${STAGING_DIR_TARGET},--without-mbedtls,mbedtls" -PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt," -PACKAGECONFIG[nghttp2] = "--with-nghttp2,--without-nghttp2,nghttp2" -PACKAGECONFIG[pop3] = "--enable-pop3,--disable-pop3," -PACKAGECONFIG[proxy] = "--enable-proxy,--disable-proxy," -PACKAGECONFIG[rtmpdump] = "--with-librtmp,--without-librtmp,rtmpdump" -PACKAGECONFIG[rtsp] = "--enable-rtsp,--disable-rtsp," -PACKAGECONFIG[smb] = "--enable-smb,--disable-smb," -PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp," -PACKAGECONFIG[ssl] = "--with-ssl --with-random=/dev/urandom,--without-ssl,openssl" -PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" -PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet," -PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp," -PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver,,,,ares" -PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose" -PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib" - -EXTRA_OECONF = " \ - --disable-libcurl-option \ - --disable-ntlm-wb \ - --enable-crypto-auth \ - --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \ - --without-libpsl \ - --enable-debug \ - --enable-optimize \ - --disable-curldebug \ -" - -do_install:append:class-target() { - # cleanup buildpaths from curl-config - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - ${D}${bindir}/curl-config -} - -PACKAGES =+ "lib${BPN}" - -FILES_lib${BPN} = "${libdir}/lib*.so.*" -RRECOMMENDS_lib${BPN} += "ca-certificates" - -FILES_${PN} += "${datadir}/zsh" - -inherit multilib_script -MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/curl-config" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.79.1.bb b/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.79.1.bb new file mode 100644 index 000000000..365873e15 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/curl/curl_7.79.1.bb @@ -0,0 +1,89 @@ +SUMMARY = "Command line tool and library for client-side URL transfers" +DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \ +curl is a widely used because of its ability to be flexible and complete \ +complex tasks. For example, you can use curl for things like user authentication, \ +HTTP post, SSL connections, proxy support, FTP uploads, and more!" +HOMEPAGE = "http://curl.haxx.se/" +BUGTRACKER = "http://curl.haxx.se/mail/list.cgi?list=curl-tracker" +SECTION = "console/network" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=425f6fdc767cc067518eef9bbdf4ab7b" + +SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \ + file://0001-replace-krb5-config-with-pkg-config.patch \ +" + +SRC_URI[sha256sum] = "de62c4ab9a9316393962e8b94777a570bb9f71feb580fb4475e412f2f9387851" + +# Curl has used many names over the years... +CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" + +inherit autotools pkgconfig binconfig multilib_header + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} ssl libidn proxy threaded-resolver verbose zlib" +PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver verbose zlib" +PACKAGECONFIG_class-nativesdk = "ipv6 proxy ssl threaded-resolver verbose zlib" + +# 'ares' and 'threaded-resolver' are mutually exclusive +PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares,,,threaded-resolver" +PACKAGECONFIG[brotli] = "--with-brotli,--without-brotli,brotli" +PACKAGECONFIG[builtinmanual] = "--enable-manual,--disable-manual" +PACKAGECONFIG[dict] = "--enable-dict,--disable-dict," +PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls" +PACKAGECONFIG[gopher] = "--enable-gopher,--disable-gopher," +PACKAGECONFIG[imap] = "--enable-imap,--disable-imap," +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5" +PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap," +PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps," +PACKAGECONFIG[libgsasl] = "--with-libgsasl,--without-libgsasl,libgsasl" +PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2" +PACKAGECONFIG[libssh2] = "--with-libssh2,--without-libssh2,libssh2" +PACKAGECONFIG[mbedtls] = "--with-mbedtls=${STAGING_DIR_TARGET},--without-mbedtls,mbedtls" +PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt," +PACKAGECONFIG[nghttp2] = "--with-nghttp2,--without-nghttp2,nghttp2" +PACKAGECONFIG[pop3] = "--enable-pop3,--disable-pop3," +PACKAGECONFIG[proxy] = "--enable-proxy,--disable-proxy," +PACKAGECONFIG[rtmpdump] = "--with-librtmp,--without-librtmp,rtmpdump" +PACKAGECONFIG[rtsp] = "--enable-rtsp,--disable-rtsp," +PACKAGECONFIG[smb] = "--enable-smb,--disable-smb," +PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp," +PACKAGECONFIG[ssl] = "--with-ssl --with-random=/dev/urandom,--without-ssl,openssl" +PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" +PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet," +PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp," +PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver,,,,ares" +PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose" +PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib" + +EXTRA_OECONF = " \ + --disable-libcurl-option \ + --disable-ntlm-wb \ + --enable-crypto-auth \ + --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \ + --without-libpsl \ + --enable-debug \ + --enable-optimize \ + --disable-curldebug \ +" + +do_install:append:class-target() { + # cleanup buildpaths from curl-config + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + ${D}${bindir}/curl-config +} + +PACKAGES =+ "lib${BPN}" + +FILES_lib${BPN} = "${libdir}/lib*.so.*" +RRECOMMENDS_lib${BPN} += "ca-certificates" + +FILES_${PN} += "${datadir}/zsh" + +inherit multilib_script +MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/curl-config" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch deleted file mode 100644 index cec2813e9..000000000 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c -index 610511f7..92be4656 100644 ---- a/plugins/curl/curl.c -+++ b/plugins/curl/curl.c -@@ -69,6 +69,8 @@ static const char *proxy = NULL; - char *proxy_password = NULL; - const char *proxy_user = NULL; - bool sslverify = true; -+const char *ssl_version = NULL; -+const char *ssl_cipher_list = NULL; - bool tcp_keepalive = false; - bool tcp_nodelay = true; - uint32_t timeout = 0; -@@ -232,6 +234,12 @@ curl_config (const char *key, const char *value) - sslverify = r; - } - -+ else if (strcmp (key, "ssl-version") == 0) -+ ssl_version = value; -+ -+ else if (strcmp (key, "ssl-cipher-list") == 0) -+ ssl_cipher_list = value; -+ - else if (strcmp (key, "tcp-keepalive") == 0) { - r = nbdkit_parse_bool (value); - if (r == -1) -@@ -302,6 +310,8 @@ curl_config_complete (void) - "proxy-user= The proxy user.\n" \ - "timeout= Set the timeout for requests (seconds).\n" \ - "sslverify=false Do not verify SSL certificate of remote host.\n" \ -+ "ssl-version= Specify preferred TLS/SSL version.\n " \ -+ "ssl-cipher-list=C1:C2:.. Specify TLS/SSL cipher suites to be used.\n" \ - "tcp-keepalive=true Enable TCP keepalives.\n" \ - "tcp-nodelay=false Disable Nagle’s algorithm.\n" \ - "unix-socket-path= Open Unix domain socket instead of TCP/IP.\n" \ -@@ -418,6 +428,30 @@ curl_open (int readonly) - curl_easy_setopt (h->c, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt (h->c, CURLOPT_SSL_VERIFYHOST, 0L); - } -+ if (ssl_version) { -+ if (strcmp (ssl_version, "tlsv1") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); -+ else if (strcmp (ssl_version, "sslv2") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv2); -+ else if (strcmp (ssl_version, "sslv3") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3); -+ else if (strcmp (ssl_version, "tlsv1.0") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0); -+ else if (strcmp (ssl_version, "tlsv1.1") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1); -+ else if (strcmp (ssl_version, "tlsv1.2") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); -+ else if (strcmp (ssl_version, "tlsv1.3") == 0) -+ curl_easy_setopt (h->c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_3); -+ else { -+ display_curl_error (h, r, "curl_easy_setopt: CURLOPT_SSLVERSION [%s]", -+ ssl_version); -+ goto err; -+ } -+ -+ } -+ if (ssl_cipher_list) -+ curl_easy_setopt (h->c, CURLOPT_SSL_CIPHER_LIST, ssl_cipher_list); - if (tcp_keepalive) - curl_easy_setopt (h->c, CURLOPT_TCP_KEEPALIVE, 1L); - if (!tcp_nodelay) diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0003-Add-support-for-tls13-ciphers.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0003-Add-support-for-tls13-ciphers.patch deleted file mode 100644 index 398cef63c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0003-Add-support-for-tls13-ciphers.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c -index fad84140..d3dc3bde 100644 ---- a/plugins/curl/curl.c -+++ b/plugins/curl/curl.c -@@ -85,6 +85,7 @@ const char *proxy_user = NULL; - bool sslverify = true; - const char *ssl_version = NULL; - const char *ssl_cipher_list = NULL; -+const char *tls13_ciphers = NULL; - bool tcp_keepalive = false; - bool tcp_nodelay = true; - uint32_t timeout = 0; -@@ -309,6 +310,9 @@ curl_config (const char *key, const char *value) - else if (strcmp (key, "ssl-cipher-list") == 0) - ssl_cipher_list = value; - -+ else if (strcmp (key, "tls13-ciphers") == 0) -+ tls13_ciphers = value; -+ - else if (strcmp (key, "tcp-keepalive") == 0) { - r = nbdkit_parse_bool (value); - if (r == -1) -@@ -413,6 +417,7 @@ curl_config_complete (void) - "sslverify=false Do not verify SSL certificate of remote host.\n" \ - "ssl-version= Specify preferred TLS/SSL version.\n " \ - "ssl-cipher-list=C1:C2:.. Specify TLS/SSL cipher suites to be used.\n" \ -+ "tls13-ciphers=C1:C2:.. Specify TLS 1.3 cipher suites to be used.\n" \ - "tcp-keepalive=true Enable TCP keepalives.\n" \ - "tcp-nodelay=false Disable Nagle’s algorithm.\n" \ - "unix-socket-path= Open Unix domain socket instead of TCP/IP.\n" \ -@@ -550,6 +555,8 @@ curl_open (int readonly) - } - if (ssl_cipher_list) - curl_easy_setopt (h->c, CURLOPT_SSL_CIPHER_LIST, ssl_cipher_list); -+ if (tls13_ciphers) -+ curl_easy_setopt (h->c, CURLOPT_TLS13_CIPHERS, tls13_ciphers); - if (tcp_keepalive) - curl_easy_setopt (h->c, CURLOPT_TCP_KEEPALIVE, 1L); - if (!tcp_nodelay) diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0004-Handle-empty-CAInfo-in-curl-plugin-correctly.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0004-Handle-empty-CAInfo-in-curl-plugin-correctly.patch deleted file mode 100644 index 867f2e166..000000000 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0004-Handle-empty-CAInfo-in-curl-plugin-correctly.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f86b22a450589cdcac6bb3afa1818dfa6d2eefe4 Mon Sep 17 00:00:00 2001 -From: Wiktor Golgowski -Date: Fri, 27 Aug 2021 17:39:59 +0200 -Subject: [PATCH] Handle empty CAInfo in curl plugin correctly. - -Recent change in libcurl causes CAINFO option to be set when -the library is compiled. If we do not want to use the default -certificate store, we set the option to an empty string. -This change recognizes zero-length CAInfo and clears the libcurl -option. - -Signed-off-by: Wiktor Golgowski ---- - plugins/curl/curl.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c -index fad84140..176f9a1f 100644 ---- a/plugins/curl/curl.c -+++ b/plugins/curl/curl.c -@@ -498,8 +498,12 @@ curl_open (int readonly) - curl_easy_setopt (h->c, CURLOPT_FAILONERROR, 1L); - - /* Options. */ -- if (cainfo) -- curl_easy_setopt (h->c, CURLOPT_CAINFO, cainfo); -+ if (cainfo) { -+ if (strlen (cainfo) == 0) -+ curl_easy_setopt (h->c, CURLOPT_CAINFO, NULL); -+ else -+ curl_easy_setopt (h->c, CURLOPT_CAINFO, cainfo); -+ } - if (capath) - curl_easy_setopt (h->c, CURLOPT_CAPATH, capath); - if (cookie) diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb index f7d690ff8..d1b5e1b22 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb @@ -11,12 +11,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=f9dcc2d8acdde215fa4bd6ac12bb14f0" SRC_URI = "git://github.com/libguestfs/nbdkit.git;protocol=https" SRC_URI += "file://0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch" -SRC_URI += "file://0002-Add-support-for-ssl-config.patch" -SRC_URI += "file://0003-Add-support-for-tls13-ciphers.patch" -SRC_URI += "file://0004-Handle-empty-CAInfo-in-curl-plugin-correctly.patch" -PV = "1.25.5+git${SRCPV}" -SRCREV = "c828c6d48ff6b69454cad98054a1920d03c4b4c7" +PV = "1.28.0+git${SRCPV}" +SRCREV = "676c193ba05e479c145cf872e4912c576d1461d3" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control/0001-Extend-VR-Watchdog-timeout.patch b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control/0001-Extend-VR-Watchdog-timeout.patch index 15de955c0..20b930fe6 100644 --- a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control/0001-Extend-VR-Watchdog-timeout.patch +++ b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control/0001-Extend-VR-Watchdog-timeout.patch @@ -1,4 +1,4 @@ -From 540836801f4ab5e8be9703d2c1350e988b2ccc1f Mon Sep 17 00:00:00 2001 +From df6782d834b3c502a9b71e946fdbbfb4513b4d96 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Thu, 11 Jun 2020 13:00:15 -0700 Subject: [PATCH] Extend VR Watchdog timeout @@ -11,14 +11,14 @@ City. Change-Id: I9658b4ead6d9bf8eaa30e4aeb9f1d56c2f2187d3 Signed-off-by: Jason M. Bills --- - power-control-x86/config/power-config-host0.json | 2 +- + config/power-config-host0.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/power-control-x86/config/power-config-host0.json b/power-control-x86/config/power-config-host0.json -index ca9a86a..f579c2b 100644 ---- a/power-control-x86/config/power-config-host0.json -+++ b/power-control-x86/config/power-config-host0.json -@@ -18,7 +18,7 @@ +diff --git a/config/power-config-host0.json b/config/power-config-host0.json +index ed91470..12c3309 100644 +--- a/config/power-config-host0.json ++++ b/config/power-config-host0.json +@@ -78,7 +78,7 @@ "ForceOffPulseMs": 15000, "ResetPulseMs": 500, "PowerCycleMs": 5000, @@ -28,5 +28,5 @@ index ca9a86a..f579c2b 100644 "GracefulPowerOffS": 300, "WarmResetCheckMs": 500, -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend index 896439fc2..daac0ecb8 100755 --- a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/x86-power-control.git;protocol=ssh" -SRCREV = "676ef2c425b4e7748bea43d5c94ee6d3239fa7a9" +SRCREV = "48c94c59728023cdbff3bd62f203de3434af8b8a" FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bbappend b/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bbappend index 2955dabd3..aa512fd0f 100644 --- a/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bbappend +++ b/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bbappend @@ -8,6 +8,7 @@ SRC_URI:append = " \ file://csk_pub.pem \ file://rk_pub.pem \ file://rk_prv.pem \ + file://rk_cert.pem \ " do_install:append () { @@ -18,5 +19,6 @@ do_install:append () { install -m 400 ${WORKDIR}/csk_pub.pem ${D}/${datadir}/pfrconfig/csk_pub.pem install -m 400 ${WORKDIR}/rk_pub.pem ${D}/${datadir}/pfrconfig/rk_pub.pem install -m 400 ${WORKDIR}/rk_prv.pem ${D}/${datadir}/pfrconfig/rk_prv.pem + install -m 0644 ${WORKDIR}/rk_cert.pem ${D}/${datadir}/pfrconfig/rk_cert.pem } diff --git a/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native/rk_cert.pem b/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native/rk_cert.pem new file mode 100644 index 000000000..4f9776f18 --- /dev/null +++ b/meta-openbmc-mods/meta-wht/recipes-intel/intel-pfr/obmc-intel-pfr-image-native/rk_cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQjCCAemgAwIBAgIUfTMHDoCGQ2wj+ZVBx0SYFOQ7PFEwCgYIKoZIzj0EAwIw +dzELMAkGA1UEBhMCVVMxDzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJSGlsbHNi +b3JvMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEMMAoGA1UECwwDRFBHMRkw +FwYDVQQDDBBJbnRlbCBPcGVuQk1DIEZXMB4XDTIxMDkyMTIwMDI0OFoXDTMxMDkx +OTIwMDI0OFowdzELMAkGA1UEBhMCVVMxDzANBgNVBAgMBk9yZWdvbjESMBAGA1UE +BwwJSGlsbHNib3JvMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEMMAoGA1UE +CwwDRFBHMRkwFwYDVQQDDBBJbnRlbCBPcGVuQk1DIEZXMFkwEwYHKoZIzj0CAQYI +KoZIzj0DAQcDQgAEZUL6ZcF0YN590Pq/bKPYjfa3F4E44XiKcqvS6+l2GfSdCLRh +XWHwiV803vFkTsZ1CfpzFdZGwfbwg7nvG5UpSaNTMFEwHQYDVR0OBBYEFFILKRsX +S66KNT7j3MnuxvHiLl+DMB8GA1UdIwQYMBaAFFILKRsXS66KNT7j3MnuxvHiLl+D +MA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgOUGKxkh8SsEbH1zH +SYIbR7Vv4ksodnm4cH+pHtOp3wgCIBvwM0HST0k63MfoJcPsOIdnZn/sXf7CJbA7 +ReiaxMGg +-----END CERTIFICATE----- -- cgit v1.2.3