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