Skip to content

Commit

Permalink
meta-ampere: mtjade: flash: fix EDKII flashing sometime fail
Browse files Browse the repository at this point in the history
Issue: Users can not flash EDKII when request to flash SCP before. Steps
to reproduce this issue as below:
  1. Request to flash SCP via Redfish.
  2. Sleep 120s, when CPU is booting (did not jump to OS)
  3. Request to flash EDKII via Redfish.
  4. HOST is turned off, EDKII is not updated.

Root cause: Before EDKII is updated, BMC turns off the HOST and waits
10s. After that, BMC checks the chassis status, if it still is "On", BMC
stops flashing and did not turn on the HOST. But during HOST is booting,
BMC needs more time to turn off the HOST, therefore waiting for 10s is
not enough.

Solution: increase waiting time to 60s, BMC checks the chassis status
each 10s.

Tested:
    1. Repeat step 1 -> 3 in "Issue" part.
       CPU is turned on after flashing is completed.
    2. In the CPU console, check the EDKII version
       dmidecode -t 0
    3. New EDKII is updated

Signed-off-by: Thang Tran <[email protected]>
  • Loading branch information
thangtran-ampere authored and thangqn-ampere committed Dec 2, 2022
1 parent b7a57aa commit 9eb1d10
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,27 +85,22 @@ 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
echo "Turn on the Host"
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
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9eb1d10

Please sign in to comment.