]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
hw/i386: Add 'vmport.h' local header
[mirror_qemu.git] / include / hw / i386 / pc.h
CommitLineData
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"
9521d42b 6#include "hw/boards.h"
0d09e41a 7#include "hw/block/fdc.h"
ebc29e1b 8#include "hw/block/flash.h"
f0bb276b 9#include "hw/i386/x86.h"
376253ec 10
ac35f13b 11#include "hw/acpi/acpi_dev_interface.h"
fe8ce968 12#include "hw/hotplug.h"
3459a625 13
7a10ef51
LPF
14#define HPET_INTCAP "hpet-intcap"
15
619d11e4
IM
16/**
17 * PCMachineState:
781bbd6b 18 * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
e3cadac0 19 * @boot_cpus: number of present VCPUs
c26ae610 20 * @smp_dies: number of dies per one package
619d11e4 21 */
d5747cac
IM
22struct PCMachineState {
23 /*< private >*/
f0bb276b 24 X86MachineState parent_obj;
619d11e4
IM
25
26 /* <public> */
13fc8343
EH
27
28 /* State for other subsystems/APIs: */
9ebeed0c 29 Notifier machine_done;
781bbd6b 30
13fc8343 31 /* Pointers to devices and objects: */
781bbd6b 32 HotplugHandler *acpi_dev;
13fc8343 33 PCIBus *bus;
ebe15582 34 I2CBus *smbus;
ebc29e1b 35 PFlashCFI01 *flash[2];
c87b1520 36
13fc8343 37 /* Configuration options: */
d1048bef 38 OnOffAuto vmport;
5fe79386 39
021746c1 40 bool acpi_build_enabled;
f5878b03
CM
41 bool smbus_enabled;
42 bool sata_enabled;
43 bool pit_enabled;
021746c1 44
dd4c2f01
EH
45 /* NUMA information: */
46 uint64_t numa_nodes;
47 uint64_t *node_mem;
cb135f59 48
091c466e
SK
49 /* ACPI Memory hotplug IO base address */
50 hwaddr memhp_io_base;
d5747cac
IM
51};
52
781bbd6b 53#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
f2ffbe2b 54#define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
9b23cfb7 55#define PC_MACHINE_VMPORT "vmport"
be232eb0 56#define PC_MACHINE_SMBUS "smbus"
272f0428 57#define PC_MACHINE_SATA "sata"
feddd2fd 58#define PC_MACHINE_PIT "pit"
781bbd6b 59
95bee274
IM
60/**
61 * PCMachineClass:
13fc8343 62 *
13fc8343
EH
63 * Compat fields:
64 *
16a9e8a5
EH
65 * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
66 * backend's alignment value if provided
13fc8343
EH
67 * @acpi_data_size: Size of the chunk of memory at the top of RAM
68 * for the BIOS ACPI tables and other BIOS
69 * datastructures.
70 * @gigabyte_align: Make sure that guest addresses aligned at
71 * 1Gbyte boundaries get mapped to host
72 * addresses aligned at 1Gbyte boundaries. This
73 * way we can use 1GByte pages in the host.
74 *
95bee274 75 */
639f642c 76typedef struct PCMachineClass {
d5747cac 77 /*< private >*/
f0bb276b 78 X86MachineClass parent_class;
95bee274
IM
79
80 /*< public >*/
13fc8343 81
13fc8343 82 /* Device configuration: */
7102fa70 83 bool pci_enabled;
13fc8343 84 bool kvmclock_enabled;
4b9c264b 85 const char *default_nic_model;
13fc8343
EH
86
87 /* Compat options: */
88
0788a56b
EH
89 /* Default CPU model version. See x86_cpu_set_default_version(). */
90 int default_cpu_version;
91
13fc8343 92 /* ACPI compat: */
7102fa70
EH
93 bool has_acpi_build;
94 bool rsdp_in_ram;
13fc8343
EH
95 int legacy_acpi_table_size;
96 unsigned acpi_data_size;
ebe15582 97 bool do_not_add_smb_acpi;
13fc8343
EH
98
99 /* SMBIOS compat: */
7102fa70
EH
100 bool smbios_defaults;
101 bool smbios_legacy_mode;
102 bool smbios_uuid_encoded;
13fc8343
EH
103
104 /* RAM / address space compat: */
7102fa70
EH
105 bool gigabyte_align;
106 bool has_reserved_memory;
16a9e8a5 107 bool enforce_aligned_dimm;
13fc8343 108 bool broken_reserved_end;
36f96c4b 109
679dd1a9
IM
110 /* generate legacy CPU hotplug AML */
111 bool legacy_cpu_hotplug;
98e753a6
IM
112
113 /* use DMA capable linuxboot option rom */
114 bool linuxboot_dma_enabled;
fda672b5
SG
115
116 /* use PVH to load kernels that support this feature */
117 bool pvh_enabled;
639f642c 118} PCMachineClass;
d5747cac 119
d5747cac
IM
120#define TYPE_PC_MACHINE "generic-pc-machine"
121#define PC_MACHINE(obj) \
122 OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
123#define PC_MACHINE_GET_CLASS(obj) \
124 OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
125#define PC_MACHINE_CLASS(klass) \
126 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
127
d665d696
PB
128/* ioapic.c */
129
417258f1
PMD
130GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled);
131
87ecb68b 132/* vmport.c */
86d86414
BS
133void vmmouse_get_data(uint32_t *data);
134void vmmouse_set_data(const uint32_t *data);
87ecb68b 135
87ecb68b
PB
136/* pc.c */
137extern int fd_bootchk;
138
845773ab
IY
139void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
140
a0628599 141void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
6f479566 142void pc_smp_parse(MachineState *ms, QemuOpts *opts);
3459a625 143
e4e8ba04 144void pc_guest_info_init(PCMachineState *pcms);
3459a625 145
39848901
IM
146#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
147#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
148#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
149#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
150#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
401f2f3e
EV
151#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size"
152#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size"
1466cef3 153
39848901 154
83d08f26
MT
155void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
156 MemoryRegion *pci_address_space);
39848901 157
7bc35e0f 158void xen_load_linux(PCMachineState *pcms);
5934e216
EH
159void pc_memory_init(PCMachineState *pcms,
160 MemoryRegion *system_memory,
161 MemoryRegion *rom_memory,
162 MemoryRegion **ram_memory);
9fa99d25 163uint64_t pc_pci_hole64_start(void);
48a18b3c
HP
164DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
165void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
1611977c 166 ISADevice **rtc_state,
fd53c87c 167 bool create_fdctrl,
7a10ef51 168 bool no_vmport,
feddd2fd 169 bool has_pit,
3a87d009 170 uint32_t hpet_irqs);
48a18b3c 171void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 172void pc_cmos_init(PCMachineState *pcms,
220a8846 173 BusState *ide0, BusState *ide1,
63ffb564 174 ISADevice *s);
4b9c264b 175void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus);
845773ab 176void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 177
f885f1ea 178typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 179
4501d317 180void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs);
a39e3564 181
424e4a87 182ISADevice *pc_find_fdc0(void);
bda05509 183int cmos_get_fd_drive_type(FloppyDriveType fd0);
424e4a87 184
d3e07dc8 185/* port92.c */
d812b3d6
EV
186#define PORT92_A20_LINE "a20"
187
d3e07dc8
PMD
188#define TYPE_PORT92 "port92"
189
cbc5b5f3 190/* pc_sysfw.c */
ebc29e1b 191void pc_system_flash_create(PCMachineState *pcms);
5e640a9e 192void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory);
cbc5b5f3 193
ac35f13b
IM
194/* acpi-build.c */
195void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
80e5db30 196 const CPUArchIdList *apic_ids, GArray *entry);
ac35f13b 197
3eb74d20
CH
198extern GlobalProperty pc_compat_4_2[];
199extern const size_t pc_compat_4_2_len;
200
9aec2e52
CH
201extern GlobalProperty pc_compat_4_1[];
202extern const size_t pc_compat_4_1_len;
203
9bf2650b
CH
204extern GlobalProperty pc_compat_4_0[];
205extern const size_t pc_compat_4_0_len;
206
abd93cc7
MAL
207extern GlobalProperty pc_compat_3_1[];
208extern const size_t pc_compat_3_1_len;
84e060bf 209
ddb3235d
MAL
210extern GlobalProperty pc_compat_3_0[];
211extern const size_t pc_compat_3_0_len;
9b4cf107 212
0d47310b
MAL
213extern GlobalProperty pc_compat_2_12[];
214extern const size_t pc_compat_2_12_len;
968ee4ad 215
43df70a9
MAL
216extern GlobalProperty pc_compat_2_11[];
217extern const size_t pc_compat_2_11_len;
df47ce8a 218
503224f4
MAL
219extern GlobalProperty pc_compat_2_10[];
220extern const size_t pc_compat_2_10_len;
a6fd5b0e 221
3e803152
MAL
222extern GlobalProperty pc_compat_2_9[];
223extern const size_t pc_compat_2_9_len;
465238d9 224
edc24ccd
MAL
225extern GlobalProperty pc_compat_2_8[];
226extern const size_t pc_compat_2_8_len;
abc62c89 227
5a995064
MAL
228extern GlobalProperty pc_compat_2_7[];
229extern const size_t pc_compat_2_7_len;
14c985cf 230
ff8f261f
MAL
231extern GlobalProperty pc_compat_2_6[];
232extern const size_t pc_compat_2_6_len;
d86c1451 233
fe759610
MAL
234extern GlobalProperty pc_compat_2_5[];
235extern const size_t pc_compat_2_5_len;
240240d5 236
2f99b9c2
MAL
237extern GlobalProperty pc_compat_2_4[];
238extern const size_t pc_compat_2_4_len;
239
8995dd90
MAL
240extern GlobalProperty pc_compat_2_3[];
241extern const size_t pc_compat_2_3_len;
242
1c30044e
MAL
243extern GlobalProperty pc_compat_2_2[];
244extern const size_t pc_compat_2_2_len;
245
c4fc5695
MAL
246extern GlobalProperty pc_compat_2_1[];
247extern const size_t pc_compat_2_1_len;
248
a310e653
MAL
249extern GlobalProperty pc_compat_2_0[];
250extern const size_t pc_compat_2_0_len;
251
252extern GlobalProperty pc_compat_1_7[];
253extern const size_t pc_compat_1_7_len;
254
255extern GlobalProperty pc_compat_1_6[];
256extern const size_t pc_compat_1_6_len;
257
258extern GlobalProperty pc_compat_1_5[];
259extern const size_t pc_compat_1_5_len;
260
261extern GlobalProperty pc_compat_1_4[];
262extern const size_t pc_compat_1_4_len;
263
cd6c1b70
EH
264/* Helper for setting model-id for CPU models that changed model-id
265 * depending on QEMU versions up to QEMU 2.4.
266 */
267#define PC_CPU_MODEL_IDS(v) \
6c36bddf
EH
268 { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
269 { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
270 { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
cd6c1b70 271
25519b06 272#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
865906f7
EH
273 static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
274 { \
275 MachineClass *mc = MACHINE_CLASS(oc); \
276 optsfn(mc); \
865906f7
EH
277 mc->init = initfn; \
278 } \
279 static const TypeInfo pc_machine_type_##suffix = { \
280 .name = namestr TYPE_MACHINE_SUFFIX, \
281 .parent = TYPE_PC_MACHINE, \
282 .class_init = pc_machine_##suffix##_class_init, \
283 }; \
61f219df
EH
284 static void pc_machine_init_##suffix(void) \
285 { \
865906f7 286 type_register(&pc_machine_type_##suffix); \
61f219df 287 } \
0e6aac87 288 type_init(pc_machine_init_##suffix)
61f219df 289
bd8107d7 290extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 291#endif