piix_pci.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. /*
  2. * QEMU i440FX/PIIX3 PCI Bridge Emulation
  3. *
  4. * Copyright (c) 2006 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 "hw.h"
  25. #include "pc.h"
  26. #include "pci/pci.h"
  27. #include "pci/pci_host.h"
  28. #include "isa.h"
  29. #include "sysbus.h"
  30. #include "range.h"
  31. #include "xen.h"
  32. #include "pam.h"
  33. /*
  34. * I440FX chipset data sheet.
  35. * http://download.intel.com/design/chipsets/datashts/29054901.pdf
  36. */
  37. typedef struct I440FXState {
  38. PCIHostState parent_obj;
  39. } I440FXState;
  40. #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */
  41. #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */
  42. #define XEN_PIIX_NUM_PIRQS 128ULL
  43. #define PIIX_PIRQC 0x60
  44. typedef struct PIIX3State {
  45. PCIDevice dev;
  46. /*
  47. * bitmap to track pic levels.
  48. * The pic level is the logical OR of all the PCI irqs mapped to it
  49. * So one PIC level is tracked by PIIX_NUM_PIRQS bits.
  50. *
  51. * PIRQ is mapped to PIC pins, we track it by
  52. * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with
  53. * pic_irq * PIIX_NUM_PIRQS + pirq
  54. */
  55. #if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64
  56. #error "unable to encode pic state in 64bit in pic_levels."
  57. #endif
  58. uint64_t pic_levels;
  59. qemu_irq *pic;
  60. /* This member isn't used. Just for save/load compatibility */
  61. int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS];
  62. } PIIX3State;
  63. struct PCII440FXState {
  64. PCIDevice dev;
  65. MemoryRegion *system_memory;
  66. MemoryRegion *pci_address_space;
  67. MemoryRegion *ram_memory;
  68. MemoryRegion pci_hole;
  69. MemoryRegion pci_hole_64bit;
  70. PAMMemoryRegion pam_regions[13];
  71. MemoryRegion smram_region;
  72. uint8_t smm_enabled;
  73. };
  74. #define I440FX_PAM 0x59
  75. #define I440FX_PAM_SIZE 7
  76. #define I440FX_SMRAM 0x72
  77. static void piix3_set_irq(void *opaque, int pirq, int level);
  78. static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pci_intx);
  79. static void piix3_write_config_xen(PCIDevice *dev,
  80. uint32_t address, uint32_t val, int len);
  81. /* return the global irq number corresponding to a given device irq
  82. pin. We could also use the bus number to have a more precise
  83. mapping. */
  84. static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
  85. {
  86. int slot_addend;
  87. slot_addend = (pci_dev->devfn >> 3) - 1;
  88. return (pci_intx + slot_addend) & 3;
  89. }
  90. static void i440fx_update_memory_mappings(PCII440FXState *d)
  91. {
  92. int i;
  93. memory_region_transaction_begin();
  94. for (i = 0; i < 13; i++) {
  95. pam_update(&d->pam_regions[i], i,
  96. d->dev.config[I440FX_PAM + ((i + 1) / 2)]);
  97. }
  98. smram_update(&d->smram_region, d->dev.config[I440FX_SMRAM], d->smm_enabled);
  99. memory_region_transaction_commit();
  100. }
  101. static void i440fx_set_smm(int val, void *arg)
  102. {
  103. PCII440FXState *d = arg;
  104. memory_region_transaction_begin();
  105. smram_set_smm(&d->smm_enabled, val, d->dev.config[I440FX_SMRAM],
  106. &d->smram_region);
  107. memory_region_transaction_commit();
  108. }
  109. static void i440fx_write_config(PCIDevice *dev,
  110. uint32_t address, uint32_t val, int len)
  111. {
  112. PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
  113. /* XXX: implement SMRAM.D_LOCK */
  114. pci_default_write_config(dev, address, val, len);
  115. if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
  116. range_covers_byte(address, len, I440FX_SMRAM)) {
  117. i440fx_update_memory_mappings(d);
  118. }
  119. }
  120. static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
  121. {
  122. PCII440FXState *d = opaque;
  123. int ret, i;
  124. ret = pci_device_load(&d->dev, f);
  125. if (ret < 0)
  126. return ret;
  127. i440fx_update_memory_mappings(d);
  128. qemu_get_8s(f, &d->smm_enabled);
  129. if (version_id == 2) {
  130. for (i = 0; i < PIIX_NUM_PIRQS; i++) {
  131. qemu_get_be32(f); /* dummy load for compatibility */
  132. }
  133. }
  134. return 0;
  135. }
  136. static int i440fx_post_load(void *opaque, int version_id)
  137. {
  138. PCII440FXState *d = opaque;
  139. i440fx_update_memory_mappings(d);
  140. return 0;
  141. }
  142. static const VMStateDescription vmstate_i440fx = {
  143. .name = "I440FX",
  144. .version_id = 3,
  145. .minimum_version_id = 3,
  146. .minimum_version_id_old = 1,
  147. .load_state_old = i440fx_load_old,
  148. .post_load = i440fx_post_load,
  149. .fields = (VMStateField []) {
  150. VMSTATE_PCI_DEVICE(dev, PCII440FXState),
  151. VMSTATE_UINT8(smm_enabled, PCII440FXState),
  152. VMSTATE_END_OF_LIST()
  153. }
  154. };
  155. static int i440fx_pcihost_initfn(SysBusDevice *dev)
  156. {
  157. PCIHostState *s = PCI_HOST_BRIDGE(dev);
  158. memory_region_init_io(&s->conf_mem, &pci_host_conf_le_ops, s,
  159. "pci-conf-idx", 4);
  160. sysbus_add_io(dev, 0xcf8, &s->conf_mem);
  161. sysbus_init_ioports(&s->busdev, 0xcf8, 4);
  162. memory_region_init_io(&s->data_mem, &pci_host_data_le_ops, s,
  163. "pci-conf-data", 4);
  164. sysbus_add_io(dev, 0xcfc, &s->data_mem);
  165. sysbus_init_ioports(&s->busdev, 0xcfc, 4);
  166. return 0;
  167. }
  168. static int i440fx_initfn(PCIDevice *dev)
  169. {
  170. PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
  171. d->dev.config[I440FX_SMRAM] = 0x02;
  172. cpu_smm_register(&i440fx_set_smm, d);
  173. return 0;
  174. }
  175. static PCIBus *i440fx_common_init(const char *device_name,
  176. PCII440FXState **pi440fx_state,
  177. int *piix3_devfn,
  178. ISABus **isa_bus, qemu_irq *pic,
  179. MemoryRegion *address_space_mem,
  180. MemoryRegion *address_space_io,
  181. ram_addr_t ram_size,
  182. hwaddr pci_hole_start,
  183. hwaddr pci_hole_size,
  184. hwaddr pci_hole64_start,
  185. hwaddr pci_hole64_size,
  186. MemoryRegion *pci_address_space,
  187. MemoryRegion *ram_memory)
  188. {
  189. DeviceState *dev;
  190. PCIBus *b;
  191. PCIDevice *d;
  192. PCIHostState *s;
  193. PIIX3State *piix3;
  194. PCII440FXState *f;
  195. unsigned i;
  196. dev = qdev_create(NULL, "i440FX-pcihost");
  197. s = PCI_HOST_BRIDGE(dev);
  198. s->address_space = address_space_mem;
  199. b = pci_bus_new(dev, NULL, pci_address_space,
  200. address_space_io, 0);
  201. s->bus = b;
  202. object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
  203. qdev_init_nofail(dev);
  204. d = pci_create_simple(b, 0, device_name);
  205. *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
  206. f = *pi440fx_state;
  207. f->system_memory = address_space_mem;
  208. f->pci_address_space = pci_address_space;
  209. f->ram_memory = ram_memory;
  210. memory_region_init_alias(&f->pci_hole, "pci-hole", f->pci_address_space,
  211. pci_hole_start, pci_hole_size);
  212. memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole);
  213. memory_region_init_alias(&f->pci_hole_64bit, "pci-hole64",
  214. f->pci_address_space,
  215. pci_hole64_start, pci_hole64_size);
  216. if (pci_hole64_size) {
  217. memory_region_add_subregion(f->system_memory, pci_hole64_start,
  218. &f->pci_hole_64bit);
  219. }
  220. memory_region_init_alias(&f->smram_region, "smram-region",
  221. f->pci_address_space, 0xa0000, 0x20000);
  222. memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
  223. &f->smram_region, 1);
  224. memory_region_set_enabled(&f->smram_region, false);
  225. init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
  226. &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
  227. for (i = 0; i < 12; ++i) {
  228. init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
  229. &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
  230. PAM_EXPAN_SIZE);
  231. }
  232. /* Xen supports additional interrupt routes from the PCI devices to
  233. * the IOAPIC: the four pins of each PCI device on the bus are also
  234. * connected to the IOAPIC directly.
  235. * These additional routes can be discovered through ACPI. */
  236. if (xen_enabled()) {
  237. piix3 = DO_UPCAST(PIIX3State, dev,
  238. pci_create_simple_multifunction(b, -1, true, "PIIX3-xen"));
  239. pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
  240. piix3, XEN_PIIX_NUM_PIRQS);
  241. } else {
  242. piix3 = DO_UPCAST(PIIX3State, dev,
  243. pci_create_simple_multifunction(b, -1, true, "PIIX3"));
  244. pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
  245. PIIX_NUM_PIRQS);
  246. pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
  247. }
  248. piix3->pic = pic;
  249. *isa_bus = DO_UPCAST(ISABus, qbus,
  250. qdev_get_child_bus(&piix3->dev.qdev, "isa.0"));
  251. *piix3_devfn = piix3->dev.devfn;
  252. ram_size = ram_size / 8 / 1024 / 1024;
  253. if (ram_size > 255)
  254. ram_size = 255;
  255. (*pi440fx_state)->dev.config[0x57]=ram_size;
  256. i440fx_update_memory_mappings(f);
  257. return b;
  258. }
  259. PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn,
  260. ISABus **isa_bus, qemu_irq *pic,
  261. MemoryRegion *address_space_mem,
  262. MemoryRegion *address_space_io,
  263. ram_addr_t ram_size,
  264. hwaddr pci_hole_start,
  265. hwaddr pci_hole_size,
  266. hwaddr pci_hole64_start,
  267. hwaddr pci_hole64_size,
  268. MemoryRegion *pci_memory, MemoryRegion *ram_memory)
  269. {
  270. PCIBus *b;
  271. b = i440fx_common_init("i440FX", pi440fx_state, piix3_devfn, isa_bus, pic,
  272. address_space_mem, address_space_io, ram_size,
  273. pci_hole_start, pci_hole_size,
  274. pci_hole64_start, pci_hole64_size,
  275. pci_memory, ram_memory);
  276. return b;
  277. }
  278. /* PIIX3 PCI to ISA bridge */
  279. static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
  280. {
  281. qemu_set_irq(piix3->pic[pic_irq],
  282. !!(piix3->pic_levels &
  283. (((1ULL << PIIX_NUM_PIRQS) - 1) <<
  284. (pic_irq * PIIX_NUM_PIRQS))));
  285. }
  286. static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level)
  287. {
  288. int pic_irq;
  289. uint64_t mask;
  290. pic_irq = piix3->dev.config[PIIX_PIRQC + pirq];
  291. if (pic_irq >= PIIX_NUM_PIC_IRQS) {
  292. return;
  293. }
  294. mask = 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq);
  295. piix3->pic_levels &= ~mask;
  296. piix3->pic_levels |= mask * !!level;
  297. piix3_set_irq_pic(piix3, pic_irq);
  298. }
  299. static void piix3_set_irq(void *opaque, int pirq, int level)
  300. {
  301. PIIX3State *piix3 = opaque;
  302. piix3_set_irq_level(piix3, pirq, level);
  303. }
  304. static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin)
  305. {
  306. PIIX3State *piix3 = opaque;
  307. int irq = piix3->dev.config[PIIX_PIRQC + pin];
  308. PCIINTxRoute route;
  309. if (irq < PIIX_NUM_PIC_IRQS) {
  310. route.mode = PCI_INTX_ENABLED;
  311. route.irq = irq;
  312. } else {
  313. route.mode = PCI_INTX_DISABLED;
  314. route.irq = -1;
  315. }
  316. return route;
  317. }
  318. /* irq routing is changed. so rebuild bitmap */
  319. static void piix3_update_irq_levels(PIIX3State *piix3)
  320. {
  321. int pirq;
  322. piix3->pic_levels = 0;
  323. for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) {
  324. piix3_set_irq_level(piix3, pirq,
  325. pci_bus_get_irq_level(piix3->dev.bus, pirq));
  326. }
  327. }
  328. static void piix3_write_config(PCIDevice *dev,
  329. uint32_t address, uint32_t val, int len)
  330. {
  331. pci_default_write_config(dev, address, val, len);
  332. if (ranges_overlap(address, len, PIIX_PIRQC, 4)) {
  333. PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev);
  334. int pic_irq;
  335. pci_bus_fire_intx_routing_notifier(piix3->dev.bus);
  336. piix3_update_irq_levels(piix3);
  337. for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) {
  338. piix3_set_irq_pic(piix3, pic_irq);
  339. }
  340. }
  341. }
  342. static void piix3_write_config_xen(PCIDevice *dev,
  343. uint32_t address, uint32_t val, int len)
  344. {
  345. xen_piix_pci_write_config_client(address, val, len);
  346. piix3_write_config(dev, address, val, len);
  347. }
  348. static void piix3_reset(void *opaque)
  349. {
  350. PIIX3State *d = opaque;
  351. uint8_t *pci_conf = d->dev.config;
  352. pci_conf[0x04] = 0x07; // master, memory and I/O
  353. pci_conf[0x05] = 0x00;
  354. pci_conf[0x06] = 0x00;
  355. pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
  356. pci_conf[0x4c] = 0x4d;
  357. pci_conf[0x4e] = 0x03;
  358. pci_conf[0x4f] = 0x00;
  359. pci_conf[0x60] = 0x80;
  360. pci_conf[0x61] = 0x80;
  361. pci_conf[0x62] = 0x80;
  362. pci_conf[0x63] = 0x80;
  363. pci_conf[0x69] = 0x02;
  364. pci_conf[0x70] = 0x80;
  365. pci_conf[0x76] = 0x0c;
  366. pci_conf[0x77] = 0x0c;
  367. pci_conf[0x78] = 0x02;
  368. pci_conf[0x79] = 0x00;
  369. pci_conf[0x80] = 0x00;
  370. pci_conf[0x82] = 0x00;
  371. pci_conf[0xa0] = 0x08;
  372. pci_conf[0xa2] = 0x00;
  373. pci_conf[0xa3] = 0x00;
  374. pci_conf[0xa4] = 0x00;
  375. pci_conf[0xa5] = 0x00;
  376. pci_conf[0xa6] = 0x00;
  377. pci_conf[0xa7] = 0x00;
  378. pci_conf[0xa8] = 0x0f;
  379. pci_conf[0xaa] = 0x00;
  380. pci_conf[0xab] = 0x00;
  381. pci_conf[0xac] = 0x00;
  382. pci_conf[0xae] = 0x00;
  383. d->pic_levels = 0;
  384. }
  385. static int piix3_post_load(void *opaque, int version_id)
  386. {
  387. PIIX3State *piix3 = opaque;
  388. piix3_update_irq_levels(piix3);
  389. return 0;
  390. }
  391. static void piix3_pre_save(void *opaque)
  392. {
  393. int i;
  394. PIIX3State *piix3 = opaque;
  395. for (i = 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) {
  396. piix3->pci_irq_levels_vmstate[i] =
  397. pci_bus_get_irq_level(piix3->dev.bus, i);
  398. }
  399. }
  400. static const VMStateDescription vmstate_piix3 = {
  401. .name = "PIIX3",
  402. .version_id = 3,
  403. .minimum_version_id = 2,
  404. .minimum_version_id_old = 2,
  405. .post_load = piix3_post_load,
  406. .pre_save = piix3_pre_save,
  407. .fields = (VMStateField []) {
  408. VMSTATE_PCI_DEVICE(dev, PIIX3State),
  409. VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
  410. PIIX_NUM_PIRQS, 3),
  411. VMSTATE_END_OF_LIST()
  412. }
  413. };
  414. static int piix3_initfn(PCIDevice *dev)
  415. {
  416. PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
  417. isa_bus_new(&d->dev.qdev, pci_address_space_io(dev));
  418. qemu_register_reset(piix3_reset, d);
  419. return 0;
  420. }
  421. static void piix3_class_init(ObjectClass *klass, void *data)
  422. {
  423. DeviceClass *dc = DEVICE_CLASS(klass);
  424. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  425. dc->desc = "ISA bridge";
  426. dc->vmsd = &vmstate_piix3;
  427. dc->no_user = 1,
  428. k->no_hotplug = 1;
  429. k->init = piix3_initfn;
  430. k->config_write = piix3_write_config;
  431. k->vendor_id = PCI_VENDOR_ID_INTEL;
  432. k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
  433. k->class_id = PCI_CLASS_BRIDGE_ISA;
  434. }
  435. static const TypeInfo piix3_info = {
  436. .name = "PIIX3",
  437. .parent = TYPE_PCI_DEVICE,
  438. .instance_size = sizeof(PIIX3State),
  439. .class_init = piix3_class_init,
  440. };
  441. static void piix3_xen_class_init(ObjectClass *klass, void *data)
  442. {
  443. DeviceClass *dc = DEVICE_CLASS(klass);
  444. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  445. dc->desc = "ISA bridge";
  446. dc->vmsd = &vmstate_piix3;
  447. dc->no_user = 1;
  448. k->no_hotplug = 1;
  449. k->init = piix3_initfn;
  450. k->config_write = piix3_write_config_xen;
  451. k->vendor_id = PCI_VENDOR_ID_INTEL;
  452. k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
  453. k->class_id = PCI_CLASS_BRIDGE_ISA;
  454. };
  455. static const TypeInfo piix3_xen_info = {
  456. .name = "PIIX3-xen",
  457. .parent = TYPE_PCI_DEVICE,
  458. .instance_size = sizeof(PIIX3State),
  459. .class_init = piix3_xen_class_init,
  460. };
  461. static void i440fx_class_init(ObjectClass *klass, void *data)
  462. {
  463. DeviceClass *dc = DEVICE_CLASS(klass);
  464. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  465. k->no_hotplug = 1;
  466. k->init = i440fx_initfn;
  467. k->config_write = i440fx_write_config;
  468. k->vendor_id = PCI_VENDOR_ID_INTEL;
  469. k->device_id = PCI_DEVICE_ID_INTEL_82441;
  470. k->revision = 0x02;
  471. k->class_id = PCI_CLASS_BRIDGE_HOST;
  472. dc->desc = "Host bridge";
  473. dc->no_user = 1;
  474. dc->vmsd = &vmstate_i440fx;
  475. }
  476. static const TypeInfo i440fx_info = {
  477. .name = "i440FX",
  478. .parent = TYPE_PCI_DEVICE,
  479. .instance_size = sizeof(PCII440FXState),
  480. .class_init = i440fx_class_init,
  481. };
  482. static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
  483. {
  484. DeviceClass *dc = DEVICE_CLASS(klass);
  485. SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
  486. k->init = i440fx_pcihost_initfn;
  487. dc->fw_name = "pci";
  488. dc->no_user = 1;
  489. }
  490. static const TypeInfo i440fx_pcihost_info = {
  491. .name = "i440FX-pcihost",
  492. .parent = TYPE_PCI_HOST_BRIDGE,
  493. .instance_size = sizeof(I440FXState),
  494. .class_init = i440fx_pcihost_class_init,
  495. };
  496. static void i440fx_register_types(void)
  497. {
  498. type_register_static(&i440fx_info);
  499. type_register_static(&piix3_info);
  500. type_register_static(&piix3_xen_info);
  501. type_register_static(&i440fx_pcihost_info);
  502. }
  503. type_init(i440fx_register_types)