]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiPeiCis.h
1. Enable use-cases in PEI using SecurityPPI co-equal to the use-cases in DXE using...
[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
c7935105 4Copyright (c) 2006 - 2013, 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
c7935105
SZ
398/**\r
399 Searches for the next matching section within the specified file.\r
400\r
401 This service enables PEI modules to discover the section of a given type within a valid file.\r
402 This service will search within encapsulation sections (compression and GUIDed) as well. It will\r
403 search inside of a GUIDed section or a compressed section, but may not, for example, search a\r
404 GUIDed section inside a GUIDes section.\r
405 This service will not search within compression sections or GUIDed sections that require\r
406 extraction if memory is not present.\r
407\r
408 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
409 @param SectionType The value of the section type to find.\r
410 @param SectionInstance Section instance to find.\r
411 @param FileHandle Handle of the firmware file to search.\r
412 @param SectionData A pointer to the discovered section, if successful.\r
413 @param AuthenticationStatus A pointer to the authentication status for this section.\r
414\r
415 @retval EFI_SUCCESS The section was found.\r
416 @retval EFI_NOT_FOUND The section was not found.\r
417\r
418**/\r
419typedef\r
420EFI_STATUS\r
421(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA3)(\r
422 IN CONST EFI_PEI_SERVICES **PeiServices,\r
423 IN EFI_SECTION_TYPE SectionType,\r
424 IN UINTN SectionInstance,\r
425 IN EFI_PEI_FILE_HANDLE FileHandle,\r
426 OUT VOID **SectionData,\r
427 OUT UINT32 *AuthenticationStatus\r
428 );\r
429\r
959ccb23 430/**\r
431 This function registers the found memory configuration with the PEI Foundation.\r
432\r
433 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
af2dc6a7 434 @param MemoryBegin The value of a region of installed memory.\r
959ccb23 435 @param MemoryLength The corresponding length of a region of installed memory.\r
436\r
437 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
438 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
439 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
440\r
441**/\r
442typedef\r
443EFI_STATUS\r
6de794cd 444(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY)(\r
1c280088 445 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 446 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
447 IN UINT64 MemoryLength\r
448 );\r
449\r
450/**\r
451 The purpose of the service is to publish an interface that allows \r
452 PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
453\r
454 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
455 @param MemoryType The type of memory to allocate.\r
456 @param Pages The number of contiguous 4 KB pages to allocate.\r
af2dc6a7 457 @param Memory A pointer to a physical address. On output, the address is set to the base \r
959ccb23 458 of the page range that was allocated.\r
459\r
460 @retval EFI_SUCCESS The memory range was successfully allocated.\r
461 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
af2dc6a7 462 @retval EFI_INVALID_PARAMETER The type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode, \r
ded5aa23 463 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,\r
464 EfiACPIReclaimMemory, or EfiACPIMemoryNVS.\r
959ccb23 465\r
466**/\r
467typedef\r
468EFI_STATUS\r
6de794cd 469(EFIAPI *EFI_PEI_ALLOCATE_PAGES)(\r
1c280088 470 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 471 IN EFI_MEMORY_TYPE MemoryType,\r
472 IN UINTN Pages,\r
c7c308ad 473 OUT EFI_PHYSICAL_ADDRESS *Memory\r
959ccb23 474 );\r
475\r
476/**\r
477 The purpose of this service is to publish an interface that \r
478 allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
479\r
480 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
481 @param Size The number of bytes to allocate from the pool.\r
482 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.\r
483\r
484 @retval EFI_SUCCESS The allocation was successful.\r
485 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
486\r
487**/\r
488typedef\r
489EFI_STATUS\r
6de794cd 490(EFIAPI *EFI_PEI_ALLOCATE_POOL)(\r
1c280088 491 IN CONST EFI_PEI_SERVICES **PeiServices,\r
959ccb23 492 IN UINTN Size,\r
493 OUT VOID **Buffer\r
494 );\r
495\r
496/**\r
497 This service copies the contents of one buffer to another buffer.\r
498\r
af2dc6a7 499 @param Destination The pointer to the destination buffer of the memory copy.\r
500 @param Source The pointer to the source buffer of the memory copy.\r
501 @param Length The number of bytes to copy from Source to Destination.\r
959ccb23 502\r
959ccb23 503**/\r
504typedef\r
505VOID\r
6de794cd 506(EFIAPI *EFI_PEI_COPY_MEM)(\r
959ccb23 507 IN VOID *Destination,\r
508 IN VOID *Source,\r
509 IN UINTN Length\r
510 );\r
511\r
512/**\r
513 The service fills a buffer with a specified value.\r
514\r
af2dc6a7 515 @param Buffer The pointer to the buffer to fill.\r
516 @param Size The number of bytes in Buffer to fill.\r
517 @param Value The value to fill Buffer with.\r
959ccb23 518\r
959ccb23 519**/\r
520typedef\r
521VOID\r
6de794cd 522(EFIAPI *EFI_PEI_SET_MEM)(\r
959ccb23 523 IN VOID *Buffer,\r
524 IN UINTN Size,\r
525 IN UINT8 Value\r
526 );\r
527\r
528/**\r
529 This service publishes an interface that allows PEIMs to report status codes.\r
530\r
c7c308ad 531 ReportStatusCode() is called by PEIMs that wish to report status information on their\r
532 progress. The principal use model is for a PEIM to emit one of the standard 32-bit error codes. This\r
533 will allow a platform owner to ascertain the state of the system, especially under conditions where\r
534 the full consoles might not have been installed.\r
535\r
959ccb23 536 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
537 @param Type Indicates the type of status code being reported.\r
538 @param Value Describes the current status of a hardware or\r
539 software entity. This includes information about the class and\r
540 subclass that is used to classify the entity as well as an operation.\r
541 For progress codes, the operation is the current activity.\r
542 For error codes, it is the exception.For debug codes,it is not defined at this time.\r
543 @param Instance The enumeration of a hardware or software entity within\r
544 the system. A system may contain multiple entities that match a class/subclass\r
545 pairing. The instance differentiates between them. An instance of 0 indicates\r
546 that instance information is unavailable, not meaningful, or not relevant.\r
547 Valid instance numbers start with 1.\r
548 @param CallerId This optional parameter may be used to identify the caller.\r
549 This parameter allows the status code driver to apply different rules to\r
550 different callers.\r
551 @param Data This optional parameter may be used to pass additional data.\r
552\r
553 @retval EFI_SUCCESS The function completed successfully.\r
554 @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.\r
555\r
556**/\r
557typedef\r
558EFI_STATUS\r
6de794cd 559(EFIAPI *EFI_PEI_REPORT_STATUS_CODE)(\r
1c280088 560 IN CONST EFI_PEI_SERVICES **PeiServices,\r
561 IN EFI_STATUS_CODE_TYPE Type,\r
562 IN EFI_STATUS_CODE_VALUE Value,\r
563 IN UINT32 Instance,\r
564 IN CONST EFI_GUID *CallerId OPTIONAL,\r
565 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
959ccb23 566 );\r
567\r
568/**\r
569 Resets the entire platform.\r
570\r
c7c308ad 571 This service resets the entire platform, including all processors\r
572 and devices, and reboots the system.\r
573 This service will never return EFI_SUCCESS. \r
574\r
959ccb23 575 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES\r
576 table published by the PEI Foundation.\r
577\r
959ccb23 578 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
579\r
580**/\r
581typedef\r
582EFI_STATUS\r
6de794cd 583(EFIAPI *EFI_PEI_RESET_SYSTEM)(\r
b0d803fe 584 IN CONST EFI_PEI_SERVICES **PeiServices\r
959ccb23 585 );\r
586\r
587/**\r
c7c308ad 588 Find a file within a volume by its name.\r
589\r
00edb218
A
590 This service searches for files with a specific name, within\r
591 either the specified firmware volume or all firmware volumes.\r
592 The service returns a file handle of type EFI_PEI_FILE_HANDLE,\r
959ccb23 593 which must be unique within the system.\r
594\r
00edb218
A
595 @param FileName A pointer to the name of the file to\r
596 find within the firmware volume.\r
c7c308ad 597 @param VolumeHandle The firmware volume to search.\r
598 @param FileHandle Upon exit, points to the found file's\r
959ccb23 599 handle or NULL if it could not be found.\r
600\r
af2dc6a7 601 @retval EFI_SUCCESS The file was found.\r
602 @retval EFI_NOT_FOUND The file was not found.\r
00edb218
A
603 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
604 FileName was NULL.\r
959ccb23 605\r
959ccb23 606**/\r
607typedef\r
608EFI_STATUS\r
6de794cd 609(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME)(\r
c7c308ad 610 IN CONST EFI_GUID *FileName,\r
611 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
612 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
00edb218 613 );\r
959ccb23 614\r
c7c308ad 615///\r
af2dc6a7 616/// The information of the FV file.\r
c7c308ad 617///\r
959ccb23 618typedef struct {\r
c7c308ad 619 ///\r
620 /// Name of the file.\r
621 ///\r
00edb218 622 EFI_GUID FileName;\r
c7c308ad 623 ///\r
624 /// File type.\r
625 ///\r
00edb218 626 EFI_FV_FILETYPE FileType;\r
c7c308ad 627 ///\r
628 /// Attributes of the file.\r
629 ///\r
00edb218 630 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
c7c308ad 631 ///\r
632 /// Points to the file's data (not the header).\r
633 /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
634 /// is zero.\r
635 ///\r
00edb218 636 VOID *Buffer;\r
c7c308ad 637 ///\r
242942b2 638 /// Size of the file's data.\r
c7c308ad 639 ///\r
00edb218 640 UINT32 BufferSize;\r
959ccb23 641} EFI_FV_FILE_INFO;\r
642\r
c7935105
SZ
643///\r
644/// The information with authentication status of the FV file.\r
645///\r
646typedef struct {\r
647 ///\r
648 /// Name of the file.\r
649 ///\r
650 EFI_GUID FileName;\r
651 ///\r
652 /// File type.\r
653 ///\r
654 EFI_FV_FILETYPE FileType;\r
655 ///\r
656 /// Attributes of the file.\r
657 ///\r
658 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
659 ///\r
660 /// Points to the file's data (not the header).\r
661 /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
662 /// is zero.\r
663 ///\r
664 VOID *Buffer;\r
665 ///\r
666 /// Size of the file's data.\r
667 ///\r
668 UINT32 BufferSize;\r
669 ///\r
670 /// Authentication status for this file.\r
671 ///\r
672 UINT32 AuthenticationStatus;\r
673} EFI_FV_FILE_INFO2;\r
674\r
959ccb23 675/**\r
c7c308ad 676 Returns information about a specific file.\r
677\r
00edb218
A
678 This function returns information about a specific file,\r
679 including its file name, type, attributes, starting address and\r
af2dc6a7 680 size. If the firmware volume is not memory mapped, then the\r
959ccb23 681 Buffer member will be NULL.\r
682\r
af2dc6a7 683 @param FileHandle The handle of the file.\r
5528573c 684 @param FileInfo Upon exit, points to the file's\r
959ccb23 685 information.\r
686\r
af2dc6a7 687 @retval EFI_SUCCESS File information was returned.\r
688 @retval EFI_INVALID_PARAMETER FileHandle does not\r
959ccb23 689 represent a valid file.\r
af2dc6a7 690 @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r
959ccb23 691 \r
692**/\r
693typedef\r
694EFI_STATUS\r
6de794cd 695(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO)(\r
c7c308ad 696 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1c280088 697 OUT EFI_FV_FILE_INFO *FileInfo\r
00edb218 698 );\r
959ccb23 699\r
c7935105
SZ
700/**\r
701 Returns information about a specific file.\r
702\r
703 This function returns information about a specific file,\r
704 including its file name, type, attributes, starting address, size and authentication status.\r
705 If the firmware volume is not memory mapped, then the Buffer member will be NULL.\r
706\r
707 @param FileHandle The handle of the file.\r
708 @param FileInfo Upon exit, points to the file's\r
709 information.\r
710\r
711 @retval EFI_SUCCESS File information was returned.\r
712 @retval EFI_INVALID_PARAMETER FileHandle does not\r
713 represent a valid file.\r
714 @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r
715\r
716**/\r
717typedef\r
718EFI_STATUS\r
719(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO2)(\r
720 IN EFI_PEI_FILE_HANDLE FileHandle,\r
721 OUT EFI_FV_FILE_INFO2 *FileInfo\r
722 );\r
723\r
c7c308ad 724///\r
af2dc6a7 725/// The information of the FV volume.\r
c7c308ad 726///\r
959ccb23 727typedef struct {\r
c7c308ad 728 ///\r
729 /// Attributes of the firmware volume.\r
730 ///\r
4ba967e7 731 EFI_FVB_ATTRIBUTES_2 FvAttributes;\r
c7c308ad 732 ///\r
733 /// Format of the firmware volume.\r
734 ///\r
4ba967e7 735 EFI_GUID FvFormat;\r
c7c308ad 736 ///\r
737 /// Name of the firmware volume.\r
738 ///\r
4ba967e7 739 EFI_GUID FvName;\r
c7c308ad 740 ///\r
741 /// Points to the first byte of the firmware\r
742 /// volume, if bit EFI_FVB_MEMORY_MAPPED is\r
743 /// set in FvAttributes.\r
744 ///\r
4ba967e7 745 VOID *FvStart;\r
c7c308ad 746 ///\r
747 /// Size of the firmware volume.\r
748 ///\r
4ba967e7 749 UINT64 FvSize;\r
959ccb23 750} EFI_FV_INFO;\r
751\r
752/**\r
4b503a77 753 Returns information about the specified volume.\r
c7c308ad 754\r
00edb218
A
755 This function returns information about a specific firmware\r
756 volume, including its name, type, attributes, starting address\r
959ccb23 757 and size.\r
758\r
759 @param VolumeHandle Handle of the volume.\r
5a9403b8 760 @param VolumeInfo Upon exit, points to the volume's information.\r
959ccb23 761\r
af2dc6a7 762 @retval EFI_SUCCESS The volume information returned.\r
5a9403b8 763 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
764 @retval EFI_INVALID_PARAMETER If VolumeHandle is NULL.\r
af2dc6a7 765 @retval EFI_SUCCESS Information was successfully returned.\r
5a9403b8 766 @retval EFI_INVALID_PARAMETER The volume designated by the VolumeHandle is not available.\r
959ccb23 767\r
768**/\r
769typedef\r
770EFI_STATUS\r
6de794cd 771(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO)(\r
1c280088 772 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
773 OUT EFI_FV_INFO *VolumeInfo\r
00edb218 774 );\r
959ccb23 775\r
776/**\r
4b503a77 777 Register a PEIM so that it will be shadowed and called again.\r
c7c308ad 778\r
00edb218
A
779 This service registers a file handle so that after memory is\r
780 available, the PEIM will be re-loaded into permanent memory and\r
781 re-initialized. The PEIM registered this way will always be\r
782 initialized twice. The first time, this function call will\r
783 return EFI_SUCCESS. The second time, this function call will\r
784 return EFI_ALREADY_STARTED. Depending on the order in which\r
785 PEIMs are dispatched, the PEIM making this call may be\r
786 initialized after permanent memory is installed, even the first\r
959ccb23 787 time.\r
788\r
c7c308ad 789 @param FileHandle PEIM's file handle. Must be the currently\r
4b503a77 790 executing PEIM.\r
959ccb23 791 \r
4ba967e7 792 @retval EFI_SUCCESS The PEIM was successfully registered for\r
793 shadowing.\r
00edb218 794 @retval EFI_ALREADY_STARTED The PEIM was previously\r
959ccb23 795 registered for shadowing.\r
4ba967e7 796 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
797 valid file handle.\r
959ccb23 798\r
799**/\r
800typedef\r
801EFI_STATUS\r
6de794cd 802(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW)(\r
1c280088 803 IN EFI_PEI_FILE_HANDLE FileHandle\r
00edb218 804 );\r
959ccb23 805\r
806\r
807//\r
808// PEI Specification Revision information\r
809//\r
810#define PEI_SPECIFICATION_MAJOR_REVISION 1\r
53e6937c 811#define PEI_SPECIFICATION_MINOR_REVISION 20\r
32d4a8ef 812///\r
af2dc6a7 813/// Specification inconsistency here: \r
814/// In the PI1.0 spec, PEI_SERVICES_SIGNATURE is defined as 0x5652455320494550. But \r
815/// to pass a multiple tool chain, it appends an ULL.\r
32d4a8ef 816///\r
959ccb23 817//\r
818// PEI Services Table\r
819//\r
f490a61d 820#define PEI_SERVICES_SIGNATURE 0x5652455320494550ULL\r
32d4a8ef 821///\r
af2dc6a7 822/// Specification inconsistency here: \r
823/// In the PI1.0 specification, there is a typo error in PEI_SERVICES_REVISION. In the specification the defintion is \r
32d4a8ef 824/// #define ((PEI_SPECIFICATION_MAJOR_REVISION<<16) |(PEI_SPECIFICATION_MINOR_REVISION))\r
af2dc6a7 825/// and it should be as follows:\r
32d4a8ef 826///\r
ef4fa1a4 827#define PEI_SERVICES_REVISION ((PEI_SPECIFICATION_MAJOR_REVISION<<16) | (PEI_SPECIFICATION_MINOR_REVISION))\r
959ccb23 828\r
6de794cd 829/// \r
830/// EFI_PEI_SERVICES is a collection of functions whose implementation is provided by the PEI\r
831/// Foundation. These services fall into various classes, including the following:\r
832/// - Managing the boot mode\r
833/// - Allocating both early and permanent memory\r
834/// - Supporting the Firmware File System (FFS)\r
835/// - Abstracting the PPI database abstraction\r
af2dc6a7 836/// - Creating Hand-Off Blocks (HOBs).\r
6de794cd 837///\r
146332ae 838struct _EFI_PEI_SERVICES {\r
c7c308ad 839 ///\r
840 /// The table header for the PEI Services Table.\r
841 ///\r
44717a39 842 EFI_TABLE_HEADER Hdr;\r
843\r
844 //\r
845 // PPI Functions\r
846 //\r
847 EFI_PEI_INSTALL_PPI InstallPpi;\r
848 EFI_PEI_REINSTALL_PPI ReInstallPpi;\r
849 EFI_PEI_LOCATE_PPI LocatePpi;\r
850 EFI_PEI_NOTIFY_PPI NotifyPpi;\r
851\r
852 //\r
853 // Boot Mode Functions\r
854 //\r
855 EFI_PEI_GET_BOOT_MODE GetBootMode;\r
856 EFI_PEI_SET_BOOT_MODE SetBootMode;\r
857\r
858 //\r
859 // HOB Functions\r
860 //\r
861 EFI_PEI_GET_HOB_LIST GetHobList;\r
862 EFI_PEI_CREATE_HOB CreateHob;\r
863\r
864 //\r
865 // Firmware Volume Functions\r
866 //\r
00edb218
A
867 EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;\r
868 EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;\r
869 EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;\r
44717a39 870\r
871 //\r
872 // PEI Memory Functions\r
873 //\r
874 EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;\r
875 EFI_PEI_ALLOCATE_PAGES AllocatePages;\r
876 EFI_PEI_ALLOCATE_POOL AllocatePool;\r
877 EFI_PEI_COPY_MEM CopyMem;\r
878 EFI_PEI_SET_MEM SetMem;\r
879\r
880 //\r
881 // Status Code\r
882 //\r
883 EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;\r
884\r
885 //\r
886 // Reset\r
887 //\r
888 EFI_PEI_RESET_SYSTEM ResetSystem;\r
889\r
890 //\r
891 // (the following interfaces are installed by publishing PEIM)\r
892 // I/O Abstractions\r
893 //\r
894 EFI_PEI_CPU_IO_PPI *CpuIo;\r
895 EFI_PEI_PCI_CFG2_PPI *PciCfg;\r
896\r
897 //\r
898 // Future Installed Services\r
899 //\r
900 EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;\r
901 EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;\r
902 EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;\r
903 EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;\r
c7935105
SZ
904 EFI_PEI_FFS_FIND_SECTION_DATA3 FindSectionData3;\r
905 EFI_PEI_FFS_GET_FILE_INFO2 FfsGetFileInfo2;\r
00edb218 906};\r
959ccb23 907\r
908\r
6de794cd 909///\r
af2dc6a7 910/// EFI_SEC_PEI_HAND_OFF structure holds information about\r
6de794cd 911/// PEI core's operating environment, such as the size of location of\r
912/// temporary RAM, the stack location and BFV location.\r
913/// \r
959ccb23 914typedef struct _EFI_SEC_PEI_HAND_OFF {\r
c7c308ad 915 ///\r
916 /// Size of the data structure.\r
917 /// \r
959ccb23 918 UINT16 DataSize;\r
919\r
c7c308ad 920 ///\r
921 /// Points to the first byte of the boot firmware volume, \r
922 /// which the PEI Dispatcher should search for \r
923 /// PEI modules.\r
924 /// \r
959ccb23 925 VOID *BootFirmwareVolumeBase;\r
926\r
c7c308ad 927 ///\r
928 /// Size of the boot firmware volume, in bytes.\r
929 /// \r
959ccb23 930 UINTN BootFirmwareVolumeSize;\r
931\r
c7c308ad 932 ///\r
933 /// Points to the first byte of the temporary RAM.\r
934 /// \r
959ccb23 935 VOID *TemporaryRamBase;\r
936\r
c7c308ad 937 ///\r
938 /// Size of the temporary RAM, in bytes.\r
939 /// \r
959ccb23 940 UINTN TemporaryRamSize;\r
941\r
c7c308ad 942 ///\r
943 /// Points to the first byte of the temporary RAM \r
944 /// available for use by the PEI Foundation. The area \r
945 /// described by PeiTemporaryRamBase and PeiTemporaryRamSize \r
946 /// must not extend outside beyond the area described by\r
947 /// TemporaryRamBase & TemporaryRamSize. This area should not\r
948 /// overlap with the area reported by StackBase and \r
949 /// StackSize.\r
950 ///\r
959ccb23 951 VOID *PeiTemporaryRamBase;\r
952\r
c7c308ad 953 ///\r
af2dc6a7 954 /// The size of the available temporary RAM available for \r
c7c308ad 955 /// use by the PEI Foundation, in bytes.\r
956 /// \r
959ccb23 957 UINTN PeiTemporaryRamSize;\r
958\r
c7c308ad 959 ///\r
960 /// Points to the first byte of the stack. \r
961 /// This are may be part of the memory described by \r
962 /// TemporaryRamBase and TemporaryRamSize \r
963 /// or may be an entirely separate area.\r
964 /// \r
959ccb23 965 VOID *StackBase;\r
966\r
c7c308ad 967 ///\r
968 /// Size of the stack, in bytes.\r
969 /// \r
959ccb23 970 UINTN StackSize;\r
971} EFI_SEC_PEI_HAND_OFF;\r
972\r
fb3df220 973\r
974/**\r
af2dc6a7 975 The entry point of PEI Foundation.\r
fb3df220 976\r
977 This function is the entry point for the PEI Foundation, which\r
978 allows the SEC phase to pass information about the stack,\r
979 temporary RAM and the Boot Firmware Volume. In addition, it also\r
980 allows the SEC phase to pass services and data forward for use\r
981 during the PEI phase in the form of one or more PPIs. There is\r
982 no limit to the number of additional PPIs that can be passed\r
983 from SEC into the PEI Foundation. As part of its initialization\r
984 phase, the PEI Foundation will add these SEC-hosted PPIs to its\r
985 PPI database such that both the PEI Foundation and any modules\r
986 can leverage the associated service calls and/or code in these\r
987 early PPIs.\r
988\r
989 @param SecCoreData Points to a data structure containing\r
990 information about the PEI core's\r
991 operating environment, such as the size\r
992 and location of temporary RAM, the stack\r
4b503a77 993 location and the BFV location.\r
fb3df220 994\r
995 @param PpiList Points to a list of one or more PPI\r
996 descriptors to be installed initially by\r
997 the PEI core. An empty PPI list consists\r
998 of a single descriptor with the end-tag\r
999 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.\r
1000 As part of its initialization phase, the\r
1001 PEI Foundation will add these SEC-hosted\r
1002 PPIs to its PPI database such that both\r
1003 the PEI Foundation and any modules can\r
1004 leverage the associated service calls\r
1005 and/or code in these early PPIs.\r
1006\r
1007\r
1008**/\r
1009typedef\r
1010VOID\r
e5544398 1011(EFIAPI *EFI_PEI_CORE_ENTRY_POINT)(\r
fb3df220 1012 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
1013 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
1014);\r
1015\r
959ccb23 1016#endif\r