]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/DxeServicesLib.h
Update the copyright notice format
[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
9df063a0 5Copyright (c) 2006 - 2010, 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
19/**\r
1a2f870c 20 Searches all the available firmware volumes and returns the first matching FFS section. \r
b75a165d
LG
21\r
22 This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid. \r
1a2f870c 23 The order in which the firmware volumes are searched is not deterministic. For each FFS file found, a search \r
b75a165d
LG
24 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances \r
25 of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. \r
26 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r
27 It is the caller's responsibility to use FreePool() to free the allocated buffer. \r
28 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections \r
29 are retrieved from an FFS file based on SectionType and SectionInstance.\r
30\r
31 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
32 the search will be retried with a section type of EFI_SECTION_PE32.\r
33 This function must be called with a TPL <= TPL_NOTIFY.\r
34\r
35 If NameGuid is NULL, then ASSERT().\r
36 If Buffer is NULL, then ASSERT().\r
ff197efb 37 If Size is NULL, then ASSERT().\r
38\r
ff197efb 39\r
af2dc6a7 40 @param NameGuid A pointer to to the FFS filename GUID to search for \r
41 within any of the firmware volumes in the platform. \r
42 @param SectionType Indicates the FFS section type to search for within \r
43 the FFS file specified by NameGuid.\r
44 @param SectionInstance Indicates which section instance within the FFS file \r
45 specified by NameGuid to retrieve.\r
46 @param Buffer On output, a pointer to a callee-allocated buffer \r
47 containing the FFS file section that was found. \r
48 It is the caller's responsibility to free this \r
49 buffer using FreePool().\r
b75a165d
LG
50 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
51\r
52 @retval EFI_SUCCESS The specified FFS section was returned.\r
53 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 54 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
55 the matching FFS section.\r
56 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
57 device error.\r
58 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
59 firmware volume that contains the matching FFS \r
60 section does not allow reads.\r
f80b0830 61**/\r
b0d803fe 62EFI_STATUS\r
63EFIAPI\r
fdbee2e4 64GetSectionFromAnyFv (\r
b0d803fe 65 IN CONST EFI_GUID *NameGuid,\r
66 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 67 IN UINTN SectionInstance,\r
b0d803fe 68 OUT VOID **Buffer,\r
69 OUT UINTN *Size\r
ed66e1bc 70 );\r
b0d803fe 71\r
72/**\r
b75a165d
LG
73 Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section. \r
74\r
75 This function searches the firmware volume that the currently executing module was loaded \r
1a2f870c 76 from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found, a search \r
b75a165d
LG
77 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance \r
78 instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.\r
79 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r
80 It is the caller's responsibility to use FreePool() to free the allocated buffer. \r
81 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from \r
82 an FFS file based on SectionType and SectionInstance.\r
83\r
84 If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned.\r
85 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
86 the search will be retried with a section type of EFI_SECTION_PE32.\r
87 \r
88 This function must be called with a TPL <= TPL_NOTIFY.\r
89 If NameGuid is NULL, then ASSERT().\r
90 If Buffer is NULL, then ASSERT().\r
ff197efb 91 If Size is NULL, then ASSERT().\r
92\r
af2dc6a7 93 @param NameGuid A pointer to to the FFS filename GUID to search for \r
94 within the firmware volumes that the currently \r
95 executing module was loaded from.\r
96 @param SectionType Indicates the FFS section type to search for within \r
97 the FFS file specified by NameGuid.\r
98 @param SectionInstance Indicates which section instance within the FFS \r
99 file specified by NameGuid to retrieve.\r
100 @param Buffer On output, a pointer to a callee allocated buffer \r
101 containing the FFS file section that was found. \r
102 It is the caller's responsibility to free this buffer \r
103 using FreePool().\r
b75a165d
LG
104 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
105\r
106\r
107 @retval EFI_SUCCESS The specified FFS section was returned.\r
108 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 109 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
110 the matching FFS section.\r
111 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
112 device error.\r
113 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
114 firmware volume that contains the matching FFS \r
115 section does not allow reads. \r
f80b0830 116**/\r
b0d803fe 117EFI_STATUS\r
118EFIAPI\r
fdbee2e4 119GetSectionFromFv (\r
b0d803fe 120 IN CONST EFI_GUID *NameGuid,\r
121 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 122 IN UINTN SectionInstance,\r
b0d803fe 123 OUT VOID **Buffer,\r
124 OUT UINTN *Size\r
ed66e1bc 125 );\r
b0d803fe 126\r
127\r
128/**\r
b75a165d
LG
129 Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.\r
130\r
131 This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.\r
132 If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType, \r
133 then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(), \r
134 and the size of the allocated buffer is returned in Size. It is the caller's responsibility \r
135 to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for \r
136 details on how sections are retrieved from an FFS file based on SectionType and SectionInstance.\r
137\r
138 If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned.\r
139 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r
140 the search will be retried with a section type of EFI_SECTION_PE32.\r
141 This function must be called with a TPL <= TPL_NOTIFY.\r
142 \r
143 If Buffer is NULL, then ASSERT().\r
ff197efb 144 If Size is NULL, then ASSERT().\r
145\r
b75a165d 146\r
af2dc6a7 147 @param SectionType Indicates the FFS section type to search for within \r
148 the FFS file that the currently executing module \r
149 was loaded from.\r
150 @param SectionInstance Indicates which section instance to retrieve within \r
151 the FFS file that the currently executing module \r
152 was loaded from.\r
153 @param Buffer On output, a pointer to a callee allocated buffer \r
154 containing the FFS file section that was found. \r
155 It is the caller's responsibility to free this buffer \r
156 using FreePool().\r
b75a165d
LG
157 @param Size On output, a pointer to the size, in bytes, of Buffer.\r
158\r
159 @retval EFI_SUCCESS The specified FFS section was returned.\r
160 @retval EFI_NOT_FOUND The specified FFS section could not be found.\r
af2dc6a7 161 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve \r
162 the matching FFS section.\r
163 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a \r
164 device error.\r
165 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the \r
166 firmware volume that contains the matching FFS \r
167 section does not allow reads. \r
b0d803fe 168 \r
f80b0830 169**/\r
b0d803fe 170EFI_STATUS\r
171EFIAPI\r
fdbee2e4 172GetSectionFromFfs (\r
b0d803fe 173 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 174 IN UINTN SectionInstance,\r
b0d803fe 175 OUT VOID **Buffer,\r
176 OUT UINTN *Size\r
ed66e1bc 177 );\r
1c280088 178\r
84716614
LG
179\r
180/**\r
181 Get the image file buffer data and buffer size by its device path. \r
182 \r
183 Access the file either from a firmware volume, from a file system interface, \r
184 or from the load file interface.\r
185 \r
186 Allocate memory to store the found image. The caller is responsible to free memory.\r
187\r
188 If File is NULL, then NULL is returned.\r
189 If FileSize is NULL, then NULL is returned.\r
190 If AuthenticationStatus is NULL, then NULL is returned.\r
191\r
af2dc6a7 192 @param[in] BootPolicy The policy for Open Image File.If TRUE, \r
193 indicates that the request originates from \r
194 the boot manager, and that the boot manager is\r
195 attempting to load FilePath as a boot selection. \r
196 If FALSE, then FilePath must match an exact \r
197 file to be loaded.\r
198 @param[in] FilePath Pointer to the device path of the file that is abstracted to\r
ea6898b9 199 the file buffer.\r
200 @param[out] FileSize Pointer to the size of the abstracted file buffer.\r
201 @param[out] AuthenticationStatus Pointer to a caller-allocated UINT32 in which the authentication\r
202 status is returned.\r
84716614 203\r
af2dc6a7 204 @retval NULL File is NULL, or FileSize is NULL, or the file can't be found.\r
84716614
LG
205 @retval other The abstracted file buffer. The caller is responsible to free memory.\r
206**/\r
207VOID *\r
208EFIAPI\r
209GetFileBufferByFilePath (\r
210 IN BOOLEAN BootPolicy,\r
211 IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
212 OUT UINTN *FileSize,\r
213 OUT UINT32 *AuthenticationStatus\r
214 );\r
215\r
1c280088 216#endif\r
217\r