1 ;------------------------------------------------------------------------------
3 ; Search for the Boot Firmware Volume (BFV) base address
5 ; Copyright (c) 2008 - 2009, 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 mov ecx, 3 ; 3: FFS3 GUID, 2: FFS2 GUID, 1: Not Found
36 searchingForBfvHeaderLoop:
38 ; We check for a firmware volume at every 4KB address in the top 16MB
39 ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
43 jb searchingForBfvWithOtherFfsGuid
45 jne searchingForFfs2Guid
50 cmp dword [eax + 0x10], FFS3_GUID_DWORD0
51 jne searchingForBfvHeaderLoop
52 cmp dword [eax + 0x14], FFS3_GUID_DWORD1
53 jne searchingForBfvHeaderLoop
54 cmp dword [eax + 0x18], FFS3_GUID_DWORD2
55 jne searchingForBfvHeaderLoop
56 cmp dword [eax + 0x1c], FFS3_GUID_DWORD3
57 jne searchingForBfvHeaderLoop
64 cmp dword [eax + 0x10], FFS2_GUID_DWORD0
65 jne searchingForBfvHeaderLoop
66 cmp dword [eax + 0x14], FFS2_GUID_DWORD1
67 jne searchingForBfvHeaderLoop
68 cmp dword [eax + 0x18], FFS2_GUID_DWORD2
69 jne searchingForBfvHeaderLoop
70 cmp dword [eax + 0x1c], FFS2_GUID_DWORD3
71 jne searchingForBfvHeaderLoop
77 cmp dword [eax + 0x24], 0
78 jne searchingForBfvHeaderLoop
80 add ebx, dword [eax + 0x20]
81 jnz searchingForBfvHeaderLoop
83 jmp searchedForBfvHeaderAndItWasFound
85 searchingForBfvWithOtherFfsGuid:
89 jne searchingForBfvHeaderLoop
91 searchedForBfvHeaderButNotFound:
93 ; Hang if the SEC entry point was not found
95 debugShowPostCode POSTCODE_BFV_NOT_FOUND
98 ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
99 ; for debugging purposes.
105 searchedForBfvHeaderAndItWasFound:
108 debugShowPostCode POSTCODE_BFV_FOUND
110 OneTimeCallRet Flat32SearchForBfvBase