3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Firmware Volume protocol as defined in the Tiano Firmware Volume
27 // Statements that include other files
29 #include "EfiFirmwareVolumeHeader.h"
30 #include "EfiFirmwareFileSystem.h"
31 #include "EfiFirmwareVolume.h"
33 // Firmware Volume Protocol GUID definition
35 #define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
37 0x389F751F, 0x1838, 0x4388, 0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 \
41 EFI_FORWARD_DECLARATION (EFI_FIRMWARE_VOLUME_PROTOCOL
);
44 // ************************************************************
45 // EFI_FV_ATTRIBUTES bit definitions
46 // ************************************************************
48 #define EFI_FV_READ_DISABLE_CAP 0x0000000000000001
49 #define EFI_FV_READ_ENABLE_CAP 0x0000000000000002
50 #define EFI_FV_READ_STATUS 0x0000000000000004
52 #define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008
53 #define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010
54 #define EFI_FV_WRITE_STATUS 0x0000000000000020
56 #define EFI_FV_LOCK_CAP 0x0000000000000040
57 #define EFI_FV_LOCK_STATUS 0x0000000000000080
58 #define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100
60 #define EFI_FV_ALIGNMENT_CAP 0x0000000000008000
61 #define EFI_FV_ALIGNMENT_2 0x0000000000010000
62 #define EFI_FV_ALIGNMENT_4 0x0000000000020000
63 #define EFI_FV_ALIGNMENT_8 0x0000000000040000
64 #define EFI_FV_ALIGNMENT_16 0x0000000000080000
65 #define EFI_FV_ALIGNMENT_32 0x0000000000100000
66 #define EFI_FV_ALIGNMENT_64 0x0000000000200000
67 #define EFI_FV_ALIGNMENT_128 0x0000000000400000
68 #define EFI_FV_ALIGNMENT_256 0x0000000000800000
69 #define EFI_FV_ALIGNMENT_512 0x0000000001000000
70 #define EFI_FV_ALIGNMENT_1K 0x0000000002000000
71 #define EFI_FV_ALIGNMENT_2K 0x0000000004000000
72 #define EFI_FV_ALIGNMENT_4K 0x0000000008000000
73 #define EFI_FV_ALIGNMENT_8K 0x0000000010000000
74 #define EFI_FV_ALIGNMENT_16K 0x0000000020000000
75 #define EFI_FV_ALIGNMENT_32K 0x0000000040000000
76 #define EFI_FV_ALIGNMENT_64K 0x0000000080000000
79 // Protocol API definitions
82 // Forward declaration of protocol data structure
84 typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL
;
88 (EFIAPI
*FV_GET_ATTRIBUTES
) (
89 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
90 OUT EFI_FV_ATTRIBUTES
* Attributes
96 Retrieves attributes, insures positive polarity of attribute bits, returns
97 resulting attributes in output parameter
100 This - Calling context
101 Attributes - output buffer which contains attributes
104 EFI_INVALID_PARAMETER
110 (EFIAPI
*FV_SET_ATTRIBUTES
) (
111 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
112 IN OUT EFI_FV_ATTRIBUTES
* Attributes
118 Sets volume attributes
122 Attributes Buffer which contains attributes
125 EFI_INVALID_PARAMETER
133 (EFIAPI
*FV_READ_FILE
) (
134 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
135 IN EFI_GUID
* NameGuid
,
136 IN OUT VOID
**Buffer
,
137 IN OUT UINTN
*BufferSize
,
138 OUT EFI_FV_FILETYPE
* FoundType
,
139 OUT EFI_FV_FILE_ATTRIBUTES
* FileAttributes
,
140 OUT UINT32
*AuthenticationStatus
146 Read the requested file (NameGuid) and returns data in Buffer.
149 This - Calling context
150 NameGuid - Filename identifying which file to read
151 Buffer - Pointer to pointer to buffer in which contents of file are returned.
153 If Buffer is NULL, only type, attributes, and size are returned as
154 there is no output buffer.
156 If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
157 from BS pool by ReadFile
159 If Buffer != NULL and *Buffer != NULL, the output buffer has been
160 allocated by the caller and is being passed in.
162 BufferSize - Indicates the buffer size passed in, and on output the size
163 required to complete the read
164 FoundType - Indicates the type of the file who's data is returned
165 FileAttributes - Indicates the attributes of the file who's data is resturned
166 AuthenticationStatus - Indicates the authentication status of the data
170 EFI_WARN_BUFFER_TOO_SMALL
178 (EFIAPI
*FV_READ_SECTION
) (
179 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
180 IN EFI_GUID
* NameGuid
,
181 IN EFI_SECTION_TYPE SectionType
,
182 IN UINTN SectionInstance
,
183 IN OUT VOID
**Buffer
,
184 IN OUT UINTN
*BufferSize
,
185 OUT UINT32
*AuthenticationStatus
191 Read the requested section from the specified file and returns data in Buffer.
194 This - Calling context
195 NameGuid - Filename identifying the file from which to read
196 SectionType - Indicates what section type to retrieve
197 SectionInstance - Indicates which instance of SectionType to retrieve
198 Buffer - Pointer to pointer to buffer in which contents of file are returned.
200 If Buffer is NULL, only type, attributes, and size are returned as
201 there is no output buffer.
203 If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
204 from BS pool by ReadFile
206 If Buffer != NULL and *Buffer != NULL, the output buffer has been
207 allocated by the caller and is being passed in.
209 BufferSize - Indicates the buffer size passed in, and on output the size
210 required to complete the read
211 AuthenticationStatus - Indicates the authentication status of the data
215 EFI_WARN_BUFFER_TOO_SMALL
225 (EFIAPI
*FV_WRITE_FILE
) (
226 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
227 IN UINT32 NumberOfFiles
,
228 IN EFI_FV_WRITE_POLICY WritePolicy
,
229 IN EFI_FV_WRITE_FILE_DATA
* FileData
235 Write the supplied file (NameGuid) to the FV.
238 This - Calling context
239 NumberOfFiles - Indicates the number of file records pointed to by FileData
240 WritePolicy - Indicates the level of reliability of the write with respect to
241 things like power failure events.
242 FileData - A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each
243 element in the array indicates a file to write, and there are
244 NumberOfFiles elements in the input array.
252 EFI_INVALID_PARAMETER
257 (EFIAPI
*FV_GET_NEXT_FILE
) (
258 IN EFI_FIRMWARE_VOLUME_PROTOCOL
* This
,
260 IN OUT EFI_FV_FILETYPE
* FileType
,
261 OUT EFI_GUID
* NameGuid
,
262 OUT EFI_FV_FILE_ATTRIBUTES
* Attributes
,
269 Given the input key, search for the next matching file in the volume.
272 This - Calling context
273 Key - Pointer to a caller allocated buffer that contains an implementation
274 specific key that is used to track where to begin searching on
276 FileType - Indicates the file type to filter for
277 NameGuid - Guid filename of the file found
278 Attributes - Attributes of the file found
279 Size - Size in bytes of the file found
288 typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL
{
289 FV_GET_ATTRIBUTES GetVolumeAttributes
;
290 FV_SET_ATTRIBUTES SetVolumeAttributes
;
291 FV_READ_FILE ReadFile
;
292 FV_READ_SECTION ReadSection
;
293 FV_WRITE_FILE WriteFile
;
294 FV_GET_NEXT_FILE GetNextFile
;
296 EFI_HANDLE ParentHandle
;
297 } EFI_FIRMWARE_VOLUME_PROTOCOL
;
299 extern EFI_GUID gEfiFirmwareVolumeProtocolGuid
;