]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVolBlock / FwVolBlock.h
CommitLineData
23c98c94 1/** @file\r
022c6d45 2 Firmware Volume Block protocol functions.\r
23c98c94 3 Consumes FV hobs and creates appropriate block protocols.\r
4\r
5Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
28a00297 13\r
504214c4 14**/\r
28a00297 15\r
16#ifndef _FWVOL_BLOCK_H_\r
17#define _FWVOL_BLOCK_H_\r
18\r
19\r
f3f2e05d 20#define FVB_DEVICE_SIGNATURE SIGNATURE_32('_','F','V','B')\r
28a00297 21\r
ec90508b 22\r
28a00297 23typedef struct {\r
24 UINTN Base;\r
25 UINTN Length;\r
26} LBA_CACHE;\r
27\r
ec90508b 28\r
28a00297 29typedef struct {\r
30 MEMMAP_DEVICE_PATH MemMapDevPath;\r
31 EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
32} FV_DEVICE_PATH;\r
33\r
34\r
35typedef struct {\r
36 UINTN Signature;\r
37 EFI_HANDLE Handle;\r
38 FV_DEVICE_PATH DevicePath;\r
39 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;\r
40 UINTN NumBlocks;\r
41 LBA_CACHE *LbaCache;\r
42 UINT32 FvbAttributes;\r
43 EFI_PHYSICAL_ADDRESS BaseAddress;\r
44} EFI_FW_VOL_BLOCK_DEVICE;\r
45\r
ec90508b 46\r
28a00297 47#define FVB_DEVICE_FROM_THIS(a) \\r
48 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)\r
49\r
50\r
162ed594 51/**\r
52 Retrieves Volume attributes. No polarity translations are done.\r
53\r
022c6d45 54 @param This Calling context\r
55 @param Attributes output buffer which contains attributes\r
162ed594 56\r
57 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
58\r
59**/\r
28a00297 60EFI_STATUS\r
61EFIAPI\r
62FwVolBlockGetAttributes (\r
63 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
8ee3a199 64 OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
23c98c94 65 );\r
28a00297 66\r
28a00297 67\r
28a00297 68\r
162ed594 69/**\r
70 Modifies the current settings of the firmware volume according to the input parameter.\r
28a00297 71\r
022c6d45 72 @param This Calling context\r
73 @param Attributes input buffer which contains attributes\r
28a00297 74\r
022c6d45 75 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
76 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with\r
77 the capabilities as declared in the firmware\r
78 volume header.\r
162ed594 79 @retval EFI_UNSUPPORTED Not supported.\r
28a00297 80\r
162ed594 81**/\r
28a00297 82EFI_STATUS\r
83EFIAPI\r
84FwVolBlockSetAttributes (\r
85 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
8ee3a199 86 IN CONST EFI_FVB_ATTRIBUTES_2 *Attributes\r
23c98c94 87 );\r
28a00297 88\r
28a00297 89\r
28a00297 90\r
162ed594 91/**\r
92 The EraseBlock() function erases one or more blocks as denoted by the\r
93 variable argument list. The entire parameter list of blocks must be verified\r
94 prior to erasing any blocks. If a block is requested that does not exist\r
95 within the associated firmware volume (it has a larger index than the last\r
96 block of the firmware volume), the EraseBlock() function must return\r
97 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
98\r
022c6d45 99 @param This Calling context\r
100 @param ... Starting LBA followed by Number of Lba to erase.\r
101 a -1 to terminate the list.\r
102\r
103 @retval EFI_SUCCESS The erase request was successfully completed.\r
104 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled\r
105 state.\r
106 @retval EFI_DEVICE_ERROR The block device is not functioning correctly\r
107 and could not be written. The firmware device\r
108 may have been partially erased.\r
109 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable\r
110 argument list do\r
162ed594 111 @retval EFI_UNSUPPORTED Not supported.\r
28a00297 112\r
162ed594 113**/\r
28a00297 114EFI_STATUS\r
115EFIAPI\r
116FwVolBlockEraseBlock (\r
117 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
118 ...\r
23c98c94 119 );\r
28a00297 120\r
121\r
162ed594 122\r
123/**\r
124 Read the specified number of bytes from the block to the input buffer.\r
125\r
022c6d45 126 @param This Indicates the calling context.\r
127 @param Lba The starting logical block index to read.\r
128 @param Offset Offset into the block at which to begin reading.\r
129 @param NumBytes Pointer to a UINT32. At entry, *NumBytes\r
130 contains the total size of the buffer. At exit,\r
131 *NumBytes contains the total number of bytes\r
132 actually read.\r
133 @param Buffer Pinter to a caller-allocated buffer that\r
134 contains the destine for the read.\r
135\r
136 @retval EFI_SUCCESS The firmware volume was read successfully.\r
137 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.\r
138 @retval EFI_ACCESS_DENIED Access denied.\r
139 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not\r
162ed594 140 be read.\r
141\r
142**/\r
28a00297 143EFI_STATUS\r
144EFIAPI\r
145FwVolBlockReadBlock (\r
146 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
147 IN CONST EFI_LBA Lba,\r
148 IN CONST UINTN Offset,\r
149 IN OUT UINTN *NumBytes,\r
150 IN OUT UINT8 *Buffer\r
23c98c94 151 );\r
28a00297 152\r
022c6d45 153\r
162ed594 154\r
155/**\r
156 Writes the specified number of bytes from the input buffer to the block.\r
157\r
022c6d45 158 @param This Indicates the calling context.\r
159 @param Lba The starting logical block index to write to.\r
160 @param Offset Offset into the block at which to begin writing.\r
161 @param NumBytes Pointer to a UINT32. At entry, *NumBytes\r
162 contains the total size of the buffer. At exit,\r
163 *NumBytes contains the total number of bytes\r
164 actually written.\r
165 @param Buffer Pinter to a caller-allocated buffer that\r
166 contains the source for the write.\r
167\r
168 @retval EFI_SUCCESS The firmware volume was written successfully.\r
169 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.\r
170 On output, NumBytes contains the total number of\r
171 bytes actually written.\r
172 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled\r
173 state.\r
174 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not\r
175 be written.\r
162ed594 176 @retval EFI_UNSUPPORTED Not supported.\r
177\r
178**/\r
28a00297 179EFI_STATUS\r
180EFIAPI\r
181FwVolBlockWriteBlock (\r
23c98c94 182 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
183 IN EFI_LBA Lba,\r
184 IN UINTN Offset,\r
185 IN OUT UINTN *NumBytes,\r
186 IN UINT8 *Buffer\r
187 );\r
28a00297 188\r
022c6d45 189\r
162ed594 190\r
191/**\r
192 Get Fvb's base address.\r
193\r
022c6d45 194 @param This Indicates the calling context.\r
195 @param Address Fvb device base address.\r
162ed594 196\r
022c6d45 197 @retval EFI_SUCCESS Successfully got Fvb's base address.\r
162ed594 198 @retval EFI_UNSUPPORTED Not supported.\r
199\r
200**/\r
28a00297 201EFI_STATUS\r
202EFIAPI\r
203FwVolBlockGetPhysicalAddress (\r
23c98c94 204 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
205 OUT EFI_PHYSICAL_ADDRESS *Address\r
206 );\r
28a00297 207\r
28a00297 208\r
28a00297 209\r
162ed594 210/**\r
211 Retrieves the size in bytes of a specific block within a firmware volume.\r
212\r
022c6d45 213 @param This Indicates the calling context.\r
214 @param Lba Indicates the block for which to return the\r
215 size.\r
216 @param BlockSize Pointer to a caller-allocated UINTN in which the\r
217 size of the block is returned.\r
218 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the\r
219 number of consecutive blocks starting with Lba\r
220 is returned. All blocks in this range have a\r
221 size of BlockSize.\r
222\r
223 @retval EFI_SUCCESS The firmware volume base address is returned.\r
162ed594 224 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.\r
28a00297 225\r
162ed594 226**/\r
28a00297 227EFI_STATUS\r
228EFIAPI\r
229FwVolBlockGetBlockSize (\r
230 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
231 IN CONST EFI_LBA Lba,\r
23c98c94 232 IN OUT UINTN *BlockSize,\r
233 IN OUT UINTN *NumberOfBlocks\r
234 );\r
28a00297 235\r
28a00297 236\r
237#endif\r