]> git.proxmox.com Git - mirror_qemu.git/blame - hw/pc_piix.c
qom: add container_get
[mirror_qemu.git] / hw / pc_piix.c
CommitLineData
845773ab
IY
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
ae0a5466
AK
25#include <glib.h>
26
845773ab
IY
27#include "hw.h"
28#include "pc.h"
29#include "apic.h"
30#include "pci.h"
845773ab
IY
31#include "net.h"
32#include "boards.h"
33#include "ide.h"
34#include "kvm.h"
3b9a6ee5 35#include "kvm/clock.h"
666daa68 36#include "sysemu.h"
96051119 37#include "sysbus.h"
0dfa5ef9 38#include "arch_init.h"
2446333c 39#include "blockdev.h"
a88df0b9 40#include "smbus.h"
29d3ccde 41#include "xen.h"
4aa63af1
AK
42#include "memory.h"
43#include "exec-memory.h"
29d3ccde
AP
44#ifdef CONFIG_XEN
45# include <xen/hvm/hvm_info_table.h>
46#endif
845773ab
IY
47
48#define MAX_IDE_BUS 2
49
50static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
51static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
52static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
53
10b61882
JK
54static void kvm_piix3_setup_irq_routing(bool pci_enabled)
55{
56#ifdef CONFIG_KVM
57 KVMState *s = kvm_state;
58 int ret, i;
59
60 if (kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) {
61 for (i = 0; i < 8; ++i) {
62 if (i == 2) {
63 continue;
64 }
65 kvm_irqchip_add_route(s, i, KVM_IRQCHIP_PIC_MASTER, i);
66 }
67 for (i = 8; i < 16; ++i) {
68 kvm_irqchip_add_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
69 }
a39c1d47
JK
70 if (pci_enabled) {
71 for (i = 0; i < 24; ++i) {
72 if (i == 0) {
73 kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
74 } else if (i != 2) {
75 kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, i);
76 }
77 }
78 }
10b61882
JK
79 ret = kvm_irqchip_commit_routes(s);
80 if (ret < 0) {
81 hw_error("KVM IRQ routing setup failed");
82 }
83 }
84#endif /* CONFIG_KVM */
85}
86
87static void kvm_piix3_gsi_handler(void *opaque, int n, int level)
88{
89 GSIState *s = opaque;
90
91 if (n < ISA_NUM_IRQS) {
92 /* Kernel will forward to both PIC and IOAPIC */
93 qemu_set_irq(s->i8259_irq[n], level);
94 } else {
95 qemu_set_irq(s->ioapic_irq[n], level);
96 }
97}
98
b881fbe9 99static void ioapic_init(GSIState *gsi_state)
96051119
BS
100{
101 DeviceState *dev;
102 SysBusDevice *d;
103 unsigned int i;
104
3d4b2649 105 if (kvm_irqchip_in_kernel()) {
a39c1d47
JK
106 dev = qdev_create(NULL, "kvm-ioapic");
107 } else {
108 dev = qdev_create(NULL, "ioapic");
109 }
20288345
PB
110 /* FIXME: this should be under the piix3. */
111 object_property_add_child(object_resolve_path("i440fx", NULL),
112 "ioapic", OBJECT(dev), NULL);
96051119
BS
113 qdev_init_nofail(dev);
114 d = sysbus_from_qdev(dev);
115 sysbus_mmio_map(d, 0, 0xfec00000);
116
117 for (i = 0; i < IOAPIC_NUM_PINS; i++) {
b881fbe9 118 gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i);
96051119
BS
119 }
120}
121
845773ab 122/* PC hardware initialisation */
6bd10515 123static void pc_init1(MemoryRegion *system_memory,
aee97b84 124 MemoryRegion *system_io,
6bd10515 125 ram_addr_t ram_size,
845773ab
IY
126 const char *boot_device,
127 const char *kernel_filename,
128 const char *kernel_cmdline,
129 const char *initrd_filename,
130 const char *cpu_model,
0ec329da
JK
131 int pci_enabled,
132 int kvmclock_enabled)
845773ab
IY
133{
134 int i;
135 ram_addr_t below_4g_mem_size, above_4g_mem_size;
136 PCIBus *pci_bus;
48a18b3c 137 ISABus *isa_bus;
845773ab
IY
138 PCII440FXState *i440fx_state;
139 int piix3_devfn = -1;
140 qemu_irq *cpu_irq;
b881fbe9 141 qemu_irq *gsi;
845773ab 142 qemu_irq *i8259;
845773ab 143 qemu_irq *smi_irq;
b881fbe9 144 GSIState *gsi_state;
845773ab 145 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 146 BusState *idebus[MAX_IDE_BUS];
1d914fa0 147 ISADevice *rtc_state;
34d4260e 148 ISADevice *floppy;
ae0a5466
AK
149 MemoryRegion *ram_memory;
150 MemoryRegion *pci_memory;
4463aee6 151 MemoryRegion *rom_memory;
ad6d45fa 152 DeviceState *dev;
845773ab
IY
153
154 pc_cpus_init(cpu_model);
155
0ec329da
JK
156 if (kvmclock_enabled) {
157 kvmclock_create();
158 }
159
e0e7e67b
AP
160 if (ram_size >= 0xe0000000 ) {
161 above_4g_mem_size = ram_size - 0xe0000000;
162 below_4g_mem_size = 0xe0000000;
163 } else {
164 above_4g_mem_size = 0;
165 below_4g_mem_size = ram_size;
166 }
167
4463aee6
JK
168 if (pci_enabled) {
169 pci_memory = g_new(MemoryRegion, 1);
170 memory_region_init(pci_memory, "pci", INT64_MAX);
171 rom_memory = pci_memory;
172 } else {
173 pci_memory = NULL;
174 rom_memory = system_memory;
175 }
ae0a5466 176
845773ab 177 /* allocate ram and load rom/bios */
29d3ccde 178 if (!xen_enabled()) {
4aa63af1
AK
179 pc_memory_init(system_memory,
180 kernel_filename, kernel_cmdline, initrd_filename,
ae0a5466 181 below_4g_mem_size, above_4g_mem_size,
c1d23eac 182 pci_enabled ? rom_memory : system_memory, &ram_memory);
29d3ccde 183 }
845773ab 184
b881fbe9 185 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 186 if (kvm_irqchip_in_kernel()) {
10b61882
JK
187 kvm_piix3_setup_irq_routing(pci_enabled);
188 gsi = qemu_allocate_irqs(kvm_piix3_gsi_handler, gsi_state,
189 GSI_NUM_PINS);
190 } else {
191 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
192 }
845773ab
IY
193
194 if (pci_enabled) {
60573079 195 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
ae0a5466
AK
196 system_memory, system_io, ram_size,
197 below_4g_mem_size,
198 0x100000000ULL - below_4g_mem_size,
199 0x100000000ULL + above_4g_mem_size,
200 (sizeof(target_phys_addr_t) == 4
201 ? 0
202 : ((uint64_t)1 << 62)),
203 pci_memory, ram_memory);
845773ab
IY
204 } else {
205 pci_bus = NULL;
02a89b21 206 i440fx_state = NULL;
48a18b3c 207 isa_bus = isa_bus_new(NULL, system_io);
57285cc3 208 no_hpet = 1;
845773ab 209 }
48a18b3c 210 isa_bus_irqs(isa_bus, gsi);
845773ab 211
3d4b2649 212 if (kvm_irqchip_in_kernel()) {
10b61882
JK
213 i8259 = kvm_i8259_init(isa_bus);
214 } else if (xen_enabled()) {
215 i8259 = xen_interrupt_controller_init();
216 } else {
4bae1efe 217 cpu_irq = pc_allocate_cpu_irq();
48a18b3c 218 i8259 = i8259_init(isa_bus, cpu_irq[0]);
4bae1efe
RH
219 }
220
43a0db35
JK
221 for (i = 0; i < ISA_NUM_IRQS; i++) {
222 gsi_state->i8259_irq[i] = i8259[i];
223 }
4bae1efe 224 if (pci_enabled) {
b881fbe9 225 ioapic_init(gsi_state);
4bae1efe
RH
226 }
227
b881fbe9 228 pc_register_ferr_irq(gsi[13]);
845773ab 229
48a18b3c 230 dev = pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
ad6d45fa 231 if (dev) {
57c9fafe 232 object_property_add_child(object_get_root(), "vga", OBJECT(dev), NULL);
ad6d45fa 233 }
845773ab 234
01195b73
SS
235 if (xen_enabled()) {
236 pci_create_simple(pci_bus, -1, "xen-platform");
237 }
238
845773ab 239 /* init basic PC hardware */
48a18b3c 240 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
845773ab
IY
241
242 for(i = 0; i < nb_nics; i++) {
243 NICInfo *nd = &nd_table[i];
244
245 if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
48a18b3c 246 pc_init_ne2k_isa(isa_bus, nd);
845773ab
IY
247 else
248 pci_nic_init_nofail(nd, "e1000", NULL);
249 }
250
75717903 251 ide_drive_get(hd, MAX_IDE_BUS);
845773ab 252 if (pci_enabled) {
c0897e0c 253 PCIDevice *dev;
679f4f8b
SS
254 if (xen_enabled()) {
255 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
256 } else {
257 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
258 }
c0897e0c
MA
259 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
260 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
ddcada78
JK
261
262 /* FIXME there's some major spaghetti here. Somehow we create the
263 * devices on the PIIX before we actually create it. We create the
264 * PIIX3 deep in the recess of the i440fx creation too and then lose
265 * the DeviceState.
266 *
267 * For now, let's "fix" this by making judicious use of paths. This
268 * is not generally the right way to do this.
269 */
57c9fafe
AL
270 object_property_add_child(object_resolve_path("/i440fx/piix3", NULL),
271 "rtc", (Object *)rtc_state, NULL);
845773ab
IY
272 } else {
273 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 274 ISADevice *dev;
48a18b3c
HP
275 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
276 ide_irq[i],
c0897e0c
MA
277 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
278 idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0");
845773ab
IY
279 }
280 }
281
4a0f031d 282 audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
845773ab 283
c0897e0c 284 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
34d4260e 285 floppy, idebus[0], idebus[1], rtc_state);
845773ab
IY
286
287 if (pci_enabled && usb_enabled) {
afb9a60e 288 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
289 }
290
291 if (pci_enabled && acpi_enabled) {
845773ab
IY
292 i2c_bus *smbus;
293
845773ab
IY
294 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
295 /* TODO: Populate SPD eeprom data. */
296 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
da98c8eb 297 gsi[9], *smi_irq,
845773ab 298 kvm_enabled());
a88df0b9 299 smbus_eeprom_init(smbus, 8, NULL, 0);
845773ab
IY
300 }
301
845773ab
IY
302 if (pci_enabled) {
303 pc_pci_device_init(pci_bus);
304 }
305}
306
307static void pc_init_pci(ram_addr_t ram_size,
308 const char *boot_device,
309 const char *kernel_filename,
310 const char *kernel_cmdline,
311 const char *initrd_filename,
312 const char *cpu_model)
313{
6bd10515 314 pc_init1(get_system_memory(),
aee97b84 315 get_system_io(),
6bd10515 316 ram_size, boot_device,
845773ab 317 kernel_filename, kernel_cmdline,
0ec329da
JK
318 initrd_filename, cpu_model, 1, 1);
319}
320
321static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
322 const char *boot_device,
323 const char *kernel_filename,
324 const char *kernel_cmdline,
325 const char *initrd_filename,
326 const char *cpu_model)
327{
6bd10515 328 pc_init1(get_system_memory(),
aee97b84 329 get_system_io(),
6bd10515 330 ram_size, boot_device,
0ec329da
JK
331 kernel_filename, kernel_cmdline,
332 initrd_filename, cpu_model, 1, 0);
845773ab
IY
333}
334
335static void pc_init_isa(ram_addr_t ram_size,
336 const char *boot_device,
337 const char *kernel_filename,
338 const char *kernel_cmdline,
339 const char *initrd_filename,
340 const char *cpu_model)
341{
342 if (cpu_model == NULL)
343 cpu_model = "486";
6bd10515 344 pc_init1(get_system_memory(),
aee97b84 345 get_system_io(),
6bd10515 346 ram_size, boot_device,
845773ab 347 kernel_filename, kernel_cmdline,
0ec329da 348 initrd_filename, cpu_model, 0, 1);
845773ab
IY
349}
350
29d3ccde
AP
351#ifdef CONFIG_XEN
352static void pc_xen_hvm_init(ram_addr_t ram_size,
353 const char *boot_device,
354 const char *kernel_filename,
355 const char *kernel_cmdline,
356 const char *initrd_filename,
357 const char *cpu_model)
358{
359 if (xen_hvm_init() != 0) {
360 hw_error("xen hardware virtual machine initialisation failed");
361 }
362 pc_init_pci_no_kvmclock(ram_size, boot_device,
363 kernel_filename, kernel_cmdline,
364 initrd_filename, cpu_model);
365 xen_vcpu_init();
366}
367#endif
368
382b3a68
JJ
369static QEMUMachine pc_machine_v1_1 = {
370 .name = "pc-1.1",
845773ab
IY
371 .alias = "pc",
372 .desc = "Standard PC",
373 .init = pc_init_pci,
374 .max_cpus = 255,
375 .is_default = 1,
376};
377
382b3a68
JJ
378static QEMUMachine pc_machine_v1_0 = {
379 .name = "pc-1.0",
380 .desc = "Standard PC",
381 .init = pc_init_pci,
382 .max_cpus = 255,
1b89fafe
JJ
383 .compat_props = (GlobalProperty[]) {
384 {
385 .driver = "pc-sysfw",
386 .property = "rom_only",
387 .value = stringify(1),
09c6d585
HP
388 }, {
389 .driver = "isa-fdc",
390 .property = "check_media_rate",
391 .value = "off",
1b89fafe
JJ
392 },
393 { /* end of list */ }
394 },
382b3a68
JJ
395};
396
ce01a508
AL
397static QEMUMachine pc_machine_v0_15 = {
398 .name = "pc-0.15",
399 .desc = "Standard PC",
400 .init = pc_init_pci,
401 .max_cpus = 255,
1b89fafe
JJ
402 .compat_props = (GlobalProperty[]) {
403 {
404 .driver = "pc-sysfw",
405 .property = "rom_only",
406 .value = stringify(1),
09c6d585
HP
407 }, {
408 .driver = "isa-fdc",
409 .property = "check_media_rate",
410 .value = "off",
1b89fafe
JJ
411 },
412 { /* end of list */ }
413 },
ce01a508
AL
414};
415
19857e62
GH
416static QEMUMachine pc_machine_v0_14 = {
417 .name = "pc-0.14",
418 .desc = "Standard PC",
419 .init = pc_init_pci,
420 .max_cpus = 255,
3827cdb1
AL
421 .compat_props = (GlobalProperty[]) {
422 {
423 .driver = "qxl",
424 .property = "revision",
425 .value = stringify(2),
426 },{
427 .driver = "qxl-vga",
428 .property = "revision",
429 .value = stringify(2),
ea830ebb
AL
430 },{
431 .driver = "virtio-blk-pci",
432 .property = "event_idx",
433 .value = "off",
434 },{
435 .driver = "virtio-serial-pci",
436 .property = "event_idx",
437 .value = "off",
438 },{
439 .driver = "virtio-net-pci",
440 .property = "event_idx",
441 .value = "off",
442 },{
443 .driver = "virtio-balloon-pci",
444 .property = "event_idx",
445 .value = "off",
09c6d585
HP
446 },{
447 .driver = "isa-fdc",
448 .property = "check_media_rate",
449 .value = "off",
3827cdb1 450 },
1b89fafe
JJ
451 {
452 .driver = "pc-sysfw",
453 .property = "rom_only",
454 .value = stringify(1),
455 },
3827cdb1
AL
456 { /* end of list */ }
457 },
19857e62
GH
458};
459
b903a0f7
GH
460static QEMUMachine pc_machine_v0_13 = {
461 .name = "pc-0.13",
462 .desc = "Standard PC",
0ec329da 463 .init = pc_init_pci_no_kvmclock,
b903a0f7 464 .max_cpus = 255,
9dbcca5a
GH
465 .compat_props = (GlobalProperty[]) {
466 {
467 .driver = "virtio-9p-pci",
468 .property = "vectors",
469 .value = stringify(0),
281a26b1
GH
470 },{
471 .driver = "VGA",
472 .property = "rombar",
473 .value = stringify(0),
474 },{
475 .driver = "vmware-svga",
476 .property = "rombar",
477 .value = stringify(0),
362dd48c
IY
478 },{
479 .driver = "PCI",
480 .property = "command_serr_enable",
481 .value = "off",
b91cb442
MT
482 },{
483 .driver = "virtio-blk-pci",
484 .property = "event_idx",
485 .value = "off",
486 },{
487 .driver = "virtio-serial-pci",
488 .property = "event_idx",
489 .value = "off",
490 },{
491 .driver = "virtio-net-pci",
492 .property = "event_idx",
493 .value = "off",
ea830ebb
AL
494 },{
495 .driver = "virtio-balloon-pci",
496 .property = "event_idx",
497 .value = "off",
25a21c94
GH
498 },{
499 .driver = "AC97",
500 .property = "use_broken_id",
501 .value = stringify(1),
09c6d585
HP
502 },{
503 .driver = "isa-fdc",
504 .property = "check_media_rate",
505 .value = "off",
9dbcca5a 506 },
1b89fafe
JJ
507 {
508 .driver = "pc-sysfw",
509 .property = "rom_only",
510 .value = stringify(1),
511 },
9dbcca5a
GH
512 { /* end of list */ }
513 },
b903a0f7
GH
514};
515
845773ab
IY
516static QEMUMachine pc_machine_v0_12 = {
517 .name = "pc-0.12",
518 .desc = "Standard PC",
0ec329da 519 .init = pc_init_pci_no_kvmclock,
845773ab
IY
520 .max_cpus = 255,
521 .compat_props = (GlobalProperty[]) {
522 {
523 .driver = "virtio-serial-pci",
1e29a009 524 .property = "max_ports",
845773ab
IY
525 .value = stringify(1),
526 },{
527 .driver = "virtio-serial-pci",
528 .property = "vectors",
529 .value = stringify(0),
281a26b1
GH
530 },{
531 .driver = "VGA",
532 .property = "rombar",
533 .value = stringify(0),
534 },{
535 .driver = "vmware-svga",
536 .property = "rombar",
537 .value = stringify(0),
b1aeb926
IY
538 },{
539 .driver = "PCI",
540 .property = "command_serr_enable",
541 .value = "off",
b91cb442
MT
542 },{
543 .driver = "virtio-blk-pci",
544 .property = "event_idx",
545 .value = "off",
546 },{
547 .driver = "virtio-serial-pci",
548 .property = "event_idx",
549 .value = "off",
550 },{
551 .driver = "virtio-net-pci",
552 .property = "event_idx",
553 .value = "off",
ea830ebb
AL
554 },{
555 .driver = "virtio-balloon-pci",
556 .property = "event_idx",
557 .value = "off",
25a21c94
GH
558 },{
559 .driver = "AC97",
560 .property = "use_broken_id",
561 .value = stringify(1),
09c6d585
HP
562 },{
563 .driver = "isa-fdc",
564 .property = "check_media_rate",
565 .value = "off",
845773ab 566 },
1b89fafe
JJ
567 {
568 .driver = "pc-sysfw",
569 .property = "rom_only",
570 .value = stringify(1),
571 },
845773ab
IY
572 { /* end of list */ }
573 }
574};
575
576static QEMUMachine pc_machine_v0_11 = {
577 .name = "pc-0.11",
578 .desc = "Standard PC, qemu 0.11",
0ec329da 579 .init = pc_init_pci_no_kvmclock,
845773ab
IY
580 .max_cpus = 255,
581 .compat_props = (GlobalProperty[]) {
582 {
583 .driver = "virtio-blk-pci",
584 .property = "vectors",
585 .value = stringify(0),
586 },{
587 .driver = "virtio-serial-pci",
1e29a009 588 .property = "max_ports",
845773ab
IY
589 .value = stringify(1),
590 },{
591 .driver = "virtio-serial-pci",
592 .property = "vectors",
593 .value = stringify(0),
594 },{
595 .driver = "ide-drive",
596 .property = "ver",
597 .value = "0.11",
598 },{
599 .driver = "scsi-disk",
600 .property = "ver",
601 .value = "0.11",
602 },{
603 .driver = "PCI",
604 .property = "rombar",
605 .value = stringify(0),
b1aeb926
IY
606 },{
607 .driver = "PCI",
608 .property = "command_serr_enable",
609 .value = "off",
b91cb442
MT
610 },{
611 .driver = "virtio-blk-pci",
612 .property = "event_idx",
613 .value = "off",
614 },{
615 .driver = "virtio-serial-pci",
616 .property = "event_idx",
617 .value = "off",
618 },{
619 .driver = "virtio-net-pci",
620 .property = "event_idx",
621 .value = "off",
ea830ebb
AL
622 },{
623 .driver = "virtio-balloon-pci",
624 .property = "event_idx",
625 .value = "off",
25a21c94
GH
626 },{
627 .driver = "AC97",
628 .property = "use_broken_id",
629 .value = stringify(1),
09c6d585
HP
630 },{
631 .driver = "isa-fdc",
632 .property = "check_media_rate",
633 .value = "off",
845773ab 634 },
1b89fafe
JJ
635 {
636 .driver = "pc-sysfw",
637 .property = "rom_only",
638 .value = stringify(1),
639 },
845773ab
IY
640 { /* end of list */ }
641 }
642};
643
644static QEMUMachine pc_machine_v0_10 = {
645 .name = "pc-0.10",
646 .desc = "Standard PC, qemu 0.10",
0ec329da 647 .init = pc_init_pci_no_kvmclock,
845773ab
IY
648 .max_cpus = 255,
649 .compat_props = (GlobalProperty[]) {
650 {
651 .driver = "virtio-blk-pci",
652 .property = "class",
653 .value = stringify(PCI_CLASS_STORAGE_OTHER),
654 },{
655 .driver = "virtio-serial-pci",
656 .property = "class",
657 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
658 },{
659 .driver = "virtio-serial-pci",
1e29a009 660 .property = "max_ports",
845773ab
IY
661 .value = stringify(1),
662 },{
663 .driver = "virtio-serial-pci",
664 .property = "vectors",
665 .value = stringify(0),
666 },{
667 .driver = "virtio-net-pci",
668 .property = "vectors",
669 .value = stringify(0),
670 },{
671 .driver = "virtio-blk-pci",
672 .property = "vectors",
673 .value = stringify(0),
674 },{
675 .driver = "ide-drive",
676 .property = "ver",
677 .value = "0.10",
678 },{
679 .driver = "scsi-disk",
680 .property = "ver",
681 .value = "0.10",
682 },{
683 .driver = "PCI",
684 .property = "rombar",
685 .value = stringify(0),
b1aeb926
IY
686 },{
687 .driver = "PCI",
688 .property = "command_serr_enable",
689 .value = "off",
b91cb442
MT
690 },{
691 .driver = "virtio-blk-pci",
692 .property = "event_idx",
693 .value = "off",
694 },{
695 .driver = "virtio-serial-pci",
696 .property = "event_idx",
697 .value = "off",
698 },{
699 .driver = "virtio-net-pci",
700 .property = "event_idx",
701 .value = "off",
ea830ebb
AL
702 },{
703 .driver = "virtio-balloon-pci",
704 .property = "event_idx",
705 .value = "off",
25a21c94
GH
706 },{
707 .driver = "AC97",
708 .property = "use_broken_id",
709 .value = stringify(1),
09c6d585
HP
710 },{
711 .driver = "isa-fdc",
712 .property = "check_media_rate",
713 .value = "off",
845773ab 714 },
1b89fafe
JJ
715 {
716 .driver = "pc-sysfw",
717 .property = "rom_only",
718 .value = stringify(1),
719 },
845773ab
IY
720 { /* end of list */ }
721 },
722};
723
724static QEMUMachine isapc_machine = {
725 .name = "isapc",
726 .desc = "ISA-only PC",
727 .init = pc_init_isa,
728 .max_cpus = 1,
1b89fafe
JJ
729 .compat_props = (GlobalProperty[]) {
730 {
731 .driver = "pc-sysfw",
732 .property = "rom_only",
733 .value = stringify(1),
734 },
735 { /* end of list */ }
736 },
845773ab
IY
737};
738
29d3ccde
AP
739#ifdef CONFIG_XEN
740static QEMUMachine xenfv_machine = {
741 .name = "xenfv",
742 .desc = "Xen Fully-virtualized PC",
743 .init = pc_xen_hvm_init,
744 .max_cpus = HVM_MAX_VCPUS,
745 .default_machine_opts = "accel=xen",
746};
747#endif
748
845773ab
IY
749static void pc_machine_init(void)
750{
382b3a68 751 qemu_register_machine(&pc_machine_v1_1);
19857e62 752 qemu_register_machine(&pc_machine_v1_0);
ce01a508 753 qemu_register_machine(&pc_machine_v0_15);
19857e62 754 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 755 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
756 qemu_register_machine(&pc_machine_v0_12);
757 qemu_register_machine(&pc_machine_v0_11);
758 qemu_register_machine(&pc_machine_v0_10);
759 qemu_register_machine(&isapc_machine);
29d3ccde
AP
760#ifdef CONFIG_XEN
761 qemu_register_machine(&xenfv_machine);
762#endif
845773ab
IY
763}
764
765machine_init(pc_machine_init);