Skip to content

Commit 8d52208

Browse files
authored
RM #4707887 bfb-install deferred issue and BMC credential issue (#307)
* bfb-install deferred issue and BMC credential issue during ActivateFirmware RM #4707887 * bfb-install deferred issue and BMC credential issue during ActivateFirmware RM #4707887
1 parent 9360544 commit 8d52208

File tree

1 file changed

+54
-16
lines changed

1 file changed

+54
-16
lines changed

scripts/bfb-install

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ clear_boot_fifo()
192192
done
193193
}
194194

195-
clear_sp2_267_swint2_2()
195+
clear_sp2_267()
196196
{
197197
sp2=`${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 | awk '{print $3}'`
198198

199199
# reset SP2.BIT2|6|7 4 + 64 + 128 = 196
200200
sp2=$((sp2 & ~196))
201201
${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 $sp2 >/dev/null
202202

203-
# reset SWINT2 for DPU mode
203+
# set SWINT2 for DPU mode
204204
${BF_REG} $(basename ${rshim_node}) ${RSH_SWINT}.64 0x4 >/dev/null
205205
sleep 1
206206
}
@@ -479,7 +479,6 @@ wait_for_update_to_finish()
479479
filter="$filter0"
480480
fi
481481

482-
483482
echo "Collecting BlueField booting status. Press Ctrl+C to stop…"
484483

485484
# Enable CLEAR_ON_READ, so rshim log will be cleared after read.
@@ -577,6 +576,7 @@ cleanup() {
577576
echo "BlueField Update Failed"
578577
fi
579578

579+
580580
# Kill all netcat related processes on both ends
581581
if [ $run_cmd_local_ready -eq 1 ]; then
582582
run_cmd local "pgrep -x nc >/dev/null && pgrep -x nc | xargs kill -9"
@@ -593,8 +593,8 @@ cleanup() {
593593
if [ $deferred -eq 1 ]; then
594594
# Reset to default state.
595595
echo "BOOT_RESET_SKIP 0" > ${rshim_node}/misc
596-
597-
clear_sp2_267_swint2_2
596+
sleep 5
597+
clear_sp2_267
598598
fi
599599

600600
# Disable CLEAR_ON_READ.
@@ -1038,6 +1038,9 @@ apply_chip_settings
10381038
# Check NIC mode and unbind mlx5_core driver in NIC mode.
10391039
check_nic_mode
10401040

1041+
# clear SP2 BITs to handle the case when ACPI events have been triggered before.
1042+
clear_sp2_267
1043+
10411044
if [ ${nic_mode} -eq 1 -a -n "${pcie_bd}" -a ${deferred} -eq 0 ]; then
10421045
# Set BREADCRUMB.BIT32 to indicate NIC mode.
10431046
breadcrumb1=$(${BF_REG} $(basename ${rshim_node}) ${RSH_BREADCRUMB1}.64 | awk '{print $3}')
@@ -1072,19 +1075,31 @@ if [ -e "${bfb}" ]; then
10721075
wait_for_update_to_finish
10731076
fi
10741077

1075-
1076-
# Set SP2.BIT6=1 to issue PLDM ActivateFirmware command that activate new images after reboot
1077-
# For DPU mode, need to set SWINT2.BIT2 additionally.
1078-
# Always reset the BITs before setting them
1079-
1078+
# Got here after wait_for_update_to_finish() returns from polling. The transfer and
1079+
# verify is done.
1080+
10801081
if [ ${deferred} -eq 1 ]; then
1081-
clear_sp2_267_swint2_2
1082-
1082+
# Note: OS bf-upgrade script will wait and check SP2.BITS right after successful
1083+
# upgrade/staging.
10831084
sp2=`${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 | awk '{print $3}'`
1084-
sp2=$((sp2 | 64))
1085-
${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 $sp2 >/dev/null
1086-
# Set SWINT2.BIT2 for DPU mode
1087-
${BF_REG} $(basename ${rshim_node}) ${RSH_SWINT}.64 0x4 >/dev/null
1085+
1086+
# Note: check SP2.BIT11|12 for success: 10b. Send Activation only it's a success.
1087+
if [ $((sp2 & 6144)) -eq 4096 ]; then
1088+
clear_sp2_267
1089+
1090+
# Set SP2.BIT6=1 to issue PLDM ActivateFirmware command that activate new images
1091+
# after reboot
1092+
echo "Sending ActivateFirmware"
1093+
sp2=$((sp2 | 64))
1094+
${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 $sp2 >/dev/null
1095+
# set SWINT2 for DPU mode
1096+
if [ ${nic_mode} -eq 0 ]; then
1097+
${BF_REG} $(basename ${rshim_node}) ${RSH_SWINT}.64 0x4 >/dev/null
1098+
fi
1099+
else
1100+
echo "Transfer/Verify failed"
1101+
exit -1
1102+
fi
10881103
fi
10891104

10901105
# LFWP activation(reset) on PCIe host.
@@ -1112,3 +1127,26 @@ if [ ${apply_lfwp} -eq 1 ]; then
11121127
echo "Live Patch NIC Firmware reset not supported."
11131128
fi
11141129
fi
1130+
1131+
if [ ${deferred} -eq 1 ]; then
1132+
end=$((SECONDS + 60))
1133+
1134+
while [ $SECONDS -lt $end ]; do
1135+
sp2=`${BF_REG} $(basename ${rshim_node}) ${RSH_SCRATCHPAD2}.64 | awk '{print $3}'`
1136+
if [ $((sp2 & 6144)) -eq 4096 ]; then
1137+
# 10b
1138+
echo "ActivateFirmware Succeeded"
1139+
break
1140+
elif [ $((sp2 & 6144)) -eq 6144 ]; then
1141+
# 11b
1142+
echo "ActivateFirmware Failed"
1143+
break
1144+
elif [ $((sp2 & 6144)) -eq 0 ]; then
1145+
# idle
1146+
break
1147+
fi
1148+
sleep 1
1149+
done
1150+
echo "Upgrade Finished"
1151+
fi
1152+

0 commit comments

Comments
 (0)