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