summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2021-01-27 22:47:14 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2021-01-28 02:23:52 +0300
commit7c5f8839ec3d71a2170b8f3514a16a67c69d1c7c (patch)
tree729dbf87ba33bf4d83b5d95496ce18f99a61ef03
parent98cc5cd6483975b64d80e8323f7f659dd1337d75 (diff)
downloadopenbmc-7c5f8839ec3d71a2170b8f3514a16a67c69d1c7c.tar.xz
Update to internal 0.29
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
-rw-r--r--meta-openbmc-mods/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-ast2500/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-ast2500/conf/machine/include/obmc-bsp-si-common.inc4
-rw-r--r--meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json2
-rw-r--r--meta-openbmc-mods/meta-ast2600/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-ast2600/conf/machine/include/obmc-bsp-si-common.inc6
-rw-r--r--meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch40
-rw-r--r--meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch44
-rw-r--r--meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common-small/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch67
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0002-hw-arm-aspeed-Add-an-intel-ast2600-machine-type.patch65
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0003-Remove-clearing-aspeed-GPIO-registers.patch30
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-native_%.bbappend9
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-system-native_%.bbappend28
-rw-r--r--meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu_%.bbappend6
-rw-r--r--meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass5
-rw-r--r--meta-openbmc-mods/meta-common/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb6
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend3
-rw-r--r--meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg1
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check20
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp35
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch457
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0029-Add-D-Bus-interfaces-for-PLDM-FW-update.patch494
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0030-Add-PLDM-version-purpose-enumeration.patch28
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0032-update-meson-build-for-MCTP-interfaces.patch266
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0033-update-meson-build-for-PLDM-FWU-interfaces.patch441
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Fix-crash-issue-due-to-throw-undefined-error.patch38
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend10
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/fwupd@.service2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch850
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch154
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch62
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch139
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch57
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch75
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch813
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch683
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch598
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch72
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch709
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch171
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch330
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch539
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README19
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend17
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch41
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts.bbappend4
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init85
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend6
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb12
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf3
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service11
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-support/boost/boost_%.bbappend4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-support/curl/curl_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/files/CMakeLists.txt7
-rw-r--r--meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/i3c-tools.bb25
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend2
-rw-r--r--meta-openbmc-mods/meta-wht/conf/layer.conf2
-rw-r--r--meta-openbmc-mods/meta-wolfpass/conf/layer.conf2
87 files changed, 5600 insertions, 2077 deletions
diff --git a/meta-openbmc-mods/conf/layer.conf b/meta-openbmc-mods/conf/layer.conf
index 74814fc36..3cda98b4e 100644
--- a/meta-openbmc-mods/conf/layer.conf
+++ b/meta-openbmc-mods/conf/layer.conf
@@ -8,7 +8,7 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "intel-openbmc"
BBFILE_PATTERN_intel-openbmc = "^${LAYERDIR}/"
BBFILE_PRIORITY_intel-openbmc = "5"
-LAYERSERIES_COMPAT_intel-openbmc = "zeus dunfell"
+LAYERSERIES_COMPAT_intel-openbmc = "dunfell gatesgarth"
IMAGE_FEATURES[validitems] += "tools-sdk tools-debug validation-unsecure"
diff --git a/meta-openbmc-mods/meta-ast2500/conf/layer.conf b/meta-openbmc-mods/meta-ast2500/conf/layer.conf
index 5a5051d2e..544cacc05 100644
--- a/meta-openbmc-mods/meta-ast2500/conf/layer.conf
+++ b/meta-openbmc-mods/meta-ast2500/conf/layer.conf
@@ -9,7 +9,7 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "ast2500"
BBFILE_PATTERN_ast2500 = ""
BBFILE_PRIORITY_ast2500 = "4"
-LAYERSERIES_COMPAT_ast2500 = "zeus dunfell"
+LAYERSERIES_COMPAT_ast2500 = "dunfell gatesgarth"
INHERIT += "extrausers"
#INHERIT += " cve-check"
diff --git a/meta-openbmc-mods/meta-ast2500/conf/machine/include/obmc-bsp-si-common.inc b/meta-openbmc-mods/meta-ast2500/conf/machine/include/obmc-bsp-si-common.inc
index 3ad449118..0690d6b56 100644
--- a/meta-openbmc-mods/meta-ast2500/conf/machine/include/obmc-bsp-si-common.inc
+++ b/meta-openbmc-mods/meta-ast2500/conf/machine/include/obmc-bsp-si-common.inc
@@ -38,6 +38,8 @@ QB_SYSTEM_NAME = "qemu-system-arm"
QB_DEFAULT_FSTYPE = "mtd"
QB_ROOTFS_OPT = "-drive file=@ROOTFS@,format=raw,if=mtd"
QB_MACHINE = "-M intel-ast2500"
-QB_OPT_APPEND += " -nographic"
+QB_OPT_APPEND += " -nographic -serial mon:stdio -serial none"
QB_NETWORK_DEVICE = "-net nic,macaddr=C0:FF:EE:00:00:02,model=ftgmac100"
QB_DEFAULT_KERNEL = "none"
+QB_RNG = ""
+QB_MEM = "512"
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 909c47621..3b7c531ff 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
@@ -813,7 +813,7 @@
"Type": "IpmbSensor"
},
{
- "Address": "0xDC",
+ "Address": "0xE0",
"Class": "PxeBridgeTemp",
"Name": "CPU1 VR Mem ABCD Temp",
"Thresholds": [
diff --git a/meta-openbmc-mods/meta-ast2600/conf/layer.conf b/meta-openbmc-mods/meta-ast2600/conf/layer.conf
index e269ae5a5..967bff8c7 100644
--- a/meta-openbmc-mods/meta-ast2600/conf/layer.conf
+++ b/meta-openbmc-mods/meta-ast2600/conf/layer.conf
@@ -9,7 +9,7 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "ast2600"
BBFILE_PATTERN_ast2600 = ""
BBFILE_PRIORITY_ast2600 = "4"
-LAYERSERIES_COMPAT_ast2600 = "zeus dunfell"
+LAYERSERIES_COMPAT_ast2600 = "dunfell gatesgarth"
INHERIT += "extrausers"
#INHERIT += " cve-check"
diff --git a/meta-openbmc-mods/meta-ast2600/conf/machine/include/obmc-bsp-si-common.inc b/meta-openbmc-mods/meta-ast2600/conf/machine/include/obmc-bsp-si-common.inc
index f5a0d9ad0..06e4a2ed3 100644
--- a/meta-openbmc-mods/meta-ast2600/conf/machine/include/obmc-bsp-si-common.inc
+++ b/meta-openbmc-mods/meta-ast2600/conf/machine/include/obmc-bsp-si-common.inc
@@ -7,6 +7,7 @@ EXTRA_IMAGEDEPENDS += "u-boot"
IMAGE_FSTYPES += "squashfs-xz"
IMAGE_FSTYPES += "mtd-auto"
+INITRAMFS_FSTYPES = "squashfs-xz"
EXTRA_IMAGECMD_squashfs-xz_append = "-processors ${BB_NUMBER_THREADS} -b 262144 -Xdict-size 100% -Xbcj arm"
KERNEL_CLASSES ?= "kernel-fitimage"
@@ -36,6 +37,9 @@ QB_SYSTEM_NAME = "qemu-system-arm"
QB_DEFAULT_FSTYPE = "mtd"
QB_ROOTFS_OPT = "-drive file=@ROOTFS@,format=raw,if=mtd"
QB_MACHINE = "-M intel-ast2600"
-QB_OPT_APPEND += " -nographic"
+QB_OPT_APPEND += " -nographic -serial mon:stdio -serial none"
+QB_OPT_APPEND += " -global driver=aspeed.gpio-ast2600,property=gpioC0,value=true"
QB_NETWORK_DEVICE = "-net nic,macaddr=C0:FF:EE:00:00:02,model=ftgmac100"
QB_DEFAULT_KERNEL = "none"
+QB_RNG = ""
+QB_MEM = "1024"
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
new file mode 100644
index 000000000..8cc95174f
--- /dev/null
+++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-Enable-PCIe-L1-support.patch
@@ -0,0 +1,40 @@
+From 1f95d121b4a11444bffd0494bcfff1986e0905b6 Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+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 <jae.hyun.yoo@intel.com>
+---
+ 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
new file mode 100644
index 000000000..119db1318
--- /dev/null
+++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0025-ast2600-PFR-platform-EXTRST-reset-mask-selection.patch
@@ -0,0 +1,44 @@
+From 298f34e528c3e64e5e10403380832df91f986f12 Mon Sep 17 00:00:00 2001
+From: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
+Date: Tue, 8 Dec 2020 10:44:53 +0000
+Subject: [PATCH] ast2600:PFR platform - EXTRST# reset mask selection
+
+This is a fix taken from Purely PFR.
+This commit will enable specific reset mask for EXTRST# signal.
+On PFR platforms, EXTRST# signal is used by PFR CPLD to put BMC
+in reset during firmware authentications, recovery and firmware
+update flow, during which certain modules of BMC should be chosen
+to be reset so that Host functionality would be intact.
+
+Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
+---
+ arch/arm/mach-aspeed/ast2600/platform.S | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S
+index cd8a57edd7..6756aee804 100644
+--- a/arch/arm/mach-aspeed/ast2600/platform.S
++++ b/arch/arm/mach-aspeed/ast2600/platform.S
+@@ -39,6 +39,7 @@
+ #define AST_SCU_REV_ID (AST_SCU_BASE + 0x014)
+ #define AST_SCU_SYSRST_CTRL (AST_SCU_BASE + 0x040)
+ #define AST_SCU_SYSRST_CTRL_CLR (AST_SCU_BASE + 0x044)
++#define AST_SCU_EXTRST_SEL (AST_SCU_BASE + 0x060)
+ #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 +286,11 @@ wait_lock:
+ str r1, [r0]
+
+ 1:
++ /* SCU060:EXTRST# reset mask selection */
++ ldr r0, =AST_SCU_EXTRST_SEL
++ ldr r1, =0x00FF1FF5
++ str r1, [r0]
++
+ /* disable eSPI, LPC and PWM resets on WDT1 reset */
+ ldr r0, =AST_WDT1_RESET_MASK2
+ ldr r1, [r0]
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend
index 4f0d75c12..3747fbdfb 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
@@ -30,6 +30,8 @@ SRC_URI_append_intel-ast2600 = " \
file://0022-Reboot-into-UBOOT-on-Watchdog-Failures.patch \
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 \
"
# CVE-2020-10648 vulnerability fix
diff --git a/meta-openbmc-mods/meta-common-small/conf/layer.conf b/meta-openbmc-mods/meta-common-small/conf/layer.conf
index a3c2fb4e7..2c2bf025b 100644
--- a/meta-openbmc-mods/meta-common-small/conf/layer.conf
+++ b/meta-openbmc-mods/meta-common-small/conf/layer.conf
@@ -8,4 +8,4 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "common-small"
BBFILE_PATTERN_common-small = "^${LAYERDIR}/"
BBFILE_PRIORITY_common-small = "10"
-LAYERSERIES_COMPAT_common-small = "zeus dunfell"
+LAYERSERIES_COMPAT_common-small = "dunfell gatesgarth"
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch
index deccc47f3..4db72085d 100644
--- a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch
+++ b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch
@@ -1,6 +1,6 @@
-From 2ad1d60c39a2a9a08bcd29188362efba4e92e546 Mon Sep 17 00:00:00 2001
-From: "Jason M. Bills" <jason.m.bills@linux.intel.com>
-Date: Tue, 9 Apr 2019 16:18:07 -0700
+From 48aa1135cffd72d2c2f4067f3e96ae25d6dbfc30 Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Mon, 16 Nov 2020 15:48:04 +0100
Subject: [PATCH] hw/arm/aspeed: Add an intel-ast2500 machine type
Include the HW strap setting and some I2C temperature sensors.
@@ -8,17 +8,17 @@ Include the HW strap setting and some I2C temperature sensors.
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Signed-off-by: James Feist <james.feist@linux.intel.com>
---
- hw/arm/aspeed.c | 42 ++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 42 insertions(+)
+ hw/arm/aspeed.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 54 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
-index 6f4d707..5a9d58b 100644
+index fcb1a7cd..514dca85 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
-@@ -64,6 +64,21 @@ struct AspeedBoardState {
+@@ -68,6 +68,21 @@ struct AspeedMachineState {
SCU_HW_STRAP_MAC0_RGMII) & \
~SCU_HW_STRAP_2ND_BOOT_WDT)
-
+
+/* intel ast2500 hardware value: 0xF3CCC286 */
+#define INTEL_AST2500_BMC_HW_STRAP1 (( \
+ AST2500_HW_STRAP1_DEFAULTS | \
@@ -37,35 +37,35 @@ index 6f4d707..5a9d58b 100644
/* Romulus hardware value: 0xF10AD206 */
#define ROMULUS_BMC_HW_STRAP1 ( \
AST2500_HW_STRAP1_DEFAULTS | \
-@@ -396,6 +411,24 @@ static void ast2600_evb_i2c_init(AspeedBoardState *bmc)
- ast2500_evb_i2c_init(bmc);
+@@ -417,6 +432,24 @@ static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
+ i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
}
-
-+static void intel_ast2500_i2c_init(AspeedBoardState *bmc)
+
++static void intel_ast2500_i2c_init(AspeedMachineState *bmc)
+{
+ AspeedSoCState *soc = &bmc->soc;
+ DeviceState *dev;
+
-+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 6), "tmp421", 0x4d);
-+ object_property_set_int(OBJECT(dev), 50000, "temperature0", &error_abort);
++ dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4d));
++ object_property_set_int(OBJECT(dev), "temperature0", 50000, &error_abort);
+ /* The s2600wf expects a TMP75 but a TMP105 is compatible */
-+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 6), "tmp105", 0x48);
-+ object_property_set_int(OBJECT(dev), 50000, "temperature", &error_abort);
-+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 6), "tmp105", 0x49);
-+ object_property_set_int(OBJECT(dev), 50000, "temperature", &error_abort);
-+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 6), "tmp105", 0x4a);
-+ object_property_set_int(OBJECT(dev), 50000, "temperature", &error_abort);
-+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 6), "tmp105", 0x4b);
-+ object_property_set_int(OBJECT(dev), 50000, "temperature", &error_abort);
++ dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x48));
++ object_property_set_int(OBJECT(dev), "temperature", 50000, &error_abort);
++ dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x49));
++ object_property_set_int(OBJECT(dev), "temperature", 50000, &error_abort);
++ dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x4a));
++ object_property_set_int(OBJECT(dev), "temperature", 50000, &error_abort);
++ dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x4b));
++ object_property_set_int(OBJECT(dev), "temperature", 50000, &error_abort);
+}
+
- static void romulus_bmc_i2c_init(AspeedBoardState *bmc)
+ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
{
- AspeedSoCState *soc = &bmc->soc;
-@@ -537,6 +570,21 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
- mc->default_ram_size = 512 * MiB;
+ /* Start with some devices on our I2C busses */
+@@ -620,6 +653,23 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
+ aspeed_soc_num_cpus(amc->soc_name);
};
-
+
+static void aspeed_machine_intel_ast2500_class_init(ObjectClass *oc, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
@@ -79,22 +79,21 @@ index 6f4d707..5a9d58b 100644
+ amc->num_cs = 1;
+ amc->i2c_init = intel_ast2500_i2c_init;
+ mc->default_ram_size = 512 * MiB;
++ mc->default_cpus = mc->min_cpus = mc->max_cpus =
++ aspeed_soc_num_cpus(amc->soc_name);
+};
+
static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
-@@ -624,6 +672,10 @@ static const TypeInfo aspeed_machine_types[] = {
+@@ -735,6 +785,10 @@ static const TypeInfo aspeed_machine_types[] = {
+ .name = MACHINE_TYPE_NAME("ast2500-evb"),
.parent = TYPE_ASPEED_MACHINE,
.class_init = aspeed_machine_ast2500_evb_class_init,
- }, {
++ }, {
+ .name = MACHINE_TYPE_NAME("intel-ast2500"),
+ .parent = TYPE_ASPEED_MACHINE,
+ .class_init = aspeed_machine_intel_ast2500_class_init,
-+ }, {
+ }, {
.name = MACHINE_TYPE_NAME("romulus-bmc"),
.parent = TYPE_ASPEED_MACHINE,
- .class_init = aspeed_machine_romulus_class_init,
---
-2.17.1
-
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0002-hw-arm-aspeed-Add-an-intel-ast2600-machine-type.patch b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0002-hw-arm-aspeed-Add-an-intel-ast2600-machine-type.patch
new file mode 100644
index 000000000..2d5bd8faa
--- /dev/null
+++ b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0002-hw-arm-aspeed-Add-an-intel-ast2600-machine-type.patch
@@ -0,0 +1,65 @@
+From 165f4bc884b9f9ed5bf568f5b930dba6835a2edd Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Mon, 16 Nov 2020 15:52:12 +0100
+Subject: [PATCH] hw/arm/aspeed: Add an intel-ast2600 machine type
+
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+---
+ hw/arm/aspeed.c | 27 +++++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
+index 514dca85..be9e1455 100644
+--- a/hw/arm/aspeed.c
++++ b/hw/arm/aspeed.c
+@@ -126,6 +126,10 @@ struct AspeedMachineState {
+ #define AST2600_EVB_HW_STRAP1 0x000000C0
+ #define AST2600_EVB_HW_STRAP2 0x00000003
+
++/* Intel AST2600 hardware value */
++#define INTEL_AST2600_HW_STRAP1 0x00000000
++#define INTEL_AST2600_HW_STRAP2 0x00000040
++
+ /* Tacoma hardware value */
+ #define TACOMA_BMC_HW_STRAP1 0x00000000
+ #define TACOMA_BMC_HW_STRAP2 0x00000040
+@@ -670,6 +674,25 @@ static void aspeed_machine_intel_ast2500_class_init(ObjectClass *oc, void *data)
+ aspeed_soc_num_cpus(amc->soc_name);
+ };
+
++static void aspeed_machine_intel_ast2600_class_init(ObjectClass *oc, void *data)
++{
++ MachineClass *mc = MACHINE_CLASS(oc);
++ AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
++
++ mc->desc = "Intel AST2600 BMC (Cortex A7)";
++ amc->soc_name = "ast2600-a1";
++ amc->hw_strap1 = INTEL_AST2600_HW_STRAP1;
++ amc->hw_strap2 = INTEL_AST2600_HW_STRAP2;
++ amc->fmc_model = "n25q512a";
++ amc->spi_model = "n25q512a";
++ amc->num_cs = 1;
++ amc->macs_mask = ASPEED_MAC1_ON | ASPEED_MAC2_ON | ASPEED_MAC3_ON;
++ amc->i2c_init = intel_ast2500_i2c_init;
++ mc->default_ram_size = 1 * GiB;
++ mc->default_cpus = mc->min_cpus = mc->max_cpus =
++ aspeed_soc_num_cpus(amc->soc_name);
++};
++
+ static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data)
+ {
+ MachineClass *mc = MACHINE_CLASS(oc);
+@@ -789,6 +812,10 @@ static const TypeInfo aspeed_machine_types[] = {
+ .name = MACHINE_TYPE_NAME("intel-ast2500"),
+ .parent = TYPE_ASPEED_MACHINE,
+ .class_init = aspeed_machine_intel_ast2500_class_init,
++ }, {
++ .name = MACHINE_TYPE_NAME("intel-ast2600"),
++ .parent = TYPE_ASPEED_MACHINE,
++ .class_init = aspeed_machine_intel_ast2600_class_init,
+ }, {
+ .name = MACHINE_TYPE_NAME("romulus-bmc"),
+ .parent = TYPE_ASPEED_MACHINE,
+--
+2.16.6
+
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0003-Remove-clearing-aspeed-GPIO-registers.patch b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0003-Remove-clearing-aspeed-GPIO-registers.patch
new file mode 100644
index 000000000..d1e9752a5
--- /dev/null
+++ b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/files/0003-Remove-clearing-aspeed-GPIO-registers.patch
@@ -0,0 +1,30 @@
+From c0f3add0f49818992f752d04f33204ee1f27e885 Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Mon, 30 Nov 2020 14:32:52 +0100
+Subject: [PATCH] Remove clearing aspeed GPIO registers
+
+Removed clearing aspeed GPIO registers to omit clearing set GPIO
+lines at machine initialization. It does not affect aspeed
+simulation. intel-ast machines boot with success.
+
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+---
+ hw/gpio/aspeed_gpio.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
+index 985a259e05..9f93a10887 100644
+--- a/hw/gpio/aspeed_gpio.c
++++ b/hw/gpio/aspeed_gpio.c
+@@ -830,7 +830,7 @@ static void aspeed_gpio_reset(DeviceState *dev)
+ AspeedGPIOState *s = ASPEED_GPIO(dev);
+
+ /* TODO: respect the reset tolerance registers */
+- memset(s->sets, 0, sizeof(s->sets));
++ //memset(s->sets, 0, sizeof(s->sets));
+ }
+
+ static void aspeed_gpio_realize(DeviceState *dev, Error **errp)
+--
+2.16.6
+
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-native_%.bbappend b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-native_%.bbappend
deleted file mode 100644
index d9fed5138..000000000
--- a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-native_%.bbappend
+++ /dev/null
@@ -1,9 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI = "git://github.com/openbmc/qemu.git;nobranch=1 \
- file://0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch"
-
-QEMU_TARGETS = "arm"
-
-S = "${WORKDIR}/git"
-SRCREV = "8ab0db0624b454bd69a04ca0010f165cb7119100"
-PACKAGECONFIG[libudev] = ""
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-system-native_%.bbappend b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-system-native_%.bbappend
index f8c8c66c1..fea29b586 100644
--- a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-system-native_%.bbappend
+++ b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu-system-native_%.bbappend
@@ -1,9 +1,25 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI = "git://github.com/openbmc/qemu.git;nobranch=1 \
- file://powerpc_rom.bin \
- file://0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch"
+SRC_URI += "file://0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch \
+ file://0002-hw-arm-aspeed-Add-an-intel-ast2600-machine-type.patch \
+ file://0003-Remove-clearing-aspeed-GPIO-registers.patch"
QEMU_TARGETS = "arm"
-
-S = "${WORKDIR}/git"
-SRCREV = "8ab0db0624b454bd69a04ca0010f165cb7119100"
+EXTRA_OECONF = " \
+ --prefix=${prefix} \
+ --bindir=${bindir} \
+ --includedir=${includedir} \
+ --libdir=${libdir} \
+ --mandir=${mandir} \
+ --datadir=${datadir} \
+ --docdir=${docdir}/${BPN} \
+ --sysconfdir=${sysconfdir} \
+ --libexecdir=${libexecdir} \
+ --localstatedir=${localstatedir} \
+ --with-confsuffix=/${BPN} \
+ --disable-strip \
+ --disable-werror \
+ --extra-cflags='${CFLAGS}' \
+ --extra-ldflags='${LDFLAGS}' \
+ --python=${HOSTTOOLS_DIR}/python3 \
+ ${PACKAGECONFIG_CONFARGS} \
+ "
diff --git a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu_%.bbappend b/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu_%.bbappend
deleted file mode 100644
index cfc1a3ace..000000000
--- a/meta-openbmc-mods/meta-common-small/recipes-devtools/qemu/qemu_%.bbappend
+++ /dev/null
@@ -1,6 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI = "git://github.com/openbmc/qemu.git;nobranch=1 \
- file://0001-hw-arm-aspeed-Add-an-intel-ast2500-machine-type.patch"
-
-S = "${WORKDIR}/git"
-SRCREV = "8ab0db0624b454bd69a04ca0010f165cb7119100"
diff --git a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass
index d2dc904b7..6d029c8b4 100644
--- a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass
+++ b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass
@@ -2,6 +2,7 @@ inherit obmc-phosphor-image
IMAGE_FEATURES += " \
obmc-bmc-state-mgmt \
+ obmc-bmcweb \
obmc-chassis-mgmt \
obmc-chassis-state-mgmt \
obmc-devtools \
@@ -30,7 +31,6 @@ IMAGE_FEATURES += " \
"
IMAGE_INSTALL_append = " \
- bmcweb \
dbus-broker \
entity-manager \
fru-device \
@@ -47,6 +47,7 @@ IMAGE_INSTALL_append = " \
phosphor-sel-logger \
smbios-mdrv2 \
obmc-ikvm \
+ system-watchdog \
frb2-watchdog \
srvcfg-manager \
callback-manager \
@@ -73,6 +74,8 @@ IMAGE_INSTALL_append = " \
virtual-media \
enable-nics \
host-misc-comm-manager \
+ telemetry \
+ i3c-tools \
"
IMAGE_INSTALL_append = " ${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'pfr-manager', '', d)}"
diff --git a/meta-openbmc-mods/meta-common/conf/layer.conf b/meta-openbmc-mods/meta-common/conf/layer.conf
index b1b7642ed..5b6da2d48 100644
--- a/meta-openbmc-mods/meta-common/conf/layer.conf
+++ b/meta-openbmc-mods/meta-common/conf/layer.conf
@@ -8,4 +8,4 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "common"
BBFILE_PATTERN_common = "^${LAYERDIR}/"
BBFILE_PRIORITY_common = "10"
-LAYERSERIES_COMPAT_common = "zeus dunfell"
+LAYERSERIES_COMPAT_common = "dunfell gatesgarth"
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 b9e1411bc..c7503ef35 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 = "c2b833e40ddb858a94734f77a0bd761b76733c65"
+SRCREV = "b9fd597ca42b290a97a259d2d5a089981c25e72c"
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 ff3387bf6..f268ad691 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 = "aedf5a9efe124853b3c722e155fea931befce89d"
+SRCREV = "6d6dc7ad721268a66adecca423716ce9fcf3838b"
diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf
new file mode 100644
index 000000000..e73e47129
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf
@@ -0,0 +1,2 @@
+x /tmp/.rwfs - - - -
+x /tmp/.overlay - - - -
diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb
index 420fc258b..fa74149d4 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb
+++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb
@@ -4,6 +4,7 @@ DESCRIPTION = "Script to periodically sync the overlay to NV storage"
S = "${WORKDIR}"
SRC_URI = "file://nv-sync.service \
file://nv-syncd \
+ file://nv-sync-tmp.conf \
"
LICENSE = "Apache-2.0"
@@ -13,13 +14,16 @@ inherit systemd
RDEPENDS_${PN} += "bash"
-FILES_${PN} += "${systemd_system_unitdir}/nv-sync.service"
+FILES_${PN} += "${systemd_system_unitdir}/nv-sync.service \
+ ${libdir}/tmpfiles.d/nv-sync-tmp.conf"
do_install() {
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/nv-sync.service ${D}${systemd_system_unitdir}
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/nv-syncd ${D}${bindir}/nv-syncd
+ install -d ${D}${libdir}/tmpfiles.d
+ install -m 0644 ${WORKDIR}/nv-sync-tmp.conf ${D}${libdir}/tmpfiles.d/
}
SYSTEMD_SERVICE_${PN} += " nv-sync.service"
diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend
index ac5fcee66..19843d892 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend
@@ -1,4 +1,4 @@
-# add some configuration overrides for systemd default /usr/lib/tmpfiles.d/
+# add some configuration overrides for systemd defaults
LICENSE = "GPL-2.0"
@@ -16,3 +16,4 @@ do_install_append(){
}
PACKAGECONFIG_remove = " kmod"
+PACKAGECONFIG_append = " logind"
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 05474eead..de947b627 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 = "bef41f6ec4097a8ee094f90a1b34a708fbd757ec"
+SRCREV = "242fda806d16f06890fb61339aa0a585443af8bb"
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 b161868f2..ed4ab4930 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 = "c66735b6e99f69a00c2b5a0b286eb1c37251ccca"
+SRCREV = "291d6388e0b770e89091935bc4edc7f371874666"
PV = "0.1+git${SRCPV}"
LICENSE = "Apache-2.0"
diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb
index 7acc19f46..c28d6a789 100644
--- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb
+++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb
@@ -12,7 +12,7 @@ SRC_URI = "git://git@github.com/Intel-BMC/blocksign;protocol=ssh"
SRCREV = "966d16f680c1b14c338640d35a12d5e2f9a6937a"
-S = "${WORKDIR}/git/"
+S = "${WORKDIR}/git"
do_install_append() {
install -d ${D}/${bindir}
diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb
index 2a0e970f6..34352acef 100644
--- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb
+++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb
@@ -4,7 +4,7 @@ DESCRIPTION = "SMBIOS MDR version 1 service for Intel based platfrom"
SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh;nobranch=1"
SRCREV = "6aab8bcc8fd0550753c87265036b1b7c4c8a9f71"
-S = "${WORKDIR}/git/services/smbios/"
+S = "${WORKDIR}/git/services/smbios"
PV = "1.0+git${SRCPV}"
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 9c5e37650..ef2c2fc20 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 = "49609c2484c4b90d7e2de979d440868a34843818"
+SRCREV = "ef55ef0590fc44e3b633635456f782999896b8ad"
S = "${WORKDIR}/git"
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg
index 5b2e178b2..21bfcf792 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg
@@ -90,3 +90,4 @@ CONFIG_USB_EHCI_ROOT_HUB_TT=n
CONFIG_USB_EHCI_HCD_PLATFORM=n
CONFIG_IPMB_DEVICE_INTERFACE=y
CONFIG_BPF_SYSCALL=n
+CONFIG_IPV6_SIT=n
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 4875050a9..b01cd0d24 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
@@ -4,7 +4,7 @@ KBRANCH = "dev-5.8-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.8-intel"
-SRCREV="9f71530c30ebbec6fc5267475b5517add7ad40ce"
+SRCREV="fc4c626deff9447cd5453b180826ed4f48fc828d"
do_compile_prepend(){
# device tree compiler flags
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 7e81ad63a..2578785b4 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
@@ -18,7 +18,7 @@ SOFS_MACDIR=${SOFS_MNT}/factory-settings/network/mac
read_hw_mac() {
local iface="$1"
- cat /sys/class/net/"$iface"/address 2>/dev/null
+ cat /sys/class/net/"$iface"/address 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null
}
set_hw_mac() {
@@ -33,12 +33,12 @@ set_hw_mac() {
read_sofs_mac() {
local iface="$1"
- cat "${SOFS_MACDIR}/${iface}" 2>/dev/null
+ cat "${SOFS_MACDIR}/${iface}" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null
}
read_fw_env_mac() {
local envname="$1"
- fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//"
+ fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null
}
set_fw_env_mac() {
@@ -97,10 +97,16 @@ error=0
first_error_seen=0
while read IFACE UBDEV; do
- mac_check "$IFACE" "$UBDEV"
- error=$?
- if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then
- first_error_seen=$error
+ # Try to configure the MAC address if the kernel finds the NIC. Blindly
+ # trying all of the interfaces listed in the DOCSTRING (END_CONF) below
+ # may result in first_error_seen being set to a non-zero value. If that
+ # happens the journal log will report the error, which is undesirable.
+ if [ -h /sys/class/net/$IFACE ]; then
+ mac_check "$IFACE" "$UBDEV"
+ error=$?
+ if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then
+ first_error_seen=$error
+ fi
fi
done <<-END_CONF
eth0 eth1addr
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 8f112e334..2f1f1dc6a 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend
@@ -1,6 +1,6 @@
# this is here just to bump faster than upstream
# SRC_URI = "git://github.com/openbmc/entity-manager.git"
-SRCREV = "e1ecc1adc93021db7521042dde2866b1901a8648"
+SRCREV = "c7c5de795cf672797ae35965e95642dd1fc39363"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
index 3d0b7fd98..00e2b53fe 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp
@@ -19,6 +19,7 @@
#include <boost/asio/steady_timer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <chrono>
+#include <filesystem>
#include <iostream>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/object_server.hpp>
@@ -29,6 +30,7 @@ extern "C" {
static constexpr uint32_t syncIntervalNormalMS = 60000;
static constexpr uint32_t syncIntervalFastMS = (syncIntervalNormalMS / 2);
+static constexpr uint32_t syncIntervalBootMS = 5000;
static uint32_t syncIntervalMS = syncIntervalNormalMS;
@@ -37,6 +39,7 @@ static constexpr uint8_t timeDiffAllowedSecond = 1;
static uint8_t pchDevI2cBusNo = 0;
static uint8_t pchDevI2cSlaveAddr = 0;
static bool getPCHI2cAddrFlag = false;
+static constexpr const char* clockFile = "/var/lib/systemd/timesync/clock";
static inline uint8_t bcd2Decimal(uint8_t hex)
{
uint8_t dec = ((hex & 0xF0) >> 4) * 10 + (hex & 0x0F);
@@ -250,6 +253,26 @@ class PCHSync
return true;
}
+ bool updateClockFileTimestamp()
+ {
+ if (!std::filesystem::exists(clockFile))
+ {
+ phosphor::logging::log<phosphor::logging::level::WARNING>(
+ "The systemd timestamp synchronization file doesn't exist: ",
+ phosphor::logging::entry("PATHNAME=%s", clockFile));
+ return false;
+ }
+ int rc = utimensat(AT_FDCWD, clockFile, nullptr, 0);
+ if (rc)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "utimensat systemd timestamp synchronization file fail: ",
+ phosphor::logging::entry("PATHNAME=%s", clockFile),
+ phosphor::logging::entry("ERRCODE=%x", errno));
+ return false;
+ }
+ return true;
+ }
bool setSystemTime(uint32_t timeSeconds)
{
struct timespec sTime = {0};
@@ -305,12 +328,20 @@ class PCHSync
phosphor::logging::entry("TIME=%s", dateString.c_str()));
}
+ // During the boot time, systemd-timesyncd.service checks
+ // "/var/lib/systemd/timesync/clock" and updates the system time with
+ // the timestamp of the file
+ if (!updateClockFileTimestamp())
+ {
+ return false;
+ }
+
return true;
}
void startSyncTimer(std::shared_ptr<sdbusplus::asio::connection>& conn)
{
- // retry 10 times (10 * 30 sec = 5min ) to get the pch timer
+ // retry 10 times (10 * 5s = 50s ) to get the pch timer
// configuration.
static uint8_t retrytimes = 10;
if (!getPCHI2cAddrFlag)
@@ -321,7 +352,7 @@ class PCHSync
"Get pch timer configuration fail");
return;
}
- syncIntervalMS = syncIntervalFastMS;
+ syncIntervalMS = syncIntervalBootMS;
getPCHTimerConfiguration(conn);
retrytimes--;
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch
new file mode 100644
index 000000000..e6afc0117
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch
@@ -0,0 +1,457 @@
+From 65d1772312a76ebfdac6391bb97287c62f18c43f Mon Sep 17 00:00:00 2001
+From: "Kowalski, Mariusz" <mariusz.kowalski@intel.com>
+Date: Thu, 27 Feb 2020 15:48:56 +0100
+Subject: [PATCH] MCTP Daemon D-Bus interface definition.
+
+This interface definition was created on base of the MCTP design
+proposed in this document:
+https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/28424/9/designs/mctp.md
+
+Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com>
+Signed-off-by: Mariusz Kowalski <mariusz.kowalski@intel.com>
+Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
+Change-Id: Ida66f8ffcf00003655edcb0fb0112202797b8e1a
+---
+ xyz/openbmc_project/MCTP/Base.interface.yaml | 227 ++++++++++++++++++
+ .../MCTP/Binding/PCIe.interface.yaml | 29 +++
+ .../MCTP/Binding/SMBus.interface.yaml | 17 ++
+ .../MCTP/BusOwner.interface.yaml | 17 ++
+ .../MCTP/Endpoint.interface.yaml | 13 +
+ xyz/openbmc_project/MCTP/README.md | 43 ++++
+ .../MCTP/SupportedMessageTypes.interface.yaml | 36 +++
+ 7 files changed, 382 insertions(+)
+ create mode 100644 xyz/openbmc_project/MCTP/Base.interface.yaml
+ create mode 100644 xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml
+ create mode 100644 xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml
+ create mode 100644 xyz/openbmc_project/MCTP/BusOwner.interface.yaml
+ create mode 100644 xyz/openbmc_project/MCTP/Endpoint.interface.yaml
+ create mode 100644 xyz/openbmc_project/MCTP/README.md
+ create mode 100644 xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml
+
+diff --git a/xyz/openbmc_project/MCTP/Base.interface.yaml b/xyz/openbmc_project/MCTP/Base.interface.yaml
+new file mode 100644
+index 0000000..9438551
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/Base.interface.yaml
+@@ -0,0 +1,227 @@
++description: >
++ Mandatory interface for each instance of the MCTP Daemon to expose
++ the base MCTP daemon and medium type interfaces.
++
++methods:
++ - name: SendMctpMessagePayload
++ description: >
++ Sends message over MCTP interface
++ parameters:
++ - name: DestinationEID
++ type: byte
++ description: >
++ Destination Endpoint ID. The logical address used to route MCTP
++ messages to a specific MCTP endpoint.
++ - name: MsgTag
++ type: byte
++ description: >
++ Message tag. Field that, along with the Source Endpoint IDs and the
++ Tag Owner (TO) field, identifies a unique message at the MCTP
++ transport level.
++ - name: TagOwner
++ type: boolean
++ description: >
++ Tag Owner bit identifies whether the message tag was originated by
++ the endpoint that is the source of the message or by the endpoint
++ that is the destination of the message.
++ - name: Payload
++ type: array[byte]
++ description: Payload of message.
++ returns:
++ - name: Status
++ type: byte
++ description: 0 - if success
++ errors:
++ - xyz.openbmc_project.Common.Error.Timeout
++ - xyz.openbmc_project.Common.Error.InvalidArgument
++ - xyz.openbmc_project.Common.Error.InternalFailure
++
++ - name: SendMctpMessageFileDescriptor
++ description: >
++ Sends message over MCTP interface
++ parameters:
++ - name: DestinationEID
++ type: byte
++ description: >
++ Destination Endpoint ID. The logical address used to route MCTP
++ messages to a specific MCTP endpoint.
++ - name: MsgTag
++ type: byte
++ description: >
++ Message tag. Field that, along with the Source Endpoint IDs and the
++ Tag Owner (TO) field, identifies a unique message at the MCTP
++ transport level.
++ - name: TagOwner
++ type: boolean
++ description: >
++ Tag Owner bit identifies whether the message tag was originated by
++ the endpoint that is the source of the message or by the endpoint
++ that is the destination of the message.
++ - name: FileDescriptor
++ type: unixfd
++ description: File descriptor of message.
++ returns:
++ - name: Status
++ type: byte
++ description: 0 - if success
++ errors:
++ - xyz.openbmc_project.Common.Error.Timeout
++ - xyz.openbmc_project.Common.Error.InvalidArgument
++ - xyz.openbmc_project.Common.Error.InternalFailure
++
++signals:
++ - name: MessageReceivedSignal
++ description: >
++ Signal indicating upper layers about arrival of a MCTP message.
++ properties:
++ - name: MessageType
++ type: enum[self.MessageTypes]
++ description: >
++ Defines the values for the Message Type field for different message
++ types transported through MCTP.
++ - name: SrcEid
++ type: byte
++ description: >
++ Source Endpoint ID. The logical address used to route MCTP messages
++ to a specific MCTP endpoint.
++ - name: MsgTag
++ type: byte
++ description: >
++ Message tag. Field that, along with the Source Endpoint IDs and the
++ Tag Owner (TO) field, identifies a unique message at the MCTP
++ transport level.
++ - name: TagOwner
++ type: boolean
++ description: >
++ Tag Owner bit identifies whether the message tag was originated by
++ the endpoint that is the source of the message or by the endpoint
++ that is the destination of the message.
++ - name: Payload
++ type: array[byte]
++ description: Payload of message.
++
++properties:
++ - name: Eid
++ type: byte
++ description: >
++ Endpoint ID. The logical address used to route MCTP messages to a
++ specific MCTP endpoint.
++
++ - name: BindingID
++ type: enum[self.BindingTypes]
++
++ - name: BindingMediumID
++ type: enum[self.MctpPhysicalMediumIdentifiers]
++
++ - name: StaticEid
++ type: boolean
++ description: Support for statically/dynamicly allocated IDs
++
++ - name: BindingMode
++ type: enum[self.BindingModeTypes]
++ description: Bus Owner / Endpoint / Bridge
++
++enumerations:
++ - name: BindingTypes
++ description: >
++ All other values than described are reserved.
++ values:
++ - name: MctpOverSmbus
++ - name: MctpOverPcieVdm
++ - name: MctpOverUsb
++ description: Reserved for MCTP over USB
++ - name: MctpOverKcs
++ - name: MctpOverSerial
++ - name: VendorDefined
++
++ - name: MctpPhysicalMediumIdentifiers
++ description: >
++ Identifies MCTP physical medium identifiers. see DSP0239.
++ values:
++ - name: Smbus
++ descritpion: SMBus 2.0 100 kHz compatible
++ - name: SmbusI2c
++ descritpion: SMBus 2.0 + I2C 100 kHz compatible
++ - name: I2cCompatible
++ description: I2C 100 kHz compatible (Standard-mode)
++ - name: Smbus3OrI2c400khzCompatible
++ description: SMBus 3.0 or I2C 400 kHz compatible (Fast-mode)
++ - name: Smbus3OrI2c1MhzCompatible
++ description: SMBus 3.0 or I2C 1 MHz compatible (Fast-mode Plus)
++ - name: I2c3Mhz4Compatible
++ description: I2C 3.4 MHz compatible (High-speed mode)
++ - name: Pcie11
++ description: PCIe revision 1.1 compatible
++ - name: Pcie2
++ description: PCIe revision 2.0 compatible
++ - name: Pcie21
++ description: PCIe revision 2.1 compatible
++ - name: Pcie3
++ description: PCIe revision 3.0 compatible
++ - name: Pcie4
++ description: PCIe revision 4.0 compatible
++ - name: Pcie5
++ description: PCIe revision 4.0 compatible
++ - name: PciCompatible
++ description: >
++ PCI compatible (PCI 1.0,2.0,2.1,2.2,2.3,3.0,PCI-X 1.0, PCI-X 2.0)
++ - name: Usb11Compatible
++ description: USB 1.1 compatible
++ - name: Usb20Compatible
++ description: USB 2.0 compatible
++ - name: Usb30Compatible
++ description: USB 3.0 compatible
++ - name: NcSiOverRbt
++ description: >
++ NC-SI over RBT (A physical interface based on RMII as defined in
++ DSP0222)
++ - name: KcsLegacy
++ description: KCS1 / Legacy (Fixed Address Decoding)
++ - name: KcsPci
++ description: KCS1 / PCI (Base Class 0xC0 Subclass 0x01)
++ - name: SerialHostLegacy
++ description: Serial Host2 / Legacy (Fixed Address Decoding)
++ - name: SerialHostPci
++ description: Serial Host2 / PCI (Base Class 0x07 Subclass 0x00)
++ - name: AsynchronousSerial
++ description: Asynchronous Serial (Between MCs and IMDs)
++ - name: I3cSDR
++ description: I3C 12.5 MHz compatible (SDR)
++ - name: I3cHDRDDR
++ description: I3C 25 MHz compatible (HDR-DDR)
++
++ - name: BindingModeTypes
++ values:
++ - name: Endpoint
++ description: >
++ An MCTP communication terminus. An MCTP endpoint is a terminus or
++ origin of MCTP packets or messages. That is, the combined
++ functionality within a physical device that communicates using the
++ MCTP transport protocol and handles MCTP control commands. This
++ includes MCTP-capable management controllers and managed devices.
++ Also referred to in this document as "endpoint".
++ - name: BusOwner
++ description: >
++ The party responsible for managing address assignments (can be
++ logical or physical addresses) on a bus (for example, in MCTP, the
++ bus owner is the party responsible for managing EID assignments for
++ a given bus). A bus owner may also have additional media-specific
++ responsibilities, such as assignment of physical addresses.
++ - name: Bridge
++ description: >
++ An MCTP endpoint that can route MCTP messages not destined for
++ itself that it receives on one interconnect onto another without
++ interpreting them. The ingress and egress media at the bridge may
++ be either homogeneous or heterogeneous. Also referred to in this
++ document as a "bridge".
++
++ - name: MessageTypes
++ values:
++ - name: MctpControl
++ - name: PLDM
++ - name: NCSI
++ - name: Ethernet
++ - name: NVMeMgmtMsg
++ - name: SPDM
++ - name: VDPCI
++ - name: VDIANA
+diff --git a/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml b/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml
+new file mode 100644
+index 0000000..1bd2881
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml
+@@ -0,0 +1,29 @@
++description: >
++ Interface exposed by MCTP daemon for PCIe binding
++
++properties:
++ - name: DiscoveredFlag
++ type: enum[self.DiscoveryFlags]
++ description: >
++ Each endpoint (except the bus owner) on the PCIe bus maintains an
++ internal flag called the Discovered flag. The flag is set to the
++ discovered state when the Set Endpoint ID command is received.
++
++ - name: BDF
++ type: uint16
++ description: >
++ Byte 1 [7:0] Bus number
++ Byte 2 [7:3] Device number [2:0] Function Number
++
++enumerations:
++ - name: DiscoveryFlags
++ description: >
++ The Prepare for Endpoint Discovery message causes each recipient
++ endpoint on the PCIe bus to set their respective Discovered flag to
++ the undiscovered state. For the Prepare for Endpoint Discovery request
++ message, the routing in the physical transport header should be set to
++ 011b (Broadcast from Root Complex).
++ values:
++ - name: Discovered
++ - name: Undiscovered
++ - name: NotApplicable
+diff --git a/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml b/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml
+new file mode 100644
+index 0000000..9219ad0
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml
+@@ -0,0 +1,17 @@
++description: >
++ Interface exposed by MCTP daemon for SMBus binding
++
++properties:
++ - name: ArpMasterSupport
++ type: boolean
++ description: >
++ The SMBus binding can also run ARP Master protocol and
++ assign SMBus addresses to the devices on the bus.
++
++ - name: BusNumber
++ type: byte
++ description: I2C bus number of the medium used
++
++ - name: SlaveAddress
++ type: byte
++ description: Slave address to be used for this medium
+diff --git a/xyz/openbmc_project/MCTP/BusOwner.interface.yaml b/xyz/openbmc_project/MCTP/BusOwner.interface.yaml
+new file mode 100644
+index 0000000..d46298e
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/BusOwner.interface.yaml
+@@ -0,0 +1,17 @@
++description: >
++ Interface exposed by MCTP root object, when executing in Bus Owner mode.
++
++properties:
++ - name: EidPool
++ type: array[struct[byte, byte]]
++ description: >
++ Pool of allowed EIDs to be used.
++ EID pool of 10-100 can be specified as {{10,100}}.
++
++ - name: TopMostBusOwner
++ type: boolean
++ description: To indicate whether BMC is topmost Bus Owner
++
++ - name: OwnEidPool
++ type: boolean
++ description: Indicates Eid pool is managed by self
+diff --git a/xyz/openbmc_project/MCTP/Endpoint.interface.yaml b/xyz/openbmc_project/MCTP/Endpoint.interface.yaml
+new file mode 100644
+index 0000000..e4ba4d0
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/Endpoint.interface.yaml
+@@ -0,0 +1,13 @@
++description:
++ Interface exposed by discovered MCTP endpoints.
++
++properties:
++ - name: Mode
++ type: enum[xyz.openbmc_project.MCTP.Base.BindingModeTypes]
++ description: Endpoint / BusOwner / Bridge
++
++ - name: NetworkId
++ type: uint16
++ description: >
++ MCTP network ID a unique identifier to distinguish each independent
++ MCTP network within a platform.
+diff --git a/xyz/openbmc_project/MCTP/README.md b/xyz/openbmc_project/MCTP/README.md
+new file mode 100644
+index 0000000..c819dbb
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/README.md
+@@ -0,0 +1,43 @@
++# MCTP Daemon
++
++## Overview
++MCTP service exposes D-Bus methods / properties / signals for managing
++MCTP devices or work as MCTP Endpoint. MCTP daemon will either
++work in Bus Owner or Endpoint mode for the specified physical medium.
++
++### MCTP service
++MCTP service can be started either in Bus Owner mode or Endpoint mode.
++It will expose following objects.
++1. Base object
++2. MCTP Endpoints (discovered in case of Bus Owner mode, queried using
++routing table in case of Endpoint mode)
++Please refer individual yaml file for details about the
++methods / signals / properties exposed in the interfaces.
++
++#### Base object
++Exposed under the path `/xyz/openbmc_project/mctp` with the following
++interfaces.
++1. `xyz.openbmc_project.MCTP.Base` which exposes all the common properties
++needed for MCTP Daemon.
++2. `xyz.openbmc_project.MCTP.BusOwner` available only in Bus Owner mode
++which exposes the properties needed by Bus Owner MCTP Daemon.
++3. `xyz.openbmc_project.MCTP.SupportedMessageTypes` which exposes the message
++types supported.
++4. Binding interface `xyz.openbmc_project.MCTP.Binding.PCIe` or
++`xyz.openbmc_project.MCTP.Binding.SMBus` as per the physical medium in which
++this MCTP Daemon is instantiated.
++5. Common UUID interface `xyz.openbmc_project.Common.UUID` which exposes UUID
++in RFC4122 format.
++
++#### Endpoint object
++Exposed under the path `/xyz/openbmc_project/mctp/device/<eid>` with the
++following interfaces.
++1. `xyz.openbmc_project.MCTP.SupportedMessageTypes` which exposes supported MCTP
++message types for the discovered MCTP Endpoint.
++2. `xyz.openbmc_project.MCTP.Endpoint` which exposes properties like Network ID
++and endpoint mode (to identify Bus Owner or Bridge or Endpoint) for the discovered
++MCTP Endpoint.
++3. `xyz.openbmc_project.MCTP.Bridge` available only for discovered MCTP Bridges to
++expose properties like EID pool. (TBD)
++4. Common UUID interface `xyz.openbmc_project.Common.UUID` which exposes UUID
++in RFC4122 format.
+diff --git a/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml b/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml
+new file mode 100644
+index 0000000..fa447ee
+--- /dev/null
++++ b/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml
+@@ -0,0 +1,36 @@
++description:
++ Interface used to represent the supported MCTP message types.
++ This will be exposed by all MCTP endpoints.
++
++properties:
++ - name: MctpControl
++ type: boolean
++ description: Indicates support availability
++
++ - name: PLDM
++ type: boolean
++ description: Indicates support availability
++
++ - name: NCSI
++ type: boolean
++ description: Indicates support availability
++
++ - name: Ethernet
++ type: boolean
++ description: Indicates support availability
++
++ - name: NVMeMgmtMsg
++ type: boolean
++ description: Indicates support availability
++
++ - name: SPDM
++ type: boolean
++ description: Indicates support availability
++
++ - name: VDPCI
++ type: boolean
++ description: Indicates support availability
++
++ - name: VDIANA
++ type: boolean
++ description: Indicates support availability
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0029-Add-D-Bus-interfaces-for-PLDM-FW-update.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0029-Add-D-Bus-interfaces-for-PLDM-FW-update.patch
new file mode 100644
index 000000000..5ee550eaa
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0029-Add-D-Bus-interfaces-for-PLDM-FW-update.patch
@@ -0,0 +1,494 @@
+From e7ba5f63a551099e1b5f934683e163963f28f28e Mon Sep 17 00:00:00 2001
+From: "Gade-RajasekharReddy@" <raja.sekhar.reddy.gade@linux.intel.com>
+Date: Wed, 16 Sep 2020 03:19:41 +0530
+Subject: [PATCH] Add D-Bus interfaces for PLDM FW update
+
+Added PLDM FW update base interface, which exposes a method. Using
+this method PLDM FWU can be initiated.
+
+Added interfaces for exposing PLDM FW update inventory info.
+
+Test
+supporting files are created for the yaml files.
+
+Signed-off-by: Gade-RajasekharReddy@ <raja.sekhar.reddy.gade@linux.intel.com>
+---
+ .../PLDM/FWU/ACPIDescriptor.interface.yaml | 14 +++
+ ...ActiveComponentImageSetInfo.interface.yaml | 9 ++
+ .../FWU/ActiveComponentInfo.interface.yaml | 55 ++++++++++
+ .../CapabilitiesDuringUpdate.interface.yaml | 32 ++++++
+ .../ComponentActivationMethods.interface.yaml | 40 +++++++
+ .../PLDM/FWU/FWUBase.interface.yaml | 21 ++++
+ .../PLDM/FWU/IANADescriptor.interface.yaml | 10 ++
+ .../PLDM/FWU/PCIDescriptor.interface.yaml | 30 +++++
+ ...endingComponentImageSetInfo.interface.yaml | 10 ++
+ .../FWU/PendingComponentInfo.interface.yaml | 40 +++++++
+ .../PLDM/FWU/PnPDescriptor.interface.yaml | 14 +++
+ xyz/openbmc_project/PLDM/FWU/README.md | 103 ++++++++++++++++++
+ 12 files changed, 378 insertions(+)
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml
+ create mode 100644 xyz/openbmc_project/PLDM/FWU/README.md
+
+diff --git a/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml b/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml
+new file mode 100644
+index 0000000..e225bad
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml
+@@ -0,0 +1,14 @@
++description : >
++ This interface has ACPI descriptor properties.
++
++properties :
++
++ - name : ACPIVendorID
++ type : string
++ description: >
++ Property containing ACPI Vendor ID.
++
++ - name : ACPIProductIdentifier
++ type : string
++ description: >
++ Property containing ACPI Product Identifier.
+diff --git a/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml b/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml
+new file mode 100644
+index 0000000..94115a3
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml
+@@ -0,0 +1,9 @@
++description : >
++ This interface has the PLDM FWU active component image set properties.
++
++properties :
++
++ - name : ActiveComponentImageSetVersionString
++ type : string
++ description: >
++ String describing the active component image set version.
+diff --git a/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml b/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml
+new file mode 100644
+index 0000000..77a7566
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml
+@@ -0,0 +1,55 @@
++description: >
++ This interface has the component entries for all of the updatable
++ active components that reside on the FD.
++
++properties:
++
++ - name: ComponentClassification
++ type: uint16
++ description: >
++ Vendor specific component classification information.
++ Special values: 0x0000, 0xFFFF are reserved.
++
++ - name: ComponentIdentifier
++ type: uint16
++ description: >
++ FD vendor selected unique value to distinguish between
++ component images.
++
++ - name: ComponentClassificationIndex
++ type: byte
++ description: >
++ Used to distinguish identical components that have the same
++ classification and identifier that can use the same component
++ image but the images are stored in different locations in the FD.
++
++ - name: ActiveComponentComparisonStamp
++ type: uint32
++ description: >
++ Optional Firmware component comparison stamp that is currently
++ active. If the firmware component does not provide a component
++ comparison stamp, this value should be set to 0x00000000.
++
++ - name: ActiveComponentReleaseDate
++ type: string
++ description: >
++ Containing the date corresponding to the component version
++ level being reported – Format YYYYMMDD.
++ If the firmware component does not provide a date, this string
++ shall be empty.
++
++ - name: ComponentAutoApply
++ type: boolean
++ description: >
++ Firmware Device performs an ‘auto-apply’ during transfer
++ phase and apply step will be completed immediately if this
++ property is true.
++ Firmware Device will execute an operation during the APPLY
++ state that will include migrating the new component image to its
++ final non-volatile storage destination if this property is
++ false.
++
++ - name: ActiveComponentVersionString
++ type: string
++ description: >
++ String describing the active component version.
+diff --git a/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml b/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml
+new file mode 100644
+index 0000000..36560ff
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml
+@@ -0,0 +1,32 @@
++description : >
++ This interface describes the capabilities during update.
++
++properties :
++
++ - name : UpdateModeRestrictions
++ type : boolean
++ description: >
++ This property tells whether update mode restrictions are
++ supported or not.
++
++ - name : PartialUpdates
++ type : boolean
++ description: >
++ This property tells whether partial updates are supported or not.
++
++ - name : HostFunctionalityDuringFirmwareUpdate
++ type : boolean
++ description: >
++ This property tells whether the host device functionality
++ during firmware update is reduced or not.
++
++ - name : ComponentUpdateFailureRetryCapability
++ type : boolean
++ description: >
++ This property shows the component update failure retry capability.
++
++ - name : ComponentUpdateFailureRecoveryCapability
++ type : boolean
++ description: >
++ This property shows the component update failure recovery
++ capability.
+diff --git a/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml b/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml
+new file mode 100644
+index 0000000..d5ec47c
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml
+@@ -0,0 +1,40 @@
++description: >
++ This interface has the component activation methods.
++
++properties:
++
++ - name: ACPowerCycle
++ type: boolean
++ description: >
++ Property that tells whether AC power cycle is an activation
++ method or not.
++
++ - name: DCPowerCycle
++ type: boolean
++ description: >
++ Property that tells whether DC power cycle is an activation
++ method or not.
++
++ - name: SystemReboot
++ type: boolean
++ description: >
++ Property that tells whether System reboot is an activation
++ method or not.
++
++ - name: MediumSpecificReset
++ type: boolean
++ description: >
++ Property that tells whether Medium-specific reset is an
++ activation method or not.
++
++ - name: SelfContained
++ type: boolean
++ description: >
++ Property that tells whether Self-Contained option is activation
++ method or not.
++
++ - name: Automatic
++ type: boolean
++ description: >
++ Property that tells whether the component can be activated
++ automatically once apply completes.
+diff --git a/xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml b/xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml
+new file mode 100644
+index 0000000..2ba15e2
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml
+@@ -0,0 +1,21 @@
++description: >
++ This interface provides a method to initiate the PLDM FW update.
++
++methods:
++ - name: StartFWUpdate
++ description: >
++ This method initiates the PLDM FW update.
++ parameters:
++ - name: filePath
++ type: string
++ description: >
++ PLDM FW update package path.
++ returns:
++ - name: status
++ type: byte
++ description: >
++ PLDM FW update status.
++ errors:
++ - xyz.openbmc_project.Common.Error.NotAllowed
++ - xyz.openbmc_project.Common.Error.InvalidArgument
++ - xyz.openbmc_project.Common.Error.ResourceNotFound
+diff --git a/xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml b/xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml
+new file mode 100644
+index 0000000..c013955
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml
+@@ -0,0 +1,10 @@
++description : >
++ This interface has device identification info, in which IANA
++ Enterprise ID is used as descriptor.
++
++properties :
++
++ - name : IANAEnterpriseID
++ type : string
++ description: >
++ Property containing the IANA Enterprise ID.
+diff --git a/xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml b/xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml
+new file mode 100644
+index 0000000..8d758ed
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml
+@@ -0,0 +1,30 @@
++description : >
++ This interface has device identification info,in which PCI Vendor ID
++ is used as descriptor.
++
++properties :
++
++ - name : PCIVendorID
++ type : string
++ description: >
++ Property containing the PCI Vendor ID.
++
++ - name : PCIDeviceID
++ type : string
++ description: >
++ Property containing the PCI Device ID.
++
++ - name : PCISubsystemVendorID
++ type : string
++ description: >
++ Property containing the PCI Subsystem Vendor ID.
++
++ - name : PCISubsystemID
++ type : string
++ description: >
++ Property containing the PCI Subsystem ID.
++
++ - name : PCIRevisionID
++ type : string
++ description: >
++ Property containing the PCI Revision ID.
+diff --git a/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml b/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml
+new file mode 100644
+index 0000000..3861572
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml
+@@ -0,0 +1,10 @@
++description : >
++ This interface has the PLDM FWU pending component image set
++ properties.
++
++properties :
++
++ - name : PendingComponentImageSetVersionString
++ type : string
++ description: >
++ String describing the pending component image set version.
+diff --git a/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml b/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml
+new file mode 100644
+index 0000000..59a2ad8
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml
+@@ -0,0 +1,40 @@
++description: >
++ This interface has the component entries for all of the pending
++ components that reside on the FD.
++
++properties:
++
++ - name: PendingComponentComparisonStamp
++ type: uint32
++ description: >
++ Optional firmware component comparison stamp that is pending
++ activation. This field, and all other pending component fields,
++ are valid once the firmware device has received the
++ ActivateFirmware command to prepare the firmware component for
++ activation, but the activation method requires further action
++ to enable the pending image to become the actively running code
++ image.
++ If no pending firmware component exists, this value shall be
++ set to 0x00000000
++
++ - name: PendingComponentReleaseDate
++ type: string
++ description: >
++ Eight byte field containing the date corresponding to the
++ component version level being reported – Format YYYYMMDD.
++ If no pending firmware component exists, this string
++ shall be empty.
++
++
++ - name: PendingComponentVersionString
++ type: string
++ description: >
++ Firmware component version, which is pending activation. The
++ version reported here should be the one that will become active
++ on the next initialization or activation of the component. The
++ pending component version value may be same as the active
++ component version. Contains a variable type string describing
++ the pending component version. Refer to
++ PendingComponentComparisonStamp field for additional details.
++ If no pending firmware component exists, this field is zero
++ bytes in length.
+diff --git a/xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml b/xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml
+new file mode 100644
+index 0000000..801db6d
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml
+@@ -0,0 +1,14 @@
++description : >
++ This interface has PnP descriptor properties.
++
++properties :
++
++ - name : PnPVendorID
++ type : string
++ description: >
++ Property containing the PnP Vendor ID.
++
++ - name : PnPProductIdentifier
++ type : string
++ description: >
++ Property containing the PnP Product Identifier.
+diff --git a/xyz/openbmc_project/PLDM/FWU/README.md b/xyz/openbmc_project/PLDM/FWU/README.md
+new file mode 100644
+index 0000000..2931739
+--- /dev/null
++++ b/xyz/openbmc_project/PLDM/FWU/README.md
+@@ -0,0 +1,103 @@
++#PLDM FW Update
++
++##Overview
++
++The PLDM FW update package contains two major sections: the FW package
++header, and the FW package payload. The FW package header is required to
++describe the target device that the package is intended to update and
++the component images that the FW update package contains. The FW
++package payload is the actual FW image which can be used by FW device
++for FW update.
++
++Update Agent(BMC) will send the inventory commands to the all the
++devices which are capable of PLDM FW update and exposes the inventory
++info to the D-Bus. How PLDM FW update package reaches BMC is out of
++scope of PLDM FWU spec 1.0.1. Once BMC receives the FW package, it
++matches the package header with the inventory info, if matches proceeds
++for FW update.
++
++###PLDM FW update interfaces overview and hierarchy
++
++/xyz/openbmc_project/pldm/fwu
++|--xyz.openbmc_project.PLDM.FWU.FWUBase
++|
++|__/xyz/openbmc_project/pldm/fwu/<tid>
++ |
++ |__/xyz/openbmc_project/pldm/fwu/<tid>/deviceDescriptors
++ | |--xyz.openbmc_project.PLDM.FWU.PCIDescriptor
++ | |--xyz.openbmc_project.PLDM.FWU.IANADescriptor
++ | |--xyz.openbmc_project.PLDM.FWU.PnPDescriptor
++ | |--xyz.openbmc_project.PLDM.FWU.ACPIDescriptor
++ |
++ |__/xyz/openbmc_project/pldm/fwu/<tid>/componentImageSetInfo
++ | |--xyz.openbmc_project.PLDM.FWU.ActiveComponentImageSetInfo
++ | |--xyz.openbmc_project.PLDM.FWU.PendingComponentImageSetInfo
++ |
++ |__/xyz/openbmc_project/pldm/fwu/<tid>/componentImageSetInfo/component_<component_no>
++ |--xyz.openbmc_project.PLDM.FWU.ActiveComponentInfo
++ |--xyz.openbmc_project.PLDM.FWU.PendingComponentInfo
++ |--xyz.openbmc_project.PLDM.FWU.ComponentActivationMethods
++ |--xyz.openbmc_project.PLDM.FWU.CapabilitiesDuringUpdate
++
++Note:
++Descriptor for a device shall be defined by one of the following
++(PCI Vendor ID, IANA Enterprise ID, UUID, PnP Vendor ID, or ACPI Vendor
++ID) and the corresponding descriptor`s interface is exposed by the.
++Device Descriptors object.
++No new UUID descriptor incterface is defined as the existing UUID
++interface will be used.
++
++####FW Update Base
++It is exposed by the object `/xyz/openbmc_project/pldm/fwu` with the
++following interface
++1. `xyz.openbmc_project.pldm.FWUBase` exposes a method by which PLDM
++FWU can be initiated.
++
++Each FW update capable device info is exposed by the object
++`/xyz/openbmc_project/pldm/fwu/<tid>`.
++It will have the following objects.
++1. Device Descriptors
++2. Component Image Set Info
++3. Component Image Info (Each component is exposed as an object)
++
++####Device Descriptors
++Device Descriptors are exposed under the object path
++`/xyz/openbmc_project/pldm/fwu/deviceDescriptors` with one of the
++following interfaces.
++1. `xyz.openbmc_project.PLDM.FWU.PCIDescriptor` which exposes the PCI
++device descriptors. If the FD is a PCI device then this interface will
++be exposed by the device descriptors object.
++2. `xyz.openbmc_project.PLDM.FWU.IANADescriptor` which exposes IANA
++descriptor properties. If FD have IANA Enterprise ID as the descriptor
++type then this interface will be exposed by the device descriptors
++object.
++3. `xyz.openbmc_project.PLDM.FWU.PnPDescriptor` which exposes the Pnp
++descriptor properties. If FD have PnP vendor ID as the descriptor
++type then this interface will be exposed by the device descriptors
++object.
++4. `xyz.openbmc_project.PLDM.FWU.ACPIDescriptor` which exposes the ACPI
++descriptor properties. If FD have ACPI vendor ID as the descriptor
++type then this interface will be exposed by the device descriptors
++object.
++
++####Component Image Set Info
++Component Image Set Info is exposed under the object path
++`/xyz/openbmc_project/pldm/fwu/componentImageSetInfo` with the
++following interface.
++1. `xyz.openbmc_project.PLDM.FWU.ActiveComponentImageSetInfo` which
++exposes the active component image set properties.
++2. `xyz.openbmc_project.PLDM.FWU.PendingComponentImageSetInfo` which
++exposes the pending component image set properties.
++
++####Component Image Info
++Component Image Info is exposed under the object path
++`/xyz/openbmc_project/pldm/fwu/componentImageSetInfo/componentInfo_<component_no>'
++with the following interface
++1. `xyz.openbmc_project.PLDM.FWU.ActiveComponentInfo` which exposes the
++component Image properties.
++2. `xyz.openbmc_project.PLDM.FWU.PendingComponentInfo` which exposes the
++component Image properties.
++3. `xyz.openbmc_project.PLDM.FWU.CapabilitiesDuringUpdate` which exposes
++the capabilities of the component during update.
++4. `xyz.openbmc_project.PLDM.FWU.ComponentActivationMethods` which
++exposes the component activation methods.
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0030-Add-PLDM-version-purpose-enumeration.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0030-Add-PLDM-version-purpose-enumeration.patch
new file mode 100644
index 000000000..3a1ae57fb
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0030-Add-PLDM-version-purpose-enumeration.patch
@@ -0,0 +1,28 @@
+From 007c07561e03a005e90858f77266f4fba3e8e2c9 Mon Sep 17 00:00:00 2001
+From: Ayushi Smriti <smriti.ayushi@intel.com>
+Date: Wed, 23 Sep 2020 22:01:25 +0530
+Subject: [PATCH] Add PLDM version purpose enumeration
+
+This change is to add PLDM in enumeration of possible purposes
+of the version to support pldm type version purpose
+
+Change-Id: I7b914d4323bfe44a4e3cd60ed4a627aeceb6b56f
+Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
+---
+ xyz/openbmc_project/Software/Version.interface.yaml | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/xyz/openbmc_project/Software/Version.interface.yaml b/xyz/openbmc_project/Software/Version.interface.yaml
+index 345e5b5..f2efbec 100644
+--- a/xyz/openbmc_project/Software/Version.interface.yaml
++++ b/xyz/openbmc_project/Software/Version.interface.yaml
+@@ -38,3 +38,6 @@ enumerations:
+ - name: PSU
+ description: >
+ The version is a version for a PSU.
++ - name: PLDM
++ description: >
++ The version is a version for PLDM.
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0032-update-meson-build-for-MCTP-interfaces.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0032-update-meson-build-for-MCTP-interfaces.patch
new file mode 100644
index 000000000..5f41a1348
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0032-update-meson-build-for-MCTP-interfaces.patch
@@ -0,0 +1,266 @@
+From b25ae31fa674a287bc100081a9dfc243bcf53f19 Mon Sep 17 00:00:00 2001
+From: Zhikui Ren <zhikui.ren@intel.com>
+Date: Tue, 8 Dec 2020 15:16:25 -0800
+Subject: [PATCH] update meson build for MCTP interfaces
+
+Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
+---
+ gen/xyz/openbmc_project/MCTP/Base/meson.build | 14 +++++
+ .../MCTP/Binding/PCIe/meson.build | 14 +++++
+ .../MCTP/Binding/SMBus/meson.build | 14 +++++
+ .../openbmc_project/MCTP/Binding/meson.build | 31 ++++++++++
+ .../openbmc_project/MCTP/BusOwner/meson.build | 14 +++++
+ .../openbmc_project/MCTP/Endpoint/meson.build | 14 +++++
+ .../MCTP/SupportedMessageTypes/meson.build | 14 +++++
+ gen/xyz/openbmc_project/MCTP/meson.build | 62 +++++++++++++++++++
+ gen/xyz/openbmc_project/meson.build | 1 +
+ 9 files changed, 178 insertions(+)
+ create mode 100644 gen/xyz/openbmc_project/MCTP/Base/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/Binding/PCIe/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/Binding/SMBus/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/Binding/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/BusOwner/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/Endpoint/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/SupportedMessageTypes/meson.build
+ create mode 100644 gen/xyz/openbmc_project/MCTP/meson.build
+
+diff --git a/gen/xyz/openbmc_project/MCTP/Base/meson.build b/gen/xyz/openbmc_project/MCTP/Base/meson.build
+new file mode 100644
+index 0000000..81aeb86
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/Base/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/Base__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Base.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Base',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/Binding/PCIe/meson.build b/gen/xyz/openbmc_project/MCTP/Binding/PCIe/meson.build
+new file mode 100644
+index 0000000..0da866c
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/Binding/PCIe/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/Binding/PCIe__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Binding/PCIe',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/Binding/SMBus/meson.build b/gen/xyz/openbmc_project/MCTP/Binding/SMBus/meson.build
+new file mode 100644
+index 0000000..a0f97bd
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/Binding/SMBus/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/Binding/SMBus__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Binding/SMBus',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/Binding/meson.build b/gen/xyz/openbmc_project/MCTP/Binding/meson.build
+new file mode 100644
+index 0000000..6e3407c
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/Binding/meson.build
+@@ -0,0 +1,31 @@
++# Generated file; do not modify.
++subdir('PCIe')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/Binding/PCIe__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml', ],
++ output: [ 'PCIe.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Binding/PCIe',
++ ],
++ build_by_default: true,
++)
++
++subdir('SMBus')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/Binding/SMBus__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml', ],
++ output: [ 'SMBus.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Binding/SMBus',
++ ],
++ build_by_default: true,
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/BusOwner/meson.build b/gen/xyz/openbmc_project/MCTP/BusOwner/meson.build
+new file mode 100644
+index 0000000..190a640
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/BusOwner/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/BusOwner__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/BusOwner.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/BusOwner',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build b/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build
+new file mode 100644
+index 0000000..cababfb
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/Endpoint__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Endpoint.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Endpoint',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/SupportedMessageTypes/meson.build b/gen/xyz/openbmc_project/MCTP/SupportedMessageTypes/meson.build
+new file mode 100644
+index 0000000..f58fa44
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/SupportedMessageTypes/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/MCTP/SupportedMessageTypes__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/SupportedMessageTypes',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/MCTP/meson.build b/gen/xyz/openbmc_project/MCTP/meson.build
+new file mode 100644
+index 0000000..94ab2c2
+--- /dev/null
++++ b/gen/xyz/openbmc_project/MCTP/meson.build
+@@ -0,0 +1,62 @@
++# Generated file; do not modify.
++subdir('Base')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/Base__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Base.interface.yaml', ],
++ output: [ 'Base.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Base',
++ ],
++ build_by_default: true,
++)
++
++subdir('Binding')
++subdir('BusOwner')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/BusOwner__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/BusOwner.interface.yaml', ],
++ output: [ 'BusOwner.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/BusOwner',
++ ],
++ build_by_default: true,
++)
++
++subdir('Endpoint')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/Endpoint__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/Endpoint.interface.yaml', ],
++ output: [ 'Endpoint.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/Endpoint',
++ ],
++ build_by_default: true,
++)
++
++subdir('SupportedMessageTypes')
++generated_others += custom_target(
++ 'xyz/openbmc_project/MCTP/SupportedMessageTypes__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml', ],
++ output: [ 'SupportedMessageTypes.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/MCTP/SupportedMessageTypes',
++ ],
++ build_by_default: true,
++)
++
+diff --git a/gen/xyz/openbmc_project/meson.build b/gen/xyz/openbmc_project/meson.build
+index 3c4750f..e4372b0 100644
+--- a/gen/xyz/openbmc_project/meson.build
++++ b/gen/xyz/openbmc_project/meson.build
+@@ -68,6 +68,7 @@ generated_others += custom_target(
+ subdir('Ipmi')
+ subdir('Led')
+ subdir('Logging')
++subdir('MCTP')
+ subdir('Memory')
+ subdir('Network')
+ subdir('Nvme')
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0033-update-meson-build-for-PLDM-FWU-interfaces.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0033-update-meson-build-for-PLDM-FWU-interfaces.patch
new file mode 100644
index 000000000..9d3a8f197
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0033-update-meson-build-for-PLDM-FWU-interfaces.patch
@@ -0,0 +1,441 @@
+From 32d4d17843bcc96a6d17b3d975fc92fac82ef081 Mon Sep 17 00:00:00 2001
+From: Zhikui Ren <zhikui.ren@intel.com>
+Date: Tue, 8 Dec 2020 15:28:42 -0800
+Subject: [PATCH] update meson build for PLDM FWU interfaces
+
+Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
+---
+ .../PLDM/FWU/ACPIDescriptor/meson.build | 14 ++
+ .../ActiveComponentImageSetInfo/meson.build | 14 ++
+ .../PLDM/FWU/ActiveComponentInfo/meson.build | 14 ++
+ .../FWU/CapabilitiesDuringUpdate/meson.build | 14 ++
+ .../ComponentActivationMethods/meson.build | 14 ++
+ .../PLDM/FWU/FWUBase/meson.build | 14 ++
+ .../PLDM/FWU/IANADescriptor/meson.build | 14 ++
+ .../PLDM/FWU/PCIDescriptor/meson.build | 14 ++
+ .../PendingComponentImageSetInfo/meson.build | 14 ++
+ .../PLDM/FWU/PendingComponentInfo/meson.build | 14 ++
+ .../PLDM/FWU/PnPDescriptor/meson.build | 14 ++
+ gen/xyz/openbmc_project/PLDM/FWU/meson.build | 166 ++++++++++++++++++
+ gen/xyz/openbmc_project/PLDM/meson.build | 1 +
+ 13 files changed, 321 insertions(+)
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/FWUBase/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/IANADescriptor/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/PCIDescriptor/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/PnPDescriptor/meson.build
+ create mode 100644 gen/xyz/openbmc_project/PLDM/FWU/meson.build
+
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor/meson.build
+new file mode 100644
+index 0000000..2ec794d
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/ACPIDescriptor/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo/meson.build
+new file mode 100644
+index 0000000..d415ec9
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo/meson.build
+new file mode 100644
+index 0000000..e2be862
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate/meson.build
+new file mode 100644
+index 0000000..62d9894
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods/meson.build
+new file mode 100644
+index 0000000..2e379b6
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/FWUBase/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/FWUBase/meson.build
+new file mode 100644
+index 0000000..149662b
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/FWUBase/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/FWUBase__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/FWUBase',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/IANADescriptor/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/IANADescriptor/meson.build
+new file mode 100644
+index 0000000..6661829
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/IANADescriptor/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/IANADescriptor__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/IANADescriptor',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/PCIDescriptor/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/PCIDescriptor/meson.build
+new file mode 100644
+index 0000000..00f54e2
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/PCIDescriptor/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo/meson.build
+new file mode 100644
+index 0000000..5349f0f
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo/meson.build
+new file mode 100644
+index 0000000..5c44acf
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/PendingComponentInfo/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/PnPDescriptor/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/PnPDescriptor/meson.build
+new file mode 100644
+index 0000000..d77e841
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/PnPDescriptor/meson.build
+@@ -0,0 +1,14 @@
++# Generated file; do not modify.
++generated_sources += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor__cpp'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml', ],
++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'cpp',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor',
++ ],
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/FWU/meson.build b/gen/xyz/openbmc_project/PLDM/FWU/meson.build
+new file mode 100644
+index 0000000..27e89fc
+--- /dev/null
++++ b/gen/xyz/openbmc_project/PLDM/FWU/meson.build
+@@ -0,0 +1,166 @@
++# Generated file; do not modify.
++subdir('ACPIDescriptor')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor.interface.yaml', ],
++ output: [ 'ACPIDescriptor.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ACPIDescriptor',
++ ],
++ build_by_default: true,
++)
++
++subdir('ActiveComponentImageSetInfo')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo.interface.yaml', ],
++ output: [ 'ActiveComponentImageSetInfo.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentImageSetInfo',
++ ],
++ build_by_default: true,
++)
++
++subdir('ActiveComponentInfo')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo.interface.yaml', ],
++ output: [ 'ActiveComponentInfo.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ActiveComponentInfo',
++ ],
++ build_by_default: true,
++)
++
++subdir('CapabilitiesDuringUpdate')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate.interface.yaml', ],
++ output: [ 'CapabilitiesDuringUpdate.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/CapabilitiesDuringUpdate',
++ ],
++ build_by_default: true,
++)
++
++subdir('ComponentActivationMethods')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods.interface.yaml', ],
++ output: [ 'ComponentActivationMethods.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/ComponentActivationMethods',
++ ],
++ build_by_default: true,
++)
++
++subdir('FWUBase')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/FWUBase__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/FWUBase.interface.yaml', ],
++ output: [ 'FWUBase.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/FWUBase',
++ ],
++ build_by_default: true,
++)
++
++subdir('IANADescriptor')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/IANADescriptor__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/IANADescriptor.interface.yaml', ],
++ output: [ 'IANADescriptor.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/IANADescriptor',
++ ],
++ build_by_default: true,
++)
++
++subdir('PCIDescriptor')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor.interface.yaml', ],
++ output: [ 'PCIDescriptor.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PCIDescriptor',
++ ],
++ build_by_default: true,
++)
++
++subdir('PendingComponentImageSetInfo')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo.interface.yaml', ],
++ output: [ 'PendingComponentImageSetInfo.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentImageSetInfo',
++ ],
++ build_by_default: true,
++)
++
++subdir('PendingComponentInfo')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo.interface.yaml', ],
++ output: [ 'PendingComponentInfo.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PendingComponentInfo',
++ ],
++ build_by_default: true,
++)
++
++subdir('PnPDescriptor')
++generated_others += custom_target(
++ 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor__markdown'.underscorify(),
++ input: [ meson.source_root() / 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor.interface.yaml', ],
++ output: [ 'PnPDescriptor.md' ],
++ command: [
++ sdbuspp_gen_meson_prog, '--command', 'markdown',
++ '--output', meson.current_build_dir(),
++ '--tool', sdbusplusplus_prog,
++ '--directory', meson.source_root(),
++ 'xyz/openbmc_project/PLDM/FWU/PnPDescriptor',
++ ],
++ build_by_default: true,
++)
++
+diff --git a/gen/xyz/openbmc_project/PLDM/meson.build b/gen/xyz/openbmc_project/PLDM/meson.build
+index 9087286..02e4234 100644
+--- a/gen/xyz/openbmc_project/PLDM/meson.build
++++ b/gen/xyz/openbmc_project/PLDM/meson.build
+@@ -14,6 +14,7 @@ generated_others += custom_target(
+ build_by_default: true,
+ )
+
++subdir('FWU')
+ subdir('PDR')
+ generated_others += custom_target(
+ 'xyz/openbmc_project/PLDM/PDR__markdown'.underscorify(),
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Fix-crash-issue-due-to-throw-undefined-error.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Fix-crash-issue-due-to-throw-undefined-error.patch
new file mode 100644
index 000000000..98c3873dd
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Fix-crash-issue-due-to-throw-undefined-error.patch
@@ -0,0 +1,38 @@
+From df0e7c1414b793a36e34a5875e4196a3a45704a5 Mon Sep 17 00:00:00 2001
+From: Kuiying Wang <kuiying.wang@intel.com>
+Date: Mon, 21 Dec 2020 23:09:33 +0800
+Subject: [PATCH] Fix crash issue due to throw undefined error
+
+Below 3 error is used by bios config manager daemon.
+xyz.openbmc_project.Common.Error.InvalidArgument
+xyz.openbmc_project.BIOSConfig.Common.Error.AttributeNotFound
+xyz.openbmc_project.BIOSConfig.Common.Error.AttributeReadOnl
+
+Tested:
+bios config manager daemon could throw these 3 error,
+but not crash any more.
+
+Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
+---
+ xyz/openbmc_project/BIOSConfig/Manager.interface.yaml | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml b/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml
+index 225ccaa..98daf3a 100644
+--- a/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml
++++ b/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml
+@@ -109,7 +109,10 @@ properties:
+ ex- { {"QuietBoot",Type.Integer, 0x1},
+ { "DdrFreqLimit",Type.String,"2933"}
+ }
+-
++ errors:
++ - xyz.openbmc_project.Common.Error.InvalidArgument
++ - xyz.openbmc_project.BIOSConfig.Common.Error.AttributeNotFound
++ - xyz.openbmc_project.BIOSConfig.Common.Error.AttributeReadOnly
+
+ enumerations:
+ - name: AttributeType
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
index b7ed97255..f947b19c0 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
@@ -1,5 +1,7 @@
+# Keep this as a comment to enable the auto-bump script without
+# stomping on SRC_URI from previous .bbappend files
#SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git"
-SRCREV = "395ba2176054745ff453f056e0593d3c2d802ea8"
+SRCREV = "6be85da9193d5c529b49fbf9345507e0be2b9477"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
@@ -10,5 +12,11 @@ SRC_URI += "file://0007-ipmi-set-BIOS-id.patch \
file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \
file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \
file://0026-Add-StandbySpare-support-for-software-inventory.patch \
+ file://0028-MCTP-Daemon-D-Bus-interface-definition.patch \
+ file://0029-Add-D-Bus-interfaces-for-PLDM-FW-update.patch \
file://0031-update-meson-build-files-for-control-and-bios.patch \
+ file://0030-Add-PLDM-version-purpose-enumeration.patch \
+ file://0032-update-meson-build-for-MCTP-interfaces.patch \
+ file://0033-update-meson-build-for-PLDM-FWU-interfaces.patch \
+ file://0034-Fix-crash-issue-due-to-throw-undefined-error.patch \
"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/fwupd@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/fwupd@.service
index 64d9a47a6..d21647611 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/fwupd@.service
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/fwupd@.service
@@ -4,5 +4,5 @@ Description=Flash BMC with fwupd script : %I
[Service]
Type=oneshot
RemainAfterExit=no
-ExecStart=/usr/bin/fwupd.sh %i
+ExecStart=/bin/systemd-inhibit --what=shutdown:sleep --who=fwupd --why "Firmware Update %i" --mode=block /usr/bin/fwupd.sh %i
SyslogIdentifier=fwupd
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
new file mode 100644
index 000000000..dd2f3483d
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch
@@ -0,0 +1,850 @@
+From 5e3b0c1f8add50acca911a927ba8a1f4864cb315 Mon Sep 17 00:00:00 2001
+From: Kuiying Wang <kuiying.wang@intel.com>
+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 <kuiying.wang@intel.com>
+---
+ 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<SystemActionsReset>(app));
+ nodes.emplace_back(std::make_unique<SystemResetActionInfo>(app));
+ nodes.emplace_back(std::make_unique<BiosService>(app));
++ nodes.emplace_back(std::make_unique<BiosSettings>(app));
++ nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
+ nodes.emplace_back(std::make_unique<BiosReset>(app));
+ #ifdef BMCWEB_ENABLE_VM_NBDPROXY
+ nodes.emplace_back(std::make_unique<VirtualMedia>(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 <utils/fw_utils.hpp>
++
+ namespace redfish
+ {
++
++/*baseBIOSTable
++map{attributeName,struct{attributeType,readonlyStatus,displayname,
++ description,menuPath,current,default,
++ array{struct{optionstring,optionvalue}}}}
++*/
++using BiosBaseTableType = std::vector<std::pair<
++ std::string,
++ std::tuple<
++ std::string, bool, std::string, std::string, std::string,
++ std::variant<int64_t, std::string>, std::variant<int64_t, std::string>,
++ std::vector<
++ std::tuple<std::string, std::variant<int64_t, std::string>>>>>>;
++using BiosBaseTableItemType = std::pair<
++ std::string,
++ std::tuple<
++ std::string, bool, std::string, std::string, std::string,
++ std::variant<int64_t, std::string>, std::variant<int64_t, std::string>,
++ std::vector<
++ std::tuple<std::string, std::variant<int64_t, std::string>>>>>;
++using OptionsItemType =
++ std::tuple<std::string, std::variant<int64_t, std::string>>;
++
++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<std::pair<
++ std::string, std::tuple<std::string, std::variant<int64_t, std::string>>>>;
++using PendingAttributesItemType =
++ std::pair<std::string,
++ std::tuple<std::string, std::variant<int64_t, std::string>>>;
++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<BiosBaseTableType>& retBiosTable) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: "
++ << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ const BiosBaseTableType* baseBiosTable =
++ std::get_if<BiosBaseTableType>(&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<biosBaseAttrType>(item.second);
++ std::string attrType =
++ mapAttrTypeToRedfish(itemType);
++ if (attrType == "String")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ attributesJson.emplace(key, currValue != nullptr
++ ? *currValue
++ : "");
++ }
++ else if (attrType == "Integer")
++ {
++ const int64_t* currValue = std::get_if<int64_t>(
++ &std::get<biosBaseCurrValue>(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<const char*, 0>());
++ }
++};
++
++/**
++ * 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<std::string>&) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(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<PendingAttributesType>&
++ 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<PendingAttributesType>(
++ &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<pendingAttrType>(item.second);
++ std::string attrType =
++ mapAttrTypeToRedfish(itemType);
++ if (attrType == "String")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<pendingAttrValue>(
++ item.second));
++ attributesJson.emplace(key, currValue != nullptr
++ ? *currValue
++ : "");
++ }
++ else if (attrType == "Integer")
++ {
++ const int64_t* currValue = std::get_if<int64_t>(
++ &std::get<pendingAttrValue>(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<const char*, 0>());
++ }
++};
++/**
++ * 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<std::string>&) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(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<BiosBaseTableType>& retBiosTable) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR
++ << "getBiosAttributeRegistry DBUS error: "
++ << ec;
++ messages::resourceNotFound(
++ asyncResp->res, "Registries/Bios", "Bios");
++ return;
++ }
++ const BiosBaseTableType* baseBiosTable =
++ std::get_if<BiosBaseTableType>(&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<biosBaseAttrType>(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<biosBaseReadonlyStatus>(item.second);
++ attributeItem["DisplayName"] =
++ std::get<biosBaseDisplayName>(item.second);
++ attributeItem["HelpText"] =
++ std::get<biosBaseDescription>(item.second);
++ attributeItem["MenuPath"] =
++ std::get<biosBaseMenuPath>(item.second);
++
++ if (attrType == "String")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ const std::string* defValue =
++ std::get_if<std::string>(
++ &std::get<biosBaseDefaultValue>(
++ item.second));
++ attributeItem["CurrentValue"] =
++ currValue != nullptr ? *currValue : "";
++ attributeItem["DefaultValue"] =
++ defValue != nullptr ? *defValue : "";
++ }
++ else if (attrType == "Integer")
++ {
++ const int64_t* currValue = std::get_if<int64_t>(
++ &std::get<biosBaseCurrValue>(item.second));
++ const int64_t* defValue = std::get_if<int64_t>(
++ &std::get<biosBaseDefaultValue>(
++ 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<OptionsItemType>& optionsVector =
++ std::get<biosBaseOptions>(item.second);
++ for (const OptionsItemType& optItem : optionsVector)
++ {
++ nlohmann::json optItemJson;
++ const std::string& strOptItemType =
++ std::get<optItemType>(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::string>(
++ &std::get<optItemValue>(optItem));
++ optItemJson[optItemTypeRedfish] =
++ currValue != nullptr ? *currValue : "";
++ }
++ else
++ {
++ const int64_t* currValue =
++ std::get_if<int64_t>(
++ &std::get<optItemValue>(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<const char*, 0>());
+ }
+ };
+ /**
+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
new file mode 100755
index 000000000..18403446d
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch
@@ -0,0 +1,154 @@
+From 8f823ad555b67b228413a0fcb46771d86108dcb3 Mon Sep 17 00:00:00 2001
+From: Kuiying Wang <kuiying.wang@intel.com>
+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": <attribute name>, "AttributeType":
+<attribute type>, "AttributeValue": <attribute value>}]}'
+
+* Multiple Attributes:
+PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d
+'{"data":[{"AttributeName": <attribute name>, "AttributeType":
+<attribute type>, "AttributeValue": <attribute value>},
+{"AttributeName": <attribute name>, "AttributeType":
+<attribute type>, "AttributeValue": <attribute value>}]}'
+
+This makes use of the "Set" of "PendingAttributes" in the
+backend and that updates the BaseBiosTable.
+
+
+Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
+---
+ 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 9fe8c6e..e9c8969 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;
+@@ -263,7 +286,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:
+@@ -361,6 +386,73 @@ class BiosSettings : public Node
+ "/xyz/openbmc_project/bios_config/manager",
+ std::array<const char*, 0>());
+ }
++
++ void doPatch(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>&) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(res);
++
++ nlohmann::json inpJson;
++
++ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson))
++ {
++ return;
++ }
++
++ for (auto& attrInfo : inpJson)
++ {
++ std::optional<std::string> attrName;
++ std::optional<std::string> attrType;
++ std::optional<std::string> 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<PendingAttributesType>(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
new file mode 100644
index 000000000..983eb170a
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch
@@ -0,0 +1,62 @@
+From 2f5b401bb36be7a1f800bea20fb489a7b2ac6d45 Mon Sep 17 00:00:00 2001
+From: Kuiying Wang <kuiying.wang@intel.com>
+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 <kuiying.wang@intel.com>
+
+---
+ 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 4727ef2..888c511 100644
+--- a/redfish-core/lib/bios.hpp
++++ b/redfish-core/lib/bios.hpp
+@@ -663,7 +663,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:
+@@ -675,19 +675,23 @@ class BiosReset : public Node
+ const std::vector<std::string>&) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(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<std::string>(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
new file mode 100644
index 000000000..c603615f1
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch
@@ -0,0 +1,139 @@
+From 0192a2217eda578ca058cdc3a289ada3ee39e47a Mon Sep 17 00:00:00 2001
+From: Kuiying Wang <kuiying.wang@intel.com>
+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 <kuiying.wang@intel.com>
+---
+ 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<BiosSettings>(app));
+ nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
+ nodes.emplace_back(std::make_unique<BiosReset>(app));
++ nodes.emplace_back(std::make_unique<BiosChangePassword>(app));
+ #ifdef BMCWEB_ENABLE_VM_NBDPROXY
+ nodes.emplace_back(std::make_unique<VirtualMedia>(app));
+ nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app));
+diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
+index 7b4306b..52ee356 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<std::string>(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<std::string>&) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(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
new file mode 100644
index 000000000..520007d41
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch
@@ -0,0 +1,57 @@
+From 01a5c12e350c04f8ed94c7e49a6030a4699eac6e Mon Sep 17 00:00:00 2001
+From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
+Date: Mon, 28 Dec 2020 18:55:57 +0000
+Subject: [PATCH] managers: add attributes for Manager.CommandShell
+
+Issue: ConnectTypesSupported, ServiceEnabled and
+ MaxConcurrentSessions Attributes are missing for
+ Manager.CommandShell, though Requirement mandates it.
+
+Fix: Added missing attributes to Manager.CommandShell
+
+Tested:
+1. Verified redfish validator passed
+2. Get bmc details from Redfish
+Redfish URI: https://<BMC IP>/redfish/v1/Managers/bmc
+Response:
+{
+ "@odata.id": "/redfish/v1/Managers/bmc",
+ "@odata.type": "#Manager.v1_9_0.Manager",
+....
+....
+ "CommandShell": {
+ "ConnectTypesSupported": [
+ "SSH",
+ "IPMI"
+ ],
+ "MaxConcurrentSessions": 4,
+ "ServiceEnabled": true
+ },
+....
+....
+
+Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
+---
+ redfish-core/lib/managers.hpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
+index 6347caf..c401ca9 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"};
++ // Fill in CommandShell info
++ res.jsonValue["CommandShell"]["ServiceEnabled"] = true;
++ res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4;
++ res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {"SSH",
++ "IPMI"};
++
+ #ifdef BMCWEB_ENABLE_KVM
+ // Fill in GraphicalConsole info
+ res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
+--
+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
new file mode 100644
index 000000000..f3235c7cf
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch
@@ -0,0 +1,75 @@
+From a170675fafc1ee8bfee502672e65be9ad379a3d1 Mon Sep 17 00:00:00 2001
+From: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
+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 <radivoje.jovanovic@intel.com>
+---
+ 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 deb3a76..8063858 100644
+--- a/include/ssl_key_handler.hpp
++++ b/include/ssl_key_handler.hpp
+@@ -326,31 +326,34 @@ inline std::shared_ptr<boost::asio::ssl::context>
+ mSslContext->use_private_key_file(ssl_pem_file,
+ 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/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
index 9157f1bf1..b1334a420 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
@@ -1,7 +1,7 @@
-From d8b7e2f4eae85cd76d480970e888a50548523fc2 Mon Sep 17 00:00:00 2001
+From c7fce288802ece4a6e1ff71ee060a44e0b8fe992 Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Mon, 27 Apr 2020 17:24:15 +0200
-Subject: [PATCH 05/10] Redfish TelemetryService schema implementation
+Subject: [PATCH 1/4] Redfish TelemetryService schema implementation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -9,73 +9,41 @@ Content-Transfer-Encoding: 8bit
Added TelemetryService, MetricReports, MetricReportCollection,
MetricReportDefinition and MetricReportDefinitionCollection schemas
with GET method support. Added TelemetryService URI to root service.
-Implemented communication with backend - MonitoringService.
-Added schemes attributes that are supported by MonitoringService
+Implemented communication with backend - Telemetry.
+Added schemes attributes that are supported by Telemetry service
design. User is able to fetch basic information about reports if
-MonitoringService is present in OpenBMC.
+Telemetry service is present in OpenBMC.
+Added util function that converts decimal value into duration format
+that is described by ISO 8601 and Redfish specification.
Tested:
- - Succesfully passed RedfishServiceValidator.py
- - Validated conversion to duration format using whole
- range of uint32_t type
- - Validated assigning value to JSON response using different
- closures and std::functions types
+ - Succesfully passed RedfishServiceValidator.py
+ - Verified DBus method calls to Telemetry service
+ - Verified all possible pages that are displayed to user when:
+ - Reports are fully defined in Telemetry
+ - Reports are partially available in Telemetry
+ - Telemetry is disabled
+ - Verified time_utils::toDurationString() output
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
+Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570
-
-%% original patch: 0001-Redfish-TelemetryService-schema-implementation.patch
-
-Change-Id: I547073faef9228e8dc5350ea28d06cdd3c5341f6
---
- include/dbus_utility.hpp | 21 +++
redfish-core/include/redfish.hpp | 10 ++
- redfish-core/include/utils/json_utils.hpp | 101 +++++++++++++
- redfish-core/include/utils/telemetry_utils.hpp | 100 +++++++++++++
- redfish-core/include/utils/time_utils.hpp | 97 +++++++++++++
- redfish-core/lib/metric_report.hpp | 149 +++++++++++++++++++
- redfish-core/lib/metric_report_definition.hpp | 191 +++++++++++++++++++++++++
+ redfish-core/include/utils/telemetry_utils.hpp | 71 ++++++++++
+ redfish-core/include/utils/time_utils.hpp | 78 +++++++++++
+ redfish-core/lib/metric_report.hpp | 162 +++++++++++++++++++++
+ redfish-core/lib/metric_report_definition.hpp | 186 +++++++++++++++++++++++++
redfish-core/lib/service_root.hpp | 2 +
- redfish-core/lib/telemetry_service.hpp | 92 ++++++++++++
- 9 files changed, 763 insertions(+)
+ redfish-core/lib/telemetry_service.hpp | 93 +++++++++++++
+ 7 files changed, 602 insertions(+)
create mode 100644 redfish-core/include/utils/telemetry_utils.hpp
create mode 100644 redfish-core/include/utils/time_utils.hpp
create mode 100644 redfish-core/lib/metric_report.hpp
create mode 100644 redfish-core/lib/metric_report_definition.hpp
create mode 100644 redfish-core/lib/telemetry_service.hpp
-diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
-index 8ba9a57..ef3438b 100644
---- a/include/dbus_utility.hpp
-+++ b/include/dbus_utility.hpp
-@@ -99,5 +99,26 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback)
- std::array<std::string, 0>());
- }
-
-+template <typename Array, typename Callback>
-+inline void getSubTreePaths(Callback&& callback, const std::string& path,
-+ int depth, Array& interfaces)
-+{
-+ crow::connections::systemBus->async_method_call(
-+ callback, "xyz.openbmc_project.ObjectMapper",
-+ "/xyz/openbmc_project/object_mapper",
-+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", path, depth,
-+ interfaces);
-+}
-+
-+template <typename Callback>
-+inline void getAllProperties(Callback&& callback, const std::string& service,
-+ const std::string& path,
-+ const std::string& interface)
-+{
-+ crow::connections::systemBus->async_method_call(
-+ callback, service, path, "org.freedesktop.DBus.Properties", "GetAll",
-+ interface);
-+}
-+
- } // namespace utility
- } // namespace dbus
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 54d5d0e..2587b37 100644
--- a/redfish-core/include/redfish.hpp
@@ -111,154 +79,12 @@ index 54d5d0e..2587b37 100644
for (const auto& node : nodes)
{
node->initPrivileges();
-diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
-index c355000..c866a2f 100644
---- a/redfish-core/include/utils/json_utils.hpp
-+++ b/redfish-core/include/utils/json_utils.hpp
-@@ -13,14 +13,18 @@
- // See the License for the specific language governing permissions and
- // limitations under the License.
- */
-+
- #pragma once
-
-+#include <boost/container/flat_map.hpp>
- #include <error_messages.hpp>
- #include <http_request.hpp>
- #include <http_response.hpp>
- #include <nlohmann/json.hpp>
-
- #include <bitset>
-+#include <string>
-+#include <variant>
-
- namespace redfish
- {
-@@ -425,5 +429,102 @@ bool getValueFromJsonObject(nlohmann::json& jsonData, const std::string& key,
- return details::unpackValue(jsonValue, key, value);
- }
-
-+template <class T>
-+struct IsStdFunction
-+{
-+ static constexpr bool value = false;
-+};
-+
-+template <class T>
-+struct IsStdFunction<std::function<T>>
-+{
-+ static constexpr bool value = true;
-+};
-+
-+template <class T>
-+constexpr bool is_std_function_v = IsStdFunction<T>::value;
-+
-+/**
-+ * @brief Assign dbus property to http response attribute if property is stored
-+ * on the map.
-+ */
-+template <typename T, typename S, typename... V>
-+bool assignIfPresent(
-+ const boost::container::flat_map<std::string, std::variant<V...>>& ret,
-+ const char* propertyName, nlohmann::json& attribute, const S& convert)
-+{
-+ if constexpr (is_std_function_v<S>)
-+ {
-+ if (!convert)
-+ {
-+ BMCWEB_LOG_ERROR << "Passed empty target as convert argument";
-+ return false;
-+ }
-+ }
-+
-+ auto found = ret.find(propertyName);
-+ if (found != ret.end())
-+ {
-+ auto property = std::get_if<T>(&found->second);
-+ if (property)
-+ {
-+ attribute = convert(*property);
-+ return true;
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_ERROR << "Variant does not contain this type";
-+ }
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_ERROR << "Element not found in map";
-+ }
-+
-+ return false;
-+}
-+
-+template <typename T, typename... V>
-+bool assignIfPresent(
-+ const boost::container::flat_map<std::string, std::variant<V...>>& ret,
-+ const char* propertyName, nlohmann::json& attribute)
-+{
-+ return assignIfPresent<T>(ret, propertyName, attribute,
-+ [](const T& v) -> T { return v; });
-+}
-+
-+template <typename T, typename... V>
-+bool assignIfPresent(
-+ const boost::container::flat_map<std::string, std::variant<V...>>& ret,
-+ const char* attributeName, crow::Response& res)
-+{
-+ return assignIfPresent<T>(ret, attributeName, res.jsonValue[attributeName]);
-+}
-+
-+/**
-+ * @brief Translate dbusPaths received from ObjectMapper into Redfish
-+ * collection members and fill http response with those information.
-+ */
-+inline void dbusPathsToMembersArray(crow::Response& res,
-+ const std::vector<std::string>& reports,
-+ const char* path)
-+{
-+ nlohmann::json& members = res.jsonValue["Members"];
-+ members = nlohmann::json::array();
-+
-+ for (const std::string& objpath : reports)
-+ {
-+ std::size_t lastPos = objpath.rfind("/");
-+ if (lastPos == std::string::npos)
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to find '/' in " << objpath;
-+ continue;
-+ }
-+ members.push_back({{"@odata.id", path + objpath.substr(lastPos + 1)}});
-+ }
-+
-+ res.jsonValue["Members@odata.count"] = members.size();
-+}
-+
- } // namespace json_util
- } // namespace redfish
diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
new file mode 100644
-index 0000000..05ed00f
+index 0000000..8caee2d
--- /dev/null
+++ b/redfish-core/include/utils/telemetry_utils.hpp
-@@ -0,0 +1,100 @@
-+/*
-+// Copyright (c) 2018-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.
-+*/
-+
+@@ -0,0 +1,71 @@
+#pragma once
+
+namespace redfish
@@ -267,112 +93,79 @@ index 0000000..05ed00f
+namespace telemetry
+{
+
-+static constexpr const char* metricReportDefinitionUri =
++constexpr const char* service = "xyz.openbmc_project.Telemetry";
++constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report";
++constexpr const char* metricReportDefinitionUri =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/";
-+static constexpr const char* metricReportUri =
++constexpr const char* metricReportUri =
+ "/redfish/v1/TelemetryService/MetricReports/";
-+static constexpr const char* reportInterface =
-+ "xyz.openbmc_project.MonitoringService.Report";
-+static constexpr const char* telemetryPath =
-+ "/xyz/openbmc_project/MonitoringService/Reports/TelemetryService";
+
-+static void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const char* uri)
++inline void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
++ const std::string& uri)
+{
+ const std::array<const char*, 1> interfaces = {reportInterface};
+
-+ dbus::utility::getSubTreePaths(
++ crow::connections::systemBus->async_method_call(
+ [asyncResp, uri](const boost::system::error_code ec,
-+ const std::vector<std::string>& reports) {
-+ if (ec == boost::system::errc::no_such_file_or_directory)
++ const std::vector<std::string>& reportPaths) {
++ if (ec)
+ {
+ asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
+ asyncResp->res.jsonValue["Members@odata.count"] = 0;
+ return;
+ }
+
-+ if (ec)
++ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
++ members = nlohmann::json::array();
++
++ for (const std::string& path : reportPaths)
+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
++ std::size_t pos = path.rfind('/');
++ if (pos == std::string::npos)
++ {
++ BMCWEB_LOG_ERROR << "Failed to find '/' in " << path;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ if (path.size() <= (pos + 1))
++ {
++ BMCWEB_LOG_ERROR << "Failed to parse path " << path;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ members.push_back({{"@odata.id", uri + path.substr(pos + 1)}});
+ }
+
-+ json_util::dbusPathsToMembersArray(asyncResp->res, reports, uri);
++ asyncResp->res.jsonValue["Members@odata.count"] = members.size();
+ },
-+ telemetryPath, 1, interfaces);
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
++ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService", 1,
++ interfaces);
+}
+
-+template <typename Callback>
-+static void getReport(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& id, const char* schemaType,
-+ const Callback&& callback)
++inline std::string getDbusReportPath(const std::string& id)
+{
-+ const std::array<const char*, 1> interfaces = {reportInterface};
-+
-+ dbus::utility::getSubTreePaths(
-+ [asyncResp, id, schemaType,
-+ callback](const boost::system::error_code ec,
-+ const std::vector<std::string>& reports) {
-+ if (ec == boost::system::errc::no_such_file_or_directory)
-+ {
-+ messages::resourceNotFound(asyncResp->res, schemaType, id);
-+ return;
-+ }
-+
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
-+ }
-+
-+ const std::string target = "/xyz/openbmc_project/"
-+ "MonitoringService/Reports/"
-+ "TelemetryService/" +
-+ id;
-+ auto path = std::find(reports.begin(), reports.end(), target);
-+ if (path == std::end(reports))
-+ {
-+ messages::resourceNotFound(asyncResp->res, schemaType, id);
-+ return;
-+ }
-+ callback(asyncResp, *path, id);
-+ },
-+ telemetryPath, 1, interfaces);
++ std::string path =
++ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService/" + id;
++ dbus::utility::escapePathForDbus(path);
++ return path;
+}
++
+} // namespace telemetry
+} // namespace redfish
diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
new file mode 100644
-index 0000000..0256b3f
+index 0000000..dd4ea75
--- /dev/null
+++ b/redfish-core/include/utils/time_utils.hpp
-@@ -0,0 +1,97 @@
-+/*
-+// 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.
-+*/
-+
+@@ -0,0 +1,78 @@
+#pragma once
+
-+#include <boost/algorithm/string/trim.hpp>
-+
+#include <chrono>
-+#include <cstdint>
+#include <string>
-+#include <type_traits>
+
+namespace redfish
+{
@@ -383,63 +176,64 @@ index 0000000..0256b3f
+namespace details
+{
+
-+template <typename T>
-+std::string toDurationFormatItem(std::chrono::milliseconds& duration,
-+ const char* postfix)
++inline void leftZeroPadding(std::string& str, const std::size_t padding)
+{
-+ const auto t = std::chrono::duration_cast<T>(duration);
-+ if (t.count() == 0)
-+ {
-+ return "";
-+ }
-+
-+ std::stringstream ss;
-+ if constexpr (std::is_same<T, std::chrono::milliseconds>::value)
++ if (str.size() < padding)
+ {
-+ ss << static_cast<float>(t.count()) /
-+ static_cast<float>(std::chrono::milliseconds::period::den);
++ str.insert(0, padding - str.size(), '0');
+ }
-+ else
-+ {
-+ ss << t.count();
-+ }
-+ ss << postfix;
-+ duration -= t;
-+ return ss.str();
+}
-+
+} // namespace details
+
+/**
+ * @brief Convert time value into duration format that is based on ISO 8601.
-+ * Pattern: "-?P(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(.\\d+)?S)?)?"
-+ * Reference: "Redfish Telemetry White Paper".
++ * Example output: "P12DT1M5.5S"
++ * Ref: Redfish Specification, Section 9.4.4. Duration values
+ */
-+std::string toDurationFormat(const uint32_t ms)
++std::string toDurationString(std::chrono::milliseconds ms)
+{
-+ std::chrono::milliseconds duration(ms);
-+ if (duration.count() == 0)
++ if (ms < std::chrono::milliseconds::zero())
+ {
-+ return "PT0S";
++ return "";
+ }
+
+ std::string fmt;
-+ fmt.reserve(sizeof("PxxxDTxxHxxMxx.xxxxxxS"));
++ fmt.reserve(sizeof("PxxxxxxxxxxxxDTxxHxxMxx.xxxxxxS"));
++
++ using Days = std::chrono::duration<long, std::ratio<24 * 60 * 60>>;
++ Days days = std::chrono::floor<Days>(ms);
++ ms -= days;
++
++ std::chrono::hours hours = std::chrono::floor<std::chrono::hours>(ms);
++ ms -= hours;
++
++ std::chrono::minutes minutes = std::chrono::floor<std::chrono::minutes>(ms);
++ ms -= minutes;
+
-+ using Days = std::chrono::duration<int, std::ratio<24 * 60 * 60>>;
++ std::chrono::seconds seconds = std::chrono::floor<std::chrono::seconds>(ms);
++ ms -= seconds;
+
-+ fmt += "P";
-+ fmt += details::toDurationFormatItem<Days>(duration, "D");
-+ if (duration.count() == 0)
++ fmt = "P";
++ if (days.count() > 0)
+ {
-+ return fmt;
++ fmt += std::to_string(days.count()) + "D";
+ }
-+
+ fmt += "T";
-+ fmt += details::toDurationFormatItem<std::chrono::hours>(duration, "H");
-+ fmt += details::toDurationFormatItem<std::chrono::minutes>(duration, "M");
-+ fmt +=
-+ details::toDurationFormatItem<std::chrono::milliseconds>(duration, "S");
++ if (hours.count() > 0)
++ {
++ fmt += std::to_string(hours.count()) + "H";
++ }
++ if (minutes.count() > 0)
++ {
++ fmt += std::to_string(minutes.count()) + "M";
++ }
++ if (seconds.count() != 0 || ms.count() != 0)
++ {
++ fmt += std::to_string(seconds.count()) + ".";
++ std::string msStr = std::to_string(ms.count());
++ details::leftZeroPadding(msStr, 3);
++ fmt += msStr + "S";
++ }
+
+ return fmt;
+}
@@ -448,43 +242,23 @@ index 0000000..0256b3f
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
new file mode 100644
-index 0000000..4d1c4e5
+index 0000000..050304c
--- /dev/null
+++ b/redfish-core/lib/metric_report.hpp
-@@ -0,0 +1,149 @@
-+/*
-+// Copyright (c) 2018-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.
-+*/
-+
+@@ -0,0 +1,162 @@
+#pragma once
+
+#include "node.hpp"
+#include "utils/telemetry_utils.hpp"
+
-+#include <boost/container/flat_map.hpp>
-+
-+#include <system_error>
-+#include <variant>
-+
+namespace redfish
+{
+
+class MetricReportCollection : public Node
+{
+ public:
-+ MetricReportCollection(App& app) : Node(app, telemetry::metricReportUri)
++ MetricReportCollection(App& app) :
++ Node(app, "/redfish/v1/TelemetryService/MetricReports/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
@@ -514,7 +288,7 @@ index 0000000..4d1c4e5
+{
+ public:
+ MetricReport(App& app) :
-+ Node(app, std::string(telemetry::metricReportUri) + "<str>/",
++ Node(app, "/redfish/v1/TelemetryService/MetricReports/<str>/",
+ std::string())
+ {
+ entityPrivileges = {
@@ -539,33 +313,74 @@ index 0000000..4d1c4e5
+ }
+
+ const std::string& id = params[0];
-+ telemetry::getReport(asyncResp, id, schemaType, getReportProperties);
++ const std::string reportPath = telemetry::getDbusReportPath(id);
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp, id, reportPath](const boost::system::error_code& ec) {
++ if (ec.value() == EBADR)
++ {
++ messages::resourceNotFound(asyncResp->res, schemaType, id);
++ return;
++ }
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp,
++ id](const boost::system::error_code ec,
++ const std::variant<TimestampReadings>& ret) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ fillReport(asyncResp, id, ret);
++ },
++ telemetry::service, reportPath,
++ "org.freedesktop.DBus.Properties", "Get",
++ telemetry::reportInterface, "Readings");
++ },
++ telemetry::service, reportPath, telemetry::reportInterface,
++ "Update");
+ }
+
+ using Readings =
-+ std::vector<std::tuple<std::string, std::string, double, int32_t>>;
-+ using MetricValues = std::vector<std::map<std::string, std::string>>;
++ std::vector<std::tuple<std::string, std::string, double, uint64_t>>;
++ using TimestampReadings = std::tuple<uint64_t, Readings>;
+
-+ static MetricValues toMetricValues(const Readings& readings)
++ static nlohmann::json toMetricValues(const Readings& readings)
+ {
-+ MetricValues metricValues;
++ nlohmann::json metricValues = nlohmann::json::array_t();
+
+ for (auto& [id, metadata, sensorValue, timestamp] : readings)
+ {
++ nlohmann::json metadataJson = nlohmann::json::parse(metadata);
+ metricValues.push_back({
+ {"MetricId", id},
-+ {"MetricProperty", metadata},
++ {"MetricDefinition", metadataJson.contains("MetricDefinition")
++ ? metadataJson["MetricDefinition"]
++ : nlohmann::json()},
++ {"MetricProperty", metadataJson.contains("MetricProperty")
++ ? metadataJson["MetricProperty"]
++ : nlohmann::json()},
+ {"MetricValue", std::to_string(sensorValue)},
-+ {"Timestamp", crow::utility::getDateTime(timestamp)},
++ {"Timestamp",
++ crow::utility::getDateTime(static_cast<time_t>(timestamp))},
+ });
+ }
+
+ return metricValues;
+ }
+
-+ static void getReportProperties(const std::shared_ptr<AsyncResp> asyncResp,
-+ const std::string& reportPath,
-+ const std::string& id)
++ static void fillReport(const std::shared_ptr<AsyncResp>& asyncResp,
++ const std::string& id,
++ const std::variant<TimestampReadings>& var)
+ {
+ asyncResp->res.jsonValue["@odata.type"] = schemaType;
+ asyncResp->res.jsonValue["@odata.id"] = telemetry::metricReportUri + id;
@@ -574,27 +389,19 @@ index 0000000..4d1c4e5
+ asyncResp->res.jsonValue["MetricReportDefinition"]["@odata.id"] =
+ telemetry::metricReportDefinitionUri + id;
+
-+ dbus::utility::getAllProperties(
-+ [asyncResp](
-+ const boost::system::error_code ec,
-+ const boost::container::flat_map<
-+ std::string, std::variant<Readings, int32_t>>& ret) {
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
-+ }
++ const TimestampReadings* timestampReadings =
++ std::get_if<TimestampReadings>(&var);
++ if (!timestampReadings)
++ {
++ BMCWEB_LOG_ERROR << "Property type mismatch or property is missing";
++ messages::internalError(asyncResp->res);
++ return;
++ }
+
-+ json_util::assignIfPresent<int32_t>(
-+ ret, "Timestamp", asyncResp->res.jsonValue["Timestamp"],
-+ crow::utility::getDateTime);
-+ json_util::assignIfPresent<Readings>(
-+ ret, "Readings", asyncResp->res.jsonValue["MetricValues"],
-+ toMetricValues);
-+ },
-+ "xyz.openbmc_project.MonitoringService", reportPath,
-+ "xyz.openbmc_project.MonitoringService.Report");
++ const auto& [timestamp, readings] = *timestampReadings;
++ asyncResp->res.jsonValue["Timestamp"] =
++ crow::utility::getDateTime(static_cast<time_t>(timestamp));
++ asyncResp->res.jsonValue["MetricValues"] = toMetricValues(readings);
+ }
+
+ static constexpr const char* schemaType =
@@ -603,35 +410,17 @@ index 0000000..4d1c4e5
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
new file mode 100644
-index 0000000..72e62e9
+index 0000000..48c56e6
--- /dev/null
+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -0,0 +1,191 @@
-+/*
-+// Copyright (c) 2018-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.
-+*/
-+
+@@ -0,0 +1,186 @@
+#pragma once
+
+#include "node.hpp"
+#include "utils/telemetry_utils.hpp"
+#include "utils/time_utils.hpp"
+
-+#include <boost/container/flat_map.hpp>
-+
-+#include <system_error>
++#include <tuple>
+#include <variant>
+
+namespace redfish
@@ -641,7 +430,7 @@ index 0000000..72e62e9
+{
+ public:
+ MetricReportDefinitionCollection(App& app) :
-+ Node(app, telemetry::metricReportDefinitionUri)
++ Node(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
@@ -672,7 +461,7 @@ index 0000000..72e62e9
+{
+ public:
+ MetricReportDefinition(App& app) :
-+ Node(app, std::string(telemetry::metricReportDefinitionUri) + "<str>/",
++ Node(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/<str>/",
+ std::string())
+ {
+ entityPrivileges = {
@@ -697,55 +486,40 @@ index 0000000..72e62e9
+ }
+
+ const std::string& id = params[0];
++ crow::connections::systemBus->async_method_call(
++ [asyncResp,
++ id](const boost::system::error_code ec,
++ const std::vector<std::pair<
++ std::string, std::variant<bool, ReadingParameters,
++ std::string, uint64_t>>>& ret) {
++ if (ec.value() == EBADR)
++ {
++ messages::resourceNotFound(asyncResp->res, schemaType, id);
++ return;
++ }
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
+
-+ telemetry::getReport(asyncResp, id, schemaType,
-+ getReportDefinitonProperties);
-+ }
-+
-+ static std::vector<std::string>
-+ toReportActions(const std::vector<std::string>& actions)
-+ {
-+ const boost::container::flat_map<std::string, std::string>
-+ reportActions = {
-+ {"Event", "RedfishEvent"},
-+ {"Log", "LogToMetricReportsCollection"},
-+ };
-+
-+ std::vector<std::string> out;
-+ for (auto& action : actions)
-+ {
-+ auto found = reportActions.find(action);
-+ if (found != reportActions.end())
-+ {
-+ out.emplace_back(found->second);
-+ }
-+ }
-+ return out;
++ fillReportDefinition(asyncResp, id, ret);
++ },
++ telemetry::service, telemetry::getDbusReportPath(id),
++ "org.freedesktop.DBus.Properties", "GetAll",
++ telemetry::reportInterface);
+ }
+
+ using ReadingParameters =
+ std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
+ std::string, std::string, std::string>>;
+
-+ static nlohmann::json toMetrics(const ReadingParameters& params)
-+ {
-+ nlohmann::json metrics = nlohmann::json::array();
-+
-+ for (auto& [sensorPaths, operationType, id, metadata] : params)
-+ {
-+ metrics.push_back({
-+ {"MetricId", id},
-+ {"MetricProperties", std::vector<std::string>() = {metadata}},
-+ });
-+ }
-+
-+ return metrics;
-+ }
-+
-+ static void
-+ getReportDefinitonProperties(const std::shared_ptr<AsyncResp> asyncResp,
-+ const std::string& reportPath,
-+ const std::string& id)
++ static void fillReportDefinition(
++ const std::shared_ptr<AsyncResp>& asyncResp, const std::string& id,
++ const std::vector<
++ std::pair<std::string, std::variant<bool, ReadingParameters,
++ std::string, uint64_t>>>& ret)
+ {
+ asyncResp->res.jsonValue["@odata.type"] = schemaType;
+ asyncResp->res.jsonValue["@odata.id"] =
@@ -755,45 +529,73 @@ index 0000000..72e62e9
+ asyncResp->res.jsonValue["MetricReport"]["@odata.id"] =
+ telemetry::metricReportUri + id;
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
++ asyncResp->res.jsonValue["ReportUpdates"] = "Overwrite";
++
++ const bool* emitsReadingsUpdate = nullptr;
++ const bool* logToMetricReportsCollection = nullptr;
++ const ReadingParameters* readingParams = nullptr;
++ const std::string* reportingType = nullptr;
++ const uint64_t* interval = nullptr;
++ for (const auto& [key, var] : ret)
++ {
++ if (key == "EmitsReadingsUpdate")
++ {
++ emitsReadingsUpdate = std::get_if<bool>(&var);
++ }
++ else if (key == "LogToMetricReportsCollection")
++ {
++ logToMetricReportsCollection = std::get_if<bool>(&var);
++ }
++ else if (key == "ReadingParameters")
++ {
++ readingParams = std::get_if<ReadingParameters>(&var);
++ }
++ else if (key == "ReportingType")
++ {
++ reportingType = std::get_if<std::string>(&var);
++ }
++ else if (key == "Interval")
++ {
++ interval = std::get_if<uint64_t>(&var);
++ }
++ }
++ if (!emitsReadingsUpdate || !logToMetricReportsCollection ||
++ !readingParams || !reportingType || !interval)
++ {
++ BMCWEB_LOG_ERROR << "Property type mismatch or property is missing";
++ messages::internalError(asyncResp->res);
++ return;
++ }
+
-+ dbus::utility::getAllProperties(
-+ [asyncResp](const boost::system::error_code ec,
-+ const boost::container::flat_map<
-+ std::string,
-+ std::variant<std::string, std::vector<std::string>,
-+ uint32_t, ReadingParameters>>& ret) {
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
-+ }
++ std::vector<std::string> redfishReportActions;
++ redfishReportActions.reserve(2);
++ if (*emitsReadingsUpdate)
++ {
++ redfishReportActions.emplace_back("RedfishEvent");
++ }
++ if (*logToMetricReportsCollection)
++ {
++ redfishReportActions.emplace_back("LogToMetricReportsCollection");
++ }
+
-+ json_util::assignIfPresent<std::vector<std::string>>(
-+ ret, "ReportAction",
-+ asyncResp->res.jsonValue["ReportActions"], toReportActions);
-+ auto assigned = json_util::assignIfPresent<std::string>(
-+ ret, "ReportingType",
-+ asyncResp->res.jsonValue["MetricReportDefinitionType"]);
-+ if (assigned &&
-+ asyncResp->res.jsonValue["MetricReportDefinitionType"] ==
-+ "Periodic")
-+ {
-+ json_util::assignIfPresent<uint32_t>(
-+ ret, "ScanPeriod",
-+ asyncResp->res
-+ .jsonValue["Schedule"]["RecurrenceInterval"],
-+ time_utils::toDurationFormat);
-+ }
-+ json_util::assignIfPresent<ReadingParameters>(
-+ ret, "ReadingParameters",
-+ asyncResp->res.jsonValue["Metrics"], toMetrics);
-+ },
-+ "xyz.openbmc_project.MonitoringService", reportPath,
-+ "xyz.openbmc_project.MonitoringService.Report");
++ nlohmann::json metrics = nlohmann::json::array();
++ for (auto& [sensorPaths, operationType, id, metadata] : *readingParams)
++ {
++ nlohmann::json metadataJson = nlohmann::json::parse(metadata);
++ metrics.push_back({
++ {"MetricId", id},
++ {"MetricProperties", metadataJson.contains("MetricProperties")
++ ? metadataJson["MetricProperties"]
++ : nlohmann::json()},
++ });
++ }
++ asyncResp->res.jsonValue["Metrics"] = metrics;
++ asyncResp->res.jsonValue["MetricReportDefinitionType"] = *reportingType;
++ asyncResp->res.jsonValue["ReportActions"] = redfishReportActions;
++ asyncResp->res.jsonValue["Schedule"]["RecurrenceInterval"] =
++ time_utils::toDurationString(std::chrono::milliseconds(*interval));
+ }
+
-+ public:
+ static constexpr const char* schemaType =
+ "#MetricReportDefinition.v1_3_0.MetricReportDefinition";
+};
@@ -813,32 +615,14 @@ index 629280c..3df5ec5 100644
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
new file mode 100644
-index 0000000..b849781
+index 0000000..a6acc34
--- /dev/null
+++ b/redfish-core/lib/telemetry_service.hpp
-@@ -0,0 +1,92 @@
-+/*
-+// Copyright (c) 2018-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.
-+*/
-+
+@@ -0,0 +1,93 @@
+#pragma once
+
+#include "node.hpp"
-+#include "utils/time_utils.hpp"
-+
-+#include <boost/container/flat_map.hpp>
++#include "utils/telemetry_utils.hpp"
+
+#include <variant>
+
@@ -864,7 +648,7 @@ index 0000000..b849781
+ const std::vector<std::string>&) override
+ {
+ res.jsonValue["@odata.type"] =
-+ "#TelemetryService.v1_2_0.TelemetryService";
++ "#TelemetryService.v1_2_1.TelemetryService";
+ res.jsonValue["@odata.id"] = "/redfish/v1/TelemetryService";
+ res.jsonValue["Id"] = "TelemetryService";
+ res.jsonValue["Name"] = "Telemetry Service";
@@ -876,36 +660,55 @@ index 0000000..b849781
+ res.jsonValue["MetricReports"]["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricReports";
+
-+ getMonitoringServiceProperties(res);
-+ }
-+
-+ void getMonitoringServiceProperties(crow::Response& res)
-+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ dbus::utility::getAllProperties(
++ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+ const boost::system::error_code ec,
-+ const boost::container::flat_map<std::string,
-+ std::variant<uint32_t>>& ret) {
-+ if (ec)
++ const std::vector<std::pair<
++ std::string, std::variant<uint32_t, uint64_t>>>& ret) {
++ if (ec == boost::system::errc::host_unreachable)
+ {
+ asyncResp->res.jsonValue["Status"]["State"] = "Absent";
++ return;
++ }
++ if (ec)
++ {
+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+
-+ json_util::assignIfPresent<uint32_t>(ret, "MaxReports",
-+ asyncResp->res);
-+ json_util::assignIfPresent<uint32_t>(
-+ ret, "PollRateResolution",
-+ asyncResp->res.jsonValue["MinCollectionInterval"],
-+ time_utils::toDurationFormat);
++ const size_t* maxReports = nullptr;
++ const uint64_t* minInterval = nullptr;
++ for (const auto& [key, var] : ret)
++ {
++ if (key == "MaxReports")
++ {
++ maxReports = std::get_if<size_t>(&var);
++ }
++ else if (key == "MinInterval")
++ {
++ minInterval = std::get_if<uint64_t>(&var);
++ }
++ }
++ if (!maxReports || !minInterval)
++ {
++ BMCWEB_LOG_ERROR
++ << "Property type mismatch or property is missing";
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ asyncResp->res.jsonValue["MaxReports"] = *maxReports;
++ asyncResp->res.jsonValue["MinCollectionInterval"] =
++ time_utils::toDurationString(std::chrono::milliseconds(
++ static_cast<time_t>(*minInterval)));
+ },
-+ "xyz.openbmc_project.MonitoringService",
-+ "/xyz/openbmc_project/MonitoringService/Reports",
-+ "xyz.openbmc_project.MonitoringService.ReportsManagement");
++ telemetry::service, "/xyz/openbmc_project/Telemetry/Reports",
++ "org.freedesktop.DBus.Properties", "GetAll",
++ "xyz.openbmc_project.Telemetry.ReportManager");
+ }
+};
+} // namespace redfish
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch
new file mode 100644
index 000000000..b04a72c9f
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch
@@ -0,0 +1,683 @@
+From 0784af276b72e5df9c545d83bc989833ac2935c4 Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Mon, 18 May 2020 11:56:57 +0200
+Subject: [PATCH 2/4] Add POST and DELETE in MetricReportDefinitions
+
+Added POST action in MetricReportDefinitions node to allow user
+to add new MetricReportDefinition. Using minimal set of
+MetricReportDefinition parameters from user bmcweb converts it to
+DBus call "AddReport" to Telemetry that serves as a backend
+for Redfish TelemetryService.
+Added DELETE request in MetricReportDefinitions node to allow user
+to remove report from Telemetry.
+Added conversion from string that represents duration format into
+its numeric equivalent.
+
+Tested:
+ - Succesfully passed RedfishServiceValidator.py
+ - Validated good cases with different parameters for POST action
+ - Validated bad cases with different parameters for POST action
+ - Verified time_utils::fromDurationString()
+ - Verified that reports are removed on DELETE request
+
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Change-Id: I2fed96848594451e22fde686f8c066d7770cc65a
+---
+ redfish-core/include/utils/telemetry_utils.hpp | 5 +-
+ redfish-core/include/utils/time_utils.hpp | 145 +++++++++-
+ redfish-core/lib/metric_report_definition.hpp | 382 ++++++++++++++++++++++++-
+ 3 files changed, 516 insertions(+), 16 deletions(-)
+
+diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
+index 8caee2d..acb739d 100644
+--- a/redfish-core/include/utils/telemetry_utils.hpp
++++ b/redfish-core/include/utils/telemetry_utils.hpp
+@@ -12,6 +12,8 @@ constexpr const char* metricReportDefinitionUri =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/";
+ constexpr const char* metricReportUri =
+ "/redfish/v1/TelemetryService/MetricReports/";
++constexpr const char* reportDir =
++ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService/";
+
+ inline void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& uri)
+@@ -61,8 +63,7 @@ inline void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
+
+ inline std::string getDbusReportPath(const std::string& id)
+ {
+- std::string path =
+- "/xyz/openbmc_project/Telemetry/Reports/TelemetryService/" + id;
++ std::string path = reportDir + id;
+ dbus::utility::escapePathForDbus(path);
+ return path;
+ }
+diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
+index dd4ea75..d8985ab 100644
+--- a/redfish-core/include/utils/time_utils.hpp
++++ b/redfish-core/include/utils/time_utils.hpp
+@@ -1,7 +1,12 @@
+ #pragma once
+
++#include "logging.hpp"
++
++#include <charconv>
+ #include <chrono>
++#include <optional>
+ #include <string>
++#include <system_error>
+
+ namespace redfish
+ {
+@@ -12,6 +17,8 @@ namespace time_utils
+ namespace details
+ {
+
++using Days = std::chrono::duration<long long, std::ratio<24 * 60 * 60>>;
++
+ inline void leftZeroPadding(std::string& str, const std::size_t padding)
+ {
+ if (str.size() < padding)
+@@ -19,8 +26,143 @@ inline void leftZeroPadding(std::string& str, const std::size_t padding)
+ str.insert(0, padding - str.size(), '0');
+ }
+ }
++
++inline bool fromChars(const char* start, const char* end,
++ std::chrono::milliseconds::rep& val)
++{
++ auto [ptr, ec] = std::from_chars(start, end, val);
++ if (ptr != end)
++ {
++ BMCWEB_LOG_ERROR
++ << "Failed to convert string to decimal because of unexpected sign";
++ return false;
++ }
++ if (ec != std::errc())
++ {
++ BMCWEB_LOG_ERROR << "Failed to convert string to decimal with err: "
++ << static_cast<int>(ec) << "("
++ << std::make_error_code(ec).message() << ")";
++ return false;
++ }
++ return true;
++}
++
++template <typename T>
++bool fromDurationItem(std::string_view& fmt, const char postfix,
++ std::chrono::milliseconds& out)
++{
++ const size_t pos = fmt.find(postfix);
++ if (pos == std::string::npos)
++ {
++ return true;
++ }
++ if ((pos + 1U) > fmt.size())
++ {
++ return false;
++ }
++
++ std::chrono::milliseconds::rep v = 0;
++ if constexpr (std::is_same_v<T, std::chrono::milliseconds>)
++ {
++ std::string str(fmt.data(), std::min<size_t>(pos, 3U));
++ while (str.size() < 3U)
++ {
++ str += '0';
++ }
++ if (!fromChars(str.data(), str.data() + str.size(), v))
++ {
++ return false;
++ }
++ }
++ else
++ {
++ if (!fromChars(fmt.data(), fmt.data() + pos, v))
++ {
++ return false;
++ }
++ }
++
++ out += T(v);
++ if (out < T(v) ||
++ std::chrono::duration_cast<T>(std::chrono::milliseconds::max())
++ .count() < v)
++ {
++ return false;
++ }
++
++ fmt.remove_prefix(pos + 1U);
++ return true;
++}
+ } // namespace details
+
++/**
++ * @brief Convert string that represents value in Duration Format to its numeric
++ * equivalent.
++ */
++std::optional<std::chrono::milliseconds>
++ fromDurationString(const std::string& str)
++{
++ std::chrono::milliseconds out = std::chrono::milliseconds::zero();
++ std::string_view v = str;
++
++ if (v.empty())
++ {
++ return out;
++ }
++ if (v.front() != 'P')
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++
++ v.remove_prefix(1);
++ if (!details::fromDurationItem<details::Days>(v, 'D', out))
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++
++ if (v.empty())
++ {
++ return out;
++ }
++ if (v.front() != 'T')
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++
++ v.remove_prefix(1);
++ if (!details::fromDurationItem<std::chrono::hours>(v, 'H', out) ||
++ !details::fromDurationItem<std::chrono::minutes>(v, 'M', out))
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++
++ if (v.find('.') != std::string::npos && v.find('S') != std::string::npos)
++ {
++ if (!details::fromDurationItem<std::chrono::seconds>(v, '.', out) ||
++ !details::fromDurationItem<std::chrono::milliseconds>(v, 'S', out))
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++ }
++ else if (!details::fromDurationItem<std::chrono::seconds>(v, 'S', out))
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++
++ if (!v.empty())
++ {
++ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
++ return std::nullopt;
++ }
++ return out;
++}
++
+ /**
+ * @brief Convert time value into duration format that is based on ISO 8601.
+ * Example output: "P12DT1M5.5S"
+@@ -36,8 +178,7 @@ std::string toDurationString(std::chrono::milliseconds ms)
+ std::string fmt;
+ fmt.reserve(sizeof("PxxxxxxxxxxxxDTxxHxxMxx.xxxxxxS"));
+
+- using Days = std::chrono::duration<long, std::ratio<24 * 60 * 60>>;
+- Days days = std::chrono::floor<Days>(ms);
++ details::Days days = std::chrono::floor<details::Days>(ms);
+ ms -= days;
+
+ std::chrono::hours hours = std::chrono::floor<std::chrono::hours>(ms);
+diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
+index 48c56e6..d5a540d 100644
+--- a/redfish-core/lib/metric_report_definition.hpp
++++ b/redfish-core/lib/metric_report_definition.hpp
+@@ -1,15 +1,26 @@
+ #pragma once
+
+ #include "node.hpp"
++#include "sensors.hpp"
+ #include "utils/telemetry_utils.hpp"
+ #include "utils/time_utils.hpp"
+
++#include <boost/container/flat_map.hpp>
++
+ #include <tuple>
+ #include <variant>
+
+ namespace redfish
+ {
+
++namespace telemetry
++{
++
++using ReadingParameters =
++ std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
++ std::string, std::string, std::string>>;
++} // namespace telemetry
++
+ class MetricReportDefinitionCollection : public Node
+ {
+ public:
+@@ -39,6 +50,318 @@ class MetricReportDefinitionCollection : public Node
+ telemetry::getReportCollection(asyncResp,
+ telemetry::metricReportDefinitionUri);
+ }
++
++ struct AddReportArgs
++ {
++ std::string name;
++ std::string reportingType;
++ bool emitsReadingsUpdate = false;
++ bool logToMetricReportsCollection = false;
++ uint64_t interval = 0;
++ std::vector<std::pair<std::string, std::vector<std::string>>> metrics;
++ };
++
++ void doPost(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>&) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(res);
++ AddReportArgs args;
++ if (!getUserParameters(res, req, args))
++ {
++ return;
++ }
++
++ boost::container::flat_set<std::pair<std::string, std::string>>
++ chassisSensors;
++ if (!getChassisSensorNode(asyncResp, args.metrics, chassisSensors))
++ {
++ return;
++ }
++
++ auto addReportReq =
++ std::make_shared<AddReport>(std::move(args), asyncResp);
++ for (const auto& [chassis, sensorType] : chassisSensors)
++ {
++ retrieveUriToDbusMap(
++ chassis, sensorType,
++ [asyncResp, addReportReq](
++ 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<unsigned>(status);
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ addReportReq->insert(uriToDbus);
++ });
++ }
++ }
++
++ static bool toDbusReportActions(crow::Response& res,
++ std::vector<std::string>& actions,
++ AddReportArgs& args)
++ {
++ size_t index = 0;
++ for (auto& action : actions)
++ {
++ if (action == "RedfishEvent")
++ {
++ args.emitsReadingsUpdate = true;
++ }
++ else if (action == "LogToMetricReportsCollection")
++ {
++ args.logToMetricReportsCollection = true;
++ }
++ else
++ {
++ messages::propertyValueNotInList(
++ res, action, "ReportActions/" + std::to_string(index));
++ return false;
++ }
++ index++;
++ }
++ return true;
++ }
++
++ static bool getUserParameters(crow::Response& res, const crow::Request& req,
++ AddReportArgs& args)
++ {
++ std::vector<nlohmann::json> metrics;
++ std::vector<std::string> reportActions;
++ std::optional<nlohmann::json> schedule;
++ if (!json_util::readJson(req, res, "Id", args.name, "Metrics", metrics,
++ "MetricReportDefinitionType",
++ args.reportingType, "ReportActions",
++ reportActions, "Schedule", schedule))
++ {
++ return false;
++ }
++
++ constexpr const char* allowedCharactersInName =
++ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
++ if (args.name.empty() ||
++ args.name.find_first_not_of(allowedCharactersInName) !=
++ std::string::npos)
++ {
++ BMCWEB_LOG_ERROR << "Failed to match " << args.name
++ << " with allowed character "
++ << allowedCharactersInName;
++ messages::propertyValueIncorrect(res, "Id", args.name);
++ return false;
++ }
++
++ if (args.reportingType != "Periodic" &&
++ args.reportingType != "OnRequest")
++ {
++ messages::propertyValueNotInList(res, args.reportingType,
++ "MetricReportDefinitionType");
++ return false;
++ }
++
++ if (!toDbusReportActions(res, reportActions, args))
++ {
++ return false;
++ }
++
++ if (args.reportingType == "Periodic")
++ {
++ if (!schedule)
++ {
++ messages::createFailedMissingReqProperties(res, "Schedule");
++ return false;
++ }
++
++ std::string durationStr;
++ if (!json_util::readJson(*schedule, res, "RecurrenceInterval",
++ durationStr))
++ {
++ return false;
++ }
++
++ std::optional<std::chrono::milliseconds> durationNum =
++ time_utils::fromDurationString(durationStr);
++ if (!durationNum)
++ {
++ messages::propertyValueIncorrect(res, "RecurrenceInterval",
++ durationStr);
++ return false;
++ }
++ args.interval = static_cast<uint64_t>(durationNum->count());
++ }
++
++ args.metrics.reserve(metrics.size());
++ for (auto& m : metrics)
++ {
++ std::string id;
++ std::vector<std::string> uris;
++ if (!json_util::readJson(m, res, "MetricId", id, "MetricProperties",
++ uris))
++ {
++ return false;
++ }
++
++ args.metrics.emplace_back(std::move(id), std::move(uris));
++ }
++
++ return true;
++ }
++
++ static bool getChassisSensorNode(
++ const std::shared_ptr<AsyncResp>& asyncResp,
++ const std::vector<std::pair<std::string, std::vector<std::string>>>&
++ metrics,
++ boost::container::flat_set<std::pair<std::string, std::string>>&
++ matched)
++ {
++ for (const auto& [id, uris] : metrics)
++ {
++ for (size_t i = 0; i < uris.size(); i++)
++ {
++ const std::string& uri = uris[i];
++ std::string chassis;
++ std::string node;
++
++ if (!boost::starts_with(uri, "/redfish/v1/Chassis/") ||
++ !dbus::utility::getNthStringFromPath(uri, 3, chassis) ||
++ !dbus::utility::getNthStringFromPath(uri, 4, node))
++ {
++ BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
++ "from "
++ << uri;
++ messages::propertyValueIncorrect(asyncResp->res, uri,
++ "MetricProperties/" +
++ std::to_string(i));
++ return false;
++ }
++
++ if (boost::ends_with(node, "#"))
++ {
++ node.pop_back();
++ }
++
++ matched.emplace(std::move(chassis), std::move(node));
++ }
++ }
++ return true;
++ }
++
++ class AddReport
++ {
++ public:
++ AddReport(AddReportArgs argsIn, std::shared_ptr<AsyncResp> asyncResp) :
++ asyncResp{std::move(asyncResp)}, args{std::move(argsIn)}
++ {}
++ ~AddReport()
++ {
++ if (asyncResp->res.result() != boost::beast::http::status::ok)
++ {
++ return;
++ }
++
++ telemetry::ReadingParameters readingParams;
++ readingParams.reserve(args.metrics.size());
++
++ for (const auto& [id, uris] : args.metrics)
++ {
++ std::vector<sdbusplus::message::object_path> dbusPaths;
++ dbusPaths.reserve(uris.size());
++
++ for (size_t i = 0; i < uris.size(); i++)
++ {
++ const std::string& uri = uris[i];
++ auto el = uriToDbus.find(uri);
++ if (el == uriToDbus.end())
++ {
++ BMCWEB_LOG_ERROR << "Failed to find DBus sensor "
++ "corresponding to URI "
++ << uri;
++ messages::propertyValueNotInList(asyncResp->res, uri,
++ "MetricProperties/" +
++ std::to_string(i));
++ return;
++ }
++
++ dbusPaths.emplace_back(el->second);
++ }
++
++ nlohmann::json metadata;
++ metadata["MetricProperties"] = uris;
++ if (uris.size() == 1)
++ {
++ metadata["MetricProperty"] = uris[0];
++ }
++ readingParams.emplace_back(std::move(dbusPaths), "SINGLE", id,
++ metadata.dump());
++ }
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp = asyncResp, name = args.name](
++ const boost::system::error_code ec, const std::string&) {
++ if (ec == boost::system::errc::file_exists)
++ {
++ messages::resourceAlreadyExists(
++ asyncResp->res, "MetricReportDefinition", "Id",
++ name);
++ return;
++ }
++ if (ec == boost::system::errc::too_many_files_open)
++ {
++ messages::createLimitReachedForResource(asyncResp->res);
++ return;
++ }
++ if (ec == boost::system::errc::argument_list_too_long)
++ {
++ messages::propertyValueNotInList(
++ asyncResp->res, "/Exceeds supported size/",
++ "Metrics");
++ return;
++ }
++ if (ec == boost::system::errc::not_supported)
++ {
++ messages::propertyValueNotInList(
++ asyncResp->res,
++ "/Only single property per metric is supported/",
++ "MetricProperties");
++ return;
++ }
++ if (ec == boost::system::errc::invalid_argument)
++ {
++ messages::propertyValueNotInList(
++ asyncResp->res, "/Less then MinInterval/",
++ "RecurrenceInterval");
++ return;
++ }
++ if (ec)
++ {
++ messages::internalError(asyncResp->res);
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ return;
++ }
++
++ messages::created(asyncResp->res);
++ },
++ telemetry::service, "/xyz/openbmc_project/Telemetry/Reports",
++ "xyz.openbmc_project.Telemetry.ReportManager", "AddReport",
++ "TelemetryService/" + args.name, args.reportingType,
++ args.emitsReadingsUpdate, args.logToMetricReportsCollection,
++ args.interval, readingParams);
++ }
++
++ void insert(
++ const boost::container::flat_map<std::string, std::string>& el)
++ {
++ uriToDbus.insert(el.begin(), el.end());
++ }
++
++ private:
++ std::shared_ptr<AsyncResp> asyncResp;
++ AddReportArgs args;
++ boost::container::flat_map<std::string, std::string> uriToDbus{};
++ };
+ };
+
+ class MetricReportDefinition : public Node
+@@ -73,9 +396,10 @@ class MetricReportDefinition : public Node
+ crow::connections::systemBus->async_method_call(
+ [asyncResp,
+ id](const boost::system::error_code ec,
+- const std::vector<std::pair<
+- std::string, std::variant<bool, ReadingParameters,
+- std::string, uint64_t>>>& ret) {
++ const std::vector<
++ std::pair<std::string,
++ std::variant<bool, telemetry::ReadingParameters,
++ std::string, uint64_t>>>& ret) {
+ if (ec.value() == EBADR)
+ {
+ messages::resourceNotFound(asyncResp->res, schemaType, id);
+@@ -95,15 +419,11 @@ class MetricReportDefinition : public Node
+ telemetry::reportInterface);
+ }
+
+- using ReadingParameters =
+- std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
+- std::string, std::string, std::string>>;
+-
+ static void fillReportDefinition(
+ const std::shared_ptr<AsyncResp>& asyncResp, const std::string& id,
+- const std::vector<
+- std::pair<std::string, std::variant<bool, ReadingParameters,
+- std::string, uint64_t>>>& ret)
++ const std::vector<std::pair<
++ std::string, std::variant<bool, telemetry::ReadingParameters,
++ std::string, uint64_t>>>& ret)
+ {
+ asyncResp->res.jsonValue["@odata.type"] = schemaType;
+ asyncResp->res.jsonValue["@odata.id"] =
+@@ -117,7 +437,7 @@ class MetricReportDefinition : public Node
+
+ const bool* emitsReadingsUpdate = nullptr;
+ const bool* logToMetricReportsCollection = nullptr;
+- const ReadingParameters* readingParams = nullptr;
++ const telemetry::ReadingParameters* readingParams = nullptr;
+ const std::string* reportingType = nullptr;
+ const uint64_t* interval = nullptr;
+ for (const auto& [key, var] : ret)
+@@ -132,7 +452,7 @@ class MetricReportDefinition : public Node
+ }
+ else if (key == "ReadingParameters")
+ {
+- readingParams = std::get_if<ReadingParameters>(&var);
++ readingParams = std::get_if<telemetry::ReadingParameters>(&var);
+ }
+ else if (key == "ReportingType")
+ {
+@@ -180,6 +500,44 @@ class MetricReportDefinition : public Node
+ time_utils::toDurationString(std::chrono::milliseconds(*interval));
+ }
+
++ void doDelete(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>& params) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(res);
++ if (params.size() != 1)
++ {
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ const std::string& id = params[0];
++ const std::string reportPath = telemetry::getDbusReportPath(id);
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp, id](const boost::system::error_code ec) {
++ /*
++ * boost::system::errc and std::errc are missing value for
++ * EBADR error that is defined in Linux.
++ */
++ if (ec.value() == EBADR)
++ {
++ messages::resourceNotFound(asyncResp->res, schemaType, id);
++ return;
++ }
++
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ asyncResp->res.result(boost::beast::http::status::no_content);
++ },
++ telemetry::service, reportPath, "xyz.openbmc_project.Object.Delete",
++ "Delete");
++ }
++
+ static constexpr const char* schemaType =
+ "#MetricReportDefinition.v1_3_0.MetricReportDefinition";
+ };
+--
+2.16.6
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch
deleted file mode 100644
index c24352de5..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch
+++ /dev/null
@@ -1,598 +0,0 @@
-From 00806052b1e9440809ce727523ffcc66083f6417 Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Mon, 18 May 2020 11:56:57 +0200
-Subject: [PATCH 06/10] Add support for POST in MetricReportDefinitions
-
-Added POST action in MetricReportDefinitions node to allow user
-to add new MetricReportDefinition. Using minimal set of
-MetricReportDefinition parameters from user bmcweb converts it to
-DBus call "AddReport" to MonitoringService that serves as a backend
-for TelemetryService.
-
-Tested:
- - Succesfully passed RedfishServiceValidator.py
- - Validated good cases with different parameters for POST action
- - Validated bad cases with different parameters for POST action
- - Validated fromDurationFormat() with range of arguments starting
- from PT0.0S up to P49D (it is an upper limit for uint32_t)
-
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
-Change-Id: I2fed96848594451e22fde686f8c066d7770cc65a
-
-%% original patch: 0002-Add-support-for-POST-in-MetricReportDefinitions.patch
-
-Change-Id: I55032bc1086b60800d19bd1c0fa14fdb891f5a5b
----
- redfish-core/include/utils/time_utils.hpp | 49 +++
- .../include/utils/validate_params_length.hpp | 109 +++++++
- redfish-core/lib/metric_report_definition.hpp | 347 +++++++++++++++++++++
- 3 files changed, 505 insertions(+)
- create mode 100644 redfish-core/include/utils/validate_params_length.hpp
-
-diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
-index 0256b3f..c365585 100644
---- a/redfish-core/include/utils/time_utils.hpp
-+++ b/redfish-core/include/utils/time_utils.hpp
-@@ -57,6 +57,32 @@ std::string toDurationFormatItem(std::chrono::milliseconds& duration,
- return ss.str();
- }
-
-+template <typename T>
-+static long long fromDurationFormatItem(std::string_view& fmt,
-+ const char* postfix)
-+{
-+ auto pos = fmt.find(postfix);
-+ if (pos == std::string::npos)
-+ {
-+ return 0;
-+ }
-+
-+ long out;
-+ if constexpr (std::is_same<T, std::chrono::milliseconds>::value)
-+ {
-+ /* Half point is added to avoid numeric error on rounding */
-+ out = static_cast<long>(std::strtof(fmt.data(), nullptr) *
-+ std::chrono::milliseconds::period::den +
-+ 0.5f);
-+ }
-+ else
-+ {
-+ out = std::strtol(fmt.data(), nullptr, 10);
-+ }
-+ fmt.remove_prefix(pos + 1);
-+ return std::chrono::milliseconds(T(out)).count();
-+}
-+
- } // namespace details
-
- /**
-@@ -93,5 +119,28 @@ std::string toDurationFormat(const uint32_t ms)
- return fmt;
- }
-
-+static uint32_t fromDurationFormat(std::string_view fmt)
-+{
-+ if (fmt.empty() || fmt[0] != 'P')
-+ {
-+ return 0;
-+ }
-+ using Days = std::chrono::duration<int, std::ratio<24 * 60 * 60>>;
-+
-+ fmt.remove_prefix(1);
-+ auto out = details::fromDurationFormatItem<Days>(fmt, "D");
-+ if (fmt[0] != 'T')
-+ {
-+ return static_cast<uint32_t>(out);
-+ }
-+
-+ fmt.remove_prefix(1);
-+ out += details::fromDurationFormatItem<std::chrono::hours>(fmt, "H");
-+ out += details::fromDurationFormatItem<std::chrono::minutes>(fmt, "M");
-+ out += details::fromDurationFormatItem<std::chrono::milliseconds>(fmt, "S");
-+
-+ return static_cast<uint32_t>(out);
-+}
-+
- } // namespace time_utils
- } // namespace redfish
-diff --git a/redfish-core/include/utils/validate_params_length.hpp b/redfish-core/include/utils/validate_params_length.hpp
-new file mode 100644
-index 0000000..c4e0569
---- /dev/null
-+++ b/redfish-core/include/utils/validate_params_length.hpp
-@@ -0,0 +1,109 @@
-+#pragma once
-+
-+namespace redfish
-+{
-+namespace detail
-+{
-+template <class Limits, size_t... Seq>
-+bool validateParamsLength(crow::Response& res, Limits&& limits,
-+ std::index_sequence<Seq...>)
-+{
-+ return (... && std::get<Seq>(limits).validate(res));
-+}
-+} // namespace detail
-+
-+template <class T>
-+struct ItemSizeValidator
-+{
-+ ItemSizeValidator(const T&& item, std::string_view name, size_t limit) :
-+ item(std::forward<const T>(item)), name(name), limit(limit)
-+ {}
-+
-+ bool validate(crow::Response& res) const
-+ {
-+ return ItemSizeValidator<T>::validateItem(res, item, name, limit);
-+ }
-+
-+ private:
-+ static bool validateItem(crow::Response& res, size_t item,
-+ std::string_view name, size_t limit)
-+ {
-+ if (item > static_cast<size_t>(limit))
-+ {
-+ messages::stringValueTooLong(res, std::string(name),
-+ static_cast<int>(limit));
-+ return false;
-+ }
-+ return true;
-+ }
-+
-+ static bool validateItem(crow::Response& res, std::string_view item,
-+ std::string_view name, size_t limit)
-+ {
-+ return validateItem(res, item.size(), name, limit);
-+ }
-+
-+ static bool validateItem(crow::Response& res, const std::string& item,
-+ std::string_view name, size_t limit)
-+ {
-+ return validateItem(res, item.size(), name, limit);
-+ }
-+
-+ static bool validateItem(crow::Response& res,
-+ const sdbusplus::message::object_path& item,
-+ std::string_view name, size_t limit)
-+ {
-+ return validateItem(res, item.str.size(), name, limit);
-+ }
-+
-+ T item;
-+ std::string_view name;
-+ size_t limit;
-+};
-+
-+template <class T>
-+ItemSizeValidator(const T&, std::string_view, size_t)
-+ -> ItemSizeValidator<const T&>;
-+
-+ItemSizeValidator(const char*, std::string_view, size_t)
-+ ->ItemSizeValidator<std::string_view>;
-+
-+template <class ContainerT>
-+struct ArrayItemsValidator
-+{
-+ ArrayItemsValidator(const ContainerT& item, std::string_view name,
-+ size_t limit) :
-+ item(item),
-+ name(name), limit(limit)
-+ {}
-+
-+ bool validate(crow::Response& res) const
-+ {
-+ return std::all_of(
-+ item.begin(), item.end(), [&res, this](const auto& item) {
-+ return ItemSizeValidator(item, name, limit).validate(res);
-+ });
-+ }
-+
-+ private:
-+ const ContainerT& item;
-+ std::string_view name;
-+ size_t limit;
-+};
-+
-+template <class T>
-+bool validateParamLength(crow::Response& res, T&& item, std::string_view name,
-+ size_t limit)
-+{
-+ return ItemSizeValidator(std::forward<T>(item), name, limit).validate(res);
-+}
-+
-+template <class Limits>
-+bool validateParamsLength(crow::Response& res, Limits&& limits)
-+{
-+ return detail::validateParamsLength(
-+ res, std::forward<Limits>(limits),
-+ std::make_index_sequence<std::tuple_size_v<std::decay_t<Limits>>>());
-+}
-+
-+} // namespace redfish
-diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
-index 72e62e9..c6b09f8 100644
---- a/redfish-core/lib/metric_report_definition.hpp
-+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -17,16 +17,29 @@
- #pragma once
-
- #include "node.hpp"
-+#include "sensors.hpp"
- #include "utils/telemetry_utils.hpp"
- #include "utils/time_utils.hpp"
-+#include "utils/validate_params_length.hpp"
-
-+#include <boost/algorithm/string/join.hpp>
-+#include <boost/algorithm/string/split.hpp>
- #include <boost/container/flat_map.hpp>
-
-+#include <regex>
- #include <system_error>
-+#include <tuple>
- #include <variant>
-
- namespace redfish
- {
-+static constexpr size_t maxShortParamLength = 255;
-+static constexpr size_t maxLongParamLength = 1024;
-+static constexpr size_t maxDbusNameLength = 255;
-+static constexpr size_t maxArraySize = 100;
-+static constexpr size_t maxReportIdLen =
-+ maxDbusNameLength - std::string_view(telemetry::telemetryPath).size() -
-+ std::string_view("/").size();
-
- class MetricReportDefinitionCollection : public Node
- {
-@@ -57,6 +70,339 @@ class MetricReportDefinitionCollection : public Node
- telemetry::getReportCollection(asyncResp,
- telemetry::metricReportDefinitionUri);
- }
-+
-+ using ChassisSensorNode = std::pair<std::string, std::string>;
-+ using DbusSensor = sdbusplus::message::object_path;
-+ using DbusSensors = std::vector<DbusSensor>;
-+ using MetricParam =
-+ std::tuple<DbusSensors, std::string, std::string, std::string>;
-+ using MetricParams = std::vector<MetricParam>;
-+ /*
-+ * AddReportArgs misses "Domain" parameter because it is constant for
-+ * TelemetryService and equals "TelemetryService".
-+ */
-+ using AddReportArgs =
-+ std::tuple<std::string, std::string, std::vector<std::string>, uint32_t,
-+ MetricParams>;
-+
-+ void doPost(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>&) override
-+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ AddReportArgs addReportArgs;
-+ if (!getUserParameters(res, req, addReportArgs))
-+ {
-+ return;
-+ }
-+
-+ boost::container::flat_set<ChassisSensorNode> chassisSensorSet;
-+ auto unmatched = getChassisSensorNode(
-+ std::get<MetricParams>(addReportArgs), chassisSensorSet);
-+ if (unmatched)
-+ {
-+ messages::resourceNotFound(asyncResp->res, "MetricProperties",
-+ *unmatched);
-+ return;
-+ }
-+
-+ auto addReportReq =
-+ std::make_shared<AddReport>(addReportArgs, asyncResp);
-+ for (auto& [chassis, sensorType] : chassisSensorSet)
-+ {
-+ retrieveUriToDbusMap(
-+ chassis, sensorType,
-+ [asyncResp, addReportReq](
-+ const boost::beast::http::status,
-+ const boost::container::flat_map<std::string, std::string>&
-+ uriToDbus) { *addReportReq += uriToDbus; });
-+ }
-+ }
-+
-+ static std::optional<std::string>
-+ replaceReportActions(std::vector<std::string>& actions)
-+ {
-+ const boost::container::flat_map<std::string, std::string>
-+ reportActions = {
-+ {"RedfishEvent", "Event"},
-+ {"LogToMetricReportsCollection", "Log"},
-+ };
-+
-+ for (auto& action : actions)
-+ {
-+ auto found = reportActions.find(action);
-+ if (found == reportActions.end())
-+ {
-+ return action;
-+ }
-+ action = found->second;
-+ }
-+ return std::nullopt;
-+ }
-+
-+ static constexpr const std::array<const char*, 2> supportedDefinitionType =
-+ {"Periodic", "OnRequest"};
-+
-+ static bool getUserParameters(crow::Response& res, const crow::Request& req,
-+ AddReportArgs& params)
-+ {
-+ std::vector<nlohmann::json> metrics;
-+ std::optional<nlohmann::json> schedule;
-+ auto& [name, reportingType, reportActions, scanPeriod, metricParams] =
-+ params;
-+ if (!json_util::readJson(req, res, "Id", name, "Metrics", metrics,
-+ "MetricReportDefinitionType", reportingType,
-+ "ReportActions", reportActions, "Schedule",
-+ schedule))
-+ {
-+ return false;
-+ }
-+
-+ auto limits = std::make_tuple(
-+ ItemSizeValidator(name, "Id", maxReportIdLen),
-+ ItemSizeValidator(reportingType, "MetricReportDefinitionType",
-+ maxShortParamLength),
-+ ItemSizeValidator(reportActions.size(), "ReportActions.size()",
-+ maxArraySize),
-+ ArrayItemsValidator(reportActions, "ReportActions",
-+ maxShortParamLength),
-+ ItemSizeValidator(metrics.size(), "Metrics.size()", maxArraySize));
-+
-+ if (!validateParamsLength(res, std::move(limits)))
-+ {
-+ return false;
-+ }
-+
-+ constexpr const char* allowedCharactersInName =
-+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-+ "_";
-+ if (name.empty() || name.find_first_not_of(allowedCharactersInName) !=
-+ std::string::npos)
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to match " << name
-+ << " with allowed character "
-+ << allowedCharactersInName;
-+ messages::propertyValueFormatError(res, name, "Id");
-+ return false;
-+ }
-+
-+ if (!std::any_of(
-+ supportedDefinitionType.begin(), supportedDefinitionType.end(),
-+ [reportingType](auto& x) { return reportingType == x; }))
-+ {
-+ messages::propertyValueNotInList(res, reportingType,
-+ "MetricReportDefinitionType");
-+ return false;
-+ }
-+
-+ auto unmatched = replaceReportActions(reportActions);
-+ if (unmatched)
-+ {
-+ messages::propertyValueNotInList(res, *unmatched, "ReportActions");
-+ return false;
-+ }
-+
-+ if (reportingType == "Periodic")
-+ {
-+ if (!schedule)
-+ {
-+ messages::createFailedMissingReqProperties(res, "Schedule");
-+ return false;
-+ }
-+
-+ std::string interval;
-+ if (!json_util::readJson(*schedule, res, "RecurrenceInterval",
-+ interval))
-+ {
-+ return false;
-+ }
-+
-+ if (!validateParamLength(res, interval, "RecurrenceInterval",
-+ maxShortParamLength))
-+ {
-+ return false;
-+ }
-+
-+ constexpr const char* durationPattern =
-+ "-?P(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(.\\d+)?S)?)?";
-+ if (!std::regex_match(interval, std::regex(durationPattern)))
-+ {
-+ messages::propertyValueFormatError(res, interval,
-+ "RecurrenceInterval");
-+ return false;
-+ }
-+
-+ scanPeriod = time_utils::fromDurationFormat(interval);
-+ }
-+
-+ return fillMetricParams(metrics, res, metricParams);
-+ }
-+
-+ static bool fillMetricParams(std::vector<nlohmann::json>& metrics,
-+ crow::Response& res,
-+ MetricParams& metricParams)
-+ {
-+ metricParams.reserve(metrics.size());
-+ for (auto& m : metrics)
-+ {
-+ std::string metricId;
-+ std::vector<std::string> metricProperties;
-+ if (!json_util::readJson(m, res, "MetricId", metricId,
-+ "MetricProperties", metricProperties))
-+ {
-+ return false;
-+ }
-+
-+ auto limits = std::make_tuple(
-+ ItemSizeValidator(metricId, "MetricId", maxLongParamLength),
-+ ItemSizeValidator(metricProperties.size(),
-+ "MetricProperties.size()", maxArraySize),
-+ ArrayItemsValidator(metricProperties, "MetricProperties",
-+ maxLongParamLength));
-+
-+ if (!validateParamsLength(res, std::move(limits)))
-+ {
-+ return false;
-+ }
-+
-+ DbusSensors dbusSensors;
-+ dbusSensors.reserve(metricProperties.size());
-+ std::for_each(
-+ metricProperties.begin(), metricProperties.end(),
-+ [&dbusSensors](auto& x) { dbusSensors.emplace_back(x); });
-+
-+ metricParams.emplace_back(
-+ dbusSensors, "SINGLE", metricId,
-+ boost::algorithm::join(metricProperties, ", "));
-+ }
-+ return true;
-+ }
-+
-+ static std::optional<std::string> getChassisSensorNode(
-+ const MetricParams& metricParams,
-+ boost::container::flat_set<ChassisSensorNode>& matched)
-+ {
-+ for (const auto& metricParam : metricParams)
-+ {
-+ const auto& sensors = std::get<DbusSensors>(metricParam);
-+ for (const auto& sensor : sensors)
-+ {
-+ /*
-+ * Support only following paths:
-+ * "/redfish/v1/Chassis/<chassis>/Power#/..."
-+ * "/redfish/v1/Chassis/<chassis>/Sensors/..."
-+ * "/redfish/v1/Chassis/<chassis>/Thermal#/..."
-+ */
-+ constexpr const char* uriPattern =
-+ "\\/redfish\\/v1\\/Chassis\\/(\\w+)\\/"
-+ "(Power|Sensors|Thermal)[#]?\\/.*";
-+ std::smatch m;
-+ if (!std::regex_match(sensor.str, m, std::regex(uriPattern)) ||
-+ m.size() != 3)
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to match " << sensor.str
-+ << " with pattern " << uriPattern;
-+ return sensor;
-+ }
-+
-+ BMCWEB_LOG_DEBUG << "Chassis=" << m[1] << ", Type=" << m[2];
-+ matched.emplace(m[1], m[2]);
-+ }
-+ }
-+ return std::nullopt;
-+ }
-+
-+ static std::optional<std::string> replaceUriWithDbus(
-+ const boost::container::flat_map<std::string, std::string>& uriToDbus,
-+ MetricParams& metricParams)
-+ {
-+ for (auto& metricParam : metricParams)
-+ {
-+ auto& dbusSensors = std::get<DbusSensors>(metricParam);
-+ for (auto& uri : dbusSensors)
-+ {
-+ auto dbus = uriToDbus.find(uri);
-+ if (dbus == uriToDbus.end())
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to find DBus sensor "
-+ "corresponding to URI "
-+ << uri.str;
-+ return uri;
-+ }
-+ uri = dbus->second;
-+ }
-+ }
-+ return std::nullopt;
-+ }
-+
-+ static void addReport(std::shared_ptr<AsyncResp> asyncResp,
-+ AddReportArgs args)
-+ {
-+ constexpr const char* domain = "TelemetryService";
-+ auto& [name, reportingType, reportActions, scanPeriod, metricParams] =
-+ args;
-+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp, name](const boost::system::error_code ec,
-+ const std::string) {
-+ if (ec == boost::system::errc::file_exists)
-+ {
-+ messages::resourceAlreadyExists(
-+ asyncResp->res, "MetricReportDefinition", "Id", name);
-+ return;
-+ }
-+ if (ec == boost::system::errc::too_many_files_open)
-+ {
-+ messages::createLimitReachedForResource(asyncResp->res);
-+ return;
-+ }
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
-+ }
-+
-+ messages::created(asyncResp->res);
-+ },
-+ "xyz.openbmc_project.MonitoringService",
-+ "/xyz/openbmc_project/MonitoringService/Reports",
-+ "xyz.openbmc_project.MonitoringService.ReportsManagement",
-+ "AddReport", name, domain, reportingType, reportActions, scanPeriod,
-+ metricParams);
-+ }
-+
-+ class AddReport
-+ {
-+ public:
-+ AddReport(AddReportArgs& args, std::shared_ptr<AsyncResp>& asyncResp) :
-+ asyncResp{asyncResp}, addReportArgs{args}
-+ {}
-+ ~AddReport()
-+ {
-+ auto unmatched = replaceUriWithDbus(
-+ uriToDbus, std::get<MetricParams>(addReportArgs));
-+ if (unmatched)
-+ {
-+ messages::resourceNotFound(asyncResp->res, "MetricProperties",
-+ *unmatched);
-+ return;
-+ }
-+
-+ addReport(asyncResp, addReportArgs);
-+ }
-+
-+ AddReport& operator+=(
-+ const boost::container::flat_map<std::string, std::string>& rhs)
-+ {
-+ this->uriToDbus.insert(rhs.begin(), rhs.end());
-+ return *this;
-+ }
-+
-+ private:
-+ std::shared_ptr<AsyncResp> asyncResp;
-+ AddReportArgs addReportArgs;
-+ boost::container::flat_map<std::string, std::string> uriToDbus{};
-+ };
- };
-
- class MetricReportDefinition : public Node
-@@ -146,6 +492,7 @@ class MetricReportDefinition : public Node
- asyncResp->res.jsonValue["MetricReport"]["@odata.id"] =
- telemetry::metricReportUri + id;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
-+ asyncResp->res.jsonValue["ReportUpdates"] = "Overwrite";
-
- dbus::utility::getAllProperties(
- [asyncResp](const boost::system::error_code ec,
---
-2.16.6
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
deleted file mode 100644
index dee5a158b..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 5a1eef4a6c74c29d9b9026676e59e6cdf0a7e8bd Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Mon, 18 May 2020 12:40:15 +0200
-Subject: [PATCH 07/10] Add support for DELETE in MetricReportDefinitions/<str>
-
-Added support for DELETE action in MetricReportDefinitions/<str>
-node. It allows user to remove MetricReportDefinition together
-with MetricReport connected to it.
-
-Tested:
- - Succesfully passed RedfishServiceValidator.py
- - Validated DELETE action by removing exisiting
- MetricReportDefinitions from MonitoringService
- - Validated DELETE action with negative cases when
- MetricReportDefinition does not exist
-
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Change-Id: Iffde9f7bbf2955376e9714ac8d833967bd25eaa3
-
-%% original patch: 0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
-
-Change-Id: I2930b9354fd4cf1f8d9a97af33b81c7b689fe0ef
----
- redfish-core/lib/metric_report_definition.hpp | 32 +++++++++++++++++++++++++++
- 1 file changed, 32 insertions(+)
-
-diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
-index c6b09f8..3191a8f 100644
---- a/redfish-core/lib/metric_report_definition.hpp
-+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -531,6 +531,38 @@ class MetricReportDefinition : public Node
- "xyz.openbmc_project.MonitoringService.Report");
- }
-
-+ void doDelete(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>& params) override
-+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ if (params.size() != 1)
-+ {
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ const std::string& id = params[0];
-+ telemetry::getReport(asyncResp, id, schemaType, deleteReport);
-+ }
-+
-+ static void deleteReport(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& path, const std::string&)
-+ {
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ asyncResp->res.result(boost::beast::http::status::no_content);
-+ },
-+ "xyz.openbmc_project.MonitoringService", path,
-+ "xyz.openbmc_project.Object.Delete", "Delete");
-+ }
-+
- public:
- static constexpr const char* schemaType =
- "#MetricReportDefinition.v1_3_0.MetricReportDefinition";
---
-2.16.6
-
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
new file mode 100644
index 000000000..d81d654f1
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch
@@ -0,0 +1,709 @@
+From b074a84560349fdbd46604ab0b8c75804de09fef Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Mon, 8 Jun 2020 17:15:54 +0200
+Subject: [PATCH 3/4] Add support for MetricDefinition scheme
+
+Added MetricDefinition node to redfish core. Now user is able to
+get all possible metrics that are present in system and are
+supported by TelemetryService.
+Added generic function to fill ReadingUnits and ReadingType
+in Sensor scheme.
+
+Tested:
+ - Succesfully passed RedfishServiceValidator.py
+ - Validated a presence of MetricDefinition members
+
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
+---
+ redfish-core/include/redfish.hpp | 3 +
+ redfish-core/include/utils/telemetry_utils.hpp | 56 ++---
+ redfish-core/lib/metric_definition.hpp | 269 +++++++++++++++++++++++++
+ redfish-core/lib/metric_report_definition.hpp | 22 ++
+ redfish-core/lib/power.hpp | 4 +-
+ redfish-core/lib/sensors.hpp | 104 +++++++---
+ redfish-core/lib/telemetry_service.hpp | 2 +
+ redfish-core/lib/thermal.hpp | 4 +-
+ 8 files changed, 410 insertions(+), 54 deletions(-)
+ create mode 100644 redfish-core/lib/metric_definition.hpp
+
+diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
+index 2587b37..705f490 100644
+--- a/redfish-core/include/redfish.hpp
++++ b/redfish-core/include/redfish.hpp
+@@ -25,6 +25,7 @@
+ #include "../lib/managers.hpp"
+ #include "../lib/memory.hpp"
+ #include "../lib/message_registries.hpp"
++#include "../lib/metric_definition.hpp"
+ #include "../lib/metric_report.hpp"
+ #include "../lib/metric_report_definition.hpp"
+ #include "../lib/network_protocol.hpp"
+@@ -211,6 +212,8 @@ class RedfishService
+ nodes.emplace_back(std::make_unique<HypervisorSystem>(app));
+
+ nodes.emplace_back(std::make_unique<TelemetryService>(app));
++ nodes.emplace_back(std::make_unique<MetricDefinitionCollection>(app));
++ nodes.emplace_back(std::make_unique<MetricDefinition>(app));
+ nodes.emplace_back(
+ std::make_unique<MetricReportDefinitionCollection>(app));
+ nodes.emplace_back(std::make_unique<MetricReportDefinition>(app));
+diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
+index acb739d..c13a79b 100644
+--- a/redfish-core/include/utils/telemetry_utils.hpp
++++ b/redfish-core/include/utils/telemetry_utils.hpp
+@@ -8,6 +8,8 @@ namespace telemetry
+
+ constexpr const char* service = "xyz.openbmc_project.Telemetry";
+ constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report";
++constexpr const char* metricDefinitionUri =
++ "/redfish/v1/TelemetryService/MetricDefinitions/";
+ constexpr const char* metricReportDefinitionUri =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/";
+ constexpr const char* metricReportUri =
+@@ -15,6 +17,36 @@ constexpr const char* metricReportUri =
+ constexpr const char* reportDir =
+ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService/";
+
++inline void dbusPathsToMembers(const std::shared_ptr<AsyncResp>& asyncResp,
++ const std::vector<std::string>& paths,
++ const std::string& uri)
++{
++ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
++ members = nlohmann::json::array();
++
++ for (const std::string& path : paths)
++ {
++ std::size_t pos = path.rfind('/');
++ if (pos == std::string::npos)
++ {
++ BMCWEB_LOG_ERROR << "Failed to find '/' in " << path;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ if (path.size() <= (pos + 1))
++ {
++ BMCWEB_LOG_ERROR << "Failed to parse path " << path;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ members.push_back({{"@odata.id", uri + path.substr(pos + 1)}});
++ }
++
++ asyncResp->res.jsonValue["Members@odata.count"] = members.size();
++}
++
+ inline void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& uri)
+ {
+@@ -30,29 +62,7 @@ inline void getReportCollection(const std::shared_ptr<AsyncResp>& asyncResp,
+ return;
+ }
+
+- nlohmann::json& members = asyncResp->res.jsonValue["Members"];
+- members = nlohmann::json::array();
+-
+- for (const std::string& path : reportPaths)
+- {
+- std::size_t pos = path.rfind('/');
+- if (pos == std::string::npos)
+- {
+- BMCWEB_LOG_ERROR << "Failed to find '/' in " << path;
+- messages::internalError(asyncResp->res);
+- return;
+- }
+- if (path.size() <= (pos + 1))
+- {
+- BMCWEB_LOG_ERROR << "Failed to parse path " << path;
+- messages::internalError(asyncResp->res);
+- return;
+- }
+-
+- members.push_back({{"@odata.id", uri + path.substr(pos + 1)}});
+- }
+-
+- asyncResp->res.jsonValue["Members@odata.count"] = members.size();
++ dbusPathsToMembers(asyncResp, reportPaths, uri);
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp
+new file mode 100644
+index 0000000..f037ed2
+--- /dev/null
++++ b/redfish-core/lib/metric_definition.hpp
+@@ -0,0 +1,269 @@
++#pragma once
++
++#include "node.hpp"
++#include "sensors.hpp"
++#include "utils/telemetry_utils.hpp"
++
++namespace redfish
++{
++
++namespace utils
++{
++
++template <typename F>
++inline void getChassisNames(F&& cb)
++{
++ const std::array<const char*, 2> interfaces = {
++ "xyz.openbmc_project.Inventory.Item.Board",
++ "xyz.openbmc_project.Inventory.Item.Chassis"};
++
++ crow::connections::systemBus->async_method_call(
++ [callback = std::move(cb)](const boost::system::error_code ec,
++ std::vector<std::string>& chassisList) {
++ if (ec)
++ {
++ BMCWEB_LOG_DEBUG << "DBus call error: " << ec.value();
++ return;
++ }
++
++ std::vector<std::string> chassisNames;
++ chassisNames.reserve(chassisList.size());
++ for (const std::string& chassisPath : chassisList)
++ {
++ size_t pos = chassisPath.rfind('/');
++ if (pos == std::string::npos)
++ {
++ continue;
++ }
++ chassisNames.push_back(chassisPath.substr(pos + 1));
++ }
++
++ callback(chassisNames);
++ },
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
++ "/xyz/openbmc_project/inventory", 0, interfaces);
++}
++} // namespace utils
++
++class MetricDefinitionCollection : public Node
++{
++ public:
++ MetricDefinitionCollection(App& app) :
++ Node(app, "/redfish/v1/TelemetryService/MetricDefinitions/")
++ {
++ entityPrivileges = {
++ {boost::beast::http::verb::get, {{"Login"}}},
++ {boost::beast::http::verb::head, {{"Login"}}},
++ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
++ }
++
++ private:
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>&) override
++ {
++ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection."
++ "MetricDefinitionCollection";
++ 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;
++
++ auto asyncResp = std::make_shared<AsyncResp>(res);
++ auto collectionReduce = std::make_shared<CollectionGather>(asyncResp);
++ utils::getChassisNames(
++ [asyncResp,
++ collectionReduce](const std::vector<std::string>& chassisNames) {
++ 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<unsigned>(status);
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ collectionReduce->insert(uriToDbus);
++ });
++ }
++ }
++ });
++ }
++
++ class CollectionGather
++ {
++ public:
++ CollectionGather(const std::shared_ptr<AsyncResp>& asyncResp) :
++ asyncResp{asyncResp}
++ {}
++
++ ~CollectionGather()
++ {
++ if (asyncResp->res.result() != boost::beast::http::status::ok)
++ {
++ return;
++ }
++
++ telemetry::dbusPathsToMembers(
++ asyncResp,
++ std::vector<std::string>(dbusTypes.begin(), dbusTypes.end()),
++ telemetry::metricDefinitionUri);
++ }
++
++ void insert(
++ const boost::container::flat_map<std::string, std::string>& el)
++ {
++ for (const auto& [_, dbusSensor] : el)
++ {
++ size_t pos = dbusSensor.rfind('/');
++ if (pos == std::string::npos)
++ {
++ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = "
++ << dbusSensor;
++ continue;
++ }
++
++ dbusTypes.insert(dbusSensor.substr(0, pos));
++ }
++ }
++
++ private:
++ const std::shared_ptr<AsyncResp> asyncResp;
++ boost::container::flat_set<std::string> dbusTypes;
++ };
++};
++
++class MetricDefinition : public Node
++{
++ public:
++ MetricDefinition(App& app) :
++ Node(app, "/redfish/v1/TelemetryService/MetricDefinitions/<str>/",
++ std::string())
++ {
++ entityPrivileges = {
++ {boost::beast::http::verb::get, {{"Login"}}},
++ {boost::beast::http::verb::head, {{"Login"}}},
++ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
++ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
++ }
++
++ private:
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>& params) override
++ {
++ auto asyncResp = std::make_shared<AsyncResp>(res);
++ if (params.size() != 1)
++ {
++ messages::internalError(asyncResp->res);
++ return;
++ }
++
++ const std::string& id = params[0];
++ auto definitionGather =
++ std::make_shared<DefinitionGather>(asyncResp, id);
++ utils::getChassisNames(
++ [asyncResp,
++ definitionGather](const std::vector<std::string>& chassisNames) {
++ 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<unsigned>(status);
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ definitionGather->insert(uriToDbus);
++ });
++ }
++ }
++ });
++ }
++
++ class DefinitionGather
++ {
++ public:
++ DefinitionGather(const std::shared_ptr<AsyncResp>& asyncResp,
++ const std::string& id) :
++ id(id),
++ pattern{'/' + id + '/'}, asyncResp{asyncResp}
++ {}
++ ~DefinitionGather()
++ {
++ if (asyncResp->res.result() != boost::beast::http::status::ok)
++ {
++ return;
++ }
++ if (redfishSensors.empty())
++ {
++ messages::resourceNotFound(asyncResp->res, schemaType, id);
++ return;
++ }
++
++ 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"] = schemaType;
++ 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<std::string, std::string>& el)
++ {
++ for (const auto& [redfishSensor, dbusSensor] : el)
++ {
++ if (dbusSensor.find(pattern) != std::string::npos)
++ {
++ redfishSensors.push_back(redfishSensor);
++ }
++ }
++ }
++
++ const std::string id;
++ const std::string pattern;
++
++ private:
++ const std::shared_ptr<AsyncResp> asyncResp;
++ std::vector<std::string> redfishSensors;
++ };
++
++ static constexpr const char* schemaType =
++ "#MetricDefinition.v1_0_3.MetricDefinition";
++};
++
++} // namespace redfish
+diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
+index d5a540d..03f0b82 100644
+--- a/redfish-core/lib/metric_report_definition.hpp
++++ b/redfish-core/lib/metric_report_definition.hpp
+@@ -269,6 +269,8 @@ class MetricReportDefinitionCollection : public Node
+ {
+ std::vector<sdbusplus::message::object_path> dbusPaths;
+ dbusPaths.reserve(uris.size());
++ std::string sensorType;
++ bool invalidType = false;
+
+ for (size_t i = 0; i < uris.size(); i++)
+ {
+@@ -286,6 +288,21 @@ class MetricReportDefinitionCollection : public Node
+ }
+
+ dbusPaths.emplace_back(el->second);
++
++ if (invalidType)
++ {
++ continue;
++ }
++ std::string tmp;
++ dbus::utility::getNthStringFromPath(el->second, 3, tmp);
++ if (sensorType.empty())
++ {
++ sensorType = std::move(tmp);
++ }
++ else if (sensorType != tmp)
++ {
++ invalidType = true;
++ }
+ }
+
+ nlohmann::json metadata;
+@@ -294,6 +311,11 @@ class MetricReportDefinitionCollection : public Node
+ {
+ metadata["MetricProperty"] = uris[0];
+ }
++ if (!sensorType.empty() && !invalidType)
++ {
++ metadata["MetricDefinition"]["@odata.id"] =
++ telemetry::metricDefinitionUri + sensorType;
++ }
+ readingParams.emplace_back(std::move(dbusPaths), "SINGLE", id,
+ metadata.dump());
+ }
+diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
+index 1c7a009..99c45ef 100644
+--- a/redfish-core/lib/power.hpp
++++ b/redfish-core/lib/power.hpp
+@@ -153,7 +153,7 @@ class Power : public Node
+ res.jsonValue["PowerControl"] = nlohmann::json::array();
+
+ auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
+- res, chassisName, sensors::dbus::types.at(sensors::node::power),
++ res, chassisName, sensors::dbus::paths.at(sensors::node::power),
+ sensors::node::power);
+
+ getChassisData(sensorAsyncResp);
+@@ -336,7 +336,7 @@ class Power : public Node
+
+ const std::string& chassisName = params[0];
+ auto asyncResp = std::make_shared<SensorsAsyncResp>(
+- res, chassisName, sensors::dbus::types.at(sensors::node::power),
++ res, chassisName, sensors::dbus::paths.at(sensors::node::power),
+ sensors::node::power);
+
+ std::optional<std::vector<nlohmann::json>> voltageCollections;
+diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
+index 567cb0c..363713d 100644
+--- a/redfish-core/lib/sensors.hpp
++++ b/redfish-core/lib/sensors.hpp
+@@ -54,9 +54,10 @@ static constexpr std::string_view thermal = "Thermal";
+
+ namespace dbus
+ {
++
+ static const boost::container::flat_map<std::string_view,
+ std::vector<const char*>>
+- types = {{node::power,
++ paths = {{node::power,
+ {"/xyz/openbmc_project/sensors/voltage",
+ "/xyz/openbmc_project/sensors/power"}},
+ {node::sensors,
+@@ -67,6 +68,64 @@ static const boost::container::flat_map<std::string_view,
+ {"/xyz/openbmc_project/sensors/fan_tach",
+ "/xyz/openbmc_project/sensors/temperature",
+ "/xyz/openbmc_project/sensors/fan_pwm"}}};
++} // namespace dbus
++
++inline const char* toReadingType(const std::string& sensorType)
++{
++ if (sensorType == "voltage")
++ {
++ return "Voltage";
++ }
++ if (sensorType == "power")
++ {
++ return "Power";
++ }
++ if (sensorType == "current")
++ {
++ return "Current";
++ }
++ if (sensorType == "fan_tach")
++ {
++ return "Rotational";
++ }
++ if (sensorType == "temperature")
++ {
++ return "Temperature";
++ }
++ if (sensorType == "fan_pwm" || sensorType == "utilization")
++ {
++ return "Percent";
++ }
++ return "";
++}
++
++inline const char* toReadingUnits(const std::string& sensorType)
++{
++ if (sensorType == "voltage")
++ {
++ return "V";
++ }
++ if (sensorType == "power")
++ {
++ return "W";
++ }
++ if (sensorType == "current")
++ {
++ return "A";
++ }
++ if (sensorType == "fan_tach")
++ {
++ return "RPM";
++ }
++ if (sensorType == "temperature")
++ {
++ return "Cel";
++ }
++ if (sensorType == "fan_pwm" || sensorType == "utilization")
++ {
++ return "%";
++ }
++ return "";
+ }
+ } // namespace sensors
+
+@@ -90,19 +149,20 @@ class SensorsAsyncResp
+ };
+
+ SensorsAsyncResp(crow::Response& response, const std::string& chassisIdIn,
+- const std::vector<const char*>& typesIn,
++ const std::vector<const char*>& matchPathsIn,
+ const std::string_view& subNode) :
+ res(response),
+- chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode)
++ chassisId(chassisIdIn), matchPaths(matchPathsIn),
++ chassisSubNode(subNode)
+ {}
+
+ // Store extra data about sensor mapping and return it in callback
+ SensorsAsyncResp(crow::Response& response, const std::string& chassisIdIn,
+- const std::vector<const char*>& typesIn,
++ const std::vector<const char*>& matchPathsIn,
+ const std::string_view& subNode,
+ DataCompleteCb&& creationComplete) :
+ res(response),
+- chassisId(chassisIdIn), types(typesIn),
++ chassisId(chassisIdIn), matchPaths(matchPathsIn),
+ chassisSubNode(subNode), metadata{std::vector<SensorData>()},
+ dataComplete{std::move(creationComplete)}
+ {}
+@@ -161,7 +221,7 @@ class SensorsAsyncResp
+
+ crow::Response& res;
+ const std::string chassisId;
+- const std::vector<const char*> types;
++ const std::vector<const char*> matchPaths;
+ const std::string chassisSubNode;
+
+ private:
+@@ -320,20 +380,20 @@ void getConnections(
+ * made, and eliminate Power sensors when a Thermal request is made.
+ */
+ inline void reduceSensorList(
+- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
++ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
+ const std::vector<std::string>* allSensors,
+ const std::shared_ptr<boost::container::flat_set<std::string>>&
+ activeSensors)
+ {
+- if (SensorsAsyncResp == nullptr)
++ if (sensorsAsyncResp == nullptr)
+ {
+ return;
+ }
+ if ((allSensors == nullptr) || (activeSensors == nullptr))
+ {
+ messages::resourceNotFound(
+- SensorsAsyncResp->res, SensorsAsyncResp->chassisSubNode,
+- SensorsAsyncResp->chassisSubNode == sensors::node::thermal
++ sensorsAsyncResp->res, sensorsAsyncResp->chassisSubNode,
++ sensorsAsyncResp->chassisSubNode == sensors::node::thermal
+ ? "Temperatures"
+ : "Voltages");
+
+@@ -345,11 +405,11 @@ inline void reduceSensorList(
+ return;
+ }
+
+- for (const char* type : SensorsAsyncResp->types)
++ for (const char* path : sensorsAsyncResp->matchPaths)
+ {
+ for (const std::string& sensor : *allSensors)
+ {
+- if (boost::starts_with(sensor, type))
++ if (boost::starts_with(sensor, path))
+ {
+ activeSensors->emplace(sensor);
+ }
+@@ -853,18 +913,8 @@ inline void objectInterfacesToJson(
+ if (sensorsAsyncResp->chassisSubNode == sensors::node::sensors)
+ {
+ sensor_json["@odata.type"] = "#Sensor.v1_0_0.Sensor";
+- if (sensorType == "power")
+- {
+- sensor_json["ReadingUnits"] = "Watts";
+- }
+- else if (sensorType == "current")
+- {
+- sensor_json["ReadingUnits"] = "Amperes";
+- }
+- else if (sensorType == "utilization")
+- {
+- sensor_json["ReadingUnits"] = "Percent";
+- }
++ sensor_json["ReadingType"] = sensors::toReadingType(sensorType);
++ sensor_json["ReadingUnits"] = sensors::toReadingUnits(sensorType);
+ }
+ else if (sensorType == "temperature")
+ {
+@@ -2976,8 +3026,8 @@ inline void retrieveUriToDbusMap(const std::string& chassis,
+ const std::string& node,
+ SensorsAsyncResp::DataCompleteCb&& mapComplete)
+ {
+- auto typesIt = sensors::dbus::types.find(node);
+- if (typesIt == sensors::dbus::types.end())
++ auto typesIt = sensors::dbus::paths.find(node);
++ if (typesIt == sensors::dbus::paths.end())
+ {
+ BMCWEB_LOG_ERROR << "Wrong node provided : " << node;
+ mapComplete(boost::beast::http::status::bad_request, {});
+@@ -3027,7 +3077,7 @@ class SensorCollection : public Node
+ const std::string& chassisId = params[0];
+ std::shared_ptr<SensorsAsyncResp> asyncResp =
+ std::make_shared<SensorsAsyncResp>(
+- res, chassisId, sensors::dbus::types.at(sensors::node::sensors),
++ res, chassisId, sensors::dbus::paths.at(sensors::node::sensors),
+ sensors::node::sensors);
+
+ auto getChassisCb =
+diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
+index a6acc34..8105d86 100644
+--- a/redfish-core/lib/telemetry_service.hpp
++++ b/redfish-core/lib/telemetry_service.hpp
+@@ -34,6 +34,8 @@ class TelemetryService : public Node
+
+ res.jsonValue["LogService"]["@odata.id"] =
+ "/redfish/v1/Managers/bmc/LogServices/Journal";
++ res.jsonValue["MetricDefinitions"]["@odata.id"] =
++ "/redfish/v1/TelemetryService/MetricDefinitions";
+ res.jsonValue["MetricReportDefinitions"]["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions";
+ res.jsonValue["MetricReports"]["@odata.id"] =
+diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp
+index 8e01bee..00acdf9 100644
+--- a/redfish-core/lib/thermal.hpp
++++ b/redfish-core/lib/thermal.hpp
+@@ -48,7 +48,7 @@ class Thermal : public Node
+ }
+ const std::string& chassisName = params[0];
+ auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
+- res, chassisName, sensors::dbus::types.at(sensors::node::thermal),
++ res, chassisName, sensors::dbus::paths.at(sensors::node::thermal),
+ sensors::node::thermal);
+
+ // TODO Need to get Chassis Redundancy information.
+@@ -71,7 +71,7 @@ class Thermal : public Node
+ allCollections;
+
+ auto asyncResp = std::make_shared<SensorsAsyncResp>(
+- res, chassisName, sensors::dbus::types.at(sensors::node::thermal),
++ res, chassisName, sensors::dbus::paths.at(sensors::node::thermal),
+ sensors::node::thermal);
+
+ if (!json_util::readJson(req, asyncResp->res, "Temperatures",
+--
+2.16.6
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
deleted file mode 100644
index c6c6a8f09..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-From d206ea5049057fe4842186777231b9eb8468ec86 Mon Sep 17 00:00:00 2001
-From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
-Date: Mon, 8 Jun 2020 15:16:10 +0200
-Subject: [PATCH 08/10] Add support for "OnRequest" in MetricReportDefinition
-
-Added support for "OnRequest" of ReportingType property in
-MetricReportDefinition node. Now user is able to create
-MetricReportDefinition that is updated on every GET request
-on MetricReport.
-
-Tested:
- - Succesfully passed RedfishServiceValidator.py
- - Manually tested via curl
-
-Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
-Change-Id: I1cdfe47e56fdc5ec9753558145d0bf3645160aaf
-
-%% original patch: 0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
----
- include/dbus_utility.hpp | 30 +++++++++++++++
- redfish-core/include/utils/telemetry_utils.hpp | 8 ++--
- redfish-core/lib/metric_report.hpp | 53 +++++++++++++++++++++++++-
- 3 files changed, 87 insertions(+), 4 deletions(-)
-
-diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
-index ef3438b..80f8bcd 100644
---- a/include/dbus_utility.hpp
-+++ b/include/dbus_utility.hpp
-@@ -18,6 +18,7 @@
- #include <sdbusplus/message.hpp>
-
- #include <filesystem>
-+#include <functional>
- #include <regex>
-
- namespace dbus
-@@ -120,5 +121,34 @@ inline void getAllProperties(Callback&& callback, const std::string& service,
- interface);
- }
-
-+template <typename T>
-+static void getProperty(
-+ std::function<void(const boost::system::error_code&, const T&)> callback,
-+ const std::string& service, const std::string& path,
-+ const std::string& interface, const std::string& property)
-+{
-+ crow::connections::systemBus->async_method_call(
-+ [callback](const boost::system::error_code ec,
-+ const std::variant<T>& value) {
-+ if (ec)
-+ {
-+ callback(ec, T{});
-+ return;
-+ }
-+
-+ if (auto v = std::get_if<T>(&value))
-+ {
-+ callback(ec, *v);
-+ return;
-+ }
-+
-+ callback(boost::system::errc::make_error_code(
-+ boost::system::errc::io_error),
-+ T{});
-+ },
-+ service, path, "org.freedesktop.DBus.Properties", "Get", interface,
-+ property);
-+}
-+
- } // namespace utility
- } // namespace dbus
-diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
-index 05ed00f..6c4e810 100644
---- a/redfish-core/include/utils/telemetry_utils.hpp
-+++ b/redfish-core/include/utils/telemetry_utils.hpp
-@@ -26,6 +26,8 @@ static constexpr const char* metricReportDefinitionUri =
- "/redfish/v1/TelemetryService/MetricReportDefinitions/";
- static constexpr const char* metricReportUri =
- "/redfish/v1/TelemetryService/MetricReports/";
-+static constexpr const char* monitoringService =
-+ "xyz.openbmc_project.MonitoringService";
- static constexpr const char* reportInterface =
- "xyz.openbmc_project.MonitoringService.Report";
- static constexpr const char* telemetryPath =
-@@ -66,9 +68,9 @@ static void getReport(const std::shared_ptr<AsyncResp>& asyncResp,
- const std::array<const char*, 1> interfaces = {reportInterface};
-
- dbus::utility::getSubTreePaths(
-- [asyncResp, id, schemaType,
-- callback](const boost::system::error_code ec,
-- const std::vector<std::string>& reports) {
-+ [asyncResp, id, schemaType, callback = std::move(callback)](
-+ const boost::system::error_code ec,
-+ const std::vector<std::string>& reports) {
- if (ec == boost::system::errc::no_such_file_or_directory)
- {
- messages::resourceNotFound(asyncResp->res, schemaType, id);
-diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
-index 4d1c4e5..768cce9 100644
---- a/redfish-core/lib/metric_report.hpp
-+++ b/redfish-core/lib/metric_report.hpp
-@@ -85,7 +85,7 @@ class MetricReport : public Node
- }
-
- const std::string& id = params[0];
-- telemetry::getReport(asyncResp, id, schemaType, getReportProperties);
-+ telemetry::getReport(asyncResp, id, schemaType, updateReportIfRequired);
- }
-
- using Readings =
-@@ -143,6 +143,57 @@ class MetricReport : public Node
- "xyz.openbmc_project.MonitoringService.Report");
- }
-
-+ template <typename Callback>
-+ static void updateReport(Callback&& callback,
-+ const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& path)
-+ {
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp, callback{std::move(callback)}](
-+ const boost::system::error_code& ec) {
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ callback();
-+ },
-+ telemetry::monitoringService, path, telemetry::reportInterface,
-+ "Update");
-+ }
-+
-+ static void
-+ updateReportIfRequired(const std::shared_ptr<AsyncResp> asyncResp,
-+ const std::string& reportPath,
-+ const std::string& id)
-+ {
-+ dbus::utility::getProperty<std::string>(
-+ [asyncResp, id, reportPath](const boost::system::error_code& ec,
-+ const std::string& reportingType) {
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ if (reportingType == "OnRequest")
-+ {
-+ updateReport(
-+ [asyncResp, reportPath, id] {
-+ getReportProperties(asyncResp, reportPath, id);
-+ },
-+ asyncResp, reportPath);
-+ }
-+ else
-+ {
-+ getReportProperties(asyncResp, reportPath, id);
-+ }
-+ },
-+ telemetry::monitoringService, reportPath,
-+ telemetry::reportInterface, "ReportingType");
-+ }
-+
- static constexpr const char* schemaType =
- "#MetricReport.v1_3_0.MetricReport";
- };
---
-2.16.6
-
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
new file mode 100644
index 000000000..08dcb385d
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch
@@ -0,0 +1,330 @@
+From 5b775e33221638a34c4aad0e2edeffc447d50fab Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Fri, 4 Dec 2020 14:48:41 +0100
+Subject: [PATCH 4/4] Sync Telmetry service with EventService
+
+Now assembling MetricReport is done properly and is
+covered in one place - MetricReport node.
+Updated method of fetching Readings from Telemetry by
+EventService. Using ReportUpdate signal is no longer
+supported.
+
+Tested:
+ - Received MetricReport in EventListener server after
+ adding subscription to EventService.
+
+Change-Id: I2fc1841a6c9259a8bff30b34bddc0d4aabd41912
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+---
+ redfish-core/include/event_service_manager.hpp | 156 +++++++++----------------
+ redfish-core/lib/metric_report.hpp | 35 +++---
+ 2 files changed, 74 insertions(+), 117 deletions(-)
+
+diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
+index 54dafb4..1cdb9a6 100644
+--- a/redfish-core/include/event_service_manager.hpp
++++ b/redfish-core/include/event_service_manager.hpp
+@@ -14,6 +14,7 @@
+ // limitations under the License.
+ */
+ #pragma once
++#include "metric_report.hpp"
+ #include "node.hpp"
+ #include "registries.hpp"
+ #include "registries/base_message_registry.hpp"
+@@ -510,48 +511,29 @@ class Subscription
+ }
+ #endif
+
+- void filterAndSendReports(const std::string& id2,
+- const std::string& readingsTs,
+- const ReadingsObjType& readings)
++ void filterAndSendReports(
++ const std::string& id,
++ const std::variant<MetricReport::TimestampReadings>& var)
+ {
+- std::string metricReportDef =
+- "/redfish/v1/TelemetryService/MetricReportDefinitions/" + id2;
++ std::string mrdUri = telemetry::metricReportDefinitionUri + id;
+
+ // Empty list means no filter. Send everything.
+ if (metricReportDefinitions.size())
+ {
+ if (std::find(metricReportDefinitions.begin(),
+ metricReportDefinitions.end(),
+- metricReportDef) == metricReportDefinitions.end())
++ mrdUri) == metricReportDefinitions.end())
+ {
+ return;
+ }
+ }
+
+- nlohmann::json metricValuesArray = nlohmann::json::array();
+- for (const auto& it : readings)
++ nlohmann::json json;
++ if (!MetricReport::fillReport(json, id, var))
+ {
+- metricValuesArray.push_back({});
+- nlohmann::json& entry = metricValuesArray.back();
+-
+- auto& [id, property, value, timestamp] = it;
+-
+- entry = {{"MetricId", id},
+- {"MetricProperty", property},
+- {"MetricValue", std::to_string(value)},
+- {"Timestamp", crow::utility::getDateTime(timestamp)}};
++ return;
+ }
+-
+- nlohmann::json msg = {
+- {"@odata.id", "/redfish/v1/TelemetryService/MetricReports/" + id},
+- {"@odata.type", "#MetricReport.v1_3_0.MetricReport"},
+- {"Id", id2},
+- {"Name", id2},
+- {"Timestamp", readingsTs},
+- {"MetricReportDefinition", {{"@odata.id", metricReportDef}}},
+- {"MetricValues", metricValuesArray}};
+-
+- this->sendEvent(msg.dump());
++ this->sendEvent(json.dump());
+ }
+
+ void updateRetryConfig(const uint32_t retryAttempts,
+@@ -1342,56 +1324,71 @@ class EventServiceManager
+ }
+
+ #endif
+-
+- void getMetricReading(const std::string& service,
+- const std::string& objPath, const std::string& intf)
++ void unregisterMetricReportSignal()
+ {
+- std::size_t found = objPath.find_last_of('/');
+- if (found == std::string::npos)
++ if (matchTelemetryMonitor)
+ {
+- BMCWEB_LOG_DEBUG << "Invalid objPath received";
+- return;
++ BMCWEB_LOG_DEBUG << "Metrics report signal - Unregister";
++ matchTelemetryMonitor.reset();
++ matchTelemetryMonitor = nullptr;
+ }
++ }
+
+- std::string idStr = objPath.substr(found + 1);
+- if (idStr.empty())
++ void registerMetricReportSignal()
++ {
++ if (!serviceEnabled || matchTelemetryMonitor)
+ {
+- BMCWEB_LOG_DEBUG << "Invalid ID in objPath";
++ BMCWEB_LOG_DEBUG << "Not registering metric report signal.";
+ return;
+ }
+
+- crow::connections::systemBus->async_method_call(
+- [idStr{std::move(idStr)}](
+- const boost::system::error_code ec,
+- boost::container::flat_map<
+- std::string, std::variant<int32_t, ReadingsObjType>>&
+- resp) {
+- if (ec)
++ BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
++ std::string matchStr = "type='signal',member='PropertiesChanged',"
++ "interface='org.freedesktop.DBus.Properties',"
++ "path_namespace=/xyz/openbmc_project/Telemetry/"
++ "Reports/TelemetryService,"
++ "arg0=xyz.openbmc_project.Telemetry.Report";
++
++ matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>(
++ *crow::connections::systemBus, matchStr,
++ [this](sdbusplus::message::message& msg) {
++ if (msg.is_method_error())
+ {
+- BMCWEB_LOG_DEBUG
+- << "D-Bus call failed to GetAll metric readings.";
++ BMCWEB_LOG_ERROR << "TelemetryMonitor Signal error";
+ return;
+ }
+
+- const int32_t* timestampPtr =
+- std::get_if<int32_t>(&resp["Timestamp"]);
+- if (!timestampPtr)
++ std::string intf;
++ std::vector<std::pair<
++ std::string, std::variant<MetricReport::TimestampReadings>>>
++ props;
++ std::vector<std::string> invalidProp;
++
++ msg.read(intf, props, invalidProp);
++ if (intf != "xyz.openbmc_project.Telemetry.Report")
+ {
+- BMCWEB_LOG_DEBUG << "Failed to Get timestamp.";
+ return;
+ }
+
+- ReadingsObjType* readingsPtr =
+- std::get_if<ReadingsObjType>(&resp["Readings"]);
+- if (!readingsPtr)
++ const std::variant<MetricReport::TimestampReadings>* varPtr =
++ nullptr;
++ for (const auto& [key, var] : props)
++ {
++ if (key == "Readings")
++ {
++ varPtr = &var;
++ break;
++ }
++ }
++ if (!varPtr)
+ {
+- BMCWEB_LOG_DEBUG << "Failed to Get Readings property.";
+ return;
+ }
+
+- if (!readingsPtr->size())
++ std::string id;
++ if (!dbus::utility::getNthStringFromPath(msg.get_path(), 5, id))
+ {
+- BMCWEB_LOG_DEBUG << "No metrics report to be transferred";
++ BMCWEB_LOG_ERROR << "Failed to get Id from path";
+ return;
+ }
+
+@@ -1401,52 +1398,9 @@ class EventServiceManager
+ std::shared_ptr<Subscription> entry = it.second;
+ if (entry->eventFormatType == metricReportFormatType)
+ {
+- entry->filterAndSendReports(
+- idStr, crow::utility::getDateTime(*timestampPtr),
+- *readingsPtr);
++ entry->filterAndSendReports(id, *varPtr);
+ }
+ }
+- },
+- service, objPath, "org.freedesktop.DBus.Properties", "GetAll",
+- intf);
+- }
+-
+- void unregisterMetricReportSignal()
+- {
+- if (matchTelemetryMonitor)
+- {
+- BMCWEB_LOG_DEBUG << "Metrics report signal - Unregister";
+- matchTelemetryMonitor.reset();
+- matchTelemetryMonitor = nullptr;
+- }
+- }
+-
+- void registerMetricReportSignal()
+- {
+- if (!serviceEnabled || matchTelemetryMonitor)
+- {
+- BMCWEB_LOG_DEBUG << "Not registering metric report signal.";
+- return;
+- }
+-
+- BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
+- std::string matchStr(
+- "type='signal',member='ReportUpdate', "
+- "interface='xyz.openbmc_project.MonitoringService.Report'");
+-
+- matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>(
+- *crow::connections::systemBus, matchStr,
+- [this](sdbusplus::message::message& msg) {
+- if (msg.is_method_error())
+- {
+- BMCWEB_LOG_ERROR << "TelemetryMonitor Signal error";
+- return;
+- }
+-
+- std::string service = msg.get_sender();
+- std::string objPath = msg.get_path();
+- std::string intf = msg.get_interface();
+- getMetricReading(service, objPath, intf);
+ });
+ }
+
+diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
+index 050304c..c2013cc 100644
+--- a/redfish-core/lib/metric_report.hpp
++++ b/redfish-core/lib/metric_report.hpp
+@@ -52,6 +52,10 @@ class MetricReport : public Node
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ }
+
++ using Readings =
++ std::vector<std::tuple<std::string, std::string, double, uint64_t>>;
++ using TimestampReadings = std::tuple<uint64_t, Readings>;
++
+ private:
+ void doGet(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+@@ -92,7 +96,10 @@ class MetricReport : public Node
+ return;
+ }
+
+- fillReport(asyncResp, id, ret);
++ if (!fillReport(asyncResp->res.jsonValue, id, ret))
++ {
++ messages::internalError(asyncResp->res);
++ }
+ },
+ telemetry::service, reportPath,
+ "org.freedesktop.DBus.Properties", "Get",
+@@ -102,10 +109,6 @@ class MetricReport : public Node
+ "Update");
+ }
+
+- using Readings =
+- std::vector<std::tuple<std::string, std::string, double, uint64_t>>;
+- using TimestampReadings = std::tuple<uint64_t, Readings>;
+-
+ static nlohmann::json toMetricValues(const Readings& readings)
+ {
+ nlohmann::json metricValues = nlohmann::json::array_t();
+@@ -130,15 +133,15 @@ class MetricReport : public Node
+ return metricValues;
+ }
+
+- static void fillReport(const std::shared_ptr<AsyncResp>& asyncResp,
+- const std::string& id,
++ public:
++ static bool fillReport(nlohmann::json& json, const std::string& id,
+ const std::variant<TimestampReadings>& var)
+ {
+- asyncResp->res.jsonValue["@odata.type"] = schemaType;
+- asyncResp->res.jsonValue["@odata.id"] = telemetry::metricReportUri + id;
+- asyncResp->res.jsonValue["Id"] = id;
+- asyncResp->res.jsonValue["Name"] = id;
+- asyncResp->res.jsonValue["MetricReportDefinition"]["@odata.id"] =
++ json["@odata.type"] = schemaType;
++ json["@odata.id"] = telemetry::metricReportUri + id;
++ json["Id"] = id;
++ json["Name"] = id;
++ json["MetricReportDefinition"]["@odata.id"] =
+ telemetry::metricReportDefinitionUri + id;
+
+ const TimestampReadings* timestampReadings =
+@@ -146,14 +149,14 @@ class MetricReport : public Node
+ if (!timestampReadings)
+ {
+ BMCWEB_LOG_ERROR << "Property type mismatch or property is missing";
+- messages::internalError(asyncResp->res);
+- return;
++ return false;
+ }
+
+ const auto& [timestamp, readings] = *timestampReadings;
+- asyncResp->res.jsonValue["Timestamp"] =
++ json["Timestamp"] =
+ crow::utility::getDateTime(static_cast<time_t>(timestamp));
+- asyncResp->res.jsonValue["MetricValues"] = toMetricValues(readings);
++ json["MetricValues"] = toMetricValues(readings);
++ return true;
+ }
+
+ static constexpr const char* schemaType =
+--
+2.16.6
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch
deleted file mode 100644
index 5b1d93664..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch
+++ /dev/null
@@ -1,539 +0,0 @@
-From b369c09460b46902878da10a106e3b3400fd776e Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Mon, 8 Jun 2020 17:15:54 +0200
-Subject: [PATCH 09/10] Add support for MetricDefinition scheme
-
-Added MetricDefinition node to redfish core. Now user is able to
-get all possible metrics that are present in system and are
-supported by TelemetryService.
-
-Tested:
- - Succesfully passed RedfishServiceValidator.py
- - Validated a presence of MetricDefinition members
-
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
-Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
-
-%% original patch: 0005-Add-support-for-MetricDefinition-scheme.patch
-
-Change-Id: Ibcb7a858c9118c8af5ff1167a055b044f0d8db77
----
- redfish-core/include/redfish.hpp | 3 +
- redfish-core/include/utils/telemetry_utils.hpp | 2 +
- redfish-core/lib/metric_definition.hpp | 300 +++++++++++++++++++++++++
- redfish-core/lib/metric_report.hpp | 65 +++++-
- redfish-core/lib/sensors.hpp | 43 +++-
- redfish-core/lib/telemetry_service.hpp | 2 +
- 6 files changed, 402 insertions(+), 13 deletions(-)
- create mode 100644 redfish-core/lib/metric_definition.hpp
-
-diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 2587b37..705f490 100644
---- a/redfish-core/include/redfish.hpp
-+++ b/redfish-core/include/redfish.hpp
-@@ -25,6 +25,7 @@
- #include "../lib/managers.hpp"
- #include "../lib/memory.hpp"
- #include "../lib/message_registries.hpp"
-+#include "../lib/metric_definition.hpp"
- #include "../lib/metric_report.hpp"
- #include "../lib/metric_report_definition.hpp"
- #include "../lib/network_protocol.hpp"
-@@ -211,6 +212,8 @@ class RedfishService
- nodes.emplace_back(std::make_unique<HypervisorSystem>(app));
-
- nodes.emplace_back(std::make_unique<TelemetryService>(app));
-+ nodes.emplace_back(std::make_unique<MetricDefinitionCollection>(app));
-+ nodes.emplace_back(std::make_unique<MetricDefinition>(app));
- nodes.emplace_back(
- std::make_unique<MetricReportDefinitionCollection>(app));
- nodes.emplace_back(std::make_unique<MetricReportDefinition>(app));
-diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
-index 6c4e810..bb747c4 100644
---- a/redfish-core/include/utils/telemetry_utils.hpp
-+++ b/redfish-core/include/utils/telemetry_utils.hpp
-@@ -22,6 +22,8 @@ namespace redfish
- namespace telemetry
- {
-
-+static constexpr const char* metricDefinitionUri =
-+ "/redfish/v1/TelemetryService/MetricDefinitions/";
- static constexpr const char* metricReportDefinitionUri =
- "/redfish/v1/TelemetryService/MetricReportDefinitions/";
- static 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..1417efa
---- /dev/null
-+++ b/redfish-core/lib/metric_definition.hpp
-@@ -0,0 +1,300 @@
-+/*
-+// Copyright (c) 2018-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
-+
-+#include "node.hpp"
-+#include "sensors.hpp"
-+#include "utils/telemetry_utils.hpp"
-+
-+namespace redfish
-+{
-+
-+namespace chassis
-+{
-+template <typename F>
-+static inline void getChassisNames(F&& callback)
-+{
-+ const std::array<const char*, 2> interfaces = {
-+ "xyz.openbmc_project.Inventory.Item.Board",
-+ "xyz.openbmc_project.Inventory.Item.Chassis"};
-+
-+ dbus::utility::getSubTreePaths(
-+ [callback{std::move(callback)}](const boost::system::error_code ec,
-+ std::vector<std::string>& chassisList) {
-+ if (ec)
-+ {
-+ return;
-+ }
-+
-+ std::vector<std::string> chassisNames;
-+ chassisNames.reserve(chassisList.size());
-+ for (auto& chassisPath : chassisList)
-+ {
-+ auto pos = chassisPath.rfind("/");
-+ if (pos == std::string::npos)
-+ {
-+ continue;
-+ }
-+ chassisNames.push_back(chassisPath.substr(pos + 1));
-+ }
-+
-+ callback(chassisNames);
-+ },
-+ "/xyz/openbmc_project/inventory", 0, interfaces);
-+}
-+} // namespace chassis
-+
-+class MetricDefinitionCollection : public Node
-+{
-+ public:
-+ MetricDefinitionCollection(App& app) :
-+ Node(app, "/redfish/v1/TelemetryService/MetricDefinitions")
-+ {
-+ entityPrivileges = {
-+ {boost::beast::http::verb::get, {{"Login"}}},
-+ {boost::beast::http::verb::head, {{"Login"}}},
-+ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
-+ }
-+
-+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>&) override
-+ {
-+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection."
-+ "MetricDefinitionCollection";
-+ 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"] = sensors::dbus::types.size();
-+
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ auto collectionReduce = std::make_shared<CollectionGather>(asyncResp);
-+ chassis::getChassisNames(
-+ [asyncResp,
-+ collectionReduce](const std::vector<std::string>& chassisNames) {
-+ for (auto& chassisName : chassisNames)
-+ {
-+ for (auto& [sensorNode, _] : sensors::dbus::types)
-+ {
-+ BMCWEB_LOG_INFO << "Chassis: " << chassisName
-+ << " sensor: " << sensorNode;
-+ retrieveUriToDbusMap(
-+ chassisName, sensorNode.data(),
-+ [asyncResp, collectionReduce](
-+ const boost::beast::http::status,
-+ const boost::container::flat_map<
-+ std::string, std::string>& uriToDbus) {
-+ *collectionReduce += uriToDbus;
-+ });
-+ }
-+ }
-+ });
-+ }
-+
-+ class CollectionGather
-+ {
-+ public:
-+ CollectionGather(const std::shared_ptr<AsyncResp>& asyncResp) :
-+ asyncResp{asyncResp}
-+ {
-+ dbusTypes.reserve(sensors::dbus::paths.size());
-+ }
-+
-+ ~CollectionGather()
-+ {
-+ json_util::dbusPathsToMembersArray(
-+ asyncResp->res,
-+ std::vector<std::string>(dbusTypes.begin(), dbusTypes.end()),
-+ telemetry::metricDefinitionUri);
-+ }
-+
-+ CollectionGather& operator+=(
-+ const boost::container::flat_map<std::string, std::string>& rhs)
-+ {
-+ for (auto& [_, dbusSensor] : rhs)
-+ {
-+ auto pos = dbusSensor.rfind("/");
-+ if (pos == std::string::npos)
-+ {
-+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = "
-+ << dbusSensor;
-+ continue;
-+ }
-+
-+ this->dbusTypes.insert(dbusSensor.substr(0, pos));
-+ }
-+ return *this;
-+ }
-+
-+ private:
-+ const std::shared_ptr<AsyncResp> asyncResp;
-+ boost::container::flat_set<std::string> dbusTypes;
-+ };
-+};
-+
-+class MetricDefinition : public Node
-+{
-+ public:
-+ MetricDefinition(App& app) :
-+ Node(app, std::string(telemetry::metricDefinitionUri) + "<str>/",
-+ std::string())
-+ {
-+ entityPrivileges = {
-+ {boost::beast::http::verb::get, {{"Login"}}},
-+ {boost::beast::http::verb::head, {{"Login"}}},
-+ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
-+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
-+ }
-+
-+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>& params) override
-+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ if (params.size() != 1)
-+ {
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ const std::string& id = params[0];
-+
-+ size_t sensorIndex = 0;
-+ for (auto& name : sensors::dbus::names)
-+ {
-+ if (name == id)
-+ {
-+ break;
-+ }
-+ sensorIndex++;
-+ }
-+ if (sensorIndex >= sensors::dbus::max)
-+ {
-+ messages::resourceNotFound(asyncResp->res, schemaType, id);
-+ return;
-+ }
-+
-+ auto definitionGather =
-+ std::make_shared<DefinitionGather>(asyncResp, id);
-+ chassis::getChassisNames(
-+ [asyncResp, definitionGather,
-+ sensorIndex](const std::vector<std::string>& chassisNames) {
-+ for (auto& chassisName : chassisNames)
-+ {
-+ for (auto& [sensorNode, dbusPaths] : sensors::dbus::types)
-+ {
-+ auto found =
-+ std::find(dbusPaths.begin(), dbusPaths.end(),
-+ sensors::dbus::paths[sensorIndex]);
-+ if (found == dbusPaths.end())
-+ {
-+ continue;
-+ }
-+
-+ retrieveUriToDbusMap(
-+ chassisName, sensorNode.data(),
-+ [asyncResp, definitionGather](
-+ const boost::beast::http::status,
-+ const boost::container::flat_map<
-+ std::string, std::string>& uriToDbus) {
-+ *definitionGather += uriToDbus;
-+ });
-+ }
-+ }
-+ });
-+ }
-+
-+ class DefinitionGather
-+ {
-+ public:
-+ DefinitionGather(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& id) :
-+ id(id),
-+ asyncResp{asyncResp}
-+ {}
-+ ~DefinitionGather()
-+ {
-+ if (redfishSensors.empty())
-+ {
-+ messages::resourceNotFound(asyncResp->res, schemaType, id);
-+ return;
-+ }
-+
-+ asyncResp->res.jsonValue["MetricProperties"] =
-+ nlohmann::json::array();
-+ auto& members = asyncResp->res.jsonValue["MetricProperties"];
-+ for (auto& redfishSensor : redfishSensors)
-+ {
-+ members.push_back(redfishSensor);
-+ }
-+
-+ asyncResp->res.jsonValue["Id"] = id;
-+ asyncResp->res.jsonValue["Name"] = id;
-+ asyncResp->res.jsonValue["@odata.id"] =
-+ telemetry::metricDefinitionUri + id;
-+ asyncResp->res.jsonValue["@odata.type"] = schemaType;
-+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal";
-+ asyncResp->res.jsonValue["MetricType"] = "Numeric";
-+ asyncResp->res.jsonValue["Implementation"] = "PhysicalSensor";
-+ asyncResp->res.jsonValue["IsLinear"] = true;
-+ asyncResp->res.jsonValue["TimestampAccuracy"] = "PT0.1S";
-+ auto unit = sensorUnits.find(id);
-+ if (unit != sensorUnits.end())
-+ {
-+ asyncResp->res.jsonValue["Units"] = unit->second;
-+ }
-+ }
-+
-+ DefinitionGather& operator+=(
-+ const boost::container::flat_map<std::string, std::string>& rhs)
-+ {
-+ for (auto& [redfishSensor, dbusSensor] : rhs)
-+ {
-+ if (dbusSensor.find(id) != std::string::npos)
-+ {
-+ this->redfishSensors.push_back(redfishSensor);
-+ }
-+ }
-+ return *this;
-+ }
-+
-+ const std::string id;
-+
-+ private:
-+ const std::shared_ptr<AsyncResp> asyncResp;
-+ std::vector<std::string> redfishSensors;
-+ const boost::container::flat_map<std::string, std::string> sensorUnits =
-+ {{sensors::dbus::names[sensors::dbus::voltage], "V"},
-+ {sensors::dbus::names[sensors::dbus::power], "W"},
-+ {sensors::dbus::names[sensors::dbus::current], "A"},
-+ {sensors::dbus::names[sensors::dbus::fan_tach], "RPM"},
-+ {sensors::dbus::names[sensors::dbus::temperature], "Cel"},
-+ {sensors::dbus::names[sensors::dbus::utilization], "%"},
-+ {sensors::dbus::names[sensors::dbus::fan_pwm], "Duty cycle"}};
-+ };
-+
-+ static constexpr const char* schemaType =
-+ "#MetricDefinition.v1_0_3.MetricDefinition";
-+};
-+
-+} // namespace redfish
-diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
-index 768cce9..bcb0d3e 100644
---- a/redfish-core/lib/metric_report.hpp
-+++ b/redfish-core/lib/metric_report.hpp
-@@ -91,6 +91,9 @@ class MetricReport : public Node
- using Readings =
- std::vector<std::tuple<std::string, std::string, double, int32_t>>;
- using MetricValues = std::vector<std::map<std::string, std::string>>;
-+ using ReadingParameters =
-+ std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
-+ std::string, std::string, std::string>>;
-
- static MetricValues toMetricValues(const Readings& readings)
- {
-@@ -109,6 +112,49 @@ class MetricReport : public Node
- return metricValues;
- }
-
-+ static void addMetricDefinition(nlohmann::json& metrics,
-+ const ReadingParameters& params)
-+ {
-+ for (auto& metric : metrics)
-+ {
-+ if (!metric.contains("MetricId"))
-+ {
-+ continue;
-+ }
-+
-+ auto& id = metric["MetricId"].get_ref<std::string&>();
-+ auto param =
-+ std::find_if(params.begin(), params.end(), [id](const auto& x) {
-+ return id == std::get<2>(x);
-+ });
-+ if (param == params.end())
-+ {
-+ continue;
-+ }
-+
-+ auto& dbusPaths =
-+ std::get<std::vector<sdbusplus::message::object_path>>(*param);
-+ if (dbusPaths.size() > 1)
-+ {
-+ continue;
-+ }
-+
-+ auto dbusPath = dbusPaths.begin();
-+ for (size_t i = 0; i < sensors::dbus::paths.size(); i++)
-+ {
-+ if (dbusPath->str.find(sensors::dbus::paths[i]) ==
-+ std::string::npos)
-+ {
-+ continue;
-+ }
-+ metric["MetricDefinition"]["@odata.id"] =
-+ telemetry::metricDefinitionUri +
-+ std::string(sensors::dbus::names[i]);
-+ break;
-+ }
-+ }
-+ }
-+
- static void getReportProperties(const std::shared_ptr<AsyncResp> asyncResp,
- const std::string& reportPath,
- const std::string& id)
-@@ -124,7 +170,8 @@ class MetricReport : public Node
- [asyncResp](
- const boost::system::error_code ec,
- const boost::container::flat_map<
-- std::string, std::variant<Readings, int32_t>>& ret) {
-+ std::string,
-+ std::variant<Readings, int32_t, ReadingParameters>>& ret) {
- if (ec)
- {
- messages::internalError(asyncResp->res);
-@@ -138,6 +185,22 @@ class MetricReport : public Node
- json_util::assignIfPresent<Readings>(
- ret, "Readings", asyncResp->res.jsonValue["MetricValues"],
- toMetricValues);
-+
-+ auto found = ret.find("ReadingParameters");
-+ if (found != ret.end())
-+ {
-+ auto params =
-+ std::get_if<ReadingParameters>(&found->second);
-+ if (params)
-+ {
-+ auto& jsonValue = asyncResp->res.jsonValue;
-+ if (jsonValue.contains("MetricValues"))
-+ {
-+ addMetricDefinition(jsonValue["MetricValues"],
-+ *params);
-+ }
-+ }
-+ }
- },
- "xyz.openbmc_project.MonitoringService", reportPath,
- "xyz.openbmc_project.MonitoringService.Report");
-diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
-index 567cb0c..2f7f70b 100644
---- a/redfish-core/lib/sensors.hpp
-+++ b/redfish-core/lib/sensors.hpp
-@@ -54,20 +54,39 @@ static constexpr std::string_view thermal = "Thermal";
-
- namespace dbus
- {
-+
-+enum Index
-+{
-+ voltage = 0,
-+ power,
-+ current,
-+ fan_tach,
-+ temperature,
-+ fan_pwm,
-+ utilization,
-+ max
-+};
-+
-+static constexpr std::array<const char*, max> names = {
-+ "voltage", "power", "current", "fan_tach",
-+ "temperature", "fan_pwm", "utilization"};
-+
-+static constexpr std::array<const char*, max> paths = {
-+ "/xyz/openbmc_project/sensors/voltage",
-+ "/xyz/openbmc_project/sensors/power",
-+ "/xyz/openbmc_project/sensors/current",
-+ "/xyz/openbmc_project/sensors/fan_tach",
-+ "/xyz/openbmc_project/sensors/temperature",
-+ "/xyz/openbmc_project/sensors/fan_pwm",
-+ "/xyz/openbmc_project/sensors/utilization"};
-+
- static const boost::container::flat_map<std::string_view,
- std::vector<const char*>>
-- types = {{node::power,
-- {"/xyz/openbmc_project/sensors/voltage",
-- "/xyz/openbmc_project/sensors/power"}},
-- {node::sensors,
-- {"/xyz/openbmc_project/sensors/power",
-- "/xyz/openbmc_project/sensors/current",
-- "/xyz/openbmc_project/sensors/utilization"}},
-- {node::thermal,
-- {"/xyz/openbmc_project/sensors/fan_tach",
-- "/xyz/openbmc_project/sensors/temperature",
-- "/xyz/openbmc_project/sensors/fan_pwm"}}};
--}
-+ types = {
-+ {node::power, {paths[voltage], paths[power]}},
-+ {node::sensors, {paths[power], paths[current], paths[utilization]}},
-+ {node::thermal, {paths[fan_tach], paths[temperature], paths[fan_pwm]}}};
-+} // namespace dbus
- } // namespace sensors
-
- /**
-diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
-index b849781..efbef6e 100644
---- a/redfish-core/lib/telemetry_service.hpp
-+++ b/redfish-core/lib/telemetry_service.hpp
-@@ -52,6 +52,8 @@ class TelemetryService : public Node
-
- res.jsonValue["LogService"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal";
-+ res.jsonValue["MetricDefinitions"]["@odata.id"] =
-+ "/redfish/v1/TelemetryService/MetricDefinitions";
- res.jsonValue["MetricReportDefinitions"]["@odata.id"] =
- "/redfish/v1/TelemetryService/MetricReportDefinitions";
- res.jsonValue["MetricReports"]["@odata.id"] =
---
-2.16.6
-
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 2929b0aec..833fabfec 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,19 +3,14 @@ Until change is integrated they will be manually merged here to enable feature i
Current revisions:
- Redfish TelemetryService schema implementation
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31692/29
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31692/54
-- Add support for POST in MetricReportDefinitions
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/32536/24
-
-- Add support for DELETE in MetricReportDefinitions/<str>
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/32537/23
-
-- Add support for "OnRequest" in MetricReportDefinition
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33358/17
+- Add POST and DELETE in MetricReportDefinitions
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/32536/46
- Add support for MetricDefinition scheme
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/20
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/42
+
+- Sync Telmetry service with EventService
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/9
-- Temporary patch for EventService because of change in design
- 0006-Fix-MetricReport-timestamp-for-EventService.patch
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 80005f5cd..ac095ba61 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend
@@ -1,7 +1,8 @@
SRC_URI = "git://github.com/openbmc/bmcweb.git"
-SRCREV = "a8fe54f09be1deefc119d8dcf100da922496d46d"
+SRCREV = "f16f62633a64f386fd0382703ff0949ea177f457"
DEPENDS += "boost-url"
+RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
@@ -15,14 +16,20 @@ 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://0005-EventService-https-client-support.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 \
"
+
# Temporary downstream mirror of upstream patches, see telemetry\README for details
SRC_URI += "file://telemetry/0001-Redfish-TelemetryService-schema-implementation.patch \
- file://telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch \
- file://telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch \
- file://telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch \
- file://telemetry/0005-Add-support-for-MetricDefinition-scheme.patch \
+ file://telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch \
+ 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-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch
index 3f01cd2c8..d071ebd67 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch
@@ -1,4 +1,4 @@
-From 644165bf32fd6e757c261881987d127a865cbf2b Mon Sep 17 00:00:00 2001
+From 42231615d6a1effbfaa581ca41c0d406174feee8 Mon Sep 17 00:00:00 2001
From: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com>
Date: Mon, 23 Mar 2020 22:19:07 +0530
Subject: [PATCH] Add dbus method SlotIpmbRequest
@@ -33,24 +33,22 @@ ipmitool raw 0x3e 0x51 0 0x01 0xb0 0x6 1
Note: Tested for all possible negative test cases and it works fine.
Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@intel.com>
-
-%% original patch: 0001-Add-dbus-method-SlotIpmbRequest.patch
---
CMakeLists.txt | 2 +-
- include/linux/i2c.h | 159 ++++++++++++++++++++++++++++++++
+ include/linux/i2c.h | 159 +++++++++++++++++++++++++++++++
ipmb-channels.json | 6 ++
- ipmbbridged.cpp | 220 +++++++++++++++++++++++++++++++++++++++++++-
+ ipmbbridged.cpp | 221 +++++++++++++++++++++++++++++++++++++++++++-
ipmbbridged.hpp | 8 +-
- 5 files changed, 391 insertions(+), 4 deletions(-)
+ 5 files changed, 392 insertions(+), 4 deletions(-)
create mode 100644 include/linux/i2c.h
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 80377f5..1436d5e 100644
+index 4acdccf..3484a58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -5,7 +5,7 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
+@@ -8,7 +8,7 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
+ #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+ #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
-include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -240,7 +238,7 @@ index 0876db7..ff570c6 100644
]
}
diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp
-index e0eadfc..72ede8c 100644
+index 3bf8469..6d1be04 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -18,6 +18,11 @@
@@ -253,9 +251,9 @@ index e0eadfc..72ede8c 100644
+#include <sys/ioctl.h>
+
#include <boost/algorithm/string/replace.hpp>
+ #include <boost/asio/write.hpp>
#include <filesystem>
- #include <fstream>
-@@ -39,7 +44,8 @@ auto conn = std::make_shared<sdbusplus::asio::connection>(io);
+@@ -40,7 +45,8 @@ auto conn = std::make_shared<sdbusplus::asio::connection>(io);
static std::list<IpmbChannel> ipmbChannels;
static const std::unordered_map<std::string, ipmbChannelType>
ipmbChannelTypeMap = {{"me", ipmbChannelType::me},
@@ -265,7 +263,7 @@ index e0eadfc..72ede8c 100644
/**
* @brief Ipmb request class methods
-@@ -551,7 +557,10 @@ int IpmbChannel::ipmbChannelInit(const char *ipmbI2cSlave)
+@@ -555,7 +561,10 @@ int IpmbChannel::ipmbChannelInit(const char *ipmbI2cSlave)
{
std::string deviceFileName =
"/sys/bus/i2c/devices/i2c-" + busStr + "/new_device";
@@ -277,7 +275,7 @@ index e0eadfc..72ede8c 100644
std::fstream deviceFile;
deviceFile.open(deviceFileName, std::ios::out);
if (!deviceFile.good())
-@@ -697,6 +706,171 @@ void IpmbChannel::addFilter(const uint8_t respNetFn, const uint8_t cmd)
+@@ -711,6 +720,171 @@ void IpmbChannel::addFilter(const uint8_t respNetFn, const uint8_t cmd)
}
}
@@ -449,7 +447,7 @@ index e0eadfc..72ede8c 100644
std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
IpmbChannel::requestAdd(boost::asio::yield_context &yield,
std::shared_ptr<IpmbRequest> request)
-@@ -826,6 +1000,46 @@ static int initializeChannels()
+@@ -848,6 +1022,47 @@ static int initializeChannels()
return 0;
}
@@ -458,7 +456,8 @@ index e0eadfc..72ede8c 100644
+ uint8_t slotNumber, uint8_t targetSlaveAddr, uint8_t netfn, uint8_t cmd,
+ std::vector<uint8_t> dataReceived) {
+ uint8_t lun = 0; // No support for lun in slot IPMB
-+ IpmbChannel *channel = getChannel(ipmbChannelType::slot_ipmb);
++ IpmbChannel *channel =
++ getChannel(static_cast<uint8_t>(ipmbChannelType::slot_ipmb));
+ if (channel == nullptr)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -496,7 +495,7 @@ index e0eadfc..72ede8c 100644
auto ipmbHandleRequest = [](boost::asio::yield_context yield,
uint8_t reqChannel, uint8_t netfn, uint8_t lun,
uint8_t cmd, std::vector<uint8_t> dataReceived) {
-@@ -971,6 +1185,8 @@ int main(int argc, char *argv[])
+@@ -994,6 +1209,8 @@ int main(int argc, char *argv[])
server.add_interface(ipmbObj, ipmbDbusIntf);
ipmbIface->register_method("sendRequest", std::move(ipmbHandleRequest));
@@ -506,10 +505,10 @@ index e0eadfc..72ede8c 100644
if (initializeChannels() < 0)
diff --git a/ipmbbridged.hpp b/ipmbbridged.hpp
-index e264195..167f613 100644
+index 052c193..c79ac63 100644
--- a/ipmbbridged.hpp
+++ b/ipmbbridged.hpp
-@@ -153,7 +153,8 @@ enum class ipmbRequestState
+@@ -155,7 +155,8 @@ enum class ipmbRequestState
enum class ipmbChannelType
{
ipmb = 0,
@@ -519,7 +518,7 @@ index e264195..167f613 100644
};
/**
-@@ -287,6 +288,11 @@ class IpmbChannel
+@@ -293,6 +294,11 @@ class IpmbChannel
void ipmbSendI2cFrame(std::shared_ptr<std::vector<uint8_t>> buffer,
size_t retriesAttempted);
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend
index cfc1ae909..33392f3c1 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend
@@ -1,5 +1,5 @@
SRC_URI = "git://github.com/openbmc/ipmbbridge.git"
-SRCREV = "3e07b9ea353b794f9ef666172265ecc056e5cd4d"
+SRCREV = "8fe0abe6d9f69f735e93d7055687fce4b56e80bf"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch \
file://ipmb-channels.json \
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb
index dfae096c6..30a229022 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb
@@ -15,5 +15,5 @@ DEPENDS = "sdbusplus \
phosphor-logging \
boost"
-S = "${WORKDIR}/git/"
+S = "${WORKDIR}/git"
inherit cmake systemd
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend
index 291bec85c..71a6d58da 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend
@@ -1,3 +1,3 @@
SRC_URI = "git://github.com/openbmc/peci-pcie"
-SRCREV = "bce86a63643e1d7cdf6d42e143738013ee47a8da"
+SRCREV = "9fa54b52f83c00fd713085e6849d3f261672d008"
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 8f8d48a4d..68b43132d 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,9 +2,9 @@ SUMMARY = "libmctp_intel"
DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)"
SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh"
-SRCREV = "2d5d44bbf7bf1f270ce5bebd90efd47579ac7120"
+SRCREV = "46651f2a88322127cbd979d71c616fd35df8d989"
-S = "${WORKDIR}/git/"
+S = "${WORKDIR}/git"
PV = "1.0+git${SRCPV}"
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 c1c06eba8..317386460 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,9 +2,9 @@ SUMMARY = "libpldm_intel"
DESCRIPTION = "Provides encode/decode APIs for PLDM specifications"
SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh"
-SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
-S = "${WORKDIR}/git/libpldm_intel/"
+S = "${WORKDIR}/git/libpldm_intel"
PV = "1.0+git${SRCPV}"
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 16975b9ff..90d8bc709 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,9 +5,9 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab"
SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh"
-SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
-S = "${WORKDIR}/git/mctp_emulator/"
+S = "${WORKDIR}/git/mctp_emulator"
PV = "1.0+git${SRCPV}"
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 0d779d4e3..55fda9954 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,9 +5,9 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab"
SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh"
-SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
-S = "${WORKDIR}/git/mctp_wrapper/"
+S = "${WORKDIR}/git/mctp_wrapper"
PV = "1.0+git${SRCPV}"
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 d4c50b872..b9c2eef31 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 = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
S = "${WORKDIR}/git"
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 5f854ba20..b047c0f85 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb
@@ -5,9 +5,9 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh"
-SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
-S = "${WORKDIR}/git/pldmd/"
+S = "${WORKDIR}/git/pldmd"
PV = "1.0+git${SRCPV}"
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 91d50d064..a76ebe7ca 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,9 +5,9 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh"
-SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec"
+SRCREV = "0f98e0d45a725003b810ea06f8e5f032b2864a5c"
-S = "${WORKDIR}/git/pmci_launcher/"
+S = "${WORKDIR}/git/pmci_launcher"
PV = "1.0+git${SRCPV}"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts.bbappend
index dc22b3c95..410775ee3 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts.bbappend
@@ -1,3 +1,5 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI = "file://init" \ No newline at end of file
+SRC_URI = "file://init"
+
+RDEPENDS_${PN} += "bash"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init
index 5d83d85a6..245dabe6c 100755
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2017-2019 Intel Corporation
#
@@ -19,8 +19,8 @@
# that can be made RW with an overlayfs
log() {
- [ -c /dev/kmsg ] && echo "init: $@" > /dev/kmsg
- echo "init: $@"
+ [ -c /dev/kmsg ] && echo "init: $*" > /dev/kmsg
+ echo "init: $*"
}
# start with /proc and /tmp mounted
@@ -38,8 +38,8 @@ if grep -q debug-init /proc/cmdline; then
set -x
env
else
- # silent bob
- exec >/dev/null 2>&1
+ # Suppress any stray output but we want to see any errors
+ exec >/dev/null 2>/dev/kmsg
fi
# list of things that need to be rw at boot
@@ -47,7 +47,7 @@ NV_OVERLAYS="/etc /var /home"
# place to mount the overlay backing store
OVERLAY_MNT=/tmp/.overlay
-OVERLAY_SIZE=16384
+# OVERLAY_SIZE=16384
# place to mount NV
RWFS_MNT=/tmp/.rwfs
# NV overlay storage
@@ -63,26 +63,23 @@ mkdir -p "$OVERLAY_MNT"
mtd_by_name() {
local name="$1"
- local mtd="/dev/$(grep "$name" /proc/mtd | cut -d : -f 1)"
- echo "$mtd"
+ echo "/dev/$(grep "$name" /proc/mtd | cut -d : -f 1)"
}
mtdnum_by_name() {
local name="$1"
- local mtdnum="$(grep "$name" /proc/mtd | cut -c 4)"
- echo "$mtdnum"
+ grep "$name" /proc/mtd | cut -c 4
}
NV_MTD=rwfs
-NV_MTD_DEV="$(mtd_by_name ${NV_MTD})"
-NV_MTD_NUM="$(mtdnum_by_name ${NV_MTD})"
nvrw() {
local p="$1"
# Clear the work dir doing overlay mount
rm -rf "${OVERLAY_MNT}${p}.work"
mkdir -p "${OVERLAY_MNT}${p}" "${OVERLAY_MNT}${p}.work"
- local mname=$(echo "ol${p}" | sed 's,/,,g')
+ local mname
+ mname=$(echo "ol${p}" | sed 's,/,,g')
local opts="lowerdir=${p},upperdir=${OVERLAY_MNT}${p},workdir=${OVERLAY_MNT}${p}.work,sync"
mount -t overlay -o "$opts" "$mname" "$p"
}
@@ -91,8 +88,9 @@ targeted_clean() {
log "restore-defaults: targeted_clean"
# Do not delete FRU info, ssh/ssl certs, or machine-id
(
- cd "${OVERLAY_SYNC}/etc"
- find . ! -regex '.*\(/ssl\|/dropbear\|/machine-id\(_bkup\)\?\|/fru\).*' -exec rm -rf {} +
+ cd "${OVERLAY_SYNC}/etc" || exit
+ find . ! -regex '.*/\(ssl\|dropbear\|machine-id\|fru\).*' -a ! -path '.' \
+ -exec rm -rf {} +
)
# nothing should be in the workdir, but clear it just in case
rm -rf "${OVERLAY_SYNC}/etc.work"
@@ -116,48 +114,57 @@ full_clean() {
sync
}
+jffs2_mount() {
+ mtd_name=$1
+ mnt=$2
+ mount -t jffs2 -o sync,ro mtd:"$mtd_name" "$mnt"
+}
+
reformat_jffs2_partition() {
local mtd_name="$1"
local mnt="$2"
# unmount the partition to reformat it
umount -f "$mnt"
- flash_eraseall "$(mtd_by_name ${mtd_name})"
+ flash_erase "$(mtd_by_name "$mtd_name")" 0 0
# remount the JFFS2
- mount -t jffs2 -o sync,ro mtd:"$mtd_name" "$mnt"
- if [ $? -ne 0 ]; then
+ if ! jffs2_mount "$mtd_name" "$mnt"; then
log "Failed to mount reformatted NV volume; system unstable"
fi
}
clear_ubenv() {
log "Clearing U-Boot environment"
- flash_erase /dev/mtd/u-boot-env 0 0
+ flash_erase "$(mtd_by_name u-boot-env)" 0 0
}
# mount NV filesystem
mkdir -p "$RWFS_MNT"
-mount -t jffs2 -o sync,ro mtd:"$NV_MTD" "$RWFS_MNT"
-if [ $? -ne 0 ]; then
+if ! jffs2_mount "$NV_MTD" "$RWFS_MNT"; then
log "Failed to mount NV volume; attempting recovery"
reformat_jffs2_partition $NV_MTD $RWFS_MNT
fi
# check for full factory reset: if so, format $NV_MTD_DEV
RESTORE_FLAG=$RWFS_MNT/.restore_op
-restore_op=$(cat $RESTORE_FLAG) # read from NV
-restore_op=${restore_op:-0} # set default value 0
-restore_op=$((restore_op & 3)) # mask off 2 bits
-if [ $restore_op -eq 1 ]; then
- targeted_clean
-elif [ $restore_op -eq 2 ]; then
- full_clean
- clear_ubenv
-elif [ $restore_op -eq 3 ]; then
- log "restore-defaults: reformat"
- reformat_jffs2_partition $NV_MTD $RWFS_MNT
- clear_ubenv
+if [ -f "$RESTORE_FLAG" ]; then
+ mount -o remount,rw "$RWFS_MNT"
+ restore_op=$(cat $RESTORE_FLAG) # read from NV
+ # set default value 0 if RESTORE_FLAG file was empty
+ restore_op=${restore_op:-0}
+ restore_op=$((restore_op & 3)) # mask off 2 bits
+ if [ $restore_op -eq 1 ]; then
+ targeted_clean
+ elif [ $restore_op -eq 2 ]; then
+ full_clean
+ clear_ubenv
+ elif [ $restore_op -eq 3 ]; then
+ log "restore-defaults: reformat"
+ reformat_jffs2_partition $NV_MTD $RWFS_MNT
+ clear_ubenv
+ fi
+ rm -f $RESTORE_FLAG
+ mount -o remount,ro "$RWFS_MNT"
fi
-rm -f $RESTORE_FLAG
# Restore the overlay saved in the sync
rsync -a --delete "${OVERLAY_SYNC}/" "${OVERLAY_MNT}"
@@ -200,11 +207,9 @@ SOFS_MNT=/var/sofs
if ! grep -q sofs /proc/mounts; then
mkdir -p $SOFS_MNT
SOFS_MTD=sofs
- SOFS_MTD_NUM="$(mtdnum_by_name ${SOFS_MTD})"
# mount a JFFS2 on the partition
- mount -t jffs2 -o sync,ro mtd:"$SOFS_MTD" "$SOFS_MNT"
- if [ $? -ne 0 ]; then
+ if ! jffs2_mount "$SOFS_MTD" "$SOFS_MNT"; then
log "Failed to mount SOFS volume; attempting recovery"
reformat_jffs2_partition $SOFS_MTD $SOFS_MNT
fi
@@ -242,12 +247,12 @@ pfr_write() {
local PFR_ADDR=0x38
local reg=$1
local val=$2
- i2cset -y $PFR_BUS $PFR_ADDR $reg $val >&/dev/null
+ i2cset -y $PFR_BUS $PFR_ADDR "$reg" "$val" >&/dev/null
}
board_id=$(read_board_id)
-if [ $board_id -eq $COOPER_CITY ]; then
- if [ $(is_nl_node) -ne 0 ]; then
+if [ "$board_id" -eq $COOPER_CITY ]; then
+ if [ "$(is_nl_node)" -ne 0 ]; then
systemctl set-default multi-node-nl.target
PFR_BMC_CHECKPOINT_REG=0xf
PFR_BMC_CHECKPOINT_COMPLETE=0x9
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend
index 6e1690252..e96f5646c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend
@@ -1,4 +1,4 @@
# Enable downstream autobump
SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git"
-SRCREV = "df7bc1c6951fb7dd2776008aa0b7dc6bea44bed4"
+SRCREV = "e526b86d7f9eef3b7a58f2800263666a04051239"
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 16c88f7fc..9a50b255d 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 = "3bcd823e3783bc49c1e75dec2d43a3ef54333c88"
+SRCREV = "6736d4b2a77cec00a8919f26035176c8b8025a4d"
#SRC_URI = "git://github.com/openbmc/dbus-sensors.git"
SRC_URI += "\
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 f44965958..0dae2be3c 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
@@ -1,7 +1,7 @@
SUMMARY = "Callback Manager"
DESCRIPTION = "D-Bus daemon that registers matches that trigger method calls"
-SRC_URI = "git://github.com/openbmc/s2600wf-misc.git;protocol=ssh;nobranch=1"
+SRC_URI = "git://github.com/openbmc/s2600wf-misc.git;protocol=ssh"
inherit cmake systemd
DEPENDS = "boost sdbusplus"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend
new file mode 100644
index 000000000..04ae511ef
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend
@@ -0,0 +1,6 @@
+SRC_URI = "git://github.com/openbmc/telemetry.git"
+SRCREV = "503c158972ff74a23ead8f50138107157b46758d"
+
+EXTRA_OEMESON += " -Dmax-reports=5"
+EXTRA_OEMESON += " -Dmax-reading-parameters=200"
+EXTRA_OEMESON += " -Dmin-interval=5000"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb
index 2b0f167c4..e568ea5d2 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb
@@ -4,7 +4,7 @@ DESCRIPTION = "Virtual Media Service"
SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh"
SRCREV = "bee56d62b209088454d166d1efae4825a2b175df"
-S = "${WORKDIR}/git/virtual-media/"
+S = "${WORKDIR}/git/virtual-media"
PV = "1.0+git${SRCPV}"
LICENSE = "Apache-2.0"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb
new file mode 100644
index 000000000..addd1ccb2
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb
@@ -0,0 +1,12 @@
+SUMMARY = "System watchdog"
+DESCRIPTION = "BMC hardware watchdog service that is used to reset BMC \
+ when unrecoverable events occurs"
+
+inherit allarch
+inherit obmc-phosphor-systemd
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+SYSTEMD_SERVICE_${PN} += "system-watchdog.service"
+SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/system-watchdog/system-watchdog.conf"
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf
new file mode 100644
index 000000000..defe830a1
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf
@@ -0,0 +1,3 @@
+TIMEOUT=60
+INTERVAL=10
+DEVICE=/dev/watchdog1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service
new file mode 100644
index 000000000..1564fda20
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=BMC Hardware Watchdog Daemon
+
+[Service]
+EnvironmentFile=/etc/default/obmc/system-watchdog/system-watchdog.conf
+ExecStart=/sbin/watchdog -T ${{TIMEOUT}} -t ${{INTERVAL}} -F ${{DEVICE}}
+KillSignal=SIGKILL
+
+[Install]
+WantedBy=basic.target
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend
index 9c4a3c879..2dfe8544f 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend
@@ -1,4 +1,4 @@
SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2"
FILESEXTRAPATHS_prepend_intel := "${THISDIR}/${PN}:"
-SRCREV = "9db94c5d0e61c6cd5935e770c14a9ad6231da497"
+SRCREV = "3b13f734a5f881b9b51346ba09fabea752b145f3"
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 4fffef955..7201eccd9 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 = "978807de2d5a11860b74f1f97dc0d915ee5c9a5e"
+SRCREV = "5fe1c3fed73164d4fe82ebb142cefbca72c2e706"
do_compile_prepend() {
cp -vf ${S}/.env.intel ${S}/.env
diff --git a/meta-openbmc-mods/meta-common/recipes-support/boost/boost_%.bbappend b/meta-openbmc-mods/meta-common/recipes-support/boost/boost_%.bbappend
index d5b102d0e..4cd1bcd51 100644
--- a/meta-openbmc-mods/meta-common/recipes-support/boost/boost_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-support/boost/boost_%.bbappend
@@ -1,8 +1,8 @@
FILES_${PN} += "/usr/lib/libboost_chrono.so* \
+ /usr/lib/libboost_context.so* \
/usr/lib/libboost_thread.so*"
-#todo this is against standard but iostreams used in mtd-util
-BOOST_LIBS_intel += "iostreams"
+BOOST_LIBS_intel += "iostreams coroutine"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
# this patch is for issue https://github.com/chriskohlhoff/asio/issues/533
diff --git a/meta-openbmc-mods/meta-common/recipes-support/curl/curl_%.bbappend b/meta-openbmc-mods/meta-common/recipes-support/curl/curl_%.bbappend
new file mode 100644
index 000000000..7e93b46a6
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-support/curl/curl_%.bbappend
@@ -0,0 +1,2 @@
+PACKAGECONFIG_remove = "gnutls"
+PACKAGECONFIG += " ssl"
diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/files/CMakeLists.txt b/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/files/CMakeLists.txt
new file mode 100644
index 000000000..5a049e9ff
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/files/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+project(i3c-tools C)
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+include_directories(include)
+add_executable(i3ctransfer i3ctransfer.c)
+install(TARGETS i3ctransfer DESTINATION bin)
diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/i3c-tools.bb b/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/i3c-tools.bb
new file mode 100644
index 000000000..2a857709b
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-utilities/i3c-tools/i3c-tools.bb
@@ -0,0 +1,25 @@
+SUMMARY = "i3c-tools"
+DESCRIPTION = "Set of tools to interact with i3c devices from user space"
+
+SRC_URI = "git://github.com/vitor-soares-snps/i3c-tools.git"
+SRCREV = "2b37323d0de6265e5da3539f29fe34ac317e5b27"
+
+S = "${WORKDIR}/git"
+
+PV = "0.1+git${SRCPV}"
+
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "\
+ file://i3ctransfer.c;beginline=1;endline=6;md5=8a1ae5c1aaf128e640de497ceaa9935e \
+ "
+
+inherit cmake
+
+SRC_URI += "\
+ file://CMakeLists.txt \
+ "
+
+do_configure_prepend() {
+ cp -f ${WORKDIR}/CMakeLists.txt ${S}
+}
+
diff --git a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend
index 18a7d4a96..5819f140f 100755
--- a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend
@@ -1,6 +1,6 @@
# Enable downstream autobump
SRC_URI = "git://github.com/openbmc/x86-power-control.git;protocol=ssh"
-SRCREV = "01a77864f49088bac80474587a123d1f152f2b26"
+SRCREV = "047bcb569b9c8baaa6184350a1628ec6e4008252"
FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
diff --git a/meta-openbmc-mods/meta-wht/conf/layer.conf b/meta-openbmc-mods/meta-wht/conf/layer.conf
index 6b2661f3a..7daf9ddc8 100644
--- a/meta-openbmc-mods/meta-wht/conf/layer.conf
+++ b/meta-openbmc-mods/meta-wht/conf/layer.conf
@@ -9,6 +9,6 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "wht"
BBFILE_PATTERN_wht = ""
BBFILE_PRIORITY_wht = "7"
-LAYERSERIES_COMPAT_wht = "zeus dunfell"
+LAYERSERIES_COMPAT_wht = "dunfell gatesgarth"
PRODUCT_GENERATION = "wht"
diff --git a/meta-openbmc-mods/meta-wolfpass/conf/layer.conf b/meta-openbmc-mods/meta-wolfpass/conf/layer.conf
index 1f59559ed..9dacd1c2b 100644
--- a/meta-openbmc-mods/meta-wolfpass/conf/layer.conf
+++ b/meta-openbmc-mods/meta-wolfpass/conf/layer.conf
@@ -9,6 +9,6 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "wolfpass"
BBFILE_PATTERN_wolfpass = ""
BBFILE_PRIORITY_wolfpass = "7"
-LAYERSERIES_COMPAT_wolfpass = "zeus dunfell"
+LAYERSERIES_COMPAT_wolfpass = "dunfell gatesgarth"
PRODUCT_GENERATION = "prl"