]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/QemuFwCfgLib.h
OvmfPkg: Add QemuFwCfgLib library class and implementation
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgLib.h
1 /** @file
2 QEMU/KVM Firmware Configuration access
3
4 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __FW_CFG_LIB__
16 #define __FW_CFG_LIB__
17
18 typedef enum {
19 QemuFwCfgItemSignature = 0x0000,
20 QemuFwCfgItemInterfaceVersion = 0x0001,
21 QemuFwCfgItemSystemUuid = 0x0002,
22 QemuFwCfgItemRamSize = 0x0003,
23 QemuFwCfgItemGraphicsEnabled = 0x0004,
24 QemuFwCfgItemSmpCpuCount = 0x0005,
25 QemuFwCfgItemMachineId = 0x0006,
26 QemuFwCfgItemKernelAddress = 0x0007,
27 QemuFwCfgItemKernelSize = 0x0008,
28 QemuFwCfgItemKernelCommandLine = 0x0009,
29 QemuFwCfgItemInitrdAddress = 0x000a,
30 QemuFwCfgItemInitrdSize = 0x000b,
31 QemuFwCfgItemBootDevice = 0x000c,
32 QemuFwCfgItemNumaData = 0x000d,
33 QemuFwCfgItemBootMenu = 0x000e,
34 QemuFwCfgItemMaximumCpuCount = 0x000f,
35 QemuFwCfgItemKernelEntry = 0x0010,
36 QemuFwCfgItemKernelData = 0x0011,
37 QemuFwCfgItemInitrdData = 0x0012,
38 QemuFwCfgItemCommandLineAddress = 0x0013,
39 QemuFwCfgItemCommandLineSize = 0x0014,
40 QemuFwCfgItemCommandLineData = 0x0015,
41 QemuFwCfgItemKernelSetupAddress = 0x0016,
42 QemuFwCfgItemKernelSetupSize = 0x0017,
43 QemuFwCfgItemKernelSetupData = 0x0018,
44
45 QemuFwCfgItemX86AcpiTables = 0x8000,
46 QemuFwCfgItemX86SmbiosTables = 0x8001,
47 QemuFwCfgItemX86Irq0Override = 0x8002,
48 QemuFwCfgItemX86E820Table = 0x8003,
49 QemuFwCfgItemX86HpetData = 0x8004,
50
51 } FIRMWARE_CONFIG_ITEM;
52
53
54 /**
55 Returns a boolean indicating if the firmware configuration interface
56 is available or not.
57
58 @retval TRUE The interface is available
59 @retval FALSE The interface is not available
60
61 **/
62 BOOLEAN
63 EFIAPI
64 QemuFwCfgIsAvailable (
65 VOID
66 );
67
68
69 /**
70 Selects a firmware configuration item for reading.
71
72 Following this call, any data read from this item will start from
73 the beginning of the configuration item's data.
74
75 @param[in] QemuFwCfgItem - Firmware Configuration item to read
76
77 **/
78 VOID
79 EFIAPI
80 QemuFwCfgSelectItem (
81 IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem
82 );
83
84
85 /**
86 Reads firmware configuration bytes into a buffer
87
88 If called multiple times, then the data read will
89 continue at the offset of the firmware configuration
90 item where the previous read ended.
91
92 @param[in] Size - Size in bytes to read
93 @param[in] Buffer - Buffer to store data into
94
95 **/
96 VOID
97 EFIAPI
98 QemuFwCfgReadBytes (
99 IN UINTN Size,
100 IN VOID *Buffer OPTIONAL
101 );
102
103
104 /**
105 Reads a UINT8 firmware configuration value
106
107 @return Value of Firmware Configuration item read
108
109 **/
110 UINT8
111 EFIAPI
112 QemuFwCfgRead8 (
113 VOID
114 );
115
116
117 /**
118 Reads a UINT16 firmware configuration value
119
120 @return Value of Firmware Configuration item read
121
122 **/
123 UINT16
124 EFIAPI
125 QemuFwCfgRead16 (
126 VOID
127 );
128
129
130 /**
131 Reads a UINT32 firmware configuration value
132
133 @return Value of Firmware Configuration item read
134
135 **/
136 UINT32
137 EFIAPI
138 QemuFwCfgRead32 (
139 VOID
140 );
141
142
143 /**
144 Reads a UINT64 firmware configuration value
145
146 @return Value of Firmware Configuration item read
147
148 **/
149 UINT64
150 EFIAPI
151 QemuFwCfgRead64 (
152 VOID
153 );
154
155
156 #endif
157