pci.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /*
  2. * Support PCI/PCIe on PowerNV platforms
  3. *
  4. * Currently supports only P5IOC2
  5. *
  6. * Copyright 2011 Benjamin Herrenschmidt, IBM Corp.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/pci.h>
  15. #include <linux/delay.h>
  16. #include <linux/string.h>
  17. #include <linux/init.h>
  18. #include <linux/bootmem.h>
  19. #include <linux/irq.h>
  20. #include <linux/io.h>
  21. #include <linux/msi.h>
  22. #include <linux/iommu.h>
  23. #include <asm/sections.h>
  24. #include <asm/io.h>
  25. #include <asm/prom.h>
  26. #include <asm/pci-bridge.h>
  27. #include <asm/machdep.h>
  28. #include <asm/msi_bitmap.h>
  29. #include <asm/ppc-pci.h>
  30. #include <asm/opal.h>
  31. #include <asm/iommu.h>
  32. #include <asm/tce.h>
  33. #include <asm/firmware.h>
  34. #include "powernv.h"
  35. #include "pci.h"
  36. /* Delay in usec */
  37. #define PCI_RESET_DELAY_US 3000000
  38. #define cfg_dbg(fmt...) do { } while(0)
  39. //#define cfg_dbg(fmt...) printk(fmt)
  40. #ifdef CONFIG_PCI_MSI
  41. static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
  42. {
  43. struct pci_controller *hose = pci_bus_to_host(pdev->bus);
  44. struct pnv_phb *phb = hose->private_data;
  45. struct pci_dn *pdn = pci_get_pdn(pdev);
  46. if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
  47. return -ENODEV;
  48. return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
  49. }
  50. static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
  51. {
  52. struct pci_controller *hose = pci_bus_to_host(pdev->bus);
  53. struct pnv_phb *phb = hose->private_data;
  54. struct msi_desc *entry;
  55. struct msi_msg msg;
  56. int hwirq;
  57. unsigned int virq;
  58. int rc;
  59. if (WARN_ON(!phb))
  60. return -ENODEV;
  61. list_for_each_entry(entry, &pdev->msi_list, list) {
  62. if (!entry->msi_attrib.is_64 && !phb->msi32_support) {
  63. pr_warn("%s: Supports only 64-bit MSIs\n",
  64. pci_name(pdev));
  65. return -ENXIO;
  66. }
  67. hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, 1);
  68. if (hwirq < 0) {
  69. pr_warn("%s: Failed to find a free MSI\n",
  70. pci_name(pdev));
  71. return -ENOSPC;
  72. }
  73. virq = irq_create_mapping(NULL, phb->msi_base + hwirq);
  74. if (virq == NO_IRQ) {
  75. pr_warn("%s: Failed to map MSI to linux irq\n",
  76. pci_name(pdev));
  77. msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq, 1);
  78. return -ENOMEM;
  79. }
  80. rc = phb->msi_setup(phb, pdev, phb->msi_base + hwirq,
  81. virq, entry->msi_attrib.is_64, &msg);
  82. if (rc) {
  83. pr_warn("%s: Failed to setup MSI\n", pci_name(pdev));
  84. irq_dispose_mapping(virq);
  85. msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq, 1);
  86. return rc;
  87. }
  88. irq_set_msi_desc(virq, entry);
  89. write_msi_msg(virq, &msg);
  90. }
  91. return 0;
  92. }
  93. static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
  94. {
  95. struct pci_controller *hose = pci_bus_to_host(pdev->bus);
  96. struct pnv_phb *phb = hose->private_data;
  97. struct msi_desc *entry;
  98. if (WARN_ON(!phb))
  99. return;
  100. list_for_each_entry(entry, &pdev->msi_list, list) {
  101. if (entry->irq == NO_IRQ)
  102. continue;
  103. irq_set_msi_desc(entry->irq, NULL);
  104. msi_bitmap_free_hwirqs(&phb->msi_bmp,
  105. virq_to_hw(entry->irq) - phb->msi_base, 1);
  106. irq_dispose_mapping(entry->irq);
  107. }
  108. }
  109. #endif /* CONFIG_PCI_MSI */
  110. static void pnv_pci_dump_p7ioc_diag_data(struct pnv_phb *phb)
  111. {
  112. struct OpalIoP7IOCPhbErrorData *data = &phb->diag.p7ioc;
  113. int i;
  114. pr_info("PHB %d diagnostic data:\n", phb->hose->global_number);
  115. pr_info(" brdgCtl = 0x%08x\n", data->brdgCtl);
  116. pr_info(" portStatusReg = 0x%08x\n", data->portStatusReg);
  117. pr_info(" rootCmplxStatus = 0x%08x\n", data->rootCmplxStatus);
  118. pr_info(" busAgentStatus = 0x%08x\n", data->busAgentStatus);
  119. pr_info(" deviceStatus = 0x%08x\n", data->deviceStatus);
  120. pr_info(" slotStatus = 0x%08x\n", data->slotStatus);
  121. pr_info(" linkStatus = 0x%08x\n", data->linkStatus);
  122. pr_info(" devCmdStatus = 0x%08x\n", data->devCmdStatus);
  123. pr_info(" devSecStatus = 0x%08x\n", data->devSecStatus);
  124. pr_info(" rootErrorStatus = 0x%08x\n", data->rootErrorStatus);
  125. pr_info(" uncorrErrorStatus = 0x%08x\n", data->uncorrErrorStatus);
  126. pr_info(" corrErrorStatus = 0x%08x\n", data->corrErrorStatus);
  127. pr_info(" tlpHdr1 = 0x%08x\n", data->tlpHdr1);
  128. pr_info(" tlpHdr2 = 0x%08x\n", data->tlpHdr2);
  129. pr_info(" tlpHdr3 = 0x%08x\n", data->tlpHdr3);
  130. pr_info(" tlpHdr4 = 0x%08x\n", data->tlpHdr4);
  131. pr_info(" sourceId = 0x%08x\n", data->sourceId);
  132. pr_info(" errorClass = 0x%016llx\n", data->errorClass);
  133. pr_info(" correlator = 0x%016llx\n", data->correlator);
  134. pr_info(" p7iocPlssr = 0x%016llx\n", data->p7iocPlssr);
  135. pr_info(" p7iocCsr = 0x%016llx\n", data->p7iocCsr);
  136. pr_info(" lemFir = 0x%016llx\n", data->lemFir);
  137. pr_info(" lemErrorMask = 0x%016llx\n", data->lemErrorMask);
  138. pr_info(" lemWOF = 0x%016llx\n", data->lemWOF);
  139. pr_info(" phbErrorStatus = 0x%016llx\n", data->phbErrorStatus);
  140. pr_info(" phbFirstErrorStatus = 0x%016llx\n", data->phbFirstErrorStatus);
  141. pr_info(" phbErrorLog0 = 0x%016llx\n", data->phbErrorLog0);
  142. pr_info(" phbErrorLog1 = 0x%016llx\n", data->phbErrorLog1);
  143. pr_info(" mmioErrorStatus = 0x%016llx\n", data->mmioErrorStatus);
  144. pr_info(" mmioFirstErrorStatus = 0x%016llx\n", data->mmioFirstErrorStatus);
  145. pr_info(" mmioErrorLog0 = 0x%016llx\n", data->mmioErrorLog0);
  146. pr_info(" mmioErrorLog1 = 0x%016llx\n", data->mmioErrorLog1);
  147. pr_info(" dma0ErrorStatus = 0x%016llx\n", data->dma0ErrorStatus);
  148. pr_info(" dma0FirstErrorStatus = 0x%016llx\n", data->dma0FirstErrorStatus);
  149. pr_info(" dma0ErrorLog0 = 0x%016llx\n", data->dma0ErrorLog0);
  150. pr_info(" dma0ErrorLog1 = 0x%016llx\n", data->dma0ErrorLog1);
  151. pr_info(" dma1ErrorStatus = 0x%016llx\n", data->dma1ErrorStatus);
  152. pr_info(" dma1FirstErrorStatus = 0x%016llx\n", data->dma1FirstErrorStatus);
  153. pr_info(" dma1ErrorLog0 = 0x%016llx\n", data->dma1ErrorLog0);
  154. pr_info(" dma1ErrorLog1 = 0x%016llx\n", data->dma1ErrorLog1);
  155. for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
  156. if ((data->pestA[i] >> 63) == 0 &&
  157. (data->pestB[i] >> 63) == 0)
  158. continue;
  159. pr_info(" PE[%3d] PESTA = 0x%016llx\n", i, data->pestA[i]);
  160. pr_info(" PESTB = 0x%016llx\n", data->pestB[i]);
  161. }
  162. }
  163. static void pnv_pci_dump_phb_diag_data(struct pnv_phb *phb)
  164. {
  165. switch(phb->model) {
  166. case PNV_PHB_MODEL_P7IOC:
  167. pnv_pci_dump_p7ioc_diag_data(phb);
  168. break;
  169. default:
  170. pr_warning("PCI %d: Can't decode this PHB diag data\n",
  171. phb->hose->global_number);
  172. }
  173. }
  174. static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
  175. {
  176. unsigned long flags, rc;
  177. int has_diag;
  178. spin_lock_irqsave(&phb->lock, flags);
  179. rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
  180. PNV_PCI_DIAG_BUF_SIZE);
  181. has_diag = (rc == OPAL_SUCCESS);
  182. rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no,
  183. OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
  184. if (rc) {
  185. pr_warning("PCI %d: Failed to clear EEH freeze state"
  186. " for PE#%d, err %ld\n",
  187. phb->hose->global_number, pe_no, rc);
  188. /* For now, let's only display the diag buffer when we fail to clear
  189. * the EEH status. We'll do more sensible things later when we have
  190. * proper EEH support. We need to make sure we don't pollute ourselves
  191. * with the normal errors generated when probing empty slots
  192. */
  193. if (has_diag)
  194. pnv_pci_dump_phb_diag_data(phb);
  195. else
  196. pr_warning("PCI %d: No diag data available\n",
  197. phb->hose->global_number);
  198. }
  199. spin_unlock_irqrestore(&phb->lock, flags);
  200. }
  201. static void pnv_pci_config_check_eeh(struct pnv_phb *phb, struct pci_bus *bus,
  202. u32 bdfn)
  203. {
  204. s64 rc;
  205. u8 fstate;
  206. u16 pcierr;
  207. u32 pe_no;
  208. /* Get PE# if we support IODA */
  209. pe_no = phb->bdfn_to_pe ? phb->bdfn_to_pe(phb, bus, bdfn & 0xff) : 0;
  210. /* Read freeze status */
  211. rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr,
  212. NULL);
  213. if (rc) {
  214. pr_warning("PCI %d: Failed to read EEH status for PE#%d,"
  215. " err %lld\n", phb->hose->global_number, pe_no, rc);
  216. return;
  217. }
  218. cfg_dbg(" -> EEH check, bdfn=%04x PE%d fstate=%x\n",
  219. bdfn, pe_no, fstate);
  220. if (fstate != 0)
  221. pnv_pci_handle_eeh_config(phb, pe_no);
  222. }
  223. static int pnv_pci_read_config(struct pci_bus *bus,
  224. unsigned int devfn,
  225. int where, int size, u32 *val)
  226. {
  227. struct pci_controller *hose = pci_bus_to_host(bus);
  228. struct pnv_phb *phb = hose->private_data;
  229. u32 bdfn = (((uint64_t)bus->number) << 8) | devfn;
  230. s64 rc;
  231. if (hose == NULL)
  232. return PCIBIOS_DEVICE_NOT_FOUND;
  233. switch (size) {
  234. case 1: {
  235. u8 v8;
  236. rc = opal_pci_config_read_byte(phb->opal_id, bdfn, where, &v8);
  237. *val = (rc == OPAL_SUCCESS) ? v8 : 0xff;
  238. break;
  239. }
  240. case 2: {
  241. u16 v16;
  242. rc = opal_pci_config_read_half_word(phb->opal_id, bdfn, where,
  243. &v16);
  244. *val = (rc == OPAL_SUCCESS) ? v16 : 0xffff;
  245. break;
  246. }
  247. case 4: {
  248. u32 v32;
  249. rc = opal_pci_config_read_word(phb->opal_id, bdfn, where, &v32);
  250. *val = (rc == OPAL_SUCCESS) ? v32 : 0xffffffff;
  251. break;
  252. }
  253. default:
  254. return PCIBIOS_FUNC_NOT_SUPPORTED;
  255. }
  256. cfg_dbg("pnv_pci_read_config bus: %x devfn: %x +%x/%x -> %08x\n",
  257. bus->number, devfn, where, size, *val);
  258. /* Check if the PHB got frozen due to an error (no response) */
  259. pnv_pci_config_check_eeh(phb, bus, bdfn);
  260. return PCIBIOS_SUCCESSFUL;
  261. }
  262. static int pnv_pci_write_config(struct pci_bus *bus,
  263. unsigned int devfn,
  264. int where, int size, u32 val)
  265. {
  266. struct pci_controller *hose = pci_bus_to_host(bus);
  267. struct pnv_phb *phb = hose->private_data;
  268. u32 bdfn = (((uint64_t)bus->number) << 8) | devfn;
  269. if (hose == NULL)
  270. return PCIBIOS_DEVICE_NOT_FOUND;
  271. cfg_dbg("pnv_pci_write_config bus: %x devfn: %x +%x/%x -> %08x\n",
  272. bus->number, devfn, where, size, val);
  273. switch (size) {
  274. case 1:
  275. opal_pci_config_write_byte(phb->opal_id, bdfn, where, val);
  276. break;
  277. case 2:
  278. opal_pci_config_write_half_word(phb->opal_id, bdfn, where, val);
  279. break;
  280. case 4:
  281. opal_pci_config_write_word(phb->opal_id, bdfn, where, val);
  282. break;
  283. default:
  284. return PCIBIOS_FUNC_NOT_SUPPORTED;
  285. }
  286. /* Check if the PHB got frozen due to an error (no response) */
  287. pnv_pci_config_check_eeh(phb, bus, bdfn);
  288. return PCIBIOS_SUCCESSFUL;
  289. }
  290. struct pci_ops pnv_pci_ops = {
  291. .read = pnv_pci_read_config,
  292. .write = pnv_pci_write_config,
  293. };
  294. static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
  295. unsigned long uaddr, enum dma_data_direction direction,
  296. struct dma_attrs *attrs)
  297. {
  298. u64 proto_tce;
  299. u64 *tcep, *tces;
  300. u64 rpn;
  301. proto_tce = TCE_PCI_READ; // Read allowed
  302. if (direction != DMA_TO_DEVICE)
  303. proto_tce |= TCE_PCI_WRITE;
  304. tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset;
  305. rpn = __pa(uaddr) >> TCE_SHIFT;
  306. while (npages--)
  307. *(tcep++) = proto_tce | (rpn++ << TCE_RPN_SHIFT);
  308. /* Some implementations won't cache invalid TCEs and thus may not
  309. * need that flush. We'll probably turn it_type into a bit mask
  310. * of flags if that becomes the case
  311. */
  312. if (tbl->it_type & TCE_PCI_SWINV_CREATE)
  313. pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1);
  314. return 0;
  315. }
  316. static void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
  317. {
  318. u64 *tcep, *tces;
  319. tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset;
  320. while (npages--)
  321. *(tcep++) = 0;
  322. if (tbl->it_type & TCE_PCI_SWINV_FREE)
  323. pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1);
  324. }
  325. static unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
  326. {
  327. return ((u64 *)tbl->it_base)[index - tbl->it_offset];
  328. }
  329. void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
  330. void *tce_mem, u64 tce_size,
  331. u64 dma_offset)
  332. {
  333. tbl->it_blocksize = 16;
  334. tbl->it_base = (unsigned long)tce_mem;
  335. tbl->it_offset = dma_offset >> IOMMU_PAGE_SHIFT;
  336. tbl->it_index = 0;
  337. tbl->it_size = tce_size >> 3;
  338. tbl->it_busno = 0;
  339. tbl->it_type = TCE_PCI;
  340. }
  341. static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
  342. {
  343. struct iommu_table *tbl;
  344. const __be64 *basep, *swinvp;
  345. const __be32 *sizep;
  346. basep = of_get_property(hose->dn, "linux,tce-base", NULL);
  347. sizep = of_get_property(hose->dn, "linux,tce-size", NULL);
  348. if (basep == NULL || sizep == NULL) {
  349. pr_err("PCI: %s has missing tce entries !\n",
  350. hose->dn->full_name);
  351. return NULL;
  352. }
  353. tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, hose->node);
  354. if (WARN_ON(!tbl))
  355. return NULL;
  356. pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)),
  357. be32_to_cpup(sizep), 0);
  358. iommu_init_table(tbl, hose->node);
  359. iommu_register_group(tbl, pci_domain_nr(hose->bus), 0);
  360. /* Deal with SW invalidated TCEs when needed (BML way) */
  361. swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info",
  362. NULL);
  363. if (swinvp) {
  364. tbl->it_busno = swinvp[1];
  365. tbl->it_index = (unsigned long)ioremap(swinvp[0], 8);
  366. tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
  367. }
  368. return tbl;
  369. }
  370. static void pnv_pci_dma_fallback_setup(struct pci_controller *hose,
  371. struct pci_dev *pdev)
  372. {
  373. struct device_node *np = pci_bus_to_OF_node(hose->bus);
  374. struct pci_dn *pdn;
  375. if (np == NULL)
  376. return;
  377. pdn = PCI_DN(np);
  378. if (!pdn->iommu_table)
  379. pdn->iommu_table = pnv_pci_setup_bml_iommu(hose);
  380. if (!pdn->iommu_table)
  381. return;
  382. set_iommu_table_base(&pdev->dev, pdn->iommu_table);
  383. }
  384. static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
  385. {
  386. struct pci_controller *hose = pci_bus_to_host(pdev->bus);
  387. struct pnv_phb *phb = hose->private_data;
  388. /* If we have no phb structure, try to setup a fallback based on
  389. * the device-tree (RTAS PCI for example)
  390. */
  391. if (phb && phb->dma_dev_setup)
  392. phb->dma_dev_setup(phb, pdev);
  393. else
  394. pnv_pci_dma_fallback_setup(hose, pdev);
  395. }
  396. void pnv_pci_shutdown(void)
  397. {
  398. struct pci_controller *hose;
  399. list_for_each_entry(hose, &hose_list, list_node) {
  400. struct pnv_phb *phb = hose->private_data;
  401. if (phb && phb->shutdown)
  402. phb->shutdown(phb);
  403. }
  404. }
  405. /* Fixup wrong class code in p7ioc and p8 root complex */
  406. static void pnv_p7ioc_rc_quirk(struct pci_dev *dev)
  407. {
  408. dev->class = PCI_CLASS_BRIDGE_PCI << 8;
  409. }
  410. DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x3b9, pnv_p7ioc_rc_quirk);
  411. static int pnv_pci_probe_mode(struct pci_bus *bus)
  412. {
  413. struct pci_controller *hose = pci_bus_to_host(bus);
  414. const __be64 *tstamp;
  415. u64 now, target;
  416. /* We hijack this as a way to ensure we have waited long
  417. * enough since the reset was lifted on the PCI bus
  418. */
  419. if (bus != hose->bus)
  420. return PCI_PROBE_NORMAL;
  421. tstamp = of_get_property(hose->dn, "reset-clear-timestamp", NULL);
  422. if (!tstamp || !*tstamp)
  423. return PCI_PROBE_NORMAL;
  424. now = mftb() / tb_ticks_per_usec;
  425. target = (be64_to_cpup(tstamp) / tb_ticks_per_usec)
  426. + PCI_RESET_DELAY_US;
  427. pr_devel("pci %04d: Reset target: 0x%llx now: 0x%llx\n",
  428. hose->global_number, target, now);
  429. if (now < target)
  430. msleep((target - now + 999) / 1000);
  431. return PCI_PROBE_NORMAL;
  432. }
  433. void __init pnv_pci_init(void)
  434. {
  435. struct device_node *np;
  436. pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN);
  437. /* OPAL absent, try POPAL first then RTAS detection of PHBs */
  438. if (!firmware_has_feature(FW_FEATURE_OPAL)) {
  439. #ifdef CONFIG_PPC_POWERNV_RTAS
  440. init_pci_config_tokens();
  441. find_and_init_phbs();
  442. #endif /* CONFIG_PPC_POWERNV_RTAS */
  443. }
  444. /* OPAL is here, do our normal stuff */
  445. else {
  446. int found_ioda = 0;
  447. /* Look for IODA IO-Hubs. We don't support mixing IODA
  448. * and p5ioc2 due to the need to change some global
  449. * probing flags
  450. */
  451. for_each_compatible_node(np, NULL, "ibm,ioda-hub") {
  452. pnv_pci_init_ioda_hub(np);
  453. found_ioda = 1;
  454. }
  455. /* Look for p5ioc2 IO-Hubs */
  456. if (!found_ioda)
  457. for_each_compatible_node(np, NULL, "ibm,p5ioc2")
  458. pnv_pci_init_p5ioc2_hub(np);
  459. /* Look for ioda2 built-in PHB3's */
  460. for_each_compatible_node(np, NULL, "ibm,ioda2-phb")
  461. pnv_pci_init_ioda2_phb(np);
  462. }
  463. /* Setup the linkage between OF nodes and PHBs */
  464. pci_devs_phb_init();
  465. /* Configure IOMMU DMA hooks */
  466. ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup;
  467. ppc_md.tce_build = pnv_tce_build;
  468. ppc_md.tce_free = pnv_tce_free;
  469. ppc_md.tce_get = pnv_tce_get;
  470. ppc_md.pci_probe_mode = pnv_pci_probe_mode;
  471. set_pci_dma_ops(&dma_iommu_ops);
  472. /* Configure MSIs */
  473. #ifdef CONFIG_PCI_MSI
  474. ppc_md.msi_check_device = pnv_msi_check_device;
  475. ppc_md.setup_msi_irqs = pnv_setup_msi_irqs;
  476. ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
  477. #endif
  478. }