]>
Commit | Line | Data |
---|---|---|
1c280088 | 1 | /** @file\r |
2 | MDE PI library functions and macros\r | |
3 | \r | |
4 | Copyright (c) 2007, Intel Corporation \r | |
5 | All rights reserved. This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __PI_LIB_H__\r | |
16 | #define __PI_LIB_H__\r | |
17 | \r | |
18 | #include <Pi/PiFirmwareFile.h>\r | |
19 | \r | |
20 | /**\r | |
21 | Allocate and fill a buffer with an image identified by a Firmware File GUID name and a Firmware Section type. \r | |
22 | The Firmware Volumes to search for the Firmware File can be specified to be either all Firmware Volumes \r | |
23 | in the system, or the Firmware Volume which contains the Firmware File specified by an image handle.\r | |
24 | \r | |
25 | If ImageHandle is NULL, all Firmware Volumes in the system will be searched. If ImageHandle is not NULL, \r | |
26 | ImageHandle is interpreted as EFI_PEI_FILE_HANDLE for the implementation of this function for PEI phase. \r | |
27 | The input parameter ImageHandle is interpreted as EFI_HANDLE, on which an EFI_LOADED_IMAGE_PROTOCOL \r | |
28 | is installed, for the implementation of this function for DXE phase. The search always starts from the FV \r | |
29 | identified by ImageHandle. If WithinImageFv is TRUE, search will only be performed on the first FV. If WithinImageFv \r | |
30 | is FALSE, search will continue on other FVs if it fails on the first FV. The search order of Firmware Volumes is \r | |
31 | deterministic but arbitrary if no new firmware volume is added into the system between each search. \r | |
32 | \r | |
33 | The search order for the section type specified by SectionType in the Firmware File is using a depth-first \r | |
34 | and left-to-right algorithm through all sections. The first section found to match SectionType will be returned. \r | |
35 | \r | |
36 | If SectionType is EFI_SECTION_PE32, EFI_SECTION_PE32 will be used as Firmware Section type \r | |
37 | to read Firmware Section data from the Firmware File. If no such section exists, the function will try \r | |
38 | to read a Firmware File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.\r | |
39 | \r | |
40 | If SectionType is EFI_SECTION_TE, EFI_SECTION_TE will be used as Firmware Section type to read Firmware Section \r | |
41 | data from the Firmware File. If no such section exists, EFI_SECTION_PE32 will be used as Firmware Section type to \r | |
42 | read Firmware Section data from the Firmware File. If no such section exists, the function will try to read a Firmware \r | |
43 | File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.\r | |
44 | \r | |
45 | The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated \r | |
46 | by this function. This function can only be called at TPL_NOTIFY and below.\r | |
47 | \r | |
48 | If ImageHandle is NULL and WithinImage is TRUE, then ASSERT ();\r | |
49 | If NameGuid is NULL, then ASSERT();\r | |
50 | If Buffer is NULL, then ASSERT();\r | |
51 | If Size is NULL, then ASSERT().\r | |
52 | \r | |
53 | @param NameGuid The GUID name of a Firmware File.\r | |
54 | @param SectionType The Firmware Section type.\r | |
55 | @param Buffer On output, Buffer contains the the data read from the section in the Firmware File found.\r | |
56 | @param Size On output, the size of Buffer.\r | |
57 | \r | |
58 | @retval EFI_SUCCESS The image is found and data and size is returned.\r | |
59 | @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.\r | |
60 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.\r | |
61 | @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.\r | |
62 | @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.\r | |
63 | \r | |
64 | **/\r | |
65 | \r | |
66 | EFI_STATUS\r | |
67 | EFIAPI\r | |
68 | GetSectionFromFvFile (\r | |
69 | IN CONST VOID* ImageHandle OPTIONAL,\r | |
70 | IN CONST EFI_GUID *NameGuid,\r | |
71 | IN EFI_SECTION_TYPE SectionType,\r | |
72 | OUT VOID **Buffer,\r | |
73 | OUT UINTN *Size,\r | |
74 | IN BOOLEAN WithImageFv\r | |
75 | )\r | |
76 | ;\r | |
77 | \r | |
78 | \r | |
79 | #endif\r | |
80 | \r |