3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 EdkIIGluePeiServicesLib.h
19 Public header file for PEI Services Lib
23 #ifndef __EDKII_GLUE_PEI_SERVICES_LIB_H__
24 #define __EDKII_GLUE_PEI_SERVICES_LIB_H__
27 // To avoid macro expansion issue when the parameter list has #if #endif.
29 #define PeiServicesLocatePpi GluePeiServicesLocatePpi
32 This service enables a given PEIM to register an interface into the PEI Foundation.
34 @param PpiList A pointer to the list of interfaces that the caller shall install.
36 @retval EFI_SUCCESS The interface was successfully installed.
37 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
38 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
39 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
40 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
45 PeiServicesInstallPpi (
46 IN EFI_PEI_PPI_DESCRIPTOR
*PpiList
50 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
52 @param OldPpi Pointer to the old PEI PPI Descriptors.
53 @param NewPpi Pointer to the new PEI PPI Descriptors.
55 @retval EFI_SUCCESS The interface was successfully installed.
56 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
57 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
58 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
59 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
60 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
66 PeiServicesReInstallPpi (
67 IN EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
68 IN EFI_PEI_PPI_DESCRIPTOR
*NewPpi
72 This service enables PEIMs to discover a given instance of an interface.
74 @param Guid A pointer to the GUID whose corresponding interface needs to be
76 @param Instance The N-th instance of the interface that is required.
77 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
78 @param Ppi A pointer to the instance of the interface.
80 @retval EFI_SUCCESS The interface was successfully returned.
81 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
86 PeiServicesLocatePpi (
89 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
94 This service enables PEIMs to register a given service to be invoked when another service is
95 installed or reinstalled.
97 @param NotifyList A pointer to the list of notification interfaces that the caller
100 @retval EFI_SUCCESS The interface was successfully installed.
101 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
102 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the
103 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
104 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
109 PeiServicesNotifyPpi (
110 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
114 This service enables PEIMs to ascertain the present value of the boot mode.
116 @param BootMode A pointer to contain the value of the boot mode.
118 @retval EFI_SUCCESS The boot mode was returned successfully.
119 @retval EFI_INVALID_PARAMETER BootMode is NULL.
124 PeiServicesGetBootMode (
125 IN OUT EFI_BOOT_MODE
*BootMode
129 This service enables PEIMs to update the boot mode variable.
131 @param BootMode The value of the boot mode to set.
133 @retval EFI_SUCCESS The value was successfully updated
138 PeiServicesSetBootMode (
139 IN EFI_BOOT_MODE BootMode
143 This service enables a PEIM to ascertain the address of the list of HOBs in memory.
145 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
147 @retval EFI_SUCCESS The list was successfully returned.
148 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
153 PeiServicesGetHobList (
154 IN OUT VOID
**HobList
158 This service enables PEIMs to create various types of HOBs.
160 @param Type The type of HOB to be installed.
161 @param Length The length of the HOB to be added.
162 @param Hob The address of a pointer that will contain the HOB header.
164 @retval EFI_SUCCESS The HOB was successfully created.
165 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
170 PeiServicesCreateHob (
176 #if (PI_SPECIFICATION_VERSION < 0x00010000)
178 This service enables PEIMs to discover additional firmware volumes.
180 @param Instance This instance of the firmware volume to find. The value 0 is the
181 Boot Firmware Volume (BFV).
182 @param FwVolHeader Pointer to the firmware volume header of the volume to return.
184 @retval EFI_SUCCESS The volume was found.
185 @retval EFI_NOT_FOUND The volume was not found.
186 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
191 PeiServicesFfsFindNextVolume (
193 IN OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
197 This service enables PEIMs to discover additional firmware files.
199 @param SearchType A filter to find files only of this type.
200 @param FwVolHeader Pointer to the firmware volume header of the volume to search.
201 This parameter must point to a valid FFS volume.
202 @param FileHeader Pointer to the current file from which to begin searching.
204 @retval EFI_SUCCESS The file was found.
205 @retval EFI_NOT_FOUND The file was not found.
206 @retval EFI_NOT_FOUND The header checksum was not zero.
211 PeiServicesFfsFindNextFile (
212 IN EFI_FV_FILETYPE SearchType
,
213 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
214 IN OUT EFI_FFS_FILE_HEADER
**FileHeader
218 This service enables PEIMs to discover sections of a given type within a valid FFS file.
220 @param SearchType The value of the section type to find.
221 @param FfsFileHeader A pointer to the file header that contains the set of sections to
223 @param SectionData A pointer to the discovered section, if successful.
225 @retval EFI_SUCCESS The section was found.
226 @retval EFI_NOT_FOUND The section was not found.
231 PeiServicesFfsFindSectionData (
232 IN EFI_SECTION_TYPE SectionType
,
233 IN EFI_FFS_FILE_HEADER
*FfsFileHeader
,
234 IN OUT VOID
**SectionData
239 This service enables PEIMs to register the permanent memory configuration
240 that has been initialized with the PEI Foundation.
242 @param MemoryBegin The value of a region of installed memory.
243 @param MemoryLength The corresponding length of a region of installed memory.
245 @retval EFI_SUCCESS The region was successfully installed in a HOB.
246 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
247 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
252 PeiServicesInstallPeiMemory (
253 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
254 IN UINT64 MemoryLength
258 This service enables PEIMs to allocate memory after the permanent memory has been installed by a
261 @param MemoryType Type of memory to allocate.
262 @param Pages Number of pages to allocate.
263 @param Memory Pointer of memory allocated.
265 @retval EFI_SUCCESS The memory range was successfully allocated.
266 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
267 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
268 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
273 PeiServicesAllocatePages (
274 IN EFI_MEMORY_TYPE MemoryType
,
276 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
280 This service allocates memory from the Hand-Off Block (HOB) heap.
282 @param Size The number of bytes to allocate from the pool.
283 @param Buffer If the call succeeds, a pointer to a pointer to the allocate
284 buffer; undefined otherwise.
286 @retval EFI_SUCCESS The allocation was successful
287 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
292 PeiServicesAllocatePool (
298 This service resets the entire platform, including all processors and devices, and reboots the
301 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
306 PeiServicesResetSystem (
311 PCI read-modify-write operations.
313 PIWG's PI specification replaces Inte's EFI Specification 1.10.
314 EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by
315 EFI_PEI_PCI_CFG2_PPI in PI 1.0. "Modify" function in these two PPI are not
316 compatibile with each other.
318 For Framework code that make the following call:
327 it will be updated to the following code which call this library API:
337 @param PeiServices An indirect pointer to the PEI Services Table
338 published by the PEI Foundation.
339 @param PciCfg A pointer to the this pointer of EFI_PEI_PCI_CFG_PPI.
340 This parameter is unused as a place holder to make
341 the parameter list identical to PEI_PCI_CFG_PPI_RW.
342 @param Width The width of the access. Enumerated in bytes. Type
343 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
344 @param Address The physical address of the access.
345 @param SetBits Points to value to bitwise-OR with the read configuration value.
346 The size of the value is determined by Width.
347 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
348 The size of the value is determined by Width.
350 @retval EFI_SUCCESS The function completed successfully.
351 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
356 IN EFI_PEI_SERVICES
**PeiServices
,
357 IN PEI_PCI_CFG_PPI
*PciCfg
,
358 IN PEI_PCI_CFG_PPI_WIDTH Width
,