]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Enable use-cases in PEI using SecurityPPI co-equal to the use-cases in DXE using...
authorStar Zeng <star.zeng@intel.com>
Fri, 11 Oct 2013 03:54:13 +0000 (03:54 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Oct 2013 03:54:13 +0000 (03:54 +0000)
2. Add support to find section by instance rather than only 0 at PEI phase.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14763 6f19259b-4bc3-4df7-8a09-765794883524

18 files changed:
MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
MdeModulePkg/Core/Pei/FwVol/FwVol.c
MdeModulePkg/Core/Pei/FwVol/FwVol.h
MdeModulePkg/Core/Pei/Image/Image.c
MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg/Core/Pei/PeiMain.inf
MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
MdeModulePkg/Core/Pei/Security/Security.c
MdePkg/Include/Library/PeiServicesLib.h
MdePkg/Include/Pi/PiPeiCis.h
MdePkg/Include/Ppi/FirmwareVolume.h
MdePkg/Include/Ppi/FirmwareVolumeInfo2.h [new file with mode: 0644]
MdePkg/Include/Ppi/Security2.h
MdePkg/Library/PeiServicesLib/PeiServicesLib.c
MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
MdePkg/MdePkg.dec
SecurityPkg/Tcg/TcgPei/TcgPei.c
SecurityPkg/Tcg/TcgPei/TcgPei.inf

index b0e4b6d12aab297cd38333f54fdb00a019737529..f4392b78ddf82466f9472866a8e881c7b63eab8b 100644 (file)
@@ -764,8 +764,14 @@ PeiDispatcher (
               //\r
               // For Fv type file, Produce new FV PPI and FV hob\r
               //\r
-              Status = ProcessFvFile (&Private->Fv[FvCount], PeimFileHandle);\r
-              AuthenticationState = 0;\r
+              Status = ProcessFvFile (Private, &Private->Fv[FvCount], PeimFileHandle);\r
+              if (Status == EFI_SUCCESS) {\r
+                //\r
+                // PEIM_STATE_NOT_DISPATCHED move to PEIM_STATE_DISPATCHED\r
+                //\r
+                Private->Fv[FvCount].PeimState[PeimCount]++;\r
+                Private->PeimDispatchOnThisPass = TRUE;\r
+              }\r
             } else {\r
               //\r
               // For PEIM driver, Load its entry point\r
@@ -777,50 +783,45 @@ PeiDispatcher (
                          &EntryPoint,\r
                          &AuthenticationState\r
                          );\r
-            }\r
-\r
-            if (Status == EFI_SUCCESS) {\r
-              //\r
-              // The PEIM has its dependencies satisfied, and its entry point\r
-              // has been found, so invoke it.\r
-              //\r
-              PERF_START (PeimFileHandle, "PEIM", NULL, 0);\r
-\r
-              ExtendedData.Handle = (EFI_HANDLE)PeimFileHandle;\r
-\r
-              REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
-                EFI_PROGRESS_CODE,\r
-                (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN),\r
-                (VOID *)(&ExtendedData),\r
-                sizeof (ExtendedData)\r
-                );\r
-\r
-              Status = VerifyPeim (Private, CoreFvHandle->FvHandle, PeimFileHandle);\r
-              if (Status != EFI_SECURITY_VIOLATION && (AuthenticationState == 0)) {\r
+              if (Status == EFI_SUCCESS) {\r
                 //\r
-                // PEIM_STATE_NOT_DISPATCHED move to PEIM_STATE_DISPATCHED\r
+                // The PEIM has its dependencies satisfied, and its entry point\r
+                // has been found, so invoke it.\r
                 //\r
-                Private->Fv[FvCount].PeimState[PeimCount]++;\r
+                PERF_START (PeimFileHandle, "PEIM", NULL, 0);\r
 \r
-                if (FvFileInfo.FileType != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {\r
+                ExtendedData.Handle = (EFI_HANDLE)PeimFileHandle;\r
+\r
+                REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
+                  EFI_PROGRESS_CODE,\r
+                  (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN),\r
+                  (VOID *)(&ExtendedData),\r
+                  sizeof (ExtendedData)\r
+                  );\r
+\r
+                Status = VerifyPeim (Private, CoreFvHandle->FvHandle, PeimFileHandle, AuthenticationState);\r
+                if (Status != EFI_SECURITY_VIOLATION) {\r
+                  //\r
+                  // PEIM_STATE_NOT_DISPATCHED move to PEIM_STATE_DISPATCHED\r
+                  //\r
+                  Private->Fv[FvCount].PeimState[PeimCount]++;\r
                   //\r
                   // Call the PEIM entry point for PEIM driver\r
                   //\r
                   PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;\r
                   PeimEntryPoint (PeimFileHandle, (const EFI_PEI_SERVICES **) PeiServices);\r
+                  Private->PeimDispatchOnThisPass = TRUE;\r
                 }\r
 \r
-                Private->PeimDispatchOnThisPass = TRUE;\r
-              }\r
-\r
-              REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
-                EFI_PROGRESS_CODE,\r
-                (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_END),\r
-                (VOID *)(&ExtendedData),\r
-                sizeof (ExtendedData)\r
-                );\r
-              PERF_END (PeimFileHandle, "PEIM", NULL, 0);\r
+                REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
+                  EFI_PROGRESS_CODE,\r
+                  (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_END),\r
+                  (VOID *)(&ExtendedData),\r
+                  sizeof (ExtendedData)\r
+                  );\r
+                PERF_END (PeimFileHandle, "PEIM", NULL, 0);\r
 \r
+              }\r
             }\r
 \r
             if (Private->SwitchStackSignal) {\r
index e505c707b075771cd13e724e097757f1b5dd412b..ec855a8df4d70bd962698e12d9e605d9141e4233 100644 (file)
@@ -14,10 +14,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "FwVol.h"\r
 \r
-EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnFvInfoList = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
-  FirmwareVolmeInfoPpiNotifyCallback \r
+EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnFvInfoList[] = {\r
+  {\r
+    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
+    &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
+    FirmwareVolmeInfoPpiNotifyCallback \r
+  },\r
+  {\r
+    (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+    &gEfiPeiFirmwareVolumeInfo2PpiGuid,\r
+    FirmwareVolmeInfoPpiNotifyCallback \r
+  }\r
 };\r
 \r
 PEI_FW_VOL_INSTANCE mPeiFfs2FwVol = {\r
@@ -29,7 +36,11 @@ PEI_FW_VOL_INSTANCE mPeiFfs2FwVol = {
     PeiFfsFvPpiFindFileByName,\r
     PeiFfsFvPpiGetFileInfo,\r
     PeiFfsFvPpiGetVolumeInfo,\r
-    PeiFfsFvPpiFindSectionByType\r
+    PeiFfsFvPpiFindSectionByType,\r
+    PeiFfsFvPpiGetFileInfo2,\r
+    PeiFfsFvPpiFindSectionByType2,\r
+    EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE,\r
+    EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION\r
   }\r
 };\r
 \r
@@ -42,7 +53,11 @@ PEI_FW_VOL_INSTANCE mPeiFfs3FwVol = {
     PeiFfsFvPpiFindFileByName,\r
     PeiFfsFvPpiGetFileInfo,\r
     PeiFfsFvPpiGetVolumeInfo,\r
-    PeiFfsFvPpiFindSectionByType\r
+    PeiFfsFvPpiFindSectionByType,\r
+    PeiFfsFvPpiGetFileInfo2,\r
+    PeiFfsFvPpiFindSectionByType2,\r
+    EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE,\r
+    EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION\r
   }\r
 };\r
             \r
@@ -461,6 +476,7 @@ PeiInitializeFv (
   PrivateData->Fv[PrivateData->FvCount].FvHeader = BfvHeader;\r
   PrivateData->Fv[PrivateData->FvCount].FvPpi    = FvPpi;\r
   PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;\r
+  PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = 0;\r
   DEBUG ((\r
     EFI_D_INFO, \r
     "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n", \r
@@ -472,18 +488,18 @@ PeiInitializeFv (
   PrivateData->FvCount ++;\r
                             \r
   //\r
-  // Post a call-back for the FvInfoPPI services to expose\r
+  // Post a call-back for the FvInfoPPI and FvInfo2PPI services to expose\r
   // additional Fvs to PeiCore.\r
   //\r
-  Status = PeiServicesNotifyPpi (&mNotifyOnFvInfoList);\r
+  Status = PeiServicesNotifyPpi (mNotifyOnFvInfoList);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
 }\r
   \r
 /**\r
-  Process Firmware Volum Information once FvInfoPPI install.\r
+  Process Firmware Volum Information once FvInfoPPI or FvInfo2PPI install.\r
   The FV Info will be registered into PeiCore private data structure.\r
-  And search the inside FV image, if found, the new FV INFO PPI will be installed.\r
+  And search the inside FV image, if found, the new FV INFO(2) PPI will be installed.\r
 \r
   @param PeiServices       An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
   @param NotifyDescriptor  Address of the notification descriptor data structure.\r
@@ -501,7 +517,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
   IN VOID                          *Ppi\r
   )\r
 {\r
-  EFI_PEI_FIRMWARE_VOLUME_INFO_PPI      *FvInfoPpi;\r
+  EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI     FvInfo2Ppi;\r
   EFI_PEI_FIRMWARE_VOLUME_PPI           *FvPpi;\r
   PEI_CORE_INSTANCE                     *PrivateData;\r
   EFI_STATUS                            Status;\r
@@ -519,14 +535,25 @@ FirmwareVolmeInfoPpiNotifyCallback (
     ASSERT (FALSE);\r
   }\r
 \r
-  FvInfoPpi = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *)Ppi;\r
+  if (CompareGuid (NotifyDescriptor->Guid, &gEfiPeiFirmwareVolumeInfo2PpiGuid)) {\r
+    //\r
+    // It is FvInfo2PPI.\r
+    //\r
+    CopyMem (&FvInfo2Ppi, Ppi, sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI));\r
+  } else {\r
+    //\r
+    // It is FvInfoPPI.\r
+    //\r
+    CopyMem (&FvInfo2Ppi, Ppi, sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r
+    FvInfo2Ppi.AuthenticationStatus = 0;\r
+  }\r
 \r
   //\r
   // Locate the corresponding FV_PPI according to founded FV's format guid\r
   //\r
   Status = PeiServicesLocatePpi (\r
-             &FvInfoPpi->FvFormat, \r
-             0, \r
+             &FvInfo2Ppi.FvFormat,\r
+             0,\r
              NULL,\r
              (VOID**)&FvPpi\r
              );\r
@@ -534,7 +561,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
     //\r
     // Process new found FV and get FV handle.\r
     //\r
-    Status = FvPpi->ProcessVolume (FvPpi, FvInfoPpi->FvInfo, FvInfoPpi->FvInfoSize, &FvHandle);\r
+    Status = FvPpi->ProcessVolume (FvPpi, FvInfo2Ppi.FvInfo, FvInfo2Ppi.FvInfoSize, &FvHandle);\r
     if (EFI_ERROR (Status)) {\r
       DEBUG ((EFI_D_ERROR, "Fail to process new found FV, FV may be corrupted!\n"));\r
       return Status;\r
@@ -545,7 +572,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
     //\r
     for (FvIndex = 0; FvIndex < PrivateData->FvCount; FvIndex ++) {\r
       if (PrivateData->Fv[FvIndex].FvHandle == FvHandle) {\r
-        DEBUG ((EFI_D_INFO, "The Fv %p has already been processed!\n", FvInfoPpi->FvInfo));\r
+        DEBUG ((EFI_D_INFO, "The Fv %p has already been processed!\n", FvInfo2Ppi.FvInfo));\r
         return EFI_SUCCESS;\r
       }\r
     }\r
@@ -553,15 +580,16 @@ FirmwareVolmeInfoPpiNotifyCallback (
     //\r
     // Update internal PEI_CORE_FV array.\r
     //\r
-    PrivateData->Fv[PrivateData->FvCount].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) FvInfoPpi->FvInfo;\r
+    PrivateData->Fv[PrivateData->FvCount].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) FvInfo2Ppi.FvInfo;\r
     PrivateData->Fv[PrivateData->FvCount].FvPpi    = FvPpi;\r
     PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;\r
+    PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = FvInfo2Ppi.AuthenticationStatus;\r
     DEBUG ((\r
       EFI_D_INFO, \r
       "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n", \r
       (UINT32) PrivateData->FvCount, \r
-      (VOID *) FvInfoPpi->FvInfo, \r
-      FvInfoPpi->FvInfoSize,\r
+      (VOID *) FvInfo2Ppi.FvInfo, \r
+      FvInfo2Ppi.FvInfoSize,\r
       FvHandle\r
       ));    \r
     PrivateData->FvCount ++;\r
@@ -594,13 +622,13 @@ FirmwareVolmeInfoPpiNotifyCallback (
         }\r
         \r
         DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, PrivateData->FvCount - 1, FvHandle));\r
-        ProcessFvFile (&PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);\r
+        ProcessFvFile (PrivateData, &PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);\r
       }\r
     } while (FileHandle != NULL);\r
   } else {\r
-    DEBUG ((EFI_D_ERROR, "Fail to process FV %p because no corresponding EFI_FIRMWARE_VOLUME_PPI is found!\n", FvInfoPpi->FvInfo));\r
+    DEBUG ((EFI_D_ERROR, "Fail to process FV %p because no corresponding EFI_FIRMWARE_VOLUME_PPI is found!\n", FvInfo2Ppi.FvInfo));\r
     \r
-    AddUnknownFormatFvInfo (PrivateData, &FvInfoPpi->FvFormat, FvInfoPpi->FvInfo, FvInfoPpi->FvInfoSize);\r
+    AddUnknownFormatFvInfo (PrivateData, &FvInfo2Ppi);\r
   }\r
   \r
   return EFI_SUCCESS;\r
@@ -662,10 +690,12 @@ VerifyGuidedSectionGuid (
   \r
   @param PeiServices       An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
   @param SectionType       Filter to find only section of this type.\r
+  @param SectionInstance   Pointer to the filter to find the specific instance of section.\r
   @param Section           From where to search.\r
   @param SectionSize       The file size to search.\r
   @param OutputBuffer      A pointer to the discovered section, if successful.\r
                            NULL if section not found\r
+  @param AuthenticationStatus Updated upon return to point to the authentication status for this section.\r
   @param IsFfs3Fv          Indicates the FV format.\r
 \r
   @return EFI_NOT_FOUND    The match section is not found.\r
@@ -676,9 +706,11 @@ EFI_STATUS
 ProcessSection (\r
   IN CONST EFI_PEI_SERVICES     **PeiServices,\r
   IN EFI_SECTION_TYPE           SectionType,\r
+  IN OUT UINTN                  *SectionInstance,\r
   IN EFI_COMMON_SECTION_HEADER  *Section,\r
   IN UINTN                      SectionSize,\r
   OUT VOID                      **OutputBuffer,\r
+  OUT UINT32                    *AuthenticationStatus,\r
   IN BOOLEAN                    IsFfs3Fv\r
   )\r
 {\r
@@ -693,6 +725,9 @@ ProcessSection (
   UINT32                                  Authentication;\r
   PEI_CORE_INSTANCE                       *PrivateData;\r
   EFI_GUID                                *SectionDefinitionGuid;\r
+  BOOLEAN                                 SectionCached;\r
+  VOID                                    *TempOutputBuffer;\r
+  UINT32                                  TempAuthenticationStatus;\r
 \r
   PrivateData   = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);\r
   *OutputBuffer = NULL;\r
@@ -721,82 +756,132 @@ ProcessSection (
     }\r
 \r
     if (Section->Type == SectionType) {\r
-      if (IS_SECTION2 (Section)) {\r
-        *OutputBuffer = (VOID *)((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER2));\r
+      //\r
+      // The type matches, so check the instance count to see if it's the one we want.\r
+      //\r
+      (*SectionInstance)--;\r
+      if (*SectionInstance == 0) {\r
+        //\r
+        // Got it!\r
+        //\r
+        if (IS_SECTION2 (Section)) {\r
+          *OutputBuffer = (VOID *)((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER2));\r
+        } else {\r
+          *OutputBuffer = (VOID *)((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER));\r
+        }\r
+        return EFI_SUCCESS;\r
       } else {\r
-        *OutputBuffer = (VOID *)((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER));\r
+        if (IS_SECTION2 (Section)) {\r
+          SectionLength = SECTION2_SIZE (Section);\r
+        } else {\r
+          SectionLength = SECTION_SIZE (Section);\r
+        }\r
+        //\r
+        // SectionLength is adjusted it is 4 byte aligned.\r
+        // Go to the next section\r
+        //\r
+        SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);\r
+        ASSERT (SectionLength != 0);\r
+        ParsedLength += SectionLength;\r
+        Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);\r
+        continue;\r
       }\r
-      return EFI_SUCCESS;\r
     } else if ((Section->Type == EFI_SECTION_GUID_DEFINED) || (Section->Type == EFI_SECTION_COMPRESSION)) {\r
       //\r
       // Check the encapsulated section is extracted into the cache data.\r
       //\r
+      SectionCached = FALSE;\r
       for (Index = 0; Index < PrivateData->CacheSection.AllSectionCount; Index ++) {\r
         if (Section == PrivateData->CacheSection.Section[Index]) {\r
+          SectionCached = TRUE;\r
           PpiOutput     = PrivateData->CacheSection.SectionData[Index];\r
           PpiOutputSize = PrivateData->CacheSection.SectionSize[Index];\r
+          Authentication = PrivateData->CacheSection.AuthenticationStatus[Index];\r
           //\r
           // Search section directly from the cache data.\r
           //\r
-          return ProcessSection (\r
-                   PeiServices,\r
-                   SectionType, \r
-                   PpiOutput, \r
-                   PpiOutputSize, \r
-                   OutputBuffer,\r
-                   IsFfs3Fv\r
+          TempAuthenticationStatus = 0;\r
+          Status = ProcessSection (\r
+                     PeiServices,\r
+                     SectionType,\r
+                     SectionInstance,\r
+                     PpiOutput, \r
+                     PpiOutputSize, \r
+                     &TempOutputBuffer,\r
+                     &TempAuthenticationStatus,\r
+                     IsFfs3Fv\r
                    );\r
+          if (!EFI_ERROR (Status)) {\r
+            *OutputBuffer = TempOutputBuffer;\r
+            *AuthenticationStatus = TempAuthenticationStatus | Authentication;\r
+            return EFI_SUCCESS;\r
+          }\r
         }\r
       }\r
-      \r
-      Status = EFI_NOT_FOUND;\r
-      if (Section->Type == EFI_SECTION_GUID_DEFINED) {\r
-        if (IS_SECTION2 (Section)) {\r
-          SectionDefinitionGuid = &((EFI_GUID_DEFINED_SECTION2 *)Section)->SectionDefinitionGuid;\r
-        } else {\r
-          SectionDefinitionGuid = &((EFI_GUID_DEFINED_SECTION *)Section)->SectionDefinitionGuid;\r
-        }\r
-        if (VerifyGuidedSectionGuid (SectionDefinitionGuid, &GuidSectionPpi)) {\r
-          Status = GuidSectionPpi->ExtractSection (\r
-                                     GuidSectionPpi,\r
-                                     Section,\r
-                                     &PpiOutput,\r
-                                     &PpiOutputSize,\r
-                                     &Authentication\r
-                                     );\r
+\r
+      //\r
+      // If SectionCached is TRUE, the section data has been cached and scanned.\r
+      //\r
+      if (!SectionCached) {\r
+        Status = EFI_NOT_FOUND;\r
+        Authentication = 0;\r
+        if (Section->Type == EFI_SECTION_GUID_DEFINED) {\r
+          if (IS_SECTION2 (Section)) {\r
+            SectionDefinitionGuid = &((EFI_GUID_DEFINED_SECTION2 *)Section)->SectionDefinitionGuid;\r
+          } else {\r
+            SectionDefinitionGuid = &((EFI_GUID_DEFINED_SECTION *)Section)->SectionDefinitionGuid;\r
+          }\r
+          if (VerifyGuidedSectionGuid (SectionDefinitionGuid, &GuidSectionPpi)) {\r
+            Status = GuidSectionPpi->ExtractSection (\r
+                                       GuidSectionPpi,\r
+                                       Section,\r
+                                       &PpiOutput,\r
+                                       &PpiOutputSize,\r
+                                       &Authentication\r
+                                       );\r
+          }\r
+        } else if (Section->Type == EFI_SECTION_COMPRESSION) {\r
+          Status = PeiServicesLocatePpi (&gEfiPeiDecompressPpiGuid, 0, NULL, (VOID **) &DecompressPpi);\r
+          if (!EFI_ERROR (Status)) {\r
+            Status = DecompressPpi->Decompress (\r
+                                      DecompressPpi,\r
+                                      (CONST EFI_COMPRESSION_SECTION*) Section,\r
+                                      &PpiOutput,\r
+                                      &PpiOutputSize\r
+                                      );\r
+          }\r
         }\r
-      } else if (Section->Type == EFI_SECTION_COMPRESSION) {\r
-        Status = PeiServicesLocatePpi (&gEfiPeiDecompressPpiGuid, 0, NULL, (VOID **) &DecompressPpi);\r
+\r
         if (!EFI_ERROR (Status)) {\r
-          Status = DecompressPpi->Decompress (\r
-                                    DecompressPpi,\r
-                                    (CONST EFI_COMPRESSION_SECTION*) Section,\r
-                                    &PpiOutput,\r
-                                    &PpiOutputSize\r
-                                    );\r
-        }\r
-      }\r
-      \r
-      if (!EFI_ERROR (Status)) {\r
-        //\r
-        // Update cache section data.\r
-        //\r
-        if (PrivateData->CacheSection.AllSectionCount < CACHE_SETION_MAX_NUMBER) {\r
-          PrivateData->CacheSection.AllSectionCount ++;\r
+          //\r
+          // Update cache section data.\r
+          //\r
+          if (PrivateData->CacheSection.AllSectionCount < CACHE_SETION_MAX_NUMBER) {\r
+            PrivateData->CacheSection.AllSectionCount ++;\r
+          }\r
+          PrivateData->CacheSection.Section [PrivateData->CacheSection.SectionIndex]     = Section;\r
+          PrivateData->CacheSection.SectionData [PrivateData->CacheSection.SectionIndex] = PpiOutput;\r
+          PrivateData->CacheSection.SectionSize [PrivateData->CacheSection.SectionIndex] = PpiOutputSize;\r
+          PrivateData->CacheSection.AuthenticationStatus [PrivateData->CacheSection.SectionIndex] = Authentication;\r
+          PrivateData->CacheSection.SectionIndex = (PrivateData->CacheSection.SectionIndex + 1)%CACHE_SETION_MAX_NUMBER;\r
+\r
+          TempAuthenticationStatus = 0;\r
+          Status = ProcessSection (\r
+                     PeiServices,\r
+                     SectionType,\r
+                     SectionInstance,\r
+                     PpiOutput, \r
+                     PpiOutputSize, \r
+                     &TempOutputBuffer,\r
+                     &TempAuthenticationStatus,\r
+                     IsFfs3Fv\r
+                   );\r
+          if (!EFI_ERROR (Status)) {\r
+            *OutputBuffer = TempOutputBuffer;\r
+            *AuthenticationStatus = TempAuthenticationStatus | Authentication;\r
+            return EFI_SUCCESS;\r
+          }\r
         }\r
-        PrivateData->CacheSection.Section [PrivateData->CacheSection.SectionIndex]     = Section;\r
-        PrivateData->CacheSection.SectionData [PrivateData->CacheSection.SectionIndex] = PpiOutput;\r
-        PrivateData->CacheSection.SectionSize [PrivateData->CacheSection.SectionIndex] = PpiOutputSize;\r
-        PrivateData->CacheSection.SectionIndex = (PrivateData->CacheSection.SectionIndex + 1)%CACHE_SETION_MAX_NUMBER;\r
-        \r
-        return ProcessSection (\r
-                 PeiServices,\r
-                 SectionType, \r
-                 PpiOutput, \r
-                 PpiOutputSize, \r
-                 OutputBuffer,\r
-                 IsFfs3Fv\r
-                 );\r
       }\r
     }\r
 \r
@@ -851,6 +936,49 @@ PeiFfsFindSectionData (
   return CoreFvHandle->FvPpi->FindSectionByType (CoreFvHandle->FvPpi, SectionType, FileHandle, SectionData);\r
 }\r
 \r
+/**\r
+  Searches for the next matching section within the specified file.\r
+\r
+  @param  PeiServices           An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            Handle of the firmware file to search.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS      The section was found.\r
+  @retval EFI_NOT_FOUND    The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFindSectionData3 (\r
+  IN CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN     EFI_SECTION_TYPE      SectionType,\r
+  IN     UINTN                 SectionInstance,\r
+  IN     EFI_PEI_FILE_HANDLE   FileHandle,\r
+  OUT VOID                     **SectionData,\r
+  OUT UINT32                   *AuthenticationStatus\r
+  )\r
+{\r
+  PEI_CORE_FV_HANDLE           *CoreFvHandle;\r
+  \r
+  CoreFvHandle = FileHandleToVolume (FileHandle);\r
+  if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  if ((CoreFvHandle->FvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&\r
+      (CoreFvHandle->FvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {\r
+    return CoreFvHandle->FvPpi->FindSectionByType2 (CoreFvHandle->FvPpi, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus);\r
+  }\r
+  //\r
+  // The old FvPpi doesn't support to find section by section instance\r
+  // and return authentication status, so return EFI_UNSUPPORTED.\r
+  //\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
 /**\r
   Searches for the next matching file in the firmware volume.\r
 \r
@@ -1009,6 +1137,48 @@ PeiFfsGetFileInfo (
   return CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->FvPpi, FileHandle, FileInfo);\r
 }\r
 \r
+/**\r
+  Returns information about a specific file.\r
+\r
+  @param FileHandle       Handle of the file.\r
+  @param FileInfo         Upon exit, points to the file's information.\r
+\r
+  @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+  @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
+  @retval EFI_SUCCESS           File information returned.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI \r
+PeiFfsGetFileInfo2 (\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT EFI_FV_FILE_INFO2   *FileInfo\r
+  )\r
+{\r
+  PEI_CORE_FV_HANDLE          *CoreFvHandle;\r
+  \r
+  if ((FileHandle == NULL) || (FileInfo == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Retrieve the FirmwareVolume which the file resides in.\r
+  //\r
+  CoreFvHandle = FileHandleToVolume (FileHandle);\r
+  if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if ((CoreFvHandle->FvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&\r
+      (CoreFvHandle->FvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {\r
+    return CoreFvHandle->FvPpi->GetFileInfo2 (CoreFvHandle->FvPpi, FileHandle, FileInfo);\r
+  }\r
+  //\r
+  // The old FvPpi doesn't support to return file info with authentication status,\r
+  // so return EFI_UNSUPPORTED.\r
+  //\r
+  return EFI_UNSUPPORTED;\r
+}\r
 \r
 /**\r
   Returns information about the specified volume.\r
@@ -1050,19 +1220,22 @@ PeiFfsGetVolumeInfo (
 }\r
 \r
 /**\r
-  Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
+  Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.\r
 \r
+  @param PrivateData          PeiCore's private data structure\r
   @param ParentFvCoreHandle   Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.\r
   @param ParentFvFileHandle   File handle of a Fv type file that contain this Fv image.\r
 \r
   @retval EFI_NOT_FOUND         FV image can't be found.\r
   @retval EFI_SUCCESS           Successfully to process it.\r
   @retval EFI_OUT_OF_RESOURCES  Can not allocate page when aligning FV image\r
+  @retval EFI_SECURITY_VIOLATION Image is illegal\r
   @retval Others                Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
   \r
 **/\r
 EFI_STATUS\r
 ProcessFvFile (\r
+  IN  PEI_CORE_INSTANCE           *PrivateData,\r
   IN  PEI_CORE_FV_HANDLE          *ParentFvCoreHandle,\r
   IN  EFI_PEI_FILE_HANDLE         ParentFvFileHandle\r
   )\r
@@ -1077,6 +1250,7 @@ ProcessFvFile (
   EFI_FIRMWARE_VOLUME_HEADER    *FvHeader;\r
   EFI_FV_FILE_INFO              FileInfo;\r
   UINT64                        FvLength;\r
+  UINT32                        AuthenticationStatus;\r
   \r
   //\r
   // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already\r
@@ -1100,17 +1274,34 @@ ProcessFvFile (
   //\r
   // Find FvImage in FvFile\r
   //\r
-  Status = ParentFvPpi->FindSectionByType (\r
-                          ParentFvPpi,\r
-                          EFI_SECTION_FIRMWARE_VOLUME_IMAGE,\r
-                          ParentFvFileHandle,\r
-                          (VOID **)&FvHeader\r
-                          );\r
-             \r
+  AuthenticationStatus = 0;\r
+  if ((ParentFvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&\r
+      (ParentFvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {\r
+    Status = ParentFvPpi->FindSectionByType2 (\r
+                            ParentFvPpi,\r
+                            EFI_SECTION_FIRMWARE_VOLUME_IMAGE,\r
+                            0,\r
+                            ParentFvFileHandle,\r
+                            (VOID **)&FvHeader,\r
+                            &AuthenticationStatus\r
+                            );\r
+  } else {\r
+    Status = ParentFvPpi->FindSectionByType (\r
+                            ParentFvPpi,\r
+                            EFI_SECTION_FIRMWARE_VOLUME_IMAGE,\r
+                            ParentFvFileHandle,\r
+                            (VOID **)&FvHeader\r
+                            );\r
+  }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
+  Status = VerifyPeim (PrivateData, ParentFvHandle, ParentFvFileHandle, AuthenticationStatus);\r
+  if (Status == EFI_SECURITY_VIOLATION) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume\r
   // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from\r
@@ -1146,14 +1337,15 @@ ProcessFvFile (
   ASSERT_EFI_ERROR (Status);\r
   \r
   //\r
-  // Install FvPpi and Build FvHob\r
+  // Install FvInfo2 Ppi and Build FvHob\r
   //\r
-  PeiServicesInstallFvInfoPpi (\r
+  PeiServicesInstallFvInfo2Ppi (\r
     &FvHeader->FileSystemGuid,\r
     (VOID**) FvHeader,\r
     (UINT32) FvHeader->FvLength,\r
     &ParentFvImageInfo.FvName,\r
-    &FileInfo.FileName\r
+    &FileInfo.FileName,\r
+    AuthenticationStatus\r
     );\r
 \r
   //\r
@@ -1409,12 +1601,6 @@ PeiFfsFvPpiGetFileInfo (
     }\r
 \r
   FileHeader = (EFI_FFS_FILE_HEADER *)FileHandle;\r
-  CopyMem (&FileInfo->FileName, &FileHeader->Name, sizeof(EFI_GUID));\r
-  FileInfo->FileType = FileHeader->Type;\r
-  FileInfo->FileAttributes = FfsAttributes2FvFileAttributes (FileHeader->Attributes);\r
-  if ((CoreFvHandle->FvHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
-    FileInfo->FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
-  }\r
   if (IS_FFS_FILE2 (FileHeader)) {\r
     ASSERT (FFS_FILE2_SIZE (FileHeader) > 0x00FFFFFF);\r
     if (!FwVolInstance->IsFfs3Fv) {\r
@@ -1427,9 +1613,65 @@ PeiFfsFvPpiGetFileInfo (
     FileInfo->BufferSize = FFS_FILE_SIZE (FileHeader) - sizeof (EFI_FFS_FILE_HEADER);\r
     FileInfo->Buffer = (UINT8 *) FileHeader + sizeof (EFI_FFS_FILE_HEADER);\r
   }\r
-  return EFI_SUCCESS;  \r
-}  \r
-  \r
+  CopyMem (&FileInfo->FileName, &FileHeader->Name, sizeof(EFI_GUID));\r
+  FileInfo->FileType = FileHeader->Type;\r
+  FileInfo->FileAttributes = FfsAttributes2FvFileAttributes (FileHeader->Attributes);\r
+  if ((CoreFvHandle->FvHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
+    FileInfo->FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
+  }\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Returns information about a specific file.\r
+\r
+  This function returns information about a specific\r
+  file, including its file name, type, attributes, starting\r
+  address, size and authentication status.\r
+\r
+  @param This                     Points to this instance of the\r
+                                  EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param FileHandle               Handle of the file.\r
+  @param FileInfo                 Upon exit, points to the file's\r
+                                  information.\r
+\r
+  @retval EFI_SUCCESS             File information returned.\r
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not\r
+                                  represent a valid file.\r
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFvPpiGetFileInfo2 (\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This, \r
+  IN        EFI_PEI_FILE_HANDLE           FileHandle, \r
+  OUT       EFI_FV_FILE_INFO2             *FileInfo\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  PEI_CORE_FV_HANDLE          *CoreFvHandle;\r
+\r
+  if ((FileHandle == NULL) || (FileInfo == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Retrieve the FirmwareVolume which the file resides in.\r
+  //\r
+  CoreFvHandle = FileHandleToVolume (FileHandle);\r
+  if (CoreFvHandle == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  Status = PeiFfsFvPpiGetFileInfo (This, FileHandle, (EFI_FV_FILE_INFO *) FileInfo);\r
+  if (!EFI_ERROR (Status)) {\r
+    FileInfo->AuthenticationStatus = CoreFvHandle->AuthenticationStatus;\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
 /**\r
   This function returns information about the firmware volume.\r
   \r
@@ -1515,13 +1757,67 @@ PeiFfsFvPpiFindSectionByType (
   OUT VOID                                 **SectionData\r
   )\r
 {\r
+  UINT32 AuthenticationStatus;\r
+  return PeiFfsFvPpiFindSectionByType2 (This, SearchType, 0, FileHandle, SectionData, &AuthenticationStatus);\r
+}\r
+\r
+/**\r
+  Find the next matching section in the firmware file.\r
+\r
+  This service enables PEI modules to discover sections\r
+  of a given instance and type within a valid file.\r
+\r
+  @param This                   Points to this instance of the\r
+                                EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param SearchType             A filter to find only sections of this\r
+                                type.\r
+  @param SearchInstance         A filter to find the specific instance\r
+                                of sections.\r
+  @param FileHandle             Handle of firmware file in which to\r
+                                search.\r
+  @param SectionData            Updated upon return to point to the\r
+                                section found.\r
+  @param AuthenticationStatus   Updated upon return to point to the\r
+                                authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS     Section was found.\r
+  @retval EFI_NOT_FOUND   Section of the specified type was not\r
+                          found. SectionData contains NULL.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFvPpiFindSectionByType2 (\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI    *This,\r
+  IN        EFI_SECTION_TYPE               SearchType,\r
+  IN        UINTN                          SearchInstance,\r
+  IN        EFI_PEI_FILE_HANDLE            FileHandle,\r
+  OUT VOID                                 **SectionData,\r
+  OUT UINT32                               *AuthenticationStatus\r
+  )\r
+{\r
+  EFI_STATUS                              Status;\r
   EFI_FFS_FILE_HEADER                     *FfsFileHeader;\r
   UINT32                                  FileSize;\r
   EFI_COMMON_SECTION_HEADER               *Section;\r
   PEI_FW_VOL_INSTANCE                     *FwVolInstance;\r
+  PEI_CORE_FV_HANDLE                      *CoreFvHandle;\r
+  UINTN                                   Instance;\r
+  UINT32                                  ExtractedAuthenticationStatus;\r
+\r
+  if (SectionData == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
 \r
   FwVolInstance = PEI_FW_VOL_INSTANCE_FROM_FV_THIS (This);\r
 \r
+  //\r
+  // Retrieve the FirmwareVolume which the file resides in.\r
+  //\r
+  CoreFvHandle = FileHandleToVolume (FileHandle);\r
+  if (CoreFvHandle == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   FfsFileHeader = (EFI_FFS_FILE_HEADER *)(FileHandle);\r
 \r
   if (IS_FFS_FILE2 (FfsFileHeader)) {\r
@@ -1537,15 +1833,26 @@ PeiFfsFvPpiFindSectionByType (
     FileSize = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);\r
   }\r
 \r
-  return ProcessSection (\r
-           GetPeiServicesTablePointer (),\r
-           SearchType, \r
-           Section, \r
-           FileSize, \r
-           SectionData,\r
-           FwVolInstance->IsFfs3Fv\r
-           );  \r
-}  \r
+  Instance = SearchInstance + 1;\r
+  ExtractedAuthenticationStatus = 0;\r
+  Status = ProcessSection (\r
+             GetPeiServicesTablePointer (),\r
+             SearchType,\r
+             &Instance,\r
+             Section, \r
+             FileSize, \r
+             SectionData,\r
+             &ExtractedAuthenticationStatus,\r
+             FwVolInstance->IsFfs3Fv\r
+             );\r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // Inherit the authentication status.\r
+    //\r
+    *AuthenticationStatus = ExtractedAuthenticationStatus | CoreFvHandle->AuthenticationStatus;\r
+  }\r
+  return Status;\r
+}\r
 \r
 /**\r
   Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.\r
@@ -1732,26 +2039,22 @@ PeiReinitializeFv (
   Report the information for a new discoveried FV in unknown third-party format.\r
   \r
   If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for third-party FV format, but\r
-  the FV in this format has been discoveried, then this FV's information will be cached into \r
+  the FV in this format has been discoveried, then this FV's information will be cached into\r
   PEI_CORE_INSTANCE's UnknownFvInfo array.\r
   Also a notification would be installed for unknown third-party FV format guid, if EFI_PEI_FIRMWARE_VOLUME_PPI\r
   is installed later by platform's PEIM, the original unknown third-party FV will be processed by\r
   using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
   \r
   @param PrivateData  Point to instance of PEI_CORE_INSTANCE\r
-  @param Format       Point to the unknown third-party format guid.\r
-  @param FvInfo       Point to FvInfo buffer.\r
-  @param FvInfoSize   The size of FvInfo buffer.\r
+  @param FvInfo2Ppi   Point to FvInfo2 PPI.\r
   \r
   @retval EFI_OUT_OF_RESOURCES  The FV info array in PEI_CORE_INSTANCE has no more spaces.\r
   @retval EFI_SUCCESS           Success to add the information for unknown FV.\r
 **/\r
 EFI_STATUS\r
 AddUnknownFormatFvInfo (\r
-  IN PEI_CORE_INSTANCE *PrivateData,\r
-  IN EFI_GUID          *Format,\r
-  IN VOID              *FvInfo,\r
-  IN UINT32            FvInfoSize\r
+  IN PEI_CORE_INSTANCE                  *PrivateData,\r
+  IN EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI  *FvInfo2Ppi\r
   )\r
 {\r
   PEI_CORE_UNKNOW_FORMAT_FV_INFO    *NewUnknownFv;\r
@@ -1763,9 +2066,10 @@ AddUnknownFormatFvInfo (
   NewUnknownFv = &PrivateData->UnknownFvInfo[PrivateData->UnknownFvInfoCount];\r
   PrivateData->UnknownFvInfoCount ++;\r
   \r
-  CopyGuid (&NewUnknownFv->FvFormat, Format);\r
-  NewUnknownFv->FvInfo     = FvInfo;\r
-  NewUnknownFv->FvInfoSize = FvInfoSize;\r
+  CopyGuid (&NewUnknownFv->FvFormat, &FvInfo2Ppi->FvFormat);\r
+  NewUnknownFv->FvInfo     = FvInfo2Ppi->FvInfo;\r
+  NewUnknownFv->FvInfoSize = FvInfo2Ppi->FvInfoSize;\r
+  NewUnknownFv->AuthenticationStatus = FvInfo2Ppi->AuthenticationStatus;\r
   NewUnknownFv->NotifyDescriptor.Flags  = (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);\r
   NewUnknownFv->NotifyDescriptor.Guid   = &NewUnknownFv->FvFormat;\r
   NewUnknownFv->NotifyDescriptor.Notify = ThirdPartyFvPpiNotifyCallback;\r
@@ -1784,6 +2088,7 @@ AddUnknownFormatFvInfo (
   @param Format           Point to given FV format guid\r
   @param FvInfo           On return, the pointer of FV information buffer\r
   @param FvInfoSize       On return, the size of FV information buffer.\r
+  @param AuthenticationStatus On return, the authentication status of FV information buffer.\r
   \r
   @retval EFI_NOT_FOUND  The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI\r
   @retval EFI_SUCCESS    Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
@@ -1793,7 +2098,8 @@ FindUnknownFormatFvInfo (
   IN  PEI_CORE_INSTANCE *PrivateData,\r
   IN  EFI_GUID          *Format,\r
   OUT VOID              **FvInfo,\r
-  OUT UINT32            *FvInfoSize\r
+  OUT UINT32            *FvInfoSize,\r
+  OUT UINT32            *AuthenticationStatus\r
   )\r
 {\r
   UINTN Index;\r
@@ -1812,6 +2118,7 @@ FindUnknownFormatFvInfo (
   \r
   *FvInfo     = PrivateData->UnknownFvInfo[Index].FvInfo;\r
   *FvInfoSize = PrivateData->UnknownFvInfo[Index].FvInfoSize;\r
+  *AuthenticationStatus = PrivateData->UnknownFvInfo[Index].AuthenticationStatus;\r
   \r
   //\r
   // Remove an entry from UnknownFvInfo array.\r
@@ -1848,6 +2155,7 @@ ThirdPartyFvPpiNotifyCallback (
   EFI_PEI_FIRMWARE_VOLUME_PPI  *FvPpi;\r
   VOID                         *FvInfo;\r
   UINT32                       FvInfoSize;\r
+  UINT32                       AuthenticationStatus;\r
   EFI_STATUS                   Status;\r
   EFI_PEI_FV_HANDLE            FvHandle;\r
   BOOLEAN                      IsProcessed;\r
@@ -1859,7 +2167,7 @@ ThirdPartyFvPpiNotifyCallback (
   FvPpi = (EFI_PEI_FIRMWARE_VOLUME_PPI*) Ppi;\r
   \r
   do {\r
-    Status = FindUnknownFormatFvInfo (PrivateData, NotifyDescriptor->Guid, &FvInfo, &FvInfoSize);\r
+    Status = FindUnknownFormatFvInfo (PrivateData, NotifyDescriptor->Guid, &FvInfo, &FvInfoSize, &AuthenticationStatus);\r
     if (EFI_ERROR (Status)) {\r
       return EFI_SUCCESS;\r
     }\r
@@ -1901,6 +2209,7 @@ ThirdPartyFvPpiNotifyCallback (
     PrivateData->Fv[PrivateData->FvCount].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) FvInfo;\r
     PrivateData->Fv[PrivateData->FvCount].FvPpi    = FvPpi;\r
     PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;\r
+    PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = AuthenticationStatus;\r
     DEBUG ((\r
       EFI_D_INFO, \r
       "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n", \r
@@ -1939,7 +2248,7 @@ ThirdPartyFvPpiNotifyCallback (
         }\r
         \r
         DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, PrivateData->FvCount - 1, FvHandle));\r
-        ProcessFvFile (&PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);\r
+        ProcessFvFile (PrivateData, &PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);\r
       }\r
     } while (FileHandle != NULL);\r
   } while (TRUE);\r
index ed4013017591271b3dc54e74d27c110789d4f634..1daeb6d97b4963e5263a5c645dc2e272661f96ef 100644 (file)
@@ -159,6 +159,40 @@ PeiFfsFvPpiFindSectionByType (
   OUT VOID                                 **SectionData\r
   );\r
 \r
+/**\r
+  Find the next matching section in the firmware file.\r
+\r
+  This service enables PEI modules to discover sections\r
+  of a given instance and type within a valid file.\r
+\r
+  @param This                   Points to this instance of the\r
+                                EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param SearchType             A filter to find only sections of this\r
+                                type.\r
+  @param SearchInstance         A filter to find the specific instance\r
+                                of sections.\r
+  @param FileHandle             Handle of firmware file in which to\r
+                                search.\r
+  @param SectionData            Updated upon return to point to the\r
+                                section found.\r
+  @param AuthenticationStatus   Updated upon return to point to the\r
+                                authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS     Section was found.\r
+  @retval EFI_NOT_FOUND   Section of the specified type was not\r
+                          found. SectionData contains NULL.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFvPpiFindSectionByType2 (\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI    *This,\r
+  IN        EFI_SECTION_TYPE               SearchType,\r
+  IN        UINTN                          SearchInstance,\r
+  IN        EFI_PEI_FILE_HANDLE            FileHandle,\r
+  OUT VOID                                 **SectionData,\r
+  OUT UINT32                               *AuthenticationStatus\r
+  );\r
+\r
 /**\r
   Returns information about a specific file.\r
 \r
@@ -186,6 +220,33 @@ PeiFfsFvPpiGetFileInfo (
   OUT       EFI_FV_FILE_INFO              *FileInfo\r
   );\r
 \r
+/**\r
+  Returns information about a specific file.\r
+\r
+  This function returns information about a specific\r
+  file, including its file name, type, attributes, starting\r
+  address, size and authentication status.\r
+\r
+  @param This                     Points to this instance of the\r
+                                  EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param FileHandle               Handle of the file.\r
+  @param FileInfo                 Upon exit, points to the file's\r
+                                  information.\r
+\r
+  @retval EFI_SUCCESS             File information returned.\r
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not\r
+                                  represent a valid file.\r
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFvPpiGetFileInfo2 (\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This,\r
+  IN        EFI_PEI_FILE_HANDLE           FileHandle,\r
+  OUT       EFI_FV_FILE_INFO2             *FileInfo\r
+  );\r
+\r
 /**\r
   This function returns information about the firmware volume.\r
   \r
@@ -250,7 +311,7 @@ FindFileEx (
 /**\r
   Report the information for a new discoveried FV in unknown format.\r
   \r
-  If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been install for specifical FV format, but\r
+  If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for specifical FV format, but\r
   the FV in this FV format has been discoveried, then the information of this FV\r
   will be cached into PEI_CORE_INSTANCE's UnknownFvInfo array.\r
   Also a notification would be installed for unknown FV format guid, if EFI_PEI_FIRMWARE_VOLUME_PPI\r
@@ -258,19 +319,15 @@ FindFileEx (
   using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
   \r
   @param PrivateData  Point to instance of PEI_CORE_INSTANCE\r
-  @param Format       Point to the unknown FV format guid.\r
-  @param FvInfo       Point to FvInfo buffer.\r
-  @param FvInfoSize   The size of FvInfo buffer.\r
+  @param FvInfo2Ppi   Point to FvInfo2 PPI.\r
   \r
   @retval EFI_OUT_OF_RESOURCES  The FV info array in PEI_CORE_INSTANCE has no more spaces.\r
   @retval EFI_SUCCESS           Success to add the information for unknown FV.\r
 **/\r
 EFI_STATUS\r
 AddUnknownFormatFvInfo (\r
-  IN PEI_CORE_INSTANCE *PrivateData,\r
-  IN EFI_GUID          *Format,\r
-  IN VOID              *FvInfo,\r
-  IN UINT32            FvInfoSize\r
+  IN PEI_CORE_INSTANCE                  *PrivateData,\r
+  IN EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI  *FvInfo2Ppi\r
   );\r
   \r
 /**\r
@@ -283,6 +340,7 @@ AddUnknownFormatFvInfo (
   @param Format           Point to given FV format guid\r
   @param FvInfo           On return, the pointer of FV information buffer in given FV format guid\r
   @param FvInfoSize       On return, the size of FV information buffer.\r
+  @param AuthenticationStatus On return, the authentication status of FV information buffer.\r
   \r
   @retval EFI_NOT_FOUND  The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI\r
   @retval EFI_SUCCESS    Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
@@ -292,7 +350,8 @@ FindUnknownFormatFvInfo (
   IN  PEI_CORE_INSTANCE *PrivateData,\r
   IN  EFI_GUID          *Format,\r
   OUT VOID              **FvInfo,\r
-  OUT UINT32            *FvInfoSize\r
+  OUT UINT32            *FvInfoSize,\r
+  OUT UINT32            *AuthenticationStatus\r
   );\r
   \r
 /**\r
index 7a1d815b2b327bde2101527c7d128780735471a5..cab08fed91db52dfb2699e665f18d3e765f1165f 100644 (file)
@@ -540,23 +540,27 @@ PeiLoadImageLoadImage (
   // Try to find a first exe section (if PcdPeiCoreImageLoaderSearchTeSectionFirst\r
   // is true, TE will be searched first).\r
   //\r
-  Status = PeiServicesFfsFindSectionData (\r
+  Status = PeiServicesFfsFindSectionData3 (\r
              SearchType1,\r
+             0,\r
              FileHandle,\r
-             &Pe32Data\r
+             &Pe32Data,\r
+             AuthenticationState\r
              );\r
   //\r
   // If we didn't find a first exe section, try to find the second exe section.\r
   //\r
   if (EFI_ERROR (Status)) {\r
-    Status = PeiServicesFfsFindSectionData (\r
+    Status = PeiServicesFfsFindSectionData3 (\r
                SearchType2,\r
+               0,\r
                FileHandle,\r
-               &Pe32Data\r
+               &Pe32Data,\r
+               AuthenticationState\r
                );\r
     if (EFI_ERROR (Status)) {\r
       //\r
-      // PEI core only carry the loader function fro TE and PE32 executables\r
+      // PEI core only carry the loader function for TE and PE32 executables\r
       // If this two section does not exist, just return.\r
       //\r
       return Status;\r
index 193704de19a219b5f8bc4f01c9ae91b41aa1f747..6a9feb03c23c1192ff68f4ead3e8987fde2eecc0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definition of Pei Core Structures and Services\r
   \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Ppi/Reset.h>\r
 #include <Ppi/FirmwareVolume.h>\r
 #include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/FirmwareVolumeInfo2.h>\r
 #include <Ppi/Decompress.h>\r
 #include <Ppi/GuidedSectionExtraction.h>\r
 #include <Ppi/LoadFile.h>\r
@@ -110,12 +111,14 @@ typedef struct {
   UINT8                               PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
   EFI_PEI_FILE_HANDLE                 FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
   BOOLEAN                             ScanFv;\r
+  UINT32                              AuthenticationStatus;\r
 } PEI_CORE_FV_HANDLE;\r
 \r
 typedef struct {\r
   EFI_GUID                            FvFormat;\r
   VOID                                *FvInfo;\r
   UINT32                              FvInfoSize;\r
+  UINT32                              AuthenticationStatus;\r
   EFI_PEI_NOTIFY_DESCRIPTOR           NotifyDescriptor;\r
 } PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r
 \r
@@ -124,6 +127,7 @@ typedef struct {
   EFI_COMMON_SECTION_HEADER*          Section[CACHE_SETION_MAX_NUMBER];\r
   VOID*                               SectionData[CACHE_SETION_MAX_NUMBER];\r
   UINTN                               SectionSize[CACHE_SETION_MAX_NUMBER];\r
+  UINT32                              AuthenticationStatus[CACHE_SETION_MAX_NUMBER];\r
   UINTN                               AllSectionCount;\r
   UINTN                               SectionIndex;\r
 } CACHE_SECTION_DATA;\r
@@ -583,23 +587,23 @@ VerifyFv (
   );\r
 \r
 /**\r
-\r
   Provide a callout to the security verification service.\r
 \r
-\r
   @param PrivateData     PeiCore's private data structure\r
   @param VolumeHandle    Handle of FV\r
   @param FileHandle      Handle of PEIM's ffs\r
+  @param AuthenticationStatus Authentication status\r
 \r
   @retval EFI_SUCCESS              Image is OK\r
   @retval EFI_SECURITY_VIOLATION   Image is illegal\r
-\r
+  @retval EFI_NOT_FOUND            If security PPI is not installed.\r
 **/\r
 EFI_STATUS\r
 VerifyPeim (\r
   IN PEI_CORE_INSTANCE      *PrivateData,\r
   IN EFI_PEI_FV_HANDLE      VolumeHandle,\r
-  IN EFI_PEI_FILE_HANDLE    FileHandle\r
+  IN EFI_PEI_FILE_HANDLE    FileHandle,\r
+  IN UINT32                 AuthenticationStatus\r
   );\r
 \r
 /**\r
@@ -714,6 +718,31 @@ PeiFfsFindSectionData (
   OUT VOID                     **SectionData\r
   );\r
 \r
+/**\r
+  Searches for the next matching section within the specified file.\r
+\r
+  @param  PeiServices           An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            Handle of the firmware file to search.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS      The section was found.\r
+  @retval EFI_NOT_FOUND    The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiFfsFindSectionData3 (\r
+  IN CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN     EFI_SECTION_TYPE      SectionType,\r
+  IN     UINTN                 SectionInstance,\r
+  IN     EFI_PEI_FILE_HANDLE   FileHandle,\r
+  OUT VOID                     **SectionData,\r
+  OUT UINT32                   *AuthenticationStatus\r
+  );\r
+\r
 /**\r
   Search the firmware volumes by index\r
 \r
@@ -967,6 +996,24 @@ PeiFfsGetFileInfo (
   OUT EFI_FV_FILE_INFO    *FileInfo\r
   );\r
 \r
+/**\r
+  Returns information about a specific file.\r
+\r
+  @param FileHandle       Handle of the file.\r
+  @param FileInfo         Upon exit, points to the file's information.\r
+\r
+  @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
+  @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
+  @retval EFI_SUCCESS           File information returned.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI \r
+PeiFfsGetFileInfo2 (\r
+  IN EFI_PEI_FILE_HANDLE  FileHandle,\r
+  OUT EFI_FV_FILE_INFO2   *FileInfo\r
+  );\r
+\r
 /**\r
   Returns information about the specified volume.\r
 \r
@@ -1061,19 +1108,22 @@ SecurityPpiNotifyCallback (
   );\r
 \r
 /**\r
-  Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
+  Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.\r
 \r
+  @param PrivateData          PeiCore's private data structure\r
   @param ParentFvCoreHandle   Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.\r
   @param ParentFvFileHandle   File handle of a Fv type file that contain this Fv image.\r
 \r
   @retval EFI_NOT_FOUND         FV image can't be found.\r
   @retval EFI_SUCCESS           Successfully to process it.\r
   @retval EFI_OUT_OF_RESOURCES  Can not allocate page when aligning FV image\r
+  @retval EFI_SECURITY_VIOLATION Image is illegal\r
   @retval Others                Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
   \r
 **/\r
 EFI_STATUS\r
 ProcessFvFile (\r
+  IN  PEI_CORE_INSTANCE           *PrivateData,\r
   IN  PEI_CORE_FV_HANDLE          *ParentFvCoreHandle,\r
   IN  EFI_PEI_FILE_HANDLE         ParentFvFileHandle\r
   );\r
index 7cfce0b31a142c5800f48a6c5c9d39daefe0f6e8..26d1c49d5d8a7125ec778ae600de4f0877d78201 100644 (file)
   \r
 [Ppis]\r
   gEfiPeiStatusCodePpiGuid                      ## SOMETIMES_CONSUMES (PeiReportStatusService is not ready if this PPI doesn't exist)\r
-  gEfiPeiResetPpiGuid                           ## SOMETIMES_CONSUMES (PeiResetService is not ready if this PPI doesn't exist) \r
+  gEfiPeiResetPpiGuid                           ## SOMETIMES_CONSUMES (PeiResetService is not ready if this PPI doesn't exist)\r
   gEfiDxeIplPpiGuid                             ## CONSUMES\r
   gEfiPeiMemoryDiscoveredPpiGuid                ## PRODUCES\r
   gEfiPeiDecompressPpiGuid                      ## CONSUMES\r
-  gEfiPeiFirmwareVolumeInfoPpiGuid              ## NOTIFY   ## SOMETIMES_PRODUCES (Produce FvInfoPpi if the encapsulated FvImage is found) \r
+  gEfiPeiFirmwareVolumeInfoPpiGuid              ## NOTIFY   ## SOMETIMES_PRODUCES (Produce FvInfoPpi if the encapsulated FvImage is found)\r
+  gEfiPeiFirmwareVolumeInfo2PpiGuid             ## NOTIFY   ## SOMETIMES_PRODUCES (Produce FvInfo2Ppi if the encapsulated FvImage is found)\r
   gEfiPeiLoadFilePpiGuid                        ## PRODUCES ## SOMETIMES_CONSUMES (The default load PeImage logic will be used when this PPI doesn't exist)\r
   gEfiPeiSecurity2PpiGuid                       ## NOTIFY\r
   gEfiTemporaryRamSupportPpiGuid                ## CONSUMES\r
index 2f63e4c6a114b0b24428264c169048e4531fe5ab..bf000229aaccbe4b7326a3814c80ada2ce72d866 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Pei Core Main Entry Point\r
   \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -61,7 +61,9 @@ EFI_PEI_SERVICES  gPs = {
   PeiFfsFindFileByName,\r
   PeiFfsGetFileInfo,\r
   PeiFfsGetVolumeInfo,\r
-  PeiRegisterForShadow\r
+  PeiRegisterForShadow,\r
+  PeiFfsFindSectionData3,\r
+  PeiFfsGetFileInfo2\r
 };\r
 \r
 /**\r
index a7515ec2205c243517bf71c0f3a7236be4e004cc..f08926766a6019caaf1bfc1c0568133e0b563da3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   EFI PEI Core Security services\r
   \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -78,13 +78,12 @@ SecurityPpiNotifyCallback (
 }\r
 \r
 /**\r
-\r
   Provide a callout to the security verification service.\r
 \r
-\r
   @param PrivateData     PeiCore's private data structure\r
   @param VolumeHandle    Handle of FV\r
   @param FileHandle      Handle of PEIM's ffs\r
+  @param AuthenticationStatus Authentication status\r
 \r
   @retval EFI_SUCCESS              Image is OK\r
   @retval EFI_SECURITY_VIOLATION   Image is illegal\r
@@ -94,17 +93,13 @@ EFI_STATUS
 VerifyPeim (\r
   IN PEI_CORE_INSTANCE      *PrivateData,\r
   IN EFI_PEI_FV_HANDLE      VolumeHandle,\r
-  IN EFI_PEI_FILE_HANDLE    FileHandle\r
+  IN EFI_PEI_FILE_HANDLE    FileHandle,\r
+  IN UINT32                 AuthenticationStatus\r
   )\r
 {\r
   EFI_STATUS                      Status;\r
-  UINT32                          AuthenticationStatus;\r
   BOOLEAN                         DeferExection;\r
 \r
-  //\r
-  // Set a default authentication state\r
-  //\r
-  AuthenticationStatus = 0;\r
 \r
   if (PrivateData->PrivateSecurityPpi == NULL) {\r
     Status = EFI_NOT_FOUND;\r
index 358c9cddf511dc600561105e3f4316b96991b880..2b51d374c9b4056e383bf2913049e408107f7ecc 100644 (file)
@@ -220,6 +220,30 @@ PeiServicesFfsFindSectionData (
   OUT VOID                      **SectionData\r
   );\r
 \r
+/**\r
+  This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.\r
+\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            A pointer to the file header that contains the set \r
+                                of sections to be searched.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS           The section was found.\r
+  @retval EFI_NOT_FOUND         The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsFindSectionData3 (\r
+  IN EFI_SECTION_TYPE           SectionType,\r
+  IN UINTN                      SectionInstance,\r
+  IN EFI_PEI_FILE_HANDLE        FileHandle,\r
+  OUT VOID                      **SectionData,\r
+  OUT UINT32                    *AuthenticationStatus\r
+  );\r
+\r
 /**\r
   This service enables PEIMs to register the permanent memory configuration\r
   that has been initialized with the PEI Foundation.\r
@@ -348,6 +372,31 @@ PeiServicesFfsGetFileInfo (
   OUT EFI_FV_FILE_INFO            *FileInfo\r
   );\r
 \r
+/**\r
+  This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services\r
+  Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface\r
+  Specification for details.\r
+\r
+  @param FileHandle   Handle of the file.\r
+\r
+  @param FileInfo     Upon exit, points to the file's\r
+                      information.\r
+\r
+  @retval EFI_SUCCESS             File information returned.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not\r
+                                  represent a valid file.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.\r
+  \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsGetFileInfo2 (\r
+  IN CONST  EFI_PEI_FILE_HANDLE   FileHandle,\r
+  OUT EFI_FV_FILE_INFO2           *FileInfo\r
+  );\r
+\r
 /**\r
   This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services \r
   Table has been removed.  See the Platform Initialization Pre-EFI Initialization Core Interface \r
@@ -431,4 +480,45 @@ PeiServicesInstallFvInfoPpi (
   IN CONST EFI_GUID                *ParentFileName OPTIONAL\r
   );\r
 \r
+/**\r
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.\r
+\r
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using\r
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.\r
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().\r
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().\r
+\r
+  @param  FvFormat             Unique identifier of the format of the memory-mapped\r
+                               firmware volume.  This parameter is optional and\r
+                               may be NULL.  If NULL is specified, the\r
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
+  @param  FvInfo               Points to a buffer which allows the\r
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r
+                               The format of this buffer is specific to the FvFormat.\r
+                               For memory-mapped firmware volumes, this typically\r
+                               points to the first byte of the firmware volume.\r
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped\r
+                               firmware volumes, this is typically the size of\r
+                               the firmware volume.\r
+  @param  ParentFvName         If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID name of the originating firmware\r
+                               volume. Otherwise, this parameter must be NULL.\r
+  @param  ParentFileName       If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID file name of the originating\r
+                               firmware file. Otherwise, this parameter must be NULL.\r
+  @param  AuthenticationStatus Authentication Status\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiServicesInstallFvInfo2Ppi (\r
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL\r
+  IN CONST VOID                    *FvInfo,\r
+  IN       UINT32                  FvInfoSize,\r
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL\r
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL\r
+  IN       UINT32                  AuthenticationStatus\r
+  );\r
+\r
 #endif\r
index c3d147ac1b77bc74520a23fd5e20c444465d3ee4..f2da20a2367b906042cf9c60b7f35ee533f2015a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PI PEI master include file. This file should match the PI spec.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -395,6 +395,38 @@ EFI_STATUS
   OUT VOID                             **SectionData\r
   );\r
 \r
+/**\r
+  Searches for the next matching section within the specified file.\r
+\r
+  This service enables PEI modules to discover the section of a given type within a valid file.\r
+  This service will search within encapsulation sections (compression and GUIDed) as well. It will\r
+  search inside of a GUIDed section or a compressed section, but may not, for example, search a\r
+  GUIDed section inside a GUIDes section.\r
+  This service will not search within compression sections or GUIDed sections that require\r
+  extraction if memory is not present.\r
+\r
+  @param  PeiServices           An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            Handle of the firmware file to search.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS      The section was found.\r
+  @retval EFI_NOT_FOUND    The section was not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA3)(\r
+  IN CONST EFI_PEI_SERVICES            **PeiServices,\r
+  IN EFI_SECTION_TYPE                  SectionType,\r
+  IN UINTN                             SectionInstance,\r
+  IN EFI_PEI_FILE_HANDLE               FileHandle,\r
+  OUT VOID                             **SectionData,\r
+  OUT UINT32                           *AuthenticationStatus\r
+  );\r
+\r
 /**\r
   This function registers the found memory configuration with the PEI Foundation.\r
 \r
@@ -608,6 +640,38 @@ typedef struct {
   UINT32                  BufferSize;\r
 } EFI_FV_FILE_INFO;\r
 \r
+///\r
+/// The information with authentication status of the FV file.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Name of the file.\r
+  ///\r
+  EFI_GUID                FileName;\r
+  ///\r
+  /// File type.\r
+  ///\r
+  EFI_FV_FILETYPE         FileType;\r
+  ///\r
+  /// Attributes of the file.\r
+  ///\r
+  EFI_FV_FILE_ATTRIBUTES  FileAttributes;\r
+  ///\r
+  /// Points to the file's data (not the header).\r
+  /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
+  /// is zero.\r
+  ///\r
+  VOID                    *Buffer;\r
+  ///\r
+  /// Size of the file's data.\r
+  ///\r
+  UINT32                  BufferSize;\r
+  ///\r
+  /// Authentication status for this file.\r
+  ///\r
+  UINT32                  AuthenticationStatus;\r
+} EFI_FV_FILE_INFO2;\r
+\r
 /**\r
   Returns information about a specific file.\r
 \r
@@ -633,6 +697,30 @@ EFI_STATUS
   OUT EFI_FV_FILE_INFO            *FileInfo\r
   );\r
 \r
+/**\r
+  Returns information about a specific file.\r
+\r
+  This function returns information about a specific file,\r
+  including its file name, type, attributes, starting address, size and authentication status.\r
+  If the firmware volume is not memory mapped, then the Buffer member will be NULL.\r
+\r
+  @param FileHandle   The handle of the file.\r
+  @param FileInfo     Upon exit, points to the file's\r
+                      information.\r
+\r
+  @retval EFI_SUCCESS             File information was returned.\r
+  @retval EFI_INVALID_PARAMETER   FileHandle does not\r
+                                  represent a valid file.\r
+  @retval EFI_INVALID_PARAMETER   FileInfo is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO2)(\r
+  IN  EFI_PEI_FILE_HANDLE         FileHandle,\r
+  OUT EFI_FV_FILE_INFO2           *FileInfo\r
+  );\r
+\r
 ///\r
 /// The information of the FV volume.\r
 ///\r
@@ -813,6 +901,8 @@ struct _EFI_PEI_SERVICES {
   EFI_PEI_FFS_GET_FILE_INFO       FfsGetFileInfo;\r
   EFI_PEI_FFS_GET_VOLUME_INFO     FfsGetVolumeInfo;\r
   EFI_PEI_REGISTER_FOR_SHADOW     RegisterForShadow;\r
+  EFI_PEI_FFS_FIND_SECTION_DATA3  FindSectionData3;\r
+  EFI_PEI_FFS_GET_FILE_INFO2      FfsGetFileInfo2;\r
 };\r
 \r
 \r
index c8fc77b1518b1d2bcbee4bb1382d062b9ebc7326..d8998fad17fe502f5d97624133dbc7fbc63d2baf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This file provides functions for accessing a memory-mapped firmware volume of a specific format.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, 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
@@ -153,6 +153,33 @@ EFI_STATUS
   OUT EFI_FV_FILE_INFO                    *FileInfo\r
 );\r
 \r
+/**\r
+  Returns information about a specific file.\r
+\r
+  This function returns information about a specific\r
+  file, including its file name, type, attributes, starting\r
+  address, size and authentication status. \r
+\r
+  @param This                     Points to this instance of the\r
+                                  EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param FileHandle               Handle of the file.\r
+  @param FileInfo                 Upon exit, points to the file's\r
+                                  information.\r
+\r
+  @retval EFI_SUCCESS             File information returned.\r
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not\r
+                                  represent a valid file.\r
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FV_GET_FILE_INFO2)(\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This, \r
+  IN  EFI_PEI_FILE_HANDLE                 FileHandle,\r
+  OUT EFI_FV_FILE_INFO2                   *FileInfo\r
+);\r
+\r
 /**\r
   This function returns information about the firmware volume.\r
   \r
@@ -203,6 +230,43 @@ EFI_STATUS
   OUT VOID                                 **SectionData\r
 );\r
 \r
+/**\r
+  Find the next matching section in the firmware file.\r
+\r
+  This service enables PEI modules to discover sections\r
+  of a given instance and type within a valid file.\r
+\r
+  @param This                   Points to this instance of the\r
+                                EFI_PEI_FIRMWARE_VOLUME_PPI.\r
+  @param SearchType             A filter to find only sections of this\r
+                                type.\r
+  @param SearchInstance         A filter to find the specific instance\r
+                                of sections.\r
+  @param FileHandle             Handle of firmware file in which to\r
+                                search.\r
+  @param SectionData            Updated upon return to point to the\r
+                                section found.\r
+  @param AuthenticationStatus   Updated upon return to point to the\r
+                                authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS     Section was found.\r
+  @retval EFI_NOT_FOUND   Section of the specified type was not\r
+                          found. SectionData contains NULL.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PEI_FV_FIND_SECTION2)(\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI    *This,\r
+  IN  EFI_SECTION_TYPE                     SearchType,\r
+  IN  UINTN                                SearchInstance,\r
+  IN  EFI_PEI_FILE_HANDLE                  FileHandle,\r
+  OUT VOID                                 **SectionData,\r
+  OUT UINT32                               *AuthenticationStatus\r
+);\r
+\r
+#define EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE SIGNATURE_32 ('P', 'F', 'V', 'P')\r
+#define EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION 0x00010030\r
+\r
 ///\r
 /// This PPI provides functions for accessing a memory-mapped firmware volume of a specific format.\r
 ///\r
@@ -213,6 +277,16 @@ struct _EFI_PEI_FIRMWARE_VOLUME_PPI {
   EFI_PEI_FV_GET_FILE_INFO    GetFileInfo;\r
   EFI_PEI_FV_GET_INFO         GetVolumeInfo;\r
   EFI_PEI_FV_FIND_SECTION     FindSectionByType;\r
+  EFI_PEI_FV_GET_FILE_INFO2   GetFileInfo2;\r
+  EFI_PEI_FV_FIND_SECTION2    FindSectionByType2;\r
+  ///\r
+  /// Signature is used to keep backward-compatibility, set to {'P','F','V','P'}.\r
+  ///\r
+  UINT32                      Signature;\r
+  ///\r
+  /// Revision for further extension.\r
+  ///\r
+  UINT32                      Revision;\r
 };\r
 \r
 extern EFI_GUID gEfiPeiFirmwareVolumePpiGuid;\r
diff --git a/MdePkg/Include/Ppi/FirmwareVolumeInfo2.h b/MdePkg/Include/Ppi/FirmwareVolumeInfo2.h
new file mode 100644 (file)
index 0000000..6cb66b3
--- /dev/null
@@ -0,0 +1,72 @@
+/** @file\r
+  This file provides location, format and authentication status of a firmware volume.\r
+\r
+  Copyright (c) 2013, 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
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  @par Revision Reference:\r
+  This PPI is introduced in PI Version 1.3 errata.\r
+\r
+**/\r
+\r
+#ifndef __EFI_PEI_FIRMWARE_VOLUME_INFO2_H__\r
+#define __EFI_PEI_FIRMWARE_VOLUME_INFO2_H__\r
+\r
+\r
+\r
+#define EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI_GUID \\r
+{ 0xea7ca24b, 0xded5, 0x4dad, { 0xa3, 0x89, 0xbf, 0x82, 0x7e, 0x8f, 0x9b, 0x38 } }\r
+\r
+typedef struct _EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI  EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI;\r
+\r
+///\r
+///  This PPI describes the location and format of a firmware volume. \r
+///  The FvFormat can be EFI_FIRMWARE_FILE_SYSTEM2_GUID or the GUID for \r
+///  a user-defined format. The  EFI_FIRMWARE_FILE_SYSTEM2_GUID is \r
+///  the PI Firmware Volume format.\r
+///\r
+struct _EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI {\r
+  ///\r
+  /// Unique identifier of the format of the memory-mapped firmware volume.\r
+  ///\r
+  EFI_GUID  FvFormat;\r
+  ///\r
+  /// Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process\r
+  /// the volume. The format of this buffer is specific to the FvFormat.\r
+  /// For memory-mapped firmware volumes, this typically points to the first byte\r
+  /// of the firmware volume.\r
+  ///\r
+  VOID      *FvInfo;\r
+  ///\r
+  /// Size of the data provided by FvInfo. For memory-mapped firmware volumes,\r
+  /// this is typically the size of the firmware volume.\r
+  ///\r
+  UINT32    FvInfoSize;\r
+  ///\r
+  /// If the firmware volume originally came from a firmware file, then these\r
+  /// point to the parent firmware volume name and firmware volume file.\r
+  /// If it did not originally come from a firmware file, these should be NULL.\r
+  ///\r
+  EFI_GUID  *ParentFvName;\r
+  ///\r
+  /// If the firmware volume originally came from a firmware file, then these\r
+  /// point to the parent firmware volume name and firmware volume file.\r
+  /// If it did not originally come from a firmware file, these should be NULL.\r
+  ///\r
+  EFI_GUID  *ParentFileName;\r
+  ///\r
+  /// Authentication Status.\r
+  ///\r
+  UINT32    AuthenticationStatus;\r
+};\r
+\r
+extern EFI_GUID gEfiPeiFirmwareVolumeInfo2PpiGuid;\r
+\r
+#endif\r
+\r
index eed56d7535a05e963a5c7a395c36f32d5fe2d243..f7aabfca3791cc985676139b71f477bef0ea0aa1 100644 (file)
@@ -5,7 +5,7 @@
   policy to the PEI Foundation, namely the case of a PEIM's authentication \r
   state being returned during the PEI section extraction process.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, 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
@@ -75,7 +75,7 @@ EFI_STATUS
   IN CONST  EFI_PEI_SECURITY2_PPI *This,\r
   IN UINT32                       AuthenticationStatus,\r
   IN EFI_PEI_FV_HANDLE            FvHandle,\r
-  IN EFI_PEI_FV_HANDLE            FileHandle,\r
+  IN EFI_PEI_FILE_HANDLE          FileHandle,\r
   IN OUT    BOOLEAN               *DeferExecution\r
 );\r
 \r
index 835325cc38d727bfe9cf908edc717e0b538e811e..e10dd8800fb9226812005a0df40e6fd6cc2354b2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for PEI Services Library.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, 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
@@ -16,6 +16,7 @@
 #include <PiPei.h>\r
 \r
 #include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/FirmwareVolumeInfo2.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 \r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
-\r
-GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_PEI_PPI_DESCRIPTOR     mPpiListTemplate[] = {\r
-  {\r
-    (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-    &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
-    NULL\r
-  }\r
-};\r
-\r
 /**\r
   This service enables a given PEIM to register an interface into the PEI Foundation.\r
 \r
@@ -309,6 +301,36 @@ PeiServicesFfsFindSectionData (
   return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData);\r
 }\r
 \r
+/**\r
+  This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.\r
+\r
+  @param  SectionType           The value of the section type to find.\r
+  @param  SectionInstance       Section instance to find.\r
+  @param  FileHandle            A pointer to the file header that contains the set \r
+                                of sections to be searched.\r
+  @param  SectionData           A pointer to the discovered section, if successful.\r
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.\r
+\r
+  @retval EFI_SUCCESS           The section was found.\r
+  @retval EFI_NOT_FOUND         The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsFindSectionData3 (\r
+  IN EFI_SECTION_TYPE           SectionType,\r
+  IN UINTN                      SectionInstance,\r
+  IN EFI_PEI_FILE_HANDLE        FileHandle,\r
+  OUT VOID                      **SectionData,\r
+  OUT UINT32                    *AuthenticationStatus\r
+  )\r
+{\r
+  CONST EFI_PEI_SERVICES **PeiServices;\r
+\r
+  PeiServices = GetPeiServicesTablePointer ();\r
+  return (*PeiServices)->FindSectionData3 (PeiServices, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus);\r
+}\r
+\r
 /**\r
   This service enables PEIMs to register the permanent memory configuration\r
   that has been initialized with the PEI Foundation.\r
@@ -459,6 +481,30 @@ PeiServicesFfsGetFileInfo (
   return (*GetPeiServicesTablePointer())->FfsGetFileInfo (FileHandle, FileInfo);\r
 }\r
 \r
+/**\r
+  This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services\r
+  Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface\r
+  Specification for details.\r
+\r
+  @param FileHandle               The handle of the file.\r
+  @param FileInfo                 Upon exit, points to the file's\r
+                                  information.\r
+\r
+  @retval EFI_SUCCESS             File information returned.\r
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not\r
+                                  represent a valid file.\r
+  @retval EFI_INVALID_PARAMETER   FileInfo is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsGetFileInfo2 (\r
+  IN CONST  EFI_PEI_FILE_HANDLE   FileHandle,\r
+  OUT EFI_FV_FILE_INFO2           *FileInfo\r
+  )\r
+{\r
+  return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo);\r
+}\r
 \r
 /**\r
   This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services \r
@@ -522,43 +568,46 @@ PeiServicesFfsGetVolumeInfo (
 }\r
 \r
 /**\r
-  Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r
-  \r
-  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using \r
-  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r
-  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r
-  If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance so the PEI Core will be notified about a new firmware volume.\r
 \r
-  \r
-  @param  FvFormat             Unique identifier of the format of the memory-mapped \r
-                               firmware volume.  This parameter is optional and \r
-                               may be NULL.  If NULL is specified, the \r
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI using\r
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance.\r
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI, then ASSERT().\r
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI can not be installed, then ASSERT().\r
+\r
+  @param  InstallFvInfoPpi     Install FvInfo Ppi if it is TRUE. Otherwise, install FvInfo2 Ppi.\r
+  @param  FvFormat             Unique identifier of the format of the memory-mapped\r
+                               firmware volume.  This parameter is optional and\r
+                               may be NULL.  If NULL is specified, the\r
                                EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
-  @param  FvInfo               Points to a buffer which allows the \r
-                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. \r
-                               The format of this buffer is specific to the FvFormat. \r
-                               For memory-mapped firmware volumes, this typically \r
+  @param  FvInfo               Points to a buffer which allows the\r
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r
+                               The format of this buffer is specific to the FvFormat.\r
+                               For memory-mapped firmware volumes, this typically\r
                                points to the first byte of the firmware volume.\r
-  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped \r
-                               firmware volumes, this is typically the size of \r
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped\r
+                               firmware volumes, this is typically the size of\r
                                the firmware volume.\r
-  @param  ParentFvName         If the new firmware volume originated from a file \r
-                               in a different firmware volume, then this parameter \r
+  @param  ParentFvName         If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
                                specifies the GUID name of the originating firmware\r
                                volume. Otherwise, this parameter must be NULL.\r
-  @param  ParentFileName       If the new firmware volume originated from a file \r
-                               in a different firmware volume, then this parameter \r
-                               specifies the GUID file name of the originating \r
+  @param  ParentFileName       If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID file name of the originating\r
                                firmware file. Otherwise, this parameter must be NULL.\r
+  @param  AuthenticationStatus Authentication Status, it will be ignored if InstallFvInfoPpi is TRUE.\r
 **/\r
 VOID\r
 EFIAPI\r
-PeiServicesInstallFvInfoPpi (\r
+InternalPeiServicesInstallFvInfoPpi (\r
+  IN       BOOLEAN                 InstallFvInfoPpi,\r
   IN CONST EFI_GUID                *FvFormat, OPTIONAL\r
   IN CONST VOID                    *FvInfo,\r
   IN       UINT32                  FvInfoSize,\r
   IN CONST EFI_GUID                *ParentFvName, OPTIONAL\r
-  IN CONST EFI_GUID                *ParentFileName OPTIONAL\r
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL\r
+  IN       UINT32                  AuthenticationStatus\r
   )\r
 {\r
   EFI_STATUS                       Status;   \r
@@ -566,11 +615,24 @@ PeiServicesInstallFvInfoPpi (
   EFI_PEI_PPI_DESCRIPTOR           *FvInfoPpiDescriptor;\r
   EFI_GUID                         *ParentFvNameValue;\r
   EFI_GUID                         *ParentFileNameValue;\r
+  EFI_GUID                         *PpiGuid;\r
 \r
   ParentFvNameValue   = NULL;\r
   ParentFileNameValue = NULL;\r
-  FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r
-  ASSERT(FvInfoPpi != NULL);\r
+  if (InstallFvInfoPpi) {\r
+    //\r
+    // To install FvInfo Ppi.\r
+    //\r
+    FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r
+    PpiGuid = &gEfiPeiFirmwareVolumeInfoPpiGuid;\r
+  } else {\r
+    //\r
+    // To install FvInfo2 Ppi.\r
+    //\r
+    FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI));\r
+    ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *) FvInfoPpi)->AuthenticationStatus = AuthenticationStatus;\r
+    PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid;\r
+  }\r
 \r
   if (FvFormat != NULL) {\r
     CopyGuid (&FvInfoPpi->FvFormat, FvFormat);\r
@@ -590,12 +652,100 @@ PeiServicesInstallFvInfoPpi (
     FvInfoPpi->ParentFileName = ParentFileNameValue;\r
   }\r
 \r
-  FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);\r
+  FvInfoPpiDescriptor = AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));\r
   ASSERT (FvInfoPpiDescriptor != NULL);\r
 \r
+  FvInfoPpiDescriptor->Guid  = PpiGuid;\r
+  FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r
   FvInfoPpiDescriptor->Ppi   = (VOID *) FvInfoPpi;\r
   Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
 }\r
 \r
+/**\r
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r
+\r
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using\r
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r
+\r
+  @param  FvFormat             Unique identifier of the format of the memory-mapped\r
+                               firmware volume.  This parameter is optional and\r
+                               may be NULL.  If NULL is specified, the\r
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
+  @param  FvInfo               Points to a buffer which allows the\r
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r
+                               The format of this buffer is specific to the FvFormat.\r
+                               For memory-mapped firmware volumes, this typically\r
+                               points to the first byte of the firmware volume.\r
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped\r
+                               firmware volumes, this is typically the size of\r
+                               the firmware volume.\r
+  @param  ParentFvName         If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID name of the originating firmware\r
+                               volume. Otherwise, this parameter must be NULL.\r
+  @param  ParentFileName       If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID file name of the originating\r
+                               firmware file. Otherwise, this parameter must be NULL.\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiServicesInstallFvInfoPpi (\r
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL\r
+  IN CONST VOID                    *FvInfo,\r
+  IN       UINT32                  FvInfoSize,\r
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL\r
+  IN CONST EFI_GUID                *ParentFileName OPTIONAL\r
+  )\r
+{\r
+  InternalPeiServicesInstallFvInfoPpi (TRUE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, 0);\r
+}\r
+\r
+/**\r
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.\r
+\r
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using\r
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.\r
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().\r
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().\r
+\r
+  @param  FvFormat             Unique identifier of the format of the memory-mapped\r
+                               firmware volume.  This parameter is optional and\r
+                               may be NULL.  If NULL is specified, the\r
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
+  @param  FvInfo               Points to a buffer which allows the\r
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r
+                               The format of this buffer is specific to the FvFormat.\r
+                               For memory-mapped firmware volumes, this typically\r
+                               points to the first byte of the firmware volume.\r
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped\r
+                               firmware volumes, this is typically the size of\r
+                               the firmware volume.\r
+  @param  ParentFvName         If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID name of the originating firmware\r
+                               volume. Otherwise, this parameter must be NULL.\r
+  @param  ParentFileName       If the new firmware volume originated from a file\r
+                               in a different firmware volume, then this parameter\r
+                               specifies the GUID file name of the originating\r
+                               firmware file. Otherwise, this parameter must be NULL.\r
+  @param  AuthenticationStatus Authentication Status\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiServicesInstallFvInfo2Ppi (\r
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL\r
+  IN CONST VOID                    *FvInfo,\r
+  IN       UINT32                  FvInfoSize,\r
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL\r
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL\r
+  IN       UINT32                  AuthenticationStatus\r
+  )\r
+{\r
+  InternalPeiServicesInstallFvInfoPpi (FALSE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, AuthenticationStatus);\r
+}\r
+\r
index cd70de7800ddd93dc453f1175a24beee7c9dc4d6..1806042a24ce17fe1b168e97d61e2787a45d0637 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # PEI Services Library implementation.\r
 #\r
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -43,6 +43,7 @@
 \r
 [Ppis]\r
   gEfiPeiFirmwareVolumeInfoPpiGuid   ## PRODUCES\r
+  gEfiPeiFirmwareVolumeInfo2PpiGuid  ## PRODUCES\r
 \r
 \r
 \r
index 916e538774237df13760bb639d1863b212bee8a7..6f9dcf955081d4f62cda8cc6f1458ee3da172dc0 100644 (file)
   ## Include/Ppi/I2cMaster.h\r
   gEfiPeiI2cMasterPpiGuid            = { 0xb3bfab9b, 0x9f9c, 0x4e8b, { 0xad, 0x37, 0x7f, 0x8c, 0x51, 0xfc, 0x62, 0x80 }}\r
 \r
+  ## Include/Ppi/FirmwareVolumeInfo2.h\r
+  gEfiPeiFirmwareVolumeInfo2PpiGuid  = { 0xea7ca24b, 0xded5, 0x4dad, { 0xa3, 0x89, 0xbf, 0x82, 0x7e, 0x8f, 0x9b, 0x38 } }\r
+\r
 [Protocols]\r
   #\r
   # Protocols defined in PI1.0.\r
index 7ff869d0fc80ceb08961769175c08442e4fd8a8b..ae905f7653b6d5c28281482be78d61993f7c47e7 100644 (file)
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <IndustryStandard/Tpm12.h>\r
 #include <IndustryStandard/UefiTcgPlatform.h>\r
 #include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/FirmwareVolumeInfo2.h>\r
 #include <Ppi/LockPhysicalPresence.h>\r
 #include <Ppi/TpmInitialized.h>\r
 #include <Ppi/FirmwareVolume.h>\r
@@ -122,6 +123,11 @@ EFI_PEI_NOTIFY_DESCRIPTOR           mNotifyList[] = {
     &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
     FirmwareVolmeInfoPpiNotifyCallback \r
   },\r
+  {\r
+    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,\r
+    &gEfiPeiFirmwareVolumeInfo2PpiGuid,\r
+    FirmwareVolmeInfoPpiNotifyCallback \r
+  },\r
   {\r
     (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
     &gEfiEndOfPeiSignalPpiGuid,\r
index d02296247802092581ca86c02b45442921123975..48a3e64362b73d8687c0fe6890fa76759e4dc78b 100644 (file)
@@ -57,6 +57,7 @@
 [Ppis]\r
   gPeiLockPhysicalPresencePpiGuid\r
   gEfiPeiFirmwareVolumeInfoPpiGuid\r
+  gEfiPeiFirmwareVolumeInfo2PpiGuid\r
   gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid\r
   gPeiTpmInitializedPpiGuid\r
   gEfiEndOfPeiSignalPpiGuid\r