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