]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/iseries/iommu.c
[PATCH] powerpc: split device tree stuff out of iseries/setup.c
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / iseries / iommu.c
index 3ac22065c424bf0690bd162c0e69369384e41079..a992f6af249fe081af06753b145f6b68bf1a8bd9 100644 (file)
 #include <asm/tce.h>
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
+#include <asm/prom.h>
 #include <asm/pci-bridge.h>
 #include <asm/iseries/hv_call_xm.h>
 #include <asm/iseries/iommu.h>
 
-extern struct list_head iSeries_Global_Device_List;
-
-
 static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
                unsigned long uaddr, enum dma_data_direction direction)
 {
@@ -140,10 +138,15 @@ void iommu_table_getparms_iSeries(unsigned long busno,
  */
 static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
 {
-       struct pci_dn *pdn;
+       struct device_node *node;
 
-       list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) {
-               struct iommu_table *it = pdn->iommu_table;
+       for (node = NULL; (node = of_find_all_nodes(node)); ) {
+               struct pci_dn *pdn = PCI_DN(node);
+               struct iommu_table *it;
+
+               if (pdn == NULL)
+                       continue;
+               it = pdn->iommu_table;
                if ((it != NULL) &&
                    (it->it_type == TCE_PCI) &&
                    (it->it_offset == tbl->it_offset) &&
@@ -159,10 +162,13 @@ void iommu_devnode_init_iSeries(struct device_node *dn)
 {
        struct iommu_table *tbl;
        struct pci_dn *pdn = PCI_DN(dn);
+       u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL);
+
+       BUG_ON(lsn == NULL);
 
        tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
 
-       iommu_table_getparms_iSeries(pdn->busno, pdn->LogicalSlot, 0, tbl);
+       iommu_table_getparms_iSeries(pdn->busno, *lsn, 0, tbl);
 
        /* Look for existing tce table */
        pdn->iommu_table = iommu_table_find(tbl);