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