From defdca82c107f46e980c84bffb1b2c1263522fa0 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Wed, 23 Jun 2021 16:18:49 -0700 Subject: Update to internal 0.57 Signed-off-by: Jason M. Bills --- .../entity-manager/CPC-Baseboard.json | 10 + .../configuration/entity-manager/WC-Baseboard.json | 10 + .../configuration/entity-manager/WP-Baseboard.json | 10 + .../0001-Add-ast2600-intel-as-a-new-board.patch | 12 +- ...ble-host-searial-port-clock-configuration.patch | 71 ++ ...003-ast2600-intel-layout-environment-addr.patch | 19 +- .../0005-Ast2600-Enable-interrupt-in-u-boot.patch | 16 +- .../u-boot/files/0006-SPI-Quad-IO-Mode.patch | 16 +- .../0007-ast2600-Override-OTP-strap-settings.patch | 19 +- ...able-DMA-arbitration-options-on-MAC1-and-.patch | 12 +- .../u-boot/files/0010-Fix-timer-support.patch | 16 +- .../files/0011-KCS-driver-support-in-uBoot.patch | 14 +- ...round-to-cover-UART-interrupt-bug-in-AST2.patch | 10 +- .../0016-Add-system-reset-status-support.patch | 16 +- ...around-to-cover-VGA-memory-size-bug-in-A0.patch | 12 +- ...1-2-reset-mask-to-reset-needed-controller.patch | 8 +- ...ble-host-searial-port-clock-configuration.patch | 71 -- ...d-WDT-to-u-boot-to-cover-booting-failures.patch | 18 +- .../u-boot/files/0025-Enable-PCIe-L1-support.patch | 40 - ...-PFR-platform-EXTRST-reset-mask-selection.patch | 13 +- .../u-boot/files/0026-Enable-PCIe-L1-support.patch | 40 + .../files/0030-Add-Aspeed-PWM-uclass-driver.patch | 576 ++++++++++++++ ...orkaround-to-fix-AST2600-A0-booting-issue.patch | 32 + .../recipes-bsp/u-boot/files/intel.cfg | 2 + .../u-boot/u-boot-aspeed-sdk_%.bbappend | 20 +- .../u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend | 19 +- ...guid_from_server-if-send_negotiate_unix_f.patch | 104 --- .../meta-common/recipes-core/dbus/dbus/dbus-1.init | 123 --- .../recipes-core/dbus/dbus/tmpdir.patch | 44 -- .../meta-common/recipes-core/dbus/dbus_%.bbappend | 11 - .../recipes-core/interfaces/libmctp_git.bb | 2 +- .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 2 +- .../sdbusplus/sdbusplus_%.bbappend | 3 - .../libvncserver/libvncserver_%.bbappend | 2 +- ...ard-and-mouse-input-events-dropping-issue.patch | 162 ---- ...004-Connect-HID-gadget-device-dynamically.patch | 494 ------------ .../0005-Refine-HID-report-writing-logic.patch | 295 ------- .../obmc-ikvm/obmc-ikvm_%.bbappend | 8 +- .../recipes-intel/hsbp/hsbp-manager_git.bb | 5 +- .../recipes-intel/psu-manager/psu-manager.bb | 2 +- .../recipes-intel/smbios/smbios-mdrv2.bb | 4 +- ...03-Die_CPU-filter-first-zero-from-GetTemp.patch | 60 ++ ...CPU-filter-first-zero-from-RdPkgConfig-10.patch | 64 ++ .../recipes-kernel/linux/linux-aspeed_%.bbappend | 6 +- ...ing-channel-specific-privilege-to-network.patch | 28 +- .../network/phosphor-network_%.bbappend | 5 +- .../network/static-mac-addr/mac-check | 4 + ...ty-manager-Add-support-to-update-assetTag.patch | 35 +- .../configuration/entity-manager_%.bbappend | 5 +- ...001-allow-dbus-sensors-without-thresholds.patch | 39 + .../fans/phosphor-pid-control_%.bbappend | 6 +- ...rmware-activation-to-launch-fwupd.sh-thro.patch | 31 +- .../0007-PFR-images-support.patch | 70 +- ...Fix-for-RedudancyPriority-in-item_updater.patch | 36 - .../flash/phosphor-software-manager_%.bbappend | 1 - ...edVia-property-to-virtual-media-item-temp.patch | 25 - ...001-Firmware-update-configuration-changes.patch | 137 ++-- ...status-code-from-InsertMedia-REST-methods.patch | 182 ----- ...d-redfish-property-for-not-inserted-resou.patch | 40 - ...Bmcweb-handle-permission-denied-exception.patch | 44 -- ...-handle-device-or-resource-busy-exception.patch | 219 ------ .../0005-EventService-https-client-support.patch | 547 ------------- .../0005-Fix-unmounting-image-in-proxy-mode.patch | 32 - ...-Define-Redfish-interface-Registries-Bios.patch | 850 --------------------- ...OS-config-Add-support-for-PATCH-operation.patch | 153 ---- .../0008-Add-support-to-ResetBios-action.patch | 62 -- ...0009-Add-support-to-ChangePassword-action.patch | 139 ---- ...s-add-attributes-for-Manager.CommandShell.patch | 36 +- ...4-recommended-fixes-by-crypto-review-team.patch | 75 ++ ...Add-state-sensor-messages-to-the-registry.patch | 98 +++ ...b-crashes-if-socket-directory-not-present.patch | 44 ++ ...registry-for-subscription-related-actions.patch | 81 ++ ...4-recommended-fixes-by-crypto-review-team.patch | 75 -- ...Add-state-sensor-messages-to-the-registry.patch | 98 --- ...8-Revert-Disable-nbd-proxy-from-the-build.patch | 50 -- ...b-crashes-if-socket-directory-not-present.patch | 44 -- ...0039-Fix-comparison-for-proxy-legacy-mode.patch | 51 -- ...-Define-Redfish-interface-Registries-Bios.patch | 848 ++++++++++++++++++++ ...BiosTable-Add-support-for-PATCH-operation.patch | 152 ++++ .../0003-Add-support-to-ResetBios-action.patch | 61 ++ ...0004-Add-support-to-ChangePassword-action.patch | 139 ++++ ...e-bios-user-pwd-change-option-via-Redfish.patch | 44 ++ ...ervice-Fix-retry-handling-for-http-client.patch | 46 +- .../0002-EventService-https-client-support.patch | 35 +- .../0004-Add-Server-Sent-Events-support.patch | 25 +- ...tyle-subscription-support-to-eventservice.patch | 85 ++- .../0006-Add-EventService-SSE-filter-support.patch | 23 +- ...rvice-Log-events-for-subscription-actions.patch | 132 ++++ .../interfaces/bmcweb/eventservice/README | 10 +- ...3-Add-support-for-MetricDefinition-scheme.patch | 400 +++++----- ...4-Sync-Telmetry-service-with-EventService.patch | 22 +- .../interfaces/bmcweb/telemetry/README | 4 +- ...1-Revert-Disable-nbd-proxy-from-the-build.patch | 50 ++ ...-handle-device-or-resource-busy-exception.patch | 219 ++++++ ...edVia-property-to-virtual-media-item-temp.patch | 28 + ...status-code-from-InsertMedia-REST-methods.patch | 185 +++++ ...d-redfish-property-for-not-inserted-resou.patch | 43 ++ ...Bmcweb-handle-permission-denied-exception.patch | 47 ++ .../0007-Fix-unmounting-image-in-proxy-mode.patch | 35 + ...ix-VM-NBDPROXY-build-issue-with-AsyncResp.patch | 37 + .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 51 +- .../ipmi/phosphor-ipmi-config/channel_config.json | 1 + .../ipmi/phosphor-ipmi-kcs_%.bbappend | 2 +- .../ipmi/phosphor-ipmi-net_%.bbappend | 2 +- .../leds/phosphor-led-manager_%.bbappend | 13 + .../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 +- ...sor-create-RequirediTempSensor-if-defined.patch | 234 ++++++ .../sensors/dbus-sensors_%.bbappend | 3 +- .../special-mode-mgr/special-mode-mgr_git.bb | 2 +- .../recipes-phosphor/system/callback-manager.bb | 2 +- .../telemetry/telemetry_%.bbappend | 6 +- .../users/phosphor-user-manager_%.bbappend | 2 +- ...ize-phosphor-watchdog-for-Intel-platforms.patch | 22 +- .../recipes-phosphor/webui/webui-vue_%.bbappend | 2 +- ...rce-nbdkit-to-send-PATCH-as-upload-method.patch | 8 +- .../nbdkit/0002-Add-support-for-ssl-config.patch | 16 +- .../recipes-utilities/nbdkit/nbdkit_git.bb | 6 +- 125 files changed, 4226 insertions(+), 4669 deletions(-) create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0002-AST2600-Enable-host-searial-port-clock-configuration.patch delete mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0021-AST2600-Enable-host-searial-port-clock-configuration.patch delete mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0026-Enable-PCIe-L1-support.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0030-Add-Aspeed-PWM-uclass-driver.patch create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0031-Add-a-workaround-to-fix-AST2600-A0-booting-issue.patch mode change 100644 => 120000 meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json index 0346c3f90..e9c91e425 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json @@ -33,6 +33,16 @@ ], "Type": "ADC" }, + { + "BusConfig": [ + { + "BusNum": 9, + "BusType": "BUS_CONFIG_I2C" + } + ], + "Name": "ASD", + "Type": "ASD" + }, { "Index": 3, "Name": "P105_PCH_AUX", diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json index 3b7c531ff..10ac69963 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json @@ -33,6 +33,16 @@ ], "Type": "ADC" }, + { + "BusConfig": [ + { + "BusNum": 9, + "BusType": "BUS_CONFIG_I2C" + } + ], + "Name": "ASD", + "Type": "ASD" + }, { "Index": 3, "Name": "P105_PCH_AUX", diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json index 23869e812..acecd3fcd 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json @@ -33,6 +33,16 @@ ], "Type": "ADC" }, + { + "BusConfig": [ + { + "BusNum": 9, + "BusType": "BUS_CONFIG_I2C" + } + ], + "Name": "ASD", + "Type": "ASD" + }, { "Index": 3, "Name": "P105_PCH_AUX", diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch index dfb11d89a..0705ab3de 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch @@ -1,4 +1,4 @@ -From ada80beb48d974f101201745657d10e72fe30b9c Mon Sep 17 00:00:00 2001 +From 041ad6cfc3d379c8e4fd271e7f9e3d8ea6ee61ac Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Thu, 24 Oct 2019 14:06:33 -0700 Subject: [PATCH] Add ast2600-intel as a new board @@ -36,7 +36,7 @@ Signed-off-by: Jae Hyun Yoo diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile old mode 100755 new mode 100644 -index e9d994737949..d2ad5968775e +index 786042cd8340..df844065cd4f --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -684,7 +684,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ @@ -288,10 +288,10 @@ index ee775ce5d264..8c985532afb4 100644 { efi_restore_gd(); diff --git a/arch/arm/mach-aspeed/ast2600/Kconfig b/arch/arm/mach-aspeed/ast2600/Kconfig -index 518f41b558d3..8023397cff58 100644 +index 6258b337bc3d..ffcb110c3ae3 100644 --- a/arch/arm/mach-aspeed/ast2600/Kconfig +++ b/arch/arm/mach-aspeed/ast2600/Kconfig -@@ -51,6 +51,13 @@ config TARGET_SLT_AST2600 +@@ -32,10 +32,18 @@ config TARGET_SLT_AST2600 help SLT-AST2600 is Aspeed SLT board for AST2600 chip. @@ -304,9 +304,7 @@ index 518f41b558d3..8023397cff58 100644 + endchoice - config ASPEED_SECBOOT_BL2 -@@ -71,5 +78,6 @@ source "board/aspeed/ncsi_ast2600a0/Kconfig" - source "board/aspeed/ncsi_ast2600a1/Kconfig" + source "board/aspeed/evb_ast2600/Kconfig" source "board/aspeed/fpga_ast2600/Kconfig" source "board/aspeed/slt_ast2600/Kconfig" +source "board/aspeed/ast2600_intel/Kconfig" diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0002-AST2600-Enable-host-searial-port-clock-configuration.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0002-AST2600-Enable-host-searial-port-clock-configuration.patch new file mode 100644 index 000000000..cd09ab4f0 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0002-AST2600-Enable-host-searial-port-clock-configuration.patch @@ -0,0 +1,71 @@ +From 816ae827f387922e31281c8b10988870ce9e0294 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Tue, 10 Dec 2019 14:58:10 +0800 +Subject: [PATCH] AST2600: Enable host searial port clock configuration in + u-boot + +In u-boot could read env variable "hostsearialcfg" and set the corresponding +clock for host searail port. + +Tested: +setenv hostsearialcfg 1, speed is set to 192Mhz (baud rate 921600) +other value, speed is set to 24Mhz(baud rate 115200) +by default is 24Mhz. + +Signed-off-by: Kuiying Wang +--- + board/aspeed/ast2600_intel/intel.c | 35 ++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c +index 4a40a050c3da..d1ac8651ac6c 100644 +--- a/board/aspeed/ast2600_intel/intel.c ++++ b/board/aspeed/ast2600_intel/intel.c +@@ -39,9 +39,44 @@ int gpio_abort(void) + } + + #define SCU_BASE 0x1E6E2000 ++#define SCU_338 0x338 //Generate UART 24 MHz Reference from UXCLK ++#define SCU_33C 0x33c //Generate UART 24 MHz Reference from HUXCLK ++#define SCU_338_R_VALUE_192MHZ 0x8e ++#define SCU_338_N_VALUE_192MHZ 0x3c3 ++#define SCU_338_R_VALUE_24MHZ 0x06 ++#define SCU_338_N_VALUE_24MHZ 0x145 ++#define HOST_SERIAL_HIGH_SPEED_192MHZ 1 ++#define R_VALUE_BITS 8 ++#define V_VALUE_BITS 10 ++#define R_V_VALUE_MASK (1 << (R_VALUE_BITS + V_VALUE_BITS)) ++ + int misc_init_r(void) + { + /* This is called near the end of the _r init sequence */ ++ /* By default host serail is set 24Mhz */ ++ uint32_t host_serial_cfg = 0; ++ char *host_serial_cfg_txt = NULL; ++ ++ /* Config the uart clock source based on environment configuration */ ++ host_serial_cfg_txt = env_get("hostserialcfg"); ++ ++ if (host_serial_cfg_txt != NULL) ++ host_serial_cfg = simple_strtoul(host_serial_cfg_txt, NULL, 16); ++ ++ if (host_serial_cfg > HOST_SERIAL_HIGH_SPEED_192MHZ || host_serial_cfg < 0) { ++ printf("Invalid hostserialcfg %x, 24Mhz is set by default!\n", host_serial_cfg); ++ host_serial_cfg = 0; ++ } ++ ++ if (host_serial_cfg & HOST_SERIAL_HIGH_SPEED_192MHZ) { ++ writel((readl(SCU_BASE | SCU_338) & R_V_VALUE_MASK) | ++ (SCU_338_N_VALUE_192MHZ << R_VALUE_BITS) | SCU_338_R_VALUE_192MHZ, ++ SCU_BASE | SCU_338); ++ } else { ++ writel((readl(SCU_BASE | SCU_338) & R_V_VALUE_MASK) | ++ (SCU_338_N_VALUE_24MHZ << R_VALUE_BITS) | SCU_338_R_VALUE_24MHZ, ++ SCU_BASE | SCU_338); ++ } + + return 0; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0003-ast2600-intel-layout-environment-addr.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0003-ast2600-intel-layout-environment-addr.patch index 326f36df1..a036b91fc 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0003-ast2600-intel-layout-environment-addr.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0003-ast2600-intel-layout-environment-addr.patch @@ -1,4 +1,4 @@ -From 3195e1ec2d772d5e4c16ae5b60c294086cfc17be Mon Sep 17 00:00:00 2001 +From fdb55afe15fdbba33782d01a77bbf994470f40b4 Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Thu, 12 Dec 2019 12:54:18 +0800 Subject: [PATCH] ast2600: intel-layout-environment-addr @@ -9,12 +9,12 @@ Both kernel and u-boot work at the area /dev/mtd/u-boot-env Signed-off-by: Kuiying Wang Signed-off-by: Jae Hyun Yoo --- - common/board_r.c | 13 ++++++++++--- + common/board_r.c | 11 +++++++++-- include/configs/aspeed-common.h | 11 ++++++++++- - 2 files changed, 20 insertions(+), 4 deletions(-) + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/board_r.c b/common/board_r.c -index 472987d5d52f..b665d0e30262 100644 +index 472987d5d52f..434c0df45c85 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -433,10 +433,17 @@ static int should_load_env(void) @@ -22,8 +22,6 @@ index 472987d5d52f..b665d0e30262 100644 { /* initialize environment */ - if (should_load_env()) -- env_relocate(); -- else + if (should_load_env()) { + /* + * try again, in case the environment failed to load the first @@ -31,7 +29,8 @@ index 472987d5d52f..b665d0e30262 100644 + */ + if (!gd->env_valid) + env_init(); -+ env_relocate(); + env_relocate(); +- else + } else { set_default_env(NULL, 0); + } @@ -39,10 +38,10 @@ index 472987d5d52f..b665d0e30262 100644 env_set_hex("fdtcontroladdr", (unsigned long)map_to_sysmem(gd->fdt_blob)); diff --git a/include/configs/aspeed-common.h b/include/configs/aspeed-common.h -index cdbffc97a223..6065ec58db0a 100644 +index 8718b50f9ebe..70590067dbcf 100644 --- a/include/configs/aspeed-common.h +++ b/include/configs/aspeed-common.h -@@ -65,9 +65,18 @@ +@@ -73,9 +73,18 @@ #endif #ifndef CONFIG_ENV_OFFSET @@ -63,5 +62,5 @@ index cdbffc97a223..6065ec58db0a 100644 /* -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch index d5bd4a2b1..ec4b6be09 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch @@ -1,4 +1,4 @@ -From c1561193296d04dd8bd06adca43edac814058367 Mon Sep 17 00:00:00 2001 +From 0732dd21869418b4d437b8d1aef239d5348fc94d Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Fri, 3 Jan 2020 12:52:29 +0800 Subject: [PATCH] Enable interrupt in u-boot. @@ -14,18 +14,18 @@ Testedby: Signed-off-by: Kuiying Wang Signed-off-by: Jae Hyun Yoo --- - Kconfig | 14 +++ + Kconfig | 14 ++ arch/arm/lib/stack.c | 9 ++ - arch/arm/lib/vectors.S | 30 +++++- + arch/arm/lib/vectors.S | 30 ++++- board/aspeed/ast2600_intel/ast-espi.c | 3 +- - board/aspeed/ast2600_intel/ast-irq.c | 185 +++++++++++++++++----------------- + board/aspeed/ast2600_intel/ast-irq.c | 185 +++++++++++++------------- board/aspeed/ast2600_intel/ast-irq.h | 8 -- board/aspeed/ast2600_intel/intel.c | 1 - 7 files changed, 145 insertions(+), 105 deletions(-) delete mode 100644 board/aspeed/ast2600_intel/ast-irq.h diff --git a/Kconfig b/Kconfig -index 305b265ed713..a6f68cd13d54 100644 +index c3dfa8de47c8..b62bcdbccf1e 100644 --- a/Kconfig +++ b/Kconfig @@ -239,6 +239,20 @@ config BUILD_TARGET @@ -551,10 +551,10 @@ index 9957f2baa7ff..000000000000 - -#endif diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index ac108c3a066c..22a377d2cb77 100644 +index 14a20b27e178..d03a446846bc 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c -@@ -209,7 +209,6 @@ static void timer_handler(void *regs) +@@ -239,7 +239,6 @@ static void timer_handler(void *regs) printf("+"); } @@ -563,5 +563,5 @@ index ac108c3a066c..22a377d2cb77 100644 { /* This is called before relocation; beware! */ -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch index 720d165c5..612a104b5 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch @@ -1,4 +1,4 @@ -From fd0768e6a63a25fdc87596036a5cbf82a88a1eb6 Mon Sep 17 00:00:00 2001 +From ddd0ebfaf667f2fd36ed2f8d2d8456dbc6acdaa8 Mon Sep 17 00:00:00 2001 From: arun-pm Date: Fri, 29 Nov 2019 00:19:09 +0530 Subject: [PATCH] SPI Quad IO Mode @@ -37,10 +37,10 @@ index 9a15e204f83b..1f14753056ee 100644 }; diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c -index 3b0a910d3fca..d6b949170570 100644 +index 5882eab2e3fc..42546f4d222a 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c -@@ -164,7 +164,12 @@ const struct flash_info spi_nor_ids[] = { +@@ -189,7 +189,12 @@ const struct flash_info spi_nor_ids[] = { { INFO("n25q256ax1", 0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("n25q512a", 0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, @@ -51,11 +51,11 @@ index 3b0a910d3fca..d6b949170570 100644 + * back(Note:- Certain other chips having same name(n25q00) but different part number has no issues). + */ + { INFO("n25q00", 0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | NO_CHIP_ERASE) }, + { INFO("mt25ql02g", 0x20ba22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, { INFO("n25q00a", 0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, { INFO("mt25qu02g", 0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, - #endif diff --git a/drivers/spi/aspeed_spi.c b/drivers/spi/aspeed_spi.c -index 18d4c2fa098e..6efb8c4e3c65 100644 +index f93200f8f67e..8ac6e40524fe 100644 --- a/drivers/spi/aspeed_spi.c +++ b/drivers/spi/aspeed_spi.c @@ -17,6 +17,9 @@ @@ -68,13 +68,13 @@ index 18d4c2fa098e..6efb8c4e3c65 100644 struct aspeed_spi_regs { u32 conf; /* 0x00 CE Type Setting */ -@@ -1037,6 +1040,19 @@ static int aspeed_spi_bind(struct udevice *bus) +@@ -1059,6 +1062,19 @@ static int aspeed_spi_bind(struct udevice *bus) return 0; } +static int aspeed_get_max_freq(void) +{ -+ u32 rev_id = readl(ASPEED_REVISION_ID); ++ u32 rev_id = readl(ASPEED_REVISION_ID0); + + /*Limit max spi frequency less than 50MHz on AST2600-A0 due + * to FWSPICLK signal quality issue. @@ -88,7 +88,7 @@ index 18d4c2fa098e..6efb8c4e3c65 100644 static int aspeed_spi_probe(struct udevice *bus) { struct resource res_regs, res_ahb; -@@ -1067,7 +1083,7 @@ static int aspeed_spi_probe(struct udevice *bus) +@@ -1089,7 +1105,7 @@ static int aspeed_spi_probe(struct udevice *bus) clk_free(&hclk); priv->max_hz = dev_read_u32_default(bus, "spi-max-frequency", diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch index 2a2d1054a..c4b8a00ef 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch @@ -1,4 +1,4 @@ -From 6f9d529b616ce84271ccd2584b9bcd8d13ab57de Mon Sep 17 00:00:00 2001 +From 844e425a503c56bd84dbfe5396c5f8f9b4284e6d Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Wed, 29 Jan 2020 14:55:44 -0800 Subject: [PATCH] ast2600: Override OTP strap settings @@ -8,11 +8,11 @@ Also, this commit disables SoC debug interface. Signed-off-by: Jae Hyun Yoo --- - arch/arm/mach-aspeed/ast2600/platform.S | 26 ++++++++++++++++++++++--- - 1 file changed, 23 insertions(+), 3 deletions(-) + arch/arm/mach-aspeed/ast2600/platform.S | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index f193c66cd04b..997670b66bdc 100644 +index f96ef1f0dac4..3b6f91a60c3d 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S @@ -44,7 +44,9 @@ @@ -25,7 +25,7 @@ index f193c66cd04b..997670b66bdc 100644 #define AST_SCU_CA7_PARITY_CHK (AST_SCU_BASE + 0x820) #define AST_SCU_CA7_PARITY_CLR (AST_SCU_BASE + 0x824) #define AST_SCU_MMIO_DEC_SET (AST_SCU_BASE + 0xC24) -@@ -173,6 +175,26 @@ do_primary_core_setup: +@@ -175,6 +177,26 @@ do_primary_core_setup: /* unlock system control unit */ scu_unlock @@ -52,7 +52,7 @@ index f193c66cd04b..997670b66bdc 100644 /* identify AST2600 A0/A1 */ ldr r0, =AST_SCU_REV_ID ldr r0, [r0] -@@ -262,19 +284,17 @@ skip_fill_wip_bit: +@@ -277,7 +299,6 @@ skip_fill_wip_bit: ldr r1, =AST_FMC_WDT1_CTRL_MODE str r0, [r1] @@ -60,12 +60,7 @@ index f193c66cd04b..997670b66bdc 100644 /* disable UART-based SoC Debug Interface UART5 and P2A bridge*/ ldr r0, =AST_SCU_DEBUG_CTRL ldr r1, [r0] - orr r1, #0x03 - str r1, [r0] -- -+ - /* disable UART-based SoC Debug Interface UART1 and LPC2AHB bridge */ - ldr r0, =AST_SCU_DEBUG_CTRL2 +@@ -289,7 +310,6 @@ skip_fill_wip_bit: ldr r1, [r0] orr r1, #0x0A str r1, [r0] diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0009-AST2600-Disable-DMA-arbitration-options-on-MAC1-and-.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0009-AST2600-Disable-DMA-arbitration-options-on-MAC1-and-.patch index f47092eaa..a506f3028 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0009-AST2600-Disable-DMA-arbitration-options-on-MAC1-and-.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0009-AST2600-Disable-DMA-arbitration-options-on-MAC1-and-.patch @@ -1,4 +1,4 @@ -From f1bfa10fefa992c7032e0c32647543bb2a8dc90f Mon Sep 17 00:00:00 2001 +From f545610f26089e78e71469e9006e3337670af0f4 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Tue, 31 Mar 2020 13:28:31 -0700 Subject: [PATCH] AST2600: Disable DMA arbitration options on MAC1 and MAC2 @@ -17,7 +17,7 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 18 insertions(+) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index 997670b66bdc..6b447845fe26 100644 +index 3b6f91a60c3d..eac52db538b0 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S @@ -57,6 +57,12 @@ @@ -33,10 +33,10 @@ index 997670b66bdc..6b447845fe26 100644 #define AST_GPIO_BASE (0x1E780000) #define AST_GPIOYZ_DATA_VALUE (AST_GPIO_BASE + 0x1E0) -@@ -229,6 +235,18 @@ wait_lock: - b 1f +@@ -244,6 +250,18 @@ wait_lock: + bne 2f - 0: + 1: + /* disable DMA arbitration on MAC1 (A1 bug) */ + ldr r0, =AST_MAC1_CTRL2 + ldr r1, [r0] @@ -49,7 +49,7 @@ index 997670b66bdc..6b447845fe26 100644 + orr r1, #0x18000000 + str r1, [r0] + - /* LPC/eSPI mode selection (A1 only) */ + /* LPC/eSPI mode selection by SW (AST2600/AST2620 A1 only) */ ldr r0, =AST_GPIOYZ_DATA_VALUE ldr r0, [r0] -- diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0010-Fix-timer-support.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0010-Fix-timer-support.patch index cf13a17f2..e998ae42f 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0010-Fix-timer-support.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0010-Fix-timer-support.patch @@ -1,4 +1,4 @@ -From bd4eb78dc71529342e5d0b784731c412cf747acc Mon Sep 17 00:00:00 2001 +From 97fc99c77c68ec6b71354786f94a80a26adde389 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Mon, 20 Apr 2020 10:42:05 -0700 Subject: [PATCH] Fix timer support @@ -10,8 +10,8 @@ commit adds the timer interrupt flag clearing logic. Signed-off-by: Jae Hyun Yoo --- - board/aspeed/ast2600_intel/ast-timer.c | 69 ++++++++++++++++++++-------------- - board/aspeed/ast2600_intel/intel.c | 13 ++++--- + board/aspeed/ast2600_intel/ast-timer.c | 69 +++++++++++++++----------- + board/aspeed/ast2600_intel/intel.c | 13 ++--- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/board/aspeed/ast2600_intel/ast-timer.c b/board/aspeed/ast2600_intel/ast-timer.c @@ -120,10 +120,10 @@ index cf8c69aba5d3..d98ec9238e15 100644 + AST_TIMER_BASE + TIMER_CONTROL); } diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index 47e5ad21d66d..befeaff0a953 100644 +index ebf883144418..7c005fb323e6 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c -@@ -219,16 +219,14 @@ void enable_onboard_tpm(void) +@@ -249,16 +249,14 @@ void enable_onboard_tpm(void) AST_GPIO_BASE | GPIO_000); } @@ -142,7 +142,7 @@ index 47e5ad21d66d..befeaff0a953 100644 arch_interrupt_init_early(); set_gpio_default_state(); -@@ -243,11 +241,9 @@ int board_early_init_f(void) +@@ -273,11 +271,9 @@ int board_early_init_f(void) return 0; } @@ -154,7 +154,7 @@ index 47e5ad21d66d..befeaff0a953 100644 enable_onboard_tpm(); -@@ -255,8 +251,13 @@ int board_early_init_r(void) +@@ -285,8 +281,13 @@ int board_early_init_r(void) } extern void espi_init(void); @@ -169,5 +169,5 @@ index 47e5ad21d66d..befeaff0a953 100644 return 0; -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0011-KCS-driver-support-in-uBoot.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0011-KCS-driver-support-in-uBoot.patch index f446d797a..6a37f7b72 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0011-KCS-driver-support-in-uBoot.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0011-KCS-driver-support-in-uBoot.patch @@ -1,4 +1,4 @@ -From 1fbd857e2ff5396ea057f686cbd01c6db4328316 Mon Sep 17 00:00:00 2001 +From b26b11483b006f603e0134551bfb1238e0980972 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Mon, 20 Apr 2020 11:08:22 -0700 Subject: [PATCH] KCS driver support in uBoot @@ -29,8 +29,8 @@ Signed-off-by: James Feist Signed-off-by: Jae Hyun Yoo --- board/aspeed/ast2600_intel/Makefile | 1 + - board/aspeed/ast2600_intel/ast-kcs.c | 418 +++++++++++++++++++++++++++++++++++ - board/aspeed/ast2600_intel/ast-kcs.h | 112 ++++++++++ + board/aspeed/ast2600_intel/ast-kcs.c | 418 +++++++++++++++++++++++++++ + board/aspeed/ast2600_intel/ast-kcs.h | 112 +++++++ board/aspeed/ast2600_intel/intel.c | 4 + 4 files changed, 535 insertions(+) create mode 100644 board/aspeed/ast2600_intel/ast-kcs.c @@ -588,10 +588,10 @@ index 000000000000..e9b949eccf69 + u8 data_out[MAX_KCS_PKT_SIZE]; +}; diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index befeaff0a953..6ac24beb930b 100644 +index 7c005fb323e6..b3d2fb313561 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c -@@ -251,6 +251,7 @@ int board_early_init_r(void) +@@ -281,6 +281,7 @@ int board_early_init_r(void) } extern void espi_init(void); @@ -599,7 +599,7 @@ index befeaff0a953..6ac24beb930b 100644 extern void timer_enable(int n, u32 interval_us, interrupt_handler_t *handler, void *cookie); int board_late_init(void) -@@ -260,6 +261,9 @@ int board_late_init(void) +@@ -290,6 +291,9 @@ int board_late_init(void) timer_enable(0, ONE_SEC_IN_USEC, timer_callback, (void *)0); espi_init(); @@ -610,5 +610,5 @@ index befeaff0a953..6ac24beb930b 100644 } -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0013-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0013-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch index 7d7b450a8..04baccf66 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0013-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0013-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch @@ -1,4 +1,4 @@ -From 2d0a3aff4c4aa3a764958579ed10a3aab43a7d8a Mon Sep 17 00:00:00 2001 +From e027384b44aff330375477556eed10c326ad1c48 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Mon, 27 Apr 2020 12:40:01 -0700 Subject: [PATCH] Add a workaround to cover UART interrupt bug in AST2600 A0 @@ -13,10 +13,10 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index 6ac24beb930b..ad5ab7632447 100644 +index b3d2fb313561..0d1ce69b6e53 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c -@@ -221,7 +221,19 @@ void enable_onboard_tpm(void) +@@ -251,7 +251,19 @@ void enable_onboard_tpm(void) static void timer_callback(void *cookie) { @@ -37,7 +37,7 @@ index 6ac24beb930b..ad5ab7632447 100644 } int board_early_init_f(void) -@@ -256,9 +268,13 @@ extern void timer_enable(int n, u32 interval_us, interrupt_handler_t *handler, +@@ -286,9 +298,13 @@ extern void timer_enable(int n, u32 interval_us, interrupt_handler_t *handler, void *cookie); int board_late_init(void) { @@ -54,5 +54,5 @@ index 6ac24beb930b..ad5ab7632447 100644 if (read_ffuj()) -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0016-Add-system-reset-status-support.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0016-Add-system-reset-status-support.patch index 89a8808eb..1b0d4d95b 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0016-Add-system-reset-status-support.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0016-Add-system-reset-status-support.patch @@ -1,4 +1,4 @@ -From 0a2511d407ad9294b8c08f5228d85e042c104aaa Mon Sep 17 00:00:00 2001 +From ea8f8aa37182b66893ac9afcbbb4d5043b3b4166 Mon Sep 17 00:00:00 2001 From: Yong Li Date: Tue, 9 Apr 2019 14:42:05 +0800 Subject: [PATCH] Add system reset status support @@ -13,12 +13,12 @@ Signed-off-by: AppaRao Puli Signed-off-by: Jae Hyun Yoo --- arch/arm/mach-aspeed/ast2600/scu_info.c | 4 ++ - board/aspeed/ast2600_intel/intel.c | 65 +++++++++++++++++++++++++++++++++ + board/aspeed/ast2600_intel/intel.c | 65 +++++++++++++++++++++++++ include/asm-generic/global_data.h | 3 ++ 3 files changed, 72 insertions(+) diff --git a/arch/arm/mach-aspeed/ast2600/scu_info.c b/arch/arm/mach-aspeed/ast2600/scu_info.c -index 2ee88b4dd39b..2cc6c3652bab 100644 +index fe26f743c0ca..18514c812018 100644 --- a/arch/arm/mach-aspeed/ast2600/scu_info.c +++ b/arch/arm/mach-aspeed/ast2600/scu_info.c @@ -9,6 +9,8 @@ @@ -30,7 +30,7 @@ index 2ee88b4dd39b..2cc6c3652bab 100644 /* SoC mapping Table */ #define SOC_ID(str, rev) { .name = str, .rev_id = rev, } -@@ -237,6 +239,8 @@ void aspeed_print_sysrst_info(void) +@@ -263,6 +265,8 @@ void aspeed_print_sysrst_info(void) writel(SYS_EXT_RESET, ASPEED_SYS_RESET_CTRL); } } @@ -40,7 +40,7 @@ index 2ee88b4dd39b..2cc6c3652bab 100644 #define SOC_FW_INIT_DRAM BIT(7) diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index 05872b439361..95e5492009d7 100644 +index 0d1ce69b6e53..849e81ff3fef 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c @@ -5,6 +5,7 @@ @@ -51,7 +51,7 @@ index 05872b439361..95e5492009d7 100644 /* use GPIOC0 on intel boards */ #define FFUJ_GPIO "gpio@1e78000016" -@@ -274,6 +275,65 @@ int board_early_init_r(void) +@@ -292,6 +293,65 @@ int board_early_init_r(void) return 0; } @@ -117,7 +117,7 @@ index 05872b439361..95e5492009d7 100644 extern void espi_init(void); extern void kcs_init(void); extern void timer_enable(int n, u32 interval_us, interrupt_handler_t *handler, -@@ -283,12 +343,17 @@ int board_late_init(void) +@@ -301,12 +361,17 @@ int board_late_init(void) #define SCU_014 0x014 /* Silicon Revision ID */ #define REV_ID_AST2600A0 0x05000303 /* AST2600 A0 */ #define ONE_MSEC_IN_USEC 1000 @@ -150,5 +150,5 @@ index 78dcf40bff48..fa51e384520f 100644 #endif -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0018-Add-a-workaround-to-cover-VGA-memory-size-bug-in-A0.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0018-Add-a-workaround-to-cover-VGA-memory-size-bug-in-A0.patch index da69791ea..66a1b564e 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0018-Add-a-workaround-to-cover-VGA-memory-size-bug-in-A0.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0018-Add-a-workaround-to-cover-VGA-memory-size-bug-in-A0.patch @@ -1,4 +1,4 @@ -From 1333a1ff082cbaec4a44cefaf84d1bcc03ba1510 Mon Sep 17 00:00:00 2001 +From 2f4d7260a4ab0eb33d1145cd640019aa1fa1414a Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Thu, 18 Jun 2020 15:08:57 -0700 Subject: [PATCH] Add a workaround to cover VGA memory size bug in A0 @@ -13,10 +13,10 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 17 insertions(+) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index 6b447845fe26..55b867ff1b17 100644 +index eac52db538b0..cf709aaa5d98 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S -@@ -210,6 +210,12 @@ do_primary_core_setup: +@@ -212,6 +212,12 @@ do_primary_core_setup: bne 0f @@ -29,10 +29,10 @@ index 6b447845fe26..55b867ff1b17 100644 /* tune up CPU clocks (A0 only) */ ldr r0, =AST_SCU_HW_STRAP1 ldr r1, [r0] -@@ -235,6 +241,17 @@ wait_lock: - b 1f +@@ -250,6 +256,17 @@ wait_lock: + bne 2f - 0: + 1: + /* set VGA memory size to 16MB (A1 only) */ + ldr r0, =AST_SCU_HW_STRAP1_CLR + movw r1, #0x4000 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0019-Apply-WDT1-2-reset-mask-to-reset-needed-controller.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0019-Apply-WDT1-2-reset-mask-to-reset-needed-controller.patch index ea7650f8b..26c83f8d6 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0019-Apply-WDT1-2-reset-mask-to-reset-needed-controller.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0019-Apply-WDT1-2-reset-mask-to-reset-needed-controller.patch @@ -1,4 +1,4 @@ -From a56e138569ce7b37285d4c2f2b4ef4082ab2a283 Mon Sep 17 00:00:00 2001 +From 783ef5212c5efc0561361fd779f1be3b047aee74 Mon Sep 17 00:00:00 2001 From: Suryakanth Sekar Date: Thu, 18 Jun 2020 05:32:48 +0530 Subject: [PATCH] Apply WDT1-2 reset mask to reset needed controller @@ -61,7 +61,7 @@ Signed-off-by: Kuiying Wang 1 file changed, 22 insertions(+) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index 55b867ff1b17..cd8a57edd76b 100644 +index cf709aaa5d98..027265593f03 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S @@ -63,6 +63,14 @@ @@ -79,10 +79,10 @@ index 55b867ff1b17..cd8a57edd76b 100644 #define AST_GPIO_BASE (0x1E780000) #define AST_GPIOYZ_DATA_VALUE (AST_GPIO_BASE + 0x1E0) -@@ -277,6 +285,20 @@ wait_lock: +@@ -292,6 +300,20 @@ wait_lock: str r1, [r0] - 1: + 2: + /* disable eSPI, LPC and PWM resets on WDT1 reset */ + ldr r0, =AST_WDT1_RESET_MASK2 + ldr r1, [r0] diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0021-AST2600-Enable-host-searial-port-clock-configuration.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0021-AST2600-Enable-host-searial-port-clock-configuration.patch deleted file mode 100644 index 915b0197f..000000000 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0021-AST2600-Enable-host-searial-port-clock-configuration.patch +++ /dev/null @@ -1,71 +0,0 @@ -From c2e2496dfd8cde56e32274b11968185a77f40736 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Tue, 10 Dec 2019 14:58:10 +0800 -Subject: [PATCH] AST2600: Enable host searial port clock configuration in - u-boot - -In u-boot could read env variable "hostsearialcfg" and set the corresponding -clock for host searail port. - -Tested: -setenv hostsearialcfg 1, speed is set to 192Mhz (baud rate 921600) -other value, speed is set to 24Mhz(baud rate 115200) -by default is 24Mhz. - -Signed-off-by: Kuiying Wang ---- - board/aspeed/ast2600_intel/intel.c | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - -diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index a02e246d0d81..eb9b3959625e 100644 ---- a/board/aspeed/ast2600_intel/intel.c -+++ b/board/aspeed/ast2600_intel/intel.c -@@ -36,9 +36,44 @@ int gpio_abort(void) - } - - #define SCU_BASE 0x1E6E2000 -+#define SCU_338 0x338 //Generate UART 24 MHz Reference from UXCLK -+#define SCU_33C 0x33c //Generate UART 24 MHz Reference from HUXCLK -+#define SCU_338_R_VALUE_192MHZ 0x8e -+#define SCU_338_N_VALUE_192MHZ 0x3c3 -+#define SCU_338_R_VALUE_24MHZ 0x06 -+#define SCU_338_N_VALUE_24MHZ 0x145 -+#define HOST_SERIAL_HIGH_SPEED_192MHZ 1 -+#define R_VALUE_BITS 8 -+#define V_VALUE_BITS 10 -+#define R_V_VALUE_MASK (1 << (R_VALUE_BITS + V_VALUE_BITS)) -+ - int misc_init_r(void) - { - /* This is called near the end of the _r init sequence */ -+ /* By default host serail is set 24Mhz */ -+ uint32_t host_serial_cfg = 0; -+ char *host_serial_cfg_txt = NULL; -+ -+ /* Config the uart clock source based on environment configuration */ -+ host_serial_cfg_txt = env_get("hostserialcfg"); -+ -+ if (host_serial_cfg_txt != NULL) -+ host_serial_cfg = simple_strtoul(host_serial_cfg_txt, NULL, 16); -+ -+ if (host_serial_cfg > HOST_SERIAL_HIGH_SPEED_192MHZ || host_serial_cfg < 0) { -+ printf("Invalid hostserialcfg %x, 24Mhz is set by default!\n", host_serial_cfg); -+ host_serial_cfg = 0; -+ } -+ -+ if (host_serial_cfg & HOST_SERIAL_HIGH_SPEED_192MHZ) { -+ writel((readl(SCU_BASE | SCU_338) & R_V_VALUE_MASK) | -+ (SCU_338_N_VALUE_192MHZ << R_VALUE_BITS) | SCU_338_R_VALUE_192MHZ, -+ SCU_BASE | SCU_338); -+ } else { -+ writel((readl(SCU_BASE | SCU_338) & R_V_VALUE_MASK) | -+ (SCU_338_N_VALUE_24MHZ << R_VALUE_BITS) | SCU_338_R_VALUE_24MHZ, -+ SCU_BASE | SCU_338); -+ } - - return 0; - } --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0023-Add-WDT-to-u-boot-to-cover-booting-failures.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0023-Add-WDT-to-u-boot-to-cover-booting-failures.patch index da7889be6..e62403413 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0023-Add-WDT-to-u-boot-to-cover-booting-failures.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0023-Add-WDT-to-u-boot-to-cover-booting-failures.patch @@ -1,4 +1,4 @@ -From 473b1990ecb578b6dc5d3347dc0ab8f7d5609137 Mon Sep 17 00:00:00 2001 +From 385629a99a8d07182812264f2868d5f85fb711e0 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Wed, 16 Sep 2020 13:25:36 -0700 Subject: [PATCH] Add WDT to u-boot to cover booting failures @@ -20,7 +20,7 @@ Signed-off-by: Jae Hyun Yoo 7 files changed, 116 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index cd8a57edd76b..08f33a9f1a17 100644 +index 027265593f03..e57bd325277f 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S @@ -64,6 +64,9 @@ @@ -33,7 +33,7 @@ index cd8a57edd76b..08f33a9f1a17 100644 #define AST_WDT1_RESET_MASK1 (AST_WDT1_BASE + 0x01C) #define AST_WDT1_RESET_MASK2 (AST_WDT1_BASE + 0x020) -@@ -313,6 +316,18 @@ wait_lock: +@@ -328,6 +331,18 @@ wait_lock: ldr r1, =AST_SCU_CA7_PARITY_CHK str r0, [r1] @@ -150,7 +150,7 @@ index 4d4248f234fb..90687092e1ae 100644 from += len; to += len; diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c -index 1793a9e1f560..2ba5e5d65f4a 100644 +index a8f5b6158241..69dfc7f21698 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -20,6 +20,7 @@ @@ -161,7 +161,7 @@ index 1793a9e1f560..2ba5e5d65f4a 100644 #include "sf_internal.h" -@@ -425,6 +426,10 @@ static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, +@@ -429,6 +430,10 @@ static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, unsigned long timebase; int ret; @@ -300,12 +300,12 @@ index c2dc3cf548d2..811ead41bb95 100644 return 0; } diff --git a/include/configs/aspeed-common.h b/include/configs/aspeed-common.h -index 255901ff0ea8..0797cd4febed 100755 +index 70590067dbcf..0eaf76b50b39 100644 --- a/include/configs/aspeed-common.h +++ b/include/configs/aspeed-common.h -@@ -18,6 +18,8 @@ - #define CONFIG_IPADDR 192.168.0.45 - #define CONFIG_SERVERIP 192.168.0.81 +@@ -20,6 +20,8 @@ + + #define CONFIG_STANDALONE_LOAD_ADDR 0x83000000 +#define CONFIG_HW_WATCHDOG + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch deleted file mode 100644 index 8cc95174f..000000000 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 1f95d121b4a11444bffd0494bcfff1986e0905b6 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Tue, 8 Jan 2019 13:33:15 -0800 -Subject: [PATCH] Enable PCIe L1 support - -This commit enables PCIe L1 support using magic registers. - -Signed-off-by: Jae Hyun Yoo ---- - arch/arm/mach-aspeed/ast2600/platform.S | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index cd8a57edd76b..ecc9fd33d125 100644 ---- a/arch/arm/mach-aspeed/ast2600/platform.S -+++ b/arch/arm/mach-aspeed/ast2600/platform.S -@@ -299,6 +299,20 @@ wait_lock: - bic r1, r2 - str r1, [r0] - -+ /* enable PCIe L1 support */ -+ ldr r0, =0x1e6ed07c -+ ldr r1, =0xa8 -+ str r1, [r0] -+ ldr r0, =0x1e6ed010 -+ ldr r1, =0x27040fe1 -+ str r1, [r0] -+ ldr r0, =0x1e6ed068 -+ ldr r1, =0xc81f0a -+ str r1, [r0] -+ ldr r0, =0x1e6ed07c -+ mov r1, #0 -+ str r1, [r0] -+ - /* MMIO decode setting */ - ldr r0, =AST_SCU_MMIO_DEC_SET - mov r1, #0x2000 --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch index 23fc22ea7..1191a6077 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch @@ -1,4 +1,4 @@ -From 5ca28a9259d084440879be48ef4b4d6716794281 Mon Sep 17 00:00:00 2001 +From 438ff3a8db6718bb137dccaafa707f8275407742 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Mon, 22 Feb 2021 17:22:16 +0530 Subject: [PATCH] ast2600-PFR-platform-EXTRST-reset-mask-selection @@ -12,11 +12,11 @@ to be reset so that Host functionality would be intact. Signed-off-by: Chalapathi Venkataramashetty Signed-off-by: Vikram Bodireddy --- - arch/arm/mach-aspeed/ast2600/platform.S | 11 +++++++++++ - 1 file changed, 11 insertions(+) + arch/arm/mach-aspeed/ast2600/platform.S | 12 ++++++++++++ + 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S -index ecc9fd33d1..8c40515b76 100644 +index bdc0884de1bd..d7115c96f117 100644 --- a/arch/arm/mach-aspeed/ast2600/platform.S +++ b/arch/arm/mach-aspeed/ast2600/platform.S @@ -39,6 +39,8 @@ @@ -28,14 +28,15 @@ index ecc9fd33d1..8c40515b76 100644 #define AST_SCU_DEBUG_CTRL (AST_SCU_BASE + 0x0C8) #define AST_SCU_DEBUG_CTRL2 (AST_SCU_BASE + 0x0D8) #define AST_SCU_HPLL_PARAM (AST_SCU_BASE + 0x200) -@@ -285,6 +287,15 @@ wait_lock: +@@ -303,6 +305,16 @@ wait_lock: str r1, [r0] - 1: + 2: + /* SCU060:EXTRST1# reset mask selection */ + ldr r0, =AST_SCU_EXTRST_SEL1 + ldr r1, =0x6FF1FF5 + str r1, [r0] ++ + /* SCU070:EXTRST2# reset mask selection */ + ldr r0, =AST_SCU_EXTRST_SEL2 + ldr r1, =0x3FFFFF7 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0026-Enable-PCIe-L1-support.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0026-Enable-PCIe-L1-support.patch new file mode 100644 index 000000000..b01b96e16 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0026-Enable-PCIe-L1-support.patch @@ -0,0 +1,40 @@ +From 8534fb50dfe7c4e1c042843ded54c4ed23ee7bc2 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Tue, 8 Jan 2019 13:33:15 -0800 +Subject: [PATCH] Enable PCIe L1 support + +This commit enables PCIe L1 support using magic registers. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/mach-aspeed/ast2600/platform.S | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S +index d7115c96f117..803ff94c4fc0 100644 +--- a/arch/arm/mach-aspeed/ast2600/platform.S ++++ b/arch/arm/mach-aspeed/ast2600/platform.S +@@ -329,6 +329,20 @@ wait_lock: + bic r1, r2 + str r1, [r0] + ++ /* enable PCIe L1 support */ ++ ldr r0, =0x1e6ed07c ++ ldr r1, =0xa8 ++ str r1, [r0] ++ ldr r0, =0x1e6ed010 ++ ldr r1, =0x27040fe1 ++ str r1, [r0] ++ ldr r0, =0x1e6ed068 ++ ldr r1, =0xc81f0a ++ str r1, [r0] ++ ldr r0, =0x1e6ed07c ++ mov r1, #0 ++ str r1, [r0] ++ + /* MMIO decode setting */ + ldr r0, =AST_SCU_MMIO_DEC_SET + mov r1, #0x2000 +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0030-Add-Aspeed-PWM-uclass-driver.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0030-Add-Aspeed-PWM-uclass-driver.patch new file mode 100644 index 000000000..ac7262f2c --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0030-Add-Aspeed-PWM-uclass-driver.patch @@ -0,0 +1,576 @@ +From b68b7c30fa3331642e321d150017d431d8cf6f6d Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Mon, 17 May 2021 13:11:24 -0700 +Subject: [PATCH] Add Aspeed PWM uclass driver + +This commit adds Aspeed PWM uclass driver to set default FAN speed +in u-boot. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/dts/ast2600-intel.dts | 11 ++ + arch/arm/dts/ast2600.dtsi | 88 ++++++++++++ + board/aspeed/ast2600_intel/intel.c | 49 +++++++ + drivers/pinctrl/aspeed/pinctrl_ast2600.c | 130 ++++++++++++++++- + drivers/pwm/Kconfig | 8 ++ + drivers/pwm/Makefile | 1 + + drivers/pwm/aspeed_pwm.c | 175 +++++++++++++++++++++++ + 7 files changed, 461 insertions(+), 1 deletion(-) + create mode 100644 drivers/pwm/aspeed_pwm.c + +diff --git a/arch/arm/dts/ast2600-intel.dts b/arch/arm/dts/ast2600-intel.dts +index 5243d1a0afc3..79356d8b7a64 100644 +--- a/arch/arm/dts/ast2600-intel.dts ++++ b/arch/arm/dts/ast2600-intel.dts +@@ -53,6 +53,17 @@ + }; + }; + ++&pwm { ++ status = "okay"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pwm0_default &pinctrl_pwm1_default ++ &pinctrl_pwm2_default &pinctrl_pwm3_default ++ &pinctrl_pwm4_default &pinctrl_pwm5_default ++ &pinctrl_pwm12g1_default &pinctrl_pwm13g1_default ++ &pinctrl_pwm14g1_default &pinctrl_pwm15g1_default>; ++}; ++ + &gpio0 { + status = "okay"; + }; +diff --git a/arch/arm/dts/ast2600.dtsi b/arch/arm/dts/ast2600.dtsi +index e619f7118886..44ec6655fee7 100644 +--- a/arch/arm/dts/ast2600.dtsi ++++ b/arch/arm/dts/ast2600.dtsi +@@ -265,6 +265,14 @@ + #size-cells = <1>; + ranges; + ++ pwm: pwm-controller@1e610000 { ++ compatible = "aspeed,ast2600-pwm"; ++ reg = <0x1e610000 0x100>; ++ clocks = <&scu ASPEED_CLK_AHB>; ++ resets = <&rst ASPEED_RESET_PWM>; ++ status = "disabled"; ++ }; ++ + syscon: syscon@1e6e2000 { + compatible = "aspeed,g6-scu", "syscon", "simple-mfd"; + reg = <0x1e6e2000 0x1000>; +@@ -1589,6 +1597,86 @@ + groups = "PWM7"; + }; + ++ pinctrl_pwm8g1_default: pwm8g1_default { ++ function = "PWM8G1"; ++ groups = "PWM8G1"; ++ }; ++ ++ pinctrl_pwm9g1_default: pwm9g1_default { ++ function = "PWM9G1"; ++ groups = "PWM9G1"; ++ }; ++ ++ pinctrl_pwm10g1_default: pwm10g1_default { ++ function = "PWM10G1"; ++ groups = "PWM10G1"; ++ }; ++ ++ pinctrl_pwm11g1_default: pwm11g1_default { ++ function = "PWM11G1"; ++ groups = "PWM11G1"; ++ }; ++ ++ pinctrl_pwm12g1_default: pwm12g1_default { ++ function = "PWM12G1"; ++ groups = "PWM12G1"; ++ }; ++ ++ pinctrl_pwm13g1_default: pwm13g1_default { ++ function = "PWM13G1"; ++ groups = "PWM13G1"; ++ }; ++ ++ pinctrl_pwm14g1_default: pwm14g1_default { ++ function = "PWM14G1"; ++ groups = "PWM14G1"; ++ }; ++ ++ pinctrl_pwm15g1_default: pwm15g1_default { ++ function = "PWM15G1"; ++ groups = "PWM15G1"; ++ }; ++ ++ pinctrl_pwm8g0_default: pwm8g0_default { ++ function = "PWM8G0"; ++ groups = "PWM8G0"; ++ }; ++ ++ pinctrl_pwm9g0_default: pwm9g0_default { ++ function = "PWM9G0"; ++ groups = "PWM9G0"; ++ }; ++ ++ pinctrl_pwm10g0_default: pwm10g0_default { ++ function = "PWM10G0"; ++ groups = "PWM10G0"; ++ }; ++ ++ pinctrl_pwm11g0_default: pwm11g0_default { ++ function = "PWM11G0"; ++ groups = "PWM11G0"; ++ }; ++ ++ pinctrl_pwm12g0_default: pwm12g0_default { ++ function = "PWM12G0"; ++ groups = "PWM12G0"; ++ }; ++ ++ pinctrl_pwm13g0_default: pwm13g0_default { ++ function = "PWM13G0"; ++ groups = "PWM13G0"; ++ }; ++ ++ pinctrl_pwm14g0_default: pwm14g0_default { ++ function = "PWM14G0"; ++ groups = "PWM14G0"; ++ }; ++ ++ pinctrl_pwm15g0_default: pwm15g0_default { ++ function = "PWM15G0"; ++ groups = "PWM15G0"; ++ }; ++ + pinctrl_rgmii1_default: rgmii1_default { + function = "RGMII1"; + groups = "RGMII1"; +diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c +index ec6b70ae6659..11b8d4dd8360 100644 +--- a/board/aspeed/ast2600_intel/intel.c ++++ b/board/aspeed/ast2600_intel/intel.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + #define SYS_PWR_RESET_FLAG BIT(0) /* from scu_info.c */ + #define WATCHDOG_RESET_BIT BIT(20) +@@ -426,6 +427,53 @@ static void mailbox_init(void) + } + } + ++struct pwm_setting { ++ uint channel; ++ uint duty_pct; ++}; ++ ++static void pwm_init(void) ++{ ++#define NSEC_PER_SEC 1000000000L ++#define PWM_TARGET_FREQ 25000 ++#define PWM_TICK_NS (NSEC_PER_SEC / PWM_TARGET_FREQ) ++#define PWM_TICK_1PCT_NS (PWM_TICK_NS / 100) ++ const struct pwm_setting settings[] = { ++ {0, 65}, ++ {1, 65}, ++ {2, 65}, ++ {3, 65}, ++ {4, 65}, ++ {5, 65}, ++ {12, 65}, ++ {13, 65}, ++ {14, 65}, ++ {15, 65}, ++ }; ++ struct udevice *dev; ++ int ret, setting_size, i; ++ ++ ret = uclass_first_device(UCLASS_PWM, &dev); ++ if (ret) { ++ debug("Can't find PWM controller: %d\n", ret); ++ return; ++ } ++ ++ setting_size = sizeof(settings) / sizeof(settings[0]); ++ ++ for (i = 0; i < setting_size; i++) { ++ ret = pwm_set_config(dev, settings[i].channel, PWM_TICK_NS, ++ settings[i].duty_pct * PWM_TICK_1PCT_NS); ++ if (!ret) { ++ ret = pwm_set_enable(dev, settings[i].channel, true); ++ if (ret) ++ debug("PWM enabling failed: %d\n", ret); ++ } else { ++ debug("PWM configure failed: %d\n", ret); ++ } ++ } ++} ++ + int board_early_init_f(void) + { + /* This is called before relocation; beware! */ +@@ -613,6 +661,7 @@ int board_late_init(void) + timer_callback, (void *)1); + #endif + ++ pwm_init(); + espi_init(); + + /* Add reset reason to bootargs */ +diff --git a/drivers/pinctrl/aspeed/pinctrl_ast2600.c b/drivers/pinctrl/aspeed/pinctrl_ast2600.c +index 8a77a5d31556..980667f84e30 100644 +--- a/drivers/pinctrl/aspeed/pinctrl_ast2600.c ++++ b/drivers/pinctrl/aspeed/pinctrl_ast2600.c +@@ -326,6 +326,110 @@ static struct aspeed_sig_desc pcie1rc_link[] = { + { 0x500, BIT(24), 0 }, //dedicate rc reset + }; + ++static struct aspeed_sig_desc pwm0[] = { ++ { 0x41C, BIT(16), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm1[] = { ++ { 0x41C, BIT(17), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm2[] = { ++ { 0x41C, BIT(18), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm3[] = { ++ { 0x41C, BIT(19), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm4[] = { ++ { 0x41C, BIT(20), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm5[] = { ++ { 0x41C, BIT(21), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm6[] = { ++ { 0x41C, BIT(22), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm7[] = { ++ { 0x41C, BIT(23), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm8g1[] = { ++ { 0x41C, BIT(24), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm9g1[] = { ++ { 0x41C, BIT(25), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm10g1[] = { ++ { 0x41C, BIT(26), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm11g1[] = { ++ { 0x41C, BIT(27), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm12g1[] = { ++ { 0x41C, BIT(28), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm13g1[] = { ++ { 0x41C, BIT(29), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm14g1[] = { ++ { 0x41C, BIT(30), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm15g1[] = { ++ { 0x41C, BIT(31), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm8g0[] = { ++ { 0x414, BIT(8), 1 }, ++ { 0x4B4, BIT(8), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm9g0[] = { ++ { 0x414, BIT(9), 1 }, ++ { 0x4B4, BIT(9), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm10g0[] = { ++ { 0x414, BIT(10), 1 }, ++ { 0x4B4, BIT(10), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm11g0[] = { ++ { 0x414, BIT(11), 1 }, ++ { 0x4B4, BIT(11), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm12g0[] = { ++ { 0x414, BIT(12), 1 }, ++ { 0x4B4, BIT(12), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm13g0[] = { ++ { 0x414, BIT(13), 1 }, ++ { 0x4B4, BIT(13), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm14g0[] = { ++ { 0x414, BIT(14), 1 }, ++ { 0x4B4, BIT(14), 0 }, ++}; ++ ++static struct aspeed_sig_desc pwm15g0[] = { ++ { 0x414, BIT(15), 1 }, ++ { 0x4B4, BIT(15), 0 }, ++}; ++ + static const struct aspeed_group_config ast2600_groups[] = { + { "MAC1LINK", ARRAY_SIZE(mac1_link), mac1_link }, + { "MAC2LINK", ARRAY_SIZE(mac2_link), mac2_link }, +@@ -383,7 +487,31 @@ static const struct aspeed_group_config ast2600_groups[] = { + { "USB2AH", ARRAY_SIZE(usb2ah_link), usb2ah_link }, + { "USB2BH", ARRAY_SIZE(usb2bh_link), usb2bh_link }, + { "PCIE0RC", ARRAY_SIZE(pcie0rc_link), pcie0rc_link }, +- { "PCIE1RC", ARRAY_SIZE(pcie1rc_link), pcie1rc_link }, ++ { "PCIE1RC", ARRAY_SIZE(pcie1rc_link), pcie1rc_link }, ++ { "PWM0", ARRAY_SIZE(pwm0), pwm0 }, ++ { "PWM1", ARRAY_SIZE(pwm1), pwm1 }, ++ { "PWM2", ARRAY_SIZE(pwm2), pwm2 }, ++ { "PWM3", ARRAY_SIZE(pwm3), pwm3 }, ++ { "PWM4", ARRAY_SIZE(pwm4), pwm4 }, ++ { "PWM5", ARRAY_SIZE(pwm5), pwm5 }, ++ { "PWM6", ARRAY_SIZE(pwm6), pwm6 }, ++ { "PWM7", ARRAY_SIZE(pwm7), pwm7 }, ++ { "PWM8G1", ARRAY_SIZE(pwm8g1), pwm8g1 }, ++ { "PWM9G1", ARRAY_SIZE(pwm9g1), pwm9g1 }, ++ { "PWM10G1", ARRAY_SIZE(pwm10g1), pwm10g1 }, ++ { "PWM11G1", ARRAY_SIZE(pwm11g1), pwm11g1 }, ++ { "PWM12G1", ARRAY_SIZE(pwm12g1), pwm12g1 }, ++ { "PWM13G1", ARRAY_SIZE(pwm13g1), pwm13g1 }, ++ { "PWM14G1", ARRAY_SIZE(pwm14g1), pwm14g1 }, ++ { "PWM15G1", ARRAY_SIZE(pwm15g1), pwm15g1 }, ++ { "PWM8G0", ARRAY_SIZE(pwm8g0), pwm8g0 }, ++ { "PWM9G0", ARRAY_SIZE(pwm9g0), pwm9g0 }, ++ { "PWM10G0", ARRAY_SIZE(pwm10g0), pwm10g0 }, ++ { "PWM11G0", ARRAY_SIZE(pwm11g0), pwm11g0 }, ++ { "PWM12G0", ARRAY_SIZE(pwm12g0), pwm12g0 }, ++ { "PWM13G0", ARRAY_SIZE(pwm13g0), pwm13g0 }, ++ { "PWM14G0", ARRAY_SIZE(pwm14g0), pwm14g0 }, ++ { "PWM15G0", ARRAY_SIZE(pwm15g0), pwm15g0 }, + }; + + static int ast2600_pinctrl_get_groups_count(struct udevice *dev) +diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig +index 2984b7976637..95e82ee5ddf6 100644 +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -50,3 +50,11 @@ config PWM_SUNXI + help + This PWM is found on H3, A64 and other Allwinner SoCs. It supports a + programmable period and duty cycle. A 16-bit counter is used. ++ ++config PWM_ASPEED ++ bool "Enable support for the Aspeed AST2600 PWM" ++ depends on DM_PWM ++ depends on ASPEED_AST2600 ++ help ++ This PWM is found on Aspeed AST2600 SoC. It supports a programmable ++ period and duty cycle. A 16-bit counter is used. +diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile +index a837c35ed2e3..770b054c3f3b 100644 +--- a/drivers/pwm/Makefile ++++ b/drivers/pwm/Makefile +@@ -16,3 +16,4 @@ obj-$(CONFIG_PWM_ROCKCHIP) += rk_pwm.o + obj-$(CONFIG_PWM_SANDBOX) += sandbox_pwm.o + obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o + obj-$(CONFIG_PWM_SUNXI) += sunxi_pwm.o ++obj-$(CONFIG_PWM_ASPEED) += aspeed_pwm.o +diff --git a/drivers/pwm/aspeed_pwm.c b/drivers/pwm/aspeed_pwm.c +new file mode 100644 +index 000000000000..111e2971d226 +--- /dev/null ++++ b/drivers/pwm/aspeed_pwm.c +@@ -0,0 +1,172 @@ ++// SPDX-License-Identifier: GPL ++// Copyright (c) 2021 Intel Corporation ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define NSEC_PER_SEC 1000000000L ++ ++#define ASPEED_PWM_CTRL 0x00 /* PWM0 General Register */ ++#define ASPEED_PWM_CTRL_CH(x) (((x) * 0x10) + ASPEED_PWM_CTRL) ++#define PWM_LOAD_AS_WDT BIT(19) ++#define PWM_DUTY_LOAD_AS_WDT_EN BIT(18) ++#define PWM_DUTY_SYNC_DIS BIT(17) ++#define PWM_CLK_ENABLE BIT(16) ++#define PWM_LEVEL_OUTPUT BIT(15) ++#define PWM_INVERSE BIT(14) ++#define PWM_OPEN_DRAIN_EN BIT(13) ++#define PWM_PIN_EN BIT(12) ++#define PWM_CLK_DIV_H_MASK GENMASK(11, 8) ++#define PWM_CLK_DIV_L_MASK GENMASK(7, 0) ++ ++#define ASPEED_PWM_DUTY_CYCLE 0x04 /* PWM0 Duty Cycle Register */ ++#define ASPEED_PWM_DUTY_CYCLE_CH(x) (((x) * 0x10) + ASPEED_PWM_DUTY_CYCLE) ++#define PWM_PERIOD_MASK GENMASK(31, 24) ++#define PWM_RISING_FALLING_AS_WDT_MASK GENMASK(23, 16) ++#define PWM_RISING_POINT_MASK GENMASK(15, 8) ++#define PWM_FALLING_POINT_MASK GENMASK(7, 0) ++ ++#define PWM_PERIOD_MAX 255 ++ ++struct aspeed_pwm_priv { ++ void __iomem *base; ++ ulong clk_freq; ++ u32 clk_tick_ns; ++}; ++ ++static int aspeed_pwm_set_config(struct udevice *dev, uint channel, ++ uint period_ns, uint duty_ns) ++{ ++ struct aspeed_pwm_priv *priv = dev_get_priv(dev); ++ u8 div_h, div_l, period_value, falling_point, rising_point; ++ u32 ctrl_value, duty_value, tick_ns; ++ ++ /* ++ * We currently avoid using 64bit arithmetic by using the ++ * fact that anything faster than 1Hz is easily representable ++ * by 32bits. ++ */ ++ if (period_ns > NSEC_PER_SEC) ++ return -ERANGE; ++ ++ for (div_l = 0; div_l <= 0xff; div_l++) { ++ for (div_h = 0; div_h <= 0xf; div_h++) { ++ tick_ns = priv->clk_tick_ns * BIT(div_h) * (div_l + 1); ++ if (tick_ns * PWM_PERIOD_MAX >= period_ns) ++ break; ++ } ++ if (tick_ns * PWM_PERIOD_MAX >= period_ns) ++ break; ++ } ++ ++ if (period_ns / tick_ns > PWM_PERIOD_MAX) ++ return -ERANGE; ++ ++ ctrl_value = FIELD_PREP(PWM_CLK_DIV_H_MASK, div_h) | ++ FIELD_PREP(PWM_CLK_DIV_L_MASK, div_l); ++ period_value = period_ns / tick_ns; ++ falling_point = 0; ++ rising_point = duty_ns / tick_ns; ++ duty_value = FIELD_PREP(PWM_PERIOD_MASK, period_value) | ++ FIELD_PREP(PWM_RISING_POINT_MASK, rising_point) | ++ FIELD_PREP(PWM_FALLING_POINT_MASK, falling_point); ++ ++ clrsetbits_le32(priv->base + ASPEED_PWM_DUTY_CYCLE_CH(channel), ++ PWM_PERIOD_MASK | PWM_RISING_POINT_MASK | ++ PWM_FALLING_POINT_MASK, duty_value); ++ clrsetbits_le32(priv->base + ASPEED_PWM_CTRL_CH(channel), ++ PWM_CLK_DIV_H_MASK | PWM_CLK_DIV_L_MASK, ctrl_value); ++ ++ return 0; ++} ++ ++static int aspeed_pwm_set_enable(struct udevice *dev, uint channel, bool enable) ++{ ++ struct aspeed_pwm_priv *priv = dev_get_priv(dev); ++ ++ debug("%s: Enable '%s' channel %u\n", __func__, dev->name, channel); ++ ++ clrsetbits_le32(priv->base + ASPEED_PWM_CTRL_CH(channel), ++ PWM_CLK_ENABLE | PWM_PIN_EN, ++ enable ? PWM_CLK_ENABLE | PWM_PIN_EN : 0); ++ ++ return 0; ++} ++ ++static int aspeed_pwm_ofdata_to_platdata(struct udevice *dev) ++{ ++ struct aspeed_pwm_priv *priv = dev_get_priv(dev); ++ struct resource res_regs; ++ int ret; ++ ++ ret = dev_read_resource(dev, 0, &res_regs); ++ if (ret < 0) ++ return ret; ++ ++ priv->base = (void __iomem *)res_regs.start; ++ ++ return 0; ++} ++ ++static int aspeed_pwm_probe(struct udevice *dev) ++{ ++ struct aspeed_pwm_priv *priv = dev_get_priv(dev); ++ struct reset_ctl reset_ctl; ++ struct clk hclk; ++ int ret; ++ ++ ret = clk_get_by_index(dev, 0, &hclk); ++ if (ret) { ++ pr_err("%s: could not get clock: %d\n", dev->name, ret); ++ return ret; ++ } ++ ++ priv->clk_freq = clk_get_rate(&hclk); ++ priv->clk_tick_ns = NSEC_PER_SEC / priv->clk_freq; ++ (void) clk_free(&hclk); ++ ++ ret = reset_get_by_index(dev, 0, &reset_ctl); ++ if (ret) { ++ pr_err("%s: Failed to get reset signal: %d\n", dev->name, ret); ++ return ret; ++ } ++ ++ ret = reset_assert(&reset_ctl); ++ if (!ret) { ++ mdelay(10); ++ ret = reset_deassert(&reset_ctl); ++ } ++ ++ return ret; ++} ++ ++static const struct pwm_ops aspeed_pwm_ops = { ++ .set_config = aspeed_pwm_set_config, ++ .set_enable = aspeed_pwm_set_enable, ++}; ++ ++static const struct udevice_id aspeed_pwm_ids[] = { ++ { .compatible = "aspeed,ast2600-pwm" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(aspeed_pwm) = { ++ .name = "aspeed_pwm", ++ .id = UCLASS_PWM, ++ .of_match = aspeed_pwm_ids, ++ .ops = &aspeed_pwm_ops, ++ .ofdata_to_platdata = aspeed_pwm_ofdata_to_platdata, ++ .priv_auto_alloc_size = sizeof(struct aspeed_pwm_priv), ++ .probe = aspeed_pwm_probe, ++}; ++ ++MODULE_AUTHOR("Jae Hyun Yoo "); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Aspeed AST2600 PWM Driver"); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0031-Add-a-workaround-to-fix-AST2600-A0-booting-issue.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0031-Add-a-workaround-to-fix-AST2600-A0-booting-issue.patch new file mode 100644 index 000000000..9444dde99 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0031-Add-a-workaround-to-fix-AST2600-A0-booting-issue.patch @@ -0,0 +1,32 @@ +From 58ed1cb4ac3229b484c983a2e4982fad13da0e06 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Fri, 21 May 2021 17:24:13 -0700 +Subject: [PATCH] Add a workaround to fix AST2600 A0 booting issue + +AST2600 A0 doesn't boot with 88KB SRAM setting so this commit adds +a workaround which pins SRAM size to 64KB to make A0 able to boot. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/include/asm/arch-aspeed/platform.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/include/asm/arch-aspeed/platform.h b/arch/arm/include/asm/arch-aspeed/platform.h +index f016bdaba3e7..192e3b977a34 100644 +--- a/arch/arm/include/asm/arch-aspeed/platform.h ++++ b/arch/arm/include/asm/arch-aspeed/platform.h +@@ -53,7 +53,11 @@ + #define ASPEED_MAC_COUNT 4 + #define ASPEED_DRAM_BASE 0x80000000 + #define ASPEED_SRAM_BASE 0x10000000 ++#if 1 /* AST2600 A0 doesn't boot with 88K setting so pin SRAM size to 64K */ ++#define ASPEED_SRAM_SIZE 0x10000 ++#else + #define ASPEED_SRAM_SIZE 0x16000 ++#endif + #define ASPEED_FMC_CS0_BASE 0x20000000 + #else + #err "No define for platform.h" +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/intel.cfg b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/intel.cfg index 1ac02608b..e61f3de1e 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/intel.cfg +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/intel.cfg @@ -12,6 +12,8 @@ CONFIG_CMD_IRQ=y CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x2400000 CONFIG_BOARD_LATE_INIT=y +CONFIG_DM_PWM=y +CONFIG_PWM_ASPEED=y CONFIG_TARGET_EVB_AST2600A1=n CONFIG_PHY_NCSI=n CONFIG_CMD_USB=n 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 29d938c6e..dd03c1f17 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 @@ -7,7 +7,7 @@ FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files:" SRC_URI_append_intel-ast2600 = " \ file://intel.cfg \ file://0001-Add-ast2600-intel-as-a-new-board.patch \ - file://0021-AST2600-Enable-host-searial-port-clock-configuration.patch \ + file://0002-AST2600-Enable-host-searial-port-clock-configuration.patch \ file://0003-ast2600-intel-layout-environment-addr.patch \ file://0004-AST2600-Adjust-default-GPIO-settings.patch \ file://0005-Ast2600-Enable-interrupt-in-u-boot.patch \ @@ -30,10 +30,12 @@ SRC_URI_append_intel-ast2600 = " \ file://0023-Add-WDT-to-u-boot-to-cover-booting-failures.patch \ file://0024-fix-SUS_WARN-handling-logic.patch \ file://0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch \ - file://0025-Enable-PCIe-L1-support.patch \ + file://0026-Enable-PCIe-L1-support.patch \ file://0027-ast2600-Add-Mailbox-init-function.patch \ file://0028-Improve-randomness-of-mac-address-generation.patch \ file://0029-Set-UART-routing-in-lowlevel_init.patch \ + file://0030-Add-Aspeed-PWM-uclass-driver.patch \ + file://0031-Add-a-workaround-to-fix-AST2600-A0-booting-issue.patch \ " # CVE-2020-10648 vulnerability fix @@ -57,12 +59,6 @@ SRC_URI_append_intel-ast2600 = " \ file://0001-lib-uuid-Fix-unseeded-PRNG-on-RANDOM_UUID-y.patch \ " -# CVE-2019-13104 vulnerability fix -FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files/CVE-2019-13104:" -SRC_URI_append_intel-ast2600 = " \ - file://0001-CVE-2019-13104-ext4-check-for-underflow-in-ext4fs_re.patch \ - " - # CVE-2019-13105 vulnerability fix FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files/CVE-2019-13105:" SRC_URI_append_intel-ast2600 = " \ @@ -70,6 +66,12 @@ SRC_URI_append_intel-ast2600 = " \ file://0002-CVE-2019-13105-ext4-fix-double-free-in-ext4_cache_re.patch \ " +# CVE-2019-13104 vulnerability fix +FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files/CVE-2019-13104:" +SRC_URI_append_intel-ast2600 = " \ + file://0001-CVE-2019-13104-ext4-check-for-underflow-in-ext4fs_re.patch \ + " + # CVE-2019-13106 vulnerability fix FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files/CVE-2019-13106:" SRC_URI_append_intel-ast2600 = " \ @@ -95,5 +97,7 @@ PFR_SRC_URI = " \ SRC_URI_append_intel-ast2600 += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', PFR_SRC_URI, '', d)}" do_install_append () { + install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config install -m 0644 ${WORKDIR}/fw_env.config ${S}/tools/env/fw_env.config } +RDEPENDS_${PN} = "udev-aspeed-mtd-partitions" diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend deleted file mode 100644 index 2e230c2a2..000000000 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend +++ /dev/null @@ -1,18 +0,0 @@ -COMPATIBLE_MACHINE = "intel-ast2600" -FILESEXTRAPATHS_append_intel-ast2600:= "${THISDIR}/files:" - -SRC_URI_append_intel-ast2600 = " \ - file://intel.cfg \ - file://0001-Add-ast2600-intel-as-a-new-board.patch \ - file://0003-ast2600-intel-layout-environment-addr.patch \ - " -PFR_SRC_URI = " \ - file://0043-AST2600-PFR-u-boot-env-changes-as-per-PFR-BMC-image.patch \ - " -SRC_URI_append_intel-ast2600 += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', PFR_SRC_URI, '', d)}" - -do_install_append () { - install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config - install -m 0644 ${WORKDIR}/fw_env.config ${S}/tools/env/fw_env.config -} -RDEPENDS_${PN} = "udev-aspeed-mtd-partitions" diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend new file mode 120000 index 000000000..c73fd75cc --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-fw-utils-aspeed-sdk_%.bbappend @@ -0,0 +1 @@ +u-boot-aspeed-sdk_%.bbappend \ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch deleted file mode 100644 index 6bb6d9c82..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch +++ /dev/null @@ -1,104 +0,0 @@ -From b8f84bd39485d3977625c9a8b8e8cff5d23be56f Mon Sep 17 00:00:00 2001 -From: Roy Li -Date: Thu, 27 Feb 2014 09:05:02 +0800 -Subject: [PATCH] dbus: clear guid_from_server if send_negotiate_unix_fd - failed - -Upstream-Status: Submitted - -bus-test dispatch test failed with below information: - ./bus/bus-test: Running message dispatch test - Activating service name='org.freedesktop.DBus.TestSuiteEchoService' - Successfully activated service 'org.freedesktop.DBus.TestSuiteEchoService' - 6363: assertion failed "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0" file "dbus-auth.c" line 1545 function process_ok - ./bus/bus-test(_dbus_print_backtrace+0x29) [0x80cb969] - ./bus/bus-test(_dbus_abort+0x14) [0x80cfb44] - ./bus/bus-test(_dbus_real_assert+0x53) [0x80b52c3] - ./bus/bus-test() [0x80e24da] - ./bus/bus-test(_dbus_auth_do_work+0x388) [0x80e3848] - ./bus/bus-test() [0x80aea49] - ./bus/bus-test() [0x80affde] - ./bus/bus-test(_dbus_transport_handle_watch+0xb1) [0x80ad841] - ./bus/bus-test(_dbus_connection_handle_watch+0x104) [0x8089174] - ./bus/bus-test(dbus_watch_handle+0xd8) [0x80b15e8] - ./bus/bus-test(_dbus_loop_iterate+0x4a9) [0x80d1509] - ./bus/bus-test(bus_test_run_clients_loop+0x5d) [0x808129d] - ./bus/bus-test() [0x806cab0] - ./bus/bus-test() [0x806e0ca] - ./bus/bus-test() [0x806da6f] - ./bus/bus-test(_dbus_test_oom_handling+0x18c) [0x80b5c8c] - ./bus/bus-test() [0x806f723] - ./bus/bus-test(bus_dispatch_test+0x3c) [0x8071aac] - ./bus/bus-test(main+0x1b7) [0x805acc7] - /lib/libc.so.6(__libc_start_main+0xf3) [0x45f919b3] - ./bus/bus-test() [0x805ae39] - -The stack is below: - #0 0xffffe425 in __kernel_vsyscall () - #1 0x45fa62d6 in raise () from /lib/libc.so.6 - #2 0x45fa9653 in abort () from /lib/libc.so.6 - #3 0x080cfb65 in _dbus_abort () at dbus-sysdeps.c:94 - #4 0x080b52c3 in _dbus_real_assert (condition=0, - condition_text=condition_text@entry=0x8117a38 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", - file=file@entry=0x8117273 "dbus-auth.c", line=line@entry=1545, - func=func@entry=0x8117f8e <__FUNCTION__.3492> "process_ok") - data=0x8157290) at dbus-connection.c:1515 - #0 0x00000033fee353e9 in raise () from /lib64/libc.so.6 - #1 0x00000033fee38508 in abort () from /lib64/libc.so.6 - #2 0x000000000047d585 in _dbus_abort () at dbus-sysdeps.c:94 - #3 0x0000000000466486 in _dbus_real_assert (condition=, - condition_text=condition_text@entry=0x4c2988 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", - file=file@entry=0x4c21a5 "dbus-auth.c", line=line@entry=1546, - func=func@entry=0x4c2fce <__FUNCTION__.3845> "process_ok") - at dbus-internals.c:931 - #4 0x000000000048d424 in process_ok (args_from_ok=0x7fffffffe480, - auth=0x6ff340) at dbus-auth.c:1546 - #5 handle_client_state_waiting_for_data (auth=0x6ff340, - command=, args=0x7fffffffe480) at dbus-auth.c:1996 - #6 0x000000000048e789 in process_command (auth=0x6ff340) at dbus-auth.c:2208 - #7 _dbus_auth_do_work (auth=0x6ff340) at dbus-auth.c:2458 - #8 0x000000000046091d in do_authentication ( - transport=transport@entry=0x6ffaa0, do_reading=do_reading@entry=1, - do_writing=do_writing@entry=0, - auth_completed=auth_completed@entry=0x7fffffffe55c) - at dbus-transport-socket.c:442 - #9 0x0000000000461d08 in socket_handle_watch (transport=0x6ffaa0, - watch=0x6f4190, flags=1) at dbus-transport-socket.c:921 - #10 0x000000000045fa3a in _dbus_transport_handle_watch (transport=0x6ffaa0, - -Once send_negotiate_unix_fd failed, this failure will happen, since -auth->guid_from_server has been set to some value before -send_negotiate_unix_fd. send_negotiate_unix_fd failure will lead to -this auth be handled by process_ok again, but this auth->guid_from_server -is not zero. - -So we should clear auth->guid_from_server if send_negotiate_unix_fd failed - -Signed-off-by: Roy Li ---- - dbus/dbus-auth.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c -index d2c37a7..37b45c6 100644 ---- a/dbus/dbus-auth.c -+++ b/dbus/dbus-auth.c -@@ -1571,8 +1571,13 @@ process_ok(DBusAuth *auth, - _dbus_verbose ("Got GUID '%s' from the server\n", - _dbus_string_get_const_data (& DBUS_AUTH_CLIENT (auth)->guid_from_server)); - -- if (auth->unix_fd_possible) -- return send_negotiate_unix_fd(auth); -+ if (auth->unix_fd_possible) { -+ if (!send_negotiate_unix_fd(auth)) { -+ _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0); -+ return FALSE; -+ } -+ return TRUE; -+ } - - _dbus_verbose("Not negotiating unix fd passing, since not possible\n"); - return send_begin (auth); --- -1.7.10.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init deleted file mode 100644 index 90e167e57..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init +++ /dev/null @@ -1,123 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: dbus -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 1 -# Short-Description: D-Bus systemwide message bus -# Description: D-Bus is a simple interprocess messaging system, used -# for sending messages between applications. -### END INIT INFO -# -# -*- coding: utf-8 -*- -# Debian init.d script for D-BUS -# Copyright © 2003 Colin Walters - -# set -e - -# Source function library. -. /etc/init.d/functions - -DAEMON=@bindir@/dbus-daemon -NAME=dbus -DAEMONUSER=messagebus # must match /usr/share/dbus-1/system.conf -PIDFILE=/var/run/dbus/pid # must match /usr/share/dbus-1/system.conf -UUIDDIR=/var/lib/dbus -DESC="system message bus" -EVENTDIR=/etc/dbus-1/event.d - -test -x $DAEMON || exit 0 - -# Source defaults file; edit that file to configure this script. -ENABLED=1 -PARAMS="" -if [ -e /etc/default/dbus ]; then - . /etc/default/dbus -fi - -test "$ENABLED" != "0" || exit 0 - -start_it_up() -{ - mkdir -p "`dirname $PIDFILE`" - if [ -e $PIDFILE ]; then - PIDDIR=/proc/$(cat $PIDFILE) - if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then - echo "$DESC already started; not starting." - else - echo "Removing stale PID file $PIDFILE." - rm -f $PIDFILE - fi - fi - - if [ ! -d $UUIDDIR ]; then - mkdir -p $UUIDDIR - chown $DAEMONUSER $UUIDDIR - chgrp $DAEMONUSER $UUIDDIR - fi - - dbus-uuidgen --ensure - - echo -n "Starting $DESC: " - start-stop-daemon -o --start --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS - echo "$NAME." - if [ -d $EVENTDIR ]; then - run-parts --arg=start $EVENTDIR - fi -} - -shut_it_down() -{ - if [ -d $EVENTDIR ]; then - # TODO: --reverse when busybox supports it - run-parts --arg=stop $EVENTDIR - fi - echo -n "Stopping $DESC: " - start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER - # We no longer include these arguments so that start-stop-daemon - # can do its job even given that we may have been upgraded. - # We rely on the pidfile being sanely managed - # --exec $DAEMON -- --system $PARAMS - echo "$NAME." - rm -f $PIDFILE -} - -reload_it() -{ - echo -n "Reloading $DESC config: " - dbus-send --print-reply --system --type=method_call \ - --dest=org.freedesktop.DBus \ - / org.freedesktop.DBus.ReloadConfig > /dev/null - # hopefully this is enough time for dbus to reload it's config file. - echo "done." -} - -case "$1" in - start) - start_it_up - ;; - stop) - shut_it_down - ;; - status) - status $DAEMON - exit $? - ;; - reload|force-reload) - reload_it - ;; - restart) - shut_it_down - sleep 1 - start_it_up - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch deleted file mode 100644 index bf086e178..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 5105fedd7fa13dadd2d0d864fb77873b83b79a4b Mon Sep 17 00:00:00 2001 -From: Koen Kooi -Date: Thu, 23 Jun 2011 13:52:09 +0200 -Subject: [PATCH] buildsys: hardcode socketdir to /tmp - -the TMPDIR env var isn't always pointing to the right target path - -Upstream-Status: Inappropriate [embedded] - -Signed-off-by: Koen Kooi - -Original comment: - - avoid to check tmp dir at build time. instead uses hard coded /tmp here - comment added by Kevin Tian ---- - configure.ac | 11 +---------- - 1 files changed, 1 insertions(+), 10 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 408054b..6d26180 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1483,16 +1483,7 @@ AC_SUBST(TEST_LAUNCH_HELPER_BINARY) - AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY", - [Full path to the launch helper test program in the builddir]) - --#### Find socket directories --if ! test -z "$TMPDIR" ; then -- DEFAULT_SOCKET_DIR=$TMPDIR --elif ! test -z "$TEMP" ; then -- DEFAULT_SOCKET_DIR=$TEMP --elif ! test -z "$TMP" ; then -- DEFAULT_SOCKET_DIR=$TMP --else -- DEFAULT_SOCKET_DIR=/tmp --fi -+DEFAULT_SOCKET_DIR=/tmp - - DEFAULT_SOCKET_DIR=`echo $DEFAULT_SOCKET_DIR | sed 's/+/%2B/g'` - --- -1.6.6.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend deleted file mode 100644 index 288c80f06..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -PV = "1.12.18" - -SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ - file://tmpdir.patch \ - file://dbus-1.init \ - file://clear-guid_from_server-if-send_negotiate_unix_f.patch \ - " -SRC_URI[md5sum] = "4ca570c281be35d0b30ab83436712242" -SRC_URI[sha256sum] = "64cf4d70840230e5e9bc784d153880775ab3db19d656ead8a0cb9c0ab5a95306" 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 ead001a7c..38426e81d 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 = "eba19a3b122a39ef2b5dbda49b418a202f78a48d" +SRCREV = "9f5b47a5844023719b84855cb6c554271c95ee4a" PV = "0.1+git${SRCPV}" 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 d1aa797a1..628352f2c 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,4 +2,4 @@ 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 = "01fbd0176c403feb29bf2a9ddd17469d0a27c3ef" +SRCREV = "fb9f1aa1ea3c944fbba17b51ab26264af1c67a25" 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 5e3751ded..6d16fe190 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend @@ -1,8 +1,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI = "git://github.com/openbmc/sdbusplus.git;nobranch=1" -SRCREV = "95874d930f0bcc8390cd47ab3bb1e5e46db45278" SRC_URI += " \ file://0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch \ " - 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 f42119baa..7172e7a00 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 = "2b6d595e3ea89597b3bebbf545eb7d3c0a1224a8" +SRCREV = "d0bc9c46e217fd923ccad4719d8701b25e3c0523" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch deleted file mode 100644 index 43600ac8a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0c0b7b5da551c99161bda98820a529ba29cbaac1 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 21 Aug 2019 16:52:30 -0700 -Subject: [PATCH] Fix keyboard and mouse input events dropping issue - -Restarting of HID input devices causes input events dropping issue -which is critical for BMC KVM uses. For an example, user can't enter -to BIOS by doing keep pressing 'F2' or 'Del' key because of this issue. - -To fix the issue, this commit removes the input device restarting -logic and refines error log journaling logic using errno checking. - -Tested: - 1. Open BMCweb -> Server control -> KVM. - 2. Make a host reset and keep pressing 'F2' key. - 3. Was able to enter to BIOS using the key press. - -Change-Id: Iec1bfad1d9e5825858844cab658bbfa3e6bc24f6 -Signed-off-by: Jae Hyun Yoo ---- - ikvm_input.cpp | 58 +++++++--------------------------------------------------- - ikvm_input.hpp | 4 ---- - ikvm_video.cpp | 3 +-- - 3 files changed, 8 insertions(+), 57 deletions(-) - -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index d95e6313f62c..df12f2715585 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -23,9 +23,9 @@ using namespace phosphor::logging; - using namespace sdbusplus::xyz::openbmc_project::Common::File::Error; - - Input::Input(const std::string& kbdPath, const std::string& ptrPath) : -- pointerError(false), sendKeyboard(false), sendPointer(false), -- keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0}, -- keyboardPath(kbdPath), pointerPath(ptrPath) -+ sendKeyboard(false), sendPointer(false), keyboardFd(-1), pointerFd(-1), -+ keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), -+ pointerPath(ptrPath) - { - if (!keyboardPath.empty()) - { -@@ -156,36 +156,6 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - rfbDefaultPtrAddEvent(buttonMask, x, y, cl); - } - --void Input::restart() --{ -- if (!keyboardPath.empty() && keyboardFd < 0) -- { -- keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -- if (keyboardFd < 0) -- { -- log("Failed to open input device", -- entry("PATH=%s", keyboardPath.c_str()), -- entry("ERROR=%s", strerror(errno))); -- } -- -- sendKeyboard = false; -- } -- -- if (!pointerPath.empty() && pointerFd < 0) -- { -- pointerFd = open(pointerPath.c_str(), O_RDWR | O_CLOEXEC | O_NONBLOCK); -- if (pointerFd < 0) -- { -- log("Failed to open input device", -- entry("PATH=%s", pointerPath.c_str()), -- entry("ERROR=%s", strerror(errno))); -- } -- -- pointerError = false; -- sendPointer = false; -- } --} -- - void Input::sendWakeupPacket() - { - uint8_t wakeupReport[KEY_REPORT_LENGTH] = {0}; -@@ -459,13 +429,10 @@ bool Input::writeKeyboard(const uint8_t *report) - { - if (write(keyboardFd, report, KEY_REPORT_LENGTH) != KEY_REPORT_LENGTH) - { -- log("Failed to write keyboard report", -- entry("ERROR=%s", strerror(errno))); -- -- if (errno == ESHUTDOWN) -+ if (errno != ESHUTDOWN && errno != EAGAIN) - { -- close(keyboardFd); -- keyboardFd = -1; -+ log("Failed to write keyboard report", -+ entry("ERROR=%s", strerror(errno))); - } - - return false; -@@ -478,23 +445,12 @@ void Input::writePointer(const uint8_t *report) - { - if (write(pointerFd, report, PTR_REPORT_LENGTH) != PTR_REPORT_LENGTH) - { -- if (!pointerError) -+ if (errno != ESHUTDOWN && errno != EAGAIN) - { - log("Failed to write pointer report", - entry("ERROR=%s", strerror(errno))); -- pointerError = true; -- } -- -- if (errno == ESHUTDOWN) -- { -- close(pointerFd); -- pointerFd = -1; - } - } -- else -- { -- pointerError = false; -- } - } - - } // namespace ikvm -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index 953333263e2d..2adc7c106755 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -48,8 +48,6 @@ class Input - */ - static void pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl); - -- /* @brief Re-opens USB device in case the endpoint shutdown */ -- void restart(); - /* @brief Sends a wakeup data packet to the USB input device */ - void sendWakeupPacket(); - /* @brief Sends an HID report to the USB input device */ -@@ -90,8 +88,6 @@ class Input - bool writeKeyboard(const uint8_t *report); - void writePointer(const uint8_t *report); - -- /* @brief Indicates whether or not a pointer report error has occurred */ -- bool pointerError; - /* @brief Indicates whether or not to send a keyboard report */ - bool sendKeyboard; - /* @brief Indicates whether or not to send a pointer report */ -diff --git a/ikvm_video.cpp b/ikvm_video.cpp -index 6a5aa6c10927..7bd4b4eb6c98 100644 ---- a/ikvm_video.cpp -+++ b/ikvm_video.cpp -@@ -163,10 +163,9 @@ bool Video::needsResize() - restart(); - return false; - } -- else if (timingsError) -+ else - { - timingsError = false; -- input.restart(); - } - - if (timings.bt.width != width || timings.bt.height != height) --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch deleted file mode 100644 index 0fe93c604..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch +++ /dev/null @@ -1,494 +0,0 @@ -From 9a0f78ab773b33fd0445b23358097ddcd175a58f Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 22 Jul 2020 23:39:18 -0700 -Subject: [PATCH] Connect HID gadget device dynamically - -Connecting HID gadget device statically from the beginning of this -service causes an issue on WHLK test. To prevent the issue, this -commit changes the HID gadget device handling as dynamic so that -the HID gadget device can be connected when this service has at -least one KVM client. - -Tested: /dev/hidg0 and /dev/hidg1 created only when at least one -KVM client is connected. - -Change-Id: I5f6596b9e4e297fb6b507000499fc041460659f7 -Signed-off-by: Jae Hyun Yoo ---- - create_usbhid.sh | 278 ++++++++++++++++++++++++-------------------- - ikvm_input.cpp | 64 +++++++++- - ikvm_input.hpp | 14 +++ - ikvm_server.cpp | 2 + - start-ipkvm.service | 2 +- - 5 files changed, 230 insertions(+), 130 deletions(-) - -diff --git a/create_usbhid.sh b/create_usbhid.sh -index 656299102d7f..d1fa4e036bbe 100644 ---- a/create_usbhid.sh -+++ b/create_usbhid.sh -@@ -1,135 +1,157 @@ - #!/bin/sh - --new_directory="/sys/kernel/config/usb_gadget/obmc_hid" -+hid_conf_directory="/sys/kernel/config/usb_gadget/obmc_hid" -+dev_name="1e6a0000.usb-vhub" - --if [ -e "${new_directory}" ]; then -- exit 0 --fi -+create_hid() { -+ # create gadget -+ mkdir "${hid_conf_directory}" -+ cd "${hid_conf_directory}" -+ -+ # add basic information -+ echo 0x0100 > bcdDevice -+ echo 0x0200 > bcdUSB -+ echo 0x0104 > idProduct # Multifunction Composite Gadget -+ echo 0x1d6b > idVendor # Linux Foundation -+ -+ # create English locale -+ mkdir strings/0x409 -+ -+ echo "OpenBMC" > strings/0x409/manufacturer -+ echo "virtual_input" > strings/0x409/product -+ echo "OBMC0001" > strings/0x409/serialnumber -+ -+ # Create HID keyboard function -+ mkdir functions/hid.0 -+ -+ echo 1 > functions/hid.0/protocol # 1: keyboard -+ echo 8 > functions/hid.0/report_length -+ echo 1 > functions/hid.0/subclass -+ -+ # Binary HID keyboard descriptor -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x06, // USAGE (Keyboard) -+ # 0xa1, 0x01, // COLLECTION (Application) -+ # 0x05, 0x07, // USAGE_PAGE (Keyboard) -+ # 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) -+ # 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x01, // LOGICAL_MAXIMUM (1) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x95, 0x08, // REPORT_COUNT (8) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x08, // REPORT_SIZE (8) -+ # 0x81, 0x03, // INPUT (Data,Var,Abs) -+ # 0x95, 0x05, // REPORT_COUNT (5) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x05, 0x08, // USAGE_PAGE (LEDs) -+ # 0x19, 0x01, // USAGE_MINIMUM (Num Lock) -+ # 0x29, 0x05, // USAGE_MAXIMUM (Kana) -+ # 0x91, 0x02, // OUTPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x03, // REPORT_SIZE (3) -+ # 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) -+ # 0x95, 0x06, // REPORT_COUNT (6) -+ # 0x75, 0x08, // REPORT_SIZE (8) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x65, // LOGICAL_MAXIMUM (101) -+ # 0x05, 0x07, // USAGE_PAGE (Keyboard) -+ # 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) -+ # 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) -+ # 0x81, 0x00, // INPUT (Data,Ary,Abs) -+ # 0xc0 // END_COLLECTION -+ echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0' > functions/hid.0/report_desc -+ -+ # Create HID mouse function -+ mkdir functions/hid.1 -+ -+ echo 2 > functions/hid.1/protocol # 2: mouse -+ echo 5 > functions/hid.1/report_length -+ echo 1 > functions/hid.1/subclass -+ -+ # Binary HID mouse descriptor (absolute coordinate) -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x02, // USAGE (Mouse) -+ # 0xa1, 0x01, // COLLECTION (Application) -+ # 0x09, 0x01, // USAGE (Pointer) -+ # 0xa1, 0x00, // COLLECTION (Physical) -+ # 0x05, 0x09, // USAGE_PAGE (Button) -+ # 0x19, 0x01, // USAGE_MINIMUM (Button 1) -+ # 0x29, 0x03, // USAGE_MAXIMUM (Button 3) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x01, // LOGICAL_MAXIMUM (1) -+ # 0x95, 0x03, // REPORT_COUNT (3) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x05, // REPORT_SIZE (5) -+ # 0x81, 0x03, // INPUT (Cnst,Var,Abs) -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x30, // USAGE (X) -+ # 0x09, 0x31, // USAGE (Y) -+ # 0x35, 0x00, // PHYSICAL_MINIMUM (0) -+ # 0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) -+ # 0x65, 0x11, // UNIT (SI Lin:Distance) -+ # 0x55, 0x00, // UNIT_EXPONENT (0) -+ # 0x75, 0x10, // REPORT_SIZE (16) -+ # 0x95, 0x02, // REPORT_COUNT (2) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0xc0, // END_COLLECTION -+ # 0xc0 // END_COLLECTION -+ echo -ne '\x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x03\x15\x00\x25\x01\x95\x03\x75\x01\x81\x02\x95\x01\x75\x05\x81\x03\x05\x01\x09\x30\x09\x31\x35\x00\x46\xff\x7f\x15\x00\x26\xff\x7f\x65\x11\x55\x00\x75\x10\x95\x02\x81\x02\xc0\xc0' > functions/hid.1/report_desc -+ -+ # Create configuration -+ mkdir configs/c.1 -+ mkdir configs/c.1/strings/0x409 -+ -+ echo 0x80 > configs/c.1/bmAttributes -+ echo 200 > configs/c.1/MaxPower -+ echo "" > configs/c.1/strings/0x409/configuration -+ -+ # Link HID functions to configuration -+ ln -s functions/hid.0 configs/c.1 -+ ln -s functions/hid.1 configs/c.1 -+} -+ -+connect_hid() { -+ if ! [[ `cat UDC` =~ "${dev_name}:p" ]]; then -+ i=0 -+ num_ports=5 -+ base_usb_dir="/sys/bus/platform/devices/${dev_name}/${dev_name}:p" -+ while [ $i -lt $num_ports ]; do -+ port=$(($i + 1)) -+ i=$port -+ if [ ! -e "${base_usb_dir}${port}/gadget/suspended" ]; then -+ break -+ fi -+ done -+ echo "${dev_name}:p${port}" > UDC -+ fi -+} -+ -+disconnect_hid() { -+ if [[ `cat UDC` =~ "${dev_name}:p" ]]; then -+ echo "" > UDC -+ fi -+} - --# create gadget - original_directory="$(pwd)" --mkdir "${new_directory}" --cd "${new_directory}" -- --# add basic information --echo 0x0100 > bcdDevice --echo 0x0200 > bcdUSB --echo 0x0104 > idProduct # Multifunction Composite Gadget --echo 0x1d6b > idVendor # Linux Foundation -- --# create English locale --mkdir strings/0x409 -- --echo "OpenBMC" > strings/0x409/manufacturer --echo "virtual_input" > strings/0x409/product --echo "OBMC0001" > strings/0x409/serialnumber -- --# Create HID keyboard function --mkdir functions/hid.0 -- --echo 1 > functions/hid.0/protocol # 1: keyboard --echo 8 > functions/hid.0/report_length --echo 1 > functions/hid.0/subclass -- --# Binary HID keyboard descriptor --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x06, // USAGE (Keyboard) --# 0xa1, 0x01, // COLLECTION (Application) --# 0x05, 0x07, // USAGE_PAGE (Keyboard) --# 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) --# 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x01, // LOGICAL_MAXIMUM (1) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x95, 0x08, // REPORT_COUNT (8) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x08, // REPORT_SIZE (8) --# 0x81, 0x03, // INPUT (Data,Var,Abs) --# 0x95, 0x05, // REPORT_COUNT (5) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x05, 0x08, // USAGE_PAGE (LEDs) --# 0x19, 0x01, // USAGE_MINIMUM (Num Lock) --# 0x29, 0x05, // USAGE_MAXIMUM (Kana) --# 0x91, 0x02, // OUTPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x03, // REPORT_SIZE (3) --# 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) --# 0x95, 0x06, // REPORT_COUNT (6) --# 0x75, 0x08, // REPORT_SIZE (8) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x65, // LOGICAL_MAXIMUM (101) --# 0x05, 0x07, // USAGE_PAGE (Keyboard) --# 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) --# 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) --# 0x81, 0x00, // INPUT (Data,Ary,Abs) --# 0xc0 // END_COLLECTION --echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0' > functions/hid.0/report_desc -- --# Create HID mouse function --mkdir functions/hid.1 -- --echo 2 > functions/hid.1/protocol # 2: mouse --echo 5 > functions/hid.1/report_length --echo 1 > functions/hid.1/subclass -- --# Binary HID mouse descriptor (absolute coordinate) --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x02, // USAGE (Mouse) --# 0xa1, 0x01, // COLLECTION (Application) --# 0x09, 0x01, // USAGE (Pointer) --# 0xa1, 0x00, // COLLECTION (Physical) --# 0x05, 0x09, // USAGE_PAGE (Button) --# 0x19, 0x01, // USAGE_MINIMUM (Button 1) --# 0x29, 0x03, // USAGE_MAXIMUM (Button 3) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x01, // LOGICAL_MAXIMUM (1) --# 0x95, 0x03, // REPORT_COUNT (3) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x05, // REPORT_SIZE (5) --# 0x81, 0x03, // INPUT (Cnst,Var,Abs) --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x30, // USAGE (X) --# 0x09, 0x31, // USAGE (Y) --# 0x35, 0x00, // PHYSICAL_MINIMUM (0) --# 0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) --# 0x65, 0x11, // UNIT (SI Lin:Distance) --# 0x55, 0x00, // UNIT_EXPONENT (0) --# 0x75, 0x10, // REPORT_SIZE (16) --# 0x95, 0x02, // REPORT_COUNT (2) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0xc0, // END_COLLECTION --# 0xc0 // END_COLLECTION --echo -ne '\x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x03\x15\x00\x25\x01\x95\x03\x75\x01\x81\x02\x95\x01\x75\x05\x81\x03\x05\x01\x09\x30\x09\x31\x35\x00\x46\xff\x7f\x15\x00\x26\xff\x7f\x65\x11\x55\x00\x75\x10\x95\x02\x81\x02\xc0\xc0' > functions/hid.1/report_desc -- --# Create configuration --mkdir configs/c.1 --mkdir configs/c.1/strings/0x409 -- --echo 0x80 > configs/c.1/bmAttributes --echo 200 > configs/c.1/MaxPower --echo "" > configs/c.1/strings/0x409/configuration -- --# Link HID functions to configuration --ln -s functions/hid.0 configs/c.1 --ln -s functions/hid.1 configs/c.1 -- --# Enable gadget --dev_name="1e6a0000.usb-vhub" --i=0 --num_ports=5 --base_usb_dir="/sys/bus/platform/devices/${dev_name}/${dev_name}:p" --while [ $i -lt $num_ports ]; do -- port=$(($i + 1)) -- i=$port -- if [ ! -e "${base_usb_dir}${port}/gadget/suspended" ]; then -- break -- fi --done --echo "${dev_name}:p${port}" > UDC -+ -+if [ ! -e "${hid_conf_directory}" ]; then -+ create_hid -+else -+ cd "${hid_conf_directory}" -+fi -+ -+if [ "$1" = "connect" ]; then -+ connect_hid -+elif [ "$1" = "disconnect" ]; then -+ disconnect_hid -+else -+ echo "Invalid option: $1. Use 'connect' or 'disconnect'." -+fi - - cd "${original_directory}" -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index df12f2715585..c4cce5088461 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -16,6 +16,8 @@ - - #include "scancodes.hpp" - -+namespace fs = std::filesystem; -+ - namespace ikvm - { - -@@ -27,6 +29,54 @@ Input::Input(const std::string& kbdPath, const std::string& ptrPath) : - keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), - pointerPath(ptrPath) - { -+ hidUdcStream.exceptions(std::ofstream::failbit | std::ofstream::badbit); -+ hidUdcStream.open(hidUdcPath, std::ios::out | std::ios::app); -+} -+ -+Input::~Input() -+{ -+ if (keyboardFd >= 0) -+ { -+ close(keyboardFd); -+ } -+ -+ if (pointerFd >= 0) -+ { -+ close(pointerFd); -+ } -+ -+ disconnect(); -+ hidUdcStream.close(); -+} -+ -+void Input::connect() -+{ -+ try -+ { -+ for (const auto& port : fs::directory_iterator(usbVirtualHubPath)) -+ { -+ if (fs::is_directory(port) && !fs::is_symlink(port) && -+ !fs::exists(port.path() / "gadget/suspended")) -+ { -+ const std::string portId = port.path().filename(); -+ hidUdcStream << portId << std::endl; -+ break; -+ } -+ } -+ } -+ catch (fs::filesystem_error& e) -+ { -+ log("Failed to search USB virtual hub port", -+ entry("ERROR=%s", e.what())); -+ return; -+ } -+ catch (std::ofstream::failure& e) -+ { -+ log("Failed to connect HID gadget", -+ entry("ERROR=%s", e.what())); -+ return; -+ } -+ - if (!keyboardPath.empty()) - { - keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -@@ -56,16 +106,28 @@ Input::Input(const std::string& kbdPath, const std::string& ptrPath) : - } - } - --Input::~Input() -+void Input::disconnect() - { - if (keyboardFd >= 0) - { - close(keyboardFd); -+ keyboardFd = -1; - } - - if (pointerFd >= 0) - { - close(pointerFd); -+ pointerFd = -1; -+ } -+ -+ try -+ { -+ hidUdcStream << "" << std::endl; -+ } -+ catch (std::ofstream::failure& e) -+ { -+ log("Failed to disconnect HID gadget", -+ entry("ERROR=%s", e.what())); - } - } - -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index 2adc7c106755..aae7cefbef6e 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -2,6 +2,8 @@ - - #include - -+#include -+#include - #include - #include - -@@ -29,6 +31,10 @@ class Input - Input(Input&&) = default; - Input& operator=(Input&&) = default; - -+ /* @brief Connects HID gadget to host */ -+ void connect(); -+ /* @brief Disconnects HID gadget from host */ -+ void disconnect(); - /* - * @brief RFB client key event handler - * -@@ -72,6 +78,12 @@ class Input - 0x04, // left alt - 0x40 // right alt - }; -+ /* @brief Path to the HID gadget UDC */ -+ static constexpr const char* hidUdcPath = -+ "/sys/kernel/config/usb_gadget/obmc_hid/UDC"; -+ /* @brief Path to the USB virtual hub */ -+ static constexpr const char* usbVirtualHubPath = -+ "/sys/bus/platform/devices/1e6a0000.usb-vhub"; - /* - * @brief Translates a RFB-specific key code to HID modifier bit - * -@@ -109,6 +121,8 @@ class Input - * of which keys are down - */ - std::map keysDown; -+ /* @brief Handle of the HID gadget UDC */ -+ std::ofstream hidUdcStream; - }; - - } // namespace ikvm -diff --git a/ikvm_server.cpp b/ikvm_server.cpp -index ebeaef049d04..1c2e981b7a72 100644 ---- a/ikvm_server.cpp -+++ b/ikvm_server.cpp -@@ -178,6 +178,7 @@ void Server::clientGone(rfbClientPtr cl) - - if (server->numClients-- == 1) - { -+ server->input.disconnect(); - rfbMarkRectAsModified(server->server, 0, 0, server->video.getWidth(), - server->video.getHeight()); - } -@@ -193,6 +194,7 @@ enum rfbNewClientAction Server::newClient(rfbClientPtr cl) - cl->clientFramebufferUpdateRequestHook = clientFramebufferUpdateRequest; - if (!server->numClients++) - { -+ server->input.connect(); - server->pendingResize = false; - server->frameCounter = 0; - } -diff --git a/start-ipkvm.service b/start-ipkvm.service -index 5f945b329a26..60234b231da3 100644 ---- a/start-ipkvm.service -+++ b/start-ipkvm.service -@@ -4,7 +4,7 @@ ConditionPathIsMountPoint=/sys/kernel/config - - [Service] - Restart=always --ExecStartPre=/usr/bin/create_usbhid.sh -+ExecStartPre=/usr/bin/create_usbhid.sh disconnect - ExecStart=/usr/bin/obmc-ikvm -v /dev/video0 -k /dev/hidg0 -p /dev/hidg1 - - [Install] --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch deleted file mode 100644 index 5293f3f27..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch +++ /dev/null @@ -1,295 +0,0 @@ -From 68885eb4d056b8343c567c48ece7e875feb28fc0 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Thu, 30 Jul 2020 00:29:19 -0700 -Subject: [PATCH] Refine HID report writing logic - -Blocking write on the keyboard HID device causes screen freezing -during turning off the host power. To fix this issue, this commit -refines the logic using non-blocking write. As a side effect, -non-blocking write introduces event dropping when kernel HID driver -returns -EAGAIN when the driver is in busy state so this commit also -adds retry logic to cover the case. - -Tested: Didn't see the screen freezing issue. - -Change-Id: Ibd95f567c49f448cd053948c14c006de17c52420 -Signed-off-by: Jae Hyun Yoo ---- - ikvm_input.cpp | 106 ++++++++++++++++++++++++++++++++---------------- - ikvm_input.hpp | 13 +++--- - ikvm_server.cpp | 2 - - 3 files changed, 79 insertions(+), 42 deletions(-) - -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index c4cce5088461..480db3c094bc 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -25,9 +25,8 @@ using namespace phosphor::logging; - using namespace sdbusplus::xyz::openbmc_project::Common::File::Error; - - Input::Input(const std::string& kbdPath, const std::string& ptrPath) : -- sendKeyboard(false), sendPointer(false), keyboardFd(-1), pointerFd(-1), -- keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), -- pointerPath(ptrPath) -+ keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0}, -+ keyboardPath(kbdPath), pointerPath(ptrPath) - { - hidUdcStream.exceptions(std::ofstream::failbit | std::ofstream::badbit); - hidUdcStream.open(hidUdcPath, std::ios::out | std::ios::app); -@@ -79,7 +78,8 @@ void Input::connect() - - if (!keyboardPath.empty()) - { -- keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -+ keyboardFd = open(keyboardPath.c_str(), -+ O_RDWR | O_CLOEXEC | O_NONBLOCK); - if (keyboardFd < 0) - { - log("Failed to open input device", -@@ -135,6 +135,12 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - Server::ClientData* cd = (Server::ClientData*)cl->clientData; - Input* input = cd->input; -+ bool sendKeyboard = false; -+ -+ if (input->keyboardFd < 0) -+ { -+ return; -+ } - - if (down) - { -@@ -150,7 +156,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - input->keyboardReport[i] = sc; - input->keysDown.insert(std::make_pair(key, i)); -- input->sendKeyboard = true; -+ sendKeyboard = true; - break; - } - } -@@ -163,7 +169,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - if (mod) - { - input->keyboardReport[0] |= mod; -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - } - } -@@ -175,7 +181,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - input->keyboardReport[it->second] = 0; - input->keysDown.erase(it); -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - else - { -@@ -184,10 +190,15 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - if (mod) - { - input->keyboardReport[0] &= ~mod; -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - } - } -+ -+ if (sendKeyboard) -+ { -+ input->writeKeyboard(input->keyboardReport); -+ } - } - - void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) -@@ -197,6 +208,11 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - Server* server = (Server*)cl->screen->screenData; - const Video& video = server->getVideo(); - -+ if (input->pointerFd < 0) -+ { -+ return; -+ } -+ - input->pointerReport[0] = ((buttonMask & 0x4) >> 1) | - ((buttonMask & 0x2) << 1) | (buttonMask & 0x1); - -@@ -214,8 +230,8 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - memcpy(&input->pointerReport[3], &yy, 2); - } - -- input->sendPointer = true; - rfbDefaultPtrAddEvent(buttonMask, x, y, cl); -+ input->writePointer(input->pointerReport); - } - - void Input::sendWakeupPacket() -@@ -249,23 +265,6 @@ void Input::sendWakeupPacket() - } - } - --void Input::sendReport() --{ -- if (sendKeyboard && keyboardFd >= 0) -- { -- writeKeyboard(keyboardReport); -- -- sendKeyboard = false; -- } -- -- if (sendPointer && pointerFd >= 0) -- { -- writePointer(pointerReport); -- -- sendPointer = false; -- } --} -- - uint8_t Input::keyToMod(rfbKeySym key) - { - uint8_t mod = 0; -@@ -489,14 +488,35 @@ uint8_t Input::keyToScancode(rfbKeySym key) - - bool Input::writeKeyboard(const uint8_t *report) - { -- if (write(keyboardFd, report, KEY_REPORT_LENGTH) != KEY_REPORT_LENGTH) -+ std::unique_lock lk(keyMutex); -+ uint retryCount = HID_REPORT_RETRY_MAX; -+ -+ while (retryCount > 0) - { -- if (errno != ESHUTDOWN && errno != EAGAIN) -+ if (write(keyboardFd, report, KEY_REPORT_LENGTH) == KEY_REPORT_LENGTH) - { -- log("Failed to write keyboard report", -- entry("ERROR=%s", strerror(errno))); -+ break; -+ } -+ -+ if (errno != EAGAIN) -+ { -+ if (errno != ESHUTDOWN) -+ { -+ log("Failed to write keyboard report", -+ entry("ERROR=%s", strerror(errno))); -+ } -+ -+ break; - } - -+ lk.unlock(); -+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); -+ lk.lock(); -+ retryCount--; -+ } -+ -+ if (!retryCount || errno) -+ { - return false; - } - -@@ -505,13 +525,31 @@ bool Input::writeKeyboard(const uint8_t *report) - - void Input::writePointer(const uint8_t *report) - { -- if (write(pointerFd, report, PTR_REPORT_LENGTH) != PTR_REPORT_LENGTH) -+ std::unique_lock lk(ptrMutex); -+ uint retryCount = HID_REPORT_RETRY_MAX; -+ -+ while (retryCount > 0) - { -- if (errno != ESHUTDOWN && errno != EAGAIN) -+ if (write(pointerFd, report, PTR_REPORT_LENGTH) == PTR_REPORT_LENGTH) - { -- log("Failed to write pointer report", -- entry("ERROR=%s", strerror(errno))); -+ break; -+ } -+ -+ if (errno != EAGAIN) -+ { -+ if (errno != ESHUTDOWN) -+ { -+ log("Failed to write pointer report", -+ entry("ERROR=%s", strerror(errno))); -+ } -+ -+ break; - } -+ -+ lk.unlock(); -+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); -+ lk.lock(); -+ retryCount--; - } - } - -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index aae7cefbef6e..558251d673cc 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include - - namespace ikvm -@@ -56,8 +57,6 @@ class Input - - /* @brief Sends a wakeup data packet to the USB input device */ - void sendWakeupPacket(); -- /* @brief Sends an HID report to the USB input device */ -- void sendReport(); - - private: - static constexpr int NUM_MODIFIER_BITS = 4; -@@ -84,6 +83,8 @@ class Input - /* @brief Path to the USB virtual hub */ - static constexpr const char* usbVirtualHubPath = - "/sys/bus/platform/devices/1e6a0000.usb-vhub"; -+ /* @brief Retry limit for writing an HID report */ -+ static constexpr int HID_REPORT_RETRY_MAX = 5; - /* - * @brief Translates a RFB-specific key code to HID modifier bit - * -@@ -100,10 +101,6 @@ class Input - bool writeKeyboard(const uint8_t *report); - void writePointer(const uint8_t *report); - -- /* @brief Indicates whether or not to send a keyboard report */ -- bool sendKeyboard; -- /* @brief Indicates whether or not to send a pointer report */ -- bool sendPointer; - /* @brief File descriptor for the USB keyboard device */ - int keyboardFd; - /* @brief File descriptor for the USB mouse device */ -@@ -123,6 +120,10 @@ class Input - std::map keysDown; - /* @brief Handle of the HID gadget UDC */ - std::ofstream hidUdcStream; -+ /* @brief Mutex for sending keyboard reports */ -+ std::mutex keyMutex; -+ /* @brief Mutex for sending pointer reports */ -+ std::mutex ptrMutex; - }; - - } // namespace ikvm -diff --git a/ikvm_server.cpp b/ikvm_server.cpp -index 0736d1f55f73..7be99e4379d1 100644 ---- a/ikvm_server.cpp -+++ b/ikvm_server.cpp -@@ -79,8 +79,6 @@ void Server::run() - - if (server->clientHead) - { -- input.sendReport(); -- - frameCounter++; - if (pendingResize && frameCounter > video.getFrameRate()) - { --- -2.17.1 - 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 9ea9e1a4e..0d2c589ae 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,10 +1,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/obmc-ikvm" -SRCREV = "861337e8ec92767c4c88237ec5db494a2a67fa8d" - -SRC_URI += " \ - file://0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch \ - file://0004-Connect-HID-gadget-device-dynamically.patch \ - file://0005-Refine-HID-report-writing-logic.patch \ - " +SRCREV = "673ac2eb1117a7d692460f808f1d947495d033db" 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 ed4ab4930..d8436709b 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 = "291d6388e0b770e89091935bc4edc7f371874666" +SRCREV = "52639bebada24990c3514786d65598dc5557477a" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" @@ -12,7 +12,8 @@ SYSTEMD_SERVICE_${PN} = "hsbp-manager.service" DEPENDS = "boost \ i2c-tools \ - sdbusplus" + sdbusplus \ + libgpiod" S = "${WORKDIR}/git/hsbp-manager" inherit cmake systemd 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 482738d25..ab41db601 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 = "d14c350c2dfcf9da3e6088ef29a8c5be4e40079b" +SRCREV = "139981b813f2d480ca55f60e6b129d55d6adcbc3" 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 fa591872a..44cee7361 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 = "2285be4fd22709c1dcfba10c2c604528353b428a" +SRCREV = "d23b84a7eb2be944b12e6539cf627f595b299fda" S = "${WORKDIR}/git" @@ -28,7 +28,7 @@ DEPENDS += " \ i2c-tools \ " -EXTRA_OECMAKE="-DYOCTO=1" +EXTRA_OECMAKE="-DYOCTO=1 -DIPMI_BLOB=0" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'smbios-no-dimm', d)}" PACKAGECONFIG[smbios-no-dimm] = "-DDIMM_DBUS=OFF, -DDIMM_DBUS=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch new file mode 100644 index 000000000..b7823ce14 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch @@ -0,0 +1,60 @@ +From 0d202fb06b873c5e258658462ac4fc01a673fd83 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 | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c +index b633ea545644..19002f02bd91 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; +@@ -129,6 +130,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; +@@ -139,6 +141,19 @@ 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) { ++ pr_err("peci-cputemp_die: 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/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch new file mode 100644 index 000000000..aab6c3cea --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch @@ -0,0 +1,64 @@ +From 68db4c74c43d4042b0b32bcd133121ab39b9b310 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 | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c +index 19002f02bd91..e1860779aa66 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; +@@ -168,6 +169,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; +@@ -181,6 +183,22 @@ 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) { ++ pr_err("peci-cputemp_dts: 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_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index 591e86160..54e182386 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,10 +1,12 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +LINUX_VERSION = "5.10.30" + KBRANCH = "dev-5.10-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="faadf371d041eb0d2c8b1d4cc729f19cf53e6a92" +SRCREV="0785121bf4894ebecd9a6efc82331894fefd6c82" do_compile_prepend(){ # device tree compiler flags @@ -17,6 +19,8 @@ SRC_URI += " \ 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://1003-Die_CPU-filter-first-zero-from-GetTemp.patch \ + file://1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-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 6bfe783af..428d4a67e 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 07bba51a168b769563a649f1c0f3a9126f480e57 Mon Sep 17 00:00:00 2001 +From 24bac5f6660ec5e5ea15c0f062dc4a08fbc0e876 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 @@ -26,7 +26,7 @@ Signed-off-by: Johnathan Mantey 4 files changed, 271 insertions(+), 1 deletion(-) diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp -index c47a759..d7a4168 100644 +index 607e658..e2b2da9 100644 --- a/ethernet_interface.cpp +++ b/ethernet_interface.cpp @@ -45,6 +45,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; @@ -48,7 +48,7 @@ index c47a759..d7a4168 100644 // Emit deferred signal. if (emitSignal) -@@ -1148,5 +1153,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) +@@ -1175,5 +1180,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) manager.writeToConfigurationFile(); return gw; } @@ -174,7 +174,7 @@ index c47a759..d7a4168 100644 } // namespace network } // namespace phosphor diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp -index e2418a2..60fd272 100644 +index 8e28b51..ebba151 100644 --- a/ethernet_interface.hpp +++ b/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -192,7 +192,7 @@ index e2418a2..60fd272 100644 #include #include #include -@@ -23,7 +26,8 @@ using Ifaces = sdbusplus::server::object::object< +@@ -33,7 +36,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 +202,7 @@ index e2418a2..60fd272 100644 using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; -@@ -31,11 +35,14 @@ using EthernetInterfaceIntf = +@@ -41,11 +45,14 @@ using EthernetInterfaceIntf = sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; using MacAddressIntf = sdbusplus::xyz::openbmc_project::Network::server::MACAddress; @@ -217,10 +217,10 @@ index e2418a2..60fd272 100644 class Manager; // forward declaration of network manager. -@@ -233,6 +240,14 @@ class EthernetInterface : public Ifaces - */ +@@ -244,6 +251,14 @@ class EthernetInterface : public Ifaces std::string defaultGateway6(std::string gateway) override; + using EthernetInterfaceIntf::dhcpEnabled; + /** @brief sets the channel maxium privilege. + * @param[in] value - Channel privilege which needs to be set on the + * system. @@ -229,10 +229,10 @@ index e2418a2..60fd272 100644 + std::string maxPrivilege(std::string value) override; + + using ChannelAccessIntf::maxPrivilege; - using EthernetInterfaceIntf::dHCPEnabled; using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; -@@ -356,6 +371,26 @@ class EthernetInterface : public Ifaces + using EthernetInterfaceIntf::nicEnabled; +@@ -366,6 +381,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the address is static */ bool originIsManuallyAssigned(IP::AddressOrigin origin); @@ -260,7 +260,7 @@ index e2418a2..60fd272 100644 } // namespace network diff --git a/network_manager.cpp b/network_manager.cpp -index c55c9bb..50ff908 100644 +index 881b767..847852f 100644 --- a/network_manager.cpp +++ b/network_manager.cpp @@ -36,6 +36,13 @@ extern std::unique_ptr restartTimer; @@ -380,10 +380,10 @@ index c55c9bb..50ff908 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/network_manager.hpp b/network_manager.hpp -index 6815d3f..96e20a6 100644 +index 227955c..9f5b7a9 100644 --- a/network_manager.hpp +++ b/network_manager.hpp -@@ -151,6 +151,12 @@ class Manager : public details::VLANCreateIface +@@ -155,6 +155,12 @@ class Manager : public details::VLANCreateIface return (interfaces.find(intf) != interfaces.end()); } @@ -396,7 +396,7 @@ index 6815d3f..96e20a6 100644 protected: /** @brief Persistent sdbusplus DBus bus connection. */ sdbusplus::bus::bus& bus; -@@ -173,6 +179,9 @@ class Manager : public details::VLANCreateIface +@@ -177,6 +183,9 @@ class Manager : public details::VLANCreateIface /** @brief Network Configuration directory. */ fs::path confDir; 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 3540e93b4..3877adabd 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,9 +3,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "ee5b2c9469a56205567a8b1b120ecf34fc9f5ef4" +SRCREV = "de433b74ec5bce22043ea44c55e83d9be3dc5372" -SRC_URI += "file://0003-Adding-channel-specific-privilege-to-network.patch \ +SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ " EXTRA_OECONF_append = " --enable-nic-ethtool=yes" +EXTRA_OECONF_append = " --enable-ipv6-accept-ra=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 2578785b4..68678e420 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -107,6 +107,10 @@ while read IFACE UBDEV; do if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then first_error_seen=$error fi + else + # Disable netipmid if present because eth(x) is not present + /bin/systemctl disable "phosphor-ipmi-net@$IFACE.socket" + /bin/systemctl disable "phosphor-ipmi-net@$IFACE.service" fi done <<-END_CONF eth0 eth1addr diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch index 8682e2cad..b44220e4b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch @@ -1,4 +1,4 @@ -From ff5dbca96d12b1c2aaaec0bb891125990af3f218 Mon Sep 17 00:00:00 2001 +From 7ae5ebc43755631c1756bbc1e89b41f2a1da138c Mon Sep 17 00:00:00 2001 From: mansijos Date: Tue, 6 Apr 2021 02:12:56 +0530 Subject: [PATCH] Entity-manager: Add support to update assetTag @@ -15,14 +15,14 @@ The new value is preserved after BMC resets. Change-Id: If7fbfd8325488280f500ab0e2c8b38475813cc3f Signed-off-by: mansijos --- - src/EntityManager.cpp | 92 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 88 insertions(+), 4 deletions(-) + src/EntityManager.cpp | 93 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp -index 932b6f9..67b8f95 100644 +index 7cfcc6e..bf5e175 100644 --- a/src/EntityManager.cpp +++ b/src/EntityManager.cpp -@@ -47,9 +47,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; +@@ -48,9 +48,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; constexpr const char* currentConfiguration = "/var/configuration/system.json"; constexpr const char* globalSchema = "global.json"; constexpr const int32_t MAX_MAPPER_DEPTH = 0; @@ -40,7 +40,7 @@ index 932b6f9..67b8f95 100644 struct cmp_str { bool operator()(const char* a, const char* b) const -@@ -575,6 +583,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, +@@ -576,6 +584,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, } } @@ -84,7 +84,7 @@ index 932b6f9..67b8f95 100644 template void addProperty(const std::string& propertyName, const PropertyType& value, sdbusplus::asio::dbus_interface* iface, -@@ -589,9 +634,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, +@@ -590,9 +635,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, } iface->register_property( propertyName, value, @@ -104,7 +104,7 @@ index 932b6f9..67b8f95 100644 val = newVal; if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration)) -@@ -989,6 +1043,9 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -990,6 +1044,9 @@ void postToDbus(const nlohmann::json& newConfiguration, populateInterfaceFromJson(systemConfiguration, jsonPointerPath, boardIface, boardValues, objServer); jsonPointerPath += "/"; @@ -114,7 +114,7 @@ index 932b6f9..67b8f95 100644 // iterate through board properties for (auto& boardField : boardValues.items()) { -@@ -998,9 +1055,28 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -999,9 +1056,28 @@ void postToDbus(const nlohmann::json& newConfiguration, createInterface(objServer, boardName, boardField.key(), boardKeyOrig); @@ -146,18 +146,19 @@ index 932b6f9..67b8f95 100644 } } -@@ -1349,6 +1425,10 @@ void PerformScan::run() - continue; +@@ -1357,6 +1433,11 @@ void PerformScan::run() + { + continue; // non-numeric replacement } - ++ + nlohmann::json recordVal = *recordPtr; + // Save the dbus path info of the device + recordVal[foundObject]["Path"] = std::get<1>(*itr); + - int index = std::stoi( - nameIt->get().substr(indexIdx), - nullptr, 0); -@@ -1421,6 +1501,10 @@ void PerformScan::run() + usedNames.insert(nameIt.value()); + auto usedIt = std::find(indexes.begin(), + indexes.end(), index); +@@ -1434,6 +1515,10 @@ void PerformScan::run() } } @@ -169,5 +170,5 @@ index 932b6f9..67b8f95 100644 { std::cerr << "Duplicates found, replacing " -- -2.17.1 +2.30.2 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 9d891c620..a7448a84b 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,11 +1,10 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "1694ef625a1075599e40faa695a40d61ccd91095" +SRCREV = "cda147301b0fa7eac99eee3a7565604dbd6f74dd" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += " file://0001-Improve-initialization-of-I2C-sensors.patch \ - file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ +SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0003-Add-logs-to-fwVersionIsSame.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch new file mode 100644 index 000000000..6af0a5702 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch @@ -0,0 +1,39 @@ +From 6b4071c12bdcc3bd20e72a7bd2eed19ff14b97af Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Wed, 12 May 2021 19:11:08 -0700 +Subject: [PATCH] allow dbus sensors without thresholds + +catch dbus exceptions when query for thresholds interfaces. +log messages and continue. + +Signed-off-by: Zhikui Ren +--- + dbus/dbusconfiguration.cpp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp +index 55151d3..fd7a138 100644 +--- a/dbus/dbusconfiguration.cpp ++++ b/dbus/dbusconfiguration.cpp +@@ -286,13 +286,15 @@ void populatePidInfo( + { + interface = thresholds::criticalInterface; + } +- const std::string& path = sensorConfig.at(info.inputs.front()).readPath; + +- DbusHelper helper(sdbusplus::bus::new_system()); +- std::string service = helper.getService(interface, path); + double reading = 0; + try + { ++ const std::string& path = sensorConfig.at(info.inputs.front()).readPath; ++ ++ DbusHelper helper(sdbusplus::bus::new_system()); ++ std::string service = helper.getService(interface, path); ++ + helper.getProperty(service, path, interface, *thresholdProperty, + reading); + } +-- +2.17.1 + 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 ab1cd3742..cdefe246f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -5,6 +5,10 @@ SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "cb4c1a27574a7fe121a851ae7ba67aec254a1129" +SRCREV = "18d5bb18dcb4ebf7340b0b7a0b39daa887d530ce" + +SRC_URI += "\ + file://0001-allow-dbus-sensors-without-thresholds.patch \ + " FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch index cfaa077eb..0a47e3278 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch @@ -1,4 +1,4 @@ -From df1281792f6886b41c99919e8197c2c2d369d0ca Mon Sep 17 00:00:00 2001 +From 6ce336adafd723319befc4ce918ba67a0ad3492c Mon Sep 17 00:00:00 2001 From: Jennifer Lee Date: Mon, 10 Dec 2018 10:36:44 -0800 Subject: [PATCH] Modified firmware activation to launch fwupd.sh through @@ -12,19 +12,19 @@ Signed-off-by: Jennifer Lee Signed-off-by: James Feist --- activation.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- - meson.build | 1 + + meson.build | 2 ++ meson_options.txt | 3 +++ static/flash.cpp | 42 ++++++++++++++++++++++++++++++++++++++++-- ubi/flash.cpp | 9 +++------ - 5 files changed, 91 insertions(+), 9 deletions(-) + 5 files changed, 92 insertions(+), 9 deletions(-) diff --git a/activation.cpp b/activation.cpp -index eb57587..901caf3 100644 +index c82e297..d690a39 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -92,7 +92,50 @@ auto Activation::activation(Activations value) -> Activations - value == - softwareServer::Activation::Activations::ActivatingAsStandbySpare) +@@ -88,7 +88,50 @@ auto Activation::activation(Activations value) -> Activations + + if (value == softwareServer::Activation::Activations::Activating) { +#ifdef FWUPD_SCRIPT + if (!activationProgress) @@ -53,7 +53,7 @@ index eb57587..901caf3 100644 + } + else if (activationProgress->progress() == 100) + { -+ log("[Jennifer] progress == 100..."); ++ log("progress == 100..."); + if (!redundancyPriority) + { + redundancyPriority = @@ -73,7 +73,7 @@ index eb57587..901caf3 100644 #ifdef HOST_BIOS_UPGRADE auto purpose = parent.versions.find(versionId)->second->purpose(); if (purpose == VersionPurpose::Host) -@@ -115,7 +158,6 @@ auto Activation::activation(Activations value) -> Activations +@@ -111,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation(value); } #endif @@ -81,7 +81,7 @@ index eb57587..901caf3 100644 auto versionStr = parent.versions.find(versionId)->second->version(); if (!minimum_ship_level::verify(versionStr)) -@@ -179,6 +221,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -175,6 +217,7 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation( softwareServer::Activation::Activations::Active); #endif @@ -90,19 +90,20 @@ index eb57587..901caf3 100644 else { diff --git a/meson.build b/meson.build -index 0a7a6a6..5990168 100644 +index a6ebcc4..5c79009 100644 --- a/meson.build +++ b/meson.build -@@ -57,6 +57,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ - get_option('verify-signature').enabled() or \ +@@ -59,6 +59,8 @@ conf.set('WANT_SIGNATURE_VERIFY', \ get_option('verify-full-signature').enabled()) conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) -+conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++ # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) + conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) diff --git a/meson_options.txt b/meson_options.txt -index 355773c..f0c8730 100644 +index 0877798..da257b7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch index 49bdc138f..e1a7f1746 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -1,4 +1,4 @@ -From 030f918b90ea45104bccf68082c2d634c6694238 Mon Sep 17 00:00:00 2001 +From 51fd06346ff492d5d4862886cb34e024d05edb45 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Tue, 13 Aug 2019 22:43:12 +0530 Subject: [PATCH] PFR images support in phosphor-software-manager @@ -12,34 +12,20 @@ tested PFR image uploads and updates Signed-off-by: Vikram Bodireddy --- - activation.cpp | 2 +- item_updater.cpp | 7 +- - meson.build | 7 +- + meson.build | 8 +- meson_options.txt | 3 + - pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ - pfr_image_manager.hpp | 75 +++++++++++++++ - 6 files changed, 306 insertions(+), 5 deletions(-) + pfr_image_manager.cpp | 218 ++++++++++++++++++++++++++++++++++++++++++ + pfr_image_manager.hpp | 76 +++++++++++++++ + 5 files changed, 308 insertions(+), 4 deletions(-) create mode 100644 pfr_image_manager.cpp create mode 100644 pfr_image_manager.hpp -diff --git a/activation.cpp b/activation.cpp -index bad17b8..3363230 100644 ---- a/activation.cpp -+++ b/activation.cpp -@@ -119,7 +119,7 @@ auto Activation::activation(Activations value) -> Activations - } - else if (activationProgress->progress() == 100) - { -- log("[Jennifer] progress == 100..."); -+ log("progress == 100..."); - if (!redundancyPriority) - { - redundancyPriority = diff --git a/item_updater.cpp b/item_updater.cpp -index df8595c..694975f 100644 +index 81fc01f..60e7d23 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) +@@ -65,10 +65,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( std::get(property.second)); if (value == VersionPurpose::BMC || @@ -52,7 +38,7 @@ index df8595c..694975f 100644 { purpose = value; } -@@ -399,6 +399,7 @@ void ItemUpdater::deleteAll() +@@ -414,6 +414,7 @@ void ItemUpdater::deleteAll() ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(const std::string& filePath) { @@ -60,7 +46,7 @@ index df8595c..694975f 100644 bool valid = true; // Record the images which are being updated -@@ -416,7 +417,7 @@ ItemUpdater::ActivationStatus +@@ -431,7 +432,7 @@ ItemUpdater::ActivationStatus return ItemUpdater::ActivationStatus::invalid; } } @@ -69,37 +55,27 @@ index df8595c..694975f 100644 return ItemUpdater::ActivationStatus::ready; } -@@ -690,8 +691,8 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if ((iter.second.get()->activation() == -- server::Activation::Activations::Active)&& -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active) && - iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); diff --git a/meson.build b/meson.build -index 08d6f71..c61d59f 100644 +index 5c79009..e33998d 100644 --- a/meson.build +++ b/meson.build -@@ -55,6 +55,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) - conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) - conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) +@@ -60,6 +60,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ + conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) + conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) +conf.set('PFR_UPDATE', get_option('pfr-update').enabled()) - + # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) -@@ -195,12 +196,16 @@ executable( +@@ -205,12 +206,17 @@ executable( install: true ) - + +image_manager_source = files('image_manager.cpp') +if get_option('pfr-update').enabled() + image_manager_source = files('pfr_image_manager.cpp') +endif ++ executable( 'phosphor-version-software-manager', image_error_cpp, @@ -111,22 +87,22 @@ index 08d6f71..c61d59f 100644 'watch.cpp', dependencies: [deps, ssl], diff --git a/meson_options.txt b/meson_options.txt -index 4f7e62a..1593502 100644 +index da257b7..2204e04 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', +@@ -28,6 +28,9 @@ option('verify-full-signature', type: 'feature', option('fwupd-script', type: 'feature', description: 'Enable fwupd script support.') - + +option('pfr-update', type: 'feature', -+ description: 'Enable fwupd script support.') ++ description: 'Enable PFR image support.') + # Variables option( 'active-bmc-max-allowed', type: 'integer', diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp new file mode 100644 -index 0000000..242a6ca +index 0000000..fec1e94 --- /dev/null +++ b/pfr_image_manager.cpp @@ -0,0 +1,218 @@ @@ -350,7 +326,7 @@ index 0000000..242a6ca +} // namespace phosphor diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp new file mode 100644 -index 0000000..c6ee6a4 +index 0000000..b9a5822 --- /dev/null +++ b/pfr_image_manager.hpp @@ -0,0 +1,76 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch deleted file mode 100644 index 156e6fe7c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f6022e25d0b47af502522913773e589fcdd1568e Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy -Date: Sun, 5 Jul 2020 00:54:57 +0530 -Subject: [PATCH] Fix for RedudancyPriority in item_updater - -This fixes accessing RedudancyPriority property for the -activated image in item_updater. The downloaded image object -is not actually associated with RedudancyPriority before and -after activation. There exists no RedundancyPriority property -for downloaded image, accessing it causing a crash in -item_updater. - -Tested: Tested for coredumps during Seamless firmware update. - -Signed-off-by: Vikram Bodireddy - ---- - item_updater.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/item_updater.cpp b/item_updater.cpp -index c3a846d..b299b4d 100644 ---- a/item_updater.cpp -+++ b/item_updater.cpp -@@ -690,8 +690,9 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if (iter.second.get()->activation() == -- server::Activation::Activations::Active) -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active)&& -+ iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); - } 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 63e0aff25..decea878f 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 @@ -13,7 +13,6 @@ SRC_URI += " \ file://0007-Adding-StandBySpare-for-firmware-activation.patch \ file://0008-item_updater-update-the-bmc_active-objectPath.patch \ file://0009-Add-ApplyOptions-D-bus-property-under-Software.patch \ - file://0011-Fix-for-RedudancyPriority-in-item_updater.patch \ file://0013-remove-image-file-on-pre-script-failures.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch deleted file mode 100644 index ec6d70df1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4af788655c5b5a5fae4d85b365a70dc619810fe0 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 - -Tested: Verified that ConnectedVia property is returned and set to - "NotConnected" for disconnected media. - -Signed-off-by: Karol Wachowski ---- - redfish-core/lib/virtual_media.hpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..80e7315 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -192,6 +192,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, - item["@odata.id"] = - "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; - item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; -+ item["ConnectedVia"] = "NotConnected"; - item["Name"] = "Virtual Removable Media"; - item["Id"] = resName; - item["WriteProtected"] = true; 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 193461baf..a76990262 100755 --- 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 10cb7cb14974725a29b3ead4c543ca5e58234c07 Mon Sep 17 00:00:00 2001 +From d5f2e8b00bc5f8a727a1ef678941c4993c3ea7a6 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Wed, 18 Nov 2020 17:14:41 +0530 Subject: [PATCH] Firmware update configuration changes @@ -39,23 +39,21 @@ Tested: - Successfully ran redfish validater with no new errors. -Signed-off-by: Vikram Bodireddy - -%% original patch: 0001-Firmware-update-configuration-changes.patch - Change-Id: I44e1743fd76aa37c7b8affa49a3e05f808187037 +Signed-off-by: Vikram Bodireddy Signed-off-by: Helen Huang +Signed-off-by: AppaRao Puli --- - redfish-core/lib/update_service.hpp | 339 ++++++++++++++++-- + redfish-core/lib/update_service.hpp | 338 ++++++++++++++++-- static/redfish/v1/$metadata/index.xml | 3 + .../JsonSchemas/OemUpdateService/index.json | 69 ++++ .../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++ - 4 files changed, 421 insertions(+), 30 deletions(-) + 4 files changed, 421 insertions(+), 29 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 6d44171..8eda265 100644 +index ca1234f..0a9f81a 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -32,6 +32,17 @@ static std::unique_ptr fwUpdateErrorMatcher; @@ -76,7 +74,7 @@ index 6d44171..8eda265 100644 static void cleanUp() { -@@ -40,27 +51,119 @@ static void cleanUp() +@@ -40,28 +51,120 @@ static void cleanUp() fwUpdateErrorMatcher = nullptr; } static void activateImage(const std::string& objPath, @@ -201,12 +199,13 @@ index 6d44171..8eda265 100644 // Note that asyncResp can be either a valid pointer or nullptr. If nullptr // then no asyncResp updates will occur - static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, -+ const std::vector imgUriTargets, - sdbusplus::message::message& m, - const crow::Request& req) + static void + softwareInterfaceAdded(const std::shared_ptr& asyncResp, ++ const std::vector imgUriTargets, + sdbusplus::message::message& m, + const crow::Request& req) { -@@ -73,22 +176,24 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -74,22 +177,24 @@ static void m.read(objPath, interfacesProperties); @@ -235,7 +234,7 @@ index 6d44171..8eda265 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -115,7 +220,7 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -116,7 +221,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -244,7 +243,7 @@ index 6d44171..8eda265 100644 if (asyncResp) { std::shared_ptr task = -@@ -247,8 +352,7 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -248,8 +353,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -254,17 +253,16 @@ index 6d44171..8eda265 100644 } } } -@@ -257,7 +361,8 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, - // then no asyncResp updates will occur +@@ -259,7 +363,7 @@ static void static void monitorForSoftwareAvailable( - const std::shared_ptr& asyncResp, const crow::Request& req, -- const std::string& url, int timeoutTimeSeconds = 10) -+ const std::string& url, const std::vector& imgUriTargets, -+ int timeoutTimeSeconds = 10) + const std::shared_ptr& asyncResp, + const crow::Request& req, const std::string& url, +- int timeoutTimeSeconds = 10) ++ const std::vector& imgUriTargets, int timeoutTimeSeconds = 10) { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -297,9 +402,10 @@ static void monitorForSoftwareAvailable( +@@ -299,9 +403,10 @@ static void monitorForSoftwareAvailable( } }); @@ -277,7 +275,7 @@ index 6d44171..8eda265 100644 }; fwUpdateInProgress = true; -@@ -475,12 +581,15 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -477,12 +582,15 @@ class UpdateServiceActionsSimpleUpdate : public Node std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -294,7 +292,7 @@ index 6d44171..8eda265 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -514,7 +623,8 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -516,7 +624,8 @@ class UpdateServiceActionsSimpleUpdate : public Node class UpdateService : public Node { public: @@ -304,37 +302,38 @@ index 6d44171..8eda265 100644 { entityPrivileges = { {boost::beast::http::verb::get, {{"Login"}}}, -@@ -526,6 +636,8 @@ class UpdateService : public Node +@@ -528,6 +637,8 @@ class UpdateService : public Node } private: + std::vector httpPushUriTargets; + bool httpPushUriTargetBusy; - void doGet(crow::Response& res, const crow::Request&, - const std::vector&) override + void doGet(const std::shared_ptr& asyncResp, + const crow::Request&, const std::vector&) override { -@@ -536,6 +648,8 @@ class UpdateService : public Node - res.jsonValue["Description"] = "Service for Software Update"; - res.jsonValue["Name"] = "Update Service"; - res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; -+ res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; -+ res.jsonValue["HttpPushUriTargetsBusy"] = httpPushUriTargetBusy; +@@ -538,6 +649,9 @@ class UpdateService : public Node + asyncResp->res.jsonValue["Description"] = "Service for Software Update"; + asyncResp->res.jsonValue["Name"] = "Update Service"; + asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; ++ asyncResp->res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; ++ asyncResp->res.jsonValue["HttpPushUriTargetsBusy"] = ++ httpPushUriTargetBusy; // UpdateService cannot be disabled - res.jsonValue["ServiceEnabled"] = true; - res.jsonValue["FirmwareInventory"] = { -@@ -585,6 +699,31 @@ class UpdateService : public Node + asyncResp->res.jsonValue["ServiceEnabled"] = true; + asyncResp->res.jsonValue["FirmwareInventory"] = { +@@ -587,6 +701,32 @@ class UpdateService : public Node "/xyz/openbmc_project/software/apply_time", "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); + + // Get the ApplyOptions value + crow::connections::systemBus->async_method_call( -+ [aResp](const boost::system::error_code ec, -+ const std::variant applyOption) { ++ [asyncResp](const boost::system::error_code ec, ++ const std::variant applyOption) { + if (ec) + { + BMCWEB_LOG_DEBUG << "DBUS response error " << ec; -+ messages::internalError(aResp->res); ++ messages::internalError(asyncResp->res); + return; + } + @@ -342,10 +341,11 @@ index 6d44171..8eda265 100644 + + if (b) + { -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = + "#OemUpdateService.ApplyOptions"; -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = -+ *b; ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = *b; + } + }, + "xyz.openbmc_project.Software.BMC.Updater", @@ -353,21 +353,20 @@ index 6d44171..8eda265 100644 + "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); } - void doPatch(crow::Response& res, const crow::Request& req, -@@ -595,12 +734,61 @@ class UpdateService : public Node - std::shared_ptr asyncResp = std::make_shared(res); + void doPatch(const std::shared_ptr& asyncResp, +@@ -596,12 +736,61 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPatch..."; std::optional pushUriOptions; -- if (!json_util::readJson(req, res, "HttpPushUriOptions", -- pushUriOptions)) + std::optional> imgTargets; + std::optional imgTargetBusy; + std::optional oemProps; + -+ if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions, -+ "HttpPushUriTargets", imgTargets, -+ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem", -+ oemProps)) + if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions", +- pushUriOptions)) ++ pushUriOptions, "HttpPushUriTargets", ++ imgTargets, "HttpPushUriTargetsBusy", ++ imgTargetBusy, "Oem", oemProps)) { + BMCWEB_LOG_DEBUG << "UpdateService doPatch: Invalid request body"; return; @@ -377,7 +376,7 @@ index 6d44171..8eda265 100644 + { + std::optional applyOptions; + -+ if (!json_util::readJson(*oemProps, res, "ApplyOptions", ++ if (!json_util::readJson(*oemProps, asyncResp->res, "ApplyOptions", + applyOptions)) + { + return; @@ -386,8 +385,8 @@ index 6d44171..8eda265 100644 + if (applyOptions) + { + std::optional clearConfig; -+ if (!json_util::readJson(*applyOptions, res, "ClearConfig", -+ clearConfig)) ++ if (!json_util::readJson(*applyOptions, asyncResp->res, ++ "ClearConfig", clearConfig)) + { + return; + } @@ -418,7 +417,7 @@ index 6d44171..8eda265 100644 if (pushUriOptions) { std::optional pushUriApplyTime; -@@ -665,6 +853,98 @@ class UpdateService : public Node +@@ -666,6 +855,98 @@ class UpdateService : public Node } } } @@ -516,9 +515,9 @@ index 6d44171..8eda265 100644 + } } - void doPost(crow::Response& res, const crow::Request& req, -@@ -675,8 +955,8 @@ class UpdateService : public Node - std::shared_ptr asyncResp = std::make_shared(res); + void doPost(const std::shared_ptr& asyncResp, +@@ -675,8 +956,8 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPost..."; // Setup callback for when new software detected - monitorForSoftwareAvailable(asyncResp, req, @@ -528,7 +527,7 @@ index 6d44171..8eda265 100644 std::string filepath( "/tmp/images/" + -@@ -761,7 +1041,7 @@ class SoftwareInventoryCollection : public Node +@@ -759,7 +1040,7 @@ class SoftwareInventoryCollection : public Node "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast(0), @@ -537,7 +536,7 @@ index 6d44171..8eda265 100644 } }; -@@ -943,7 +1223,7 @@ class SoftwareInventory : public Node +@@ -940,7 +1221,7 @@ class SoftwareInventory : public Node }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -546,7 +545,7 @@ index 6d44171..8eda265 100644 } if (!found) { -@@ -964,8 +1244,7 @@ class SoftwareInventory : public Node +@@ -961,8 +1242,7 @@ class SoftwareInventory : public Node "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", @@ -557,19 +556,19 @@ index 6d44171..8eda265 100644 }; diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index 514f3dd..c068d4f 100644 +index 9d9fd1f..6cbc0d1 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2142,6 +2142,9 @@ - - +@@ -2145,6 +2145,9 @@ + + + + + - - - + + + diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json new file mode 100644 index 0000000..74e39cd diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch deleted file mode 100644 index c9a4119a1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch +++ /dev/null @@ -1,182 +0,0 @@ - -From 1bbabe4ecdeea20da809b9f1d8e194683629517c Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Tue, 20 Apr 2021 16:32:37 +0200 -Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, PUT, - DELETE, PATCH in proxy mode - -Add handlers for GET, PUT, DELETE, PATCH method and function that -checks which mode is used and set suitable status code: -Not allowed for Legacy and Not found for Proxy. - -Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b -Signed-off-by: Alicja Rybak ---- - redfish-core/lib/virtual_media.hpp | 154 +++++++++++++++++++++++++++++ - 1 file changed, 154 insertions(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 8353ce7..66bf220 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -530,6 +530,160 @@ class VirtualMediaActionInsertMedia : public Node - return true; - } - -+ /** -+ * @brief Function checks if insert media request is Legacy or Proxy type -+ * and sets suitable response code for unsupported REST method. -+ * -+ */ -+ void CheckProxyMode(crow::Response& res, -+ const crow::Request& req, -+ const std::vector& params) -+ { -+ auto aResp = std::make_shared(res); -+ -+ if (params.size() != 2) -+ { -+ messages::internalError(res); -+ return; -+ } -+ -+ // take resource name from URL -+ const std::string& resName = params[1]; -+ -+ if (params[0] != "bmc") -+ { -+ messages::resourceNotFound(res, "VirtualMedia.Insert", resName); -+ -+ return; -+ } -+ -+ crow::connections::systemBus->async_method_call( -+ [this, aResp{std::move(aResp)}, req, -+ resName](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " -+ << ec; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ -+ return; -+ } -+ std::string service = getObjectType.begin()->first; -+ BMCWEB_LOG_DEBUG << "GetObjectType: " << service; -+ -+ crow::connections::systemBus->async_method_call( -+ [this, service, resName, req, -+ aResp{aResp}](const boost::system::error_code ec, -+ ManagedObjectType& subtree) { -+ if (ec) -+ { -+ BMCWEB_LOG_DEBUG << "DBUS response error"; -+ -+ return; -+ } -+ -+ for (auto& item : subtree) -+ { -+ std::string thispath = item.first.filename(); -+ if (thispath.empty()) -+ { -+ continue; -+ } -+ -+ if (thispath != resName) -+ { -+ continue; -+ } -+ -+ auto mode = item.first.parent_path(); -+ auto type = mode.parent_path(); -+ if (mode.filename().empty() || -+ type.filename().empty()) -+ { -+ continue; -+ } -+ -+ if (type.filename() != "VirtualMedia") -+ { -+ continue; -+ } -+ -+ // Check if dbus path is Legacy type -+ if (mode.filename() == "Legacy") -+ { -+ BMCWEB_LOG_DEBUG << "InsertMedia only allowed " -+ "with POST method " -+ "in legacy mode"; -+ aResp->res.result( -+ boost::beast::http::status:: -+ method_not_allowed); -+ -+ return; -+ } -+ // Check if dbus path is Proxy type -+ if (mode.filename() == "Proxy") -+ { -+ // Not possible in proxy mode -+ BMCWEB_LOG_DEBUG << "InsertMedia not " -+ "allowed in proxy mode"; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ -+ return; -+ } -+ } -+ -+ BMCWEB_LOG_DEBUG << "Parent item not found"; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ }, -+ service, "/xyz/openbmc_project/VirtualMedia", -+ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/VirtualMedia", std::array()); -+ } -+ -+ /** -+ * @brief Function handles GET method request. -+ */ -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles PATCH method request. -+ */ -+ void doPatch(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles PUT method request. -+ */ -+ void doPut(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles DELETE method request. -+ */ -+ void doDelete(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ - /** - * @brief Function handles POST method request. - * diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch deleted file mode 100644 index eaba041d5..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch +++ /dev/null @@ -1,40 +0,0 @@ -From dab4adbf211b6867f86fcf6080b34a0e41f6f4a1 Mon Sep 17 00:00:00 2001 -From: Karol Wachowski -Date: Tue, 23 Feb 2021 15:53:16 +0000 -Subject: [PATCH] Set Inserted redfish property for not inserted resources - -Tested: Verified that Inserted property is returned and set to - "false" for not inserted media. -Signed-off-by: Karol Wachowski ---- - redfish-core/lib/virtual_media.hpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..f477f63 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -95,6 +95,7 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - BMCWEB_LOG_DEBUG << "Value Active not found"; - return; - } -+ aResp->res.jsonValue["Inserted"] = *activeValue; - - const std::string* endpointIdValue = - std::get_if(&endpointIdProperty->second); -@@ -106,7 +107,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = - *endpointIdValue; - aResp->res.jsonValue["TransferProtocolType"] = "OEM"; -- aResp->res.jsonValue["Inserted"] = *activeValue; - if (*activeValue == true) - { - aResp->res.jsonValue["ConnectedVia"] = "Applet"; -@@ -137,7 +137,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - } - - aResp->res.jsonValue["Image"] = *imageUrlValue; -- aResp->res.jsonValue["Inserted"] = *activeValue; - aResp->res.jsonValue["TransferProtocolType"] = - getTransferProtocolTypeFromUri(*imageUrlValue); - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch deleted file mode 100644 index 074718349..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 81f2c022b22ef75990f30e5ba5bfd4ba5bd41754 Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Wed, 14 Apr 2021 16:26:59 +0200 -Subject: [PATCH] Bmcweb handle permission denied exception - -Add handling of permission denied exception (EPERM) that -can be thrown by VirtualMedia service during Mount/Unmount dbus operations. - -Tested: -Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode, -VirtualMedia returns EPERM, which bmcweb handles as 403 status code. - -Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b -Signed-off-by: Alicja Rybak ---- - redfish-core/lib/virtual_media.hpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..bbdc91b 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -900,6 +900,10 @@ class VirtualMediaActionInsertMedia : public Node - { - messages::resourceInUse(asyncResp->res); - } -+ else if (ec == boost::system::errc::permission_denied) -+ { -+ messages::accessDenied(asyncResp->res, "VirtualMedia.Insert"); -+ } - else - { - messages::internalError(asyncResp->res); -@@ -1092,6 +1096,10 @@ class VirtualMediaActionEjectMedia : public Node - { - messages::resourceInUse(asyncResp->res); - } -+ else if (ec == boost::system::errc::permission_denied) -+ { -+ messages::accessDenied(asyncResp->res, "VirtualMedia.Eject"); -+ } - else - { - messages::internalError(asyncResp->res); diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch deleted file mode 100644 index 01c1c858c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 76480c6a5b1708113f28aecab32a85984371243c Mon Sep 17 00:00:00 2001 -From: Karol Wachowski -Date: Fri, 10 Jul 2020 09:54:06 +0000 -Subject: [PATCH] bmcweb handle device or resource busy exception - -Use async_method_call_timed() for mount/unmount dbus oprations. -Long mount/unmount times are supported by VirtualMedia service, -this works because of settable timeout property, available for each block -device. -Default dbus calls will timeout when mount/unmount timeout is long enough. - -Get mount/unmount timeout property and use it for mount/unmount calls. -Add handling of device or resource busy exception (EBUSY) that -can be thrown by VirtualMedia service during Mount/Unmount dbus operations. - -Tested: Verified that after mounting non-existing HTTPS resource - in proxy mode, VirtualMedia recovers restoring ready state - and returns EBUSY during that transition. - Verfied that resources can be mounted/unmounted in both legacy - and proxy mode. -Signed-off-by: Karol Wachowski -Change-Id: Ica62c34db0cce24c4c6169fc661edfde49e948d0 ---- - redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++------- - 1 file changed, 110 insertions(+), 34 deletions(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 95a8881..188248a 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -24,6 +24,8 @@ - #include - #include - -+#include -+ - namespace redfish - - { -@@ -160,6 +162,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - } - } - -+/** -+ * @brief parses Timeout property and converts to microseconds -+ */ -+static std::optional -+ vmParseTimeoutProperty(const std::variant& timeoutProperty) -+{ -+ const int* timeoutValue = std::get_if(&timeoutProperty); -+ if (timeoutValue) -+ { -+ constexpr int timeoutMarginSeconds = 10; -+ return std::chrono::duration_cast( -+ std::chrono::seconds(*timeoutValue + timeoutMarginSeconds)) -+ .count(); -+ } -+ else -+ { -+ return std::nullopt; -+ } -+} -+ - /** - * @brief Fill template for Virtual Media Item. - */ -@@ -856,22 +878,54 @@ class VirtualMediaActionInsertMedia : public Node - } - - crow::connections::systemBus->async_method_call( -- [asyncResp, secretPipe](const boost::system::error_code ec, -- bool success) { -+ [asyncResp, service, name, imageUrl, rw, unixFd, -+ secretPipe](const boost::system::error_code ec, -+ const std::variant timeoutProperty) { - if (ec) - { - BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; - messages::internalError(asyncResp->res); -+ return; - } -- else if (!success) -+ -+ auto timeout = vmParseTimeoutProperty(timeoutProperty); -+ if (timeout == std::nullopt) - { -- BMCWEB_LOG_ERROR << "Service responded with error"; -- messages::generalError(asyncResp->res); -+ BMCWEB_LOG_ERROR << "Timeout property is empty."; -+ messages::internalError(asyncResp->res); -+ return; - } -+ -+ crow::connections::systemBus->async_method_call_timed( -+ [asyncResp, secretPipe](const boost::system::error_code ec, -+ bool success) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " -+ << ec; -+ if (ec == -+ boost::system::errc::device_or_resource_busy) -+ { -+ messages::resourceInUse(asyncResp->res); -+ } -+ else -+ { -+ messages::internalError(asyncResp->res); -+ } -+ } -+ else if (!success) -+ { -+ BMCWEB_LOG_ERROR << "Service responded with error"; -+ messages::generalError(asyncResp->res); -+ } -+ }, -+ service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -+ "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", -+ *timeout, imageUrl, rw, unixFd); - }, - service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -- "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", imageUrl, rw, -- unixFd); -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); - } - }; - -@@ -1003,38 +1057,60 @@ class VirtualMediaActionEjectMedia : public Node - const std::string& service, const std::string& name, - bool legacy) - { -- -- // Legacy mount requires parameter with image -+ std::string objectPath = "/xyz/openbmc_project/VirtualMedia/"; -+ std::string ifaceName = "xyz.openbmc_project.VirtualMedia"; - if (legacy) - { -- crow::connections::systemBus->async_method_call( -- [asyncResp](const boost::system::error_code ec) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -- -- messages::internalError(asyncResp->res); -- return; -- } -- }, -- service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -- "xyz.openbmc_project.VirtualMedia.Legacy", "Unmount"); -+ objectPath += "Legacy/"; -+ ifaceName += ".Legacy"; - } -- else // proxy -+ else - { -- crow::connections::systemBus->async_method_call( -- [asyncResp](const boost::system::error_code ec) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -- -- messages::internalError(asyncResp->res); -- return; -- } -- }, -- service, "/xyz/openbmc_project/VirtualMedia/Proxy/" + name, -- "xyz.openbmc_project.VirtualMedia.Proxy", "Unmount"); -+ objectPath += "Proxy/"; -+ ifaceName += ".Proxy"; - } -+ objectPath += name; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp, service, name, objectPath, -+ ifaceName](const boost::system::error_code ec, -+ const std::variant timeoutProperty) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ auto timeout = vmParseTimeoutProperty(timeoutProperty); -+ if (timeout == std::nullopt) -+ { -+ BMCWEB_LOG_ERROR << "Timeout property is empty."; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ crow::connections::systemBus->async_method_call_timed( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " -+ << ec; -+ if (ec == -+ boost::system::errc::device_or_resource_busy) -+ { -+ messages::resourceInUse(asyncResp->res); -+ } -+ else -+ { -+ messages::internalError(asyncResp->res); -+ } -+ return; -+ } -+ }, -+ service, objectPath, ifaceName, "Unmount", *timeout); -+ }, -+ service, objectPath, "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); - } - }; - --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch deleted file mode 100644 index 54f00aa39..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch +++ /dev/null @@ -1,547 +0,0 @@ -From d340953bc925ff8535c5a8fac54db24b243ba8ad Mon Sep 17 00:00:00 2001 -From: AppaRao Puli -Date: Mon, 19 Oct 2020 13:21:42 +0530 -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. - -Tested: - - 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 -Signed-off-by: P Dheeraj Srujan Kumar ---- - http/http_client.hpp | 370 +++++++++++++----- - .../include/event_service_manager.hpp | 2 +- - 2 files changed, 267 insertions(+), 105 deletions(-) - -diff --git a/http/http_client.hpp b/http/http_client.hpp -index 5c7b13f..d782dee 100644 ---- a/http/http_client.hpp -+++ b/http/http_client.hpp -@@ -31,12 +31,17 @@ namespace crow - { - - static constexpr uint8_t maxRequestQueueSize = 50; -+static constexpr unsigned int httpReadBodyLimit = 1024; - - enum class ConnState - { - initialized, -+ resolveInProgress, -+ resolveFailed, -+ resolved, - connectInProgress, - connectFailed, -+ sslHandshakeInProgress, - connected, - sendInProgress, - sendFailed, -@@ -50,53 +55,124 @@ enum class ConnState - class HttpClient : public std::enable_shared_from_this - { - private: -+ boost::asio::ip::tcp::resolver resolver; -+ boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv12_client}; - boost::beast::tcp_stream conn; -+ std::optional> sslConn; - boost::asio::steady_timer timer; -- boost::beast::flat_buffer buffer; -+ boost::beast::flat_static_buffer buffer; -+ std::optional< -+ boost::beast::http::response_parser> -+ parser; - boost::beast::http::request req; -- boost::beast::http::response res; - boost::asio::ip::tcp::resolver::results_type endpoint; -- std::vector> headers; -+ boost::beast::http::fields fields; - std::queue requestDataQueue; -- ConnState state; - std::string subId; - std::string host; - std::string port; - std::string uri; -+ bool useSsl; - uint32_t retryCount; - uint32_t maxRetryAttempts; - uint32_t retryIntervalSecs; - std::string retryPolicyAction; - bool runningTimer; -+ ConnState state; -+ -+ void doResolve() -+ { -+ BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; -+ if (state == ConnState::resolveInProgress) -+ { -+ return; -+ } -+ state = ConnState::resolveInProgress; -+ // TODO: Use async_resolver. boost asio example -+ // code as is crashing with async_resolve(). -+ try -+ { -+ endpoint = resolver.resolve(host, port); -+ } -+ catch (const std::exception& e) -+ { -+ BMCWEB_LOG_ERROR << "Failed to resolve hostname: " << host << " - " -+ << e.what(); -+ state = ConnState::resolveFailed; -+ checkQueue(); -+ return; -+ } -+ state = ConnState::resolved; -+ checkQueue(); -+ } - - void doConnect() - { -- if (state == ConnState::connectInProgress) -+ if (useSsl) -+ { -+ sslConn.emplace(conn, ctx); -+ } -+ -+ if ((state == ConnState::connectInProgress) || -+ (state == ConnState::sslHandshakeInProgress)) - { - return; - } - state = ConnState::connectInProgress; - - BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; -- // Set a timeout on the operation -+ -+ auto respHandler = -+ [self(shared_from_this())](const boost::beast::error_code ec, -+ const boost::asio::ip::tcp::resolver:: -+ results_type::endpoint_type& ep) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Connect " << ep -+ << " failed: " << ec.message(); -+ self->state = ConnState::connectFailed; -+ self->checkQueue(); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ if (self->sslConn) -+ { -+ self->performHandshake(); -+ } -+ else -+ { -+ self->state = ConnState::connected; -+ self->checkQueue(); -+ } -+ }; -+ - conn.expires_after(std::chrono::seconds(30)); -- conn.async_connect(endpoint, [self(shared_from_this())]( -- const boost::beast::error_code& ec, -- const boost::asio::ip::tcp::resolver:: -- results_type::endpoint_type& ep) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Connect " << ep -- << " failed: " << ec.message(); -- self->state = ConnState::connectFailed; -- self->checkQueue(); -- return; -- } -- self->state = ConnState::connected; -- BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ conn.async_connect(endpoint, std::move(respHandler)); -+ } -+ -+ void performHandshake() -+ { -+ if (state == ConnState::sslHandshakeInProgress) -+ { -+ return; -+ } -+ state = ConnState::sslHandshakeInProgress; -+ -+ sslConn->async_handshake( -+ boost::asio::ssl::stream_base::client, -+ [self(shared_from_this())](const boost::beast::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "SSL handshake failed: " -+ << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::connectFailed); -+ return; -+ } -+ self->state = ConnState::connected; -+ BMCWEB_LOG_DEBUG << "SSL Handshake successfull"; - -- self->checkQueue(); -- }); -+ self->checkQueue(); -+ }); - } - - void sendMessage(const std::string& data) -@@ -107,100 +183,170 @@ class HttpClient : public std::enable_shared_from_this - } - state = ConnState::sendInProgress; - -- BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; -+ BMCWEB_LOG_DEBUG << 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 = {}; -+ for (const auto& field : fields) - { -- req.set(key, value); -+ req.set(field.name_string(), field.value()); - } - req.set(boost::beast::http::field::host, host); -+ req.set(boost::beast::http::field::content_type, "text/plain"); -+ -+ req.version(static_cast(11)); // HTTP 1.1 -+ req.target(uri); -+ req.method(boost::beast::http::verb::post); - req.keep_alive(true); - - 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->doCloseAndCheckQueue(ConnState::sendFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); - -- // Send the HTTP request to the remote host -- boost::beast::http::async_write( -- conn, req, -- [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->checkQueue(); -- return; -- } -- BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -+ self->recvMessage(); -+ }; - -- self->recvMessage(); -- }); -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_write(*sslConn, req, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_write(conn, req, std::move(respHandler)); -+ } - } - - void recvMessage() - { -- // Receive the HTTP response -- boost::beast::http::async_read( -- conn, buffer, res, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec && ec != boost::beast::http::error::partial_message) -+ { -+ BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::recvFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); -+ -+ // TODO: check for return status code and perform -+ // retry if fails(Ex: 40x). Take action depending on -+ // retry policy. -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " -+ << self->parser->get().body(); -+ -+ // Send is successful, Lets remove data from queue -+ // check for next request data in queue. -+ self->requestDataQueue.pop(); -+ -+ // Transfer ownership of the response -+ self->parser->release(); -+ -+ // TODO: Implement the keep-alive connections. -+ // Most of the web servers close connection abruptly -+ // and might be reason due to which its observed that -+ // stream_truncated(Next read) or partial_message -+ // errors. So for now, closing connection and re-open -+ // for all cases. -+ self->doCloseAndCheckQueue(ConnState::closed); -+ }; -+ -+ parser.emplace(std::piecewise_construct, std::make_tuple()); -+ parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response parsing. -+ parser->skip(true); -+ buffer.consume(buffer.size()); -+ -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_read(*sslConn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_read(conn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ } -+ -+ void doCloseAndCheckQueue(const ConnState setState = ConnState::closed) -+ { -+ if (sslConn) -+ { -+ conn.expires_after(std::chrono::seconds(30)); -+ sslConn->async_shutdown([self = shared_from_this(), -+ setState{std::move(setState)}]( -+ const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "recvMessage() failed: " -- << ec.message(); -- self->state = ConnState::recvFailed; -- self->checkQueue(); -- return; -+ // Many https server closes connection abruptly -+ // i.e witnout close_notify. More details are at -+ // https://github.com/boostorg/beast/issues/824 -+ if (ec == boost::asio::ssl::error::stream_truncated) -+ { -+ BMCWEB_LOG_ERROR -+ << "doCloseAndCheckQueue(): Connection " -+ "closed by server. "; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } - } -- 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; -- -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- self->requestDataQueue.pop(); -- self->state = ConnState::idle; -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ self->conn.cancel(); -+ self->state = setState; - self->checkQueue(); - }); -- } -- -- void doClose() -- { -- boost::beast::error_code ec; -- conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -- -- state = ConnState::closed; -- // not_connected happens sometimes so don't bother reporting it. -- if (ec && ec != boost::beast::errc::not_connected) -+ } -+ else - { -- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); -- return; -+ boost::beast::error_code ec; -+ conn.expires_after(std::chrono::seconds(30)); -+ conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, -+ ec); -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ -+ conn.close(); -+ state = setState; -+ checkQueue(); - } -- BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -+ return; - } - - void checkQueue(const bool newRecord = false) - { - if (requestDataQueue.empty()) - { -- // TODO: Having issue in keeping connection alive. So lets close if -- // nothing to be transferred. -- doClose(); -- - BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; - return; - } -@@ -232,6 +378,7 @@ class HttpClient : public std::enable_shared_from_this - } - - if ((state == ConnState::connectFailed) || -+ (state == ConnState::resolveFailed) || - (state == ConnState::sendFailed) || - (state == ConnState::recvFailed)) - { -@@ -256,14 +403,18 @@ class HttpClient : public std::enable_shared_from_this - << " seconds. RetryCount = " << retryCount; - timer.expires_after(std::chrono::seconds(retryIntervalSecs)); - timer.async_wait( -- [self = shared_from_this()](const boost::system::error_code&) { -+ [self = shared_from_this()](boost::system::error_code) { - self->runningTimer = false; - self->connStateCheck(); - }); - return; - } -- // reset retry count. -- retryCount = 0; -+ -+ if (state == ConnState::idle) -+ { -+ // State idle means, previous attempt is successful. -+ retryCount = 0; -+ } - connStateCheck(); - - return; -@@ -273,15 +424,21 @@ class HttpClient : public std::enable_shared_from_this - { - switch (state) - { -+ case ConnState::initialized: -+ case ConnState::resolveFailed: -+ case ConnState::connectFailed: -+ doResolve(); -+ break; - case ConnState::connectInProgress: -+ case ConnState::resolveInProgress: -+ case ConnState::sslHandshakeInProgress: - case ConnState::sendInProgress: - case ConnState::suspended: - case ConnState::terminated: - // do nothing - break; -- case ConnState::initialized: - case ConnState::closed: -- case ConnState::connectFailed: -+ case ConnState::resolved: - case ConnState::sendFailed: - case ConnState::recvFailed: - { -@@ -297,22 +454,22 @@ class HttpClient : public std::enable_shared_from_this - sendMessage(data); - break; - } -+ default: -+ break; - } - } - - public: - explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, - 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), -- retryPolicyAction("TerminateAfterRetries"), runningTimer(false) -- { -- boost::asio::ip::tcp::resolver resolver(ioc); -- endpoint = resolver.resolve(host, port); -- state = ConnState::initialized; -- } -+ const std::string& destUri, -+ const bool inUseSsl = true) : -+ resolver(ioc), -+ conn(ioc), timer(ioc), subId(id), host(destIP), port(destPort), -+ uri(destUri), useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5), -+ retryPolicyAction("TerminateAfterRetries"), runningTimer(false), -+ state(ConnState::initialized) -+ {} - - void sendData(const std::string& data) - { -@@ -337,7 +494,12 @@ class HttpClient : public std::enable_shared_from_this - void setHeaders( - const std::vector>& httpHeaders) - { -- headers = httpHeaders; -+ // Set headers -+ for (const auto& [key, value] : httpHeaders) -+ { -+ // TODO: Validate the header fileds before assign. -+ fields.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 54dafb4..f68ae1d 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription - { - conn = std::make_shared( - crow::connections::systemBus->get_io_context(), id, host, port, -- path); -+ path, (uriProto == "https" ? true : false)); - } - - Subscription(const std::shared_ptr& adaptor) : --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch deleted file mode 100644 index acfd9225b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9493bb8e2f5c708e187313c86e6033de5f103c51 Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Fri, 23 Apr 2021 17:35:52 +0200 -Subject: [PATCH] Fix unmounting image in proxy mode. - -Sometimes Slot0 got higher key than Slot1 and erase function for Slot1 -invalidates elements with keys not less than the erased element. -In that case invalid slot0 will be unmounted. -Change order of calling close() and erase() functions to -unmount correct device. - -Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0 -Signed-off-by: Alicja Rybak ---- - include/nbd_proxy.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp -index 7b90e90..fa7f647 100644 ---- a/include/nbd_proxy.hpp -+++ b/include/nbd_proxy.hpp -@@ -428,9 +428,9 @@ inline void requestRoutes(App& app) - BMCWEB_LOG_DEBUG << "No session to close"; - return; - } -+ session->second->close(); - // Remove reference to session in global map - sessions.erase(session); -- session->second->close(); - }) - .onmessage([](crow::websocket::Connection& conn, - const std::string& data, bool) { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch deleted file mode 100644 index b2627644b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch +++ /dev/null @@ -1,850 +0,0 @@ -From c645c011bb3ea2a2aaf52560cb9fcc461d048cae Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Fri, 4 Sep 2020 19:24:25 +0800 -Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable - Attributes property - -1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry - RBC Daemon provide method to get BIOS attribute registry. -2. Eanble Attributes property for BIOS resource -3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS -settings -4. RBC daemon is at -https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/ -5. IPMI command implementation is at -https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/ -6. Property design is at -https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig -7. Design doc is at -https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md -8. There will be 95 test cases for this feature in the validation team. - -Tested: - -1. Use postman (Redfish tool) could get all the attributes in bios -resouce, get bios settings, get bios attribute -registry. -https://IP_ADDR/redfish/v1/Systems/system/Bios -{ - "@Redfish.Settings": { - "@odata.type": "#Settings.v1_3_0.Settings", - "SettingsObject": { - "@odata.id": "/redfish/v1/Systems/system/Bios/Settings" - } - }, - "@odata.id": "/redfish/v1/Systems/system/Bios", - "@odata.type": "#Bios.v1_1_0.Bios", - "Actions": { - "#Bios.ChangePassword": { - "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword" - }, - "#Bios.ResetBios": { - "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios" - } - }, - "AttributeRegistry": "BiosAttributeRegistry", - "Attributes": { - "attr0": "current value" - }, - "Description": "BIOS Configuration Service", - "Id": "BIOS", - "Links": { - "ActiveSoftwareImage": { - "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" - }, - "SoftwareImages": [ - { - "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" - } - ], - "SoftwareImages@odata.count": 1 - }, - "Name": "BIOS Configuration" -} - -Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry -{ - "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry", - "@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile", - "Description": "BiosAttributeRegistry Message Registry File Location", - "Id": "BiosAttributeRegistry", - "Languages": [ - "en" - ], - "Languages@odata.count": 1, - "Location": [ - { - "Language": "en", - "Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry" - } - ], - "Location@odata.count": 1, - "Name": "BiosAttributeRegistry Message Registry File", - "Registry": "BiosAttributeRegistry.1.0.0" -} - -Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry -{ - "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry", - "@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry", - "Id": "BiosAttributeRegistry", - "Language": "en", - "Name": "Bios Attribute Registry", - "OwningEntity": "OpenBMC", - "RegistryEntries": { - "Attributes": [ - { - "AttributeName": "attr0", - "CurrentValue": "current value", - "DefaultValue": "default value", - "DisplayName": "display name for attr0", - "HelpText": "description for attr0", - "MenuPath": "./menu/path/for/attr0", - "ReadOnly": false, - "Type": "String", - "Value": [] - } - ] - }, - "RegistryVersion": "1.0.0" -} - -https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings -{ - "@odata.id": "/redfish/v1/Systems/system/Bios/Settings", - "@odata.type": "#Bios.v1_1_0.Bios", - "AttributeRegistry": "BiosAttributeRegistry", - "Attributes": { - "QuietBoot": "0x0" - }, - "Id": "BiosSettingsV1", - "Name": "Bios Settings Version 1" -} - -2. Passed Validator check for bios resource and bios attribute registry -*** /redfish/v1/Systems/system/Bios -INFO - Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377) -INFO - PASS -*** /redfish/v1/Registries/BiosAttributeRegistry -INFO - Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438) -INFO - PASS -INFO - -*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry -INFO - Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751) -INFO - PASS - -@odata.id /redfish/v1/Systems/system/Bios odata Exists PASS -@odata.type #Settings.v1_3_0.Settings odata Exists PASS -Links [JSON Object] Bios.v1_1_0.Links Yes complex -Links.ActiveSoftwareImage Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active link to: SoftwareInventory Yes PASS -Links.SoftwareImages Array (size: 1) array of: SoftwareInventory Yes ... -Links.SoftwareImages[0] Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active SoftwareInventory Yes PASS -Links.Oem - Resource.Oem No Optional -SoftwareImages@odata.count 1 odata Exists PASS -AttributeRegistry BiosAttributeRegistry string Yes PASS -Actions [JSON Object] Bios.v1_0_0.Actions Yes complex -Actions.#Bios.ResetBios Action - Yes PASS -Actions.#Bios.ChangePassword Action - Yes PASS -Attributes [JSON Object] Bios.v1_0_0.Attributes Yes complex -Attributes.attr0 current value primitive Yes PASS -Id BIOS string Yes PASS -Description BIOS Configuration Service string Yes PASS -Name BIOS Configuration string Yes PASS -Oem - Resource.Oem No Optional -@Redfish.Settings [JSON Object] Settings.Settings Yes complex -@Redfish.Settings.MaintenanceWindowResource - link to: ItemOrCollection No Optional -@Redfish.Settings.SupportedApplyTimes - string (enum) No Optional -@Redfish.Settings.Time - date No Optional -@Redfish.Settings.ETag - string No Optional -@Redfish.Settings.SettingsObject Link: /redfish/v1/Systems/system/Bios/Settings link to: Item Yes PASS -@Redfish.Settings.Messages - Message No Optional - -@odata.id /redfish/v1/Registries/BiosAttributeRegistry odata Exists PASS -@odata.type #MessageRegistryFile.v1_1_0.MessageRegistryFile odata Exists PASS -Languages@odata.count 1 odata Exists PASS -Location@odata.count 1 odata Exists PASS -Actions - MessageRegistryFile.v1_1_0.Actions No Optional -Languages Array (size: 1) string Yes ... -Languages[0] en string Yes PASS -Registry BiosAttributeRegistry.1.0.0 string Yes PASS -Location Array (size: 1) array of: Location Yes ... -Location[0] [JSON Object] Location Yes complex -Location[0].Language en string Yes PASS -Location[0].Uri /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry string Yes PASS -Location[0].ArchiveUri - string No Optional -Location[0].PublicationUri - string No Optional -Location[0].ArchiveFile - string No Optional -Id BiosAttributeRegistry string Yes PASS -Description BiosAttributeRegistry Message Registry File Location string Yes PASS -Name BiosAttributeRegistry Message Registry File string Yes PASS -Oem - Resource.Oem No Optional - -@odata.id /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry odata Exists PASS -@odata.type #AttributeRegistry.v1_3_2.AttributeRegistry odata Exists PASS -Actions - AttributeRegistry.v1_1_0.Actions No Optional -Language en string Yes PASS -RegistryVersion 1.0.0 string Yes PASS -OwningEntity OpenBMC string Yes PASS -SupportedSystems - SupportedSystems No Optional -RegistryEntries [JSON Object] AttributeRegistry.v1_0_0.RegistryEntries Yes complex -RegistryEntries.Attributes Array (size: 1) array of: Attributes Yes ... -RegistryEntries.Attributes[0] [JSON Object] Attributes Yes complex -RegistryEntries.Attributes[0].Oem - Resource.Oem No Optional -RegistryEntries.Attributes[0].ResetRequired - boolean No Optional -RegistryEntries.Attributes[0].UefiDevicePath - string No Optional -RegistryEntries.Attributes[0].UefiKeywordName - string No Optional -RegistryEntries.Attributes[0].UefiNamespaceId - string No Optional -RegistryEntries.Attributes[0].AttributeName attr0 string Yes PASS -RegistryEntries.Attributes[0].Type String string (enum) Yes PASS -RegistryEntries.Attributes[0].Value Array (size: 0) array of: AttributeValue Yes ... -RegistryEntries.Attributes[0].DisplayName display name for attr0 string Yes PASS -RegistryEntries.Attributes[0].HelpText description for attr0 string Yes PASS -RegistryEntries.Attributes[0].WarningText - string No Optional -RegistryEntries.Attributes[0].CurrentValue current value primitive Yes PASS -RegistryEntries.Attributes[0].DefaultValue default value primitive Yes PASS -RegistryEntries.Attributes[0].DisplayOrder - number No Optional -RegistryEntries.Attributes[0].MenuPath ./menu/path/for/attr0 string Yes PASS -RegistryEntries.Attributes[0].ReadOnly False boolean Yes PASS -RegistryEntries.Attributes[0].WriteOnly - boolean No Optional -RegistryEntries.Attributes[0].GrayOut - boolean No Optional -RegistryEntries.Attributes[0].Hidden - boolean No Optional -RegistryEntries.Attributes[0].Immutable - boolean No Optional -RegistryEntries.Attributes[0].IsSystemUniqueProperty - boolean No Optional -RegistryEntries.Attributes[0].MaxLength - number No Optional -RegistryEntries.Attributes[0].MinLength - number No Optional -RegistryEntries.Attributes[0].ScalarIncrement - number No Optional -RegistryEntries.Attributes[0].UpperBound - number No Optional -RegistryEntries.Attributes[0].LowerBound - number No Optional -RegistryEntries.Attributes[0].ValueExpression - string No Optional -RegistryEntries.Menus - Menus No Optional -RegistryEntries.Dependencies - Dependencies No Optional -Id BiosAttributeRegistry string Yes PASS -Description - string No Optional -Name Bios Attribute Registry string Yes PASS -Oem - Resource.Oem No Optional - -Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 -Signed-off-by: Kuiying Wang ---- - redfish-core/include/redfish.hpp | 2 + - .../include/registries/bios_registry.hpp | 31 ++ - redfish-core/lib/bios.hpp | 503 ++++++++++++++++++ - redfish-core/lib/message_registries.hpp | 9 +- - 4 files changed, 544 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 5d5eb7b..a8e5cf2 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -157,6 +157,8 @@ class RedfishService - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - #ifdef BMCWEB_ENABLE_VM_NBDPROXY - nodes.emplace_back(std::make_unique(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 ---- /dev/null -+++ b/redfish-core/include/registries/bios_registry.hpp -@@ -0,0 +1,31 @@ -+/* -+// Copyright (c) 2020 Intel Corporation -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+*/ -+#pragma once -+ -+namespace redfish::message_registries::bios -+{ -+const Header header = { -+ "Copyright 2020 OpenBMC. All rights reserved.", -+ "#MessageRegistry.v1_4_0.MessageRegistry", -+ "BiosAttributeRegistry.1.0.0", -+ "Bios Attribute Registry", -+ "en", -+ "This registry defines the messages for bios attribute registry.", -+ "BiosAttributeRegistry", -+ "1.0.0", -+ "OpenBMC", -+}; -+} // 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 2c31077..5f8c91b 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -3,8 +3,140 @@ - #include "node.hpp" - - #include -+ - namespace redfish - { -+ -+/*baseBIOSTable -+map{attributeName,struct{attributeType,readonlyStatus,displayname, -+ description,menuPath,current,default, -+ array{struct{optionstring,optionvalue}}}} -+*/ -+using BiosBaseTableType = std::vector, std::variant, -+ std::vector< -+ std::tuple>>>>>; -+using BiosBaseTableItemType = std::pair< -+ std::string, -+ std::tuple< -+ std::string, bool, std::string, std::string, std::string, -+ std::variant, std::variant, -+ std::vector< -+ std::tuple>>>>; -+using OptionsItemType = -+ std::tuple>; -+ -+enum BiosBaseTableIndex -+{ -+ biosBaseAttrType = 0, -+ biosBaseReadonlyStatus, -+ biosBaseDisplayName, -+ biosBaseDescription, -+ biosBaseMenuPath, -+ biosBaseCurrValue, -+ biosBaseDefaultValue, -+ biosBaseOptions -+}; -+enum OptionsItemIndex -+{ -+ optItemType = 0, -+ optItemValue -+}; -+/* -+ The Pending attribute name and new value. -+ ex- { {"QuietBoot",Type.Integer, 0x1}, -+ { "DdrFreqLimit",Type.String,"2933"} -+ } -+*/ -+using PendingAttributesType = std::vector>>>; -+using PendingAttributesItemType = -+ std::pair>>; -+enum PendingAttributesIndex -+{ -+ pendingAttrType = 0, -+ pendingAttrValue -+}; -+static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) -+{ -+ std::string ret; -+ if (typeDbus == "xyz.openbmc_project.BIOSConfig.Manager." -+ "AttributeType.Enumeration") -+ { -+ ret = "Enumeration"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.String") -+ { -+ ret = "String"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Password") -+ { -+ ret = "Password"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Integer") -+ { -+ ret = "Integer"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Boolean") -+ { -+ ret = "Boolean"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} -+static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) -+{ -+ std::string ret; -+ if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement") -+ { -+ ret = "ScalarIncrement"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound") -+ { -+ ret = "LowerBound"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound") -+ { -+ ret = "UpperBound"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength") -+ { -+ ret = "MinStringLength"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength") -+ { -+ ret = "MaxStringLength"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf") -+ { -+ ret = "OneOf"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} -+ - /** - * BiosService class supports handle get method for bios. - */ -@@ -35,6 +167,377 @@ class BiosService : public Node - // 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"] = {}; -+ -+ 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") -+ { -+ 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()); -+ } -+}; -+ -+/** -+ * BiosSettings class supports handle GET/PATCH method for -+ * BIOS configuration pending settings. -+ */ -+class BiosSettings : public Node -+{ -+ public: -+ BiosSettings(App& app) : -+ Node(app, "/redfish/v1/Systems/system/Bios/Settings") -+ { -+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ } -+ -+ private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/Systems/system/Bios/Settings"; -+ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios"; -+ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1"; -+ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1"; -+ 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; -+ } -+ std::string service = getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const std::variant& -+ retPendingAttributes) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "getBiosSettings DBUS error: " -+ << ec; -+ messages::resourceNotFound(asyncResp->res, -+ "Systems/system/Bios", -+ "Settings"); -+ return; -+ } -+ const PendingAttributesType* pendingAttributes = -+ std::get_if( -+ &retPendingAttributes); -+ nlohmann::json& attributesJson = -+ asyncResp->res.jsonValue["Attributes"]; -+ if (pendingAttributes == nullptr) -+ { -+ BMCWEB_LOG_ERROR << "pendingAttributes == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const PendingAttributesItemType& item : -+ *pendingAttributes) -+ { -+ 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", -+ "PendingAttributes"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); -+ } -+}; -+/** -+ * BiosAttributeRegistry class supports handle get method for BIOS attribute -+ * registry. -+ */ -+class BiosAttributeRegistry : public Node -+{ -+ public: -+ BiosAttributeRegistry(App& app) : -+ Node(app, "/redfish/v1/Registries/BiosAttributeRegistry/" -+ "BiosAttributeRegistry") -+ { -+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ } -+ -+ private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/Registries/BiosAttributeRegistry/" -+ "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#AttributeRegistry.v1_3_2.AttributeRegistry"; -+ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry"; -+ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0"; -+ asyncResp->res.jsonValue["Language"] = "en"; -+ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC"; -+ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] = -+ nlohmann::json::array(); -+ -+ 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; -+ } -+ 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 -+ << "getBiosAttributeRegistry DBUS error: " -+ << ec; -+ messages::resourceNotFound( -+ asyncResp->res, "Registries/Bios", "Bios"); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if(&retBiosTable); -+ nlohmann::json& attributeArray = -+ asyncResp->res -+ .jsonValue["RegistryEntries"]["Attributes"]; -+ nlohmann::json optionsArray = nlohmann::json::array(); -+ if (baseBiosTable == nullptr) -+ { -+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const BiosBaseTableItemType& item : *baseBiosTable) -+ { -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR << "attrType == UNKNOWN"; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ nlohmann::json attributeItem; -+ attributeItem["AttributeName"] = item.first; -+ attributeItem["Type"] = attrType; -+ attributeItem["ReadOnly"] = -+ std::get(item.second); -+ attributeItem["DisplayName"] = -+ std::get(item.second); -+ attributeItem["HelpText"] = -+ std::get(item.second); -+ attributeItem["MenuPath"] = -+ std::get(item.second); -+ -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ const std::string* defValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributeItem["CurrentValue"] = -+ currValue != nullptr ? *currValue : ""; -+ attributeItem["DefaultValue"] = -+ defValue != nullptr ? *defValue : ""; -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = std::get_if( -+ &std::get(item.second)); -+ const int64_t* defValue = std::get_if( -+ &std::get( -+ item.second)); -+ attributeItem["CurrentValue"] = -+ currValue != nullptr ? *currValue : 0; -+ attributeItem["DefaultValue"] = -+ defValue != nullptr ? *defValue : 0; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ const std::vector& optionsVector = -+ std::get(item.second); -+ for (const OptionsItemType& optItem : optionsVector) -+ { -+ nlohmann::json optItemJson; -+ const std::string& strOptItemType = -+ std::get(optItem); -+ std::string optItemTypeRedfish = -+ mapBoundTypeToRedfish(strOptItemType); -+ if (optItemTypeRedfish == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR -+ << "optItemTypeRedfish == UNKNOWN"; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ if (optItemTypeRedfish == "OneOf") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get(optItem)); -+ optItemJson[optItemTypeRedfish] = -+ currValue != nullptr ? *currValue : ""; -+ } -+ else -+ { -+ const int64_t* currValue = -+ std::get_if( -+ &std::get(optItem)); -+ optItemJson[optItemTypeRedfish] = -+ currValue != nullptr ? *currValue : 0; -+ } -+ -+ optionsArray.push_back(optItemJson); -+ } -+ -+ attributeItem["Value"] = optionsArray; -+ attributeArray.push_back(attributeItem); -+ } -+ }, -+ 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()); - } - }; - /** -diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index 77fc10e..0caf01c 100644 ---- a/redfish-core/lib/message_registries.hpp -+++ b/redfish-core/lib/message_registries.hpp -@@ -18,6 +18,7 @@ - #include "node.hpp" - #include "registries.hpp" - #include "registries/base_message_registry.hpp" -+#include "registries/bios_registry.hpp" - #include "registries/openbmc_message_registry.hpp" - #include "registries/resource_event_message_registry.hpp" - #include "registries/task_event_message_registry.hpp" -@@ -56,11 +57,12 @@ class MessageRegistryFileCollection : public Node - {"@odata.id", "/redfish/v1/Registries"}, - {"Name", "MessageRegistryFile Collection"}, - {"Description", "Collection of MessageRegistryFiles"}, -- {"Members@odata.count", 4}, -+ {"Members@odata.count", 5}, - {"Members", - {{{"@odata.id", "/redfish/v1/Registries/Base"}}, - {{"@odata.id", "/redfish/v1/Registries/TaskEvent"}}, - {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}}, -+ {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}}, - {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}}; - - res.end(); -@@ -118,6 +120,11 @@ class MessageRegistryFile : public Node - 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( --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch deleted file mode 100644 index 6f3794478..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch +++ /dev/null @@ -1,153 +0,0 @@ -From ad2b1c83bd9cb1bb6eb86bebd1867b0172e5a7a8 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 16:50:45 +0800 -Subject: [PATCH] BaseBiosTable: Add support for PATCH operation - -This commit brings in support for PATCH operation of the -bios variables that updates the BaseBiosTable. - -Tested-By: -* Passed Redfish validator - -* Single Attribute: -PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d -'{"data":[{"AttributeName": , "AttributeType": -, "AttributeValue": }]}' - -* Multiple Attributes: -PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d -'{"data":[{"AttributeName": , "AttributeType": -, "AttributeValue": }, -{"AttributeName": , "AttributeType": -, "AttributeValue": }]}' - -This makes use of the "Set" of "PendingAttributes" in the -backend and that updates the BaseBiosTable. - -Signed-off-by: Kuiying Wang ---- - redfish-core/lib/bios.hpp | 94 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 93 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 5f8c91b..cf76fe0 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) - - return ret; - } -+static std::string mapRedfishToAttrType(const std::string_view type) -+{ -+ std::string ret; -+ if (type == "string") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"; -+ } -+ else if (type == "int") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"; -+ } -+ else if (type == "enum") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType." -+ "Enumeration"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} - static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) - { - std::string ret; -@@ -262,7 +285,9 @@ class BiosSettings : public Node - BiosSettings(App& app) : - Node(app, "/redfish/v1/Systems/system/Bios/Settings") - { -- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ entityPrivileges = { -+ {boost::beast::http::verb::get, {{"Login"}}}, -+ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}}; - } - - private: -@@ -359,6 +384,73 @@ class BiosSettings : public Node - "/xyz/openbmc_project/bios_config/manager", - std::array()); - } -+ -+ void doPatch(crow::Response& res, const crow::Request& req, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ -+ nlohmann::json inpJson; -+ -+ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson)) -+ { -+ return; -+ } -+ -+ for (auto& attrInfo : inpJson) -+ { -+ std::optional attrName; -+ std::optional attrType; -+ std::optional attrValue; -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeName", -+ attrName)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeName"); -+ return; -+ } -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeType", -+ attrType)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeType"); -+ return; -+ } -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeValue", -+ attrValue)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeValue"); -+ return; -+ } -+ std::string biosAttrType = mapRedfishToAttrType(*attrType); -+ -+ if (biosAttrType == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR << "Invalid attribute type"; -+ messages::propertyValueNotInList(asyncResp->res, -+ "AttributeType", *attrType); -+ return; -+ } -+ -+ PendingAttributesType pendingAttributes; -+ pendingAttributes.emplace_back(std::make_pair( -+ *attrName, std::make_tuple(biosAttrType, *attrValue))); -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "doPatch resp_handler got error " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ }, -+ "xyz.openbmc_project.BIOSConfigManager", -+ "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.BIOSConfig.Manager", "PendingAttributes", -+ std::variant(pendingAttributes)); -+ } -+ } - }; - /** - * BiosAttributeRegistry class supports handle get method for BIOS attribute --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch deleted file mode 100644 index 7e4e2e8d8..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch +++ /dev/null @@ -1,62 +0,0 @@ -From a78eecb032eefeb84da3ec042700a40f55ae8f10 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 22:47:56 +0800 -Subject: [PATCH] Add support to ResetBios action - -Tested: - -Bios reset flag can be modified throw redfish -POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios - -Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124 -Signed-off-by: Kuiying Wang - ---- - redfish-core/lib/bios.hpp | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index cf76fe0..7b6fc3d 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -643,7 +643,7 @@ class BiosReset : public Node - Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/") - { - entityPrivileges = { -- {boost::beast::http::verb::post, {{"ConfigureManager"}}}}; -+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; - } - - private: -@@ -655,19 +655,23 @@ class BiosReset : public Node - const std::vector&) override - { - auto asyncResp = std::make_shared(res); -- -+ 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; - } -+ BMCWEB_LOG_DEBUG << "bios reset action is done"; - }, -- "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 --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch deleted file mode 100644 index 976292197..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch +++ /dev/null @@ -1,139 +0,0 @@ -From ede8454491b554c2494a61f42993fa2e39b4d865 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 14:41:23 +0800 -Subject: [PATCH] Add support to ChangePassword action - -Tested: - -Passed Redfish validator. -Bios change password: -root@intel-obmc:~# cat /var/lib/bios-settings-manager/seedData -{ -"UserPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", -"AdminPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", -"Seed": "123456", -"HashAlgo": "SHA384" -} -POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword -{ - "NewPassword": "12345678", - "OldPassword": "1234567890", - "PasswordName": "Administrator" -} -root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData -{ - "CurrentPassword": "1234567890", - "IsAdminPwdChanged": 1, - "IsUserPwdChanged": 0, - "NewPassword": "2DD65D57EB60B1D92C5F3D2DC84724FCEE7BC02E57AA75E834712266ED94CAC704047B2FF7CEC1C36BED280B36BB5AC6", - "UserName": "Administrator" -} - -Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 -Signed-off-by: Kuiying Wang ---- - redfish-core/include/redfish.hpp | 1 + - redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++ - 2 files changed, 71 insertions(+) - -diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index a8e5cf2..dabf78e 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -160,6 +160,7 @@ class RedfishService - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); - #ifdef BMCWEB_ENABLE_VM_NBDPROXY - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 7b6fc3d..61b396b 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -186,6 +186,9 @@ class BiosService : public Node - 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"}}; - - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, -@@ -674,4 +677,71 @@ class BiosReset : public Node - std::variant(resetFlag)); - } - }; -+ -+/** -+ * BiosChangePassword class supports handle POST method for change bios -+ * password. The class retrieves and sends data directly to D-Bus. -+ */ -+class BiosChangePassword : public Node -+{ -+ public: -+ BiosChangePassword(App& app) : -+ Node(app, -+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") -+ { -+ entityPrivileges = { -+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; -+ } -+ -+ private: -+ /** -+ * Function handles POST method request. -+ * Analyzes POST body message before sends Reset request data to D-Bus. -+ */ -+ void doPost(crow::Response& res, const crow::Request& req, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ std::string currentPassword, newPassword, userName; -+ if (!json_util::readJson(req, res, "NewPassword", newPassword, -+ "OldPassword", currentPassword, "PasswordName", -+ userName)) -+ { -+ return; -+ } -+ if (currentPassword.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "OldPassword"); -+ return; -+ } -+ if (newPassword.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "NewPassword"); -+ return; -+ } -+ if (userName.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "PasswordName"); -+ return; -+ } -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_CRITICAL << "Failed in doPost(BiosChangePassword) " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ }, -+ "xyz.openbmc_project.BIOSConfigPassword", -+ "/xyz/openbmc_project/bios_config/password", -+ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword", -+ userName, currentPassword, newPassword); -+ } -+}; -+ - } // namespace redfish --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch index a9c46f487..d962d3872 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch @@ -1,4 +1,4 @@ -From a76314cd29f5cbcf19142b7120c5bf83358910fd Mon Sep 17 00:00:00 2001 +From b5e4edfc26eec245427d3435de9acaa9363ae836 Mon Sep 17 00:00:00 2001 From: Jayaprakash Mutyala Date: Mon, 28 Dec 2020 18:55:57 +0000 Subject: [PATCH] managers: add attributes for Manager.CommandShell @@ -32,26 +32,36 @@ Response: Signed-off-by: Jayaprakash Mutyala --- - redfish-core/lib/managers.hpp | 6 ++++++ - 1 file changed, 6 insertions(+) + redfish-core/lib/managers.hpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp -index 6347caf..c401ca9 100644 +index 67f8d99..dcbc347 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp -@@ -1767,6 +1767,12 @@ class Manager : public Node - res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; - res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = {"IPMI", - "SSH"}; +@@ -1830,6 +1830,13 @@ class Manager : public Node + asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; + asyncResp->res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = { + "IPMI", "SSH"}; ++ + // Fill in CommandShell info -+ res.jsonValue["CommandShell"]["ServiceEnabled"] = true; -+ res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; -+ res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {"SSH", -+ "IPMI"}; ++ asyncResp->res.jsonValue["CommandShell"]["ServiceEnabled"] = true; ++ asyncResp->res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; ++ asyncResp->res.jsonValue["CommandShell"]["ConnectTypesSupported"] = { ++ "SSH", "IPMI"}; + #ifdef BMCWEB_ENABLE_KVM // Fill in GraphicalConsole info - res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; + asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; +@@ -2272,7 +2279,7 @@ class Manager : public Node + } + + std::string uuid; +-}; ++}; // namespace redfish + + class ManagerCollection : public Node + { -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch new file mode 100644 index 000000000..5ffc259c0 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch @@ -0,0 +1,75 @@ +From aaaa117817687a05284f8bfff07e2404e0d616b7 Mon Sep 17 00:00:00 2001 +From: Radivoje Jovanovic +Date: Thu, 10 Dec 2020 13:42:20 -0800 +Subject: [PATCH] recommended fixes by crypto review team + +some curves/cyphers are forbiden to be used by +Intel crypto team. +Only enable approved ones. +the patch was created by aleksandr.v.tereschenko@intel.com + +Signed-off-by: Radivoje Jovanovic +--- + include/ssl_key_handler.hpp | 39 ++++++++++++++++++++----------------- + 1 file changed, 21 insertions(+), 18 deletions(-) + +diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp +index 39e83d7..8de7349 100644 +--- a/include/ssl_key_handler.hpp ++++ b/include/ssl_key_handler.hpp +@@ -381,31 +381,34 @@ inline std::shared_ptr + mSslContext->use_private_key_file(sslPemFile, + boost::asio::ssl::context::pem); + +- // Set up EC curves to auto (boost asio doesn't have a method for this) +- // There is a pull request to add this. Once this is included in an asio +- // drop, use the right way +- // http://stackoverflow.com/questions/18929049/boost-asio-with-ecdsa-certificate-issue +- if (SSL_CTX_set_ecdh_auto(mSslContext->native_handle(), 1) != 1) ++ std::string handshakeCurves = "P-384:P-521:X448"; ++ if (SSL_CTX_set1_groups_list(mSslContext->native_handle(), handshakeCurves.c_str()) != 1) + { +- BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n"; ++ BMCWEB_LOG_ERROR << "Error setting ECDHE group list\n"; + } + +- std::string mozillaModern = "ECDHE-ECDSA-AES256-GCM-SHA384:" +- "ECDHE-RSA-AES256-GCM-SHA384:" +- "ECDHE-ECDSA-CHACHA20-POLY1305:" +- "ECDHE-RSA-CHACHA20-POLY1305:" +- "ECDHE-ECDSA-AES128-GCM-SHA256:" +- "ECDHE-RSA-AES128-GCM-SHA256:" +- "ECDHE-ECDSA-AES256-SHA384:" +- "ECDHE-RSA-AES256-SHA384:" +- "ECDHE-ECDSA-AES128-SHA256:" +- "ECDHE-RSA-AES128-SHA256"; ++ std::string tls12Ciphers = "ECDHE-ECDSA-AES256-GCM-SHA384:" ++ "ECDHE-RSA-AES256-GCM-SHA384"; ++ std::string tls13Ciphers = "TLS_AES_256_GCM_SHA384"; + + if (SSL_CTX_set_cipher_list(mSslContext->native_handle(), +- mozillaModern.c_str()) != 1) ++ tls12Ciphers.c_str()) != 1) + { +- BMCWEB_LOG_ERROR << "Error setting cipher list\n"; ++ BMCWEB_LOG_ERROR << "Error setting TLS 1.2 cipher list\n"; + } ++ ++ if (SSL_CTX_set_ciphersuites(mSslContext->native_handle(), ++ tls13Ciphers.c_str()) != 1) ++ { ++ BMCWEB_LOG_ERROR << "Error setting TLS 1.3 cipher list\n"; ++ } ++ ++ if ((SSL_CTX_set_options(mSslContext->native_handle(), ++ SSL_OP_CIPHER_SERVER_PREFERENCE) & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) ++ { ++ BMCWEB_LOG_ERROR << "Error setting TLS server preference option\n"; ++ } ++ + return mSslContext; + } + } // namespace ensuressl +-- +2.17.1 + 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 new file mode 100644 index 000000000..b171a8b2c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch @@ -0,0 +1,98 @@ +From df571ddf0596f73c0318da3a90b9813e6df19dd9 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 + +Add messages to registry to indicate state sensor state change. + +Tested: +Build and redfish validator passes. +Logged these events and confirmed that they appear as expected on +Redfish. +GET: https:///redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180 +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180", + "@odata.type": "#LogEntry.v1_4_0.LogEntry", + "Created": "2021-02-05T12:29:40+00:00", + "EntryType": "Event", + "Id": "1612528180", + "Message": "Operational Fault Status of Card_health_1 state sensor changed from Error to Normal.", + "MessageArgs": [ + "Operational Fault Status", + "Card_health_1", + "Error", + "Normal" + ], + "MessageId": "OpenBMC.0.1.StateSensorNormal", + "Name": "System Event Log Entry", + "Severity": "OK" +} + +Signed-off-by: Arun P. Mohanan +--- + .../registries/openbmc_message_registry.hpp | 36 +++++++++++++++++-- + 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 +--- 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", + "OpenBMC", + }; +-constexpr std::array registry = { ++constexpr std::array registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -2318,6 +2318,39 @@ constexpr std::array registry = { + {}, + "None.", + }}, ++ MessageEntry{ ++ "StateSensorNormal", ++ { ++ "Indicates that a state sensor has changed state to normal.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "OK", ++ "OK", ++ 4, ++ {"string", "string", "string", "string"}, ++ "None.", ++ }}, ++ MessageEntry{ ++ "StateSensorWarning", ++ { ++ "Indicates that a state sensor has changed state to warning.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "Warning", ++ "Warning", ++ 4, ++ {"string", "string", "string", "string"}, ++ "Check sensor subsystem for errors.", ++ }}, ++ MessageEntry{ ++ "StateSensorCritical", ++ { ++ "Indicates that a state sensor has changed state to critical.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "Critical", ++ "Critical", ++ 4, ++ {"string", "string", "string", "string"}, ++ "Check sensor subsystem for errors.", ++ }}, + MessageEntry{"SystemInterfaceDisabledProvisioned", + { + "Indicates that the system interface is in the disabled " +@@ -2410,6 +2443,5 @@ constexpr std::array registry = { + {"string"}, + "None.", + }}, +- + }; + } // namespace redfish::message_registries::openbmc +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch new file mode 100644 index 000000000..bc023839f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch @@ -0,0 +1,44 @@ +From 48fe2a68d634970795f9ff13903afbedca801088 Mon Sep 17 00:00:00 2001 +From: Nidhin MS +Date: Wed, 14 Apr 2021 11:28:44 +0530 +Subject: [PATCH] Fix: bmcweb crashes if socket directory not present + +When trying to mount virtual media image bmcweb tries to create unix +socket and if the parent directory does not exist +stream_protocol::acceptor throws error and bmcweb crashes. Fix the same + +Tested: +Removed directory and mounted the vm image. bmcweb crash was not +observed + +Change-Id: I3aea1d8e197c06238f425a97435c01d3c80552a9 +Signed-off-by: Nidhin MS +--- + include/nbd_proxy.hpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp +index 7b90e90..3b28823 100644 +--- a/include/nbd_proxy.hpp ++++ b/include/nbd_proxy.hpp +@@ -397,6 +397,17 @@ inline void requestRoutes(App& app) + // If the socket file exists (i.e. after bmcweb crash), + // we cannot reuse it. + std::remove((*socketValue).c_str()); ++ std::filesystem::path socketPath(*socketValue); ++ std::error_code fsErr; ++ if (!std::filesystem::exists(socketPath.parent_path(), ++ fsErr)) ++ { ++ BMCWEB_LOG_ERROR ++ << "VirtualMedia socket directory not present. " ++ << socketPath.parent_path(); ++ conn.close("Unable to create unix socket"); ++ return; ++ } + + sessions[&conn] = std::make_shared( + conn, *socketValue, *endpointValue, +-- +2.17.1 + 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 new file mode 100644 index 000000000..d0cfd1c44 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch @@ -0,0 +1,81 @@ +From 7282ab7756cdb8c844bef9affd8a8e894828678c 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 + +For subscription event message log purpose, added message registry +entry for event service subscription related actions- add, update +and delete. + +Tested: + - Message registry entry appears in the log for the corresponding + subscription action. + +Signed-off-by: AppaRao Puli +Signed-off-by: Ayushi Smriti +--- + .../registries/openbmc_message_registry.hpp | 41 ++++++++++++++++++- + 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 +--- 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", + { +@@ -417,6 +417,45 @@ constexpr std::array registry = { + {}, + "None.", + }}, ++ MessageEntry{"EventSubscriptionAdded", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was added.", ++ "Event subscription with id %1 was added.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionRemoved", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was removed.", ++ "Event subscription with id %1 was removed.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionUpdated", ++ { ++ "Indicates that an Event subscription with specific " ++ " id was updated.", ++ "Event subscription with id %1 was updated.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, + MessageEntry{"FanInserted", + { + "Indicates that a system fan has been inserted.", +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch deleted file mode 100644 index 5ffc259c0..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch +++ /dev/null @@ -1,75 +0,0 @@ -From aaaa117817687a05284f8bfff07e2404e0d616b7 Mon Sep 17 00:00:00 2001 -From: Radivoje Jovanovic -Date: Thu, 10 Dec 2020 13:42:20 -0800 -Subject: [PATCH] recommended fixes by crypto review team - -some curves/cyphers are forbiden to be used by -Intel crypto team. -Only enable approved ones. -the patch was created by aleksandr.v.tereschenko@intel.com - -Signed-off-by: Radivoje Jovanovic ---- - include/ssl_key_handler.hpp | 39 ++++++++++++++++++++----------------- - 1 file changed, 21 insertions(+), 18 deletions(-) - -diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp -index 39e83d7..8de7349 100644 ---- a/include/ssl_key_handler.hpp -+++ b/include/ssl_key_handler.hpp -@@ -381,31 +381,34 @@ inline std::shared_ptr - mSslContext->use_private_key_file(sslPemFile, - boost::asio::ssl::context::pem); - -- // Set up EC curves to auto (boost asio doesn't have a method for this) -- // There is a pull request to add this. Once this is included in an asio -- // drop, use the right way -- // http://stackoverflow.com/questions/18929049/boost-asio-with-ecdsa-certificate-issue -- if (SSL_CTX_set_ecdh_auto(mSslContext->native_handle(), 1) != 1) -+ std::string handshakeCurves = "P-384:P-521:X448"; -+ if (SSL_CTX_set1_groups_list(mSslContext->native_handle(), handshakeCurves.c_str()) != 1) - { -- BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n"; -+ BMCWEB_LOG_ERROR << "Error setting ECDHE group list\n"; - } - -- std::string mozillaModern = "ECDHE-ECDSA-AES256-GCM-SHA384:" -- "ECDHE-RSA-AES256-GCM-SHA384:" -- "ECDHE-ECDSA-CHACHA20-POLY1305:" -- "ECDHE-RSA-CHACHA20-POLY1305:" -- "ECDHE-ECDSA-AES128-GCM-SHA256:" -- "ECDHE-RSA-AES128-GCM-SHA256:" -- "ECDHE-ECDSA-AES256-SHA384:" -- "ECDHE-RSA-AES256-SHA384:" -- "ECDHE-ECDSA-AES128-SHA256:" -- "ECDHE-RSA-AES128-SHA256"; -+ std::string tls12Ciphers = "ECDHE-ECDSA-AES256-GCM-SHA384:" -+ "ECDHE-RSA-AES256-GCM-SHA384"; -+ std::string tls13Ciphers = "TLS_AES_256_GCM_SHA384"; - - if (SSL_CTX_set_cipher_list(mSslContext->native_handle(), -- mozillaModern.c_str()) != 1) -+ tls12Ciphers.c_str()) != 1) - { -- BMCWEB_LOG_ERROR << "Error setting cipher list\n"; -+ BMCWEB_LOG_ERROR << "Error setting TLS 1.2 cipher list\n"; - } -+ -+ if (SSL_CTX_set_ciphersuites(mSslContext->native_handle(), -+ tls13Ciphers.c_str()) != 1) -+ { -+ BMCWEB_LOG_ERROR << "Error setting TLS 1.3 cipher list\n"; -+ } -+ -+ if ((SSL_CTX_set_options(mSslContext->native_handle(), -+ SSL_OP_CIPHER_SERVER_PREFERENCE) & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) -+ { -+ BMCWEB_LOG_ERROR << "Error setting TLS server preference option\n"; -+ } -+ - return mSslContext; - } - } // namespace ensuressl --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch deleted file mode 100644 index b171a8b2c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch +++ /dev/null @@ -1,98 +0,0 @@ -From df571ddf0596f73c0318da3a90b9813e6df19dd9 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 - -Add messages to registry to indicate state sensor state change. - -Tested: -Build and redfish validator passes. -Logged these events and confirmed that they appear as expected on -Redfish. -GET: https:///redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180 -{ - "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180", - "@odata.type": "#LogEntry.v1_4_0.LogEntry", - "Created": "2021-02-05T12:29:40+00:00", - "EntryType": "Event", - "Id": "1612528180", - "Message": "Operational Fault Status of Card_health_1 state sensor changed from Error to Normal.", - "MessageArgs": [ - "Operational Fault Status", - "Card_health_1", - "Error", - "Normal" - ], - "MessageId": "OpenBMC.0.1.StateSensorNormal", - "Name": "System Event Log Entry", - "Severity": "OK" -} - -Signed-off-by: Arun P. Mohanan ---- - .../registries/openbmc_message_registry.hpp | 36 +++++++++++++++++-- - 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 ---- 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", - "OpenBMC", - }; --constexpr std::array registry = { -+constexpr std::array registry = { - MessageEntry{ - "ADDDCCorrectable", - { -@@ -2318,6 +2318,39 @@ constexpr std::array registry = { - {}, - "None.", - }}, -+ MessageEntry{ -+ "StateSensorNormal", -+ { -+ "Indicates that a state sensor has changed state to normal.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "OK", -+ "OK", -+ 4, -+ {"string", "string", "string", "string"}, -+ "None.", -+ }}, -+ MessageEntry{ -+ "StateSensorWarning", -+ { -+ "Indicates that a state sensor has changed state to warning.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "Warning", -+ "Warning", -+ 4, -+ {"string", "string", "string", "string"}, -+ "Check sensor subsystem for errors.", -+ }}, -+ MessageEntry{ -+ "StateSensorCritical", -+ { -+ "Indicates that a state sensor has changed state to critical.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "Critical", -+ "Critical", -+ 4, -+ {"string", "string", "string", "string"}, -+ "Check sensor subsystem for errors.", -+ }}, - MessageEntry{"SystemInterfaceDisabledProvisioned", - { - "Indicates that the system interface is in the disabled " -@@ -2410,6 +2443,5 @@ constexpr std::array registry = { - {"string"}, - "None.", - }}, -- - }; - } // namespace redfish::message_registries::openbmc --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch deleted file mode 100644 index 3e3f69d1c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 95f002dc969d7d6d64dbf2ee0db7dc1c1c6a9173 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski -Date: Thu, 18 Mar 2021 11:30:28 +0100 -Subject: [PATCH] Revert "Disable nbd proxy from the build" - -NBD Proxy has been disabled upstream. Reenable as we use it for Virtual -Media - -This reverts commit efb8062c306474942bc94f15d748b2eb0b58fbb6. ---- - meson.build | 2 +- - meson_options.txt | 9 +-------- - 2 files changed, 2 insertions(+), 9 deletions(-) - -diff --git a/meson.build b/meson.build -index 66a066b..cef0a49 100644 ---- a/meson.build -+++ b/meson.build -@@ -81,7 +81,7 @@ feature_map = { - 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', - 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', - 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', --#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', -+'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', - 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', - } - -diff --git a/meson_options.txt b/meson_options.txt -index 9611631..7ee3ebb 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -3,14 +3,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT - option('kvm', type : 'feature',value : 'enabled', description : 'Enable the KVM host video WebSocket. Path is \'/kvm/0\'. Video is from the BMC\'s \'/dev/video\' device.') - option ('tests', type : 'feature', value : 'enabled', description : 'Enable Unit tests for bmcweb') - option('vm-websocket', type : 'feature', value : 'enabled', description : '''Enable the Virtual Media WebSocket. Path is \'/vm/0/0\'to open the websocket. See https://github.com/openbmc/jsnbd/blob/master/README.''') -- --# if you use this option and are seeing this comment, please comment here: --# https://github.com/openbmc/bmcweb/issues/188 and put forward your intentions --# for this code. At this point, no daemon has been upstreamed that implements --# this interface, so for the moment this appears to be dead code; In leiu of --# removing it, it has been disabled to try to give those that use it the --# opportunity to upstream their backend implementation --#option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') -+option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') - 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.') --- -2.26.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch deleted file mode 100644 index bc023839f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 48fe2a68d634970795f9ff13903afbedca801088 Mon Sep 17 00:00:00 2001 -From: Nidhin MS -Date: Wed, 14 Apr 2021 11:28:44 +0530 -Subject: [PATCH] Fix: bmcweb crashes if socket directory not present - -When trying to mount virtual media image bmcweb tries to create unix -socket and if the parent directory does not exist -stream_protocol::acceptor throws error and bmcweb crashes. Fix the same - -Tested: -Removed directory and mounted the vm image. bmcweb crash was not -observed - -Change-Id: I3aea1d8e197c06238f425a97435c01d3c80552a9 -Signed-off-by: Nidhin MS ---- - include/nbd_proxy.hpp | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp -index 7b90e90..3b28823 100644 ---- a/include/nbd_proxy.hpp -+++ b/include/nbd_proxy.hpp -@@ -397,6 +397,17 @@ inline void requestRoutes(App& app) - // If the socket file exists (i.e. after bmcweb crash), - // we cannot reuse it. - std::remove((*socketValue).c_str()); -+ std::filesystem::path socketPath(*socketValue); -+ std::error_code fsErr; -+ if (!std::filesystem::exists(socketPath.parent_path(), -+ fsErr)) -+ { -+ BMCWEB_LOG_ERROR -+ << "VirtualMedia socket directory not present. " -+ << socketPath.parent_path(); -+ conn.close("Unable to create unix socket"); -+ return; -+ } - - sessions[&conn] = std::make_shared( - conn, *socketValue, *endpointValue, --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch deleted file mode 100644 index f02e5e1a4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7cde56820505a4f750cc67caa0dc9300688f3fd9 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski -Date: Tue, 13 Apr 2021 15:16:43 +0200 -Subject: [PATCH] Fix comparison for proxy/legacy mode - -After sdbusplus made available string path wrapper VM code has been -updated to use it. This makes legacy mode unusable as appropriate -change introduced a problem with comparison of DBus object path, which -is now fixed. - -Tested: -After applying this fix, legacy mode has InsertMedia action enabled -again. - -Change-Id: I062994f23b77cb7ab9c4421f296a65a80b9ce896 -Signed-off-by: Przemyslaw Czarnowski ---- - redfish-core/lib/virtual_media.hpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..dda73d8 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -274,10 +274,22 @@ static void getVmData(const std::shared_ptr& aResp, - continue; - } - -+ auto mode = item.first.parent_path(); -+ auto type = mode.parent_path(); -+ if (mode.filename().empty() || type.filename().empty()) -+ { -+ continue; -+ } -+ -+ if (type.filename() != "VirtualMedia") -+ { -+ continue; -+ } -+ - aResp->res.jsonValue = vmItemTemplate(name, resName); - - // Check if dbus path is Legacy type -- if (thispath.find("VirtualMedia/Legacy") != std::string::npos) -+ if (mode.filename() == "Legacy") - { - aResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"] - ["target"] = --- -2.26.2 - 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 new file mode 100644 index 000000000..9cf4653d6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch @@ -0,0 +1,848 @@ +From 72c273ae74bb6add062b89f59ebeee4d4eb7e523 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Fri, 4 Sep 2020 19:24:25 +0800 +Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable + Attributes property + +1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry + RBC Daemon provide method to get BIOS attribute registry. +2. Eanble Attributes property for BIOS resource +3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS +settings +4. RBC daemon is at +https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/ +5. IPMI command implementation is at +https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/ +6. Property design is at +https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig +7. Design doc is at +https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md +8. There will be 95 test cases for this feature in the validation team. + +Tested: + +1. Use postman (Redfish tool) could get all the attributes in bios +resouce, get bios settings, get bios attribute +registry. +https://IP_ADDR/redfish/v1/Systems/system/Bios +{ + "@Redfish.Settings": { + "@odata.type": "#Settings.v1_3_0.Settings", + "SettingsObject": { + "@odata.id": "/redfish/v1/Systems/system/Bios/Settings" + } + }, + "@odata.id": "/redfish/v1/Systems/system/Bios", + "@odata.type": "#Bios.v1_1_0.Bios", + "Actions": { + "#Bios.ChangePassword": { + "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword" + }, + "#Bios.ResetBios": { + "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios" + } + }, + "AttributeRegistry": "BiosAttributeRegistry", + "Attributes": { + "attr0": "current value" + }, + "Description": "BIOS Configuration Service", + "Id": "BIOS", + "Links": { + "ActiveSoftwareImage": { + "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" + }, + "SoftwareImages": [ + { + "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" + } + ], + "SoftwareImages@odata.count": 1 + }, + "Name": "BIOS Configuration" +} + +Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry +{ + "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry", + "@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile", + "Description": "BiosAttributeRegistry Message Registry File Location", + "Id": "BiosAttributeRegistry", + "Languages": [ + "en" + ], + "Languages@odata.count": 1, + "Location": [ + { + "Language": "en", + "Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry" + } + ], + "Location@odata.count": 1, + "Name": "BiosAttributeRegistry Message Registry File", + "Registry": "BiosAttributeRegistry.1.0.0" +} + +Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry +{ + "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry", + "@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry", + "Id": "BiosAttributeRegistry", + "Language": "en", + "Name": "Bios Attribute Registry", + "OwningEntity": "OpenBMC", + "RegistryEntries": { + "Attributes": [ + { + "AttributeName": "attr0", + "CurrentValue": "current value", + "DefaultValue": "default value", + "DisplayName": "display name for attr0", + "HelpText": "description for attr0", + "MenuPath": "./menu/path/for/attr0", + "ReadOnly": false, + "Type": "String", + "Value": [] + } + ] + }, + "RegistryVersion": "1.0.0" +} + +https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings +{ + "@odata.id": "/redfish/v1/Systems/system/Bios/Settings", + "@odata.type": "#Bios.v1_1_0.Bios", + "AttributeRegistry": "BiosAttributeRegistry", + "Attributes": { + "QuietBoot": "0x0" + }, + "Id": "BiosSettingsV1", + "Name": "Bios Settings Version 1" +} + +2. Passed Validator check for bios resource and bios attribute registry +*** /redfish/v1/Systems/system/Bios +INFO - Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377) +INFO - PASS +*** /redfish/v1/Registries/BiosAttributeRegistry +INFO - Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438) +INFO - PASS +INFO - +*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry +INFO - Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751) +INFO - PASS + +@odata.id /redfish/v1/Systems/system/Bios odata Exists PASS +@odata.type #Settings.v1_3_0.Settings odata Exists PASS +Links [JSON Object] Bios.v1_1_0.Links Yes complex +Links.ActiveSoftwareImage Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active link to: SoftwareInventory Yes PASS +Links.SoftwareImages Array (size: 1) array of: SoftwareInventory Yes ... +Links.SoftwareImages[0] Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active SoftwareInventory Yes PASS +Links.Oem - Resource.Oem No Optional +SoftwareImages@odata.count 1 odata Exists PASS +AttributeRegistry BiosAttributeRegistry string Yes PASS +Actions [JSON Object] Bios.v1_0_0.Actions Yes complex +Actions.#Bios.ResetBios Action - Yes PASS +Actions.#Bios.ChangePassword Action - Yes PASS +Attributes [JSON Object] Bios.v1_0_0.Attributes Yes complex +Attributes.attr0 current value primitive Yes PASS +Id BIOS string Yes PASS +Description BIOS Configuration Service string Yes PASS +Name BIOS Configuration string Yes PASS +Oem - Resource.Oem No Optional +@Redfish.Settings [JSON Object] Settings.Settings Yes complex +@Redfish.Settings.MaintenanceWindowResource - link to: ItemOrCollection No Optional +@Redfish.Settings.SupportedApplyTimes - string (enum) No Optional +@Redfish.Settings.Time - date No Optional +@Redfish.Settings.ETag - string No Optional +@Redfish.Settings.SettingsObject Link: /redfish/v1/Systems/system/Bios/Settings link to: Item Yes PASS +@Redfish.Settings.Messages - Message No Optional + +@odata.id /redfish/v1/Registries/BiosAttributeRegistry odata Exists PASS +@odata.type #MessageRegistryFile.v1_1_0.MessageRegistryFile odata Exists PASS +Languages@odata.count 1 odata Exists PASS +Location@odata.count 1 odata Exists PASS +Actions - MessageRegistryFile.v1_1_0.Actions No Optional +Languages Array (size: 1) string Yes ... +Languages[0] en string Yes PASS +Registry BiosAttributeRegistry.1.0.0 string Yes PASS +Location Array (size: 1) array of: Location Yes ... +Location[0] [JSON Object] Location Yes complex +Location[0].Language en string Yes PASS +Location[0].Uri /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry string Yes PASS +Location[0].ArchiveUri - string No Optional +Location[0].PublicationUri - string No Optional +Location[0].ArchiveFile - string No Optional +Id BiosAttributeRegistry string Yes PASS +Description BiosAttributeRegistry Message Registry File Location string Yes PASS +Name BiosAttributeRegistry Message Registry File string Yes PASS +Oem - Resource.Oem No Optional + +@odata.id /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry odata Exists PASS +@odata.type #AttributeRegistry.v1_3_2.AttributeRegistry odata Exists PASS +Actions - AttributeRegistry.v1_1_0.Actions No Optional +Language en string Yes PASS +RegistryVersion 1.0.0 string Yes PASS +OwningEntity OpenBMC string Yes PASS +SupportedSystems - SupportedSystems No Optional +RegistryEntries [JSON Object] AttributeRegistry.v1_0_0.RegistryEntries Yes complex +RegistryEntries.Attributes Array (size: 1) array of: Attributes Yes ... +RegistryEntries.Attributes[0] [JSON Object] Attributes Yes complex +RegistryEntries.Attributes[0].Oem - Resource.Oem No Optional +RegistryEntries.Attributes[0].ResetRequired - boolean No Optional +RegistryEntries.Attributes[0].UefiDevicePath - string No Optional +RegistryEntries.Attributes[0].UefiKeywordName - string No Optional +RegistryEntries.Attributes[0].UefiNamespaceId - string No Optional +RegistryEntries.Attributes[0].AttributeName attr0 string Yes PASS +RegistryEntries.Attributes[0].Type String string (enum) Yes PASS +RegistryEntries.Attributes[0].Value Array (size: 0) array of: AttributeValue Yes ... +RegistryEntries.Attributes[0].DisplayName display name for attr0 string Yes PASS +RegistryEntries.Attributes[0].HelpText description for attr0 string Yes PASS +RegistryEntries.Attributes[0].WarningText - string No Optional +RegistryEntries.Attributes[0].CurrentValue current value primitive Yes PASS +RegistryEntries.Attributes[0].DefaultValue default value primitive Yes PASS +RegistryEntries.Attributes[0].DisplayOrder - number No Optional +RegistryEntries.Attributes[0].MenuPath ./menu/path/for/attr0 string Yes PASS +RegistryEntries.Attributes[0].ReadOnly False boolean Yes PASS +RegistryEntries.Attributes[0].WriteOnly - boolean No Optional +RegistryEntries.Attributes[0].GrayOut - boolean No Optional +RegistryEntries.Attributes[0].Hidden - boolean No Optional +RegistryEntries.Attributes[0].Immutable - boolean No Optional +RegistryEntries.Attributes[0].IsSystemUniqueProperty - boolean No Optional +RegistryEntries.Attributes[0].MaxLength - number No Optional +RegistryEntries.Attributes[0].MinLength - number No Optional +RegistryEntries.Attributes[0].ScalarIncrement - number No Optional +RegistryEntries.Attributes[0].UpperBound - number No Optional +RegistryEntries.Attributes[0].LowerBound - number No Optional +RegistryEntries.Attributes[0].ValueExpression - string No Optional +RegistryEntries.Menus - Menus No Optional +RegistryEntries.Dependencies - Dependencies No Optional +Id BiosAttributeRegistry string Yes PASS +Description - string No Optional +Name Bios Attribute Registry string Yes PASS +Oem - Resource.Oem No Optional + +Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 +Signed-off-by: Kuiying Wang +--- + redfish-core/include/redfish.hpp | 2 + + .../include/registries/bios_registry.hpp | 31 ++ + redfish-core/lib/bios.hpp | 501 ++++++++++++++++++ + redfish-core/lib/message_registries.hpp | 9 +- + 4 files changed, 542 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 db58d60..298ebb8 100644 +--- a/redfish-core/include/redfish.hpp ++++ b/redfish-core/include/redfish.hpp +@@ -156,6 +156,8 @@ class RedfishService + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + #ifdef BMCWEB_ENABLE_VM_NBDPROXY + nodes.emplace_back(std::make_unique(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 +--- /dev/null ++++ b/redfish-core/include/registries/bios_registry.hpp +@@ -0,0 +1,31 @@ ++/* ++// Copyright (c) 2020 Intel Corporation ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++*/ ++#pragma once ++ ++namespace redfish::message_registries::bios ++{ ++const Header header = { ++ "Copyright 2020 OpenBMC. All rights reserved.", ++ "#MessageRegistry.v1_4_0.MessageRegistry", ++ "BiosAttributeRegistry.1.0.0", ++ "Bios Attribute Registry", ++ "en", ++ "This registry defines the messages for bios attribute registry.", ++ "BiosAttributeRegistry", ++ "1.0.0", ++ "OpenBMC", ++}; ++} // 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 0917cc7..cb2b74d 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -3,8 +3,140 @@ + #include "node.hpp" + + #include ++ + namespace redfish + { ++ ++/*baseBIOSTable ++map{attributeName,struct{attributeType,readonlyStatus,displayname, ++ description,menuPath,current,default, ++ array{struct{optionstring,optionvalue}}}} ++*/ ++using BiosBaseTableType = std::vector, std::variant, ++ std::vector< ++ std::tuple>>>>>; ++using BiosBaseTableItemType = std::pair< ++ std::string, ++ std::tuple< ++ std::string, bool, std::string, std::string, std::string, ++ std::variant, std::variant, ++ std::vector< ++ std::tuple>>>>; ++using OptionsItemType = ++ std::tuple>; ++ ++enum BiosBaseTableIndex ++{ ++ biosBaseAttrType = 0, ++ biosBaseReadonlyStatus, ++ biosBaseDisplayName, ++ biosBaseDescription, ++ biosBaseMenuPath, ++ biosBaseCurrValue, ++ biosBaseDefaultValue, ++ biosBaseOptions ++}; ++enum OptionsItemIndex ++{ ++ optItemType = 0, ++ optItemValue ++}; ++/* ++ The Pending attribute name and new value. ++ ex- { {"QuietBoot",Type.Integer, 0x1}, ++ { "DdrFreqLimit",Type.String,"2933"} ++ } ++*/ ++using PendingAttributesType = std::vector>>>; ++using PendingAttributesItemType = ++ std::pair>>; ++enum PendingAttributesIndex ++{ ++ pendingAttrType = 0, ++ pendingAttrValue ++}; ++static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) ++{ ++ std::string ret; ++ if (typeDbus == "xyz.openbmc_project.BIOSConfig.Manager." ++ "AttributeType.Enumeration") ++ { ++ ret = "Enumeration"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.String") ++ { ++ ret = "String"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Password") ++ { ++ ret = "Password"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Integer") ++ { ++ ret = "Integer"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Boolean") ++ { ++ ret = "Boolean"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} ++static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) ++{ ++ std::string ret; ++ if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement") ++ { ++ ret = "ScalarIncrement"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound") ++ { ++ ret = "LowerBound"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound") ++ { ++ ret = "UpperBound"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength") ++ { ++ ret = "MinStringLength"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength") ++ { ++ ret = "MaxStringLength"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf") ++ { ++ ret = "OneOf"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} ++ + /** + * BiosService class supports handle get method for bios. + */ +@@ -33,6 +165,375 @@ class BiosService : public Node + // 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"] = {}; ++ ++ 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") ++ { ++ 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()); ++ } ++}; ++ ++/** ++ * BiosSettings class supports handle GET/PATCH method for ++ * BIOS configuration pending settings. ++ */ ++class BiosSettings : public Node ++{ ++ public: ++ BiosSettings(App& app) : ++ Node(app, "/redfish/v1/Systems/system/Bios/Settings") ++ { ++ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ } ++ ++ private: ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override ++ { ++ asyncResp->res.jsonValue["@odata.id"] = ++ "/redfish/v1/Systems/system/Bios/Settings"; ++ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios"; ++ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1"; ++ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1"; ++ 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; ++ } ++ std::string service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const std::variant& ++ retPendingAttributes) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosSettings DBUS error: " ++ << ec; ++ messages::resourceNotFound(asyncResp->res, ++ "Systems/system/Bios", ++ "Settings"); ++ return; ++ } ++ const PendingAttributesType* pendingAttributes = ++ std::get_if( ++ &retPendingAttributes); ++ nlohmann::json& attributesJson = ++ asyncResp->res.jsonValue["Attributes"]; ++ if (pendingAttributes == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "pendingAttributes == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const PendingAttributesItemType& item : ++ *pendingAttributes) ++ { ++ 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", ++ "PendingAttributes"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); ++ } ++}; ++/** ++ * BiosAttributeRegistry class supports handle get method for BIOS attribute ++ * registry. ++ */ ++class BiosAttributeRegistry : public Node ++{ ++ public: ++ BiosAttributeRegistry(App& app) : ++ Node(app, "/redfish/v1/Registries/BiosAttributeRegistry/" ++ "BiosAttributeRegistry") ++ { ++ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ } ++ ++ private: ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override ++ { ++ asyncResp->res.jsonValue["@odata.id"] = ++ "/redfish/v1/Registries/BiosAttributeRegistry/" ++ "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["@odata.type"] = ++ "#AttributeRegistry.v1_3_2.AttributeRegistry"; ++ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry"; ++ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0"; ++ asyncResp->res.jsonValue["Language"] = "en"; ++ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC"; ++ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] = ++ nlohmann::json::array(); ++ ++ 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; ++ } ++ 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 ++ << "getBiosAttributeRegistry DBUS error: " ++ << ec; ++ messages::resourceNotFound( ++ asyncResp->res, "Registries/Bios", "Bios"); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if(&retBiosTable); ++ nlohmann::json& attributeArray = ++ asyncResp->res ++ .jsonValue["RegistryEntries"]["Attributes"]; ++ nlohmann::json optionsArray = nlohmann::json::array(); ++ if (baseBiosTable == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const BiosBaseTableItemType& item : *baseBiosTable) ++ { ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = ++ mapAttrTypeToRedfish(itemType); ++ if (attrType == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR << "attrType == UNKNOWN"; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ nlohmann::json attributeItem; ++ attributeItem["AttributeName"] = item.first; ++ attributeItem["Type"] = attrType; ++ attributeItem["ReadOnly"] = ++ std::get(item.second); ++ attributeItem["DisplayName"] = ++ std::get(item.second); ++ attributeItem["HelpText"] = ++ std::get(item.second); ++ attributeItem["MenuPath"] = ++ std::get(item.second); ++ ++ if (attrType == "String") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ const std::string* defValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ attributeItem["CurrentValue"] = ++ currValue != nullptr ? *currValue : ""; ++ attributeItem["DefaultValue"] = ++ defValue != nullptr ? *defValue : ""; ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ const int64_t* defValue = std::get_if( ++ &std::get( ++ item.second)); ++ attributeItem["CurrentValue"] = ++ currValue != nullptr ? *currValue : 0; ++ attributeItem["DefaultValue"] = ++ defValue != nullptr ? *defValue : 0; ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "Unsupported attribute type."; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ const std::vector& optionsVector = ++ std::get(item.second); ++ for (const OptionsItemType& optItem : optionsVector) ++ { ++ nlohmann::json optItemJson; ++ const std::string& strOptItemType = ++ std::get(optItem); ++ std::string optItemTypeRedfish = ++ mapBoundTypeToRedfish(strOptItemType); ++ if (optItemTypeRedfish == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR ++ << "optItemTypeRedfish == UNKNOWN"; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ if (optItemTypeRedfish == "OneOf") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get(optItem)); ++ optItemJson[optItemTypeRedfish] = ++ currValue != nullptr ? *currValue : ""; ++ } ++ else ++ { ++ const int64_t* currValue = ++ std::get_if( ++ &std::get(optItem)); ++ optItemJson[optItemTypeRedfish] = ++ currValue != nullptr ? *currValue : 0; ++ } ++ ++ optionsArray.push_back(optItemJson); ++ } ++ ++ attributeItem["Value"] = optionsArray; ++ attributeArray.push_back(attributeItem); ++ } ++ }, ++ 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()); + } + }; + /** +diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp +index 455bf70..7afbfc2 100644 +--- a/redfish-core/lib/message_registries.hpp ++++ b/redfish-core/lib/message_registries.hpp +@@ -18,6 +18,7 @@ + #include "node.hpp" + #include "registries.hpp" + #include "registries/base_message_registry.hpp" ++#include "registries/bios_registry.hpp" + #include "registries/openbmc_message_registry.hpp" + #include "registries/resource_event_message_registry.hpp" + #include "registries/task_event_message_registry.hpp" +@@ -56,11 +57,12 @@ class MessageRegistryFileCollection : public Node + {"@odata.id", "/redfish/v1/Registries"}, + {"Name", "MessageRegistryFile Collection"}, + {"Description", "Collection of MessageRegistryFiles"}, +- {"Members@odata.count", 4}, ++ {"Members@odata.count", 5}, + {"Members", + {{{"@odata.id", "/redfish/v1/Registries/Base"}}, + {{"@odata.id", "/redfish/v1/Registries/TaskEvent"}}, + {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}}, ++ {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}}, + {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}}; + } + }; +@@ -116,6 +118,11 @@ class MessageRegistryFile : public Node + 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( +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch new file mode 100644 index 000000000..21a21e8db --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch @@ -0,0 +1,152 @@ +From 9c498d683be59ce25dd0124ba7ec5e026c59bbbf Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 16:50:45 +0800 +Subject: [PATCH] BaseBiosTable: Add support for PATCH operation + +This commit brings in support for PATCH operation of the +bios variables that updates the BaseBiosTable. + +Tested-By: +* Passed Redfish validator + +* Single Attribute: +PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d +'{"data":[{"AttributeName": , "AttributeType": +, "AttributeValue": }]}' + +* Multiple Attributes: +PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d +'{"data":[{"AttributeName": , "AttributeType": +, "AttributeValue": }, +{"AttributeName": , "AttributeType": +, "AttributeValue": }]}' + +This makes use of the "Set" of "PendingAttributes" in the +backend and that updates the BaseBiosTable. + +Signed-off-by: Kuiying Wang +--- + redfish-core/lib/bios.hpp | 93 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 92 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index cb2b74d..860a643 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) + + return ret; + } ++static std::string mapRedfishToAttrType(const std::string_view type) ++{ ++ std::string ret; ++ if (type == "string") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"; ++ } ++ else if (type == "int") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"; ++ } ++ else if (type == "enum") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType." ++ "Enumeration"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} + static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) + { + std::string ret; +@@ -260,7 +283,9 @@ class BiosSettings : public Node + BiosSettings(App& app) : + Node(app, "/redfish/v1/Systems/system/Bios/Settings") + { +- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ entityPrivileges = { ++ {boost::beast::http::verb::get, {{"Login"}}}, ++ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}}; + } + + private: +@@ -356,6 +381,72 @@ class BiosSettings : public Node + "/xyz/openbmc_project/bios_config/manager", + std::array()); + } ++ ++ void doPatch(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector&) override ++ { ++ nlohmann::json inpJson; ++ ++ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson)) ++ { ++ return; ++ } ++ ++ for (auto& attrInfo : inpJson) ++ { ++ std::optional attrName; ++ std::optional attrType; ++ std::optional attrValue; ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeName", ++ attrName)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeName"); ++ return; ++ } ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeType", ++ attrType)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeType"); ++ return; ++ } ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeValue", ++ attrValue)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeValue"); ++ return; ++ } ++ std::string biosAttrType = mapRedfishToAttrType(*attrType); ++ ++ if (biosAttrType == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR << "Invalid attribute type"; ++ messages::propertyValueNotInList(asyncResp->res, ++ "AttributeType", *attrType); ++ return; ++ } ++ ++ PendingAttributesType pendingAttributes; ++ pendingAttributes.emplace_back(std::make_pair( ++ *attrName, std::make_tuple(biosAttrType, *attrValue))); ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "doPatch resp_handler got error " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.BIOSConfigManager", ++ "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.BIOSConfig.Manager", "PendingAttributes", ++ std::variant(pendingAttributes)); ++ } ++ } + }; + /** + * BiosAttributeRegistry class supports handle get method for BIOS attribute +-- +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 new file mode 100644 index 000000000..5a24996a0 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch @@ -0,0 +1,61 @@ +From 4e85ce8a5f34038c289504855d21ebfa3d6b94f0 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 22:47:56 +0800 +Subject: [PATCH] Add support to ResetBios action + +Tested: + +Bios reset flag can be modified throw redfish +POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios + +Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124 +Signed-off-by: Kuiying Wang +--- + redfish-core/lib/bios.hpp | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 860a643..1eb7bef 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -638,7 +638,7 @@ class BiosReset : public Node + Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/") + { + entityPrivileges = { +- {boost::beast::http::verb::post, {{"ConfigureManager"}}}}; ++ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; + } + + private: +@@ -649,19 +649,24 @@ class BiosReset : public Node + void doPost(const std::shared_ptr& asyncResp, + const crow::Request&, const std::vector&) override + { ++ 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; + } ++ BMCWEB_LOG_DEBUG << "bios reset action is done"; + }, +- "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 +-- +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 new file mode 100644 index 000000000..e87995aca --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch @@ -0,0 +1,139 @@ +From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 14:41:23 +0800 +Subject: [PATCH] Add support to ChangePassword action + +Tested: + +Passed Redfish validator. +Bios change password: +root@intel-obmc:~# cat /var/lib/bios-settings-manager/seedData +{ +"UserPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", +"AdminPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", +"Seed": "123456", +"HashAlgo": "SHA384" +} +POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword +{ + "NewPassword": "12345678", + "OldPassword": "1234567890", + "PasswordName": "Administrator" +} +root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData +{ + "CurrentPassword": "1234567890", + "IsAdminPwdChanged": 1, + "IsUserPwdChanged": 0, + "NewPassword": "2DD65D57EB60B1D92C5F3D2DC84724FCEE7BC02E57AA75E834712266ED94CAC704047B2FF7CEC1C36BED280B36BB5AC6", + "UserName": "Administrator" +} + +Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 +Signed-off-by: Kuiying Wang +--- + redfish-core/include/redfish.hpp | 1 + + redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++ + 2 files changed, 71 insertions(+) + +diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp +index 298ebb8..4418c3d 100644 +--- a/redfish-core/include/redfish.hpp ++++ b/redfish-core/include/redfish.hpp +@@ -159,6 +159,7 @@ class RedfishService + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); + #ifdef BMCWEB_ENABLE_VM_NBDPROXY + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 1eb7bef..12ec472 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -184,6 +184,9 @@ class BiosService : public Node + 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"}}; + + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, +@@ -669,4 +672,71 @@ class BiosReset : public Node + std::variant(resetFlag)); + } + }; ++ ++/** ++ * BiosChangePassword class supports handle POST method for change bios ++ * password. The class retrieves and sends data directly to D-Bus. ++ */ ++class BiosChangePassword : public Node ++{ ++ public: ++ BiosChangePassword(App& app) : ++ Node(app, ++ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") ++ { ++ entityPrivileges = { ++ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; ++ } ++ ++ private: ++ /** ++ * Function handles POST method request. ++ * Analyzes POST body message before sends Reset request data to D-Bus. ++ */ ++ void doPost(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector&) override ++ { ++ std::string currentPassword, newPassword, userName; ++ if (!json_util::readJson(req, asyncResp->res, "NewPassword", ++ newPassword, "OldPassword", currentPassword, ++ "PasswordName", userName)) ++ { ++ return; ++ } ++ if (currentPassword.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "OldPassword"); ++ return; ++ } ++ if (newPassword.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "NewPassword"); ++ return; ++ } ++ if (userName.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "PasswordName"); ++ return; ++ } ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_CRITICAL ++ << "Failed in doPost(BiosChangePassword) " << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.BIOSConfigPassword", ++ "/xyz/openbmc_project/bios_config/password", ++ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword", ++ userName, currentPassword, newPassword); ++ } ++}; ++ + } // namespace redfish +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch new file mode 100644 index 000000000..75a78abb4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch @@ -0,0 +1,44 @@ +From fedcdb7887b4d934ee763d75f7988825300c5cef Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti +Date: Thu, 6 May 2021 11:56:38 +0530 +Subject: [PATCH] Fix:remove bios user pwd change option via Redfish + +BMC should not provide user bios setup password change option via +Redfish as per bios security requirements. Only Admin BIOS setup +password is supported. + +Added check for the password name action parameter and +do not allow if it has User Password value from redfish side. + +Tested: sent POST query in redfish on URI: +https:///redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword +error occurs for UserPassword parameter and allows for AdminPassword. + +Signed-off-by: Ayushi Smriti +--- + redfish-core/lib/bios.hpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 12ec472..0416934 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -722,6 +722,15 @@ class BiosChangePassword : public Node + "PasswordName"); + return; + } ++ ++ // In Intel BIOS, we are not supporting user password in BIOS setup ++ if (userName == "UserPassword") ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "PasswordName"); ++ return; ++ } ++ + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) +-- +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 index b46d30149..bda893a81 100644 --- 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 @@ -1,7 +1,7 @@ -From ae55e89c14ea5abef0895409c956f5f4c38f330f Mon Sep 17 00:00:00 2001 +From 3d6c3b3e91c04ff8f10bff49bcf2a7d7206c53df Mon Sep 17 00:00:00 2001 From: Sunitha Harish Date: Fri, 19 Feb 2021 13:38:31 +0530 -Subject: [PATCH 1/2] EventService : Fix retry handling for http-client +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 @@ -23,17 +23,22 @@ Tested by: - 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 | 289 ++++++++++-------- + http/http_client.hpp | 288 ++++++++++-------- .../include/event_service_manager.hpp | 2 +- - 2 files changed, 163 insertions(+), 128 deletions(-) + 2 files changed, 162 insertions(+), 128 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index 992ac2b..d116f6d 100644 +index 992ac2b..feabbba 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -34,22 +34,28 @@ namespace crow @@ -67,7 +72,7 @@ index 992ac2b..d116f6d 100644 }; class HttpClient : public std::enable_shared_from_this -@@ -58,11 +64,14 @@ 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; @@ -80,13 +85,12 @@ index 992ac2b..d116f6d 100644 + std::optional< + boost::beast::http::response_parser> + parser; -+ boost::asio::ip::tcp::endpoint endpoint; + boost::circular_buffer_space_optimized requestDataQueue{}; + std::vector endPoints; ConnState state; std::string subId; std::string host; -@@ -76,12 +85,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this void doResolve() { @@ -99,7 +103,7 @@ index 992ac2b..d116f6d 100644 BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; auto respHandler = -@@ -89,78 +93,56 @@ class HttpClient : public std::enable_shared_from_this +@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this const boost::beast::error_code ec, const std::vector& endpointList) { @@ -191,7 +195,7 @@ index 992ac2b..d116f6d 100644 // Send the HTTP request to the remote host boost::beast::http::async_write( conn, req, -@@ -171,7 +153,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); self->state = ConnState::sendFailed; @@ -200,7 +204,7 @@ index 992ac2b..d116f6d 100644 return; } BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -@@ -184,9 +166,18 @@ class HttpClient : public std::enable_shared_from_this +@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this void recvMessage() { @@ -208,8 +212,7 @@ index 992ac2b..d116f6d 100644 + + parser.emplace(std::piecewise_construct, std::make_tuple()); + parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response body parsing. ++ + // Check only for the response header + parser->skip(true); + @@ -220,7 +223,7 @@ index 992ac2b..d116f6d 100644 [self(shared_from_this())](const boost::beast::error_code& ec, const std::size_t& bytesTransferred) { if (ec) -@@ -194,30 +185,46 @@ class HttpClient : public std::enable_shared_from_this +@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); self->state = ConnState::recvFailed; @@ -257,7 +260,8 @@ index 992ac2b..d116f6d 100644 + // enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); @@ -275,7 +279,7 @@ index 992ac2b..d116f6d 100644 // not_connected happens sometimes so don't bother reporting it. if (ec && ec != boost::beast::errc::not_connected) { -@@ -225,112 +232,139 @@ class HttpClient : public std::enable_shared_from_this +@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this return; } BMCWEB_LOG_DEBUG << "Connection closed gracefully"; @@ -369,7 +373,7 @@ index 992ac2b..d116f6d 100644 - retryCount = 0; - connStateCheck(); + runningTimer = true; - ++ + retryCount++; + + BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs @@ -384,7 +388,7 @@ index 992ac2b..d116f6d 100644 + // sending the event as per the retry policy + } + self->runningTimer = false; -+ + + // Lets close connection and start from resolve. + self->doClose(); + }); @@ -469,7 +473,7 @@ index 992ac2b..d116f6d 100644 } } -@@ -339,37 +373,38 @@ class HttpClient : public std::enable_shared_from_this +@@ -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), @@ -526,10 +530,10 @@ index 992ac2b..d116f6d 100644 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 148c703..bffa68f 100644 +index fa4e41a..c999121 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -412,7 +412,7 @@ class Subscription +@@ -423,7 +423,7 @@ class Subscription reqHeaders.emplace_back(std::pair(key, val)); } } 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 b1f61c6fd..7cbb406a5 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,7 +1,7 @@ -From 579fda953ec991b4e7f9d7194b08f6aa103fa0ec Mon Sep 17 00:00:00 2001 +From 5f19e5c8ebc5cb0ce331e4ef841526995b6bdb2e Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Mon, 22 Feb 2021 17:07:47 +0000 -Subject: [PATCH 2/2] EventService: https client support +Subject: [PATCH] EventService: https client support Add https client support for push style eventing. Using this BMC can push the event @@ -17,12 +17,12 @@ Tested: Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli --- - http/http_client.hpp | 255 ++++++++++++------ + http/http_client.hpp | 257 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 175 insertions(+), 82 deletions(-) + 2 files changed, 176 insertions(+), 83 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index d116f6d..cebc857 100644 +index feabbba..aaf1b2d 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -52,7 +52,7 @@ index d116f6d..cebc857 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer buffer; boost::beast::http::request req; -@@ -112,23 +117,52 @@ class HttpClient : public std::enable_shared_from_this +@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this void doConnect() { state = ConnState::connectInProgress; @@ -113,7 +113,7 @@ index d116f6d..cebc857 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -136,106 +170,159 @@ class HttpClient : public std::enable_shared_from_this +@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this void sendMessage(const std::string& data) { @@ -207,15 +207,15 @@ index d116f6d..cebc857 100644 + // Abort the connection since server is not keep-alive enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); + }; parser.emplace(std::piecewise_construct, std::make_tuple()); parser->body_limit(httpReadBodyLimit); - // Since these are all push style eventing, we are not - // bothered about response body parsing. + // Check only for the response header parser->skip(true); + conn.expires_after(std::chrono::seconds(30)); @@ -296,7 +296,8 @@ index d116f6d..cebc857 100644 + self->state = ConnState::closed; + self->handleConnState(); } -- // Transfer ownership of the response +- +- // Returns ownership of the parsed message - self->parser->release(); - - self->handleConnState(); @@ -344,7 +345,7 @@ index d116f6d..cebc857 100644 } } -@@ -302,6 +389,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -352,7 +353,7 @@ index d116f6d..cebc857 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -333,6 +421,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -360,7 +361,7 @@ index d116f6d..cebc857 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -371,7 +460,8 @@ class HttpClient : public std::enable_shared_from_this +@@ -370,7 +459,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, @@ -370,7 +371,7 @@ index d116f6d..cebc857 100644 conn(ioc), timer(ioc), req(boost::beast::http::verb::post, destUri, 11), state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -384,8 +474,11 @@ class HttpClient : public std::enable_shared_from_this +@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -384,10 +385,10 @@ index d116f6d..cebc857 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 bffa68f..1e6f496 100644 +index c999121..267c857 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription +@@ -398,7 +398,7 @@ class Subscription { conn = std::make_shared( crow::connections::systemBus->get_io_context(), id, host, port, 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 0d31fbc72..cd59ed94d 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,7 +1,7 @@ -From e93a6a02b0fba3371144d474422fadacc3f25fde Mon Sep 17 00:00:00 2001 +From 0c531d959364192697290c1489d5f7b1bdd7a665 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Fri, 12 Mar 2021 18:53:25 +0000 -Subject: [PATCH 4/6] Add Server-Sent-Events support +Subject: [PATCH] Add Server-Sent-Events support Server-Sent Events is a standard describing how servers can initiate data transmission towards clients once an initial @@ -24,13 +24,13 @@ Signed-off-by: AppaRao Puli --- http/http_connection.hpp | 14 +- http/http_response.hpp | 7 +- - http/routing.hpp | 70 ++++++++++ + http/routing.hpp | 71 ++++++++++ http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 364 insertions(+), 6 deletions(-) + 4 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 4482f8d..2c8bf40 100644 +index 6172b3a..fc9fc60 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -326,7 +326,7 @@ class Connection : @@ -63,7 +63,7 @@ index 4482f8d..2c8bf40 100644 // delete lambda with self shared_ptr // to enable connection destruction diff --git a/http/http_response.hpp b/http/http_response.hpp -index cd00ec8..ffd6dda 100644 +index 7965704..29c56e1 100644 --- a/http/http_response.hpp +++ b/http/http_response.hpp @@ -13,10 +13,15 @@ namespace crow @@ -93,7 +93,7 @@ index cd00ec8..ffd6dda 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 65c7b70..0824939 100644 +index dd07523..7ddc6b0 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -6,6 +6,7 @@ @@ -104,7 +104,7 @@ index 65c7b70..0824939 100644 #include "sessions.hpp" #include "utility.hpp" #include "websocket.hpp" -@@ -390,6 +391,67 @@ class WebSocketRule : public BaseRule +@@ -398,6 +399,68 @@ class WebSocketRule : public BaseRule std::function errorHandler; }; @@ -119,10 +119,11 @@ index 65c7b70..0824939 100644 + void validate() override + {} + -+ void handle(const Request&, Response& res, const RoutingParams&) override ++ void handle(const Request&, ++ const std::shared_ptr& asyncResp, ++ const RoutingParams&) override + { -+ res.result(boost::beast::http::status::not_found); -+ res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + } + + void handleUpgrade(const Request& req, Response&, @@ -172,7 +173,7 @@ index 65c7b70..0824939 100644 template struct RuleParameterTraits { -@@ -402,6 +464,14 @@ struct RuleParameterTraits +@@ -410,6 +473,14 @@ struct RuleParameterTraits return *p; } 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 02d28833f..37609c154 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,7 +1,7 @@ -From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 Mon Sep 17 00:00:00 2001 +From bcb80fc9a86555c74b56b5b37615601d3fbfae31 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 16 Mar 2021 15:37:24 +0000 -Subject: [PATCH 5/6] Add SSE style subscription support to eventservice +Subject: [PATCH] Add SSE style subscription support to eventservice This commit adds the SSE style eventservice subscription style event. Using this, end user can subscribe for @@ -23,16 +23,16 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 77 ++++- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 291 ------------------ redfish-core/lib/event_service.hpp | 4 +- src/webserver_main.cpp | 2 + - 6 files changed, 149 insertions(+), 302 deletions(-) + 6 files changed, 163 insertions(+), 320 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 2c8bf40..1ab776c 100644 +index fc9fc60..3afb4da 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -350,7 +350,7 @@ class Connection : @@ -126,7 +126,7 @@ index 0000000..6c98e6e +} // namespace eventservice_sse +} // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 5821e2e..f4d57c2 100644 +index fa4e41a..ac644c1 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -23,13 +23,15 @@ @@ -146,7 +146,7 @@ index 5821e2e..f4d57c2 100644 #include #include #include -@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple; +@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple; static constexpr const char* eventFormatType = "Event"; static constexpr const char* metricReportFormatType = "MetricReport"; @@ -157,11 +157,50 @@ index 5821e2e..f4d57c2 100644 +static constexpr const uint8_t maxNoOfSubscriptions = 20; +static constexpr const uint8_t maxNoOfSSESubscriptions = 10; + - #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - static std::optional inotifyConn; - static constexpr const char* redfishEventLogDir = "/var/log"; -@@ -391,11 +397,9 @@ class Subscription - path, uriProto); ++#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES ++static std::optional inotifyConn; ++static constexpr const char* redfishEventLogDir = "/var/log"; ++static constexpr const char* redfishEventLogFile = "/var/log/redfish"; ++static constexpr const size_t iEventSize = sizeof(inotify_event); ++static int inotifyFd = -1; ++static int dirWatchDesc = -1; ++static int fileWatchDesc = -1; ++ ++// ++using EventLogObjectsType = ++ std::tuple>; ++ + namespace message_registries + { + inline boost::beast::span +@@ -68,24 +88,6 @@ inline boost::beast::span + } + return boost::beast::span(openbmc::registry); + } +-} // namespace message_registries +- +-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +-static std::optional inotifyConn; +-static constexpr const char* redfishEventLogDir = "/var/log"; +-static constexpr const char* redfishEventLogFile = "/var/log/redfish"; +-static constexpr const size_t iEventSize = sizeof(inotify_event); +-static int inotifyFd = -1; +-static int dirWatchDesc = -1; +-static int fileWatchDesc = -1; +- +-// +-using EventLogObjectsType = +- std::tuple>; +- +-namespace message_registries +-{ + static const Message* + getMsgFromRegistry(const std::string& messageKey, + const boost::beast::span& registry) +@@ -401,11 +403,9 @@ class Subscription + path); } - Subscription(const std::shared_ptr& adaptor) : @@ -175,7 +214,7 @@ index 5821e2e..f4d57c2 100644 ~Subscription() = default; -@@ -420,7 +424,7 @@ class Subscription +@@ -430,7 +430,7 @@ class Subscription if (sseConn != nullptr) { @@ -184,7 +223,7 @@ index 5821e2e..f4d57c2 100644 } } -@@ -510,6 +514,7 @@ class Subscription +@@ -520,6 +520,7 @@ class Subscription this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); @@ -192,7 +231,7 @@ index 5821e2e..f4d57c2 100644 } #endif -@@ -565,14 +570,39 @@ class Subscription +@@ -590,14 +591,39 @@ class Subscription return eventSeqNum; } @@ -233,7 +272,7 @@ index 5821e2e..f4d57c2 100644 }; static constexpr const bool defaultEnabledState = true; -@@ -963,6 +993,8 @@ class EventServiceManager +@@ -988,6 +1014,8 @@ class EventServiceManager subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); subValue->updateRetryPolicy(); @@ -242,7 +281,7 @@ index 5821e2e..f4d57c2 100644 return id; } -@@ -987,11 +1019,40 @@ class EventServiceManager +@@ -1012,11 +1040,40 @@ class EventServiceManager } } @@ -581,7 +620,7 @@ index 578fa19..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index be6f04d..1875ec9 100644 +index 64a2009..7c9bb7a 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -34,8 +34,6 @@ static constexpr const std::array supportedResourceTypes = { @@ -603,7 +642,7 @@ index be6f04d..1875ec9 100644 {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, {"Actions", diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp -index 902c32b..c871faa 100644 +index 902c32b..d4bd48c 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -5,6 +5,7 @@ @@ -614,14 +653,14 @@ index 902c32b..c871faa 100644 #include #include #include -@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/) +@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/) + #endif + #ifdef BMCWEB_ENABLE_REDFISH ++ redfish::eventservice_sse::requestRoutes(app); redfish::requestRoutes(app); redfish::RedfishService redfish(app); -+ redfish::eventservice_sse::requestRoutes(app); - // Create EventServiceManager instance and initialize Config - redfish::EventServiceManager::getInstance(); -- 2.17.1 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 4d99b2754..16e8affa5 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,7 +1,7 @@ -From 82185c52ae6e27cc1e086654a3b7d10e63ecc783 Mon Sep 17 00:00:00 2001 +From dda3c7a46391ef88e7c6a6f61fba7fe9133336bf Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Wed, 17 Mar 2021 01:16:50 +0000 -Subject: [PATCH 6/6] Add EventService SSE filter support +Subject: [PATCH] Add EventService SSE filter support This commit implements the Event Service SSE stream filters support. As per redfish specification: @@ -35,9 +35,9 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 include/eventservice_sse.hpp | 94 ++++++++++++++++++- redfish-core/include/error_messages.hpp | 9 ++ .../include/event_service_manager.hpp | 5 + - redfish-core/lib/event_service.hpp | 4 - + redfish-core/lib/event_service.hpp | 5 - redfish-core/src/error_messages.cpp | 26 +++++ - 5 files changed, 130 insertions(+), 8 deletions(-) + 5 files changed, 130 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp index 6c98e6e..ff72c4d 100644 @@ -171,7 +171,7 @@ index 7dfdc80..922dae9 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index f4d57c2..567fb9c 100644 +index ac644c1..3661fed 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = @@ -180,24 +180,25 @@ index f4d57c2..567fb9c 100644 +static constexpr const std::array supportedEvtFormatTypes = { + eventFormatType, metricReportFormatType}; -+static constexpr const std::array supportedRegPrefixes = { -+ "Base", "OpenBMC", "Task"}; ++static constexpr const std::array supportedRegPrefixes = { ++ "OpenBMC", "TaskEvent"}; + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES 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 1875ec9..4d1ac9f 100644 +index 7c9bb7a..297a4ea 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -19,10 +19,6 @@ +@@ -18,11 +18,6 @@ + namespace redfish { - +- -static constexpr const std::array supportedEvtFormatTypes = { - eventFormatType, metricReportFormatType}; -static constexpr const std::array supportedRegPrefixes = { -- "Base", "OpenBMC", "Task"}; +- "Base", "OpenBMC", "TaskEvent"}; static constexpr const std::array supportedRetryPolicies = { "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch new file mode 100644 index 000000000..0b12671e5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch @@ -0,0 +1,132 @@ +From 0a1390428fd6f5651669f4306f6105d33a24453c Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti +Date: Mon, 10 May 2021 13:03:37 +0530 +Subject: [PATCH] EventService: Log events for subscription actions + +Log redfish event for below 3 actions + - Add new subscription + - Update existing subscription properties + - Delete existing subscription +in order to notify the subscribed clients on the subscription related +information. + +Modified method name accordingly to indicate the clear purpose and +added updateSubscription method with subscription id param +to log event for subscription update. + +Tested: + - Performed all the above actions and verified the redfish event + messages are logged. + +Change-Id: I528293e55b1f3401bc2bb09c11c63ae985fbfedb +Signed-off-by: AppaRao Puli +Signed-off-by: Ayushi Smriti +--- + .../include/event_service_manager.hpp | 35 ++++++++++++++++--- + redfish-core/lib/event_service.hpp | 2 +- + 2 files changed, 32 insertions(+), 5 deletions(-) + +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 9952ef1..2b957ea 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -22,6 +22,7 @@ + #include "registries/task_event_message_registry.hpp" + + #include ++#include + + #include + #include +@@ -800,7 +801,7 @@ class EventServiceManager + return; + } + +- void updateSubscriptionData() ++ void persistSubscriptionData() + { + // Persist the config and subscription data. + nlohmann::json jsonData; +@@ -897,7 +898,7 @@ class EventServiceManager + + if (updateConfig) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + if (updateRetryCfg) +@@ -992,7 +993,7 @@ class EventServiceManager + + if (updateFile) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +@@ -1007,6 +1008,13 @@ class EventServiceManager + + // Set Subscription ID for back trace + subValue->setSubscriptionId(id); ++ ++ /* Log event for subscription addition */ ++ sd_journal_send("MESSAGE=Event subscription added(Id: %s)", id.c_str(), ++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionAdded", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ + return id; + } + +@@ -1027,7 +1035,14 @@ class EventServiceManager + { + subscriptionsMap.erase(obj); + updateNoOfSubscribersCount(); +- updateSubscriptionData(); ++ ++ persistSubscriptionData(); ++ /* 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); + } + } + +@@ -1049,6 +1064,18 @@ class EventServiceManager + } + } + ++ void updateSubscription(const std::string& id) ++ { ++ persistSubscriptionData(); ++ ++ /* Log event for subscription update. */ ++ sd_journal_send("MESSAGE=Event subscription updated.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionUpdated", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ } ++ + size_t getNumberOfSubscriptions() + { + return subscriptionsMap.size(); +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index 297a4ea..ed4955e 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -616,7 +616,7 @@ class EventDestination : public Node + subValue->updateRetryPolicy(); + } + +- EventServiceManager::getInstance().updateSubscriptionData(); ++ EventServiceManager::getInstance().updateSubscription(params[0]); + } + + void doDelete(const std::shared_ptr& asyncResp, +-- +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 3954e89c1..ae010dafb 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 @@ -4,16 +4,16 @@ thee gets merged upstream. Upstream revision information: - EventService : Fix retry handling for http-client - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/18 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/20 - EventService: https client support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/38 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/39 - Add Server-Sent-Events support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/6 - Add SSE style subscription support to eventservice - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/6 - Add EventService SSE filter support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/2 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/3 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch index 03feec633..8b08c6c5e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch @@ -1,7 +1,7 @@ -From b6ccf463b4cfb8df4a904f06c5f4852029a96c50 Mon Sep 17 00:00:00 2001 -From: "Wludzik, Jozef" -Date: Tue, 15 Dec 2020 12:28:17 +0100 -Subject: [PATCH 3/4] Add support for MetricDefinition scheme +From d664a145a96a642597c74819c183410d4a04fce0 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 Added MetricDefinition node to Redfish code. Now user is able to list all available metrics in OpenBMC that are supported @@ -23,16 +23,16 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 283 ++++++++++++++++++ + redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++ redfish-core/lib/telemetry_service.hpp | 2 + - 4 files changed, 290 insertions(+) + 4 files changed, 342 insertions(+) create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index aad28ac..dfcb8cd 100644 +index 7a14969..d280a86 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "../lib/managers.hpp" #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" @@ -40,7 +40,7 @@ index aad28ac..dfcb8cd 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -215,6 +216,8 @@ class RedfishService +@@ -219,6 +220,8 @@ class RedfishService nodes.emplace_back(std::make_unique(app)); nodes.emplace_back(std::make_unique(app)); @@ -50,7 +50,7 @@ index aad28ac..dfcb8cd 100644 std::make_unique(app)); nodes.emplace_back(std::make_unique(app)); diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 0a3af5f..54b5133 100644 +index 5872350..1b4f75d 100644 --- a/redfish-core/include/utils/telemetry_utils.hpp +++ b/redfish-core/include/utils/telemetry_utils.hpp @@ -10,6 +10,8 @@ namespace telemetry @@ -64,12 +64,13 @@ index 0a3af5f..54b5133 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..f9c7779 +index 0000000..515fe86 --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,283 @@ +@@ -0,0 +1,335 @@ +#pragma once + ++#include "async_resp.hpp" +#include "node.hpp" +#include "sensors.hpp" +#include "utils/telemetry_utils.hpp" @@ -80,150 +81,138 @@ index 0000000..f9c7779 +namespace utils +{ + ++class AsyncRespWithFinalizer ++{ ++ public: ++ AsyncRespWithFinalizer( ++ const std::shared_ptr& asyncResp) : ++ asyncResp(asyncResp) ++ {} ++ ++ AsyncRespWithFinalizer(const std::shared_ptr& asyncResp, ++ std::function finalizer) : ++ asyncResp(asyncResp), ++ finalizer(std::move(finalizer)) ++ {} ++ ++ AsyncRespWithFinalizer(const AsyncRespWithFinalizer&) = delete; ++ AsyncRespWithFinalizer(AsyncRespWithFinalizer&&) = delete; ++ ++ ~AsyncRespWithFinalizer() ++ { ++ if (finalizer) ++ { ++ try ++ { ++ finalizer(asyncResp->res); ++ } ++ catch (const std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "Executing finalizer failed: " << e.what(); ++ messages::internalError(asyncResp->res); ++ } ++ } ++ } ++ ++ void setFinalizer(std::function newFinalizer) ++ { ++ finalizer = std::move(newFinalizer); ++ } ++ ++ private: ++ std::shared_ptr asyncResp; ++ std::function finalizer; ++ ++ public: ++ crow::Response& res = asyncResp->res; ++}; ++ +template -+inline void getChassisNames(F&& cb, const std::shared_ptr& asyncResp) ++inline void getChassisNames(F&& cb) +{ + const std::array interfaces = { + "xyz.openbmc_project.Inventory.Item.Board", + "xyz.openbmc_project.Inventory.Item.Chassis"}; + + crow::connections::systemBus->async_method_call( -+ [asyncResp, -+ callback = std::move(cb)](const boost::system::error_code ec, -+ std::vector& chassis) { ++ [callback = std::move(cb)](const boost::system::error_code ec, ++ const std::vector& chassis) { ++ std::vector chassisNames; ++ + if (ec) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_DEBUG << "DBus call error: " << ec.value(); ++ callback(ec, chassisNames); + return; + } + -+ std::vector chassisNames; + chassisNames.reserve(chassis.size()); -+ for (const auto& path : chassis) ++ for (const std::string& path : chassis) + { + sdbusplus::message::object_path dbusPath = path; + std::string name = dbusPath.filename(); + if (name.empty()) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_ERROR << "Invalid chassis: " << dbusPath.str; ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::invalid_argument), ++ chassisNames); + return; + } + chassisNames.emplace_back(std::move(name)); + } + -+ callback(chassisNames); ++ callback(ec, chassisNames); + }, + "xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", + "/xyz/openbmc_project/inventory", 0, interfaces); +} ++ +} // namespace utils + +namespace telemetry +{ + -+class MetricDefinitionCollectionReduce ++void addMembers(crow::Response& res, ++ const boost::container::flat_map& el) +{ -+ public: -+ MetricDefinitionCollectionReduce( -+ const std::shared_ptr& asyncResp) : -+ asyncResp{asyncResp} -+ {} -+ -+ ~MetricDefinitionCollectionReduce() ++ for (const auto& [_, dbusSensor] : el) + { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) ++ sdbusplus::message::object_path path(dbusSensor); ++ sdbusplus::message::object_path parentPath = path.parent_path(); ++ std::string type = parentPath.filename(); ++ if (type.empty()) + { -+ return; ++ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " ++ << dbusSensor; ++ continue; + } + -+ nlohmann::json& members = asyncResp->res.jsonValue["Members"]; -+ members = nlohmann::json::array(); ++ nlohmann::json& members = res.jsonValue["Members"]; + -+ for (const std::string& type : dbusTypes) -+ { -+ members.push_back( -+ {{"@odata.id", telemetry::metricDefinitionUri + type}}); -+ } -+ asyncResp->res.jsonValue["Members@odata.count"] = members.size(); -+ } ++ const std::string odataId = ++ telemetry::metricDefinitionUri + std::move(type); + -+ void insert(const boost::container::flat_map& el) -+ { -+ for (const auto& [_, dbusSensor] : el) -+ { -+ sdbusplus::message::object_path path(dbusSensor); -+ sdbusplus::message::object_path parentPath = path.parent_path(); -+ std::string type = parentPath.filename(); -+ if (type.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " -+ << dbusSensor; -+ continue; -+ } ++ const auto it = ++ std::find_if(members.begin(), members.end(), ++ [&odataId](const nlohmann::json& item) { ++ auto kt = item.find("@odata.id"); ++ if (kt == item.end()) ++ { ++ return false; ++ } ++ return kt->get() == odataId; ++ }); + -+ dbusTypes.insert(std::move(type)); -+ } -+ } -+ -+ private: -+ const std::shared_ptr asyncResp; -+ boost::container::flat_set dbusTypes; -+}; -+ -+class MetricDefinitionReduce -+{ -+ public: -+ MetricDefinitionReduce(const std::shared_ptr& asyncResp, -+ const std::string& id) : -+ id(id), -+ pattern{'/' + id + '/'}, asyncResp{asyncResp} -+ {} -+ ~MetricDefinitionReduce() -+ { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) -+ { -+ return; -+ } -+ if (redfishSensors.empty()) ++ if (it == members.end()) + { -+ messages::resourceNotFound(asyncResp->res, "MetricDefinition", id); -+ return; ++ members.push_back({{"@odata.id", odataId}}); + } + -+ asyncResp->res.jsonValue["MetricProperties"] = redfishSensors; -+ asyncResp->res.jsonValue["Id"] = id; -+ asyncResp->res.jsonValue["Name"] = id; -+ asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + id; -+ 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["Units"] = sensors::toReadingUnits(id); -+ } -+ -+ void insert(const boost::container::flat_map& el) -+ { -+ for (const auto& [redfishSensor, dbusSensor] : el) -+ { -+ if (dbusSensor.find(pattern) != std::string::npos) -+ { -+ redfishSensors.push_back(redfishSensor); -+ } -+ } ++ res.jsonValue["Members@odata.count"] = members.size(); + } ++} + -+ private: -+ const std::string id; -+ const std::string pattern; -+ const std::shared_ptr asyncResp; -+ std::vector redfishSensors; -+}; +} // namespace telemetry + +class MetricDefinitionCollection : public Node @@ -242,52 +231,83 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override + { -+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." -+ "MetricDefinitionCollection"; -+ res.jsonValue["@odata.id"] = ++ asyncResp->res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." ++ "MetricDefinitionCollection"; ++ asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; -+ res.jsonValue["Name"] = "Metric Definition Collection"; -+ res.jsonValue["Members"] = nlohmann::json::array(); -+ res.jsonValue["Members@odata.count"] = 0; ++ asyncResp->res.jsonValue["Name"] = "Metric Definition Collection"; ++ asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); ++ asyncResp->res.jsonValue["Members@odata.count"] = 0; ++ ++ auto handleRetrieveUriToDbusMap = ++ [asyncResp]( ++ const boost::beast::http::status status, ++ const boost::container::flat_map& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast(status); ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ telemetry::addMembers(asyncResp->res, uriToDbus); ++ }; + -+ auto asyncResp = std::make_shared(res); + utils::getChassisNames( -+ [asyncResp](const std::vector& chassisNames) { -+ auto collectionReduce = std::make_shared< -+ telemetry::MetricDefinitionCollectionReduce>(asyncResp); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ asyncResp](boost::system::error_code ec, ++ const std::vector& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, _] : sensors::dbus::paths) + { -+ BMCWEB_LOG_INFO << "Chassis: " << chassisName -+ << " sensor: " << sensorNode; -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, collectionReduce]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR -+ << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ collectionReduce->insert(uriToDbus); -+ }); ++ BMCWEB_LOG_DEBUG << "Chassis: " << chassisName ++ << " sensor: " << sensorNode; ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + ++namespace telemetry ++{ ++ ++void addMetricProperty( ++ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id, ++ 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 (sensorId == id) ++ { ++ metricProperties.push_back(redfishSensor); ++ } ++ } ++ } ++} ++ ++} // namespace telemetry ++ +class MetricDefinition : public Node +{ + public: @@ -305,65 +325,97 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, + const std::vector& params) override + { -+ auto asyncResp = std::make_shared(res); ++ auto telemetryAsyncResp = ++ std::make_shared(asyncResp); ++ + if (params.size() != 1) + { -+ messages::internalError(asyncResp->res); ++ messages::internalError(telemetryAsyncResp->res); + return; + } + + const std::string& id = params[0]; ++ telemetryAsyncResp->setFinalizer([id](crow::Response& res) { ++ if (res.jsonValue["MetricProperties"].empty()) ++ { ++ messages::resourceNotFound(res, "MetricDefinition", id); ++ } ++ }); ++ ++ telemetryAsyncResp->res.jsonValue["MetricProperties"] = ++ nlohmann::json::array(); ++ telemetryAsyncResp->res.jsonValue["Id"] = id; ++ telemetryAsyncResp->res.jsonValue["Name"] = id; ++ telemetryAsyncResp->res.jsonValue["@odata.id"] = ++ telemetry::metricDefinitionUri + id; ++ telemetryAsyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ telemetryAsyncResp->res.jsonValue["MetricDataType"] = "Decimal"; ++ telemetryAsyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ telemetryAsyncResp->res.jsonValue["IsLinear"] = true; ++ telemetryAsyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits(id); ++ ++ auto handleRetrieveUriToDbusMap = ++ [telemetryAsyncResp, ++ id](const boost::beast::http::status status, ++ const boost::container::flat_map& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast(status); ++ messages::internalError(telemetryAsyncResp->res); ++ return; ++ } ++ telemetry::addMetricProperty(*telemetryAsyncResp, id, ++ uriToDbus); ++ }; ++ + utils::getChassisNames( -+ [asyncResp, id](const std::vector& chassisNames) { -+ auto definitionGather = -+ std::make_shared( -+ asyncResp, id); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ telemetryAsyncResp, ++ id](boost::system::error_code ec, ++ const std::vector& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(telemetryAsyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, dbusPaths] : + sensors::dbus::paths) + { -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, definitionGather]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR -+ << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ definitionGather->insert(uriToDbus); -+ }); ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + +} // namespace redfish diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 61ca891..a8c8b03 100644 +index 9ec0737..de9c800 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp @@ -32,6 +32,8 @@ class TelemetryService : public Node - res.jsonValue["Id"] = "TelemetryService"; - res.jsonValue["Name"] = "Telemetry Service"; + asyncResp->res.jsonValue["Id"] = "TelemetryService"; + asyncResp->res.jsonValue["Name"] = "Telemetry Service"; -+ res.jsonValue["MetricDefinitions"]["@odata.id"] = ++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; - res.jsonValue["MetricReportDefinitions"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] = "/redfish/v1/TelemetryService/MetricReportDefinitions"; - res.jsonValue["MetricReports"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch index f2ebce6e3..4119045f1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch @@ -1,7 +1,7 @@ -From efcd128a3d66fce33200fd4211ba5abf13a81375 Mon Sep 17 00:00:00 2001 +From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" Date: Tue, 15 Dec 2020 12:30:31 +0100 -Subject: [PATCH 4/4] Sync Telmetry service with EventService +Subject: [PATCH] Sync Telmetry service with EventService Synced the latest changes in Telemetry service with Event Service code. Now assembling MetricReport is covered in single place in @@ -22,7 +22,7 @@ Signed-off-by: Wludzik, Jozef 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 148c703..27e41e3 100644 +index c3c110a..dc99cda 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -33,7 +33,7 @@ index 148c703..27e41e3 100644 #include "node.hpp" #include "registries.hpp" #include "registries/base_message_registry.hpp" -@@ -512,47 +513,32 @@ class Subscription +@@ -529,47 +530,32 @@ class Subscription } #endif @@ -92,7 +92,7 @@ index 148c703..27e41e3 100644 this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); } -@@ -1348,75 +1334,6 @@ class EventServiceManager +@@ -1421,75 +1407,6 @@ class EventServiceManager } #endif @@ -168,7 +168,7 @@ index 148c703..27e41e3 100644 void unregisterMetricReportSignal() { if (matchTelemetryMonitor) -@@ -1436,9 +1353,11 @@ class EventServiceManager +@@ -1509,9 +1426,11 @@ class EventServiceManager } BMCWEB_LOG_DEBUG << "Metrics report signal - Register"; @@ -183,7 +183,7 @@ index 148c703..27e41e3 100644 matchTelemetryMonitor = std::make_shared( *crow::connections::systemBus, matchStr, -@@ -1449,10 +1368,43 @@ class EventServiceManager +@@ -1522,10 +1441,43 @@ class EventServiceManager return; } @@ -232,14 +232,14 @@ index 148c703..27e41e3 100644 } diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 9caf4a3..e79a41c 100644 +index ad15a05..18a6dcc 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -31,16 +31,14 @@ inline nlohmann::json toMetricValues(const Readings& readings) return metricValues; } --inline void fillReport(const std::shared_ptr& asyncResp, +-inline void fillReport(const std::shared_ptr& asyncResp, - const std::string& id, +inline bool fillReport(nlohmann::json& json, const std::string& id, const std::variant& var) @@ -258,7 +258,7 @@ index 9caf4a3..e79a41c 100644 telemetry::metricReportDefinitionUri + id; const TimestampReadings* timestampReadings = -@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr& asyncResp, +@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr& asyncResp, if (!timestampReadings) { BMCWEB_LOG_ERROR << "Property type mismatch or property is missing"; @@ -277,7 +277,7 @@ index 9caf4a3..e79a41c 100644 } } // namespace telemetry -@@ -146,7 +144,11 @@ class MetricReport : public Node +@@ -145,7 +143,11 @@ class MetricReport : public Node return; } 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 46128f7ae..20c93c08e 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,8 +3,8 @@ 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/60 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/72 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/26 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30 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 new file mode 100644 index 000000000..3e3f69d1c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch @@ -0,0 +1,50 @@ +From 95f002dc969d7d6d64dbf2ee0db7dc1c1c6a9173 Mon Sep 17 00:00:00 2001 +From: Przemyslaw Czarnowski +Date: Thu, 18 Mar 2021 11:30:28 +0100 +Subject: [PATCH] Revert "Disable nbd proxy from the build" + +NBD Proxy has been disabled upstream. Reenable as we use it for Virtual +Media + +This reverts commit efb8062c306474942bc94f15d748b2eb0b58fbb6. +--- + meson.build | 2 +- + meson_options.txt | 9 +-------- + 2 files changed, 2 insertions(+), 9 deletions(-) + +diff --git a/meson.build b/meson.build +index 66a066b..cef0a49 100644 +--- a/meson.build ++++ b/meson.build +@@ -81,7 +81,7 @@ feature_map = { + 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', + 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', + 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', +-#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', + 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', + } + +diff --git a/meson_options.txt b/meson_options.txt +index 9611631..7ee3ebb 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -3,14 +3,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT + option('kvm', type : 'feature',value : 'enabled', description : 'Enable the KVM host video WebSocket. Path is \'/kvm/0\'. Video is from the BMC\'s \'/dev/video\' device.') + option ('tests', type : 'feature', value : 'enabled', description : 'Enable Unit tests for bmcweb') + option('vm-websocket', type : 'feature', value : 'enabled', description : '''Enable the Virtual Media WebSocket. Path is \'/vm/0/0\'to open the websocket. See https://github.com/openbmc/jsnbd/blob/master/README.''') +- +-# if you use this option and are seeing this comment, please comment here: +-# https://github.com/openbmc/bmcweb/issues/188 and put forward your intentions +-# for this code. At this point, no daemon has been upstreamed that implements +-# this interface, so for the moment this appears to be dead code; In leiu of +-# removing it, it has been disabled to try to give those that use it the +-# opportunity to upstream their backend implementation +-#option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') ++option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') + 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.') +-- +2.26.2 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch new file mode 100644 index 000000000..01c1c858c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch @@ -0,0 +1,219 @@ +From 76480c6a5b1708113f28aecab32a85984371243c Mon Sep 17 00:00:00 2001 +From: Karol Wachowski +Date: Fri, 10 Jul 2020 09:54:06 +0000 +Subject: [PATCH] bmcweb handle device or resource busy exception + +Use async_method_call_timed() for mount/unmount dbus oprations. +Long mount/unmount times are supported by VirtualMedia service, +this works because of settable timeout property, available for each block +device. +Default dbus calls will timeout when mount/unmount timeout is long enough. + +Get mount/unmount timeout property and use it for mount/unmount calls. +Add handling of device or resource busy exception (EBUSY) that +can be thrown by VirtualMedia service during Mount/Unmount dbus operations. + +Tested: Verified that after mounting non-existing HTTPS resource + in proxy mode, VirtualMedia recovers restoring ready state + and returns EBUSY during that transition. + Verfied that resources can be mounted/unmounted in both legacy + and proxy mode. +Signed-off-by: Karol Wachowski +Change-Id: Ica62c34db0cce24c4c6169fc661edfde49e948d0 +--- + redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++------- + 1 file changed, 110 insertions(+), 34 deletions(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 95a8881..188248a 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -24,6 +24,8 @@ + #include + #include + ++#include ++ + namespace redfish + + { +@@ -160,6 +162,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, + } + } + ++/** ++ * @brief parses Timeout property and converts to microseconds ++ */ ++static std::optional ++ vmParseTimeoutProperty(const std::variant& timeoutProperty) ++{ ++ const int* timeoutValue = std::get_if(&timeoutProperty); ++ if (timeoutValue) ++ { ++ constexpr int timeoutMarginSeconds = 10; ++ return std::chrono::duration_cast( ++ std::chrono::seconds(*timeoutValue + timeoutMarginSeconds)) ++ .count(); ++ } ++ else ++ { ++ return std::nullopt; ++ } ++} ++ + /** + * @brief Fill template for Virtual Media Item. + */ +@@ -856,22 +878,54 @@ class VirtualMediaActionInsertMedia : public Node + } + + crow::connections::systemBus->async_method_call( +- [asyncResp, secretPipe](const boost::system::error_code ec, +- bool success) { ++ [asyncResp, service, name, imageUrl, rw, unixFd, ++ secretPipe](const boost::system::error_code ec, ++ const std::variant timeoutProperty) { + if (ec) + { + BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; + messages::internalError(asyncResp->res); ++ return; + } +- else if (!success) ++ ++ auto timeout = vmParseTimeoutProperty(timeoutProperty); ++ if (timeout == std::nullopt) + { +- BMCWEB_LOG_ERROR << "Service responded with error"; +- messages::generalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "Timeout property is empty."; ++ messages::internalError(asyncResp->res); ++ return; + } ++ ++ crow::connections::systemBus->async_method_call_timed( ++ [asyncResp, secretPipe](const boost::system::error_code ec, ++ bool success) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " ++ << ec; ++ if (ec == ++ boost::system::errc::device_or_resource_busy) ++ { ++ messages::resourceInUse(asyncResp->res); ++ } ++ else ++ { ++ messages::internalError(asyncResp->res); ++ } ++ } ++ else if (!success) ++ { ++ BMCWEB_LOG_ERROR << "Service responded with error"; ++ messages::generalError(asyncResp->res); ++ } ++ }, ++ service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, ++ "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", ++ *timeout, imageUrl, rw, unixFd); + }, + service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, +- "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", imageUrl, rw, +- unixFd); ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); + } + }; + +@@ -1003,38 +1057,60 @@ class VirtualMediaActionEjectMedia : public Node + const std::string& service, const std::string& name, + bool legacy) + { +- +- // Legacy mount requires parameter with image ++ std::string objectPath = "/xyz/openbmc_project/VirtualMedia/"; ++ std::string ifaceName = "xyz.openbmc_project.VirtualMedia"; + if (legacy) + { +- crow::connections::systemBus->async_method_call( +- [asyncResp](const boost::system::error_code ec) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; +- +- messages::internalError(asyncResp->res); +- return; +- } +- }, +- service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, +- "xyz.openbmc_project.VirtualMedia.Legacy", "Unmount"); ++ objectPath += "Legacy/"; ++ ifaceName += ".Legacy"; + } +- else // proxy ++ else + { +- crow::connections::systemBus->async_method_call( +- [asyncResp](const boost::system::error_code ec) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; +- +- messages::internalError(asyncResp->res); +- return; +- } +- }, +- service, "/xyz/openbmc_project/VirtualMedia/Proxy/" + name, +- "xyz.openbmc_project.VirtualMedia.Proxy", "Unmount"); ++ objectPath += "Proxy/"; ++ ifaceName += ".Proxy"; + } ++ objectPath += name; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp, service, name, objectPath, ++ ifaceName](const boost::system::error_code ec, ++ const std::variant timeoutProperty) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ auto timeout = vmParseTimeoutProperty(timeoutProperty); ++ if (timeout == std::nullopt) ++ { ++ BMCWEB_LOG_ERROR << "Timeout property is empty."; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ crow::connections::systemBus->async_method_call_timed( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " ++ << ec; ++ if (ec == ++ boost::system::errc::device_or_resource_busy) ++ { ++ messages::resourceInUse(asyncResp->res); ++ } ++ else ++ { ++ messages::internalError(asyncResp->res); ++ } ++ return; ++ } ++ }, ++ service, objectPath, ifaceName, "Unmount", *timeout); ++ }, ++ service, objectPath, "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); + } + }; + +-- +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 new file mode 100644 index 000000000..41c1c9836 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch @@ -0,0 +1,28 @@ +From d303bfdd6778c43096401ff78fab70f9041cd4cf 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 + +Tested: Verified that ConnectedVia property is returned and set to + "NotConnected" for disconnected media. + +Signed-off-by: Karol Wachowski +--- + redfish-core/lib/virtual_media.hpp | 1 + + 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 +--- 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; + item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; ++ item["ConnectedVia"] = "NotConnected"; + item["Name"] = "Virtual Removable Media"; + item["Id"] = resName; + item["WriteProtected"] = true; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch new file mode 100644 index 000000000..3a9e67217 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch @@ -0,0 +1,185 @@ +From 805641a2d189da9befc05168f51cef76da1ba326 Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Tue, 20 Apr 2021 16:32:37 +0200 +Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, + PUT, DELETE, PATCH in proxy mode + +Add handlers for GET, PUT, DELETE, PATCH method and function that +checks which mode is used and set suitable status code: +Not allowed for Legacy and Not found for Proxy. + +Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b +Signed-off-by: Alicja Rybak +--- + redfish-core/lib/virtual_media.hpp | 155 +++++++++++++++++++++++++++++ + 1 file changed, 155 insertions(+) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index aa7c639..3e28164 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -548,6 +548,161 @@ class VirtualMediaActionInsertMedia : public Node + return true; + } + ++ /** ++ * @brief Function checks if insert media request is Legacy or Proxy type ++ * and sets suitable response code for unsupported REST method. ++ * ++ */ ++ void CheckProxyMode(const std::shared_ptr& aResp, ++ const crow::Request& req, ++ const std::vector& params) ++ { ++ if (params.size() != 2) ++ { ++ messages::internalError(aResp->res); ++ return; ++ } ++ ++ // take resource name from URL ++ const std::string& resName = params[1]; ++ ++ if (params[0] != "bmc") ++ { ++ messages::resourceNotFound(aResp->res, "VirtualMedia.Insert", ++ resName); ++ ++ return; ++ } ++ ++ crow::connections::systemBus->async_method_call( ++ [this, aResp{std::move(aResp)}, req, ++ resName](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ aResp->res.result(boost::beast::http::status::not_found); ++ ++ return; ++ } ++ std::string service = getObjectType.begin()->first; ++ BMCWEB_LOG_DEBUG << "GetObjectType: " << service; ++ ++ crow::connections::systemBus->async_method_call( ++ [this, service, resName, req, ++ aResp{aResp}](const boost::system::error_code ec, ++ ManagedObjectType& subtree) { ++ if (ec) ++ { ++ BMCWEB_LOG_DEBUG << "DBUS response error"; ++ ++ return; ++ } ++ ++ for (auto& item : subtree) ++ { ++ std::string thispath = item.first.filename(); ++ if (thispath.empty()) ++ { ++ continue; ++ } ++ ++ if (thispath != resName) ++ { ++ continue; ++ } ++ ++ auto mode = item.first.parent_path(); ++ auto type = mode.parent_path(); ++ if (mode.filename().empty() || ++ type.filename().empty()) ++ { ++ continue; ++ } ++ ++ if (type.filename() != "VirtualMedia") ++ { ++ continue; ++ } ++ ++ // Check if dbus path is Legacy type ++ if (mode.filename() == "Legacy") ++ { ++ BMCWEB_LOG_DEBUG << "InsertMedia only allowed " ++ "with POST method " ++ "in legacy mode"; ++ aResp->res.result(boost::beast::http::status:: ++ method_not_allowed); ++ ++ return; ++ } ++ // Check if dbus path is Proxy type ++ if (mode.filename() == "Proxy") ++ { ++ // Not possible in proxy mode ++ BMCWEB_LOG_DEBUG << "InsertMedia not " ++ "allowed in proxy mode"; ++ aResp->res.result( ++ boost::beast::http::status::not_found); ++ ++ return; ++ } ++ } ++ ++ BMCWEB_LOG_DEBUG << "Parent item not found"; ++ aResp->res.result( ++ boost::beast::http::status::not_found); ++ }, ++ service, "/xyz/openbmc_project/VirtualMedia", ++ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/VirtualMedia", std::array()); ++ } ++ ++ /** ++ * @brief Function handles GET method request. ++ */ ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles PATCH method request. ++ */ ++ void doPatch(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles PUT method request. ++ */ ++ void doPut(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles DELETE method request. ++ */ ++ void doDelete(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ + /** + * @brief Function handles POST method request. + * +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch new file mode 100644 index 000000000..3d80aeb20 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch @@ -0,0 +1,43 @@ +From 89ca38dbc3433b3b734a20068e599809f3bd7b90 Mon Sep 17 00:00:00 2001 +From: Karol Wachowski +Date: Tue, 23 Feb 2021 15:53:16 +0000 +Subject: [PATCH] Set Inserted redfish property for not inserted resources + +Tested: Verified that Inserted property is returned and set to + "false" for not inserted media. +Signed-off-by: Karol Wachowski +--- + redfish-core/lib/virtual_media.hpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 3e28164..4c475b7 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -96,6 +96,7 @@ static void + BMCWEB_LOG_DEBUG << "Value Active not found"; + return; + } ++ aResp->res.jsonValue["Inserted"] = *activeValue; + + const std::string* endpointIdValue = + std::get_if(&endpointIdProperty->second); +@@ -107,7 +108,6 @@ static void + aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = + *endpointIdValue; + aResp->res.jsonValue["TransferProtocolType"] = "OEM"; +- aResp->res.jsonValue["Inserted"] = *activeValue; + if (*activeValue == true) + { + aResp->res.jsonValue["ConnectedVia"] = "Applet"; +@@ -138,7 +138,6 @@ static void + } + + aResp->res.jsonValue["Image"] = *imageUrlValue; +- aResp->res.jsonValue["Inserted"] = *activeValue; + aResp->res.jsonValue["TransferProtocolType"] = + getTransferProtocolTypeFromUri(*imageUrlValue); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch new file mode 100644 index 000000000..efce3e72c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch @@ -0,0 +1,47 @@ +From e7018ea9e3ad1a17e096aec3717a4764c3feac2e Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Wed, 14 Apr 2021 16:26:59 +0200 +Subject: [PATCH] Bmcweb handle permission denied exception + +Add handling of permission denied exception (EPERM) that +can be thrown by VirtualMedia service during Mount/Unmount dbus operations. + +Tested: +Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode, +VirtualMedia returns EPERM, which bmcweb handles as 403 status code. + +Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b +Signed-off-by: Alicja Rybak +--- + redfish-core/lib/virtual_media.hpp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 4c475b7..8151ac0 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -1073,6 +1073,10 @@ class VirtualMediaActionInsertMedia : public Node + { + messages::resourceInUse(asyncResp->res); + } ++ else if (ec == boost::system::errc::permission_denied) ++ { ++ messages::accessDenied(asyncResp->res, "VirtualMedia.Insert"); ++ } + else + { + messages::internalError(asyncResp->res); +@@ -1267,6 +1271,10 @@ class VirtualMediaActionEjectMedia : public Node + { + messages::resourceInUse(asyncResp->res); + } ++ else if (ec == boost::system::errc::permission_denied) ++ { ++ messages::accessDenied(asyncResp->res, "VirtualMedia.Eject"); ++ } + else + { + messages::internalError(asyncResp->res); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch new file mode 100644 index 000000000..88fa89465 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch @@ -0,0 +1,35 @@ +From 6f4b5fc1879f39b0f5fee0838f0ecbc481275d5e Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Fri, 23 Apr 2021 17:35:52 +0200 +Subject: [PATCH] Fix unmounting image in proxy mode. + +Sometimes Slot0 got higher key than Slot1 and erase function for Slot1 +invalidates elements with keys not less than the erased element. +In that case invalid slot0 will be unmounted. +Change order of calling close() and erase() functions to +unmount correct device. + +Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0 +Signed-off-by: Alicja Rybak +--- + include/nbd_proxy.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp +index 3b28823..897bcf2 100644 +--- a/include/nbd_proxy.hpp ++++ b/include/nbd_proxy.hpp +@@ -439,9 +439,9 @@ inline void requestRoutes(App& app) + BMCWEB_LOG_DEBUG << "No session to close"; + return; + } ++ session->second->close(); + // Remove reference to session in global map + sessions.erase(session); +- session->second->close(); + }) + .onmessage([](crow::websocket::Connection& conn, + const std::string& data, bool) { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch new file mode 100644 index 000000000..c188b2105 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch @@ -0,0 +1,37 @@ +From d31d913a8c5dbacf6a36407532cf777852099ced Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Sun, 2 May 2021 11:07:16 +0000 +Subject: [PATCH] Fix VM NBDPROXY build issue with AsyncResp + +8d1b46d7 moves bmcweb to using AsyncResp everywhere, and not have +each individual handler creating its own object. + +This commit fixes the build failure when enabling virtual media +compile flag(BMCWEB_ENABLE_VM_NBDPROXY). This is caused by above +mentioned recent change. + +Tested: + - Build is successful with enabled virtual media flag. + +Signed-off-by: AppaRao Puli +Change-Id: I363a41a08fae9dc05b3553695b96ffd26948f696 +--- + redfish-core/lib/virtual_media.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 685ee5c..99542c4 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -635,7 +635,7 @@ class VirtualMediaActionInsertMedia : public Node + } + + bool paramsValid = validateParams( +- asyncResp->res, imageUrl, inserted, ++ asyncResp, imageUrl, inserted, + transferMethod, transferProtocolType); + + if (paramsValid == false) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index d9b32f5ae..7e9d42228 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "dab0604af234bdd5010407031a01343d6c242edf" +SRCREV = "2ebb9683287cf6b1a2f2cc3c077bd99aceefa8dd" DEPENDS += "boost-url" RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config" @@ -14,20 +14,33 @@ GROUPADD_PARAM_${PN} = "web; redfish " SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0002-Use-chip-id-based-UUID-for-Service-Root.patch \ - file://0004-bmcweb-handle-device-or-resource-busy-exception.patch \ - file://0006-Define-Redfish-interface-Registries-Bios.patch \ - file://0007-BIOS-config-Add-support-for-PATCH-operation.patch \ - file://0008-Add-support-to-ResetBios-action.patch \ - file://0009-Add-support-to-ChangePassword-action.patch \ file://0010-managers-add-attributes-for-Manager.CommandShell.patch \ - file://0034-recommended-fixes-by-crypto-review-team.patch \ file://0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch \ file://0012-Log-RedFish-event-for-Invalid-login-attempt.patch \ file://0013-Add-UART-routing-logic-into-host-console-connection-.patch \ + file://0014-recommended-fixes-by-crypto-review-team.patch \ + file://0015-Add-state-sensor-messages-to-the-registry.patch \ + file://0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ + file://0017-Add-msg-registry-for-subscription-related-actions.patch \ " -# Temporary downstream mirror of upstream patch to enable feature in Intel builds. -SRC_URI += "file://0037-Add-state-sensor-messages-to-the-registry.patch \ +# OOB Bios Config: +SRC_URI += "file://biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch \ + file://biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch \ + file://biosconfig/0003-Add-support-to-ResetBios-action.patch \ + file://biosconfig/0004-Add-support-to-ChangePassword-action.patch \ + file://biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch \ +" + +# Virtual Media: Backend code is not upstreamed so downstream only patches. +SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ + file://vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch \ + file://vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ + file://vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch \ + file://vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ + file://vm/0006-Bmcweb-handle-permission-denied-exception.patch \ + file://vm/0007-Fix-unmounting-image-in-proxy-mode.patch \ + file://vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details @@ -36,26 +49,12 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0004-Add-Server-Sent-Events-support.patch \ file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ file://eventservice/0006-Add-EventService-SSE-filter-support.patch \ + file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details -SRC_URI += "file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ -" - -SRC_URI += "file://0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ - file://0002-Invalid-status-code-from-InsertMedia-REST-methods.patch \ - file://0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ - file://0004-Bmcweb-handle-permission-denied-exception.patch \ - file://0005-Fix-unmounting-image-in-proxy-mode.patch \ -" - -SRC_URI += "file://0038-Revert-Disable-nbd-proxy-from-the-build.patch \ - file://0039-Fix-comparison-for-proxy-legacy-mode.patch \ -" - -# Fix to avoid bmcweb crash on VM mount -SRC_URI += "file://0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ +SRC_URI += " file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ + file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ " # Temporary fix: Move it to service file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json index 656207de6..73fb214a2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -36,6 +36,7 @@ "name" : "eth0", "is_valid" : true, "active_sessions" : 0, + "is_management_nic" : true, "channel_info" : { "medium_type" : "lan-802.3", "protocol_type" : "ipmb-1.0", 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 cc9f2d025..a84352929 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 = "3b170152ddc967f270939f4c351be987c451f0ca" +SRCREV = "03e6defcbca99c9c00cd37c4afb1d2b415a92acd" 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 7fe91fd1f..56b581ce7 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 = "d4a4bed525f79c39705fa526b20ab663bb2c2069" +SRCREV = "7b645018775b85a0c61148e592d951841809eef9" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend new file mode 100644 index 000000000..83fd20bdb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +RDEPENDS_${PN}_remove = "clear-once" + +do_compile_prepend(){ + install -m 0644 ${STAGING_DATADIR_NATIVE}/${PN}/led.yaml ${S} +} + +do_install_append(){ + rm -f ${S}/led.yaml +} + + 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 6c930876f..6881a8065 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 = "37ea118aa8653cc6220c4fd6da0224f0797f4bdc" +SRCREV = "807b80296c9793900f46ba5675e5e739fc18dafd" 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 ee6fd12ee..67b7d2b42 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" 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 b9d3c0ca4..7527e949d 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" 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 afe199192..f9c2adcb5 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" 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 96582c76e..78244d0ba 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "e850d4ad2f72698e51f0a95bb949aa7a6055ccd6" 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 c36c0d926..055b9b7e4 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" 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 8a73394e5..2f0e2c8e7 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 = "832c63d3db86788859f4afb911840f5ba100d230" +SRCREV = "f3ba26e5fd3542d3c30b1069c4c1439a637f42ba" 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 4a2a33878..3d747004a 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" 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 134cd9fdd..1ad639ba1 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 = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/pmci_launcher" 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 new file mode 100644 index 000000000..fb38b0348 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -0,0 +1,234 @@ +From f516fc884fcbc03bf560b4ef975ad236232bd1e6 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 + +When BMC fails to talk to CPU through PECI, no +CPU sensors are created. Fan speed control only boost +fan when input sensor is not available. It does not +have the knowledge of which sensors are expected to +be present and can't treat "missing" sensor as failed one. +The failure on PECI goes unnoticed and we can have a thermal +run away. + +Query sensor config for RequiredTempSensor for any present +CPUs. Create a CPU sensor that is not available. +This sensor will be replaced by a normal CPU sensor when +peci detect the CPU and associated hwmon file is discovered. + +This is an initial patch that target to address the particular +failure case. More work will follow to support a more generic +"Required" sensor config. + +Signed-off-by: Zhikui Ren +--- + include/CPUSensor.hpp | 9 ++++++ + src/CPUSensor.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ + src/CPUSensorMain.cpp | 54 ++++++++++++++++++++++++++++----- + 3 files changed, 124 insertions(+), 8 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 29b8209..5d09e4e 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -26,6 +26,15 @@ class CPUSensor : public Sensor + std::vector&& thresholds, + const std::string& configuration, int cpuId, bool show, + double dtsOffset); ++ ++ // Create a CPUSensor without a path to sensor value ++ CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& conn, ++ boost::asio::io_service& io, const std::string& sensorName, ++ std::vector&& thresholdsIn, ++ const std::string& sensorConfiguration); ++ + ~CPUSensor() override; + static constexpr unsigned int sensorScaleFactor = 1000; + static constexpr unsigned int sensorPollMs = 1000; +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 7f9a2c5..7c29cf0 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + setupRead(); + } + ++// Create a dummy "not available" CPUSensor ++// This is used to indicate a missing required sensor for ++// other services like fan control ++CPUSensor::CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& conn, ++ 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, 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) ++{ ++ // assume it is a temperature sensor for now ++ // support for other type can be added later ++ std::string interfacePath = ++ "/xyz/openbmc_project/sensors/temperature/" + name; ++ const char* units = sensor_paths::unitDegreesC; ++ minValue = -128; ++ maxValue = 127; ++ ++ sensorInterface = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Value"); ++ ++ sensorInterface->register_property("Unit", units); ++ sensorInterface->register_property("MaxValue", maxValue); ++ sensorInterface->register_property("MinValue", minValue); ++ sensorInterface->register_property( ++ "Value", value, [&](const double& newValue, double& oldValue) { ++ return setSensorValue(newValue, oldValue); ++ }); ++ if (!sensorInterface->initialize()) ++ { ++ std::cerr << "error initializing value interface\n"; ++ } ++ ++ if (!availableInterface) ++ { ++ availableInterface = std::make_shared( ++ conn, sensorInterface->get_object_path(), availableInterfaceName); ++ availableInterface->register_property( ++ "Available", false, [this](const bool propIn, bool& old) { ++ if (propIn == old) ++ { ++ return 1; ++ } ++ old = propIn; ++ if (!propIn) ++ { ++ updateValue(std::numeric_limits::quiet_NaN()); ++ } ++ return 1; ++ }); ++ availableInterface->initialize(); ++ } ++ if (!operationalInterface) ++ { ++ operationalInterface = ++ std::make_shared( ++ conn, sensorInterface->get_object_path(), ++ operationalInterfaceName); ++ operationalInterface->register_property("Functional", true); ++ operationalInterface->initialize(); ++ } ++} ++ + CPUSensor::~CPUSensor() + { + // close the input dev to cancel async operations +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index 92c1716..4c00551 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, + { + if (debug) + { +- std::cout << "Skipped: " << inputPath << ": " << sensorName +- << " is already created\n"; ++ std::cout << "Will be replaced: " << inputPath << ": " ++ << sensorName << " is already created\n"; + } +- continue; + } + + // check hidden properties +@@ -636,9 +635,9 @@ void detectCpuAsync( + }); + } + +-bool getCpuConfig(const std::shared_ptr& systemBus, ++bool getCpuConfig(std::shared_ptr& systemBus, + boost::container::flat_set& cpuConfigs, +- ManagedObjectType& sensorConfigs, ++ ManagedObjectType& sensorConfigs, boost::asio::io_service& io, + sdbusplus::asio::object_server& objectServer) + { + bool useCache = false; +@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr& systemBus, + iface->register_property("Present", *present); + iface->initialize(); + inventoryIfaces[name] = std::move(iface); ++ if (*present) ++ { ++ // create required CPU sensors here in unavailable state ++ auto findRequiredTempSensor = ++ config.second.find("RequiredTempSensor"); ++ auto findCpuId = config.second.find("CpuID"); ++ if (findRequiredTempSensor != config.second.end() && ++ findCpuId != config.second.end()) ++ { ++ std::string label = ++ std::visit(VariantToStringVisitor(), ++ findRequiredTempSensor->second); ++ // for temp sensor hwmon sysfs use input ++ std::string item{"input"}; ++ int cpuId = ++ std::visit(VariantToUnsignedIntVisitor(), ++ findCpuId->second); ++ std::string requiredSensorName = ++ createSensorName(label, item, cpuId); ++ ++ auto& sensorPtr = gCpuSensors[requiredSensorName]; ++ if (sensorPtr == nullptr) ++ { ++ // created a dummy sensor for required sensor, ++ // will be replaced with a real one if it is ++ // detected ++ std::string objectType{}; ++ std::vector ++ emptyThreshold{}; ++ std::string emptyConfig{}; ++ sensorPtr = std::make_unique( ++ objectType, objectServer, systemBus, io, ++ requiredSensorName, ++ std::move(emptyThreshold), emptyConfig); ++ std::cout << "created required CPU sensor " ++ << requiredSensorName << "\n"; ++ } ++ } ++ } + } + + auto findBus = config.second.find("Bus"); +@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr& systemBus, + std::cout << "name: " << name << "\n"; + std::cout << "type: " << type << "\n"; + } +- + cpuConfigs.emplace(bus, addr, name, State::OFF); + } + } +@@ -764,7 +801,8 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, objectServer)) ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, ++ objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, + systemBus, cpuConfigs, sensorConfigs); +@@ -792,7 +830,7 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, + objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, +-- +2.17.1 + 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 c00b5d4cf..361e425e5 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 = "6b6891c52e550c42507d4b413cbc4c6a09235535" +SRCREV = "13b63f8f597d396db8b5bd182ac2e5814d599e2f" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ @@ -11,6 +11,7 @@ SRC_URI += "\ file://0003-Fix-missing-threshold-de-assert-event-when-threshold.patch \ file://0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch \ file://0005-Fix-PECI-ioctl-number.patch \ + file://0006-CPUSensor-create-RequirediTempSensor-if-defined.patch \ " DEPENDS_append = " libgpiod libmctp" 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 c77e5ace6..adcdd0588 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 = "32ea1e19df9e5179054d87617468664367dfab80" +SRCREV = "4f4f122790b999dc7db973a80727dbc1ca785e57" 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/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 0dae2be3c..e0e10f7b7 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 = "291d6388e0b770e89091935bc4edc7f371874666" +SRCREV = "52639bebada24990c3514786d65598dc5557477a" 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 42f23dd9e..34a93fb6c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,6 +1,6 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "f763c9e3bbe0f86a4a41e7bb0dc70bffde0af9b2" +SRCREV = "32859b634e366a015331fb8ab62766340df9c7b8" -EXTRA_OEMESON += " -Dmax-reports=5" +EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" -EXTRA_OEMESON += " -Dmin-interval=5000" +EXTRA_OEMESON += " -Dmin-interval=1000" 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 c9f14f54c..43fd25df4 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 = "18c1b42c1612e0e8d8f5cd9973bba09b447c7185" +SRCREV = "e6500a493a156dd58a92b384c77aef2cbd3addac" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch index a634b1588..07ac95c89 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -1,4 +1,4 @@ -From 67797d726b6eb6fa8e1dad063c7d2021cec47ab3 Mon Sep 17 00:00:00 2001 +From 5760937ef1ae9a4610b47ba64fdebe594fc2c9df Mon Sep 17 00:00:00 2001 From: James Feist Date: Mon, 17 Jun 2019 12:00:58 -0700 Subject: [PATCH] Customize phosphor-watchdog for Intel platforms @@ -22,14 +22,14 @@ Signed-off-by: Sunita Kumari %% original patch: 0001-Customize-phosphor-watchdog-for-Intel-platforms.patch --- - watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++++++--- - watchdog.hpp | 23 +++++- + src/watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++--- + src/watchdog.hpp | 23 ++++- 2 files changed, 242 insertions(+), 11 deletions(-) -diff --git a/watchdog.cpp b/watchdog.cpp -index 57e9050..1204db4 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp +diff --git a/src/watchdog.cpp b/src/watchdog.cpp +index 57e905059153..1204db4cab0f 100644 +--- a/src/watchdog.cpp ++++ b/src/watchdog.cpp @@ -1,11 +1,14 @@ #include "watchdog.hpp" @@ -300,10 +300,10 @@ index 57e9050..1204db4 100644 } catch (const SdBusError& e) { -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..b004b7a 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp +diff --git a/src/watchdog.hpp b/src/watchdog.hpp +index 7de9bb38419c..b004b7ab4e3f 100644 +--- a/src/watchdog.hpp ++++ b/src/watchdog.hpp @@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits WatchdogInherits(bus, objPath), bus(bus), actionTargetMap(std::move(actionTargetMap)), 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 7ebf1d4d6..618f4dddb 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,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "5ed21f2d1e8b82be699a623bfdef550dfd598dbb" +SRCREV = "71114feb9a800d42f6eeddfa477077a8ab8e44f6" do_compile_prepend() { cp -vf ${S}/.env.intel ${S}/.env diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch index 83f015a76..dc7f7b924 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch +++ b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch @@ -23,7 +23,7 @@ diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c index 0ed3984..804ad78 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c -@@ -525,6 +525,7 @@ static int +@@ -787,6 +787,7 @@ static int curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) { struct curl_handle *h = handle; @@ -31,10 +31,10 @@ index 0ed3984..804ad78 100644 CURLcode r; char range[128]; -@@ -535,15 +536,21 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) +@@ -800,15 +801,21 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) h->read_count = count; - curl_easy_setopt (h->c, CURLOPT_UPLOAD, 1); + curl_easy_setopt (h->c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (h->c, CURLOPT_CUSTOMREQUEST, "PATCH"); /* Make an HTTP range request. */ @@ -55,7 +55,7 @@ index 0ed3984..804ad78 100644 display_curl_error (h, r, "pwrite: curl_easy_perform"); return -1; } -@@ -554,6 +561,10 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) +@@ -819,6 +826,10 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) /* As far as I understand the cURL API, this should never happen. */ assert (h->read_count == 0); 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 index c597cb3a4..cec2813e9 100644 --- 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 @@ -3,14 +3,14 @@ index 610511f7..92be4656 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c @@ -69,6 +69,8 @@ static const char *proxy = NULL; - static char *proxy_password = NULL; - static const char *proxy_user = NULL; - static bool sslverify = true; -+static const char *ssl_version = NULL; -+static const char *ssl_cipher_list = NULL; - static bool tcp_keepalive = false; - static bool tcp_nodelay = true; - static uint32_t timeout = 0; + 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; } 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 01b3fc27e..89072b090 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 @@ -7,14 +7,14 @@ nbdkit is a toolkit for creating NBD servers." HOMEPAGE = "https://github.com/libguestfs/nbdkit" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://LICENSE;md5=4332a97808994cf2133a65b6c6f33eaf" +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" -PV = "1.17.5+git${SRCPV}" -SRCREV = "c8406880c6603bb617dae131dd0a8826c05869ca" +PV = "1.25.5+git${SRCPV}" +SRCREV = "c828c6d48ff6b69454cad98054a1920d03c4b4c7" S = "${WORKDIR}/git" -- cgit v1.2.3