2 PEI Core Library implementation
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.
13 Module Name: PeiServicesLib.h
17 #ifndef __PEI_SERVICES_LIB_H__
18 #define __PEI_SERVICES_LIB_H__
21 This service enables a given PEIM to register an interface into the PEI Foundation.
23 @param PpiList A pointer to the list of interfaces that the caller shall install.
25 @retval EFI_SUCCESS The interface was successfully installed.
26 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
27 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have
28 the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
29 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
34 PeiServicesInstallPpi (
35 IN EFI_PEI_PPI_DESCRIPTOR
*PpiList
40 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
42 @param OldPpi Pointer to the old PEI PPI Descriptors.
43 @param NewPpi Pointer to the new PEI PPI Descriptors.
45 @retval EFI_SUCCESS The interface was successfully installed.
46 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
47 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have
48 the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
49 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
50 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.
55 PeiServicesReInstallPpi (
56 IN EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
57 IN EFI_PEI_PPI_DESCRIPTOR
*NewPpi
62 This service enables PEIMs to discover a given instance of an interface.
64 @param Guid A pointer to the GUID whose corresponding interface needs to be found.
65 @param Instance The N-th instance of the interface that is required.
66 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
67 @param Ppi A pointer to the instance of the interface.
69 @retval EFI_SUCCESS The interface was successfully returned.
70 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
75 PeiServicesLocatePpi (
78 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
84 This service enables PEIMs to register a given service to be invoked
85 when another service is installed or reinstalled.
87 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.
89 @retval EFI_SUCCESS The interface was successfully installed.
90 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
91 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have
92 the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
93 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
98 PeiServicesNotifyPpi (
99 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
104 This service enables PEIMs to ascertain the present value of the boot mode.
106 @param BootMode A pointer to contain the value of the boot mode.
108 @retval EFI_SUCCESS The boot mode was returned successfully.
109 @retval EFI_INVALID_PARAMETER BootMode is NULL.
114 PeiServicesGetBootMode (
115 IN OUT EFI_BOOT_MODE
*BootMode
120 This service enables PEIMs to update the boot mode variable.
122 @param BootMode The value of the boot mode to set.
124 @retval EFI_SUCCESS The value was successfully updated
129 PeiServicesSetBootMode (
130 IN EFI_BOOT_MODE BootMode
135 This service enables a PEIM to ascertain the address of the list of HOBs in memory.
137 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
139 @retval EFI_SUCCESS The list was successfully returned.
140 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
145 PeiServicesGetHobList (
146 IN OUT VOID
**HobList
151 This service enables PEIMs to create various types of HOBs.
153 @param Type The type of HOB to be installed.
154 @param Length The length of the HOB to be added.
155 @param Hob The address of a pointer that will contain the HOB header.
157 @retval EFI_SUCCESS The HOB was successfully created.
158 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
163 PeiServicesCreateHob (
171 This service enables PEIMs to discover additional firmware volumes.
173 @param Instance This instance of the firmware volume to find.
174 The value 0 is the Boot Firmware Volume (BFV).
175 @param FwVolHeader Pointer to the firmware volume header of the volume to return.
177 @retval EFI_SUCCESS The volume was found.
178 @retval EFI_NOT_FOUND The volume was not found.
179 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
184 PeiServicesFfsFindNextVolume (
186 IN OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
191 This service enables PEIMs to discover additional firmware files.
193 @param SearchType A filter to find files only of this type.
194 @param FwVolHeader Pointer to the firmware volume header of the volume to search.
195 This parameter must point to a valid FFS volume.
196 @param FileHeader Pointer to the current file from which to begin searching.
198 @retval EFI_SUCCESS The file was found.
199 @retval EFI_NOT_FOUND The file was not found.
200 @retval EFI_NOT_FOUND The header checksum was not zero.
205 PeiServicesFfsFindNextFile (
206 IN EFI_FV_FILETYPE SearchType
,
207 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
208 IN OUT EFI_FFS_FILE_HEADER
**FileHeader
213 This service enables PEIMs to discover sections of a given type within a valid FFS file.
215 @param SearchType The value of the section type to find.
216 @param FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
217 @param SectionData A pointer to the discovered section, if successful.
219 @retval EFI_SUCCESS The section was found.
220 @retval EFI_NOT_FOUND The section was not found.
225 PeiServicesFfsFindSectionData (
226 IN EFI_SECTION_TYPE SectionType
,
227 IN EFI_FFS_FILE_HEADER
*FfsFileHeader
,
228 IN OUT VOID
**SectionData
233 This service enables PEIMs to register the permanent memory configuration
234 that has been initialized with the PEI Foundation.
236 @param MemoryBegin The value of a region of installed memory.
237 @param MemoryLength The corresponding length of a region of installed memory.
239 @retval EFI_SUCCESS The region was successfully installed in a HOB.
240 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
241 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
246 PeiServicesInstallPeiMemory (
247 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
248 IN UINT64 MemoryLength
253 This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM.
255 @param MemoryType Type of memory to allocate.
256 @param Pages Number of pages to allocate.
257 @param Memory Pointer of memory allocated.
259 @retval EFI_SUCCESS The memory range was successfully allocated.
260 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
261 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
262 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
267 PeiServicesAllocatePages (
268 IN EFI_MEMORY_TYPE MemoryType
,
270 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
275 This service allocates memory from the Hand-Off Block (HOB) heap.
277 @param Size The number of bytes to allocate from the pool.
278 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer;
281 @retval EFI_SUCCESS The allocation was successful
282 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
287 PeiServicesAllocatePool (
294 This service resets the entire platform, including all processors and devices, and reboots the system.
296 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
301 PeiServicesResetSystem (