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