i440fx: make types configurable at run-time
[qemu/cris-port.git] / hw / i386 / pc_piix.c
blobaaf7cfb0519234685d23584797b90e9da1713406
1 /*
2 * QEMU PC System Emulator
4 * Copyright (c) 2003-2004 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #include <glib.h>
27 #include "hw/hw.h"
28 #include "hw/loader.h"
29 #include "hw/i386/pc.h"
30 #include "hw/i386/apic.h"
31 #include "hw/smbios/smbios.h"
32 #include "hw/pci/pci.h"
33 #include "hw/pci/pci_ids.h"
34 #include "hw/usb.h"
35 #include "net/net.h"
36 #include "hw/boards.h"
37 #include "hw/ide.h"
38 #include "sysemu/kvm.h"
39 #include "hw/kvm/clock.h"
40 #include "sysemu/sysemu.h"
41 #include "hw/sysbus.h"
42 #include "hw/cpu/icc_bus.h"
43 #include "sysemu/arch_init.h"
44 #include "sysemu/block-backend.h"
45 #include "hw/i2c/smbus.h"
46 #include "hw/xen/xen.h"
47 #include "exec/memory.h"
48 #include "exec/address-spaces.h"
49 #include "hw/acpi/acpi.h"
50 #include "cpu.h"
51 #include "qemu/error-report.h"
52 #ifdef CONFIG_XEN
53 # include <xen/hvm/hvm_info_table.h>
54 #endif
55 #include "migration/migration.h"
57 #define MAX_IDE_BUS 2
59 static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
60 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
61 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
63 static bool pci_enabled = true;
64 static bool has_acpi_build = true;
65 static bool rsdp_in_ram = true;
66 static int legacy_acpi_table_size;
67 static bool smbios_defaults = true;
68 static bool smbios_legacy_mode;
69 static bool smbios_uuid_encoded = true;
70 /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
71 * host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
72 * pages in the host.
74 static bool gigabyte_align = true;
75 static bool has_reserved_memory = true;
76 static bool kvmclock_enabled = true;
78 /* PC hardware initialisation */
79 static void pc_init1(MachineState *machine)
81 PCMachineState *pcms = PC_MACHINE(machine);
82 MemoryRegion *system_memory = get_system_memory();
83 MemoryRegion *system_io = get_system_io();
84 int i;
85 PCIBus *pci_bus;
86 ISABus *isa_bus;
87 PCII440FXState *i440fx_state;
88 int piix3_devfn = -1;
89 qemu_irq *gsi;
90 qemu_irq *i8259;
91 qemu_irq smi_irq;
92 GSIState *gsi_state;
93 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
94 BusState *idebus[MAX_IDE_BUS];
95 ISADevice *rtc_state;
96 MemoryRegion *ram_memory;
97 MemoryRegion *pci_memory;
98 MemoryRegion *rom_memory;
99 DeviceState *icc_bridge;
100 PcGuestInfo *guest_info;
101 ram_addr_t lowmem;
103 /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
104 * If it doesn't, we need to split it in chunks below and above 4G.
105 * In any case, try to make sure that guest addresses aligned at
106 * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
107 * For old machine types, use whatever split we used historically to avoid
108 * breaking migration.
110 if (machine->ram_size >= 0xe0000000) {
111 lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
112 } else {
113 lowmem = 0xe0000000;
116 /* Handle the machine opt max-ram-below-4g. It is basically doing
117 * min(qemu limit, user limit).
119 if (lowmem > pcms->max_ram_below_4g) {
120 lowmem = pcms->max_ram_below_4g;
121 if (machine->ram_size - lowmem > lowmem &&
122 lowmem & ((1ULL << 30) - 1)) {
123 error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
124 ") not a multiple of 1G; possible bad performance.",
125 pcms->max_ram_below_4g);
129 if (machine->ram_size >= lowmem) {
130 pcms->above_4g_mem_size = machine->ram_size - lowmem;
131 pcms->below_4g_mem_size = lowmem;
132 } else {
133 pcms->above_4g_mem_size = 0;
134 pcms->below_4g_mem_size = machine->ram_size;
137 if (xen_enabled() && xen_hvm_init(&pcms->below_4g_mem_size,
138 &pcms->above_4g_mem_size,
139 &ram_memory) != 0) {
140 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
141 exit(1);
144 icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
145 object_property_add_child(qdev_get_machine(), "icc-bridge",
146 OBJECT(icc_bridge), NULL);
148 pc_cpus_init(machine->cpu_model, icc_bridge);
150 if (kvm_enabled() && kvmclock_enabled) {
151 kvmclock_create();
154 if (pci_enabled) {
155 pci_memory = g_new(MemoryRegion, 1);
156 memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
157 rom_memory = pci_memory;
158 } else {
159 pci_memory = NULL;
160 rom_memory = system_memory;
163 guest_info = pc_guest_info_init(pcms);
165 guest_info->has_acpi_build = has_acpi_build;
166 guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
168 guest_info->isapc_ram_fw = !pci_enabled;
169 guest_info->has_reserved_memory = has_reserved_memory;
170 guest_info->rsdp_in_ram = rsdp_in_ram;
172 if (smbios_defaults) {
173 MachineClass *mc = MACHINE_GET_CLASS(machine);
174 /* These values are guest ABI, do not change */
175 smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
176 mc->name, smbios_legacy_mode, smbios_uuid_encoded,
177 SMBIOS_ENTRY_POINT_21);
180 /* allocate ram and load rom/bios */
181 if (!xen_enabled()) {
182 pc_memory_init(pcms, system_memory,
183 rom_memory, &ram_memory, guest_info);
184 } else if (machine->kernel_filename != NULL) {
185 /* For xen HVM direct kernel boot, load linux here */
186 xen_load_linux(pcms, guest_info);
189 gsi_state = g_malloc0(sizeof(*gsi_state));
190 if (kvm_irqchip_in_kernel()) {
191 kvm_pc_setup_irq_routing(pci_enabled);
192 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
193 GSI_NUM_PINS);
194 } else {
195 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
198 if (pci_enabled) {
199 pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
200 TYPE_I440FX_PCI_DEVICE,
201 &i440fx_state, &piix3_devfn, &isa_bus, gsi,
202 system_memory, system_io, machine->ram_size,
203 pcms->below_4g_mem_size,
204 pcms->above_4g_mem_size,
205 pci_memory, ram_memory);
206 } else {
207 pci_bus = NULL;
208 i440fx_state = NULL;
209 isa_bus = isa_bus_new(NULL, get_system_memory(), system_io);
210 no_hpet = 1;
212 isa_bus_irqs(isa_bus, gsi);
214 if (kvm_irqchip_in_kernel()) {
215 i8259 = kvm_i8259_init(isa_bus);
216 } else if (xen_enabled()) {
217 i8259 = xen_interrupt_controller_init();
218 } else {
219 i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
222 for (i = 0; i < ISA_NUM_IRQS; i++) {
223 gsi_state->i8259_irq[i] = i8259[i];
225 g_free(i8259);
226 if (pci_enabled) {
227 ioapic_init_gsi(gsi_state, "i440fx");
229 qdev_init_nofail(icc_bridge);
231 pc_register_ferr_irq(gsi[13]);
233 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
235 assert(pcms->vmport != ON_OFF_AUTO_MAX);
236 if (pcms->vmport == ON_OFF_AUTO_AUTO) {
237 pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
240 /* init basic PC hardware */
241 pc_basic_device_init(isa_bus, gsi, &rtc_state, true,
242 (pcms->vmport != ON_OFF_AUTO_ON), 0x4);
244 pc_nic_init(isa_bus, pci_bus);
246 ide_drive_get(hd, ARRAY_SIZE(hd));
247 if (pci_enabled) {
248 PCIDevice *dev;
249 if (xen_enabled()) {
250 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
251 } else {
252 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
254 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
255 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
256 } else {
257 for(i = 0; i < MAX_IDE_BUS; i++) {
258 ISADevice *dev;
259 char busname[] = "ide.0";
260 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
261 ide_irq[i],
262 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
264 * The ide bus name is ide.0 for the first bus and ide.1 for the
265 * second one.
267 busname[4] = '0' + i;
268 idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
272 pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
274 if (pci_enabled && usb_enabled()) {
275 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
278 if (pci_enabled && acpi_enabled) {
279 DeviceState *piix4_pm;
280 I2CBus *smbus;
282 smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
283 /* TODO: Populate SPD eeprom data. */
284 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
285 gsi[9], smi_irq,
286 pc_machine_is_smm_enabled(pcms),
287 &piix4_pm);
288 smbus_eeprom_init(smbus, 8, NULL, 0);
290 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
291 TYPE_HOTPLUG_HANDLER,
292 (Object **)&pcms->acpi_dev,
293 object_property_allow_set_link,
294 OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
295 object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
296 PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
299 if (pci_enabled) {
300 pc_pci_device_init(pci_bus);
304 static void pc_compat_2_3(MachineState *machine)
306 PCMachineState *pcms = PC_MACHINE(machine);
307 savevm_skip_section_footers();
308 if (kvm_enabled()) {
309 pcms->smm = ON_OFF_AUTO_OFF;
311 global_state_set_optional();
312 savevm_skip_configuration();
315 static void pc_compat_2_2(MachineState *machine)
317 pc_compat_2_3(machine);
318 rsdp_in_ram = false;
319 machine->suppress_vmdesc = true;
322 static void pc_compat_2_1(MachineState *machine)
324 PCMachineState *pcms = PC_MACHINE(machine);
326 pc_compat_2_2(machine);
327 smbios_uuid_encoded = false;
328 x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
329 pcms->enforce_aligned_dimm = false;
332 static void pc_compat_2_0(MachineState *machine)
334 pc_compat_2_1(machine);
335 /* This value depends on the actual DSDT and SSDT compiled into
336 * the source QEMU; unfortunately it depends on the binary and
337 * not on the machine type, so we cannot make pc-i440fx-1.7 work on
338 * both QEMU 1.7 and QEMU 2.0.
340 * Large variations cause migration to fail for more than one
341 * consecutive value of the "-smp" maxcpus option.
343 * For small variations of the kind caused by different iasl versions,
344 * the 4k rounding usually leaves slack. However, there could be still
345 * one or two values that break. For QEMU 1.7 and QEMU 2.0 the
346 * slack is only ~10 bytes before one "-smp maxcpus" value breaks!
348 * 6652 is valid for QEMU 2.0, the right value for pc-i440fx-1.7 on
349 * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418.
351 legacy_acpi_table_size = 6652;
352 smbios_legacy_mode = true;
353 has_reserved_memory = false;
354 pc_set_legacy_acpi_data_size();
357 static void pc_compat_1_7(MachineState *machine)
359 pc_compat_2_0(machine);
360 smbios_defaults = false;
361 gigabyte_align = false;
362 option_rom_has_mr = true;
363 legacy_acpi_table_size = 6414;
364 x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC);
367 static void pc_compat_1_6(MachineState *machine)
369 pc_compat_1_7(machine);
370 rom_file_has_mr = false;
371 has_acpi_build = false;
374 static void pc_compat_1_5(MachineState *machine)
376 pc_compat_1_6(machine);
379 static void pc_compat_1_4(MachineState *machine)
381 pc_compat_1_5(machine);
384 static void pc_compat_1_3(MachineState *machine)
386 pc_compat_1_4(machine);
387 enable_compat_apic_id_mode();
390 /* PC compat function for pc-0.14 to pc-1.2 */
391 static void pc_compat_1_2(MachineState *machine)
393 pc_compat_1_3(machine);
394 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
397 /* PC compat function for pc-0.10 to pc-0.13 */
398 static void pc_compat_0_13(MachineState *machine)
400 pc_compat_1_2(machine);
401 kvmclock_enabled = false;
404 static void pc_init_isa(MachineState *machine)
406 pci_enabled = false;
407 has_acpi_build = false;
408 smbios_defaults = false;
409 gigabyte_align = false;
410 smbios_legacy_mode = true;
411 has_reserved_memory = false;
412 option_rom_has_mr = true;
413 rom_file_has_mr = false;
414 if (!machine->cpu_model) {
415 machine->cpu_model = "486";
417 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
418 enable_compat_apic_id_mode();
419 pc_init1(machine);
422 #ifdef CONFIG_XEN
423 static void pc_xen_hvm_init(MachineState *machine)
425 PCIBus *bus;
427 pc_init1(machine);
429 bus = pci_find_primary_bus();
430 if (bus != NULL) {
431 pci_create_simple(bus, -1, "xen-platform");
434 #endif
436 #define DEFINE_I440FX_MACHINE(suffix, name, compatfn, optionfn) \
437 static void pc_init_##suffix(MachineState *machine) \
439 void (*compat)(MachineState *m) = (compatfn); \
440 if (compat) { \
441 compat(machine); \
443 pc_init1(machine); \
445 DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
447 static void pc_i440fx_machine_options(MachineClass *m)
449 m->family = "pc_piix";
450 m->desc = "Standard PC (i440FX + PIIX, 1996)";
451 m->hot_add_cpu = pc_hot_add_cpu;
454 static void pc_i440fx_2_4_machine_options(MachineClass *m)
456 pc_i440fx_machine_options(m);
457 m->default_machine_opts = "firmware=bios-256k.bin";
458 m->default_display = "std";
459 m->alias = "pc";
460 m->is_default = 1;
463 DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
464 pc_i440fx_2_4_machine_options)
467 static void pc_i440fx_2_3_machine_options(MachineClass *m)
469 pc_i440fx_2_4_machine_options(m);
470 m->alias = NULL;
471 m->is_default = 0;
472 SET_MACHINE_COMPAT(m, PC_COMPAT_2_3);
475 DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3,
476 pc_i440fx_2_3_machine_options);
479 static void pc_i440fx_2_2_machine_options(MachineClass *m)
481 pc_i440fx_2_3_machine_options(m);
482 SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
485 DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2,
486 pc_i440fx_2_2_machine_options);
489 static void pc_i440fx_2_1_machine_options(MachineClass *m)
491 pc_i440fx_2_2_machine_options(m);
492 m->default_display = NULL;
493 SET_MACHINE_COMPAT(m, PC_COMPAT_2_1);
496 DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1,
497 pc_i440fx_2_1_machine_options);
501 static void pc_i440fx_2_0_machine_options(MachineClass *m)
503 pc_i440fx_2_1_machine_options(m);
504 SET_MACHINE_COMPAT(m, PC_COMPAT_2_0);
507 DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0,
508 pc_i440fx_2_0_machine_options);
511 static void pc_i440fx_1_7_machine_options(MachineClass *m)
513 pc_i440fx_2_0_machine_options(m);
514 m->default_machine_opts = NULL;
515 SET_MACHINE_COMPAT(m, PC_COMPAT_1_7);
518 DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7,
519 pc_i440fx_1_7_machine_options);
522 static void pc_i440fx_1_6_machine_options(MachineClass *m)
524 pc_i440fx_1_7_machine_options(m);
525 SET_MACHINE_COMPAT(m, PC_COMPAT_1_6);
528 DEFINE_I440FX_MACHINE(v1_6, "pc-i440fx-1.6", pc_compat_1_6,
529 pc_i440fx_1_6_machine_options);
532 static void pc_i440fx_1_5_machine_options(MachineClass *m)
534 pc_i440fx_1_6_machine_options(m);
535 SET_MACHINE_COMPAT(m, PC_COMPAT_1_5);
538 DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5,
539 pc_i440fx_1_5_machine_options);
542 static void pc_i440fx_1_4_machine_options(MachineClass *m)
544 pc_i440fx_1_5_machine_options(m);
545 m->hot_add_cpu = NULL;
546 SET_MACHINE_COMPAT(m, PC_COMPAT_1_4);
549 DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
550 pc_i440fx_1_4_machine_options);
553 #define PC_COMPAT_1_3 \
554 PC_COMPAT_1_4 \
556 .driver = "usb-tablet",\
557 .property = "usb_version",\
558 .value = stringify(1),\
559 },{\
560 .driver = "virtio-net-pci",\
561 .property = "ctrl_mac_addr",\
562 .value = "off", \
563 },{ \
564 .driver = "virtio-net-pci", \
565 .property = "mq", \
566 .value = "off", \
567 }, {\
568 .driver = "e1000",\
569 .property = "autonegotiation",\
570 .value = "off",\
574 static void pc_i440fx_1_3_machine_options(MachineClass *m)
576 pc_i440fx_1_4_machine_options(m);
577 SET_MACHINE_COMPAT(m, PC_COMPAT_1_3);
580 DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
581 pc_i440fx_1_3_machine_options);
584 #define PC_COMPAT_1_2 \
585 PC_COMPAT_1_3 \
587 .driver = "nec-usb-xhci",\
588 .property = "msi",\
589 .value = "off",\
590 },{\
591 .driver = "nec-usb-xhci",\
592 .property = "msix",\
593 .value = "off",\
594 },{\
595 .driver = "ivshmem",\
596 .property = "use64",\
597 .value = "0",\
598 },{\
599 .driver = "qxl",\
600 .property = "revision",\
601 .value = stringify(3),\
602 },{\
603 .driver = "qxl-vga",\
604 .property = "revision",\
605 .value = stringify(3),\
606 },{\
607 .driver = "VGA",\
608 .property = "mmio",\
609 .value = "off",\
612 static void pc_i440fx_1_2_machine_options(MachineClass *m)
614 pc_i440fx_1_3_machine_options(m);
615 SET_MACHINE_COMPAT(m, PC_COMPAT_1_2);
618 DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
619 pc_i440fx_1_2_machine_options);
622 #define PC_COMPAT_1_1 \
623 PC_COMPAT_1_2 \
625 .driver = "virtio-scsi-pci",\
626 .property = "hotplug",\
627 .value = "off",\
628 },{\
629 .driver = "virtio-scsi-pci",\
630 .property = "param_change",\
631 .value = "off",\
632 },{\
633 .driver = "VGA",\
634 .property = "vgamem_mb",\
635 .value = stringify(8),\
636 },{\
637 .driver = "vmware-svga",\
638 .property = "vgamem_mb",\
639 .value = stringify(8),\
640 },{\
641 .driver = "qxl-vga",\
642 .property = "vgamem_mb",\
643 .value = stringify(8),\
644 },{\
645 .driver = "qxl",\
646 .property = "vgamem_mb",\
647 .value = stringify(8),\
648 },{\
649 .driver = "virtio-blk-pci",\
650 .property = "config-wce",\
651 .value = "off",\
654 static void pc_i440fx_1_1_machine_options(MachineClass *m)
656 pc_i440fx_1_2_machine_options(m);
657 SET_MACHINE_COMPAT(m, PC_COMPAT_1_1);
660 DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
661 pc_i440fx_1_1_machine_options);
664 #define PC_COMPAT_1_0 \
665 PC_COMPAT_1_1 \
667 .driver = TYPE_ISA_FDC,\
668 .property = "check_media_rate",\
669 .value = "off",\
670 }, {\
671 .driver = "virtio-balloon-pci",\
672 .property = "class",\
673 .value = stringify(PCI_CLASS_MEMORY_RAM),\
674 },{\
675 .driver = "apic-common",\
676 .property = "vapic",\
677 .value = "off",\
678 },{\
679 .driver = TYPE_USB_DEVICE,\
680 .property = "full-path",\
681 .value = "no",\
684 static void pc_i440fx_1_0_machine_options(MachineClass *m)
686 pc_i440fx_1_1_machine_options(m);
687 m->hw_version = "1.0";
688 SET_MACHINE_COMPAT(m, PC_COMPAT_1_0);
691 DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
692 pc_i440fx_1_0_machine_options);
695 #define PC_COMPAT_0_15 \
696 PC_COMPAT_1_0
698 static void pc_i440fx_0_15_machine_options(MachineClass *m)
700 pc_i440fx_1_0_machine_options(m);
701 m->hw_version = "0.15";
702 SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
705 DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
706 pc_i440fx_0_15_machine_options);
709 #define PC_COMPAT_0_14 \
710 PC_COMPAT_0_15 \
712 .driver = "virtio-blk-pci",\
713 .property = "event_idx",\
714 .value = "off",\
715 },{\
716 .driver = "virtio-serial-pci",\
717 .property = "event_idx",\
718 .value = "off",\
719 },{\
720 .driver = "virtio-net-pci",\
721 .property = "event_idx",\
722 .value = "off",\
723 },{\
724 .driver = "virtio-balloon-pci",\
725 .property = "event_idx",\
726 .value = "off",\
727 },{\
728 .driver = "qxl",\
729 .property = "revision",\
730 .value = stringify(2),\
731 },{\
732 .driver = "qxl-vga",\
733 .property = "revision",\
734 .value = stringify(2),\
737 static void pc_i440fx_0_14_machine_options(MachineClass *m)
739 pc_i440fx_0_15_machine_options(m);
740 m->hw_version = "0.14";
741 SET_MACHINE_COMPAT(m, PC_COMPAT_0_14);
744 DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
745 pc_i440fx_0_14_machine_options);
748 #define PC_COMPAT_0_13 \
749 PC_COMPAT_0_14 \
751 .driver = TYPE_PCI_DEVICE,\
752 .property = "command_serr_enable",\
753 .value = "off",\
754 },{\
755 .driver = "AC97",\
756 .property = "use_broken_id",\
757 .value = stringify(1),\
758 },{\
759 .driver = "virtio-9p-pci",\
760 .property = "vectors",\
761 .value = stringify(0),\
762 },{\
763 .driver = "VGA",\
764 .property = "rombar",\
765 .value = stringify(0),\
766 },{\
767 .driver = "vmware-svga",\
768 .property = "rombar",\
769 .value = stringify(0),\
772 static void pc_i440fx_0_13_machine_options(MachineClass *m)
774 pc_i440fx_0_14_machine_options(m);
775 m->hw_version = "0.13";
776 SET_MACHINE_COMPAT(m, PC_COMPAT_0_13);
779 DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
780 pc_i440fx_0_13_machine_options);
783 #define PC_COMPAT_0_12 \
784 PC_COMPAT_0_13 \
786 .driver = "virtio-serial-pci",\
787 .property = "max_ports",\
788 .value = stringify(1),\
789 },{\
790 .driver = "virtio-serial-pci",\
791 .property = "vectors",\
792 .value = stringify(0),\
793 },{\
794 .driver = "usb-mouse",\
795 .property = "serial",\
796 .value = "1",\
797 },{\
798 .driver = "usb-tablet",\
799 .property = "serial",\
800 .value = "1",\
801 },{\
802 .driver = "usb-kbd",\
803 .property = "serial",\
804 .value = "1",\
807 static void pc_i440fx_0_12_machine_options(MachineClass *m)
809 pc_i440fx_0_13_machine_options(m);
810 m->hw_version = "0.12";
811 SET_MACHINE_COMPAT(m, PC_COMPAT_0_12);
814 DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
815 pc_i440fx_0_12_machine_options);
818 #define PC_COMPAT_0_11 \
819 PC_COMPAT_0_12 \
821 .driver = "virtio-blk-pci",\
822 .property = "vectors",\
823 .value = stringify(0),\
824 },{\
825 .driver = TYPE_PCI_DEVICE,\
826 .property = "rombar",\
827 .value = stringify(0),\
828 },{\
829 .driver = "ide-drive",\
830 .property = "ver",\
831 .value = "0.11",\
832 },{\
833 .driver = "scsi-disk",\
834 .property = "ver",\
835 .value = "0.11",\
838 static void pc_i440fx_0_11_machine_options(MachineClass *m)
840 pc_i440fx_0_12_machine_options(m);
841 m->hw_version = "0.11";
842 SET_MACHINE_COMPAT(m, PC_COMPAT_0_11);
845 DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
846 pc_i440fx_0_11_machine_options);
849 #define PC_COMPAT_0_10 \
850 PC_COMPAT_0_11 \
852 .driver = "virtio-blk-pci",\
853 .property = "class",\
854 .value = stringify(PCI_CLASS_STORAGE_OTHER),\
855 },{\
856 .driver = "virtio-serial-pci",\
857 .property = "class",\
858 .value = stringify(PCI_CLASS_DISPLAY_OTHER),\
859 },{\
860 .driver = "virtio-net-pci",\
861 .property = "vectors",\
862 .value = stringify(0),\
863 },{\
864 .driver = "ide-drive",\
865 .property = "ver",\
866 .value = "0.10",\
867 },{\
868 .driver = "scsi-disk",\
869 .property = "ver",\
870 .value = "0.10",\
873 static void pc_i440fx_0_10_machine_options(MachineClass *m)
875 pc_i440fx_0_11_machine_options(m);
876 m->hw_version = "0.10";
877 SET_MACHINE_COMPAT(m, PC_COMPAT_0_10);
880 DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13,
881 pc_i440fx_0_10_machine_options);
884 static void isapc_machine_options(MachineClass *m)
886 m->desc = "ISA-only PC";
887 m->max_cpus = 1;
890 DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
891 isapc_machine_options);
894 #ifdef CONFIG_XEN
895 static void xenfv_machine_options(MachineClass *m)
897 m->desc = "Xen Fully-virtualized PC";
898 m->max_cpus = HVM_MAX_VCPUS;
899 m->default_machine_opts = "accel=xen";
900 m->hot_add_cpu = pc_hot_add_cpu;
903 DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
904 xenfv_machine_options);
905 #endif