2 MDE DXE Services Library provides functions that simplify the development of DXE Drivers.
3 These functions help access data from sections of FFS files or from file path.
5 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __DXE_SERVICES_LIB_H__
17 #define __DXE_SERVICES_LIB_H__
20 Searches all the available firmware volumes and returns the first matching FFS section.
22 This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid.
23 The order in which the firmware volumes are searched is not deterministic. For each FFS file found, a search
24 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances
25 of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.
26 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size.
27 It is the caller's responsibility to use FreePool() to free the allocated buffer.
28 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections
29 are retrieved from an FFS file based on SectionType and SectionInstance.
31 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails,
32 the search will be retried with a section type of EFI_SECTION_PE32.
33 This function must be called with a TPL <= TPL_NOTIFY.
35 If NameGuid is NULL, then ASSERT().
36 If Buffer is NULL, then ASSERT().
37 If Size is NULL, then ASSERT().
40 @param NameGuid A pointer to to the FFS filename GUID to search for
41 within any of the firmware volumes in the platform.
42 @param SectionType Indicates the FFS section type to search for within
43 the FFS file specified by NameGuid.
44 @param SectionInstance Indicates which section instance within the FFS file
45 specified by NameGuid to retrieve.
46 @param Buffer On output, a pointer to a callee-allocated buffer
47 containing the FFS file section that was found.
48 It is the caller's responsibility to free this
49 buffer using FreePool().
50 @param Size On output, a pointer to the size, in bytes, of Buffer.
52 @retval EFI_SUCCESS The specified FFS section was returned.
53 @retval EFI_NOT_FOUND The specified FFS section could not be found.
54 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve
55 the matching FFS section.
56 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a
58 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the
59 firmware volume that contains the matching FFS
60 section does not allow reads.
65 IN CONST EFI_GUID
*NameGuid
,
66 IN EFI_SECTION_TYPE SectionType
,
67 IN UINTN SectionInstance
,
73 Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section.
75 This function searches the firmware volume that the currently executing module was loaded
76 from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found, a search
77 is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance
78 instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.
79 Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size.
80 It is the caller's responsibility to use FreePool() to free the allocated buffer.
81 See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from
82 an FFS file based on SectionType and SectionInstance.
84 If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned.
85 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails,
86 the search will be retried with a section type of EFI_SECTION_PE32.
88 This function must be called with a TPL <= TPL_NOTIFY.
89 If NameGuid is NULL, then ASSERT().
90 If Buffer is NULL, then ASSERT().
91 If Size is NULL, then ASSERT().
93 @param NameGuid A pointer to to the FFS filename GUID to search for
94 within the firmware volumes that the currently
95 executing module was loaded from.
96 @param SectionType Indicates the FFS section type to search for within
97 the FFS file specified by NameGuid.
98 @param SectionInstance Indicates which section instance within the FFS
99 file specified by NameGuid to retrieve.
100 @param Buffer On output, a pointer to a callee allocated buffer
101 containing the FFS file section that was found.
102 It is the caller's responsibility to free this buffer
104 @param Size On output, a pointer to the size, in bytes, of Buffer.
107 @retval EFI_SUCCESS The specified FFS section was returned.
108 @retval EFI_NOT_FOUND The specified FFS section could not be found.
109 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve
110 the matching FFS section.
111 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a
113 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the
114 firmware volume that contains the matching FFS
115 section does not allow reads.
120 IN CONST EFI_GUID
*NameGuid
,
121 IN EFI_SECTION_TYPE SectionType
,
122 IN UINTN SectionInstance
,
129 Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.
131 This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.
132 If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType,
133 then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(),
134 and the size of the allocated buffer is returned in Size. It is the caller's responsibility
135 to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for
136 details on how sections are retrieved from an FFS file based on SectionType and SectionInstance.
138 If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned.
139 If SectionType is EFI_SECTION_TE, and the search with an FFS file fails,
140 the search will be retried with a section type of EFI_SECTION_PE32.
141 This function must be called with a TPL <= TPL_NOTIFY.
143 If Buffer is NULL, then ASSERT().
144 If Size is NULL, then ASSERT().
147 @param SectionType Indicates the FFS section type to search for within
148 the FFS file that the currently executing module
150 @param SectionInstance Indicates which section instance to retrieve within
151 the FFS file that the currently executing module
153 @param Buffer On output, a pointer to a callee allocated buffer
154 containing the FFS file section that was found.
155 It is the caller's responsibility to free this buffer
157 @param Size On output, a pointer to the size, in bytes, of Buffer.
159 @retval EFI_SUCCESS The specified FFS section was returned.
160 @retval EFI_NOT_FOUND The specified FFS section could not be found.
161 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve
162 the matching FFS section.
163 @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a
165 @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the
166 firmware volume that contains the matching FFS
167 section does not allow reads.
173 IN EFI_SECTION_TYPE SectionType
,
174 IN UINTN SectionInstance
,
181 Get the image file buffer data and buffer size by its device path.
183 Access the file either from a firmware volume, from a file system interface,
184 or from the load file interface.
186 Allocate memory to store the found image. The caller is responsible to free memory.
188 If File is NULL, then NULL is returned.
189 If FileSize is NULL, then NULL is returned.
190 If AuthenticationStatus is NULL, then NULL is returned.
192 @param[in] BootPolicy The policy for Open Image File.If TRUE,
193 indicates that the request originates from
194 the boot manager, and that the boot manager is
195 attempting to load FilePath as a boot selection.
196 If FALSE, then FilePath must match an exact
198 @param[in] FilePath Pointer to the device path of the file that is abstracted to
200 @param[out] FileSize Pointer to the size of the abstracted file buffer.
201 @param[out] AuthenticationStatus Pointer to a caller-allocated UINT32 in which the authentication
204 @retval NULL File is NULL, or FileSize is NULL, or the file can't be found.
205 @retval other The abstracted file buffer. The caller is responsible to free memory.
209 GetFileBufferByFilePath (
210 IN BOOLEAN BootPolicy
,
211 IN CONST EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
213 OUT UINT32
*AuthenticationStatus