]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/FrameworkFirmwareVolumeBlock.h
Clean up doxygen comments
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / FrameworkFirmwareVolumeBlock.h
CommitLineData
220c61c1 1/** @file\r
2 This file provides control over block-oriented firmware devices.\r
3\r
4 Copyright (c) 2006 - 2008, 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 @par Revision Reference: \r
14 This protocol is defined in framework spec: Firmware Volume Block specification\r
15\r
16**/\r
17\r
18#ifndef __FRAMEWORK_FIRMWARE_VOLUME_BLOCK_H__\r
19#define __FRAMEWORK_FIRMWARE_VOLUME_BLOCK_H__\r
20\r
220c61c1 21\r
22typedef struct _FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL;\r
23///\r
24/// type of EFI FVB attribute per Frameowrk spec\r
25/// \r
26typedef UINT32 EFI_FVB_ATTRIBUTES;\r
27\r
28/**\r
29 The GetAttributes() function retrieves the attributes and\r
30 current settings of the block. Status Codes Returned\r
31\r
32 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
33\r
34 @param Attributes Pointer to EFI_FVB_ATTRIBUTES in which the\r
35 attributes and current settings are\r
36 returned. \r
37\r
38 @retval EFI_SUCCESS The firmware volume attributes were\r
39 returned.\r
40\r
41**/\r
42typedef\r
43EFI_STATUS\r
44(EFIAPI * FRAMEWORK_EFI_FVB_GET_ATTRIBUTES)(\r
45 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
46 OUT EFI_FVB_ATTRIBUTES *Attributes\r
47);\r
48\r
49\r
50/**\r
51 The SetAttributes() function sets configurable firmware volume\r
52 attributes and returns the new settings of the firmware volume.\r
53\r
54 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
55\r
56 @param Attributes On input, Attributes is a pointer to\r
57 EFI_FVB_ATTRIBUTES that contains the\r
58 desired firmware volume settings. On\r
59 successful return, it contains the new\r
60 settings of the firmware volume. \r
61 \r
62 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
63\r
64 @retval EFI_INVALID_PARAMETER The attributes requested are in\r
65 conflict with the capabilities\r
66 as declared in the firmware\r
67 volume header.\r
68\r
69**/\r
70typedef\r
71EFI_STATUS\r
72(EFIAPI * FRAMEWORK_EFI_FVB_SET_ATTRIBUTES)(\r
73 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
74 IN OUT EFI_FVB_ATTRIBUTES *Attributes\r
75);\r
76\r
77\r
78/**\r
79 The GetPhysicalAddress() function retrieves the base address of\r
80 a memory-mapped firmware volume. This function should be called\r
81 only for memory-mapped firmware volumes.\r
82\r
83 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
84 \r
85 @param Address Pointer to a caller-allocated\r
86 EFI_PHYSICAL_ADDRESS that, on successful\r
87 return from GetPhysicalAddress(), contains the\r
88 base address of the firmware volume.\r
89 \r
90 @retval EFI_SUCCESS The firmware volume base address is returned.\r
91 \r
92 @retval EFI_NOT_SUPPORTED The firmware volume is not memory mapped.\r
93\r
94**/\r
95typedef\r
96EFI_STATUS\r
97(EFIAPI * FRAMEWORK_EFI_FVB_GET_PHYSICAL_ADDRESS)(\r
98 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
99 OUT EFI_PHYSICAL_ADDRESS *Address\r
100);\r
101\r
102/**\r
103 The GetBlockSize() function retrieves the size of the requested\r
104 block. It also returns the number of additional blocks with\r
105 the identical size. The GetBlockSize() function is used to\r
106 retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).\r
107\r
108\r
109 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
110\r
111 @param Lba Indicates the block for which to return the size.\r
112\r
113 @param BlockSize Pointer to a caller-allocated UINTN in which\r
114 the size of the block is returned.\r
115\r
116 @param NumberOfBlocks Pointer to a caller-allocated UINTN in\r
117 which the number of consecutive blocks,\r
118 starting with Lba, is returned. All\r
119 blocks in this range have a size of\r
120 BlockSize.\r
121\r
122 \r
123 @retval EFI_SUCCESS The firmware volume base address is returned.\r
124 \r
125 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.\r
126\r
127**/\r
128typedef\r
129EFI_STATUS\r
130(EFIAPI * FRAMEWORK_EFI_FVB_GET_BLOCK_SIZE)(\r
131 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
132 IN EFI_LBA Lba,\r
133 OUT UINTN *BlockSize,\r
134 OUT UINTN *NumberOfBlocks\r
135);\r
136\r
137\r
138/**\r
139 Reads the specified number of bytes into a buffer from the specified block.\r
140\r
141 The Read() function reads the requested number of bytes from the\r
142 requested block and stores them in the provided buffer.\r
143 Implementations should be mindful that the firmware volume\r
144 might be in the ReadDisabled state. If it is in this state,\r
145 the Read() function must return the status code\r
146 EFI_ACCESS_DENIED without modifying the contents of the\r
147 buffer. The Read() function must also prevent spanning block\r
148 boundaries. If a read is requested that would span a block\r
149 boundary, the read must read up to the boundary but not\r
150 beyond. The output parameter NumBytes must be set to correctly\r
151 indicate the number of bytes actually read. The caller must be\r
152 aware that a read may be partially completed.\r
153\r
154 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
155 \r
156 @param Lba The starting logical block index\r
157 from which to read.\r
158\r
159 @param Offset Offset into the block at which to begin reading.\r
160\r
161 @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
162 contains the total size of the buffer. At\r
163 exit, *NumBytes contains the total number of\r
164 bytes read.\r
165\r
166 @param Buffer Pointer to a caller-allocated buffer that will\r
167 be used to hold the data that is read.\r
168\r
169 @retval EFI_SUCCESS The firmware volume was read successfully\r
170 and contents are in Buffer.\r
171 \r
172 @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA\r
173 boundary. On output, NumBytes\r
174 contains the total number of bytes\r
175 returned in Buffer.\r
176 \r
177 @retval EFI_ACCESS_DENIED The firmware volume is in the\r
178 ReadDisabled state.\r
179 \r
180 @retval EFI_DEVICE_ERROR The block device is not\r
181 functioning correctly and could\r
182 not be read.\r
183\r
184**/\r
185typedef\r
186EFI_STATUS\r
187(EFIAPI *FRAMEWORK_EFI_FVB_READ)(\r
188 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
189 IN EFI_LBA Lba,\r
190 IN UINTN Offset,\r
191 IN OUT UINTN *NumBytes,\r
192 IN OUT UINT8 *Buffer\r
193);\r
194\r
195/**\r
196 Writes the specified number of bytes from the input buffer to the block.\r
197\r
198 The Write() function writes the specified number of bytes from\r
199 the provided buffer to the specified block and offset. If the\r
200 firmware volume is sticky write, the caller must ensure that\r
201 all the bits of the specified range to write are in the\r
202 EFI_FVB_ERASE_POLARITY state before calling the Write()\r
203 function, or else the result will be unpredictable. This\r
204 unpredictability arises because, for a sticky-write firmware\r
205 volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY\r
206 state but cannot flip it back again. In general, before\r
207 calling the Write() function, the caller should call the\r
208 EraseBlocks() function first to erase the specified block to\r
209 write. A block erase cycle will transition bits from the\r
210 (NOT)EFI_FVB_ERASE_POLARITY state back to the\r
211 EFI_FVB_ERASE_POLARITY state. Implementations should be\r
212 mindful that the firmware volume might be in the WriteDisabled\r
213 state. If it is in this state, the Write() function must\r
214 return the status code EFI_ACCESS_DENIED without modifying the\r
215 contents of the firmware volume. The Write() function must\r
216 also prevent spanning block boundaries. If a write is\r
217 requested that spans a block boundary, the write must store up\r
218 to the boundary but not beyond. The output parameter NumBytes\r
219 must be set to correctly indicate the number of bytes actually\r
220 written. The caller must be aware that a write may be\r
221 partially completed. All writes, partial or otherwise, must be\r
222 fully flushed to the hardware before the Write() service\r
223 returns.\r
224\r
225 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL instance.\r
226 \r
227 @param Lba The starting logical block index to write to.\r
228 \r
229 @param Offset Offset into the block at which to begin writing.\r
230 \r
231 @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
232 contains the total size of the buffer. At\r
233 exit, *NumBytes contains the total number of\r
234 bytes actually written.\r
235 \r
236 @param Buffer Pointer to a caller-allocated buffer that\r
237 contains the source for the write.\r
238 \r
239 @retval EFI_SUCCESS The firmware volume was written successfully.\r
240 \r
241 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an\r
242 LBA boundary. On output, NumBytes\r
243 contains the total number of bytes\r
244 actually written.\r
245 \r
246 @retval EFI_ACCESS_DENIED The firmware volume is in the\r
247 WriteDisabled state.\r
248 \r
249 @retval EFI_DEVICE_ERROR The block device is malfunctioning\r
250 and could not be written.\r
251\r
252\r
253**/\r
254typedef\r
255EFI_STATUS\r
256(EFIAPI * FRAMEWORK_EFI_FVB_WRITE)(\r
257 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
258 IN EFI_LBA Lba,\r
259 IN UINTN Offset,\r
260 IN OUT UINTN *NumBytes,\r
261 IN UINT8 *Buffer\r
262);\r
263\r
264\r
265\r
266\r
267///\r
268/// EFI_LBA_LIST_TERMINATOR\r
269///\r
270#define FRAMEWORK_EFI_LBA_LIST_TERMINATOR 0xFFFFFFFFFFFFFFFFULL\r
271\r
272\r
273/**\r
274 Erases and initializes a firmware volume block.\r
275\r
276 The EraseBlocks() function erases one or more blocks as denoted\r
277 by the variable argument list. The entire parameter list of\r
278 blocks must be verified before erasing any blocks. If a block is\r
279 requested that does not exist within the associated firmware\r
280 volume (it has a larger index than the last block of the\r
281 firmware volume), the EraseBlocks() function must return the\r
282 status code EFI_INVALID_PARAMETER without modifying the contents\r
283 of the firmware volume. Implementations should be mindful that\r
284 the firmware volume might be in the WriteDisabled state. If it\r
285 is in this state, the EraseBlocks() function must return the\r
286 status code EFI_ACCESS_DENIED without modifying the contents of\r
287 the firmware volume. All calls to EraseBlocks() must be fully\r
288 flushed to the hardware before the EraseBlocks() service\r
289 returns.\r
290\r
291 @param This Indicates the FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
292 instance.\r
293\r
294 @param ... The variable argument list is a list of tuples.\r
295 Each tuple describes a range of LBAs to erase\r
296 and consists of the following:\r
297 - An EFI_LBA that indicates the starting LBA\r
298 - A UINTN that indicates the number of blocks to\r
299 erase\r
300\r
301 The list is terminated with an\r
302 EFI_LBA_LIST_TERMINATOR. For example, the\r
303 following indicates that two ranges of blocks\r
304 (5-7 and 10-11) are to be erased: EraseBlocks\r
305 (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);\r
306\r
307 @retval EFI_SUCCESS The erase request was successfully\r
308 completed.\r
309 \r
310 @retval EFI_ACCESS_DENIED The firmware volume is in the\r
311 WriteDisabled state.\r
312 @retval EFI_DEVICE_ERROR The block device is not functioning\r
313 correctly and could not be written.\r
314 The firmware device may have been\r
315 partially erased.\r
316 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed\r
317 in the variable argument list do\r
318 not exist in the firmware volume. \r
319\r
320**/\r
321typedef\r
322EFI_STATUS\r
323(EFIAPI * FRAMEWORK_EFI_FVB_ERASE_BLOCKS)(\r
324 IN FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
325 ...\r
326);\r
327\r
328///\r
329/// The Firmware Volume Block Protocol is the low-level interface\r
330/// to a firmware volume. File-level access to a firmware volume\r
331/// should not be done using the Firmware Volume Block Protocol.\r
332/// Normal access to a firmware volume must use the Firmware\r
333/// Volume Protocol. Typically, only the file system driver that\r
334/// produces the Firmware Volume Protocol will bind to the\r
335/// Firmware Volume Block Protocol.\r
336///\r
337struct _FRAMEWORK_EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {\r
338 FRAMEWORK_EFI_FVB_GET_ATTRIBUTES GetAttributes;\r
339 FRAMEWORK_EFI_FVB_SET_ATTRIBUTES SetAttributes;\r
340 FRAMEWORK_EFI_FVB_GET_PHYSICAL_ADDRESS GetPhysicalAddress;\r
341 FRAMEWORK_EFI_FVB_GET_BLOCK_SIZE GetBlockSize;\r
342 FRAMEWORK_EFI_FVB_READ Read;\r
343 FRAMEWORK_EFI_FVB_WRITE Write;\r
344 FRAMEWORK_EFI_FVB_ERASE_BLOCKS EraseBlocks;\r
345 ///\r
346 /// Handle of the parent firmware volume.\r
347 /// \r
348 EFI_HANDLE ParentHandle;\r
349};\r
350\r
351\r
352\r
353#endif\r