]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Library/PeiServicesLib.h
Synchronization of MDE Library Spec., Mde.dec, and corresponding head files in MdePkg...
[mirror_edk2.git] / MdePkg / Include / Library / PeiServicesLib.h
... / ...
CommitLineData
1/** @file\r
2 Provides library functions for all PEI Services.\r
3\r
4Copyright (c) 2006 - 2008, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
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 __PEI_SERVICES_LIB_H__\r
16#define __PEI_SERVICES_LIB_H__\r
17\r
18/**\r
19 This service enables a given PEIM to register an interface into the PEI Foundation. \r
20\r
21 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
22\r
23 @retval EFI_SUCCESS The interface was successfully installed.\r
24 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r
25 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
26 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
27 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
28\r
29**/\r
30EFI_STATUS\r
31EFIAPI\r
32PeiServicesInstallPpi (\r
33 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
34 );\r
35\r
36/**\r
37 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
38\r
39 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
40 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
41\r
42 @retval EFI_SUCCESS The interface was successfully installed.\r
43 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r
44 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
45 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
46 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
47 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r
48 installed.\r
49\r
50**/\r
51EFI_STATUS\r
52EFIAPI\r
53PeiServicesReInstallPpi (\r
54 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
55 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
56 );\r
57\r
58/**\r
59 This service enables PEIMs to discover a given instance of an interface.\r
60\r
61 @param Guid A pointer to the GUID whose corresponding interface needs to be\r
62 found.\r
63 @param Instance The N-th instance of the interface that is required.\r
64 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
65 @param Ppi A pointer to the instance of the interface.\r
66\r
67 @retval EFI_SUCCESS The interface was successfully returned.\r
68 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
69\r
70**/\r
71EFI_STATUS\r
72EFIAPI\r
73PeiServicesLocatePpi (\r
74 IN CONST EFI_GUID *Guid,\r
75 IN UINTN Instance,\r
76 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
77 IN OUT VOID **Ppi\r
78 );\r
79\r
80/**\r
81 This service enables PEIMs to register a given service to be invoked when another service is\r
82 installed or reinstalled.\r
83\r
84 @param NotifyList A pointer to the list of notification interfaces that the caller\r
85 shall install.\r
86\r
87 @retval EFI_SUCCESS The interface was successfully installed.\r
88 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r
89 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the\r
90 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.\r
91 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96PeiServicesNotifyPpi (\r
97 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
98 );\r
99\r
100/**\r
101 This service enables PEIMs to ascertain the present value of the boot mode. \r
102\r
103 @param BootMode A pointer to contain the value of the boot mode.\r
104\r
105 @retval EFI_SUCCESS The boot mode was returned successfully.\r
106 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
107\r
108**/\r
109EFI_STATUS\r
110EFIAPI\r
111PeiServicesGetBootMode (\r
112 IN OUT EFI_BOOT_MODE *BootMode\r
113 );\r
114\r
115/**\r
116 This service enables PEIMs to update the boot mode variable. \r
117\r
118 @param BootMode The value of the boot mode to set.\r
119\r
120 @retval EFI_SUCCESS The value was successfully updated\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125PeiServicesSetBootMode (\r
126 IN EFI_BOOT_MODE BootMode\r
127 );\r
128\r
129/**\r
130 This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
131\r
132 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r
133\r
134 @retval EFI_SUCCESS The list was successfully returned.\r
135 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
136\r
137**/\r
138EFI_STATUS\r
139EFIAPI\r
140PeiServicesGetHobList (\r
141 OUT VOID **HobList\r
142 );\r
143\r
144/**\r
145 This service enables PEIMs to create various types of HOBs.\r
146\r
147 @param Type The type of HOB to be installed.\r
148 @param Length The length of the HOB to be added.\r
149 @param Hob The address of a pointer that will contain the HOB header.\r
150\r
151 @retval EFI_SUCCESS The HOB was successfully created.\r
152 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
153\r
154**/\r
155EFI_STATUS\r
156EFIAPI\r
157PeiServicesCreateHob (\r
158 IN UINT16 Type,\r
159 IN UINT16 Length,\r
160 OUT VOID **Hob\r
161 );\r
162\r
163/**\r
164 This service enables PEIMs to discover additional firmware volumes.\r
165\r
166 @param Instance This instance of the firmware volume to find. The value 0 is the\r
167 Boot Firmware Volume (BFV).\r
168 @param VolumeHandle Pointer to the firmware volume header of the volume to return.\r
169\r
170 @retval EFI_SUCCESS The volume was found.\r
171 @retval EFI_NOT_FOUND The volume was not found.\r
172 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r
173\r
174**/\r
175EFI_STATUS\r
176EFIAPI\r
177PeiServicesFfsFindNextVolume (\r
178 IN UINTN Instance,\r
179 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
180 );\r
181\r
182/**\r
183 This service enables PEIMs to discover additional firmware files.\r
184\r
185 @param SearchType A filter to find files only of this type.\r
186 @param VolumeHandle Pointer to the firmware volume header of the volume to search.\r
187 This parameter must point to a valid FFS volume.\r
188 @param FileHandle Pointer to the current file from which to begin searching.\r
189\r
190 @retval EFI_SUCCESS The file was found.\r
191 @retval EFI_NOT_FOUND The file was not found.\r
192 @retval EFI_NOT_FOUND The header checksum was not zero.\r
193\r
194**/\r
195EFI_STATUS\r
196EFIAPI\r
197PeiServicesFfsFindNextFile (\r
198 IN EFI_FV_FILETYPE SearchType,\r
199 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
200 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
201 );\r
202\r
203/**\r
204 This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
205\r
206 @param SectionType The value of the section type to find.\r
207 @param FileHandle A pointer to the file header that contains the set of sections to\r
208 be searched.\r
209 @param SectionData A pointer to the discovered section, if successful.\r
210\r
211 @retval EFI_SUCCESS The section was found.\r
212 @retval EFI_NOT_FOUND The section was not found.\r
213\r
214**/\r
215EFI_STATUS\r
216EFIAPI\r
217PeiServicesFfsFindSectionData (\r
218 IN EFI_SECTION_TYPE SectionType,\r
219 IN EFI_PEI_FILE_HANDLE FileHandle,\r
220 OUT VOID **SectionData\r
221 );\r
222\r
223/**\r
224 This service enables PEIMs to register the permanent memory configuration\r
225 that has been initialized with the PEI Foundation.\r
226\r
227 @param MemoryBegin The value of a region of installed memory.\r
228 @param MemoryLength The corresponding length of a region of installed memory.\r
229\r
230 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
231 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
232 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
233\r
234**/\r
235EFI_STATUS\r
236EFIAPI\r
237PeiServicesInstallPeiMemory (\r
238 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
239 IN UINT64 MemoryLength\r
240 );\r
241\r
242/**\r
243 This service enables PEIMs to allocate memory after the permanent memory has been installed by a\r
244 PEIM.\r
245\r
246 @param MemoryType Type of memory to allocate.\r
247 @param Pages Number of pages to allocate.\r
248 @param Memory Pointer of memory allocated.\r
249\r
250 @retval EFI_SUCCESS The memory range was successfully allocated.\r
251 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
252 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
253 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
254\r
255**/\r
256EFI_STATUS\r
257EFIAPI\r
258PeiServicesAllocatePages (\r
259 IN EFI_MEMORY_TYPE MemoryType,\r
260 IN UINTN Pages,\r
261 OUT EFI_PHYSICAL_ADDRESS *Memory\r
262 );\r
263\r
264/**\r
265 This service allocates memory from the Hand-Off Block (HOB) heap.\r
266\r
267 @param Size The number of bytes to allocate from the pool.\r
268 @param Buffer If the call succeeds, a pointer to a pointer to the allocate\r
269 buffer; undefined otherwise.\r
270\r
271 @retval EFI_SUCCESS The allocation was successful\r
272 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
273\r
274**/\r
275EFI_STATUS\r
276EFIAPI\r
277PeiServicesAllocatePool (\r
278 IN UINTN Size,\r
279 OUT VOID **Buffer\r
280 );\r
281\r
282/**\r
283 Resets the entire platform.\r
284\r
285 @retval EFI_SUCCESS The function completed successfully.\r
286 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
287\r
288**/\r
289EFI_STATUS\r
290EFIAPI\r
291PeiServicesResetSystem (\r
292 VOID\r
293 );\r
294\r
295\r
296/**\r
297 This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services \r
298 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
299 Specification for details. \r
300\r
301 @param FileName A pointer to the name of the file to\r
302 find within the firmware volume.\r
303\r
304 @param VolumeHandle The firmware volume to search FileHandle\r
305 Upon exit, points to the found file's\r
306 handle or NULL if it could not be found.\r
307 @param FileHandle Pointer to found file handle \r
308\r
309 @retval EFI_SUCCESS File was found.\r
310\r
311 @retval EFI_NOT_FOUND File was not found.\r
312\r
313 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
314 FileName was NULL.\r
315\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319PeiServicesFfsFindByName (\r
320 IN CONST EFI_GUID *FileName,\r
321 IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
322 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
323 );\r
324\r
325\r
326/**\r
327 This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services \r
328 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
329 Specification for details. \r
330\r
331 @param FileHandle Handle of the file.\r
332\r
333 @param FileInfo Upon exit, points to the file's\r
334 information.\r
335\r
336 @retval EFI_SUCCESS File information returned.\r
337 \r
338 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
339 represent a valid file.\r
340 \r
341 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
342 \r
343**/\r
344EFI_STATUS\r
345EFIAPI \r
346PeiServicesFfsGetFileInfo (\r
347 IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
348 OUT EFI_FV_FILE_INFO *FileInfo\r
349 );\r
350\r
351/**\r
352 This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services \r
353 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
354 Specification for details. \r
355\r
356 @param VolumeHandle Handle of the volume.\r
357\r
358 @param VolumeInfo Upon exit, points to the volume's\r
359 information.\r
360\r
361 @retval EFI_SUCCESS File information returned.\r
362 \r
363 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
364 represent a valid file.\r
365 \r
366 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
367\r
368**/\r
369EFI_STATUS\r
370EFIAPI\r
371PeiServicesFfsGetVolumeInfo (\r
372 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
373 OUT EFI_FV_INFO *VolumeInfo\r
374 );\r
375\r
376\r
377/**\r
378 This service is a wrapper for the PEI Service RegisterForShadow(), except the pointer to the PEI Services \r
379 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
380 Specification for details. \r
381\r
382 @param FileHandle PEIM's file handle. Must be the currently\r
383 executing PEIM.\r
384 \r
385 @retval EFI_SUCCESS The PEIM was successfully registered for\r
386 shadowing.\r
387\r
388 @retval EFI_ALREADY_STARTED The PEIM was previously\r
389 registered for shadowing.\r
390\r
391 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
392 valid file handle.\r
393**/\r
394EFI_STATUS\r
395EFIAPI\r
396PeiServicesRegisterForShadow (\r
397 IN EFI_PEI_FILE_HANDLE FileHandle\r
398 );\r
399\r
400/**\r
401 Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume.\r
402 \r
403 The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed\r
404 in and install the PPI.\r
405 \r
406 @param FvFormat Unique identifier of the format of the memory-mapped firmware volume. \r
407 If NULL is specified, EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID.\r
408 @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to\r
409 process the volume. The format of this buffer is specific to the FvFormat. For\r
410 memory-mapped firmware volumes, this typically points to the first byte of the\r
411 firmware volume.\r
412 @param FvInfoSize Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is\r
413 typically the size of the firmware volume.\r
414 @param ParentFvName If the firmware volume originally came from a firmware file, then these point to the\r
415 parent firmware volume name. If it did not originally come from a firmware file, \r
416 these should be NULL.\r
417 @param ParentFileName If the firmware volume originally came from a firmware file, then these point to the\r
418 firmware volume file. If it did not originally come from a firmware file, \r
419 these should be NULL.\r
420 \r
421**/\r
422VOID\r
423EFIAPI\r
424PeiServicesInstallFvInfoPpi (\r
425 IN CONST EFI_GUID *FvFormat, OPTIONAL\r
426 IN CONST VOID *FvInfo,\r
427 IN UINT32 FvInfoSize,\r
428 IN CONST EFI_GUID *ParentFvName, OPTIONAL\r
429 IN CONST EFI_GUID *ParentFileName OPTIONAL\r
430 );\r
431\r
432#endif\r