pc_piix.c 20 KB

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