Skip to content

Commit 077efbb

Browse files
bf-update: Update upgrade status
Update status via SP2.BIT[11-12] in progress = 1 is complete = 2 fail = 3 Signed-off-by: Vladimir Sokolovsky <[email protected]>
1 parent 6084d02 commit 077efbb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/bf-upgrade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ if [[ $ACTIVATE_FLOW -eq 1 || $CANCEL_FLOW -eq 1 || $COMPATIBILITY_FLOW -eq 1 ||
451451
if [ $RC -ne 0 ]; then
452452
log "ERR $0 flow failed with RC: $RC"
453453
ilog "Removing BFB directory: $BFB_DIR"
454+
set_status $FAILED
454455
fi
455456
cd ${WDIR}
456457
/bin/rm -rf dump-*

src/bf-upgrade.env/rshim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ write_RshimSP2_path=/sys/firmware/efi/efivars/RshimSP2W-f3ce977e-c17f-493e-a3cd-
55
status_clear_mask=$(( ~( (1 << 11) | (1 << 12) ) ))
66
progress_clear_mask=$(( ~( (1 << 13) | (1 << 14) | (1 << 15)) ))
77

8+
IN_PROGRESS=0x1
9+
COMPLETED=0x2
10+
FAILED=0x3
811

912
# Function to read 8 bytes from a specific offset and convert to UINT64 little-endian
1013
read_SP2() {
@@ -79,10 +82,12 @@ is_mode_cancel() {
7982
fi
8083
}
8184

82-
set_status_idle() {
85+
set_status() {
8386
# SP2.BIT11-12
8487
local result=$(( SP2 & status_clear_mask ))
85-
ilog "set_status_idle: $result"
88+
result=$(( result | ($1 << 11) ))
89+
90+
ilog "set_status: $result"
8691
write_uint64_with_prefix "$result"
8792
}
8893

@@ -92,11 +97,14 @@ set_upgrade_progress() {
9297
local percent
9398
SP2=$(read_SP2)
9499
local result=$(( SP2 & progress_clear_mask ))
100+
result=$(( result & status_clear_mask ))
95101
if [ $1 -lt 100 ]; then
96102
percent=$(( $1 / 20 ))
97103
[ $percent -lt 0 ] && percent=0
104+
result=$(( result | (IN_PROGRESS << 11) ))
98105
else
99106
percent=5
107+
result=$(( result | (COMPLETED << 11) ))
100108
fi
101109

102110
result=$(( result | (percent << 13) ))

0 commit comments

Comments
 (0)