]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/QemuFwCfgLib.h
OvmfPkg: XenHypercallLib: add empty constructor for ARM & AARCH64
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgLib.h
CommitLineData
f1ec65ba 1/** @file\r
2 QEMU/KVM Firmware Configuration access\r
3\r
29874a8c 4 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
0dc231c9
LE
5 Copyright (C) 2013, Red Hat, Inc.\r
6\r
f1ec65ba 7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef __FW_CFG_LIB__\r
18#define __FW_CFG_LIB__\r
19\r
6a904296
LE
20//\r
21// The size, in bytes, of names of firmware configuration files, including at\r
22// least one terminating NUL byte.\r
23//\r
24#define QEMU_FW_CFG_FNAME_SIZE 56\r
25\r
f1ec65ba 26typedef enum {\r
27 QemuFwCfgItemSignature = 0x0000,\r
28 QemuFwCfgItemInterfaceVersion = 0x0001,\r
29 QemuFwCfgItemSystemUuid = 0x0002,\r
30 QemuFwCfgItemRamSize = 0x0003,\r
31 QemuFwCfgItemGraphicsEnabled = 0x0004,\r
32 QemuFwCfgItemSmpCpuCount = 0x0005,\r
33 QemuFwCfgItemMachineId = 0x0006,\r
34 QemuFwCfgItemKernelAddress = 0x0007,\r
35 QemuFwCfgItemKernelSize = 0x0008,\r
36 QemuFwCfgItemKernelCommandLine = 0x0009,\r
37 QemuFwCfgItemInitrdAddress = 0x000a,\r
38 QemuFwCfgItemInitrdSize = 0x000b,\r
39 QemuFwCfgItemBootDevice = 0x000c,\r
40 QemuFwCfgItemNumaData = 0x000d,\r
41 QemuFwCfgItemBootMenu = 0x000e,\r
42 QemuFwCfgItemMaximumCpuCount = 0x000f,\r
43 QemuFwCfgItemKernelEntry = 0x0010,\r
44 QemuFwCfgItemKernelData = 0x0011,\r
45 QemuFwCfgItemInitrdData = 0x0012,\r
46 QemuFwCfgItemCommandLineAddress = 0x0013,\r
47 QemuFwCfgItemCommandLineSize = 0x0014,\r
48 QemuFwCfgItemCommandLineData = 0x0015,\r
49 QemuFwCfgItemKernelSetupAddress = 0x0016,\r
50 QemuFwCfgItemKernelSetupSize = 0x0017,\r
51 QemuFwCfgItemKernelSetupData = 0x0018,\r
0ac9bc9b 52 QemuFwCfgItemFileDir = 0x0019,\r
f1ec65ba 53\r
54 QemuFwCfgItemX86AcpiTables = 0x8000,\r
55 QemuFwCfgItemX86SmbiosTables = 0x8001,\r
56 QemuFwCfgItemX86Irq0Override = 0x8002,\r
57 QemuFwCfgItemX86E820Table = 0x8003,\r
58 QemuFwCfgItemX86HpetData = 0x8004,\r
59\r
60} FIRMWARE_CONFIG_ITEM;\r
61\r
62\r
63/**\r
64 Returns a boolean indicating if the firmware configuration interface\r
65 is available or not.\r
66\r
0dc231c9
LE
67 This function may change fw_cfg state.\r
68\r
f1ec65ba 69 @retval TRUE The interface is available\r
70 @retval FALSE The interface is not available\r
71\r
72**/\r
73BOOLEAN\r
74EFIAPI\r
75QemuFwCfgIsAvailable (\r
76 VOID\r
77 );\r
78\r
79\r
80/**\r
81 Selects a firmware configuration item for reading.\r
82\r
83 Following this call, any data read from this item will start from\r
84 the beginning of the configuration item's data.\r
85\r
86 @param[in] QemuFwCfgItem - Firmware Configuration item to read\r
87\r
88**/\r
89VOID\r
90EFIAPI\r
91QemuFwCfgSelectItem (\r
92 IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem\r
93 );\r
94\r
95\r
96/**\r
97 Reads firmware configuration bytes into a buffer\r
98\r
99 If called multiple times, then the data read will\r
100 continue at the offset of the firmware configuration\r
101 item where the previous read ended.\r
102\r
103 @param[in] Size - Size in bytes to read\r
104 @param[in] Buffer - Buffer to store data into\r
105\r
106**/\r
107VOID\r
108EFIAPI\r
109QemuFwCfgReadBytes (\r
110 IN UINTN Size,\r
111 IN VOID *Buffer OPTIONAL\r
112 );\r
113\r
114\r
29874a8c 115/**\r
116 Writes firmware configuration bytes from a buffer\r
117\r
118 If called multiple times, then the data written will\r
119 continue at the offset of the firmware configuration\r
120 item where the previous write ended.\r
121\r
122 @param[in] Size - Size in bytes to write\r
123 @param[in] Buffer - Buffer to read data from\r
124\r
125**/\r
126VOID\r
127EFIAPI\r
128QemuFwCfgWriteBytes (\r
129 IN UINTN Size,\r
130 IN VOID *Buffer\r
131 );\r
132\r
133\r
f1ec65ba 134/**\r
135 Reads a UINT8 firmware configuration value\r
136\r
137 @return Value of Firmware Configuration item read\r
138\r
139**/\r
140UINT8\r
141EFIAPI\r
142QemuFwCfgRead8 (\r
143 VOID\r
144 );\r
145\r
146\r
147/**\r
148 Reads a UINT16 firmware configuration value\r
149\r
150 @return Value of Firmware Configuration item read\r
151\r
152**/\r
153UINT16\r
154EFIAPI\r
155QemuFwCfgRead16 (\r
156 VOID\r
157 );\r
158\r
159\r
160/**\r
161 Reads a UINT32 firmware configuration value\r
162\r
163 @return Value of Firmware Configuration item read\r
164\r
165**/\r
166UINT32\r
167EFIAPI\r
168QemuFwCfgRead32 (\r
169 VOID\r
170 );\r
171\r
172\r
173/**\r
174 Reads a UINT64 firmware configuration value\r
175\r
176 @return Value of Firmware Configuration item read\r
177\r
178**/\r
179UINT64\r
180EFIAPI\r
181QemuFwCfgRead64 (\r
182 VOID\r
183 );\r
184\r
185\r
0ac9bc9b 186/**\r
187 Find the configuration item corresponding to the firmware configuration file.\r
188\r
189 @param[in] Name - Name of file to look up.\r
190 @param[out] Item - Configuration item corresponding to the file, to be passed\r
191 to QemuFwCfgSelectItem ().\r
192 @param[out] Size - Number of bytes in the file.\r
193\r
194 @return RETURN_SUCCESS If file is found.\r
195 RETURN_NOT_FOUND If file is not found.\r
196 RETURN_UNSUPPORTED If firmware configuration is unavailable.\r
197\r
198**/\r
199RETURN_STATUS\r
200EFIAPI\r
201QemuFwCfgFindFile (\r
202 IN CONST CHAR8 *Name,\r
203 OUT FIRMWARE_CONFIG_ITEM *Item,\r
204 OUT UINTN *Size\r
205 );\r
0dc231c9
LE
206\r
207\r
208/**\r
209 Returns a boolean indicating if the firmware configuration interface is\r
210 available for library-internal purposes.\r
211\r
212 This function never changes fw_cfg state.\r
213\r
214 @retval TRUE The interface is available internally.\r
215 @retval FALSE The interface is not available internally.\r
216**/\r
217BOOLEAN\r
218EFIAPI\r
219InternalQemuFwCfgIsAvailable (\r
220 VOID\r
221 );\r
222\r
14eb7a5b
LE
223\r
224/**\r
225 Determine if S3 support is explicitly enabled.\r
226\r
227 @retval TRUE if S3 support is explicitly enabled.\r
228 FALSE otherwise. This includes unavailability of the firmware\r
229 configuration interface.\r
230**/\r
231BOOLEAN\r
232EFIAPI\r
233QemuFwCfgS3Enabled (\r
234 VOID\r
235 );\r
236\r
f1ec65ba 237#endif\r
238\r