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