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