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