summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade
diff options
context:
space:
mode:
authorThang Tran <thuutran@amperecomputing.com>2022-11-17 06:35:04 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2022-12-15 07:34:28 +0300
commit8e086fe82988eb0b7f5f7e9509ac2f06aa727a36 (patch)
tree099db99a9dcfba986ac9c93af11a56ba5c822bde /meta-ampere/meta-jade
parentf3e35a2f853e76e429c7a43e4bcde0287f4613a4 (diff)
downloadopenbmc-8e086fe82988eb0b7f5f7e9509ac2f06aa727a36.tar.xz
meta-ampere: mtjade: fix flash BIOS occasional fail
Before flashing UEFI firmware, the BMC calls "obmcutil chassisoff" to turn OFF the Host and wait 10s before checking if the Host is actually OFF or not. In some cases, 10s is not enough. This will make the flashing script sees the Host is still ON and bypasses the flashing. This commit changes to check Host state each 2s until maximum 60s to avoid above failure. Tested: check below steps 10 times and ensure all done successful: 1. Request to flash SCP firmware via Redfish. 2. Sleep 120s, when CPU is booting (did not jump to OS) 3. Request to flash UEFI firmware via Redfish. 4. Check if the flashing successes Signed-off-by: Thang Tran <thuutran@amperecomputing.com> Change-Id: I403f4b432e53b3b091315612488c50dbb595ea76
Diffstat (limited to 'meta-ampere/meta-jade')
-rwxr-xr-xmeta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_firmware_upgrade.sh51
-rwxr-xr-xmeta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_flash_bios.sh28
2 files changed, 49 insertions, 30 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_firmware_upgrade.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_firmware_upgrade.sh
index 130682d12a..6f0a11fc9f 100755
--- a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_firmware_upgrade.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_firmware_upgrade.sh
@@ -31,14 +31,26 @@ do_smpmpro_upgrade() {
then
echo "Turning the Chassis off"
obmcutil chassisoff
- sleep 15
- # Check if HOST was OFF
- chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
- if [ "$chassisstate_off" == 'On' ];
- then
- echo "Error : Failed turning the Chassis off"
- exit
- fi
+
+ # Wait 60s until Chassis is off
+ cnt=30
+ while [ "$cnt" -gt 0 ];
+ do
+ cnt=$((cnt - 1))
+ sleep 2
+ # Check if HOST was OFF
+ chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
+ if [ "$chassisstate_off" != 'On' ];
+ then
+ break
+ fi
+
+ if [ "$cnt" == "0" ];
+ then
+ echo "--- Error : Failed turning the Chassis off"
+ exit 1
+ fi
+ done
fi
if [[ $SECPRO == 1 ]]; then
@@ -73,6 +85,15 @@ do_smpmpro_upgrade() {
# 226 is BMC_GPIOAC2_SPI0_PROGRAM_SEL
gpioset 0 226=1
+ # Deassert SECPRO GPIO PINs
+ if [[ $SECPRO == 1 ]]; then
+ echo "De-asserting special GPIO PINs"
+ # 3 is S0_SPECIAL_BOOT
+ gpioset 0 3=0
+ # 66 is S1_SPECIAL_BOOT
+ gpioset 0 66=0
+ fi
+
if [ "$chassisstate" == 'On' ];
then
sleep 5
@@ -80,20 +101,6 @@ do_smpmpro_upgrade() {
obmcutil poweron
fi
- # Deassert SECPRO GPIO PINs
- if [[ $SECPRO == 1 ]]; then
- chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}')
- if [ "$chassisstate_off" == 'Off' ]; then
- obmcutil poweron
- fi
-
- sleep 30s
- echo "De-asserting special GPIO PINs"
- # 3 is S0_SPECIAL_BOOT
- gpioset 0 3=0
- # 66 is S1_SPECIAL_BOOT
- gpioset 0 66=0
- fi
}
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_flash_bios.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_flash_bios.sh
index 7852dc4acc..5a13da481c 100755
--- a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_flash_bios.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_flash_bios.sh
@@ -69,14 +69,26 @@ if [ "$chassisstate" == 'On' ];
then
echo "--- Turning the Chassis off"
obmcutil chassisoff
- sleep 10
- # Check if HOST was OFF
- chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
- if [ "$chassisstate_off" == 'On' ];
- then
- echo "--- Error : Failed turning the Chassis off"
- exit 1
- fi
+
+ # Wait 60s until Chassis is off
+ cnt=30
+ while [ "$cnt" -gt 0 ];
+ do
+ cnt=$((cnt - 1))
+ sleep 2
+ # Check if HOST was OFF
+ chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
+ if [ "$chassisstate_off" != 'On' ];
+ then
+ break
+ fi
+
+ if [ "$cnt" == "0" ];
+ then
+ echo "--- Error : Failed turning the Chassis off"
+ exit 1
+ fi
+ done
fi
# Switch the host SPI bus to BMC"