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