pci_fire.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /* pci_fire.c: Sun4u platform PCI-E controller support.
  2. *
  3. * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/pci.h>
  7. #include <linux/slab.h>
  8. #include <linux/init.h>
  9. #include <linux/msi.h>
  10. #include <linux/irq.h>
  11. #include <asm/oplib.h>
  12. #include <asm/prom.h>
  13. #include <asm/irq.h>
  14. #include "pci_impl.h"
  15. #define fire_read(__reg) \
  16. ({ u64 __ret; \
  17. __asm__ __volatile__("ldxa [%1] %2, %0" \
  18. : "=r" (__ret) \
  19. : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \
  20. : "memory"); \
  21. __ret; \
  22. })
  23. #define fire_write(__reg, __val) \
  24. __asm__ __volatile__("stxa %0, [%1] %2" \
  25. : /* no outputs */ \
  26. : "r" (__val), "r" (__reg), \
  27. "i" (ASI_PHYS_BYPASS_EC_E) \
  28. : "memory")
  29. static void pci_fire_scan_bus(struct pci_pbm_info *pbm)
  30. {
  31. pbm->pci_bus = pci_scan_one_pbm(pbm);
  32. /* XXX register error interrupt handlers XXX */
  33. }
  34. #define FIRE_IOMMU_CONTROL 0x40000UL
  35. #define FIRE_IOMMU_TSBBASE 0x40008UL
  36. #define FIRE_IOMMU_FLUSH 0x40100UL
  37. #define FIRE_IOMMU_FLUSHINV 0x40108UL
  38. static int pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
  39. {
  40. struct iommu *iommu = pbm->iommu;
  41. u32 vdma[2], dma_mask;
  42. u64 control;
  43. int tsbsize, err;
  44. /* No virtual-dma property on these guys, use largest size. */
  45. vdma[0] = 0xc0000000; /* base */
  46. vdma[1] = 0x40000000; /* size */
  47. dma_mask = 0xffffffff;
  48. tsbsize = 128;
  49. /* Register addresses. */
  50. iommu->iommu_control = pbm->pbm_regs + FIRE_IOMMU_CONTROL;
  51. iommu->iommu_tsbbase = pbm->pbm_regs + FIRE_IOMMU_TSBBASE;
  52. iommu->iommu_flush = pbm->pbm_regs + FIRE_IOMMU_FLUSH;
  53. iommu->iommu_flushinv = pbm->pbm_regs + FIRE_IOMMU_FLUSHINV;
  54. /* We use the main control/status register of FIRE as the write
  55. * completion register.
  56. */
  57. iommu->write_complete_reg = pbm->controller_regs + 0x410000UL;
  58. /*
  59. * Invalidate TLB Entries.
  60. */
  61. fire_write(iommu->iommu_flushinv, ~(u64)0);
  62. err = iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
  63. if (err)
  64. return err;
  65. fire_write(iommu->iommu_tsbbase, __pa(iommu->page_table) | 0x7UL);
  66. control = fire_read(iommu->iommu_control);
  67. control |= (0x00000400 /* TSB cache snoop enable */ |
  68. 0x00000300 /* Cache mode */ |
  69. 0x00000002 /* Bypass enable */ |
  70. 0x00000001 /* Translation enable */);
  71. fire_write(iommu->iommu_control, control);
  72. return 0;
  73. }
  74. #ifdef CONFIG_PCI_MSI
  75. struct pci_msiq_entry {
  76. u64 word0;
  77. #define MSIQ_WORD0_RESV 0x8000000000000000UL
  78. #define MSIQ_WORD0_FMT_TYPE 0x7f00000000000000UL
  79. #define MSIQ_WORD0_FMT_TYPE_SHIFT 56
  80. #define MSIQ_WORD0_LEN 0x00ffc00000000000UL
  81. #define MSIQ_WORD0_LEN_SHIFT 46
  82. #define MSIQ_WORD0_ADDR0 0x00003fff00000000UL
  83. #define MSIQ_WORD0_ADDR0_SHIFT 32
  84. #define MSIQ_WORD0_RID 0x00000000ffff0000UL
  85. #define MSIQ_WORD0_RID_SHIFT 16
  86. #define MSIQ_WORD0_DATA0 0x000000000000ffffUL
  87. #define MSIQ_WORD0_DATA0_SHIFT 0
  88. #define MSIQ_TYPE_MSG 0x6
  89. #define MSIQ_TYPE_MSI32 0xb
  90. #define MSIQ_TYPE_MSI64 0xf
  91. u64 word1;
  92. #define MSIQ_WORD1_ADDR1 0xffffffffffff0000UL
  93. #define MSIQ_WORD1_ADDR1_SHIFT 16
  94. #define MSIQ_WORD1_DATA1 0x000000000000ffffUL
  95. #define MSIQ_WORD1_DATA1_SHIFT 0
  96. u64 resv[6];
  97. };
  98. /* All MSI registers are offset from pbm->pbm_regs */
  99. #define EVENT_QUEUE_BASE_ADDR_REG 0x010000UL
  100. #define EVENT_QUEUE_BASE_ADDR_ALL_ONES 0xfffc000000000000UL
  101. #define EVENT_QUEUE_CONTROL_SET(EQ) (0x011000UL + (EQ) * 0x8UL)
  102. #define EVENT_QUEUE_CONTROL_SET_OFLOW 0x0200000000000000UL
  103. #define EVENT_QUEUE_CONTROL_SET_EN 0x0000100000000000UL
  104. #define EVENT_QUEUE_CONTROL_CLEAR(EQ) (0x011200UL + (EQ) * 0x8UL)
  105. #define EVENT_QUEUE_CONTROL_CLEAR_OF 0x0200000000000000UL
  106. #define EVENT_QUEUE_CONTROL_CLEAR_E2I 0x0000800000000000UL
  107. #define EVENT_QUEUE_CONTROL_CLEAR_DIS 0x0000100000000000UL
  108. #define EVENT_QUEUE_STATE(EQ) (0x011400UL + (EQ) * 0x8UL)
  109. #define EVENT_QUEUE_STATE_MASK 0x0000000000000007UL
  110. #define EVENT_QUEUE_STATE_IDLE 0x0000000000000001UL
  111. #define EVENT_QUEUE_STATE_ACTIVE 0x0000000000000002UL
  112. #define EVENT_QUEUE_STATE_ERROR 0x0000000000000004UL
  113. #define EVENT_QUEUE_TAIL(EQ) (0x011600UL + (EQ) * 0x8UL)
  114. #define EVENT_QUEUE_TAIL_OFLOW 0x0200000000000000UL
  115. #define EVENT_QUEUE_TAIL_VAL 0x000000000000007fUL
  116. #define EVENT_QUEUE_HEAD(EQ) (0x011800UL + (EQ) * 0x8UL)
  117. #define EVENT_QUEUE_HEAD_VAL 0x000000000000007fUL
  118. #define MSI_MAP(MSI) (0x020000UL + (MSI) * 0x8UL)
  119. #define MSI_MAP_VALID 0x8000000000000000UL
  120. #define MSI_MAP_EQWR_N 0x4000000000000000UL
  121. #define MSI_MAP_EQNUM 0x000000000000003fUL
  122. #define MSI_CLEAR(MSI) (0x028000UL + (MSI) * 0x8UL)
  123. #define MSI_CLEAR_EQWR_N 0x4000000000000000UL
  124. #define IMONDO_DATA0 0x02C000UL
  125. #define IMONDO_DATA0_DATA 0xffffffffffffffc0UL
  126. #define IMONDO_DATA1 0x02C008UL
  127. #define IMONDO_DATA1_DATA 0xffffffffffffffffUL
  128. #define MSI_32BIT_ADDR 0x034000UL
  129. #define MSI_32BIT_ADDR_VAL 0x00000000ffff0000UL
  130. #define MSI_64BIT_ADDR 0x034008UL
  131. #define MSI_64BIT_ADDR_VAL 0xffffffffffff0000UL
  132. static int pci_fire_get_head(struct pci_pbm_info *pbm, unsigned long msiqid,
  133. unsigned long *head)
  134. {
  135. *head = fire_read(pbm->pbm_regs + EVENT_QUEUE_HEAD(msiqid));
  136. return 0;
  137. }
  138. static int pci_fire_dequeue_msi(struct pci_pbm_info *pbm, unsigned long msiqid,
  139. unsigned long *head, unsigned long *msi)
  140. {
  141. unsigned long type_fmt, type, msi_num;
  142. struct pci_msiq_entry *base, *ep;
  143. base = (pbm->msi_queues + ((msiqid - pbm->msiq_first) * 8192));
  144. ep = &base[*head];
  145. if ((ep->word0 & MSIQ_WORD0_FMT_TYPE) == 0)
  146. return 0;
  147. type_fmt = ((ep->word0 & MSIQ_WORD0_FMT_TYPE) >>
  148. MSIQ_WORD0_FMT_TYPE_SHIFT);
  149. type = (type_fmt >> 3);
  150. if (unlikely(type != MSIQ_TYPE_MSI32 &&
  151. type != MSIQ_TYPE_MSI64))
  152. return -EINVAL;
  153. *msi = msi_num = ((ep->word0 & MSIQ_WORD0_DATA0) >>
  154. MSIQ_WORD0_DATA0_SHIFT);
  155. fire_write(pbm->pbm_regs + MSI_CLEAR(msi_num),
  156. MSI_CLEAR_EQWR_N);
  157. /* Clear the entry. */
  158. ep->word0 &= ~MSIQ_WORD0_FMT_TYPE;
  159. /* Go to next entry in ring. */
  160. (*head)++;
  161. if (*head >= pbm->msiq_ent_count)
  162. *head = 0;
  163. return 1;
  164. }
  165. static int pci_fire_set_head(struct pci_pbm_info *pbm, unsigned long msiqid,
  166. unsigned long head)
  167. {
  168. fire_write(pbm->pbm_regs + EVENT_QUEUE_HEAD(msiqid), head);
  169. return 0;
  170. }
  171. static int pci_fire_msi_setup(struct pci_pbm_info *pbm, unsigned long msiqid,
  172. unsigned long msi, int is_msi64)
  173. {
  174. u64 val;
  175. val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
  176. val &= ~(MSI_MAP_EQNUM);
  177. val |= msiqid;
  178. fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
  179. fire_write(pbm->pbm_regs + MSI_CLEAR(msi),
  180. MSI_CLEAR_EQWR_N);
  181. val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
  182. val |= MSI_MAP_VALID;
  183. fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
  184. return 0;
  185. }
  186. static int pci_fire_msi_teardown(struct pci_pbm_info *pbm, unsigned long msi)
  187. {
  188. unsigned long msiqid;
  189. u64 val;
  190. val = fire_read(pbm->pbm_regs + MSI_MAP(msi));
  191. msiqid = (val & MSI_MAP_EQNUM);
  192. val &= ~MSI_MAP_VALID;
  193. fire_write(pbm->pbm_regs + MSI_MAP(msi), val);
  194. return 0;
  195. }
  196. static int pci_fire_msiq_alloc(struct pci_pbm_info *pbm)
  197. {
  198. unsigned long pages, order, i;
  199. order = get_order(512 * 1024);
  200. pages = __get_free_pages(GFP_KERNEL | __GFP_COMP, order);
  201. if (pages == 0UL) {
  202. printk(KERN_ERR "MSI: Cannot allocate MSI queues (o=%lu).\n",
  203. order);
  204. return -ENOMEM;
  205. }
  206. memset((char *)pages, 0, PAGE_SIZE << order);
  207. pbm->msi_queues = (void *) pages;
  208. fire_write(pbm->pbm_regs + EVENT_QUEUE_BASE_ADDR_REG,
  209. (EVENT_QUEUE_BASE_ADDR_ALL_ONES |
  210. __pa(pbm->msi_queues)));
  211. fire_write(pbm->pbm_regs + IMONDO_DATA0,
  212. pbm->portid << 6);
  213. fire_write(pbm->pbm_regs + IMONDO_DATA1, 0);
  214. fire_write(pbm->pbm_regs + MSI_32BIT_ADDR,
  215. pbm->msi32_start);
  216. fire_write(pbm->pbm_regs + MSI_64BIT_ADDR,
  217. pbm->msi64_start);
  218. for (i = 0; i < pbm->msiq_num; i++) {
  219. fire_write(pbm->pbm_regs + EVENT_QUEUE_HEAD(i), 0);
  220. fire_write(pbm->pbm_regs + EVENT_QUEUE_TAIL(i), 0);
  221. }
  222. return 0;
  223. }
  224. static void pci_fire_msiq_free(struct pci_pbm_info *pbm)
  225. {
  226. unsigned long pages, order;
  227. order = get_order(512 * 1024);
  228. pages = (unsigned long) pbm->msi_queues;
  229. free_pages(pages, order);
  230. pbm->msi_queues = NULL;
  231. }
  232. static int pci_fire_msiq_build_irq(struct pci_pbm_info *pbm,
  233. unsigned long msiqid,
  234. unsigned long devino)
  235. {
  236. unsigned long cregs = (unsigned long) pbm->pbm_regs;
  237. unsigned long imap_reg, iclr_reg, int_ctrlr;
  238. unsigned int virt_irq;
  239. int fixup;
  240. u64 val;
  241. imap_reg = cregs + (0x001000UL + (devino * 0x08UL));
  242. iclr_reg = cregs + (0x001400UL + (devino * 0x08UL));
  243. /* XXX iterate amongst the 4 IRQ controllers XXX */
  244. int_ctrlr = (1UL << 6);
  245. val = fire_read(imap_reg);
  246. val |= (1UL << 63) | int_ctrlr;
  247. fire_write(imap_reg, val);
  248. fixup = ((pbm->portid << 6) | devino) - int_ctrlr;
  249. virt_irq = build_irq(fixup, iclr_reg, imap_reg);
  250. if (!virt_irq)
  251. return -ENOMEM;
  252. fire_write(pbm->pbm_regs +
  253. EVENT_QUEUE_CONTROL_SET(msiqid),
  254. EVENT_QUEUE_CONTROL_SET_EN);
  255. return virt_irq;
  256. }
  257. static const struct sparc64_msiq_ops pci_fire_msiq_ops = {
  258. .get_head = pci_fire_get_head,
  259. .dequeue_msi = pci_fire_dequeue_msi,
  260. .set_head = pci_fire_set_head,
  261. .msi_setup = pci_fire_msi_setup,
  262. .msi_teardown = pci_fire_msi_teardown,
  263. .msiq_alloc = pci_fire_msiq_alloc,
  264. .msiq_free = pci_fire_msiq_free,
  265. .msiq_build_irq = pci_fire_msiq_build_irq,
  266. };
  267. static void pci_fire_msi_init(struct pci_pbm_info *pbm)
  268. {
  269. sparc64_pbm_msi_init(pbm, &pci_fire_msiq_ops);
  270. }
  271. #else /* CONFIG_PCI_MSI */
  272. static void pci_fire_msi_init(struct pci_pbm_info *pbm)
  273. {
  274. }
  275. #endif /* !(CONFIG_PCI_MSI) */
  276. /* Based at pbm->controller_regs */
  277. #define FIRE_PARITY_CONTROL 0x470010UL
  278. #define FIRE_PARITY_ENAB 0x8000000000000000UL
  279. #define FIRE_FATAL_RESET_CTL 0x471028UL
  280. #define FIRE_FATAL_RESET_SPARE 0x0000000004000000UL
  281. #define FIRE_FATAL_RESET_MB 0x0000000002000000UL
  282. #define FIRE_FATAL_RESET_CPE 0x0000000000008000UL
  283. #define FIRE_FATAL_RESET_APE 0x0000000000004000UL
  284. #define FIRE_FATAL_RESET_PIO 0x0000000000000040UL
  285. #define FIRE_FATAL_RESET_JW 0x0000000000000004UL
  286. #define FIRE_FATAL_RESET_JI 0x0000000000000002UL
  287. #define FIRE_FATAL_RESET_JR 0x0000000000000001UL
  288. #define FIRE_CORE_INTR_ENABLE 0x471800UL
  289. /* Based at pbm->pbm_regs */
  290. #define FIRE_TLU_CTRL 0x80000UL
  291. #define FIRE_TLU_CTRL_TIM 0x00000000da000000UL
  292. #define FIRE_TLU_CTRL_QDET 0x0000000000000100UL
  293. #define FIRE_TLU_CTRL_CFG 0x0000000000000001UL
  294. #define FIRE_TLU_DEV_CTRL 0x90008UL
  295. #define FIRE_TLU_LINK_CTRL 0x90020UL
  296. #define FIRE_TLU_LINK_CTRL_CLK 0x0000000000000040UL
  297. #define FIRE_LPU_RESET 0xe2008UL
  298. #define FIRE_LPU_LLCFG 0xe2200UL
  299. #define FIRE_LPU_LLCFG_VC0 0x0000000000000100UL
  300. #define FIRE_LPU_FCTRL_UCTRL 0xe2240UL
  301. #define FIRE_LPU_FCTRL_UCTRL_N 0x0000000000000002UL
  302. #define FIRE_LPU_FCTRL_UCTRL_P 0x0000000000000001UL
  303. #define FIRE_LPU_TXL_FIFOP 0xe2430UL
  304. #define FIRE_LPU_LTSSM_CFG2 0xe2788UL
  305. #define FIRE_LPU_LTSSM_CFG3 0xe2790UL
  306. #define FIRE_LPU_LTSSM_CFG4 0xe2798UL
  307. #define FIRE_LPU_LTSSM_CFG5 0xe27a0UL
  308. #define FIRE_DMC_IENAB 0x31800UL
  309. #define FIRE_DMC_DBG_SEL_A 0x53000UL
  310. #define FIRE_DMC_DBG_SEL_B 0x53008UL
  311. #define FIRE_PEC_IENAB 0x51800UL
  312. static void pci_fire_hw_init(struct pci_pbm_info *pbm)
  313. {
  314. u64 val;
  315. fire_write(pbm->controller_regs + FIRE_PARITY_CONTROL,
  316. FIRE_PARITY_ENAB);
  317. fire_write(pbm->controller_regs + FIRE_FATAL_RESET_CTL,
  318. (FIRE_FATAL_RESET_SPARE |
  319. FIRE_FATAL_RESET_MB |
  320. FIRE_FATAL_RESET_CPE |
  321. FIRE_FATAL_RESET_APE |
  322. FIRE_FATAL_RESET_PIO |
  323. FIRE_FATAL_RESET_JW |
  324. FIRE_FATAL_RESET_JI |
  325. FIRE_FATAL_RESET_JR));
  326. fire_write(pbm->controller_regs + FIRE_CORE_INTR_ENABLE, ~(u64)0);
  327. val = fire_read(pbm->pbm_regs + FIRE_TLU_CTRL);
  328. val |= (FIRE_TLU_CTRL_TIM |
  329. FIRE_TLU_CTRL_QDET |
  330. FIRE_TLU_CTRL_CFG);
  331. fire_write(pbm->pbm_regs + FIRE_TLU_CTRL, val);
  332. fire_write(pbm->pbm_regs + FIRE_TLU_DEV_CTRL, 0);
  333. fire_write(pbm->pbm_regs + FIRE_TLU_LINK_CTRL,
  334. FIRE_TLU_LINK_CTRL_CLK);
  335. fire_write(pbm->pbm_regs + FIRE_LPU_RESET, 0);
  336. fire_write(pbm->pbm_regs + FIRE_LPU_LLCFG,
  337. FIRE_LPU_LLCFG_VC0);
  338. fire_write(pbm->pbm_regs + FIRE_LPU_FCTRL_UCTRL,
  339. (FIRE_LPU_FCTRL_UCTRL_N |
  340. FIRE_LPU_FCTRL_UCTRL_P));
  341. fire_write(pbm->pbm_regs + FIRE_LPU_TXL_FIFOP,
  342. ((0xffff << 16) | (0x0000 << 0)));
  343. fire_write(pbm->pbm_regs + FIRE_LPU_LTSSM_CFG2, 3000000);
  344. fire_write(pbm->pbm_regs + FIRE_LPU_LTSSM_CFG3, 500000);
  345. fire_write(pbm->pbm_regs + FIRE_LPU_LTSSM_CFG4,
  346. (2 << 16) | (140 << 8));
  347. fire_write(pbm->pbm_regs + FIRE_LPU_LTSSM_CFG5, 0);
  348. fire_write(pbm->pbm_regs + FIRE_DMC_IENAB, ~(u64)0);
  349. fire_write(pbm->pbm_regs + FIRE_DMC_DBG_SEL_A, 0);
  350. fire_write(pbm->pbm_regs + FIRE_DMC_DBG_SEL_B, 0);
  351. fire_write(pbm->pbm_regs + FIRE_PEC_IENAB, ~(u64)0);
  352. }
  353. static int pci_fire_pbm_init(struct pci_controller_info *p,
  354. struct device_node *dp, u32 portid)
  355. {
  356. const struct linux_prom64_registers *regs;
  357. struct pci_pbm_info *pbm;
  358. int err;
  359. if ((portid & 1) == 0)
  360. pbm = &p->pbm_A;
  361. else
  362. pbm = &p->pbm_B;
  363. pbm->next = pci_pbm_root;
  364. pci_pbm_root = pbm;
  365. pbm->scan_bus = pci_fire_scan_bus;
  366. pbm->pci_ops = &sun4u_pci_ops;
  367. pbm->config_space_reg_bits = 12;
  368. pbm->index = pci_num_pbms++;
  369. pbm->portid = portid;
  370. pbm->parent = p;
  371. pbm->prom_node = dp;
  372. pbm->name = dp->full_name;
  373. regs = of_get_property(dp, "reg", NULL);
  374. pbm->pbm_regs = regs[0].phys_addr;
  375. pbm->controller_regs = regs[1].phys_addr - 0x410000UL;
  376. printk("%s: SUN4U PCIE Bus Module\n", pbm->name);
  377. pci_determine_mem_io_space(pbm);
  378. pci_get_pbm_props(pbm);
  379. pci_fire_hw_init(pbm);
  380. err = pci_fire_pbm_iommu_init(pbm);
  381. if (err)
  382. return err;
  383. pci_fire_msi_init(pbm);
  384. return 0;
  385. }
  386. static inline int portid_compare(u32 x, u32 y)
  387. {
  388. if (x == (y ^ 1))
  389. return 1;
  390. return 0;
  391. }
  392. void fire_pci_init(struct device_node *dp, const char *model_name)
  393. {
  394. struct pci_controller_info *p;
  395. u32 portid = of_getintprop_default(dp, "portid", 0xff);
  396. struct iommu *iommu;
  397. struct pci_pbm_info *pbm;
  398. for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
  399. if (portid_compare(pbm->portid, portid)) {
  400. if (pci_fire_pbm_init(pbm->parent, dp, portid))
  401. goto fatal_memory_error;
  402. return;
  403. }
  404. }
  405. p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
  406. if (!p)
  407. goto fatal_memory_error;
  408. iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
  409. if (!iommu)
  410. goto fatal_memory_error;
  411. p->pbm_A.iommu = iommu;
  412. iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
  413. if (!iommu)
  414. goto fatal_memory_error;
  415. p->pbm_B.iommu = iommu;
  416. if (pci_fire_pbm_init(p, dp, portid))
  417. goto fatal_memory_error;
  418. return;
  419. fatal_memory_error:
  420. prom_printf("PCI_FIRE: Fatal memory allocation error.\n");
  421. prom_halt();
  422. }