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