1 ;------------------------------------------------------------------------------
3 ; Search for the Boot Firmware Volume (BFV) base address
5 ; Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
6 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;------------------------------------------------------------------------------
10 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
11 ; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
12 %define FFS2_GUID_DWORD0 0x8c8ce578
13 %define FFS2_GUID_DWORD1 0x4f1c8a3d
14 %define FFS2_GUID_DWORD2 0x61893599
15 %define FFS2_GUID_DWORD3 0xd32dc385
17 ;#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \
18 ; { 0x8c8ce578, 0x3dcb, 0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } }
19 %define FFS3_GUID_DWORD0 0x5473c07a
20 %define FFS3_GUID_DWORD1 0x4dca3dcb
21 %define FFS3_GUID_DWORD2 0x961e6fbd
22 %define FFS3_GUID_DWORD3 0x9a34e789
30 ; @param[out] EBP Address of Boot Firmware Volume (BFV)
32 Flat32SearchForBfvBase:
35 searchingForBfvHeaderLoop:
37 ; We check for a firmware volume at every 4KB address in the top 16MB
38 ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
42 jb searchedForBfvHeaderButNotFound
47 cmp dword [eax + 0x10], FFS3_GUID_DWORD0
48 jne searchingForFfs2Guid
49 cmp dword [eax + 0x14], FFS3_GUID_DWORD1
50 jne searchingForFfs2Guid
51 cmp dword [eax + 0x18], FFS3_GUID_DWORD2
52 jne searchingForFfs2Guid
53 cmp dword [eax + 0x1c], FFS3_GUID_DWORD3
54 jne searchingForFfs2Guid
61 cmp dword [eax + 0x10], FFS2_GUID_DWORD0
62 jne searchingForBfvHeaderLoop
63 cmp dword [eax + 0x14], FFS2_GUID_DWORD1
64 jne searchingForBfvHeaderLoop
65 cmp dword [eax + 0x18], FFS2_GUID_DWORD2
66 jne searchingForBfvHeaderLoop
67 cmp dword [eax + 0x1c], FFS2_GUID_DWORD3
68 jne searchingForBfvHeaderLoop
74 cmp dword [eax + 0x24], 0
75 jne searchingForBfvHeaderLoop
77 add ebx, dword [eax + 0x20]
78 jnz searchingForBfvHeaderLoop
80 jmp searchedForBfvHeaderAndItWasFound
82 searchedForBfvHeaderButNotFound:
84 ; Hang if the SEC entry point was not found
86 debugShowPostCode POSTCODE_BFV_NOT_FOUND
89 ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
90 ; for debugging purposes.
96 searchedForBfvHeaderAndItWasFound:
99 debugShowPostCode POSTCODE_BFV_FOUND
101 OneTimeCallRet Flat32SearchForBfvBase