blob: c1c16aba5c825f1d1ee8f55cba63ab53ec4baaff [file] [log] [blame]
Thang Q. Nguyenbd7d6332021-12-06 10:18:21 +00001#!/bin/bash
2
3# Handle the SCP Failover feature in which:
4# - If the BMC receives the SCP_AUTH_FAILURE signal from Socket0,
5# attempts to boot from the failover boot EEPROM.
6# - If the second boot fails, treats this as a permanent boot failure
7# and logs an event in SEL.
8
9# shellcheck disable=SC1091
chaul.ampere7b6d85f2022-07-23 04:28:42 +000010# shellcheck disable=SC2046
11
Thang Q. Nguyenbd7d6332021-12-06 10:18:21 +000012source /usr/sbin/gpio-lib.sh
13source /usr/sbin/gpio-defs.sh
14
15# Check the I2C_BACKUP_SEL
16I2C_BACKUP_SEL=$(gpio_get_val "$BMC_I2C_BACKUP_SEL")
17if [ "${I2C_BACKUP_SEL}" == "1" ]; then
18 # If it is HIGH, set it LOW. Then reset the Host to boot from
19 # the failover Boot EEPROM.
20 echo "scp-failover: switch HOST to failover boot EEPROM"
chaul.ampere7b6d85f2022-07-23 04:28:42 +000021 gpioset $(gpiofind BMC_SELECT_EEPROM)=0
Thang Q. Nguyenbd7d6332021-12-06 10:18:21 +000022
23 # Reset the Host to boot on the failover EEPROM
24 ampere_power_util.sh mb force_reset
25else
26 # Turn OFF Host as SCP firmware on both Boot EEPROM fail
27 obmcutil chassisoff
28
29 echo "scp-failover: switch HOST back to the main Boot EEPROM"
chaul.ampere7b6d85f2022-07-23 04:28:42 +000030 gpioset $(gpiofind BMC_SELECT_EEPROM)=1
Thang Q. Nguyenbd7d6332021-12-06 10:18:21 +000031
32 # Log event
33 ampere_add_redfishevent.sh OpenBMC.0.1.GeneralFirmwareSecurityViolation.Critical "SCP Authentication failure"
34fi