pci.c 16 KB

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