]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
38db7507 | 2 | This file declares the Firmware Volume Protocol.\r |
8411f1c0 | 3 | \r |
38db7507 | 4 | The Firmware Volume Protocol provides file-level access to the firmware volume.\r |
5 | Each firmware volume driver must produce an instance of the Firmware Volume\r | |
6 | Protocol if the firmware volume is to be visible to the system. The Firmware\r | |
7 | Volume Protocol also provides mechanisms for determining and modifying some\r | |
8 | attributes of the firmware volume.\r | |
9 | \r | |
79964ac8 | 10 | Copyright (c) 2007, Intel Corporation\r |
11 | All rights reserved. This program and the accompanying materials\r | |
12 | are licensed and made available under the terms and conditions of the BSD License\r | |
13 | which accompanies this distribution. The full text of the license may be found at\r | |
14 | http://opensource.org/licenses/bsd-license.php\r | |
15 | \r | |
16 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
17 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
18 | \r | |
79964ac8 | 19 | @par Revision Reference:\r |
20 | This protocol is defined in Firmware Volume specification.\r | |
21 | Version 0.9\r | |
22 | \r | |
23 | **/\r | |
24 | \r | |
25 | #ifndef _FIRMWARE_VOLUME_H_\r | |
26 | #define _FIRMWARE_VOLUME_H_\r | |
27 | \r | |
b80fbe85 | 28 | #include <PiDxe.h>\r |
79964ac8 | 29 | \r |
30 | //\r | |
31 | // Firmware Volume Protocol GUID definition\r | |
32 | //\r | |
33 | #define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \\r | |
34 | { \\r | |
35 | 0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \\r | |
36 | }\r | |
37 | \r | |
e89ec8f6 | 38 | #define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')\r |
79964ac8 | 39 | \r |
40 | typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;\r | |
41 | \r | |
42 | //\r | |
3d02e416 | 43 | // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions\r |
79964ac8 | 44 | //\r |
3d02e416 | 45 | typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;\r |
79964ac8 | 46 | \r |
47 | //\r | |
48 | // ************************************************************\r | |
3d02e416 | 49 | // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions\r |
79964ac8 | 50 | // ************************************************************\r |
51 | //\r | |
52 | #define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL\r | |
53 | #define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL\r | |
54 | #define EFI_FV_READ_STATUS 0x0000000000000004ULL\r | |
55 | \r | |
56 | #define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL\r | |
57 | #define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL\r | |
58 | #define EFI_FV_WRITE_STATUS 0x0000000000000020ULL\r | |
59 | \r | |
60 | #define EFI_FV_LOCK_CAP 0x0000000000000040ULL\r | |
61 | #define EFI_FV_LOCK_STATUS 0x0000000000000080ULL\r | |
62 | #define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL\r | |
63 | \r | |
64 | #define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL\r | |
65 | #define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL\r | |
66 | #define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL\r | |
67 | #define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL\r | |
68 | #define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL\r | |
69 | #define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL\r | |
70 | #define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL\r | |
71 | #define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL\r | |
72 | #define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL\r | |
73 | #define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL\r | |
74 | #define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL\r | |
75 | #define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL\r | |
76 | #define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL\r | |
77 | #define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL\r | |
78 | #define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL\r | |
79 | #define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL\r | |
80 | #define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL\r | |
81 | \r | |
82 | //\r | |
83 | // Protocol API definitions\r | |
84 | //\r | |
85 | \r | |
86 | /**\r | |
87 | Retrieves attributes, insures positive polarity of attribute bits, returns\r | |
88 | resulting attributes in output parameter\r | |
89 | \r | |
38db7507 | 90 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
79964ac8 | 91 | @param Attributes output buffer which contains attributes\r |
92 | \r | |
38db7507 | 93 | @retval EFI_SUCCESS The firmware volume attributes were returned.\r |
79964ac8 | 94 | **/\r |
95 | typedef\r | |
96 | EFI_STATUS\r | |
69686d56 | 97 | (EFIAPI *FRAMEWORK_EFI_FV_GET_ATTRIBUTES)(\r |
3d02e416 | 98 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
99 | OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
79964ac8 | 100 | );\r |
101 | \r | |
102 | /**\r | |
103 | Sets volume attributes\r | |
104 | \r | |
38db7507 | 105 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
106 | @param Attributes On input, Attributes is a pointer to an \r | |
107 | EFI_FV_ATTRIBUTES containing the desired firmware \r | |
108 | volume settings.O n successful return, it contains \r | |
109 | the new settings of the firmware volume. On \r | |
110 | unsuccessful return, Attributes is not modified \r | |
111 | and the firmware volume settings are not changed.\r | |
79964ac8 | 112 | \r |
38db7507 | 113 | @retval EFI_INVALID_PARAMETER A bit in Attributes was invalid\r |
114 | @retval EFI_SUCCESS The requested firmware volume attributes were set \r | |
115 | and the resulting EFI_FV_ATTRIBUTES is returned in\r | |
116 | Attributes.\r | |
117 | @retval EFI_ACCESS_DENIED the Device is locked and does not permit modification. \r | |
79964ac8 | 118 | \r |
119 | **/\r | |
120 | typedef\r | |
121 | EFI_STATUS\r | |
69686d56 | 122 | (EFIAPI *FRAMEWORK_EFI_FV_SET_ATTRIBUTES)(\r |
38db7507 | 123 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
124 | IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
79964ac8 | 125 | );\r |
126 | \r | |
79964ac8 | 127 | /**\r |
38db7507 | 128 | Read the requested file (NameGuid) or file information from the firmware volume \r |
129 | and returns data in Buffer.\r | |
79964ac8 | 130 | \r |
38db7507 | 131 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
132 | @param NameGuid pointer to EFI_GUID which is the filename identifying which file to read\r | |
79964ac8 | 133 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r |
134 | <br>\r | |
135 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
136 | there is no output buffer.\r | |
137 | <br>\r | |
138 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
139 | from BS pool by ReadFile\r | |
140 | <br>\r | |
141 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
142 | allocated by the caller and is being passed in.\r | |
143 | @param BufferSize Indicates the buffer size passed in, and on output the size\r | |
144 | required to complete the read\r | |
38db7507 | 145 | @param FoundType pointer to type of the file who's data is returned\r |
146 | @param FileAttributes pointer to attributes of the file who's data is resturned\r | |
147 | @param AuthenticationStatus pointer to authentication status of the data\r | |
148 | \r | |
149 | @retval EFI_SUCCESS The call completed successfully\r | |
150 | @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.\r | |
151 | The buffer is filled and the output is truncated.\r | |
152 | @retval EFI_NOT_FOUND NameGuid was not found int he firmware volume.\r | |
153 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.\r | |
154 | @retval EFI_ACCESS_DENIED The firmware volumen is configured to disallow reads.\r | |
155 | @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r | |
79964ac8 | 156 | \r |
157 | **/\r | |
158 | typedef\r | |
159 | EFI_STATUS\r | |
69686d56 | 160 | (EFIAPI *FRAMEWORK_EFI_FV_READ_FILE)(\r |
79964ac8 | 161 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
162 | IN EFI_GUID *NameGuid,\r | |
163 | IN OUT VOID **Buffer,\r | |
164 | IN OUT UINTN *BufferSize,\r | |
165 | OUT EFI_FV_FILETYPE *FoundType,\r | |
166 | OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r | |
167 | OUT UINT32 *AuthenticationStatus\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Read the requested section from the specified file and returns data in Buffer.\r | |
172 | \r | |
38db7507 | 173 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
79964ac8 | 174 | @param NameGuid Filename identifying the file from which to read\r |
175 | @param SectionType Indicates what section type to retrieve\r | |
176 | @param SectionInstance Indicates which instance of SectionType to retrieve\r | |
177 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r | |
178 | <br>\r | |
179 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
180 | there is no output buffer.\r | |
181 | <br>\r | |
182 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
183 | from BS pool by ReadFile\r | |
184 | <br>\r | |
185 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
186 | allocated by the caller and is being passed in.\r | |
38db7507 | 187 | @param BufferSize pointer to the buffer size passed in, and on output the size\r |
79964ac8 | 188 | required to complete the read\r |
38db7507 | 189 | @param AuthenticationStatus pointer to the authentication status of the data\r |
79964ac8 | 190 | \r |
920d2c23 LG |
191 | @retval EFI_SUCCESS The call completed successfully.\r |
192 | @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output. \r | |
193 | The buffer is filled and the output is truncated.\r | |
194 | @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r | |
195 | @retval EFI_NOT_FOUND Name was not found in the firmware volume.\r | |
196 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.\r | |
197 | @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.\r | |
79964ac8 | 198 | \r |
199 | **/\r | |
200 | typedef\r | |
201 | EFI_STATUS\r | |
69686d56 | 202 | (EFIAPI *FRAMEWORK_EFI_FV_READ_SECTION)(\r |
79964ac8 | 203 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
204 | IN EFI_GUID *NameGuid,\r | |
205 | IN EFI_SECTION_TYPE SectionType,\r | |
206 | IN UINTN SectionInstance,\r | |
207 | IN OUT VOID **Buffer,\r | |
208 | IN OUT UINTN *BufferSize,\r | |
209 | OUT UINT32 *AuthenticationStatus\r | |
210 | );\r | |
211 | \r | |
3d02e416 | 212 | typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;\r |
79964ac8 | 213 | \r |
3d02e416 | 214 | #define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000\r |
215 | #define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001\r | |
79964ac8 | 216 | \r |
217 | typedef struct {\r | |
218 | EFI_GUID *NameGuid;\r | |
219 | EFI_FV_FILETYPE Type;\r | |
220 | EFI_FV_FILE_ATTRIBUTES FileAttributes;\r | |
221 | VOID *Buffer;\r | |
222 | UINT32 BufferSize;\r | |
3d02e416 | 223 | } FRAMEWORK_EFI_FV_WRITE_FILE_DATA;\r |
79964ac8 | 224 | \r |
225 | /**\r | |
226 | Write the supplied file (NameGuid) to the FV.\r | |
227 | \r | |
38db7507 | 228 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
79964ac8 | 229 | @param NumberOfFiles Indicates the number of file records pointed to by FileData\r |
230 | @param WritePolicy Indicates the level of reliability of the write with respect to\r | |
231 | things like power failure events.\r | |
232 | @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each\r | |
233 | element in the array indicates a file to write, and there are\r | |
234 | NumberOfFiles elements in the input array.\r | |
235 | \r | |
920d2c23 LG |
236 | @retval EFI_SUCCESS The write completed successfully.\r |
237 | @retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free space to store file(s).\r | |
238 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.\r | |
239 | @retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.\r | |
240 | @retval EFI_NOT_FOUND A delete was requested, but the requested file was not \r | |
241 | found in the firmware volume.\r | |
242 | @retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.\r | |
243 | An unsupported WritePolicy was requested.\r | |
244 | An unknown file type was specified.\r | |
245 | A file system specific error has occurred.\r | |
79964ac8 | 246 | **/\r |
247 | typedef\r | |
248 | EFI_STATUS\r | |
69686d56 | 249 | (EFIAPI *FRAMEWORK_EFI_FV_WRITE_FILE)(\r |
3d02e416 | 250 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
251 | IN UINT32 NumberOfFiles,\r | |
252 | IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,\r | |
253 | IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData\r | |
79964ac8 | 254 | );\r |
255 | \r | |
256 | /**\r | |
257 | Given the input key, search for the next matching file in the volume.\r | |
258 | \r | |
38db7507 | 259 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r |
79964ac8 | 260 | @param Key Pointer to a caller allocated buffer that contains an implementation\r |
261 | specific key that is used to track where to begin searching on\r | |
262 | successive calls.\r | |
38db7507 | 263 | @param FileType pointer to the file type to filter for\r |
264 | @param NameGuid pointer to Guid filename of the file found\r | |
265 | @param Attributes pointer to Attributes of the file found\r | |
266 | @param Size pointer to Size in bytes of the file found\r | |
79964ac8 | 267 | \r |
920d2c23 LG |
268 | @retval EFI_SUCCESS The output parameters are filled with data obtained from \r |
269 | the first matching file that was found.\r | |
270 | @retval EFI_NOT_FOUND No files of type FileType were found.\r | |
271 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access \r | |
272 | the firmware volume.\r | |
273 | @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.\r | |
79964ac8 | 274 | \r |
275 | **/\r | |
276 | typedef\r | |
277 | EFI_STATUS\r | |
69686d56 | 278 | (EFIAPI *FRAMEWORK_EFI_FV_GET_NEXT_FILE)(\r |
79964ac8 | 279 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r |
280 | IN OUT VOID *Key,\r | |
281 | IN OUT EFI_FV_FILETYPE *FileType,\r | |
282 | OUT EFI_GUID *NameGuid,\r | |
283 | OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r | |
284 | OUT UINTN *Size\r | |
285 | );\r | |
286 | \r | |
38db7507 | 287 | //\r |
288 | // Protocol interface structure\r | |
289 | //\r | |
79964ac8 | 290 | struct _EFI_FIRMWARE_VOLUME_PROTOCOL {\r |
38db7507 | 291 | ///\r |
292 | /// Retrieves volume capabilities and current settings.\r | |
293 | ///\r | |
3d02e416 | 294 | FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;\r |
38db7507 | 295 | ///\r |
296 | /// Modifies the current settings of the firmware volume.\r | |
297 | ///\r | |
3d02e416 | 298 | FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;\r |
38db7507 | 299 | ///\r |
300 | /// Reads an entire file from the firmware volume.\r | |
301 | ///\r | |
3d02e416 | 302 | FRAMEWORK_EFI_FV_READ_FILE ReadFile;\r |
38db7507 | 303 | ///\r |
304 | /// Reads a single section from a file into a buffer.\r | |
305 | ///\r | |
3d02e416 | 306 | FRAMEWORK_EFI_FV_READ_SECTION ReadSection;\r |
38db7507 | 307 | ///\r |
308 | /// Writes an entire file into the firmware volume.\r | |
309 | ///\r | |
3d02e416 | 310 | FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;\r |
38db7507 | 311 | ///\r |
312 | /// Provides service to allow searching the firmware volume.\r | |
313 | ///\r | |
3d02e416 | 314 | FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;\r |
38db7507 | 315 | ///\r |
316 | /// Data field that indicates the size in bytes of the Key input buffer for\r | |
317 | /// the GetNextFile() API.\r | |
318 | ///\r | |
319 | UINT32 KeySize;\r | |
320 | ///\r | |
321 | /// Handle of the parent firmware volume.\r | |
322 | ///\r | |
79964ac8 | 323 | EFI_HANDLE ParentHandle;\r |
324 | };\r | |
325 | \r | |
326 | extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;\r | |
327 | \r | |
328 | #endif\r |