]>
Commit | Line | Data |
---|---|---|
87ecb68b PB |
1 | #ifndef HW_PC_H |
2 | #define HW_PC_H | |
376253ec | 3 | |
fe8ce968 PMD |
4 | #include "qemu/notify.h" |
5 | #include "qapi/qapi-types-common.h" | |
9617cddb | 6 | #include "qemu/uuid.h" |
9521d42b | 7 | #include "hw/boards.h" |
0d09e41a | 8 | #include "hw/block/fdc.h" |
ebc29e1b | 9 | #include "hw/block/flash.h" |
f0bb276b | 10 | #include "hw/i386/x86.h" |
376253ec | 11 | |
ac35f13b | 12 | #include "hw/acpi/acpi_dev_interface.h" |
fe8ce968 | 13 | #include "hw/hotplug.h" |
db1015e9 | 14 | #include "qom/object.h" |
dfce81f1 | 15 | #include "hw/i386/sgx-epc.h" |
0e4edb3b | 16 | #include "hw/firmware/smbios.h" |
1ebf9001 | 17 | #include "hw/cxl/cxl.h" |
3459a625 | 18 | |
7a10ef51 LPF |
19 | #define HPET_INTCAP "hpet-intcap" |
20 | ||
619d11e4 IM |
21 | /** |
22 | * PCMachineState: | |
781bbd6b | 23 | * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling |
e3cadac0 | 24 | * @boot_cpus: number of present VCPUs |
619d11e4 | 25 | */ |
c8ed1cd7 | 26 | typedef struct PCMachineState { |
d5747cac | 27 | /*< private >*/ |
f0bb276b | 28 | X86MachineState parent_obj; |
619d11e4 IM |
29 | |
30 | /* <public> */ | |
13fc8343 EH |
31 | |
32 | /* State for other subsystems/APIs: */ | |
9ebeed0c | 33 | Notifier machine_done; |
781bbd6b | 34 | |
13fc8343 | 35 | /* Pointers to devices and objects: */ |
13fc8343 | 36 | PCIBus *bus; |
ebe15582 | 37 | I2CBus *smbus; |
ebc29e1b | 38 | PFlashCFI01 *flash[2]; |
6b8d1416 | 39 | ISADevice *pcspk; |
1b3bf138 | 40 | DeviceState *iommu; |
c87b1520 | 41 | |
13fc8343 | 42 | /* Configuration options: */ |
9a45729d | 43 | uint64_t max_ram_below_4g; |
d1048bef | 44 | OnOffAuto vmport; |
0e4edb3b | 45 | SmbiosEntryPointType smbios_entry_point_type; |
5fe79386 | 46 | |
021746c1 | 47 | bool acpi_build_enabled; |
f5878b03 CM |
48 | bool smbus_enabled; |
49 | bool sata_enabled; | |
0259c78c | 50 | bool hpet_enabled; |
4ccd5fe2 | 51 | bool i8042_enabled; |
c9e96b04 | 52 | bool default_bus_bypass_iommu; |
0657c657 | 53 | uint64_t max_fw_size; |
021746c1 | 54 | |
091c466e SK |
55 | /* ACPI Memory hotplug IO base address */ |
56 | hwaddr memhp_io_base; | |
dfce81f1 SC |
57 | |
58 | SGXEPCState sgx_epc; | |
1ebf9001 | 59 | CXLState cxl_devices_state; |
c8ed1cd7 | 60 | } PCMachineState; |
d5747cac | 61 | |
781bbd6b | 62 | #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" |
9a45729d | 63 | #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" |
f2ffbe2b | 64 | #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" |
9b23cfb7 | 65 | #define PC_MACHINE_VMPORT "vmport" |
be232eb0 | 66 | #define PC_MACHINE_SMBUS "smbus" |
272f0428 | 67 | #define PC_MACHINE_SATA "sata" |
4ccd5fe2 | 68 | #define PC_MACHINE_I8042 "i8042" |
0657c657 | 69 | #define PC_MACHINE_MAX_FW_SIZE "max-fw-size" |
0e4edb3b EH |
70 | #define PC_MACHINE_SMBIOS_EP "smbios-entry-point-type" |
71 | ||
95bee274 IM |
72 | /** |
73 | * PCMachineClass: | |
13fc8343 | 74 | * |
13fc8343 EH |
75 | * Compat fields: |
76 | * | |
16a9e8a5 EH |
77 | * @enforce_aligned_dimm: check that DIMM's address/size is aligned by |
78 | * backend's alignment value if provided | |
13fc8343 EH |
79 | * @acpi_data_size: Size of the chunk of memory at the top of RAM |
80 | * for the BIOS ACPI tables and other BIOS | |
81 | * datastructures. | |
82 | * @gigabyte_align: Make sure that guest addresses aligned at | |
83 | * 1Gbyte boundaries get mapped to host | |
84 | * addresses aligned at 1Gbyte boundaries. This | |
85 | * way we can use 1GByte pages in the host. | |
86 | * | |
95bee274 | 87 | */ |
db1015e9 | 88 | struct PCMachineClass { |
d5747cac | 89 | /*< private >*/ |
f0bb276b | 90 | X86MachineClass parent_class; |
95bee274 IM |
91 | |
92 | /*< public >*/ | |
13fc8343 | 93 | |
13fc8343 | 94 | /* Device configuration: */ |
7102fa70 | 95 | bool pci_enabled; |
13fc8343 | 96 | bool kvmclock_enabled; |
4b9c264b | 97 | const char *default_nic_model; |
13fc8343 EH |
98 | |
99 | /* Compat options: */ | |
100 | ||
0788a56b EH |
101 | /* Default CPU model version. See x86_cpu_set_default_version(). */ |
102 | int default_cpu_version; | |
103 | ||
13fc8343 | 104 | /* ACPI compat: */ |
7102fa70 EH |
105 | bool has_acpi_build; |
106 | bool rsdp_in_ram; | |
13fc8343 EH |
107 | int legacy_acpi_table_size; |
108 | unsigned acpi_data_size; | |
0a343a5a | 109 | int pci_root_uid; |
13fc8343 EH |
110 | |
111 | /* SMBIOS compat: */ | |
7102fa70 EH |
112 | bool smbios_defaults; |
113 | bool smbios_legacy_mode; | |
114 | bool smbios_uuid_encoded; | |
13fc8343 EH |
115 | |
116 | /* RAM / address space compat: */ | |
7102fa70 EH |
117 | bool gigabyte_align; |
118 | bool has_reserved_memory; | |
16a9e8a5 | 119 | bool enforce_aligned_dimm; |
13fc8343 | 120 | bool broken_reserved_end; |
b3e6982b | 121 | bool enforce_amd_1tb_hole; |
36f96c4b | 122 | |
679dd1a9 IM |
123 | /* generate legacy CPU hotplug AML */ |
124 | bool legacy_cpu_hotplug; | |
98e753a6 | 125 | |
fda672b5 SG |
126 | /* use PVH to load kernels that support this feature */ |
127 | bool pvh_enabled; | |
8700a984 VK |
128 | |
129 | /* create kvmclock device even when KVM PV features are not exposed */ | |
130 | bool kvmclock_create_always; | |
67f7e426 JD |
131 | |
132 | /* skip passing an rng seed for legacy machines */ | |
133 | bool legacy_no_rng_seed; | |
db1015e9 | 134 | }; |
d5747cac | 135 | |
d5747cac | 136 | #define TYPE_PC_MACHINE "generic-pc-machine" |
a489d195 | 137 | OBJECT_DECLARE_TYPE(PCMachineState, PCMachineClass, PC_MACHINE) |
d5747cac | 138 | |
d665d696 PB |
139 | /* ioapic.c */ |
140 | ||
417258f1 PMD |
141 | GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled); |
142 | ||
87ecb68b PB |
143 | /* pc.c */ |
144 | extern int fd_bootchk; | |
145 | ||
845773ab IY |
146 | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
147 | ||
e4e8ba04 | 148 | void pc_guest_info_init(PCMachineState *pcms); |
3459a625 | 149 | |
39848901 IM |
150 | #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" |
151 | #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" | |
152 | #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" | |
153 | #define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" | |
154 | #define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" | |
401f2f3e EV |
155 | #define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" |
156 | #define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" | |
1466cef3 | 157 | |
39848901 | 158 | |
83d08f26 MT |
159 | void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, |
160 | MemoryRegion *pci_address_space); | |
39848901 | 161 | |
7bc35e0f | 162 | void xen_load_linux(PCMachineState *pcms); |
5934e216 EH |
163 | void pc_memory_init(PCMachineState *pcms, |
164 | MemoryRegion *system_memory, | |
165 | MemoryRegion *rom_memory, | |
c48eb7a4 JM |
166 | MemoryRegion **ram_memory, |
167 | uint64_t pci_hole64_size); | |
9fa99d25 | 168 | uint64_t pc_pci_hole64_start(void); |
48a18b3c | 169 | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
10e2483b GH |
170 | void pc_basic_device_init(struct PCMachineState *pcms, |
171 | ISABus *isa_bus, qemu_irq *gsi, | |
1611977c | 172 | ISADevice **rtc_state, |
fd53c87c | 173 | bool create_fdctrl, |
3a87d009 | 174 | uint32_t hpet_irqs); |
23d30407 | 175 | void pc_cmos_init(PCMachineState *pcms, |
220a8846 | 176 | BusState *ide0, BusState *ide1, |
63ffb564 | 177 | ISADevice *s); |
4b9c264b | 178 | void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); |
f885f1ea | 179 | |
4501d317 | 180 | void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); |
a39e3564 | 181 | |
d3e07dc8 | 182 | /* port92.c */ |
d812b3d6 EV |
183 | #define PORT92_A20_LINE "a20" |
184 | ||
d3e07dc8 PMD |
185 | #define TYPE_PORT92 "port92" |
186 | ||
cbc5b5f3 | 187 | /* pc_sysfw.c */ |
ebc29e1b | 188 | void pc_system_flash_create(PCMachineState *pcms); |
dd29b5c3 | 189 | void pc_system_flash_cleanup_unused(PCMachineState *pcms); |
5e640a9e | 190 | void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory); |
9617cddb JB |
191 | bool pc_system_ovmf_table_find(const char *entry, uint8_t **data, |
192 | int *data_len); | |
b5b31860 | 193 | void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size); |
9617cddb | 194 | |
d0aa026a | 195 | /* hw/i386/acpi-common.c */ |
ac35f13b | 196 | void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, |
d0aa026a IM |
197 | const CPUArchIdList *apic_ids, GArray *entry, |
198 | bool force_enabled); | |
ac35f13b | 199 | |
1dec2e1f SC |
200 | /* sgx.c */ |
201 | void pc_machine_init_sgx_epc(PCMachineState *pcms); | |
202 | ||
f514e147 CH |
203 | extern GlobalProperty pc_compat_7_1[]; |
204 | extern const size_t pc_compat_7_1_len; | |
205 | ||
0ca70366 CH |
206 | extern GlobalProperty pc_compat_7_0[]; |
207 | extern const size_t pc_compat_7_0_len; | |
208 | ||
01854af2 CH |
209 | extern GlobalProperty pc_compat_6_2[]; |
210 | extern const size_t pc_compat_6_2_len; | |
211 | ||
52e64f5b YW |
212 | extern GlobalProperty pc_compat_6_1[]; |
213 | extern const size_t pc_compat_6_1_len; | |
214 | ||
da7e13c0 CH |
215 | extern GlobalProperty pc_compat_6_0[]; |
216 | extern const size_t pc_compat_6_0_len; | |
217 | ||
576a00bd CH |
218 | extern GlobalProperty pc_compat_5_2[]; |
219 | extern const size_t pc_compat_5_2_len; | |
220 | ||
3ff3c5d3 CH |
221 | extern GlobalProperty pc_compat_5_1[]; |
222 | extern const size_t pc_compat_5_1_len; | |
223 | ||
541aaa1d CH |
224 | extern GlobalProperty pc_compat_5_0[]; |
225 | extern const size_t pc_compat_5_0_len; | |
226 | ||
3eb74d20 CH |
227 | extern GlobalProperty pc_compat_4_2[]; |
228 | extern const size_t pc_compat_4_2_len; | |
229 | ||
9aec2e52 CH |
230 | extern GlobalProperty pc_compat_4_1[]; |
231 | extern const size_t pc_compat_4_1_len; | |
232 | ||
9bf2650b CH |
233 | extern GlobalProperty pc_compat_4_0[]; |
234 | extern const size_t pc_compat_4_0_len; | |
235 | ||
abd93cc7 MAL |
236 | extern GlobalProperty pc_compat_3_1[]; |
237 | extern const size_t pc_compat_3_1_len; | |
84e060bf | 238 | |
ddb3235d MAL |
239 | extern GlobalProperty pc_compat_3_0[]; |
240 | extern const size_t pc_compat_3_0_len; | |
9b4cf107 | 241 | |
0d47310b MAL |
242 | extern GlobalProperty pc_compat_2_12[]; |
243 | extern const size_t pc_compat_2_12_len; | |
968ee4ad | 244 | |
43df70a9 MAL |
245 | extern GlobalProperty pc_compat_2_11[]; |
246 | extern const size_t pc_compat_2_11_len; | |
df47ce8a | 247 | |
503224f4 MAL |
248 | extern GlobalProperty pc_compat_2_10[]; |
249 | extern const size_t pc_compat_2_10_len; | |
a6fd5b0e | 250 | |
3e803152 MAL |
251 | extern GlobalProperty pc_compat_2_9[]; |
252 | extern const size_t pc_compat_2_9_len; | |
465238d9 | 253 | |
edc24ccd MAL |
254 | extern GlobalProperty pc_compat_2_8[]; |
255 | extern const size_t pc_compat_2_8_len; | |
abc62c89 | 256 | |
5a995064 MAL |
257 | extern GlobalProperty pc_compat_2_7[]; |
258 | extern const size_t pc_compat_2_7_len; | |
14c985cf | 259 | |
ff8f261f MAL |
260 | extern GlobalProperty pc_compat_2_6[]; |
261 | extern const size_t pc_compat_2_6_len; | |
d86c1451 | 262 | |
fe759610 MAL |
263 | extern GlobalProperty pc_compat_2_5[]; |
264 | extern const size_t pc_compat_2_5_len; | |
240240d5 | 265 | |
2f99b9c2 MAL |
266 | extern GlobalProperty pc_compat_2_4[]; |
267 | extern const size_t pc_compat_2_4_len; | |
268 | ||
8995dd90 MAL |
269 | extern GlobalProperty pc_compat_2_3[]; |
270 | extern const size_t pc_compat_2_3_len; | |
271 | ||
1c30044e MAL |
272 | extern GlobalProperty pc_compat_2_2[]; |
273 | extern const size_t pc_compat_2_2_len; | |
274 | ||
c4fc5695 MAL |
275 | extern GlobalProperty pc_compat_2_1[]; |
276 | extern const size_t pc_compat_2_1_len; | |
277 | ||
a310e653 MAL |
278 | extern GlobalProperty pc_compat_2_0[]; |
279 | extern const size_t pc_compat_2_0_len; | |
280 | ||
281 | extern GlobalProperty pc_compat_1_7[]; | |
282 | extern const size_t pc_compat_1_7_len; | |
283 | ||
284 | extern GlobalProperty pc_compat_1_6[]; | |
285 | extern const size_t pc_compat_1_6_len; | |
286 | ||
287 | extern GlobalProperty pc_compat_1_5[]; | |
288 | extern const size_t pc_compat_1_5_len; | |
289 | ||
290 | extern GlobalProperty pc_compat_1_4[]; | |
291 | extern const size_t pc_compat_1_4_len; | |
292 | ||
25519b06 | 293 | #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ |
865906f7 EH |
294 | static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ |
295 | { \ | |
296 | MachineClass *mc = MACHINE_CLASS(oc); \ | |
297 | optsfn(mc); \ | |
865906f7 EH |
298 | mc->init = initfn; \ |
299 | } \ | |
300 | static const TypeInfo pc_machine_type_##suffix = { \ | |
301 | .name = namestr TYPE_MACHINE_SUFFIX, \ | |
302 | .parent = TYPE_PC_MACHINE, \ | |
303 | .class_init = pc_machine_##suffix##_class_init, \ | |
304 | }; \ | |
61f219df EH |
305 | static void pc_machine_init_##suffix(void) \ |
306 | { \ | |
865906f7 | 307 | type_register(&pc_machine_type_##suffix); \ |
61f219df | 308 | } \ |
0e6aac87 | 309 | type_init(pc_machine_init_##suffix) |
61f219df | 310 | |
87ecb68b | 311 | #endif |