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