]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | FirmwareVolume.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Firmware Volume protocol as defined in the Tiano Firmware Volume\r | |
19 | specification.\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
23 | #ifndef _FW_VOL_H_\r | |
24 | #define _FW_VOL_H_\r | |
25 | \r | |
26 | //\r | |
27 | // Statements that include other files\r | |
28 | //\r | |
29 | #include "EfiFirmwareVolumeHeader.h"\r | |
30 | #include "EfiFirmwareFileSystem.h"\r | |
31 | #include "EfiFirmwareVolume.h"\r | |
32 | //\r | |
33 | // Firmware Volume Protocol GUID definition\r | |
34 | //\r | |
35 | #define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \\r | |
36 | { \\r | |
37 | 0x389F751F, 0x1838, 0x4388, 0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 \\r | |
38 | }\r | |
39 | \r | |
40 | \r | |
3eb9473e | 41 | //\r |
42 | // ************************************************************\r | |
43 | // EFI_FV_ATTRIBUTES bit definitions\r | |
44 | // ************************************************************\r | |
45 | //\r | |
46 | #define EFI_FV_READ_DISABLE_CAP 0x0000000000000001\r | |
47 | #define EFI_FV_READ_ENABLE_CAP 0x0000000000000002\r | |
48 | #define EFI_FV_READ_STATUS 0x0000000000000004\r | |
49 | \r | |
50 | #define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008\r | |
51 | #define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010\r | |
52 | #define EFI_FV_WRITE_STATUS 0x0000000000000020\r | |
53 | \r | |
54 | #define EFI_FV_LOCK_CAP 0x0000000000000040\r | |
55 | #define EFI_FV_LOCK_STATUS 0x0000000000000080\r | |
56 | #define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100\r | |
57 | \r | |
58 | #define EFI_FV_ALIGNMENT_CAP 0x0000000000008000\r | |
59 | #define EFI_FV_ALIGNMENT_2 0x0000000000010000\r | |
60 | #define EFI_FV_ALIGNMENT_4 0x0000000000020000\r | |
61 | #define EFI_FV_ALIGNMENT_8 0x0000000000040000\r | |
62 | #define EFI_FV_ALIGNMENT_16 0x0000000000080000\r | |
63 | #define EFI_FV_ALIGNMENT_32 0x0000000000100000\r | |
64 | #define EFI_FV_ALIGNMENT_64 0x0000000000200000\r | |
65 | #define EFI_FV_ALIGNMENT_128 0x0000000000400000\r | |
66 | #define EFI_FV_ALIGNMENT_256 0x0000000000800000\r | |
67 | #define EFI_FV_ALIGNMENT_512 0x0000000001000000\r | |
68 | #define EFI_FV_ALIGNMENT_1K 0x0000000002000000\r | |
69 | #define EFI_FV_ALIGNMENT_2K 0x0000000004000000\r | |
70 | #define EFI_FV_ALIGNMENT_4K 0x0000000008000000\r | |
71 | #define EFI_FV_ALIGNMENT_8K 0x0000000010000000\r | |
72 | #define EFI_FV_ALIGNMENT_16K 0x0000000020000000\r | |
73 | #define EFI_FV_ALIGNMENT_32K 0x0000000040000000\r | |
74 | #define EFI_FV_ALIGNMENT_64K 0x0000000080000000\r | |
75 | \r | |
76 | //\r | |
77 | // Protocol API definitions\r | |
78 | //\r | |
79 | //\r | |
80 | // Forward declaration of protocol data structure\r | |
81 | //\r | |
82 | typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;\r | |
83 | \r | |
84 | typedef\r | |
85 | EFI_STATUS\r | |
86 | (EFIAPI *FV_GET_ATTRIBUTES) (\r | |
87 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
88 | OUT EFI_FV_ATTRIBUTES * Attributes\r | |
89 | );\r | |
90 | \r | |
91 | /*++\r | |
92 | \r | |
93 | Routine Description:\r | |
94 | Retrieves attributes, insures positive polarity of attribute bits, returns\r | |
95 | resulting attributes in output parameter\r | |
96 | \r | |
97 | Arguments:\r | |
98 | This - Calling context\r | |
99 | Attributes - output buffer which contains attributes\r | |
100 | \r | |
101 | Returns:\r | |
102 | EFI_INVALID_PARAMETER\r | |
103 | EFI_SUCCESS\r | |
104 | \r | |
105 | --*/\r | |
106 | typedef\r | |
107 | EFI_STATUS\r | |
108 | (EFIAPI *FV_SET_ATTRIBUTES) (\r | |
109 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
110 | IN OUT EFI_FV_ATTRIBUTES * Attributes\r | |
111 | );\r | |
112 | \r | |
113 | /*++\r | |
114 | \r | |
115 | Routine Description:\r | |
116 | Sets volume attributes\r | |
117 | \r | |
118 | Arguments:\r | |
119 | This Calling context\r | |
120 | Attributes Buffer which contains attributes\r | |
121 | \r | |
122 | Returns:\r | |
123 | EFI_INVALID_PARAMETER\r | |
124 | EFI_DEVICE_ERROR\r | |
125 | EFI_SUCCESS\r | |
126 | \r | |
127 | --*/\r | |
128 | \r | |
129 | typedef\r | |
130 | EFI_STATUS\r | |
131 | (EFIAPI *FV_READ_FILE) (\r | |
132 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
133 | IN EFI_GUID * NameGuid,\r | |
134 | IN OUT VOID **Buffer,\r | |
135 | IN OUT UINTN *BufferSize,\r | |
136 | OUT EFI_FV_FILETYPE * FoundType,\r | |
137 | OUT EFI_FV_FILE_ATTRIBUTES * FileAttributes,\r | |
138 | OUT UINT32 *AuthenticationStatus\r | |
139 | );\r | |
140 | \r | |
141 | /*++\r | |
142 | \r | |
143 | Routine Description:\r | |
144 | Read the requested file (NameGuid) and returns data in Buffer.\r | |
145 | \r | |
146 | Arguments:\r | |
147 | This - Calling context\r | |
148 | NameGuid - Filename identifying which file to read \r | |
149 | Buffer - Pointer to pointer to buffer in which contents of file are returned.\r | |
150 | \r | |
151 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
152 | there is no output buffer.\r | |
153 | \r | |
154 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
155 | from BS pool by ReadFile\r | |
156 | \r | |
157 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
158 | allocated by the caller and is being passed in.\r | |
159 | \r | |
160 | BufferSize - Indicates the buffer size passed in, and on output the size\r | |
161 | required to complete the read\r | |
162 | FoundType - Indicates the type of the file who's data is returned\r | |
163 | FileAttributes - Indicates the attributes of the file who's data is resturned\r | |
164 | AuthenticationStatus - Indicates the authentication status of the data\r | |
165 | \r | |
166 | Returns:\r | |
167 | EFI_SUCCESS\r | |
168 | EFI_WARN_BUFFER_TOO_SMALL\r | |
169 | EFI_NOT_FOUND\r | |
170 | EFI_DEVICE_ERROR\r | |
171 | EFI_ACCESS_DENIED\r | |
172 | \r | |
173 | --*/\r | |
174 | typedef\r | |
175 | EFI_STATUS\r | |
176 | (EFIAPI *FV_READ_SECTION) (\r | |
177 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
178 | IN EFI_GUID * NameGuid,\r | |
179 | IN EFI_SECTION_TYPE SectionType,\r | |
180 | IN UINTN SectionInstance,\r | |
181 | IN OUT VOID **Buffer,\r | |
182 | IN OUT UINTN *BufferSize,\r | |
183 | OUT UINT32 *AuthenticationStatus\r | |
184 | );\r | |
185 | \r | |
186 | /*++\r | |
187 | \r | |
188 | Routine Description:\r | |
189 | Read the requested section from the specified file and returns data in Buffer.\r | |
190 | \r | |
191 | Arguments:\r | |
192 | This - Calling context\r | |
193 | NameGuid - Filename identifying the file from which to read \r | |
194 | SectionType - Indicates what section type to retrieve\r | |
195 | SectionInstance - Indicates which instance of SectionType to retrieve\r | |
196 | Buffer - Pointer to pointer to buffer in which contents of file are returned.\r | |
197 | \r | |
198 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
199 | there is no output buffer.\r | |
200 | \r | |
201 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
202 | from BS pool by ReadFile\r | |
203 | \r | |
204 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
205 | allocated by the caller and is being passed in.\r | |
206 | \r | |
207 | BufferSize - Indicates the buffer size passed in, and on output the size\r | |
208 | required to complete the read\r | |
209 | AuthenticationStatus - Indicates the authentication status of the data\r | |
210 | \r | |
211 | Returns:\r | |
212 | EFI_SUCCESS\r | |
213 | EFI_WARN_BUFFER_TOO_SMALL\r | |
214 | EFI_OUT_OF_RESOURCES\r | |
215 | EFI_NOT_FOUND\r | |
216 | EFI_DEVICE_ERROR\r | |
217 | EFI_ACCESS_DENIED\r | |
218 | \r | |
219 | --*/\r | |
220 | \r | |
221 | typedef\r | |
222 | EFI_STATUS\r | |
223 | (EFIAPI *FV_WRITE_FILE) (\r | |
224 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
225 | IN UINT32 NumberOfFiles,\r | |
226 | IN EFI_FV_WRITE_POLICY WritePolicy,\r | |
227 | IN EFI_FV_WRITE_FILE_DATA * FileData\r | |
228 | );\r | |
229 | \r | |
230 | /*++\r | |
231 | \r | |
232 | Routine Description:\r | |
233 | Write the supplied file (NameGuid) to the FV.\r | |
234 | \r | |
235 | Arguments:\r | |
236 | This - Calling context\r | |
237 | NumberOfFiles - Indicates the number of file records pointed to by FileData\r | |
238 | WritePolicy - Indicates the level of reliability of the write with respect to\r | |
239 | things like power failure events.\r | |
240 | FileData - A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each\r | |
241 | element in the array indicates a file to write, and there are\r | |
242 | NumberOfFiles elements in the input array.\r | |
243 | \r | |
244 | Returns:\r | |
245 | EFI_SUCCESS\r | |
246 | EFI_OUT_OF_RESOURCES\r | |
247 | EFI_DEVICE_ERROR\r | |
248 | EFI_WRITE_PROTECTED\r | |
249 | EFI_NOT_FOUND\r | |
250 | EFI_INVALID_PARAMETER\r | |
251 | \r | |
252 | --*/\r | |
253 | typedef\r | |
254 | EFI_STATUS\r | |
255 | (EFIAPI *FV_GET_NEXT_FILE) (\r | |
256 | IN EFI_FIRMWARE_VOLUME_PROTOCOL * This,\r | |
257 | IN OUT VOID *Key,\r | |
258 | IN OUT EFI_FV_FILETYPE * FileType,\r | |
259 | OUT EFI_GUID * NameGuid,\r | |
260 | OUT EFI_FV_FILE_ATTRIBUTES * Attributes,\r | |
261 | OUT UINTN *Size\r | |
262 | );\r | |
263 | \r | |
264 | /*++\r | |
265 | \r | |
266 | Routine Description:\r | |
267 | Given the input key, search for the next matching file in the volume.\r | |
268 | \r | |
269 | Arguments:\r | |
270 | This - Calling context\r | |
271 | Key - Pointer to a caller allocated buffer that contains an implementation\r | |
272 | specific key that is used to track where to begin searching on\r | |
273 | successive calls.\r | |
274 | FileType - Indicates the file type to filter for\r | |
275 | NameGuid - Guid filename of the file found\r | |
276 | Attributes - Attributes of the file found\r | |
277 | Size - Size in bytes of the file found\r | |
278 | \r | |
279 | Returns:\r | |
280 | EFI_SUCCESS\r | |
281 | EFI_NOT_FOUND\r | |
282 | EFI_DEVICE_ERROR\r | |
283 | EFI_ACCESS_DENIED\r | |
284 | \r | |
285 | --*/\r | |
5d46191d | 286 | struct _EFI_FIRMWARE_VOLUME_PROTOCOL {\r |
3eb9473e | 287 | FV_GET_ATTRIBUTES GetVolumeAttributes;\r |
288 | FV_SET_ATTRIBUTES SetVolumeAttributes;\r | |
289 | FV_READ_FILE ReadFile;\r | |
290 | FV_READ_SECTION ReadSection;\r | |
291 | FV_WRITE_FILE WriteFile;\r | |
292 | FV_GET_NEXT_FILE GetNextFile;\r | |
293 | UINT32 KeySize;\r | |
294 | EFI_HANDLE ParentHandle;\r | |
5d46191d | 295 | };\r |
3eb9473e | 296 | \r |
297 | extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;\r | |
298 | \r | |
299 | #endif\r |