187ecb68bSpbrook #ifndef HW_PC_H 287ecb68bSpbrook #define HW_PC_H 3376253ecSaliguori 4376253ecSaliguori #include "qemu-common.h" 5022c62cbSPaolo Bonzini #include "exec/memory.h" 69521d42bSPaolo Bonzini #include "hw/boards.h" 70d09e41aSPaolo Bonzini #include "hw/isa/isa.h" 80d09e41aSPaolo Bonzini #include "hw/block/fdc.h" 9*ebc29e1bSMarkus Armbruster #include "hw/block/flash.h" 101422e32dSPaolo Bonzini #include "net/net.h" 110d09e41aSPaolo Bonzini #include "hw/i386/ioapic.h" 12376253ecSaliguori 133459a625SMichael S. Tsirkin #include "qemu/range.h" 14b20c9bd5SMichael S. Tsirkin #include "qemu/bitmap.h" 15b20c9bd5SMichael S. Tsirkin #include "sysemu/sysemu.h" 16b20c9bd5SMichael S. Tsirkin #include "hw/pci/pci.h" 17a7d69ff1SBharata B Rao #include "hw/mem/pc-dimm.h" 185fe79386SXiao Guangrong #include "hw/mem/nvdimm.h" 19ac35f13bSIgor Mammedov #include "hw/acpi/acpi_dev_interface.h" 203459a625SMichael S. Tsirkin 217a10ef51SLiu Ping Fan #define HPET_INTCAP "hpet-intcap" 227a10ef51SLiu Ping Fan 23619d11e4SIgor Mammedov /** 24619d11e4SIgor Mammedov * PCMachineState: 25781bbd6bSIgor Mammedov * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling 26e3cadac0SIgor Mammedov * @boot_cpus: number of present VCPUs 27619d11e4SIgor Mammedov */ 28d5747cacSIgor Mammedov struct PCMachineState { 29d5747cacSIgor Mammedov /*< private >*/ 30d5747cacSIgor Mammedov MachineState parent_obj; 31619d11e4SIgor Mammedov 32619d11e4SIgor Mammedov /* <public> */ 3313fc8343SEduardo Habkost 3413fc8343SEduardo Habkost /* State for other subsystems/APIs: */ 359ebeed0cSEduardo Habkost Notifier machine_done; 36781bbd6bSIgor Mammedov 3713fc8343SEduardo Habkost /* Pointers to devices and objects: */ 38781bbd6bSIgor Mammedov HotplugHandler *acpi_dev; 392d996150SGu Zheng ISADevice *rtc; 4013fc8343SEduardo Habkost PCIBus *bus; 41f264d360SEduardo Habkost FWCfgState *fw_cfg; 423e6c0c4cSMarc-André Lureau qemu_irq *gsi; 43*ebc29e1bSMarkus Armbruster PFlashCFI01 *flash[2]; 44c87b1520SDon Slutz 4513fc8343SEduardo Habkost /* Configuration options: */ 46c87b1520SDon Slutz uint64_t max_ram_below_4g; 47d1048befSDon Slutz OnOffAuto vmport; 48355023f2SPaolo Bonzini OnOffAuto smm; 495fe79386SXiao Guangrong 505fe79386SXiao Guangrong AcpiNVDIMMState acpi_nvdimm_state; 5113fc8343SEduardo Habkost 52021746c1SWei Liu bool acpi_build_enabled; 53f5878b03SCorey Minyard bool smbus_enabled; 54f5878b03SCorey Minyard bool sata_enabled; 55f5878b03SCorey Minyard bool pit_enabled; 56021746c1SWei Liu 5713fc8343SEduardo Habkost /* RAM information (sizes, addresses, configuration): */ 58c0aa4e1eSEduardo Habkost ram_addr_t below_4g_mem_size, above_4g_mem_size; 59dd4c2f01SEduardo Habkost 60dd4c2f01SEduardo Habkost /* CPU and apic information: */ 61dd4c2f01SEduardo Habkost bool apic_xrupt_override; 62dd4c2f01SEduardo Habkost unsigned apic_id_limit; 63e3cadac0SIgor Mammedov uint16_t boot_cpus; 64dd4c2f01SEduardo Habkost 65dd4c2f01SEduardo Habkost /* NUMA information: */ 66dd4c2f01SEduardo Habkost uint64_t numa_nodes; 67dd4c2f01SEduardo Habkost uint64_t *node_mem; 68cb135f59SPeter Xu 69cb135f59SPeter Xu /* Address space used by IOAPIC device. All IOAPIC interrupts 70cb135f59SPeter Xu * will be translated to MSI messages in the address space. */ 71cb135f59SPeter Xu AddressSpace *ioapic_as; 72d5747cacSIgor Mammedov }; 73d5747cacSIgor Mammedov 74781bbd6bSIgor Mammedov #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" 75f2ffbe2bSDavid Hildenbrand #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" 76c87b1520SDon Slutz #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" 779b23cfb7SDr. David Alan Gilbert #define PC_MACHINE_VMPORT "vmport" 78355023f2SPaolo Bonzini #define PC_MACHINE_SMM "smm" 7987252e1bSXiao Guangrong #define PC_MACHINE_NVDIMM "nvdimm" 8011c39b5cSRoss Zwisler #define PC_MACHINE_NVDIMM_PERSIST "nvdimm-persistence" 81be232eb0SChao Peng #define PC_MACHINE_SMBUS "smbus" 82272f0428SChao Peng #define PC_MACHINE_SATA "sata" 83feddd2fdSChao Peng #define PC_MACHINE_PIT "pit" 84781bbd6bSIgor Mammedov 8595bee274SIgor Mammedov /** 8695bee274SIgor Mammedov * PCMachineClass: 8713fc8343SEduardo Habkost * 8813fc8343SEduardo Habkost * Compat fields: 8913fc8343SEduardo Habkost * 9016a9e8a5SEduardo Habkost * @enforce_aligned_dimm: check that DIMM's address/size is aligned by 9116a9e8a5SEduardo Habkost * backend's alignment value if provided 9213fc8343SEduardo Habkost * @acpi_data_size: Size of the chunk of memory at the top of RAM 9313fc8343SEduardo Habkost * for the BIOS ACPI tables and other BIOS 9413fc8343SEduardo Habkost * datastructures. 9513fc8343SEduardo Habkost * @gigabyte_align: Make sure that guest addresses aligned at 9613fc8343SEduardo Habkost * 1Gbyte boundaries get mapped to host 9713fc8343SEduardo Habkost * addresses aligned at 1Gbyte boundaries. This 9813fc8343SEduardo Habkost * way we can use 1GByte pages in the host. 9913fc8343SEduardo Habkost * 10095bee274SIgor Mammedov */ 101639f642cSPhilippe Mathieu-Daudé typedef struct PCMachineClass { 102d5747cacSIgor Mammedov /*< private >*/ 103d5747cacSIgor Mammedov MachineClass parent_class; 10495bee274SIgor Mammedov 10595bee274SIgor Mammedov /*< public >*/ 10613fc8343SEduardo Habkost 10713fc8343SEduardo Habkost /* Device configuration: */ 1087102fa70SEduardo Habkost bool pci_enabled; 10913fc8343SEduardo Habkost bool kvmclock_enabled; 1104b9c264bSPaolo Bonzini const char *default_nic_model; 11113fc8343SEduardo Habkost 11213fc8343SEduardo Habkost /* Compat options: */ 11313fc8343SEduardo Habkost 11413fc8343SEduardo Habkost /* ACPI compat: */ 1157102fa70SEduardo Habkost bool has_acpi_build; 1167102fa70SEduardo Habkost bool rsdp_in_ram; 11713fc8343SEduardo Habkost int legacy_acpi_table_size; 11813fc8343SEduardo Habkost unsigned acpi_data_size; 11913fc8343SEduardo Habkost 12013fc8343SEduardo Habkost /* SMBIOS compat: */ 1217102fa70SEduardo Habkost bool smbios_defaults; 1227102fa70SEduardo Habkost bool smbios_legacy_mode; 1237102fa70SEduardo Habkost bool smbios_uuid_encoded; 12413fc8343SEduardo Habkost 12513fc8343SEduardo Habkost /* RAM / address space compat: */ 1267102fa70SEduardo Habkost bool gigabyte_align; 1277102fa70SEduardo Habkost bool has_reserved_memory; 12816a9e8a5SEduardo Habkost bool enforce_aligned_dimm; 12913fc8343SEduardo Habkost bool broken_reserved_end; 13036f96c4bSHaozhong Zhang 13136f96c4bSHaozhong Zhang /* TSC rate migration: */ 13236f96c4bSHaozhong Zhang bool save_tsc_khz; 133679dd1a9SIgor Mammedov /* generate legacy CPU hotplug AML */ 134679dd1a9SIgor Mammedov bool legacy_cpu_hotplug; 13598e753a6SIgor Mammedov 13698e753a6SIgor Mammedov /* use DMA capable linuxboot option rom */ 13798e753a6SIgor Mammedov bool linuxboot_dma_enabled; 138fda672b5SStefano Garzarella 139fda672b5SStefano Garzarella /* use PVH to load kernels that support this feature */ 140fda672b5SStefano Garzarella bool pvh_enabled; 141639f642cSPhilippe Mathieu-Daudé } PCMachineClass; 142d5747cacSIgor Mammedov 143d5747cacSIgor Mammedov #define TYPE_PC_MACHINE "generic-pc-machine" 144d5747cacSIgor Mammedov #define PC_MACHINE(obj) \ 145d5747cacSIgor Mammedov OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) 146d5747cacSIgor Mammedov #define PC_MACHINE_GET_CLASS(obj) \ 147d5747cacSIgor Mammedov OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) 148d5747cacSIgor Mammedov #define PC_MACHINE_CLASS(klass) \ 149d5747cacSIgor Mammedov OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) 150d5747cacSIgor Mammedov 15187ecb68bSpbrook /* i8259.c */ 15287ecb68bSpbrook 1539aa78c42SJan Kiszka extern DeviceState *isa_pic; 15448a18b3cSHervé Poussineau qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); 15510b61882SJan Kiszka qemu_irq *kvm_i8259_init(ISABus *bus); 1569aa78c42SJan Kiszka int pic_read_irq(DeviceState *d); 1579aa78c42SJan Kiszka int pic_get_output(DeviceState *d); 15887ecb68bSpbrook 159d665d696SPavel Butsykin /* ioapic.c */ 160d665d696SPavel Butsykin 161b881fbe9SJan Kiszka /* Global System Interrupts */ 16296051119SBlue Swirl 163b881fbe9SJan Kiszka #define GSI_NUM_PINS IOAPIC_NUM_PINS 164845773abSIsaku Yamahata 165b881fbe9SJan Kiszka typedef struct GSIState { 16643a0db35SJan Kiszka qemu_irq i8259_irq[ISA_NUM_IRQS]; 167b881fbe9SJan Kiszka qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; 168b881fbe9SJan Kiszka } GSIState; 169b881fbe9SJan Kiszka 170b881fbe9SJan Kiszka void gsi_handler(void *opaque, int n, int level); 171845773abSIsaku Yamahata 17287ecb68bSpbrook /* vmport.c */ 173936a6447SEfimov Vasily #define TYPE_VMPORT "vmport" 174d67f679dSJan Kiszka typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address); 175d67f679dSJan Kiszka 17648a18b3cSHervé Poussineau static inline void vmport_init(ISABus *bus) 1776872ef61SBlue Swirl { 178936a6447SEfimov Vasily isa_create_simple(bus, TYPE_VMPORT); 1796872ef61SBlue Swirl } 180d67f679dSJan Kiszka 181d67f679dSJan Kiszka void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque); 18286d86414SBlue Swirl void vmmouse_get_data(uint32_t *data); 18386d86414SBlue Swirl void vmmouse_set_data(const uint32_t *data); 18487ecb68bSpbrook 18587ecb68bSpbrook /* pc.c */ 18687ecb68bSpbrook extern int fd_bootchk; 18787ecb68bSpbrook 188355023f2SPaolo Bonzini bool pc_machine_is_smm_enabled(PCMachineState *pcms); 1898e78eb28SIsaku Yamahata void pc_register_ferr_irq(qemu_irq irq); 190845773abSIsaku Yamahata void pc_acpi_smi_interrupt(void *opaque, int irq, int level); 191845773abSIsaku Yamahata 1924884b7bfSZhu Guihua void pc_cpus_init(PCMachineState *pcms); 193c649983bSIgor Mammedov void pc_hot_add_cpu(const int64_t id, Error **errp); 1943459a625SMichael S. Tsirkin 195e4e8ba04SEduardo Habkost void pc_guest_info_init(PCMachineState *pcms); 1963459a625SMichael S. Tsirkin 19739848901SIgor Mammedov #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" 19839848901SIgor Mammedov #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" 19939848901SIgor Mammedov #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" 20039848901SIgor Mammedov #define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" 20139848901SIgor Mammedov #define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" 202401f2f3eSEfimov Vasily #define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" 203401f2f3eSEfimov Vasily #define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" 2041466cef3SMichael S. Tsirkin 20539848901SIgor Mammedov 20683d08f26SMichael S. Tsirkin void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, 20783d08f26SMichael S. Tsirkin MemoryRegion *pci_address_space); 20839848901SIgor Mammedov 2097bc35e0fSEduardo Habkost void xen_load_linux(PCMachineState *pcms); 2105934e216SEduardo Habkost void pc_memory_init(PCMachineState *pcms, 2119521d42bSPaolo Bonzini MemoryRegion *system_memory, 2124463aee6SJan Kiszka MemoryRegion *rom_memory, 2135934e216SEduardo Habkost MemoryRegion **ram_memory); 2149fa99d25SMarcel Apfelbaum uint64_t pc_pci_hole64_start(void); 2150b0cc076SShannon Zhao qemu_irq pc_allocate_cpu_irq(void); 21648a18b3cSHervé Poussineau DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); 21748a18b3cSHervé Poussineau void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, 2181611977cSAnthony PERARD ISADevice **rtc_state, 219fd53c87cSLaszlo Ersek bool create_fdctrl, 2207a10ef51SLiu Ping Fan bool no_vmport, 221feddd2fdSChao Peng bool has_pit, 2223a87d009SPeter Maydell uint32_t hpet_irqs); 22348a18b3cSHervé Poussineau void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); 22423d30407SEduardo Habkost void pc_cmos_init(PCMachineState *pcms, 225220a8846SLaszlo Ersek BusState *ide0, BusState *ide1, 22663ffb564SBlue Swirl ISADevice *s); 2274b9c264bSPaolo Bonzini void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); 228845773abSIsaku Yamahata void pc_pci_device_init(PCIBus *pci_bus); 2298e78eb28SIsaku Yamahata 230f885f1eaSIsaku Yamahata typedef void (*cpu_set_smm_t)(int smm, void *arg); 231f885f1eaSIsaku Yamahata 232a39e3564SJason Baron void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); 233a39e3564SJason Baron 234424e4a87SRoman Kagan ISADevice *pc_find_fdc0(void); 235bda05509SRoman Kagan int cmos_get_fd_drive_type(FloppyDriveType fd0); 236424e4a87SRoman Kagan 237305ae888SGabriel L. Somlo #define FW_CFG_IO_BASE 0x510 238305ae888SGabriel L. Somlo 239d812b3d6SEfimov Vasily #define PORT92_A20_LINE "a20" 240d812b3d6SEfimov Vasily 2419d5e77a2SIsaku Yamahata /* acpi_piix.c */ 24253b67b30SBlue Swirl 243a5c82852SAndreas Färber I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, 244da98c8ebSGerd Hoffmann qemu_irq sci_irq, qemu_irq smi_irq, 24561e66c62SPaolo Bonzini int smm_enabled, DeviceState **piix4_pm); 24687ecb68bSpbrook 24716b29ae1Saliguori /* hpet.c */ 24816b29ae1Saliguori extern int no_hpet; 24916b29ae1Saliguori 25087ecb68bSpbrook /* piix_pci.c */ 2510a3bacf3SJuan Quintela struct PCII440FXState; 2520a3bacf3SJuan Quintela typedef struct PCII440FXState PCII440FXState; 2530a3bacf3SJuan Quintela 2547bb836e4SMichael S. Tsirkin #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" 2557bb836e4SMichael S. Tsirkin #define TYPE_I440FX_PCI_DEVICE "i440FX" 2567bb836e4SMichael S. Tsirkin 257595a4f07STiejun Chen #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" 258595a4f07STiejun Chen 2596103451aSPhil Dennis-Jordan /* 2606103451aSPhil Dennis-Jordan * Reset Control Register: PCI-accessible ISA-Compatible Register at address 2616103451aSPhil Dennis-Jordan * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). 2626103451aSPhil Dennis-Jordan */ 2636103451aSPhil Dennis-Jordan #define RCR_IOPORT 0xcf9 2646103451aSPhil Dennis-Jordan 2657bb836e4SMichael S. Tsirkin PCIBus *i440fx_init(const char *host_type, const char *pci_type, 2667bb836e4SMichael S. Tsirkin PCII440FXState **pi440fx_state, int *piix_devfn, 26760573079SHervé Poussineau ISABus **isa_bus, qemu_irq *pic, 268aee97b84SAvi Kivity MemoryRegion *address_space_mem, 269aee97b84SAvi Kivity MemoryRegion *address_space_io, 270ae0a5466SAvi Kivity ram_addr_t ram_size, 271ddaaefb4SGerd Hoffmann ram_addr_t below_4g_mem_size, 27239848901SIgor Mammedov ram_addr_t above_4g_mem_size, 273ae0a5466SAvi Kivity MemoryRegion *pci_memory, 274ae0a5466SAvi Kivity MemoryRegion *ram_memory); 27587ecb68bSpbrook 276277e9340SMichael S. Tsirkin PCIBus *find_i440fx(void); 277823e675aSJuan Quintela /* piix4.c */ 278b1d8e52eSblueswir1 extern PCIDevice *piix4_dev; 279142e9787SHervé Poussineau int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); 28087ecb68bSpbrook 281cbc5b5f3SJordan Justen /* pc_sysfw.c */ 282*ebc29e1bSMarkus Armbruster void pc_system_flash_create(PCMachineState *pcms); 2835e640a9eSPhilippe Mathieu-Daudé void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory); 284cbc5b5f3SJordan Justen 285ac35f13bSIgor Mammedov /* acpi-build.c */ 286ac35f13bSIgor Mammedov void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, 28780e5db30SIgor Mammedov const CPUArchIdList *apic_ids, GArray *entry); 288ac35f13bSIgor Mammedov 2894c5b10b7SJes Sorensen /* e820 types */ 2904c5b10b7SJes Sorensen #define E820_RAM 1 2914c5b10b7SJes Sorensen #define E820_RESERVED 2 2924c5b10b7SJes Sorensen #define E820_ACPI 3 2934c5b10b7SJes Sorensen #define E820_NVS 4 2944c5b10b7SJes Sorensen #define E820_UNUSABLE 5 2954c5b10b7SJes Sorensen 2964c5b10b7SJes Sorensen int e820_add_entry(uint64_t, uint64_t, uint32_t); 2977bf8ef19SGabriel L. Somlo int e820_get_num_entries(void); 2987bf8ef19SGabriel L. Somlo bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); 2994c5b10b7SJes Sorensen 300abd93cc7SMarc-André Lureau extern GlobalProperty pc_compat_3_1[]; 301abd93cc7SMarc-André Lureau extern const size_t pc_compat_3_1_len; 30284e060bfSAlex Williamson 303ddb3235dSMarc-André Lureau extern GlobalProperty pc_compat_3_0[]; 304ddb3235dSMarc-André Lureau extern const size_t pc_compat_3_0_len; 3059b4cf107SRoman Kagan 3060d47310bSMarc-André Lureau extern GlobalProperty pc_compat_2_12[]; 3070d47310bSMarc-André Lureau extern const size_t pc_compat_2_12_len; 308968ee4adSBabu Moger 30943df70a9SMarc-André Lureau extern GlobalProperty pc_compat_2_11[]; 31043df70a9SMarc-André Lureau extern const size_t pc_compat_2_11_len; 311df47ce8aSHaozhong Zhang 312503224f4SMarc-André Lureau extern GlobalProperty pc_compat_2_10[]; 313503224f4SMarc-André Lureau extern const size_t pc_compat_2_10_len; 314a6fd5b0eSMarcel Apfelbaum 3153e803152SMarc-André Lureau extern GlobalProperty pc_compat_2_9[]; 3163e803152SMarc-André Lureau extern const size_t pc_compat_2_9_len; 317465238d9SPeter Xu 318edc24ccdSMarc-André Lureau extern GlobalProperty pc_compat_2_8[]; 319edc24ccdSMarc-André Lureau extern const size_t pc_compat_2_8_len; 320abc62c89SMarcelo Tosatti 3215a995064SMarc-André Lureau extern GlobalProperty pc_compat_2_7[]; 3225a995064SMarc-André Lureau extern const size_t pc_compat_2_7_len; 32314c985cfSLongpeng(Mike) 324ff8f261fSMarc-André Lureau extern GlobalProperty pc_compat_2_6[]; 325ff8f261fSMarc-André Lureau extern const size_t pc_compat_2_6_len; 326d86c1451SIgor Mammedov 327fe759610SMarc-André Lureau extern GlobalProperty pc_compat_2_5[]; 328fe759610SMarc-André Lureau extern const size_t pc_compat_2_5_len; 329240240d5SEduardo Habkost 3302f99b9c2SMarc-André Lureau extern GlobalProperty pc_compat_2_4[]; 3312f99b9c2SMarc-André Lureau extern const size_t pc_compat_2_4_len; 3322f99b9c2SMarc-André Lureau 3338995dd90SMarc-André Lureau extern GlobalProperty pc_compat_2_3[]; 3348995dd90SMarc-André Lureau extern const size_t pc_compat_2_3_len; 3358995dd90SMarc-André Lureau 3361c30044eSMarc-André Lureau extern GlobalProperty pc_compat_2_2[]; 3371c30044eSMarc-André Lureau extern const size_t pc_compat_2_2_len; 3381c30044eSMarc-André Lureau 339c4fc5695SMarc-André Lureau extern GlobalProperty pc_compat_2_1[]; 340c4fc5695SMarc-André Lureau extern const size_t pc_compat_2_1_len; 341c4fc5695SMarc-André Lureau 342a310e653SMarc-André Lureau extern GlobalProperty pc_compat_2_0[]; 343a310e653SMarc-André Lureau extern const size_t pc_compat_2_0_len; 344a310e653SMarc-André Lureau 345a310e653SMarc-André Lureau extern GlobalProperty pc_compat_1_7[]; 346a310e653SMarc-André Lureau extern const size_t pc_compat_1_7_len; 347a310e653SMarc-André Lureau 348a310e653SMarc-André Lureau extern GlobalProperty pc_compat_1_6[]; 349a310e653SMarc-André Lureau extern const size_t pc_compat_1_6_len; 350a310e653SMarc-André Lureau 351a310e653SMarc-André Lureau extern GlobalProperty pc_compat_1_5[]; 352a310e653SMarc-André Lureau extern const size_t pc_compat_1_5_len; 353a310e653SMarc-André Lureau 354a310e653SMarc-André Lureau extern GlobalProperty pc_compat_1_4[]; 355a310e653SMarc-André Lureau extern const size_t pc_compat_1_4_len; 356a310e653SMarc-André Lureau 357cd6c1b70SEduardo Habkost /* Helper for setting model-id for CPU models that changed model-id 358cd6c1b70SEduardo Habkost * depending on QEMU versions up to QEMU 2.4. 359cd6c1b70SEduardo Habkost */ 360cd6c1b70SEduardo Habkost #define PC_CPU_MODEL_IDS(v) \ 3616c36bddfSEduardo Habkost { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ 3626c36bddfSEduardo Habkost { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ 3636c36bddfSEduardo Habkost { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, 364cd6c1b70SEduardo Habkost 36525519b06SEduardo Habkost #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ 366865906f7SEduardo Habkost static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ 367865906f7SEduardo Habkost { \ 368865906f7SEduardo Habkost MachineClass *mc = MACHINE_CLASS(oc); \ 369865906f7SEduardo Habkost optsfn(mc); \ 370865906f7SEduardo Habkost mc->init = initfn; \ 371865906f7SEduardo Habkost } \ 372865906f7SEduardo Habkost static const TypeInfo pc_machine_type_##suffix = { \ 373865906f7SEduardo Habkost .name = namestr TYPE_MACHINE_SUFFIX, \ 374865906f7SEduardo Habkost .parent = TYPE_PC_MACHINE, \ 375865906f7SEduardo Habkost .class_init = pc_machine_##suffix##_class_init, \ 376865906f7SEduardo Habkost }; \ 37761f219dfSEduardo Habkost static void pc_machine_init_##suffix(void) \ 37861f219dfSEduardo Habkost { \ 379865906f7SEduardo Habkost type_register(&pc_machine_type_##suffix); \ 38025519b06SEduardo Habkost } \ 3810e6aac87SEduardo Habkost type_init(pc_machine_init_##suffix) 38225519b06SEduardo Habkost 383bd8107d7STiejun Chen extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); 38487ecb68bSpbrook #endif 385