]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbSmmDxe.h
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / FvbRuntimeDxe / FvbSmmDxe.h
CommitLineData
3cbfba02
DW
1/** @file\r
2\r
3 The internal header file includes the common header files, defines\r
4 internal structure and functions used by FVB module.\r
5\r
6Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>\r
7 \r\r
8 This program and the accompanying materials are licensed and made available under\r\r
9 the terms and conditions of the BSD License that accompanies this distribution. \r\r
10 The full text of the license may be found at \r\r
11 http://opensource.org/licenses/bsd-license.php. \r\r
12 \r\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r\r
15 \r\r
16\r
17**/\r
18\r
19#ifndef _SMM_FVB_DXE_H_\r
20#define _SMM_FVB_DXE_H_\r
21\r
22#include <PiDxe.h>\r
23\r
24#include <Protocol/SmmFirmwareVolumeBlock.h>\r
25#include <Protocol/SmmCommunication.h>\r
26\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/UefiDriverEntryPoint.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/BaseLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34#include <Library/DevicePathLib.h>\r
35\r
36#include <Guid/EventGroup.h>\r
37#include "FvbSmmCommon.h"\r
38\r
39#define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'S')\r
40#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FVB_DEVICE, FvbInstance, FVB_DEVICE_SIGNATURE)\r
41\r
42typedef struct {\r
43 MEDIA_FW_VOL_DEVICE_PATH FvDevPath;\r
44 EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
45} FV_PIWG_DEVICE_PATH;\r
46\r
47typedef struct {\r
48 MEMMAP_DEVICE_PATH MemMapDevPath;\r
49 EFI_DEVICE_PATH_PROTOCOL EndDevPath;\r
50} FV_MEMMAP_DEVICE_PATH;\r
51\r
52typedef struct {\r
53 UINTN Signature;\r
54 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
55 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FvbInstance;\r
56 EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL *SmmFvbInstance;\r
57} EFI_FVB_DEVICE;\r
58\r
59/**\r
60 This function retrieves the attributes and current settings of the block.\r
61\r
62 @param[in] This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.\r
63\r
64 @param[out] Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the attributes\r
65 and current settings are returned. Type EFI_FVB_ATTRIBUTES_2\r
66 is defined in EFI_FIRMWARE_VOLUME_HEADER.\r
67\r
68 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
69\r
70**/\r
71EFI_STATUS\r
72EFIAPI\r
73FvbGetAttributes (\r
74 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
75 OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
76 );\r
77\r
78\r
79 /**\r
80 Sets Volume attributes. No polarity translations are done.\r
81\r
82 @param[in] This Calling context.\r
83 @param[out] Attributes Output buffer which contains attributes.\r
84\r
85 @retval EFI_SUCCESS The function always return successfully.\r
86\r
87**/\r
88EFI_STATUS\r
89EFIAPI\r
90FvbSetAttributes (\r
91 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
92 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes\r
93 );\r
94\r
95\r
96/**\r
97 Retrieves the physical address of the device.\r
98\r
99 @param[in] This A pointer to EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL.\r
100 @param[out] Address Output buffer containing the address.\r
101\r
102 @retval EFI_SUCCESS The function always return successfully.\r
103\r
104**/\r
105EFI_STATUS\r
106EFIAPI\r
107FvbGetPhysicalAddress (\r
108 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
109 OUT EFI_PHYSICAL_ADDRESS *Address\r
110 );\r
111\r
112\r
113/**\r
114 Retrieve the size of a logical block.\r
115\r
116 @param[in] This Calling context.\r
117 @param[in] Lba Indicates which block to return the size for.\r
118 @param[out] BlockSize A pointer to a caller allocated UINTN in which\r
119 the size of the block is returned.\r
120 @param[out] NumOfBlocks A pointer to a caller allocated UINTN in which the\r
121 number of consecutive blocks starting with Lba is\r
122 returned. All blocks in this range have a size of\r
123 BlockSize.\r
124\r
125 @retval EFI_SUCCESS The function always return successfully.\r
126\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130FvbGetBlockSize (\r
131 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
132 IN EFI_LBA Lba,\r
133 OUT UINTN *BlockSize,\r
134 OUT UINTN *NumOfBlocks\r
135 );\r
136\r
137\r
138/**\r
139 Reads data beginning at Lba:Offset from FV. The Read terminates either\r
140 when *NumBytes of data have been read, or when a block boundary is\r
141 reached. *NumBytes is updated to reflect the actual number of bytes\r
142 written. The write opertion does not include erase. This routine will\r
143 attempt to write only the specified bytes. If the writes do not stick,\r
144 it will return an error.\r
145\r
146 @param[in] This Calling context.\r
147 @param[in] Lba Block in which to begin write.\r
148 @param[in] Offset Offset in the block at which to begin write\r
149 @param[in,out] NumBytes On input, indicates the requested write size. On\r
150 output, indicates the actual number of bytes written\r
151 @param[in] Buffer Buffer containing source data for the write.\r
152\r
153 @retval EFI_SUCCESS The firmware volume was read successfully and\r
154 contents are in Buffer\r
155 @retval EFI_BAD_BUFFER_SIZE Read attempted across a LBA boundary. On output,\r
156 NumBytes contains the total number of bytes returned\r
157 in Buffer\r
158 @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state\r
159 @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
160 could not be read\r
161 @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL\r
162\r
163**/\r
164EFI_STATUS\r
165EFIAPI\r
166FvbRead (\r
167 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
168 IN EFI_LBA Lba,\r
169 IN UINTN Offset,\r
170 IN OUT UINTN *NumBytes,\r
171 OUT UINT8 *Buffer\r
172 );\r
173\r
174\r
175/**\r
176 Writes data beginning at Lba:Offset from FV. The write terminates either\r
177 when *NumBytes of data have been written, or when a block boundary is\r
178 reached. *NumBytes is updated to reflect the actual number of bytes\r
179 written. The write opertion does not include erase. This routine will\r
180 attempt to write only the specified bytes. If the writes do not stick,\r
181 it will return an error.\r
182\r
183 @param[in] This Calling context.\r
184 @param[in] Lba Block in which to begin write.\r
185 @param[in] Offset Offset in the block at which to begin write.\r
186 @param[in,out] NumBytes On input, indicates the requested write size. On\r
187 output, indicates the actual number of bytes written\r
188 @param[in] Buffer Buffer containing source data for the write.\r
189\r
190 @retval EFI_SUCCESS The firmware volume was written successfully\r
191 @retval EFI_BAD_BUFFER_SIZE Write attempted across a LBA boundary. On output,\r
192 NumBytes contains the total number of bytes\r
193 actually written.\r
194 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state\r
195 @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
196 could not be written.\r
197 @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL.\r
198\r
199**/\r
200EFI_STATUS\r
201EFIAPI\r
202FvbWrite (\r
203 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
204 IN EFI_LBA Lba,\r
205 IN UINTN Offset,\r
206 IN OUT UINTN *NumBytes,\r
207 IN UINT8 *Buffer\r
208 );\r
209\r
210\r
211/**\r
212 The EraseBlock() function erases one or more blocks as denoted by the\r
213 variable argument list. The entire parameter list of blocks must be verified\r
214 prior to erasing any blocks. If a block is requested that does not exist\r
215 within the associated firmware volume (it has a larger index than the last\r
216 block of the firmware volume), the EraseBlock() function must return\r
217 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
218\r
219 @param[in] This Calling context.\r
220 @param[in] ... Starting LBA followed by Number of Lba to erase.\r
221 a -1 to terminate the list.\r
222\r
223 @retval EFI_SUCCESS The erase request was successfully completed.\r
224 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state\r
225 @retval EFI_DEVICE_ERROR The block device is not functioning correctly and\r
226 could not be written. Firmware device may have been\r
227 partially erased.\r
228\r
229**/\r
230EFI_STATUS\r
231EFIAPI\r
232FvbEraseBlocks (\r
233 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
234 ...\r
235 );\r
236\r
237#endif\r