4 #include "qemu-common.h"
5 #include "exec/memory.h"
6 #include "exec/ioport.h"
7 #include "hw/isa/isa.h"
8 #include "hw/block/fdc.h"
10 #include "hw/i386/ioapic.h"
12 /* PC-style peripherals (also used by other machines). */
15 static inline bool parallel_init(ISABus
*bus
, int index
, CharDriverState
*chr
)
19 dev
= isa_try_create(bus
, "isa-parallel");
23 qdev_prop_set_uint32(&dev
->qdev
, "index", index
);
24 qdev_prop_set_chr(&dev
->qdev
, "chardev", chr
);
25 if (qdev_init(&dev
->qdev
) < 0) {
31 bool parallel_mm_init(MemoryRegion
*address_space
,
32 hwaddr base
, int it_shift
, qemu_irq irq
,
33 CharDriverState
*chr
);
37 extern DeviceState
*isa_pic
;
38 qemu_irq
*i8259_init(ISABus
*bus
, qemu_irq parent_irq
);
39 qemu_irq
*kvm_i8259_init(ISABus
*bus
);
40 int pic_read_irq(DeviceState
*d
);
41 int pic_get_output(DeviceState
*d
);
42 void pic_info(Monitor
*mon
, const QDict
*qdict
);
43 void irq_info(Monitor
*mon
, const QDict
*qdict
);
45 /* Global System Interrupts */
47 #define GSI_NUM_PINS IOAPIC_NUM_PINS
49 typedef struct GSIState
{
50 qemu_irq i8259_irq
[ISA_NUM_IRQS
];
51 qemu_irq ioapic_irq
[IOAPIC_NUM_PINS
];
54 void gsi_handler(void *opaque
, int n
, int level
);
57 static inline void vmport_init(ISABus
*bus
)
59 isa_create_simple(bus
, "vmport");
61 void vmport_register(unsigned char command
, IOPortReadFunc
*func
, void *opaque
);
62 void vmmouse_get_data(uint32_t *data
);
63 void vmmouse_set_data(const uint32_t *data
);
67 void i8042_init(qemu_irq kbd_irq
, qemu_irq mouse_irq
, uint32_t io_base
);
68 void i8042_mm_init(qemu_irq kbd_irq
, qemu_irq mouse_irq
,
69 MemoryRegion
*region
, ram_addr_t size
,
71 void i8042_isa_mouse_fake_event(void *opaque
);
72 void i8042_setup_a20_line(ISADevice
*dev
, qemu_irq
*a20_out
);
75 extern int fd_bootchk
;
77 void pc_register_ferr_irq(qemu_irq irq
);
78 void pc_acpi_smi_interrupt(void *opaque
, int irq
, int level
);
80 #define QEMU_BELOW_4G_RAM_END 0xe0000000
81 #define QEMU_BELOW_4G_MMIO_LENGTH ((1ULL << 32) - QEMU_BELOW_4G_RAM_END)
83 void pc_cpus_init(const char *cpu_model
, DeviceState
*icc_bridge
);
84 void pc_hot_add_cpu(const int64_t id
, Error
**errp
);
85 void pc_acpi_init(const char *default_dsdt
);
86 FWCfgState
*pc_memory_init(MemoryRegion
*system_memory
,
87 const char *kernel_filename
,
88 const char *kernel_cmdline
,
89 const char *initrd_filename
,
90 ram_addr_t below_4g_mem_size
,
91 ram_addr_t above_4g_mem_size
,
92 MemoryRegion
*rom_memory
,
93 MemoryRegion
**ram_memory
);
94 qemu_irq
*pc_allocate_cpu_irq(void);
95 DeviceState
*pc_vga_init(ISABus
*isa_bus
, PCIBus
*pci_bus
);
96 void pc_basic_device_init(ISABus
*isa_bus
, qemu_irq
*gsi
,
97 ISADevice
**rtc_state
,
100 void pc_init_ne2k_isa(ISABus
*bus
, NICInfo
*nd
);
101 void pc_cmos_init(ram_addr_t ram_size
, ram_addr_t above_4g_mem_size
,
102 const char *boot_device
,
103 ISADevice
*floppy
, BusState
*ide0
, BusState
*ide1
,
105 void pc_nic_init(ISABus
*isa_bus
, PCIBus
*pci_bus
);
106 void pc_pci_device_init(PCIBus
*pci_bus
);
108 typedef void (*cpu_set_smm_t
)(int smm
, void *arg
);
109 void cpu_smm_register(cpu_set_smm_t callback
, void *arg
);
111 void ioapic_init_gsi(GSIState
*gsi_state
, const char *parent_name
);
115 i2c_bus
*piix4_pm_init(PCIBus
*bus
, int devfn
, uint32_t smb_io_base
,
116 qemu_irq sci_irq
, qemu_irq smi_irq
,
117 int kvm_enabled
, FWCfgState
*fw_cfg
);
118 void piix4_smbus_register_device(SMBusDevice
*dev
, uint8_t addr
);
124 struct PCII440FXState
;
125 typedef struct PCII440FXState PCII440FXState
;
127 PCIBus
*i440fx_init(PCII440FXState
**pi440fx_state
, int *piix_devfn
,
128 ISABus
**isa_bus
, qemu_irq
*pic
,
129 MemoryRegion
*address_space_mem
,
130 MemoryRegion
*address_space_io
,
132 hwaddr pci_hole_start
,
133 hwaddr pci_hole_size
,
134 hwaddr pci_hole64_start
,
135 hwaddr pci_hole64_size
,
136 MemoryRegion
*pci_memory
,
137 MemoryRegion
*ram_memory
);
140 extern PCIDevice
*piix4_dev
;
141 int piix4_init(PCIBus
*bus
, ISABus
**isa_bus
, int devfn
);
144 enum vga_retrace_method
{
149 extern enum vga_retrace_method vga_retrace_method
;
151 int isa_vga_mm_init(hwaddr vram_base
,
152 hwaddr ctrl_base
, int it_shift
,
153 MemoryRegion
*address_space
);
156 static inline bool isa_ne2000_init(ISABus
*bus
, int base
, int irq
, NICInfo
*nd
)
160 qemu_check_nic_model(nd
, "ne2k_isa");
162 dev
= isa_try_create(bus
, "ne2k_isa");
166 qdev_prop_set_uint32(&dev
->qdev
, "iobase", base
);
167 qdev_prop_set_uint32(&dev
->qdev
, "irq", irq
);
168 qdev_set_nic_properties(&dev
->qdev
, nd
);
169 qdev_init_nofail(&dev
->qdev
);
174 void pc_system_firmware_init(MemoryRegion
*rom_memory
);
177 int pvpanic_init(ISABus
*bus
);
181 #define E820_RESERVED 2
184 #define E820_UNUSABLE 5
186 int e820_add_entry(uint64_t, uint64_t, uint32_t);
188 #define PC_COMPAT_1_5 \
190 .driver = "Conroe-" TYPE_X86_CPU,\
191 .property = "model",\
192 .value = stringify(2),\
194 .driver = "Penryn-" TYPE_X86_CPU,\
195 .property = "model",\
196 .value = stringify(2),\
198 .driver = "Nehalem-" TYPE_X86_CPU,\
199 .property = "model",\
200 .value = stringify(2),\
203 #define PC_COMPAT_1_4 \
206 .driver = "scsi-hd",\
207 .property = "discard_granularity",\
208 .value = stringify(0),\
210 .driver = "scsi-cd",\
211 .property = "discard_granularity",\
212 .value = stringify(0),\
214 .driver = "scsi-disk",\
215 .property = "discard_granularity",\
216 .value = stringify(0),\
219 .property = "discard_granularity",\
220 .value = stringify(0),\
223 .property = "discard_granularity",\
224 .value = stringify(0),\
226 .driver = "ide-drive",\
227 .property = "discard_granularity",\
228 .value = stringify(0),\
230 .driver = "virtio-blk-pci",\
231 .property = "discard_granularity",\
232 .value = stringify(0),\
234 .driver = "virtio-serial-pci",\
235 .property = "vectors",\
236 /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
237 .value = stringify(0xFFFFFFFF),\
239 .driver = "virtio-net-pci", \
240 .property = "ctrl_guest_offloads", \
244 .property = "romfile",\
245 .value = "pxe-e1000.rom",\
247 .driver = "ne2k_pci",\
248 .property = "romfile",\
249 .value = "pxe-ne2k_pci.rom",\
252 .property = "romfile",\
253 .value = "pxe-pcnet.rom",\
255 .driver = "rtl8139",\
256 .property = "romfile",\
257 .value = "pxe-rtl8139.rom",\
259 .driver = "virtio-net-pci",\
260 .property = "romfile",\
261 .value = "pxe-virtio.rom",\
263 .driver = "486-" TYPE_X86_CPU,\
264 .property = "model",\
265 .value = stringify(0),\