2 Framework PEI master include file. This file should match the PEI CIS spec.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 @par Revision Reference:
20 #ifndef __PEIM_CIS_H__
21 #define __PEIM_CIS_H__
23 #include <Common/MultiPhase.h>
24 #include <Common/BootMode.h>
25 #include <Common/Hob.h>
26 #include <Common/FirmwareVolumeImageFormat.h>
27 #include <Common/FirmwareVolumeHeader.h>
28 #include <Common/FirmwareFileSystem.h>
29 #include <Common/Dependency.h>
31 #define TIANO_ERROR(a) (MAX_2_BITS | (a))
33 #if (EFI_SPECIFICATION_VERSION < 0x00020000)
35 // Tiano added a couple of return types. These are owned by UEFI specification
36 // and Tiano can not use them. Thus for UEFI 2.0/R9 support we moved the values
37 // to a UEFI OEM extension range to conform to UEFI specification.
39 #define EFI_NOT_AVAILABLE_YET EFIERR (28)
40 #define EFI_UNLOAD_IMAGE EFIERR (29)
42 #define EFI_NOT_AVAILABLE_YET TIANO_ERROR (0)
43 #define EFI_UNLOAD_IMAGE TIANO_ERROR (1)
47 // Declare forward referenced data structures
49 typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES
;
50 typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR
;
53 #include <Ppi/CpuIo.h>
54 #include <Ppi/PciCfg.h>
57 // PEI Specification Revision information
59 #define PEI_SPECIFICATION_MAJOR_REVISION 0
60 #define PEI_SPECIFICATION_MINOR_REVISION 91
63 The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI
64 Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header.
66 @param FfsHeader Pointer to the FFS file header.
68 @param PeiServices Describes the list of possible PEI Services.
75 (EFIAPI
*EFI_PEIM_ENTRY_POINT
)(
76 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
77 IN EFI_PEI_SERVICES
**PeiServices
81 Entry point of the notification callback function itself within the PEIM.
83 @param PeiServices Indirect reference to the PEI Services Table.
85 @param NotifyDescriptor Address of the notification descriptor data structure.
87 @param Ppi Address of the PPI that was installed.
94 (EFIAPI
*EFI_PEIM_NOTIFY_ENTRY_POINT
) (
95 IN EFI_PEI_SERVICES
**PeiServices
,
96 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
101 // PEI Ppi Services List Descriptors
103 #define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001
104 #define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010
105 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020
106 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040
107 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060
108 #define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000
114 } EFI_PEI_PPI_DESCRIPTOR
;
116 struct _EFI_PEI_NOTIFY_DESCRIPTOR
{
119 EFI_PEIM_NOTIFY_ENTRY_POINT Notify
;
123 This service is the first one provided by the PEI Foundation. This function
124 installs an interface in the PEI PPI database by GUID. The purpose of the
125 service is to publish an interface that other parties can use to call
128 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
129 published by the PEI Foundation.
131 @param PpiList A pointer to the list of interfaces that the caller shall install.
133 @retval EFI_SUCCESS The interface was successfully installed.
135 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
137 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
142 (EFIAPI
*EFI_PEI_INSTALL_PPI
) (
143 IN EFI_PEI_SERVICES
**PeiServices
,
144 IN EFI_PEI_PPI_DESCRIPTOR
*PpiList
148 This function reinstalls an interface in the PEI PPI database by GUID.
149 The purpose of the service is to publish an interface that other parties
150 can use to replace a same-named interface in the protocol database
151 with a different interface.
153 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
154 published by the PEI Foundation.
156 @param OldPpi A pointer to the former PPI in the database.
158 @param NewPpi A pointer to the new interfaces that the caller shall install.
160 @retval EFI_SUCCESS The interface was successfully installed.
162 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
164 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
166 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.
171 (EFIAPI
*EFI_PEI_REINSTALL_PPI
) (
172 IN EFI_PEI_SERVICES
**PeiServices
,
173 IN EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
174 IN EFI_PEI_PPI_DESCRIPTOR
*NewPpi
178 This function locates an interface in the PEI PPI database by GUID.
180 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.
182 @param Guid A pointer to the GUID whose corresponding interface needs to be found.
184 @param Instance The N-th instance of the interface that is required.
186 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
188 @param Ppi A pointer to the instance of the interface.
190 @retval EFI_SUCCESS The interface was successfully returned.
192 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
197 (EFIAPI
*EFI_PEI_LOCATE_PPI
) (
198 IN EFI_PEI_SERVICES
**PeiServices
,
201 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
206 This function installs a notification service to be called back when a
207 given interface is installed or reinstalled. The purpose of the service
208 is to publish an interface that other parties can use to call additional PPIs
209 that may materialize later.
211 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
213 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.
215 @retval EFI_SUCCESS The interface was successfully installed.
217 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
219 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
224 (EFIAPI
*EFI_PEI_NOTIFY_PPI
) (
225 IN EFI_PEI_SERVICES
**PeiServices
,
226 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
230 This function returns the present value of the boot mode.
232 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
234 @param BootMode A pointer to contain the value of the boot mode.
236 @retval EFI_SUCCESS The boot mode was returned successfully.
241 (EFIAPI
*EFI_PEI_GET_BOOT_MODE
) (
242 IN EFI_PEI_SERVICES
**PeiServices
,
243 OUT EFI_BOOT_MODE
*BootMode
247 This function sets the value of the boot mode.
249 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
251 @param BootMode The value of the boot mode to set.
253 @retval EFI_SUCCESS The boot mode was returned successfully.
258 (EFIAPI
*EFI_PEI_SET_BOOT_MODE
) (
259 IN EFI_PEI_SERVICES
**PeiServices
,
260 IN EFI_BOOT_MODE BootMode
264 This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory.
266 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
268 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize
270 @retval EFI_SUCCESS The list was successfully returned.
272 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
277 (EFIAPI
*EFI_PEI_GET_HOB_LIST
) (
278 IN EFI_PEI_SERVICES
**PeiServices
,
279 IN OUT VOID
**HobList
283 This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB¡¯s) headers.
285 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
287 @param Type The type of HOB to be installed.
289 @param Length The length of the HOB to be added.
291 @param Hob The address of a pointer that will contain the HOB header.
293 @retval EFI_SUCCESS The HOB was successfully created.
295 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
300 (EFIAPI
*EFI_PEI_CREATE_HOB
) (
301 IN EFI_PEI_SERVICES
**PeiServices
,
308 The purpose of the service is to abstract the capability of the PEI
309 Foundation to discover instances of firmware volumes in the system.
310 Given the input file pointer, this service searches for the next
311 matching file in the Firmware File System (FFS) volume.
313 @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. The value 0 is the Boot Firmware Volume (BFV).
317 @param FwVolHeader Pointer to the firmware volume header of the volume to return.
319 @retval EFI_SUCCESS The volume was found.
321 @retval EFI_NOT_FOUND The volume was not found.
323 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL
328 (EFIAPI
*EFI_PEI_FFS_FIND_NEXT_VOLUME
) (
329 IN EFI_PEI_SERVICES
**PeiServices
,
331 IN OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
335 The purpose of the service is to abstract the capability of the PEI
336 Foundation to discover instances of firmware files in the system.
337 Given the input file pointer, this service searches for the next matching
338 file in the Firmware File System (FFS) volume.
340 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
342 @param SearchType A filter to find files only of this type.
344 @param FwVolHeader Pointer to the firmware volume header of the volume to search.This parameter must point to a valid FFS volume.
346 @param FileHeader Pointer to the current file from which to begin searching.This pointer will be updated upon return to reflect the file found.
348 @retval EFI_SUCCESS The file was found.
350 @retval EFI_NOT_FOUND The file was not found.
352 @retval EFI_NOT_FOUND The header checksum was not zero.
357 (EFIAPI
*EFI_PEI_FFS_FIND_NEXT_FILE
) (
358 IN EFI_PEI_SERVICES
**PeiServices
,
359 IN EFI_FV_FILETYPE SearchType
,
360 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
361 IN OUT EFI_FFS_FILE_HEADER
**FileHeader
365 Given the input file pointer, this service searches for the next
366 matching file in the Firmware File System (FFS) volume.
368 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
370 @param SectionType The value of the section type to find.
372 @param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
374 @param SectionData A pointer to the discovered section, if successful.
376 @retval EFI_SUCCESS The section was found.
378 @retval EFI_NOT_FOUND The section was not found.
383 (EFIAPI
*EFI_PEI_FFS_FIND_SECTION_DATA
) (
384 IN EFI_PEI_SERVICES
**PeiServices
,
385 IN EFI_SECTION_TYPE SectionType
,
386 IN EFI_FFS_FILE_HEADER
*FfsFileHeader
,
387 IN OUT VOID
**SectionData
391 This function registers the found memory configuration with the PEI Foundation.
393 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
395 @param MemoryBegin The value of a region of installed memory
397 @param MemoryLength The corresponding length of a region of installed memory.
399 @retval EFI_SUCCESS The region was successfully installed in a HOB.
401 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
403 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
408 (EFIAPI
*EFI_PEI_INSTALL_PEI_MEMORY
) (
409 IN EFI_PEI_SERVICES
**PeiServices
,
410 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
411 IN UINT64 MemoryLength
415 The purpose of the service is to publish an interface that allows
416 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
418 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
420 @param MemoryType The type of memory to allocate.
422 @param Pages The number of contiguous 4 KB pages to allocate.
424 @param Memory Pointer to a physical address. On output, the address is set to the base of the page range that was allocated.
426 @retval EFI_SUCCESS The memory range was successfully allocated.
428 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
430 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
435 (EFIAPI
*EFI_PEI_ALLOCATE_PAGES
) (
436 IN EFI_PEI_SERVICES
**PeiServices
,
437 IN EFI_MEMORY_TYPE MemoryType
,
439 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
443 The purpose of this service is to publish an interface that
444 allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.
446 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
448 @param Size The number of bytes to allocate from the pool.
450 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.
452 @retval EFI_SUCCESS The allocation was successful.
454 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
459 (EFIAPI
*EFI_PEI_ALLOCATE_POOL
) (
460 IN EFI_PEI_SERVICES
**PeiServices
,
466 This service copies the contents of one buffer to another buffer.
468 @param Destination Pointer to the destination buffer of the memory copy.
470 @param Source Pointer to the source buffer of the memory copy
472 @param Length Number of bytes to copy from Source to Destination.
479 (EFIAPI
*EFI_PEI_COPY_MEM
) (
480 IN VOID
*Destination
,
486 The service fills a buffer with a specified value.
488 @param Buffer Pointer to the buffer to fill.
490 @param Size Number of bytes in Buffer to fill.
492 @param Value Value to fill Buffer with
499 (EFIAPI
*EFI_PEI_SET_MEM
) (
506 This service publishes an interface that allows PEIMs to report status codes.
508 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
510 @param Type Indicates the type of status code being reported.
512 @param Value Describes the current status of a hardware or
513 software entity. This includes information about the class and
514 subclass that is used to classify the entity as well as an operation.
515 For progress codes, the operation is the current activity.
516 For error codes, it is the exception.For debug codes,it is not defined at this time.
518 @param Instance The enumeration of a hardware or software entity within
519 the system. A system may contain multiple entities that match a class/subclass
520 pairing. The instance differentiates between them. An instance of 0 indicates
521 that instance information is unavailable, not meaningful, or not relevant.
522 Valid instance numbers start with 1.
524 @param CallerId This optional parameter may be used to identify the caller.
525 This parameter allows the status code driver to apply different rules to
528 @param Data This optional parameter may be used to pass additional data.
530 @retval EFI_SUCCESS The function completed successfully.
532 @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.
537 (EFIAPI
*EFI_PEI_REPORT_STATUS_CODE
) (
538 IN EFI_PEI_SERVICES
**PeiServices
,
539 IN EFI_STATUS_CODE_TYPE Type
,
540 IN EFI_STATUS_CODE_VALUE Value
,
542 IN EFI_GUID
*CallerId OPTIONAL
,
543 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
547 Resets the entire platform.
549 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES
550 table published by the PEI Foundation.
552 @retval EFI_SUCCESS The function completed successfully.
554 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
559 (EFIAPI
*EFI_PEI_RESET_SYSTEM
) (
560 IN EFI_PEI_SERVICES
**PeiServices
564 // EFI PEI Services Table
566 #define PEI_SERVICES_SIGNATURE 0x5652455320494550ULL
567 #define PEI_SERVICES_REVISION ((PEI_SPECIFICATION_MAJOR_REVISION << 16) | (PEI_SPECIFICATION_MINOR_REVISION))
569 struct _EFI_PEI_SERVICES
{
570 EFI_TABLE_HEADER Hdr
;
575 EFI_PEI_INSTALL_PPI InstallPpi
;
576 EFI_PEI_REINSTALL_PPI ReInstallPpi
;
577 EFI_PEI_LOCATE_PPI LocatePpi
;
578 EFI_PEI_NOTIFY_PPI NotifyPpi
;
581 // Boot Mode Functions
583 EFI_PEI_GET_BOOT_MODE GetBootMode
;
584 EFI_PEI_SET_BOOT_MODE SetBootMode
;
589 EFI_PEI_GET_HOB_LIST GetHobList
;
590 EFI_PEI_CREATE_HOB CreateHob
;
593 // Filesystem Functions
595 EFI_PEI_FFS_FIND_NEXT_VOLUME FfsFindNextVolume
;
596 EFI_PEI_FFS_FIND_NEXT_FILE FfsFindNextFile
;
597 EFI_PEI_FFS_FIND_SECTION_DATA FfsFindSectionData
;
602 EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory
;
603 EFI_PEI_ALLOCATE_PAGES AllocatePages
;
604 EFI_PEI_ALLOCATE_POOL AllocatePool
;
605 EFI_PEI_COPY_MEM CopyMem
;
606 EFI_PEI_SET_MEM SetMem
;
611 EFI_PEI_REPORT_STATUS_CODE PeiReportStatusCode
;
616 EFI_PEI_RESET_SYSTEM PeiResetSystem
;
619 // Pointer to PPI interface
621 EFI_PEI_CPU_IO_PPI
*CpuIo
;
622 EFI_PEI_PCI_CFG_PPI
*PciCfg
;
627 UINTN BootFirmwareVolume
;
628 UINTN SizeOfCacheAsRam
;
629 EFI_PEI_PPI_DESCRIPTOR
*DispatchTable
;
630 } EFI_PEI_STARTUP_DESCRIPTOR
;
632 #include <Common/EfiImage.h>
633 #include <Common/StatusCode.h>
634 #include <Common/BootScript.h>
635 #include <Common/Capsule.h>
637 #include <Guid/Apriori.h>
638 #include <Guid/Capsule.h>
639 #include <Guid/DxeServices.h>
640 #include <Guid/HobList.h>
641 #include <Guid/MemoryAllocationHob.h>
642 #include <Guid/FirmwareFileSystem.h>
643 #include <Guid/SmramMemoryReserve.h>
644 #include <Guid/GlobalVariable.h>
646 #include <Ppi/BlockIo.h>
647 #include <Ppi/BootInRecoveryMode.h>
648 #include <Ppi/BootScriptExecuter.h>
649 #include <Ppi/DeviceRecoveryModule.h>
650 #include <Ppi/DxeIpl.h>
651 #include <Ppi/EndOfPeiPhase.h>
652 #include <Ppi/FindFv.h>
653 #include <Ppi/LoadFile.h>
654 #include <Ppi/MasterBootMode.h>
655 #include <Ppi/MemoryDiscovered.h>
657 #include <Ppi/ReadOnlyVariable.h>
658 #include <Ppi/RecoveryModule.h>
659 #include <Ppi/Reset.h>
660 #include <Ppi/S3Resume.h>
661 #include <Ppi/SecPlatformInformation.h>
662 #include <Ppi/SectionExtraction.h>
663 #include <Ppi/Security.h>
664 #include <Ppi/Smbus.h>
665 #include <Ppi/Stall.h>
666 #include <Ppi/StatusCode.h>
668 #include <Protocol/FirmwareVolumeBlock.h>
669 #include <Protocol/Pcd.h>