2 This file declares the Firmware Volume Protocol.
4 The Firmware Volume Protocol provides file-level access to the firmware volume.
5 Each firmware volume driver must produce an instance of the Firmware Volume
6 Protocol if the firmware volume is to be visible to the system. The Firmware
7 Volume Protocol also provides mechanisms for determining and modifying some
8 attributes of the firmware volume.
10 Copyright (c) 2007 - 2009, Intel Corporation
11 All rights reserved. This program and the accompanying materials
12 are licensed and made available under the terms and conditions of the BSD License
13 which accompanies this distribution. The full text of the license may be found at
14 http://opensource.org/licenses/bsd-license.php
16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 @par Revision Reference:
20 This protocol is defined in Firmware Volume specification.
25 #ifndef _FIRMWARE_VOLUME_H_
26 #define _FIRMWARE_VOLUME_H_
30 // Firmware Volume Protocol GUID definition
32 #define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
34 0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \
37 #define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')
39 typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL
;
42 // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
44 typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES
;
47 // ************************************************************
48 // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
49 // ************************************************************
51 #define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL
52 #define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL
53 #define EFI_FV_READ_STATUS 0x0000000000000004ULL
55 #define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL
56 #define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL
57 #define EFI_FV_WRITE_STATUS 0x0000000000000020ULL
59 #define EFI_FV_LOCK_CAP 0x0000000000000040ULL
60 #define EFI_FV_LOCK_STATUS 0x0000000000000080ULL
61 #define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL
63 #define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL
64 #define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL
65 #define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL
66 #define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL
67 #define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL
68 #define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL
69 #define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL
70 #define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL
71 #define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL
72 #define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL
73 #define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL
74 #define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL
75 #define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL
76 #define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL
77 #define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL
78 #define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL
79 #define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL
82 // Protocol API definitions
86 Retrieves attributes, insures positive polarity of attribute bits, returns
87 resulting attributes in output parameter
89 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
90 @param Attributes output buffer which contains attributes
92 @retval EFI_SUCCESS The firmware volume attributes were returned.
96 (EFIAPI
*FRAMEWORK_EFI_FV_GET_ATTRIBUTES
)(
97 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
98 OUT FRAMEWORK_EFI_FV_ATTRIBUTES
*Attributes
102 Sets volume attributes
104 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
105 @param Attributes On input, Attributes is a pointer to an
106 EFI_FV_ATTRIBUTES containing the desired firmware
107 volume settings.O n successful return, it contains
108 the new settings of the firmware volume. On
109 unsuccessful return, Attributes is not modified
110 and the firmware volume settings are not changed.
112 @retval EFI_INVALID_PARAMETER A bit in Attributes was invalid
113 @retval EFI_SUCCESS The requested firmware volume attributes were set
114 and the resulting EFI_FV_ATTRIBUTES is returned in
116 @retval EFI_ACCESS_DENIED the Device is locked and does not permit modification.
121 (EFIAPI
*FRAMEWORK_EFI_FV_SET_ATTRIBUTES
)(
122 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
123 IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES
*Attributes
127 Read the requested file (NameGuid) or file information from the firmware volume
128 and returns data in Buffer.
130 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
131 @param NameGuid pointer to EFI_GUID which is the filename identifying which file to read
132 @param Buffer Pointer to pointer to buffer in which contents of file are returned.
134 If Buffer is NULL, only type, attributes, and size are returned as
135 there is no output buffer.
137 If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
138 from BS pool by ReadFile
140 If Buffer != NULL and *Buffer != NULL, the output buffer has been
141 allocated by the caller and is being passed in.
142 @param BufferSize Indicates the buffer size passed in, and on output the size
143 required to complete the read
144 @param FoundType pointer to type of the file who's data is returned
145 @param FileAttributes pointer to attributes of the file who's data is resturned
146 @param AuthenticationStatus pointer to authentication status of the data
148 @retval EFI_SUCCESS The call completed successfully
149 @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
150 The buffer is filled and the output is truncated.
151 @retval EFI_NOT_FOUND NameGuid was not found int he firmware volume.
152 @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
153 @retval EFI_ACCESS_DENIED The firmware volumen is configured to disallow reads.
154 @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
159 (EFIAPI
*FRAMEWORK_EFI_FV_READ_FILE
)(
160 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
161 IN EFI_GUID
*NameGuid
,
162 IN OUT VOID
**Buffer
,
163 IN OUT UINTN
*BufferSize
,
164 OUT EFI_FV_FILETYPE
*FoundType
,
165 OUT EFI_FV_FILE_ATTRIBUTES
*FileAttributes
,
166 OUT UINT32
*AuthenticationStatus
170 Read the requested section from the specified file and returns data in Buffer.
172 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
173 @param NameGuid Filename identifying the file from which to read
174 @param SectionType Indicates what section type to retrieve
175 @param SectionInstance Indicates which instance of SectionType to retrieve
176 @param Buffer Pointer to pointer to buffer in which contents of file are returned.
178 If Buffer is NULL, only type, attributes, and size are returned as
179 there is no output buffer.
181 If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
182 from BS pool by ReadFile
184 If Buffer != NULL and *Buffer != NULL, the output buffer has been
185 allocated by the caller and is being passed in.
186 @param BufferSize pointer to the buffer size passed in, and on output the size
187 required to complete the read
188 @param AuthenticationStatus pointer to the authentication status of the data
190 @retval EFI_SUCCESS The call completed successfully.
191 @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
192 The buffer is filled and the output is truncated.
193 @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
194 @retval EFI_NOT_FOUND Name was not found in the firmware volume.
195 @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
196 @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
201 (EFIAPI
*FRAMEWORK_EFI_FV_READ_SECTION
)(
202 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
203 IN EFI_GUID
*NameGuid
,
204 IN EFI_SECTION_TYPE SectionType
,
205 IN UINTN SectionInstance
,
206 IN OUT VOID
**Buffer
,
207 IN OUT UINTN
*BufferSize
,
208 OUT UINT32
*AuthenticationStatus
211 typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY
;
213 #define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000
214 #define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001
218 EFI_FV_FILETYPE Type
;
219 EFI_FV_FILE_ATTRIBUTES FileAttributes
;
222 } FRAMEWORK_EFI_FV_WRITE_FILE_DATA
;
225 Write the supplied file (NameGuid) to the FV.
227 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
228 @param NumberOfFiles Indicates the number of file records pointed to by FileData
229 @param WritePolicy Indicates the level of reliability of the write with respect to
230 things like power failure events.
231 @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each
232 element in the array indicates a file to write, and there are
233 NumberOfFiles elements in the input array.
235 @retval EFI_SUCCESS The write completed successfully.
236 @retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free space to store file(s).
237 @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
238 @retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.
239 @retval EFI_NOT_FOUND A delete was requested, but the requested file was not
240 found in the firmware volume.
241 @retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.
242 An unsupported WritePolicy was requested.
243 An unknown file type was specified.
244 A file system specific error has occurred.
248 (EFIAPI
*FRAMEWORK_EFI_FV_WRITE_FILE
)(
249 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
250 IN UINT32 NumberOfFiles
,
251 IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy
,
252 IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA
*FileData
256 Given the input key, search for the next matching file in the volume.
258 @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
259 @param Key Pointer to a caller allocated buffer that contains an implementation
260 specific key that is used to track where to begin searching on
262 @param FileType pointer to the file type to filter for
263 @param NameGuid pointer to Guid filename of the file found
264 @param Attributes pointer to Attributes of the file found
265 @param Size pointer to Size in bytes of the file found
267 @retval EFI_SUCCESS The output parameters are filled with data obtained from
268 the first matching file that was found.
269 @retval EFI_NOT_FOUND No files of type FileType were found.
270 @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access
272 @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
277 (EFIAPI
*FRAMEWORK_EFI_FV_GET_NEXT_FILE
)(
278 IN EFI_FIRMWARE_VOLUME_PROTOCOL
*This
,
280 IN OUT EFI_FV_FILETYPE
*FileType
,
281 OUT EFI_GUID
*NameGuid
,
282 OUT EFI_FV_FILE_ATTRIBUTES
*Attributes
,
287 // Protocol interface structure
289 struct _EFI_FIRMWARE_VOLUME_PROTOCOL
{
291 /// Retrieves volume capabilities and current settings.
293 FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes
;
296 /// Modifies the current settings of the firmware volume.
298 FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes
;
301 /// Reads an entire file from the firmware volume.
303 FRAMEWORK_EFI_FV_READ_FILE ReadFile
;
306 /// Reads a single section from a file into a buffer.
308 FRAMEWORK_EFI_FV_READ_SECTION ReadSection
;
311 /// Writes an entire file into the firmware volume.
313 FRAMEWORK_EFI_FV_WRITE_FILE WriteFile
;
316 /// Provides service to allow searching the firmware volume.
318 FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile
;
321 /// Data field that indicates the size in bytes of the Key input buffer for
322 /// the GetNextFile() API.
327 /// Handle of the parent firmware volume.
329 EFI_HANDLE ParentHandle
;
332 extern EFI_GUID gEfiFirmwareVolumeProtocolGuid
;