pseries/iommu: Restore_default_window does not use liobn parameter
[deliverable/linux.git] / arch / powerpc / platforms / pseries / iommu.c
index 6153eea27ce7d39ea51fb4d1f210be2a1934bfdf..a8e99f9c3b41fa3462b431ac742f898aaac01f6f 100644 (file)
 #include <linux/dma-mapping.h>
 #include <linux/crash_dump.h>
 #include <linux/memory.h>
+#include <linux/of.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/iommu.h>
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/firmware.h>
 #include <asm/tce.h>
 #include <asm/ppc-pci.h>
@@ -382,6 +382,7 @@ static int tce_clearrange_multi_pSeriesLP(unsigned long start_pfn,
                rc = plpar_tce_stuff((u64)be32_to_cpu(maprange->liobn),
                                             dma_offset,
                                             0, limit);
+               next += limit * tce_size;
                num_tce -= limit;
        } while (num_tce > 0 && !rc);
 
@@ -760,7 +761,7 @@ static void remove_ddw(struct device_node *np)
        __remove_ddw(np, ddw_avail, liobn);
 
 delprop:
-       ret = prom_remove_property(np, win64);
+       ret = of_remove_property(np, win64);
        if (ret)
                pr_warning("%s: failed to remove direct window property: %d\n",
                        np->full_name, ret);
@@ -883,7 +884,7 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
 }
 
 static void restore_default_window(struct pci_dev *dev,
-                               u32 ddw_restore_token, unsigned long liobn)
+                                       u32 ddw_restore_token)
 {
        struct eeh_dev *edev;
        u32 cfg_addr;
@@ -1070,7 +1071,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
                goto out_free_window;
        }
 
-       ret = prom_add_property(pdn, win64);
+       ret = of_add_property(pdn, win64);
        if (ret) {
                dev_err(&dev->dev, "unable to add dma window property for %s: %d",
                         pdn->full_name, ret);
@@ -1099,7 +1100,7 @@ out_free_prop:
 
 out_restore_window:
        if (ddw_restore_token)
-               restore_default_window(dev, ddw_restore_token, liobn);
+               restore_default_window(dev, ddw_restore_token);
 
 out_unlock:
        mutex_unlock(&direct_window_init_mutex);
@@ -1294,7 +1295,8 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
        struct direct_window *window;
 
        switch (action) {
-       case PSERIES_RECONFIG_REMOVE:
+       case OF_RECONFIG_DETACH_NODE:
+               remove_ddw(np);
                if (pci && pci->iommu_table)
                        iommu_free_table(pci->iommu_table, np->full_name);
 
@@ -1307,16 +1309,6 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
                        }
                }
                spin_unlock(&direct_window_list_lock);
-
-               /*
-                * Because the notifier runs after isolation of the
-                * slot, we are guaranteed any DMA window has already
-                * been revoked and the TCEs have been marked invalid,
-                * so we don't need a call to remove_ddw(np). However,
-                * if an additional notifier action is added before the
-                * isolate call, we should update this code for
-                * completeness with such a call.
-                */
                break;
        default:
                err = NOTIFY_DONE;
@@ -1357,7 +1349,7 @@ void iommu_init_early_pSeries(void)
        }
 
 
-       pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
+       of_reconfig_notifier_register(&iommu_reconfig_nb);
        register_memory_notifier(&iommu_mem_nb);
 
        set_pci_dma_ops(&dma_iommu_ops);
This page took 0.036287 seconds and 5 git commands to generate.