linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / sparc / kernel / ioport.c
index c47650d..d39c9f2 100644 (file)
 #include <asm/oplib.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
-#include <asm/pgtable.h>
+#include <asm/dma.h>
 
 #define mmu_inval_dma_area(p, l)       /* Anton pulled it out for 2.4.0-xx */
 
 struct resource *_sparc_find_resource(struct resource *r, unsigned long);
 
-static void *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
-static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
+static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
+static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
     unsigned long size, char *name);
 static void _sparc_free_io(struct resource *res);
 
 /* This points to the next to use virtual memory for DVMA mappings */
 static struct resource _sparc_dvma = {
-       "sparc_dvma", DVMA_VADDR, DVMA_END - 1
+       .name = "sparc_dvma", .start = DVMA_VADDR, .end = DVMA_END - 1
 };
 /* This points to the start of I/O mappings, cluable from outside. */
 /*ext*/ struct resource sparc_iomap = {
-       "sparc_iomap", IOBASE_VADDR, IOBASE_END - 1
+       .name = "sparc_iomap", .start = IOBASE_VADDR, .end = IOBASE_END - 1
 };
 
 /*
@@ -103,7 +103,7 @@ static void xres_free(struct xresource *xrp) {
  *
  * Bus type is always zero on IIep.
  */
-void *ioremap(unsigned long offset, unsigned long size)
+void __iomem *ioremap(unsigned long offset, unsigned long size)
 {
        char name[14];
 
@@ -114,7 +114,7 @@ void *ioremap(unsigned long offset, unsigned long size)
 /*
  * Comlimentary to ioremap().
  */
-void iounmap(void *virtual)
+void iounmap(volatile void __iomem *virtual)
 {
        unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
        struct resource *res;
@@ -134,24 +134,24 @@ void iounmap(void *virtual)
 
 /*
  */
-unsigned long sbus_ioremap(struct resource *phyres, unsigned long offset,
+void __iomem *sbus_ioremap(struct resource *phyres, unsigned long offset,
     unsigned long size, char *name)
 {
-       return (unsigned long) _sparc_alloc_io(phyres->flags & 0xF,
+       return _sparc_alloc_io(phyres->flags & 0xF,
            phyres->start + offset, size, name);
 }
 
 /*
  */
-void sbus_iounmap(unsigned long addr, unsigned long size)
+void sbus_iounmap(volatile void __iomem *addr, unsigned long size)
 {
-       iounmap((void *)addr);
+       iounmap(addr);
 }
 
 /*
  * Meat of mapping
  */
-static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
+static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
     unsigned long size, char *name)
 {
        static int printed_full;
@@ -159,7 +159,7 @@ static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
        struct resource *res;
        char *tack;
        int tlen;
-       void *va;       /* P3 diag */
+       void __iomem *va;       /* P3 diag */
 
        if (name == NULL) name = "???";
 
@@ -189,7 +189,7 @@ static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
 
 /*
  */
-static void *
+static void __iomem *
 _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
 {
        unsigned long offset = ((unsigned long) pa) & (~PAGE_MASK);
@@ -206,7 +206,7 @@ _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
        pa &= PAGE_MASK;
        sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1);
 
-       return (void *) (res->start + offset);
+       return (void __iomem *) (res->start + offset);
 }
 
 /*
@@ -252,7 +252,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
        }
 
        order = get_order(len_total);
-       if ((va = __get_free_pages(GFP_KERNEL, order)) == 0)
+       if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
                goto err_nopages;
 
        if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
@@ -725,7 +725,7 @@ _sparc_find_resource(struct resource *root, unsigned long hit)
 void register_proc_sparc_ioport(void)
 {
 #ifdef CONFIG_PROC_FS
-       create_proc_read_entry("io_map",0,0,_sparc_io_get_info,&sparc_iomap);
-       create_proc_read_entry("dvma_map",0,0,_sparc_io_get_info,&_sparc_dvma);
+       create_proc_read_entry("io_map",0,NULL,_sparc_io_get_info,&sparc_iomap);
+       create_proc_read_entry("dvma_map",0,NULL,_sparc_io_get_info,&_sparc_dvma);
 #endif
 }