]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVolBlock / FwVolBlock.c
index f031ef110c19b78680235837541bf6d1566731fc..100aa28dffa4d3b94f3eee78a3d918e0ceab351d 100644 (file)
@@ -4,7 +4,7 @@
   It consumes FV HOBs and creates read-only Firmare Volume Block protocol\r
   instances for each of them.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -495,6 +495,13 @@ ProduceFVBProtocolOnBuffer (
       //\r
       // FvImage buffer is not at its required alignment.\r
       //\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n",\r
+        BaseAddress,\r
+        Length,\r
+        FvAlignment\r
+        ));\r
       return EFI_VOLUME_CORRUPTED;\r
     }\r
   }\r
@@ -510,9 +517,7 @@ ProduceFVBProtocolOnBuffer (
   FvbDev->BaseAddress   = BaseAddress;\r
   FvbDev->FvbAttributes = FwVolHeader->Attributes;\r
   FvbDev->FwVolBlockInstance.ParentHandle = ParentHandle;\r
-  if (ParentHandle != NULL) {\r
-    FvbDev->AuthenticationStatus = AuthenticationStatus;\r
-  }\r
+  FvbDev->AuthenticationStatus = AuthenticationStatus;\r
 \r
   //\r
   // Init the block caching fields of the device\r
@@ -537,7 +542,7 @@ ProduceFVBProtocolOnBuffer (
     CoreFreePool (FvbDev);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Last, fill in the cache with the linear address of the blocks\r
   //\r
@@ -577,11 +582,11 @@ ProduceFVBProtocolOnBuffer (
       return EFI_OUT_OF_RESOURCES;\r
     }\r
     CopyGuid (\r
-      &((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName, \r
+      &((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName,\r
       (GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset)\r
       );\r
   }\r
-  \r
+\r
   //\r
   //\r
   // Attach FvVolBlock Protocol to new handle\r
@@ -623,16 +628,31 @@ FwVolBlockDriverInit (
   )\r
 {\r
   EFI_PEI_HOB_POINTERS          FvHob;\r
+  EFI_PEI_HOB_POINTERS          Fv3Hob;\r
+  UINT32                        AuthenticationStatus;\r
 \r
   //\r
   // Core Needs Firmware Volumes to function\r
   //\r
   FvHob.Raw = GetHobList ();\r
   while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {\r
+    AuthenticationStatus = 0;\r
+    //\r
+    // Get the authentication status propagated from PEI-phase to DXE.\r
+    //\r
+    Fv3Hob.Raw = GetHobList ();\r
+    while ((Fv3Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV3, Fv3Hob.Raw)) != NULL) {\r
+      if ((Fv3Hob.FirmwareVolume3->BaseAddress == FvHob.FirmwareVolume->BaseAddress) &&\r
+          (Fv3Hob.FirmwareVolume3->Length == FvHob.FirmwareVolume->Length)) {\r
+        AuthenticationStatus = Fv3Hob.FirmwareVolume3->AuthenticationStatus;\r
+        break;\r
+      }\r
+      Fv3Hob.Raw = GET_NEXT_HOB (Fv3Hob);\r
+    }\r
     //\r
     // Produce an FVB protocol for it\r
     //\r
-    ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, 0, NULL);\r
+    ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, AuthenticationStatus, NULL);\r
     FvHob.Raw = GET_NEXT_HOB (FvHob);\r
   }\r
 \r