]> git.proxmox.com Git - qemu.git/blob - hw/i386/pc_piix.c
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
[qemu.git] / hw / i386 / pc_piix.c
1 /*
2 * QEMU PC System Emulator
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
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.
23 */
24
25 #include <glib.h>
26
27 #include "hw/hw.h"
28 #include "hw/i386/pc.h"
29 #include "hw/i386/apic.h"
30 #include "hw/pci/pci.h"
31 #include "hw/pci/pci_ids.h"
32 #include "hw/usb.h"
33 #include "net/net.h"
34 #include "hw/boards.h"
35 #include "hw/ide.h"
36 #include "sysemu/kvm.h"
37 #include "hw/kvm/clock.h"
38 #include "sysemu/sysemu.h"
39 #include "hw/sysbus.h"
40 #include "hw/cpu/icc_bus.h"
41 #include "sysemu/arch_init.h"
42 #include "sysemu/blockdev.h"
43 #include "hw/i2c/smbus.h"
44 #include "hw/xen/xen.h"
45 #include "exec/memory.h"
46 #include "exec/address-spaces.h"
47 #include "hw/acpi/acpi.h"
48 #include "cpu.h"
49 #ifdef CONFIG_XEN
50 # include <xen/hvm/hvm_info_table.h>
51 #endif
52
53 #define MAX_IDE_BUS 2
54
55 static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
56 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
57 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
58
59 static bool has_pvpanic = true;
60 static bool has_pci_info = true;
61
62 /* PC hardware initialisation */
63 static void pc_init1(MemoryRegion *system_memory,
64 MemoryRegion *system_io,
65 ram_addr_t ram_size,
66 const char *boot_device,
67 const char *kernel_filename,
68 const char *kernel_cmdline,
69 const char *initrd_filename,
70 const char *cpu_model,
71 int pci_enabled,
72 int kvmclock_enabled)
73 {
74 int i;
75 ram_addr_t below_4g_mem_size, above_4g_mem_size;
76 PCIBus *pci_bus;
77 ISABus *isa_bus;
78 PCII440FXState *i440fx_state;
79 int piix3_devfn = -1;
80 qemu_irq *cpu_irq;
81 qemu_irq *gsi;
82 qemu_irq *i8259;
83 qemu_irq *smi_irq;
84 GSIState *gsi_state;
85 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
86 BusState *idebus[MAX_IDE_BUS];
87 ISADevice *rtc_state;
88 ISADevice *floppy;
89 MemoryRegion *ram_memory;
90 MemoryRegion *pci_memory;
91 MemoryRegion *rom_memory;
92 DeviceState *icc_bridge;
93 FWCfgState *fw_cfg = NULL;
94 PcGuestInfo *guest_info;
95
96 if (xen_enabled() && xen_hvm_init() != 0) {
97 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
98 exit(1);
99 }
100
101 icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
102 object_property_add_child(qdev_get_machine(), "icc-bridge",
103 OBJECT(icc_bridge), NULL);
104
105 pc_cpus_init(cpu_model, icc_bridge);
106 pc_acpi_init("acpi-dsdt.aml");
107
108 if (kvm_enabled() && kvmclock_enabled) {
109 kvmclock_create();
110 }
111
112 if (ram_size >= 0xe0000000 ) {
113 above_4g_mem_size = ram_size - 0xe0000000;
114 below_4g_mem_size = 0xe0000000;
115 } else {
116 above_4g_mem_size = 0;
117 below_4g_mem_size = ram_size;
118 }
119
120 if (pci_enabled) {
121 pci_memory = g_new(MemoryRegion, 1);
122 memory_region_init(pci_memory, NULL, "pci", INT64_MAX);
123 rom_memory = pci_memory;
124 } else {
125 pci_memory = NULL;
126 rom_memory = system_memory;
127 }
128
129 guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
130 guest_info->has_pci_info = has_pci_info;
131
132 /* Set PCI window size the way seabios has always done it. */
133 /* Power of 2 so bios can cover it with a single MTRR */
134 if (ram_size <= 0x80000000)
135 guest_info->pci_info.w32.begin = 0x80000000;
136 else if (ram_size <= 0xc0000000)
137 guest_info->pci_info.w32.begin = 0xc0000000;
138 else
139 guest_info->pci_info.w32.begin = 0xe0000000;
140
141 /* allocate ram and load rom/bios */
142 if (!xen_enabled()) {
143 fw_cfg = pc_memory_init(system_memory,
144 kernel_filename, kernel_cmdline, initrd_filename,
145 below_4g_mem_size, above_4g_mem_size,
146 rom_memory, &ram_memory, guest_info);
147 }
148
149 gsi_state = g_malloc0(sizeof(*gsi_state));
150 if (kvm_irqchip_in_kernel()) {
151 kvm_pc_setup_irq_routing(pci_enabled);
152 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
153 GSI_NUM_PINS);
154 } else {
155 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
156 }
157
158 if (pci_enabled) {
159 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
160 system_memory, system_io, ram_size,
161 below_4g_mem_size,
162 0x100000000ULL - below_4g_mem_size,
163 0x100000000ULL + above_4g_mem_size,
164 (sizeof(hwaddr) == 4
165 ? 0
166 : ((uint64_t)1 << 62)),
167 pci_memory, ram_memory);
168 } else {
169 pci_bus = NULL;
170 i440fx_state = NULL;
171 isa_bus = isa_bus_new(NULL, system_io);
172 no_hpet = 1;
173 }
174 isa_bus_irqs(isa_bus, gsi);
175
176 if (kvm_irqchip_in_kernel()) {
177 i8259 = kvm_i8259_init(isa_bus);
178 } else if (xen_enabled()) {
179 i8259 = xen_interrupt_controller_init();
180 } else {
181 cpu_irq = pc_allocate_cpu_irq();
182 i8259 = i8259_init(isa_bus, cpu_irq[0]);
183 }
184
185 for (i = 0; i < ISA_NUM_IRQS; i++) {
186 gsi_state->i8259_irq[i] = i8259[i];
187 }
188 if (pci_enabled) {
189 ioapic_init_gsi(gsi_state, "i440fx");
190 }
191 qdev_init_nofail(icc_bridge);
192
193 pc_register_ferr_irq(gsi[13]);
194
195 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
196
197 /* init basic PC hardware */
198 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
199
200 pc_nic_init(isa_bus, pci_bus);
201
202 ide_drive_get(hd, MAX_IDE_BUS);
203 if (pci_enabled) {
204 PCIDevice *dev;
205 if (xen_enabled()) {
206 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
207 } else {
208 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
209 }
210 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
211 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
212 } else {
213 for(i = 0; i < MAX_IDE_BUS; i++) {
214 ISADevice *dev;
215 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
216 ide_irq[i],
217 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
218 idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0");
219 }
220 }
221
222 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
223 floppy, idebus[0], idebus[1], rtc_state);
224
225 if (pci_enabled && usb_enabled(false)) {
226 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
227 }
228
229 if (pci_enabled && acpi_enabled) {
230 i2c_bus *smbus;
231
232 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt,
233 x86_env_get_cpu(first_cpu), 1);
234 /* TODO: Populate SPD eeprom data. */
235 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
236 gsi[9], *smi_irq,
237 kvm_enabled(), fw_cfg);
238 smbus_eeprom_init(smbus, 8, NULL, 0);
239 }
240
241 if (pci_enabled) {
242 pc_pci_device_init(pci_bus);
243 }
244
245 if (has_pvpanic) {
246 pvpanic_init(isa_bus);
247 }
248 }
249
250 static void pc_init_pci(QEMUMachineInitArgs *args)
251 {
252 ram_addr_t ram_size = args->ram_size;
253 const char *cpu_model = args->cpu_model;
254 const char *kernel_filename = args->kernel_filename;
255 const char *kernel_cmdline = args->kernel_cmdline;
256 const char *initrd_filename = args->initrd_filename;
257 const char *boot_device = args->boot_device;
258 pc_init1(get_system_memory(),
259 get_system_io(),
260 ram_size, boot_device,
261 kernel_filename, kernel_cmdline,
262 initrd_filename, cpu_model, 1, 1);
263 }
264
265 static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
266 {
267 has_pci_info = false;
268 pc_init_pci(args);
269 }
270
271 static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
272 {
273 has_pvpanic = false;
274 x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
275 pc_init_pci_1_5(args);
276 }
277
278 static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
279 {
280 enable_compat_apic_id_mode();
281 pc_init_pci_1_4(args);
282 }
283
284 /* PC machine init function for pc-1.1 to pc-1.2 */
285 static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
286 {
287 disable_kvm_pv_eoi();
288 pc_init_pci_1_3(args);
289 }
290
291 /* PC machine init function for pc-0.14 to pc-1.0 */
292 static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
293 {
294 pc_init_pci_1_2(args);
295 }
296
297 /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
298 static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
299 {
300 ram_addr_t ram_size = args->ram_size;
301 const char *cpu_model = args->cpu_model;
302 const char *kernel_filename = args->kernel_filename;
303 const char *kernel_cmdline = args->kernel_cmdline;
304 const char *initrd_filename = args->initrd_filename;
305 const char *boot_device = args->boot_device;
306 has_pvpanic = false;
307 has_pci_info = false;
308 disable_kvm_pv_eoi();
309 enable_compat_apic_id_mode();
310 pc_init1(get_system_memory(),
311 get_system_io(),
312 ram_size, boot_device,
313 kernel_filename, kernel_cmdline,
314 initrd_filename, cpu_model, 1, 0);
315 }
316
317 static void pc_init_isa(QEMUMachineInitArgs *args)
318 {
319 ram_addr_t ram_size = args->ram_size;
320 const char *cpu_model = args->cpu_model;
321 const char *kernel_filename = args->kernel_filename;
322 const char *kernel_cmdline = args->kernel_cmdline;
323 const char *initrd_filename = args->initrd_filename;
324 const char *boot_device = args->boot_device;
325 has_pvpanic = false;
326 has_pci_info = false;
327 if (cpu_model == NULL)
328 cpu_model = "486";
329 disable_kvm_pv_eoi();
330 enable_compat_apic_id_mode();
331 pc_init1(get_system_memory(),
332 get_system_io(),
333 ram_size, boot_device,
334 kernel_filename, kernel_cmdline,
335 initrd_filename, cpu_model, 0, 1);
336 }
337
338 #ifdef CONFIG_XEN
339 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
340 {
341 PCIBus *bus;
342
343 pc_init_pci(args);
344
345 bus = pci_find_primary_bus();
346 if (bus != NULL) {
347 pci_create_simple(bus, -1, "xen-platform");
348 }
349 }
350 #endif
351
352 static QEMUMachine pc_i440fx_machine_v1_6 = {
353 .name = "pc-i440fx-1.6",
354 .alias = "pc",
355 .desc = "Standard PC (i440FX + PIIX, 1996)",
356 .init = pc_init_pci,
357 .hot_add_cpu = pc_hot_add_cpu,
358 .max_cpus = 255,
359 .is_default = 1,
360 DEFAULT_MACHINE_OPTIONS,
361 };
362
363 static QEMUMachine pc_i440fx_machine_v1_5 = {
364 .name = "pc-i440fx-1.5",
365 .desc = "Standard PC (i440FX + PIIX, 1996)",
366 .init = pc_init_pci_1_5,
367 .hot_add_cpu = pc_hot_add_cpu,
368 .max_cpus = 255,
369 .compat_props = (GlobalProperty[]) {
370 PC_COMPAT_1_5,
371 { /* end of list */ }
372 },
373 DEFAULT_MACHINE_OPTIONS,
374 };
375
376 static QEMUMachine pc_i440fx_machine_v1_4 = {
377 .name = "pc-i440fx-1.4",
378 .desc = "Standard PC (i440FX + PIIX, 1996)",
379 .init = pc_init_pci_1_4,
380 .max_cpus = 255,
381 .compat_props = (GlobalProperty[]) {
382 PC_COMPAT_1_4,
383 { /* end of list */ }
384 },
385 DEFAULT_MACHINE_OPTIONS,
386 };
387
388 #define PC_COMPAT_1_3 \
389 PC_COMPAT_1_4, \
390 {\
391 .driver = "usb-tablet",\
392 .property = "usb_version",\
393 .value = stringify(1),\
394 },{\
395 .driver = "virtio-net-pci",\
396 .property = "ctrl_mac_addr",\
397 .value = "off", \
398 },{ \
399 .driver = "virtio-net-pci", \
400 .property = "mq", \
401 .value = "off", \
402 }, {\
403 .driver = "e1000",\
404 .property = "autonegotiation",\
405 .value = "off",\
406 }
407
408 static QEMUMachine pc_machine_v1_3 = {
409 .name = "pc-1.3",
410 .desc = "Standard PC",
411 .init = pc_init_pci_1_3,
412 .max_cpus = 255,
413 .compat_props = (GlobalProperty[]) {
414 PC_COMPAT_1_3,
415 { /* end of list */ }
416 },
417 DEFAULT_MACHINE_OPTIONS,
418 };
419
420 #define PC_COMPAT_1_2 \
421 PC_COMPAT_1_3,\
422 {\
423 .driver = "nec-usb-xhci",\
424 .property = "msi",\
425 .value = "off",\
426 },{\
427 .driver = "nec-usb-xhci",\
428 .property = "msix",\
429 .value = "off",\
430 },{\
431 .driver = "ivshmem",\
432 .property = "use64",\
433 .value = "0",\
434 },{\
435 .driver = "qxl",\
436 .property = "revision",\
437 .value = stringify(3),\
438 },{\
439 .driver = "qxl-vga",\
440 .property = "revision",\
441 .value = stringify(3),\
442 },{\
443 .driver = "VGA",\
444 .property = "mmio",\
445 .value = "off",\
446 }
447
448 static QEMUMachine pc_machine_v1_2 = {
449 .name = "pc-1.2",
450 .desc = "Standard PC",
451 .init = pc_init_pci_1_2,
452 .max_cpus = 255,
453 .compat_props = (GlobalProperty[]) {
454 PC_COMPAT_1_2,
455 { /* end of list */ }
456 },
457 DEFAULT_MACHINE_OPTIONS,
458 };
459
460 #define PC_COMPAT_1_1 \
461 PC_COMPAT_1_2,\
462 {\
463 .driver = "virtio-scsi-pci",\
464 .property = "hotplug",\
465 .value = "off",\
466 },{\
467 .driver = "virtio-scsi-pci",\
468 .property = "param_change",\
469 .value = "off",\
470 },{\
471 .driver = "VGA",\
472 .property = "vgamem_mb",\
473 .value = stringify(8),\
474 },{\
475 .driver = "vmware-svga",\
476 .property = "vgamem_mb",\
477 .value = stringify(8),\
478 },{\
479 .driver = "qxl-vga",\
480 .property = "vgamem_mb",\
481 .value = stringify(8),\
482 },{\
483 .driver = "qxl",\
484 .property = "vgamem_mb",\
485 .value = stringify(8),\
486 },{\
487 .driver = "virtio-blk-pci",\
488 .property = "config-wce",\
489 .value = "off",\
490 }
491
492 static QEMUMachine pc_machine_v1_1 = {
493 .name = "pc-1.1",
494 .desc = "Standard PC",
495 .init = pc_init_pci_1_2,
496 .max_cpus = 255,
497 .compat_props = (GlobalProperty[]) {
498 PC_COMPAT_1_1,
499 { /* end of list */ }
500 },
501 DEFAULT_MACHINE_OPTIONS,
502 };
503
504 #define PC_COMPAT_1_0 \
505 PC_COMPAT_1_1,\
506 {\
507 .driver = "pc-sysfw",\
508 .property = "rom_only",\
509 .value = stringify(1),\
510 }, {\
511 .driver = TYPE_ISA_FDC,\
512 .property = "check_media_rate",\
513 .value = "off",\
514 }, {\
515 .driver = "virtio-balloon-pci",\
516 .property = "class",\
517 .value = stringify(PCI_CLASS_MEMORY_RAM),\
518 },{\
519 .driver = "apic",\
520 .property = "vapic",\
521 .value = "off",\
522 },{\
523 .driver = TYPE_USB_DEVICE,\
524 .property = "full-path",\
525 .value = "no",\
526 }
527
528 static QEMUMachine pc_machine_v1_0 = {
529 .name = "pc-1.0",
530 .desc = "Standard PC",
531 .init = pc_init_pci_1_0,
532 .max_cpus = 255,
533 .compat_props = (GlobalProperty[]) {
534 PC_COMPAT_1_0,
535 { /* end of list */ }
536 },
537 .hw_version = "1.0",
538 DEFAULT_MACHINE_OPTIONS,
539 };
540
541 #define PC_COMPAT_0_15 \
542 PC_COMPAT_1_0
543
544 static QEMUMachine pc_machine_v0_15 = {
545 .name = "pc-0.15",
546 .desc = "Standard PC",
547 .init = pc_init_pci_1_0,
548 .max_cpus = 255,
549 .compat_props = (GlobalProperty[]) {
550 PC_COMPAT_0_15,
551 { /* end of list */ }
552 },
553 .hw_version = "0.15",
554 DEFAULT_MACHINE_OPTIONS,
555 };
556
557 #define PC_COMPAT_0_14 \
558 PC_COMPAT_0_15,\
559 {\
560 .driver = "virtio-blk-pci",\
561 .property = "event_idx",\
562 .value = "off",\
563 },{\
564 .driver = "virtio-serial-pci",\
565 .property = "event_idx",\
566 .value = "off",\
567 },{\
568 .driver = "virtio-net-pci",\
569 .property = "event_idx",\
570 .value = "off",\
571 },{\
572 .driver = "virtio-balloon-pci",\
573 .property = "event_idx",\
574 .value = "off",\
575 }
576
577 static QEMUMachine pc_machine_v0_14 = {
578 .name = "pc-0.14",
579 .desc = "Standard PC",
580 .init = pc_init_pci_1_0,
581 .max_cpus = 255,
582 .compat_props = (GlobalProperty[]) {
583 PC_COMPAT_0_14,
584 {
585 .driver = "qxl",
586 .property = "revision",
587 .value = stringify(2),
588 },{
589 .driver = "qxl-vga",
590 .property = "revision",
591 .value = stringify(2),
592 },
593 { /* end of list */ }
594 },
595 .hw_version = "0.14",
596 DEFAULT_MACHINE_OPTIONS,
597 };
598
599 #define PC_COMPAT_0_13 \
600 PC_COMPAT_0_14,\
601 {\
602 .driver = TYPE_PCI_DEVICE,\
603 .property = "command_serr_enable",\
604 .value = "off",\
605 },{\
606 .driver = "AC97",\
607 .property = "use_broken_id",\
608 .value = stringify(1),\
609 }
610
611 static QEMUMachine pc_machine_v0_13 = {
612 .name = "pc-0.13",
613 .desc = "Standard PC",
614 .init = pc_init_pci_no_kvmclock,
615 .max_cpus = 255,
616 .compat_props = (GlobalProperty[]) {
617 PC_COMPAT_0_13,
618 {
619 .driver = "virtio-9p-pci",
620 .property = "vectors",
621 .value = stringify(0),
622 },{
623 .driver = "VGA",
624 .property = "rombar",
625 .value = stringify(0),
626 },{
627 .driver = "vmware-svga",
628 .property = "rombar",
629 .value = stringify(0),
630 },
631 { /* end of list */ }
632 },
633 .hw_version = "0.13",
634 DEFAULT_MACHINE_OPTIONS,
635 };
636
637 #define PC_COMPAT_0_12 \
638 PC_COMPAT_0_13,\
639 {\
640 .driver = "virtio-serial-pci",\
641 .property = "max_ports",\
642 .value = stringify(1),\
643 },{\
644 .driver = "virtio-serial-pci",\
645 .property = "vectors",\
646 .value = stringify(0),\
647 },{\
648 .driver = "usb-mouse",\
649 .property = "serial",\
650 .value = "1",\
651 },{\
652 .driver = "usb-tablet",\
653 .property = "serial",\
654 .value = "1",\
655 },{\
656 .driver = "usb-kbd",\
657 .property = "serial",\
658 .value = "1",\
659 }
660
661 static QEMUMachine pc_machine_v0_12 = {
662 .name = "pc-0.12",
663 .desc = "Standard PC",
664 .init = pc_init_pci_no_kvmclock,
665 .max_cpus = 255,
666 .compat_props = (GlobalProperty[]) {
667 PC_COMPAT_0_12,
668 {
669 .driver = "VGA",
670 .property = "rombar",
671 .value = stringify(0),
672 },{
673 .driver = "vmware-svga",
674 .property = "rombar",
675 .value = stringify(0),
676 },
677 { /* end of list */ }
678 },
679 .hw_version = "0.12",
680 DEFAULT_MACHINE_OPTIONS,
681 };
682
683 #define PC_COMPAT_0_11 \
684 PC_COMPAT_0_12,\
685 {\
686 .driver = "virtio-blk-pci",\
687 .property = "vectors",\
688 .value = stringify(0),\
689 },{\
690 .driver = TYPE_PCI_DEVICE,\
691 .property = "rombar",\
692 .value = stringify(0),\
693 }
694
695 static QEMUMachine pc_machine_v0_11 = {
696 .name = "pc-0.11",
697 .desc = "Standard PC, qemu 0.11",
698 .init = pc_init_pci_no_kvmclock,
699 .max_cpus = 255,
700 .compat_props = (GlobalProperty[]) {
701 PC_COMPAT_0_11,
702 {
703 .driver = "ide-drive",
704 .property = "ver",
705 .value = "0.11",
706 },{
707 .driver = "scsi-disk",
708 .property = "ver",
709 .value = "0.11",
710 },
711 { /* end of list */ }
712 },
713 .hw_version = "0.11",
714 DEFAULT_MACHINE_OPTIONS,
715 };
716
717 static QEMUMachine pc_machine_v0_10 = {
718 .name = "pc-0.10",
719 .desc = "Standard PC, qemu 0.10",
720 .init = pc_init_pci_no_kvmclock,
721 .max_cpus = 255,
722 .compat_props = (GlobalProperty[]) {
723 PC_COMPAT_0_11,
724 {
725 .driver = "virtio-blk-pci",
726 .property = "class",
727 .value = stringify(PCI_CLASS_STORAGE_OTHER),
728 },{
729 .driver = "virtio-serial-pci",
730 .property = "class",
731 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
732 },{
733 .driver = "virtio-net-pci",
734 .property = "vectors",
735 .value = stringify(0),
736 },{
737 .driver = "ide-drive",
738 .property = "ver",
739 .value = "0.10",
740 },{
741 .driver = "scsi-disk",
742 .property = "ver",
743 .value = "0.10",
744 },
745 { /* end of list */ }
746 },
747 .hw_version = "0.10",
748 DEFAULT_MACHINE_OPTIONS,
749 };
750
751 static QEMUMachine isapc_machine = {
752 .name = "isapc",
753 .desc = "ISA-only PC",
754 .init = pc_init_isa,
755 .max_cpus = 1,
756 .compat_props = (GlobalProperty[]) {
757 {
758 .driver = "pc-sysfw",
759 .property = "rom_only",
760 .value = stringify(1),
761 },
762 {
763 .driver = "pc-sysfw",
764 .property = "isapc_ram_fw",
765 .value = stringify(1),
766 },
767 { /* end of list */ }
768 },
769 DEFAULT_MACHINE_OPTIONS,
770 };
771
772 #ifdef CONFIG_XEN
773 static QEMUMachine xenfv_machine = {
774 .name = "xenfv",
775 .desc = "Xen Fully-virtualized PC",
776 .init = pc_xen_hvm_init,
777 .max_cpus = HVM_MAX_VCPUS,
778 .default_machine_opts = "accel=xen",
779 DEFAULT_MACHINE_OPTIONS,
780 };
781 #endif
782
783 static void pc_machine_init(void)
784 {
785 qemu_register_machine(&pc_i440fx_machine_v1_6);
786 qemu_register_machine(&pc_i440fx_machine_v1_5);
787 qemu_register_machine(&pc_i440fx_machine_v1_4);
788 qemu_register_machine(&pc_machine_v1_3);
789 qemu_register_machine(&pc_machine_v1_2);
790 qemu_register_machine(&pc_machine_v1_1);
791 qemu_register_machine(&pc_machine_v1_0);
792 qemu_register_machine(&pc_machine_v0_15);
793 qemu_register_machine(&pc_machine_v0_14);
794 qemu_register_machine(&pc_machine_v0_13);
795 qemu_register_machine(&pc_machine_v0_12);
796 qemu_register_machine(&pc_machine_v0_11);
797 qemu_register_machine(&pc_machine_v0_10);
798 qemu_register_machine(&isapc_machine);
799 #ifdef CONFIG_XEN
800 qemu_register_machine(&xenfv_machine);
801 #endif
802 }
803
804 machine_init(pc_machine_init);