]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/DxeServicesLib.h
Correct function comments on DxeServicesLib GetFileBufferByFilePath API.
[mirror_edk2.git] / MdePkg / Include / Library / DxeServicesLib.h
CommitLineData
1c280088 1/** @file\r
b75a165d 2 MDE DXE Services Library provides functions that simplify the development of DXE Drivers. \r
84716614 3 These functions help access data from sections of FFS files or from file path.\r
1c280088 4\r
3556c7a2 5Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
1c280088 10\r
af2dc6a7 11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
1c280088 13\r
14**/\r
15\r
68167fed 16#ifndef __DXE_SERVICES_LIB_H__\r
17#define __DXE_SERVICES_LIB_H__\r
b0d803fe 18\r
682cee4c
LG
19/**\r
20 Searches all the available firmware volumes and returns the first matching FFS section. \r
21\r
22 This function searches all the firmware volumes for FFS files with FV file type specified by FileType\r
23 The order that the firmware volumes is searched is not deterministic. For each available FV a search \r
24 is made for FFS file of type FileType. If the FV contains more than one FFS file with the same FileType, \r
25 the FileInstance instance will be the matched FFS file. For each FFS file found a search \r
26 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances \r
27 of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. \r
28 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r
29 It is the caller's responsibility to use FreePool() to free the allocated buffer. \r
30 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections \r
31 are retrieved from an FFS file based on SectionType and SectionInstance.\r
32\r
33 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
34 the search will be retried with a section type of EFI_SECTION_PE32.\r
35 This function must be called with a TPL <= TPL_NOTIFY.\r
36\r
37 If Buffer is NULL, then ASSERT().\r
38 If Size is NULL, then ASSERT().\r
39\r
40 @param FileType Indicates the FV file type to search for within all available FVs.\r
41 @param FileInstance Indicates which file instance within all available FVs specified by FileType.\r
42 FileInstance starts from zero.\r
43 @param SectionType Indicates the FFS section type to search for within the FFS file \r
44 specified by FileType with FileInstance.\r
45 @param SectionInstance Indicates which section instance within the FFS file \r
46 specified by FileType with FileInstance to retrieve. SectionInstance starts from zero.\r
47 @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found.\r
48 Is it the caller's responsibility to free this buffer using FreePool().\r
49 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
50\r
51 @retval EFI_SUCCESS The specified FFS section was returned.\r
52 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
53 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve the matching FFS section.\r
54 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r
55 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r
56 contains the matching FFS section does not allow reads.\r
57**/\r
58EFI_STATUS\r
59EFIAPI\r
60GetSectionFromAnyFvByFileType (\r
61 IN EFI_FV_FILETYPE FileType,\r
62 IN UINTN FileInstance,\r
63 IN EFI_SECTION_TYPE SectionType,\r
64 IN UINTN SectionInstance,\r
65 OUT VOID **Buffer,\r
66 OUT UINTN *Size\r
67 );\r
68\r
b0d803fe 69/**\r
1a2f870c 70 Searches all the available firmware volumes and returns the first matching FFS section. \r
b75a165d
LG
71\r
72 This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid. \r
1a2f870c 73 The order in which the firmware volumes are searched is not deterministic. For each FFS file found, a search \r
b75a165d
LG
74 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances \r
75 of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. \r
76 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r
77 It is the caller's responsibility to use FreePool() to free the allocated buffer. \r
78 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections \r
79 are retrieved from an FFS file based on SectionType and SectionInstance.\r
80\r
81 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
82 the search will be retried with a section type of EFI_SECTION_PE32.\r
83 This function must be called with a TPL <= TPL_NOTIFY.\r
84\r
85 If NameGuid is NULL, then ASSERT().\r
86 If Buffer is NULL, then ASSERT().\r
ff197efb 87 If Size is NULL, then ASSERT().\r
88\r
ff197efb 89\r
af2dc6a7 90 @param NameGuid A pointer to to the FFS filename GUID to search for \r
91 within any of the firmware volumes in the platform. \r
92 @param SectionType Indicates the FFS section type to search for within \r
93 the FFS file specified by NameGuid.\r
94 @param SectionInstance Indicates which section instance within the FFS file \r
95 specified by NameGuid to retrieve.\r
96 @param Buffer On output, a pointer to a callee-allocated buffer \r
97 containing the FFS file section that was found. \r
98 It is the caller's responsibility to free this \r
99 buffer using FreePool().\r
b75a165d
LG
100 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
101\r
102 @retval EFI_SUCCESS The specified FFS section was returned.\r
103 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 104 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
105 the matching FFS section.\r
106 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
107 device error.\r
108 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
109 firmware volume that contains the matching FFS \r
110 section does not allow reads.\r
f80b0830 111**/\r
b0d803fe 112EFI_STATUS\r
113EFIAPI\r
fdbee2e4 114GetSectionFromAnyFv (\r
b0d803fe 115 IN CONST EFI_GUID *NameGuid,\r
116 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 117 IN UINTN SectionInstance,\r
b0d803fe 118 OUT VOID **Buffer,\r
119 OUT UINTN *Size\r
ed66e1bc 120 );\r
b0d803fe 121\r
122/**\r
b75a165d
LG
123 Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section. \r
124\r
125 This function searches the firmware volume that the currently executing module was loaded \r
1a2f870c 126 from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found, a search \r
b75a165d
LG
127 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance \r
128 instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.\r
129 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r
130 It is the caller's responsibility to use FreePool() to free the allocated buffer. \r
131 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from \r
132 an FFS file based on SectionType and SectionInstance.\r
133\r
134 If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned.\r
135 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
136 the search will be retried with a section type of EFI_SECTION_PE32.\r
137 \r
138 This function must be called with a TPL <= TPL_NOTIFY.\r
139 If NameGuid is NULL, then ASSERT().\r
140 If Buffer is NULL, then ASSERT().\r
ff197efb 141 If Size is NULL, then ASSERT().\r
142\r
af2dc6a7 143 @param NameGuid A pointer to to the FFS filename GUID to search for \r
144 within the firmware volumes that the currently \r
145 executing module was loaded from.\r
146 @param SectionType Indicates the FFS section type to search for within \r
147 the FFS file specified by NameGuid.\r
148 @param SectionInstance Indicates which section instance within the FFS \r
149 file specified by NameGuid to retrieve.\r
150 @param Buffer On output, a pointer to a callee allocated buffer \r
151 containing the FFS file section that was found. \r
152 It is the caller's responsibility to free this buffer \r
153 using FreePool().\r
b75a165d
LG
154 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
155\r
156\r
157 @retval EFI_SUCCESS The specified FFS section was returned.\r
158 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 159 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
160 the matching FFS section.\r
161 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
162 device error.\r
163 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
164 firmware volume that contains the matching FFS \r
165 section does not allow reads. \r
f80b0830 166**/\r
b0d803fe 167EFI_STATUS\r
168EFIAPI\r
fdbee2e4 169GetSectionFromFv (\r
b0d803fe 170 IN CONST EFI_GUID *NameGuid,\r
171 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 172 IN UINTN SectionInstance,\r
b0d803fe 173 OUT VOID **Buffer,\r
174 OUT UINTN *Size\r
ed66e1bc 175 );\r
b0d803fe 176\r
177\r
178/**\r
b75a165d
LG
179 Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.\r
180\r
181 This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.\r
182 If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType, \r
183 then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(), \r
184 and the size of the allocated buffer is returned in Size. It is the caller's responsibility \r
185 to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for \r
186 details on how sections are retrieved from an FFS file based on SectionType and SectionInstance.\r
187\r
188 If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned.\r
189 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
190 the search will be retried with a section type of EFI_SECTION_PE32.\r
191 This function must be called with a TPL <= TPL_NOTIFY.\r
192 \r
193 If Buffer is NULL, then ASSERT().\r
ff197efb 194 If Size is NULL, then ASSERT().\r
195\r
b75a165d 196\r
af2dc6a7 197 @param SectionType Indicates the FFS section type to search for within \r
198 the FFS file that the currently executing module \r
199 was loaded from.\r
200 @param SectionInstance Indicates which section instance to retrieve within \r
201 the FFS file that the currently executing module \r
202 was loaded from.\r
203 @param Buffer On output, a pointer to a callee allocated buffer \r
204 containing the FFS file section that was found. \r
205 It is the caller's responsibility to free this buffer \r
206 using FreePool().\r
b75a165d
LG
207 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
208\r
209 @retval EFI_SUCCESS The specified FFS section was returned.\r
210 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 211 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
212 the matching FFS section.\r
213 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
214 device error.\r
215 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
216 firmware volume that contains the matching FFS \r
217 section does not allow reads. \r
b0d803fe 218 \r
f80b0830 219**/\r
b0d803fe 220EFI_STATUS\r
221EFIAPI\r
fdbee2e4 222GetSectionFromFfs (\r
b0d803fe 223 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 224 IN UINTN SectionInstance,\r
b0d803fe 225 OUT VOID **Buffer,\r
226 OUT UINTN *Size\r
ed66e1bc 227 );\r
1c280088 228\r
84716614
LG
229\r
230/**\r
231 Get the image file buffer data and buffer size by its device path. \r
232 \r
233 Access the file either from a firmware volume, from a file system interface, \r
234 or from the load file interface.\r
235 \r
236 Allocate memory to store the found image. The caller is responsible to free memory.\r
237\r
3556c7a2 238 If FilePath is NULL, then NULL is returned.\r
84716614
LG
239 If FileSize is NULL, then NULL is returned.\r
240 If AuthenticationStatus is NULL, then NULL is returned.\r
241\r
af2dc6a7 242 @param[in] BootPolicy The policy for Open Image File.If TRUE, \r
243 indicates that the request originates from \r
244 the boot manager, and that the boot manager is\r
245 attempting to load FilePath as a boot selection. \r
246 If FALSE, then FilePath must match an exact \r
247 file to be loaded.\r
248 @param[in] FilePath Pointer to the device path of the file that is abstracted to\r
ea6898b9 249 the file buffer.\r
250 @param[out] FileSize Pointer to the size of the abstracted file buffer.\r
3556c7a2 251 @param[out] AuthenticationStatus Pointer to the authentication status.\r
84716614 252\r
3556c7a2 253 @retval NULL FilePath is NULL, or FileSize is NULL, or AuthenticationStatus is NULL, or the file can't be found.\r
84716614
LG
254 @retval other The abstracted file buffer. The caller is responsible to free memory.\r
255**/\r
256VOID *\r
257EFIAPI\r
258GetFileBufferByFilePath (\r
259 IN BOOLEAN BootPolicy,\r
260 IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
261 OUT UINTN *FileSize,\r
262 OUT UINT32 *AuthenticationStatus\r
263 );\r
264\r
1c280088 265#endif\r
266\r