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