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/PciCfg2.h>
55 #include <Ppi/PciCfg.h>
58 // PEI Specification Revision information
60 #define PEI_SPECIFICATION_MAJOR_REVISION 0
61 #define PEI_SPECIFICATION_MINOR_REVISION 91
64 The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI
65 Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header.
67 @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.
84 @param NotifyDescriptor Address of the notification descriptor data structure.
85 @param Ppi Address of the PPI that was installed.
92 (EFIAPI
*EFI_PEIM_NOTIFY_ENTRY_POINT
) (
93 IN EFI_PEI_SERVICES
**PeiServices
,
94 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
99 // PEI Ppi Services List Descriptors
101 #define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001
102 #define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010
103 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020
104 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040
105 #define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060
106 #define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000
112 } EFI_PEI_PPI_DESCRIPTOR
;
114 struct _EFI_PEI_NOTIFY_DESCRIPTOR
{
117 EFI_PEIM_NOTIFY_ENTRY_POINT Notify
;
121 This service is the first one provided by the PEI Foundation. This function
122 installs an interface in the PEI PPI database by GUID. The purpose of the
123 service is to publish an interface that other parties can use to call
126 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
127 published by the PEI Foundation.
128 @param PpiList A pointer to the list of interfaces that the caller shall install.
130 @retval EFI_SUCCESS The interface was successfully installed.
131 @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.
132 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
137 (EFIAPI
*EFI_PEI_INSTALL_PPI
) (
138 IN EFI_PEI_SERVICES
**PeiServices
,
139 IN EFI_PEI_PPI_DESCRIPTOR
*PpiList
143 This function reinstalls an interface in the PEI PPI database by GUID.
144 The purpose of the service is to publish an interface that other parties
145 can use to replace a same-named interface in the protocol database
146 with a different interface.
148 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table
149 published by the PEI Foundation.
150 @param OldPpi A pointer to the former PPI in the database.
151 @param NewPpi A pointer to the new interfaces that the caller shall install.
153 @retval EFI_SUCCESS The interface was successfully installed.
154 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the
155 list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
156 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
157 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.
162 (EFIAPI
*EFI_PEI_REINSTALL_PPI
) (
163 IN EFI_PEI_SERVICES
**PeiServices
,
164 IN EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
165 IN EFI_PEI_PPI_DESCRIPTOR
*NewPpi
169 This function locates an interface in the PEI PPI database by GUID.
171 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.
172 @param Guid A pointer to the GUID whose corresponding interface needs to be found.
173 @param Instance The N-th instance of the interface that is required.
174 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
175 @param Ppi A pointer to the instance of the interface.
177 @retval EFI_SUCCESS The interface was successfully returned.
178 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
183 (EFIAPI
*EFI_PEI_LOCATE_PPI
) (
184 IN EFI_PEI_SERVICES
**PeiServices
,
187 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
192 This function installs a notification service to be called back when a
193 given interface is installed or reinstalled. The purpose of the service
194 is to publish an interface that other parties can use to call additional PPIs
195 that may materialize later.
197 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
198 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.
200 @retval EFI_SUCCESS The interface was successfully installed.
201 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the
202 list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
203 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
208 (EFIAPI
*EFI_PEI_NOTIFY_PPI
) (
209 IN EFI_PEI_SERVICES
**PeiServices
,
210 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
214 This function returns the present value of the boot mode.
216 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
217 @param BootMode A pointer to contain the value of the boot mode.
219 @retval EFI_SUCCESS The boot mode was returned successfully.
224 (EFIAPI
*EFI_PEI_GET_BOOT_MODE
) (
225 IN EFI_PEI_SERVICES
**PeiServices
,
226 OUT EFI_BOOT_MODE
*BootMode
230 This function sets the value of the boot mode.
232 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
233 @param BootMode The value of the boot mode to set.
235 @retval EFI_SUCCESS The boot mode was returned successfully.
240 (EFIAPI
*EFI_PEI_SET_BOOT_MODE
) (
241 IN EFI_PEI_SERVICES
**PeiServices
,
242 IN EFI_BOOT_MODE BootMode
246 This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory.
248 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
249 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize
251 @retval EFI_SUCCESS The list was successfully returned.
252 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
257 (EFIAPI
*EFI_PEI_GET_HOB_LIST
) (
258 IN EFI_PEI_SERVICES
**PeiServices
,
259 IN OUT VOID
**HobList
263 This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB's) headers.
265 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
266 @param Type The type of HOB to be installed.
267 @param Length The length of the HOB to be added.
268 @param Hob The address of a pointer that will contain the HOB header.
270 @retval EFI_SUCCESS The HOB was successfully created.
271 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
276 (EFIAPI
*EFI_PEI_CREATE_HOB
) (
277 IN EFI_PEI_SERVICES
**PeiServices
,
284 The purpose of the service is to abstract the capability of the PEI
285 Foundation to discover instances of firmware volumes in the system.
286 Given the input file pointer, this service searches for the next
287 matching file in the Firmware File System (FFS) volume.
289 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
290 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV).
291 @param FwVolHeader Pointer to the firmware volume header of the volume to return.
293 @retval EFI_SUCCESS The volume was found.
294 @retval EFI_NOT_FOUND The volume was not found.
295 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL
300 (EFIAPI
*EFI_PEI_FFS_FIND_NEXT_VOLUME
) (
301 IN EFI_PEI_SERVICES
**PeiServices
,
303 IN OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
307 The purpose of the service is to abstract the capability of the PEI
308 Foundation to discover instances of firmware files in the system.
309 Given the input file pointer, this service searches for the next matching
310 file in the Firmware File System (FFS) volume.
312 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
313 @param SearchType A filter to find files only of this type.
314 @param FwVolHeader Pointer to the firmware volume header of the volume to search.This parameter
315 must point to a valid FFS volume.
316 @param FileHeader Pointer to the current file from which to begin searching.This pointer will be
317 updated upon return to reflect the file found.
319 @retval EFI_SUCCESS The file was found.
320 @retval EFI_NOT_FOUND The file was not found.
321 @retval EFI_NOT_FOUND The header checksum was not zero.
326 (EFIAPI
*EFI_PEI_FFS_FIND_NEXT_FILE
) (
327 IN EFI_PEI_SERVICES
**PeiServices
,
328 IN EFI_FV_FILETYPE SearchType
,
329 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
330 IN OUT EFI_FFS_FILE_HEADER
**FileHeader
334 Given the input file pointer, this service searches for the next
335 matching file in the Firmware File System (FFS) volume.
337 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
338 @param SectionType The value of the section type to find.
339 @param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
340 @param SectionData A pointer to the discovered section, if successful.
342 @retval EFI_SUCCESS The section was found.
343 @retval EFI_NOT_FOUND The section was not found.
348 (EFIAPI
*EFI_PEI_FFS_FIND_SECTION_DATA
) (
349 IN EFI_PEI_SERVICES
**PeiServices
,
350 IN EFI_SECTION_TYPE SectionType
,
351 IN EFI_FFS_FILE_HEADER
*FfsFileHeader
,
352 IN OUT VOID
**SectionData
356 This function registers the found memory configuration with the PEI Foundation.
358 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
359 @param MemoryBegin The value of a region of installed memory
360 @param MemoryLength The corresponding length of a region of installed memory.
362 @retval EFI_SUCCESS The region was successfully installed in a HOB.
363 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
364 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
369 (EFIAPI
*EFI_PEI_INSTALL_PEI_MEMORY
) (
370 IN EFI_PEI_SERVICES
**PeiServices
,
371 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
372 IN UINT64 MemoryLength
376 The purpose of the service is to publish an interface that allows
377 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
379 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
380 @param MemoryType The type of memory to allocate.
381 @param Pages The number of contiguous 4 KB pages to allocate.
382 @param Memory Pointer to a physical address. On output, the address is set to the base
383 of the page range that was allocated.
385 @retval EFI_SUCCESS The memory range was successfully allocated.
386 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
387 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
392 (EFIAPI
*EFI_PEI_ALLOCATE_PAGES
) (
393 IN EFI_PEI_SERVICES
**PeiServices
,
394 IN EFI_MEMORY_TYPE MemoryType
,
396 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
400 The purpose of this service is to publish an interface that
401 allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.
403 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
404 @param Size The number of bytes to allocate from the pool.
405 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.
407 @retval EFI_SUCCESS The allocation was successful.
408 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
413 (EFIAPI
*EFI_PEI_ALLOCATE_POOL
) (
414 IN EFI_PEI_SERVICES
**PeiServices
,
420 This service copies the contents of one buffer to another buffer.
422 @param Destination Pointer to the destination buffer of the memory copy.
423 @param Source Pointer to the source buffer of the memory copy
424 @param Length Number of bytes to copy from Source to Destination.
431 (EFIAPI
*EFI_PEI_COPY_MEM
) (
432 IN VOID
*Destination
,
438 The service fills a buffer with a specified value.
440 @param Buffer Pointer to the buffer to fill.
441 @param Size Number of bytes in Buffer to fill.
442 @param Value Value to fill Buffer with
449 (EFIAPI
*EFI_PEI_SET_MEM
) (
456 This service publishes an interface that allows PEIMs to report status codes.
458 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
459 @param Type Indicates the type of status code being reported.
460 @param Value Describes the current status of a hardware or
461 software entity. This includes information about the class and
462 subclass that is used to classify the entity as well as an operation.
463 For progress codes, the operation is the current activity.
464 For error codes, it is the exception.For debug codes,it is not defined at this time.
465 @param Instance The enumeration of a hardware or software entity within
466 the system. A system may contain multiple entities that match a class/subclass
467 pairing. The instance differentiates between them. An instance of 0 indicates
468 that instance information is unavailable, not meaningful, or not relevant.
469 Valid instance numbers start with 1.
470 @param CallerId This optional parameter may be used to identify the caller.
471 This parameter allows the status code driver to apply different rules to
473 @param Data This optional parameter may be used to pass additional data.
475 @retval EFI_SUCCESS The function completed successfully.
476 @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.
481 (EFIAPI
*EFI_PEI_REPORT_STATUS_CODE
) (
482 IN EFI_PEI_SERVICES
**PeiServices
,
483 IN EFI_STATUS_CODE_TYPE Type
,
484 IN EFI_STATUS_CODE_VALUE Value
,
486 IN EFI_GUID
*CallerId OPTIONAL
,
487 IN EFI_STATUS_CODE_DATA
*Data OPTIONAL
491 Resets the entire platform.
493 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES
494 table published by the PEI Foundation.
496 @retval EFI_SUCCESS The function completed successfully.
497 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
502 (EFIAPI
*EFI_PEI_RESET_SYSTEM
) (
503 IN EFI_PEI_SERVICES
**PeiServices
507 // EFI PEI Services Table
509 #define PEI_SERVICES_SIGNATURE 0x5652455320494550ULL
510 #define PEI_SERVICES_REVISION ((PEI_SPECIFICATION_MAJOR_REVISION << 16) | (PEI_SPECIFICATION_MINOR_REVISION))
512 struct _EFI_PEI_SERVICES
{
513 EFI_TABLE_HEADER Hdr
;
518 EFI_PEI_INSTALL_PPI InstallPpi
;
519 EFI_PEI_REINSTALL_PPI ReInstallPpi
;
520 EFI_PEI_LOCATE_PPI LocatePpi
;
521 EFI_PEI_NOTIFY_PPI NotifyPpi
;
524 // Boot Mode Functions
526 EFI_PEI_GET_BOOT_MODE GetBootMode
;
527 EFI_PEI_SET_BOOT_MODE SetBootMode
;
532 EFI_PEI_GET_HOB_LIST GetHobList
;
533 EFI_PEI_CREATE_HOB CreateHob
;
536 // Filesystem Functions
538 EFI_PEI_FFS_FIND_NEXT_VOLUME FfsFindNextVolume
;
539 EFI_PEI_FFS_FIND_NEXT_FILE FfsFindNextFile
;
540 EFI_PEI_FFS_FIND_SECTION_DATA FfsFindSectionData
;
545 EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory
;
546 EFI_PEI_ALLOCATE_PAGES AllocatePages
;
547 EFI_PEI_ALLOCATE_POOL AllocatePool
;
548 EFI_PEI_COPY_MEM CopyMem
;
549 EFI_PEI_SET_MEM SetMem
;
554 EFI_PEI_REPORT_STATUS_CODE PeiReportStatusCode
;
559 EFI_PEI_RESET_SYSTEM PeiResetSystem
;
562 // Pointer to PPI interface
564 EFI_PEI_CPU_IO_PPI
*CpuIo
;
565 EFI_PEI_PCI_CFG_PPI
*PciCfg
;
570 UINTN BootFirmwareVolume
;
571 UINTN SizeOfCacheAsRam
;
572 EFI_PEI_PPI_DESCRIPTOR
*DispatchTable
;
573 } EFI_PEI_STARTUP_DESCRIPTOR
;
575 #include <Common/EfiImage.h>
576 #include <Common/StatusCode.h>
577 #include <Common/BootScript.h>
578 #include <Common/Capsule.h>
580 #include <Guid/Apriori.h>
581 #include <Guid/Capsule.h>
582 #include <Guid/DxeServices.h>
583 #include <Guid/HobList.h>
584 #include <Guid/MemoryAllocationHob.h>
585 #include <Guid/FirmwareFileSystem.h>
586 #include <Guid/SmramMemoryReserve.h>
587 #include <Guid/GlobalVariable.h>
589 #include <Ppi/BlockIo.h>
590 #include <Ppi/BootInRecoveryMode.h>
591 #include <Ppi/BootScriptExecuter.h>
592 #include <Ppi/DeviceRecoveryModule.h>
593 #include <Ppi/DxeIpl.h>
594 #include <Ppi/EndOfPeiPhase.h>
595 #include <Ppi/FindFv.h>
596 #include <Ppi/LoadFile.h>
597 #include <Ppi/MasterBootMode.h>
598 #include <Ppi/MemoryDiscovered.h>
600 #include <Ppi/ReadOnlyVariable.h>
601 #include <Ppi/RecoveryModule.h>
602 #include <Ppi/Reset.h>
603 #include <Ppi/S3Resume.h>
604 #include <Ppi/SecPlatformInformation.h>
605 #include <Ppi/SectionExtraction.h>
606 #include <Ppi/Security.h>
607 #include <Ppi/Smbus.h>
608 #include <Ppi/Stall.h>
609 #include <Ppi/StatusCode.h>
611 #include <Protocol/FirmwareVolumeBlock.h>