]> git.proxmox.com Git - mirror_qemu.git/blame - hw/i386/pc_piix.c
pc: Split pc_init_pci_1_0() off pc_init_pci_1_2()
[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
6fd028f6 244/* PC machine init function for pc-1.1 to pc-1.2 */
29694758 245static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
dc59944b 246{
29694758 247 disable_kvm_pv_eoi();
36afbc51
MA
248 enable_compat_apic_id_mode();
249 pc_init_pci(args);
dc59944b
MT
250}
251
6fd028f6
MA
252/* PC machine init function for pc-0.14 to pc-1.0 */
253static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
254{
255 disable_kvm_pv_eoi();
256 enable_compat_apic_id_mode();
257 pc_init_pci(args);
258}
259
29694758 260/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
5f072e1f 261static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
0ec329da 262{
5f072e1f
EH
263 ram_addr_t ram_size = args->ram_size;
264 const char *cpu_model = args->cpu_model;
265 const char *kernel_filename = args->kernel_filename;
266 const char *kernel_cmdline = args->kernel_cmdline;
267 const char *initrd_filename = args->initrd_filename;
268 const char *boot_device = args->boot_device;
29694758 269 disable_kvm_pv_eoi();
8932cfdf 270 enable_compat_apic_id_mode();
6bd10515 271 pc_init1(get_system_memory(),
aee97b84 272 get_system_io(),
6bd10515 273 ram_size, boot_device,
0ec329da
JK
274 kernel_filename, kernel_cmdline,
275 initrd_filename, cpu_model, 1, 0);
845773ab
IY
276}
277
5f072e1f 278static void pc_init_isa(QEMUMachineInitArgs *args)
845773ab 279{
5f072e1f
EH
280 ram_addr_t ram_size = args->ram_size;
281 const char *cpu_model = args->cpu_model;
282 const char *kernel_filename = args->kernel_filename;
283 const char *kernel_cmdline = args->kernel_cmdline;
284 const char *initrd_filename = args->initrd_filename;
285 const char *boot_device = args->boot_device;
845773ab
IY
286 if (cpu_model == NULL)
287 cpu_model = "486";
29694758 288 disable_kvm_pv_eoi();
8932cfdf 289 enable_compat_apic_id_mode();
6bd10515 290 pc_init1(get_system_memory(),
aee97b84 291 get_system_io(),
6bd10515 292 ram_size, boot_device,
845773ab 293 kernel_filename, kernel_cmdline,
0ec329da 294 initrd_filename, cpu_model, 0, 1);
845773ab
IY
295}
296
29d3ccde 297#ifdef CONFIG_XEN
5f072e1f 298static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
29d3ccde
AP
299{
300 if (xen_hvm_init() != 0) {
301 hw_error("xen hardware virtual machine initialisation failed");
302 }
5f072e1f 303 pc_init_pci_no_kvmclock(args);
29d3ccde
AP
304 xen_vcpu_init();
305}
306#endif
307
bf3caa3d
PB
308static QEMUMachine pc_i440fx_machine_v1_5 = {
309 .name = "pc-i440fx-1.5",
845773ab 310 .alias = "pc",
94dec594 311 .desc = "Standard PC (i440FX + PIIX, 1996)",
29694758 312 .init = pc_init_pci,
845773ab
IY
313 .max_cpus = 255,
314 .is_default = 1,
e4ada29e 315 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
316};
317
bf3caa3d
PB
318static QEMUMachine pc_i440fx_machine_v1_4 = {
319 .name = "pc-i440fx-1.4",
320 .desc = "Standard PC (i440FX + PIIX, 1996)",
321 .init = pc_init_pci,
322 .max_cpus = 255,
323 .compat_props = (GlobalProperty[]) {
324 PC_COMPAT_1_4,
325 { /* end of list */ }
326 },
327 DEFAULT_MACHINE_OPTIONS,
328};
329
427e3aa1 330#define PC_COMPAT_1_3 \
bf3caa3d 331 PC_COMPAT_1_4, \
427e3aa1
HG
332 {\
333 .driver = "usb-tablet",\
334 .property = "usb_version",\
335 .value = stringify(1),\
c1943a3f
AK
336 },{\
337 .driver = "virtio-net-pci",\
338 .property = "ctrl_mac_addr",\
339 .value = "off", \
a9c87c58
JW
340 },{ \
341 .driver = "virtio-net-pci", \
342 .property = "mq", \
343 .value = "off", \
2af234e6
MT
344 }, {\
345 .driver = "e1000",\
346 .property = "autonegotiation",\
347 .value = "off",\
427e3aa1
HG
348 }
349
f1ae2e38
GH
350static QEMUMachine pc_machine_v1_3 = {
351 .name = "pc-1.3",
352 .desc = "Standard PC",
8932cfdf 353 .init = pc_init_pci_1_3,
f1ae2e38
GH
354 .max_cpus = 255,
355 .compat_props = (GlobalProperty[]) {
427e3aa1 356 PC_COMPAT_1_3,
f1ae2e38
GH
357 { /* end of list */ }
358 },
e4ada29e 359 DEFAULT_MACHINE_OPTIONS,
f1ae2e38
GH
360};
361
183c5eaa 362#define PC_COMPAT_1_2 \
427e3aa1 363 PC_COMPAT_1_3,\
183c5eaa
GH
364 {\
365 .driver = "nec-usb-xhci",\
366 .property = "msi",\
367 .value = "off",\
368 },{\
369 .driver = "nec-usb-xhci",\
370 .property = "msix",\
371 .value = "off",\
c08ba66f
GH
372 },{\
373 .driver = "ivshmem",\
374 .property = "use64",\
375 .value = "0",\
591af143
GH
376 },{\
377 .driver = "qxl",\
378 .property = "revision",\
379 .value = stringify(3),\
380 },{\
381 .driver = "qxl-vga",\
382 .property = "revision",\
383 .value = stringify(3),\
803ff052
GH
384 },{\
385 .driver = "VGA",\
386 .property = "mmio",\
387 .value = "off",\
183c5eaa
GH
388 }
389
f4306941
GH
390static QEMUMachine pc_machine_v1_2 = {
391 .name = "pc-1.2",
392 .desc = "Standard PC",
29694758 393 .init = pc_init_pci_1_2,
f4306941 394 .max_cpus = 255,
183c5eaa
GH
395 .compat_props = (GlobalProperty[]) {
396 PC_COMPAT_1_2,
397 { /* end of list */ }
398 },
e4ada29e 399 DEFAULT_MACHINE_OPTIONS,
f4306941
GH
400};
401
9e56edcf 402#define PC_COMPAT_1_1 \
183c5eaa 403 PC_COMPAT_1_2,\
9e56edcf 404 {\
07a5298c
PB
405 .driver = "virtio-scsi-pci",\
406 .property = "hotplug",\
407 .value = "off",\
408 },{\
409 .driver = "virtio-scsi-pci",\
410 .property = "param_change",\
411 .value = "off",\
412 },{\
9e56edcf
GH
413 .driver = "VGA",\
414 .property = "vgamem_mb",\
415 .value = stringify(8),\
416 },{\
417 .driver = "vmware-svga",\
418 .property = "vgamem_mb",\
419 .value = stringify(8),\
420 },{\
421 .driver = "qxl-vga",\
422 .property = "vgamem_mb",\
423 .value = stringify(8),\
424 },{\
425 .driver = "qxl",\
426 .property = "vgamem_mb",\
427 .value = stringify(8),\
ea776abc
SH
428 },{\
429 .driver = "virtio-blk-pci",\
430 .property = "config-wce",\
431 .value = "off",\
9e56edcf
GH
432 }
433
f1dacf1c
GH
434static QEMUMachine pc_machine_v1_1 = {
435 .name = "pc-1.1",
436 .desc = "Standard PC",
29694758 437 .init = pc_init_pci_1_2,
f1dacf1c 438 .max_cpus = 255,
9e56edcf
GH
439 .compat_props = (GlobalProperty[]) {
440 PC_COMPAT_1_1,
441 { /* end of list */ }
442 },
e4ada29e 443 DEFAULT_MACHINE_OPTIONS,
f1dacf1c
GH
444};
445
d6c73008 446#define PC_COMPAT_1_0 \
9e56edcf 447 PC_COMPAT_1_1,\
d6c73008
MT
448 {\
449 .driver = "pc-sysfw",\
450 .property = "rom_only",\
451 .value = stringify(1),\
452 }, {\
453 .driver = "isa-fdc",\
454 .property = "check_media_rate",\
455 .value = "off",\
2ba1d381
DG
456 }, {\
457 .driver = "virtio-balloon-pci",\
458 .property = "class",\
459 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
460 },{\
461 .driver = "apic",\
462 .property = "vapic",\
463 .value = "off",\
eeb0cf9a 464 },{\
bce54474 465 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
466 .property = "full-path",\
467 .value = "no",\
d6c73008
MT
468 }
469
382b3a68
JJ
470static QEMUMachine pc_machine_v1_0 = {
471 .name = "pc-1.0",
472 .desc = "Standard PC",
6fd028f6 473 .init = pc_init_pci_1_0,
382b3a68 474 .max_cpus = 255,
1b89fafe 475 .compat_props = (GlobalProperty[]) {
d6c73008 476 PC_COMPAT_1_0,
1b89fafe
JJ
477 { /* end of list */ }
478 },
93bfef4c 479 .hw_version = "1.0",
e4ada29e 480 DEFAULT_MACHINE_OPTIONS,
382b3a68
JJ
481};
482
d6c73008
MT
483#define PC_COMPAT_0_15 \
484 PC_COMPAT_1_0
485
ce01a508
AL
486static QEMUMachine pc_machine_v0_15 = {
487 .name = "pc-0.15",
488 .desc = "Standard PC",
6fd028f6 489 .init = pc_init_pci_1_0,
ce01a508 490 .max_cpus = 255,
1b89fafe 491 .compat_props = (GlobalProperty[]) {
d6c73008 492 PC_COMPAT_0_15,
1b89fafe
JJ
493 { /* end of list */ }
494 },
93bfef4c 495 .hw_version = "0.15",
e4ada29e 496 DEFAULT_MACHINE_OPTIONS,
ce01a508
AL
497};
498
d6c73008
MT
499#define PC_COMPAT_0_14 \
500 PC_COMPAT_0_15,\
501 {\
502 .driver = "virtio-blk-pci",\
503 .property = "event_idx",\
504 .value = "off",\
505 },{\
506 .driver = "virtio-serial-pci",\
507 .property = "event_idx",\
508 .value = "off",\
509 },{\
510 .driver = "virtio-net-pci",\
511 .property = "event_idx",\
512 .value = "off",\
513 },{\
514 .driver = "virtio-balloon-pci",\
515 .property = "event_idx",\
516 .value = "off",\
517 }
518
19857e62
GH
519static QEMUMachine pc_machine_v0_14 = {
520 .name = "pc-0.14",
521 .desc = "Standard PC",
6fd028f6 522 .init = pc_init_pci_1_0,
19857e62 523 .max_cpus = 255,
3827cdb1 524 .compat_props = (GlobalProperty[]) {
d6c73008 525 PC_COMPAT_0_14,
3827cdb1
AL
526 {
527 .driver = "qxl",
528 .property = "revision",
529 .value = stringify(2),
530 },{
531 .driver = "qxl-vga",
532 .property = "revision",
533 .value = stringify(2),
1b89fafe 534 },
3827cdb1
AL
535 { /* end of list */ }
536 },
93bfef4c 537 .hw_version = "0.14",
e4ada29e 538 DEFAULT_MACHINE_OPTIONS,
19857e62
GH
539};
540
d6c73008
MT
541#define PC_COMPAT_0_13 \
542 PC_COMPAT_0_14,\
543 {\
bce54474 544 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
545 .property = "command_serr_enable",\
546 .value = "off",\
547 },{\
548 .driver = "AC97",\
549 .property = "use_broken_id",\
550 .value = stringify(1),\
551 }
552
b903a0f7
GH
553static QEMUMachine pc_machine_v0_13 = {
554 .name = "pc-0.13",
555 .desc = "Standard PC",
0ec329da 556 .init = pc_init_pci_no_kvmclock,
b903a0f7 557 .max_cpus = 255,
9dbcca5a 558 .compat_props = (GlobalProperty[]) {
d6c73008 559 PC_COMPAT_0_13,
9dbcca5a
GH
560 {
561 .driver = "virtio-9p-pci",
562 .property = "vectors",
563 .value = stringify(0),
281a26b1
GH
564 },{
565 .driver = "VGA",
566 .property = "rombar",
567 .value = stringify(0),
568 },{
569 .driver = "vmware-svga",
570 .property = "rombar",
571 .value = stringify(0),
1b89fafe 572 },
9dbcca5a
GH
573 { /* end of list */ }
574 },
93bfef4c 575 .hw_version = "0.13",
e4ada29e 576 DEFAULT_MACHINE_OPTIONS,
b903a0f7
GH
577};
578
d6c73008
MT
579#define PC_COMPAT_0_12 \
580 PC_COMPAT_0_13,\
581 {\
582 .driver = "virtio-serial-pci",\
583 .property = "max_ports",\
584 .value = stringify(1),\
585 },{\
586 .driver = "virtio-serial-pci",\
587 .property = "vectors",\
588 .value = stringify(0),\
589 }
590
845773ab
IY
591static QEMUMachine pc_machine_v0_12 = {
592 .name = "pc-0.12",
593 .desc = "Standard PC",
0ec329da 594 .init = pc_init_pci_no_kvmclock,
845773ab
IY
595 .max_cpus = 255,
596 .compat_props = (GlobalProperty[]) {
d6c73008 597 PC_COMPAT_0_12,
845773ab 598 {
281a26b1
GH
599 .driver = "VGA",
600 .property = "rombar",
601 .value = stringify(0),
602 },{
603 .driver = "vmware-svga",
604 .property = "rombar",
605 .value = stringify(0),
1b89fafe 606 },
845773ab 607 { /* end of list */ }
93bfef4c
CV
608 },
609 .hw_version = "0.12",
e4ada29e 610 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
611};
612
d6c73008
MT
613#define PC_COMPAT_0_11 \
614 PC_COMPAT_0_12,\
615 {\
616 .driver = "virtio-blk-pci",\
617 .property = "vectors",\
618 .value = stringify(0),\
c115cd65 619 },{\
bce54474 620 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
621 .property = "rombar",\
622 .value = stringify(0),\
d6c73008
MT
623 }
624
845773ab
IY
625static QEMUMachine pc_machine_v0_11 = {
626 .name = "pc-0.11",
627 .desc = "Standard PC, qemu 0.11",
0ec329da 628 .init = pc_init_pci_no_kvmclock,
845773ab
IY
629 .max_cpus = 255,
630 .compat_props = (GlobalProperty[]) {
d6c73008 631 PC_COMPAT_0_11,
845773ab 632 {
845773ab
IY
633 .driver = "ide-drive",
634 .property = "ver",
635 .value = "0.11",
636 },{
637 .driver = "scsi-disk",
638 .property = "ver",
639 .value = "0.11",
1b89fafe 640 },
845773ab 641 { /* end of list */ }
93bfef4c
CV
642 },
643 .hw_version = "0.11",
e4ada29e 644 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
645};
646
647static QEMUMachine pc_machine_v0_10 = {
648 .name = "pc-0.10",
649 .desc = "Standard PC, qemu 0.10",
0ec329da 650 .init = pc_init_pci_no_kvmclock,
845773ab
IY
651 .max_cpus = 255,
652 .compat_props = (GlobalProperty[]) {
d6c73008 653 PC_COMPAT_0_11,
845773ab
IY
654 {
655 .driver = "virtio-blk-pci",
656 .property = "class",
657 .value = stringify(PCI_CLASS_STORAGE_OTHER),
658 },{
659 .driver = "virtio-serial-pci",
660 .property = "class",
661 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
662 },{
663 .driver = "virtio-net-pci",
664 .property = "vectors",
665 .value = stringify(0),
845773ab
IY
666 },{
667 .driver = "ide-drive",
668 .property = "ver",
669 .value = "0.10",
670 },{
671 .driver = "scsi-disk",
672 .property = "ver",
673 .value = "0.10",
1b89fafe 674 },
845773ab
IY
675 { /* end of list */ }
676 },
93bfef4c 677 .hw_version = "0.10",
e4ada29e 678 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
679};
680
681static QEMUMachine isapc_machine = {
682 .name = "isapc",
683 .desc = "ISA-only PC",
684 .init = pc_init_isa,
685 .max_cpus = 1,
1b89fafe
JJ
686 .compat_props = (GlobalProperty[]) {
687 {
688 .driver = "pc-sysfw",
689 .property = "rom_only",
690 .value = stringify(1),
691 },
692 { /* end of list */ }
693 },
e4ada29e 694 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
695};
696
29d3ccde
AP
697#ifdef CONFIG_XEN
698static QEMUMachine xenfv_machine = {
699 .name = "xenfv",
700 .desc = "Xen Fully-virtualized PC",
701 .init = pc_xen_hvm_init,
702 .max_cpus = HVM_MAX_VCPUS,
703 .default_machine_opts = "accel=xen",
e4ada29e 704 DEFAULT_MACHINE_OPTIONS,
29d3ccde
AP
705};
706#endif
707
845773ab
IY
708static void pc_machine_init(void)
709{
bf3caa3d 710 qemu_register_machine(&pc_i440fx_machine_v1_5);
94dec594 711 qemu_register_machine(&pc_i440fx_machine_v1_4);
f4306941 712 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 713 qemu_register_machine(&pc_machine_v1_2);
382b3a68 714 qemu_register_machine(&pc_machine_v1_1);
19857e62 715 qemu_register_machine(&pc_machine_v1_0);
ce01a508 716 qemu_register_machine(&pc_machine_v0_15);
19857e62 717 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 718 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
719 qemu_register_machine(&pc_machine_v0_12);
720 qemu_register_machine(&pc_machine_v0_11);
721 qemu_register_machine(&pc_machine_v0_10);
722 qemu_register_machine(&isapc_machine);
29d3ccde
AP
723#ifdef CONFIG_XEN
724 qemu_register_machine(&xenfv_machine);
725#endif
845773ab
IY
726}
727
728machine_init(pc_machine_init);