]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/QemuFwCfgLib.h
OvmfPkg: adapt VirtioPrepare()'s leading comment to the coding style
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgLib.h
1 /** @file
2 QEMU/KVM Firmware Configuration access
3
4 Copyright (c) 2011 - 2013, 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 QemuFwCfgItemFileDir = 0x0019,
45
46 QemuFwCfgItemX86AcpiTables = 0x8000,
47 QemuFwCfgItemX86SmbiosTables = 0x8001,
48 QemuFwCfgItemX86Irq0Override = 0x8002,
49 QemuFwCfgItemX86E820Table = 0x8003,
50 QemuFwCfgItemX86HpetData = 0x8004,
51
52 } FIRMWARE_CONFIG_ITEM;
53
54
55 /**
56 Returns a boolean indicating if the firmware configuration interface
57 is available or not.
58
59 @retval TRUE The interface is available
60 @retval FALSE The interface is not available
61
62 **/
63 BOOLEAN
64 EFIAPI
65 QemuFwCfgIsAvailable (
66 VOID
67 );
68
69
70 /**
71 Selects a firmware configuration item for reading.
72
73 Following this call, any data read from this item will start from
74 the beginning of the configuration item's data.
75
76 @param[in] QemuFwCfgItem - Firmware Configuration item to read
77
78 **/
79 VOID
80 EFIAPI
81 QemuFwCfgSelectItem (
82 IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem
83 );
84
85
86 /**
87 Reads firmware configuration bytes into a buffer
88
89 If called multiple times, then the data read will
90 continue at the offset of the firmware configuration
91 item where the previous read ended.
92
93 @param[in] Size - Size in bytes to read
94 @param[in] Buffer - Buffer to store data into
95
96 **/
97 VOID
98 EFIAPI
99 QemuFwCfgReadBytes (
100 IN UINTN Size,
101 IN VOID *Buffer OPTIONAL
102 );
103
104
105 /**
106 Writes firmware configuration bytes from a buffer
107
108 If called multiple times, then the data written will
109 continue at the offset of the firmware configuration
110 item where the previous write ended.
111
112 @param[in] Size - Size in bytes to write
113 @param[in] Buffer - Buffer to read data from
114
115 **/
116 VOID
117 EFIAPI
118 QemuFwCfgWriteBytes (
119 IN UINTN Size,
120 IN VOID *Buffer
121 );
122
123
124 /**
125 Reads a UINT8 firmware configuration value
126
127 @return Value of Firmware Configuration item read
128
129 **/
130 UINT8
131 EFIAPI
132 QemuFwCfgRead8 (
133 VOID
134 );
135
136
137 /**
138 Reads a UINT16 firmware configuration value
139
140 @return Value of Firmware Configuration item read
141
142 **/
143 UINT16
144 EFIAPI
145 QemuFwCfgRead16 (
146 VOID
147 );
148
149
150 /**
151 Reads a UINT32 firmware configuration value
152
153 @return Value of Firmware Configuration item read
154
155 **/
156 UINT32
157 EFIAPI
158 QemuFwCfgRead32 (
159 VOID
160 );
161
162
163 /**
164 Reads a UINT64 firmware configuration value
165
166 @return Value of Firmware Configuration item read
167
168 **/
169 UINT64
170 EFIAPI
171 QemuFwCfgRead64 (
172 VOID
173 );
174
175
176 /**
177 Find the configuration item corresponding to the firmware configuration file.
178
179 @param[in] Name - Name of file to look up.
180 @param[out] Item - Configuration item corresponding to the file, to be passed
181 to QemuFwCfgSelectItem ().
182 @param[out] Size - Number of bytes in the file.
183
184 @return RETURN_SUCCESS If file is found.
185 RETURN_NOT_FOUND If file is not found.
186 RETURN_UNSUPPORTED If firmware configuration is unavailable.
187
188 **/
189 RETURN_STATUS
190 EFIAPI
191 QemuFwCfgFindFile (
192 IN CONST CHAR8 *Name,
193 OUT FIRMWARE_CONFIG_ITEM *Item,
194 OUT UINTN *Size
195 );
196 #endif
197