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