pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 1 | #ifndef HW_PC_H |
| 2 | #define HW_PC_H |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 3 | |
| 4 | #include "qemu-common.h" |
Paolo Bonzini | 022c62c | 2012-12-17 18:19:49 +0100 | [diff] [blame] | 5 | #include "exec/memory.h" |
Paolo Bonzini | 9521d42 | 2014-06-10 19:15:17 +0800 | [diff] [blame] | 6 | #include "hw/boards.h" |
Paolo Bonzini | 0d09e41 | 2013-02-05 17:06:20 +0100 | [diff] [blame] | 7 | #include "hw/isa/isa.h" |
| 8 | #include "hw/block/fdc.h" |
Paolo Bonzini | 1422e32 | 2012-10-24 08:43:34 +0200 | [diff] [blame] | 9 | #include "net/net.h" |
Paolo Bonzini | 0d09e41 | 2013-02-05 17:06:20 +0100 | [diff] [blame] | 10 | #include "hw/i386/ioapic.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 11 | |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 12 | #include "qemu/range.h" |
Michael S. Tsirkin | b20c9bd | 2013-07-24 18:56:09 +0300 | [diff] [blame] | 13 | #include "qemu/bitmap.h" |
| 14 | #include "sysemu/sysemu.h" |
| 15 | #include "hw/pci/pci.h" |
Igor Mammedov | d5747ca | 2014-06-02 15:24:57 +0200 | [diff] [blame] | 16 | #include "hw/boards.h" |
Michael S. Tsirkin | 68a27b2 | 2014-10-14 19:40:06 +0300 | [diff] [blame] | 17 | #include "hw/compat.h" |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 18 | |
Liu Ping Fan | 7a10ef5 | 2013-12-08 17:38:17 +0800 | [diff] [blame] | 19 | #define HPET_INTCAP "hpet-intcap" |
| 20 | |
Igor Mammedov | 619d11e | 2014-06-02 15:25:08 +0200 | [diff] [blame] | 21 | /** |
| 22 | * PCMachineState: |
| 23 | * @hotplug_memory_base: address in guest RAM address space where hotplug memory |
| 24 | * address space begins. |
| 25 | * @hotplug_memory: hotplug memory addess space container |
Igor Mammedov | 781bbd6 | 2014-06-02 15:25:24 +0200 | [diff] [blame] | 26 | * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling |
Igor Mammedov | 91aa70a | 2014-10-31 16:38:39 +0000 | [diff] [blame] | 27 | * @enforce_aligned_dimm: check that DIMM's address/size is aligned by |
| 28 | * backend's alignment value if provided |
Igor Mammedov | 619d11e | 2014-06-02 15:25:08 +0200 | [diff] [blame] | 29 | */ |
Igor Mammedov | d5747ca | 2014-06-02 15:24:57 +0200 | [diff] [blame] | 30 | struct PCMachineState { |
| 31 | /*< private >*/ |
| 32 | MachineState parent_obj; |
Igor Mammedov | 619d11e | 2014-06-02 15:25:08 +0200 | [diff] [blame] | 33 | |
| 34 | /* <public> */ |
| 35 | ram_addr_t hotplug_memory_base; |
| 36 | MemoryRegion hotplug_memory; |
Igor Mammedov | 781bbd6 | 2014-06-02 15:25:24 +0200 | [diff] [blame] | 37 | |
| 38 | HotplugHandler *acpi_dev; |
Gu Zheng | 2d99615 | 2014-10-22 11:24:29 +0800 | [diff] [blame] | 39 | ISADevice *rtc; |
Don Slutz | c87b152 | 2014-06-19 21:40:25 -0400 | [diff] [blame] | 40 | |
| 41 | uint64_t max_ram_below_4g; |
Don Slutz | d1048be | 2014-11-21 11:18:52 -0500 | [diff] [blame] | 42 | OnOffAuto vmport; |
Igor Mammedov | 91aa70a | 2014-10-31 16:38:39 +0000 | [diff] [blame] | 43 | bool enforce_aligned_dimm; |
Igor Mammedov | d5747ca | 2014-06-02 15:24:57 +0200 | [diff] [blame] | 44 | }; |
| 45 | |
Igor Mammedov | 781bbd6 | 2014-06-02 15:25:24 +0200 | [diff] [blame] | 46 | #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" |
Igor Mammedov | bf1e893 | 2014-06-02 15:25:27 +0200 | [diff] [blame] | 47 | #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size" |
Don Slutz | c87b152 | 2014-06-19 21:40:25 -0400 | [diff] [blame] | 48 | #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" |
Dr. David Alan Gilbert | 9b23cfb | 2014-10-03 17:33:37 -0400 | [diff] [blame] | 49 | #define PC_MACHINE_VMPORT "vmport" |
Igor Mammedov | 91aa70a | 2014-10-31 16:38:39 +0000 | [diff] [blame] | 50 | #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm" |
Igor Mammedov | 781bbd6 | 2014-06-02 15:25:24 +0200 | [diff] [blame] | 51 | |
Igor Mammedov | 95bee27 | 2014-06-02 15:25:12 +0200 | [diff] [blame] | 52 | /** |
| 53 | * PCMachineClass: |
| 54 | * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler |
| 55 | */ |
Igor Mammedov | d5747ca | 2014-06-02 15:24:57 +0200 | [diff] [blame] | 56 | struct PCMachineClass { |
| 57 | /*< private >*/ |
| 58 | MachineClass parent_class; |
Igor Mammedov | 95bee27 | 2014-06-02 15:25:12 +0200 | [diff] [blame] | 59 | |
| 60 | /*< public >*/ |
| 61 | HotplugHandler *(*get_hotplug_handler)(MachineState *machine, |
| 62 | DeviceState *dev); |
Igor Mammedov | d5747ca | 2014-06-02 15:24:57 +0200 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | typedef struct PCMachineState PCMachineState; |
| 66 | typedef struct PCMachineClass PCMachineClass; |
| 67 | |
| 68 | #define TYPE_PC_MACHINE "generic-pc-machine" |
| 69 | #define PC_MACHINE(obj) \ |
| 70 | OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) |
| 71 | #define PC_MACHINE_GET_CLASS(obj) \ |
| 72 | OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) |
| 73 | #define PC_MACHINE_CLASS(klass) \ |
| 74 | OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) |
| 75 | |
| 76 | void qemu_register_pc_machine(QEMUMachine *m); |
| 77 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 78 | /* PC-style peripherals (also used by other machines). */ |
| 79 | |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 80 | typedef struct PcPciInfo { |
| 81 | Range w32; |
| 82 | Range w64; |
| 83 | } PcPciInfo; |
| 84 | |
Michael S. Tsirkin | f854ecc | 2013-09-16 18:09:11 +0300 | [diff] [blame] | 85 | #define ACPI_PM_PROP_S3_DISABLED "disable_s3" |
| 86 | #define ACPI_PM_PROP_S4_DISABLED "disable_s4" |
| 87 | #define ACPI_PM_PROP_S4_VAL "s4_val" |
| 88 | #define ACPI_PM_PROP_SCI_INT "sci_int" |
| 89 | #define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd" |
| 90 | #define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd" |
| 91 | #define ACPI_PM_PROP_PM_IO_BASE "pm_io_base" |
| 92 | #define ACPI_PM_PROP_GPE0_BLK "gpe0_blk" |
| 93 | #define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len" |
| 94 | |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 95 | struct PcGuestInfo { |
Paolo Bonzini | 6dd2a5c | 2013-08-09 12:35:02 -0500 | [diff] [blame] | 96 | bool isapc_ram_fw; |
Eduardo Habkost | f30ee8a | 2014-01-09 17:12:42 -0200 | [diff] [blame] | 97 | hwaddr ram_size, ram_size_below_4g; |
Michael S. Tsirkin | b20c9bd | 2013-07-24 18:56:09 +0300 | [diff] [blame] | 98 | unsigned apic_id_limit; |
| 99 | bool apic_xrupt_override; |
| 100 | uint64_t numa_nodes; |
| 101 | uint64_t *node_mem; |
| 102 | uint64_t *node_cpu; |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 103 | FWCfgState *fw_cfg; |
Paolo Bonzini | 07fb617 | 2014-07-28 17:34:15 +0200 | [diff] [blame] | 104 | int legacy_acpi_table_size; |
Michael S. Tsirkin | 72c194f | 2013-07-24 18:56:14 +0300 | [diff] [blame] | 105 | bool has_acpi_build; |
Igor Mammedov | de268e1 | 2014-06-02 15:25:10 +0200 | [diff] [blame] | 106 | bool has_reserved_memory; |
Michael S. Tsirkin | 384fb32 | 2015-02-17 10:04:40 +0100 | [diff] [blame] | 107 | bool rsdp_in_ram; |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 108 | }; |
| 109 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 110 | /* parallel.c */ |
| 111 | |
Markus Armbruster | 07dc788 | 2015-02-04 18:33:07 +0100 | [diff] [blame] | 112 | void parallel_hds_isa_init(ISABus *bus, int n); |
Blue Swirl | defdb20 | 2011-02-05 14:51:57 +0000 | [diff] [blame] | 113 | |
Avi Kivity | 63858cd | 2011-10-06 16:44:26 +0200 | [diff] [blame] | 114 | bool parallel_mm_init(MemoryRegion *address_space, |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 115 | hwaddr base, int it_shift, qemu_irq irq, |
Blue Swirl | defdb20 | 2011-02-05 14:51:57 +0000 | [diff] [blame] | 116 | CharDriverState *chr); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 117 | |
| 118 | /* i8259.c */ |
| 119 | |
Jan Kiszka | 9aa78c4 | 2012-01-10 16:31:16 +0100 | [diff] [blame] | 120 | extern DeviceState *isa_pic; |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 121 | qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); |
Jan Kiszka | 10b6188 | 2011-10-16 15:30:27 +0200 | [diff] [blame] | 122 | qemu_irq *kvm_i8259_init(ISABus *bus); |
Jan Kiszka | 9aa78c4 | 2012-01-10 16:31:16 +0100 | [diff] [blame] | 123 | int pic_read_irq(DeviceState *d); |
| 124 | int pic_get_output(DeviceState *d); |
Markus Armbruster | 1ce6be2 | 2015-02-06 14:18:24 +0100 | [diff] [blame] | 125 | void hmp_info_pic(Monitor *mon, const QDict *qdict); |
| 126 | void hmp_info_irq(Monitor *mon, const QDict *qdict); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 127 | |
Jan Kiszka | b881fbe | 2011-10-07 09:19:35 +0200 | [diff] [blame] | 128 | /* Global System Interrupts */ |
Blue Swirl | 9605111 | 2010-06-19 07:41:43 +0000 | [diff] [blame] | 129 | |
Jan Kiszka | b881fbe | 2011-10-07 09:19:35 +0200 | [diff] [blame] | 130 | #define GSI_NUM_PINS IOAPIC_NUM_PINS |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 131 | |
Jan Kiszka | b881fbe | 2011-10-07 09:19:35 +0200 | [diff] [blame] | 132 | typedef struct GSIState { |
Jan Kiszka | 43a0db3 | 2011-10-07 09:19:36 +0200 | [diff] [blame] | 133 | qemu_irq i8259_irq[ISA_NUM_IRQS]; |
Jan Kiszka | b881fbe | 2011-10-07 09:19:35 +0200 | [diff] [blame] | 134 | qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; |
| 135 | } GSIState; |
| 136 | |
| 137 | void gsi_handler(void *opaque, int n, int level); |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 138 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 139 | /* vmport.c */ |
Jan Kiszka | d67f679 | 2013-06-22 08:07:06 +0200 | [diff] [blame] | 140 | typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address); |
| 141 | |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 142 | static inline void vmport_init(ISABus *bus) |
Blue Swirl | 6872ef6 | 2011-02-05 14:34:41 +0000 | [diff] [blame] | 143 | { |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 144 | isa_create_simple(bus, "vmport"); |
Blue Swirl | 6872ef6 | 2011-02-05 14:34:41 +0000 | [diff] [blame] | 145 | } |
Jan Kiszka | d67f679 | 2013-06-22 08:07:06 +0200 | [diff] [blame] | 146 | |
| 147 | void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque); |
Blue Swirl | 86d8641 | 2011-02-05 14:34:52 +0000 | [diff] [blame] | 148 | void vmmouse_get_data(uint32_t *data); |
| 149 | void vmmouse_set_data(const uint32_t *data); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 150 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 151 | /* pckbd.c */ |
| 152 | |
| 153 | void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base); |
| 154 | void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, |
Richard Henderson | dbff76a | 2011-08-10 15:28:17 -0700 | [diff] [blame] | 155 | MemoryRegion *region, ram_addr_t size, |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 156 | hwaddr mask); |
Blue Swirl | 956a3e6 | 2010-05-22 07:59:01 +0000 | [diff] [blame] | 157 | void i8042_isa_mouse_fake_event(void *opaque); |
| 158 | void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 159 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 160 | /* pc.c */ |
| 161 | extern int fd_bootchk; |
| 162 | |
Isaku Yamahata | 8e78eb2 | 2010-05-14 16:29:09 +0900 | [diff] [blame] | 163 | void pc_register_ferr_irq(qemu_irq irq); |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 164 | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
| 165 | |
Igor Mammedov | 62fc403 | 2013-04-29 18:54:13 +0200 | [diff] [blame] | 166 | void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge); |
Igor Mammedov | c649983 | 2013-04-30 18:00:53 +0200 | [diff] [blame] | 167 | void pc_hot_add_cpu(const int64_t id, Error **errp); |
Gerd Hoffmann | f7e4dd6 | 2012-12-03 10:47:27 +0100 | [diff] [blame] | 168 | void pc_acpi_init(const char *default_dsdt); |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 169 | |
| 170 | PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, |
| 171 | ram_addr_t above_4g_mem_size); |
| 172 | |
Michael S. Tsirkin | 927766c | 2014-08-20 21:58:12 +0200 | [diff] [blame] | 173 | void pc_set_legacy_acpi_data_size(void); |
| 174 | |
Igor Mammedov | 3984890 | 2013-07-29 16:47:57 +0200 | [diff] [blame] | 175 | #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" |
| 176 | #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" |
| 177 | #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" |
| 178 | #define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" |
| 179 | #define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" |
Michael S. Tsirkin | 1466cef | 2013-08-27 08:37:26 +0300 | [diff] [blame] | 180 | #define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL) |
| 181 | |
Igor Mammedov | 3984890 | 2013-07-29 16:47:57 +0200 | [diff] [blame] | 182 | |
Michael S. Tsirkin | 83d08f2 | 2013-10-29 13:57:34 +0100 | [diff] [blame] | 183 | void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, |
| 184 | MemoryRegion *pci_address_space); |
Igor Mammedov | 3984890 | 2013-07-29 16:47:57 +0200 | [diff] [blame] | 185 | |
Chunyan Liu | b33a5bb | 2014-07-07 14:34:35 +0800 | [diff] [blame] | 186 | FWCfgState *xen_load_linux(const char *kernel_filename, |
| 187 | const char *kernel_cmdline, |
| 188 | const char *initrd_filename, |
| 189 | ram_addr_t below_4g_mem_size, |
| 190 | PcGuestInfo *guest_info); |
Paolo Bonzini | 9521d42 | 2014-06-10 19:15:17 +0800 | [diff] [blame] | 191 | FWCfgState *pc_memory_init(MachineState *machine, |
| 192 | MemoryRegion *system_memory, |
Laszlo Ersek | a88b362 | 2013-04-16 02:24:08 +0200 | [diff] [blame] | 193 | ram_addr_t below_4g_mem_size, |
| 194 | ram_addr_t above_4g_mem_size, |
| 195 | MemoryRegion *rom_memory, |
Michael S. Tsirkin | 3459a62 | 2013-05-30 12:57:26 +0300 | [diff] [blame] | 196 | MemoryRegion **ram_memory, |
| 197 | PcGuestInfo *guest_info); |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 198 | qemu_irq *pc_allocate_cpu_irq(void); |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 199 | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
| 200 | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, |
Anthony PERARD | 1611977 | 2011-05-03 17:06:54 +0100 | [diff] [blame] | 201 | ISADevice **rtc_state, |
Kevin Wolf | 34d4260 | 2011-10-20 16:37:26 +0200 | [diff] [blame] | 202 | ISADevice **floppy, |
Liu Ping Fan | 7a10ef5 | 2013-12-08 17:38:17 +0800 | [diff] [blame] | 203 | bool no_vmport, |
| 204 | uint32 hpet_irqs); |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 205 | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 206 | void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, |
Gu Zheng | 2d99615 | 2014-10-22 11:24:29 +0800 | [diff] [blame] | 207 | const char *boot_device, MachineState *machine, |
Kevin Wolf | 34d4260 | 2011-10-20 16:37:26 +0200 | [diff] [blame] | 208 | ISADevice *floppy, BusState *ide0, BusState *ide1, |
Blue Swirl | 63ffb56 | 2011-02-05 16:32:23 +0000 | [diff] [blame] | 209 | ISADevice *s); |
Isaku Yamahata | 9011a1a | 2012-11-14 15:54:01 -0500 | [diff] [blame] | 210 | void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus); |
Isaku Yamahata | 845773a | 2010-05-14 16:29:15 +0900 | [diff] [blame] | 211 | void pc_pci_device_init(PCIBus *pci_bus); |
Isaku Yamahata | 8e78eb2 | 2010-05-14 16:29:09 +0900 | [diff] [blame] | 212 | |
Isaku Yamahata | f885f1e | 2010-05-14 16:29:04 +0900 | [diff] [blame] | 213 | typedef void (*cpu_set_smm_t)(int smm, void *arg); |
| 214 | void cpu_smm_register(cpu_set_smm_t callback, void *arg); |
| 215 | |
Jason Baron | a39e356 | 2012-11-14 15:54:01 -0500 | [diff] [blame] | 216 | void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); |
| 217 | |
Isaku Yamahata | 9d5e77a | 2009-06-18 19:57:00 +0900 | [diff] [blame] | 218 | /* acpi_piix.c */ |
Blue Swirl | 53b67b3 | 2010-03-29 19:23:52 +0000 | [diff] [blame] | 219 | |
Andreas Färber | a5c8285 | 2013-08-03 00:18:51 +0200 | [diff] [blame] | 220 | I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, |
| 221 | qemu_irq sci_irq, qemu_irq smi_irq, |
Igor Mammedov | 781bbd6 | 2014-06-02 15:25:24 +0200 | [diff] [blame] | 222 | int kvm_enabled, FWCfgState *fw_cfg, |
| 223 | DeviceState **piix4_pm); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 224 | void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 225 | |
aliguori | 16b29ae | 2008-12-17 23:28:44 +0000 | [diff] [blame] | 226 | /* hpet.c */ |
| 227 | extern int no_hpet; |
| 228 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 229 | /* piix_pci.c */ |
Juan Quintela | 0a3bacf | 2009-08-28 15:28:15 +0200 | [diff] [blame] | 230 | struct PCII440FXState; |
| 231 | typedef struct PCII440FXState PCII440FXState; |
| 232 | |
Avi Kivity | 1e39101 | 2011-07-26 14:26:19 +0300 | [diff] [blame] | 233 | PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, |
Hervé Poussineau | 6057307 | 2011-12-15 22:09:54 +0100 | [diff] [blame] | 234 | ISABus **isa_bus, qemu_irq *pic, |
Avi Kivity | aee97b8 | 2011-08-08 16:09:04 +0300 | [diff] [blame] | 235 | MemoryRegion *address_space_mem, |
| 236 | MemoryRegion *address_space_io, |
Avi Kivity | ae0a546 | 2011-08-15 17:17:38 +0300 | [diff] [blame] | 237 | ram_addr_t ram_size, |
Gerd Hoffmann | ddaaefb | 2013-12-21 03:02:50 +0100 | [diff] [blame] | 238 | ram_addr_t below_4g_mem_size, |
Igor Mammedov | 3984890 | 2013-07-29 16:47:57 +0200 | [diff] [blame] | 239 | ram_addr_t above_4g_mem_size, |
Avi Kivity | ae0a546 | 2011-08-15 17:17:38 +0300 | [diff] [blame] | 240 | MemoryRegion *pci_memory, |
| 241 | MemoryRegion *ram_memory); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 242 | |
Michael S. Tsirkin | 277e934 | 2013-07-24 18:56:11 +0300 | [diff] [blame] | 243 | PCIBus *find_i440fx(void); |
Juan Quintela | 823e675 | 2009-08-28 15:28:13 +0200 | [diff] [blame] | 244 | /* piix4.c */ |
blueswir1 | b1d8e52 | 2008-10-26 13:43:07 +0000 | [diff] [blame] | 245 | extern PCIDevice *piix4_dev; |
Hervé Poussineau | 142e978 | 2011-12-15 22:09:58 +0100 | [diff] [blame] | 246 | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 247 | |
| 248 | /* vga.c */ |
malc | cb5a7aa | 2008-09-28 00:42:12 +0000 | [diff] [blame] | 249 | enum vga_retrace_method { |
| 250 | VGA_RETRACE_DUMB, |
| 251 | VGA_RETRACE_PRECISE |
| 252 | }; |
| 253 | |
| 254 | extern enum vga_retrace_method vga_retrace_method; |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 255 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 256 | int isa_vga_mm_init(hwaddr vram_base, |
| 257 | hwaddr ctrl_base, int it_shift, |
Avi Kivity | be20f9e | 2011-08-15 17:17:37 +0300 | [diff] [blame] | 258 | MemoryRegion *address_space); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 259 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 260 | /* ne2000.c */ |
Hervé Poussineau | 48a18b3 | 2011-12-15 22:09:51 +0100 | [diff] [blame] | 261 | static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) |
Blue Swirl | 60a14ad | 2011-02-05 15:39:57 +0000 | [diff] [blame] | 262 | { |
Andreas Färber | 4a17cc4 | 2013-06-07 13:49:13 +0200 | [diff] [blame] | 263 | DeviceState *dev; |
| 264 | ISADevice *isadev; |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 265 | |
Blue Swirl | 60a14ad | 2011-02-05 15:39:57 +0000 | [diff] [blame] | 266 | qemu_check_nic_model(nd, "ne2k_isa"); |
| 267 | |
Andreas Färber | 4a17cc4 | 2013-06-07 13:49:13 +0200 | [diff] [blame] | 268 | isadev = isa_try_create(bus, "ne2k_isa"); |
| 269 | if (!isadev) { |
Blue Swirl | cd1b8a8 | 2011-02-05 15:44:45 +0000 | [diff] [blame] | 270 | return false; |
| 271 | } |
Andreas Färber | 4a17cc4 | 2013-06-07 13:49:13 +0200 | [diff] [blame] | 272 | dev = DEVICE(isadev); |
| 273 | qdev_prop_set_uint32(dev, "iobase", base); |
| 274 | qdev_prop_set_uint32(dev, "irq", irq); |
| 275 | qdev_set_nic_properties(dev, nd); |
| 276 | qdev_init_nofail(dev); |
Blue Swirl | cd1b8a8 | 2011-02-05 15:44:45 +0000 | [diff] [blame] | 277 | return true; |
Blue Swirl | 60a14ad | 2011-02-05 15:39:57 +0000 | [diff] [blame] | 278 | } |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 279 | |
Jordan Justen | cbc5b5f | 2012-02-21 23:18:51 -0800 | [diff] [blame] | 280 | /* pc_sysfw.c */ |
Paolo Bonzini | 6dd2a5c | 2013-08-09 12:35:02 -0500 | [diff] [blame] | 281 | void pc_system_firmware_init(MemoryRegion *rom_memory, |
| 282 | bool isapc_ram_fw); |
Jordan Justen | cbc5b5f | 2012-02-21 23:18:51 -0800 | [diff] [blame] | 283 | |
Hu Tao | 3ab135f | 2013-04-26 11:24:46 +0800 | [diff] [blame] | 284 | /* pvpanic.c */ |
Michael S. Tsirkin | 309cd62 | 2013-07-24 18:56:12 +0300 | [diff] [blame] | 285 | uint16_t pvpanic_port(void); |
Hu Tao | 3ab135f | 2013-04-26 11:24:46 +0800 | [diff] [blame] | 286 | |
Jes Sorensen | 4c5b10b | 2010-02-15 18:33:46 +0100 | [diff] [blame] | 287 | /* e820 types */ |
| 288 | #define E820_RAM 1 |
| 289 | #define E820_RESERVED 2 |
| 290 | #define E820_ACPI 3 |
| 291 | #define E820_NVS 4 |
| 292 | #define E820_UNUSABLE 5 |
| 293 | |
| 294 | int e820_add_entry(uint64_t, uint64_t, uint32_t); |
Gabriel L. Somlo | 7bf8ef1 | 2014-04-23 09:42:36 -0400 | [diff] [blame] | 295 | int e820_get_num_entries(void); |
| 296 | bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); |
Jes Sorensen | 4c5b10b | 2010-02-15 18:33:46 +0100 | [diff] [blame] | 297 | |
Gabriel L. Somlo | 9df11c9 | 2014-05-05 10:52:50 -0400 | [diff] [blame] | 298 | #define PC_COMPAT_2_0 \ |
Michael S. Tsirkin | 68a27b2 | 2014-10-14 19:40:06 +0300 | [diff] [blame] | 299 | HW_COMPAT_2_1, \ |
Gabriel L. Somlo | 9df11c9 | 2014-05-05 10:52:50 -0400 | [diff] [blame] | 300 | {\ |
Paolo Bonzini | 3eff1f4 | 2014-06-10 16:40:31 +0200 | [diff] [blame] | 301 | .driver = "virtio-scsi-pci",\ |
| 302 | .property = "any_layout",\ |
| 303 | .value = "off",\ |
| 304 | },{\ |
Igor Mammedov | 3477432 | 2014-06-02 15:25:20 +0200 | [diff] [blame] | 305 | .driver = "PIIX4_PM",\ |
| 306 | .property = "memory-hotplug-support",\ |
| 307 | .value = "off",\ |
| 308 | },\ |
| 309 | {\ |
Gabriel L. Somlo | aa93200 | 2014-05-05 10:52:51 -0400 | [diff] [blame] | 310 | .driver = "apic",\ |
| 311 | .property = "version",\ |
| 312 | .value = stringify(0x11),\ |
Igor Mammedov | 3477432 | 2014-06-02 15:25:20 +0200 | [diff] [blame] | 313 | },\ |
| 314 | {\ |
Gerd Hoffmann | 7bafd88 | 2014-05-15 12:42:16 +0200 | [diff] [blame] | 315 | .driver = "nec-usb-xhci",\ |
| 316 | .property = "superspeed-ports-first",\ |
| 317 | .value = "off",\ |
BALATON Zoltan | 13cc2c3 | 2014-02-27 02:05:05 +0100 | [diff] [blame] | 318 | },\ |
| 319 | {\ |
Dr. David Alan Gilbert | e6043e9 | 2014-09-09 11:19:43 +0100 | [diff] [blame] | 320 | .driver = "nec-usb-xhci",\ |
| 321 | .property = "force-pcie-endcap",\ |
| 322 | .value = "on",\ |
| 323 | },\ |
| 324 | {\ |
BALATON Zoltan | 13cc2c3 | 2014-02-27 02:05:05 +0100 | [diff] [blame] | 325 | .driver = "pci-serial",\ |
| 326 | .property = "prog_if",\ |
| 327 | .value = stringify(0),\ |
| 328 | },\ |
| 329 | {\ |
| 330 | .driver = "pci-serial-2x",\ |
Eduardo Habkost | fa118d1 | 2014-06-24 19:57:55 -0300 | [diff] [blame] | 331 | .property = "prog_if",\ |
BALATON Zoltan | 13cc2c3 | 2014-02-27 02:05:05 +0100 | [diff] [blame] | 332 | .value = stringify(0),\ |
| 333 | },\ |
| 334 | {\ |
| 335 | .driver = "pci-serial-4x",\ |
| 336 | .property = "prog_if",\ |
| 337 | .value = stringify(0),\ |
Jason Wang | f57fcf7 | 2014-05-20 14:01:44 +0800 | [diff] [blame] | 338 | },\ |
| 339 | {\ |
| 340 | .driver = "virtio-net-pci",\ |
| 341 | .property = "guest_announce",\ |
| 342 | .value = "off",\ |
Eduardo Habkost | b8f5cfd | 2014-06-24 23:04:44 -0300 | [diff] [blame] | 343 | },\ |
| 344 | {\ |
| 345 | .driver = "ICH9-LPC",\ |
| 346 | .property = "memory-hotplug-support",\ |
| 347 | .value = "off",\ |
| 348 | },{\ |
| 349 | .driver = "xio3130-downstream",\ |
| 350 | .property = COMPAT_PROP_PCP,\ |
| 351 | .value = "off",\ |
| 352 | },{\ |
| 353 | .driver = "ioh3420",\ |
| 354 | .property = COMPAT_PROP_PCP,\ |
| 355 | .value = "off",\ |
Gabriel L. Somlo | 9df11c9 | 2014-05-05 10:52:50 -0400 | [diff] [blame] | 356 | } |
| 357 | |
Gerd Hoffmann | 5319dc7 | 2013-11-20 07:32:31 +0100 | [diff] [blame] | 358 | #define PC_COMPAT_1_7 \ |
Gabriel L. Somlo | 9df11c9 | 2014-05-05 10:52:50 -0400 | [diff] [blame] | 359 | PC_COMPAT_2_0, \ |
Gerd Hoffmann | 5319dc7 | 2013-11-20 07:32:31 +0100 | [diff] [blame] | 360 | {\ |
| 361 | .driver = TYPE_USB_DEVICE,\ |
| 362 | .property = "msos-desc",\ |
| 363 | .value = "no",\ |
Michael S. Tsirkin | 9e047b9 | 2013-10-14 18:01:20 +0300 | [diff] [blame] | 364 | },\ |
| 365 | {\ |
| 366 | .driver = "PIIX4_PM",\ |
| 367 | .property = "acpi-pci-hotplug-with-bridge-support",\ |
| 368 | .value = "off",\ |
Eduardo Habkost | b8f5cfd | 2014-06-24 23:04:44 -0300 | [diff] [blame] | 369 | },\ |
| 370 | {\ |
| 371 | .driver = "hpet",\ |
| 372 | .property = HPET_INTCAP,\ |
| 373 | .value = stringify(4),\ |
Gerd Hoffmann | 5319dc7 | 2013-11-20 07:32:31 +0100 | [diff] [blame] | 374 | } |
| 375 | |
Vincenzo Maffione | e9845f0 | 2013-08-02 18:30:52 +0200 | [diff] [blame] | 376 | #define PC_COMPAT_1_6 \ |
Gerd Hoffmann | 5319dc7 | 2013-11-20 07:32:31 +0100 | [diff] [blame] | 377 | PC_COMPAT_1_7, \ |
Vincenzo Maffione | e9845f0 | 2013-08-02 18:30:52 +0200 | [diff] [blame] | 378 | {\ |
| 379 | .driver = "e1000",\ |
| 380 | .property = "mitigation",\ |
| 381 | .value = "off",\ |
Eduardo Habkost | f8e6a11 | 2013-09-10 17:48:59 -0300 | [diff] [blame] | 382 | },{\ |
| 383 | .driver = "qemu64-" TYPE_X86_CPU,\ |
| 384 | .property = "model",\ |
| 385 | .value = stringify(2),\ |
| 386 | },{\ |
| 387 | .driver = "qemu32-" TYPE_X86_CPU,\ |
| 388 | .property = "model",\ |
| 389 | .value = stringify(3),\ |
Cole Robinson | 04c7d8b | 2013-11-05 18:46:27 -0500 | [diff] [blame] | 390 | },{\ |
| 391 | .driver = "i440FX-pcihost",\ |
| 392 | .property = "short_root_bus",\ |
| 393 | .value = stringify(1),\ |
| 394 | },{\ |
| 395 | .driver = "q35-pcihost",\ |
| 396 | .property = "short_root_bus",\ |
| 397 | .value = stringify(1),\ |
Vincenzo Maffione | e9845f0 | 2013-08-02 18:30:52 +0200 | [diff] [blame] | 398 | } |
| 399 | |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 400 | #define PC_COMPAT_1_5 \ |
Vincenzo Maffione | e9845f0 | 2013-08-02 18:30:52 +0200 | [diff] [blame] | 401 | PC_COMPAT_1_6, \ |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 402 | {\ |
| 403 | .driver = "Conroe-" TYPE_X86_CPU,\ |
| 404 | .property = "model",\ |
| 405 | .value = stringify(2),\ |
| 406 | },{\ |
Eduardo Habkost | 6b11322 | 2013-05-27 17:23:55 -0300 | [diff] [blame] | 407 | .driver = "Conroe-" TYPE_X86_CPU,\ |
| 408 | .property = "level",\ |
| 409 | .value = stringify(2),\ |
| 410 | },{\ |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 411 | .driver = "Penryn-" TYPE_X86_CPU,\ |
| 412 | .property = "model",\ |
| 413 | .value = stringify(2),\ |
| 414 | },{\ |
Eduardo Habkost | 6b11322 | 2013-05-27 17:23:55 -0300 | [diff] [blame] | 415 | .driver = "Penryn-" TYPE_X86_CPU,\ |
| 416 | .property = "level",\ |
| 417 | .value = stringify(2),\ |
| 418 | },{\ |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 419 | .driver = "Nehalem-" TYPE_X86_CPU,\ |
| 420 | .property = "model",\ |
| 421 | .value = stringify(2),\ |
Eduardo Habkost | 6b11322 | 2013-05-27 17:23:55 -0300 | [diff] [blame] | 422 | },{\ |
| 423 | .driver = "Nehalem-" TYPE_X86_CPU,\ |
| 424 | .property = "level",\ |
| 425 | .value = stringify(2),\ |
Michael S. Tsirkin | 488f069 | 2013-07-11 16:06:46 +0300 | [diff] [blame] | 426 | },{\ |
| 427 | .driver = "virtio-net-pci",\ |
| 428 | .property = "any_layout",\ |
| 429 | .value = "off",\ |
Eduardo Habkost | 9337e3b | 2013-07-26 17:09:36 -0300 | [diff] [blame] | 430 | },{\ |
| 431 | .driver = TYPE_X86_CPU,\ |
| 432 | .property = "pmu",\ |
| 433 | .value = "on",\ |
Cole Robinson | 04c7d8b | 2013-11-05 18:46:27 -0500 | [diff] [blame] | 434 | },{\ |
| 435 | .driver = "i440FX-pcihost",\ |
| 436 | .property = "short_root_bus",\ |
| 437 | .value = stringify(0),\ |
| 438 | },{\ |
| 439 | .driver = "q35-pcihost",\ |
| 440 | .property = "short_root_bus",\ |
| 441 | .value = stringify(0),\ |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 442 | } |
| 443 | |
Paolo Bonzini | bf3caa3 | 2013-02-08 14:06:15 +0100 | [diff] [blame] | 444 | #define PC_COMPAT_1_4 \ |
Eduardo Habkost | ffce9eb | 2013-05-27 17:23:54 -0300 | [diff] [blame] | 445 | PC_COMPAT_1_5, \ |
Paolo Bonzini | bf3caa3 | 2013-02-08 14:06:15 +0100 | [diff] [blame] | 446 | {\ |
| 447 | .driver = "scsi-hd",\ |
| 448 | .property = "discard_granularity",\ |
| 449 | .value = stringify(0),\ |
| 450 | },{\ |
| 451 | .driver = "scsi-cd",\ |
| 452 | .property = "discard_granularity",\ |
| 453 | .value = stringify(0),\ |
| 454 | },{\ |
| 455 | .driver = "scsi-disk",\ |
| 456 | .property = "discard_granularity",\ |
| 457 | .value = stringify(0),\ |
| 458 | },{\ |
| 459 | .driver = "ide-hd",\ |
| 460 | .property = "discard_granularity",\ |
| 461 | .value = stringify(0),\ |
| 462 | },{\ |
| 463 | .driver = "ide-cd",\ |
| 464 | .property = "discard_granularity",\ |
| 465 | .value = stringify(0),\ |
| 466 | },{\ |
| 467 | .driver = "ide-drive",\ |
| 468 | .property = "discard_granularity",\ |
| 469 | .value = stringify(0),\ |
Gerd Hoffmann | c45e5b5 | 2013-02-26 17:46:11 +0100 | [diff] [blame] | 470 | },{\ |
Paolo Bonzini | bf3caa3 | 2013-02-08 14:06:15 +0100 | [diff] [blame] | 471 | .driver = "virtio-blk-pci",\ |
| 472 | .property = "discard_granularity",\ |
| 473 | .value = stringify(0),\ |
Gal Hammer | 554f199 | 2013-02-27 15:15:31 +0200 | [diff] [blame] | 474 | },{\ |
| 475 | .driver = "virtio-serial-pci",\ |
| 476 | .property = "vectors",\ |
| 477 | /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ |
| 478 | .value = stringify(0xFFFFFFFF),\ |
Dmitry Fleytman | 644c985 | 2013-05-20 11:18:14 +0300 | [diff] [blame] | 479 | },{ \ |
| 480 | .driver = "virtio-net-pci", \ |
| 481 | .property = "ctrl_guest_offloads", \ |
| 482 | .value = "off", \ |
Gerd Hoffmann | c45e5b5 | 2013-02-26 17:46:11 +0100 | [diff] [blame] | 483 | },{\ |
| 484 | .driver = "e1000",\ |
| 485 | .property = "romfile",\ |
| 486 | .value = "pxe-e1000.rom",\ |
| 487 | },{\ |
| 488 | .driver = "ne2k_pci",\ |
| 489 | .property = "romfile",\ |
| 490 | .value = "pxe-ne2k_pci.rom",\ |
| 491 | },{\ |
| 492 | .driver = "pcnet",\ |
| 493 | .property = "romfile",\ |
| 494 | .value = "pxe-pcnet.rom",\ |
| 495 | },{\ |
| 496 | .driver = "rtl8139",\ |
| 497 | .property = "romfile",\ |
| 498 | .value = "pxe-rtl8139.rom",\ |
| 499 | },{\ |
| 500 | .driver = "virtio-net-pci",\ |
| 501 | .property = "romfile",\ |
| 502 | .value = "pxe-virtio.rom",\ |
Markus Armbruster | 9953f88 | 2013-04-12 17:25:03 +0200 | [diff] [blame] | 503 | },{\ |
Andreas Färber | b2a856d | 2013-05-01 17:30:51 +0200 | [diff] [blame] | 504 | .driver = "486-" TYPE_X86_CPU,\ |
| 505 | .property = "model",\ |
| 506 | .value = stringify(0),\ |
Gerd Hoffmann | c45e5b5 | 2013-02-26 17:46:11 +0100 | [diff] [blame] | 507 | } |
Paolo Bonzini | bf3caa3 | 2013-02-08 14:06:15 +0100 | [diff] [blame] | 508 | |
Michael S. Tsirkin | a0dba64 | 2013-08-27 09:48:06 +0300 | [diff] [blame] | 509 | #define PC_COMMON_MACHINE_OPTIONS \ |
| 510 | .default_boot_order = "cad" |
| 511 | |
| 512 | #define PC_DEFAULT_MACHINE_OPTIONS \ |
| 513 | PC_COMMON_MACHINE_OPTIONS, \ |
| 514 | .hot_add_cpu = pc_hot_add_cpu, \ |
| 515 | .max_cpus = 255 |
| 516 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 517 | #endif |