diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-06-24 01:22:00 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-06-24 01:22:00 +0300 |
commit | 5565c9abcc817b88098b849b2de5c017a8fb559f (patch) | |
tree | 2d2a10f694c3793a003a3cb1e2f9db52173cd3cb /meta-quanta/meta-gbs/recipes-phosphor | |
parent | 2a64b8ae9b952b18b4aef38cb7c41ce6dba16c50 (diff) | |
parent | 000fd965915b31e7e613f7e9dfe7042f76dcc951 (diff) | |
download | openbmc-5565c9abcc817b88098b849b2de5c017a8fb559f.tar.xz |
Merge tag '0.57' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor')
37 files changed, 1203 insertions, 984 deletions
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb index cd632e132..167f78df9 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb @@ -9,6 +9,7 @@ SRC_URI = " \ file://gbs-ipmi-fru.yaml \ file://gbs-ipmi-sensors.yaml \ file://gbs-ipmi-fru-properties.yaml \ + file://gbs-ipmi-inventory-sensors.yaml \ " S = "${WORKDIR}" @@ -20,12 +21,15 @@ do_install() { ${D}${datadir}/${BPN}/ipmi-sensors.yaml install -m 0644 -D gbs-ipmi-fru-properties.yaml \ ${D}${datadir}/${BPN}/ipmi-extra-properties.yaml + install -m 0644 -D gbs-ipmi-inventory-sensors.yaml \ + ${D}${datadir}/${BPN}/ipmi-inventory-sensors.yaml } FILES_${PN}-dev = " \ ${datadir}/${BPN}/ipmi-fru-read.yaml \ ${datadir}/${BPN}/ipmi-sensors.yaml \ ${datadir}/${BPN}/ipmi-extra-properties.yaml \ + ${datadir}/${BPN}/ipmi-inventory-sensors.yaml \ " ALLOW_EMPTY_${PN} = "1" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml new file mode 100644 index 000000000..865e4b3b6 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml @@ -0,0 +1,435 @@ +/xyz/openbmc_project/sensors/temperature/i2cool_0: + eventReadingType: 1 + sensorID: 0x10 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/i2cool_1: + eventReadingType: 1 + sensorID: 0x11 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/i2cool_2: + eventReadingType: 1 + sensorID: 0x12 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/powerseq_temp: + eventReadingType: 1 + sensorID: 0x13 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/cputemp: + eventReadingType: 1 + sensorID: 0x14 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme0: + eventReadingType: 1 + sensorID: 0x15 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme1: + eventReadingType: 1 + sensorID: 0x16 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme2: + eventReadingType: 1 + sensorID: 0x17 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme3: + eventReadingType: 1 + sensorID: 0x18 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme4: + eventReadingType: 1 + sensorID: 0x19 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme5: + eventReadingType: 1 + sensorID: 0x1A + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme6: + eventReadingType: 1 + sensorID: 0x1B + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme7: + eventReadingType: 1 + sensorID: 0x1C + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme8: + eventReadingType: 1 + sensorID: 0x1D + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme9: + eventReadingType: 1 + sensorID: 0x1E + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme10: + eventReadingType: 1 + sensorID: 0x1F + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme11: + eventReadingType: 1 + sensorID: 0x20 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme12: + eventReadingType: 1 + sensorID: 0x21 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme13: + eventReadingType: 1 + sensorID: 0x22 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme14: + eventReadingType: 1 + sensorID: 0x23 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/nvme15: + eventReadingType: 1 + sensorID: 0x24 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/vddcr_cpu: + eventReadingType: 1 + sensorID: 0x27 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/vddcr_soc: + eventReadingType: 1 + sensorID: 0x28 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/vddio_abcd: + eventReadingType: 1 + sensorID: 0x29 + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/vddio_efgh: + eventReadingType: 1 + sensorID: 0x2A + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/p12v_mobo: + eventReadingType: 1 + sensorID: 0x2B + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/p12v_fan: + eventReadingType: 1 + sensorID: 0x2C + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/temperature/hotswap: + eventReadingType: 1 + sensorID: 0x2D + sensorType: 1 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p1v8_stby: + eventReadingType: 1 + sensorID: 0x30 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddcr_soc_stby: + eventReadingType: 1 + sensorID: 0x31 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p2v5_stby: + eventReadingType: 1 + sensorID: 0x32 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p1v2_stby: + eventReadingType: 1 + sensorID: 0x33 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p1v175_stby: + eventReadingType: 1 + sensorID: 0x34 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p1v8: + eventReadingType: 1 + sensorID: 0x35 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p3v3: + eventReadingType: 1 + sensorID: 0x36 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/pwrgd_pvpp: + eventReadingType: 1 + sensorID: 0x37 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/pwrgd_pvddio: + eventReadingType: 1 + sensorID: 0x38 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/pwrgd_cpuvr: + eventReadingType: 1 + sensorID: 0x39 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p3v3_stby: + eventReadingType: 1 + sensorID: 0x3A + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p5v_stby: + eventReadingType: 1 + sensorID: 0x3B + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddcr_cpu_in: + eventReadingType: 1 + sensorID: 0x3C + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddcr_cpu_out: + eventReadingType: 1 + sensorID: 0x3D + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddcr_soc_in: + eventReadingType: 1 + sensorID: 0x3E + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddcr_soc_out: + eventReadingType: 1 + sensorID: 0x3F + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddio_abcd_out: + eventReadingType: 1 + sensorID: 0x40 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddio_abcd_in: + eventReadingType: 1 + sensorID: 0x41 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddio_efgh_out: + eventReadingType: 1 + sensorID: 0x42 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/vddio_efgh_in: + eventReadingType: 1 + sensorID: 0x43 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/hotswap_vin: + eventReadingType: 1 + sensorID: 0x44 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/hotswap_vout: + eventReadingType: 1 + sensorID: 0x45 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p3v_bat_adc: + eventReadingType: 1 + sensorID: 0x46 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p12v_mobo_out: + eventReadingType: 1 + sensorID: 0x47 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p12v_mobo_in: + eventReadingType: 1 + sensorID: 0x48 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p12v_fan_out: + eventReadingType: 1 + sensorID: 0x49 + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/voltage/p12v_fan_in: + eventReadingType: 1 + sensorID: 0x4A + sensorType: 2 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddcr_cpu_in: + eventReadingType: 1 + sensorID: 0x50 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddcr_cpu_out: + eventReadingType: 1 + sensorID: 0x51 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddcr_soc_in: + eventReadingType: 1 + sensorID: 0x52 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddcr_soc_out: + eventReadingType: 1 + sensorID: 0x53 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddio_abcd_in: + eventReadingType: 1 + sensorID: 0x55 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddio_abcd_out: + eventReadingType: 1 + sensorID: 0x54 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddio_efgh_in: + eventReadingType: 1 + sensorID: 0x57 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/vddio_efgh_out: + eventReadingType: 1 + sensorID: 0x56 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/p12v_mobo_in: + eventReadingType: 1 + sensorID: 0x5A + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/p12v_mobo_out: + eventReadingType: 1 + sensorID: 0x59 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/p12v_fan_in: + eventReadingType: 1 + sensorID: 0x5C + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/p12v_fan_out: + eventReadingType: 1 + sensorID: 0x5B + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/current/hotswap_iout: + eventReadingType: 1 + sensorID: 0x58 + sensorType: 3 + offset: 0xff +/xyz/openbmc_project/sensors/power/hotswap_pout: + eventReadingType: 1 + sensorID: 0x70 + sensorType: 0x0B + offset: 0xff +/xyz/openbmc_project/sensors/fan_tach/fan0: + eventReadingType: 1 + sensorID: 0x60 + sensorType: 4 + offset: 0xff +/xyz/openbmc_project/sensors/fan_tach/fan1: + eventReadingType: 1 + sensorID: 0x61 + sensorType: 4 + offset: 0xff +/xyz/openbmc_project/sensors/fan_tach/fb_fan0: + eventReadingType: 1 + sensorID: 0x62 + sensorType: 4 + offset: 0xff +/xyz/openbmc_project/sensors/fan_tach/fb_fan1: + eventReadingType: 1 + sensorID: 0x63 + sensorType: 4 + offset: 0xff +/xyz/openbmc_project/sensors/fan_tach/fb_fan2: + eventReadingType: 1 + sensorID: 0x64 + sensorType: 4 + offset: 0xff +/xyz/openbmc_project/metrics/memory/BmcECC: + eventReadingType: 0x6f + sensorID: 0xF0 + sensorType: 0x0C + offset: 0x00 +/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab0_prsnt: + eventReadingType: 0x6f + sensorID: 0xF1 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab1_prsnt: + eventReadingType: 0x6f + sensorID: 0xF2 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab2_prsnt: + eventReadingType: 0x6f + sensorID: 0xF3 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab3_prsnt: + eventReadingType: 0x6f + sensorID: 0xF4 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/sata0_prsnt: + eventReadingType: 0x6f + sensorID: 0xF5 + sensorType: 0x25 + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF6 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF7 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF8 + sensorType: 0x1B + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt: + eventReadingType: 0x6f + sensorID: 0xF9 + sensorType: 0x25 + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot1_prsnt: + eventReadingType: 0x6f + sensorID: 0xFA + sensorType: 0x25 + offset: 0x01 +/xyz/openbmc_project/watchdog/host0: + eventReadingType: 0x6f + sensorID: 0xFB + sensorType: 0x23 + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/fans_efuse_pg: + eventReadingType: 0x6f + sensorID: 0xFC + sensorType: 0x25 + offset: 0x01 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules b/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules deleted file mode 100644 index 3d0670bc3..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules +++ /dev/null @@ -1 +0,0 @@ -SUBSYSTEM=="tty", ATTRS{iomem_base}=="0xF0002000", ENV{SYSTEMD_WANTS}="obmc-console@ttyS1" SYMLINK+="ttyS1", TAG+="systemd" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend index f78e3c22d..142661078 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend @@ -1,13 +1,4 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/files:" -SRC_URI_append_gbs = " file://80-gbs-nuvoton-sol.rules" -do_install_append_gbs() { - install -m 0755 -d ${D}${sysconfdir}/${BPN} - rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf - install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/ - ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.ttyS1.conf - - install -d ${D}/lib/udev/rules.d - rm -f ${D}/lib/udev/rules.d/80-obmc-console-uart.rules - install -m 0644 ${WORKDIR}/80-gbs-nuvoton-sol.rules ${D}/lib/udev/rules.d -} +OBMC_CONSOLE_FRONT_TTY_gbs = "ttyS3" +OBMC_CONSOLE_HOST_TTY_gbs = "ttyS1" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch deleted file mode 100644 index 67fa59090..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 6e9a19c43acac7d4254910906329d98d7b59085a Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Fri, 24 May 2019 14:55:10 +0800 -Subject: [PATCH] Add the pre-timeout interrupt defined in IPMI spec - -The IPMI watchdog pre-timeout interrupt is used to set the different -pre-timeout interrupt source. Add them as a dbus property, -IPMI set/get watchdog commands will use it. - -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - xyz/openbmc_project/State/Watchdog.interface.yaml | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/xyz/openbmc_project/State/Watchdog.interface.yaml b/xyz/openbmc_project/State/Watchdog.interface.yaml -index 2fc47d8..6dfa9b9 100644 ---- a/xyz/openbmc_project/State/Watchdog.interface.yaml -+++ b/xyz/openbmc_project/State/Watchdog.interface.yaml -@@ -33,6 +33,11 @@ properties: - description: > - The action the watchdog should perform when it expires. - default: 'HardReset' -+ - name: PreTimeoutInterrupt -+ type: enum[self.PreTimeoutInterruptAction] -+ description: > -+ The BMC generates the selected interrupt before the timer expires. -+ default: 'None' - - name: Interval - type: uint64 - description: > -@@ -73,6 +78,23 @@ enumerations: - description: > - Perform a power cycle of the system. - -+ - name: PreTimeoutInterruptAction -+ description: > -+ The type of PreTimeout Interrupt. -+ values: -+ - name: 'None' -+ description: > -+ Do nothing. -+ - name: 'SMI' -+ description: > -+ SMI. -+ - name: 'NMI' -+ description: > -+ NMI / Diagnostic Interrupt. -+ - name: 'MI' -+ description: > -+ Messaging Interrupt. -+ - - name: TimerUse - description: > - The type of timer use. --- -2.7.4 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch deleted file mode 100644 index d7e66abd2..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b7c487750c05dcc081219ccdd4ef539beef6aa30 Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Mon, 29 Jul 2019 10:51:12 +0800 -Subject: [PATCH] Add PreInterruptFlag properity in DBUS. - -PreTimeoutInterruptOccurFlag in DBUS would be set 'true' -when watchdog pre-timeout interrupt occurred. - -Tested: -Enable command(raw 0x06 0x31) that get message flag -can set right bit about watchdog, -need record PreTimeoutInterruptOccurFlag -at xyz.openbmmc_project.State.Watchdog when watchdog -pre-timeout interrupt occurred. - -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - xyz/openbmc_project/State/Watchdog.interface.yaml | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xyz/openbmc_project/State/Watchdog.interface.yaml b/xyz/openbmc_project/State/Watchdog.interface.yaml -index bf4cca0..6579368 100644 ---- a/xyz/openbmc_project/State/Watchdog.interface.yaml -+++ b/xyz/openbmc_project/State/Watchdog.interface.yaml -@@ -59,6 +59,11 @@ properties: - description: > - The timer user at the time of expiration. - default: 'Reserved' -+ - name: PreTimeoutInterruptOccurFlag -+ type: boolean -+ description: > -+ PreTimeoutInterruptOccurFlag that preTimeoutInterrupt action occurred. -+ default: false - - enumerations: - - name: Action --- -2.7.4 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend deleted file mode 100644 index 0b5bff905..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" - -SRC_URI_append_gbs = " file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \ - file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \ - " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend index 9cea5db15..ff9e512c7 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend @@ -22,3 +22,4 @@ OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-nvme-pwr-ctrl" OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " read-margin-temp" OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-virtual-sensor" OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " acpi-power-state-daemon" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " virtual/obmc-gpio-presence" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend index 87ecf4fa3..2c19a3ead 100755 --- a/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,3 +1,8 @@ -EXTRA_OECMAKE_append_gbs = " \ - -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES=ON \ +EXTRA_OEMESON_append_gbs = " \ + -Dredfish-dbus-log=enabled \ + -Dhttp-body-limit=40 \ " + +do_install_append_gbs(){ + install -d ${D}${localstatedir}/lib/bmcweb +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend index 9f4c89026..14f333b81 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend @@ -1,5 +1,5 @@ NUVOTON_FLASH_PCIMBOX = "0xF0848000" -EXTRA_OECONF_append_gbs = " --enable-nuvoton-p2a-mbox" +PACKAGECONFIG_append_gbs = " nuvoton-p2a-mbox" IPMI_FLASH_BMC_ADDRESS_gbs = "${NUVOTON_FLASH_PCIMBOX}" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch new file mode 100644 index 000000000..74f982b33 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch @@ -0,0 +1,79 @@ +From a1f9d797753e32b36e08e7d611ff88b10e9bbad2 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Thu, 30 Jan 2020 16:18:33 -0800 +Subject: [PATCH 1/3] Add Chassis State Transition interface + +This adds the Chassis State Transition interface in preparation +to support the mapping defined in the design document below. + +ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 + +Tested: +Ran each IPMI chassis control command to confirm the expected +behavior: +ipmitool power on: system is powered-on +ipmitool power off: system is forced off +ipmitool power cycle: system is forced off then powered-on +ipmitool power reset: system is hard reset +ipmitool power soft: soft power-off requested from system software + +Change-Id: I6acfb795a9a33ff5227a5d6e1830774ab732ac0c +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + chassishandler.cpp | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/chassishandler.cpp b/chassishandler.cpp +index 0d318647..fdbb9fa5 100644 +--- a/chassishandler.cpp ++++ b/chassishandler.cpp +@@ -31,6 +31,7 @@ + #include <xyz/openbmc_project/Control/Boot/Mode/server.hpp> + #include <xyz/openbmc_project/Control/Boot/Source/server.hpp> + #include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp> ++#include <xyz/openbmc_project/State/Chassis/server.hpp> + #include <xyz/openbmc_project/State/Host/server.hpp> + #include <xyz/openbmc_project/State/PowerOnHours/server.hpp> + +@@ -865,6 +866,38 @@ int initiate_state_transition(State::Host::Transition transition) + return rc; + } + ++//------------------------------------------ ++// Calls into Chassis State Manager Dbus object ++//------------------------------------------ ++int initiateChassisStateTransition(State::Chassis::Transition transition) ++{ ++ // OpenBMC Chassis State Manager dbus framework ++ constexpr auto chassisStatePath = "/xyz/openbmc_project/state/chassis0"; ++ constexpr auto chassisStateIntf = "xyz.openbmc_project.State.Chassis"; ++ ++ auto service = ++ ipmi::getService(*getSdBus(), chassisStateIntf, chassisStatePath); ++ ++ // Convert to string equivalent of the passed in transition enum. ++ auto request = State::convertForMessage(transition); ++ ++ try ++ { ++ ipmi::setDbusProperty(*getSdBus(), service, chassisStatePath, ++ chassisStateIntf, "RequestedPowerTransition", ++ request); ++ } ++ catch (std::exception& e) ++ { ++ log<level::ERR>( ++ "Failed to initiate transition", ++ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); ++ return -1; ++ } ++ ++ return 0; ++} ++ + //------------------------------------------ + // Set Enabled property to inform NMI source + // handling to trigger a NMI_OUT BSOD. +-- +2.21.0 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch new file mode 100644 index 000000000..6d13f9297 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch @@ -0,0 +1,169 @@ +From 8ce91a760fca8c945540679c92770f841629e179 Mon Sep 17 00:00:00 2001 +From: Tony Lee <tony.lee@quantatw.com> +Date: Thu, 31 Oct 2019 17:24:16 +0800 +Subject: [PATCH] Fix issues and support signed sensor values + +Sensor will get "disable" when the command "ipmitool sdr elist" is +executed that if sensorReadingType is 0x6F. + +sensor_units_1 is always set to 0 currently. To support the display of +signed sensor values, we add the attribute "sensorUnits1" to the sensor +mapping yaml. This attribute can be used to determine whether the +sensor is signed. + +It were making negative values 0 in get::readingData(). Fix the issue +by using a int32_t and add an overflow check. + +Change-Id: I705defcf18805db9ada7d0de0738a59aedab61df +Signed-off-by: Tony Lee <tony.lee@quantatw.com> +--- + include/ipmid/types.hpp | 2 ++ + scripts/sensor-example.yaml | 2 ++ + scripts/writesensor.mako.cpp | 2 ++ + sensordatahandler.cpp | 2 -- + sensordatahandler.hpp | 31 ++++++++++++++++++++++++++++--- + sensorhandler.cpp | 5 ++--- + 6 files changed, 36 insertions(+), 8 deletions(-) + +diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp +index e62c8192..bd1fac2b 100644 +--- a/include/ipmid/types.hpp ++++ b/include/ipmid/types.hpp +@@ -133,6 +133,7 @@ using Unit = std::string; + using EntityType = uint8_t; + using EntityInst = uint8_t; + using SensorName = std::string; ++using SensorUnits1 = uint8_t; + + enum class Mutability + { +@@ -167,6 +168,7 @@ struct Info + Exponent exponentR; + bool hasScale; + Scale scale; ++ SensorUnits1 sensorUnits1; + Unit unit; + std::function<uint8_t(SetSensorReadingReq&, const Info&)> updateFunc; + std::function<GetSensorResponse(const Info&)> getFunc; +diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml +index 9760cd01..bddd2e6d 100644 +--- a/scripts/sensor-example.yaml ++++ b/scripts/sensor-example.yaml +@@ -112,6 +112,8 @@ + # Applies for analog sensors, the actual reading value for the sensor is + # Value * 10^N + scale: -3 ++ # Indicate Analog Data Format, Rate unit, Modifier unit and Percentage ++ sensorUnits1 : 0x80 + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData +diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp +index 8b268052..813f9404 100644 +--- a/scripts/writesensor.mako.cpp ++++ b/scripts/writesensor.mako.cpp +@@ -49,6 +49,7 @@ extern const IdInfoMap sensors = { + offsetB = sensor.get("offsetB", 0) + bExp = sensor.get("bExp", 0) + rExp = sensor.get("rExp", 0) ++ sensorUnits1 = sensor.get("sensorUnits1", 0) + unit = sensor.get("unit", "") + scale = sensor.get("scale", 0) + hasScale = "true" if "scale" in sensor.keys() else "false" +@@ -91,6 +92,7 @@ extern const IdInfoMap sensors = { + .exponentR = ${rExp}, + .hasScale = ${hasScale}, + .scale = ${scale}, ++ .sensorUnits1 = ${sensorUnits1}, + .unit = "${unit}", + .updateFunc = ${updateFunc}, + .getFunc = ${getFunc}, +diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp +index 06f5f429..fc74b8f8 100644 +--- a/sensordatahandler.cpp ++++ b/sensordatahandler.cpp +@@ -7,8 +7,6 @@ + #include <ipmid/types.hpp> + #include <ipmid/utils.hpp> + #include <optional> +-#include <phosphor-logging/elog-errors.hpp> +-#include <phosphor-logging/log.hpp> + #include <sdbusplus/message/types.hpp> + #include <xyz/openbmc_project/Common/error.hpp> + +diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp +index 5cad58c5..c48140a3 100644 +--- a/sensordatahandler.hpp ++++ b/sensordatahandler.hpp +@@ -8,6 +8,8 @@ + #include <ipmid/api.hpp> + #include <ipmid/types.hpp> + #include <ipmid/utils.hpp> ++#include <phosphor-logging/elog-errors.hpp> ++#include <phosphor-logging/log.hpp> + #include <sdbusplus/message/types.hpp> + + namespace ipmi +@@ -28,6 +30,7 @@ using ServicePath = std::pair<Path, Service>; + using Interfaces = std::vector<Interface>; + + using MapperResponseType = std::map<Path, std::map<Service, Interfaces>>; ++using namespace phosphor::logging; + + /** @brief get the D-Bus service and service path + * @param[in] bus - The Dbus bus object +@@ -225,10 +228,32 @@ GetSensorResponse readingData(const Info& sensorInfo) + + double value = std::get<T>(propValue) * + std::pow(10, sensorInfo.scale - sensorInfo.exponentR); ++ int32_t rawData = ++ (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM; + +- auto rawData = static_cast<uint8_t>((value - sensorInfo.scaledOffset) / +- sensorInfo.coefficientM); +- setReading(rawData, &response); ++ constexpr uint8_t sensorUnitsSignedBits = 2 << 6; ++ constexpr uint8_t signedDataFormat = 0x80; ++ // if sensorUnits1 [7:6] = 10b, sensor is signed ++ if ((sensorInfo.sensorUnits1 & sensorUnitsSignedBits) == signedDataFormat) ++ { ++ if (rawData > std::numeric_limits<int8_t>::max() || ++ rawData < std::numeric_limits<int8_t>::lowest()) ++ { ++ log<level::ERR>("Value out of range"); ++ throw std::out_of_range("Value out of range"); ++ } ++ setReading(static_cast<int8_t>(rawData), &response); ++ } ++ else ++ { ++ if (rawData > std::numeric_limits<uint8_t>::max() || ++ rawData < std::numeric_limits<uint8_t>::lowest()) ++ { ++ log<level::ERR>("Value out of range"); ++ throw std::out_of_range("Value out of range"); ++ } ++ setReading(static_cast<uint8_t>(rawData), &response); ++ } + + return response; + } +diff --git a/sensorhandler.cpp b/sensorhandler.cpp +index 36998715..260331a0 100644 +--- a/sensorhandler.cpp ++++ b/sensorhandler.cpp +@@ -700,9 +700,8 @@ ipmi_ret_t populate_record_from_dbus(get_sdr::SensorDataFullRecordBody* body, + /* Functional sensor case */ + if (isAnalogSensor(info->propertyInterfaces.begin()->first)) + { +- +- body->sensor_units_1 = 0; // unsigned, no rate, no modifier, not a % +- ++ body->sensor_units_1 = info->sensorUnits1; // default is 0. unsigned, no ++ // rate, no modifier, not a % + /* Unit info */ + setUnitFieldsForObject(info, body); + +-- +2.21.0 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch new file mode 100644 index 000000000..156327b9c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch @@ -0,0 +1,137 @@ +From 8079e1e39e1953458bd2e59c7f546a3d879558db Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Thu, 30 Jan 2020 16:02:39 -0800 +Subject: [PATCH 2/3] Update Host State Transition function + +This updates the Host State Transition function to use the new +IPMI DBus APIs for transition requests. + +Tested: +Ran each IPMI chassis control command to confirm the expected +behavior: +ipmitool power on: system is powered-on +ipmitool power off: system is forced off +ipmitool power cycle: system is forced off then powered-on +ipmitool power reset: system is hard reset +ipmitool power soft: soft power-off requested from system software + +Change-Id: Id2253a9c0060e892bc318dd02a6221ac1a2ae2d9 +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + chassishandler.cpp | 64 +++++++++++++--------------------------------- + 1 file changed, 18 insertions(+), 46 deletions(-) + +diff --git a/chassishandler.cpp b/chassishandler.cpp +index fdbb9fa5..af9cba72 100644 +--- a/chassishandler.cpp ++++ b/chassishandler.cpp +@@ -811,59 +811,31 @@ ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout, + //------------------------------------------ + // Calls into Host State Manager Dbus object + //------------------------------------------ +-int initiate_state_transition(State::Host::Transition transition) ++int initiateHostStateTransition(State::Host::Transition transition) + { + // OpenBMC Host State Manager dbus framework +- constexpr auto HOST_STATE_MANAGER_ROOT = "/xyz/openbmc_project/state/host0"; +- constexpr auto HOST_STATE_MANAGER_IFACE = "xyz.openbmc_project.State.Host"; +- constexpr auto DBUS_PROPERTY_IFACE = "org.freedesktop.DBus.Properties"; +- constexpr auto PROPERTY = "RequestedHostTransition"; ++ constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0"; ++ constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host"; + +- // sd_bus error +- int rc = 0; +- char* busname = NULL; +- +- // SD Bus error report mechanism. +- sd_bus_error bus_error = SD_BUS_ERROR_NULL; +- +- // Gets a hook onto either a SYSTEM or SESSION bus +- sd_bus* bus_type = ipmid_get_sd_bus_connection(); +- rc = mapper_get_service(bus_type, HOST_STATE_MANAGER_ROOT, &busname); +- if (rc < 0) +- { +- log<level::ERR>( +- "Failed to get bus name", +- entry("ERRNO=0x%X, OBJPATH=%s", -rc, HOST_STATE_MANAGER_ROOT)); +- return rc; +- } ++ auto service = ipmi::getService(*getSdBus(), hostStateIntf, hostStatePath); + + // Convert to string equivalent of the passed in transition enum. + auto request = State::convertForMessage(transition); + +- rc = sd_bus_call_method(bus_type, // On the system bus +- busname, // Service to contact +- HOST_STATE_MANAGER_ROOT, // Object path +- DBUS_PROPERTY_IFACE, // Interface name +- "Set", // Method to be called +- &bus_error, // object to return error +- nullptr, // Response buffer if any +- "ssv", // Takes 3 arguments +- HOST_STATE_MANAGER_IFACE, PROPERTY, "s", +- request.c_str()); +- if (rc < 0) ++ try + { +- log<level::ERR>("Failed to initiate transition", +- entry("ERRNO=0x%X, REQUEST=%s", -rc, request.c_str())); ++ ipmi::setDbusProperty(*getSdBus(), service, hostStatePath, ++ hostStateIntf, "RequestedHostTransition", ++ request); + } +- else ++ catch (std::exception& e) + { +- log<level::INFO>("Transition request initiated successfully"); ++ log<level::ERR>( ++ "Failed to initiate transition", ++ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); ++ return -1; + } +- +- sd_bus_error_free(&bus_error); +- free(busname); +- +- return rc; ++ return 0; + } + + //------------------------------------------ +@@ -1411,7 +1383,7 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) + switch (chassisControl) + { + case CMD_POWER_ON: +- rc = initiate_state_transition(State::Host::Transition::On); ++ rc = initiateHostStateTransition(State::Host::Transition::On); + break; + case CMD_POWER_OFF: + // This path would be hit in 2 conditions. +@@ -1439,7 +1411,7 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) + indicate_no_softoff_needed(); + + // Now request the shutdown +- rc = initiate_state_transition(State::Host::Transition::Off); ++ rc = initiateHostStateTransition(State::Host::Transition::Off); + } + else + { +@@ -1460,12 +1432,12 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) + // originating via a soft power off SMS request) + indicate_no_softoff_needed(); + +- rc = initiate_state_transition(State::Host::Transition::Reboot); ++ rc = initiateHostStateTransition(State::Host::Transition::Reboot); + break; + + case CMD_SOFT_OFF_VIA_OVER_TEMP: + // Request Host State Manager to do a soft power off +- rc = initiate_state_transition(State::Host::Transition::Off); ++ rc = initiateHostStateTransition(State::Host::Transition::Off); + break; + + case CMD_PULSE_DIAGNOSTIC_INTR: +-- +2.21.0 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch new file mode 100644 index 000000000..271af3f5b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch @@ -0,0 +1,180 @@ +From 291629d5c3e5bea31925c9d025688897c90eb783 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Thu, 30 Jan 2020 16:22:24 -0800 +Subject: [PATCH 3/3] Update IPMI Chassis Control command transition requests + +This change updates the IPMI Chassis Control command to use the new +host state transitions and chassis off transition based on the +mapping in the design document below. This allows each chassis +control action to more closely follow the behavior defined in the +IPMI spec. + +ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 + +Tested: +Ran each IPMI chassis control command to confirm the expected +behavior: +ipmitool power on: system is powered-on using Host.On +ipmitool power off: system is forced off using Chassis.Off +ipmitool power cycle: system is forced off then powered-on using + Host.Reboot +ipmitool power reset: system is hard reset using Host.ForceWarmReboot +ipmitool power soft: soft power-off requested from system software + using Host.Off + +Change-Id: Ieb42722102fde0e51a49dc4aaa3ff227a3394066 +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + chassishandler.cpp | 121 ++------------------------------------------- + 1 file changed, 5 insertions(+), 116 deletions(-) + +diff --git a/chassishandler.cpp b/chassishandler.cpp +index af9cba72..663081de 100644 +--- a/chassishandler.cpp ++++ b/chassishandler.cpp +@@ -1301,76 +1301,6 @@ ipmi::RspType<uint4_t, // Restart Cause + return ipmi::responseSuccess(cause.value(), reserved, channel); + } + +-//------------------------------------------------------------- +-// Send a command to SoftPowerOff application to stop any timer +-//------------------------------------------------------------- +-int stop_soft_off_timer() +-{ +- constexpr auto iface = "org.freedesktop.DBus.Properties"; +- constexpr auto soft_off_iface = "xyz.openbmc_project.Ipmi.Internal." +- "SoftPowerOff"; +- +- constexpr auto property = "ResponseReceived"; +- constexpr auto value = "xyz.openbmc_project.Ipmi.Internal." +- "SoftPowerOff.HostResponse.HostShutdown"; +- +- // Get the system bus where most system services are provided. +- auto bus = ipmid_get_sd_bus_connection(); +- +- // Get the service name +- // TODO openbmc/openbmc#1661 - Mapper refactor +- // +- // See openbmc/openbmc#1743 for some details but high level summary is that +- // for now the code will directly call the soft off interface due to a +- // race condition with mapper usage +- // +- // char *busname = nullptr; +- // auto r = mapper_get_service(bus, SOFTOFF_OBJPATH, &busname); +- // if (r < 0) +- //{ +- // fprintf(stderr, "Failed to get %s bus name: %s\n", +- // SOFTOFF_OBJPATH, -r); +- // return r; +- //} +- +- // No error object or reply expected. +- int rc = sd_bus_call_method(bus, SOFTOFF_BUSNAME, SOFTOFF_OBJPATH, iface, +- "Set", nullptr, nullptr, "ssv", soft_off_iface, +- property, "s", value); +- if (rc < 0) +- { +- log<level::ERR>("Failed to set property in SoftPowerOff object", +- entry("ERRNO=0x%X", -rc)); +- } +- +- // TODO openbmc/openbmc#1661 - Mapper refactor +- // free(busname); +- return rc; +-} +- +-//---------------------------------------------------------------------- +-// Create file to indicate there is no need for softoff notification to host +-//---------------------------------------------------------------------- +-void indicate_no_softoff_needed() +-{ +- fs::path path{HOST_INBAND_REQUEST_DIR}; +- if (!fs::is_directory(path)) +- { +- fs::create_directory(path); +- } +- +- // Add the host instance (default 0 for now) to the file name +- std::string file{HOST_INBAND_REQUEST_FILE}; +- auto size = std::snprintf(nullptr, 0, file.c_str(), 0); +- size++; // null +- std::unique_ptr<char[]> buf(new char[size]); +- std::snprintf(buf.get(), size, file.c_str(), 0); +- +- // Append file name to directory and create it +- path /= buf.get(); +- std::ofstream(path.c_str()); +-} +- + /** @brief Implementation of chassis control command + * + * @param - chassisControl command byte +@@ -1386,60 +1316,19 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) + rc = initiateHostStateTransition(State::Host::Transition::On); + break; + case CMD_POWER_OFF: +- // This path would be hit in 2 conditions. +- // 1: When user asks for power off using ipmi chassis command 0x04 +- // 2: Host asking for power off post shutting down. +- +- // If it's a host requested power off, then need to nudge Softoff +- // application that it needs to stop the watchdog timer if running. +- // If it is a user requested power off, then this is not really +- // needed. But then we need to differentiate between user and host +- // calling this same command +- +- // For now, we are going ahead with trying to nudge the soft off and +- // interpret the failure to do so as a non softoff case +- rc = stop_soft_off_timer(); +- +- // Only request the Off transition if the soft power off +- // application is not running +- if (rc < 0) +- { +- // First create a file to indicate to the soft off application +- // that it should not run. Not doing this will result in State +- // manager doing a default soft power off when asked for power +- // off. +- indicate_no_softoff_needed(); +- +- // Now request the shutdown +- rc = initiateHostStateTransition(State::Host::Transition::Off); +- } +- else +- { +- log<level::INFO>("Soft off is running, so let shutdown target " +- "stop the host"); +- } ++ rc = ++ initiateChassisStateTransition(State::Chassis::Transition::Off); + break; +- + case CMD_HARD_RESET: ++ rc = initiateHostStateTransition( ++ State::Host::Transition::ForceWarmReboot); ++ break; + case CMD_POWER_CYCLE: +- // SPEC has a section that says certain implementations can trigger +- // PowerOn if power is Off when a command to power cycle is +- // requested +- +- // First create a file to indicate to the soft off application +- // that it should not run since this is a direct user initiated +- // power reboot request (i.e. a reboot request that is not +- // originating via a soft power off SMS request) +- indicate_no_softoff_needed(); +- + rc = initiateHostStateTransition(State::Host::Transition::Reboot); + break; +- + case CMD_SOFT_OFF_VIA_OVER_TEMP: +- // Request Host State Manager to do a soft power off + rc = initiateHostStateTransition(State::Host::Transition::Off); + break; +- + case CMD_PULSE_DIAGNOSTIC_INTR: + rc = setNmiProperty(true); + break; +-- +2.21.0 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch deleted file mode 100644 index d815cde72..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 9deb72959477700216326c033c930236e58f965f Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Tue, 28 May 2019 17:11:17 +0800 -Subject: [PATCH] Save the pre-timeout interrupt in dbus property - -Get the watchdog pre-timeout interrupt value from ipmi watchdog set command, -and store it into dbus property. - -Tested: -Config IPMI watchdog: BIOS FRB2 Power Cycle after 1 seconds: -ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00 -Start watchdog: -Ipmitool mc watchdog reset -Check the watchdog pre-timeout interrupt in below: -https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries - -Signed-off-by: Ren Yu <yux.ren@intel.com> - ---- - app/watchdog.cpp | 47 ++++++++++++++++++++++++++++++++++++++++ - app/watchdog_service.cpp | 6 +++++ - app/watchdog_service.hpp | 9 ++++++++ - 3 files changed, 62 insertions(+) - -diff --git a/app/watchdog.cpp b/app/watchdog.cpp -index 03c373e..cb0b1fd 100644 ---- a/app/watchdog.cpp -+++ b/app/watchdog.cpp -@@ -80,6 +80,7 @@ ipmi::RspType<> ipmiAppResetWatchdogTimer() - - static constexpr uint8_t wd_dont_stop = 0x1 << 6; - static constexpr uint8_t wd_timeout_action_mask = 0x3; -+static constexpr uint8_t wdPreTimeoutInterruptMask = 0x3; - - static constexpr uint8_t wdTimerUseResTimer1 = 0x0; - static constexpr uint8_t wdTimerUseResTimer2 = 0x6; -@@ -127,6 +128,45 @@ WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmi_action) - } - } - -+enum class IpmiPreTimeoutInterrupt : uint8_t -+{ -+ None = 0x0, -+ SMI = 0x1, -+ NMI = 0x2, -+ MI = 0x3, -+}; -+/** @brief Converts an IPMI Watchdog PreTimeoutInterrupt to DBUS defined action -+ * @param[in] ipmi_action The IPMI Watchdog PreTimeoutInterrupt -+ * @return The Watchdog PreTimeoutInterrupt that the ipmi_action maps to -+ */ -+WatchdogService::PreTimeoutInterruptAction ipmiPreTimeoutInterruptToWdAction( -+ IpmiPreTimeoutInterrupt ipmiPreTimeOutInterrupt) -+{ -+ switch (ipmiPreTimeOutInterrupt) -+ { -+ case IpmiPreTimeoutInterrupt::None: -+ { -+ return WatchdogService::PreTimeoutInterruptAction::None; -+ } -+ case IpmiPreTimeoutInterrupt::SMI: -+ { -+ return WatchdogService::PreTimeoutInterruptAction::SMI; -+ } -+ case IpmiPreTimeoutInterrupt::NMI: -+ { -+ return WatchdogService::PreTimeoutInterruptAction::NMI; -+ } -+ case IpmiPreTimeoutInterrupt::MI: -+ { -+ return WatchdogService::PreTimeoutInterruptAction::MI; -+ } -+ default: -+ { -+ throw std::domain_error("IPMI PreTimeoutInterrupt is invalid"); -+ } -+ } -+} -+ - enum class IpmiTimerUse : uint8_t - { - Reserved = 0x0, -@@ -250,6 +290,13 @@ ipmi::RspType<> - // Mark as initialized so that future resets behave correctly - wd_service.setInitialized(true); - -+ // pretimeOutAction -+ const auto ipmiPreTimeoutInterrupt = -+ static_cast<IpmiPreTimeoutInterrupt>(wdPreTimeoutInterruptMask & -+ (static_cast<uint8_t>(preTimeoutInterrupt))); -+ wd_service.setPreTimeoutInterrupt( -+ ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt)); -+ - lastCallSuccessful = true; - return ipmi::responseSuccess(); - } -diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp -index 3534e89..4df1ab6 100644 ---- a/app/watchdog_service.cpp -+++ b/app/watchdog_service.cpp -@@ -198,3 +198,9 @@ void WatchdogService::setInterval(uint64_t interval) - { - setProperty("Interval", interval); - } -+ -+void WatchdogService::setPreTimeoutInterrupt( -+ PreTimeoutInterruptAction preTimeoutInterrupt) -+{ -+ setProperty("PreTimeoutInterrupt", convertForMessage(preTimeoutInterrupt)); -+} -\ No newline at end of file -diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp -index 141bdb7..32b7461 100644 ---- a/app/watchdog_service.hpp -+++ b/app/watchdog_service.hpp -@@ -15,6 +15,8 @@ class WatchdogService - - using Action = - sdbusplus::xyz::openbmc_project::State::server::Watchdog::Action; -+ using PreTimeoutInterruptAction = sdbusplus::xyz::openbmc_project::State:: -+ server::Watchdog::PreTimeoutInterruptAction; - using TimerUse = - sdbusplus::xyz::openbmc_project::State::server::Watchdog::TimerUse; - -@@ -92,6 +94,13 @@ class WatchdogService - */ - void setInterval(uint64_t interval); - -+ /** @brief Sets the value of the PreTimeoutInterrupt property on the host -+ * watchdog -+ * -+ * @param[in] PreTimeoutInterrupt - The new PreTimeoutInterrupt value -+ */ -+ void setPreTimeoutInterrupt(PreTimeoutInterruptAction preTimeoutInterrupt); -+ - private: - /** @brief sdbusplus handle */ - sdbusplus::bus::bus bus; diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index bf2986c47..af5fb1356 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -1,18 +1,19 @@ DEPENDS_append_gbs = " gbs-yaml-config" -SRC_URI_remove_gbs = "git://github.com/openbmc/phosphor-host-ipmid" -SRC_URI_prepend_gbs = "git://github.com/quanta-bmc/phosphor-host-ipmid.git" - -SRCREV_gbs = "257ea262809c52e51f1f592e047d27125f0273b3" - FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \ - file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ + file://0001-Add-Chassis-State-Transition-interface.patch \ + file://0002-Update-Host-State-Transition-function.patch \ + file://0003-Update-IPMI-Chassis-Control-command-transition-reque.patch \ + file://0001-Fix-issues-and-support-signed-sensor-values.patch \ " WHITELIST_CONF_gbs = "${WORKDIR}/gbs-ipmid-whitelist.conf" -EXTRA_OECONF_append_gbs = " --with-journal-sel \ +EXTRA_OECONF_append_gbs = " \ SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-sensors.yaml \ FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-fru-read.yaml \ + INVSENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-inventory-sensors.yaml \ " + +RDEPENDS_${PN}_remove_gbs = "clear-once" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/leds/phosphor-led-manager_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/leds/phosphor-led-manager_%.bbappend index a7ec24f41..e887b1935 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/leds/phosphor-led-manager_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/leds/phosphor-led-manager_%.bbappend @@ -1,5 +1,16 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" SRC_URI_append_gbs = " file://service-override.conf" -SYSTEMD_OVERRIDE_${PN}-ledmanager_append_gbs = " \ - service-override.conf:xyz.openbmc_project.LED.GroupManager.service.d/service-override.conf" +FILES_${PN}_append_gbs = " ${systemd_system_unitdir}/xyz.openbmc_project.LED.GroupManager.service.d/service-override.conf" + +do_compile_prepend_gbs() { + install -m 0644 ${STAGING_DATADIR_NATIVE}/${PN}/led.yaml ${S} +} + +do_install_append_gbs() { + rm -rf ${D}${datadir}/${PN}/* + + install -d ${D}${systemd_system_unitdir}/xyz.openbmc_project.LED.GroupManager.service.d + install -D -m 0644 ${WORKDIR}/service-override.conf \ + ${D}${systemd_system_unitdir}/xyz.openbmc_project.LED.GroupManager.service.d/ +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend new file mode 100644 index 000000000..264423933 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend @@ -0,0 +1 @@ +EXTRA_OEMESON_append_gbs = " -Derror_info_cap=256" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend index 49959cc0e..9caf61e66 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend @@ -1 +1,2 @@ -EXTRA_OECONF_append_gbs = " --enable-nic-ethtool=yes" +PACKAGECONFIG_append_gbs = " nic-ethtool" +PACKAGECONFIG_remove_gbs = "uboot-env" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb index 4c1bb123c..20c81ad94 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb +++ b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb @@ -32,5 +32,5 @@ SUMMARY_${PN}-flash = "GBS Flash" RDEPENDS_${PN}-flash = " \ phosphor-ipmi-flash \ gbs-bmc-update \ - gbs-bios-update \ + virtual/bios-update \ " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend index 935c3cebb..73e9b0aa4 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend @@ -1,2 +1,2 @@ -RDEPENDS_${PN}-extras_remove_gbs = "obmc-ikvm" -RDEPENDS_${PN}-inventory_append_gbs = " virtual/obmc-gpio-presence" +RDEPENDS_${PN}-fru-ipmi_remove_gbs = "fru-device" +RDEPENDS_${PN}-ikvm_remove_gbs = "obmc-ikvm" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend index e0f8e08aa..5c28b0435 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -1,5 +1,4 @@ -SRC_URI_gbs := "git://github.com/quanta-bmc/phosphor-sel-logger.git" -SRCREV_gbs := "6ded68355db28958836aedb40c0d4780d84d2b43" - # Enable threshold monitoring -EXTRA_OECMAKE_append_gbs = "-DSEL_LOGGER_MONITOR_THRESHOLD_EVENTS=ON" +EXTRA_OECMAKE_append_gbs = "-DSEL_LOGGER_SEND_TO_LOGGING_SERVICE=ON \ + -DSEL_LOGGER_MONITOR_THRESHOLD_ALARM_EVENTS=ON \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch index c279e0b81..a3718ea2a 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch @@ -1,44 +1,33 @@ -From 2cea5d289b278db4468b16bf6b64102655811fd0 Mon Sep 17 00:00:00 2001 -From: Eddielu <Eddie.Lu@quantatw.com> -Date: Mon, 27 Jul 2020 20:30:22 +0800 -Subject: [PATCH] Update lev-add-poweron-monitor-feature patch. +From 5cea18ba476c0cb6ea622be50a09ead00cd47b14 Mon Sep 17 00:00:00 2001 +From: Ivan Li <rli11@lenovo.com> +Date: Wed, 25 Dec 2019 17:05:00 +0800 +Subject: [PATCH] Add power on monitor mechanism +Summary: +1. Add "PWRONMON" attribute in sensor configuration file to determine whether it's power-on monitor sensor or not. (i.e. PWRONMON_temp1 = "ON") +2. Watching "CurrentHostState" property and then use it to turn on/off threshold alert for power-on monitor sensors. + +Test Plan: +Check if there is any abnormal threshold events occurred in power off state or during power transition + +Signed-off-by: Ivan Li <rli11@lenovo.com> +Change-Id: I76d3a664153141d94636e0011f3a48e4f6dee922 --- - Makefile.am | 2 ++ - mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - sensor.cpp | 11 ++++++- - sensor.hpp | 13 ++++++++ - thresholds.hpp | 2 -- - 5 files changed, 127 insertions(+), 3 deletions(-) + mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ + sensor.cpp | 11 +++++- + sensor.hpp | 13 +++++++ + thresholds.hpp | 24 ------------ + 4 files changed, 125 insertions(+), 25 deletions(-) -diff --git a/Makefile.am b/Makefile.am -index 706a6cc..c620fa4 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -46,6 +46,7 @@ libhwmon_la_LIBADD = \ - $(SDEVENTPLUS_LIBS) \ - $(PHOSPHOR_DBUS_INTERFACES_LIBS) \ - $(PHOSPHOR_LOGGING_LIBS) \ -+ $(PTHREAD_LIBS) \ - $(GPIOPLUS_LIBS) \ - $(STDPLUS_LIBS) \ - $(CODE_COVERAGE_LIBS) \ -@@ -55,6 +56,7 @@ libhwmon_la_CXXFLAGS = \ - $(SDEVENTPLUS_CFLAGS) \ - $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ - $(PHOSPHOR_LOGGING_CFLAGS) \ -+ $(PTHREAD_CFLAGS) \ - $(STDPLUS_CFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) - diff --git a/mainloop.cpp b/mainloop.cpp -index 3e7e0bf..4789a80 100644 +index 29dc26a..5e27a30 100644 --- a/mainloop.cpp +++ b/mainloop.cpp -@@ -41,6 +41,12 @@ +@@ -42,6 +42,13 @@ #include <string> #include <unordered_set> #include <xyz/openbmc_project/Sensor/Device/error.hpp> ++#include <boost/asio/io_service.hpp> +#include <boost/container/flat_map.hpp> +#include <boost/algorithm/string/predicate.hpp> +#include <sdbusplus/asio/connection.hpp> @@ -48,9 +37,9 @@ index 3e7e0bf..4789a80 100644 using namespace phosphor::logging; -@@ -76,6 +82,12 @@ decltype( - Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi = - &CriticalObject::criticalAlarmHigh; +@@ -110,6 +117,12 @@ decltype(Thresholds<CriticalObject>::deassertHighSignal) + Thresholds<CriticalObject>::deassertHighSignal = + &CriticalObject::criticalHighAlarmDeasserted; +static std::unique_ptr<phosphor::Timer> cacheTimer = nullptr; +static std::unique_ptr<sdbusplus::bus::match::match> powerMatch = nullptr; @@ -61,7 +50,7 @@ index 3e7e0bf..4789a80 100644 void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) { for (auto& iface : ifaces) -@@ -103,6 +115,84 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) +@@ -137,6 +150,83 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) } } @@ -104,23 +93,23 @@ index 3e7e0bf..4789a80 100644 + std::string objectName; + boost::container::flat_map<std::string, std::variant<std::string>> + values; -+ message.read(objectName, values); -+ auto findState = values.find("CurrentHostState"); -+ if (findState != values.end()) -+ { -+ bool on = boost::ends_with( ++ message.read(objectName, values); ++ auto findState = values.find("CurrentHostState"); ++ if (findState != values.end()) ++ { ++ bool on = boost::ends_with( + std::get<std::string>(findState->second), "Running"); -+ if (!on) ++ if (!on) + { -+ cacheTimer->stop(); ++ cacheTimer->stop(); + powerStatusOn = false; + return; + } -+ cacheTimer->start(std::chrono::duration_cast<std::chrono::microseconds>( ++ cacheTimer->start(std::chrono::duration_cast<std::chrono::microseconds>( + std::chrono::seconds(10))); -+ } -+ else { -+ powerStatusOn = false; ++ } ++ else { ++ powerStatusOn = false; + } + }); + @@ -135,18 +124,17 @@ index 3e7e0bf..4789a80 100644 + boost::ends_with(std::get<std::string>(state), "Running"); + }, + "xyz.openbmc_project.State.Host", -+ "/xyz/openbmc_project/state/host0", -+ "org.freedesktop.DBus.Properties", "Get", ++ "/xyz/openbmc_project/state/host0", ++ "org.freedesktop.DBus.Properties", "Get", + "xyz.openbmc_project.State.Host", "CurrentHostState"); + + createTimer(); +} + -+ std::string MainLoop::getID(SensorSet::container_t::const_reference sensor) { std::string id; -@@ -384,6 +474,7 @@ void MainLoop::init() +@@ -418,6 +508,7 @@ void MainLoop::init() _interval = std::strtoull(interval.c_str(), NULL, 10); } } @@ -154,7 +142,7 @@ index 3e7e0bf..4789a80 100644 } void MainLoop::read() -@@ -428,6 +519,12 @@ void MainLoop::read() +@@ -462,6 +553,12 @@ void MainLoop::read() try { @@ -167,23 +155,23 @@ index 3e7e0bf..4789a80 100644 if (sensor->hasFaultFile()) { auto fault = _ioAccess->read(sensorSysfsType, sensorSysfsNum, -@@ -490,6 +587,11 @@ void MainLoop::read() +@@ -588,6 +685,11 @@ void MainLoop::read() } } + if(sensor->pwrOnMonitor() && !isPowerOn()) + { -+ statusIface->functional(false); -+ continue; ++ statusIface->functional(false); ++ continue; + } updateSensorInterfaces(obj, value); } catch (const std::system_error& e) diff --git a/sensor.cpp b/sensor.cpp -index 09aeca6..b1cb470 100644 +index ac2f896..72b45f8 100644 --- a/sensor.cpp +++ b/sensor.cpp -@@ -31,7 +31,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, +@@ -32,7 +32,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, const hwmonio::HwmonIOInterface* ioAccess, const std::string& devPath) : _sensor(sensor), @@ -192,7 +180,7 @@ index 09aeca6..b1cb470 100644 { auto chip = env::getEnv("GPIOCHIP", sensor); auto access = env::getEnv("GPIO", sensor); -@@ -60,6 +60,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, +@@ -61,6 +61,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, auto senRmRCs = env::getEnv("REMOVERCS", sensor); // Add sensor removal return codes defined per sensor addRemoveRCs(senRmRCs); @@ -209,10 +197,10 @@ index 09aeca6..b1cb470 100644 void Sensor::addRemoveRCs(const std::string& rcList) diff --git a/sensor.hpp b/sensor.hpp -index 4b2d281..369a252 100644 +index 64d6e48..41c0fe7 100644 --- a/sensor.hpp +++ b/sensor.hpp -@@ -135,6 +135,16 @@ class Sensor +@@ -151,6 +151,16 @@ class Sensor return _hasFaultFile; } @@ -229,7 +217,7 @@ index 4b2d281..369a252 100644 private: /** @brief Sensor object's identifiers */ SensorSet::key_type _sensor; -@@ -156,6 +166,9 @@ class Sensor +@@ -172,6 +182,9 @@ class Sensor /** @brief Tracks whether the sensor has a fault file or not. */ bool _hasFaultFile; @@ -240,18 +228,42 @@ index 4b2d281..369a252 100644 /** diff --git a/thresholds.hpp b/thresholds.hpp -index 4d2fcff..972a469 100644 +index 8d557fc..0ffe0ce 100644 --- a/thresholds.hpp +++ b/thresholds.hpp -@@ -101,8 +101,6 @@ auto addThreshold(const std::string& sensorType, const std::string& sensorID, +@@ -137,32 +137,8 @@ auto addThreshold(const std::string& sensorType, const std::string& sensorID, auto hi = stod(tHi) * std::pow(10, scale); (*iface.*Thresholds<T>::setLo)(lo); (*iface.*Thresholds<T>::setHi)(hi); -- (*iface.*Thresholds<T>::alarmLo)(value <= lo); -- (*iface.*Thresholds<T>::alarmHi)(value >= hi); +- auto alarmLowState = (*iface.*Thresholds<T>::getAlarmLow)(); +- auto alarmHighState = (*iface.*Thresholds<T>::getAlarmHigh)(); + (*iface.*Thresholds<T>::alarmLo)(value <= lo); + (*iface.*Thresholds<T>::alarmHi)(value >= hi); +- if (alarmLowState != (value <= lo)) +- { +- if (value <= lo) +- { +- (*iface.*Thresholds<T>::assertLowSignal)(value); +- } +- else +- { +- (*iface.*Thresholds<T>::deassertLowSignal)(value); +- } +- } +- if (alarmHighState != (value >= hi)) +- { +- if (value >= hi) +- { +- (*iface.*Thresholds<T>::assertHighSignal)(value); +- } +- else +- { +- (*iface.*Thresholds<T>::deassertHighSignal)(value); +- } +- } auto type = Thresholds<T>::type; obj[type] = iface; } -- -2.7.4 +2.21.0 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch deleted file mode 100644 index 0ab2f2048..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch +++ /dev/null @@ -1,295 +0,0 @@ -From 8eafa1b0513dd2f5898182487b4524a485bf1e21 Mon Sep 17 00:00:00 2001 -From: Eddielu <Eddie.Lu@quantatw.com> -Date: Mon, 27 Jul 2020 20:54:28 +0800 -Subject: [PATCH] Update add sensors slow readings patch. - ---- - mainloop.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- - mainloop.hpp | 3 +++ - meson.build | 1 + - sensor.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- - sensor.hpp | 20 ++++++++++++++-- - 5 files changed, 158 insertions(+), 14 deletions(-) - -diff --git a/mainloop.cpp b/mainloop.cpp -index 4789a80..98d0658 100644 ---- a/mainloop.cpp -+++ b/mainloop.cpp -@@ -34,6 +34,7 @@ - #include <cassert> - #include <cstdlib> - #include <functional> -+#include <future> - #include <iostream> - #include <memory> - #include <phosphor-logging/elog-errors.hpp> -@@ -299,7 +300,7 @@ std::optional<ObjectStateData> - { - // Add status interface based on _fault file being present - sensorObj->addStatus(info); -- valueInterface = sensorObj->addValue(retryIO, info); -+ valueInterface = sensorObj->addValue(retryIO, info, _timedoutMap); - } - catch (const std::system_error& e) - { -@@ -542,10 +543,74 @@ void MainLoop::read() - // RAII object for GPIO unlock / lock - auto locker = sensor::gpioUnlock(sensor->getGpio()); - -- // Retry for up to a second if device is busy -- // or has a transient error. -- value = _ioAccess->read(sensorSysfsType, sensorSysfsNum, input, -+ // For sensors with attribute ASYNC_READ_TIMEOUT, -+ // spawn a thread with timeout -+ auto asyncRead = -+ env::getEnv("ASYNC_READ_TIMEOUT", sensorSetKey); -+ if (!asyncRead.empty()) -+ { -+ // Default async read timeout -+ std::chrono::milliseconds asyncReadTimeout{ -+ std::stoi(asyncRead)}; -+ bool valueIsValid = false; -+ std::future<int64_t> asyncThread; -+ -+ auto asyncIter = _timedoutMap.find(sensorSetKey); -+ if (asyncIter == _timedoutMap.end()) -+ { -+ // If sensor not found in timedoutMap, spawn an async -+ // thread -+ asyncThread = std::async( -+ std::launch::async, -+ &hwmonio::HwmonIOInterface::read, _ioAccess, -+ sensorSysfsType, sensorSysfsNum, input, -+ hwmonio::retries, hwmonio::delay); -+ valueIsValid = true; -+ } -+ else -+ { -+ // If we already have the async thread in the -+ // timedoutMap, it means this sensor has already timed -+ // out in the previous reads. No need to wait on -+ // subsequent reads -+ asyncReadTimeout = std::chrono::seconds(0); -+ asyncThread = std::move(asyncIter->second); -+ } -+ -+ std::future_status status = -+ asyncThread.wait_for(asyncReadTimeout); -+ switch (status) -+ { -+ // Read has finished -+ case std::future_status::ready: -+ // Read has finished -+ if (valueIsValid) -+ { -+ value = asyncThread.get(); -+ break; -+ // Good sensor reads should skip the code below -+ } -+ // Async read thread has completed, erase from -+ // timedoutMap to allow retry then throw -+ _timedoutMap.erase(sensorSetKey); -+ throw sensor::AsyncSensorReadTimeOut(); -+ default: -+ // Read timed out so add the thread to the -+ // timedoutMap (if the entry already exists, -+ // operator[] updates it) -+ _timedoutMap[sensorSetKey] = std::move(asyncThread); -+ throw sensor::AsyncSensorReadTimeOut(); -+ } -+ } -+ else -+ { -+ // Retry for up to a second if device is busy -+ // or has a transient error. -+ value = -+ _ioAccess->read(sensorSysfsType, sensorSysfsNum, input, - hwmonio::retries, hwmonio::delay); -+ } -+ - // Set functional property to true if we could read sensor - statusIface->functional(true); - -diff --git a/mainloop.hpp b/mainloop.hpp -index b3de022..6803c4b 100644 ---- a/mainloop.hpp -+++ b/mainloop.hpp -@@ -9,6 +9,7 @@ - #include "types.hpp" - - #include <any> -+#include <future> - #include <memory> - #include <optional> - #include <sdbusplus/server.hpp> -@@ -116,6 +117,8 @@ class MainLoop - /** @brief Store the specifications of sensor objects */ - std::map<SensorSet::key_type, std::unique_ptr<sensor::Sensor>> - _sensorObjects; -+ /** @brief Store the async futures of timed out sensor objects */ -+ std::map<SensorSet::key_type, std::future<int64_t>> _timedoutMap; - - /** - * @brief Map of removed sensors -diff --git a/meson.build b/meson.build -index 66e6801..d6a92f8 100644 ---- a/meson.build -+++ b/meson.build -@@ -84,6 +84,7 @@ libhwmon_all = static_library( - gpioplus, - phosphor_dbus_interfaces, - phosphor_logging, -+ threads, - ], - link_with: [ - libaverage, -diff --git a/sensor.cpp b/sensor.cpp -index b1cb470..72b45f8 100644 ---- a/sensor.cpp -+++ b/sensor.cpp -@@ -15,6 +15,7 @@ - #include <cmath> - #include <cstring> - #include <filesystem> -+#include <future> - #include <phosphor-logging/elog-errors.hpp> - #include <thread> - #include <xyz/openbmc_project/Common/error.hpp> -@@ -125,8 +126,9 @@ SensorValueType Sensor::adjustValue(SensorValueType value) - return value; - } - --std::shared_ptr<ValueObject> Sensor::addValue(const RetryIO& retryIO, -- ObjectInfo& info) -+std::shared_ptr<ValueObject> Sensor::addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map<SensorSet::key_type, std::future<int64_t>>& timedoutMap) - { - static constexpr bool deferSignals = true; - -@@ -153,12 +155,69 @@ std::shared_ptr<ValueObject> Sensor::addValue(const RetryIO& retryIO, - // RAII object for GPIO unlock / lock - auto locker = gpioUnlock(getGpio()); - -- // Retry for up to a second if device is busy -- // or has a transient error. -- val = -- _ioAccess->read(_sensor.first, _sensor.second, -- hwmon::entry::cinput, std::get<size_t>(retryIO), -- std::get<std::chrono::milliseconds>(retryIO)); -+ // For sensors with attribute ASYNC_READ_TIMEOUT, -+ // spawn a thread with timeout -+ auto asyncRead = env::getEnv("ASYNC_READ_TIMEOUT", _sensor); -+ if (!asyncRead.empty()) -+ { -+ // Default async read timeout -+ std::chrono::milliseconds asyncReadTimeout{ -+ std::stoi(asyncRead)}; -+ bool valueIsValid = false; -+ std::future<int64_t> asyncThread; -+ -+ auto asyncIter = timedoutMap.find(_sensor); -+ if (asyncIter == timedoutMap.end()) -+ { -+ // If sensor not found in timedoutMap, spawn an async thread -+ asyncThread = std::async( -+ std::launch::async, &hwmonio::HwmonIOInterface::read, -+ _ioAccess, _sensor.first, _sensor.second, -+ hwmon::entry::cinput, std::get<size_t>(retryIO), -+ std::get<std::chrono::milliseconds>(retryIO)); -+ valueIsValid = true; -+ } -+ else -+ { -+ // If we already have the async thread in the timedoutMap, -+ // it means this sensor has already timed out in the -+ // previous reads. No need to wait on subsequent reads -+ asyncReadTimeout = std::chrono::seconds(0); -+ asyncThread = std::move(asyncIter->second); -+ } -+ -+ std::future_status status = -+ asyncThread.wait_for(asyncReadTimeout); -+ switch (status) -+ { -+ case std::future_status::ready: -+ // Read has finished -+ if (valueIsValid) -+ { -+ val = asyncThread.get(); -+ break; -+ // Good sensor reads should skip the code below -+ } -+ // Async read thread has completed, erase from -+ // timedoutMap to allow retry then throw -+ timedoutMap.erase(_sensor); -+ throw AsyncSensorReadTimeOut(); -+ default: -+ // Read timed out so add the thread to the timedoutMap -+ // (if the entry already exists, operator[] updates it) -+ timedoutMap[_sensor] = std::move(asyncThread); -+ throw AsyncSensorReadTimeOut(); -+ } -+ } -+ else -+ { -+ // Retry for up to a second if device is busy -+ // or has a transient error. -+ val = _ioAccess->read( -+ _sensor.first, _sensor.second, hwmon::entry::cinput, -+ std::get<size_t>(retryIO), -+ std::get<std::chrono::milliseconds>(retryIO)); -+ } - } - #ifdef UPDATE_FUNCTIONAL_ON_FAIL - catch (const std::system_error& e) -diff --git a/sensor.hpp b/sensor.hpp -index 369a252..41c0fe7 100644 ---- a/sensor.hpp -+++ b/sensor.hpp -@@ -4,6 +4,8 @@ - #include "sensorset.hpp" - #include "types.hpp" - -+#include <cerrno> -+#include <future> - #include <gpioplus/handle.hpp> - #include <memory> - #include <optional> -@@ -20,6 +22,17 @@ struct valueAdjust - std::unordered_set<int> rmRCs; - }; - -+/** @brief Custom exception for async sensor reading timeout -+ */ -+struct AsyncSensorReadTimeOut : public std::system_error -+{ -+ AsyncSensorReadTimeOut() : -+ system_error(std::error_code(ETIMEDOUT, std::system_category()), -+ "Async sensor read timed out") -+ { -+ } -+}; -+ - /** @class Sensor - * @brief Sensor object based on a SensorSet container's key type - * @details Sensor object to create and modify an associated device's sensor -@@ -87,10 +100,13 @@ class Sensor - * (number of and delay between) - * @param[in] info - Sensor object information - * -+ * @param[in] timedoutMap - Map to track timed out threads -+ * - * @return - Shared pointer to the value object - */ -- std::shared_ptr<ValueObject> addValue(const RetryIO& retryIO, -- ObjectInfo& info); -+ std::shared_ptr<ValueObject> addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map<SensorSet::key_type, std::future<int64_t>>& timedoutMap); - - /** - * @brief Add status interface and functional property for sensor --- -2.7.4 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf index 34caf4a43..f21ee70e9 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf @@ -2,7 +2,7 @@ LABEL_fan1= "fan0" WARNHI_fan1= "19800" WARNLO_fan1= "3330" CRITHI_fan1= "19800" -CRITLO_fan1= "1800" +CRITLO_fan1= "1500" MINVALUE_fan1 = "0" MAXVALUE_fan1 = "20775" PWM_TARGET_fan1 = 1 @@ -11,7 +11,7 @@ LABEL_fan2= "fan1" WARNHI_fan2= "19800" WARNLO_fan2= "3330" CRITHI_fan2= "19800" -CRITLO_fan2= "1800" +CRITLO_fan2= "1500" MINVALUE_fan2 = "0" MAXVALUE_fan2 = "20775" PWM_TARGET_fan2 = 2 @@ -20,7 +20,7 @@ LABEL_fan3= "fb_fan0" WARNHI_fan3= "19800" WARNLO_fan3= "3330" CRITHI_fan3= "19800" -CRITLO_fan3= "1800" +CRITLO_fan3= "1500" MINVALUE_fan3 = "0" MAXVALUE_fan3 = "20775" PWM_TARGET_fan3 = 3 @@ -29,7 +29,7 @@ LABEL_fan4= "fb_fan1" WARNHI_fan4= "19800" WARNLO_fan4= "3330" CRITHI_fan4= "19800" -CRITLO_fan4= "1800" +CRITLO_fan4= "1500" MINVALUE_fan4 = "0" MAXVALUE_fan4 = "20775" PWM_TARGET_fan4 = 4 @@ -38,7 +38,7 @@ LABEL_fan5= "fb_fan2" WARNHI_fan5= "19800" WARNLO_fan5= "3330" CRITHI_fan5= "19800" -CRITLO_fan5= "1800" +CRITLO_fan5= "1500" MINVALUE_fan5 = "0" MAXVALUE_fan5 = "20775" PWM_TARGET_fan5 = 5 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend index 5f0517a30..22b31cfb9 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend @@ -1,7 +1,6 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" -SRC_URI_append_gbs = " file://0001-lev-add-poweron-monitor-feature.patch \ - file://0002-lev-add-sensors-slow-readings.patch \ +SRC_URI_append_gbs = " file://0002-Add-power-on-monitor-mechanism.patch \ " GBS_NAMES = " \ @@ -32,4 +31,4 @@ FENVS = "obmc/hwmon/ahb/apb/{0}" SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs = " ${@compose_list(d, 'FENVS', 'FITEMS')}" -EXTRA_OEMESON_append_gbs = " -Dupdate-functional-on-fail=true" +EXTRA_OEMESON_append_gbs = " -Dupdate-functional-on-fail=true -Dnegative-errno-on-fail=false" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/config-virtual-sensor.json b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/config-virtual-sensor.json index 6e729108a..7be584152 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/config-virtual-sensor.json +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/config-virtual-sensor.json @@ -2,7 +2,9 @@ { "Desc": { "Name": "i2cool_0", - "SensorType": "temperature" + "SensorType": "temperature", + "MaxValue": 127.0, + "MinValue": -128.0 }, "Threshold": { "CriticalHigh": 35, @@ -40,7 +42,9 @@ { "Desc": { "Name": "i2cool_1", - "SensorType": "temperature" + "SensorType": "temperature", + "MaxValue": 127.0, + "MinValue": -128.0 }, "Threshold": { "CriticalHigh": 70, @@ -78,7 +82,9 @@ { "Desc": { "Name": "i2cool_2", - "SensorType": "temperature" + "SensorType": "temperature", + "MaxValue": 127.0, + "MinValue": -128.0 }, "Threshold": { "CriticalHigh": 70, diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/phosphor-virtual-sensor.service.replace b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/phosphor-virtual-sensor.service.replace index eae38b23d..bffb6d154 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/phosphor-virtual-sensor.service.replace +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor/phosphor-virtual-sensor.service.replace @@ -2,13 +2,12 @@ Description=Virtual sensors Wants=obmc-mapper.target After=obmc-mapper.target +After=mapper-wait@-xyz-openbmc_project-sensors-temperature-inlet.service +After=mapper-wait@-xyz-openbmc_project-sensors-temperature-outlet_0.service +After=mapper-wait@-xyz-openbmc_project-sensors-temperature-outlet_1.service [Service] -ExecStartPre=mapper wait /xyz/openbmc_project/sensors/temperature/inlet -ExecStartPre=mapper wait /xyz/openbmc_project/sensors/temperature/outlet_0 -ExecStartPre=mapper wait /xyz/openbmc_project/sensors/temperature/outlet_1 ExecStart=/usr/bin/virtual-sensor -ExecStartPost=/usr/bin/setMaxMinValue.sh Type=dbus BusName=xyz.openbmc_project.VirtualSensor SyslogIdentifier=phosphor-virtual-sensor diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend index 77546694e..d151f2025 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend @@ -2,15 +2,11 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" SRC_URI_append_gbs = " file://config-virtual-sensor.json \ file://phosphor-virtual-sensor.service.replace \ - file://setMaxMinValue.sh \ " RDEPENDS_${PN}_append_gbs = "bash" do_install_append_gbs() { - install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/setMaxMinValue.sh ${D}${bindir}/ - install -d ${D}${datadir}/${PN} install -m 0644 -D ${WORKDIR}/config-virtual-sensor.json \ ${D}${datadir}/${PN}/virtual_sensor_config.json diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch deleted file mode 100644 index 22670d3fc..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch +++ /dev/null @@ -1,313 +0,0 @@ -From ac0c216ac2c273c620579fd1308c8c225e0cca36 Mon Sep 17 00:00:00 2001 -From: James Feist <james.feist@linux.intel.com> -Date: Mon, 17 Jun 2019 12:00:58 -0700 -Subject: [PATCH] Customize phosphor-watchdog for Intel platforms - -This patch adds various changes to phosphor-watchdog that are -required for compatibility with Intel platforms. - - 1. Add Redfish messages for watchdog timeout and pre-interrupt - 2. Use dbus properties for power control insted of service files - 3. Use host status to enable/disable watchdog - 4. Set preTimeoutInterruptOccurFlag - -Signed-off-by: James Feist <james.feist@linux.intel.com> -Signed-off-by: Ren Yu <yux.ren@intel.com> -Signed-off-by: Yong Li <yong.b.li@linux.intel.com> -Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> ---- - watchdog.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++--- - watchdog.hpp | 23 +++++- - 2 files changed, 206 insertions(+), 10 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 57e9050..3b5356f 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -1,11 +1,14 @@ - #include "watchdog.hpp" - -+#include <systemd/sd-journal.h> -+ - #include <algorithm> - #include <chrono> - #include <phosphor-logging/elog.hpp> - #include <phosphor-logging/log.hpp> - #include <sdbusplus/exception.hpp> - #include <xyz/openbmc_project/Common/error.hpp> -+#include <xyz/openbmc_project/State/Host/server.hpp> - - namespace phosphor - { -@@ -18,10 +21,69 @@ using namespace phosphor::logging; - using sdbusplus::exception::SdBusError; - using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; - --// systemd service to kick start a target. --constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; --constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; --constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; -+const static constexpr char* currentHostState = "CurrentHostState"; -+const static constexpr char* hostStatusOff = -+ "xyz.openbmc_project.State.Host.HostState.Off"; -+ -+const static constexpr char* actionDescription = " due to Watchdog timeout"; -+const static constexpr char* hardResetDescription = "Hard Reset - System reset"; -+const static constexpr char* powerOffDescription = -+ "Power Down - System power down"; -+const static constexpr char* powerCycleDescription = -+ "Power Cycle - System power cycle"; -+const static constexpr char* timerExpiredDescription = "Timer expired"; -+ -+const static constexpr char* preInterruptActionNone = -+ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -+ -+const static constexpr char* preInterruptDescriptionSMI = "SMI"; -+const static constexpr char* preInterruptDescriptionNMI = "NMI"; -+const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; -+ -+const static constexpr char* reservedDescription = "Reserved"; -+ -+const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; -+const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; -+const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; -+const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; -+const static constexpr char* timerUseDescriptionOEM = "OEM"; -+ -+namespace restart -+{ -+static constexpr const char* busName = -+ "xyz.openbmc_project.Control.Host.RestartCause"; -+static constexpr const char* path = -+ "/xyz/openbmc_project/control/host0/restart_cause"; -+static constexpr const char* interface = -+ "xyz.openbmc_project.Control.Host.RestartCause"; -+static constexpr const char* property = "RequestedRestartCause"; -+} // namespace restart -+ -+// chassis state manager service -+namespace chassis -+{ -+static constexpr const char* busName = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* path = "/xyz/openbmc_project/state/chassis0"; -+static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* request = "RequestedPowerTransition"; -+} // namespace chassis -+ -+void Watchdog::powerStateChangedHandler( -+ const std::map<std::string, std::variant<std::string>>& props) -+{ -+ const auto iter = props.find(currentHostState); -+ if (iter != props.end()) -+ { -+ const std::string* powerState = std::get_if<std::string>(&iter->second); -+ if (powerState && (*powerState == hostStatusOff)) -+ { -+ if (timerEnabled()) -+ { -+ enabled(false); -+ } -+ } -+ } -+} - - void Watchdog::resetTimeRemaining(bool enableWatchdog) - { -@@ -107,13 +169,102 @@ uint64_t Watchdog::interval(uint64_t value) - // Optional callback function on timer expiration - void Watchdog::timeOutHandler() - { -+ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); -+ std::string preInterruptActionMessageArgs{}; -+ - Action action = expireAction(); -+ std::string actionMessageArgs{}; -+ -+ expiredTimerUse(currentTimerUse()); -+ -+ TimerUse timeUser = expiredTimerUse(); -+ std::string timeUserMessage{}; -+ - if (!this->enabled()) - { - action = fallback->action; - } - -- expiredTimerUse(currentTimerUse()); -+ switch (timeUser) -+ { -+ case Watchdog::TimerUse::BIOSFRB2: -+ timeUserMessage = timerUseDescriptionBIOSFRB2; -+ break; -+ case Watchdog::TimerUse::BIOSPOST: -+ timeUserMessage = timerUseDescriptionBIOSPOST; -+ break; -+ case Watchdog::TimerUse::OSLoad: -+ timeUserMessage = timerUseDescriptionOSLoad; -+ break; -+ case Watchdog::TimerUse::SMSOS: -+ timeUserMessage = timerUseDescriptionSMSOS; -+ break; -+ case Watchdog::TimerUse::OEM: -+ timeUserMessage = timerUseDescriptionOEM; -+ break; -+ default: -+ timeUserMessage = reservedDescription; -+ break; -+ } -+ -+ switch (action) -+ { -+ case Watchdog::Action::HardReset: -+ actionMessageArgs = std::string(hardResetDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::PowerOff: -+ actionMessageArgs = std::string(powerOffDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::PowerCycle: -+ actionMessageArgs = std::string(powerCycleDescription) + -+ std::string(actionDescription); -+ break; -+ case Watchdog::Action::None: -+ actionMessageArgs = timerExpiredDescription; -+ break; -+ default: -+ actionMessageArgs = reservedDescription; -+ break; -+ } -+ -+ // Log into redfish event log -+ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", -+ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, -+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", -+ "REDFISH_MESSAGE_ARGS=%s. timer use: %s", -+ actionMessageArgs.c_str(), timeUserMessage.c_str(), NULL); -+ -+ switch (preTimeoutInterruptAction) -+ { -+ case Watchdog::PreTimeoutInterruptAction::SMI: -+ preInterruptActionMessageArgs = preInterruptDescriptionSMI; -+ break; -+ case Watchdog::PreTimeoutInterruptAction::NMI: -+ preInterruptActionMessageArgs = preInterruptDescriptionNMI; -+ break; -+ case Watchdog::PreTimeoutInterruptAction::MI: -+ preInterruptActionMessageArgs = preInterruptDescriptionMI; -+ break; -+ default: -+ preInterruptActionMessageArgs = reservedDescription; -+ break; -+ } -+ -+ if (preInterruptActionNone != convertForMessage(preTimeoutInterruptAction)) -+ { -+ preTimeoutInterruptOccurFlag(true); -+ -+ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", -+ convertForMessage(preTimeoutInterruptAction).c_str(), -+ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", -+ "OpenBMC.0.1.IPMIWatchdog", -+ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " -+ "Watchdog timeout. timer use: %s", -+ preInterruptActionMessageArgs.c_str(), -+ timeUserMessage.c_str(), NULL); -+ } - - auto target = actionTargetMap.find(action); - if (target == actionTargetMap.end()) -@@ -133,10 +284,11 @@ void Watchdog::timeOutHandler() - - try - { -- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_ROOT, -- SYSTEMD_INTERFACE, "StartUnit"); -- method.append(target->second); -- method.append("replace"); -+ auto method = -+ bus.new_method_call(chassis::busName, chassis::path, -+ "org.freedesktop.DBus.Properties", "Set"); -+ method.append(chassis::interface, chassis::request, -+ std::variant<std::string>(target->second)); - - bus.call_noreply(method); - } -@@ -147,6 +299,29 @@ void Watchdog::timeOutHandler() - entry("ERROR=%s", e.what())); - commit<InternalFailure>(); - } -+ -+ // set restart cause for watchdog HardReset & PowerCycle actions -+ if ((action == Watchdog::Action::HardReset) || -+ (action == Watchdog::Action::PowerCycle)) -+ { -+ try -+ { -+ auto method = bus.new_method_call( -+ restart::busName, restart::path, -+ "org.freedesktop.DBus.Properties", "Set"); -+ method.append( -+ restart::interface, restart::property, -+ std::variant<std::string>("xyz.openbmc_project.State.Host." -+ "RestartCause.WatchdogTimer")); -+ bus.call(method); -+ } -+ catch (sdbusplus::exception_t& e) -+ { -+ log<level::ERR>("Failed to set HostRestartCause property", -+ entry("ERROR=%s", e.what())); -+ commit<InternalFailure>(); -+ } -+ } - } - - tryFallbackOrDisable(); -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..b004b7a 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp -@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits - WatchdogInherits(bus, objPath), - bus(bus), actionTargetMap(std::move(actionTargetMap)), - fallback(std::move(fallback)), minInterval(minInterval), -- timer(event, std::bind(&Watchdog::timeOutHandler, this)) -+ timer(event, std::bind(&Watchdog::timeOutHandler, this)), -+ powerStateChangedSignal( -+ bus, -+ sdbusplus::bus::match::rules::propertiesChanged( -+ "/xyz/openbmc_project/state/host0", -+ "xyz.openbmc_project.State.Host"), -+ [this](sdbusplus::message::message& msg) { -+ std::string objectName; -+ std::map<std::string, std::variant<std::string>> props; -+ msg.read(objectName, props); -+ powerStateChangedHandler(props); -+ }) - { - // We set the watchdog interval with the default value. - interval(interval()); -@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits - tryFallbackOrDisable(); - } - -+ /** @brief Disable watchdog when power status change meet -+ * the specific requirement -+ */ -+ void powerStateChangedHandler( -+ const std::map<std::string, std::variant<std::string>>& props); -+ - /** @brief Resets the TimeRemaining to the configured Interval - * Optionally enables the watchdog. - * -@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits - /** @brief Contained timer object */ - sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer; - -+ /** @brief Optional Callback handler when power status change meet -+ * the specific requirement */ -+ sdbusplus::bus::match_t powerStateChangedSignal; -+ - /** @brief Optional Callback handler on timer expirartion */ - void timeOutHandler(); - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 new file mode 100644 index 000000000..27c438d90 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 @@ -0,0 +1,8 @@ +DEVPATH=/xyz/openbmc_project/watchdog/host0 +SERVICE=xyz.openbmc_project.Watchdog +UNIT_HARD_RESET=phosphor-host-watchdog-reset.service +UNIT_POWER_OFF=phosphor-host-watchdog-poweroff.service +UNIT_POWER_CYCLE=phosphor-host-watchdog-powercycle.service +FALLBACK_ACTION=xyz.openbmc_project.State.Watchdog.Action.PowerCycle +FALLBACK_INTERVAL=180000 +MIN_INTERVAL=60000 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-powercycle.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-powercycle.service new file mode 100644 index 000000000..9b8b0d691 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-powercycle.service @@ -0,0 +1,9 @@ +[Unit] +Description=Power Cycle Host Server +After=xyz.openbmc_project.Chassis.Control.Power.service + +[Service] +Type=oneshot +ExecStart=busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.PowerCycle +ExecStart=busctl set-property xyz.openbmc_project.Control.Host.RestartCause /xyz/openbmc_project/control/host0/restart_cause xyz.openbmc_project.Control.Host.RestartCause RequestedRestartCause s xyz.openbmc_project.State.Host.RestartCause.WatchdogTimer +SyslogIdentifier=phosphor-watchdog diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-poweroff.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-poweroff.service new file mode 100644 index 000000000..af7e6ef0d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-poweroff.service @@ -0,0 +1,8 @@ +[Unit] +Description=Shutdown Host Server +After=xyz.openbmc_project.Chassis.Control.Power.service + +[Service] +Type=oneshot +ExecStart=busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Off +SyslogIdentifier=phosphor-watchdog diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-reset.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-reset.service new file mode 100644 index 000000000..655618b05 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-reset.service @@ -0,0 +1,9 @@ +[Unit] +Description=Reset Host Server +After=xyz.openbmc_project.Chassis.Control.Power.service + +[Service] +Type=oneshot +ExecStart=busctl set-property xyz.openbmc_project.State.Host /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host RequestedHostTransition s xyz.openbmc_project.State.Host.Transition.ForceWarmReboot +ExecStart=busctl set-property xyz.openbmc_project.Control.Host.RestartCause /xyz/openbmc_project/control/host0/restart_cause xyz.openbmc_project.Control.Host.RestartCause RequestedRestartCause s xyz.openbmc_project.State.Host.RestartCause.WatchdogTimer +SyslogIdentifier=phosphor-watchdog diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service deleted file mode 100644 index 5ef1a4179..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Phosphor Watchdog - -[Service] -ExecStart=/usr/bin/env phosphor-watchdog --continue --service=xyz.openbmc_project.Watchdog \ - --path=/xyz/openbmc_project/watchdog/host0 \ - --action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=xyz.openbmc_project.State.Chassis.Transition.Reset \ - --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=xyz.openbmc_project.State.Chassis.Transition.Off \ - --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=xyz.openbmc_project.State.Chassis.Transition.PowerCycle - -SyslogIdentifier=phosphor-watchdog -BusName =xyz.openbmc_project.Watchdog -Type=dbus - -[Install] -WantedBy=basic.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service new file mode 100644 index 000000000..4577cd1c1 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service @@ -0,0 +1,17 @@ +[Unit] +Description=Phosphor Watchdog + +[Service] +EnvironmentFile={envfiledir}/obmc/watchdog/%I +ExecStart=/usr/bin/env phosphor-watchdog --service=${{SERVICE}} --path=${{DEVPATH}} \ + --continue --fallback_always --min_interval=${{MIN_INTERVAL}} \ + --fallback_action=${{FALLBACK_ACTION}} --fallback_interval=${{FALLBACK_INTERVAL}} \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=${{UNIT_HARD_RESET}} \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=${{UNIT_POWER_OFF}} \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=${{UNIT_POWER_CYCLE}} +SyslogIdentifier=phosphor-watchdog +BusName=xyz.openbmc_project.Watchdog +Type=dbus + +[Install] +WantedBy=basic.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend index 9c491ecfc..d8b1aa956 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend @@ -1,7 +1,13 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" -SRC_URI_append_gbs = " file://0001-Customize-phosphor-watchdog-for-Intel-platforms.patch" - -# Remove the override to keep service running after DC cycle +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs = " obmc/watchdog/host0" +OBMC_HOST_WATCHDOG_INSTANCES_A = "host0" +WATCHDOG_FMT_A = "phosphor-watchdog@{0}.service" SYSTEMD_OVERRIDE_${PN}_remove_gbs = "poweron.conf:phosphor-watchdog@poweron.service.d/poweron.conf" -SYSTEMD_SERVICE_${PN}_gbs = "phosphor-watchdog.service" +SYSTEMD_LINK_${PN}_remove_gbs = "${@compose_list(d, 'ENABLE_WATCHDOG_FMT', 'OBMC_HOST_INSTANCES')}" +SYSTEMD_LINK_${PN}_remove_gbs = "${@compose_list(d, 'WATCHDOG_FMT', 'OBMC_HOST_WATCHDOG_INSTANCES', 'OBMC_HOST_INSTANCES')}" +SYSTEMD_SERVICE_${PN}_gbs = " ${@compose_list(d, 'WATCHDOG_FMT_A', 'OBMC_HOST_WATCHDOG_INSTANCES_A')} \ + phosphor-host-watchdog-reset.service \ + phosphor-host-watchdog-poweroff.service \ + phosphor-host-watchdog-powercycle.service \ + " |