From 45a89b65e97053842bcb6a468ec1b3e454edb8c9 Mon Sep 17 00:00:00 2001 From: "Thang Q. Nguyen" Date: Fri, 16 Sep 2022 14:26:53 +0700 Subject: meta-ampere: mtjade: use phosphor-multi-gpio to handle GPIO events Change to use phosphor-multi-gpio-monitor to handle all GPIO events from Altra Host. Tested: 1. Run reboot command from Host OS and check if Host can reboot and then boot to OS. 2. Run shutdown command from Host OS and check if PowerState change to Off after complete. 3. Check SCP failover handling. 4. Check PSU Hotswap workaround is applied when hot plugging/unplugging PSUs Signed-off-by: Thang Q. Nguyen Change-Id: I9797b51facf31672a6d2c9bc7ab7add24d8e06b8 --- .../recipes-phosphor/gpio/ampere-gpio-handling.bb | 39 +----------- .../ampere-host-shutdown-ack@.service | 8 --- .../ampere_fault_led_start@.service | 10 --- .../ampere_fault_led_stop@.service | 10 --- .../ampere-gpio-handling/ampere_overtemp@.service | 7 --- .../ampere_psu_reset_hotswap.sh | 72 ---------------------- .../ampere_scp_failover.service | 6 -- .../ampere-gpio-handling/ampere_scp_failover.sh | 34 ---------- .../ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD | 4 -- .../ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD | 4 -- .../obmc/gpio/S0_fault_alert_start | 5 -- .../obmc/gpio/S0_fault_alert_stop | 5 -- .../ampere-gpio-handling/obmc/gpio/S0_overtemp | 4 -- .../obmc/gpio/S0_scp_auth_failure | 4 -- .../obmc/gpio/S1_fault_alert_start | 5 -- .../obmc/gpio/S1_fault_alert_stop | 5 -- .../ampere-gpio-handling/obmc/gpio/S1_overtemp | 4 -- .../gpio/ampere-gpio-handling/obmc/gpio/reboot_ack | 4 -- .../ampere-gpio-handling/obmc/gpio/shutdown_ack | 4 -- .../psu_hotswap_reset@.service | 6 -- .../gpio/ampere-gpio-handling/toggle_fault_led.sh | 30 --------- .../ampere-gpio-handling/toggle_identify_led.sh | 31 ---------- .../ampere-host-shutdown-ack@.service | 8 +++ .../phosphor-gpio-monitor/ampere_overtemp@.service | 7 +++ .../ampere_psu_reset_hotswap.sh | 72 ++++++++++++++++++++++ .../ampere_scp_failover.service | 6 ++ .../phosphor-gpio-monitor/ampere_scp_failover.sh | 34 ++++++++++ .../phosphor-multi-gpio-monitor.json | 53 ++++++++++++++++ .../psu_hotswap_reset@.service | 6 ++ .../gpio/phosphor-gpio-monitor_%.bbappend | 35 +++++++++++ 30 files changed, 223 insertions(+), 299 deletions(-) delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service delete mode 100755 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service delete mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh delete mode 100755 meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-shutdown-ack@.service create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_overtemp@.service create mode 100755 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_psu_reset_hotswap.sh create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.service create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.sh create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/psu_hotswap_reset@.service create mode 100644 meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend (limited to 'meta-ampere') diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling.bb b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling.bb index 2889517c43..16fde56247 100644 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling.bb +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling.bb @@ -9,38 +9,16 @@ DEPENDS += "virtual/obmc-gpio-monitor" RDEPENDS:${PN} += "virtual/obmc-gpio-monitor" RDEPENDS:${PN} += "bash" -SRC_URI += " \ - file://toggle_fault_led.sh \ - file://ampere_psu_reset_hotswap.sh \ - file://toggle_identify_led.sh \ - file://ampere_scp_failover.sh \ - " - AMPERE_MONITOR_INSTANCES = " \ - reboot_ack shutdown_ack id_button S0_scp_auth_failure \ - S0_overtemp S0_hightemp_start S0_hightemp_stop \ - S1_overtemp S1_hightemp_start S1_hightemp_stop \ - S0_fault_alert_start S0_fault_alert_stop \ - S1_fault_alert_start S1_fault_alert_stop \ - PSU1_VIN_GOOD PSU2_VIN_GOOD \ + S0_hightemp_start S0_hightemp_stop \ + S1_hightemp_start S1_hightemp_stop \ " SYSTEMD_ENVIRONMENT_FILE:${PN} +=" \ - obmc/gpio/reboot_ack \ - obmc/gpio/shutdown_ack \ - obmc/gpio/S0_scp_auth_failure \ - obmc/gpio/S0_overtemp \ obmc/gpio/S0_hightemp_start \ obmc/gpio/S0_hightemp_stop \ - obmc/gpio/S1_overtemp \ obmc/gpio/S1_hightemp_start \ obmc/gpio/S1_hightemp_stop \ - obmc/gpio/S0_fault_alert_start \ - obmc/gpio/S0_fault_alert_stop \ - obmc/gpio/S1_fault_alert_start \ - obmc/gpio/S1_fault_alert_stop \ - obmc/gpio/PSU1_VIN_GOOD \ - obmc/gpio/PSU2_VIN_GOOD \ " TMPL = "phosphor-gpio-monitor@.service" @@ -49,21 +27,8 @@ TGT = "multi-user.target" FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}" SYSTEMD_SERVICE:${PN} += " \ - ampere-host-shutdown-ack@.service \ - ampere_overtemp@.service \ ampere_hightemp_start@.service \ ampere_hightemp_stop@.service \ - ampere_fault_led_start@.service \ - ampere_fault_led_stop@.service \ - psu_hotswap_reset@.service \ - ampere_scp_failover.service \ " SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT', 'AMPERE_MONITOR_INSTANCES')}" -do_install() { - install -d ${D}${sbindir} - install -m 0755 ${WORKDIR}/toggle_fault_led.sh ${D}${sbindir}/ - install -m 0755 ${WORKDIR}/toggle_identify_led.sh ${D}${sbindir}/ - install -m 0755 ${WORKDIR}/ampere_psu_reset_hotswap.sh ${D}${sbindir}/ - install -m 0755 ${WORKDIR}/ampere_scp_failover.sh ${D}${sbindir}/ -} diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service deleted file mode 100644 index 6588191aae..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Ampere Computing LLC host shutdown ACK -Conflicts=obmc-chassis-poweron@0.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/env ampere_power_util.sh mb shutdown_ack -SyslogIdentifier=ampere_host_shutdown_ack diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service deleted file mode 100644 index 18ee1bee52..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Ampere Computing LLC fault event condition service -Wants=mapper-wait@-xyz-openbmc_project-led-groups.service -After=mapper-wait@-xyz-openbmc_project-led-groups.service -StartLimitIntervalSec=0 - -[Service] -Type=oneshot -ExecStart=/usr/bin/env toggle_fault_led.sh %i on -SyslogIdentifier=fault-led diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service deleted file mode 100644 index 83f442cef4..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Ampere Computing LLC fault event condition service -Wants=mapper-wait@-xyz-openbmc_project-led-groups.service -After=mapper-wait@-xyz-openbmc_project-led-groups.service -StartLimitIntervalSec=0 - -[Service] -Type=oneshot -ExecStart=/usr/bin/env toggle_fault_led.sh %i off -SyslogIdentifier=fault-led diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service deleted file mode 100644 index 587cba195d..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Ampere Computing LLC Overtemp event - -[Service] -Restart=no -ExecStart=/usr/bin/env obmcutil chassisoff -ExecStartPost=/usr/bin/env ampere_add_redfishevent.sh OpenBMC.0.1.CPUThermalTrip.Critical %i diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh deleted file mode 100755 index 3ff3e1fc6a..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -# When system only use single PSU ( ex : PSU1 ) to power ON normal 12V, -# HSC2 will be trigged Fault event (FET health). -# At this time, to plug-in PSU2 in system, PSU2 won't deliver power to -# +12V_MB because HSC2 is protected by Fault event. -# Due to HSC2 protected, the PSU redundancy mechanism can't be created. -# Once PSU1 is plugged out at this moment, system will crash ( reset ) -# because +12V_MB dropped. - -# BMC SW work-around solution: -# - When BMC detect event PSU is plugged in system, BMC will reset HSC -# by disbale HOT SWAP and then enable HOT SWAP through pmbus command to clear -# Fault event. - -# Note: -# In case hot swap occurs during BMC reset, BMC still not in operation state, -# BMC can't detect PSU plug/unplug, then the work-around won't be executed - -# Author: Chanh Nguyen - -HSC1_PMBUS_NUM=10 -HSC2_PMBUS_NUM=10 -HSC1_SLAVE_ADDR=0x10 -HSC2_SLAVE_ADDR=0x11 -OPERATION=0x01 -STATUS_MFR_SPECIFIC=0x80 - -# $1 will be the name of the psu -PSU=$1 - -if [ "$PSU" = 0 ]; then - HSC_PMBUS_NUM=$HSC1_PMBUS_NUM - HSC_SLAVE_ADDR=$HSC1_SLAVE_ADDR -elif [ "$PSU" = 1 ]; then - HSC_PMBUS_NUM=$HSC2_PMBUS_NUM - HSC_SLAVE_ADDR=$HSC2_SLAVE_ADDR -else - echo "Please choose PSU1 (0) or PSU2 (1)" - echo "Ex: ampere_psu_reset_hotswap.sh 0" - exit 0 -fi - -# Check HOST state -chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}') -if [ "$chassisstate" = 'Off' ]; then - echo "HOST is being OFF, so can't access the i2c $HSC_PMBUS_NUM. Please Turn ON HOST !" - exit 1 -fi - -# Check FET health problems -if ! data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC); then - echo "ERROR: Can't access the i2c. Please check /dev/i2c-$HSC_PMBUS_NUM" - exit 1 -fi - -psu_sts=$(((data & 0x80) != 0)) - -if [ $psu_sts = 1 ]; then - echo "PSU $PSU: FET health problems have been detected" - echo "Reset Hot swap output on PSU $PSU" - # Disable Hot swap output - write_data=0x00 - i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b - - # Enable Hot swap output - write_data=0x80; - i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b - -else - echo "PSU $PSU: FET health problems have not been detected" -fi diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service deleted file mode 100644 index ff4dec57a3..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service +++ /dev/null @@ -1,6 +0,0 @@ -[Unit] -Description=Ampere Computing LLC Ampere failover event service - -[Service] -Restart=no -ExecStart=/usr/bin/env ampere_scp_failover.sh diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh deleted file mode 100644 index c1c16aba5c..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Handle the SCP Failover feature in which: -# - If the BMC receives the SCP_AUTH_FAILURE signal from Socket0, -# attempts to boot from the failover boot EEPROM. -# - If the second boot fails, treats this as a permanent boot failure -# and logs an event in SEL. - -# shellcheck disable=SC1091 -# shellcheck disable=SC2046 - -source /usr/sbin/gpio-lib.sh -source /usr/sbin/gpio-defs.sh - -# Check the I2C_BACKUP_SEL -I2C_BACKUP_SEL=$(gpio_get_val "$BMC_I2C_BACKUP_SEL") -if [ "${I2C_BACKUP_SEL}" == "1" ]; then - # If it is HIGH, set it LOW. Then reset the Host to boot from - # the failover Boot EEPROM. - echo "scp-failover: switch HOST to failover boot EEPROM" - gpioset $(gpiofind BMC_SELECT_EEPROM)=0 - - # Reset the Host to boot on the failover EEPROM - ampere_power_util.sh mb force_reset -else - # Turn OFF Host as SCP firmware on both Boot EEPROM fail - obmcutil chassisoff - - echo "scp-failover: switch HOST back to the main Boot EEPROM" - gpioset $(gpiofind BMC_SELECT_EEPROM)=1 - - # Log event - ampere_add_redfishevent.sh OpenBMC.0.1.GeneralFirmwareSecurityViolation.Critical "SCP Authentication failure" -fi diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD deleted file mode 100644 index cf13085b1d..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=60 -POLARITY=0 -TARGET=psu_hotswap_reset@0.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD deleted file mode 100644 index 7588c2595c..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=61 -POLARITY=0 -TARGET=psu_hotswap_reset@1.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start deleted file mode 100644 index c13da449c7..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start +++ /dev/null @@ -1,5 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=73 -POLARITY=1 -TARGET=ampere_fault_led_start@0.service -EXTRA_ARGS=--continue diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop deleted file mode 100644 index 7233f881a8..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop +++ /dev/null @@ -1,5 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=73 -POLARITY=0 -TARGET=ampere_fault_led_stop@0.service -EXTRA_ARGS=--continue diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp deleted file mode 100644 index e39e196805..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=51 -POLARITY=1 -TARGET=ampere_overtemp@0.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure deleted file mode 100644 index e8e975f9f0..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=74 -POLARITY=1 -TARGET=ampere_scp_failover.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start deleted file mode 100644 index 6fa47857bf..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start +++ /dev/null @@ -1,5 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=201 -POLARITY=1 -TARGET=ampere_fault_led_start@1.service -EXTRA_ARGS=--continue diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop deleted file mode 100644 index 36b29ec462..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop +++ /dev/null @@ -1,5 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=201 -POLARITY=0 -TARGET=ampere_fault_led_stop@1.service -EXTRA_ARGS=--continue diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp deleted file mode 100644 index c7bb8c1bc4..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/by-path/platform-gpio-keys-event -KEY=206 -POLARITY=1 -TARGET=ampere_overtemp@1.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack deleted file mode 100644 index a8ad98ee75..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/event0 -KEY=75 -POLARITY=1 -TARGET=obmc-host-force-warm-reboot@0.target diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack deleted file mode 100644 index 18cc87246f..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack +++ /dev/null @@ -1,4 +0,0 @@ -DEVPATH=/dev/input/event0 -KEY=50 -POLARITY=1 -TARGET=ampere-host-shutdown-ack@0.service diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service deleted file mode 100644 index 357cc05383..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service +++ /dev/null @@ -1,6 +0,0 @@ -[Unit] -Description=Ampere Computing LLC PSU1 reset hotswap - -[Service] -Restart=no -ExecStart=/usr/sbin/ampere_psu_reset_hotswap.sh %i diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh deleted file mode 100644 index 58aa47f8e8..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Toggle the state of identify LED Group - -socket=$1 -isOn=$2 - -# Create /tmp/fault* file -if [ "$isOn" == "on" ]; then - touch /tmp/fault"$socket" -else - rm /tmp/fault"$socket" -fi - -# Set Fault Led state -if [[ -f /tmp/fault0 ]] || [[ -f /tmp/fault1 ]]; then - target='true' -else - target='false' -fi - -SERVICE="xyz.openbmc_project.LED.GroupManager" -INTERFACE="xyz.openbmc_project.Led.Group" -PROPERTY="Asserted" - -# Get current state -object=$(busctl tree $SERVICE --list | grep system_fault) - -# Set target state -busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh deleted file mode 100755 index f6eae0e245..0000000000 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# Toggle the state of identify LED Group - -SERVICE="xyz.openbmc_project.LED.GroupManager" -INTERFACE="xyz.openbmc_project.Led.Group" -PROPERTY="Asserted" - -# Get enclosure_identify state -identify_object=$(busctl tree $SERVICE --list | grep -m 1 identify) -identify_state=$(busctl get-property $SERVICE "$identify_object" $INTERFACE $PROPERTY \ - | awk '{print $NF;}') - -# Get enclosure_identify_blink state -identify_blink_object=$(busctl tree $SERVICE --list | grep identify_blink) -identify_blink_state=$(busctl get-property $SERVICE "$identify_blink_object" $INTERFACE $PROPERTY \ - | awk '{print $NF;}') - -# Set state -if [ "$identify_state" = "false" ] && [ "$identify_blink_state" = "false" ]; then - # Turn on the UID LED - busctl set-property $SERVICE "$identify_object" $INTERFACE $PROPERTY b true -elif [ "$identify_state" = "false" ] && [ "$identify_blink_state" = "true" ]; then - # Turn off the UID LED when LED is blinking state - busctl set-property $SERVICE "$identify_blink_object" $INTERFACE $PROPERTY b false -elif [ "$identify_state" = "true" ] && [ "$identify_blink_state" = "false" ]; then - # Turn off the UID LED - busctl set-property $SERVICE "$identify_object" $INTERFACE $PROPERTY b false -else - echo "Invalid case! When identify_blink_state is true, the identify_state will set to false" -fi diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-shutdown-ack@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-shutdown-ack@.service new file mode 100644 index 0000000000..6588191aae --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-shutdown-ack@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Ampere Computing LLC host shutdown ACK +Conflicts=obmc-chassis-poweron@0.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/env ampere_power_util.sh mb shutdown_ack +SyslogIdentifier=ampere_host_shutdown_ack diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_overtemp@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_overtemp@.service new file mode 100644 index 0000000000..a3efc9ff99 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_overtemp@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Ampere Computing LLC Overtemp event + +[Service] +Restart=no +ExecStart=/bin/sh -c "touch /tmp/fault_overtemp && obmcutil chassisoff" +ExecStartPost=/bin/sh -c "ampere_add_redfishevent.sh OpenBMC.0.1.CPUThermalTrip.Critical %i && sleep 10 && rm /tmp/fault_overtemp" diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_psu_reset_hotswap.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_psu_reset_hotswap.sh new file mode 100755 index 0000000000..3ff3e1fc6a --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_psu_reset_hotswap.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# When system only use single PSU ( ex : PSU1 ) to power ON normal 12V, +# HSC2 will be trigged Fault event (FET health). +# At this time, to plug-in PSU2 in system, PSU2 won't deliver power to +# +12V_MB because HSC2 is protected by Fault event. +# Due to HSC2 protected, the PSU redundancy mechanism can't be created. +# Once PSU1 is plugged out at this moment, system will crash ( reset ) +# because +12V_MB dropped. + +# BMC SW work-around solution: +# - When BMC detect event PSU is plugged in system, BMC will reset HSC +# by disbale HOT SWAP and then enable HOT SWAP through pmbus command to clear +# Fault event. + +# Note: +# In case hot swap occurs during BMC reset, BMC still not in operation state, +# BMC can't detect PSU plug/unplug, then the work-around won't be executed + +# Author: Chanh Nguyen + +HSC1_PMBUS_NUM=10 +HSC2_PMBUS_NUM=10 +HSC1_SLAVE_ADDR=0x10 +HSC2_SLAVE_ADDR=0x11 +OPERATION=0x01 +STATUS_MFR_SPECIFIC=0x80 + +# $1 will be the name of the psu +PSU=$1 + +if [ "$PSU" = 0 ]; then + HSC_PMBUS_NUM=$HSC1_PMBUS_NUM + HSC_SLAVE_ADDR=$HSC1_SLAVE_ADDR +elif [ "$PSU" = 1 ]; then + HSC_PMBUS_NUM=$HSC2_PMBUS_NUM + HSC_SLAVE_ADDR=$HSC2_SLAVE_ADDR +else + echo "Please choose PSU1 (0) or PSU2 (1)" + echo "Ex: ampere_psu_reset_hotswap.sh 0" + exit 0 +fi + +# Check HOST state +chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}') +if [ "$chassisstate" = 'Off' ]; then + echo "HOST is being OFF, so can't access the i2c $HSC_PMBUS_NUM. Please Turn ON HOST !" + exit 1 +fi + +# Check FET health problems +if ! data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC); then + echo "ERROR: Can't access the i2c. Please check /dev/i2c-$HSC_PMBUS_NUM" + exit 1 +fi + +psu_sts=$(((data & 0x80) != 0)) + +if [ $psu_sts = 1 ]; then + echo "PSU $PSU: FET health problems have been detected" + echo "Reset Hot swap output on PSU $PSU" + # Disable Hot swap output + write_data=0x00 + i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b + + # Enable Hot swap output + write_data=0x80; + i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b + +else + echo "PSU $PSU: FET health problems have not been detected" +fi diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.service new file mode 100644 index 0000000000..ff4dec57a3 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.service @@ -0,0 +1,6 @@ +[Unit] +Description=Ampere Computing LLC Ampere failover event service + +[Service] +Restart=no +ExecStart=/usr/bin/env ampere_scp_failover.sh diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.sh new file mode 100644 index 0000000000..c1c16aba5c --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere_scp_failover.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Handle the SCP Failover feature in which: +# - If the BMC receives the SCP_AUTH_FAILURE signal from Socket0, +# attempts to boot from the failover boot EEPROM. +# - If the second boot fails, treats this as a permanent boot failure +# and logs an event in SEL. + +# shellcheck disable=SC1091 +# shellcheck disable=SC2046 + +source /usr/sbin/gpio-lib.sh +source /usr/sbin/gpio-defs.sh + +# Check the I2C_BACKUP_SEL +I2C_BACKUP_SEL=$(gpio_get_val "$BMC_I2C_BACKUP_SEL") +if [ "${I2C_BACKUP_SEL}" == "1" ]; then + # If it is HIGH, set it LOW. Then reset the Host to boot from + # the failover Boot EEPROM. + echo "scp-failover: switch HOST to failover boot EEPROM" + gpioset $(gpiofind BMC_SELECT_EEPROM)=0 + + # Reset the Host to boot on the failover EEPROM + ampere_power_util.sh mb force_reset +else + # Turn OFF Host as SCP firmware on both Boot EEPROM fail + obmcutil chassisoff + + echo "scp-failover: switch HOST back to the main Boot EEPROM" + gpioset $(gpiofind BMC_SELECT_EEPROM)=1 + + # Log event + ampere_add_redfishevent.sh OpenBMC.0.1.GeneralFirmwareSecurityViolation.Critical "SCP Authentication failure" +fi diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json new file mode 100644 index 0000000000..7b89a145be --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json @@ -0,0 +1,53 @@ +[ + { + "Name": "REBOOT_ACK", + "ChipId": "0", + "GpioNum": 75, + "EventMon": "FALLING", + "Target": "obmc-host-force-warm-reboot@0.target", + "Continue": true + }, + { + "Name": "SHUTDOWN_ACK", + "ChipId": "0", + "GpioNum": 50, + "EventMon": "FALLING", + "Target": "ampere-host-shutdown-ack@0.service", + "Continue": true + }, + { + "Name": "S0_OVERTEMP", + "LineName": "S0_OVERTEMP_L", + "EventMon": "FALLING", + "Target": "ampere_overtemp@0.service", + "Continue": true + }, + { + "Name": "S1_OVERTEMP", + "LineName": "S1_OVERTEMP_L", + "EventMon": "FALLING", + "Target": "ampere_overtemp@1.service", + "Continue": true + }, + { + "Name": "S0_SCP_AUTH_FAIL", + "LineName": "S0_SCP_AUTH_FAIL_L", + "EventMon": "FALLING", + "Target": "ampere_scp_failover.service", + "Continue": true + }, + { + "Name": "PSU1_VIN_GOOD", + "LineName": "PSU1_VIN_GOOD", + "EventMon": "RISING", + "Target": "psu_hotswap_reset@0.service", + "Continue": true + }, + { + "Name": "PSU2_VIN_GOOD", + "LineName": "PSU2_VIN_GOOD", + "EventMon": "RISING", + "Target": "psu_hotswap_reset@1.service", + "Continue": true + } +] diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/psu_hotswap_reset@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/psu_hotswap_reset@.service new file mode 100644 index 0000000000..357cc05383 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor/psu_hotswap_reset@.service @@ -0,0 +1,6 @@ +[Unit] +Description=Ampere Computing LLC PSU1 reset hotswap + +[Service] +Restart=no +ExecStart=/usr/sbin/ampere_psu_reset_hotswap.sh %i diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend new file mode 100644 index 0000000000..f798fee835 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend @@ -0,0 +1,35 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +inherit systemd +inherit obmc-phosphor-systemd + +RDEPENDS:${PN}-monitor += "bash" +RDEPENDS:${PN} += "bash" + +SRC_URI += " \ + file://phosphor-multi-gpio-monitor.json \ + file://ampere_scp_failover.sh \ + file://ampere_psu_reset_hotswap.sh \ + " + +SYSTEMD_SERVICE:${PN}-monitor += " \ + ampere-host-shutdown-ack@.service \ + ampere_overtemp@.service \ + ampere_scp_failover.service \ + psu_hotswap_reset@.service \ + " + +FILES:${PN}-monitor += " \ + /usr/share/${PN}/phosphor-multi-gpio-monitor.json \ + /usr/sbin/ampere_scp_failover.sh \ + /usr/sbin/ampere_psu_reset_hotswap.sh \ + " + +SYSTEMD_LINK:${PN}-monitor:append = " ../phosphor-multi-gpio-monitor.service:multi-user.target.requires/phosphor-multi-gpio-monitor.service" + +do_install:append() { + install -d ${D}${sbindir} + install -m 0644 ${WORKDIR}/phosphor-multi-gpio-monitor.json ${D}${datadir}/${PN}/ + install -m 0755 ${WORKDIR}/ampere_scp_failover.sh ${D}${sbindir}/ + install -m 0755 ${WORKDIR}/ampere_psu_reset_hotswap.sh ${D}${sbindir}/ +} -- cgit v1.2.3