]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/FwVol/FwVol.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Core / Pei / FwVol / FwVol.h
CommitLineData
3b428ade 1/** @file\r
2 The internal header file for firmware volume related definitions.\r
3 \r
cd5ebaa0
HT
4Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials \r
3b428ade 6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#ifndef _FWVOL_H_\r
16#define _FWVOL_H_\r
17\r
18#include "PeiMain.h"\r
19\r
20#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \\r
21 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))\r
22\r
23\r
24/**\r
25 Process a firmware volume and create a volume handle.\r
26\r
27 Create a volume handle from the information in the buffer. For\r
28 memory-mapped firmware volumes, Buffer and BufferSize refer to\r
29 the start of the firmware volume and the firmware volume size.\r
30 For non memory-mapped firmware volumes, this points to a\r
31 buffer which contains the necessary information for creating\r
32 the firmware volume handle. Normally, these values are derived\r
33 from the EFI_FIRMWARE_VOLUME_INFO_PPI.\r
34 \r
35 \r
36 @param This Points to this instance of the\r
37 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
38 @param Buffer Points to the start of the buffer.\r
39 @param BufferSize Size of the buffer.\r
40 @param FvHandle Points to the returned firmware volume\r
41 handle. The firmware volume handle must\r
42 be unique within the system. \r
43\r
44 @retval EFI_SUCCESS Firmware volume handle created.\r
45 @retval EFI_VOLUME_CORRUPTED Volume was corrupt.\r
46\r
47**/\r
48EFI_STATUS\r
49EFIAPI\r
50PeiFfs2FvPpiProcessVolume (\r
51 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
52 IN VOID *Buffer,\r
53 IN UINTN BufferSize,\r
54 OUT EFI_PEI_FV_HANDLE *FvHandle\r
55 );\r
56 \r
57/**\r
58 Finds the next file of the specified type.\r
59\r
60 This service enables PEI modules to discover additional firmware files. \r
61 The FileHandle must be unique within the system.\r
62\r
63 @param This Points to this instance of the\r
64 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
65 @param SearchType A filter to find only files of this type. Type\r
66 EFI_FV_FILETYPE_ALL causes no filtering to be\r
67 done.\r
68 @param FvHandle Handle of firmware volume in which to\r
69 search.\r
70 @param FileHandle Points to the current handle from which to\r
71 begin searching or NULL to start at the\r
72 beginning of the firmware volume. Updated\r
73 upon return to reflect the file found.\r
74\r
75 @retval EFI_SUCCESS The file was found.\r
76 @retval EFI_NOT_FOUND The file was not found. FileHandle contains NULL.\r
77\r
78**/ \r
79EFI_STATUS\r
80EFIAPI\r
81PeiFfs2FvPpiFindFileByType (\r
82 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
83 IN EFI_FV_FILETYPE SearchType,\r
84 IN EFI_PEI_FV_HANDLE FvHandle,\r
85 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
86 );\r
87\r
88/**\r
89 Find a file within a volume by its name. \r
90 \r
91 This service searches for files with a specific name, within\r
92 either the specified firmware volume or all firmware volumes.\r
93\r
94 @param This Points to this instance of the\r
95 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
96 @param FileName A pointer to the name of the file to find\r
97 within the firmware volume.\r
98 @param FvHandle Upon entry, the pointer to the firmware\r
99 volume to search or NULL if all firmware\r
100 volumes should be searched. Upon exit, the\r
101 actual firmware volume in which the file was\r
102 found.\r
103 @param FileHandle Upon exit, points to the found file's\r
104 handle or NULL if it could not be found.\r
105\r
106 @retval EFI_SUCCESS File was found.\r
107 @retval EFI_NOT_FOUND File was not found.\r
108 @retval EFI_INVALID_PARAMETER FvHandle or FileHandle or\r
109 FileName was NULL.\r
110\r
111\r
112**/ \r
113EFI_STATUS\r
114EFIAPI\r
115PeiFfs2FvPpiFindFileByName (\r
116 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
117 IN CONST EFI_GUID *FileName,\r
118 IN EFI_PEI_FV_HANDLE *FvHandle,\r
119 OUT EFI_PEI_FILE_HANDLE *FileHandle \r
120 );\r
121\r
122/**\r
123 Find the next matching section in the firmware file.\r
124 \r
125 This service enables PEI modules to discover sections\r
126 of a given type within a valid file.\r
127 \r
128 @param This Points to this instance of the\r
129 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
130 @param SearchType A filter to find only sections of this\r
131 type.\r
132 @param FileHandle Handle of firmware file in which to\r
133 search.\r
134 @param SectionData Updated upon return to point to the\r
135 section found.\r
136 \r
137 @retval EFI_SUCCESS Section was found.\r
138 @retval EFI_NOT_FOUND Section of the specified type was not\r
139 found. SectionData contains NULL.\r
140**/ \r
141EFI_STATUS\r
142EFIAPI\r
143PeiFfs2FvPpiFindSectionByType (\r
144 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,\r
145 IN EFI_SECTION_TYPE SearchType,\r
146 IN EFI_PEI_FILE_HANDLE FileHandle,\r
147 OUT VOID **SectionData\r
148 );\r
149\r
150/**\r
151 Returns information about a specific file.\r
152\r
153 This function returns information about a specific\r
154 file, including its file name, type, attributes, starting\r
155 address and size. \r
156 \r
157 @param This Points to this instance of the\r
158 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
159 @param FileHandle Handle of the file.\r
160 @param FileInfo Upon exit, points to the file's\r
161 information.\r
162\r
163 @retval EFI_SUCCESS File information returned.\r
164 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
165 represent a valid file.\r
166 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
167 \r
168**/ \r
169EFI_STATUS\r
170EFIAPI\r
171PeiFfs2FvPpiGetFileInfo (\r
172 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, \r
173 IN EFI_PEI_FILE_HANDLE FileHandle, \r
174 OUT EFI_FV_FILE_INFO *FileInfo\r
175 );\r
176\r
177/**\r
178 This function returns information about the firmware volume.\r
179 \r
180 @param This Points to this instance of the\r
181 EFI_PEI_FIRMWARE_VOLUME_PPI.\r
182 @param FvHandle Handle to the firmware handle.\r
183 @param VolumeInfo Points to the returned firmware volume\r
184 information.\r
185\r
186 @retval EFI_SUCCESS Information returned successfully.\r
187 @retval EFI_INVALID_PARAMETER FvHandle does not indicate a valid\r
188 firmware volume or VolumeInfo is NULL.\r
189\r
190**/ \r
191EFI_STATUS\r
192EFIAPI\r
193PeiFfs2FvPpiGetVolumeInfo (\r
194 IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, \r
195 IN EFI_PEI_FV_HANDLE FvHandle, \r
196 OUT EFI_FV_INFO *VolumeInfo\r
197 );\r
198\r
199/**\r
200 Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.\r
201 \r
202 @param FvHandle The handle of a FV.\r
203 \r
204 @retval NULL if can not find.\r
205 @return Pointer of corresponding PEI_CORE_FV_HANDLE. \r
206**/\r
207PEI_CORE_FV_HANDLE *\r
208FvHandleToCoreHandle (\r
209 IN EFI_PEI_FV_HANDLE FvHandle\r
210 );\r
211 \r
212/**\r
213 Given the input file pointer, search for the next matching file in the\r
214 FFS volume as defined by SearchType. The search starts from FileHeader inside\r
215 the Firmware Volume defined by FwVolHeader.\r
216\r
217\r
218 @param FvHandle Pointer to the FV header of the volume to search\r
219 @param FileName File name\r
220 @param SearchType Filter to find only files of this type.\r
221 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
222 @param FileHandle This parameter must point to a valid FFS volume.\r
223 @param AprioriFile Pointer to AprioriFile image in this FV if has\r
224\r
225 @return EFI_NOT_FOUND No files matching the search criteria were found\r
226 @retval EFI_SUCCESS Success to search given file\r
227\r
228**/\r
229EFI_STATUS\r
230FindFileEx (\r
231 IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
232 IN CONST EFI_GUID *FileName, OPTIONAL\r
233 IN EFI_FV_FILETYPE SearchType,\r
234 IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r
235 IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r
236 );\r
237\r
f3358329 238/**\r
239 Report the information for a new discoveried FV in unknown format.\r
240 \r
241 If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been install for specifical FV format, but\r
242 the FV in this FV format has been discoveried, then the information of this FV\r
243 will be cached into PEI_CORE_INSTANCE's UnknownFvInfo array.\r
244 Also a notification would be installed for unknown FV format guid, if EFI_PEI_FIRMWARE_VOLUME_PPI\r
245 is installed later by platform's PEIM, the original unknown FV will be processed by\r
246 using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
247 \r
248 @param PrivateData Point to instance of PEI_CORE_INSTANCE\r
249 @param Format Point to the unknown FV format guid.\r
250 @param FvInfo Point to FvInfo buffer.\r
251 @param FvInfoSize The size of FvInfo buffer.\r
252 \r
253 @retval EFI_OUT_OF_RESOURCES The FV info array in PEI_CORE_INSTANCE has no more spaces.\r
254 @retval EFI_SUCCESS Success to add the information for unknown FV.\r
255**/\r
256EFI_STATUS\r
257AddUnknownFormatFvInfo (\r
258 IN PEI_CORE_INSTANCE *PrivateData,\r
259 IN EFI_GUID *Format,\r
260 IN VOID *FvInfo,\r
261 IN UINT32 FvInfoSize\r
262 );\r
263 \r
264/**\r
265 Find the FV information according to FV format guid.\r
266 \r
267 This routine also will remove the FV information found by given FV format guid from\r
268 PrivateData->UnknownFvInfo[].\r
269 \r
270 @param PrivateData Point to instance of PEI_CORE_INSTANCE\r
271 @param Format Point to given FV format guid\r
272 @param FvInfo On return, the pointer of FV information buffer in given FV format guid\r
273 @param FvInfoSize On return, the size of FV information buffer.\r
274 \r
275 @retval EFI_NOT_FOUND The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI\r
276 @retval EFI_SUCCESS Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.\r
277**/\r
278EFI_STATUS\r
279FindUnknownFormatFvInfo (\r
280 IN PEI_CORE_INSTANCE *PrivateData,\r
281 IN EFI_GUID *Format,\r
282 OUT VOID **FvInfo,\r
283 OUT UINT32 *FvInfoSize\r
284 );\r
285 \r
286/**\r
287 Notification callback function for EFI_PEI_FIRMWARE_VOLUME_PPI.\r
288 \r
289 When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this \r
290 routine is called to process all discoveried FVs in this format.\r
291 \r
292 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
293 @param NotifyDescriptor Address of the notification descriptor data structure.\r
294 @param Ppi Address of the PPI that was installed.\r
295 \r
296 @retval EFI_SUCCESS The notification callback is processed correctly.\r
297**/\r
298EFI_STATUS\r
299EFIAPI\r
300ThirdPartyFvPpiNotifyCallback (\r
301 IN EFI_PEI_SERVICES **PeiServices,\r
302 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
303 IN VOID *Ppi\r
304 ); \r
305 \r
3b428ade 306#endif \r