]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
sparc32: Make mmu_map_dma_area and mmu_unmap_dma_area take a device pointer.
authorDavid S. Miller <davem@davemloft.net>
Thu, 28 Aug 2008 01:40:38 +0000 (18:40 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Aug 2008 09:15:07 +0000 (02:15 -0700)
This lets us kill this "map it in every IOMMU" crazy code, and also
some of the final references to sbus_root.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/dma.h
arch/sparc/kernel/ioport.c
arch/sparc/mm/io-unit.c
arch/sparc/mm/iommu.c
arch/sparc/mm/sun4c.c

index ee4ac181bf2f6800a6147a4023b6e46cc1854ac6..d1ae56be9fa67506a9e0f9d85e456ac06056c6e5 100644 (file)
@@ -131,11 +131,11 @@ BTFIXUPDEF_CALL(void,  mmu_release_scsi_sgl, struct device *, struct scatterlist
  * know if we are mapping RAM or I/O, so it has to be an additional argument
  * to a separate mapping function for CPU visible mappings.
  */
-BTFIXUPDEF_CALL(int,  mmu_map_dma_area, dma_addr_t *, unsigned long, unsigned long, int len)
-BTFIXUPDEF_CALL(void,  mmu_unmap_dma_area, unsigned long busa, int len)
+BTFIXUPDEF_CALL(int, mmu_map_dma_area, struct device *, dma_addr_t *, unsigned long, unsigned long, int len)
+BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, struct device *, unsigned long busa, int len)
 
-#define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len)
-#define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
+#define mmu_map_dma_area(dev,pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(dev,pba,va,a,len)
+#define mmu_unmap_dma_area(dev,ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(dev,ba,len)
 #endif
 
 #endif /* !(_ASM_SPARC_DMA_H) */
index 82ef2016191044dd8b5f7dbd7417c23f3804a7b4..d65fb9b066885cceed994d4d44b2bc37e00791eb 100644 (file)
@@ -339,7 +339,7 @@ void *sbus_alloc_consistent(struct device *dev, long len, u32 *dma_addrp)
         * XXX That's where sdev would be used. Currently we load
         * all iommu tables with the same translations.
         */
-       if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
+       if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0)
                goto err_noiommu;
 
        res->name = op->node->name;
@@ -384,7 +384,7 @@ void sbus_free_consistent(struct device *dev, long n, void *p, u32 ba)
 
        /* mmu_inval_dma_area(va, n); */ /* it's consistent, isn't it */
        pgv = virt_to_page(p);
-       mmu_unmap_dma_area(ba, n);
+       mmu_unmap_dma_area(dev, ba, n);
 
        __free_pages(pgv, get_order(n));
 }
index 6b469820fb92215fbfdb5d05190e2fe9fe8b27e2..0f97ab30df3f3320c56c7b961c5199085001cc81 100644 (file)
@@ -186,12 +186,12 @@ static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg,
 }
 
 #ifdef CONFIG_SBUS
-static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, int len)
+static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va, __u32 addr, int len)
 {
+       struct iounit_struct *iounit = dev->archdata.iommu;
        unsigned long page, end;
        pgprot_t dvma_prot;
        iopte_t *iopte;
-       struct sbus_bus *sbus;
 
        *pba = addr;
 
@@ -213,12 +213,8 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
                        
                        i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
 
-                       for_each_sbus(sbus) {
-                               struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
-
-                               iopte = (iopte_t *)(iounit->page_table + i);
-                               *iopte = MKIOPTE(__pa(page));
-                       }
+                       iopte = (iopte_t *)(iounit->page_table + i);
+                       *iopte = MKIOPTE(__pa(page));
                }
                addr += PAGE_SIZE;
                va += PAGE_SIZE;
@@ -229,7 +225,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
        return 0;
 }
 
-static void iounit_unmap_dma_area(unsigned long addr, int len)
+static void iounit_unmap_dma_area(struct device *dev, unsigned long addr, int len)
 {
        /* XXX Somebody please fill this in */
 }
index 832d99f334706f9922f4579a9f9fc82ac25ae3d8..2970cea877b11a5befd6fa3858cb1f0917f22d76 100644 (file)
@@ -334,11 +334,11 @@ static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i
 }
 
 #ifdef CONFIG_SBUS
-static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
-    unsigned long addr, int len)
+static int iommu_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va,
+                             unsigned long addr, int len)
 {
+       struct iommu_struct *iommu = dev->archdata.iommu;
        unsigned long page, end;
-       struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
        iopte_t *iopte = iommu->page_table;
        iopte_t *first;
        int ioptex;
@@ -401,9 +401,9 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
        return 0;
 }
 
-static void iommu_unmap_dma_area(unsigned long busa, int len)
+static void iommu_unmap_dma_area(struct device *dev, unsigned long busa, int len)
 {
-       struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
+       struct iommu_struct *iommu = dev->archdata.iommu;
        iopte_t *iopte = iommu->page_table;
        unsigned long end;
        int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
index 65af3119f5ac28754c8ae03cb5e43f20467bef5f..f289e7ce902e6219a3769eda70313dcb40573275 100644 (file)
@@ -532,8 +532,8 @@ static inline void sun4c_init_ss2_cache_bug(void)
 }
 
 /* Addr is always aligned on a page boundary for us already. */
-static int sun4c_map_dma_area(dma_addr_t *pba, unsigned long va,
-    unsigned long addr, int len)
+static int sun4c_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va,
+                             unsigned long addr, int len)
 {
        unsigned long page, end;
 
@@ -555,7 +555,7 @@ static int sun4c_map_dma_area(dma_addr_t *pba, unsigned long va,
        return 0;
 }
 
-static void sun4c_unmap_dma_area(unsigned long busa, int len)
+static void sun4c_unmap_dma_area(struct device *dev, unsigned long busa, int len)
 {
        /* Fortunately for us, bus_addr == uncached_virt in sun4c. */
        /* XXX Implement this */