2 Firmware Volume Block protocol functions.
3 Consumes FV hobs and creates appropriate block protocols.
5 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _FWVOL_BLOCK_H_
11 #define _FWVOL_BLOCK_H_
14 #define FVB_DEVICE_SIGNATURE SIGNATURE_32('_','F','V','B')
23 MEMMAP_DEVICE_PATH MemMapDevPath
;
24 EFI_DEVICE_PATH_PROTOCOL EndDevPath
;
25 } FV_MEMMAP_DEVICE_PATH
;
28 // UEFI Specification define FV device path format if FV provide name guid in extension header
31 MEDIA_FW_VOL_DEVICE_PATH FvDevPath
;
32 EFI_DEVICE_PATH_PROTOCOL EndDevPath
;
33 } FV_PIWG_DEVICE_PATH
;
38 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
39 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance
;
43 EFI_PHYSICAL_ADDRESS BaseAddress
;
44 UINT32 AuthenticationStatus
;
45 } EFI_FW_VOL_BLOCK_DEVICE
;
48 #define FVB_DEVICE_FROM_THIS(a) \
49 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
53 Retrieves Volume attributes. No polarity translations are done.
55 @param This Calling context
56 @param Attributes output buffer which contains attributes
58 @retval EFI_SUCCESS The firmware volume attributes were returned.
63 FwVolBlockGetAttributes (
64 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
65 OUT EFI_FVB_ATTRIBUTES_2
*Attributes
71 Modifies the current settings of the firmware volume according to the input parameter.
73 @param This Calling context
74 @param Attributes input buffer which contains attributes
76 @retval EFI_SUCCESS The firmware volume attributes were returned.
77 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
78 the capabilities as declared in the firmware
80 @retval EFI_UNSUPPORTED Not supported.
85 FwVolBlockSetAttributes (
86 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
87 IN CONST EFI_FVB_ATTRIBUTES_2
*Attributes
93 The EraseBlock() function erases one or more blocks as denoted by the
94 variable argument list. The entire parameter list of blocks must be verified
95 prior to erasing any blocks. If a block is requested that does not exist
96 within the associated firmware volume (it has a larger index than the last
97 block of the firmware volume), the EraseBlock() function must return
98 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
100 @param This Calling context
101 @param ... Starting LBA followed by Number of Lba to erase.
102 a -1 to terminate the list.
104 @retval EFI_SUCCESS The erase request was successfully completed.
105 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
107 @retval EFI_DEVICE_ERROR The block device is not functioning correctly
108 and could not be written. The firmware device
109 may have been partially erased.
110 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
112 @retval EFI_UNSUPPORTED Not supported.
117 FwVolBlockEraseBlock (
118 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
125 Read the specified number of bytes from the block to the input buffer.
127 @param This Indicates the calling context.
128 @param Lba The starting logical block index to read.
129 @param Offset Offset into the block at which to begin reading.
130 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
131 contains the total size of the buffer. At exit,
132 *NumBytes contains the total number of bytes
134 @param Buffer Pinter to a caller-allocated buffer that
135 contains the destine for the read.
137 @retval EFI_SUCCESS The firmware volume was read successfully.
138 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
139 @retval EFI_ACCESS_DENIED Access denied.
140 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
146 FwVolBlockReadBlock (
147 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
148 IN CONST EFI_LBA Lba
,
149 IN CONST UINTN Offset
,
150 IN OUT UINTN
*NumBytes
,
157 Writes the specified number of bytes from the input buffer to the block.
159 @param This Indicates the calling context.
160 @param Lba The starting logical block index to write to.
161 @param Offset Offset into the block at which to begin writing.
162 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
163 contains the total size of the buffer. At exit,
164 *NumBytes contains the total number of bytes
166 @param Buffer Pinter to a caller-allocated buffer that
167 contains the source for the write.
169 @retval EFI_SUCCESS The firmware volume was written successfully.
170 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
171 On output, NumBytes contains the total number of
172 bytes actually written.
173 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
175 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
177 @retval EFI_UNSUPPORTED Not supported.
182 FwVolBlockWriteBlock (
183 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
186 IN OUT UINTN
*NumBytes
,
193 Get Fvb's base address.
195 @param This Indicates the calling context.
196 @param Address Fvb device base address.
198 @retval EFI_SUCCESS Successfully got Fvb's base address.
199 @retval EFI_UNSUPPORTED Not supported.
204 FwVolBlockGetPhysicalAddress (
205 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
206 OUT EFI_PHYSICAL_ADDRESS
*Address
212 Retrieves the size in bytes of a specific block within a firmware volume.
214 @param This Indicates the calling context.
215 @param Lba Indicates the block for which to return the
217 @param BlockSize Pointer to a caller-allocated UINTN in which the
218 size of the block is returned.
219 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
220 number of consecutive blocks starting with Lba
221 is returned. All blocks in this range have a
224 @retval EFI_SUCCESS The firmware volume base address is returned.
225 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
230 FwVolBlockGetBlockSize (
231 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
232 IN CONST EFI_LBA Lba
,
233 IN OUT UINTN
*BlockSize
,
234 IN OUT UINTN
*NumberOfBlocks