]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiPeiCis.h
Updated the IpIoLiband and the change includes:
[mirror_edk2.git] / MdePkg / Include / Pi / PiPeiCis.h
CommitLineData
959ccb23 1/** @file\r
2 PI PEI master include file. This file should match the PI spec.\r
3\r
d7dfd027 4 Copyright (c) 2006 - 2009, Intel Corporation \r
959ccb23 5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
959ccb23 13 @par Revision Reference:\r
0047820e 14 PI Version 1.0\r
959ccb23 15\r
16**/\r
17\r
18#ifndef __PI_PEICIS_H__\r
19#define __PI_PEICIS_H__\r
20\r
d7dfd027 21#include <Uefi/UefiMultiPhase.h>\r
959ccb23 22#include <Pi/PiMultiPhase.h>\r
23\r
6de794cd 24///\r
25/// Handles of EFI FV.\r
26/// \r
00edb218 27typedef VOID *EFI_PEI_FV_HANDLE;\r
6de794cd 28\r
29///\r
30/// Handles of EFI FFS\r
31/// \r
00edb218 32typedef VOID *EFI_PEI_FILE_HANDLE;\r
959ccb23 33\r
6de794cd 34///\r
35/// Declare forward reference data structure for EFI_PEI_SERVICE\r
36/// \r
959ccb23 37typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES;\r
6de794cd 38\r
39///\r
40/// Declare forward reference data structure for EFI_PEI_NOTIFY_DESCRIPTOR\r
41/// \r
959ccb23 42typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR;\r
43\r
44\r
45#include <Ppi/CpuIo.h>\r
46#include <Ppi/PciCfg2.h>\r
47\r
fb3df220 48\r
959ccb23 49/**\r
50 The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI \r
51 Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header. \r
52\r
6de794cd 53 @param FileHandle Pointer to the FFS file header.\r
959ccb23 54 @param PeiServices Describes the list of possible PEI Services.\r
55\r
373b5cf9 56 @retval EFI_SUCCESS The PEI completed successfully.\r
57 @retval !EFI_SUCCESS There is error in PEIM.\r
959ccb23 58\r
59**/\r
60typedef\r
61EFI_STATUS\r
1c9d209f 62(EFIAPI *EFI_PEIM_ENTRY_POINT2)(\r
b0d803fe 63 IN EFI_PEI_FILE_HANDLE FileHandle,\r
64 IN CONST EFI_PEI_SERVICES **PeiServices\r
959ccb23 65 );\r
66\r
67/**\r
68 Entry point of the notification callback function itself within the PEIM.\r
69\r
70 @param PeiServices Indirect reference to the PEI Services Table.\r
71 @param NotifyDescriptor Address of the notification descriptor data structure.\r
72 @param Ppi Address of the PPI that was installed.\r
73\r
373b5cf9 74 @return Status of the notification.\r
959ccb23 75**/\r
76typedef\r
77EFI_STATUS\r
6de794cd 78(EFIAPI *EFI_PEIM_NOTIFY_ENTRY_POINT)(\r
959ccb23 79 IN EFI_PEI_SERVICES **PeiServices,\r
80 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
81 IN VOID *Ppi\r
82 );\r
83\r
84//\r
85// PEI Ppi Services List Descriptors\r
86//\r
87#define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001\r
88#define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010\r
89#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020\r
90#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040\r
91#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060\r
92#define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000\r
93\r
6de794cd 94///\r
95/// The data structure through which a PEIM describes available services to the PEI Foundation.\r
96/// \r
959ccb23 97typedef struct {\r
1bf79370
LG
98 ///\r
99 /// This field is a set of flags describing the characteristics of this imported table entry.\r
100 /// All flags are defined as EFI_PEI_PPI_DESCRIPTOR_***, which can also be combined into one.\r
101 ///\r
959ccb23 102 UINTN Flags;\r
1bf79370
LG
103 ///\r
104 /// The address of the EFI_GUID that names the interface.\r
105 ///\r
959ccb23 106 EFI_GUID *Guid;\r
1bf79370
LG
107 ///\r
108 /// A pointer to the PPI. It contains the information necessary to install a service.\r
109 ///\r
959ccb23 110 VOID *Ppi;\r
111} EFI_PEI_PPI_DESCRIPTOR;\r
112\r
6de794cd 113/// \r
114/// The data structure in a given PEIM that tells the PEI \r
115/// Foundation where to invoke the notification service.\r
116/// \r
959ccb23 117struct _EFI_PEI_NOTIFY_DESCRIPTOR {\r
1bf79370
LG
118 ///\r
119 /// Details if the type of notification is callback or dispatch.\r
120 ///\r
959ccb23 121 UINTN Flags;\r
1bf79370
LG
122 ///\r
123 /// The address of the EFI_GUID that names the interface.\r
124 ///\r
959ccb23 125 EFI_GUID *Guid;\r
1bf79370
LG
126 ///\r
127 /// Address of the notification callback function itself within the PEIM.\r
128 ///\r
959ccb23 129 EFI_PEIM_NOTIFY_ENTRY_POINT Notify;\r
130};\r
131\r
959ccb23 132/**\r
133 This service is the first one provided by the PEI Foundation. This function \r
134 installs an interface in the PEI PPI database by GUID. The purpose of the \r
135 service is to publish an interface that other parties can use to call \r
136 additional PEIMs.\r
137\r
138 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
139 published by the PEI Foundation.\r
140 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
141\r
142 @retval EFI_SUCCESS The interface was successfully installed.\r
143 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
144 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
145\r
146**/\r
147typedef\r
148EFI_STATUS\r
6de794cd 149(EFIAPI *EFI_PEI_INSTALL_PPI)(\r
1c280088 150 IN CONST EFI_PEI_SERVICES **PeiServices,\r
151 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
959ccb23 152 );\r
153\r
154/**\r
155 This function reinstalls an interface in the PEI PPI database by GUID. \r
156 The purpose of the service is to publish an interface that other parties \r
157 can use to replace a same-named interface in the protocol database \r
158 with a different interface. \r
159\r
160 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
161 published by the PEI Foundation.\r
162 @param OldPpi A pointer to the former PPI in the database.\r
163 @param NewPpi A pointer to the new interfaces that the caller shall install.\r
164\r
165 @retval EFI_SUCCESS The interface was successfully installed.\r
166 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the \r
167 list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
168 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
169 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.\r
170\r
171**/\r
172typedef\r
173EFI_STATUS\r
6de794cd 174(EFIAPI *EFI_PEI_REINSTALL_PPI)(\r
1c280088 175 IN CONST EFI_PEI_SERVICES **PeiServices,\r
176 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
177 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
959ccb23 178 );\r
179\r
180/**\r
181 This function locates an interface in the PEI PPI database by GUID. \r
182\r
183 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.\r
184 @param Guid A pointer to the GUID whose corresponding interface needs to be found.\r
185 @param Instance The N-th instance of the interface that is required.\r
186 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
187 @param Ppi A pointer to the instance of the interface.\r
188\r
189 @retval EFI_SUCCESS The interface was successfully returned.\r
190 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
191\r
192**/\r
193typedef\r
194EFI_STATUS\r
6de794cd 195(EFIAPI *EFI_PEI_LOCATE_PPI)(\r
1c280088 196 IN CONST EFI_PEI_SERVICES **PeiServices,\r
197 IN CONST EFI_GUID *Guid,\r
198 IN UINTN Instance,\r
199 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,\r
200 IN OUT VOID **Ppi\r
959ccb23 201 );\r
202\r
203/**\r
204 This function installs a notification service to be called back when a \r
205 given interface is installed or reinstalled. The purpose of the service \r
206 is to publish an interface that other parties can use to call additional PPIs \r
207 that may materialize later.\r
208\r
209 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
210 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.\r
211\r
212 @retval EFI_SUCCESS The interface was successfully installed.\r
213 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the \r
214 list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
215 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
216\r
217**/\r
218typedef\r
219EFI_STATUS\r
6de794cd 220(EFIAPI *EFI_PEI_NOTIFY_PPI)(\r
1c280088 221 IN CONST EFI_PEI_SERVICES **PeiServices,\r
222 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
959ccb23 223 );\r
224\r
225/**\r
226 This function returns the present value of the boot mode.\r
227\r
228 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
229 @param BootMode A pointer to contain the value of the boot mode.\r
230\r
231 @retval EFI_SUCCESS The boot mode was returned successfully.\r
232\r
233**/\r
234typedef\r
235EFI_STATUS\r
6de794cd 236(EFIAPI *EFI_PEI_GET_BOOT_MODE)(\r
1c280088 237 IN CONST EFI_PEI_SERVICES **PeiServices,\r
238 OUT EFI_BOOT_MODE *BootMode\r
959ccb23 239 );\r
240\r
241/**\r
242 This function sets the value of the boot mode.\r
243\r
244 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
245 @param BootMode The value of the boot mode to set.\r
246\r
247 @retval EFI_SUCCESS The boot mode was returned successfully.\r
248\r
249**/\r
250typedef\r
251EFI_STATUS\r
6de794cd 252(EFIAPI *EFI_PEI_SET_BOOT_MODE)(\r
1c280088 253 IN CONST EFI_PEI_SERVICES **PeiServices,\r
254 IN EFI_BOOT_MODE BootMode\r
959ccb23 255 );\r
256\r
257/**\r
258 This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory. \r
259\r
260 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
261 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize\r
262\r
263 @retval EFI_SUCCESS The list was successfully returned.\r
264 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
265\r
266**/\r
267typedef\r
268EFI_STATUS\r
6de794cd 269(EFIAPI *EFI_PEI_GET_HOB_LIST)(\r
1c280088 270 IN CONST EFI_PEI_SERVICES **PeiServices,\r
67c89a21 271 OUT VOID **HobList\r
959ccb23 272 );\r
273\r
274/**\r
275 This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB's) headers.\r
276\r
277 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
278 @param Type The type of HOB to be installed.\r
279 @param Length The length of the HOB to be added.\r
280 @param Hob The address of a pointer that will contain the HOB header.\r
281\r
282 @retval EFI_SUCCESS The HOB was successfully created.\r
283 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
284\r
285**/\r
286typedef\r
287EFI_STATUS\r
6de794cd 288(EFIAPI *EFI_PEI_CREATE_HOB)(\r
1c280088 289 IN CONST EFI_PEI_SERVICES **PeiServices,\r
290 IN UINT16 Type,\r
291 IN UINT16 Length,\r
7b1bf9f6 292 IN OUT VOID **Hob\r
959ccb23 293 );\r
294\r
295/**\r
296 The purpose of the service is to abstract the capability of the PEI \r
297 Foundation to discover instances of firmware volumes in the system. \r
c7c308ad 298\r
299 This service enables PEIMs to discover additional firmware volumes. The PEI Foundation uses this\r
300 service to abstract the locations and formats of various firmware volumes. These volumes include\r
301 the Boot Firmware Volume and any other volumes exposed by EFI_PEI_FV_PPI. The service\r
302 returns a volume handle of type EFI_PEI_FV_HANDLE, which must be unique within the system.\r
959ccb23 303\r
304 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
c7c308ad 305 @param Instance This instance of the firmware volume to find.\r
306 The value 0 is the Boot Firmware Volume (BFV).\r
307 @param VolumeHandle On exit, points to the next volumn handle or NULL if it does not exist.\r
959ccb23 308\r
309 @retval EFI_SUCCESS The volume was found.\r
310 @retval EFI_NOT_FOUND The volume was not found.\r
7b1bf9f6 311 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL.\r
959ccb23 312\r
313**/\r
314typedef\r
315EFI_STATUS\r
6de794cd 316(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME2)(\r
1c280088 317 IN CONST EFI_PEI_SERVICES **PeiServices,\r
318 IN UINTN Instance,\r
319 OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
959ccb23 320 );\r
321\r
322/**\r
c7c308ad 323 Searches for the next matching file in the firmware volume.\r
324\r
325 This service enables PEIMs to discover firmware files within a specified volume.\r
326 To find the first instance of a firmware file, pass a FileHandle value of NULL into the service.\r
327 The service returns a file handle of type EFI_PEI_FILE_HANDLE, which must be unique within\r
328 the system.\r
959ccb23 329\r
330 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
331 @param SearchType A filter to find files only of this type.\r
c7c308ad 332 @param FvHandle Handle of firmware volume in which to search.\r
333 @param FileHandle On entry, points to the current handle from which to begin searching\r
334 or NULL to start at the beginning of the firmware volume.\r
335 On exit, points the file handle of the next file in the volume or NULL\r
336 if there are no more files.\r
959ccb23 337\r
c7c308ad 338 @retval EFI_SUCCESS The file was found.\r
339 @retval EFI_NOT_FOUND The file was not found.\r
340 @retval EFI_NOT_FOUND The header checksum was not zero.\r
959ccb23 341\r
342**/\r
343typedef\r
344EFI_STATUS\r
6de794cd 345(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE2)(\r
1c280088 346 IN CONST EFI_PEI_SERVICES **PeiServices,\r
347 IN EFI_FV_FILETYPE SearchType,\r
c7c308ad 348 IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
1c280088 349 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
959ccb23 350 );\r
351\r
352/**\r
c7c308ad 353 Searches for the next matching section within the specified file.\r
354\r
355 This service enables PEI modules to discover the first section of a given type within a valid file.\r
356 This service will search within encapsulation sections (compression and GUIDed) as well. It will\r
357 search inside of a GUIDed section or a compressed section, but may not, for example, search a\r
358 GUIDed section inside a GUIDes section.\r
359 This service will not search within compression sections or GUIDed sections which require\r
360 extraction if memory is not present.\r
959ccb23 361\r
362 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
363 @param SectionType The value of the section type to find.\r
c7c308ad 364 @param FileHandle Handle of the firmware file to search.\r
959ccb23 365 @param SectionData A pointer to the discovered section, if successful.\r
366\r
c7c308ad 367 @retval EFI_SUCCESS The section was found.\r
368 @retval EFI_NOT_FOUND The section was not found.\r
959ccb23 369\r
370**/\r
371typedef\r
372EFI_STATUS\r
6de794cd 373(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA2)(\r
1c280088 374 IN CONST EFI_PEI_SERVICES **PeiServices,\r
375 IN EFI_SECTION_TYPE SectionType,\r
376 IN EFI_PEI_FILE_HANDLE FileHandle,\r
c7c308ad 377 OUT VOID **SectionData\r
959ccb23 378 );\r
379\r
380/**\r
381 This function registers the found memory configuration with the PEI Foundation.\r
382\r
383 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
384 @param MemoryBegin The value of a region of installed memory\r
385 @param MemoryLength The corresponding length of a region of installed memory.\r
386\r
387 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
388 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
389 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
390\r
391**/\r
392typedef\r
393EFI_STATUS\r
6de794cd 394(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY)(\r
1c280088 395 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 396 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
397 IN UINT64 MemoryLength\r
398 );\r
399\r
400/**\r
401 The purpose of the service is to publish an interface that allows \r
402 PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
403\r
404 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
405 @param MemoryType The type of memory to allocate.\r
406 @param Pages The number of contiguous 4 KB pages to allocate.\r
407 @param Memory Pointer to a physical address. On output, the address is set to the base \r
408 of the page range that was allocated.\r
409\r
410 @retval EFI_SUCCESS The memory range was successfully allocated.\r
411 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
412 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
413\r
414**/\r
415typedef\r
416EFI_STATUS\r
6de794cd 417(EFIAPI *EFI_PEI_ALLOCATE_PAGES)(\r
1c280088 418 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 419 IN EFI_MEMORY_TYPE MemoryType,\r
420 IN UINTN Pages,\r
c7c308ad 421 OUT EFI_PHYSICAL_ADDRESS *Memory\r
959ccb23 422 );\r
423\r
424/**\r
425 The purpose of this service is to publish an interface that \r
426 allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
427\r
428 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
429 @param Size The number of bytes to allocate from the pool.\r
430 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.\r
431\r
432 @retval EFI_SUCCESS The allocation was successful.\r
433 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
434\r
435**/\r
436typedef\r
437EFI_STATUS\r
6de794cd 438(EFIAPI *EFI_PEI_ALLOCATE_POOL)(\r
1c280088 439 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 440 IN UINTN Size,\r
441 OUT VOID **Buffer\r
442 );\r
443\r
444/**\r
445 This service copies the contents of one buffer to another buffer.\r
446\r
447 @param Destination Pointer to the destination buffer of the memory copy.\r
448 @param Source Pointer to the source buffer of the memory copy\r
449 @param Length Number of bytes to copy from Source to Destination.\r
450\r
959ccb23 451**/\r
452typedef\r
453VOID\r
6de794cd 454(EFIAPI *EFI_PEI_COPY_MEM)(\r
959ccb23 455 IN VOID *Destination,\r
456 IN VOID *Source,\r
457 IN UINTN Length\r
458 );\r
459\r
460/**\r
461 The service fills a buffer with a specified value.\r
462\r
463 @param Buffer Pointer to the buffer to fill.\r
464 @param Size Number of bytes in Buffer to fill.\r
465 @param Value Value to fill Buffer with\r
466\r
959ccb23 467**/\r
468typedef\r
469VOID\r
6de794cd 470(EFIAPI *EFI_PEI_SET_MEM)(\r
959ccb23 471 IN VOID *Buffer,\r
472 IN UINTN Size,\r
473 IN UINT8 Value\r
474 );\r
475\r
476/**\r
477 This service publishes an interface that allows PEIMs to report status codes.\r
478\r
c7c308ad 479 ReportStatusCode() is called by PEIMs that wish to report status information on their\r
480 progress. The principal use model is for a PEIM to emit one of the standard 32-bit error codes. This\r
481 will allow a platform owner to ascertain the state of the system, especially under conditions where\r
482 the full consoles might not have been installed.\r
483\r
959ccb23 484 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
485 @param Type Indicates the type of status code being reported.\r
486 @param Value Describes the current status of a hardware or\r
487 software entity. This includes information about the class and\r
488 subclass that is used to classify the entity as well as an operation.\r
489 For progress codes, the operation is the current activity.\r
490 For error codes, it is the exception.For debug codes,it is not defined at this time.\r
491 @param Instance The enumeration of a hardware or software entity within\r
492 the system. A system may contain multiple entities that match a class/subclass\r
493 pairing. The instance differentiates between them. An instance of 0 indicates\r
494 that instance information is unavailable, not meaningful, or not relevant.\r
495 Valid instance numbers start with 1.\r
496 @param CallerId This optional parameter may be used to identify the caller.\r
497 This parameter allows the status code driver to apply different rules to\r
498 different callers.\r
499 @param Data This optional parameter may be used to pass additional data.\r
500\r
501 @retval EFI_SUCCESS The function completed successfully.\r
502 @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.\r
503\r
504**/\r
505typedef\r
506EFI_STATUS\r
6de794cd 507(EFIAPI *EFI_PEI_REPORT_STATUS_CODE)(\r
1c280088 508 IN CONST EFI_PEI_SERVICES **PeiServices,\r
509 IN EFI_STATUS_CODE_TYPE Type,\r
510 IN EFI_STATUS_CODE_VALUE Value,\r
511 IN UINT32 Instance,\r
512 IN CONST EFI_GUID *CallerId OPTIONAL,\r
513 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
959ccb23 514 );\r
515\r
516/**\r
517 Resets the entire platform.\r
518\r
c7c308ad 519 This service resets the entire platform, including all processors\r
520 and devices, and reboots the system.\r
521 This service will never return EFI_SUCCESS. \r
522\r
959ccb23 523 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES\r
524 table published by the PEI Foundation.\r
525\r
959ccb23 526 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
527\r
528**/\r
529typedef\r
530EFI_STATUS\r
6de794cd 531(EFIAPI *EFI_PEI_RESET_SYSTEM)(\r
b0d803fe 532 IN CONST EFI_PEI_SERVICES **PeiServices\r
959ccb23 533 );\r
534\r
535/**\r
c7c308ad 536 Find a file within a volume by its name.\r
537\r
00edb218
A
538 This service searches for files with a specific name, within\r
539 either the specified firmware volume or all firmware volumes.\r
540 The service returns a file handle of type EFI_PEI_FILE_HANDLE,\r
959ccb23 541 which must be unique within the system.\r
542\r
00edb218
A
543 @param FileName A pointer to the name of the file to\r
544 find within the firmware volume.\r
c7c308ad 545 @param VolumeHandle The firmware volume to search.\r
546 @param FileHandle Upon exit, points to the found file's\r
959ccb23 547 handle or NULL if it could not be found.\r
548\r
00edb218 549 @retval EFI_SUCCESS File was found.\r
00edb218 550 @retval EFI_NOT_FOUND File was not found.\r
00edb218
A
551 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
552 FileName was NULL.\r
959ccb23 553\r
959ccb23 554**/\r
555typedef\r
556EFI_STATUS\r
6de794cd 557(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME)(\r
c7c308ad 558 IN CONST EFI_GUID *FileName,\r
559 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
560 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
00edb218 561 );\r
959ccb23 562\r
c7c308ad 563///\r
564/// Information of FV file.\r
565///\r
959ccb23 566typedef struct {\r
c7c308ad 567 ///\r
568 /// Name of the file.\r
569 ///\r
00edb218 570 EFI_GUID FileName;\r
c7c308ad 571 ///\r
572 /// File type.\r
573 ///\r
00edb218 574 EFI_FV_FILETYPE FileType;\r
c7c308ad 575 ///\r
576 /// Attributes of the file.\r
577 ///\r
00edb218 578 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
c7c308ad 579 ///\r
580 /// Points to the file's data (not the header).\r
581 /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
582 /// is zero.\r
583 ///\r
00edb218 584 VOID *Buffer;\r
c7c308ad 585 ///\r
242942b2 586 /// Size of the file's data.\r
c7c308ad 587 ///\r
00edb218 588 UINT32 BufferSize;\r
959ccb23 589} EFI_FV_FILE_INFO;\r
590\r
591/**\r
c7c308ad 592 Returns information about a specific file.\r
593\r
00edb218
A
594 This function returns information about a specific file,\r
595 including its file name, type, attributes, starting address and\r
596 size. If the firmware volume is not memory mapped then the\r
959ccb23 597 Buffer member will be NULL.\r
598\r
599 @param FileHandle Handle of the file.\r
5528573c 600 @param FileInfo Upon exit, points to the file's\r
959ccb23 601 information.\r
602\r
00edb218 603 @retval EFI_SUCCESS File information returned.\r
00edb218 604 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
959ccb23 605 represent a valid file.\r
00edb218 606 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
959ccb23 607 \r
608**/\r
609typedef\r
610EFI_STATUS\r
6de794cd 611(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO)(\r
c7c308ad 612 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1c280088 613 OUT EFI_FV_FILE_INFO *FileInfo\r
00edb218 614 );\r
959ccb23 615\r
c7c308ad 616///\r
617/// Information of FV volume.\r
618///\r
959ccb23 619typedef struct {\r
c7c308ad 620 ///\r
621 /// Attributes of the firmware volume.\r
622 ///\r
4ba967e7 623 EFI_FVB_ATTRIBUTES_2 FvAttributes;\r
c7c308ad 624 ///\r
625 /// Format of the firmware volume.\r
626 ///\r
4ba967e7 627 EFI_GUID FvFormat;\r
c7c308ad 628 ///\r
629 /// Name of the firmware volume.\r
630 ///\r
4ba967e7 631 EFI_GUID FvName;\r
c7c308ad 632 ///\r
633 /// Points to the first byte of the firmware\r
634 /// volume, if bit EFI_FVB_MEMORY_MAPPED is\r
635 /// set in FvAttributes.\r
636 ///\r
4ba967e7 637 VOID *FvStart;\r
c7c308ad 638 ///\r
639 /// Size of the firmware volume.\r
640 ///\r
4ba967e7 641 UINT64 FvSize;\r
959ccb23 642} EFI_FV_INFO;\r
643\r
644/**\r
4b503a77 645 Returns information about the specified volume.\r
c7c308ad 646\r
00edb218
A
647 This function returns information about a specific firmware\r
648 volume, including its name, type, attributes, starting address\r
959ccb23 649 and size.\r
650\r
651 @param VolumeHandle Handle of the volume.\r
652\r
5528573c 653 @param VolumeInfo Upon exit, points to the volume's\r
959ccb23 654 information.\r
655\r
00edb218 656 @retval EFI_SUCCESS File information returned.\r
00edb218 657 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
959ccb23 658 represent a valid file.\r
00edb218 659 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
959ccb23 660\r
661**/\r
662typedef\r
663EFI_STATUS\r
6de794cd 664(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO)(\r
1c280088 665 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
666 OUT EFI_FV_INFO *VolumeInfo\r
00edb218 667 );\r
959ccb23 668\r
669/**\r
4b503a77 670 Register a PEIM so that it will be shadowed and called again.\r
c7c308ad 671\r
00edb218
A
672 This service registers a file handle so that after memory is\r
673 available, the PEIM will be re-loaded into permanent memory and\r
674 re-initialized. The PEIM registered this way will always be\r
675 initialized twice. The first time, this function call will\r
676 return EFI_SUCCESS. The second time, this function call will\r
677 return EFI_ALREADY_STARTED. Depending on the order in which\r
678 PEIMs are dispatched, the PEIM making this call may be\r
679 initialized after permanent memory is installed, even the first\r
959ccb23 680 time.\r
681\r
c7c308ad 682 @param FileHandle PEIM's file handle. Must be the currently\r
4b503a77 683 executing PEIM.\r
959ccb23 684 \r
4ba967e7 685 @retval EFI_SUCCESS The PEIM was successfully registered for\r
686 shadowing.\r
00edb218 687 @retval EFI_ALREADY_STARTED The PEIM was previously\r
959ccb23 688 registered for shadowing.\r
4ba967e7 689 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
690 valid file handle.\r
959ccb23 691\r
692**/\r
693typedef\r
694EFI_STATUS\r
6de794cd 695(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW)(\r
1c280088 696 IN EFI_PEI_FILE_HANDLE FileHandle\r
00edb218 697 );\r
959ccb23 698\r
699\r
700//\r
701// PEI Specification Revision information\r
702//\r
703#define PEI_SPECIFICATION_MAJOR_REVISION 1\r
704#define PEI_SPECIFICATION_MINOR_REVISION 0\r
32d4a8ef 705///\r
706/// Inconsistent with specification here: \r
707/// In PI1.0 spec, PEI_SERVICES_SIGNATURE is defined as 0x5652455320494550. But \r
708/// to pass multiple tool chain, it is append a ULL.\r
709///\r
959ccb23 710//\r
711// PEI Services Table\r
712//\r
f490a61d 713#define PEI_SERVICES_SIGNATURE 0x5652455320494550ULL\r
32d4a8ef 714///\r
715/// Inconsistent with specification here: \r
716/// In PI1.0 spec, There is a typo error in PEI_SERVICES_REVISION. In the spec. the defintion is \r
717/// #define ((PEI_SPECIFICATION_MAJOR_REVISION<<16) |(PEI_SPECIFICATION_MINOR_REVISION))\r
718/// and it should be as follow:\r
719///\r
ef4fa1a4 720#define PEI_SERVICES_REVISION ((PEI_SPECIFICATION_MAJOR_REVISION<<16) | (PEI_SPECIFICATION_MINOR_REVISION))\r
959ccb23 721\r
6de794cd 722/// \r
723/// EFI_PEI_SERVICES is a collection of functions whose implementation is provided by the PEI\r
724/// Foundation. These services fall into various classes, including the following:\r
725/// - Managing the boot mode\r
726/// - Allocating both early and permanent memory\r
727/// - Supporting the Firmware File System (FFS)\r
728/// - Abstracting the PPI database abstraction\r
729/// - Creating Hand-Off Blocks (HOBs)\r
730///\r
146332ae 731struct _EFI_PEI_SERVICES {\r
c7c308ad 732 ///\r
733 /// The table header for the PEI Services Table.\r
734 ///\r
44717a39 735 EFI_TABLE_HEADER Hdr;\r
736\r
737 //\r
738 // PPI Functions\r
739 //\r
740 EFI_PEI_INSTALL_PPI InstallPpi;\r
741 EFI_PEI_REINSTALL_PPI ReInstallPpi;\r
742 EFI_PEI_LOCATE_PPI LocatePpi;\r
743 EFI_PEI_NOTIFY_PPI NotifyPpi;\r
744\r
745 //\r
746 // Boot Mode Functions\r
747 //\r
748 EFI_PEI_GET_BOOT_MODE GetBootMode;\r
749 EFI_PEI_SET_BOOT_MODE SetBootMode;\r
750\r
751 //\r
752 // HOB Functions\r
753 //\r
754 EFI_PEI_GET_HOB_LIST GetHobList;\r
755 EFI_PEI_CREATE_HOB CreateHob;\r
756\r
757 //\r
758 // Firmware Volume Functions\r
759 //\r
00edb218
A
760 EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;\r
761 EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;\r
762 EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;\r
44717a39 763\r
764 //\r
765 // PEI Memory Functions\r
766 //\r
767 EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;\r
768 EFI_PEI_ALLOCATE_PAGES AllocatePages;\r
769 EFI_PEI_ALLOCATE_POOL AllocatePool;\r
770 EFI_PEI_COPY_MEM CopyMem;\r
771 EFI_PEI_SET_MEM SetMem;\r
772\r
773 //\r
774 // Status Code\r
775 //\r
776 EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;\r
777\r
778 //\r
779 // Reset\r
780 //\r
781 EFI_PEI_RESET_SYSTEM ResetSystem;\r
782\r
783 //\r
784 // (the following interfaces are installed by publishing PEIM)\r
785 // I/O Abstractions\r
786 //\r
787 EFI_PEI_CPU_IO_PPI *CpuIo;\r
788 EFI_PEI_PCI_CFG2_PPI *PciCfg;\r
789\r
790 //\r
791 // Future Installed Services\r
792 //\r
793 EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;\r
794 EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;\r
795 EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;\r
796 EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;\r
00edb218 797};\r
959ccb23 798\r
799\r
6de794cd 800///\r
801/// EFI_SEC_PEI_HAND_OFF structure hold information about\r
802/// PEI core's operating environment, such as the size of location of\r
803/// temporary RAM, the stack location and BFV location.\r
804/// \r
959ccb23 805typedef struct _EFI_SEC_PEI_HAND_OFF {\r
c7c308ad 806 ///\r
807 /// Size of the data structure.\r
808 /// \r
959ccb23 809 UINT16 DataSize;\r
810\r
c7c308ad 811 ///\r
812 /// Points to the first byte of the boot firmware volume, \r
813 /// which the PEI Dispatcher should search for \r
814 /// PEI modules.\r
815 /// \r
959ccb23 816 VOID *BootFirmwareVolumeBase;\r
817\r
c7c308ad 818 ///\r
819 /// Size of the boot firmware volume, in bytes.\r
820 /// \r
959ccb23 821 UINTN BootFirmwareVolumeSize;\r
822\r
c7c308ad 823 ///\r
824 /// Points to the first byte of the temporary RAM.\r
825 /// \r
959ccb23 826 VOID *TemporaryRamBase;\r
827\r
c7c308ad 828 ///\r
829 /// Size of the temporary RAM, in bytes.\r
830 /// \r
959ccb23 831 UINTN TemporaryRamSize;\r
832\r
c7c308ad 833 ///\r
834 /// Points to the first byte of the temporary RAM \r
835 /// available for use by the PEI Foundation. The area \r
836 /// described by PeiTemporaryRamBase and PeiTemporaryRamSize \r
837 /// must not extend outside beyond the area described by\r
838 /// TemporaryRamBase & TemporaryRamSize. This area should not\r
839 /// overlap with the area reported by StackBase and \r
840 /// StackSize.\r
841 ///\r
959ccb23 842 VOID *PeiTemporaryRamBase;\r
843\r
c7c308ad 844 ///\r
845 /// Size of the available temporary RAM available for \r
846 /// use by the PEI Foundation, in bytes.\r
847 /// \r
959ccb23 848 UINTN PeiTemporaryRamSize;\r
849\r
c7c308ad 850 ///\r
851 /// Points to the first byte of the stack. \r
852 /// This are may be part of the memory described by \r
853 /// TemporaryRamBase and TemporaryRamSize \r
854 /// or may be an entirely separate area.\r
855 /// \r
959ccb23 856 VOID *StackBase;\r
857\r
c7c308ad 858 ///\r
859 /// Size of the stack, in bytes.\r
860 /// \r
959ccb23 861 UINTN StackSize;\r
862} EFI_SEC_PEI_HAND_OFF;\r
863\r
fb3df220 864\r
865/**\r
4b503a77 866 Entry point of PEI Foundation.\r
fb3df220 867\r
868 This function is the entry point for the PEI Foundation, which\r
869 allows the SEC phase to pass information about the stack,\r
870 temporary RAM and the Boot Firmware Volume. In addition, it also\r
871 allows the SEC phase to pass services and data forward for use\r
872 during the PEI phase in the form of one or more PPIs. There is\r
873 no limit to the number of additional PPIs that can be passed\r
874 from SEC into the PEI Foundation. As part of its initialization\r
875 phase, the PEI Foundation will add these SEC-hosted PPIs to its\r
876 PPI database such that both the PEI Foundation and any modules\r
877 can leverage the associated service calls and/or code in these\r
878 early PPIs.\r
879\r
880 @param SecCoreData Points to a data structure containing\r
881 information about the PEI core's\r
882 operating environment, such as the size\r
883 and location of temporary RAM, the stack\r
4b503a77 884 location and the BFV location.\r
fb3df220 885\r
886 @param PpiList Points to a list of one or more PPI\r
887 descriptors to be installed initially by\r
888 the PEI core. An empty PPI list consists\r
889 of a single descriptor with the end-tag\r
890 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.\r
891 As part of its initialization phase, the\r
892 PEI Foundation will add these SEC-hosted\r
893 PPIs to its PPI database such that both\r
894 the PEI Foundation and any modules can\r
895 leverage the associated service calls\r
896 and/or code in these early PPIs.\r
897\r
898\r
899**/\r
900typedef\r
901VOID\r
e5544398 902(EFIAPI *EFI_PEI_CORE_ENTRY_POINT)(\r
fb3df220 903 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
904 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
905);\r
906\r
959ccb23 907#endif\r