2 Provides library functions for all PEI Services.
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 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 #ifndef __PEI_SERVICES_LIB_H__
16 #define __PEI_SERVICES_LIB_H__
19 This service enables a given PEIM to register an interface into the PEI Foundation.
21 @param PpiList A pointer to the list of interfaces that the caller shall install.
23 @retval EFI_SUCCESS The interface was successfully installed.
24 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
25 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
26 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
27 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
32 PeiServicesInstallPpi (
33 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
37 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
39 @param OldPpi Pointer to the old PEI PPI Descriptors.
40 @param NewPpi Pointer to the new PEI PPI Descriptors.
42 @retval EFI_SUCCESS The interface was successfully installed.
43 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
44 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
45 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
46 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
47 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
53 PeiServicesReInstallPpi (
54 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
55 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
59 This service enables PEIMs to discover a given instance of an interface.
61 @param Guid A pointer to the GUID whose corresponding interface needs to be
63 @param Instance The N-th instance of the interface that is required.
64 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
65 @param Ppi A pointer to the instance of the interface.
67 @retval EFI_SUCCESS The interface was successfully returned.
68 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
73 PeiServicesLocatePpi (
74 IN CONST EFI_GUID
*Guid
,
76 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
81 This service enables PEIMs to register a given service to be invoked when another service is
82 installed or reinstalled.
84 @param NotifyList A pointer to the list of notification interfaces that the caller
87 @retval EFI_SUCCESS The interface was successfully installed.
88 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
89 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the
90 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
91 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
96 PeiServicesNotifyPpi (
97 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
101 This service enables PEIMs to ascertain the present value of the boot mode.
103 @param BootMode A pointer to contain the value of the boot mode.
105 @retval EFI_SUCCESS The boot mode was returned successfully.
106 @retval EFI_INVALID_PARAMETER BootMode is NULL.
111 PeiServicesGetBootMode (
112 OUT EFI_BOOT_MODE
*BootMode
116 This service enables PEIMs to update the boot mode variable.
118 @param BootMode The value of the boot mode to set.
120 @retval EFI_SUCCESS The value was successfully updated
125 PeiServicesSetBootMode (
126 IN EFI_BOOT_MODE BootMode
130 This service enables a PEIM to ascertain the address of the list of HOBs in memory.
132 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
134 @retval EFI_SUCCESS The list was successfully returned.
135 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
140 PeiServicesGetHobList (
145 This service enables PEIMs to create various types of HOBs.
147 @param Type The type of HOB to be installed.
148 @param Length The length of the HOB to be added.
149 @param Hob The address of a pointer that will contain the HOB header.
151 @retval EFI_SUCCESS The HOB was successfully created.
152 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
157 PeiServicesCreateHob (
164 This service enables PEIMs to discover additional firmware volumes.
166 @param Instance This instance of the firmware volume to find. The value 0 is the
167 Boot Firmware Volume (BFV).
168 @param VolumeHandle Handle of the firmware volume header of the volume to return.
170 @retval EFI_SUCCESS The volume was found.
171 @retval EFI_NOT_FOUND The volume was not found.
172 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
177 PeiServicesFfsFindNextVolume (
179 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
183 This service enables PEIMs to discover additional firmware files.
185 @param SearchType A filter to find files only of this type.
186 @param VolumeHandle Pointer to the firmware volume header of the volume to search.
187 This parameter must point to a valid FFS volume.
188 @param FileHandle Handle of the current file from which to begin searching.
190 @retval EFI_SUCCESS The file was found.
191 @retval EFI_NOT_FOUND The file was not found.
192 @retval EFI_NOT_FOUND The header checksum was not zero.
197 PeiServicesFfsFindNextFile (
198 IN EFI_FV_FILETYPE SearchType
,
199 IN EFI_PEI_FV_HANDLE VolumeHandle
,
200 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
204 This service enables PEIMs to discover sections of a given type within a valid FFS file.
206 @param SectionType The value of the section type to find.
207 @param FileHandle A pointer to the file header that contains the set of sections to
209 @param SectionData A pointer to the discovered section, if successful.
211 @retval EFI_SUCCESS The section was found.
212 @retval EFI_NOT_FOUND The section was not found.
217 PeiServicesFfsFindSectionData (
218 IN EFI_SECTION_TYPE SectionType
,
219 IN EFI_PEI_FILE_HANDLE FileHandle
,
220 OUT VOID
**SectionData
224 This service enables PEIMs to register the permanent memory configuration
225 that has been initialized with the PEI Foundation.
227 @param MemoryBegin The value of a region of installed memory.
228 @param MemoryLength The corresponding length of a region of installed memory.
230 @retval EFI_SUCCESS The region was successfully installed in a HOB.
231 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
232 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
237 PeiServicesInstallPeiMemory (
238 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
239 IN UINT64 MemoryLength
243 This service enables PEIMs to allocate memory after the permanent memory has been installed by a
246 @param MemoryType Type of memory to allocate.
247 @param Pages Number of pages to allocate.
248 @param Memory Pointer of memory allocated.
250 @retval EFI_SUCCESS The memory range was successfully allocated.
251 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
252 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
253 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
258 PeiServicesAllocatePages (
259 IN EFI_MEMORY_TYPE MemoryType
,
261 OUT EFI_PHYSICAL_ADDRESS
*Memory
265 This service allocates memory from the Hand-Off Block (HOB) heap.
267 @param Size The number of bytes to allocate from the pool.
268 @param Buffer If the call succeeds, a pointer to a pointer to the allocate
269 buffer; undefined otherwise.
271 @retval EFI_SUCCESS The allocation was successful
272 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
277 PeiServicesAllocatePool (
283 Resets the entire platform.
285 @retval EFI_SUCCESS The function completed successfully.
286 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
291 PeiServicesResetSystem (
297 This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services
298 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
299 Specification for details.
301 @param FileName A pointer to the name of the file to
302 find within the firmware volume.
304 @param VolumeHandle The firmware volume to search FileHandle
305 Upon exit, points to the found file's
306 handle or NULL if it could not be found.
307 @param FileHandle Pointer to found file handle
309 @retval EFI_SUCCESS File was found.
311 @retval EFI_NOT_FOUND File was not found.
313 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or
319 PeiServicesFfsFindFileByName (
320 IN CONST EFI_GUID
*FileName
,
321 IN CONST EFI_PEI_FV_HANDLE VolumeHandle
,
322 OUT EFI_PEI_FILE_HANDLE
*FileHandle
327 This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services
328 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
329 Specification for details.
331 @param FileHandle Handle of the file.
333 @param FileInfo Upon exit, points to the file's
336 @retval EFI_SUCCESS File information returned.
338 @retval EFI_INVALID_PARAMETER If FileHandle does not
339 represent a valid file.
341 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
346 PeiServicesFfsGetFileInfo (
347 IN CONST EFI_PEI_FILE_HANDLE FileHandle
,
348 OUT EFI_FV_FILE_INFO
*FileInfo
352 This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
353 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
354 Specification for details.
356 @param VolumeHandle Handle of the volume.
358 @param VolumeInfo Upon exit, points to the volume's
361 @retval EFI_SUCCESS File information returned.
363 @retval EFI_INVALID_PARAMETER If FileHandle does not
364 represent a valid file.
366 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
371 PeiServicesFfsGetVolumeInfo (
372 IN EFI_PEI_FV_HANDLE VolumeHandle
,
373 OUT EFI_FV_INFO
*VolumeInfo
378 This service is a wrapper for the PEI Service RegisterForShadow(), except the pointer to the PEI Services
379 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
380 Specification for details.
382 @param FileHandle PEIM's file handle. Must be the currently
385 @retval EFI_SUCCESS The PEIM was successfully registered for
388 @retval EFI_ALREADY_STARTED The PEIM was previously
389 registered for shadowing.
391 @retval EFI_NOT_FOUND The FileHandle does not refer to a
396 PeiServicesRegisterForShadow (
397 IN EFI_PEI_FILE_HANDLE FileHandle
401 Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.
403 This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using
404 the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.
405 If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().
406 If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().
409 @param FvFormat Unique identifier of the format of the memory-mapped firmware volume.
410 This parameter is optional and may be NULL.
411 If NULL is specified, the EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
412 @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
413 The format of this buffer is specific to the FvFormat. For memory-mapped firmware volumes,
414 this typically points to the first byte of the firmware volume.
415 @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped firmware volumes,
416 this is typically the size of the firmware volume.
417 @param ParentFvName If the new firmware volume originated from a file in a different firmware volume,
418 then this parameter specifies the GUID name of the originating firmware volume.
419 Otherwise, this parameter must be NULL.
420 @param ParentFileName If the new firmware volume originated from a file in a different firmware volume,
421 then this parameter specifies the GUID file name of the originating firmware file.
422 Otherwise, this parameter must be NULL.
426 PeiServicesInstallFvInfoPpi (
427 IN CONST EFI_GUID
*FvFormat
, OPTIONAL
428 IN CONST VOID
*FvInfo
,
429 IN UINT32 FvInfoSize
,
430 IN CONST EFI_GUID
*ParentFvName
, OPTIONAL
431 IN CONST EFI_GUID
*ParentFileName OPTIONAL