]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
[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
0c3a1db4 5Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 6This program and the accompanying materials\r
23c98c94 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
28typedef struct {\r
29 MEMMAP_DEVICE_PATH MemMapDevPath;\r
30 EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
84266565 31} FV_MEMMAP_DEVICE_PATH;\r
28a00297 32\r
84266565 33//\r
34// UEFI Specification define FV device path format if FV provide name guid in extension header\r
35//\r
36typedef struct {\r
37 MEDIA_FW_VOL_DEVICE_PATH FvDevPath;\r
38 EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
39} FV_PIWG_DEVICE_PATH;\r
28a00297 40\r
41typedef struct {\r
42 UINTN Signature;\r
43 EFI_HANDLE Handle;\r
84266565 44 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
28a00297 45 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;\r
46 UINTN NumBlocks;\r
47 LBA_CACHE *LbaCache;\r
48 UINT32 FvbAttributes;\r
49 EFI_PHYSICAL_ADDRESS BaseAddress;\r
0c3a1db4 50 UINT32 AuthenticationStatus;\r
28a00297 51} EFI_FW_VOL_BLOCK_DEVICE;\r
52\r
ec90508b 53\r
28a00297 54#define FVB_DEVICE_FROM_THIS(a) \\r
55 CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)\r
56\r
57\r
162ed594 58/**\r
59 Retrieves Volume attributes. No polarity translations are done.\r
60\r
022c6d45 61 @param This Calling context\r
62 @param Attributes output buffer which contains attributes\r
162ed594 63\r
64 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
65\r
66**/\r
28a00297 67EFI_STATUS\r
68EFIAPI\r
69FwVolBlockGetAttributes (\r
70 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
8ee3a199 71 OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
23c98c94 72 );\r
28a00297 73\r
28a00297 74\r
28a00297 75\r
162ed594 76/**\r
77 Modifies the current settings of the firmware volume according to the input parameter.\r
28a00297 78\r
022c6d45 79 @param This Calling context\r
80 @param Attributes input buffer which contains attributes\r
28a00297 81\r
022c6d45 82 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
83 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with\r
84 the capabilities as declared in the firmware\r
85 volume header.\r
162ed594 86 @retval EFI_UNSUPPORTED Not supported.\r
28a00297 87\r
162ed594 88**/\r
28a00297 89EFI_STATUS\r
90EFIAPI\r
91FwVolBlockSetAttributes (\r
92 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
8ee3a199 93 IN CONST EFI_FVB_ATTRIBUTES_2 *Attributes\r
23c98c94 94 );\r
28a00297 95\r
28a00297 96\r
28a00297 97\r
162ed594 98/**\r
99 The EraseBlock() function erases one or more blocks as denoted by the\r
100 variable argument list. The entire parameter list of blocks must be verified\r
101 prior to erasing any blocks. If a block is requested that does not exist\r
102 within the associated firmware volume (it has a larger index than the last\r
103 block of the firmware volume), the EraseBlock() function must return\r
104 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
105\r
022c6d45 106 @param This Calling context\r
107 @param ... Starting LBA followed by Number of Lba to erase.\r
108 a -1 to terminate the list.\r
109\r
110 @retval EFI_SUCCESS The erase request was successfully completed.\r
111 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled\r
112 state.\r
113 @retval EFI_DEVICE_ERROR The block device is not functioning correctly\r
114 and could not be written. The firmware device\r
115 may have been partially erased.\r
116 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable\r
117 argument list do\r
162ed594 118 @retval EFI_UNSUPPORTED Not supported.\r
28a00297 119\r
162ed594 120**/\r
28a00297 121EFI_STATUS\r
122EFIAPI\r
123FwVolBlockEraseBlock (\r
124 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
125 ...\r
23c98c94 126 );\r
28a00297 127\r
128\r
162ed594 129\r
130/**\r
131 Read the specified number of bytes from the block to the input buffer.\r
132\r
022c6d45 133 @param This Indicates the calling context.\r
134 @param Lba The starting logical block index to read.\r
135 @param Offset Offset into the block at which to begin reading.\r
136 @param NumBytes Pointer to a UINT32. At entry, *NumBytes\r
137 contains the total size of the buffer. At exit,\r
138 *NumBytes contains the total number of bytes\r
139 actually read.\r
140 @param Buffer Pinter to a caller-allocated buffer that\r
141 contains the destine for the read.\r
142\r
143 @retval EFI_SUCCESS The firmware volume was read successfully.\r
144 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary.\r
145 @retval EFI_ACCESS_DENIED Access denied.\r
146 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not\r
162ed594 147 be read.\r
148\r
149**/\r
28a00297 150EFI_STATUS\r
151EFIAPI\r
152FwVolBlockReadBlock (\r
153 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
154 IN CONST EFI_LBA Lba,\r
155 IN CONST UINTN Offset,\r
156 IN OUT UINTN *NumBytes,\r
157 IN OUT UINT8 *Buffer\r
23c98c94 158 );\r
28a00297 159\r
022c6d45 160\r
162ed594 161\r
162/**\r
163 Writes the specified number of bytes from the input buffer to the block.\r
164\r
022c6d45 165 @param This Indicates the calling context.\r
166 @param Lba The starting logical block index to write to.\r
167 @param Offset Offset into the block at which to begin writing.\r
168 @param NumBytes Pointer to a UINT32. At entry, *NumBytes\r
169 contains the total size of the buffer. At exit,\r
170 *NumBytes contains the total number of bytes\r
171 actually written.\r
172 @param Buffer Pinter to a caller-allocated buffer that\r
173 contains the source for the write.\r
174\r
175 @retval EFI_SUCCESS The firmware volume was written successfully.\r
176 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.\r
177 On output, NumBytes contains the total number of\r
178 bytes actually written.\r
179 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled\r
180 state.\r
181 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not\r
182 be written.\r
162ed594 183 @retval EFI_UNSUPPORTED Not supported.\r
184\r
185**/\r
28a00297 186EFI_STATUS\r
187EFIAPI\r
188FwVolBlockWriteBlock (\r
23c98c94 189 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
190 IN EFI_LBA Lba,\r
191 IN UINTN Offset,\r
192 IN OUT UINTN *NumBytes,\r
193 IN UINT8 *Buffer\r
194 );\r
28a00297 195\r
022c6d45 196\r
162ed594 197\r
198/**\r
199 Get Fvb's base address.\r
200\r
022c6d45 201 @param This Indicates the calling context.\r
202 @param Address Fvb device base address.\r
162ed594 203\r
022c6d45 204 @retval EFI_SUCCESS Successfully got Fvb's base address.\r
162ed594 205 @retval EFI_UNSUPPORTED Not supported.\r
206\r
207**/\r
28a00297 208EFI_STATUS\r
209EFIAPI\r
210FwVolBlockGetPhysicalAddress (\r
23c98c94 211 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
212 OUT EFI_PHYSICAL_ADDRESS *Address\r
213 );\r
28a00297 214\r
28a00297 215\r
28a00297 216\r
162ed594 217/**\r
218 Retrieves the size in bytes of a specific block within a firmware volume.\r
219\r
022c6d45 220 @param This Indicates the calling context.\r
221 @param Lba Indicates the block for which to return the\r
222 size.\r
223 @param BlockSize Pointer to a caller-allocated UINTN in which the\r
224 size of the block is returned.\r
225 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the\r
226 number of consecutive blocks starting with Lba\r
227 is returned. All blocks in this range have a\r
228 size of BlockSize.\r
229\r
230 @retval EFI_SUCCESS The firmware volume base address is returned.\r
162ed594 231 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.\r
28a00297 232\r
162ed594 233**/\r
28a00297 234EFI_STATUS\r
235EFIAPI\r
236FwVolBlockGetBlockSize (\r
237 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
238 IN CONST EFI_LBA Lba,\r
23c98c94 239 IN OUT UINTN *BlockSize,\r
240 IN OUT UINTN *NumberOfBlocks\r
241 );\r
28a00297 242\r
28a00297 243\r
244#endif\r