ebus.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /* $Id: ebus.c,v 1.64 2001/11/08 04:41:33 davem Exp $
  2. * ebus.c: PCI to EBus bridge device.
  3. *
  4. * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
  5. * Copyright (C) 1999 David S. Miller (davem@redhat.com)
  6. */
  7. #include <linux/config.h>
  8. #include <linux/module.h>
  9. #include <linux/kernel.h>
  10. #include <linux/types.h>
  11. #include <linux/init.h>
  12. #include <linux/slab.h>
  13. #include <linux/string.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/delay.h>
  16. #include <asm/system.h>
  17. #include <asm/page.h>
  18. #include <asm/pbm.h>
  19. #include <asm/ebus.h>
  20. #include <asm/oplib.h>
  21. #include <asm/bpp.h>
  22. #include <asm/irq.h>
  23. /* EBUS dma library. */
  24. #define EBDMA_CSR 0x00UL /* Control/Status */
  25. #define EBDMA_ADDR 0x04UL /* DMA Address */
  26. #define EBDMA_COUNT 0x08UL /* DMA Count */
  27. #define EBDMA_CSR_INT_PEND 0x00000001
  28. #define EBDMA_CSR_ERR_PEND 0x00000002
  29. #define EBDMA_CSR_DRAIN 0x00000004
  30. #define EBDMA_CSR_INT_EN 0x00000010
  31. #define EBDMA_CSR_RESET 0x00000080
  32. #define EBDMA_CSR_WRITE 0x00000100
  33. #define EBDMA_CSR_EN_DMA 0x00000200
  34. #define EBDMA_CSR_CYC_PEND 0x00000400
  35. #define EBDMA_CSR_DIAG_RD_DONE 0x00000800
  36. #define EBDMA_CSR_DIAG_WR_DONE 0x00001000
  37. #define EBDMA_CSR_EN_CNT 0x00002000
  38. #define EBDMA_CSR_TC 0x00004000
  39. #define EBDMA_CSR_DIS_CSR_DRN 0x00010000
  40. #define EBDMA_CSR_BURST_SZ_MASK 0x000c0000
  41. #define EBDMA_CSR_BURST_SZ_1 0x00080000
  42. #define EBDMA_CSR_BURST_SZ_4 0x00000000
  43. #define EBDMA_CSR_BURST_SZ_8 0x00040000
  44. #define EBDMA_CSR_BURST_SZ_16 0x000c0000
  45. #define EBDMA_CSR_DIAG_EN 0x00100000
  46. #define EBDMA_CSR_DIS_ERR_PEND 0x00400000
  47. #define EBDMA_CSR_TCI_DIS 0x00800000
  48. #define EBDMA_CSR_EN_NEXT 0x01000000
  49. #define EBDMA_CSR_DMA_ON 0x02000000
  50. #define EBDMA_CSR_A_LOADED 0x04000000
  51. #define EBDMA_CSR_NA_LOADED 0x08000000
  52. #define EBDMA_CSR_DEV_ID_MASK 0xf0000000
  53. #define EBUS_DMA_RESET_TIMEOUT 10000
  54. static void __ebus_dma_reset(struct ebus_dma_info *p, int no_drain)
  55. {
  56. int i;
  57. u32 val = 0;
  58. writel(EBDMA_CSR_RESET, p->regs + EBDMA_CSR);
  59. udelay(1);
  60. if (no_drain)
  61. return;
  62. for (i = EBUS_DMA_RESET_TIMEOUT; i > 0; i--) {
  63. val = readl(p->regs + EBDMA_CSR);
  64. if (!(val & (EBDMA_CSR_DRAIN | EBDMA_CSR_CYC_PEND)))
  65. break;
  66. udelay(10);
  67. }
  68. }
  69. static irqreturn_t ebus_dma_irq(int irq, void *dev_id, struct pt_regs *regs)
  70. {
  71. struct ebus_dma_info *p = dev_id;
  72. unsigned long flags;
  73. u32 csr = 0;
  74. spin_lock_irqsave(&p->lock, flags);
  75. csr = readl(p->regs + EBDMA_CSR);
  76. writel(csr, p->regs + EBDMA_CSR);
  77. spin_unlock_irqrestore(&p->lock, flags);
  78. if (csr & EBDMA_CSR_ERR_PEND) {
  79. printk(KERN_CRIT "ebus_dma(%s): DMA error!\n", p->name);
  80. p->callback(p, EBUS_DMA_EVENT_ERROR, p->client_cookie);
  81. return IRQ_HANDLED;
  82. } else if (csr & EBDMA_CSR_INT_PEND) {
  83. p->callback(p,
  84. (csr & EBDMA_CSR_TC) ?
  85. EBUS_DMA_EVENT_DMA : EBUS_DMA_EVENT_DEVICE,
  86. p->client_cookie);
  87. return IRQ_HANDLED;
  88. }
  89. return IRQ_NONE;
  90. }
  91. int ebus_dma_register(struct ebus_dma_info *p)
  92. {
  93. u32 csr;
  94. if (!p->regs)
  95. return -EINVAL;
  96. if (p->flags & ~(EBUS_DMA_FLAG_USE_EBDMA_HANDLER |
  97. EBUS_DMA_FLAG_TCI_DISABLE))
  98. return -EINVAL;
  99. if ((p->flags & EBUS_DMA_FLAG_USE_EBDMA_HANDLER) && !p->callback)
  100. return -EINVAL;
  101. if (!strlen(p->name))
  102. return -EINVAL;
  103. __ebus_dma_reset(p, 1);
  104. csr = EBDMA_CSR_BURST_SZ_16 | EBDMA_CSR_EN_CNT;
  105. if (p->flags & EBUS_DMA_FLAG_TCI_DISABLE)
  106. csr |= EBDMA_CSR_TCI_DIS;
  107. writel(csr, p->regs + EBDMA_CSR);
  108. return 0;
  109. }
  110. EXPORT_SYMBOL(ebus_dma_register);
  111. int ebus_dma_irq_enable(struct ebus_dma_info *p, int on)
  112. {
  113. unsigned long flags;
  114. u32 csr;
  115. if (on) {
  116. if (p->flags & EBUS_DMA_FLAG_USE_EBDMA_HANDLER) {
  117. if (request_irq(p->irq, ebus_dma_irq, SA_SHIRQ, p->name, p))
  118. return -EBUSY;
  119. }
  120. spin_lock_irqsave(&p->lock, flags);
  121. csr = readl(p->regs + EBDMA_CSR);
  122. csr |= EBDMA_CSR_INT_EN;
  123. writel(csr, p->regs + EBDMA_CSR);
  124. spin_unlock_irqrestore(&p->lock, flags);
  125. } else {
  126. spin_lock_irqsave(&p->lock, flags);
  127. csr = readl(p->regs + EBDMA_CSR);
  128. csr &= ~EBDMA_CSR_INT_EN;
  129. writel(csr, p->regs + EBDMA_CSR);
  130. spin_unlock_irqrestore(&p->lock, flags);
  131. if (p->flags & EBUS_DMA_FLAG_USE_EBDMA_HANDLER) {
  132. free_irq(p->irq, p);
  133. }
  134. }
  135. return 0;
  136. }
  137. EXPORT_SYMBOL(ebus_dma_irq_enable);
  138. void ebus_dma_unregister(struct ebus_dma_info *p)
  139. {
  140. unsigned long flags;
  141. u32 csr;
  142. int irq_on = 0;
  143. spin_lock_irqsave(&p->lock, flags);
  144. csr = readl(p->regs + EBDMA_CSR);
  145. if (csr & EBDMA_CSR_INT_EN) {
  146. csr &= ~EBDMA_CSR_INT_EN;
  147. writel(csr, p->regs + EBDMA_CSR);
  148. irq_on = 1;
  149. }
  150. spin_unlock_irqrestore(&p->lock, flags);
  151. if (irq_on)
  152. free_irq(p->irq, p);
  153. }
  154. EXPORT_SYMBOL(ebus_dma_unregister);
  155. int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, size_t len)
  156. {
  157. unsigned long flags;
  158. u32 csr;
  159. int err;
  160. if (len >= (1 << 24))
  161. return -EINVAL;
  162. spin_lock_irqsave(&p->lock, flags);
  163. csr = readl(p->regs + EBDMA_CSR);
  164. err = -EINVAL;
  165. if (!(csr & EBDMA_CSR_EN_DMA))
  166. goto out;
  167. err = -EBUSY;
  168. if (csr & EBDMA_CSR_NA_LOADED)
  169. goto out;
  170. writel(len, p->regs + EBDMA_COUNT);
  171. writel(bus_addr, p->regs + EBDMA_ADDR);
  172. err = 0;
  173. out:
  174. spin_unlock_irqrestore(&p->lock, flags);
  175. return err;
  176. }
  177. EXPORT_SYMBOL(ebus_dma_request);
  178. void ebus_dma_prepare(struct ebus_dma_info *p, int write)
  179. {
  180. unsigned long flags;
  181. u32 csr;
  182. spin_lock_irqsave(&p->lock, flags);
  183. __ebus_dma_reset(p, 0);
  184. csr = (EBDMA_CSR_INT_EN |
  185. EBDMA_CSR_EN_CNT |
  186. EBDMA_CSR_BURST_SZ_16 |
  187. EBDMA_CSR_EN_NEXT);
  188. if (write)
  189. csr |= EBDMA_CSR_WRITE;
  190. if (p->flags & EBUS_DMA_FLAG_TCI_DISABLE)
  191. csr |= EBDMA_CSR_TCI_DIS;
  192. writel(csr, p->regs + EBDMA_CSR);
  193. spin_unlock_irqrestore(&p->lock, flags);
  194. }
  195. EXPORT_SYMBOL(ebus_dma_prepare);
  196. unsigned int ebus_dma_residue(struct ebus_dma_info *p)
  197. {
  198. return readl(p->regs + EBDMA_COUNT);
  199. }
  200. EXPORT_SYMBOL(ebus_dma_residue);
  201. unsigned int ebus_dma_addr(struct ebus_dma_info *p)
  202. {
  203. return readl(p->regs + EBDMA_ADDR);
  204. }
  205. EXPORT_SYMBOL(ebus_dma_addr);
  206. void ebus_dma_enable(struct ebus_dma_info *p, int on)
  207. {
  208. unsigned long flags;
  209. u32 orig_csr, csr;
  210. spin_lock_irqsave(&p->lock, flags);
  211. orig_csr = csr = readl(p->regs + EBDMA_CSR);
  212. if (on)
  213. csr |= EBDMA_CSR_EN_DMA;
  214. else
  215. csr &= ~EBDMA_CSR_EN_DMA;
  216. if ((orig_csr & EBDMA_CSR_EN_DMA) !=
  217. (csr & EBDMA_CSR_EN_DMA))
  218. writel(csr, p->regs + EBDMA_CSR);
  219. spin_unlock_irqrestore(&p->lock, flags);
  220. }
  221. EXPORT_SYMBOL(ebus_dma_enable);
  222. struct linux_ebus *ebus_chain = NULL;
  223. static inline void *ebus_alloc(size_t size)
  224. {
  225. void *mem;
  226. mem = kzalloc(size, GFP_ATOMIC);
  227. if (!mem)
  228. panic("ebus_alloc: out of memory");
  229. return mem;
  230. }
  231. int __init ebus_intmap_match(struct linux_ebus *ebus,
  232. struct linux_prom_registers *reg,
  233. int *interrupt)
  234. {
  235. struct linux_prom_ebus_intmap *imap;
  236. struct linux_prom_ebus_intmask *imask;
  237. unsigned int hi, lo, irq;
  238. int i, len, n_imap;
  239. imap = of_get_property(ebus->prom_node, "interrupt-map", &len);
  240. if (!imap)
  241. return 0;
  242. n_imap = len / sizeof(imap[0]);
  243. imask = of_get_property(ebus->prom_node, "interrupt-map-mask", NULL);
  244. if (!imask)
  245. return 0;
  246. hi = reg->which_io & imask->phys_hi;
  247. lo = reg->phys_addr & imask->phys_lo;
  248. irq = *interrupt & imask->interrupt;
  249. for (i = 0; i < n_imap; i++) {
  250. if ((imap[i].phys_hi == hi) &&
  251. (imap[i].phys_lo == lo) &&
  252. (imap[i].interrupt == irq)) {
  253. *interrupt = imap[i].cinterrupt;
  254. return 0;
  255. }
  256. }
  257. return -1;
  258. }
  259. void __init fill_ebus_child(struct device_node *dp,
  260. struct linux_prom_registers *preg,
  261. struct linux_ebus_child *dev,
  262. int non_standard_regs)
  263. {
  264. int *regs;
  265. int *irqs;
  266. int i, len;
  267. dev->prom_node = dp;
  268. printk(" (%s)", dp->name);
  269. regs = of_get_property(dp, "reg", &len);
  270. if (!regs)
  271. dev->num_addrs = 0;
  272. else
  273. dev->num_addrs = len / sizeof(regs[0]);
  274. if (non_standard_regs) {
  275. /* This is to handle reg properties which are not
  276. * in the parent relative format. One example are
  277. * children of the i2c device on CompactPCI systems.
  278. *
  279. * So, for such devices we just record the property
  280. * raw in the child resources.
  281. */
  282. for (i = 0; i < dev->num_addrs; i++)
  283. dev->resource[i].start = regs[i];
  284. } else {
  285. for (i = 0; i < dev->num_addrs; i++) {
  286. int rnum = regs[i];
  287. if (rnum >= dev->parent->num_addrs) {
  288. prom_printf("UGH: property for %s was %d, need < %d\n",
  289. dp->name, len, dev->parent->num_addrs);
  290. prom_halt();
  291. }
  292. dev->resource[i].start = dev->parent->resource[i].start;
  293. dev->resource[i].end = dev->parent->resource[i].end;
  294. dev->resource[i].flags = IORESOURCE_MEM;
  295. dev->resource[i].name = dp->name;
  296. }
  297. }
  298. for (i = 0; i < PROMINTR_MAX; i++)
  299. dev->irqs[i] = PCI_IRQ_NONE;
  300. irqs = of_get_property(dp, "interrupts", &len);
  301. if (!irqs) {
  302. dev->num_irqs = 0;
  303. /*
  304. * Oh, well, some PROMs don't export interrupts
  305. * property to children of EBus devices...
  306. *
  307. * Be smart about PS/2 keyboard and mouse.
  308. */
  309. if (!strcmp(dev->parent->prom_node->name, "8042")) {
  310. if (!strcmp(dev->prom_node->name, "kb_ps2")) {
  311. dev->num_irqs = 1;
  312. dev->irqs[0] = dev->parent->irqs[0];
  313. } else {
  314. dev->num_irqs = 1;
  315. dev->irqs[0] = dev->parent->irqs[1];
  316. }
  317. }
  318. } else {
  319. dev->num_irqs = len / sizeof(irqs[0]);
  320. for (i = 0; i < dev->num_irqs; i++) {
  321. struct pci_pbm_info *pbm = dev->bus->parent;
  322. struct pci_controller_info *p = pbm->parent;
  323. if (ebus_intmap_match(dev->bus, preg, &irqs[i]) != -1) {
  324. dev->irqs[i] = p->irq_build(pbm,
  325. dev->bus->self,
  326. irqs[i]);
  327. } else {
  328. /* If we get a bogus interrupt property, just
  329. * record the raw value instead of punting.
  330. */
  331. dev->irqs[i] = irqs[i];
  332. }
  333. }
  334. }
  335. }
  336. static int __init child_regs_nonstandard(struct linux_ebus_device *dev)
  337. {
  338. if (!strcmp(dev->prom_node->name, "i2c") ||
  339. !strcmp(dev->prom_node->name, "SUNW,lombus"))
  340. return 1;
  341. return 0;
  342. }
  343. void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev)
  344. {
  345. struct linux_prom_registers *regs;
  346. struct linux_ebus_child *child;
  347. int *irqs;
  348. int i, n, len;
  349. dev->prom_node = dp;
  350. printk(" [%s", dp->name);
  351. regs = of_get_property(dp, "reg", &len);
  352. if (!regs) {
  353. dev->num_addrs = 0;
  354. goto probe_interrupts;
  355. }
  356. if (len % sizeof(struct linux_prom_registers)) {
  357. prom_printf("UGH: proplen for %s was %d, need multiple of %d\n",
  358. dev->prom_node->name, len,
  359. (int)sizeof(struct linux_prom_registers));
  360. prom_halt();
  361. }
  362. dev->num_addrs = len / sizeof(struct linux_prom_registers);
  363. for (i = 0; i < dev->num_addrs; i++) {
  364. /* XXX Learn how to interpret ebus ranges... -DaveM */
  365. if (regs[i].which_io >= 0x10)
  366. n = (regs[i].which_io - 0x10) >> 2;
  367. else
  368. n = regs[i].which_io;
  369. dev->resource[i].start = dev->bus->self->resource[n].start;
  370. dev->resource[i].start += (unsigned long)regs[i].phys_addr;
  371. dev->resource[i].end =
  372. (dev->resource[i].start + (unsigned long)regs[i].reg_size - 1UL);
  373. dev->resource[i].flags = IORESOURCE_MEM;
  374. dev->resource[i].name = dev->prom_node->name;
  375. request_resource(&dev->bus->self->resource[n],
  376. &dev->resource[i]);
  377. }
  378. probe_interrupts:
  379. for (i = 0; i < PROMINTR_MAX; i++)
  380. dev->irqs[i] = PCI_IRQ_NONE;
  381. irqs = of_get_property(dp, "interrupts", &len);
  382. if (!irqs) {
  383. dev->num_irqs = 0;
  384. } else {
  385. dev->num_irqs = len / sizeof(irqs[0]);
  386. for (i = 0; i < dev->num_irqs; i++) {
  387. struct pci_pbm_info *pbm = dev->bus->parent;
  388. struct pci_controller_info *p = pbm->parent;
  389. if (ebus_intmap_match(dev->bus, &regs[0], &irqs[i]) != -1) {
  390. dev->irqs[i] = p->irq_build(pbm,
  391. dev->bus->self,
  392. irqs[i]);
  393. } else {
  394. /* If we get a bogus interrupt property, just
  395. * record the raw value instead of punting.
  396. */
  397. dev->irqs[i] = irqs[i];
  398. }
  399. }
  400. }
  401. dev->ofdev.node = dp;
  402. dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
  403. dev->ofdev.dev.bus = &ebus_bus_type;
  404. strcpy(dev->ofdev.dev.bus_id, dp->path_component_name);
  405. /* Register with core */
  406. if (of_device_register(&dev->ofdev) != 0)
  407. printk(KERN_DEBUG "ebus: device registration error for %s!\n",
  408. dev->ofdev.dev.bus_id);
  409. dp = dp->child;
  410. if (dp) {
  411. printk(" ->");
  412. dev->children = ebus_alloc(sizeof(struct linux_ebus_child));
  413. child = dev->children;
  414. child->next = NULL;
  415. child->parent = dev;
  416. child->bus = dev->bus;
  417. fill_ebus_child(dp, regs, child,
  418. child_regs_nonstandard(dev));
  419. while ((dp = dp->sibling) != NULL) {
  420. child->next = ebus_alloc(sizeof(struct linux_ebus_child));
  421. child = child->next;
  422. child->next = NULL;
  423. child->parent = dev;
  424. child->bus = dev->bus;
  425. fill_ebus_child(dp, regs, child,
  426. child_regs_nonstandard(dev));
  427. }
  428. }
  429. printk("]");
  430. }
  431. static struct pci_dev *find_next_ebus(struct pci_dev *start, int *is_rio_p)
  432. {
  433. struct pci_dev *pdev = start;
  434. while ((pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev)))
  435. if (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
  436. pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)
  437. break;
  438. *is_rio_p = !!(pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS));
  439. return pdev;
  440. }
  441. void __init ebus_init(void)
  442. {
  443. struct pci_pbm_info *pbm;
  444. struct linux_ebus_device *dev;
  445. struct linux_ebus *ebus;
  446. struct pci_dev *pdev;
  447. struct pcidev_cookie *cookie;
  448. struct device_node *dp;
  449. int is_rio;
  450. int num_ebus = 0;
  451. pdev = find_next_ebus(NULL, &is_rio);
  452. if (!pdev) {
  453. printk("ebus: No EBus's found.\n");
  454. return;
  455. }
  456. cookie = pdev->sysdata;
  457. dp = cookie->prom_node;
  458. ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus));
  459. ebus->next = NULL;
  460. ebus->is_rio = is_rio;
  461. while (dp) {
  462. struct device_node *child;
  463. /* SUNW,pci-qfe uses four empty ebuses on it.
  464. I think we should not consider them here,
  465. as they have half of the properties this
  466. code expects and once we do PCI hot-plug,
  467. we'd have to tweak with the ebus_chain
  468. in the runtime after initialization. -jj */
  469. if (!dp->child) {
  470. pdev = find_next_ebus(pdev, &is_rio);
  471. if (!pdev) {
  472. if (ebus == ebus_chain) {
  473. ebus_chain = NULL;
  474. printk("ebus: No EBus's found.\n");
  475. return;
  476. }
  477. break;
  478. }
  479. ebus->is_rio = is_rio;
  480. cookie = pdev->sysdata;
  481. dp = cookie->prom_node;
  482. continue;
  483. }
  484. printk("ebus%d:", num_ebus);
  485. ebus->index = num_ebus;
  486. ebus->prom_node = dp;
  487. ebus->self = pdev;
  488. ebus->parent = pbm = cookie->pbm;
  489. ebus->ofdev.node = dp;
  490. ebus->ofdev.dev.parent = &pdev->dev;
  491. ebus->ofdev.dev.bus = &ebus_bus_type;
  492. strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name);
  493. /* Register with core */
  494. if (of_device_register(&ebus->ofdev) != 0)
  495. printk(KERN_DEBUG "ebus: device registration error for %s!\n",
  496. ebus->ofdev.dev.bus_id);
  497. child = dp->child;
  498. if (!child)
  499. goto next_ebus;
  500. ebus->devices = ebus_alloc(sizeof(struct linux_ebus_device));
  501. dev = ebus->devices;
  502. dev->next = NULL;
  503. dev->children = NULL;
  504. dev->bus = ebus;
  505. fill_ebus_device(child, dev);
  506. while ((child = child->sibling) != NULL) {
  507. dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
  508. dev = dev->next;
  509. dev->next = NULL;
  510. dev->children = NULL;
  511. dev->bus = ebus;
  512. fill_ebus_device(child, dev);
  513. }
  514. next_ebus:
  515. printk("\n");
  516. pdev = find_next_ebus(pdev, &is_rio);
  517. if (!pdev)
  518. break;
  519. cookie = pdev->sysdata;
  520. dp = cookie->prom_node;
  521. ebus->next = ebus_alloc(sizeof(struct linux_ebus));
  522. ebus = ebus->next;
  523. ebus->next = NULL;
  524. ebus->is_rio = is_rio;
  525. ++num_ebus;
  526. }
  527. pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */
  528. }