/** @file\r
The internal header file for firmware volume related definitions.\r
- \r
-Copyright (c) 2009, Intel Corporation \r
-All rights reserved. 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 - 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \\r
((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))\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
Process a firmware volume and create a volume handle.\r
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
**/\r
EFI_STATUS\r
EFIAPI\r
-PeiFfs2FvPpiProcessVolume (\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
+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
@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
- IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
- IN EFI_FV_FILETYPE SearchType,\r
- IN EFI_PEI_FV_HANDLE FvHandle,\r
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle\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
+ IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
);\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
FileName was NULL.\r
\r
\r
-**/ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
-PeiFfs2FvPpiFindFileByName (\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
+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
);\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
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
- 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
+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
\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
@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
- OUT EFI_FV_FILE_INFO *FileInfo\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
@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
- OUT EFI_FV_INFO *VolumeInfo\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
**/\r
EFI_STATUS\r
FindFileEx (\r
- IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
- IN CONST EFI_GUID *FileName, OPTIONAL\r
- IN EFI_FV_FILETYPE SearchType,\r
- IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r
- IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r
+ IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
+ IN CONST EFI_GUID *FileName OPTIONAL,\r
+ IN EFI_FV_FILETYPE SearchType,\r
+ IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r
+ IN OUT EFI_PEI_FILE_HANDLE *AprioriFile OPTIONAL\r
+ );\r
+\r
+/**\r
+ Report the information for a newly discovered FV in an unknown format.\r
+\r
+ If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for a third-party FV format, but\r
+ the FV has been discovered, then the information of this FV will be cached into PEI_CORE_INSTANCE's\r
+ UnknownFvInfo array.\r
+\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
+ @param PrivateData Point to instance of PEI_CORE_INSTANCE\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_PEI_FIRMWARE_VOLUME_INFO2_PPI *FvInfo2Ppi\r
+ );\r
+\r
+/**\r
+ Find the FV information according to FV format GUID.\r
+\r
+ This routine also will remove the FV information found by given FV format GUID from\r
+ PrivateData->UnknownFvInfo[].\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
+ @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
+EFI_STATUS\r
+FindUnknownFormatFvInfo (\r
+ IN PEI_CORE_INSTANCE *PrivateData,\r
+ IN EFI_GUID *Format,\r
+ OUT VOID **FvInfo,\r
+ OUT UINT32 *FvInfoSize,\r
+ OUT UINT32 *AuthenticationStatus\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
+ routine is called to process all discovered FVs in this format.\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
+ @retval EFI_SUCCESS The notification callback is processed correctly.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ThirdPartyFvPpiNotifyCallback (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
+ IN VOID *Ppi\r
);\r
\r
-#endif \r
+#endif\r