]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PiLib.h
Upgrade the format of EFI_PEIM_ENTRY_POINT to EFI_PEIM_ENTRY_POINT2 according to...
[mirror_edk2.git] / MdePkg / Include / Library / PiLib.h
1 /** @file
2 MDE PI library functions and macros
3
4 Copyright (c) 2007, 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
9
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.
12
13 **/
14
15 #ifndef __PI_LIB_H__
16 #define __PI_LIB_H__
17
18 #include <Pi/PiFirmwareFile.h>
19
20 /**
21 Allocate and fill a buffer with an image identified by a Firmware File GUID name and a Firmware Section type.
22 The Firmware Volumes to search for the Firmware File can be specified to be either all Firmware Volumes
23 in the system, or the Firmware Volume which contains the Firmware File specified by an image handle.
24
25 If ImageHandle is NULL, all Firmware Volumes in the system will be searched. If ImageHandle is not NULL,
26 ImageHandle is interpreted as EFI_PEI_FILE_HANDLE for the implementation of this function for PEI phase.
27 The input parameter ImageHandle is interpreted as EFI_HANDLE, on which an EFI_LOADED_IMAGE_PROTOCOL
28 is installed, for the implementation of this function for DXE phase. The search always starts from the FV
29 identified by ImageHandle. If WithinImageFv is TRUE, search will only be performed on the first FV. If WithinImageFv
30 is FALSE, search will continue on other FVs if it fails on the first FV. The search order of Firmware Volumes is
31 deterministic but arbitrary if no new firmware volume is added into the system between each search.
32
33 The search order for the section type specified by SectionType in the Firmware File is using a depth-first
34 and left-to-right algorithm through all sections. The first section found to match SectionType will be returned.
35
36 If SectionType is EFI_SECTION_PE32, EFI_SECTION_PE32 will be used as Firmware Section type
37 to read Firmware Section data from the Firmware File. If no such section exists, the function will try
38 to read a Firmware File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.
39
40 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE will be used as Firmware Section type to read Firmware Section
41 data from the Firmware File. If no such section exists, EFI_SECTION_PE32 will be used as Firmware Section type to
42 read Firmware Section data from the Firmware File. If no such section exists, the function will try to read a Firmware
43 File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.
44
45 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
46 by this function. This function can only be called at TPL_NOTIFY and below.
47
48 If ImageHandle is NULL and WithinImage is TRUE, then ASSERT ();
49 If NameGuid is NULL, then ASSERT();
50 If Buffer is NULL, then ASSERT();
51 If Size is NULL, then ASSERT().
52
53 @param NameGuid The GUID name of a Firmware File.
54 @param SectionType The Firmware Section type.
55 @param Buffer On output, Buffer contains the the data read from the section in the Firmware File found.
56 @param Size On output, the size of Buffer.
57
58 @retval EFI_SUCCESS The image is found and data and size is returned.
59 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
60 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
61 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
62 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
63
64 **/
65
66 EFI_STATUS
67 EFIAPI
68 GetSectionFromFvFile (
69 IN CONST VOID* ImageHandle OPTIONAL,
70 IN CONST EFI_GUID *NameGuid,
71 IN EFI_SECTION_TYPE SectionType,
72 OUT VOID **Buffer,
73 OUT UINTN *Size,
74 IN BOOLEAN WithImageFv
75 )
76 ;
77
78
79 #endif
80