pci_fire.c 14 KB

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