]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Framework/Protocol/FirmwareVolumeBlock/FirmwareVolumeBlock.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Framework / Protocol / FirmwareVolumeBlock / FirmwareVolumeBlock.h
1 /*++
2
3 Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
4 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 //
32 // The following GUID value has been changed to EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL_GUID in
33 // PI 1.2 spec on purpose. This will force all platforms built with EdkCompatibilityPkg
34 // produce FVB 2 protocol.
35 //
36 #define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \
37 { \
38 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } \
39 }
40
41 EFI_FORWARD_DECLARATION (EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL);
42
43 typedef
44 EFI_STATUS
45 (EFIAPI *EFI_FVB_GET_ATTRIBUTES) (
46 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
47 OUT EFI_FVB_ATTRIBUTES * Attributes
48 )
49 /*++
50
51 Routine Description:
52 Retrieves Volume attributes. No polarity translations are done.
53
54 Arguments:
55 This - Calling context
56 Attributes - output buffer which contains attributes
57
58 Returns:
59 EFI_INVALID_PARAMETER
60 EFI_SUCCESS
61
62 --*/
63 ;
64
65 typedef
66 EFI_STATUS
67 (EFIAPI *EFI_FVB_SET_ATTRIBUTES) (
68 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
69 IN OUT EFI_FVB_ATTRIBUTES * Attributes
70 )
71 /*++
72
73 Routine Description:
74 Sets Volume attributes. No polarity translations are done.
75
76 Arguments:
77 This - Calling context
78 Attributes - On input: contains new attributes
79 On output: contains current attributes of FV
80
81 Returns:
82 EFI_INVALID_PARAMETER
83 EFI_SUCCESS
84
85 --*/
86 ;
87
88 typedef
89 EFI_STATUS
90 (EFIAPI *EFI_FVB_GET_PHYSICAL_ADDRESS) (
91 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
92 OUT EFI_PHYSICAL_ADDRESS * Address
93 )
94 /*++
95
96 Routine Description:
97 Retrieves the physical address of a memory mapped FV.
98
99 Arguments:
100 This - Calling context
101 Attributes - Address is a pointer to a caller allocated EFI_PHYSICAL_ADDRESS
102 that on successful return from GetPhysicalAddress() contains the
103 base address of the firmware volume.
104
105 Returns:
106 EFI_UNSUPPORTED
107 EFI_SUCCESS
108
109 --*/
110 ;
111
112 typedef
113 EFI_STATUS
114 (EFIAPI *EFI_FVB_GET_BLOCK_SIZE) (
115 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
116 IN EFI_LBA Lba,
117 OUT UINTN *BlockSize,
118 OUT UINTN *NumberOfBlocks
119 )
120 /*++
121
122 Routine Description:
123 Retrieves the size in bytes of a specific block within an FV.
124
125 Arguments:
126 This - Calling context.
127 Lba - Indicates which block to return the size for.
128 BlockSize - BlockSize is a pointer to a caller allocated
129 UINTN in which the size of the block is returned.
130 NumberOfBlocks - NumberOfBlocks is a pointer to a caller allocated
131 UINTN in which the number of consecutive blocks
132 starting with Lba is returned. All blocks in this
133 range have a size of BlockSize.
134
135 Returns:
136 EFI_INVALID_PARAMETER
137 EFI_SUCCESS
138
139 --*/
140 ;
141
142 typedef
143 EFI_STATUS
144 (EFIAPI *EFI_FVB_READ) (
145 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
146 IN EFI_LBA Lba,
147 IN UINTN Offset,
148 IN OUT UINTN *NumBytes,
149 OUT UINT8 *Buffer
150 )
151 /*++
152
153 Routine Description:
154 Reads data beginning at Lba:Offset from FV and places the data in Buffer.
155 The read terminates either when *NumBytes of data have been read, or when
156 a block boundary is reached. *NumBytes is updated to reflect the actual
157 number of bytes read.
158
159 Arguments:
160 This - Calling context
161 Lba - Block in which to begin read
162 Offset - Offset in the block at which to begin read
163 NumBytes - At input, indicates the requested read size. At output, indicates
164 the actual number of bytes read.
165 Buffer - Data buffer in which to place data read.
166
167 Returns:
168 EFI_INVALID_PARAMETER
169 EFI_NOT_FOUND
170 EFI_DEVICE_ERROR
171 EFI_SUCCESS
172
173 --*/
174 ;
175
176 typedef
177 EFI_STATUS
178 (EFIAPI *EFI_FVB_WRITE) (
179 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
180 IN EFI_LBA Lba,
181 IN UINTN Offset,
182 IN OUT UINTN *NumBytes,
183 IN UINT8 *Buffer
184 )
185 /*++
186
187 Routine Description:
188
189 Writes data beginning at Lba:Offset from FV. The write terminates either
190 when *NumBytes of data have been written, or when a block boundary is
191 reached. *NumBytes is updated to reflect the actual number of bytes
192 written.
193
194 Arguments:
195 This - Calling context
196 Lba - Block in which to begin write
197 Offset - Offset in the block at which to begin write
198 NumBytes - At input, indicates the requested write size. At output, indicates
199 the actual number of bytes written.
200 Buffer - Buffer containing source data for the write.
201
202 Returns:
203 EFI_INVALID_PARAMETER
204 EFI_NOT_FOUND
205 EFI_DEVICE_ERROR
206 EFI_SUCCESS
207
208 --*/
209 ;
210
211 #define EFI_LBA_LIST_TERMINATOR 0xFFFFFFFFFFFFFFFF
212
213 typedef
214 EFI_STATUS
215 (EFIAPI *EFI_FVB_ERASE_BLOCKS) (
216 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL * This,
217 ...
218 )
219 /*++
220
221 Routine Description:
222 The EraseBlock() function erases one or more blocks as denoted by the
223 variable argument list. The entire parameter list of blocks must be verified
224 prior to erasing any blocks. If a block is requested that does not exist
225 within the associated firmware volume (it has a larger index than the last
226 block of the firmware volume), the EraseBlock() function must return
227 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
228
229 Arguments:
230 This - Calling context
231 ... - Starting LBA followed by Number of Lba to erase. a -1 to terminate
232 the list.
233
234 Returns:
235 EFI_INVALID_PARAMETER
236 EFI_DEVICE_ERROR
237 EFI_SUCCESS
238 EFI_ACCESS_DENIED
239
240 --*/
241 ;
242
243 struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {
244 EFI_FVB_GET_ATTRIBUTES GetVolumeAttributes;
245 EFI_FVB_SET_ATTRIBUTES SetVolumeAttributes;
246 EFI_FVB_GET_PHYSICAL_ADDRESS GetPhysicalAddress;
247 EFI_FVB_GET_BLOCK_SIZE GetBlockSize;
248 EFI_FVB_READ Read;
249 EFI_FVB_WRITE Write;
250 EFI_FVB_ERASE_BLOCKS EraseBlocks;
251 EFI_HANDLE ParentHandle;
252 };
253
254 extern EFI_GUID gEfiFirmwareVolumeBlockProtocolGuid;
255
256 #endif