Commit 1918660b authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller

sparc32: fix sparse warning in io-unit.c

Fix following warning:
io-unit.c:56:13: warning: incorrect type in assignment (different address spaces)

The page table for the io unit resides in __iomem.
Fix up all users of the io unit page table.
Introduce sbus helers for all read/write operations.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f977ea49
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
struct iounit_struct { struct iounit_struct {
unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];
spinlock_t lock; spinlock_t lock;
iopte_t *page_table; iopte_t __iomem *page_table;
unsigned long rotor[3]; unsigned long rotor[3];
unsigned long limit[4]; unsigned long limit[4];
}; };
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include "mm_32.h"
/* #define IOUNIT_DEBUG */ /* #define IOUNIT_DEBUG */
#ifdef IOUNIT_DEBUG #ifdef IOUNIT_DEBUG
#define IOD(x) printk(x) #define IOD(x) printk(x)
...@@ -38,7 +40,8 @@ ...@@ -38,7 +40,8 @@
static void __init iounit_iommu_init(struct platform_device *op) static void __init iounit_iommu_init(struct platform_device *op)
{ {
struct iounit_struct *iounit; struct iounit_struct *iounit;
iopte_t *xpt, *xptend; iopte_t __iomem *xpt;
iopte_t __iomem *xptend;
iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
if (!iounit) { if (!iounit) {
...@@ -63,9 +66,9 @@ static void __init iounit_iommu_init(struct platform_device *op) ...@@ -63,9 +66,9 @@ static void __init iounit_iommu_init(struct platform_device *op)
iounit->page_table = xpt; iounit->page_table = xpt;
spin_lock_init(&iounit->lock); spin_lock_init(&iounit->lock);
for (xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t);
xpt < xptend;) for (; xpt < xptend; xpt++)
iopte_val(*xpt++) = 0; sbus_writel(0, xpt);
} }
static int __init iounit_init(void) static int __init iounit_init(void)
...@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); ...@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK);
for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) {
set_bit(scan, iounit->bmap); set_bit(scan, iounit->bmap);
iounit->page_table[scan] = iopte; sbus_writel(iopte, &iounit->page_table[scan]);
} }
IOD(("%08lx\n", vaddr)); IOD(("%08lx\n", vaddr));
return vaddr; return vaddr;
...@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon ...@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
struct iounit_struct *iounit = dev->archdata.iommu; struct iounit_struct *iounit = dev->archdata.iommu;
unsigned long page, end; unsigned long page, end;
pgprot_t dvma_prot; pgprot_t dvma_prot;
iopte_t *iopte; iopte_t __iomem *iopte;
*pba = addr; *pba = addr;
...@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon ...@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
iopte = (iopte_t *)(iounit->page_table + i); iopte = iounit->page_table + i;
*iopte = MKIOPTE(__pa(page)); sbus_writel(MKIOPTE(__pa(page)), iopte);
} }
addr += PAGE_SIZE; addr += PAGE_SIZE;
va += PAGE_SIZE; va += PAGE_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment