Initial commit
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC host shutdown ACK
|
||||
Conflicts=obmc-chassis-poweron@0.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_power_util.sh mb shutdown_ack
|
||||
SyslogIdentifier=ampere_host_shutdown_ack
|
||||
Executable
+72
@@ -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 <chnguyen@amperecomputing.com>
|
||||
|
||||
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
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC Ampere failover event service
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/usr/sbin/ampere_scp_failover.sh
|
||||
+34
@@ -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
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
[
|
||||
{
|
||||
"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_HIGHTEMP",
|
||||
"LineName": "S0_HIGHTEMP_L",
|
||||
"EventMon": "BOTH",
|
||||
"Targets": {
|
||||
"FALLING": ["ampere_hightemp_start@0.service"],
|
||||
"RISING": ["ampere_hightemp_stop@0.service"]
|
||||
},
|
||||
"Continue": true
|
||||
},
|
||||
{
|
||||
"Name": "S1_HIGHTEMP",
|
||||
"LineName": "S1_HIGHTEMP_L",
|
||||
"EventMon": "BOTH",
|
||||
"Targets": {
|
||||
"FALLING": ["ampere_hightemp_start@1.service"],
|
||||
"RISING": ["ampere_hightemp_stop@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
|
||||
}
|
||||
]
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC PSU1 reset hotswap
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/usr/sbin/ampere_psu_reset_hotswap.sh %i
|
||||
@@ -0,0 +1,31 @@
|
||||
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_scp_failover.service \
|
||||
psu_hotswap_reset@.service \
|
||||
"
|
||||
|
||||
FILES:${PN}-monitor += " \
|
||||
${datadir}/${PN}/phosphor-multi-gpio-monitor.json \
|
||||
/usr/sbin/ampere_scp_failover.sh \
|
||||
/usr/sbin/ampere_psu_reset_hotswap.sh \
|
||||
"
|
||||
|
||||
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}/
|
||||
}
|
||||
Reference in New Issue
Block a user