]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg/Gcd: Fix bug of attribute conversion
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVolBlock / FwVolBlock.c
index f031ef110c19b78680235837541bf6d1566731fc..f7fb18ae15df2c9c392e752eeaaa86792b8745cf 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 - 2017, 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
@@ -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