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