uninorth.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /*
  2. * QEMU Uninorth PCI host (for all Mac99 and newer machines)
  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 "qemu/osdep.h"
  25. #include "hw/irq.h"
  26. #include "hw/qdev-properties.h"
  27. #include "qemu/module.h"
  28. #include "hw/pci/pci_device.h"
  29. #include "hw/pci/pci_host.h"
  30. #include "hw/pci-host/uninorth.h"
  31. #include "trace.h"
  32. static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
  33. {
  34. return (irq_num + (pci_dev->devfn >> 3)) & 3;
  35. }
  36. static void pci_unin_set_irq(void *opaque, int irq_num, int level)
  37. {
  38. UNINHostState *s = opaque;
  39. trace_unin_set_irq(irq_num, level);
  40. qemu_set_irq(s->irqs[irq_num], level);
  41. }
  42. static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
  43. {
  44. uint32_t retval;
  45. if (reg & (1u << 31)) {
  46. /* XXX OpenBIOS compatibility hack */
  47. retval = reg | (addr & 3);
  48. } else if (reg & 1) {
  49. /* CFA1 style */
  50. retval = (reg & ~7u) | (addr & 7);
  51. } else {
  52. uint32_t slot, func;
  53. /* Grab CFA0 style values */
  54. slot = ctz32(reg & 0xfffff800);
  55. if (slot == 32) {
  56. slot = -1; /* XXX: should this be 0? */
  57. }
  58. func = PCI_FUNC(reg >> 8);
  59. /* ... and then convert them to x86 format */
  60. /* config pointer */
  61. retval = (reg & (0xff - 7)) | (addr & 7);
  62. /* slot, fn */
  63. retval |= PCI_DEVFN(slot, func) << 8;
  64. }
  65. trace_unin_get_config_reg(reg, addr, retval);
  66. return retval;
  67. }
  68. static void unin_data_write(void *opaque, hwaddr addr,
  69. uint64_t val, unsigned len)
  70. {
  71. UNINHostState *s = opaque;
  72. PCIHostState *phb = PCI_HOST_BRIDGE(s);
  73. trace_unin_data_write(addr, len, val);
  74. pci_data_write(phb->bus,
  75. unin_get_config_reg(phb->config_reg, addr),
  76. val, len);
  77. }
  78. static uint64_t unin_data_read(void *opaque, hwaddr addr,
  79. unsigned len)
  80. {
  81. UNINHostState *s = opaque;
  82. PCIHostState *phb = PCI_HOST_BRIDGE(s);
  83. uint32_t val;
  84. val = pci_data_read(phb->bus,
  85. unin_get_config_reg(phb->config_reg, addr),
  86. len);
  87. trace_unin_data_read(addr, len, val);
  88. return val;
  89. }
  90. static const MemoryRegionOps unin_data_ops = {
  91. .read = unin_data_read,
  92. .write = unin_data_write,
  93. .endianness = DEVICE_LITTLE_ENDIAN,
  94. };
  95. static char *pci_unin_main_ofw_unit_address(const SysBusDevice *dev)
  96. {
  97. UNINHostState *s = UNI_NORTH_PCI_HOST_BRIDGE(dev);
  98. return g_strdup_printf("%x", s->ofw_addr);
  99. }
  100. static void pci_unin_main_realize(DeviceState *dev, Error **errp)
  101. {
  102. UNINHostState *s = UNI_NORTH_PCI_HOST_BRIDGE(dev);
  103. PCIHostState *h = PCI_HOST_BRIDGE(dev);
  104. h->bus = pci_register_root_bus(dev, NULL,
  105. pci_unin_set_irq, pci_unin_map_irq,
  106. s,
  107. &s->pci_mmio,
  108. &s->pci_io,
  109. PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
  110. pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-pci");
  111. /*
  112. * DEC 21154 bridge was unused for many years, this comment is
  113. * a placeholder for whoever wishes to resurrect it
  114. */
  115. }
  116. static void pci_unin_main_init(Object *obj)
  117. {
  118. UNINHostState *s = UNI_NORTH_PCI_HOST_BRIDGE(obj);
  119. SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
  120. PCIHostState *h = PCI_HOST_BRIDGE(obj);
  121. /* Use values found on a real PowerMac */
  122. /* Uninorth main bus */
  123. memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops,
  124. obj, "unin-pci-conf-idx", 0x1000);
  125. memory_region_init_io(&h->data_mem, OBJECT(h), &unin_data_ops, obj,
  126. "unin-pci-conf-data", 0x1000);
  127. memory_region_init(&s->pci_mmio, OBJECT(s), "unin-pci-mmio",
  128. 0x100000000ULL);
  129. memory_region_init_io(&s->pci_io, OBJECT(s), &unassigned_io_ops, obj,
  130. "unin-pci-isa-mmio", 0x00800000);
  131. memory_region_init_alias(&s->pci_hole, OBJECT(s),
  132. "unin-pci-hole", &s->pci_mmio,
  133. 0x80000000ULL, 0x10000000ULL);
  134. sysbus_init_mmio(sbd, &h->conf_mem);
  135. sysbus_init_mmio(sbd, &h->data_mem);
  136. sysbus_init_mmio(sbd, &s->pci_hole);
  137. sysbus_init_mmio(sbd, &s->pci_io);
  138. qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
  139. }
  140. static void pci_u3_agp_realize(DeviceState *dev, Error **errp)
  141. {
  142. UNINHostState *s = U3_AGP_HOST_BRIDGE(dev);
  143. PCIHostState *h = PCI_HOST_BRIDGE(dev);
  144. h->bus = pci_register_root_bus(dev, NULL,
  145. pci_unin_set_irq, pci_unin_map_irq,
  146. s,
  147. &s->pci_mmio,
  148. &s->pci_io,
  149. PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
  150. pci_create_simple(h->bus, PCI_DEVFN(11, 0), "u3-agp");
  151. }
  152. static void pci_u3_agp_init(Object *obj)
  153. {
  154. UNINHostState *s = U3_AGP_HOST_BRIDGE(obj);
  155. SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
  156. PCIHostState *h = PCI_HOST_BRIDGE(obj);
  157. /* Uninorth U3 AGP bus */
  158. memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops,
  159. obj, "unin-pci-conf-idx", 0x1000);
  160. memory_region_init_io(&h->data_mem, OBJECT(h), &unin_data_ops, obj,
  161. "unin-pci-conf-data", 0x1000);
  162. memory_region_init(&s->pci_mmio, OBJECT(s), "unin-pci-mmio",
  163. 0x100000000ULL);
  164. memory_region_init_io(&s->pci_io, OBJECT(s), &unassigned_io_ops, obj,
  165. "unin-pci-isa-mmio", 0x00800000);
  166. memory_region_init_alias(&s->pci_hole, OBJECT(s),
  167. "unin-pci-hole", &s->pci_mmio,
  168. 0x80000000ULL, 0x70000000ULL);
  169. sysbus_init_mmio(sbd, &h->conf_mem);
  170. sysbus_init_mmio(sbd, &h->data_mem);
  171. sysbus_init_mmio(sbd, &s->pci_hole);
  172. sysbus_init_mmio(sbd, &s->pci_io);
  173. qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
  174. }
  175. static void pci_unin_agp_realize(DeviceState *dev, Error **errp)
  176. {
  177. UNINHostState *s = UNI_NORTH_AGP_HOST_BRIDGE(dev);
  178. PCIHostState *h = PCI_HOST_BRIDGE(dev);
  179. h->bus = pci_register_root_bus(dev, NULL,
  180. pci_unin_set_irq, pci_unin_map_irq,
  181. s,
  182. &s->pci_mmio,
  183. &s->pci_io,
  184. PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
  185. pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-agp");
  186. }
  187. static void pci_unin_agp_init(Object *obj)
  188. {
  189. UNINHostState *s = UNI_NORTH_AGP_HOST_BRIDGE(obj);
  190. SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
  191. PCIHostState *h = PCI_HOST_BRIDGE(obj);
  192. /* Uninorth AGP bus */
  193. memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops,
  194. obj, "unin-agp-conf-idx", 0x1000);
  195. memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops,
  196. obj, "unin-agp-conf-data", 0x1000);
  197. sysbus_init_mmio(sbd, &h->conf_mem);
  198. sysbus_init_mmio(sbd, &h->data_mem);
  199. qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
  200. }
  201. static void pci_unin_internal_realize(DeviceState *dev, Error **errp)
  202. {
  203. UNINHostState *s = UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE(dev);
  204. PCIHostState *h = PCI_HOST_BRIDGE(dev);
  205. h->bus = pci_register_root_bus(dev, NULL,
  206. pci_unin_set_irq, pci_unin_map_irq,
  207. s,
  208. &s->pci_mmio,
  209. &s->pci_io,
  210. PCI_DEVFN(14, 0), 4, TYPE_PCI_BUS);
  211. pci_create_simple(h->bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");
  212. }
  213. static void pci_unin_internal_init(Object *obj)
  214. {
  215. UNINHostState *s = UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE(obj);
  216. SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
  217. PCIHostState *h = PCI_HOST_BRIDGE(obj);
  218. /* Uninorth internal bus */
  219. memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops,
  220. obj, "unin-pci-conf-idx", 0x1000);
  221. memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops,
  222. obj, "unin-pci-conf-data", 0x1000);
  223. sysbus_init_mmio(sbd, &h->conf_mem);
  224. sysbus_init_mmio(sbd, &h->data_mem);
  225. qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
  226. }
  227. static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
  228. {
  229. d->config[PCI_CACHE_LINE_SIZE] = 0x08;
  230. d->config[PCI_LATENCY_TIMER] = 0x10;
  231. d->config[PCI_CAPABILITY_LIST] = 0x00;
  232. /*
  233. * Set kMacRISCPCIAddressSelect (0x48) register to indicate PCI
  234. * memory space with base 0x80000000, size 0x10000000 for Apple's
  235. * AppleMacRiscPCI driver
  236. */
  237. d->config[0x48] = 0x0;
  238. d->config[0x49] = 0x0;
  239. d->config[0x4a] = 0x0;
  240. d->config[0x4b] = 0x1;
  241. }
  242. static void unin_agp_pci_host_realize(PCIDevice *d, Error **errp)
  243. {
  244. d->config[PCI_CACHE_LINE_SIZE] = 0x08;
  245. d->config[PCI_LATENCY_TIMER] = 0x10;
  246. /* d->config[PCI_CAPABILITY_LIST] = 0x80; */
  247. }
  248. static void u3_agp_pci_host_realize(PCIDevice *d, Error **errp)
  249. {
  250. d->config[PCI_CACHE_LINE_SIZE] = 0x08;
  251. d->config[PCI_LATENCY_TIMER] = 0x10;
  252. }
  253. static void unin_internal_pci_host_realize(PCIDevice *d, Error **errp)
  254. {
  255. d->config[PCI_CACHE_LINE_SIZE] = 0x08;
  256. d->config[PCI_LATENCY_TIMER] = 0x10;
  257. d->config[PCI_CAPABILITY_LIST] = 0x00;
  258. }
  259. static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
  260. {
  261. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  262. DeviceClass *dc = DEVICE_CLASS(klass);
  263. k->realize = unin_main_pci_host_realize;
  264. k->vendor_id = PCI_VENDOR_ID_APPLE;
  265. k->device_id = PCI_DEVICE_ID_APPLE_UNI_N_PCI;
  266. k->revision = 0x00;
  267. k->class_id = PCI_CLASS_BRIDGE_HOST;
  268. /*
  269. * PCI-facing part of the host bridge, not usable without the
  270. * host-facing part, which can't be device_add'ed, yet.
  271. */
  272. dc->user_creatable = false;
  273. }
  274. static const TypeInfo unin_main_pci_host_info = {
  275. .name = "uni-north-pci",
  276. .parent = TYPE_PCI_DEVICE,
  277. .instance_size = sizeof(PCIDevice),
  278. .class_init = unin_main_pci_host_class_init,
  279. .interfaces = (InterfaceInfo[]) {
  280. { INTERFACE_CONVENTIONAL_PCI_DEVICE },
  281. { },
  282. },
  283. };
  284. static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data)
  285. {
  286. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  287. DeviceClass *dc = DEVICE_CLASS(klass);
  288. k->realize = u3_agp_pci_host_realize;
  289. k->vendor_id = PCI_VENDOR_ID_APPLE;
  290. k->device_id = PCI_DEVICE_ID_APPLE_U3_AGP;
  291. k->revision = 0x00;
  292. k->class_id = PCI_CLASS_BRIDGE_HOST;
  293. /*
  294. * PCI-facing part of the host bridge, not usable without the
  295. * host-facing part, which can't be device_add'ed, yet.
  296. */
  297. dc->user_creatable = false;
  298. }
  299. static const TypeInfo u3_agp_pci_host_info = {
  300. .name = "u3-agp",
  301. .parent = TYPE_PCI_DEVICE,
  302. .instance_size = sizeof(PCIDevice),
  303. .class_init = u3_agp_pci_host_class_init,
  304. .interfaces = (InterfaceInfo[]) {
  305. { INTERFACE_CONVENTIONAL_PCI_DEVICE },
  306. { },
  307. },
  308. };
  309. static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data)
  310. {
  311. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  312. DeviceClass *dc = DEVICE_CLASS(klass);
  313. k->realize = unin_agp_pci_host_realize;
  314. k->vendor_id = PCI_VENDOR_ID_APPLE;
  315. k->device_id = PCI_DEVICE_ID_APPLE_UNI_N_AGP;
  316. k->revision = 0x00;
  317. k->class_id = PCI_CLASS_BRIDGE_HOST;
  318. /*
  319. * PCI-facing part of the host bridge, not usable without the
  320. * host-facing part, which can't be device_add'ed, yet.
  321. */
  322. dc->user_creatable = false;
  323. }
  324. static const TypeInfo unin_agp_pci_host_info = {
  325. .name = "uni-north-agp",
  326. .parent = TYPE_PCI_DEVICE,
  327. .instance_size = sizeof(PCIDevice),
  328. .class_init = unin_agp_pci_host_class_init,
  329. .interfaces = (InterfaceInfo[]) {
  330. { INTERFACE_CONVENTIONAL_PCI_DEVICE },
  331. { },
  332. },
  333. };
  334. static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data)
  335. {
  336. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  337. DeviceClass *dc = DEVICE_CLASS(klass);
  338. k->realize = unin_internal_pci_host_realize;
  339. k->vendor_id = PCI_VENDOR_ID_APPLE;
  340. k->device_id = PCI_DEVICE_ID_APPLE_UNI_N_I_PCI;
  341. k->revision = 0x00;
  342. k->class_id = PCI_CLASS_BRIDGE_HOST;
  343. /*
  344. * PCI-facing part of the host bridge, not usable without the
  345. * host-facing part, which can't be device_add'ed, yet.
  346. */
  347. dc->user_creatable = false;
  348. }
  349. static const TypeInfo unin_internal_pci_host_info = {
  350. .name = "uni-north-internal-pci",
  351. .parent = TYPE_PCI_DEVICE,
  352. .instance_size = sizeof(PCIDevice),
  353. .class_init = unin_internal_pci_host_class_init,
  354. .interfaces = (InterfaceInfo[]) {
  355. { INTERFACE_CONVENTIONAL_PCI_DEVICE },
  356. { },
  357. },
  358. };
  359. static Property pci_unin_main_pci_host_props[] = {
  360. DEFINE_PROP_UINT32("ofw-addr", UNINHostState, ofw_addr, -1),
  361. DEFINE_PROP_END_OF_LIST()
  362. };
  363. static void pci_unin_main_class_init(ObjectClass *klass, void *data)
  364. {
  365. DeviceClass *dc = DEVICE_CLASS(klass);
  366. SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
  367. dc->realize = pci_unin_main_realize;
  368. device_class_set_props(dc, pci_unin_main_pci_host_props);
  369. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  370. dc->fw_name = "pci";
  371. sbc->explicit_ofw_unit_address = pci_unin_main_ofw_unit_address;
  372. }
  373. static const TypeInfo pci_unin_main_info = {
  374. .name = TYPE_UNI_NORTH_PCI_HOST_BRIDGE,
  375. .parent = TYPE_PCI_HOST_BRIDGE,
  376. .instance_size = sizeof(UNINHostState),
  377. .instance_init = pci_unin_main_init,
  378. .class_init = pci_unin_main_class_init,
  379. };
  380. static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
  381. {
  382. DeviceClass *dc = DEVICE_CLASS(klass);
  383. dc->realize = pci_u3_agp_realize;
  384. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  385. }
  386. static const TypeInfo pci_u3_agp_info = {
  387. .name = TYPE_U3_AGP_HOST_BRIDGE,
  388. .parent = TYPE_PCI_HOST_BRIDGE,
  389. .instance_size = sizeof(UNINHostState),
  390. .instance_init = pci_u3_agp_init,
  391. .class_init = pci_u3_agp_class_init,
  392. };
  393. static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
  394. {
  395. DeviceClass *dc = DEVICE_CLASS(klass);
  396. dc->realize = pci_unin_agp_realize;
  397. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  398. }
  399. static const TypeInfo pci_unin_agp_info = {
  400. .name = TYPE_UNI_NORTH_AGP_HOST_BRIDGE,
  401. .parent = TYPE_PCI_HOST_BRIDGE,
  402. .instance_size = sizeof(UNINHostState),
  403. .instance_init = pci_unin_agp_init,
  404. .class_init = pci_unin_agp_class_init,
  405. };
  406. static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
  407. {
  408. DeviceClass *dc = DEVICE_CLASS(klass);
  409. dc->realize = pci_unin_internal_realize;
  410. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  411. }
  412. static const TypeInfo pci_unin_internal_info = {
  413. .name = TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE,
  414. .parent = TYPE_PCI_HOST_BRIDGE,
  415. .instance_size = sizeof(UNINHostState),
  416. .instance_init = pci_unin_internal_init,
  417. .class_init = pci_unin_internal_class_init,
  418. };
  419. /* UniN device */
  420. static void unin_write(void *opaque, hwaddr addr, uint64_t value,
  421. unsigned size)
  422. {
  423. trace_unin_write(addr, value);
  424. }
  425. static uint64_t unin_read(void *opaque, hwaddr addr, unsigned size)
  426. {
  427. uint32_t value;
  428. switch (addr) {
  429. case 0:
  430. value = UNINORTH_VERSION_10A;
  431. break;
  432. default:
  433. value = 0;
  434. }
  435. trace_unin_read(addr, value);
  436. return value;
  437. }
  438. static const MemoryRegionOps unin_ops = {
  439. .read = unin_read,
  440. .write = unin_write,
  441. .endianness = DEVICE_BIG_ENDIAN,
  442. };
  443. static void unin_init(Object *obj)
  444. {
  445. UNINState *s = UNI_NORTH(obj);
  446. SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
  447. memory_region_init_io(&s->mem, obj, &unin_ops, s, "unin", 0x1000);
  448. sysbus_init_mmio(sbd, &s->mem);
  449. }
  450. static void unin_class_init(ObjectClass *klass, void *data)
  451. {
  452. DeviceClass *dc = DEVICE_CLASS(klass);
  453. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  454. }
  455. static const TypeInfo unin_info = {
  456. .name = TYPE_UNI_NORTH,
  457. .parent = TYPE_SYS_BUS_DEVICE,
  458. .instance_size = sizeof(UNINState),
  459. .instance_init = unin_init,
  460. .class_init = unin_class_init,
  461. };
  462. static void unin_register_types(void)
  463. {
  464. type_register_static(&unin_main_pci_host_info);
  465. type_register_static(&u3_agp_pci_host_info);
  466. type_register_static(&unin_agp_pci_host_info);
  467. type_register_static(&unin_internal_pci_host_info);
  468. type_register_static(&pci_unin_main_info);
  469. type_register_static(&pci_u3_agp_info);
  470. type_register_static(&pci_unin_agp_info);
  471. type_register_static(&pci_unin_internal_info);
  472. type_register_static(&unin_info);
  473. }
  474. type_init(unin_register_types)