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