]> git.proxmox.com Git - mirror_qemu.git/blame - hw/i386/pc_piix.c
Merge remote-tracking branch 'alon/libcacard_ccid.1' into staging
[mirror_qemu.git] / hw / i386 / 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
83c9f4ca 27#include "hw/hw.h"
0d09e41a
PB
28#include "hw/i386/pc.h"
29#include "hw/i386/apic.h"
83c9f4ca
PB
30#include "hw/pci/pci.h"
31#include "hw/pci/pci_ids.h"
32#include "hw/usb.h"
1422e32d 33#include "net/net.h"
83c9f4ca
PB
34#include "hw/boards.h"
35#include "hw/ide.h"
9c17d615 36#include "sysemu/kvm.h"
83c9f4ca 37#include "hw/kvm/clock.h"
9c17d615 38#include "sysemu/sysemu.h"
83c9f4ca 39#include "hw/sysbus.h"
9c17d615
PB
40#include "sysemu/arch_init.h"
41#include "sysemu/blockdev.h"
0d09e41a
PB
42#include "hw/i2c/smbus.h"
43#include "hw/xen/xen.h"
022c62cb
PB
44#include "exec/memory.h"
45#include "exec/address-spaces.h"
0445259b 46#include "hw/acpi/acpi.h"
dc59944b 47#include "cpu.h"
29d3ccde
AP
48#ifdef CONFIG_XEN
49# include <xen/hvm/hvm_info_table.h>
50#endif
845773ab
IY
51
52#define MAX_IDE_BUS 2
53
54static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
55static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
56static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
57
58/* PC hardware initialisation */
6bd10515 59static void pc_init1(MemoryRegion *system_memory,
aee97b84 60 MemoryRegion *system_io,
6bd10515 61 ram_addr_t ram_size,
845773ab
IY
62 const char *boot_device,
63 const char *kernel_filename,
64 const char *kernel_cmdline,
65 const char *initrd_filename,
66 const char *cpu_model,
0ec329da
JK
67 int pci_enabled,
68 int kvmclock_enabled)
845773ab
IY
69{
70 int i;
71 ram_addr_t below_4g_mem_size, above_4g_mem_size;
72 PCIBus *pci_bus;
48a18b3c 73 ISABus *isa_bus;
845773ab
IY
74 PCII440FXState *i440fx_state;
75 int piix3_devfn = -1;
76 qemu_irq *cpu_irq;
b881fbe9 77 qemu_irq *gsi;
845773ab 78 qemu_irq *i8259;
845773ab 79 qemu_irq *smi_irq;
b881fbe9 80 GSIState *gsi_state;
845773ab 81 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 82 BusState *idebus[MAX_IDE_BUS];
1d914fa0 83 ISADevice *rtc_state;
34d4260e 84 ISADevice *floppy;
ae0a5466
AK
85 MemoryRegion *ram_memory;
86 MemoryRegion *pci_memory;
4463aee6 87 MemoryRegion *rom_memory;
459ae5ea 88 void *fw_cfg = NULL;
845773ab
IY
89
90 pc_cpus_init(cpu_model);
f7e4dd6c 91 pc_acpi_init("acpi-dsdt.aml");
845773ab 92
0ec329da
JK
93 if (kvmclock_enabled) {
94 kvmclock_create();
95 }
96
e0e7e67b
AP
97 if (ram_size >= 0xe0000000 ) {
98 above_4g_mem_size = ram_size - 0xe0000000;
99 below_4g_mem_size = 0xe0000000;
100 } else {
101 above_4g_mem_size = 0;
102 below_4g_mem_size = ram_size;
103 }
104
4463aee6
JK
105 if (pci_enabled) {
106 pci_memory = g_new(MemoryRegion, 1);
107 memory_region_init(pci_memory, "pci", INT64_MAX);
108 rom_memory = pci_memory;
109 } else {
110 pci_memory = NULL;
111 rom_memory = system_memory;
112 }
ae0a5466 113
845773ab 114 /* allocate ram and load rom/bios */
29d3ccde 115 if (!xen_enabled()) {
459ae5ea 116 fw_cfg = pc_memory_init(system_memory,
4aa63af1 117 kernel_filename, kernel_cmdline, initrd_filename,
ae0a5466 118 below_4g_mem_size, above_4g_mem_size,
0d3cf3b6 119 rom_memory, &ram_memory);
29d3ccde 120 }
845773ab 121
b881fbe9 122 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 123 if (kvm_irqchip_in_kernel()) {
d8ee0384
JB
124 kvm_pc_setup_irq_routing(pci_enabled);
125 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
10b61882
JK
126 GSI_NUM_PINS);
127 } else {
128 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
129 }
845773ab
IY
130
131 if (pci_enabled) {
60573079 132 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
ae0a5466
AK
133 system_memory, system_io, ram_size,
134 below_4g_mem_size,
135 0x100000000ULL - below_4g_mem_size,
136 0x100000000ULL + above_4g_mem_size,
a8170e5e 137 (sizeof(hwaddr) == 4
ae0a5466
AK
138 ? 0
139 : ((uint64_t)1 << 62)),
140 pci_memory, ram_memory);
845773ab
IY
141 } else {
142 pci_bus = NULL;
02a89b21 143 i440fx_state = NULL;
48a18b3c 144 isa_bus = isa_bus_new(NULL, system_io);
57285cc3 145 no_hpet = 1;
845773ab 146 }
48a18b3c 147 isa_bus_irqs(isa_bus, gsi);
845773ab 148
3d4b2649 149 if (kvm_irqchip_in_kernel()) {
10b61882
JK
150 i8259 = kvm_i8259_init(isa_bus);
151 } else if (xen_enabled()) {
152 i8259 = xen_interrupt_controller_init();
153 } else {
4bae1efe 154 cpu_irq = pc_allocate_cpu_irq();
48a18b3c 155 i8259 = i8259_init(isa_bus, cpu_irq[0]);
4bae1efe
RH
156 }
157
43a0db35
JK
158 for (i = 0; i < ISA_NUM_IRQS; i++) {
159 gsi_state->i8259_irq[i] = i8259[i];
160 }
4bae1efe 161 if (pci_enabled) {
a39e3564 162 ioapic_init_gsi(gsi_state, "i440fx");
4bae1efe
RH
163 }
164
b881fbe9 165 pc_register_ferr_irq(gsi[13]);
845773ab 166
f424d5c4 167 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
01195b73
SS
168 if (xen_enabled()) {
169 pci_create_simple(pci_bus, -1, "xen-platform");
170 }
171
845773ab 172 /* init basic PC hardware */
48a18b3c 173 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
845773ab 174
9011a1a7 175 pc_nic_init(isa_bus, pci_bus);
845773ab 176
75717903 177 ide_drive_get(hd, MAX_IDE_BUS);
845773ab 178 if (pci_enabled) {
c0897e0c 179 PCIDevice *dev;
679f4f8b
SS
180 if (xen_enabled()) {
181 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
182 } else {
183 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
184 }
c0897e0c
MA
185 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
186 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
845773ab
IY
187 } else {
188 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 189 ISADevice *dev;
48a18b3c
HP
190 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
191 ide_irq[i],
c0897e0c
MA
192 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
193 idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0");
845773ab
IY
194 }
195 }
196
4a0f031d 197 audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
845773ab 198
c0897e0c 199 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
34d4260e 200 floppy, idebus[0], idebus[1], rtc_state);
845773ab 201
094b287f 202 if (pci_enabled && usb_enabled(false)) {
afb9a60e 203 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
204 }
205
206 if (pci_enabled && acpi_enabled) {
845773ab
IY
207 i2c_bus *smbus;
208
c3affe56
AF
209 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt,
210 x86_env_get_cpu(first_cpu), 1);
845773ab
IY
211 /* TODO: Populate SPD eeprom data. */
212 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
da98c8eb 213 gsi[9], *smi_irq,
459ae5ea 214 kvm_enabled(), fw_cfg);
a88df0b9 215 smbus_eeprom_init(smbus, 8, NULL, 0);
845773ab
IY
216 }
217
845773ab
IY
218 if (pci_enabled) {
219 pc_pci_device_init(pci_bus);
220 }
221}
222
5f072e1f 223static void pc_init_pci(QEMUMachineInitArgs *args)
845773ab 224{
5f072e1f
EH
225 ram_addr_t ram_size = args->ram_size;
226 const char *cpu_model = args->cpu_model;
227 const char *kernel_filename = args->kernel_filename;
228 const char *kernel_cmdline = args->kernel_cmdline;
229 const char *initrd_filename = args->initrd_filename;
230 const char *boot_device = args->boot_device;
6bd10515 231 pc_init1(get_system_memory(),
aee97b84 232 get_system_io(),
6bd10515 233 ram_size, boot_device,
845773ab 234 kernel_filename, kernel_cmdline,
0ec329da
JK
235 initrd_filename, cpu_model, 1, 1);
236}
237
8932cfdf
EH
238static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
239{
240 enable_compat_apic_id_mode();
241 pc_init_pci(args);
242}
243
29694758
EH
244/* PC machine init function for pc-0.14 to pc-1.2 */
245static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
dc59944b 246{
29694758 247 disable_kvm_pv_eoi();
8932cfdf 248 pc_init_pci_1_3(args);
dc59944b
MT
249}
250
29694758 251/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
5f072e1f 252static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
0ec329da 253{
5f072e1f
EH
254 ram_addr_t ram_size = args->ram_size;
255 const char *cpu_model = args->cpu_model;
256 const char *kernel_filename = args->kernel_filename;
257 const char *kernel_cmdline = args->kernel_cmdline;
258 const char *initrd_filename = args->initrd_filename;
259 const char *boot_device = args->boot_device;
29694758 260 disable_kvm_pv_eoi();
8932cfdf 261 enable_compat_apic_id_mode();
6bd10515 262 pc_init1(get_system_memory(),
aee97b84 263 get_system_io(),
6bd10515 264 ram_size, boot_device,
0ec329da
JK
265 kernel_filename, kernel_cmdline,
266 initrd_filename, cpu_model, 1, 0);
845773ab
IY
267}
268
5f072e1f 269static void pc_init_isa(QEMUMachineInitArgs *args)
845773ab 270{
5f072e1f
EH
271 ram_addr_t ram_size = args->ram_size;
272 const char *cpu_model = args->cpu_model;
273 const char *kernel_filename = args->kernel_filename;
274 const char *kernel_cmdline = args->kernel_cmdline;
275 const char *initrd_filename = args->initrd_filename;
276 const char *boot_device = args->boot_device;
845773ab
IY
277 if (cpu_model == NULL)
278 cpu_model = "486";
29694758 279 disable_kvm_pv_eoi();
8932cfdf 280 enable_compat_apic_id_mode();
6bd10515 281 pc_init1(get_system_memory(),
aee97b84 282 get_system_io(),
6bd10515 283 ram_size, boot_device,
845773ab 284 kernel_filename, kernel_cmdline,
0ec329da 285 initrd_filename, cpu_model, 0, 1);
845773ab
IY
286}
287
29d3ccde 288#ifdef CONFIG_XEN
5f072e1f 289static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
29d3ccde
AP
290{
291 if (xen_hvm_init() != 0) {
292 hw_error("xen hardware virtual machine initialisation failed");
293 }
5f072e1f 294 pc_init_pci_no_kvmclock(args);
29d3ccde
AP
295 xen_vcpu_init();
296}
297#endif
298
bf3caa3d
PB
299static QEMUMachine pc_i440fx_machine_v1_5 = {
300 .name = "pc-i440fx-1.5",
845773ab 301 .alias = "pc",
94dec594 302 .desc = "Standard PC (i440FX + PIIX, 1996)",
29694758 303 .init = pc_init_pci,
845773ab
IY
304 .max_cpus = 255,
305 .is_default = 1,
e4ada29e 306 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
307};
308
bf3caa3d
PB
309static QEMUMachine pc_i440fx_machine_v1_4 = {
310 .name = "pc-i440fx-1.4",
311 .desc = "Standard PC (i440FX + PIIX, 1996)",
312 .init = pc_init_pci,
313 .max_cpus = 255,
314 .compat_props = (GlobalProperty[]) {
315 PC_COMPAT_1_4,
316 { /* end of list */ }
317 },
318 DEFAULT_MACHINE_OPTIONS,
319};
320
427e3aa1 321#define PC_COMPAT_1_3 \
bf3caa3d 322 PC_COMPAT_1_4, \
427e3aa1
HG
323 {\
324 .driver = "usb-tablet",\
325 .property = "usb_version",\
326 .value = stringify(1),\
c1943a3f
AK
327 },{\
328 .driver = "virtio-net-pci",\
329 .property = "ctrl_mac_addr",\
330 .value = "off", \
a9c87c58
JW
331 },{ \
332 .driver = "virtio-net-pci", \
333 .property = "mq", \
334 .value = "off", \
2af234e6
MT
335 }, {\
336 .driver = "e1000",\
337 .property = "autonegotiation",\
338 .value = "off",\
427e3aa1
HG
339 }
340
f1ae2e38
GH
341static QEMUMachine pc_machine_v1_3 = {
342 .name = "pc-1.3",
343 .desc = "Standard PC",
8932cfdf 344 .init = pc_init_pci_1_3,
f1ae2e38
GH
345 .max_cpus = 255,
346 .compat_props = (GlobalProperty[]) {
427e3aa1 347 PC_COMPAT_1_3,
f1ae2e38
GH
348 { /* end of list */ }
349 },
e4ada29e 350 DEFAULT_MACHINE_OPTIONS,
f1ae2e38
GH
351};
352
183c5eaa 353#define PC_COMPAT_1_2 \
427e3aa1 354 PC_COMPAT_1_3,\
183c5eaa
GH
355 {\
356 .driver = "nec-usb-xhci",\
357 .property = "msi",\
358 .value = "off",\
359 },{\
360 .driver = "nec-usb-xhci",\
361 .property = "msix",\
362 .value = "off",\
c08ba66f
GH
363 },{\
364 .driver = "ivshmem",\
365 .property = "use64",\
366 .value = "0",\
591af143
GH
367 },{\
368 .driver = "qxl",\
369 .property = "revision",\
370 .value = stringify(3),\
371 },{\
372 .driver = "qxl-vga",\
373 .property = "revision",\
374 .value = stringify(3),\
803ff052
GH
375 },{\
376 .driver = "VGA",\
377 .property = "mmio",\
378 .value = "off",\
183c5eaa
GH
379 }
380
f4306941
GH
381static QEMUMachine pc_machine_v1_2 = {
382 .name = "pc-1.2",
383 .desc = "Standard PC",
29694758 384 .init = pc_init_pci_1_2,
f4306941 385 .max_cpus = 255,
183c5eaa
GH
386 .compat_props = (GlobalProperty[]) {
387 PC_COMPAT_1_2,
388 { /* end of list */ }
389 },
e4ada29e 390 DEFAULT_MACHINE_OPTIONS,
f4306941
GH
391};
392
9e56edcf 393#define PC_COMPAT_1_1 \
183c5eaa 394 PC_COMPAT_1_2,\
9e56edcf 395 {\
07a5298c
PB
396 .driver = "virtio-scsi-pci",\
397 .property = "hotplug",\
398 .value = "off",\
399 },{\
400 .driver = "virtio-scsi-pci",\
401 .property = "param_change",\
402 .value = "off",\
403 },{\
9e56edcf
GH
404 .driver = "VGA",\
405 .property = "vgamem_mb",\
406 .value = stringify(8),\
407 },{\
408 .driver = "vmware-svga",\
409 .property = "vgamem_mb",\
410 .value = stringify(8),\
411 },{\
412 .driver = "qxl-vga",\
413 .property = "vgamem_mb",\
414 .value = stringify(8),\
415 },{\
416 .driver = "qxl",\
417 .property = "vgamem_mb",\
418 .value = stringify(8),\
ea776abc
SH
419 },{\
420 .driver = "virtio-blk-pci",\
421 .property = "config-wce",\
422 .value = "off",\
9e56edcf
GH
423 }
424
f1dacf1c
GH
425static QEMUMachine pc_machine_v1_1 = {
426 .name = "pc-1.1",
427 .desc = "Standard PC",
29694758 428 .init = pc_init_pci_1_2,
f1dacf1c 429 .max_cpus = 255,
9e56edcf
GH
430 .compat_props = (GlobalProperty[]) {
431 PC_COMPAT_1_1,
432 { /* end of list */ }
433 },
e4ada29e 434 DEFAULT_MACHINE_OPTIONS,
f1dacf1c
GH
435};
436
d6c73008 437#define PC_COMPAT_1_0 \
9e56edcf 438 PC_COMPAT_1_1,\
d6c73008
MT
439 {\
440 .driver = "pc-sysfw",\
441 .property = "rom_only",\
442 .value = stringify(1),\
443 }, {\
444 .driver = "isa-fdc",\
445 .property = "check_media_rate",\
446 .value = "off",\
2ba1d381
DG
447 }, {\
448 .driver = "virtio-balloon-pci",\
449 .property = "class",\
450 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
451 },{\
452 .driver = "apic",\
453 .property = "vapic",\
454 .value = "off",\
eeb0cf9a 455 },{\
bce54474 456 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
457 .property = "full-path",\
458 .value = "no",\
d6c73008
MT
459 }
460
382b3a68
JJ
461static QEMUMachine pc_machine_v1_0 = {
462 .name = "pc-1.0",
463 .desc = "Standard PC",
29694758 464 .init = pc_init_pci_1_2,
382b3a68 465 .max_cpus = 255,
1b89fafe 466 .compat_props = (GlobalProperty[]) {
d6c73008 467 PC_COMPAT_1_0,
1b89fafe
JJ
468 { /* end of list */ }
469 },
93bfef4c 470 .hw_version = "1.0",
e4ada29e 471 DEFAULT_MACHINE_OPTIONS,
382b3a68
JJ
472};
473
d6c73008
MT
474#define PC_COMPAT_0_15 \
475 PC_COMPAT_1_0
476
ce01a508
AL
477static QEMUMachine pc_machine_v0_15 = {
478 .name = "pc-0.15",
479 .desc = "Standard PC",
29694758 480 .init = pc_init_pci_1_2,
ce01a508 481 .max_cpus = 255,
1b89fafe 482 .compat_props = (GlobalProperty[]) {
d6c73008 483 PC_COMPAT_0_15,
1b89fafe
JJ
484 { /* end of list */ }
485 },
93bfef4c 486 .hw_version = "0.15",
e4ada29e 487 DEFAULT_MACHINE_OPTIONS,
ce01a508
AL
488};
489
d6c73008
MT
490#define PC_COMPAT_0_14 \
491 PC_COMPAT_0_15,\
492 {\
493 .driver = "virtio-blk-pci",\
494 .property = "event_idx",\
495 .value = "off",\
496 },{\
497 .driver = "virtio-serial-pci",\
498 .property = "event_idx",\
499 .value = "off",\
500 },{\
501 .driver = "virtio-net-pci",\
502 .property = "event_idx",\
503 .value = "off",\
504 },{\
505 .driver = "virtio-balloon-pci",\
506 .property = "event_idx",\
507 .value = "off",\
508 }
509
19857e62
GH
510static QEMUMachine pc_machine_v0_14 = {
511 .name = "pc-0.14",
512 .desc = "Standard PC",
29694758 513 .init = pc_init_pci_1_2,
19857e62 514 .max_cpus = 255,
3827cdb1 515 .compat_props = (GlobalProperty[]) {
d6c73008 516 PC_COMPAT_0_14,
3827cdb1
AL
517 {
518 .driver = "qxl",
519 .property = "revision",
520 .value = stringify(2),
521 },{
522 .driver = "qxl-vga",
523 .property = "revision",
524 .value = stringify(2),
1b89fafe 525 },
3827cdb1
AL
526 { /* end of list */ }
527 },
93bfef4c 528 .hw_version = "0.14",
e4ada29e 529 DEFAULT_MACHINE_OPTIONS,
19857e62
GH
530};
531
d6c73008
MT
532#define PC_COMPAT_0_13 \
533 PC_COMPAT_0_14,\
534 {\
bce54474 535 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
536 .property = "command_serr_enable",\
537 .value = "off",\
538 },{\
539 .driver = "AC97",\
540 .property = "use_broken_id",\
541 .value = stringify(1),\
542 }
543
b903a0f7
GH
544static QEMUMachine pc_machine_v0_13 = {
545 .name = "pc-0.13",
546 .desc = "Standard PC",
0ec329da 547 .init = pc_init_pci_no_kvmclock,
b903a0f7 548 .max_cpus = 255,
9dbcca5a 549 .compat_props = (GlobalProperty[]) {
d6c73008 550 PC_COMPAT_0_13,
9dbcca5a
GH
551 {
552 .driver = "virtio-9p-pci",
553 .property = "vectors",
554 .value = stringify(0),
281a26b1
GH
555 },{
556 .driver = "VGA",
557 .property = "rombar",
558 .value = stringify(0),
559 },{
560 .driver = "vmware-svga",
561 .property = "rombar",
562 .value = stringify(0),
1b89fafe 563 },
9dbcca5a
GH
564 { /* end of list */ }
565 },
93bfef4c 566 .hw_version = "0.13",
e4ada29e 567 DEFAULT_MACHINE_OPTIONS,
b903a0f7
GH
568};
569
d6c73008
MT
570#define PC_COMPAT_0_12 \
571 PC_COMPAT_0_13,\
572 {\
573 .driver = "virtio-serial-pci",\
574 .property = "max_ports",\
575 .value = stringify(1),\
576 },{\
577 .driver = "virtio-serial-pci",\
578 .property = "vectors",\
579 .value = stringify(0),\
580 }
581
845773ab
IY
582static QEMUMachine pc_machine_v0_12 = {
583 .name = "pc-0.12",
584 .desc = "Standard PC",
0ec329da 585 .init = pc_init_pci_no_kvmclock,
845773ab
IY
586 .max_cpus = 255,
587 .compat_props = (GlobalProperty[]) {
d6c73008 588 PC_COMPAT_0_12,
845773ab 589 {
281a26b1
GH
590 .driver = "VGA",
591 .property = "rombar",
592 .value = stringify(0),
593 },{
594 .driver = "vmware-svga",
595 .property = "rombar",
596 .value = stringify(0),
1b89fafe 597 },
845773ab 598 { /* end of list */ }
93bfef4c
CV
599 },
600 .hw_version = "0.12",
e4ada29e 601 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
602};
603
d6c73008
MT
604#define PC_COMPAT_0_11 \
605 PC_COMPAT_0_12,\
606 {\
607 .driver = "virtio-blk-pci",\
608 .property = "vectors",\
609 .value = stringify(0),\
c115cd65 610 },{\
bce54474 611 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
612 .property = "rombar",\
613 .value = stringify(0),\
d6c73008
MT
614 }
615
845773ab
IY
616static QEMUMachine pc_machine_v0_11 = {
617 .name = "pc-0.11",
618 .desc = "Standard PC, qemu 0.11",
0ec329da 619 .init = pc_init_pci_no_kvmclock,
845773ab
IY
620 .max_cpus = 255,
621 .compat_props = (GlobalProperty[]) {
d6c73008 622 PC_COMPAT_0_11,
845773ab 623 {
845773ab
IY
624 .driver = "ide-drive",
625 .property = "ver",
626 .value = "0.11",
627 },{
628 .driver = "scsi-disk",
629 .property = "ver",
630 .value = "0.11",
1b89fafe 631 },
845773ab 632 { /* end of list */ }
93bfef4c
CV
633 },
634 .hw_version = "0.11",
e4ada29e 635 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
636};
637
638static QEMUMachine pc_machine_v0_10 = {
639 .name = "pc-0.10",
640 .desc = "Standard PC, qemu 0.10",
0ec329da 641 .init = pc_init_pci_no_kvmclock,
845773ab
IY
642 .max_cpus = 255,
643 .compat_props = (GlobalProperty[]) {
d6c73008 644 PC_COMPAT_0_11,
845773ab
IY
645 {
646 .driver = "virtio-blk-pci",
647 .property = "class",
648 .value = stringify(PCI_CLASS_STORAGE_OTHER),
649 },{
650 .driver = "virtio-serial-pci",
651 .property = "class",
652 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
653 },{
654 .driver = "virtio-net-pci",
655 .property = "vectors",
656 .value = stringify(0),
845773ab
IY
657 },{
658 .driver = "ide-drive",
659 .property = "ver",
660 .value = "0.10",
661 },{
662 .driver = "scsi-disk",
663 .property = "ver",
664 .value = "0.10",
1b89fafe 665 },
845773ab
IY
666 { /* end of list */ }
667 },
93bfef4c 668 .hw_version = "0.10",
e4ada29e 669 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
670};
671
672static QEMUMachine isapc_machine = {
673 .name = "isapc",
674 .desc = "ISA-only PC",
675 .init = pc_init_isa,
676 .max_cpus = 1,
1b89fafe
JJ
677 .compat_props = (GlobalProperty[]) {
678 {
679 .driver = "pc-sysfw",
680 .property = "rom_only",
681 .value = stringify(1),
682 },
683 { /* end of list */ }
684 },
e4ada29e 685 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
686};
687
29d3ccde
AP
688#ifdef CONFIG_XEN
689static QEMUMachine xenfv_machine = {
690 .name = "xenfv",
691 .desc = "Xen Fully-virtualized PC",
692 .init = pc_xen_hvm_init,
693 .max_cpus = HVM_MAX_VCPUS,
694 .default_machine_opts = "accel=xen",
e4ada29e 695 DEFAULT_MACHINE_OPTIONS,
29d3ccde
AP
696};
697#endif
698
845773ab
IY
699static void pc_machine_init(void)
700{
bf3caa3d 701 qemu_register_machine(&pc_i440fx_machine_v1_5);
94dec594 702 qemu_register_machine(&pc_i440fx_machine_v1_4);
f4306941 703 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 704 qemu_register_machine(&pc_machine_v1_2);
382b3a68 705 qemu_register_machine(&pc_machine_v1_1);
19857e62 706 qemu_register_machine(&pc_machine_v1_0);
ce01a508 707 qemu_register_machine(&pc_machine_v0_15);
19857e62 708 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 709 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
710 qemu_register_machine(&pc_machine_v0_12);
711 qemu_register_machine(&pc_machine_v0_11);
712 qemu_register_machine(&pc_machine_v0_10);
713 qemu_register_machine(&isapc_machine);
29d3ccde
AP
714#ifdef CONFIG_XEN
715 qemu_register_machine(&xenfv_machine);
716#endif
845773ab
IY
717}
718
719machine_init(pc_machine_init);