]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/DxePiLib.h
Update prototype of DxeLoadCore().
[mirror_edk2.git] / MdePkg / Include / Library / DxePiLib.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 /**
22 Locates a requested firmware section within a file and returns it to a buffer allocated by this function.
23
24 PiLibGetSectionFromAnyFv () is used to read a specific section from a file within a firmware volume. The function
25 will search the first file with the specified name in all firmware volumes in the system. The search order for firmware
26 volumes in the system is determistic but abitrary if no new firmware volume is added into the system between
27 each calls of this function.
28
29 After the specific file is located, the function searches the specifc firmware section with type SectionType in this file.
30 The details of this search order is defined in description of EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection ()
31 found in PI Specification.
32
33 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section
34 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND
35 is returned.
36
37 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
38 by this function. This function can only be called at TPL_NOTIFY and below.
39
40 If NameGuid is NULL, then ASSERT();
41 If Buffer is NULL, then ASSERT();
42 If Size is NULL, then ASSERT().
43
44 @param NameGuid Pointer to an EFI_GUID, which indicates the file name from which the requested
45 section will be read. Type EFI_GUID is defined in
46 InstallProtocolInterface() in the UEFI 2.0 specification.
47 @param SectionType Indicates the section type to return. SectionType in conjunction with
48 SectionInstance indicates which section to return. Type
49 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.
50 @param SectionInstance Indicates which instance of sections with a type of SectionType to return.
51 SectionType in conjunction with SectionInstance indicates which section to
52 return. SectionInstance is zero based.
53 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not
54 including the section header. Caller is responsible to free this memory.
55 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by
56 *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 EFI_STATUS
66 EFIAPI
67 PiLibGetSectionFromAnyFv (
68 IN CONST EFI_GUID *NameGuid,
69 IN EFI_SECTION_TYPE SectionType,
70 IN UINTN SectionInstance,
71 OUT VOID **Buffer,
72 OUT UINTN *Size
73 )
74 ;
75
76 /**
77 Locates a requested firmware section within a file and returns it to a buffer allocated by this function.
78
79 PiLibGetSectionFromCurrentFv () is used to read a specific section from a file within the same firmware volume from which
80 the running image is loaded. If the specific file is found, the function searches the specifc firmware section with type SectionType.
81 The details of this search order is defined in description of EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection ()
82 found in PI Specification.
83
84 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section
85 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND
86 is returned.
87
88 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
89 by this function. This function can be only called at TPL_NOTIFY and below.
90
91 If NameGuid is NULL, then ASSERT();
92 If Buffer is NULL, then ASSERT();
93 If Size is NULL, then ASSERT().
94
95 @param NameGuid Pointer to an EFI_GUID, which indicates the file name from which the requested
96 section will be read. Type EFI_GUID is defined in
97 InstallProtocolInterface() in the UEFI 2.0 specification.
98 @param SectionType Indicates the section type to return. SectionType in conjunction with
99 SectionInstance indicates which section to return. Type
100 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.
101 @param SectionInstance Indicates which instance of sections with a type of SectionType to return.
102 SectionType in conjunction with SectionInstance indicates which section to
103 return. SectionInstance is zero based.
104 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not
105 including the section header. Caller is responsible to free this memory.
106 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by
107 *Buffer.
108
109
110 @retval EFI_SUCCESS The image is found and data and size is returned.
111 @retval EFI_UNSUPPORTED FvHandle does not support EFI_FIRMWARE_VOLUME2_PROTOCOL.
112 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
113 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
114 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
115 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
116
117 **/
118 EFI_STATUS
119 EFIAPI
120 PiLibGetSectionFromCurrentFv (
121 IN CONST EFI_GUID *NameGuid,
122 IN EFI_SECTION_TYPE SectionType,
123 IN UINTN SectionInstance,
124 OUT VOID **Buffer,
125 OUT UINTN *Size
126 )
127 ;
128
129
130 /**
131 Locates a requested firmware section within a file and returns it to a buffer allocated by this function.
132
133 PiLibGetSectionFromCurrentFfs () searches the specifc firmware section with type SectionType in the same firmware file from
134 which the running image is loaded. The details of this search order is defined in description of
135 EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection () found in PI Specification.
136
137 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section
138 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND
139 is returned.
140
141
142 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
143 by this function. This function can only be called at TPL_NOTIFY and below.
144
145 If Buffer is NULL, then ASSERT();
146 If Size is NULL, then ASSERT().
147
148 @param SectionType Indicates the section type to return. SectionType in conjunction with
149 SectionInstance indicates which section to return. Type
150 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.
151 @param SectionInstance Indicates which instance of sections with a type of SectionType to return.
152 SectionType in conjunction with SectionInstance indicates which section to
153 return. SectionInstance is zero based.
154 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not
155 including the section header. Caller is responsible to free this memory.
156 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by
157 *Buffer.
158
159 @retval EFI_SUCCESS The image is found and data and size is returned.
160 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
161 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
162 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
163 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
164
165 **/
166 EFI_STATUS
167 EFIAPI
168 PiLibGetSectionFromCurrentFfs (
169 IN EFI_SECTION_TYPE SectionType,
170 IN UINTN SectionInstance,
171 OUT VOID **Buffer,
172 OUT UINTN *Size
173 )
174 ;
175
176 #endif
177