aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/iommu.c')
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 9322f74e1d8b..f9510a5a3e21 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -242,6 +242,7 @@ static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
242 return tce_ret; 242 return tce_ret;
243} 243}
244 244
245#ifdef CONFIG_PCI
245static void iommu_table_setparms(struct pci_controller *phb, 246static void iommu_table_setparms(struct pci_controller *phb,
246 struct device_node *dn, 247 struct device_node *dn,
247 struct iommu_table *tbl) 248 struct iommu_table *tbl)
@@ -478,29 +479,6 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
478 pci_name(dev)); 479 pci_name(dev));
479} 480}
480 481
481static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
482{
483 int err = NOTIFY_OK;
484 struct device_node *np = node;
485 struct pci_dn *pci = PCI_DN(np);
486
487 switch (action) {
488 case PSERIES_RECONFIG_REMOVE:
489 if (pci && pci->iommu_table &&
490 get_property(np, "ibm,dma-window", NULL))
491 iommu_free_table(np);
492 break;
493 default:
494 err = NOTIFY_DONE;
495 break;
496 }
497 return err;
498}
499
500static struct notifier_block iommu_reconfig_nb = {
501 .notifier_call = iommu_reconfig_notifier,
502};
503
504static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) 482static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
505{ 483{
506 struct device_node *pdn, *dn; 484 struct device_node *pdn, *dn;
@@ -554,6 +532,35 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
554 532
555 dev->dev.archdata.dma_data = pci->iommu_table; 533 dev->dev.archdata.dma_data = pci->iommu_table;
556} 534}
535#else /* CONFIG_PCI */
536#define pci_dma_bus_setup_pSeries NULL
537#define pci_dma_dev_setup_pSeries NULL
538#define pci_dma_bus_setup_pSeriesLP NULL
539#define pci_dma_dev_setup_pSeriesLP NULL
540#endif /* !CONFIG_PCI */
541
542static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
543{
544 int err = NOTIFY_OK;
545 struct device_node *np = node;
546 struct pci_dn *pci = PCI_DN(np);
547
548 switch (action) {
549 case PSERIES_RECONFIG_REMOVE:
550 if (pci && pci->iommu_table &&
551 get_property(np, "ibm,dma-window", NULL))
552 iommu_free_table(np);
553 break;
554 default:
555 err = NOTIFY_DONE;
556 break;
557 }
558 return err;
559}
560
561static struct notifier_block iommu_reconfig_nb = {
562 .notifier_call = iommu_reconfig_notifier,
563};
557 564
558/* These are called very early. */ 565/* These are called very early. */
559void iommu_init_early_pSeries(void) 566void iommu_init_early_pSeries(void)