2 The internal header file for firmware volume related definitions.
4 Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
15 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
18 #define PEI_FW_VOL_SIGNATURE SIGNATURE_32('P','F','W','V')
23 EFI_PEI_FIRMWARE_VOLUME_PPI Fv
;
24 } PEI_FW_VOL_INSTANCE
;
26 #define PEI_FW_VOL_INSTANCE_FROM_FV_THIS(a) \
27 CR(a, PEI_FW_VOL_INSTANCE, Fv, PEI_FW_VOL_SIGNATURE)
31 Process a firmware volume and create a volume handle.
33 Create a volume handle from the information in the buffer. For
34 memory-mapped firmware volumes, Buffer and BufferSize refer to
35 the start of the firmware volume and the firmware volume size.
36 For non memory-mapped firmware volumes, this points to a
37 buffer which contains the necessary information for creating
38 the firmware volume handle. Normally, these values are derived
39 from the EFI_FIRMWARE_VOLUME_INFO_PPI.
42 @param This Points to this instance of the
43 EFI_PEI_FIRMWARE_VOLUME_PPI.
44 @param Buffer Points to the start of the buffer.
45 @param BufferSize Size of the buffer.
46 @param FvHandle Points to the returned firmware volume
47 handle. The firmware volume handle must
48 be unique within the system.
50 @retval EFI_SUCCESS Firmware volume handle created.
51 @retval EFI_VOLUME_CORRUPTED Volume was corrupt.
56 PeiFfsFvPpiProcessVolume (
57 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
60 OUT EFI_PEI_FV_HANDLE
*FvHandle
64 Finds the next file of the specified type.
66 This service enables PEI modules to discover additional firmware files.
67 The FileHandle must be unique within the system.
69 @param This Points to this instance of the
70 EFI_PEI_FIRMWARE_VOLUME_PPI.
71 @param SearchType A filter to find only files of this type. Type
72 EFI_FV_FILETYPE_ALL causes no filtering to be
74 @param FvHandle Handle of firmware volume in which to
76 @param FileHandle Points to the current handle from which to
77 begin searching or NULL to start at the
78 beginning of the firmware volume. Updated
79 upon return to reflect the file found.
81 @retval EFI_SUCCESS The file was found.
82 @retval EFI_NOT_FOUND The file was not found. FileHandle contains NULL.
87 PeiFfsFvPpiFindFileByType (
88 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
89 IN EFI_FV_FILETYPE SearchType
,
90 IN EFI_PEI_FV_HANDLE FvHandle
,
91 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
95 Find a file within a volume by its name.
97 This service searches for files with a specific name, within
98 either the specified firmware volume or all firmware volumes.
100 @param This Points to this instance of the
101 EFI_PEI_FIRMWARE_VOLUME_PPI.
102 @param FileName A pointer to the name of the file to find
103 within the firmware volume.
104 @param FvHandle Upon entry, the pointer to the firmware
105 volume to search or NULL if all firmware
106 volumes should be searched. Upon exit, the
107 actual firmware volume in which the file was
109 @param FileHandle Upon exit, points to the found file's
110 handle or NULL if it could not be found.
112 @retval EFI_SUCCESS File was found.
113 @retval EFI_NOT_FOUND File was not found.
114 @retval EFI_INVALID_PARAMETER FvHandle or FileHandle or
121 PeiFfsFvPpiFindFileByName (
122 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
123 IN CONST EFI_GUID
*FileName
,
124 IN EFI_PEI_FV_HANDLE
*FvHandle
,
125 OUT EFI_PEI_FILE_HANDLE
*FileHandle
129 Find the next matching section in the firmware file.
131 This service enables PEI modules to discover sections
132 of a given type within a valid file.
134 @param This Points to this instance of the
135 EFI_PEI_FIRMWARE_VOLUME_PPI.
136 @param SearchType A filter to find only sections of this
138 @param FileHandle Handle of firmware file in which to
140 @param SectionData Updated upon return to point to the
143 @retval EFI_SUCCESS Section was found.
144 @retval EFI_NOT_FOUND Section of the specified type was not
145 found. SectionData contains NULL.
149 PeiFfsFvPpiFindSectionByType (
150 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
151 IN EFI_SECTION_TYPE SearchType
,
152 IN EFI_PEI_FILE_HANDLE FileHandle
,
153 OUT VOID
**SectionData
157 Find the next matching section in the firmware file.
159 This service enables PEI modules to discover sections
160 of a given instance and type within a valid file.
162 @param This Points to this instance of the
163 EFI_PEI_FIRMWARE_VOLUME_PPI.
164 @param SearchType A filter to find only sections of this
166 @param SearchInstance A filter to find the specific instance
168 @param FileHandle Handle of firmware file in which to
170 @param SectionData Updated upon return to point to the
172 @param AuthenticationStatus Updated upon return to point to the
173 authentication status for this section.
175 @retval EFI_SUCCESS Section was found.
176 @retval EFI_NOT_FOUND Section of the specified type was not
177 found. SectionData contains NULL.
181 PeiFfsFvPpiFindSectionByType2 (
182 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
183 IN EFI_SECTION_TYPE SearchType
,
184 IN UINTN SearchInstance
,
185 IN EFI_PEI_FILE_HANDLE FileHandle
,
186 OUT VOID
**SectionData
,
187 OUT UINT32
*AuthenticationStatus
191 Returns information about a specific file.
193 This function returns information about a specific
194 file, including its file name, type, attributes, starting
197 @param This Points to this instance of the
198 EFI_PEI_FIRMWARE_VOLUME_PPI.
199 @param FileHandle Handle of the file.
200 @param FileInfo Upon exit, points to the file's
203 @retval EFI_SUCCESS File information returned.
204 @retval EFI_INVALID_PARAMETER If FileHandle does not
205 represent a valid file.
206 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
211 PeiFfsFvPpiGetFileInfo (
212 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
213 IN EFI_PEI_FILE_HANDLE FileHandle
,
214 OUT EFI_FV_FILE_INFO
*FileInfo
218 Returns information about a specific file.
220 This function returns information about a specific
221 file, including its file name, type, attributes, starting
222 address, size and authentication status.
224 @param This Points to this instance of the
225 EFI_PEI_FIRMWARE_VOLUME_PPI.
226 @param FileHandle Handle of the file.
227 @param FileInfo Upon exit, points to the file's
230 @retval EFI_SUCCESS File information returned.
231 @retval EFI_INVALID_PARAMETER If FileHandle does not
232 represent a valid file.
233 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
238 PeiFfsFvPpiGetFileInfo2 (
239 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
240 IN EFI_PEI_FILE_HANDLE FileHandle
,
241 OUT EFI_FV_FILE_INFO2
*FileInfo
245 This function returns information about the firmware volume.
247 @param This Points to this instance of the
248 EFI_PEI_FIRMWARE_VOLUME_PPI.
249 @param FvHandle Handle to the firmware handle.
250 @param VolumeInfo Points to the returned firmware volume
253 @retval EFI_SUCCESS Information returned successfully.
254 @retval EFI_INVALID_PARAMETER FvHandle does not indicate a valid
255 firmware volume or VolumeInfo is NULL.
260 PeiFfsFvPpiGetVolumeInfo (
261 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI
*This
,
262 IN EFI_PEI_FV_HANDLE FvHandle
,
263 OUT EFI_FV_INFO
*VolumeInfo
267 Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.
269 @param FvHandle The handle of a FV.
271 @retval NULL if can not find.
272 @return Pointer of corresponding PEI_CORE_FV_HANDLE.
275 FvHandleToCoreHandle (
276 IN EFI_PEI_FV_HANDLE FvHandle
280 Given the input file pointer, search for the next matching file in the
281 FFS volume as defined by SearchType. The search starts from FileHeader inside
282 the Firmware Volume defined by FwVolHeader.
285 @param FvHandle Pointer to the FV header of the volume to search
286 @param FileName File name
287 @param SearchType Filter to find only files of this type.
288 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
289 @param FileHandle This parameter must point to a valid FFS volume.
290 @param AprioriFile Pointer to AprioriFile image in this FV if has
292 @return EFI_NOT_FOUND No files matching the search criteria were found
293 @retval EFI_SUCCESS Success to search given file
298 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
299 IN CONST EFI_GUID
*FileName
, OPTIONAL
300 IN EFI_FV_FILETYPE SearchType
,
301 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
302 IN OUT EFI_PEI_FILE_HANDLE
*AprioriFile OPTIONAL
306 Report the information for a new discovered FV in unknown format.
308 If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for specific FV format, but
309 the FV in this FV format has been discovered, then the information of this FV
310 will be cached into PEI_CORE_INSTANCE's UnknownFvInfo array.
311 Also a notification would be installed for unknown FV format GUID, if EFI_PEI_FIRMWARE_VOLUME_PPI
312 is installed later by platform's PEIM, the original unknown FV will be processed by
313 using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.
315 @param PrivateData Point to instance of PEI_CORE_INSTANCE
316 @param FvInfo2Ppi Point to FvInfo2 PPI.
318 @retval EFI_OUT_OF_RESOURCES The FV info array in PEI_CORE_INSTANCE has no more spaces.
319 @retval EFI_SUCCESS Success to add the information for unknown FV.
322 AddUnknownFormatFvInfo (
323 IN PEI_CORE_INSTANCE
*PrivateData
,
324 IN EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI
*FvInfo2Ppi
328 Find the FV information according to FV format GUID.
330 This routine also will remove the FV information found by given FV format GUID from
331 PrivateData->UnknownFvInfo[].
333 @param PrivateData Point to instance of PEI_CORE_INSTANCE
334 @param Format Point to given FV format GUID
335 @param FvInfo On return, the pointer of FV information buffer in given FV format GUID
336 @param FvInfoSize On return, the size of FV information buffer.
337 @param AuthenticationStatus On return, the authentication status of FV information buffer.
339 @retval EFI_NOT_FOUND The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI
340 @retval EFI_SUCCESS Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.
343 FindUnknownFormatFvInfo (
344 IN PEI_CORE_INSTANCE
*PrivateData
,
347 OUT UINT32
*FvInfoSize
,
348 OUT UINT32
*AuthenticationStatus
352 Notification callback function for EFI_PEI_FIRMWARE_VOLUME_PPI.
354 When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this
355 routine is called to process all discovered FVs in this format.
357 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
358 @param NotifyDescriptor Address of the notification descriptor data structure.
359 @param Ppi Address of the PPI that was installed.
361 @retval EFI_SUCCESS The notification callback is processed correctly.
365 ThirdPartyFvPpiNotifyCallback (
366 IN EFI_PEI_SERVICES
**PeiServices
,
367 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,