]>
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 |
b75a165d | 5 | Copyright (c) 2008, Intel Corporation \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 | |
16 | #ifndef __PI_LIB_H__\r | |
17 | #define __PI_LIB_H__\r | |
18 | \r | |
19 | #include <Pi/PiFirmwareFile.h>\r | |
20 | \r | |
b0d803fe | 21 | \r |
22 | /**\r | |
b75a165d LG |
23 | Searches all the availables firmware volumes and returns the first matching FFS section. \r |
24 | \r | |
25 | This function searches all the firmware volumes for FFS files with an FFS filename specified by NameGuid. \r | |
26 | The order that the firmware volumes is searched is not deterministic. For each FFS file found a search \r | |
27 | is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance instances \r | |
28 | of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer. \r | |
29 | Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r | |
30 | It is the caller's responsibility to use FreePool() to free the allocated buffer. \r | |
31 | See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections \r | |
32 | are retrieved from an FFS file based on SectionType and SectionInstance.\r | |
33 | \r | |
34 | If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r | |
35 | the search will be retried with a section type of EFI_SECTION_PE32.\r | |
36 | This function must be called with a TPL <= TPL_NOTIFY.\r | |
37 | \r | |
38 | If NameGuid is NULL, then ASSERT().\r | |
39 | If Buffer is NULL, then ASSERT().\r | |
ff197efb | 40 | If Size is NULL, then ASSERT().\r |
41 | \r | |
ff197efb | 42 | \r |
b75a165d LG |
43 | @param NameGuid A pointer to to the FFS filename GUID to search for within \r |
44 | any of the firmware volumes in the platform. \r | |
45 | @param SectionType Indicates the FFS section type to search for within the FFS file specified by NameGuid.\r | |
46 | @param SectionInstance Indicates which section instance within the FFS file specified by NameGuid to retrieve.\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 respobsibility 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 rsources 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 | |
f80b0830 | 57 | **/\r |
b0d803fe | 58 | EFI_STATUS\r |
59 | EFIAPI\r | |
fdbee2e4 | 60 | GetSectionFromAnyFv (\r |
b0d803fe | 61 | IN CONST EFI_GUID *NameGuid,\r |
62 | IN EFI_SECTION_TYPE SectionType,\r | |
ff197efb | 63 | IN UINTN SectionInstance,\r |
b0d803fe | 64 | OUT VOID **Buffer,\r |
65 | OUT UINTN *Size\r | |
ed66e1bc | 66 | );\r |
b0d803fe | 67 | \r |
68 | /**\r | |
b75a165d LG |
69 | Searches the firmware volume that the currently executing module was loaded from and returns the first matching FFS section. \r |
70 | \r | |
71 | This function searches the firmware volume that the currently executing module was loaded \r | |
72 | from for an FFS file with an FFS filename specified by NameGuid. If the FFS file is found a search \r | |
73 | is made for FFS sections of type SectionType. If the FFS file contains at least SectionInstance \r | |
74 | instances of the FFS section specified by SectionType, then the SectionInstance instance is returned in Buffer.\r | |
75 | Buffer is allocated using AllocatePool(), and the size of the allocated buffer is returned in Size. \r | |
76 | It is the caller's responsibility to use FreePool() to free the allocated buffer. \r | |
77 | See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for details on how sections are retrieved from \r | |
78 | an FFS file based on SectionType and SectionInstance.\r | |
79 | \r | |
80 | If the currently executing module was not loaded from a firmware volume, then EFI_NOT_FOUND is returned.\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 | \r | |
84 | This function must be called with a TPL <= TPL_NOTIFY.\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 | |
b75a165d LG |
89 | @param NameGuid A pointer to to the FFS filename GUID to search for within \r |
90 | the firmware volumes that the currently executing module was loaded from.\r | |
91 | @param SectionType Indicates the FFS section type to search for within the FFS file specified by NameGuid.\r | |
92 | @param SectionInstance Indicates which section instance within the FFS file specified by NameGuid to retrieve.\r | |
93 | @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found. \r | |
94 | Is it the caller's respobsibility to free this buffer using FreePool().\r | |
95 | @param Size On output, a pointer to the size, in bytes, of Buffer.\r | |
96 | \r | |
97 | \r | |
98 | @retval EFI_SUCCESS The specified FFS section was returned.\r | |
99 | @retval EFI_NOT_FOUND The specified FFS section could not be found.\r | |
100 | @retval EFI_OUT_OF_RESOURCES There are not enough rsources available to retrieve the matching FFS section.\r | |
101 | @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r | |
102 | @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r | |
103 | contains the matching FFS section does not allow reads. \r | |
f80b0830 | 104 | **/\r |
b0d803fe | 105 | EFI_STATUS\r |
106 | EFIAPI\r | |
fdbee2e4 | 107 | GetSectionFromFv (\r |
b0d803fe | 108 | IN CONST EFI_GUID *NameGuid,\r |
109 | IN EFI_SECTION_TYPE SectionType,\r | |
ff197efb | 110 | IN UINTN SectionInstance,\r |
b0d803fe | 111 | OUT VOID **Buffer,\r |
112 | OUT UINTN *Size\r | |
ed66e1bc | 113 | );\r |
b0d803fe | 114 | \r |
115 | \r | |
116 | /**\r | |
b75a165d LG |
117 | Searches the FFS file the the currently executing module was loaded from and returns the first matching FFS section.\r |
118 | \r | |
119 | This function searches the FFS file that the currently executing module was loaded from for a FFS sections of type SectionType.\r | |
120 | If the FFS file contains at least SectionInstance instances of the FFS section specified by SectionType, \r | |
121 | then the SectionInstance instance is returned in Buffer. Buffer is allocated using AllocatePool(), \r | |
122 | and the size of the allocated buffer is returned in Size. It is the caller's responsibility \r | |
123 | to use FreePool() to free the allocated buffer. See EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() for \r | |
124 | details on how sections are retrieved from an FFS file based on SectionType and SectionInstance.\r | |
125 | \r | |
126 | If the currently executing module was not loaded from an FFS file, then EFI_NOT_FOUND is returned.\r | |
127 | If SectionType is EFI_SECTION_TE, and the search with an FFS file fails, \r | |
128 | the search will be retried with a section type of EFI_SECTION_PE32.\r | |
129 | This function must be called with a TPL <= TPL_NOTIFY.\r | |
130 | \r | |
131 | If Buffer is NULL, then ASSERT().\r | |
ff197efb | 132 | If Size is NULL, then ASSERT().\r |
133 | \r | |
b75a165d LG |
134 | \r |
135 | @param SectionType Indicates the FFS section type to search for within the FFS file \r | |
136 | that the currently executing module was loaded from.\r | |
137 | @param SectionInstance Indicates which section instance to retrieve within the FFS file \r | |
138 | that the currently executing module was loaded from.\r | |
139 | @param Buffer On output, a pointer to a callee allocated buffer containing the FFS file section that was found. \r | |
140 | Is it the caller's respobsibility to free this buffer using FreePool().\r | |
141 | @param Size On output, a pointer to the size, in bytes, of Buffer.\r | |
142 | \r | |
143 | @retval EFI_SUCCESS The specified FFS section was returned.\r | |
144 | @retval EFI_NOT_FOUND The specified FFS section could not be found.\r | |
145 | @retval EFI_OUT_OF_RESOURCES There are not enough rsources available to retrieve the matching FFS section.\r | |
146 | @retval EFI_DEVICE_ERROR The FFS section could not be retrieves due to a device error.\r | |
147 | @retval EFI_ACCESS_DENIED The FFS section could not be retrieves because the firmware volume that \r | |
148 | contains the matching FFS section does not allow reads. \r | |
b0d803fe | 149 | \r |
f80b0830 | 150 | **/\r |
b0d803fe | 151 | EFI_STATUS\r |
152 | EFIAPI\r | |
fdbee2e4 | 153 | GetSectionFromFfs (\r |
b0d803fe | 154 | IN EFI_SECTION_TYPE SectionType,\r |
ff197efb | 155 | IN UINTN SectionInstance,\r |
b0d803fe | 156 | OUT VOID **Buffer,\r |
157 | OUT UINTN *Size\r | |
ed66e1bc | 158 | );\r |
1c280088 | 159 | \r |
160 | #endif\r | |
161 | \r |