]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Core/Pei/FwVol/FwVol.h
MdeModulePkg PeiCore: Improve comment semantics
[mirror_edk2.git] / MdeModulePkg / Core / Pei / FwVol / FwVol.h
... / ...
CommitLineData
1/** @file\r
2 The internal header file for firmware volume related definitions.\r
3\r
4Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
5SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#ifndef _FWVOL_H_\r
10#define _FWVOL_H_\r
11\r
12#include "PeiMain.h"\r
13\r
14#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \\r
15 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))\r
16\r
17\r
18#define PEI_FW_VOL_SIGNATURE SIGNATURE_32('P','F','W','V')\r
19\r
20typedef struct {\r
21 UINTN Signature;\r
22 BOOLEAN IsFfs3Fv;\r
23 EFI_PEI_FIRMWARE_VOLUME_PPI Fv;\r
24} PEI_FW_VOL_INSTANCE;\r
25\r
26#define PEI_FW_VOL_INSTANCE_FROM_FV_THIS(a) \\r
27 CR(a, PEI_FW_VOL_INSTANCE, Fv, PEI_FW_VOL_SIGNATURE)\r
28\r
29\r
30/**\r
31 Process a firmware volume and create a volume handle.\r
32\r
33 Create a volume handle from the information in the buffer. For\r
34 memory-mapped firmware volumes, Buffer and BufferSize refer to\r
35 the start of the firmware volume and the firmware volume size.\r
36 For non memory-mapped firmware volumes, this points to a\r
37 buffer which contains the necessary information for creating\r
38 the firmware volume handle. Normally, these values are derived\r
39 from the EFI_FIRMWARE_VOLUME_INFO_PPI.\r
40\r
41\r
42 @param This Points to this instance of the\r
43 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
44 @param Buffer Points to the start of the buffer.\r
45 @param BufferSize Size of the buffer.\r
46 @param FvHandle Points to the returned firmware volume\r
47 handle. The firmware volume handle must\r
48 be unique within the system.\r
49\r
50 @retval EFI_SUCCESS Firmware volume handle created.\r
51 @retval EFI_VOLUME_CORRUPTED Volume was corrupt.\r
52\r
53**/\r
54EFI_STATUS\r
55EFIAPI\r
56PeiFfsFvPpiProcessVolume (\r
57 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
58 IN VOID *Buffer,\r
59 IN UINTN BufferSize,\r
60 OUT EFI_PEI_FV_HANDLE *FvHandle\r
61 );\r
62\r
63/**\r
64 Finds the next file of the specified type.\r
65\r
66 This service enables PEI modules to discover additional firmware files.\r
67 The FileHandle must be unique within the system.\r
68\r
69 @param This Points to this instance of the\r
70 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
71 @param SearchType A filter to find only files of this type. Type\r
72 EFI_FV_FILETYPE_ALL causes no filtering to be\r
73 done.\r
74 @param FvHandle Handle of firmware volume in which to\r
75 search.\r
76 @param FileHandle Points to the current handle from which to\r
77 begin searching or NULL to start at the\r
78 beginning of the firmware volume. Updated\r
79 upon return to reflect the file found.\r
80\r
81 @retval EFI_SUCCESS The file was found.\r
82 @retval EFI_NOT_FOUND The file was not found. FileHandle contains NULL.\r
83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87PeiFfsFvPpiFindFileByType (\r
88 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
89 IN EFI_FV_FILETYPE SearchType,\r
90 IN EFI_PEI_FV_HANDLE FvHandle,\r
91 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
92 );\r
93\r
94/**\r
95 Find a file within a volume by its name.\r
96\r
97 This service searches for files with a specific name, within\r
98 either the specified firmware volume or all firmware volumes.\r
99\r
100 @param This Points to this instance of the\r
101 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
102 @param FileName A pointer to the name of the file to find\r
103 within the firmware volume.\r
104 @param FvHandle Upon entry, the pointer to the firmware\r
105 volume to search or NULL if all firmware\r
106 volumes should be searched. Upon exit, the\r
107 actual firmware volume in which the file was\r
108 found.\r
109 @param FileHandle Upon exit, points to the found file's\r
110 handle or NULL if it could not be found.\r
111\r
112 @retval EFI_SUCCESS File was found.\r
113 @retval EFI_NOT_FOUND File was not found.\r
114 @retval EFI_INVALID_PARAMETER FvHandle or FileHandle or\r
115 FileName was NULL.\r
116\r
117\r
118**/\r
119EFI_STATUS\r
120EFIAPI\r
121PeiFfsFvPpiFindFileByName (\r
122 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
123 IN CONST EFI_GUID *FileName,\r
124 IN EFI_PEI_FV_HANDLE *FvHandle,\r
125 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
126 );\r
127\r
128/**\r
129 Find the next matching section in the firmware file.\r
130\r
131 This service enables PEI modules to discover sections\r
132 of a given type within a valid file.\r
133\r
134 @param This Points to this instance of the\r
135 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
136 @param SearchType A filter to find only sections of this\r
137 type.\r
138 @param FileHandle Handle of firmware file in which to\r
139 search.\r
140 @param SectionData Updated upon return to point to the\r
141 section found.\r
142\r
143 @retval EFI_SUCCESS Section was found.\r
144 @retval EFI_NOT_FOUND Section of the specified type was not\r
145 found. SectionData contains NULL.\r
146**/\r
147EFI_STATUS\r
148EFIAPI\r
149PeiFfsFvPpiFindSectionByType (\r
150 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
151 IN EFI_SECTION_TYPE SearchType,\r
152 IN EFI_PEI_FILE_HANDLE FileHandle,\r
153 OUT VOID **SectionData\r
154 );\r
155\r
156/**\r
157 Find the next matching section in the firmware file.\r
158\r
159 This service enables PEI modules to discover sections\r
160 of a given instance and type within a valid file.\r
161\r
162 @param This Points to this instance of the\r
163 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
164 @param SearchType A filter to find only sections of this\r
165 type.\r
166 @param SearchInstance A filter to find the specific instance\r
167 of sections.\r
168 @param FileHandle Handle of firmware file in which to\r
169 search.\r
170 @param SectionData Updated upon return to point to the\r
171 section found.\r
172 @param AuthenticationStatus Updated upon return to point to the\r
173 authentication status for this section.\r
174\r
175 @retval EFI_SUCCESS Section was found.\r
176 @retval EFI_NOT_FOUND Section of the specified type was not\r
177 found. SectionData contains NULL.\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
181PeiFfsFvPpiFindSectionByType2 (\r
182 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
183 IN EFI_SECTION_TYPE SearchType,\r
184 IN UINTN SearchInstance,\r
185 IN EFI_PEI_FILE_HANDLE FileHandle,\r
186 OUT VOID **SectionData,\r
187 OUT UINT32 *AuthenticationStatus\r
188 );\r
189\r
190/**\r
191 Returns information about a specific file.\r
192\r
193 This function returns information about a specific\r
194 file, including its file name, type, attributes, starting\r
195 address and size.\r
196\r
197 @param This Points to this instance of the\r
198 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
199 @param FileHandle Handle of the file.\r
200 @param FileInfo Upon exit, points to the file's\r
201 information.\r
202\r
203 @retval EFI_SUCCESS File information returned.\r
204 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
205 represent a valid file.\r
206 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
207\r
208**/\r
209EFI_STATUS\r
210EFIAPI\r
211PeiFfsFvPpiGetFileInfo (\r
212 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
213 IN EFI_PEI_FILE_HANDLE FileHandle,\r
214 OUT EFI_FV_FILE_INFO *FileInfo\r
215 );\r
216\r
217/**\r
218 Returns information about a specific file.\r
219\r
220 This function returns information about a specific\r
221 file, including its file name, type, attributes, starting\r
222 address, size and authentication status.\r
223\r
224 @param This Points to this instance of the\r
225 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
226 @param FileHandle Handle of the file.\r
227 @param FileInfo Upon exit, points to the file's\r
228 information.\r
229\r
230 @retval EFI_SUCCESS File information returned.\r
231 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
232 represent a valid file.\r
233 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
234\r
235**/\r
236EFI_STATUS\r
237EFIAPI\r
238PeiFfsFvPpiGetFileInfo2 (\r
239 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
240 IN EFI_PEI_FILE_HANDLE FileHandle,\r
241 OUT EFI_FV_FILE_INFO2 *FileInfo\r
242 );\r
243\r
244/**\r
245 This function returns information about the firmware volume.\r
246\r
247 @param This Points to this instance of the\r
248 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
249 @param FvHandle Handle to the firmware handle.\r
250 @param VolumeInfo Points to the returned firmware volume\r
251 information.\r
252\r
253 @retval EFI_SUCCESS Information returned successfully.\r
254 @retval EFI_INVALID_PARAMETER FvHandle does not indicate a valid\r
255 firmware volume or VolumeInfo is NULL.\r
256\r
257**/\r
258EFI_STATUS\r
259EFIAPI\r
260PeiFfsFvPpiGetVolumeInfo (\r
261 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
262 IN EFI_PEI_FV_HANDLE FvHandle,\r
263 OUT EFI_FV_INFO *VolumeInfo\r
264 );\r
265\r
266/**\r
267 Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.\r
268\r
269 @param FvHandle The handle of a FV.\r
270\r
271 @retval NULL if can not find.\r
272 @return Pointer of corresponding PEI_CORE_FV_HANDLE.\r
273**/\r
274PEI_CORE_FV_HANDLE *\r
275FvHandleToCoreHandle (\r
276 IN EFI_PEI_FV_HANDLE FvHandle\r
277 );\r
278\r
279/**\r
280 Given the input file pointer, search for the next matching file in the\r
281 FFS volume as defined by SearchType. The search starts from FileHeader inside\r
282 the Firmware Volume defined by FwVolHeader.\r
283\r
284\r
285 @param FvHandle Pointer to the FV header of the volume to search\r
286 @param FileName File name\r
287 @param SearchType Filter to find only files of this type.\r
288 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
289 @param FileHandle This parameter must point to a valid FFS volume.\r
290 @param AprioriFile Pointer to AprioriFile image in this FV if has\r
291\r
292 @return EFI_NOT_FOUND No files matching the search criteria were found\r
293 @retval EFI_SUCCESS Success to search given file\r
294\r
295**/\r
296EFI_STATUS\r
297FindFileEx (\r
298 IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
299 IN CONST EFI_GUID *FileName, OPTIONAL\r
300 IN EFI_FV_FILETYPE SearchType,\r
301 IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r
302 IN OUT EFI_PEI_FILE_HANDLE *AprioriFile OPTIONAL\r
303 );\r
304\r
305/**\r
306 Report the information for a newly discovered FV in an unknown format.\r
307\r
308 If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for a third-party FV format, but\r
309 the FV has been discovered, then the information of this FV will be cached into PEI_CORE_INSTANCE's\r
310 UnknownFvInfo array.\r
311\r
312 Also a notification would be installed for unknown FV format GUID, if EFI_PEI_FIRMWARE_VOLUME_PPI\r
313 is installed later by platform's PEIM, the original unknown FV will be processed by\r
314 using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
315\r
316 @param PrivateData Point to instance of PEI_CORE_INSTANCE\r
317 @param FvInfo2Ppi Point to FvInfo2 PPI.\r
318\r
319 @retval EFI_OUT_OF_RESOURCES The FV info array in PEI_CORE_INSTANCE has no more spaces.\r
320 @retval EFI_SUCCESS Success to add the information for unknown FV.\r
321**/\r
322EFI_STATUS\r
323AddUnknownFormatFvInfo (\r
324 IN PEI_CORE_INSTANCE *PrivateData,\r
325 IN EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *FvInfo2Ppi\r
326 );\r
327\r
328/**\r
329 Find the FV information according to FV format GUID.\r
330\r
331 This routine also will remove the FV information found by given FV format GUID from\r
332 PrivateData->UnknownFvInfo[].\r
333\r
334 @param PrivateData Point to instance of PEI_CORE_INSTANCE\r
335 @param Format Point to given FV format GUID\r
336 @param FvInfo On return, the pointer of FV information buffer in given FV format GUID\r
337 @param FvInfoSize On return, the size of FV information buffer.\r
338 @param AuthenticationStatus On return, the authentication status of FV information buffer.\r
339\r
340 @retval EFI_NOT_FOUND The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI\r
341 @retval EFI_SUCCESS Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
342**/\r
343EFI_STATUS\r
344FindUnknownFormatFvInfo (\r
345 IN PEI_CORE_INSTANCE *PrivateData,\r
346 IN EFI_GUID *Format,\r
347 OUT VOID **FvInfo,\r
348 OUT UINT32 *FvInfoSize,\r
349 OUT UINT32 *AuthenticationStatus\r
350 );\r
351\r
352/**\r
353 Notification callback function for EFI_PEI_FIRMWARE_VOLUME_PPI.\r
354\r
355 When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this\r
356 routine is called to process all discovered FVs in this format.\r
357\r
358 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
359 @param NotifyDescriptor Address of the notification descriptor data structure.\r
360 @param Ppi Address of the PPI that was installed.\r
361\r
362 @retval EFI_SUCCESS The notification callback is processed correctly.\r
363**/\r
364EFI_STATUS\r
365EFIAPI\r
366ThirdPartyFvPpiNotifyCallback (\r
367 IN EFI_PEI_SERVICES **PeiServices,\r
368 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
369 IN VOID *Ppi\r
370 );\r
371\r
372#endif\r