]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PeiServicesLib.h
MdePkg: fix comment typo in DebugLib.h
[mirror_edk2.git] / MdePkg / Include / Library / PeiServicesLib.h
CommitLineData
fb3df220 1/** @file\r
50a64e5b 2 Provides library functions for all PEI Services.\r
fb3df220 3\r
9df063a0
HT
4Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
50a64e5b 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
fb3df220 9\r
50a64e5b 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
fb3df220 12\r
fb3df220 13**/\r
14\r
15#ifndef __PEI_SERVICES_LIB_H__\r
16#define __PEI_SERVICES_LIB_H__\r
17\r
18/**\r
122e2191 19 This service enables a given PEIM to register an interface into the PEI Foundation.\r
fb3df220 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
1c280088 33 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
fb3df220 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
1c280088 54 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
55 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
fb3df220 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
1c280088 74 IN CONST EFI_GUID *Guid,\r
fb3df220 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
1c280088 97 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
fb3df220 98 );\r
99\r
100/**\r
122e2191 101 This service enables PEIMs to ascertain the present value of the boot mode.\r
fb3df220 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
c3363c92 112 OUT EFI_BOOT_MODE *BootMode\r
fb3df220 113 );\r
114\r
115/**\r
122e2191 116 This service enables PEIMs to update the boot mode variable.\r
fb3df220 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
67c89a21 141 OUT VOID **HobList\r
fb3df220 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
67c89a21 160 OUT VOID **Hob\r
fb3df220 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
122e2191 168 @param VolumeHandle Handle of the firmware volume header of the volume to return.\r
fb3df220 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
1c280088 179 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
fb3df220 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
01aef47b 186 @param VolumeHandle Pointer to the firmware volume header of the volume to search.\r
fb3df220 187 This parameter must point to a valid FFS volume.\r
122e2191 188 @param FileHandle Handle of the current file from which to begin searching.\r
fb3df220 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
1c280088 199 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
200 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
fb3df220 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
01aef47b 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
fb3df220 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
1c280088 219 IN EFI_PEI_FILE_HANDLE FileHandle,\r
67c89a21 220 OUT VOID **SectionData\r
fb3df220 221 );\r
222\r
c7935105
SZ
223/**\r
224 This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.\r
225\r
226 @param SectionType The value of the section type to find.\r
227 @param SectionInstance Section instance to find.\r
228 @param FileHandle A pointer to the file header that contains the set \r
229 of sections to be searched.\r
230 @param SectionData A pointer to the discovered section, if successful.\r
231 @param AuthenticationStatus A pointer to the authentication status for this section.\r
232\r
233 @retval EFI_SUCCESS The section was found.\r
234 @retval EFI_NOT_FOUND The section was not found.\r
235\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239PeiServicesFfsFindSectionData3 (\r
240 IN EFI_SECTION_TYPE SectionType,\r
241 IN UINTN SectionInstance,\r
242 IN EFI_PEI_FILE_HANDLE FileHandle,\r
243 OUT VOID **SectionData,\r
244 OUT UINT32 *AuthenticationStatus\r
245 );\r
246\r
fb3df220 247/**\r
248 This service enables PEIMs to register the permanent memory configuration\r
249 that has been initialized with the PEI Foundation.\r
250\r
251 @param MemoryBegin The value of a region of installed memory.\r
252 @param MemoryLength The corresponding length of a region of installed memory.\r
253\r
254 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
255 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
256 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
257\r
258**/\r
259EFI_STATUS\r
260EFIAPI\r
261PeiServicesInstallPeiMemory (\r
262 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
263 IN UINT64 MemoryLength\r
264 );\r
265\r
266/**\r
267 This service enables PEIMs to allocate memory after the permanent memory has been installed by a\r
268 PEIM.\r
269\r
270 @param MemoryType Type of memory to allocate.\r
271 @param Pages Number of pages to allocate.\r
272 @param Memory Pointer of memory allocated.\r
273\r
274 @retval EFI_SUCCESS The memory range was successfully allocated.\r
275 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
276 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
277 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
278\r
279**/\r
280EFI_STATUS\r
281EFIAPI\r
282PeiServicesAllocatePages (\r
283 IN EFI_MEMORY_TYPE MemoryType,\r
284 IN UINTN Pages,\r
67c89a21 285 OUT EFI_PHYSICAL_ADDRESS *Memory\r
fb3df220 286 );\r
287\r
288/**\r
289 This service allocates memory from the Hand-Off Block (HOB) heap.\r
290\r
291 @param Size The number of bytes to allocate from the pool.\r
292 @param Buffer If the call succeeds, a pointer to a pointer to the allocate\r
293 buffer; undefined otherwise.\r
294\r
295 @retval EFI_SUCCESS The allocation was successful\r
296 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
297\r
298**/\r
299EFI_STATUS\r
300EFIAPI\r
301PeiServicesAllocatePool (\r
302 IN UINTN Size,\r
303 OUT VOID **Buffer\r
304 );\r
305\r
306/**\r
67c89a21 307 Resets the entire platform.\r
fb3df220 308\r
67c89a21 309 @retval EFI_SUCCESS The function completed successfully.\r
fb3df220 310 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
311\r
312**/\r
313EFI_STATUS\r
314EFIAPI\r
315PeiServicesResetSystem (\r
316 VOID\r
317 );\r
318\r
319\r
67c89a21 320/**\r
321 This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services \r
322 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
323 Specification for details. \r
324\r
325 @param FileName A pointer to the name of the file to\r
326 find within the firmware volume.\r
327\r
328 @param VolumeHandle The firmware volume to search FileHandle\r
329 Upon exit, points to the found file's\r
330 handle or NULL if it could not be found.\r
01aef47b 331 @param FileHandle Pointer to found file handle \r
67c89a21 332\r
333 @retval EFI_SUCCESS File was found.\r
334\r
335 @retval EFI_NOT_FOUND File was not found.\r
336\r
337 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
338 FileName was NULL.\r
339\r
340**/\r
b0d803fe 341EFI_STATUS\r
342EFIAPI\r
98db57b0 343PeiServicesFfsFindFileByName (\r
b0d803fe 344 IN CONST EFI_GUID *FileName,\r
345 IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
346 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
347 );\r
348\r
349\r
67c89a21 350/**\r
351 This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services \r
352 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
353 Specification for details. \r
354\r
355 @param FileHandle Handle of the file.\r
356\r
357 @param FileInfo Upon exit, points to the file's\r
358 information.\r
359\r
360 @retval EFI_SUCCESS File information returned.\r
361 \r
362 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
363 represent a valid file.\r
364 \r
365 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
366 \r
367**/\r
b0d803fe 368EFI_STATUS\r
369EFIAPI \r
370PeiServicesFfsGetFileInfo (\r
371 IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
372 OUT EFI_FV_FILE_INFO *FileInfo\r
373 );\r
374\r
c7935105
SZ
375/**\r
376 This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services\r
377 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface\r
378 Specification for details.\r
379\r
380 @param FileHandle Handle of the file.\r
381\r
382 @param FileInfo Upon exit, points to the file's\r
383 information.\r
384\r
385 @retval EFI_SUCCESS File information returned.\r
386 \r
387 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
388 represent a valid file.\r
389 \r
390 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
391 \r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395PeiServicesFfsGetFileInfo2 (\r
396 IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
397 OUT EFI_FV_FILE_INFO2 *FileInfo\r
398 );\r
399\r
67c89a21 400/**\r
401 This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services \r
402 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
403 Specification for details. \r
404\r
405 @param VolumeHandle Handle of the volume.\r
406\r
407 @param VolumeInfo Upon exit, points to the volume's\r
408 information.\r
409\r
410 @retval EFI_SUCCESS File information returned.\r
411 \r
412 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
413 represent a valid file.\r
414 \r
415 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
416\r
417**/\r
b0d803fe 418EFI_STATUS\r
419EFIAPI\r
420PeiServicesFfsGetVolumeInfo (\r
421 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
422 OUT EFI_FV_INFO *VolumeInfo\r
423 );\r
424\r
425\r
67c89a21 426/**\r
427 This service is a wrapper for the PEI Service RegisterForShadow(), except the pointer to the PEI Services \r
428 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
429 Specification for details. \r
430\r
431 @param FileHandle PEIM's file handle. Must be the currently\r
432 executing PEIM.\r
433 \r
434 @retval EFI_SUCCESS The PEIM was successfully registered for\r
435 shadowing.\r
436\r
437 @retval EFI_ALREADY_STARTED The PEIM was previously\r
438 registered for shadowing.\r
439\r
440 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
441 valid file handle.\r
442**/\r
b0d803fe 443EFI_STATUS\r
444EFIAPI\r
445PeiServicesRegisterForShadow (\r
446 IN EFI_PEI_FILE_HANDLE FileHandle\r
447 );\r
448\r
f26f70ad 449/**\r
b75a165d 450 Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r
f26f70ad 451 \r
b75a165d
LG
452 This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using \r
453 the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r
454 If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r
455 If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r
456\r
f26f70ad 457 \r
b75a165d
LG
458 @param FvFormat Unique identifier of the format of the memory-mapped firmware volume.\r
459 This parameter is optional and may be NULL. \r
460 If NULL is specified, the EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
461 @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. \r
462 The format of this buffer is specific to the FvFormat. For memory-mapped firmware volumes, \r
463 this typically points to the first byte of the firmware volume.\r
464 @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped firmware volumes, \r
465 this is typically the size of the firmware volume.\r
466 @param ParentFvName If the new firmware volume originated from a file in a different firmware volume, \r
467 then this parameter specifies the GUID name of the originating firmware volume.\r
468 Otherwise, this parameter must be NULL.\r
469 @param ParentFileName If the new firmware volume originated from a file in a different firmware volume, \r
470 then this parameter specifies the GUID file name of the originating firmware file.\r
471 Otherwise, this parameter must be NULL.\r
f26f70ad 472**/\r
473VOID\r
474EFIAPI\r
475PeiServicesInstallFvInfoPpi (\r
476 IN CONST EFI_GUID *FvFormat, OPTIONAL\r
477 IN CONST VOID *FvInfo,\r
478 IN UINT32 FvInfoSize,\r
479 IN CONST EFI_GUID *ParentFvName, OPTIONAL\r
480 IN CONST EFI_GUID *ParentFileName OPTIONAL\r
481 );\r
b0d803fe 482\r
c7935105
SZ
483/**\r
484 Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.\r
485\r
486 This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using\r
487 the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.\r
488 If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().\r
489 If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().\r
490\r
491 @param FvFormat Unique identifier of the format of the memory-mapped\r
492 firmware volume. This parameter is optional and\r
493 may be NULL. If NULL is specified, the\r
494 EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
495 @param FvInfo Points to a buffer which allows the\r
496 EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r
497 The format of this buffer is specific to the FvFormat.\r
498 For memory-mapped firmware volumes, this typically\r
499 points to the first byte of the firmware volume.\r
500 @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped\r
501 firmware volumes, this is typically the size of\r
502 the firmware volume.\r
503 @param ParentFvName If the new firmware volume originated from a file\r
504 in a different firmware volume, then this parameter\r
505 specifies the GUID name of the originating firmware\r
506 volume. Otherwise, this parameter must be NULL.\r
507 @param ParentFileName If the new firmware volume originated from a file\r
508 in a different firmware volume, then this parameter\r
509 specifies the GUID file name of the originating\r
510 firmware file. Otherwise, this parameter must be NULL.\r
511 @param AuthenticationStatus Authentication Status\r
512**/\r
513VOID\r
514EFIAPI\r
515PeiServicesInstallFvInfo2Ppi (\r
516 IN CONST EFI_GUID *FvFormat, OPTIONAL\r
517 IN CONST VOID *FvInfo,\r
518 IN UINT32 FvInfoSize,\r
519 IN CONST EFI_GUID *ParentFvName, OPTIONAL\r
520 IN CONST EFI_GUID *ParentFileName, OPTIONAL\r
521 IN UINT32 AuthenticationStatus\r
522 );\r
523\r
fb3df220 524#endif\r