]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg Core: Propagate PEI-phase FV authentication status to DXE
authorStar Zeng <star.zeng@intel.com>
Tue, 3 Oct 2017 13:48:47 +0000 (21:48 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 10 Oct 2017 12:54:42 +0000 (20:54 +0800)
FV3 HOB was introduced by new (>= 1.5) PI spec, it is intended to
be used to propagate PEI-phase FV authentication status to DXE.
This patch is to update PeiCore to build FV3 HOB with the
authentication status and DxeCore to get the authentication
status from FV3 HOB when producing FVB Protocol.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg/Core/Dxe/FwVol/FwVol.c
MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg/Core/Pei/FwVol/FwVol.c

index 91e94a78d20598195c50dfc85a268d7fedd5cff5..433cca3a800c1c6acb36257b953c03706b6e2ba6 100644 (file)
@@ -380,10 +380,43 @@ DxeMain (
       }\r
     }\r
     for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {\r
-      if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) {\r
-        DEBUG ((DEBUG_INFO | DEBUG_LOAD, "FV2 Hob           0x%0lx - 0x%0lx\n", Hob.FirmwareVolume2->BaseAddress, Hob.FirmwareVolume2->BaseAddress + Hob.FirmwareVolume2->Length - 1));\r
-      } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) {\r
-        DEBUG ((DEBUG_INFO | DEBUG_LOAD, "FV Hob            0x%0lx - 0x%0lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->BaseAddress + Hob.FirmwareVolume->Length - 1));\r
+      if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) {\r
+        DEBUG ((\r
+          DEBUG_INFO | DEBUG_LOAD,\r
+          "FV Hob            0x%0lx - 0x%0lx\n",\r
+          Hob.FirmwareVolume->BaseAddress,\r
+          Hob.FirmwareVolume->BaseAddress + Hob.FirmwareVolume->Length - 1\r
+          ));\r
+      } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) {\r
+        DEBUG ((\r
+          DEBUG_INFO | DEBUG_LOAD,\r
+          "FV2 Hob           0x%0lx - 0x%0lx\n",\r
+          Hob.FirmwareVolume2->BaseAddress,\r
+          Hob.FirmwareVolume2->BaseAddress + Hob.FirmwareVolume2->Length - 1\r
+          ));\r
+        DEBUG ((\r
+          DEBUG_INFO | DEBUG_LOAD,\r
+          "                  %g - %g\n",\r
+          &Hob.FirmwareVolume2->FvName,\r
+          &Hob.FirmwareVolume2->FileName\r
+          ));\r
+      } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV3) {\r
+        DEBUG ((\r
+          DEBUG_INFO | DEBUG_LOAD,\r
+          "FV3 Hob           0x%0lx - 0x%0lx - 0x%x - 0x%x\n",\r
+          Hob.FirmwareVolume3->BaseAddress,\r
+          Hob.FirmwareVolume3->BaseAddress + Hob.FirmwareVolume3->Length - 1,\r
+          Hob.FirmwareVolume3->AuthenticationStatus,\r
+          Hob.FirmwareVolume3->ExtractedFv\r
+          ));\r
+        if (Hob.FirmwareVolume3->ExtractedFv) {\r
+          DEBUG ((\r
+            DEBUG_INFO | DEBUG_LOAD,\r
+            "                  %g - %g\n",\r
+            &Hob.FirmwareVolume3->FvName,\r
+            &Hob.FirmwareVolume3->FileName\r
+            ));\r
+        }\r
       }\r
     }\r
   DEBUG_CODE_END ();\r
index fe12d6e0ac30572a50149a7decb0e465536c0de6..2f5867b59d909ab4a2d90e614405c5ae8817d215 100644 (file)
@@ -3,7 +3,7 @@
   Layers on top of Firmware Block protocol to produce a file abstraction\r
   of FV based files.\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
@@ -711,13 +711,10 @@ NotifyFwVolBlock (
       FvDevice->FwVolHeader     = FwVolHeader;\r
       FvDevice->IsFfs3Fv        = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);\r
       FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
-\r
-      if (Fvb->ParentHandle != NULL) {\r
-        //\r
-        // Inherit the authentication status from FVB.\r
-        //\r
-        FvDevice->AuthenticationStatus = GetFvbAuthenticationStatus (Fvb);\r
-      }\r
+      //\r
+      // Inherit the authentication status from FVB.\r
+      //\r
+      FvDevice->AuthenticationStatus = GetFvbAuthenticationStatus (Fvb);\r
       \r
       if (!EFI_ERROR (FvCheck (FvDevice))) {\r
         //\r
index bc7b34140f841547e9458eafb2a787ddb6c8ae80..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 - 2016, 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
@@ -517,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
@@ -630,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
index c90a70b5f7995fdd18ef34a46e5a8a6e3728ec71..3da90f95312d0172dac6721317e173859115a20c 100644 (file)
@@ -1452,6 +1452,18 @@ ProcessFvFile (
     &FileInfo.FileName\r
     );\r
 \r
+  //\r
+  // Build FV3 HOB with authentication status to be propagated to DXE.\r
+  //\r
+  BuildFv3Hob (\r
+    (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,\r
+    FvHeader->FvLength,\r
+    AuthenticationStatus,\r
+    TRUE,\r
+    &ParentFvImageInfo.FvName,\r
+    &FileInfo.FileName\r
+    );\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r