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 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 UINT32 AuthenticationStatus
;
51 } EFI_FW_VOL_BLOCK_DEVICE
;
54 #define FVB_DEVICE_FROM_THIS(a) \
55 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
59 Retrieves Volume attributes. No polarity translations are done.
61 @param This Calling context
62 @param Attributes output buffer which contains attributes
64 @retval EFI_SUCCESS The firmware volume attributes were returned.
69 FwVolBlockGetAttributes (
70 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
71 OUT EFI_FVB_ATTRIBUTES_2
*Attributes
77 Modifies the current settings of the firmware volume according to the input parameter.
79 @param This Calling context
80 @param Attributes input buffer which contains attributes
82 @retval EFI_SUCCESS The firmware volume attributes were returned.
83 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with
84 the capabilities as declared in the firmware
86 @retval EFI_UNSUPPORTED Not supported.
91 FwVolBlockSetAttributes (
92 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
93 IN CONST EFI_FVB_ATTRIBUTES_2
*Attributes
99 The EraseBlock() function erases one or more blocks as denoted by the
100 variable argument list. The entire parameter list of blocks must be verified
101 prior to erasing any blocks. If a block is requested that does not exist
102 within the associated firmware volume (it has a larger index than the last
103 block of the firmware volume), the EraseBlock() function must return
104 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
106 @param This Calling context
107 @param ... Starting LBA followed by Number of Lba to erase.
108 a -1 to terminate the list.
110 @retval EFI_SUCCESS The erase request was successfully completed.
111 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
113 @retval EFI_DEVICE_ERROR The block device is not functioning correctly
114 and could not be written. The firmware device
115 may have been partially erased.
116 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable
118 @retval EFI_UNSUPPORTED Not supported.
123 FwVolBlockEraseBlock (
124 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
131 Read the specified number of bytes from the block to the input buffer.
133 @param This Indicates the calling context.
134 @param Lba The starting logical block index to read.
135 @param Offset Offset into the block at which to begin reading.
136 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
137 contains the total size of the buffer. At exit,
138 *NumBytes contains the total number of bytes
140 @param Buffer Pinter to a caller-allocated buffer that
141 contains the destine for the read.
143 @retval EFI_SUCCESS The firmware volume was read successfully.
144 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.
145 @retval EFI_ACCESS_DENIED Access denied.
146 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
152 FwVolBlockReadBlock (
153 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
154 IN CONST EFI_LBA Lba
,
155 IN CONST UINTN Offset
,
156 IN OUT UINTN
*NumBytes
,
163 Writes the specified number of bytes from the input buffer to the block.
165 @param This Indicates the calling context.
166 @param Lba The starting logical block index to write to.
167 @param Offset Offset into the block at which to begin writing.
168 @param NumBytes Pointer to a UINT32. At entry, *NumBytes
169 contains the total size of the buffer. At exit,
170 *NumBytes contains the total number of bytes
172 @param Buffer Pinter to a caller-allocated buffer that
173 contains the source for the write.
175 @retval EFI_SUCCESS The firmware volume was written successfully.
176 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
177 On output, NumBytes contains the total number of
178 bytes actually written.
179 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled
181 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not
183 @retval EFI_UNSUPPORTED Not supported.
188 FwVolBlockWriteBlock (
189 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
192 IN OUT UINTN
*NumBytes
,
199 Get Fvb's base address.
201 @param This Indicates the calling context.
202 @param Address Fvb device base address.
204 @retval EFI_SUCCESS Successfully got Fvb's base address.
205 @retval EFI_UNSUPPORTED Not supported.
210 FwVolBlockGetPhysicalAddress (
211 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
212 OUT EFI_PHYSICAL_ADDRESS
*Address
218 Retrieves the size in bytes of a specific block within a firmware volume.
220 @param This Indicates the calling context.
221 @param Lba Indicates the block for which to return the
223 @param BlockSize Pointer to a caller-allocated UINTN in which the
224 size of the block is returned.
225 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the
226 number of consecutive blocks starting with Lba
227 is returned. All blocks in this range have a
230 @retval EFI_SUCCESS The firmware volume base address is returned.
231 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.
236 FwVolBlockGetBlockSize (
237 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*This
,
238 IN CONST EFI_LBA Lba
,
239 IN OUT UINTN
*BlockSize
,
240 IN OUT UINTN
*NumberOfBlocks