ICE_TEA_BIOS/Board/Oem/L05AlderLakePMultiBoardPkg/PlatformConfig/BiosGuard/BGSL/InsydeBiosGuardScript.bgsl
LCFC\AiXia.Jiang a870bff2f4 1.Frist commit
2022-09-30 14:59:06 +08:00

97 lines
1.6 KiB
Plaintext

begin
;---------------Do NOT Modify Section-----------
Set I8 0xFFFFFFFF; BaseType BiosRegionBase-0xFFFFFFFF RomBase-0x00000000
Set I9 0x0; Image Size
Set I7 0x0; Image BIOS Offset
;---------------Do NOT Modify Section-----------
Set I0 0x0; Offset Count;
Set I1 0x1000; flash size per flash (4K)
Set I2 0x3; Max error try
Set I3 0x0; error try
Set I4 0x0; write try
Set I5 0x0; HW Status 0=success 1=erase error 2=write error
compare I8 0x00000000
je _Flash_start;
;
; Get BIOS base referenced SPI Programming Guide
; Step1 - Find FRBA(Flash Region Base Address) offset[23:16] from FLMAP0 (FDBAR+0x14)
; Step2 - Get Bios Base and size from FRBA
; Step3 - Check image in Bios Range
;
set Ia 0x0; Temp and Bios Base
set Ib 0x0; Bios limit
set Ic 0x0; BIOS Base + image offset + image size < bios limit
set F0 0x16;
Set B1 0x0;
read B1 F0 0x1;
loadbyte Ia B1;
shiftl Ia 4; Ia = FRBA
Set B1 0x0;
add Ia 0x4;
set F0 Ia;
read B1 F0 0x4;
loadDword Ia B1;
set Ib Ia;
And Ia 0x00007FFF;
shiftl Ia 0xC;
And Ib 0x7FFF0000;
shiftr Ib 0x10
add Ib 0x1;
shiftl Ib 0xC
add I7 Ia;
set Ic I7;
add Ic I9;
compare Ic Ib;
jg _end;
_Flash_start:
Set F0 I7; set Image address to F0
jmp _Flash_Loop;
_error_label:
add I3 0x1;
compare I3 I2;
jge _end;
jmp _erase;
_write_label:
add I4 0x1;
compare I4 I2;
jge _end;
jmp _erase;
_Flash_Loop:
_erase:
Eraseblk F0;
rdsts I5;
compare I5 0;
jne _error_label;
_write:
write F0 B0 I1;
rdsts I5;
compare I5 0;
jne _write_label;
_continue:
Set I3 0x0;
Set I4 0x0;
add I0 I1;
compare I0 I9;
jge _end;
add F0 I1;
add B0 I1;
jmp _Flash_Loop;
_end:
set If I5;
end