summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Framework/Protocol/FirmwareVolume/FirmwareVolume.h
blob: fadc1b8df0c75bee186499bbb2a3f67682e5816c (plain)
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/*++

Copyright (c) 2004, 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

Abstract:

  Firmware Volume protocol as defined in the Tiano Firmware Volume
  specification.

--*/

#ifndef _FW_VOL_H_
#define _FW_VOL_H_

//
// Statements that include other files
//
#include "EfiFirmwareVolumeHeader.h"
#include "EfiFirmwareFileSystem.h"
#include "EfiFirmwareVolume.h" //;;## ...AMI_OVERRIDE... Support PI1.x
//
// Firmware Volume Protocol GUID definition
//
#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
  { \
    0x389F751F, 0x1838, 0x4388, 0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 \
  }

//;;## ...AMI_OVERRIDE... Support PI1.x #define FV_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', '_')

EFI_FORWARD_DECLARATION (EFI_FIRMWARE_VOLUME_PROTOCOL);

//
// EFI_FV_ATTRIBUTES bit definitions
//
//;;## ...AMI_OVERRIDE... Support PI1.x typedef UINT64  EFI_FV_ATTRIBUTES;

//
// ************************************************************
// EFI_FV_ATTRIBUTES bit definitions
// ************************************************************
//
#define EFI_FV_READ_DISABLE_CAP       0x0000000000000001
#define EFI_FV_READ_ENABLE_CAP        0x0000000000000002
#define EFI_FV_READ_STATUS            0x0000000000000004

#define EFI_FV_WRITE_DISABLE_CAP      0x0000000000000008
#define EFI_FV_WRITE_ENABLE_CAP       0x0000000000000010
#define EFI_FV_WRITE_STATUS           0x0000000000000020

#define EFI_FV_LOCK_CAP               0x0000000000000040
#define EFI_FV_LOCK_STATUS            0x0000000000000080
#define EFI_FV_WRITE_POLICY_RELIABLE  0x0000000000000100

#define EFI_FV_ALIGNMENT_CAP          0x0000000000008000
#define EFI_FV_ALIGNMENT_2            0x0000000000010000
#define EFI_FV_ALIGNMENT_4            0x0000000000020000
#define EFI_FV_ALIGNMENT_8            0x0000000000040000
#define EFI_FV_ALIGNMENT_16           0x0000000000080000
#define EFI_FV_ALIGNMENT_32           0x0000000000100000
#define EFI_FV_ALIGNMENT_64           0x0000000000200000
#define EFI_FV_ALIGNMENT_128          0x0000000000400000
#define EFI_FV_ALIGNMENT_256          0x0000000000800000
#define EFI_FV_ALIGNMENT_512          0x0000000001000000
#define EFI_FV_ALIGNMENT_1K           0x0000000002000000
#define EFI_FV_ALIGNMENT_2K           0x0000000004000000
#define EFI_FV_ALIGNMENT_4K           0x0000000008000000
#define EFI_FV_ALIGNMENT_8K           0x0000000010000000
#define EFI_FV_ALIGNMENT_16K          0x0000000020000000
#define EFI_FV_ALIGNMENT_32K          0x0000000040000000
#define EFI_FV_ALIGNMENT_64K          0x0000000080000000

//
// Protocol API definitions
//
//
// Forward declaration of protocol data structure
//
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL  EFI_FIRMWARE_VOLUME_PROTOCOL;

typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_GET_ATTRIBUTES) (
(EFIAPI *FV_GET_ATTRIBUTES) (
  IN  EFI_FIRMWARE_VOLUME_PROTOCOL  * This,
  OUT EFI_FV_ATTRIBUTES             * Attributes
  );

/*++

Routine Description:
  Retrieves attributes, insures positive polarity of attribute bits, returns
  resulting attributes in output parameter

Arguments:
  This - Calling context
  Attributes - output buffer which contains attributes

Returns:
  EFI_INVALID_PARAMETER
  EFI_SUCCESS

--*/
typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_SET_ATTRIBUTES) (
(EFIAPI *FV_SET_ATTRIBUTES) (
  IN EFI_FIRMWARE_VOLUME_PROTOCOL   * This,
  IN OUT EFI_FV_ATTRIBUTES          * Attributes
  );

/*++

Routine Description:
  Sets volume attributes

Arguments:
  This          Calling context
  Attributes    Buffer which contains attributes

Returns:
  EFI_INVALID_PARAMETER
  EFI_DEVICE_ERROR
  EFI_SUCCESS

--*/
//;;## ...AMI_OVERRIDE... Support PI1.x typedef UINT32  EFI_FV_FILE_ATTRIBUTES;

//;;## ...AMI_OVERRIDE... Support PI1.x #define EFI_FV_FILE_ATTRIB_ALIGNMENT  0x0000001F

typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_READ_FILE) (
(EFIAPI *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
  );

/*++

Routine Description:
    Read the requested file (NameGuid) and returns data in Buffer.

Arguments:
  This - Calling context
  NameGuid - Filename identifying which file to read 
  Buffer - Pointer to pointer to buffer in which contents of file are returned.
          
          If Buffer is NULL, only type, attributes, and size are returned as
          there is no output buffer.
          
          If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
          from BS pool by ReadFile
          
          If Buffer != NULL and *Buffer != NULL, the output buffer has been
          allocated by the caller and is being passed in.
          
  BufferSize - Indicates the buffer size passed in, and on output the size
          required to complete the read
  FoundType - Indicates the type of the file who's data is returned
  FileAttributes - Indicates the attributes of the file who's data is resturned
  AuthenticationStatus - Indicates the authentication status of the data

Returns:
  EFI_SUCCESS
  EFI_WARN_BUFFER_TOO_SMALL
  EFI_NOT_FOUND
  EFI_DEVICE_ERROR
  EFI_ACCESS_DENIED
  
--*/
typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_READ_SECTION) (
(EFIAPI *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
  );

/*++

Routine Description:
    Read the requested section from the specified file and returns data in Buffer.

Arguments:
  This - Calling context
  NameGuid - Filename identifying the file from which to read 
  SectionType - Indicates what section type to retrieve
  SectionInstance - Indicates which instance of SectionType to retrieve
  Buffer - Pointer to pointer to buffer in which contents of file are returned.
          
          If Buffer is NULL, only type, attributes, and size are returned as
          there is no output buffer.
          
          If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
          from BS pool by ReadFile
          
          If Buffer != NULL and *Buffer != NULL, the output buffer has been
          allocated by the caller and is being passed in.
          
  BufferSize - Indicates the buffer size passed in, and on output the size
          required to complete the read
  AuthenticationStatus - Indicates the authentication status of the data

Returns:
  EFI_SUCCESS
  EFI_WARN_BUFFER_TOO_SMALL
  EFI_OUT_OF_RESOURCES
  EFI_NOT_FOUND
  EFI_DEVICE_ERROR
  EFI_ACCESS_DENIED
  
--*/
//;;## ...AMI_OVERRIDE... Support PI1.x typedef UINT32  EFI_FV_WRITE_POLICY;

//;;## ...AMI_OVERRIDE... Support PI1.x #define EFI_FV_UNRELIABLE_WRITE 0x00000000
//;;## ...AMI_OVERRIDE... Support PI1.x #define EFI_FV_RELIABLE_WRITE   0x00000001

//;;## ...AMI_OVERRIDE... Support PI1.x typedef struct {
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_GUID                *NameGuid;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_FILETYPE         Type;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_FILE_ATTRIBUTES  FileAttributes;
//;;## ...AMI_OVERRIDE... Support PI1.x   VOID                    *Buffer;
//;;## ...AMI_OVERRIDE... Support PI1.x   UINT32                  BufferSize;
//;;## ...AMI_OVERRIDE... Support PI1.x } EFI_FV_WRITE_FILE_DATA;

typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_WRITE_FILE) (
(EFIAPI *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
  );

/*++

Routine Description:
  Write the supplied file (NameGuid) to the FV.

Arguments:
  This - Calling context
  NumberOfFiles - Indicates the number of file records pointed to by FileData
  WritePolicy - Indicates the level of reliability of the write with respect to
          things like power failure events.
  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.

Returns:
  EFI_SUCCESS
  EFI_OUT_OF_RESOURCES
  EFI_DEVICE_ERROR
  EFI_WRITE_PROTECTED
  EFI_NOT_FOUND
  EFI_INVALID_PARAMETER
  
--*/
typedef
EFI_STATUS
//;;## ...AMI_OVERRIDE... Support PI1.x (EFIAPI *EFI_FV_GET_NEXT_FILE) (
(EFIAPI *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
  );

/*++

Routine Description:
  Given the input key, search for the next matching file in the volume.

Arguments:
  This - Calling context
  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.
  FileType - Indicates the file type to filter for
  NameGuid - Guid filename of the file found
  Attributes - Attributes of the file found
  Size - Size in bytes of the file found

Returns:
  EFI_SUCCESS
  EFI_NOT_FOUND
  EFI_DEVICE_ERROR
  EFI_ACCESS_DENIED

--*/
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL {
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_READ_FILE      ReadFile;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_READ_SECTION   ReadSection;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_WRITE_FILE     WriteFile;
//;;## ...AMI_OVERRIDE... Support PI1.x   EFI_FV_GET_NEXT_FILE  GetNextFile;
  FV_GET_ATTRIBUTES GetVolumeAttributes;
  FV_SET_ATTRIBUTES SetVolumeAttributes;
  FV_READ_FILE      ReadFile;
  FV_READ_SECTION   ReadSection;
  FV_WRITE_FILE     WriteFile;
  FV_GET_NEXT_FILE  GetNextFile;
  UINT32            KeySize;
  EFI_HANDLE        ParentHandle;
} EFI_FIRMWARE_VOLUME_PROTOCOL;

extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;

#endif