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