Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
[sfrench/cifs-2.6.git] / arch / x86_64 / kernel / tce.c
index 5530dda3f27ac3b84ec63a6e4f96662f4f50abc3..821527e7faa327fc85727c0f81120fde453b84e9 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * This file manages the translation entries for the IBM Calgary IOMMU.
+ *
  * Derived from arch/powerpc/platforms/pseries/iommu.c
  *
  * Copyright (C) IBM Corporation, 2006
@@ -21,7 +23,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -104,14 +105,6 @@ static int tce_table_setparms(struct pci_dev *dev, struct iommu_table *tbl)
        /* set the tce table size - measured in entries */
        tbl->it_size = table_size_to_number_of_entries(specified_table_size);
 
-       tbl->it_base = (unsigned long)tce_table_kva[dev->bus->number];
-       if (!tbl->it_base) {
-               printk(KERN_ERR "Calgary: iommu_table_setparms: "
-                      "no table allocated?!\n");
-               ret = -ENOMEM;
-               goto done;
-       }
-
        /*
         * number of bytes needed for the bitmap size in number of
         * entries; we need one bit per entry
@@ -143,9 +136,9 @@ int build_tce_table(struct pci_dev *dev, void __iomem *bbar)
        struct iommu_table *tbl;
        int ret;
 
-       if (dev->sysdata) {
-               printk(KERN_ERR "Calgary: dev %p has sysdata %p\n",
-                      dev, dev->sysdata);
+       if (pci_iommu(dev->bus)) {
+               printk(KERN_ERR "Calgary: dev %p has sysdata->iommu %p\n",
+                      dev, pci_iommu(dev->bus));
                BUG();
        }
 
@@ -160,15 +153,9 @@ int build_tce_table(struct pci_dev *dev, void __iomem *bbar)
        if (ret)
                goto free_tbl;
 
-       tce_free(tbl, 0, tbl->it_size);
-
        tbl->bbar = bbar;
 
-       /*
-        * NUMA is already using the bus's sysdata pointer, so we use
-        * the bus's pci_dev's sysdata instead.
-        */
-       dev->sysdata = tbl;
+       set_pci_iommu(dev->bus, tbl);
 
        return 0;
 
@@ -178,7 +165,7 @@ done:
        return ret;
 }
 
-void* alloc_tce_table(void)
+void * __init alloc_tce_table(void)
 {
        unsigned int size;
 
@@ -188,7 +175,7 @@ void* alloc_tce_table(void)
        return __alloc_bootmem_low(size, size, 0);
 }
 
-void free_tce_table(void *tbl)
+void __init free_tce_table(void *tbl)
 {
        unsigned int size;