UefiCpuPkg: Update BFV searching algorithm in VTF0

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3870
The new algorithm searches FFS3 GUID first and then FFS2 GUID at
every 4KB address in the top 16MB just below 4GB.

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>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
This commit is contained in:
Kuo, Ted 2022-03-17 16:38:32 +08:00 committed by mergify[bot]
parent ec30a4a0c3
commit 3ef2071927
10 changed files with 6 additions and 15 deletions

View File

@ -2,7 +2,7 @@
; @file ; @file
; Search for the Boot Firmware Volume (BFV) base address ; Search for the Boot Firmware Volume (BFV) base address
; ;
; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,7 +32,6 @@ BITS 32
Flat32SearchForBfvBase: Flat32SearchForBfvBase:
xor eax, eax xor eax, eax
mov ecx, 3 ; 3: FFS3 GUID, 2: FFS2 GUID, 1: Not Found
searchingForBfvHeaderLoop: searchingForBfvHeaderLoop:
; ;
; We check for a firmware volume at every 4KB address in the top 16MB ; We check for a firmware volume at every 4KB address in the top 16MB
@ -40,21 +39,19 @@ searchingForBfvHeaderLoop:
; ;
sub eax, 0x1000 sub eax, 0x1000
cmp eax, 0xff000000 cmp eax, 0xff000000
jb searchingForBfvWithOtherFfsGuid jb searchedForBfvHeaderButNotFound
cmp ecx, 3
jne searchingForFfs2Guid
; ;
; Check FFS3 GUID ; Check FFS3 GUID
; ;
cmp dword [eax + 0x10], FFS3_GUID_DWORD0 cmp dword [eax + 0x10], FFS3_GUID_DWORD0
jne searchingForBfvHeaderLoop jne searchingForFfs2Guid
cmp dword [eax + 0x14], FFS3_GUID_DWORD1 cmp dword [eax + 0x14], FFS3_GUID_DWORD1
jne searchingForBfvHeaderLoop jne searchingForFfs2Guid
cmp dword [eax + 0x18], FFS3_GUID_DWORD2 cmp dword [eax + 0x18], FFS3_GUID_DWORD2
jne searchingForBfvHeaderLoop jne searchingForFfs2Guid
cmp dword [eax + 0x1c], FFS3_GUID_DWORD3 cmp dword [eax + 0x1c], FFS3_GUID_DWORD3
jne searchingForBfvHeaderLoop jne searchingForFfs2Guid
jmp checkingFvLength jmp checkingFvLength
searchingForFfs2Guid: searchingForFfs2Guid:
@ -82,12 +79,6 @@ checkingFvLength:
jmp searchedForBfvHeaderAndItWasFound jmp searchedForBfvHeaderAndItWasFound
searchingForBfvWithOtherFfsGuid:
xor eax, eax
dec ecx
cmp ecx, 1
jne searchingForBfvHeaderLoop
searchedForBfvHeaderButNotFound: searchedForBfvHeaderButNotFound:
; ;
; Hang if the SEC entry point was not found ; Hang if the SEC entry point was not found