]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PeiServicesLib.h
Add 2 functions to UefiLib library class: CatSPrint and CatVSPrint.
[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
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
67c89a21 261 OUT EFI_PHYSICAL_ADDRESS *Memory\r
fb3df220 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
67c89a21 283 Resets the entire platform.\r
fb3df220 284\r
67c89a21 285 @retval EFI_SUCCESS The function completed successfully.\r
fb3df220 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
67c89a21 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
01aef47b 307 @param FileHandle Pointer to found file handle \r
67c89a21 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
b0d803fe 317EFI_STATUS\r
318EFIAPI\r
98db57b0 319PeiServicesFfsFindFileByName (\r
b0d803fe 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
67c89a21 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
b0d803fe 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
67c89a21 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
b0d803fe 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
67c89a21 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
b0d803fe 394EFI_STATUS\r
395EFIAPI\r
396PeiServicesRegisterForShadow (\r
397 IN EFI_PEI_FILE_HANDLE FileHandle\r
398 );\r
399\r
f26f70ad 400/**\r
b75a165d 401 Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r
f26f70ad 402 \r
b75a165d
LG
403 This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using \r
404 the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r
405 If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r
406 If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r
407\r
f26f70ad 408 \r
b75a165d
LG
409 @param FvFormat Unique identifier of the format of the memory-mapped firmware volume.\r
410 This parameter is optional and may be NULL. \r
411 If NULL is specified, the EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
412 @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. \r
413 The format of this buffer is specific to the FvFormat. For memory-mapped firmware volumes, \r
414 this typically points to the first byte of the firmware volume.\r
415 @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped firmware volumes, \r
416 this is typically the size of the firmware volume.\r
417 @param ParentFvName If the new firmware volume originated from a file in a different firmware volume, \r
418 then this parameter specifies the GUID name of the originating firmware volume.\r
419 Otherwise, this parameter must be NULL.\r
420 @param ParentFileName If the new firmware volume originated from a file in a different firmware volume, \r
421 then this parameter specifies the GUID file name of the originating firmware file.\r
422 Otherwise, this parameter must be NULL.\r
f26f70ad 423**/\r
424VOID\r
425EFIAPI\r
426PeiServicesInstallFvInfoPpi (\r
427 IN CONST EFI_GUID *FvFormat, OPTIONAL\r
428 IN CONST VOID *FvInfo,\r
429 IN UINT32 FvInfoSize,\r
430 IN CONST EFI_GUID *ParentFvName, OPTIONAL\r
431 IN CONST EFI_GUID *ParentFileName OPTIONAL\r
432 );\r
b0d803fe 433\r
fb3df220 434#endif\r