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