From 9329645dac8bf8da6b0b61d63eb9f396f867a674 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 07:27:11 +0800 Subject: meta-quanta: gbs: change back to upstream and enable IPMI SEL - change back to OpenBMC upstream for phosphor-host-ipmid and phosphor-sel-logger - add inventory sensors YAML for IPMI SEL - enable SEL_LOGGER_SEND_TO_LOGGING_SERVICE and SEL_LOGGER_MONITOR_THRESHOLD_ALARM_EVENTS for IPMI SEL Signed-off-by: George Hung Change-Id: I16c58444986aec6c927e175a2c69f9cca92a7bcb --- .../configuration/gbs-yaml-config.bb | 4 + .../gbs-ipmi-inventory-sensors.yaml | 435 +++++++++++++++++++++ .../ipmi/phosphor-ipmi-host_%.bbappend | 9 +- .../sel-logger/phosphor-sel-logger_%.bbappend | 7 +- 4 files changed, 444 insertions(+), 11 deletions(-) create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml (limited to 'meta-quanta') 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..58bcb658c --- /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/entity/hsbp_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF6 + sensorType: 0x25 + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/fanbd_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF7 + sensorType: 0x25 + offset: 0x01 +/xyz/openbmc_project/inventory/system/chassis/entity/bp12v_cab_prsnt: + eventReadingType: 0x6f + sensorID: 0xF8 + sensorType: 0x25 + 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/ipmi/phosphor-ipmi-host_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index bf2986c47..816c5da3e 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,13 @@ 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 \ " 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 \ " 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 \ + " -- cgit v1.2.3 From 95f04fdcfc18a5d37539faf807e4dbfc26cd8720 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 11:00:27 +0800 Subject: meta-quanta: gbs: fix includes error and add flag explictly 1. Remake the patch to fix includes error: - Implement sensor "ASYNC_READ_TIMEOUT" https://gerrit.openbmc-project.xyz/24337 - Add power on monitor mechanism https://gerrit.openbmc-project.xyz/28181 2. Set negative-errno-on-fail flag as false explicitly, otherwise it would be true conflicts with update-functional-on-fail Signed-off-by: George Hung Change-Id: Id550bc5261e6fa7218e2ff2731e1af51487ee376 --- .../0001-lev-add-poweron-monitor-feature.patch | 257 ---------------- ...ensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch | 333 +++++++++++++++++++++ .../0002-Add-power-on-monitor-mechanism.patch | 269 +++++++++++++++++ .../0002-lev-add-sensors-slow-readings.patch | 295 ------------------ .../sensors/phosphor-hwmon_%.bbappend | 6 +- 5 files changed, 605 insertions(+), 555 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch (limited to 'meta-quanta') 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/0001-lev-add-poweron-monitor-feature.patch deleted file mode 100644 index c279e0b81..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch +++ /dev/null @@ -1,257 +0,0 @@ -From 2cea5d289b278db4468b16bf6b64102655811fd0 Mon Sep 17 00:00:00 2001 -From: Eddielu -Date: Mon, 27 Jul 2020 20:30:22 +0800 -Subject: [PATCH] Update lev-add-poweron-monitor-feature patch. - ---- - Makefile.am | 2 ++ - mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - sensor.cpp | 11 ++++++- - sensor.hpp | 13 ++++++++ - thresholds.hpp | 2 -- - 5 files changed, 127 insertions(+), 3 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 ---- a/mainloop.cpp -+++ b/mainloop.cpp -@@ -41,6 +41,12 @@ - #include - #include - #include -+#include -+#include -+#include -+#include -+#include -+#include - - using namespace phosphor::logging; - -@@ -76,6 +82,12 @@ decltype( - Thresholds::alarmHi) Thresholds::alarmHi = - &CriticalObject::criticalAlarmHigh; - -+static std::unique_ptr cacheTimer = nullptr; -+static std::unique_ptr powerMatch = nullptr; -+static bool powerStatusOn = false; -+static boost::asio::io_service io; -+static auto conn = std::make_shared(io); -+ - void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) - { - for (auto& iface : ifaces) -@@ -103,6 +115,84 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) - } - } - -+void powerStatusSet() -+{ -+ powerStatusOn = true; -+ return; -+} -+ -+void createTimer() -+{ -+ if (cacheTimer == nullptr) -+ { -+ cacheTimer = std::make_unique(powerStatusSet); -+ } -+} -+ -+bool isPowerOn(void) -+{ -+ if (!powerMatch) -+ { -+ throw std::runtime_error("Power Match Not Created"); -+ } -+ return powerStatusOn; -+} -+ -+void setupPowerMatch(sdbusplus::bus::bus& bus) -+{ -+ if (powerMatch) -+ { -+ return; -+ } -+ -+ powerMatch = std::make_unique( -+ bus, -+ "type='signal',interface='org.freedesktop.DBus.Properties',path='/xyz/" -+ "openbmc_project/state/" -+ "host0',arg0='xyz.openbmc_project.State.Host'", -+ [](sdbusplus::message::message& message) { -+ std::string objectName; -+ boost::container::flat_map> -+ values; -+ message.read(objectName, values); -+ auto findState = values.find("CurrentHostState"); -+ if (findState != values.end()) -+ { -+ bool on = boost::ends_with( -+ std::get(findState->second), "Running"); -+ if (!on) -+ { -+ cacheTimer->stop(); -+ powerStatusOn = false; -+ return; -+ } -+ cacheTimer->start(std::chrono::duration_cast( -+ std::chrono::seconds(10))); -+ } -+ else { -+ powerStatusOn = false; -+ } -+ }); -+ -+ conn->async_method_call( -+ [](boost::system::error_code ec, -+ const std::variant& state) { -+ if (ec) -+ { -+ return; -+ } -+ powerStatusOn = -+ boost::ends_with(std::get(state), "Running"); -+ }, -+ "xyz.openbmc_project.State.Host", -+ "/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() - _interval = std::strtoull(interval.c_str(), NULL, 10); - } - } -+ setupPowerMatch(_bus); - } - - void MainLoop::read() -@@ -428,6 +519,12 @@ void MainLoop::read() - - try - { -+ if(sensor->pwrOnMonitor() && !isPowerOn()) -+ { -+ statusIface->functional(false); -+ continue; -+ } -+ - if (sensor->hasFaultFile()) - { - auto fault = _ioAccess->read(sensorSysfsType, sensorSysfsNum, -@@ -490,6 +587,11 @@ void MainLoop::read() - } - } - -+ if(sensor->pwrOnMonitor() && !isPowerOn()) -+ { -+ 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 ---- a/sensor.cpp -+++ b/sensor.cpp -@@ -31,7 +31,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, - const hwmonio::HwmonIOInterface* ioAccess, - const std::string& devPath) : - _sensor(sensor), -- _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false) -+ _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false), _pwrOnMonitor(false) - { - auto chip = env::getEnv("GPIOCHIP", sensor); - auto access = env::getEnv("GPIO", sensor); -@@ -60,6 +60,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, - auto senRmRCs = env::getEnv("REMOVERCS", sensor); - // Add sensor removal return codes defined per sensor - addRemoveRCs(senRmRCs); -+ -+ auto pwrOnMon = env::getEnv("PWRONMON", sensor); -+ if (!pwrOnMon.empty()) -+ { -+ if (pwrOnMon == "ON") -+ { -+ _pwrOnMonitor = true; -+ } -+ } - } - - void Sensor::addRemoveRCs(const std::string& rcList) -diff --git a/sensor.hpp b/sensor.hpp -index 4b2d281..369a252 100644 ---- a/sensor.hpp -+++ b/sensor.hpp -@@ -135,6 +135,16 @@ class Sensor - return _hasFaultFile; - } - -+ /** -+ * @brief Get whether the sensor only need to be monitored in power on state or not. -+ * -+ * @return - Boolean on whether the sensor only need to be monitored in power on state -+ */ -+ inline bool pwrOnMonitor(void) const -+ { -+ return _pwrOnMonitor; -+ } -+ - private: - /** @brief Sensor object's identifiers */ - SensorSet::key_type _sensor; -@@ -156,6 +166,9 @@ class Sensor - - /** @brief Tracks whether the sensor has a fault file or not. */ - bool _hasFaultFile; -+ -+ /** @brief Whether the sensor only need to be monitored in power on state or not. */ -+ bool _pwrOnMonitor; - }; - - /** -diff --git a/thresholds.hpp b/thresholds.hpp -index 4d2fcff..972a469 100644 ---- a/thresholds.hpp -+++ b/thresholds.hpp -@@ -101,8 +101,6 @@ auto addThreshold(const std::string& sensorType, const std::string& sensorID, - auto hi = stod(tHi) * std::pow(10, scale); - (*iface.*Thresholds::setLo)(lo); - (*iface.*Thresholds::setHi)(hi); -- (*iface.*Thresholds::alarmLo)(value <= lo); -- (*iface.*Thresholds::alarmHi)(value >= hi); - auto type = Thresholds::type; - obj[type] = iface; - } --- -2.7.4 - diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch new file mode 100644 index 000000000..88f55d055 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch @@ -0,0 +1,333 @@ +From c1b3d32430df12ab01f9cacf132aedff8324d55b Mon Sep 17 00:00:00 2001 +From: Brandon Kim +Date: Fri, 9 Aug 2019 15:38:53 -0700 +Subject: [PATCH] sensor: Implement sensor "ASYNC_READ_TIMEOUT" + +This change will prevent sensors from blocking all other sensor reads +and D-Bus if they do not report failures quickly enough. + +If "ASYNC_READ_TIMEOUT" environment variable is defined in the +sensor's config file for a key_type, the sensor read will be +asynchronous with timeout set in milliseconds. + +For example for "sensor1": +ASYNC_READ_TIMEOUT_sensor1="1000" // Timeout will be set to 1 sec + +If the read times out, the sensor read will be skipped and the +sensor's functional property will be set to 'false'. Timed out futures +will be placed in a map to prevent their destructor from running and +blocking until the read completes (limiation of std::async). + +Change-Id: I3d9ed4d5c9cc87d3196fc281451834f3001d0b48 +Signed-off-by: Brandon Kim +--- + Makefile.am | 2 ++ + mainloop.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++--- + mainloop.hpp | 3 +++ + meson.build | 1 + + sensor.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++------ + sensor.hpp | 20 ++++++++++++-- + 6 files changed, 160 insertions(+), 14 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 ecceee5..29dc26a 100644 +--- a/mainloop.cpp ++++ b/mainloop.cpp +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -242,7 +243,7 @@ std::optional + { + // 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) + { +@@ -478,10 +479,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 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 ++#include + #include + #include + #include +@@ -116,6 +117,8 @@ class MainLoop + /** @brief Store the specifications of sensor objects */ + std::map> + _sensorObjects; ++ /** @brief Store the async futures of timed out sensor objects */ ++ std::map> _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 09aeca6..ac2f896 100644 +--- a/sensor.cpp ++++ b/sensor.cpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -116,8 +117,9 @@ SensorValueType Sensor::adjustValue(SensorValueType value) + return value; + } + +-std::shared_ptr Sensor::addValue(const RetryIO& retryIO, +- ObjectInfo& info) ++std::shared_ptr Sensor::addValue( ++ const RetryIO& retryIO, ObjectInfo& info, ++ std::map>& timedoutMap) + { + static constexpr bool deferSignals = true; + +@@ -144,12 +146,69 @@ std::shared_ptr 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(retryIO), +- std::get(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 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(retryIO), ++ std::get(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(retryIO), ++ std::get(retryIO)); ++ } + } + #ifdef UPDATE_FUNCTIONAL_ON_FAIL + catch (const std::system_error& e) +diff --git a/sensor.hpp b/sensor.hpp +index 4b2d281..64d6e48 100644 +--- a/sensor.hpp ++++ b/sensor.hpp +@@ -4,6 +4,8 @@ + #include "sensorset.hpp" + #include "types.hpp" + ++#include ++#include + #include + #include + #include +@@ -20,6 +22,17 @@ struct valueAdjust + std::unordered_set 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 addValue(const RetryIO& retryIO, +- ObjectInfo& info); ++ std::shared_ptr addValue( ++ const RetryIO& retryIO, ObjectInfo& info, ++ std::map>& timedoutMap); + + /** + * @brief Add status interface and functional property for sensor +-- +2.21.0 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch new file mode 100644 index 000000000..a3718ea2a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-Add-power-on-monitor-mechanism.patch @@ -0,0 +1,269 @@ +From 5cea18ba476c0cb6ea622be50a09ead00cd47b14 Mon Sep 17 00:00:00 2001 +From: Ivan Li +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 +Change-Id: I76d3a664153141d94636e0011f3a48e4f6dee922 +--- + mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ + sensor.cpp | 11 +++++- + sensor.hpp | 13 +++++++ + thresholds.hpp | 24 ------------ + 4 files changed, 125 insertions(+), 25 deletions(-) + +diff --git a/mainloop.cpp b/mainloop.cpp +index 29dc26a..5e27a30 100644 +--- a/mainloop.cpp ++++ b/mainloop.cpp +@@ -42,6 +42,13 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + using namespace phosphor::logging; + +@@ -110,6 +117,12 @@ decltype(Thresholds::deassertHighSignal) + Thresholds::deassertHighSignal = + &CriticalObject::criticalHighAlarmDeasserted; + ++static std::unique_ptr cacheTimer = nullptr; ++static std::unique_ptr powerMatch = nullptr; ++static bool powerStatusOn = false; ++static boost::asio::io_service io; ++static auto conn = std::make_shared(io); ++ + void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) + { + for (auto& iface : ifaces) +@@ -137,6 +150,83 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) + } + } + ++void powerStatusSet() ++{ ++ powerStatusOn = true; ++ return; ++} ++ ++void createTimer() ++{ ++ if (cacheTimer == nullptr) ++ { ++ cacheTimer = std::make_unique(powerStatusSet); ++ } ++} ++ ++bool isPowerOn(void) ++{ ++ if (!powerMatch) ++ { ++ throw std::runtime_error("Power Match Not Created"); ++ } ++ return powerStatusOn; ++} ++ ++void setupPowerMatch(sdbusplus::bus::bus& bus) ++{ ++ if (powerMatch) ++ { ++ return; ++ } ++ ++ powerMatch = std::make_unique( ++ bus, ++ "type='signal',interface='org.freedesktop.DBus.Properties',path='/xyz/" ++ "openbmc_project/state/" ++ "host0',arg0='xyz.openbmc_project.State.Host'", ++ [](sdbusplus::message::message& message) { ++ std::string objectName; ++ boost::container::flat_map> ++ values; ++ message.read(objectName, values); ++ auto findState = values.find("CurrentHostState"); ++ if (findState != values.end()) ++ { ++ bool on = boost::ends_with( ++ std::get(findState->second), "Running"); ++ if (!on) ++ { ++ cacheTimer->stop(); ++ powerStatusOn = false; ++ return; ++ } ++ cacheTimer->start(std::chrono::duration_cast( ++ std::chrono::seconds(10))); ++ } ++ else { ++ powerStatusOn = false; ++ } ++ }); ++ ++ conn->async_method_call( ++ [](boost::system::error_code ec, ++ const std::variant& state) { ++ if (ec) ++ { ++ return; ++ } ++ powerStatusOn = ++ boost::ends_with(std::get(state), "Running"); ++ }, ++ "xyz.openbmc_project.State.Host", ++ "/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; +@@ -418,6 +508,7 @@ void MainLoop::init() + _interval = std::strtoull(interval.c_str(), NULL, 10); + } + } ++ setupPowerMatch(_bus); + } + + void MainLoop::read() +@@ -462,6 +553,12 @@ void MainLoop::read() + + try + { ++ if(sensor->pwrOnMonitor() && !isPowerOn()) ++ { ++ statusIface->functional(false); ++ continue; ++ } ++ + if (sensor->hasFaultFile()) + { + auto fault = _ioAccess->read(sensorSysfsType, sensorSysfsNum, +@@ -588,6 +685,11 @@ void MainLoop::read() + } + } + ++ if(sensor->pwrOnMonitor() && !isPowerOn()) ++ { ++ statusIface->functional(false); ++ continue; ++ } + updateSensorInterfaces(obj, value); + } + catch (const std::system_error& e) +diff --git a/sensor.cpp b/sensor.cpp +index ac2f896..72b45f8 100644 +--- a/sensor.cpp ++++ b/sensor.cpp +@@ -32,7 +32,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, + const hwmonio::HwmonIOInterface* ioAccess, + const std::string& devPath) : + _sensor(sensor), +- _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false) ++ _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false), _pwrOnMonitor(false) + { + auto chip = env::getEnv("GPIOCHIP", sensor); + auto access = env::getEnv("GPIO", 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); ++ ++ auto pwrOnMon = env::getEnv("PWRONMON", sensor); ++ if (!pwrOnMon.empty()) ++ { ++ if (pwrOnMon == "ON") ++ { ++ _pwrOnMonitor = true; ++ } ++ } + } + + void Sensor::addRemoveRCs(const std::string& rcList) +diff --git a/sensor.hpp b/sensor.hpp +index 64d6e48..41c0fe7 100644 +--- a/sensor.hpp ++++ b/sensor.hpp +@@ -151,6 +151,16 @@ class Sensor + return _hasFaultFile; + } + ++ /** ++ * @brief Get whether the sensor only need to be monitored in power on state or not. ++ * ++ * @return - Boolean on whether the sensor only need to be monitored in power on state ++ */ ++ inline bool pwrOnMonitor(void) const ++ { ++ return _pwrOnMonitor; ++ } ++ + private: + /** @brief Sensor object's identifiers */ + SensorSet::key_type _sensor; +@@ -172,6 +182,9 @@ class Sensor + + /** @brief Tracks whether the sensor has a fault file or not. */ + bool _hasFaultFile; ++ ++ /** @brief Whether the sensor only need to be monitored in power on state or not. */ ++ bool _pwrOnMonitor; + }; + + /** +diff --git a/thresholds.hpp b/thresholds.hpp +index 8d557fc..0ffe0ce 100644 +--- a/thresholds.hpp ++++ b/thresholds.hpp +@@ -137,32 +137,8 @@ auto addThreshold(const std::string& sensorType, const std::string& sensorID, + auto hi = stod(tHi) * std::pow(10, scale); + (*iface.*Thresholds::setLo)(lo); + (*iface.*Thresholds::setHi)(hi); +- auto alarmLowState = (*iface.*Thresholds::getAlarmLow)(); +- auto alarmHighState = (*iface.*Thresholds::getAlarmHigh)(); + (*iface.*Thresholds::alarmLo)(value <= lo); + (*iface.*Thresholds::alarmHi)(value >= hi); +- if (alarmLowState != (value <= lo)) +- { +- if (value <= lo) +- { +- (*iface.*Thresholds::assertLowSignal)(value); +- } +- else +- { +- (*iface.*Thresholds::deassertLowSignal)(value); +- } +- } +- if (alarmHighState != (value >= hi)) +- { +- if (value >= hi) +- { +- (*iface.*Thresholds::assertHighSignal)(value); +- } +- else +- { +- (*iface.*Thresholds::deassertHighSignal)(value); +- } +- } + auto type = Thresholds::type; + obj[type] = iface; + } +-- +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 -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 - #include - #include -+#include - #include - #include - #include -@@ -299,7 +300,7 @@ std::optional - { - // 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 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 -+#include - #include - #include - #include -@@ -116,6 +117,8 @@ class MainLoop - /** @brief Store the specifications of sensor objects */ - std::map> - _sensorObjects; -+ /** @brief Store the async futures of timed out sensor objects */ -+ std::map> _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 - #include - #include -+#include - #include - #include - #include -@@ -125,8 +126,9 @@ SensorValueType Sensor::adjustValue(SensorValueType value) - return value; - } - --std::shared_ptr Sensor::addValue(const RetryIO& retryIO, -- ObjectInfo& info) -+std::shared_ptr Sensor::addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map>& timedoutMap) - { - static constexpr bool deferSignals = true; - -@@ -153,12 +155,69 @@ std::shared_ptr 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(retryIO), -- std::get(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 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(retryIO), -+ std::get(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(retryIO), -+ std::get(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 -+#include - #include - #include - #include -@@ -20,6 +22,17 @@ struct valueAdjust - std::unordered_set 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 addValue(const RetryIO& retryIO, -- ObjectInfo& info); -+ std::shared_ptr addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map>& 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_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend index 5f0517a30..e6b8e2d80 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,7 @@ 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://0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch \ + file://0002-Add-power-on-monitor-mechanism.patch \ " GBS_NAMES = " \ @@ -32,4 +32,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" -- cgit v1.2.3 From 48b7da057fa2b312c2c51a253b65a72aa0171dd8 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 10:57:06 +0800 Subject: meta-quanta: gbs: remove unused packages Remove ikvm and fru-device packages Signed-off-by: George Hung Change-Id: I3a6cb2b92ffcae11b775813bec12190399d27c88 --- .../recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'meta-quanta') 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..47eed2d30 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,3 @@ -RDEPENDS_${PN}-extras_remove_gbs = "obmc-ikvm" +RDEPENDS_${PN}-fru-ipmi_remove_gbs = "fru-device" +RDEPENDS_${PN}-ikvm_remove_gbs = "obmc-ikvm" RDEPENDS_${PN}-inventory_append_gbs = " virtual/obmc-gpio-presence" -- cgit v1.2.3 From cb9a27855c945ecfecc58aaaa4f8cfeea499d187 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 10:47:52 +0800 Subject: meta-quanta: gbs: adjust ro/rw partition offset Adjust ro/rw partition offset according to the kernel dts Signed-off-by: George Hung Change-Id: I78d6e6d689de22e96b900ed1ce97714102d18473 --- meta-quanta/meta-gbs/conf/machine/gbs.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/conf/machine/gbs.conf b/meta-quanta/meta-gbs/conf/machine/gbs.conf index e9456b5ec..9a99b5b01 100644 --- a/meta-quanta/meta-gbs/conf/machine/gbs.conf +++ b/meta-quanta/meta-gbs/conf/machine/gbs.conf @@ -14,8 +14,8 @@ GBMC_NCSI_IF_NAME = "eth0" GBMC_KCS_DEV = "ipmi-kcs1" # Overwrite flash offsets -FLASH_ROFS_OFFSET = "7296" -FLASH_RWFS_OFFSET = "61440" +FLASH_ROFS_OFFSET = "7168" +FLASH_RWFS_OFFSET = "62400" FLASH_SIZE = "65536" OBMC_MACHINE_FEATURES += "\ -- cgit v1.2.3 From 9d538eb746f20eb7efb1a81cace692b2f7b3c8df Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 10:26:40 +0800 Subject: meta-quanta: gbs: update chassis control and support signed sensor - Update IPMI Chassis Control command transition requests: https://gerrit.openbmc-project.xyz/29051 - Add Chassis State Transition interface https://gerrit.openbmc-project.xyz/29050 - Update Host State Transition function https://gerrit.openbmc-project.xyz/29049 - Fix issues and support signed sensor values https://gerrit.openbmc-project.xyz/26754 Signed-off-by: George Hung Change-Id: Ice305cb9a9e390099a828e872af451e832d59749 --- ...01-Add-Chassis-State-Transition-interface.patch | 79 +++++++++ ...x-issues-and-support-signed-sensor-values.patch | 169 +++++++++++++++++++ ...002-Update-Host-State-Transition-function.patch | 137 ++++++++++++++++ ...-Chassis-Control-command-transition-reque.patch | 180 +++++++++++++++++++++ ...he-pre-timeout-interrupt-in-dbus-property.patch | 138 ---------------- .../ipmi/phosphor-ipmi-host_%.bbappend | 4 + 6 files changed, 569 insertions(+), 138 deletions(-) create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-Chassis-State-Transition-interface.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Fix-issues-and-support-signed-sensor-values.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Update-Host-State-Transition-function.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Update-IPMI-Chassis-Control-command-transition-reque.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch (limited to 'meta-quanta') 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" +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 +--- + 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 + #include + #include ++#include + #include + #include + +@@ -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( ++ "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 +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 +--- + 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 updateFunc; + std::function 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 + #include + #include +-#include +-#include + #include + #include + +diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp +index 5cad58c5..c48140a3 100644 +--- a/sensordatahandler.hpp ++++ b/sensordatahandler.hpp +@@ -8,6 +8,8 @@ + #include + #include + #include ++#include ++#include + #include + + namespace ipmi +@@ -28,6 +30,7 @@ using ServicePath = std::pair; + using Interfaces = std::vector; + + using MapperResponseType = std::map>; ++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(propValue) * + std::pow(10, sensorInfo.scale - sensorInfo.exponentR); ++ int32_t rawData = ++ (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM; + +- auto rawData = static_cast((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::max() || ++ rawData < std::numeric_limits::lowest()) ++ { ++ log("Value out of range"); ++ throw std::out_of_range("Value out of range"); ++ } ++ setReading(static_cast(rawData), &response); ++ } ++ else ++ { ++ if (rawData > std::numeric_limits::max() || ++ rawData < std::numeric_limits::lowest()) ++ { ++ log("Value out of range"); ++ throw std::out_of_range("Value out of range"); ++ } ++ setReading(static_cast(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" +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 +--- + 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( +- "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("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("Transition request initiated successfully"); ++ log( ++ "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" +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 +--- + 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("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 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("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 -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 - ---- - 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(wdPreTimeoutInterruptMask & -+ (static_cast(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 816c5da3e..66f4f1384 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 @@ -2,6 +2,10 @@ DEPENDS_append_gbs = " gbs-yaml-config" FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \ + 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" -- cgit v1.2.3 From d996a1087bda5a099a44165e84c7f3dcd670a21b Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 14:53:37 +0800 Subject: meta-quanta: gbs: remove u-boot-fw-utils/clear-once packages remove u-boot-fw-utils/clear-once packages since we don't use u-boot environment Signed-off-by: George Hung Change-Id: Ideb8ece3529bd8fea658f9c160551950773d6d13 --- .../u-boot/u-boot-fw-utils-nuvoton/fw_env.config | 24 ---------------------- .../u-boot/u-boot-fw-utils-nuvoton_%.bbappend | 6 ------ .../ipmi/phosphor-ipmi-host_%.bbappend | 2 ++ .../network/phosphor-network_%.bbappend | 2 ++ 4 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config delete mode 100644 meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config deleted file mode 100644 index 0c384273f..000000000 --- a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config +++ /dev/null @@ -1,24 +0,0 @@ -# Configuration file for fw_(printenv/setenv) utility. -# Up to two entries are valid, in this case the redundant -# environment sector is assumed present. -# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. -# Futhermore, if the Flash sector size is ommitted, this value is assumed to -# be the same as the Environment size, which is valid for NOR and SPI-dataflash - -# NOR example -# MTD device name Device offset Env. size Flash sector size Number of sectors -/dev/mtd2 0x0000 0x40000 0x4000 - -# MTD SPI-dataflash example -# MTD device name Device offset Env. size Flash sector size Number of sectors -#/dev/mtd5 0x4200 0x4200 -#/dev/mtd6 0x4200 0x4200 - -# NAND example -#/dev/mtd0 0x4000 0x4000 0x20000 2 - -# Block device example -#/dev/mmcblk0 0xc0000 0x20000 - -# VFAT example -#/boot/uboot.env 0x0000 0x4000 diff --git a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend deleted file mode 100644 index 8b66271a5..000000000 --- a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" -SRC_URI_append_gbs = " file://fw_env.config" - -do_install_append_gbs() { - install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config -} 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 66f4f1384..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 @@ -15,3 +15,5 @@ EXTRA_OECONF_append_gbs = " \ 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/network/phosphor-network_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend index 49959cc0e..7bf73aee7 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,3 @@ EXTRA_OECONF_append_gbs = " --enable-nic-ethtool=yes" + +PACKAGECONFIG_remove_gbs = "uboot-env" -- cgit v1.2.3 From 7f52f354af516cda676c8ab4a1801cd19595533f Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 16:13:38 +0800 Subject: meta-quanta: gbs: set the max number of IPMI SEL logs limit the max number of IPMI SEL logs as 256 since the logs would store in persistent path (/var/lib/phosphor-logging/errors) Signed-off-by: George Hung Change-Id: I120623a934bd9fa6e8dd5c9b372b110287ef85d5 --- .../meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend | 1 + 1 file changed, 1 insertion(+) create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend (limited to 'meta-quanta') 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..75f5e7ebe --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend @@ -0,0 +1 @@ +EXTRA_OECONF_append_gbs = " ERROR_INFO_CAP=256" -- cgit v1.2.3 From 527fb966b7805fe41533477bc83339554ae45777 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 17:03:42 +0800 Subject: meta-quanta: gbs: fix mapper wait quit immediately Using mapper wait to ExecStartPre would quit immdiately while the D-Bus path is not active yet, so change to add to "After=" to make sure it would wait until the D-Bus path work Signed-off-by: George Hung Change-Id: I86029f4eba6b34b5c313ec9cc1578ef173d5c2aa --- .../phosphor-virtual-sensor/phosphor-virtual-sensor.service.replace | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'meta-quanta') 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..ec8fd73f8 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,11 +2,11 @@ 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 -- cgit v1.2.3 From 7616e873053477f1200110d7f854af336af6c0c7 Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Wed, 28 Apr 2021 17:33:05 -0700 Subject: meta-quanta: gbs: Add explicit RDEPENDS for tools gbs-sysinit requires i2c-tools and gbs-hotswap-powercycle requires libgpiod-tools. Declare the RDEPENDS in the bitbake file. Signed-off-by: Brandon Kim Change-Id: I28bdb2cc138e301faa395eb9150cc7624b93c8a3 --- meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb | 3 ++- .../recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb index 68a9cf181..c9d595a3d 100644 --- a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb @@ -8,8 +8,9 @@ inherit systemd DEPENDS += "systemd" RDEPENDS_${PN} += "bash" -RDEPENDS_${PN} += "libsystemd" +RDEPENDS_${PN} += "i2c-tools" RDEPENDS_${PN} += "jq" +RDEPENDS_${PN} += "libsystemd" SRC_URI = "file://gbs-sysinit.sh \ file://gbs-gpio-common.sh \ diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb index 6bf7bb69f..7c28dc28d 100644 --- a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb +++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb @@ -8,6 +8,7 @@ inherit systemd DEPENDS += "systemd" RDEPENDS_${PN} += "bash" +RDEPENDS_${PN} += "libgpiod-tools" SRC_URI = " file://hotswap-power-cycle.service \ file://tray_powercycle.sh \ -- cgit v1.2.3 From 8aebc427fcca01cc5722c80519528a31d20e9777 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 15:23:13 +0800 Subject: meta-quanta: gbs: add gpio-keys configs and fix build warning - fix comments for kernel build warning - add gpio-keys configs due to the following commit: https://gerrit.openbmc-project.xyz/40930 Signed-off-by: George Hung Change-Id: I3129f96a6d2d45f8d72d7cf4be806126c89f3cc0 --- .../meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg index edd009c47..73d52f845 100644 --- a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg @@ -29,8 +29,10 @@ CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y // Allow userspace to blink LEDs -CONFIG_LEDS_TRIGGER_PANIC=y // Blink BMC fault when kernel panics +# Allow userspace to blink LEDs +CONFIG_LEDS_TRIGGER_TIMER=y +# Blink BMC fault when kernel panics +CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEDS_TRIGGER_DEFAULT_ON=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y @@ -108,3 +110,7 @@ CONFIG_MTD_M25P80=y CONFIG_MUX_MMIO=y CONFIG_NPCM7XX_LPC_BPC=y CONFIG_MTD_PARTITIONED_MASTER=y + +# Enable phsophor-gpio-keys feature +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y -- cgit v1.2.3 From b588235e34a679c45ca41848473da3f59613acd7 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 29 Apr 2021 10:20:30 +0800 Subject: meta-quanta: gbs: fix the sensor type error They should be the cable sensor type Signed-off-by: George Hung Change-Id: I5056a7bd51effdc34ca89966da8ab4f666bbc92a --- .../configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'meta-quanta') 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 index 58bcb658c..96e282d8e 100644 --- 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 @@ -398,17 +398,17 @@ sensorID: 0xF5 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/hsbp_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF6 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/fanbd_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF7 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/bp12v_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF8 sensorType: 0x25 -- cgit v1.2.3 From b4af56f7f44ff7e2f565c548aa65489f151d36f2 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 28 Apr 2021 14:19:23 +0800 Subject: meta-quanta: gbs: fix yaml file and override config were not used - meson.build doesn't parse the led.yaml you provide, so replace the yaml file of source before compiling - install service-override.conf directly intead of using SYSTEMD_OVERRIDE to avoid package name changing - remove unused json config Signed-off-by: George Hung Change-Id: I28c72dfabf32d22f917ca1e244f5b700ae941667 --- .../recipes-phosphor/leds/phosphor-led-manager_%.bbappend | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'meta-quanta') 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/ +} -- cgit v1.2.3 From c4d7953f9ccb03549bbd7af2cd2fa755c0aaaf59 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 29 Apr 2021 10:48:55 +0800 Subject: meta-quanta: gbs: use service files instead of setting D-bus properties Use service files instead of setting D-bus properties for power control and remove unused patches Signed-off-by: George Hung Change-Id: I6f80979906e87b77b36a6e333456d4e5c42249ce --- ...ize-phosphor-watchdog-for-Intel-platforms.patch | 313 --------------------- .../watchdog/phosphor-watchdog/obmc/watchdog/host0 | 5 + .../phosphor-host-watchdog-powercycle.service | 9 + .../phosphor-host-watchdog-poweroff.service | 8 + .../phosphor-host-watchdog-reset.service | 9 + .../phosphor-watchdog/phosphor-watchdog.service | 16 -- .../phosphor-watchdog/phosphor-watchdog@.service | 16 ++ .../watchdog/phosphor-watchdog_%.bbappend | 14 +- 8 files changed, 57 insertions(+), 333 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-powercycle.service create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-poweroff.service create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-host-watchdog-reset.service delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service create mode 100644 meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service (limited to 'meta-quanta') 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 -Date: Mon, 17 Jun 2019 12:00:58 -0700 -Subject: [PATCH] Customize phosphor-watchdog for Intel platforms - -This patch adds various changes to phosphor-watchdog that are -required for compatibility with Intel platforms. - - 1. Add Redfish messages for watchdog timeout and pre-interrupt - 2. Use dbus properties for power control insted of service files - 3. Use host status to enable/disable watchdog - 4. Set preTimeoutInterruptOccurFlag - -Signed-off-by: James Feist -Signed-off-by: Ren Yu -Signed-off-by: Yong Li -Signed-off-by: Jason M. Bills ---- - watchdog.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++--- - watchdog.hpp | 23 +++++- - 2 files changed, 206 insertions(+), 10 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 57e9050..3b5356f 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -1,11 +1,14 @@ - #include "watchdog.hpp" - -+#include -+ - #include - #include - #include - #include - #include - #include -+#include - - namespace phosphor - { -@@ -18,10 +21,69 @@ using namespace phosphor::logging; - using sdbusplus::exception::SdBusError; - using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; - --// systemd service to kick start a target. --constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; --constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; --constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; -+const static constexpr char* currentHostState = "CurrentHostState"; -+const static constexpr char* hostStatusOff = -+ "xyz.openbmc_project.State.Host.HostState.Off"; -+ -+const static constexpr char* actionDescription = " due to Watchdog timeout"; -+const static constexpr char* hardResetDescription = "Hard Reset - System reset"; -+const static constexpr char* powerOffDescription = -+ "Power Down - System power down"; -+const static constexpr char* powerCycleDescription = -+ "Power Cycle - System power cycle"; -+const static constexpr char* timerExpiredDescription = "Timer expired"; -+ -+const static constexpr char* preInterruptActionNone = -+ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -+ -+const static constexpr char* preInterruptDescriptionSMI = "SMI"; -+const static constexpr char* preInterruptDescriptionNMI = "NMI"; -+const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; -+ -+const static constexpr char* reservedDescription = "Reserved"; -+ -+const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; -+const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; -+const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; -+const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; -+const static constexpr char* timerUseDescriptionOEM = "OEM"; -+ -+namespace restart -+{ -+static constexpr const char* busName = -+ "xyz.openbmc_project.Control.Host.RestartCause"; -+static constexpr const char* path = -+ "/xyz/openbmc_project/control/host0/restart_cause"; -+static constexpr const char* interface = -+ "xyz.openbmc_project.Control.Host.RestartCause"; -+static constexpr const char* property = "RequestedRestartCause"; -+} // namespace restart -+ -+// chassis state manager service -+namespace chassis -+{ -+static constexpr const char* busName = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* path = "/xyz/openbmc_project/state/chassis0"; -+static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; -+static constexpr const char* request = "RequestedPowerTransition"; -+} // namespace chassis -+ -+void Watchdog::powerStateChangedHandler( -+ const std::map>& props) -+{ -+ const auto iter = props.find(currentHostState); -+ if (iter != props.end()) -+ { -+ const std::string* powerState = std::get_if(&iter->second); -+ if (powerState && (*powerState == hostStatusOff)) -+ { -+ if (timerEnabled()) -+ { -+ enabled(false); -+ } -+ } -+ } -+} - - void Watchdog::resetTimeRemaining(bool enableWatchdog) - { -@@ -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(target->second)); - - bus.call_noreply(method); - } -@@ -147,6 +299,29 @@ void Watchdog::timeOutHandler() - entry("ERROR=%s", e.what())); - commit(); - } -+ -+ // set restart cause for watchdog HardReset & PowerCycle actions -+ if ((action == Watchdog::Action::HardReset) || -+ (action == Watchdog::Action::PowerCycle)) -+ { -+ try -+ { -+ auto method = bus.new_method_call( -+ restart::busName, restart::path, -+ "org.freedesktop.DBus.Properties", "Set"); -+ method.append( -+ restart::interface, restart::property, -+ std::variant("xyz.openbmc_project.State.Host." -+ "RestartCause.WatchdogTimer")); -+ bus.call(method); -+ } -+ catch (sdbusplus::exception_t& e) -+ { -+ log("Failed to set HostRestartCause property", -+ entry("ERROR=%s", e.what())); -+ commit(); -+ } -+ } - } - - tryFallbackOrDisable(); -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..b004b7a 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp -@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits - WatchdogInherits(bus, objPath), - bus(bus), actionTargetMap(std::move(actionTargetMap)), - fallback(std::move(fallback)), minInterval(minInterval), -- timer(event, std::bind(&Watchdog::timeOutHandler, this)) -+ timer(event, std::bind(&Watchdog::timeOutHandler, this)), -+ powerStateChangedSignal( -+ bus, -+ sdbusplus::bus::match::rules::propertiesChanged( -+ "/xyz/openbmc_project/state/host0", -+ "xyz.openbmc_project.State.Host"), -+ [this](sdbusplus::message::message& msg) { -+ std::string objectName; -+ std::map> props; -+ msg.read(objectName, props); -+ powerStateChangedHandler(props); -+ }) - { - // We set the watchdog interval with the default value. - interval(interval()); -@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits - tryFallbackOrDisable(); - } - -+ /** @brief Disable watchdog when power status change meet -+ * the specific requirement -+ */ -+ void powerStateChangedHandler( -+ const std::map>& props); -+ - /** @brief Resets the TimeRemaining to the configured Interval - * Optionally enables the watchdog. - * -@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits - /** @brief Contained timer object */ - sdeventplus::utility::Timer timer; - -+ /** @brief Optional Callback handler when power status change meet -+ * the specific requirement */ -+ sdbusplus::bus::match_t powerStateChangedSignal; -+ - /** @brief Optional Callback handler on timer expirartion */ - void timeOutHandler(); - 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..c0f04ef03 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 @@ -0,0 +1,5 @@ +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 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..df11b22e5 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Phosphor Watchdog + +[Service] +EnvironmentFile={envfiledir}/obmc/watchdog/%I +ExecStart=/usr/bin/env phosphor-watchdog --service=${{SERVICE}} --path=${{DEVPATH}} \ + --continue \ + --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 \ + " -- cgit v1.2.3 From 7ef770c8e7d4574e6bc0c35b972124ee90ab66ef Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 29 Apr 2021 11:03:27 +0800 Subject: meta-quanta: gbs: remove dbus-interfaces patches for watchdog Signed-off-by: George Hung Change-Id: Idce541a84d476fa9c5af0fd1311eee9f9732679b --- ...re-timeout-interrupt-defined-in-IPMI-spec.patch | 57 ---------------------- ...25-Add-PreInterruptFlag-properity-in-DBUS.patch | 39 --------------- .../dbus/phosphor-dbus-interfaces_%.bbappend | 5 -- 3 files changed, 101 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend (limited to 'meta-quanta') 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 -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 ---- - 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 -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 ---- - 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 \ - " -- cgit v1.2.3 From 2af6b9f8a3270c8ddb906f455ae716dfcd6f8a33 Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Wed, 28 Apr 2021 21:53:04 -0700 Subject: meta-quanta: gsj: Update mac-address to use meta-common meta-gsj is using SRCREV = "${AUTOREV}" which is outdated. Instead, use the bitbake from meta-common similar to meta-gbs. Signed-off-by: Brandon Kim Change-Id: I7c05b04987d10382329e7e813e71d0d79f2c4b9e --- meta-quanta/meta-gsj/recipes-gsj/mac-address/files/config.txt | 7 ------- .../recipes-gsj/mac-address/files/mac-address.service | 11 ----------- .../recipes-quanta/network/mac-address/mac-address/config.txt | 7 +++++++ .../meta-gsj/recipes-quanta/network/mac-address_%.bbappend | 10 ++++++++++ 4 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 meta-quanta/meta-gsj/recipes-gsj/mac-address/files/config.txt delete mode 100644 meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service create mode 100644 meta-quanta/meta-gsj/recipes-quanta/network/mac-address/mac-address/config.txt create mode 100644 meta-quanta/meta-gsj/recipes-quanta/network/mac-address_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/config.txt b/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/config.txt deleted file mode 100644 index 668b1d485..000000000 --- a/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/config.txt +++ /dev/null @@ -1,7 +0,0 @@ -fruBusNum=10 -fruAddr=0x55 -numberMac=4 -mac1=eth1 -mac2=usb0_dev -mac3=usb0_host -mac4=eth0 diff --git a/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service b/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service deleted file mode 100644 index e18d69493..000000000 --- a/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Initialize MAC Address -Before=usb_network.service network-pre.target -Wants=network-pre.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/mac-address - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/meta-quanta/meta-gsj/recipes-quanta/network/mac-address/mac-address/config.txt b/meta-quanta/meta-gsj/recipes-quanta/network/mac-address/mac-address/config.txt new file mode 100644 index 000000000..668b1d485 --- /dev/null +++ b/meta-quanta/meta-gsj/recipes-quanta/network/mac-address/mac-address/config.txt @@ -0,0 +1,7 @@ +fruBusNum=10 +fruAddr=0x55 +numberMac=4 +mac1=eth1 +mac2=usb0_dev +mac3=usb0_host +mac4=eth0 diff --git a/meta-quanta/meta-gsj/recipes-quanta/network/mac-address_%.bbappend b/meta-quanta/meta-gsj/recipes-quanta/network/mac-address_%.bbappend new file mode 100644 index 000000000..a90150b3d --- /dev/null +++ b/meta-quanta/meta-gsj/recipes-quanta/network/mac-address_%.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS_prepend_gsj := "${THISDIR}/${PN}:" +SRC_URI_append_gsj = " file://config.txt" + +FILES_${PN}_append_gsj = " ${datadir}/mac-address/config.txt" + +do_install_append_gsj() { + install -d ${D}${datadir}/mac-address + install -m 0644 -D ${WORKDIR}/config.txt \ + ${D}${datadir}/mac-address/config.txt +} -- cgit v1.2.3 From fe2be333c7cdb58de08245cf3d472976fd0ae55a Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Thu, 29 Apr 2021 09:26:04 -0700 Subject: meta-quanta: gsj: Remove gsj specific mac-address.bb gsj should be using the meta-common mac-address. Remove the gsj specific mac-address.bb Signed-off-by: Brandon Kim Change-Id: Iad1daca6308f4952816ba5fa6192cd6a161a75ca --- .../recipes-gsj/mac-address/mac-address.bb | 34 ---------------------- 1 file changed, 34 deletions(-) delete mode 100644 meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb b/meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb deleted file mode 100644 index d9fda7ccb..000000000 --- a/meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb +++ /dev/null @@ -1,34 +0,0 @@ -SRC_URI = "git://github.com/quanta-bmc/mac-address.git;protocol=git" -SRCREV = "${AUTOREV}" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -inherit autotools pkgconfig -inherit systemd - -DEPENDS += "systemd" -DEPENDS += "autoconf-archive-native" - -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI_append = " file://mac-address.service" -SRC_URI_append = " file://config.txt" - -FILES_${PN}_append = " ${datadir}/mac-address/config.txt" - -HASHSTYLE = "gnu" -S = "${WORKDIR}/git" -CXXFLAGS += "-std=c++17" - -do_install_append() { - install -d ${D}${systemd_unitdir}/system/ - install -m 0644 ${WORKDIR}/mac-address.service \ - ${D}${systemd_unitdir}/system - - install -d ${D}${datadir}/mac-address - install -m 0644 -D ${WORKDIR}/config.txt \ - ${D}${datadir}/mac-address/config.txt -} - -SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE_${PN} += "mac-address.service" -- cgit v1.2.3 From 2d52a389366be11fed6a81378b0669e2c274f220 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Fri, 30 Apr 2021 10:27:59 -0500 Subject: phosphor-logging: convert to meson Signed-off-by: Patrick Williams Change-Id: I2a5eb57d100ced02043bf68f64e4596c59da6ebd --- .../recipes-phosphor/logging/phosphor-logging_git.bb | 20 +++++++------------- .../logging/phosphor-logging_%.bbappend | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'meta-quanta') diff --git a/meta-phosphor/recipes-phosphor/logging/phosphor-logging_git.bb b/meta-phosphor/recipes-phosphor/logging/phosphor-logging_git.bb index a5b6990fe..e714a8e26 100644 --- a/meta-phosphor/recipes-phosphor/logging/phosphor-logging_git.bb +++ b/meta-phosphor/recipes-phosphor/logging/phosphor-logging_git.bb @@ -7,13 +7,12 @@ PV = "1.0+git${SRCPV}" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" -inherit autotools pkgconfig +inherit meson inherit python3native inherit obmc-phosphor-dbus-service inherit phosphor-logging inherit phosphor-dbus-yaml -DEPENDS += "autoconf-archive-native" DEPENDS += "systemd" DEPENDS += "${PYTHON_PN}-mako-native" DEPENDS += "${PYTHON_PN}-pyyaml-native" @@ -56,21 +55,16 @@ SRCREV = "60356ad409fd51703ba2ac7ea13df3d7f0426d0c" S = "${WORKDIR}/git" -PACKAGECONFIG ??= "metadata-processing" - -PACKAGECONFIG[metadata-processing] = " \ - --enable-metadata-processing, \ - --disable-metadata-processing, , \ - " +PACKAGECONFIG ??= "" PACKAGECONFIG[openpower-pels] = " \ - --enable-openpower-pel-extension, \ - --disable-openpower-pel-extension, \ + -Dopenpower-pel-extension=enabled, \ + -Dopenpower-pel-extension=disabled, \ nlohmann-json cli11 pldm, \ python3, \ " -EXTRA_OECONF = " \ - YAML_DIR=${STAGING_DIR_TARGET}${yaml_dir} \ - CALLOUTS_YAML=${STAGING_DIR_NATIVE}${callouts_datadir}/callouts.yaml \ +EXTRA_OEMESON = " \ + -Dyamldir=${STAGING_DIR_TARGET}${yaml_dir} \ + -Dcallout_yaml=${STAGING_DIR_NATIVE}${callouts_datadir}/callouts.yaml \ " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend index 75f5e7ebe..264423933 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/logging/phosphor-logging_%.bbappend @@ -1 +1 @@ -EXTRA_OECONF_append_gbs = " ERROR_INFO_CAP=256" +EXTRA_OEMESON_append_gbs = " -Derror_info_cap=256" -- cgit v1.2.3 From 2f920b821b92e5c4d29396473d2d4f5d689d214f Mon Sep 17 00:00:00 2001 From: George Hung Date: Mon, 3 May 2021 02:32:58 +0000 Subject: Revert "meta-quanta: gbs: fix the sensor type error" This reverts commit b588235e34a679c45ca41848473da3f59613acd7. Reason for revert: wrong sensor type number for cable sensors Signed-off-by: George Hung Change-Id: I865fb34b46295e727b652042619724148668183a --- .../configuration/gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'meta-quanta') 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 index 96e282d8e..58bcb658c 100644 --- 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 @@ -398,17 +398,17 @@ sensorID: 0xF5 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/entity/hsbp_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF6 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/entity/fanbd_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF7 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/entity/bp12v_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF8 sensorType: 0x25 -- cgit v1.2.3 From 8d033f485c48a76d5130012d39674ed64dc33587 Mon Sep 17 00:00:00 2001 From: George Hung Date: Mon, 3 May 2021 13:30:06 +0800 Subject: meta-quanta: gbs: add back CONFIG_INPUT_KEYBOARD Add back CONFIG_INPUT_KEYBOARD because it's needed for CONFIG_KEYBOARD_GPIO Kconfig ref: https://gerrit.openbmc-project.xyz/42704 Signed-off-by: George Hung Change-Id: I8cbaec4f950c9787f1c9b3526ccd92d2785b2b01 --- meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg | 2 ++ 1 file changed, 2 insertions(+) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg index 73d52f845..221910a36 100644 --- a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg @@ -113,4 +113,6 @@ CONFIG_MTD_PARTITIONED_MASTER=y # Enable phsophor-gpio-keys feature CONFIG_INPUT_EVDEV=y +# Need for CONFIG_KEYBOARD_GPIO Kconfig +CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_GPIO=y -- cgit v1.2.3 From 8848e75f90e7d6a43b444554736762b36b4343b8 Mon Sep 17 00:00:00 2001 From: George Hung Date: Mon, 3 May 2021 13:41:04 +0800 Subject: meta-quanta: gbs: Add Max/Min value setting in json config Add Max/Min value setting in json config, so sel-logger could show correct sensor value ref: https://gerrit.openbmc-project.xyz/42073 Signed-off-by: George Hung Change-Id: Ieebb60fec73a83a17babd4a918645dd1a387d8b4 --- .../phosphor-virtual-sensor/config-virtual-sensor.json | 12 +++++++++--- .../phosphor-virtual-sensor.service.replace | 1 - .../sensors/phosphor-virtual-sensor_%.bbappend | 4 ---- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'meta-quanta') 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 ec8fd73f8..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 @@ -8,7 +8,6 @@ After=mapper-wait@-xyz-openbmc_project-sensors-temperature-outlet_1.service [Service] 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 -- cgit v1.2.3 From 4592462f956145f98d2df36164789dc5ef7e15f5 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 29 Apr 2021 14:32:56 +0800 Subject: meta-quanta: gbs: fix sensor type error Correct as the cable sensor type for cable sensors Signed-off-by: George Hung Change-Id: I5483e0cf103dccdf38a79ce781529e0f6b7b2d88 --- .../gbs-yaml-config/gbs-ipmi-inventory-sensors.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'meta-quanta') 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 index 58bcb658c..865e4b3b6 100644 --- 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 @@ -398,20 +398,20 @@ sensorID: 0xF5 sensorType: 0x25 offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/hsbp_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF6 - sensorType: 0x25 + sensorType: 0x1B offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/fanbd_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF7 - sensorType: 0x25 + sensorType: 0x1B offset: 0x01 -/xyz/openbmc_project/inventory/system/chassis/entity/bp12v_cab_prsnt: +/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt: eventReadingType: 0x6f sensorID: 0xF8 - sensorType: 0x25 + sensorType: 0x1B offset: 0x01 /xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt: eventReadingType: 0x6f -- cgit v1.2.3 From 1b315f63300a3b430f2e241c1423a9fb0601cd09 Mon Sep 17 00:00:00 2001 From: George Hung Date: Wed, 5 May 2021 21:15:53 +0800 Subject: meta-quanta: gbs: update bmcweb build option - update to use meson instead of cmake - change http request body limit size to 40MB to pass firmware update of Robot framework test for GBS - create /var/lib/bmcweb folder to satisfy the path redfish eventservice required to save config and subscriptions Signed-off-by: George Hung Change-Id: Ic0de91547d11aad9cc6412a389d26c2da5c79644 --- .../meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'meta-quanta') 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 +} -- cgit v1.2.3 From 39c444bb509d1d3560b63ebaa66b573772dcf223 Mon Sep 17 00:00:00 2001 From: George Hung Date: Fri, 7 May 2021 11:08:46 +0800 Subject: meta-quanta: gbs: update ASYNC_READ_TIMEOUT build method to meson ref: https://gerrit.openbmc-project.xyz/24337 Signed-off-by: George Hung Change-Id: Id02a797a515363f74fcff27fc6ce9fc88a4bd9cc --- ...ensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch | 328 ++++++++++----------- 1 file changed, 164 insertions(+), 164 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch index 88f55d055..b3d98d3ed 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch @@ -1,4 +1,4 @@ -From c1b3d32430df12ab01f9cacf132aedff8324d55b Mon Sep 17 00:00:00 2001 +From 9d3c86863cd49f18603f6334b3e09e8963c73ba2 Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Fri, 9 Aug 2019 15:38:53 -0700 Subject: [PATCH] sensor: Implement sensor "ASYNC_READ_TIMEOUT" @@ -16,41 +16,23 @@ ASYNC_READ_TIMEOUT_sensor1="1000" // Timeout will be set to 1 sec If the read times out, the sensor read will be skipped and the sensor's functional property will be set to 'false'. Timed out futures will be placed in a map to prevent their destructor from running and -blocking until the read completes (limiation of std::async). +blocking until the read completes (limitation of std::async). + +Tested: This patch has been running downstream for over a year to + solve a slow I2C sensor reads causing IPMI slowdown. Change-Id: I3d9ed4d5c9cc87d3196fc281451834f3001d0b48 Signed-off-by: Brandon Kim --- - Makefile.am | 2 ++ - mainloop.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++--- - mainloop.hpp | 3 +++ + mainloop.cpp | 27 ++++++++++++--- + mainloop.hpp | 3 ++ meson.build | 1 + - sensor.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++------ - sensor.hpp | 20 ++++++++++++-- - 6 files changed, 160 insertions(+), 14 deletions(-) + sensor.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++++++++--- + sensor.hpp | 46 +++++++++++++++++++++++++- + 5 files changed, 159 insertions(+), 10 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 ecceee5..29dc26a 100644 +index 40c429a..e138db7 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -34,6 +34,7 @@ @@ -70,7 +52,7 @@ index ecceee5..29dc26a 100644 } catch (const std::system_error& e) { -@@ -478,10 +479,74 @@ void MainLoop::read() +@@ -478,10 +479,28 @@ void MainLoop::read() // RAII object for GPIO unlock / lock auto locker = sensor::gpioUnlock(sensor->getGpio()); @@ -79,62 +61,16 @@ index ecceee5..29dc26a 100644 - value = _ioAccess->read(sensorSysfsType, sensorSysfsNum, input, + // For sensors with attribute ASYNC_READ_TIMEOUT, + // spawn a thread with timeout -+ auto asyncRead = ++ auto asyncReadTimeout = + env::getEnv("ASYNC_READ_TIMEOUT", sensorSetKey); -+ if (!asyncRead.empty()) ++ if (!asyncReadTimeout.empty()) + { -+ // Default async read timeout -+ std::chrono::milliseconds asyncReadTimeout{ -+ std::stoi(asyncRead)}; -+ bool valueIsValid = false; -+ std::future 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(); -+ } ++ std::chrono::milliseconds asyncTimeout{ ++ std::stoi(asyncReadTimeout)}; ++ value = sensor::asyncRead( ++ sensorSetKey, _ioAccess, asyncTimeout, _timedoutMap, ++ sensorSysfsType, sensorSysfsNum, input, ++ hwmonio::retries, hwmonio::delay); + } + else + { @@ -149,7 +85,7 @@ index ecceee5..29dc26a 100644 statusIface->functional(true); diff --git a/mainloop.hpp b/mainloop.hpp -index b3de022..6803c4b 100644 +index b3de022..047d614 100644 --- a/mainloop.hpp +++ b/mainloop.hpp @@ -9,6 +9,7 @@ @@ -165,24 +101,24 @@ index b3de022..6803c4b 100644 std::map> _sensorObjects; + /** @brief Store the async futures of timed out sensor objects */ -+ std::map> _timedoutMap; ++ sensor::TimedoutMap _timedoutMap; /** * @brief Map of removed sensors diff --git a/meson.build b/meson.build -index 66e6801..d6a92f8 100644 +index 77f7761..e10a3b5 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, +@@ -45,6 +45,7 @@ hwmon_deps = [ + dependency('sdbusplus'), + dependency('sdeventplus'), + dependency('stdplus'), ++ dependency('threads'), + sysfs_dep, + ] + diff --git a/sensor.cpp b/sensor.cpp -index 09aeca6..ac2f896 100644 +index 43af2f6..a2e33cb 100644 --- a/sensor.cpp +++ b/sensor.cpp @@ -15,6 +15,7 @@ @@ -193,19 +129,17 @@ index 09aeca6..ac2f896 100644 #include #include #include -@@ -116,8 +117,9 @@ SensorValueType Sensor::adjustValue(SensorValueType value) - return value; +@@ -117,7 +118,8 @@ SensorValueType Sensor::adjustValue(SensorValueType value) } --std::shared_ptr Sensor::addValue(const RetryIO& retryIO, + std::shared_ptr Sensor::addValue(const RetryIO& retryIO, - ObjectInfo& info) -+std::shared_ptr Sensor::addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map>& timedoutMap) ++ ObjectInfo& info, ++ TimedoutMap& timedoutMap) { static constexpr bool deferSignals = true; -@@ -144,12 +146,69 @@ std::shared_ptr Sensor::addValue(const RetryIO& retryIO, +@@ -144,12 +146,27 @@ std::shared_ptr Sensor::addValue(const RetryIO& retryIO, // RAII object for GPIO unlock / lock auto locker = gpioUnlock(getGpio()); @@ -213,61 +147,17 @@ index 09aeca6..ac2f896 100644 - // or has a transient error. - val = - _ioAccess->read(_sensor.first, _sensor.second, -- hwmon::entry::cinput, std::get(retryIO), -- std::get(retryIO)); + // For sensors with attribute ASYNC_READ_TIMEOUT, + // spawn a thread with timeout -+ auto asyncRead = env::getEnv("ASYNC_READ_TIMEOUT", _sensor); -+ if (!asyncRead.empty()) ++ auto asyncReadTimeout = env::getEnv("ASYNC_READ_TIMEOUT", _sensor); ++ if (!asyncReadTimeout.empty()) + { -+ // Default async read timeout -+ std::chrono::milliseconds asyncReadTimeout{ -+ std::stoi(asyncRead)}; -+ bool valueIsValid = false; -+ std::future 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(retryIO), -+ std::get(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(); -+ } ++ std::chrono::milliseconds asyncTimeout{ ++ std::stoi(asyncReadTimeout)}; ++ val = asyncRead(_sensor, _ioAccess, asyncTimeout, timedoutMap, ++ _sensor.first, _sensor.second, + hwmon::entry::cinput, std::get(retryIO), + std::get(retryIO)); + } + else + { @@ -279,22 +169,103 @@ index 09aeca6..ac2f896 100644 + std::get(retryIO)); + } } - #ifdef UPDATE_FUNCTIONAL_ON_FAIL + #if UPDATE_FUNCTIONAL_ON_FAIL catch (const std::system_error& e) +@@ -266,4 +283,69 @@ std::optional gpioUnlock(const gpioplus::HandleInterface* handle) + return GpioLocker(std::move(handle)); + } + ++SensorValueType asyncRead(const SensorSet::key_type& sensorSetKey, ++ const hwmonio::HwmonIOInterface* ioAccess, ++ const std::chrono::milliseconds asyncTimeout, ++ TimedoutMap& timedoutMap, const std::string& type, ++ const std::string& id, const std::string& sensor, ++ const size_t retries, ++ const std::chrono::milliseconds delay) ++{ ++ // Default async read timeout ++ auto asyncReadTimeout = asyncTimeout; ++ bool valueIsValid = false; ++ std::future 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, type, id, sensor, retries, 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 - proceed to check the future_status to see when ++ // the async thread finishes ++ asyncReadTimeout = std::chrono::seconds(0); ++ asyncThread = std::move(asyncIter->second); ++ } ++ ++ // TODO: This is still not a true asynchronous read as it still blocks the ++ // main thread for asyncReadTimeout amount of time. To make this completely ++ // asynchronous, schedule a read and register a callback to update the ++ // sensor value ++ std::future_status status = asyncThread.wait_for(asyncReadTimeout); ++ switch (status) ++ { ++ case std::future_status::ready: ++ // Read has finished ++ if (valueIsValid) ++ { ++ return asyncThread.get(); ++ // Good sensor reads should skip the code below ++ } ++ // Async read thread has completed but had previously timed out (was ++ // found in the timedoutMap). Erase from timedoutMap and throw to ++ // allow retry in the next read cycle. Not returning the read value ++ // as the sensor reading may be bad / corrupted if it took so long. ++ timedoutMap.erase(sensorSetKey); ++ throw AsyncSensorReadTimeOut(); ++ default: ++ // Read timed out so add the thread to the timedoutMap (if the entry ++ // already exists, operator[] updates it). ++ // ++ // Keeping the timed out futures in a map is required to prevent ++ // their destructor from being called when returning from this ++ // stack. The destructor will otherwise block until the read ++ // completes due to the limitation of std::async. ++ timedoutMap[sensorSetKey] = std::move(asyncThread); ++ throw AsyncSensorReadTimeOut(); ++ } ++} ++ + } // namespace sensor diff --git a/sensor.hpp b/sensor.hpp -index 4b2d281..64d6e48 100644 +index 4b2d281..830d403 100644 --- a/sensor.hpp +++ b/sensor.hpp -@@ -4,6 +4,8 @@ +@@ -4,7 +4,10 @@ #include "sensorset.hpp" #include "types.hpp" +#include +#include #include ++#include #include #include -@@ -20,6 +22,17 @@ struct valueAdjust + #include +@@ -13,6 +16,8 @@ + namespace sensor + { + ++using TimedoutMap = std::map>; ++ + struct valueAdjust + { + double gain = 1.0; +@@ -20,6 +25,17 @@ struct valueAdjust std::unordered_set rmRCs; }; @@ -312,7 +283,7 @@ index 4b2d281..64d6e48 100644 /** @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 +@@ -87,10 +103,13 @@ class Sensor * (number of and delay between) * @param[in] info - Sensor object information * @@ -320,14 +291,43 @@ index 4b2d281..64d6e48 100644 + * * @return - Shared pointer to the value object */ -- std::shared_ptr addValue(const RetryIO& retryIO, + std::shared_ptr addValue(const RetryIO& retryIO, - ObjectInfo& info); -+ std::shared_ptr addValue( -+ const RetryIO& retryIO, ObjectInfo& info, -+ std::map>& timedoutMap); ++ ObjectInfo& info, ++ TimedoutMap& timedoutMap); /** * @brief Add status interface and functional property for sensor +@@ -177,4 +196,29 @@ using GpioLocker = + */ + std::optional gpioUnlock(const gpioplus::HandleInterface* handle); + ++/** ++ * @brief Asynchronously read a sensor with timeout defined by ++ * ASYNC_READ_TIMEOUT environment variable ++ * ++ * @param[in] sensorSetKey - Sensor object's identifiers ++ * @param[in] ioAccess - Hwmon sysfs access ++ * @param[in] asyncTimeout - Async read timeout in milliseconds ++ * @param[in] timedoutMap - Map to track timed out threads ++ * ++ * (Params needed for HwmonIO::read) ++ * @param[in] type - The hwmon type (ex. temp). ++ * @param[in] id - The hwmon id (ex. 1). ++ * @param[in] sensor - The hwmon sensor (ex. input). ++ * @param[in] retries - The number of times to retry. ++ * @param[in] delay - The time to sleep between retry attempts. ++ * ++ * @return - SensorValueType read asynchronously, will throw if timed out ++ */ ++SensorValueType asyncRead(const SensorSet::key_type& sensorSetKey, ++ const hwmonio::HwmonIOInterface* ioAccess, ++ const std::chrono::milliseconds asyncTimeout, ++ TimedoutMap& timedoutMap, const std::string& type, ++ const std::string& id, const std::string& sensor, ++ const size_t retries, ++ const std::chrono::milliseconds delay); + } // namespace sensor -- 2.21.0 -- cgit v1.2.3 From 1819d8176a3380fd13b958275c678ec24c462aaf Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Mon, 10 May 2021 09:41:28 -0700 Subject: meta-quanta: gbs: Remove phosphor-hwmon ASYNC patch The 0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch was merged: https://gerrit.openbmc-project.xyz/24337 And SRCREV bumped here: https://gerrit.openbmc-project.xyz/43005 Remove the patch to fix build failures. Change-Id: I38dcaa56a2d184ed9c65a8a653a4d34a80d8f83b Signed-off-by: Brandon Kim --- ...ensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch | 333 --------------------- .../sensors/phosphor-hwmon_%.bbappend | 3 +- 2 files changed, 1 insertion(+), 335 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch deleted file mode 100644 index b3d98d3ed..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 9d3c86863cd49f18603f6334b3e09e8963c73ba2 Mon Sep 17 00:00:00 2001 -From: Brandon Kim -Date: Fri, 9 Aug 2019 15:38:53 -0700 -Subject: [PATCH] sensor: Implement sensor "ASYNC_READ_TIMEOUT" - -This change will prevent sensors from blocking all other sensor reads -and D-Bus if they do not report failures quickly enough. - -If "ASYNC_READ_TIMEOUT" environment variable is defined in the -sensor's config file for a key_type, the sensor read will be -asynchronous with timeout set in milliseconds. - -For example for "sensor1": -ASYNC_READ_TIMEOUT_sensor1="1000" // Timeout will be set to 1 sec - -If the read times out, the sensor read will be skipped and the -sensor's functional property will be set to 'false'. Timed out futures -will be placed in a map to prevent their destructor from running and -blocking until the read completes (limitation of std::async). - -Tested: This patch has been running downstream for over a year to - solve a slow I2C sensor reads causing IPMI slowdown. - -Change-Id: I3d9ed4d5c9cc87d3196fc281451834f3001d0b48 -Signed-off-by: Brandon Kim ---- - mainloop.cpp | 27 ++++++++++++--- - mainloop.hpp | 3 ++ - meson.build | 1 + - sensor.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++++++++--- - sensor.hpp | 46 +++++++++++++++++++++++++- - 5 files changed, 159 insertions(+), 10 deletions(-) - -diff --git a/mainloop.cpp b/mainloop.cpp -index 40c429a..e138db7 100644 ---- a/mainloop.cpp -+++ b/mainloop.cpp -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -242,7 +243,7 @@ std::optional - { - // 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) - { -@@ -478,10 +479,28 @@ 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 asyncReadTimeout = -+ env::getEnv("ASYNC_READ_TIMEOUT", sensorSetKey); -+ if (!asyncReadTimeout.empty()) -+ { -+ std::chrono::milliseconds asyncTimeout{ -+ std::stoi(asyncReadTimeout)}; -+ value = sensor::asyncRead( -+ sensorSetKey, _ioAccess, asyncTimeout, _timedoutMap, -+ sensorSysfsType, sensorSysfsNum, input, -+ hwmonio::retries, hwmonio::delay); -+ } -+ 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..047d614 100644 ---- a/mainloop.hpp -+++ b/mainloop.hpp -@@ -9,6 +9,7 @@ - #include "types.hpp" - - #include -+#include - #include - #include - #include -@@ -116,6 +117,8 @@ class MainLoop - /** @brief Store the specifications of sensor objects */ - std::map> - _sensorObjects; -+ /** @brief Store the async futures of timed out sensor objects */ -+ sensor::TimedoutMap _timedoutMap; - - /** - * @brief Map of removed sensors -diff --git a/meson.build b/meson.build -index 77f7761..e10a3b5 100644 ---- a/meson.build -+++ b/meson.build -@@ -45,6 +45,7 @@ hwmon_deps = [ - dependency('sdbusplus'), - dependency('sdeventplus'), - dependency('stdplus'), -+ dependency('threads'), - sysfs_dep, - ] - -diff --git a/sensor.cpp b/sensor.cpp -index 43af2f6..a2e33cb 100644 ---- a/sensor.cpp -+++ b/sensor.cpp -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -117,7 +118,8 @@ SensorValueType Sensor::adjustValue(SensorValueType value) - } - - std::shared_ptr Sensor::addValue(const RetryIO& retryIO, -- ObjectInfo& info) -+ ObjectInfo& info, -+ TimedoutMap& timedoutMap) - { - static constexpr bool deferSignals = true; - -@@ -144,12 +146,27 @@ std::shared_ptr 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, -+ // For sensors with attribute ASYNC_READ_TIMEOUT, -+ // spawn a thread with timeout -+ auto asyncReadTimeout = env::getEnv("ASYNC_READ_TIMEOUT", _sensor); -+ if (!asyncReadTimeout.empty()) -+ { -+ std::chrono::milliseconds asyncTimeout{ -+ std::stoi(asyncReadTimeout)}; -+ val = asyncRead(_sensor, _ioAccess, asyncTimeout, timedoutMap, -+ _sensor.first, _sensor.second, - hwmon::entry::cinput, std::get(retryIO), - std::get(retryIO)); -+ } -+ 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(retryIO), -+ std::get(retryIO)); -+ } - } - #if UPDATE_FUNCTIONAL_ON_FAIL - catch (const std::system_error& e) -@@ -266,4 +283,69 @@ std::optional gpioUnlock(const gpioplus::HandleInterface* handle) - return GpioLocker(std::move(handle)); - } - -+SensorValueType asyncRead(const SensorSet::key_type& sensorSetKey, -+ const hwmonio::HwmonIOInterface* ioAccess, -+ const std::chrono::milliseconds asyncTimeout, -+ TimedoutMap& timedoutMap, const std::string& type, -+ const std::string& id, const std::string& sensor, -+ const size_t retries, -+ const std::chrono::milliseconds delay) -+{ -+ // Default async read timeout -+ auto asyncReadTimeout = asyncTimeout; -+ bool valueIsValid = false; -+ std::future 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, type, id, sensor, retries, 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 - proceed to check the future_status to see when -+ // the async thread finishes -+ asyncReadTimeout = std::chrono::seconds(0); -+ asyncThread = std::move(asyncIter->second); -+ } -+ -+ // TODO: This is still not a true asynchronous read as it still blocks the -+ // main thread for asyncReadTimeout amount of time. To make this completely -+ // asynchronous, schedule a read and register a callback to update the -+ // sensor value -+ std::future_status status = asyncThread.wait_for(asyncReadTimeout); -+ switch (status) -+ { -+ case std::future_status::ready: -+ // Read has finished -+ if (valueIsValid) -+ { -+ return asyncThread.get(); -+ // Good sensor reads should skip the code below -+ } -+ // Async read thread has completed but had previously timed out (was -+ // found in the timedoutMap). Erase from timedoutMap and throw to -+ // allow retry in the next read cycle. Not returning the read value -+ // as the sensor reading may be bad / corrupted if it took so long. -+ timedoutMap.erase(sensorSetKey); -+ throw AsyncSensorReadTimeOut(); -+ default: -+ // Read timed out so add the thread to the timedoutMap (if the entry -+ // already exists, operator[] updates it). -+ // -+ // Keeping the timed out futures in a map is required to prevent -+ // their destructor from being called when returning from this -+ // stack. The destructor will otherwise block until the read -+ // completes due to the limitation of std::async. -+ timedoutMap[sensorSetKey] = std::move(asyncThread); -+ throw AsyncSensorReadTimeOut(); -+ } -+} -+ - } // namespace sensor -diff --git a/sensor.hpp b/sensor.hpp -index 4b2d281..830d403 100644 ---- a/sensor.hpp -+++ b/sensor.hpp -@@ -4,7 +4,10 @@ - #include "sensorset.hpp" - #include "types.hpp" - -+#include -+#include - #include -+#include - #include - #include - #include -@@ -13,6 +16,8 @@ - namespace sensor - { - -+using TimedoutMap = std::map>; -+ - struct valueAdjust - { - double gain = 1.0; -@@ -20,6 +25,17 @@ struct valueAdjust - std::unordered_set 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 +103,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 addValue(const RetryIO& retryIO, -- ObjectInfo& info); -+ ObjectInfo& info, -+ TimedoutMap& timedoutMap); - - /** - * @brief Add status interface and functional property for sensor -@@ -177,4 +196,29 @@ using GpioLocker = - */ - std::optional gpioUnlock(const gpioplus::HandleInterface* handle); - -+/** -+ * @brief Asynchronously read a sensor with timeout defined by -+ * ASYNC_READ_TIMEOUT environment variable -+ * -+ * @param[in] sensorSetKey - Sensor object's identifiers -+ * @param[in] ioAccess - Hwmon sysfs access -+ * @param[in] asyncTimeout - Async read timeout in milliseconds -+ * @param[in] timedoutMap - Map to track timed out threads -+ * -+ * (Params needed for HwmonIO::read) -+ * @param[in] type - The hwmon type (ex. temp). -+ * @param[in] id - The hwmon id (ex. 1). -+ * @param[in] sensor - The hwmon sensor (ex. input). -+ * @param[in] retries - The number of times to retry. -+ * @param[in] delay - The time to sleep between retry attempts. -+ * -+ * @return - SensorValueType read asynchronously, will throw if timed out -+ */ -+SensorValueType asyncRead(const SensorSet::key_type& sensorSetKey, -+ const hwmonio::HwmonIOInterface* ioAccess, -+ const std::chrono::milliseconds asyncTimeout, -+ TimedoutMap& timedoutMap, const std::string& type, -+ const std::string& id, const std::string& sensor, -+ const size_t retries, -+ const std::chrono::milliseconds delay); - } // namespace sensor --- -2.21.0 - 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 e6b8e2d80..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-sensor-Implement-sensor-ASYNC_READ_TIMEOUT.patch \ - file://0002-Add-power-on-monitor-mechanism.patch \ +SRC_URI_append_gbs = " file://0002-Add-power-on-monitor-mechanism.patch \ " GBS_NAMES = " \ -- cgit v1.2.3 From a3036f8a8a66563ca25f6f3af353826615197ae8 Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Thu, 13 May 2021 00:14:23 -0700 Subject: meta-quanta: gbs: Move appending gpio-presence Instead of appending virtual/obmc-gpio-presence to ${PN}-inventory, simply move it to obmc-phosphor-image.bbappend Signed-off-by: Brandon Kim Change-Id: Ie1ec9bdd3b29cc73acea272199c543b3da715bf1 --- .../meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend | 1 + .../recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'meta-quanta') 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/packagegroups/packagegroup-obmc-apps%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend index 47eed2d30..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,3 +1,2 @@ RDEPENDS_${PN}-fru-ipmi_remove_gbs = "fru-device" RDEPENDS_${PN}-ikvm_remove_gbs = "obmc-ikvm" -RDEPENDS_${PN}-inventory_append_gbs = " virtual/obmc-gpio-presence" -- cgit v1.2.3 From 89a45281d57ad35db387ec4083e2f6d207b395a6 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 13 May 2021 14:09:01 +0800 Subject: meta-quanta: gbs: remove SB-TSI patch It's already merged to the upstream for kernel 5.10 Signed-off-by: George Hung Change-Id: Ie8d82b3d393bd7e8324aa0b3482ac43c481df3f5 --- ...0003-Add-basic-support-for-SB-TSI-sensors.patch | 327 --------------------- .../recipes-kernel/linux/linux-nuvoton_%.bbappend | 1 - 2 files changed, 328 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch deleted file mode 100644 index b690a9813..000000000 --- a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch +++ /dev/null @@ -1,327 +0,0 @@ -SB Temperature Sensor Interface (SB-TSI) is an SMBus compatible -interface that reports AMD SoC's Ttcl (normalized temperature), -and resembles a typical 8-pin remote temperature sensor's I2C interface -to BMC. - -This commit adds basic support using this interface to read CPU -temperature, and read/write high/low CPU temp thresholds. - -To instantiate this driver on an AMD CPU with SB-TSI -support, the i2c bus number would be the bus connected from the board -management controller (BMC) to the CPU. The i2c address is specified in -Section 6.3.1 of the spec [1]: The SB-TSI address is normally 98h for socket 0 -and 90h for socket 1, but it could vary based on hardware address select pins. - -[1]: https://www.amd.com/system/files/TechDocs/56255_OSRR.pdf - -Test status: tested reading temp1_input, and reading/writing -temp1_max/min. - -Signed-off-by: Kun Yi ---- - drivers/hwmon/Kconfig | 10 ++ - drivers/hwmon/Makefile | 1 + - drivers/hwmon/sbtsi_temp.c | 259 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 270 insertions(+) - create mode 100644 drivers/hwmon/sbtsi_temp.c - -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index 05a30832c6ba..9585dcd01d1b 100644 ---- a/drivers/hwmon/Kconfig -+++ b/drivers/hwmon/Kconfig -@@ -1412,6 +1412,16 @@ config SENSORS_RASPBERRYPI_HWMON - This driver can also be built as a module. If so, the module - will be called raspberrypi-hwmon. - -+config SENSORS_SBTSI -+ tristate "Emulated SB-TSI temperature sensor" -+ depends on I2C -+ help -+ If you say yes here you get support for emulated temperature -+ sensors on AMD SoCs with SB-TSI interface connected to a BMC device. -+ -+ This driver can also be built as a module. If so, the module will -+ be called sbtsi_temp. -+ - config SENSORS_SHT15 - tristate "Sensiron humidity and temperature sensors. SHT15 and compat." - depends on GPIOLIB || COMPILE_TEST -diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile -index b0b9c8e57176..cd109f003ce4 100644 ---- a/drivers/hwmon/Makefile -+++ b/drivers/hwmon/Makefile -@@ -152,6 +152,7 @@ obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o - obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o - obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o - obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o -+obj-$(CONFIG_SENSORS_SBTSI) += sbtsi_temp.o - obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o - obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o - obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o -diff --git a/drivers/hwmon/sbtsi_temp.c b/drivers/hwmon/sbtsi_temp.c -new file mode 100644 -index 000000000000..e3ad6a9f7ec1 ---- /dev/null -+++ b/drivers/hwmon/sbtsi_temp.c -@@ -0,0 +1,259 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later -+/* -+ * sbtsi_temp.c - hwmon driver for a SBI Temperature Sensor Interface (SB-TSI) -+ * compliant AMD SoC temperature device. -+ * -+ * Copyright (c) 2020, Google Inc. -+ * Copyright (c) 2020, Kun Yi -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+ * SB-TSI registers only support SMBus byte data access. "_INT" registers are -+ * the integer part of a temperature value or limit, and "_DEC" registers are -+ * corresponding decimal parts. -+ */ -+#define SBTSI_REG_TEMP_INT 0x01 /* RO */ -+#define SBTSI_REG_STATUS 0x02 /* RO */ -+#define SBTSI_REG_CONFIG 0x03 /* RO */ -+#define SBTSI_REG_TEMP_HIGH_INT 0x07 /* RW */ -+#define SBTSI_REG_TEMP_LOW_INT 0x08 /* RW */ -+#define SBTSI_REG_TEMP_DEC 0x10 /* RW */ -+#define SBTSI_REG_TEMP_HIGH_DEC 0x13 /* RW */ -+#define SBTSI_REG_TEMP_LOW_DEC 0x14 /* RW */ -+#define SBTSI_REG_REV 0xFF /* RO */ -+ -+#define SBTSI_CONFIG_READ_ORDER_SHIFT 5 -+ -+#define SBTSI_TEMP_MIN 0 -+#define SBTSI_TEMP_MAX 255875 -+#define SBTSI_REV_MAX_VALID_ID 4 -+ -+/* Each client has this additional data */ -+struct sbtsi_data { -+ struct i2c_client *client; -+ struct mutex lock; -+}; -+ -+/* -+ * From SB-TSI spec: CPU temperature readings and limit registers encode the -+ * temperature in increments of 0.125 from 0 to 255.875. The "high byte" -+ * register encodes the base-2 of the integer portion, and the upper 3 bits of -+ * the "low byte" encode in base-2 the decimal portion. -+ * -+ * e.g. INT=0x19, DEC=0x20 represents 25.125 degrees Celsius -+ * -+ * Therefore temperature in millidegree Celsius = -+ * (INT + DEC / 256) * 1000 = (INT * 8 + DEC / 32) * 125 -+ */ -+static inline int sbtsi_reg_to_mc(s32 integer, s32 decimal) -+{ -+ return ((integer << 3) + (decimal >> 5)) * 125; -+} -+ -+/* -+ * Inversely, given temperature in millidegree Celsius -+ * INT = (TEMP / 125) / 8 -+ * DEC = ((TEMP / 125) % 8) * 32 -+ * Caller have to make sure temp doesn't exceed 255875, the max valid value. -+ */ -+static inline void sbtsi_mc_to_reg(s32 temp, u8 *integer, u8 *decimal) -+{ -+ temp /= 125; -+ *integer = temp >> 3; -+ *decimal = (temp & 0x7) << 5; -+} -+ -+static int sbtsi_read(struct device *dev, enum hwmon_sensor_types type, -+ u32 attr, int channel, long *val) -+{ -+ struct sbtsi_data *data = dev_get_drvdata(dev); -+ s32 temp_int, temp_dec; -+ int err, reg_int, reg_dec; -+ u8 read_order; -+ -+ if (type != hwmon_temp) -+ return -EINVAL; -+ -+ read_order = 0; -+ switch (attr) { -+ case hwmon_temp_input: -+ /* -+ * ReadOrder bit specifies the reading order of integer and -+ * decimal part of CPU temp for atomic reads. If bit == 0, -+ * reading integer part triggers latching of the decimal part, -+ * so integer part should be read first. If bit == 1, read -+ * order should be reversed. -+ */ -+ err = i2c_smbus_read_byte_data(data->client, SBTSI_REG_CONFIG); -+ if (err < 0) -+ return err; -+ -+ read_order = (u8)err & BIT(SBTSI_CONFIG_READ_ORDER_SHIFT); -+ reg_int = SBTSI_REG_TEMP_INT; -+ reg_dec = SBTSI_REG_TEMP_DEC; -+ break; -+ case hwmon_temp_max: -+ reg_int = SBTSI_REG_TEMP_HIGH_INT; -+ reg_dec = SBTSI_REG_TEMP_HIGH_DEC; -+ break; -+ case hwmon_temp_min: -+ reg_int = SBTSI_REG_TEMP_LOW_INT; -+ reg_dec = SBTSI_REG_TEMP_LOW_DEC; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ if (read_order == 0) { -+ temp_int = i2c_smbus_read_byte_data(data->client, reg_int); -+ temp_dec = i2c_smbus_read_byte_data(data->client, reg_dec); -+ } else { -+ temp_dec = i2c_smbus_read_byte_data(data->client, reg_dec); -+ temp_int = i2c_smbus_read_byte_data(data->client, reg_int); -+ } -+ -+ if (temp_int < 0) -+ return temp_int; -+ if (temp_dec < 0) -+ return temp_dec; -+ -+ *val = sbtsi_reg_to_mc(temp_int, temp_dec); -+ -+ return 0; -+} -+ -+static int sbtsi_write(struct device *dev, enum hwmon_sensor_types type, -+ u32 attr, int channel, long val) -+{ -+ struct sbtsi_data *data = dev_get_drvdata(dev); -+ int reg_int, reg_dec, err; -+ u8 temp_int, temp_dec; -+ -+ if (type != hwmon_temp) -+ return -EINVAL; -+ -+ switch (attr) { -+ case hwmon_temp_max: -+ reg_int = SBTSI_REG_TEMP_HIGH_INT; -+ reg_dec = SBTSI_REG_TEMP_HIGH_DEC; -+ break; -+ case hwmon_temp_min: -+ reg_int = SBTSI_REG_TEMP_LOW_INT; -+ reg_dec = SBTSI_REG_TEMP_LOW_DEC; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ val = clamp_val(val, SBTSI_TEMP_MIN, SBTSI_TEMP_MAX); -+ mutex_lock(&data->lock); -+ sbtsi_mc_to_reg(val, &temp_int, &temp_dec); -+ err = i2c_smbus_write_byte_data(data->client, reg_int, temp_int); -+ if (err) -+ goto exit; -+ -+ err = i2c_smbus_write_byte_data(data->client, reg_dec, temp_dec); -+exit: -+ mutex_unlock(&data->lock); -+ return err; -+} -+ -+static umode_t sbtsi_is_visible(const void *data, -+ enum hwmon_sensor_types type, -+ u32 attr, int channel) -+{ -+ switch (type) { -+ case hwmon_temp: -+ switch (attr) { -+ case hwmon_temp_input: -+ return 0444; -+ case hwmon_temp_min: -+ return 0644; -+ case hwmon_temp_max: -+ return 0644; -+ } -+ break; -+ default: -+ break; -+ } -+ return 0; -+} -+ -+static const struct hwmon_channel_info *sbtsi_info[] = { -+ HWMON_CHANNEL_INFO(chip, -+ HWMON_C_REGISTER_TZ), -+ HWMON_CHANNEL_INFO(temp, -+ HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX), -+ NULL -+}; -+ -+static const struct hwmon_ops sbtsi_hwmon_ops = { -+ .is_visible = sbtsi_is_visible, -+ .read = sbtsi_read, -+ .write = sbtsi_write, -+}; -+ -+static const struct hwmon_chip_info sbtsi_chip_info = { -+ .ops = &sbtsi_hwmon_ops, -+ .info = sbtsi_info, -+}; -+ -+static int sbtsi_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct device *dev = &client->dev; -+ struct device *hwmon_dev; -+ struct sbtsi_data *data; -+ -+ data = devm_kzalloc(dev, sizeof(struct sbtsi_data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ data->client = client; -+ mutex_init(&data->lock); -+ -+ hwmon_dev = -+ devm_hwmon_device_register_with_info(dev, client->name, data, -+ &sbtsi_chip_info, NULL); -+ -+ return PTR_ERR_OR_ZERO(hwmon_dev); -+} -+ -+static const struct i2c_device_id sbtsi_id[] = { -+ {"sbtsi", 0}, -+ {} -+}; -+MODULE_DEVICE_TABLE(i2c, sbtsi_id); -+ -+static const struct of_device_id __maybe_unused sbtsi_of_match[] = { -+ { -+ .compatible = "amd,sbtsi", -+ }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, sbtsi_of_match); -+ -+static struct i2c_driver sbtsi_driver = { -+ .class = I2C_CLASS_HWMON, -+ .driver = { -+ .name = "sbtsi", -+ .of_match_table = of_match_ptr(sbtsi_of_match), -+ }, -+ .probe = sbtsi_probe, -+ .id_table = sbtsi_id, -+}; -+ -+module_i2c_driver(sbtsi_driver); -+ -+MODULE_AUTHOR("Kun Yi "); -+MODULE_DESCRIPTION("Hwmon driver for AMD SB-TSI emulated sensor"); -+MODULE_LICENSE("GPL"); --- -2.26.0.292.g33ef6b2f38-goog \ No newline at end of file diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend index 4de4ca900..e5fadfe05 100644 --- a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend @@ -1,6 +1,5 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/linux-nuvoton:" SRC_URI_append_gbs = " file://gbs.cfg" -SRC_URI_append_gbs = " file://0003-Add-basic-support-for-SB-TSI-sensors.patch" SRC_URI_append_gbs = " file://0004-Add-kernel-seven-seg-display-support.patch" SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch" SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch" -- cgit v1.2.3 From 01439a98f9b7b599ac02da3d90bc1954aee86cd8 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 13 May 2021 15:17:21 +0800 Subject: meta-quanta: gbs: srcrev bump f7d2dbd6b4..3b39e92a8 David Wang(1): Fix missing includes Signed-off-by: George Hung Change-Id: I95a1f9081c1db5eb858fd5202d35a3e9b772e436 --- meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb index a3f0c58d9..21ef52c49 100644 --- a/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb @@ -12,7 +12,7 @@ DEPENDS += "boost" DEPENDS += "libgpiod" SRC_URI = "git://github.com/quanta-bmc/nvme-power-control;protocol=git" -SRCREV = "f7d2dbd6b48f3992d4a2fb1c0fe2afd746b8428a" +SRCREV = "3b39e92a8340d8ba1bd40a03af3f5a9049da3bc7" S = "${WORKDIR}/git" -- cgit v1.2.3 From 036c136642dcf766b5a98b19c891cc35ef3e26dd Mon Sep 17 00:00:00 2001 From: Benjamin Fair Date: Tue, 16 Mar 2021 18:32:08 -0700 Subject: meta-quanta: gbs: move to nuvoton-p2a-mbox PACKAGECONFIG Use the PACKAGECONFIG option instead of setting the configure argument directly. Change-Id: I514138c63d58af1a0d83815241410a679a859d73 Signed-off-by: Benjamin Fair --- .../meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta-quanta') 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}" -- cgit v1.2.3 From 8b57342767da8044620172886a4d9ca004acef5d Mon Sep 17 00:00:00 2001 From: Brandon Kim Date: Fri, 14 May 2021 14:34:06 -0700 Subject: meta-quanta: gbs: Lower pwm-fan-controller CRITLO Lower CRITLO parameter to 1500. Signed-off-by: Brandon Kim Change-Id: I34383068cf1a3469a4f946bac862a60398634f62 --- .../obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'meta-quanta') 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 -- cgit v1.2.3 From f5f78f62d720ef57a54660927ba9a45515243190 Mon Sep 17 00:00:00 2001 From: George Hung Date: Mon, 17 May 2021 10:10:14 +0800 Subject: meta-quanta: gbs: enable fallback watchdog Enable fallback watchdog since it is possible that host fails to boot before enabling the watchdog timer at all Signed-off-by: George Hung Change-Id: I4eeb48b618cd6aba3e48dd1337ea69e3ce8292c6 --- .../recipes-phosphor/watchdog/phosphor-watchdog/obmc/watchdog/host0 | 3 +++ .../watchdog/phosphor-watchdog/phosphor-watchdog@.service | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'meta-quanta') 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 index c0f04ef03..27c438d90 100644 --- 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 @@ -3,3 +3,6 @@ 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-watchdog@.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service index df11b22e5..4577cd1c1 100644 --- 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 @@ -4,7 +4,8 @@ Description=Phosphor Watchdog [Service] EnvironmentFile={envfiledir}/obmc/watchdog/%I ExecStart=/usr/bin/env phosphor-watchdog --service=${{SERVICE}} --path=${{DEVPATH}} \ - --continue \ + --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}} -- cgit v1.2.3 From a57d39af54bca0158112b4a10431a5bb334b23d8 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 17 May 2021 15:27:43 -0700 Subject: meta-quanta: gsj: Remove networkd override We don't need to override this option anymore as the network will be configured correctly without it. Change-Id: Icdc7bb645afa18c12cb5d16337d13cdab7b3e339 Signed-off-by: William A. Kennington III --- .../meta-gsj/recipes-phosphor/network/phosphor-network_%.bbappend | 1 - 1 file changed, 1 deletion(-) delete mode 100644 meta-quanta/meta-gsj/recipes-phosphor/network/phosphor-network_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gsj/recipes-phosphor/network/phosphor-network_%.bbappend b/meta-quanta/meta-gsj/recipes-phosphor/network/phosphor-network_%.bbappend deleted file mode 100644 index 730c62d5f..000000000 --- a/meta-quanta/meta-gsj/recipes-phosphor/network/phosphor-network_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -EXTRA_OECONF_gsj += " --disable-link-local-autoconfiguration" -- cgit v1.2.3 From 301b0fb16f48dbb138905ff8dc7606396af405ff Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 17 May 2021 15:26:26 -0700 Subject: meta-quanta: gbs: Remove autotools specific config We want to use packageconfig options instead of build system specific ones. Change-Id: Ib0b293c457ea418e98d294da9796c7b103209888 Signed-off-by: William A. Kennington III --- .../meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'meta-quanta') 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 7bf73aee7..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,3 +1,2 @@ -EXTRA_OECONF_append_gbs = " --enable-nic-ethtool=yes" - +PACKAGECONFIG_append_gbs = " nic-ethtool" PACKAGECONFIG_remove_gbs = "uboot-env" -- cgit v1.2.3 From 53a19ec702db8f1b63baf6e57d7f293c6272578f Mon Sep 17 00:00:00 2001 From: George Hung Date: Tue, 18 May 2021 12:21:16 +0800 Subject: meta-quanta: gbs: change to 100% for failsafe thermal requirement Signed-off-by: George Hung Change-Id: I47e3efaf6d5bef277821e2731a9886783371a2aa --- .../acpi-power-state-daemon/gbs-host-s0-set-failsafe.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-host-s0-set-failsafe.service b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-host-s0-set-failsafe.service index 263cafaa2..ccc6a1c20 100644 --- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-host-s0-set-failsafe.service +++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-host-s0-set-failsafe.service @@ -8,8 +8,8 @@ After=mapper-wait@-xyz-openbmc_project-settings-fanctrl.service [Service] Type=oneshot -# 230: 90% duty cycle -ExecStart=/usr/bin/gbs-set-failsafe.sh 230 +# 255: 100% duty cycle +ExecStart=/usr/bin/gbs-set-failsafe.sh 255 [Install] WantedBy=host-s0-state.target -- cgit v1.2.3 From 04fa7fa906a548beb1012f3583a194a6b9798244 Mon Sep 17 00:00:00 2001 From: George Hung Date: Tue, 18 May 2021 20:44:34 +0800 Subject: meta-quanta: gbs: update the GBS console redirect setting Commit the GBS console redirect setting for obmc-console Signed-off-by: George Hung Change-Id: If4b39537bc71a00def2d788a24ab06bd1f40a6ad --- meta-quanta/meta-gbs/conf/machine/gbs.conf | 1 + .../recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules | 1 - .../recipes-phosphor/console/obmc-console_%.bbappend | 13 ++----------- 3 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/conf/machine/gbs.conf b/meta-quanta/meta-gbs/conf/machine/gbs.conf index 9a99b5b01..6814e0212 100644 --- a/meta-quanta/meta-gbs/conf/machine/gbs.conf +++ b/meta-quanta/meta-gbs/conf/machine/gbs.conf @@ -10,6 +10,7 @@ MACHINEOVERRIDES .= ":npcm7xx" require conf/machine/include/npcm7xx.inc require conf/machine/include/obmc-bsp-common.inc +SERIAL_CONSOLES = "115200;ttyS0" GBMC_NCSI_IF_NAME = "eth0" GBMC_KCS_DEV = "ipmi-kcs1" 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" -- cgit v1.2.3 From 67ddc2125421f5d45f13f8550b9d06efb4bff2b7 Mon Sep 17 00:00:00 2001 From: Bruceleequantatw Date: Wed, 17 Mar 2021 10:08:48 +0800 Subject: meta-quanta: common: add bmc_health_config This config will not set threshold and to avoid critical/warning message shows on journalctl. Signed-off-by: Bruceleequantatw Change-Id: Ic6ba793ce7ed16e16a79c5b79f748f78b35ce0cd --- .../recipes-phosphor/health/files/bmc_health_config.json | 15 +++++++++++++++ .../health/phosphor-health-monitor_%.bbappend | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100755 meta-quanta/meta-common/recipes-phosphor/health/files/bmc_health_config.json create mode 100755 meta-quanta/meta-common/recipes-phosphor/health/phosphor-health-monitor_%.bbappend (limited to 'meta-quanta') diff --git a/meta-quanta/meta-common/recipes-phosphor/health/files/bmc_health_config.json b/meta-quanta/meta-common/recipes-phosphor/health/files/bmc_health_config.json new file mode 100755 index 000000000..373b5d50f --- /dev/null +++ b/meta-quanta/meta-common/recipes-phosphor/health/files/bmc_health_config.json @@ -0,0 +1,15 @@ +{ + "CPU" : { + "Frequency" : 1, + "Window_size": 120 + }, + "Memory" : { + "Frequency" : 1, + "Window_size": 120 + }, + "Storage_RW" : { + "Path" : "/run/initramfs/rw", + "Frequency" : 1, + "Window_size": 120 + } +} diff --git a/meta-quanta/meta-common/recipes-phosphor/health/phosphor-health-monitor_%.bbappend b/meta-quanta/meta-common/recipes-phosphor/health/phosphor-health-monitor_%.bbappend new file mode 100755 index 000000000..1d8bb4ecd --- /dev/null +++ b/meta-quanta/meta-common/recipes-phosphor/health/phosphor-health-monitor_%.bbappend @@ -0,0 +1,9 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +SRC_URI_append = " file://bmc_health_config.json \ + " + +do_install_append() { + install -d ${D}/${sysconfdir}/healthMon/ + install -m 0644 ${WORKDIR}/bmc_health_config.json ${D}/${sysconfdir}/healthMon/ +} + -- cgit v1.2.3 From e60f2ac8edee81330272e495efad5b77c770d0f2 Mon Sep 17 00:00:00 2001 From: George Hung Date: Thu, 20 May 2021 18:53:06 +0800 Subject: meta-quanta: gbs: add the virtual provider for gbs-bios-update Signed-off-by: George Hung Change-Id: I032031d25b0755611e870c779792844ef87d9e57 --- meta-quanta/meta-gbs/conf/machine/gbs.conf | 1 + meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb | 3 +++ .../meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'meta-quanta') diff --git a/meta-quanta/meta-gbs/conf/machine/gbs.conf b/meta-quanta/meta-gbs/conf/machine/gbs.conf index 6814e0212..6f54e383b 100644 --- a/meta-quanta/meta-gbs/conf/machine/gbs.conf +++ b/meta-quanta/meta-gbs/conf/machine/gbs.conf @@ -38,6 +38,7 @@ PREFERRED_PROVIDER_virtual/obmc-fan-mgmt = "packagegroup-gbs-apps" PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-gbs-apps" PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw = "gbmc-kcs-config" PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "gbs-led-manager-config-native" +PREFERRED_PROVIDER_virtual/bios-update = "gbs-bios-update" # Remove unneeded binaries from image IMAGE_FEATURES_remove = "obmc-fan-control" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb index 32b9d512b..0ea731c35 100644 --- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb @@ -12,6 +12,9 @@ DEPENDS += "systemd" DEPENDS += "phosphor-ipmi-flash" RDEPENDS_${PN} += "bash" +PROVIDES += "virtual/bios-update" +RPROVIDES_${PN} += "virtual/bios-update" + SRC_URI += " file://bios-verify.sh \ file://bios-update.sh \ file://phosphor-ipmi-flash-bios-verify.service \ 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 \ " -- cgit v1.2.3