1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
/** @file
This file declares Firmware Volume Block protocol.
Low level firmware device access routines to abstract firmware device
hardware.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: FirmwareVolumeBlock.h
@par Revision Reference:
This protocol is defined in Framework of EFI Firmware Volume Block specification.
Version 0.9
**/
#ifndef __FIRMWARE_VOLUME_BLOCK_H__
#define __FIRMWARE_VOLUME_BLOCK_H__
#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \
{ \
0xDE28BC59, 0x6228, 0x41BD, {0xBD, 0xF6, 0xA3, 0xB9, 0xAD, 0xB5, 0x8D, 0xA1 } \
}
typedef struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL;
/**
Retrieves Volume attributes. No polarity translations are done.
@param This Calling context
@param Attributes output buffer which contains attributes
@retval EFI_INVALID_PARAMETER
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_GET_ATTRIBUTES) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_FVB_ATTRIBUTES *Attributes
)
;
/**
Sets Volume attributes. No polarity translations are done.
@param This Calling context
@param Attributes On input: contains new attributes
On output: contains current attributes of FV
@retval EFI_INVALID_PARAMETER
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_SET_ATTRIBUTES) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN OUT EFI_FVB_ATTRIBUTES *Attributes
)
;
/**
Retrieves the physical address of a memory mapped FV.
@param This Calling context
@param Attributes Address is a pointer to a caller allocated EFI_PHYSICAL_ADDRESS
that on successful return from GetPhysicalAddress() contains the
base address of the firmware volume.
@retval EFI_UNSUPPORTED
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_GET_PHYSICAL_ADDRESS) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_PHYSICAL_ADDRESS *Address
)
;
/**
Retrieves the size in bytes of a specific block within an FV.
@param This Calling context.
@param Lba Indicates which block to return the size for.
@param BlockSize BlockSize is a pointer to a caller allocated
UINTN in which the size of the block is returned.
@param NumberOfBlocks NumberOfBlocks is a pointer to a caller allocated
UINTN in which the number of consecutive blocks
starting with Lba is returned. All blocks in this
range have a size of BlockSize.
@retval EFI_INVALID_PARAMETER
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_GET_BLOCK_SIZE) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba,
OUT UINTN *BlockSize,
OUT UINTN *NumberOfBlocks
)
;
/**
Reads data beginning at Lba:Offset from FV and places the data in Buffer.
The read terminates either when *NumBytes of data have been read, or when
a block boundary is reached. *NumBytes is updated to reflect the actual
number of bytes read.
@param This Calling context
@param Lba Block in which to begin read
@param Offset Offset in the block at which to begin read
@param NumBytes At input, indicates the requested read size. At output, indicates
the actual number of bytes read.
@param Buffer Data buffer in which to place data read.
@retval EFI_INVALID_PARAMETER
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_READ) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba,
IN UINTN Offset,
IN OUT UINTN *NumBytes,
OUT UINT8 *Buffer
)
;
/**
Writes data beginning at Lba:Offset from FV. The write terminates either
when *NumBytes of data have been written, or when a block boundary is
reached. *NumBytes is updated to reflect the actual number of bytes
written.
@param This Calling context
@param Lba Block in which to begin write
@param Offset Offset in the block at which to begin write
@param NumBytes At input, indicates the requested write size. At output, indicates
the actual number of bytes written.
@param Buffer Buffer containing source data for the write.
@retval EFI_INVALID_PARAMETER
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_WRITE) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba,
IN UINTN Offset,
IN OUT UINTN *NumBytes,
IN UINT8 *Buffer
)
;
#define EFI_LBA_LIST_TERMINATOR 0xFFFFFFFFFFFFFFFFULL
/**
The EraseBlock() function erases one or more blocks as denoted by the
variable argument list. The entire parameter list of blocks must be verified
prior to erasing any blocks. If a block is requested that does not exist
within the associated firmware volume (it has a larger index than the last
block of the firmware volume), the EraseBlock() function must return
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
@param This Calling context
@param ... Starting LBA followed by Number of Lba to erase. a -1 to terminate
the list.
@retval EFI_INVALID_PARAMETER
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
@retval EFI_ACCESS_DENIED
**/
typedef
EFI_STATUS
(EFIAPI *EFI_FVB_ERASE_BLOCKS) (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
...
)
;
/**
@par Protocol Description:
This protocol provides control over block-oriented firmware devices.
Typically, the FFS (or an alternate file system) driver consumes the
Firmware Volume Block Protocol and produces the Firmware Volume Protocol.
@param GetAttributes
Retrieves the current volume attributes.
@param SetAttributes
Sets the current volume attributes.
@param GetPhysicalAddress
Retrieves the memory-mapped address of the firmware volume.
@param GetBlockSize
Retrieves the size for a specific block.
@param Read
Reads n bytes into a buffer from the firmware volume hardware.
@param Write
Writes n bytes from a buffer into the firmware volume hardware.
@param EraseBlocks
Erases specified block(s) and sets all values as indicated by
the EFI_FVB_ERASE_POLARITY bit.
@param ParentHandle
Handle of the parent firmware volume.
**/
struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {
EFI_FVB_GET_ATTRIBUTES GetVolumeAttributes;
EFI_FVB_SET_ATTRIBUTES SetVolumeAttributes;
EFI_FVB_GET_PHYSICAL_ADDRESS GetPhysicalAddress;
EFI_FVB_GET_BLOCK_SIZE GetBlockSize;
EFI_FVB_READ Read;
EFI_FVB_WRITE Write;
EFI_FVB_ERASE_BLOCKS EraseBlocks;
EFI_HANDLE ParentHandle;
};
extern EFI_GUID gEfiFirmwareVolumeBlockProtocolGuid;
#endif
|