]>
Commit | Line | Data |
---|---|---|
1c280088 | 1 | /** @file\r |
b75a165d LG |
2 | MDE DXE Services Library provides functions that simplify the development of DXE Drivers. \r |
3 | These functions help access data from sections of FFS files.\r | |
1c280088 | 4 | \r |
3e5c3238 | 5 | Copyright (c) 2008, Intel Corporation<BR> \r |
1c280088 | 6 | All rights reserved. This program and the accompanying materials \r |
7 | are licensed and made available under the terms and conditions of the BSD License \r | |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php \r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
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 |
b75a165d LG |
40 | @param NameGuid A pointer to to the FFS filename GUID to search for within \r |
41 | any of the firmware volumes in the platform. \r | |
42 | @param SectionType Indicates the FFS section type to search for within the FFS file specified by NameGuid.\r | |
43 | @param SectionInstance Indicates which section instance within the FFS file specified by NameGuid to retrieve.\r | |
44 | @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found. \r | |
1a2f870c | 45 | It is the caller's responsibility to free this buffer using FreePool().\r |
b75a165d LG |
46 | @param Size On output, a pointer to the size, in bytes, of Buffer.\r |
47 | \r | |
48 | @retval EFI_SUCCESS The specified FFS section was returned.\r | |
49 | @retval EFI_NOT_FOUND The specified FFS section could not be found.\r | |
3e5c3238 | 50 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve the matching FFS section.\r |
b75a165d LG |
51 | @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r |
52 | @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r | |
53 | contains the matching FFS section does not allow reads.\r | |
f80b0830 | 54 | **/\r |
b0d803fe | 55 | EFI_STATUS\r |
56 | EFIAPI\r | |
fdbee2e4 | 57 | GetSectionFromAnyFv (\r |
b0d803fe | 58 | IN CONST EFI_GUID *NameGuid,\r |
59 | IN EFI_SECTION_TYPE SectionType,\r | |
ff197efb | 60 | IN UINTN SectionInstance,\r |
b0d803fe | 61 | OUT VOID **Buffer,\r |
62 | OUT UINTN *Size\r | |
ed66e1bc | 63 | );\r |
b0d803fe | 64 | \r |
65 | /**\r | |
b75a165d LG |
66 | Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section. \r |
67 | \r | |
68 | This function searches the firmware volume that the currently executing module was loaded \r | |
1a2f870c | 69 | from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found, a search \r |
b75a165d LG |
70 | is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance \r |
71 | instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.\r | |
72 | Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r | |
73 | It is the caller's responsibility to use FreePool() to free the allocated buffer. \r | |
74 | See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from \r | |
75 | an FFS file based on SectionType and SectionInstance.\r | |
76 | \r | |
77 | If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned.\r | |
78 | If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r | |
79 | the search will be retried with a section type of EFI_SECTION_PE32.\r | |
80 | \r | |
81 | This function must be called with a TPL <= TPL_NOTIFY.\r | |
82 | If NameGuid is NULL, then ASSERT().\r | |
83 | If Buffer is NULL, then ASSERT().\r | |
ff197efb | 84 | If Size is NULL, then ASSERT().\r |
85 | \r | |
b75a165d LG |
86 | @param NameGuid A pointer to to the FFS filename GUID to search for within \r |
87 | the firmware volumes that the currently executing module was loaded from.\r | |
88 | @param SectionType Indicates the FFS section type to search for within the FFS file specified by NameGuid.\r | |
89 | @param SectionInstance Indicates which section instance within the FFS file specified by NameGuid to retrieve.\r | |
90 | @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found. \r | |
1a2f870c | 91 | It is the caller's responsibility to free this buffer using FreePool().\r |
b75a165d LG |
92 | @param Size On output, a pointer to the size, in bytes, of Buffer.\r |
93 | \r | |
94 | \r | |
95 | @retval EFI_SUCCESS The specified FFS section was returned.\r | |
96 | @retval EFI_NOT_FOUND The specified FFS section could not be found.\r | |
3e5c3238 | 97 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve the matching FFS section.\r |
b75a165d LG |
98 | @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r |
99 | @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r | |
100 | contains the matching FFS section does not allow reads. \r | |
f80b0830 | 101 | **/\r |
b0d803fe | 102 | EFI_STATUS\r |
103 | EFIAPI\r | |
fdbee2e4 | 104 | GetSectionFromFv (\r |
b0d803fe | 105 | IN CONST EFI_GUID *NameGuid,\r |
106 | IN EFI_SECTION_TYPE SectionType,\r | |
ff197efb | 107 | IN UINTN SectionInstance,\r |
b0d803fe | 108 | OUT VOID **Buffer,\r |
109 | OUT UINTN *Size\r | |
ed66e1bc | 110 | );\r |
b0d803fe | 111 | \r |
112 | \r | |
113 | /**\r | |
b75a165d LG |
114 | Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.\r |
115 | \r | |
116 | This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.\r | |
117 | If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType, \r | |
118 | then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(), \r | |
119 | and the size of the allocated buffer is returned in Size. It is the caller's responsibility \r | |
120 | to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for \r | |
121 | details on how sections are retrieved from an FFS file based on SectionType and SectionInstance.\r | |
122 | \r | |
123 | If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned.\r | |
124 | If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r | |
125 | the search will be retried with a section type of EFI_SECTION_PE32.\r | |
126 | This function must be called with a TPL <= TPL_NOTIFY.\r | |
127 | \r | |
128 | If Buffer is NULL, then ASSERT().\r | |
ff197efb | 129 | If Size is NULL, then ASSERT().\r |
130 | \r | |
b75a165d LG |
131 | \r |
132 | @param SectionType Indicates the FFS section type to search for within the FFS file \r | |
133 | that the currently executing module was loaded from.\r | |
134 | @param SectionInstance Indicates which section instance to retrieve within the FFS file \r | |
135 | that the currently executing module was loaded from.\r | |
136 | @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found. \r | |
1a2f870c | 137 | It is the caller's responsibility to free this buffer using FreePool().\r |
b75a165d LG |
138 | @param Size On output, a pointer to the size, in bytes, of Buffer.\r |
139 | \r | |
140 | @retval EFI_SUCCESS The specified FFS section was returned.\r | |
141 | @retval EFI_NOT_FOUND The specified FFS section could not be found.\r | |
3e5c3238 | 142 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to retrieve the matching FFS section.\r |
b75a165d LG |
143 | @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r |
144 | @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r | |
145 | contains the matching FFS section does not allow reads. \r | |
b0d803fe | 146 | \r |
f80b0830 | 147 | **/\r |
b0d803fe | 148 | EFI_STATUS\r |
149 | EFIAPI\r | |
fdbee2e4 | 150 | GetSectionFromFfs (\r |
b0d803fe | 151 | IN EFI_SECTION_TYPE SectionType,\r |
ff197efb | 152 | IN UINTN SectionInstance,\r |
b0d803fe | 153 | OUT VOID **Buffer,\r |
154 | OUT UINTN *Size\r | |
ed66e1bc | 155 | );\r |
1c280088 | 156 | \r |
157 | #endif\r | |
158 | \r |