]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/FwVol/FwVol.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / Pei / FwVol / FwVol.h
index a3cfdf9b1b8fdbcba0fa9c9ca953c3306056b8f5..4082cfbec1f856d19c8ea02a2e99e211e93c90ba 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   The internal header file for firmware volume related definitions.\r
-  \r
-Copyright (c) 2009, 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
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -21,6 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))\r
 \r
 \r
+#define PEI_FW_VOL_SIGNATURE  SIGNATURE_32('P','F','W','V')\r
+\r
+typedef struct {\r
+  UINTN                         Signature;\r
+  BOOLEAN                       IsFfs3Fv;\r
+  EFI_PEI_FIRMWARE_VOLUME_PPI   Fv;\r
+} PEI_FW_VOL_INSTANCE;\r
+\r
+#define PEI_FW_VOL_INSTANCE_FROM_FV_THIS(a) \\r
+  CR(a, PEI_FW_VOL_INSTANCE, Fv, PEI_FW_VOL_SIGNATURE)\r
+\r
+\r
 /**\r
   Process a firmware volume and create a volume handle.\r
 \r
@@ -31,15 +37,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   buffer which contains the necessary information for creating\r
   the firmware volume handle. Normally, these values are derived\r
   from the EFI_FIRMWARE_VOLUME_INFO_PPI.\r
-  \r
-  \r
+\r
+\r
   @param This                   Points to this instance of the\r
                                 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
   @param Buffer                 Points to the start of the buffer.\r
   @param BufferSize             Size of the buffer.\r
   @param FvHandle               Points to the returned firmware volume\r
                                 handle. The firmware volume handle must\r
-                                be unique within the system. \r
+                                be unique within the system.\r
 \r
   @retval EFI_SUCCESS           Firmware volume handle created.\r
   @retval EFI_VOLUME_CORRUPTED  Volume was corrupt.\r
@@ -47,17 +53,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiProcessVolume (\r
+PeiFfsFvPpiProcessVolume (\r
   IN  CONST  EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
   IN  VOID                               *Buffer,\r
   IN  UINTN                              BufferSize,\r
   OUT EFI_PEI_FV_HANDLE                  *FvHandle\r
   );\r
-  \r
+\r
 /**\r
   Finds the next file of the specified type.\r
 \r
-  This service enables PEI modules to discover additional firmware files. \r
+  This service enables PEI modules to discover additional firmware files.\r
   The FileHandle must be unique within the system.\r
 \r
   @param This           Points to this instance of the\r
@@ -75,10 +81,10 @@ PeiFfs2FvPpiProcessVolume (
   @retval EFI_SUCCESS   The file was found.\r
   @retval EFI_NOT_FOUND The file was not found. FileHandle contains NULL.\r
 \r
-**/  \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiFindFileByType (\r
+PeiFfsFvPpiFindFileByType (\r
   IN CONST  EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
   IN        EFI_FV_FILETYPE             SearchType,\r
   IN        EFI_PEI_FV_HANDLE           FvHandle,\r
@@ -86,8 +92,8 @@ PeiFfs2FvPpiFindFileByType (
   );\r
 \r
 /**\r
-  Find a file within a volume by its name. \r
-  \r
+  Find a file within a volume by its name.\r
+\r
   This service searches for files with a specific name, within\r
   either the specified firmware volume or all firmware volumes.\r
 \r
@@ -109,22 +115,22 @@ PeiFfs2FvPpiFindFileByType (
                                 FileName was NULL.\r
 \r
 \r
-**/    \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiFindFileByName (\r
+PeiFfsFvPpiFindFileByName (\r
   IN  CONST  EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
   IN  CONST  EFI_GUID                    *FileName,\r
   IN  EFI_PEI_FV_HANDLE                  *FvHandle,\r
-  OUT EFI_PEI_FILE_HANDLE                *FileHandle  \r
+  OUT EFI_PEI_FILE_HANDLE                *FileHandle\r
   );\r
 \r
 /**\r
   Find the next matching section in the firmware file.\r
-  \r
+\r
   This service enables PEI modules to discover sections\r
   of a given type within a valid file.\r
-  \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
@@ -133,27 +139,61 @@ PeiFfs2FvPpiFindFileByName (
                           search.\r
   @param SectionData      Updated upon  return to point to the\r
                           section found.\r
-  \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
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiFindSectionByType (\r
+PeiFfsFvPpiFindSectionByType (\r
   IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI    *This,\r
   IN        EFI_SECTION_TYPE               SearchType,\r
   IN        EFI_PEI_FILE_HANDLE            FileHandle,\r
   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
   This function returns information about a specific\r
   file, including its file name, type, attributes, starting\r
-  address and size. \r
-   \r
+  address and size.\r
+\r
   @param This                     Points to this instance of the\r
                                   EFI_PEI_FIRMWARE_VOLUME_PPI.\r
   @param FileHandle               Handle of the file.\r
@@ -164,19 +204,46 @@ PeiFfs2FvPpiFindSectionByType (
   @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
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiGetFileInfo (\r
-  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This, \r
-  IN        EFI_PEI_FILE_HANDLE           FileHandle, \r
+PeiFfsFvPpiGetFileInfo (\r
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This,\r
+  IN        EFI_PEI_FILE_HANDLE           FileHandle,\r
   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
+\r
   @param This                     Points to this instance of the\r
                                   EFI_PEI_FIRMWARE_VOLUME_PPI.\r
   @param FvHandle                 Handle to the firmware handle.\r
@@ -187,28 +254,28 @@ PeiFfs2FvPpiGetFileInfo (
   @retval EFI_INVALID_PARAMETER   FvHandle does not indicate a valid\r
                                   firmware volume or VolumeInfo is NULL.\r
 \r
-**/            \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeiFfs2FvPpiGetVolumeInfo (\r
-  IN  CONST  EFI_PEI_FIRMWARE_VOLUME_PPI   *This, \r
-  IN  EFI_PEI_FV_HANDLE                    FvHandle, \r
+PeiFfsFvPpiGetVolumeInfo (\r
+  IN  CONST  EFI_PEI_FIRMWARE_VOLUME_PPI   *This,\r
+  IN  EFI_PEI_FV_HANDLE                    FvHandle,\r
   OUT EFI_FV_INFO                          *VolumeInfo\r
   );\r
 \r
 /**\r
   Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.\r
-  \r
+\r
   @param FvHandle   The handle of a FV.\r
-  \r
+\r
   @retval NULL if can not find.\r
-  @return Pointer of corresponding PEI_CORE_FV_HANDLE. \r
+  @return Pointer of corresponding PEI_CORE_FV_HANDLE.\r
 **/\r
 PEI_CORE_FV_HANDLE *\r
 FvHandleToCoreHandle (\r
   IN EFI_PEI_FV_HANDLE  FvHandle\r
   );\r
-  \r
+\r
 /**\r
   Given the input file pointer, search for the next matching file in the\r
   FFS volume as defined by SearchType. The search starts from FileHeader inside\r
@@ -237,41 +304,38 @@ FindFileEx (
 \r
 /**\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
+\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
   is installed later by platform's PEIM, the original unknown FV will be processed by\r
   using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
-  \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
-  \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
 /**\r
   Find the FV information according to FV format guid.\r
-  \r
+\r
   This routine also will remove the FV information found by given FV format guid from\r
   PrivateData->UnknownFvInfo[].\r
-  \r
+\r
   @param PrivateData      Point to instance of PEI_CORE_INSTANCE\r
   @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
-  \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
 **/\r
@@ -280,19 +344,20 @@ 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
 /**\r
   Notification callback function for EFI_PEI_FIRMWARE_VOLUME_PPI.\r
-  \r
-  When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this \r
+\r
+  When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this\r
   routine is called to process all discoveried FVs in this format.\r
-  \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
   @param Ppi               Address of the PPI that was installed.\r
-  \r
+\r
   @retval EFI_SUCCESS  The notification callback is processed correctly.\r
 **/\r
 EFI_STATUS\r
@@ -301,6 +366,6 @@ ThirdPartyFvPpiNotifyCallback (
   IN EFI_PEI_SERVICES              **PeiServices,\r
   IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,\r
   IN VOID                          *Ppi\r
-  );  \r
-  \r
-#endif \r
+  );\r
+\r
+#endif\r