2 QEMU/KVM Firmware Configuration access
4 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
5 Copyright (C) 2013, Red Hat, Inc.
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef __FW_CFG_LIB__
18 #define __FW_CFG_LIB__
21 QemuFwCfgItemSignature
= 0x0000,
22 QemuFwCfgItemInterfaceVersion
= 0x0001,
23 QemuFwCfgItemSystemUuid
= 0x0002,
24 QemuFwCfgItemRamSize
= 0x0003,
25 QemuFwCfgItemGraphicsEnabled
= 0x0004,
26 QemuFwCfgItemSmpCpuCount
= 0x0005,
27 QemuFwCfgItemMachineId
= 0x0006,
28 QemuFwCfgItemKernelAddress
= 0x0007,
29 QemuFwCfgItemKernelSize
= 0x0008,
30 QemuFwCfgItemKernelCommandLine
= 0x0009,
31 QemuFwCfgItemInitrdAddress
= 0x000a,
32 QemuFwCfgItemInitrdSize
= 0x000b,
33 QemuFwCfgItemBootDevice
= 0x000c,
34 QemuFwCfgItemNumaData
= 0x000d,
35 QemuFwCfgItemBootMenu
= 0x000e,
36 QemuFwCfgItemMaximumCpuCount
= 0x000f,
37 QemuFwCfgItemKernelEntry
= 0x0010,
38 QemuFwCfgItemKernelData
= 0x0011,
39 QemuFwCfgItemInitrdData
= 0x0012,
40 QemuFwCfgItemCommandLineAddress
= 0x0013,
41 QemuFwCfgItemCommandLineSize
= 0x0014,
42 QemuFwCfgItemCommandLineData
= 0x0015,
43 QemuFwCfgItemKernelSetupAddress
= 0x0016,
44 QemuFwCfgItemKernelSetupSize
= 0x0017,
45 QemuFwCfgItemKernelSetupData
= 0x0018,
46 QemuFwCfgItemFileDir
= 0x0019,
48 QemuFwCfgItemX86AcpiTables
= 0x8000,
49 QemuFwCfgItemX86SmbiosTables
= 0x8001,
50 QemuFwCfgItemX86Irq0Override
= 0x8002,
51 QemuFwCfgItemX86E820Table
= 0x8003,
52 QemuFwCfgItemX86HpetData
= 0x8004,
54 } FIRMWARE_CONFIG_ITEM
;
58 Returns a boolean indicating if the firmware configuration interface
61 This function may change fw_cfg state.
63 @retval TRUE The interface is available
64 @retval FALSE The interface is not available
69 QemuFwCfgIsAvailable (
75 Selects a firmware configuration item for reading.
77 Following this call, any data read from this item will start from
78 the beginning of the configuration item's data.
80 @param[in] QemuFwCfgItem - Firmware Configuration item to read
86 IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem
91 Reads firmware configuration bytes into a buffer
93 If called multiple times, then the data read will
94 continue at the offset of the firmware configuration
95 item where the previous read ended.
97 @param[in] Size - Size in bytes to read
98 @param[in] Buffer - Buffer to store data into
105 IN VOID
*Buffer OPTIONAL
110 Writes firmware configuration bytes from a buffer
112 If called multiple times, then the data written will
113 continue at the offset of the firmware configuration
114 item where the previous write ended.
116 @param[in] Size - Size in bytes to write
117 @param[in] Buffer - Buffer to read data from
122 QemuFwCfgWriteBytes (
129 Reads a UINT8 firmware configuration value
131 @return Value of Firmware Configuration item read
142 Reads a UINT16 firmware configuration value
144 @return Value of Firmware Configuration item read
155 Reads a UINT32 firmware configuration value
157 @return Value of Firmware Configuration item read
168 Reads a UINT64 firmware configuration value
170 @return Value of Firmware Configuration item read
181 Find the configuration item corresponding to the firmware configuration file.
183 @param[in] Name - Name of file to look up.
184 @param[out] Item - Configuration item corresponding to the file, to be passed
185 to QemuFwCfgSelectItem ().
186 @param[out] Size - Number of bytes in the file.
188 @return RETURN_SUCCESS If file is found.
189 RETURN_NOT_FOUND If file is not found.
190 RETURN_UNSUPPORTED If firmware configuration is unavailable.
196 IN CONST CHAR8
*Name
,
197 OUT FIRMWARE_CONFIG_ITEM
*Item
,
203 Returns a boolean indicating if the firmware configuration interface is
204 available for library-internal purposes.
206 This function never changes fw_cfg state.
208 @retval TRUE The interface is available internally.
209 @retval FALSE The interface is not available internally.
213 InternalQemuFwCfgIsAvailable (
219 Determine if S3 support is explicitly enabled.
221 @retval TRUE if S3 support is explicitly enabled.
222 FALSE otherwise. This includes unavailability of the firmware
223 configuration interface.