apb.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. /*
  2. * QEMU Ultrasparc APB PCI host
  3. *
  4. * Copyright (c) 2006 Fabrice Bellard
  5. * Copyright (c) 2012,2013 Artyom Tarasenko
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. * THE SOFTWARE.
  24. */
  25. /* XXX This file and most of its contents are somewhat misnamed. The
  26. Ultrasparc PCI host is called the PCI Bus Module (PBM). The APB is
  27. the secondary PCI bridge. */
  28. #include "hw/sysbus.h"
  29. #include "hw/pci/pci.h"
  30. #include "hw/pci/pci_host.h"
  31. #include "hw/pci/pci_bridge.h"
  32. #include "hw/pci/pci_bus.h"
  33. #include "hw/pci-host/apb.h"
  34. #include "sysemu/sysemu.h"
  35. #include "exec/address-spaces.h"
  36. /* debug APB */
  37. //#define DEBUG_APB
  38. #ifdef DEBUG_APB
  39. #define APB_DPRINTF(fmt, ...) \
  40. do { printf("APB: " fmt , ## __VA_ARGS__); } while (0)
  41. #else
  42. #define APB_DPRINTF(fmt, ...)
  43. #endif
  44. /*
  45. * Chipset docs:
  46. * PBM: "UltraSPARC IIi User's Manual",
  47. * http://www.sun.com/processors/manuals/805-0087.pdf
  48. *
  49. * APB: "Advanced PCI Bridge (APB) User's Manual",
  50. * http://www.sun.com/processors/manuals/805-1251.pdf
  51. */
  52. #define PBM_PCI_IMR_MASK 0x7fffffff
  53. #define PBM_PCI_IMR_ENABLED 0x80000000
  54. #define POR (1U << 31)
  55. #define SOFT_POR (1U << 30)
  56. #define SOFT_XIR (1U << 29)
  57. #define BTN_POR (1U << 28)
  58. #define BTN_XIR (1U << 27)
  59. #define RESET_MASK 0xf8000000
  60. #define RESET_WCMASK 0x98000000
  61. #define RESET_WMASK 0x60000000
  62. #define MAX_IVEC 0x40
  63. #define NO_IRQ_REQUEST (MAX_IVEC + 1)
  64. #define TYPE_APB "pbm"
  65. #define APB_DEVICE(obj) \
  66. OBJECT_CHECK(APBState, (obj), TYPE_APB)
  67. typedef struct APBState {
  68. PCIHostState parent_obj;
  69. MemoryRegion apb_config;
  70. MemoryRegion pci_config;
  71. MemoryRegion pci_mmio;
  72. MemoryRegion pci_ioport;
  73. uint64_t pci_irq_in;
  74. uint32_t iommu[4];
  75. uint32_t pci_control[16];
  76. uint32_t pci_irq_map[8];
  77. uint32_t obio_irq_map[32];
  78. qemu_irq *pbm_irqs;
  79. qemu_irq *ivec_irqs;
  80. unsigned int irq_request;
  81. uint32_t reset_control;
  82. unsigned int nr_resets;
  83. } APBState;
  84. static inline void pbm_set_request(APBState *s, unsigned int irq_num)
  85. {
  86. APB_DPRINTF("%s: request irq %d\n", __func__, irq_num);
  87. s->irq_request = irq_num;
  88. qemu_set_irq(s->ivec_irqs[irq_num], 1);
  89. }
  90. static inline void pbm_check_irqs(APBState *s)
  91. {
  92. unsigned int i;
  93. /* Previous request is not acknowledged, resubmit */
  94. if (s->irq_request != NO_IRQ_REQUEST) {
  95. pbm_set_request(s, s->irq_request);
  96. return;
  97. }
  98. /* no request pending */
  99. if (s->pci_irq_in == 0ULL) {
  100. return;
  101. }
  102. for (i = 0; i < 32; i++) {
  103. if (s->pci_irq_in & (1ULL << i)) {
  104. if (s->pci_irq_map[i >> 2] & PBM_PCI_IMR_ENABLED) {
  105. pbm_set_request(s, i);
  106. return;
  107. }
  108. }
  109. }
  110. for (i = 32; i < 64; i++) {
  111. if (s->pci_irq_in & (1ULL << i)) {
  112. if (s->obio_irq_map[i - 32] & PBM_PCI_IMR_ENABLED) {
  113. pbm_set_request(s, i);
  114. break;
  115. }
  116. }
  117. }
  118. }
  119. static inline void pbm_clear_request(APBState *s, unsigned int irq_num)
  120. {
  121. APB_DPRINTF("%s: clear request irq %d\n", __func__, irq_num);
  122. qemu_set_irq(s->ivec_irqs[irq_num], 0);
  123. s->irq_request = NO_IRQ_REQUEST;
  124. }
  125. static void apb_config_writel (void *opaque, hwaddr addr,
  126. uint64_t val, unsigned size)
  127. {
  128. APBState *s = opaque;
  129. APB_DPRINTF("%s: addr " TARGET_FMT_plx " val %" PRIx64 "\n", __func__, addr, val);
  130. switch (addr & 0xffff) {
  131. case 0x30 ... 0x4f: /* DMA error registers */
  132. /* XXX: not implemented yet */
  133. break;
  134. case 0x200 ... 0x20b: /* IOMMU */
  135. s->iommu[(addr & 0xf) >> 2] = val;
  136. break;
  137. case 0x20c ... 0x3ff: /* IOMMU flush */
  138. break;
  139. case 0xc00 ... 0xc3f: /* PCI interrupt control */
  140. if (addr & 4) {
  141. unsigned int ino = (addr & 0x3f) >> 3;
  142. s->pci_irq_map[ino] &= PBM_PCI_IMR_MASK;
  143. s->pci_irq_map[ino] |= val & ~PBM_PCI_IMR_MASK;
  144. if ((s->irq_request == ino) && !(val & ~PBM_PCI_IMR_MASK)) {
  145. pbm_clear_request(s, ino);
  146. }
  147. pbm_check_irqs(s);
  148. }
  149. break;
  150. case 0x1000 ... 0x1080: /* OBIO interrupt control */
  151. if (addr & 4) {
  152. unsigned int ino = ((addr & 0xff) >> 3);
  153. s->obio_irq_map[ino] &= PBM_PCI_IMR_MASK;
  154. s->obio_irq_map[ino] |= val & ~PBM_PCI_IMR_MASK;
  155. if ((s->irq_request == (ino | 0x20))
  156. && !(val & ~PBM_PCI_IMR_MASK)) {
  157. pbm_clear_request(s, ino | 0x20);
  158. }
  159. pbm_check_irqs(s);
  160. }
  161. break;
  162. case 0x1400 ... 0x14ff: /* PCI interrupt clear */
  163. if (addr & 4) {
  164. unsigned int ino = (addr & 0xff) >> 5;
  165. if ((s->irq_request / 4) == ino) {
  166. pbm_clear_request(s, s->irq_request);
  167. pbm_check_irqs(s);
  168. }
  169. }
  170. break;
  171. case 0x1800 ... 0x1860: /* OBIO interrupt clear */
  172. if (addr & 4) {
  173. unsigned int ino = ((addr & 0xff) >> 3) | 0x20;
  174. if (s->irq_request == ino) {
  175. pbm_clear_request(s, ino);
  176. pbm_check_irqs(s);
  177. }
  178. }
  179. break;
  180. case 0x2000 ... 0x202f: /* PCI control */
  181. s->pci_control[(addr & 0x3f) >> 2] = val;
  182. break;
  183. case 0xf020 ... 0xf027: /* Reset control */
  184. if (addr & 4) {
  185. val &= RESET_MASK;
  186. s->reset_control &= ~(val & RESET_WCMASK);
  187. s->reset_control |= val & RESET_WMASK;
  188. if (val & SOFT_POR) {
  189. s->nr_resets = 0;
  190. qemu_system_reset_request();
  191. } else if (val & SOFT_XIR) {
  192. qemu_system_reset_request();
  193. }
  194. }
  195. break;
  196. case 0x5000 ... 0x51cf: /* PIO/DMA diagnostics */
  197. case 0xa400 ... 0xa67f: /* IOMMU diagnostics */
  198. case 0xa800 ... 0xa80f: /* Interrupt diagnostics */
  199. case 0xf000 ... 0xf01f: /* FFB config, memory control */
  200. /* we don't care */
  201. default:
  202. break;
  203. }
  204. }
  205. static uint64_t apb_config_readl (void *opaque,
  206. hwaddr addr, unsigned size)
  207. {
  208. APBState *s = opaque;
  209. uint32_t val;
  210. switch (addr & 0xffff) {
  211. case 0x30 ... 0x4f: /* DMA error registers */
  212. val = 0;
  213. /* XXX: not implemented yet */
  214. break;
  215. case 0x200 ... 0x20b: /* IOMMU */
  216. val = s->iommu[(addr & 0xf) >> 2];
  217. break;
  218. case 0x20c ... 0x3ff: /* IOMMU flush */
  219. val = 0;
  220. break;
  221. case 0xc00 ... 0xc3f: /* PCI interrupt control */
  222. if (addr & 4) {
  223. val = s->pci_irq_map[(addr & 0x3f) >> 3];
  224. } else {
  225. val = 0;
  226. }
  227. break;
  228. case 0x1000 ... 0x1080: /* OBIO interrupt control */
  229. if (addr & 4) {
  230. val = s->obio_irq_map[(addr & 0xff) >> 3];
  231. } else {
  232. val = 0;
  233. }
  234. break;
  235. case 0x2000 ... 0x202f: /* PCI control */
  236. val = s->pci_control[(addr & 0x3f) >> 2];
  237. break;
  238. case 0xf020 ... 0xf027: /* Reset control */
  239. if (addr & 4) {
  240. val = s->reset_control;
  241. } else {
  242. val = 0;
  243. }
  244. break;
  245. case 0x5000 ... 0x51cf: /* PIO/DMA diagnostics */
  246. case 0xa400 ... 0xa67f: /* IOMMU diagnostics */
  247. case 0xa800 ... 0xa80f: /* Interrupt diagnostics */
  248. case 0xf000 ... 0xf01f: /* FFB config, memory control */
  249. /* we don't care */
  250. default:
  251. val = 0;
  252. break;
  253. }
  254. APB_DPRINTF("%s: addr " TARGET_FMT_plx " -> %x\n", __func__, addr, val);
  255. return val;
  256. }
  257. static const MemoryRegionOps apb_config_ops = {
  258. .read = apb_config_readl,
  259. .write = apb_config_writel,
  260. .endianness = DEVICE_NATIVE_ENDIAN,
  261. };
  262. static void apb_pci_config_write(void *opaque, hwaddr addr,
  263. uint64_t val, unsigned size)
  264. {
  265. APBState *s = opaque;
  266. PCIHostState *phb = PCI_HOST_BRIDGE(s);
  267. val = qemu_bswap_len(val, size);
  268. APB_DPRINTF("%s: addr " TARGET_FMT_plx " val %" PRIx64 "\n", __func__, addr, val);
  269. pci_data_write(phb->bus, addr, val, size);
  270. }
  271. static uint64_t apb_pci_config_read(void *opaque, hwaddr addr,
  272. unsigned size)
  273. {
  274. uint32_t ret;
  275. APBState *s = opaque;
  276. PCIHostState *phb = PCI_HOST_BRIDGE(s);
  277. ret = pci_data_read(phb->bus, addr, size);
  278. ret = qemu_bswap_len(ret, size);
  279. APB_DPRINTF("%s: addr " TARGET_FMT_plx " -> %x\n", __func__, addr, ret);
  280. return ret;
  281. }
  282. /* The APB host has an IRQ line for each IRQ line of each slot. */
  283. static int pci_apb_map_irq(PCIDevice *pci_dev, int irq_num)
  284. {
  285. return ((pci_dev->devfn & 0x18) >> 1) + irq_num;
  286. }
  287. static int pci_pbm_map_irq(PCIDevice *pci_dev, int irq_num)
  288. {
  289. int bus_offset;
  290. if (pci_dev->devfn & 1)
  291. bus_offset = 16;
  292. else
  293. bus_offset = 0;
  294. return (bus_offset + (PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f;
  295. }
  296. static void pci_apb_set_irq(void *opaque, int irq_num, int level)
  297. {
  298. APBState *s = opaque;
  299. APB_DPRINTF("%s: set irq_in %d level %d\n", __func__, irq_num, level);
  300. /* PCI IRQ map onto the first 32 INO. */
  301. if (irq_num < 32) {
  302. if (level) {
  303. s->pci_irq_in |= 1ULL << irq_num;
  304. if (s->pci_irq_map[irq_num >> 2] & PBM_PCI_IMR_ENABLED) {
  305. pbm_set_request(s, irq_num);
  306. }
  307. } else {
  308. s->pci_irq_in &= ~(1ULL << irq_num);
  309. }
  310. } else {
  311. /* OBIO IRQ map onto the next 32 INO. */
  312. if (level) {
  313. APB_DPRINTF("%s: set irq %d level %d\n", __func__, irq_num, level);
  314. s->pci_irq_in |= 1ULL << irq_num;
  315. if ((s->irq_request == NO_IRQ_REQUEST)
  316. && (s->obio_irq_map[irq_num - 32] & PBM_PCI_IMR_ENABLED)) {
  317. pbm_set_request(s, irq_num);
  318. }
  319. } else {
  320. s->pci_irq_in &= ~(1ULL << irq_num);
  321. }
  322. }
  323. }
  324. static int apb_pci_bridge_initfn(PCIDevice *dev)
  325. {
  326. int rc;
  327. rc = pci_bridge_initfn(dev, TYPE_PCI_BUS);
  328. if (rc < 0) {
  329. return rc;
  330. }
  331. /*
  332. * command register:
  333. * According to PCI bridge spec, after reset
  334. * bus master bit is off
  335. * memory space enable bit is off
  336. * According to manual (805-1251.pdf).
  337. * the reset value should be zero unless the boot pin is tied high
  338. * (which is true) and thus it should be PCI_COMMAND_MEMORY.
  339. */
  340. pci_set_word(dev->config + PCI_COMMAND,
  341. PCI_COMMAND_MEMORY);
  342. pci_set_word(dev->config + PCI_STATUS,
  343. PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
  344. PCI_STATUS_DEVSEL_MEDIUM);
  345. return 0;
  346. }
  347. PCIBus *pci_apb_init(hwaddr special_base,
  348. hwaddr mem_base,
  349. qemu_irq *ivec_irqs, PCIBus **bus2, PCIBus **bus3,
  350. qemu_irq **pbm_irqs)
  351. {
  352. DeviceState *dev;
  353. SysBusDevice *s;
  354. PCIHostState *phb;
  355. APBState *d;
  356. PCIDevice *pci_dev;
  357. PCIBridge *br;
  358. /* Ultrasparc PBM main bus */
  359. dev = qdev_create(NULL, TYPE_APB);
  360. qdev_init_nofail(dev);
  361. s = SYS_BUS_DEVICE(dev);
  362. /* apb_config */
  363. sysbus_mmio_map(s, 0, special_base);
  364. /* PCI configuration space */
  365. sysbus_mmio_map(s, 1, special_base + 0x1000000ULL);
  366. /* pci_ioport */
  367. sysbus_mmio_map(s, 2, special_base + 0x2000000ULL);
  368. d = APB_DEVICE(dev);
  369. memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL);
  370. memory_region_add_subregion(get_system_memory(), mem_base, &d->pci_mmio);
  371. phb = PCI_HOST_BRIDGE(dev);
  372. phb->bus = pci_register_bus(DEVICE(phb), "pci",
  373. pci_apb_set_irq, pci_pbm_map_irq, d,
  374. &d->pci_mmio,
  375. get_system_io(),
  376. 0, 32, TYPE_PCI_BUS);
  377. *pbm_irqs = d->pbm_irqs;
  378. d->ivec_irqs = ivec_irqs;
  379. pci_create_simple(phb->bus, 0, "pbm-pci");
  380. /* APB secondary busses */
  381. pci_dev = pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true,
  382. "pbm-bridge");
  383. br = PCI_BRIDGE(pci_dev);
  384. pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 1",
  385. pci_apb_map_irq);
  386. qdev_init_nofail(&pci_dev->qdev);
  387. *bus2 = pci_bridge_get_sec_bus(br);
  388. pci_dev = pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true,
  389. "pbm-bridge");
  390. br = PCI_BRIDGE(pci_dev);
  391. pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 2",
  392. pci_apb_map_irq);
  393. qdev_init_nofail(&pci_dev->qdev);
  394. *bus3 = pci_bridge_get_sec_bus(br);
  395. return phb->bus;
  396. }
  397. static void pci_pbm_reset(DeviceState *d)
  398. {
  399. unsigned int i;
  400. APBState *s = APB_DEVICE(d);
  401. for (i = 0; i < 8; i++) {
  402. s->pci_irq_map[i] &= PBM_PCI_IMR_MASK;
  403. }
  404. for (i = 0; i < 32; i++) {
  405. s->obio_irq_map[i] &= PBM_PCI_IMR_MASK;
  406. }
  407. s->irq_request = NO_IRQ_REQUEST;
  408. s->pci_irq_in = 0ULL;
  409. if (s->nr_resets++ == 0) {
  410. /* Power on reset */
  411. s->reset_control = POR;
  412. }
  413. }
  414. static const MemoryRegionOps pci_config_ops = {
  415. .read = apb_pci_config_read,
  416. .write = apb_pci_config_write,
  417. .endianness = DEVICE_NATIVE_ENDIAN,
  418. };
  419. static int pci_pbm_init_device(SysBusDevice *dev)
  420. {
  421. APBState *s;
  422. unsigned int i;
  423. s = APB_DEVICE(dev);
  424. for (i = 0; i < 8; i++) {
  425. s->pci_irq_map[i] = (0x1f << 6) | (i << 2);
  426. }
  427. for (i = 0; i < 32; i++) {
  428. s->obio_irq_map[i] = ((0x1f << 6) | 0x20) + i;
  429. }
  430. s->pbm_irqs = qemu_allocate_irqs(pci_apb_set_irq, s, MAX_IVEC);
  431. s->irq_request = NO_IRQ_REQUEST;
  432. s->pci_irq_in = 0ULL;
  433. /* apb_config */
  434. memory_region_init_io(&s->apb_config, OBJECT(s), &apb_config_ops, s,
  435. "apb-config", 0x10000);
  436. /* at region 0 */
  437. sysbus_init_mmio(dev, &s->apb_config);
  438. memory_region_init_io(&s->pci_config, OBJECT(s), &pci_config_ops, s,
  439. "apb-pci-config", 0x1000000);
  440. /* at region 1 */
  441. sysbus_init_mmio(dev, &s->pci_config);
  442. /* pci_ioport */
  443. memory_region_init_alias(&s->pci_ioport, OBJECT(s), "apb-pci-ioport",
  444. get_system_io(), 0, 0x10000);
  445. /* at region 2 */
  446. sysbus_init_mmio(dev, &s->pci_ioport);
  447. return 0;
  448. }
  449. static int pbm_pci_host_init(PCIDevice *d)
  450. {
  451. pci_set_word(d->config + PCI_COMMAND,
  452. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
  453. pci_set_word(d->config + PCI_STATUS,
  454. PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
  455. PCI_STATUS_DEVSEL_MEDIUM);
  456. return 0;
  457. }
  458. static void pbm_pci_host_class_init(ObjectClass *klass, void *data)
  459. {
  460. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  461. DeviceClass *dc = DEVICE_CLASS(klass);
  462. k->init = pbm_pci_host_init;
  463. k->vendor_id = PCI_VENDOR_ID_SUN;
  464. k->device_id = PCI_DEVICE_ID_SUN_SABRE;
  465. k->class_id = PCI_CLASS_BRIDGE_HOST;
  466. /*
  467. * PCI-facing part of the host bridge, not usable without the
  468. * host-facing part, which can't be device_add'ed, yet.
  469. */
  470. dc->cannot_instantiate_with_device_add_yet = true;
  471. }
  472. static const TypeInfo pbm_pci_host_info = {
  473. .name = "pbm-pci",
  474. .parent = TYPE_PCI_DEVICE,
  475. .instance_size = sizeof(PCIDevice),
  476. .class_init = pbm_pci_host_class_init,
  477. };
  478. static void pbm_host_class_init(ObjectClass *klass, void *data)
  479. {
  480. DeviceClass *dc = DEVICE_CLASS(klass);
  481. SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
  482. k->init = pci_pbm_init_device;
  483. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  484. dc->reset = pci_pbm_reset;
  485. }
  486. static const TypeInfo pbm_host_info = {
  487. .name = TYPE_APB,
  488. .parent = TYPE_PCI_HOST_BRIDGE,
  489. .instance_size = sizeof(APBState),
  490. .class_init = pbm_host_class_init,
  491. };
  492. static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
  493. {
  494. DeviceClass *dc = DEVICE_CLASS(klass);
  495. PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
  496. k->init = apb_pci_bridge_initfn;
  497. k->exit = pci_bridge_exitfn;
  498. k->vendor_id = PCI_VENDOR_ID_SUN;
  499. k->device_id = PCI_DEVICE_ID_SUN_SIMBA;
  500. k->revision = 0x11;
  501. k->config_write = pci_bridge_write_config;
  502. k->is_bridge = 1;
  503. set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
  504. dc->reset = pci_bridge_reset;
  505. dc->vmsd = &vmstate_pci_device;
  506. }
  507. static const TypeInfo pbm_pci_bridge_info = {
  508. .name = "pbm-bridge",
  509. .parent = TYPE_PCI_BRIDGE,
  510. .class_init = pbm_pci_bridge_class_init,
  511. };
  512. static void pbm_register_types(void)
  513. {
  514. type_register_static(&pbm_host_info);
  515. type_register_static(&pbm_pci_host_info);
  516. type_register_static(&pbm_pci_bridge_info);
  517. }
  518. type_init(pbm_register_types)