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