2 Firmware Volume Block protocol functions.
3 Consumes FV hobs and creates appropriate block protocols.
5 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 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')
29 MEMMAP_DEVICE_PATH MemMapDevPath
;
30 EFI_DEVICE_PATH_PROTOCOL EndDevPath
;
31 } FV_MEMMAP_DEVICE_PATH
;
34 // UEFI Specification define FV device path format if FV provide name guid in extension header
37 MEDIA_FW_VOL_DEVICE_PATH FvDevPath
;
38 EFI_DEVICE_PATH_PROTOCOL EndDevPath
;
39 } FV_PIWG_DEVICE_PATH
;
44 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
45 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance
;
49 EFI_PHYSICAL_ADDRESS BaseAddress
;
50 } EFI_FW_VOL_BLOCK_DEVICE
;
53 #define FVB_DEVICE_FROM_THIS(a) \
54 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
58 Retrieves Volume attributes. No polarity translations are done.
60 @param This Calling context
61 @param Attributes output buffer which contains attributes
63 @retval EFI_SUCCESS The firmware volume attributes were returned.
68 FwVolBlockGetAttributes (
69 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
70 OUT EFI_FVB_ATTRIBUTES_2
*Attributes
76 Modifies the current settings of the firmware volume according to the input parameter.
78 @param This Calling context
79 @param Attributes input buffer which contains attributes
81 @retval EFI_SUCCESS The firmware volume attributes were returned.
82 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
83 the capabilities as declared in the firmware
85 @retval EFI_UNSUPPORTED Not supported.
90 FwVolBlockSetAttributes (
91 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
92 IN CONST EFI_FVB_ATTRIBUTES_2
*Attributes
98 The EraseBlock() function erases one or more blocks as denoted by the
99 variable argument list. The entire parameter list of blocks must be verified
100 prior to erasing any blocks. If a block is requested that does not exist
101 within the associated firmware volume (it has a larger index than the last
102 block of the firmware volume), the EraseBlock() function must return
103 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
105 @param This Calling context
106 @param ... Starting LBA followed by Number of Lba to erase.
107 a -1 to terminate the list.
109 @retval EFI_SUCCESS The erase request was successfully completed.
110 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
112 @retval EFI_DEVICE_ERROR The block device is not functioning correctly
113 and could not be written. The firmware device
114 may have been partially erased.
115 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
117 @retval EFI_UNSUPPORTED Not supported.
122 FwVolBlockEraseBlock (
123 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
130 Read the specified number of bytes from the block to the input buffer.
132 @param This Indicates the calling context.
133 @param Lba The starting logical block index to read.
134 @param Offset Offset into the block at which to begin reading.
135 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
136 contains the total size of the buffer. At exit,
137 *NumBytes contains the total number of bytes
139 @param Buffer Pinter to a caller-allocated buffer that
140 contains the destine for the read.
142 @retval EFI_SUCCESS The firmware volume was read successfully.
143 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
144 @retval EFI_ACCESS_DENIED Access denied.
145 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
151 FwVolBlockReadBlock (
152 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
153 IN CONST EFI_LBA Lba
,
154 IN CONST UINTN Offset
,
155 IN OUT UINTN
*NumBytes
,
162 Writes the specified number of bytes from the input buffer to the block.
164 @param This Indicates the calling context.
165 @param Lba The starting logical block index to write to.
166 @param Offset Offset into the block at which to begin writing.
167 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
168 contains the total size of the buffer. At exit,
169 *NumBytes contains the total number of bytes
171 @param Buffer Pinter to a caller-allocated buffer that
172 contains the source for the write.
174 @retval EFI_SUCCESS The firmware volume was written successfully.
175 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
176 On output, NumBytes contains the total number of
177 bytes actually written.
178 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
180 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
182 @retval EFI_UNSUPPORTED Not supported.
187 FwVolBlockWriteBlock (
188 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
191 IN OUT UINTN
*NumBytes
,
198 Get Fvb's base address.
200 @param This Indicates the calling context.
201 @param Address Fvb device base address.
203 @retval EFI_SUCCESS Successfully got Fvb's base address.
204 @retval EFI_UNSUPPORTED Not supported.
209 FwVolBlockGetPhysicalAddress (
210 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
211 OUT EFI_PHYSICAL_ADDRESS
*Address
217 Retrieves the size in bytes of a specific block within a firmware volume.
219 @param This Indicates the calling context.
220 @param Lba Indicates the block for which to return the
222 @param BlockSize Pointer to a caller-allocated UINTN in which the
223 size of the block is returned.
224 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
225 number of consecutive blocks starting with Lba
226 is returned. All blocks in this range have a
229 @retval EFI_SUCCESS The firmware volume base address is returned.
230 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
235 FwVolBlockGetBlockSize (
236 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
237 IN CONST EFI_LBA Lba
,
238 IN OUT UINTN
*BlockSize
,
239 IN OUT UINTN
*NumberOfBlocks