xref: /freebsd/sys/contrib/edk2/Include/Protocol/FirmwareVolume2.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1*f439973dSWarner Losh /** @file
2*f439973dSWarner Losh   The Firmware Volume Protocol provides file-level access to the firmware volume.
3*f439973dSWarner Losh   Each firmware volume driver must produce an instance of the
4*f439973dSWarner Losh   Firmware Volume Protocol if the firmware volume is to be visible to
5*f439973dSWarner Losh   the system during the DXE phase. The Firmware Volume Protocol also provides
6*f439973dSWarner Losh   mechanisms for determining and modifying some attributes of the firmware volume.
7*f439973dSWarner Losh 
8*f439973dSWarner Losh   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9*f439973dSWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
10*f439973dSWarner Losh 
11*f439973dSWarner Losh   @par Revision Reference: PI
12*f439973dSWarner Losh   Version 1.00.
13*f439973dSWarner Losh 
14*f439973dSWarner Losh **/
15*f439973dSWarner Losh 
16*f439973dSWarner Losh #ifndef __FIRMWARE_VOLUME2_H__
17*f439973dSWarner Losh #define __FIRMWARE_VOLUME2_H__
18*f439973dSWarner Losh 
19*f439973dSWarner Losh #define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \
20*f439973dSWarner Losh   { 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } }
21*f439973dSWarner Losh 
22*f439973dSWarner Losh typedef struct _EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME2_PROTOCOL;
23*f439973dSWarner Losh 
24*f439973dSWarner Losh ///
25*f439973dSWarner Losh /// EFI_FV_ATTRIBUTES
26*f439973dSWarner Losh ///
27*f439973dSWarner Losh typedef UINT64 EFI_FV_ATTRIBUTES;
28*f439973dSWarner Losh 
29*f439973dSWarner Losh //
30*f439973dSWarner Losh // EFI_FV_ATTRIBUTES bit definitions
31*f439973dSWarner Losh //
32*f439973dSWarner Losh // EFI_FV_ATTRIBUTES bit semantics
33*f439973dSWarner Losh #define EFI_FV2_READ_DISABLE_CAP       0x0000000000000001ULL
34*f439973dSWarner Losh #define EFI_FV2_READ_ENABLE_CAP        0x0000000000000002ULL
35*f439973dSWarner Losh #define EFI_FV2_READ_STATUS            0x0000000000000004ULL
36*f439973dSWarner Losh #define EFI_FV2_WRITE_DISABLE_CAP      0x0000000000000008ULL
37*f439973dSWarner Losh #define EFI_FV2_WRITE_ENABLE_CAP       0x0000000000000010ULL
38*f439973dSWarner Losh #define EFI_FV2_WRITE_STATUS           0x0000000000000020ULL
39*f439973dSWarner Losh #define EFI_FV2_LOCK_CAP               0x0000000000000040ULL
40*f439973dSWarner Losh #define EFI_FV2_LOCK_STATUS            0x0000000000000080ULL
41*f439973dSWarner Losh #define EFI_FV2_WRITE_POLICY_RELIABLE  0x0000000000000100ULL
42*f439973dSWarner Losh #define EFI_FV2_READ_LOCK_CAP          0x0000000000001000ULL
43*f439973dSWarner Losh #define EFI_FV2_READ_LOCK_STATUS       0x0000000000002000ULL
44*f439973dSWarner Losh #define EFI_FV2_WRITE_LOCK_CAP         0x0000000000004000ULL
45*f439973dSWarner Losh #define EFI_FV2_WRITE_LOCK_STATUS      0x0000000000008000ULL
46*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT              0x00000000001F0000ULL
47*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_1            0x0000000000000000ULL
48*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_2            0x0000000000010000ULL
49*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_4            0x0000000000020000ULL
50*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_8            0x0000000000030000ULL
51*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_16           0x0000000000040000ULL
52*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_32           0x0000000000050000ULL
53*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_64           0x0000000000060000ULL
54*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_128          0x0000000000070000ULL
55*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_256          0x0000000000080000ULL
56*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_512          0x0000000000090000ULL
57*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_1K           0x00000000000A0000ULL
58*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_2K           0x00000000000B0000ULL
59*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_4K           0x00000000000C0000ULL
60*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_8K           0x00000000000D0000ULL
61*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_16K          0x00000000000E0000ULL
62*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_32K          0x00000000000F0000ULL
63*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_64K          0x0000000000100000ULL
64*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_128K         0x0000000000110000ULL
65*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_256K         0x0000000000120000ULL
66*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_512K         0x0000000000130000ULL
67*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_1M           0x0000000000140000ULL
68*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_2M           0x0000000000150000ULL
69*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_4M           0x0000000000160000ULL
70*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_8M           0x0000000000170000ULL
71*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_16M          0x0000000000180000ULL
72*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_32M          0x0000000000190000ULL
73*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_64M          0x00000000001A0000ULL
74*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_128M         0x00000000001B0000ULL
75*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_256M         0x00000000001C0000ULL
76*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_512M         0x00000000001D0000ULL
77*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_1G           0x00000000001E0000ULL
78*f439973dSWarner Losh #define EFI_FV2_ALIGNMENT_2G           0x00000000001F0000ULL
79*f439973dSWarner Losh 
80*f439973dSWarner Losh /**
81*f439973dSWarner Losh   Returns the attributes and current settings of the firmware volume.
82*f439973dSWarner Losh 
83*f439973dSWarner Losh   Because of constraints imposed by the underlying firmware
84*f439973dSWarner Losh   storage, an instance of the Firmware Volume Protocol may not
85*f439973dSWarner Losh   be to able to support all possible variations of this
86*f439973dSWarner Losh   architecture. These constraints and the current state of the
87*f439973dSWarner Losh   firmware volume are exposed to the caller using the
88*f439973dSWarner Losh   GetVolumeAttributes() function. GetVolumeAttributes() is
89*f439973dSWarner Losh   callable only from TPL_NOTIFY and below. Behavior of
90*f439973dSWarner Losh   GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is
91*f439973dSWarner Losh   undefined.
92*f439973dSWarner Losh 
93*f439973dSWarner Losh   @param  This          Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
94*f439973dSWarner Losh 
95*f439973dSWarner Losh   @param  FvAttributes  Pointer to an EFI_FV_ATTRIBUTES in which
96*f439973dSWarner Losh                         the attributes and current settings are
97*f439973dSWarner Losh                         returned.
98*f439973dSWarner Losh 
99*f439973dSWarner Losh 
100*f439973dSWarner Losh   @retval EFI_SUCCESS   The firmware volume attributes were
101*f439973dSWarner Losh                         returned.
102*f439973dSWarner Losh 
103*f439973dSWarner Losh **/
104*f439973dSWarner Losh typedef
105*f439973dSWarner Losh EFI_STATUS
106*f439973dSWarner Losh (EFIAPI *EFI_FV_GET_ATTRIBUTES)(
107*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
108*f439973dSWarner Losh   OUT       EFI_FV_ATTRIBUTES             *FvAttributes
109*f439973dSWarner Losh   );
110*f439973dSWarner Losh 
111*f439973dSWarner Losh /**
112*f439973dSWarner Losh   Modifies the current settings of the firmware volume according to the input parameter.
113*f439973dSWarner Losh 
114*f439973dSWarner Losh   The SetVolumeAttributes() function is used to set configurable
115*f439973dSWarner Losh   firmware volume attributes. Only EFI_FV_READ_STATUS,
116*f439973dSWarner Losh   EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and
117*f439973dSWarner Losh    then only in accordance with the declared capabilities. All
118*f439973dSWarner Losh   other bits of FvAttributes are ignored on input. On successful
119*f439973dSWarner Losh   return, all bits of *FvAttributes are valid and it contains the
120*f439973dSWarner Losh   completed EFI_FV_ATTRIBUTES for the volume. To modify an
121*f439973dSWarner Losh   attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES
122*f439973dSWarner Losh   is set to the desired value on input. The EFI_FV_LOCK_STATUS bit
123*f439973dSWarner Losh   does not affect the ability to read or write the firmware
124*f439973dSWarner Losh   volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it
125*f439973dSWarner Losh   prevents further modification to all the attribute bits.
126*f439973dSWarner Losh   SetVolumeAttributes() is callable only from TPL_NOTIFY and
127*f439973dSWarner Losh   below. Behavior of SetVolumeAttributes() at any EFI_TPL above
128*f439973dSWarner Losh   TPL_NOTIFY is undefined.
129*f439973dSWarner Losh 
130*f439973dSWarner Losh   @param  This          Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
131*f439973dSWarner Losh 
132*f439973dSWarner Losh   @param  FvAttributes  On input, FvAttributes is a pointer to
133*f439973dSWarner Losh                         an EFI_FV_ATTRIBUTES containing the
134*f439973dSWarner Losh                         desired firmware volume settings. On
135*f439973dSWarner Losh                         successful return, it contains the new
136*f439973dSWarner Losh                         settings of the firmware volume. On
137*f439973dSWarner Losh                         unsuccessful return, FvAttributes is not
138*f439973dSWarner Losh                         modified and the firmware volume
139*f439973dSWarner Losh                         settings are not changed.
140*f439973dSWarner Losh 
141*f439973dSWarner Losh   @retval EFI_SUCCESS           The requested firmware volume attributes
142*f439973dSWarner Losh                                 were set and the resulting
143*f439973dSWarner Losh                                 EFI_FV_ATTRIBUTES is returned in
144*f439973dSWarner Losh                                 FvAttributes.
145*f439973dSWarner Losh 
146*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
147*f439973dSWarner Losh                                 is set to 1 on input, but the
148*f439973dSWarner Losh                                 device does not support enabling
149*f439973dSWarner Losh                                 reads
150*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_READ_ENABLE
151*f439973dSWarner Losh                                 is clear on return from
152*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
153*f439973dSWarner Losh                                 volume attributes are unchanged.
154*f439973dSWarner Losh 
155*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
156*f439973dSWarner Losh                                 is cleared to 0 on input, but
157*f439973dSWarner Losh                                 the device does not support
158*f439973dSWarner Losh                                 disabling reads
159*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_READ_DISABL
160*f439973dSWarner Losh                                 is clear on return from
161*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
162*f439973dSWarner Losh                                 volume attributes are unchanged.
163*f439973dSWarner Losh 
164*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
165*f439973dSWarner Losh                                 is set to 1 on input, but the
166*f439973dSWarner Losh                                 device does not support enabling
167*f439973dSWarner Losh                                 writes
168*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_WRITE_ENABL
169*f439973dSWarner Losh                                 is clear on return from
170*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
171*f439973dSWarner Losh                                 volume attributes are unchanged.
172*f439973dSWarner Losh 
173*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
174*f439973dSWarner Losh                                 is cleared to 0 on input, but
175*f439973dSWarner Losh                                 the device does not support
176*f439973dSWarner Losh                                 disabling writes
177*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_WRITE_DISAB
178*f439973dSWarner Losh                                 is clear on return from
179*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
180*f439973dSWarner Losh                                 volume attributes are unchanged.
181*f439973dSWarner Losh 
182*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS
183*f439973dSWarner Losh                                 is set on input, but the device
184*f439973dSWarner Losh                                 does not support locking
185*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_LOCK_CAP is
186*f439973dSWarner Losh                                 clear on return from
187*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
188*f439973dSWarner Losh                                 volume attributes are unchanged.
189*f439973dSWarner Losh 
190*f439973dSWarner Losh   @retval EFI_ACCESS_DENIED     Device is locked and does not
191*f439973dSWarner Losh                                 allow attribute modification
192*f439973dSWarner Losh                                 (FvAttributes:EFI_FV_LOCK_STATUS
193*f439973dSWarner Losh                                 is set on return from
194*f439973dSWarner Losh                                 GetVolumeAttributes()). Actual
195*f439973dSWarner Losh                                 volume attributes are unchanged.
196*f439973dSWarner Losh 
197*f439973dSWarner Losh **/
198*f439973dSWarner Losh typedef
199*f439973dSWarner Losh EFI_STATUS
200*f439973dSWarner Losh (EFIAPI *EFI_FV_SET_ATTRIBUTES)(
201*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
202*f439973dSWarner Losh   IN OUT    EFI_FV_ATTRIBUTES             *FvAttributes
203*f439973dSWarner Losh   );
204*f439973dSWarner Losh 
205*f439973dSWarner Losh /**
206*f439973dSWarner Losh   Retrieves a file and/or file information from the firmware volume.
207*f439973dSWarner Losh 
208*f439973dSWarner Losh   ReadFile() is used to retrieve any file from a firmware volume
209*f439973dSWarner Losh   during the DXE phase. The actual binary encoding of the file in
210*f439973dSWarner Losh   the firmware volume media may be in any arbitrary format as long
211*f439973dSWarner Losh   as it does the following: It is accessed using the Firmware
212*f439973dSWarner Losh   Volume Protocol. The image that is returned follows the image
213*f439973dSWarner Losh   format defined in Code Definitions: PI Firmware File Format.
214*f439973dSWarner Losh   If the input value of Buffer==NULL, it indicates the caller is
215*f439973dSWarner Losh   requesting only that the type, attributes, and size of the
216*f439973dSWarner Losh   file be returned and that there is no output buffer. In this
217*f439973dSWarner Losh   case, the following occurs:
218*f439973dSWarner Losh   - BufferSize is returned with the size that is required to
219*f439973dSWarner Losh     successfully complete the read.
220*f439973dSWarner Losh   - The output parameters FoundType and *FileAttributes are
221*f439973dSWarner Losh   returned with valid values.
222*f439973dSWarner Losh   - The returned value of *AuthenticationStatus is undefined.
223*f439973dSWarner Losh 
224*f439973dSWarner Losh   If the input value of Buffer!=NULL, the output buffer is
225*f439973dSWarner Losh   specified by a double indirection of the Buffer parameter. The
226*f439973dSWarner Losh   input value of *Buffer is used to determine if the output
227*f439973dSWarner Losh   buffer is caller allocated or is dynamically allocated by
228*f439973dSWarner Losh   ReadFile(). If the input value of *Buffer!=NULL, it indicates
229*f439973dSWarner Losh   the output buffer is caller allocated. In this case, the input
230*f439973dSWarner Losh    value of *BufferSize indicates the size of the
231*f439973dSWarner Losh   caller-allocated output buffer. If the output buffer is not
232*f439973dSWarner Losh   large enough to contain the entire requested output, it is
233*f439973dSWarner Losh   filled up to the point that the output buffer is exhausted and
234*f439973dSWarner Losh   EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is
235*f439973dSWarner Losh    returned with the size required to successfully complete the
236*f439973dSWarner Losh   read. All other output parameters are returned with valid
237*f439973dSWarner Losh   values. If the input value of *Buffer==NULL, it indicates the
238*f439973dSWarner Losh   output buffer is to be allocated by ReadFile(). In this case,
239*f439973dSWarner Losh   ReadFile() will allocate an appropriately sized buffer from
240*f439973dSWarner Losh   boot services pool memory, which will be returned in Buffer.
241*f439973dSWarner Losh   The size of the new buffer is returned in BufferSize and all
242*f439973dSWarner Losh   other output parameters are returned with valid values.
243*f439973dSWarner Losh   ReadFile() is callable only from TPL_NOTIFY and below.
244*f439973dSWarner Losh   Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is
245*f439973dSWarner Losh   undefined.
246*f439973dSWarner Losh 
247*f439973dSWarner Losh   @param  This                  Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
248*f439973dSWarner Losh 
249*f439973dSWarner Losh   @param  NameGuid              Pointer to an EFI_GUID, which is the file
250*f439973dSWarner Losh                                 name. All firmware file names are EFI_GUIDs.
251*f439973dSWarner Losh                                 A single firmware volume must not have two
252*f439973dSWarner Losh                                 valid files with the same file name
253*f439973dSWarner Losh                                 EFI_GUID.
254*f439973dSWarner Losh 
255*f439973dSWarner Losh   @param  Buffer                Pointer to a pointer to a buffer in which the
256*f439973dSWarner Losh                                 file contents are returned, not including the
257*f439973dSWarner Losh                                 file header.
258*f439973dSWarner Losh 
259*f439973dSWarner Losh   @param  BufferSize            Pointer to a caller-allocated UINTN. It
260*f439973dSWarner Losh                                 indicates the size of the memory
261*f439973dSWarner Losh                                 represented by Buffer.
262*f439973dSWarner Losh 
263*f439973dSWarner Losh   @param  FoundType             Pointer to a caller-allocated EFI_FV_FILETYPE.
264*f439973dSWarner Losh 
265*f439973dSWarner Losh   @param  FileAttributes        Pointer to a  caller-allocated
266*f439973dSWarner Losh                                 EFI_FV_FILE_ATTRIBUTES.
267*f439973dSWarner Losh 
268*f439973dSWarner Losh   @param  AuthenticationStatus  Pointer to a caller-allocated
269*f439973dSWarner Losh                                 UINT32 in which the
270*f439973dSWarner Losh                                 authentication status is
271*f439973dSWarner Losh                                 returned.
272*f439973dSWarner Losh 
273*f439973dSWarner Losh   @retval EFI_SUCCESS                 The call completed successfully.
274*f439973dSWarner Losh 
275*f439973dSWarner Losh   @retval EFI_WARN_BUFFER_TOO_SMALL   The buffer is too small to
276*f439973dSWarner Losh                                       contain the requested
277*f439973dSWarner Losh                                       output. The buffer is
278*f439973dSWarner Losh                                       filled and the output is
279*f439973dSWarner Losh                                       truncated.
280*f439973dSWarner Losh 
281*f439973dSWarner Losh   @retval EFI_OUT_OF_RESOURCES        An allocation failure occurred.
282*f439973dSWarner Losh 
283*f439973dSWarner Losh   @retval EFI_NOT_FOUND               Name was not found in the firmware volume.
284*f439973dSWarner Losh 
285*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR            A hardware error occurred when
286*f439973dSWarner Losh                                       attempting to access the firmware volume.
287*f439973dSWarner Losh 
288*f439973dSWarner Losh   @retval EFI_ACCESS_DENIED           The firmware volume is configured to
289*f439973dSWarner Losh                                       disallow reads.
290*f439973dSWarner Losh 
291*f439973dSWarner Losh **/
292*f439973dSWarner Losh typedef
293*f439973dSWarner Losh EFI_STATUS
294*f439973dSWarner Losh (EFIAPI *EFI_FV_READ_FILE)(
295*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
296*f439973dSWarner Losh   IN CONST  EFI_GUID                      *NameGuid,
297*f439973dSWarner Losh   IN OUT    VOID                          **Buffer,
298*f439973dSWarner Losh   IN OUT    UINTN                         *BufferSize,
299*f439973dSWarner Losh   OUT       EFI_FV_FILETYPE               *FoundType,
300*f439973dSWarner Losh   OUT       EFI_FV_FILE_ATTRIBUTES        *FileAttributes,
301*f439973dSWarner Losh   OUT       UINT32                        *AuthenticationStatus
302*f439973dSWarner Losh   );
303*f439973dSWarner Losh 
304*f439973dSWarner Losh /**
305*f439973dSWarner Losh   Locates the requested section within a file and returns it in a buffer.
306*f439973dSWarner Losh 
307*f439973dSWarner Losh   ReadSection() is used to retrieve a specific section from a file
308*f439973dSWarner Losh   within a firmware volume. The section returned is determined
309*f439973dSWarner Losh   using a depth-first, left-to-right search algorithm through all
310*f439973dSWarner Losh   sections found in the specified file. The output buffer is specified by a double indirection
311*f439973dSWarner Losh   of the Buffer parameter. The input value of Buffer is used to
312*f439973dSWarner Losh   determine if the output buffer is caller allocated or is
313*f439973dSWarner Losh   dynamically allocated by ReadSection(). If the input value of
314*f439973dSWarner Losh   Buffer!=NULL, it indicates that the output buffer is caller
315*f439973dSWarner Losh   allocated. In this case, the input value of *BufferSize
316*f439973dSWarner Losh   indicates the size of the caller-allocated output buffer. If
317*f439973dSWarner Losh   the output buffer is not large enough to contain the entire
318*f439973dSWarner Losh   requested output, it is filled up to the point that the output
319*f439973dSWarner Losh   buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned,
320*f439973dSWarner Losh   and then BufferSize is returned with the size that is required
321*f439973dSWarner Losh   to successfully complete the read. All other
322*f439973dSWarner Losh   output parameters are returned with valid values. If the input
323*f439973dSWarner Losh   value of *Buffer==NULL, it indicates the output buffer is to
324*f439973dSWarner Losh   be allocated by ReadSection(). In this case, ReadSection()
325*f439973dSWarner Losh   will allocate an appropriately sized buffer from boot services
326*f439973dSWarner Losh   pool memory, which will be returned in *Buffer. The size of
327*f439973dSWarner Losh   the new buffer is returned in *BufferSize and all other output
328*f439973dSWarner Losh   parameters are returned with valid values. ReadSection() is
329*f439973dSWarner Losh   callable only from TPL_NOTIFY and below. Behavior of
330*f439973dSWarner Losh   ReadSection() at any EFI_TPL above TPL_NOTIFY is
331*f439973dSWarner Losh   undefined.
332*f439973dSWarner Losh 
333*f439973dSWarner Losh   @param  This                Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
334*f439973dSWarner Losh 
335*f439973dSWarner Losh   @param NameGuid             Pointer to an EFI_GUID, which indicates the
336*f439973dSWarner Losh                               file name from which the requested section
337*f439973dSWarner Losh                               will be read.
338*f439973dSWarner Losh 
339*f439973dSWarner Losh   @param SectionType          Indicates the section type to return.
340*f439973dSWarner Losh                               SectionType in conjunction with
341*f439973dSWarner Losh                               SectionInstance indicates which section to
342*f439973dSWarner Losh                               return.
343*f439973dSWarner Losh 
344*f439973dSWarner Losh   @param SectionInstance      Indicates which instance of sections
345*f439973dSWarner Losh                               with a type of SectionType to return.
346*f439973dSWarner Losh                               SectionType in conjunction with
347*f439973dSWarner Losh                               SectionInstance indicates which
348*f439973dSWarner Losh                               section to return. SectionInstance is
349*f439973dSWarner Losh                               zero based.
350*f439973dSWarner Losh 
351*f439973dSWarner Losh   @param Buffer               Pointer to a pointer to a buffer in which the
352*f439973dSWarner Losh                               section contents are returned, not including
353*f439973dSWarner Losh                               the section header.
354*f439973dSWarner Losh 
355*f439973dSWarner Losh   @param BufferSize           Pointer to a caller-allocated UINTN. It
356*f439973dSWarner Losh                               indicates the size of the memory
357*f439973dSWarner Losh                               represented by Buffer.
358*f439973dSWarner Losh 
359*f439973dSWarner Losh   @param AuthenticationStatus Pointer to a caller-allocated
360*f439973dSWarner Losh                               UINT32 in which the authentication
361*f439973dSWarner Losh                               status is returned.
362*f439973dSWarner Losh 
363*f439973dSWarner Losh 
364*f439973dSWarner Losh   @retval EFI_SUCCESS   The call completed successfully.
365*f439973dSWarner Losh 
366*f439973dSWarner Losh   @retval EFI_WARN_BUFFER_TOO_SMALL   The caller-allocated
367*f439973dSWarner Losh                                       buffer is too small to
368*f439973dSWarner Losh                                       contain the requested
369*f439973dSWarner Losh                                       output. The buffer is
370*f439973dSWarner Losh                                       filled and the output is
371*f439973dSWarner Losh                                       truncated.
372*f439973dSWarner Losh 
373*f439973dSWarner Losh   @retval EFI_OUT_OF_RESOURCES  An allocation failure occurred.
374*f439973dSWarner Losh 
375*f439973dSWarner Losh   @retval EFI_NOT_FOUND   The requested file was not found in
376*f439973dSWarner Losh                           the firmware volume. EFI_NOT_FOUND The
377*f439973dSWarner Losh                           requested section was not found in the
378*f439973dSWarner Losh                           specified file.
379*f439973dSWarner Losh 
380*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR  A hardware error occurred when
381*f439973dSWarner Losh                             attempting to access the firmware
382*f439973dSWarner Losh                             volume.
383*f439973dSWarner Losh 
384*f439973dSWarner Losh   @retval EFI_ACCESS_DENIED The firmware volume is configured to
385*f439973dSWarner Losh                             disallow reads. EFI_PROTOCOL_ERROR
386*f439973dSWarner Losh                             The requested section was not found,
387*f439973dSWarner Losh                             but the file could not be fully
388*f439973dSWarner Losh                             parsed because a required
389*f439973dSWarner Losh                             GUIDED_SECTION_EXTRACTION_PROTOCOL
390*f439973dSWarner Losh                             was not found. It is possible the
391*f439973dSWarner Losh                             requested section exists within the
392*f439973dSWarner Losh                             file and could be successfully
393*f439973dSWarner Losh                             extracted once the required
394*f439973dSWarner Losh                             GUIDED_SECTION_EXTRACTION_PROTOCOL
395*f439973dSWarner Losh                             is published.
396*f439973dSWarner Losh 
397*f439973dSWarner Losh **/
398*f439973dSWarner Losh typedef
399*f439973dSWarner Losh EFI_STATUS
400*f439973dSWarner Losh (EFIAPI *EFI_FV_READ_SECTION)(
401*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
402*f439973dSWarner Losh   IN CONST  EFI_GUID                      *NameGuid,
403*f439973dSWarner Losh   IN        EFI_SECTION_TYPE              SectionType,
404*f439973dSWarner Losh   IN        UINTN                         SectionInstance,
405*f439973dSWarner Losh   IN OUT    VOID                          **Buffer,
406*f439973dSWarner Losh   IN OUT    UINTN                         *BufferSize,
407*f439973dSWarner Losh   OUT       UINT32                        *AuthenticationStatus
408*f439973dSWarner Losh   );
409*f439973dSWarner Losh 
410*f439973dSWarner Losh ///
411*f439973dSWarner Losh /// EFI_FV_WRITE_POLICY, two policies (unreliable write and reliable write) are defined.
412*f439973dSWarner Losh ///
413*f439973dSWarner Losh typedef UINT32 EFI_FV_WRITE_POLICY;
414*f439973dSWarner Losh #define EFI_FV_UNRELIABLE_WRITE  0x00000000
415*f439973dSWarner Losh #define EFI_FV_RELIABLE_WRITE    0x00000001
416*f439973dSWarner Losh 
417*f439973dSWarner Losh //
418*f439973dSWarner Losh // EFI_FV_WRITE_FILE_DATA
419*f439973dSWarner Losh //
420*f439973dSWarner Losh typedef struct {
421*f439973dSWarner Losh   ///
422*f439973dSWarner Losh   /// Pointer to a GUID, which is the file name to be written.
423*f439973dSWarner Losh   ///
424*f439973dSWarner Losh   EFI_GUID                  *NameGuid;
425*f439973dSWarner Losh   ///
426*f439973dSWarner Losh   /// Indicates the type of file to be written.
427*f439973dSWarner Losh   ///
428*f439973dSWarner Losh   EFI_FV_FILETYPE           Type;
429*f439973dSWarner Losh   ///
430*f439973dSWarner Losh   /// Indicates the attributes for the file to be written.
431*f439973dSWarner Losh   ///
432*f439973dSWarner Losh   EFI_FV_FILE_ATTRIBUTES    FileAttributes;
433*f439973dSWarner Losh   ///
434*f439973dSWarner Losh   /// Pointer to a buffer containing the file to be written.
435*f439973dSWarner Losh   ///
436*f439973dSWarner Losh   VOID                      *Buffer;
437*f439973dSWarner Losh   ///
438*f439973dSWarner Losh   /// Indicates the size of the file image contained in Buffer.
439*f439973dSWarner Losh   ///
440*f439973dSWarner Losh   UINT32                    BufferSize;
441*f439973dSWarner Losh } EFI_FV_WRITE_FILE_DATA;
442*f439973dSWarner Losh 
443*f439973dSWarner Losh /**
444*f439973dSWarner Losh   Locates the requested section within a file and returns it in a buffer.
445*f439973dSWarner Losh 
446*f439973dSWarner Losh   WriteFile() is used to write one or more files to a firmware
447*f439973dSWarner Losh   volume. Each file to be written is described by an
448*f439973dSWarner Losh   EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that
449*f439973dSWarner Losh   any required alignment for all files listed in the FileData
450*f439973dSWarner Losh   array is compatible with the firmware volume. Firmware volume
451*f439973dSWarner Losh   capabilities can be determined using the GetVolumeAttributes()
452*f439973dSWarner Losh   call. Similarly, if the WritePolicy is set to
453*f439973dSWarner Losh   EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume
454*f439973dSWarner Losh   capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the
455*f439973dSWarner Losh   firmware volume. EFI_FV_UNRELIABLE_WRITE must always be
456*f439973dSWarner Losh   supported. Writing a file with a size of zero
457*f439973dSWarner Losh   (FileData[n].BufferSize == 0) deletes the file from the firmware
458*f439973dSWarner Losh   volume if it exists. Deleting a file must be done one at a time.
459*f439973dSWarner Losh   Deleting a file as part of a multiple file write is not allowed.
460*f439973dSWarner Losh   Platform Initialization Specification VOLUME 3 Shared
461*f439973dSWarner Losh   Architectural Elements 84 August 21, 2006 Version 1.0
462*f439973dSWarner Losh   WriteFile() is callable only from TPL_NOTIFY and below.
463*f439973dSWarner Losh   Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is
464*f439973dSWarner Losh   undefined.
465*f439973dSWarner Losh 
466*f439973dSWarner Losh   @param This           Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
467*f439973dSWarner Losh 
468*f439973dSWarner Losh   @param NumberOfFiles  Indicates the number of elements in the array pointed to by FileData
469*f439973dSWarner Losh 
470*f439973dSWarner Losh   @param WritePolicy    Indicates the level of reliability for the
471*f439973dSWarner Losh                         write in the event of a power failure or
472*f439973dSWarner Losh                         other system failure during the write
473*f439973dSWarner Losh                         operation.
474*f439973dSWarner Losh 
475*f439973dSWarner Losh   @param FileData       Pointer to an array of
476*f439973dSWarner Losh                         EFI_FV_WRITE_FILE_DATA. Each element of
477*f439973dSWarner Losh                         FileData[] represents a file to be written.
478*f439973dSWarner Losh 
479*f439973dSWarner Losh 
480*f439973dSWarner Losh   @retval EFI_SUCCESS             The write completed successfully.
481*f439973dSWarner Losh 
482*f439973dSWarner Losh   @retval EFI_OUT_OF_RESOURCES    The firmware volume does not
483*f439973dSWarner Losh                                   have enough free space to
484*f439973dSWarner Losh                                   storefile(s).
485*f439973dSWarner Losh 
486*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR        A hardware error occurred when
487*f439973dSWarner Losh                                   attempting to access the firmware volume.
488*f439973dSWarner Losh 
489*f439973dSWarner Losh   @retval EFI_WRITE_PROTECTED     The firmware volume is
490*f439973dSWarner Losh                                   configured to disallow writes.
491*f439973dSWarner Losh 
492*f439973dSWarner Losh   @retval EFI_NOT_FOUND           A delete was requested, but the
493*f439973dSWarner Losh                                   requested file was not found in the
494*f439973dSWarner Losh                                   firmware volume.
495*f439973dSWarner Losh 
496*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER   A delete was requested with a
497*f439973dSWarner Losh                                   multiple file write.
498*f439973dSWarner Losh 
499*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER   An unsupported WritePolicy was
500*f439973dSWarner Losh                                   requested.
501*f439973dSWarner Losh 
502*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER   An unknown file type was
503*f439973dSWarner Losh                                   specified.
504*f439973dSWarner Losh 
505*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER   A file system specific error
506*f439973dSWarner Losh                                   has occurred.
507*f439973dSWarner Losh 
508*f439973dSWarner Losh **/
509*f439973dSWarner Losh typedef
510*f439973dSWarner Losh EFI_STATUS
511*f439973dSWarner Losh (EFIAPI *EFI_FV_WRITE_FILE)(
512*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
513*f439973dSWarner Losh   IN        UINT32                        NumberOfFiles,
514*f439973dSWarner Losh   IN        EFI_FV_WRITE_POLICY           WritePolicy,
515*f439973dSWarner Losh   IN        EFI_FV_WRITE_FILE_DATA        *FileData
516*f439973dSWarner Losh   );
517*f439973dSWarner Losh 
518*f439973dSWarner Losh /**
519*f439973dSWarner Losh   Retrieves information about the next file in the firmware volume store
520*f439973dSWarner Losh   that matches the search criteria.
521*f439973dSWarner Losh 
522*f439973dSWarner Losh   GetNextFile() is the interface that is used to search a firmware
523*f439973dSWarner Losh   volume for a particular file. It is called successively until
524*f439973dSWarner Losh   the desired file is located or the function returns
525*f439973dSWarner Losh    EFI_NOT_FOUND. To filter uninteresting files from the output,
526*f439973dSWarner Losh   the type of file to search for may be specified in FileType. For
527*f439973dSWarner Losh   example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of
528*f439973dSWarner Losh   this type will be returned in the output. If *FileType is
529*f439973dSWarner Losh   EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key
530*f439973dSWarner Losh   parameter is used to indicate a starting point of the search. If
531*f439973dSWarner Losh   the buffer *Key is completely initialized to zero, the search
532*f439973dSWarner Losh   re-initialized and starts at the beginning. Subsequent calls to
533*f439973dSWarner Losh   GetNextFile() must maintain the value of *Key returned by the
534*f439973dSWarner Losh   immediately previous call. The actual contents of *Key are
535*f439973dSWarner Losh   implementation specific and no semantic content is implied.
536*f439973dSWarner Losh   GetNextFile() is callable only from TPL_NOTIFY and below.
537*f439973dSWarner Losh   Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is
538*f439973dSWarner Losh   undefined.
539*f439973dSWarner Losh 
540*f439973dSWarner Losh   @param This       Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
541*f439973dSWarner Losh 
542*f439973dSWarner Losh   @param Key        Pointer to a caller-allocated buffer that contains implementation-specific data that is
543*f439973dSWarner Losh                     used to track where to begin the search for the next file. The size of the buffer must be
544*f439973dSWarner Losh                     at least This->KeySize bytes long. To re-initialize the search and begin from the
545*f439973dSWarner Losh                     beginning of the firmware volume, the entire buffer must be cleared to zero. Other
546*f439973dSWarner Losh                     than clearing the buffer to initiate a new search, the caller must not modify the data in
547*f439973dSWarner Losh                     the buffer between calls to GetNextFile().
548*f439973dSWarner Losh 
549*f439973dSWarner Losh   @param FileType   Pointer to a caller-allocated
550*f439973dSWarner Losh                     EFI_FV_FILETYPE. The GetNextFile() API can
551*f439973dSWarner Losh                     filter its search for files based on the
552*f439973dSWarner Losh                     value of the FileType input. A *FileType
553*f439973dSWarner Losh                     input of EFI_FV_FILETYPE_ALL causes
554*f439973dSWarner Losh                     GetNextFile() to search for files of all
555*f439973dSWarner Losh                     types. If a file is found, the file's type
556*f439973dSWarner Losh                     is returned in FileType. *FileType is not
557*f439973dSWarner Losh                     modified if no file is found.
558*f439973dSWarner Losh 
559*f439973dSWarner Losh   @param NameGuid   Pointer to a caller-allocated EFI_GUID. If a
560*f439973dSWarner Losh                     matching file is found, the file's name is
561*f439973dSWarner Losh                     returned in NameGuid. If no matching file is
562*f439973dSWarner Losh                     found, *NameGuid is not modified.
563*f439973dSWarner Losh 
564*f439973dSWarner Losh   @param Attributes Pointer to a caller-allocated
565*f439973dSWarner Losh                     EFI_FV_FILE_ATTRIBUTES. If a matching file
566*f439973dSWarner Losh                     is found, the file's attributes are returned
567*f439973dSWarner Losh                     in Attributes. If no matching file is found,
568*f439973dSWarner Losh                     Attributes is not modified. Type
569*f439973dSWarner Losh                     EFI_FV_FILE_ATTRIBUTES is defined in
570*f439973dSWarner Losh                     ReadFile().
571*f439973dSWarner Losh 
572*f439973dSWarner Losh   @param Size       Pointer to a caller-allocated UINTN. If a
573*f439973dSWarner Losh                     matching file is found, the file's size is
574*f439973dSWarner Losh                     returned in *Size. If no matching file is found,
575*f439973dSWarner Losh                     Size is not modified.
576*f439973dSWarner Losh 
577*f439973dSWarner Losh   @retval EFI_SUCCESS       The output parameters are filled with data
578*f439973dSWarner Losh                             obtained from the first matching file that
579*f439973dSWarner Losh                             was found.
580*f439973dSWarner Losh 
581*f439973dSWarner Losh   @retval FI_NOT_FOUND      No files of type FileType were found.
582*f439973dSWarner Losh 
583*f439973dSWarner Losh 
584*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR  A hardware error occurred when
585*f439973dSWarner Losh                             attempting to access the firmware
586*f439973dSWarner Losh                             volume.
587*f439973dSWarner Losh 
588*f439973dSWarner Losh   @retval EFI_ACCESS_DENIED The firmware volume is configured to
589*f439973dSWarner Losh                             disallow reads.
590*f439973dSWarner Losh 
591*f439973dSWarner Losh 
592*f439973dSWarner Losh **/
593*f439973dSWarner Losh typedef
594*f439973dSWarner Losh EFI_STATUS
595*f439973dSWarner Losh (EFIAPI *EFI_FV_GET_NEXT_FILE)(
596*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
597*f439973dSWarner Losh   IN OUT    VOID                          *Key,
598*f439973dSWarner Losh   IN OUT    EFI_FV_FILETYPE               *FileType,
599*f439973dSWarner Losh   OUT       EFI_GUID                      *NameGuid,
600*f439973dSWarner Losh   OUT       EFI_FV_FILE_ATTRIBUTES        *Attributes,
601*f439973dSWarner Losh   OUT       UINTN                         *Size
602*f439973dSWarner Losh   );
603*f439973dSWarner Losh 
604*f439973dSWarner Losh /**
605*f439973dSWarner Losh   Return information about a firmware volume.
606*f439973dSWarner Losh 
607*f439973dSWarner Losh   The GetInfo() function returns information of type
608*f439973dSWarner Losh   InformationType for the requested firmware volume. If the volume
609*f439973dSWarner Losh   does not support the requested information type, then
610*f439973dSWarner Losh   EFI_UNSUPPORTED is returned. If the buffer is not large enough
611*f439973dSWarner Losh   to hold the requested structure, EFI_BUFFER_TOO_SMALL is
612*f439973dSWarner Losh   returned and the BufferSize is set to the size of buffer that is
613*f439973dSWarner Losh   required to make the request. The information types defined by
614*f439973dSWarner Losh   this specification are required information types that all file
615*f439973dSWarner Losh   systems must support.
616*f439973dSWarner Losh 
617*f439973dSWarner Losh   @param This             A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
618*f439973dSWarner Losh                           instance that is the file handle the requested
619*f439973dSWarner Losh                           information is for.
620*f439973dSWarner Losh 
621*f439973dSWarner Losh   @param InformationType  The type identifier for the
622*f439973dSWarner Losh                           information being requested.
623*f439973dSWarner Losh 
624*f439973dSWarner Losh   @param BufferSize       On input, the size of Buffer. On output,
625*f439973dSWarner Losh                           the amount of data returned in Buffer. In
626*f439973dSWarner Losh                           both cases, the size is measured in bytes.
627*f439973dSWarner Losh 
628*f439973dSWarner Losh   @param Buffer           A pointer to the data buffer to return. The
629*f439973dSWarner Losh                           buffer's type is indicated by InformationType.
630*f439973dSWarner Losh 
631*f439973dSWarner Losh 
632*f439973dSWarner Losh   @retval EFI_SUCCESS           The information was retrieved.
633*f439973dSWarner Losh 
634*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       The InformationType is not known.
635*f439973dSWarner Losh 
636*f439973dSWarner Losh   @retval EFI_NO_MEDIA          The device has no medium.
637*f439973dSWarner Losh 
638*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR      The device reported an error.
639*f439973dSWarner Losh 
640*f439973dSWarner Losh   @retval EFI_VOLUME_CORRUPTED  The file system structures are
641*f439973dSWarner Losh                                 corrupted.
642*f439973dSWarner Losh 
643*f439973dSWarner Losh   @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small to
644*f439973dSWarner Losh                                 read the current directory
645*f439973dSWarner Losh                                 entry. BufferSize has been
646*f439973dSWarner Losh                                 updated with the size needed to
647*f439973dSWarner Losh                                 complete the request.
648*f439973dSWarner Losh 
649*f439973dSWarner Losh 
650*f439973dSWarner Losh **/
651*f439973dSWarner Losh typedef
652*f439973dSWarner Losh EFI_STATUS
653*f439973dSWarner Losh (EFIAPI *EFI_FV_GET_INFO)(
654*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
655*f439973dSWarner Losh   IN CONST  EFI_GUID                      *InformationType,
656*f439973dSWarner Losh   IN OUT    UINTN                         *BufferSize,
657*f439973dSWarner Losh   OUT       VOID                          *Buffer
658*f439973dSWarner Losh   );
659*f439973dSWarner Losh 
660*f439973dSWarner Losh /**
661*f439973dSWarner Losh   Sets information about a firmware volume.
662*f439973dSWarner Losh 
663*f439973dSWarner Losh   The SetInfo() function sets information of type InformationType
664*f439973dSWarner Losh   on the requested firmware volume.
665*f439973dSWarner Losh 
666*f439973dSWarner Losh 
667*f439973dSWarner Losh   @param This             A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
668*f439973dSWarner Losh                           instance that is the file handle the information
669*f439973dSWarner Losh                           is for.
670*f439973dSWarner Losh 
671*f439973dSWarner Losh   @param InformationType  The type identifier for the
672*f439973dSWarner Losh                           information being set.
673*f439973dSWarner Losh 
674*f439973dSWarner Losh   @param BufferSize       The size, in bytes, of Buffer.
675*f439973dSWarner Losh 
676*f439973dSWarner Losh   @param Buffer           A pointer to the data buffer to write. The
677*f439973dSWarner Losh                           buffer's type is indicated by InformationType.
678*f439973dSWarner Losh 
679*f439973dSWarner Losh   @retval EFI_SUCCESS           The information was set.
680*f439973dSWarner Losh 
681*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       The InformationType is not known.
682*f439973dSWarner Losh 
683*f439973dSWarner Losh   @retval EFI_NO_MEDIA          The device has no medium.
684*f439973dSWarner Losh 
685*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR      The device reported an error.
686*f439973dSWarner Losh 
687*f439973dSWarner Losh   @retval EFI_VOLUME_CORRUPTED  The file system structures are
688*f439973dSWarner Losh                                 corrupted.
689*f439973dSWarner Losh 
690*f439973dSWarner Losh 
691*f439973dSWarner Losh   @retval EFI_WRITE_PROTECTED   The media is read only.
692*f439973dSWarner Losh 
693*f439973dSWarner Losh   @retval EFI_VOLUME_FULL       The volume is full.
694*f439973dSWarner Losh 
695*f439973dSWarner Losh   @retval EFI_BAD_BUFFER_SIZE   BufferSize is smaller than the
696*f439973dSWarner Losh                                 size of the type indicated by
697*f439973dSWarner Losh                                 InformationType.
698*f439973dSWarner Losh 
699*f439973dSWarner Losh **/
700*f439973dSWarner Losh typedef
701*f439973dSWarner Losh EFI_STATUS
702*f439973dSWarner Losh (EFIAPI *EFI_FV_SET_INFO)(
703*f439973dSWarner Losh   IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
704*f439973dSWarner Losh   IN CONST  EFI_GUID                      *InformationType,
705*f439973dSWarner Losh   IN        UINTN                         BufferSize,
706*f439973dSWarner Losh   IN CONST  VOID                          *Buffer
707*f439973dSWarner Losh   );
708*f439973dSWarner Losh 
709*f439973dSWarner Losh ///
710*f439973dSWarner Losh /// The Firmware Volume Protocol contains the file-level
711*f439973dSWarner Losh /// abstraction to the firmware volume as well as some firmware
712*f439973dSWarner Losh /// volume attribute reporting and configuration services. The
713*f439973dSWarner Losh /// Firmware Volume Protocol is the interface used by all parts of
714*f439973dSWarner Losh /// DXE that are not directly involved with managing the firmware
715*f439973dSWarner Losh /// volume itself. This abstraction allows many varied types of
716*f439973dSWarner Losh /// firmware volume implementations. A firmware volume may be a
717*f439973dSWarner Losh /// flash device or it may be a file in the UEFI system partition,
718*f439973dSWarner Losh /// for example. This level of firmware volume implementation
719*f439973dSWarner Losh /// detail is not visible to the consumers of the Firmware Volume
720*f439973dSWarner Losh /// Protocol.
721*f439973dSWarner Losh ///
722*f439973dSWarner Losh struct _EFI_FIRMWARE_VOLUME2_PROTOCOL {
723*f439973dSWarner Losh   EFI_FV_GET_ATTRIBUTES    GetVolumeAttributes;
724*f439973dSWarner Losh   EFI_FV_SET_ATTRIBUTES    SetVolumeAttributes;
725*f439973dSWarner Losh   EFI_FV_READ_FILE         ReadFile;
726*f439973dSWarner Losh   EFI_FV_READ_SECTION      ReadSection;
727*f439973dSWarner Losh   EFI_FV_WRITE_FILE        WriteFile;
728*f439973dSWarner Losh   EFI_FV_GET_NEXT_FILE     GetNextFile;
729*f439973dSWarner Losh 
730*f439973dSWarner Losh   ///
731*f439973dSWarner Losh   /// Data field that indicates the size in bytes
732*f439973dSWarner Losh   /// of the Key input buffer for the
733*f439973dSWarner Losh   /// GetNextFile() API.
734*f439973dSWarner Losh   ///
735*f439973dSWarner Losh   UINT32                   KeySize;
736*f439973dSWarner Losh 
737*f439973dSWarner Losh   ///
738*f439973dSWarner Losh   /// Handle of the parent firmware volume.
739*f439973dSWarner Losh   ///
740*f439973dSWarner Losh   EFI_HANDLE               ParentHandle;
741*f439973dSWarner Losh   EFI_FV_GET_INFO          GetInfo;
742*f439973dSWarner Losh   EFI_FV_SET_INFO          SetInfo;
743*f439973dSWarner Losh };
744*f439973dSWarner Losh 
745*f439973dSWarner Losh extern EFI_GUID  gEfiFirmwareVolume2ProtocolGuid;
746*f439973dSWarner Losh 
747*f439973dSWarner Losh #endif
748