2 Firmware Volume Block protocol functions.
3 Consumes FV hobs and creates appropriate block protocols.
5 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _FWVOL_BLOCK_H_
17 #define _FWVOL_BLOCK_H_
20 #define FVB_DEVICE_SIGNATURE SIGNATURE_32('_','F','V','B')
30 MEMMAP_DEVICE_PATH MemMapDevPath
;
31 EFI_DEVICE_PATH_PROTOCOL EndDevPath
;
38 FV_DEVICE_PATH DevicePath
;
39 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance
;
43 EFI_PHYSICAL_ADDRESS BaseAddress
;
44 } EFI_FW_VOL_BLOCK_DEVICE
;
47 #define FVB_DEVICE_FROM_THIS(a) \
48 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
52 Retrieves Volume attributes. No polarity translations are done.
54 @param This Calling context
55 @param Attributes output buffer which contains attributes
57 @retval EFI_SUCCESS The firmware volume attributes were returned.
62 FwVolBlockGetAttributes (
63 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
64 OUT EFI_FVB_ATTRIBUTES_2
*Attributes
70 Modifies the current settings of the firmware volume according to the input parameter.
72 @param This Calling context
73 @param Attributes input buffer which contains attributes
75 @retval EFI_SUCCESS The firmware volume attributes were returned.
76 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
77 the capabilities as declared in the firmware
79 @retval EFI_UNSUPPORTED Not supported.
84 FwVolBlockSetAttributes (
85 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
86 IN CONST EFI_FVB_ATTRIBUTES_2
*Attributes
92 The EraseBlock() function erases one or more blocks as denoted by the
93 variable argument list. The entire parameter list of blocks must be verified
94 prior to erasing any blocks. If a block is requested that does not exist
95 within the associated firmware volume (it has a larger index than the last
96 block of the firmware volume), the EraseBlock() function must return
97 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
99 @param This Calling context
100 @param ... Starting LBA followed by Number of Lba to erase.
101 a -1 to terminate the list.
103 @retval EFI_SUCCESS The erase request was successfully completed.
104 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
106 @retval EFI_DEVICE_ERROR The block device is not functioning correctly
107 and could not be written. The firmware device
108 may have been partially erased.
109 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
111 @retval EFI_UNSUPPORTED Not supported.
116 FwVolBlockEraseBlock (
117 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
124 Read the specified number of bytes from the block to the input buffer.
126 @param This Indicates the calling context.
127 @param Lba The starting logical block index to read.
128 @param Offset Offset into the block at which to begin reading.
129 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
130 contains the total size of the buffer. At exit,
131 *NumBytes contains the total number of bytes
133 @param Buffer Pinter to a caller-allocated buffer that
134 contains the destine for the read.
136 @retval EFI_SUCCESS The firmware volume was read successfully.
137 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
138 @retval EFI_ACCESS_DENIED Access denied.
139 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
145 FwVolBlockReadBlock (
146 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
147 IN CONST EFI_LBA Lba
,
148 IN CONST UINTN Offset
,
149 IN OUT UINTN
*NumBytes
,
156 Writes the specified number of bytes from the input buffer to the block.
158 @param This Indicates the calling context.
159 @param Lba The starting logical block index to write to.
160 @param Offset Offset into the block at which to begin writing.
161 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
162 contains the total size of the buffer. At exit,
163 *NumBytes contains the total number of bytes
165 @param Buffer Pinter to a caller-allocated buffer that
166 contains the source for the write.
168 @retval EFI_SUCCESS The firmware volume was written successfully.
169 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
170 On output, NumBytes contains the total number of
171 bytes actually written.
172 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
174 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
176 @retval EFI_UNSUPPORTED Not supported.
181 FwVolBlockWriteBlock (
182 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
185 IN OUT UINTN
*NumBytes
,
192 Get Fvb's base address.
194 @param This Indicates the calling context.
195 @param Address Fvb device base address.
197 @retval EFI_SUCCESS Successfully got Fvb's base address.
198 @retval EFI_UNSUPPORTED Not supported.
203 FwVolBlockGetPhysicalAddress (
204 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
205 OUT EFI_PHYSICAL_ADDRESS
*Address
211 Retrieves the size in bytes of a specific block within a firmware volume.
213 @param This Indicates the calling context.
214 @param Lba Indicates the block for which to return the
216 @param BlockSize Pointer to a caller-allocated UINTN in which the
217 size of the block is returned.
218 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
219 number of consecutive blocks starting with Lba
220 is returned. All blocks in this range have a
223 @retval EFI_SUCCESS The firmware volume base address is returned.
224 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
229 FwVolBlockGetBlockSize (
230 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
231 IN CONST EFI_LBA Lba
,
232 IN OUT UINTN
*BlockSize
,
233 IN OUT UINTN
*NumberOfBlocks