]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/QemuFwCfgLib.h
OvmfPkg: LoadLinuxLib: Zero kernel parameters instead of passing garbage
[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 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 Reads a UINT8 firmware configuration value
107
108 @return Value of Firmware Configuration item read
109
110 **/
111 UINT8
112 EFIAPI
113 QemuFwCfgRead8 (
114 VOID
115 );
116
117
118 /**
119 Reads a UINT16 firmware configuration value
120
121 @return Value of Firmware Configuration item read
122
123 **/
124 UINT16
125 EFIAPI
126 QemuFwCfgRead16 (
127 VOID
128 );
129
130
131 /**
132 Reads a UINT32 firmware configuration value
133
134 @return Value of Firmware Configuration item read
135
136 **/
137 UINT32
138 EFIAPI
139 QemuFwCfgRead32 (
140 VOID
141 );
142
143
144 /**
145 Reads a UINT64 firmware configuration value
146
147 @return Value of Firmware Configuration item read
148
149 **/
150 UINT64
151 EFIAPI
152 QemuFwCfgRead64 (
153 VOID
154 );
155
156
157 /**
158 Find the configuration item corresponding to the firmware configuration file.
159
160 @param[in] Name - Name of file to look up.
161 @param[out] Item - Configuration item corresponding to the file, to be passed
162 to QemuFwCfgSelectItem ().
163 @param[out] Size - Number of bytes in the file.
164
165 @return RETURN_SUCCESS If file is found.
166 RETURN_NOT_FOUND If file is not found.
167 RETURN_UNSUPPORTED If firmware configuration is unavailable.
168
169 **/
170 RETURN_STATUS
171 EFIAPI
172 QemuFwCfgFindFile (
173 IN CONST CHAR8 *Name,
174 OUT FIRMWARE_CONFIG_ITEM *Item,
175 OUT UINTN *Size
176 );
177 #endif
178