UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3862
The new algorithm searches BFV address with FFS3 GUID first.
If not found, it will search BFV address with FFS2 GUID.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
This commit is contained in:
Kuo, Ted 2022-03-11 15:28:34 +08:00 committed by mergify[bot]
parent 0fdd466c75
commit 52e09dcd7a
10 changed files with 41 additions and 10 deletions

View File

@ -9,10 +9,17 @@
;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
%define FFS_GUID_DWORD0 0x8c8ce578
%define FFS_GUID_DWORD1 0x4f1c8a3d
%define FFS_GUID_DWORD2 0x61893599
%define FFS_GUID_DWORD3 0xd32dc385
%define FFS2_GUID_DWORD0 0x8c8ce578
%define FFS2_GUID_DWORD1 0x4f1c8a3d
%define FFS2_GUID_DWORD2 0x61893599
%define FFS2_GUID_DWORD3 0xd32dc385
;#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \
; { 0x8c8ce578, 0x3dcb, 0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } }
%define FFS3_GUID_DWORD0 0x5473c07a
%define FFS3_GUID_DWORD1 0x4dca3dcb
%define FFS3_GUID_DWORD2 0x961e6fbd
%define FFS3_GUID_DWORD3 0x9a34e789
BITS 32
@ -25,6 +32,7 @@ BITS 32
Flat32SearchForBfvBase:
xor eax, eax
mov ecx, 3 ; 3: FFS3 GUID, 2: FFS2 GUID, 1: Not Found
searchingForBfvHeaderLoop:
;
; We check for a firmware volume at every 4KB address in the top 16MB
@ -32,20 +40,37 @@ searchingForBfvHeaderLoop:
;
sub eax, 0x1000
cmp eax, 0xff000000
jb searchedForBfvHeaderButNotFound
jb searchingForBfvWithOtherFfsGuid
cmp ecx, 3
jne searchingForFfs2Guid
;
; Check FFS GUID
; Check FFS3 GUID
;
cmp dword [eax + 0x10], FFS_GUID_DWORD0
cmp dword [eax + 0x10], FFS3_GUID_DWORD0
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x14], FFS_GUID_DWORD1
cmp dword [eax + 0x14], FFS3_GUID_DWORD1
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x18], FFS_GUID_DWORD2
cmp dword [eax + 0x18], FFS3_GUID_DWORD2
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x1c], FFS_GUID_DWORD3
cmp dword [eax + 0x1c], FFS3_GUID_DWORD3
jne searchingForBfvHeaderLoop
jmp checkingFvLength
searchingForFfs2Guid:
;
; Check FFS2 GUID
;
cmp dword [eax + 0x10], FFS2_GUID_DWORD0
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x14], FFS2_GUID_DWORD1
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x18], FFS2_GUID_DWORD2
jne searchingForBfvHeaderLoop
cmp dword [eax + 0x1c], FFS2_GUID_DWORD3
jne searchingForBfvHeaderLoop
checkingFvLength:
;
; Check FV Length
;
@ -57,6 +82,12 @@ searchingForBfvHeaderLoop:
jmp searchedForBfvHeaderAndItWasFound
searchingForBfvWithOtherFfsGuid:
xor eax, eax
dec ecx
cmp ecx, 1
jne searchingForBfvHeaderLoop
searchedForBfvHeaderButNotFound:
;
; Hang if the SEC entry point was not found