Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] sh: I/O routine cleanups and ioremap() overhaul

This introduces a few changes in the way that the I/O routines are defined on
SH, specifically so that things like the iomap API properly wrap through the
machvec for board-specific quirks.

In addition to this, the old p3_ioremap() work is converted to a more generic
__ioremap() that will map through the PMB if it's available, or fall back on
page tables for everything else.

An alpha-like IO_CONCAT is also added so we can start to clean up the
board-specific io.h mess, which will be handled in board update patches..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Paul Mundt and committed by
Linus Torvalds
b66c1a39 bf3a00f8

+423 -320
+28 -13
arch/sh/kernel/io.c
··· 2 2 * linux/arch/sh/kernel/io.c 3 3 * 4 4 * Copyright (C) 2000 Stuart Menefy 5 + * Copyright (C) 2005 Paul Mundt 5 6 * 6 7 * Provide real functions which expand to whatever the header file defined. 7 8 * Also definitions of machine independent IO functions. 9 + * 10 + * This file is subject to the terms and conditions of the GNU General Public 11 + * License. See the file "COPYING" in the main directory of this archive 12 + * for more details. 8 13 */ 9 - 10 - #include <asm/io.h> 11 14 #include <linux/module.h> 15 + #include <asm/machvec.h> 16 + #include <asm/io.h> 12 17 13 18 /* 14 19 * Copy data from IO memory space to "real" memory space. 15 20 * This needs to be optimized. 16 21 */ 17 - void memcpy_fromio(void * to, unsigned long from, unsigned long count) 22 + void memcpy_fromio(void *to, volatile void __iomem *from, unsigned long count) 18 23 { 19 24 char *p = to; 20 25 while (count) { 21 26 count--; 22 - *p = readb(from); 27 + *p = readb((void __iomem *)from); 23 28 p++; 24 29 from++; 25 30 } 26 31 } 27 - 32 + EXPORT_SYMBOL(memcpy_fromio); 33 + 28 34 /* 29 35 * Copy data from "real" memory space to IO memory space. 30 36 * This needs to be optimized. 31 37 */ 32 - void memcpy_toio(unsigned long to, const void * from, unsigned long count) 38 + void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count) 33 39 { 34 40 const char *p = from; 35 41 while (count) { 36 42 count--; 37 - writeb(*p, to); 43 + writeb(*p, (void __iomem *)to); 38 44 p++; 39 45 to++; 40 46 } 41 47 } 42 - 48 + EXPORT_SYMBOL(memcpy_toio); 49 + 43 50 /* 44 51 * "memset" on IO memory space. 45 52 * This needs to be optimized. 46 53 */ 47 - void memset_io(unsigned long dst, int c, unsigned long count) 54 + void memset_io(volatile void __iomem *dst, int c, unsigned long count) 48 55 { 49 56 while (count) { 50 57 count--; 51 - writeb(c, dst); 58 + writeb(c, (void __iomem *)dst); 52 59 dst++; 53 60 } 54 61 } 55 - 56 - EXPORT_SYMBOL(memcpy_fromio); 57 - EXPORT_SYMBOL(memcpy_toio); 58 62 EXPORT_SYMBOL(memset_io); 59 63 64 + void __iomem *ioport_map(unsigned long port, unsigned int nr) 65 + { 66 + return sh_mv.mv_ioport_map(port, nr); 67 + } 68 + EXPORT_SYMBOL(ioport_map); 69 + 70 + void ioport_unmap(void __iomem *addr) 71 + { 72 + sh_mv.mv_ioport_unmap(addr); 73 + } 74 + EXPORT_SYMBOL(ioport_unmap);
+87 -105
arch/sh/kernel/io_generic.c
··· 3 3 * linux/arch/sh/kernel/io_generic.c 4 4 * 5 5 * Copyright (C) 2000 Niibe Yutaka 6 + * Copyright (C) 2005 Paul Mundt 6 7 * 7 8 * Generic I/O routine. These can be used where a machine specific version 8 9 * is not required. ··· 11 10 * This file is subject to the terms and conditions of the GNU General Public 12 11 * License. See the file "COPYING" in the main directory of this archive 13 12 * for more details. 14 - * 15 13 */ 16 - 14 + #include <linux/module.h> 17 15 #include <asm/io.h> 18 16 #include <asm/machvec.h> 19 - #include <linux/module.h> 20 17 21 - #if defined(CONFIG_CPU_SH3) 18 + #ifdef CONFIG_CPU_SH3 19 + /* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a 20 + * workaround. */ 22 21 /* I'm not sure SH7709 has this kind of bug */ 23 - #define SH3_PCMCIA_BUG_WORKAROUND 1 24 - #define DUMMY_READ_AREA6 0xba000000 22 + #define dummy_read() ctrl_inb(0xba000000) 23 + #else 24 + #define dummy_read() 25 25 #endif 26 - 27 - #define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x)) 28 26 29 27 unsigned long generic_io_base; 30 28 ··· 32 32 ctrl_inw(0xa0000000); 33 33 } 34 34 35 - unsigned char generic_inb(unsigned long port) 35 + u8 generic_inb(unsigned long port) 36 36 { 37 - return *(volatile unsigned char*)PORT2ADDR(port); 37 + return ctrl_inb((unsigned long __force)ioport_map(port, 1)); 38 38 } 39 39 40 - unsigned short generic_inw(unsigned long port) 40 + u16 generic_inw(unsigned long port) 41 41 { 42 - return *(volatile unsigned short*)PORT2ADDR(port); 42 + return ctrl_inw((unsigned long __force)ioport_map(port, 2)); 43 43 } 44 44 45 - unsigned int generic_inl(unsigned long port) 45 + u32 generic_inl(unsigned long port) 46 46 { 47 - return *(volatile unsigned long*)PORT2ADDR(port); 47 + return ctrl_inl((unsigned long __force)ioport_map(port, 4)); 48 48 } 49 49 50 - unsigned char generic_inb_p(unsigned long port) 50 + u8 generic_inb_p(unsigned long port) 51 51 { 52 - unsigned long v = *(volatile unsigned char*)PORT2ADDR(port); 52 + unsigned long v = generic_inb(port); 53 53 54 54 delay(); 55 55 return v; 56 56 } 57 57 58 - unsigned short generic_inw_p(unsigned long port) 58 + u16 generic_inw_p(unsigned long port) 59 59 { 60 - unsigned long v = *(volatile unsigned short*)PORT2ADDR(port); 60 + unsigned long v = generic_inw(port); 61 61 62 62 delay(); 63 63 return v; 64 64 } 65 65 66 - unsigned int generic_inl_p(unsigned long port) 66 + u32 generic_inl_p(unsigned long port) 67 67 { 68 - unsigned long v = *(volatile unsigned long*)PORT2ADDR(port); 68 + unsigned long v = generic_inl(port); 69 69 70 70 delay(); 71 71 return v; ··· 77 77 * convert the port address to real address once. 78 78 */ 79 79 80 - void generic_insb(unsigned long port, void *buffer, unsigned long count) 80 + void generic_insb(unsigned long port, void *dst, unsigned long count) 81 81 { 82 - volatile unsigned char *port_addr; 83 - unsigned char *buf=buffer; 82 + volatile u8 *port_addr; 83 + u8 *buf = dst; 84 84 85 - port_addr = (volatile unsigned char *)PORT2ADDR(port); 86 - 87 - while(count--) 88 - *buf++ = *port_addr; 85 + port_addr = (volatile u8 *)ioport_map(port, 1); 86 + while (count--) 87 + *buf++ = *port_addr; 89 88 } 90 89 91 - void generic_insw(unsigned long port, void *buffer, unsigned long count) 90 + void generic_insw(unsigned long port, void *dst, unsigned long count) 92 91 { 93 - volatile unsigned short *port_addr; 94 - unsigned short *buf=buffer; 92 + volatile u16 *port_addr; 93 + u16 *buf = dst; 95 94 96 - port_addr = (volatile unsigned short *)PORT2ADDR(port); 95 + port_addr = (volatile u16 *)ioport_map(port, 2); 96 + while (count--) 97 + *buf++ = *port_addr; 97 98 98 - while(count--) 99 - *buf++ = *port_addr; 100 - #ifdef SH3_PCMCIA_BUG_WORKAROUND 101 - ctrl_inb (DUMMY_READ_AREA6); 102 - #endif 99 + dummy_read(); 103 100 } 104 101 105 - void generic_insl(unsigned long port, void *buffer, unsigned long count) 102 + void generic_insl(unsigned long port, void *dst, unsigned long count) 106 103 { 107 - volatile unsigned long *port_addr; 108 - unsigned long *buf=buffer; 104 + volatile u32 *port_addr; 105 + u32 *buf = dst; 109 106 110 - port_addr = (volatile unsigned long *)PORT2ADDR(port); 107 + port_addr = (volatile u32 *)ioport_map(port, 4); 108 + while (count--) 109 + *buf++ = *port_addr; 111 110 112 - while(count--) 113 - *buf++ = *port_addr; 114 - #ifdef SH3_PCMCIA_BUG_WORKAROUND 115 - ctrl_inb (DUMMY_READ_AREA6); 116 - #endif 111 + dummy_read(); 117 112 } 118 113 119 - void generic_outb(unsigned char b, unsigned long port) 114 + void generic_outb(u8 b, unsigned long port) 120 115 { 121 - *(volatile unsigned char*)PORT2ADDR(port) = b; 116 + ctrl_outb(b, (unsigned long __force)ioport_map(port, 1)); 122 117 } 123 118 124 - void generic_outw(unsigned short b, unsigned long port) 119 + void generic_outw(u16 b, unsigned long port) 125 120 { 126 - *(volatile unsigned short*)PORT2ADDR(port) = b; 121 + ctrl_outw(b, (unsigned long __force)ioport_map(port, 2)); 127 122 } 128 123 129 - void generic_outl(unsigned int b, unsigned long port) 124 + void generic_outl(u32 b, unsigned long port) 130 125 { 131 - *(volatile unsigned long*)PORT2ADDR(port) = b; 126 + ctrl_outl(b, (unsigned long __force)ioport_map(port, 4)); 132 127 } 133 128 134 - void generic_outb_p(unsigned char b, unsigned long port) 129 + void generic_outb_p(u8 b, unsigned long port) 135 130 { 136 - *(volatile unsigned char*)PORT2ADDR(port) = b; 131 + generic_outb(b, port); 137 132 delay(); 138 133 } 139 134 140 - void generic_outw_p(unsigned short b, unsigned long port) 135 + void generic_outw_p(u16 b, unsigned long port) 141 136 { 142 - *(volatile unsigned short*)PORT2ADDR(port) = b; 137 + generic_outw(b, port); 143 138 delay(); 144 139 } 145 140 146 - void generic_outl_p(unsigned int b, unsigned long port) 141 + void generic_outl_p(u32 b, unsigned long port) 147 142 { 148 - *(volatile unsigned long*)PORT2ADDR(port) = b; 143 + generic_outl(b, port); 149 144 delay(); 150 145 } 151 146 ··· 149 154 * address. However as the port address doesn't change we only need to 150 155 * convert the port address to real address once. 151 156 */ 152 - 153 - void generic_outsb(unsigned long port, const void *buffer, unsigned long count) 157 + void generic_outsb(unsigned long port, const void *src, unsigned long count) 154 158 { 155 - volatile unsigned char *port_addr; 156 - const unsigned char *buf=buffer; 159 + volatile u8 *port_addr; 160 + const u8 *buf = src; 157 161 158 - port_addr = (volatile unsigned char *)PORT2ADDR(port); 162 + port_addr = (volatile u8 __force *)ioport_map(port, 1); 159 163 160 - while(count--) 161 - *port_addr = *buf++; 164 + while (count--) 165 + *port_addr = *buf++; 162 166 } 163 167 164 - void generic_outsw(unsigned long port, const void *buffer, unsigned long count) 168 + void generic_outsw(unsigned long port, const void *src, unsigned long count) 165 169 { 166 - volatile unsigned short *port_addr; 167 - const unsigned short *buf=buffer; 170 + volatile u16 *port_addr; 171 + const u16 *buf = src; 168 172 169 - port_addr = (volatile unsigned short *)PORT2ADDR(port); 173 + port_addr = (volatile u16 __force *)ioport_map(port, 2); 170 174 171 - while(count--) 172 - *port_addr = *buf++; 175 + while (count--) 176 + *port_addr = *buf++; 173 177 174 - #ifdef SH3_PCMCIA_BUG_WORKAROUND 175 - ctrl_inb (DUMMY_READ_AREA6); 176 - #endif 178 + dummy_read(); 177 179 } 178 180 179 - void generic_outsl(unsigned long port, const void *buffer, unsigned long count) 181 + void generic_outsl(unsigned long port, const void *src, unsigned long count) 180 182 { 181 - volatile unsigned long *port_addr; 182 - const unsigned long *buf=buffer; 183 + volatile u32 *port_addr; 184 + const u32 *buf = src; 183 185 184 - port_addr = (volatile unsigned long *)PORT2ADDR(port); 186 + port_addr = (volatile u32 __force *)ioport_map(port, 4); 187 + while (count--) 188 + *port_addr = *buf++; 185 189 186 - while(count--) 187 - *port_addr = *buf++; 188 - 189 - #ifdef SH3_PCMCIA_BUG_WORKAROUND 190 - ctrl_inb (DUMMY_READ_AREA6); 191 - #endif 190 + dummy_read(); 192 191 } 193 192 194 - unsigned char generic_readb(unsigned long addr) 193 + u8 generic_readb(void __iomem *addr) 195 194 { 196 - return *(volatile unsigned char*)addr; 195 + return ctrl_inb((unsigned long __force)addr); 197 196 } 198 197 199 - unsigned short generic_readw(unsigned long addr) 198 + u16 generic_readw(void __iomem *addr) 200 199 { 201 - return *(volatile unsigned short*)addr; 200 + return ctrl_inw((unsigned long __force)addr); 202 201 } 203 202 204 - unsigned int generic_readl(unsigned long addr) 203 + u32 generic_readl(void __iomem *addr) 205 204 { 206 - return *(volatile unsigned long*)addr; 205 + return ctrl_inl((unsigned long __force)addr); 207 206 } 208 207 209 - void generic_writeb(unsigned char b, unsigned long addr) 208 + void generic_writeb(u8 b, void __iomem *addr) 210 209 { 211 - *(volatile unsigned char*)addr = b; 210 + ctrl_outb(b, (unsigned long __force)addr); 212 211 } 213 212 214 - void generic_writew(unsigned short b, unsigned long addr) 213 + void generic_writew(u16 b, void __iomem *addr) 215 214 { 216 - *(volatile unsigned short*)addr = b; 215 + ctrl_outw(b, (unsigned long __force)addr); 217 216 } 218 217 219 - void generic_writel(unsigned int b, unsigned long addr) 218 + void generic_writel(u32 b, void __iomem *addr) 220 219 { 221 - *(volatile unsigned long*)addr = b; 220 + ctrl_outl(b, (unsigned long __force)addr); 222 221 } 223 222 224 - void * generic_ioremap(unsigned long offset, unsigned long size) 223 + void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) 225 224 { 226 - return (void *) P2SEGADDR(offset); 225 + return (void __iomem *)(addr + generic_io_base); 227 226 } 228 - EXPORT_SYMBOL(generic_ioremap); 229 227 230 - void generic_iounmap(void *addr) 228 + void generic_ioport_unmap(void __iomem *addr) 231 229 { 232 - } 233 - EXPORT_SYMBOL(generic_iounmap); 234 - 235 - unsigned long generic_isa_port2addr(unsigned long offset) 236 - { 237 - return offset + generic_io_base; 238 230 }
+84 -21
arch/sh/mm/ioremap.c
··· 6 6 * 640k-1MB IO memory area on PC's 7 7 * 8 8 * (C) Copyright 1995 1996 Linus Torvalds 9 + * (C) Copyright 2005, 2006 Paul Mundt 10 + * 11 + * This file is subject to the terms and conditions of the GNU General 12 + * Public License. See the file "COPYING" in the main directory of this 13 + * archive for more details. 9 14 */ 10 - 11 15 #include <linux/vmalloc.h> 16 + #include <linux/module.h> 12 17 #include <linux/mm.h> 13 18 #include <asm/io.h> 14 19 #include <asm/page.h> 15 20 #include <asm/pgalloc.h> 21 + #include <asm/addrspace.h> 16 22 #include <asm/cacheflush.h> 17 23 #include <asm/tlbflush.h> 18 24 ··· 86 80 if (address >= end) 87 81 BUG(); 88 82 do { 83 + pud_t *pud; 89 84 pmd_t *pmd; 90 - pmd = pmd_alloc(&init_mm, dir, address); 85 + 91 86 error = -ENOMEM; 87 + 88 + pud = pud_alloc(&init_mm, dir, address); 89 + if (!pud) 90 + break; 91 + pmd = pmd_alloc(&init_mm, pud, address); 92 92 if (!pmd) 93 93 break; 94 94 if (remap_area_pmd(pmd, address, end - address, ··· 109 97 } 110 98 111 99 /* 112 - * Generic mapping function (not visible outside): 113 - */ 114 - 115 - /* 116 100 * Remap an arbitrary physical address space into the kernel virtual 117 101 * address space. Needed when the kernel wants to access high addresses 118 102 * directly. ··· 117 109 * have to convert them into an offset in a page-aligned mapping, but the 118 110 * caller shouldn't need to know that small detail. 119 111 */ 120 - void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 112 + void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, 113 + unsigned long flags) 121 114 { 122 - void * addr; 123 115 struct vm_struct * area; 124 - unsigned long offset, last_addr; 116 + unsigned long offset, last_addr, addr, orig_addr; 125 117 126 118 /* Don't allow wraparound or zero size */ 127 119 last_addr = phys_addr + size - 1; ··· 132 124 * Don't remap the low PCI/ISA area, it's always mapped.. 133 125 */ 134 126 if (phys_addr >= 0xA0000 && last_addr < 0x100000) 135 - return phys_to_virt(phys_addr); 127 + return (void __iomem *)phys_to_virt(phys_addr); 136 128 137 129 /* 138 130 * Don't allow anybody to remap normal RAM that we're using.. ··· 154 146 if (!area) 155 147 return NULL; 156 148 area->phys_addr = phys_addr; 157 - addr = area->addr; 158 - if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 159 - vunmap(addr); 160 - return NULL; 161 - } 162 - return (void *) (offset + (char *)addr); 163 - } 149 + orig_addr = addr = (unsigned long)area->addr; 164 150 165 - void p3_iounmap(void *addr) 166 - { 167 - if (addr > high_memory) 168 - vfree((void *)(PAGE_MASK & (unsigned long)addr)); 151 + #ifdef CONFIG_32BIT 152 + /* 153 + * First try to remap through the PMB once a valid VMA has been 154 + * established. Smaller allocations (or the rest of the size 155 + * remaining after a PMB mapping due to the size not being 156 + * perfectly aligned on a PMB size boundary) are then mapped 157 + * through the UTLB using conventional page tables. 158 + * 159 + * PMB entries are all pre-faulted. 160 + */ 161 + if (unlikely(size >= 0x1000000)) { 162 + unsigned long mapped = pmb_remap(addr, phys_addr, size, flags); 163 + 164 + if (likely(mapped)) { 165 + addr += mapped; 166 + phys_addr += mapped; 167 + size -= mapped; 168 + } 169 + } 170 + #endif 171 + 172 + if (likely(size)) 173 + if (remap_area_pages(addr, phys_addr, size, flags)) { 174 + vunmap((void *)orig_addr); 175 + return NULL; 176 + } 177 + 178 + return (void __iomem *)(offset + (char *)orig_addr); 169 179 } 180 + EXPORT_SYMBOL(__ioremap); 181 + 182 + void __iounmap(void __iomem *addr) 183 + { 184 + unsigned long vaddr = (unsigned long __force)addr; 185 + struct vm_struct *p; 186 + 187 + if (PXSEG(vaddr) < P3SEG) 188 + return; 189 + 190 + #ifdef CONFIG_32BIT 191 + /* 192 + * Purge any PMB entries that may have been established for this 193 + * mapping, then proceed with conventional VMA teardown. 194 + * 195 + * XXX: Note that due to the way that remove_vm_area() does 196 + * matching of the resultant VMA, we aren't able to fast-forward 197 + * the address past the PMB space until the end of the VMA where 198 + * the page tables reside. As such, unmap_vm_area() will be 199 + * forced to linearly scan over the area until it finds the page 200 + * tables where PTEs that need to be unmapped actually reside, 201 + * which is far from optimal. Perhaps we need to use a separate 202 + * VMA for the PMB mappings? 203 + * -- PFM. 204 + */ 205 + pmb_unmap(vaddr); 206 + #endif 207 + 208 + p = remove_vm_area((void *)(vaddr & PAGE_MASK)); 209 + if (!p) { 210 + printk(KERN_ERR "%s: bad address %p\n", __FUNCTION__, addr); 211 + return; 212 + } 213 + 214 + kfree(p); 215 + } 216 + EXPORT_SYMBOL(__iounmap);
+158 -109
include/asm-sh/io.h
··· 11 11 * For read{b,w,l} and write{b,w,l} there are also __raw versions, which 12 12 * do not have a memory barrier after them. 13 13 * 14 - * In addition, we have 14 + * In addition, we have 15 15 * ctrl_in{b,w,l}/ctrl_out{b,w,l} for SuperH specific I/O. 16 16 * which are processor specific. 17 17 */ ··· 23 23 * inb by default expands to _inb, but the machine specific code may 24 24 * define it to __inb if it chooses. 25 25 */ 26 - 26 + #include <linux/config.h> 27 27 #include <asm/cache.h> 28 28 #include <asm/system.h> 29 29 #include <asm/addrspace.h> 30 30 #include <asm/machvec.h> 31 - #include <linux/config.h> 31 + #include <asm/pgtable.h> 32 + #include <asm-generic/iomap.h> 33 + 34 + #ifdef __KERNEL__ 32 35 33 36 /* 34 37 * Depending on which platform we are running on, we need different 35 38 * I/O functions. 36 39 */ 40 + #define __IO_PREFIX generic 41 + #include <asm/io_generic.h> 37 42 38 - #ifdef __KERNEL__ 43 + #define maybebadio(port) \ 44 + printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \ 45 + __FUNCTION__, __LINE__, (port), (u32)__builtin_return_address(0)) 46 + 39 47 /* 40 48 * Since boards are able to define their own set of I/O routines through 41 49 * their respective machine vector, we always wrap through the mv. ··· 52 44 * a given routine, it will be wrapped to generic code at run-time. 53 45 */ 54 46 55 - # define __inb(p) sh_mv.mv_inb((p)) 56 - # define __inw(p) sh_mv.mv_inw((p)) 57 - # define __inl(p) sh_mv.mv_inl((p)) 58 - # define __outb(x,p) sh_mv.mv_outb((x),(p)) 59 - # define __outw(x,p) sh_mv.mv_outw((x),(p)) 60 - # define __outl(x,p) sh_mv.mv_outl((x),(p)) 47 + #define __inb(p) sh_mv.mv_inb((p)) 48 + #define __inw(p) sh_mv.mv_inw((p)) 49 + #define __inl(p) sh_mv.mv_inl((p)) 50 + #define __outb(x,p) sh_mv.mv_outb((x),(p)) 51 + #define __outw(x,p) sh_mv.mv_outw((x),(p)) 52 + #define __outl(x,p) sh_mv.mv_outl((x),(p)) 61 53 62 - # define __inb_p(p) sh_mv.mv_inb_p((p)) 63 - # define __inw_p(p) sh_mv.mv_inw_p((p)) 64 - # define __inl_p(p) sh_mv.mv_inl_p((p)) 65 - # define __outb_p(x,p) sh_mv.mv_outb_p((x),(p)) 66 - # define __outw_p(x,p) sh_mv.mv_outw_p((x),(p)) 67 - # define __outl_p(x,p) sh_mv.mv_outl_p((x),(p)) 54 + #define __inb_p(p) sh_mv.mv_inb_p((p)) 55 + #define __inw_p(p) sh_mv.mv_inw_p((p)) 56 + #define __inl_p(p) sh_mv.mv_inl_p((p)) 57 + #define __outb_p(x,p) sh_mv.mv_outb_p((x),(p)) 58 + #define __outw_p(x,p) sh_mv.mv_outw_p((x),(p)) 59 + #define __outl_p(x,p) sh_mv.mv_outl_p((x),(p)) 68 60 69 - # define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) 70 - # define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) 71 - # define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) 72 - # define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) 73 - # define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) 74 - # define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) 61 + #define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) 62 + #define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) 63 + #define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) 64 + #define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) 65 + #define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) 66 + #define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) 75 67 76 - # define __readb(a) sh_mv.mv_readb((a)) 77 - # define __readw(a) sh_mv.mv_readw((a)) 78 - # define __readl(a) sh_mv.mv_readl((a)) 79 - # define __writeb(v,a) sh_mv.mv_writeb((v),(a)) 80 - # define __writew(v,a) sh_mv.mv_writew((v),(a)) 81 - # define __writel(v,a) sh_mv.mv_writel((v),(a)) 68 + #define __readb(a) sh_mv.mv_readb((a)) 69 + #define __readw(a) sh_mv.mv_readw((a)) 70 + #define __readl(a) sh_mv.mv_readl((a)) 71 + #define __writeb(v,a) sh_mv.mv_writeb((v),(a)) 72 + #define __writew(v,a) sh_mv.mv_writew((v),(a)) 73 + #define __writel(v,a) sh_mv.mv_writel((v),(a)) 82 74 83 - # define __ioremap(a,s) sh_mv.mv_ioremap((a), (s)) 84 - # define __iounmap(a) sh_mv.mv_iounmap((a)) 75 + #define inb __inb 76 + #define inw __inw 77 + #define inl __inl 78 + #define outb __outb 79 + #define outw __outw 80 + #define outl __outl 85 81 86 - # define __isa_port2addr(a) sh_mv.mv_isa_port2addr(a) 82 + #define inb_p __inb_p 83 + #define inw_p __inw_p 84 + #define inl_p __inl_p 85 + #define outb_p __outb_p 86 + #define outw_p __outw_p 87 + #define outl_p __outl_p 87 88 88 - # define inb __inb 89 - # define inw __inw 90 - # define inl __inl 91 - # define outb __outb 92 - # define outw __outw 93 - # define outl __outl 89 + #define insb __insb 90 + #define insw __insw 91 + #define insl __insl 92 + #define outsb __outsb 93 + #define outsw __outsw 94 + #define outsl __outsl 94 95 95 - # define inb_p __inb_p 96 - # define inw_p __inw_p 97 - # define inl_p __inl_p 98 - # define outb_p __outb_p 99 - # define outw_p __outw_p 100 - # define outl_p __outl_p 101 - 102 - # define insb __insb 103 - # define insw __insw 104 - # define insl __insl 105 - # define outsb __outsb 106 - # define outsw __outsw 107 - # define outsl __outsl 108 - 109 - # define __raw_readb __readb 110 - # define __raw_readw __readw 111 - # define __raw_readl __readl 112 - # define __raw_writeb __writeb 113 - # define __raw_writew __writew 114 - # define __raw_writel __writel 96 + #define __raw_readb(a) __readb((void __iomem *)(a)) 97 + #define __raw_readw(a) __readw((void __iomem *)(a)) 98 + #define __raw_readl(a) __readl((void __iomem *)(a)) 99 + #define __raw_writeb(v, a) __writeb(v, (void __iomem *)(a)) 100 + #define __raw_writew(v, a) __writew(v, (void __iomem *)(a)) 101 + #define __raw_writel(v, a) __writel(v, (void __iomem *)(a)) 115 102 116 103 /* 117 104 * The platform header files may define some of these macros to use 118 105 * the inlined versions where appropriate. These macros may also be 119 106 * redefined by userlevel programs. 120 107 */ 121 - #ifdef __raw_readb 122 - # define readb(a) ({ unsigned long r_ = __raw_readb((unsigned long)a); mb(); r_; }) 108 + #ifdef __readb 109 + # define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; }) 123 110 #endif 124 111 #ifdef __raw_readw 125 - # define readw(a) ({ unsigned long r_ = __raw_readw((unsigned long)a); mb(); r_; }) 112 + # define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; }) 126 113 #endif 127 114 #ifdef __raw_readl 128 - # define readl(a) ({ unsigned long r_ = __raw_readl((unsigned long)a); mb(); r_; }) 115 + # define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; }) 129 116 #endif 130 117 131 118 #ifdef __raw_writeb 132 - # define writeb(v,a) ({ __raw_writeb((v),(unsigned long)(a)); mb(); }) 119 + # define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) 133 120 #endif 134 121 #ifdef __raw_writew 135 - # define writew(v,a) ({ __raw_writew((v),(unsigned long)(a)); mb(); }) 122 + # define writew(v,a) ({ __raw_writew((v),(a)); mb(); }) 136 123 #endif 137 124 #ifdef __raw_writel 138 - # define writel(v,a) ({ __raw_writel((v),(unsigned long)(a)); mb(); }) 125 + # define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) 139 126 #endif 140 127 141 128 #define readb_relaxed(a) readb(a) 142 129 #define readw_relaxed(a) readw(a) 143 130 #define readl_relaxed(a) readl(a) 144 131 145 - #define mmiowb() 132 + /* Simple MMIO */ 133 + #define ioread8(a) readb(a) 134 + #define ioread16(a) readw(a) 135 + #define ioread16be(a) be16_to_cpu(__raw_readw((a))) 136 + #define ioread32(a) readl(a) 137 + #define ioread32be(a) be32_to_cpu(__raw_readl((a))) 146 138 147 - /* 148 - * If the platform has PC-like I/O, this function converts the offset into 149 - * an address. 150 - */ 151 - static __inline__ unsigned long isa_port2addr(unsigned long offset) 152 - { 153 - return __isa_port2addr(offset); 154 - } 139 + #define iowrite8(v,a) writeb((v),(a)) 140 + #define iowrite16(v,a) writew((v),(a)) 141 + #define iowrite16be(v,a) __raw_writew(cpu_to_be16((v)),(a)) 142 + #define iowrite32(v,a) writel((v),(a)) 143 + #define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a)) 144 + 145 + #define ioread8_rep(a,d,c) insb((a),(d),(c)) 146 + #define ioread16_rep(a,d,c) insw((a),(d),(c)) 147 + #define ioread32_rep(a,d,c) insl((a),(d),(c)) 148 + 149 + #define iowrite8_rep(a,s,c) outsb((a),(s),(c)) 150 + #define iowrite16_rep(a,s,c) outsw((a),(s),(c)) 151 + #define iowrite32_rep(a,s,c) outsl((a),(s),(c)) 152 + 153 + #define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */ 155 154 156 155 /* 157 156 * This function provides a method for the generic case where a board-specific 158 - * isa_port2addr simply needs to return the port + some arbitrary port base. 157 + * ioport_map simply needs to return the port + some arbitrary port base. 159 158 * 160 159 * We use this at board setup time to implicitly set the port base, and 161 - * as a result, we can use the generic isa_port2addr. 160 + * as a result, we can use the generic ioport_map. 162 161 */ 163 162 static inline void __set_io_port_base(unsigned long pbase) 164 163 { ··· 174 159 generic_io_base = pbase; 175 160 } 176 161 177 - #define isa_readb(a) readb(isa_port2addr(a)) 178 - #define isa_readw(a) readw(isa_port2addr(a)) 179 - #define isa_readl(a) readl(isa_port2addr(a)) 180 - #define isa_writeb(b,a) writeb(b,isa_port2addr(a)) 181 - #define isa_writew(w,a) writew(w,isa_port2addr(a)) 182 - #define isa_writel(l,a) writel(l,isa_port2addr(a)) 162 + #define isa_readb(a) readb(ioport_map(a, 1)) 163 + #define isa_readw(a) readw(ioport_map(a, 2)) 164 + #define isa_readl(a) readl(ioport_map(a, 4)) 165 + #define isa_writeb(b,a) writeb(b,ioport_map(a, 1)) 166 + #define isa_writew(w,a) writew(w,ioport_map(a, 2)) 167 + #define isa_writel(l,a) writel(l,ioport_map(a, 4)) 168 + 183 169 #define isa_memset_io(a,b,c) \ 184 - memset((void *)(isa_port2addr((unsigned long)a)),(b),(c)) 170 + memset((void *)(ioport_map((unsigned long)(a), 1)),(b),(c)) 185 171 #define isa_memcpy_fromio(a,b,c) \ 186 - memcpy((a),(void *)(isa_port2addr((unsigned long)(b))),(c)) 172 + memcpy((a),(void *)(ioport_map((unsigned long)(b), 1)),(c)) 187 173 #define isa_memcpy_toio(a,b,c) \ 188 - memcpy((void *)(isa_port2addr((unsigned long)(a))),(b),(c)) 174 + memcpy((void *)(ioport_map((unsigned long)(a), 1)),(b),(c)) 189 175 190 176 /* We really want to try and get these to memcpy etc */ 191 - extern void memcpy_fromio(void *, unsigned long, unsigned long); 192 - extern void memcpy_toio(unsigned long, const void *, unsigned long); 193 - extern void memset_io(unsigned long, int, unsigned long); 177 + extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long); 178 + extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 179 + extern void memset_io(volatile void __iomem *, int, unsigned long); 194 180 195 181 /* SuperH on-chip I/O functions */ 196 - static __inline__ unsigned char ctrl_inb(unsigned long addr) 182 + static inline unsigned char ctrl_inb(unsigned long addr) 197 183 { 198 184 return *(volatile unsigned char*)addr; 199 185 } 200 186 201 - static __inline__ unsigned short ctrl_inw(unsigned long addr) 187 + static inline unsigned short ctrl_inw(unsigned long addr) 202 188 { 203 189 return *(volatile unsigned short*)addr; 204 190 } 205 191 206 - static __inline__ unsigned int ctrl_inl(unsigned long addr) 192 + static inline unsigned int ctrl_inl(unsigned long addr) 207 193 { 208 194 return *(volatile unsigned long*)addr; 209 195 } 210 196 211 - static __inline__ void ctrl_outb(unsigned char b, unsigned long addr) 197 + static inline void ctrl_outb(unsigned char b, unsigned long addr) 212 198 { 213 199 *(volatile unsigned char*)addr = b; 214 200 } 215 201 216 - static __inline__ void ctrl_outw(unsigned short b, unsigned long addr) 202 + static inline void ctrl_outw(unsigned short b, unsigned long addr) 217 203 { 218 204 *(volatile unsigned short*)addr = b; 219 205 } 220 206 221 - static __inline__ void ctrl_outl(unsigned int b, unsigned long addr) 207 + static inline void ctrl_outl(unsigned int b, unsigned long addr) 222 208 { 223 209 *(volatile unsigned long*)addr = b; 224 210 } ··· 230 214 * Change virtual addresses to physical addresses and vv. 231 215 * These are trivial on the 1:1 Linux/SuperH mapping 232 216 */ 233 - static __inline__ unsigned long virt_to_phys(volatile void * address) 217 + static inline unsigned long virt_to_phys(volatile void *address) 234 218 { 235 219 return PHYSADDR(address); 236 220 } 237 221 238 - static __inline__ void * phys_to_virt(unsigned long address) 222 + static inline void *phys_to_virt(unsigned long address) 239 223 { 240 224 return (void *)P1SEGADDR(address); 241 225 } ··· 250 234 * differently. On the x86 architecture, we just read/write the 251 235 * memory location directly. 252 236 * 253 - * On SH, we have the whole physical address space mapped at all times 254 - * (as MIPS does), so "ioremap()" and "iounmap()" do not need to do 255 - * anything. (This isn't true for all machines but we still handle 256 - * these cases with wired TLB entries anyway ...) 237 + * On SH, we traditionally have the whole physical address space mapped 238 + * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not 239 + * need to do anything but place the address in the proper segment. This 240 + * is true for P1 and P2 addresses, as well as some P3 ones. However, 241 + * most of the P3 addresses and newer cores using extended addressing 242 + * need to map through page tables, so the ioremap() implementation 243 + * becomes a bit more complicated. See arch/sh/mm/ioremap.c for 244 + * additional notes on this. 257 245 * 258 246 * We cheat a bit and always return uncachable areas until we've fixed 259 - * the drivers to handle caching properly. 247 + * the drivers to handle caching properly. 260 248 */ 261 - static __inline__ void * ioremap(unsigned long offset, unsigned long size) 249 + #ifdef CONFIG_MMU 250 + void __iomem *__ioremap(unsigned long offset, unsigned long size, 251 + unsigned long flags); 252 + void __iounmap(void __iomem *addr); 253 + #else 254 + #define __ioremap(offset, size, flags) ((void __iomem *)(offset)) 255 + #define __iounmap(addr) do { } while (0) 256 + #endif /* CONFIG_MMU */ 257 + 258 + static inline void __iomem * 259 + __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) 262 260 { 263 - return __ioremap(offset, size); 261 + unsigned long last_addr = offset + size - 1; 262 + 263 + /* 264 + * For P1 and P2 space this is trivial, as everything is already 265 + * mapped. Uncached access for P1 addresses are done through P2. 266 + * In the P3 case or for addresses outside of the 29-bit space, 267 + * mapping must be done by the PMB or by using page tables. 268 + */ 269 + if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) { 270 + if (unlikely(flags & _PAGE_CACHABLE)) 271 + return (void __iomem *)P1SEGADDR(offset); 272 + 273 + return (void __iomem *)P2SEGADDR(offset); 274 + } 275 + 276 + return __ioremap(offset, size, flags); 264 277 } 265 278 266 - static __inline__ void iounmap(void *addr) 267 - { 268 - return __iounmap(addr); 269 - } 279 + #define ioremap(offset, size) \ 280 + __ioremap_mode((offset), (size), 0) 281 + #define ioremap_nocache(offset, size) \ 282 + __ioremap_mode((offset), (size), 0) 283 + #define ioremap_cache(offset, size) \ 284 + __ioremap_mode((offset), (size), _PAGE_CACHABLE) 285 + #define p3_ioremap(offset, size, flags) \ 286 + __ioremap((offset), (size), (flags)) 287 + #define iounmap(addr) \ 288 + __iounmap((addr)) 270 289 271 - #define ioremap_nocache(off,size) ioremap(off,size) 272 - 273 - static __inline__ int check_signature(unsigned long io_addr, 290 + static inline int check_signature(char __iomem *io_addr, 274 291 const unsigned char *signature, int length) 275 292 { 276 293 int retval = 0;
+38 -40
include/asm-sh/io_generic.h
··· 1 1 /* 2 - * include/asm-sh/io_generic.h 3 - * 4 - * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) 5 - * 6 - * May be copied or modified under the terms of the GNU General Public 7 - * License. See linux/COPYING for more information. 8 - * 9 - * Generic IO functions 2 + * Trivial I/O routine definitions, intentionally meant to be included 3 + * multiple times. Ugly I/O routine concatenation helpers taken from 4 + * alpha. Must be included _before_ io.h to avoid preprocessor-induced 5 + * routine mismatch. 10 6 */ 7 + #define IO_CONCAT(a,b) _IO_CONCAT(a,b) 8 + #define _IO_CONCAT(a,b) a ## _ ## b 11 9 12 - #ifndef _ASM_SH_IO_GENERIC_H 13 - #define _ASM_SH_IO_GENERIC_H 10 + #ifndef __IO_PREFIX 11 + #error "Don't include this header without a valid system prefix" 12 + #endif 14 13 15 - extern unsigned long generic_io_base; 14 + u8 IO_CONCAT(__IO_PREFIX,inb)(unsigned long); 15 + u16 IO_CONCAT(__IO_PREFIX,inw)(unsigned long); 16 + u32 IO_CONCAT(__IO_PREFIX,inl)(unsigned long); 16 17 17 - extern unsigned char generic_inb(unsigned long port); 18 - extern unsigned short generic_inw(unsigned long port); 19 - extern unsigned int generic_inl(unsigned long port); 18 + void IO_CONCAT(__IO_PREFIX,outb)(u8, unsigned long); 19 + void IO_CONCAT(__IO_PREFIX,outw)(u16, unsigned long); 20 + void IO_CONCAT(__IO_PREFIX,outl)(u32, unsigned long); 20 21 21 - extern void generic_outb(unsigned char value, unsigned long port); 22 - extern void generic_outw(unsigned short value, unsigned long port); 23 - extern void generic_outl(unsigned int value, unsigned long port); 22 + u8 IO_CONCAT(__IO_PREFIX,inb_p)(unsigned long); 23 + u16 IO_CONCAT(__IO_PREFIX,inw_p)(unsigned long); 24 + u32 IO_CONCAT(__IO_PREFIX,inl_p)(unsigned long); 25 + void IO_CONCAT(__IO_PREFIX,outb_p)(u8, unsigned long); 26 + void IO_CONCAT(__IO_PREFIX,outw_p)(u16, unsigned long); 27 + void IO_CONCAT(__IO_PREFIX,outl_p)(u32, unsigned long); 24 28 25 - extern unsigned char generic_inb_p(unsigned long port); 26 - extern unsigned short generic_inw_p(unsigned long port); 27 - extern unsigned int generic_inl_p(unsigned long port); 28 - extern void generic_outb_p(unsigned char value, unsigned long port); 29 - extern void generic_outw_p(unsigned short value, unsigned long port); 30 - extern void generic_outl_p(unsigned int value, unsigned long port); 29 + void IO_CONCAT(__IO_PREFIX,insb)(unsigned long, void *dst, unsigned long count); 30 + void IO_CONCAT(__IO_PREFIX,insw)(unsigned long, void *dst, unsigned long count); 31 + void IO_CONCAT(__IO_PREFIX,insl)(unsigned long, void *dst, unsigned long count); 32 + void IO_CONCAT(__IO_PREFIX,outsb)(unsigned long, const void *src, unsigned long count); 33 + void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count); 34 + void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count); 31 35 32 - extern void generic_insb(unsigned long port, void *addr, unsigned long count); 33 - extern void generic_insw(unsigned long port, void *addr, unsigned long count); 34 - extern void generic_insl(unsigned long port, void *addr, unsigned long count); 35 - extern void generic_outsb(unsigned long port, const void *addr, unsigned long count); 36 - extern void generic_outsw(unsigned long port, const void *addr, unsigned long count); 37 - extern void generic_outsl(unsigned long port, const void *addr, unsigned long count); 36 + u8 IO_CONCAT(__IO_PREFIX,readb)(void __iomem *); 37 + u16 IO_CONCAT(__IO_PREFIX,readw)(void __iomem *); 38 + u32 IO_CONCAT(__IO_PREFIX,readl)(void __iomem *); 39 + void IO_CONCAT(__IO_PREFIX,writeb)(u8, void __iomem *); 40 + void IO_CONCAT(__IO_PREFIX,writew)(u16, void __iomem *); 41 + void IO_CONCAT(__IO_PREFIX,writel)(u32, void __iomem *); 38 42 39 - extern unsigned char generic_readb(unsigned long addr); 40 - extern unsigned short generic_readw(unsigned long addr); 41 - extern unsigned int generic_readl(unsigned long addr); 42 - extern void generic_writeb(unsigned char b, unsigned long addr); 43 - extern void generic_writew(unsigned short b, unsigned long addr); 44 - extern void generic_writel(unsigned int b, unsigned long addr); 43 + void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size); 44 + void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr); 45 45 46 - extern void *generic_ioremap(unsigned long offset, unsigned long size); 47 - extern void generic_iounmap(void *addr); 46 + void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size); 47 + void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr); 48 48 49 - extern unsigned long generic_isa_port2addr(unsigned long offset); 50 - 51 - #endif /* _ASM_SH_IO_GENERIC_H */ 49 + #undef __IO_PREFIX
+28 -32
include/asm-sh/machvec.h
··· 18 18 #include <asm/machvec_init.h> 19 19 20 20 struct device; 21 - struct timeval; 22 21 23 - struct sh_machine_vector 24 - { 22 + struct sh_machine_vector { 25 23 int mv_nr_irqs; 26 24 27 - unsigned char (*mv_inb)(unsigned long); 28 - unsigned short (*mv_inw)(unsigned long); 29 - unsigned int (*mv_inl)(unsigned long); 30 - void (*mv_outb)(unsigned char, unsigned long); 31 - void (*mv_outw)(unsigned short, unsigned long); 32 - void (*mv_outl)(unsigned int, unsigned long); 25 + u8 (*mv_inb)(unsigned long); 26 + u16 (*mv_inw)(unsigned long); 27 + u32 (*mv_inl)(unsigned long); 28 + void (*mv_outb)(u8, unsigned long); 29 + void (*mv_outw)(u16, unsigned long); 30 + void (*mv_outl)(u32, unsigned long); 33 31 34 - unsigned char (*mv_inb_p)(unsigned long); 35 - unsigned short (*mv_inw_p)(unsigned long); 36 - unsigned int (*mv_inl_p)(unsigned long); 37 - void (*mv_outb_p)(unsigned char, unsigned long); 38 - void (*mv_outw_p)(unsigned short, unsigned long); 39 - void (*mv_outl_p)(unsigned int, unsigned long); 32 + u8 (*mv_inb_p)(unsigned long); 33 + u16 (*mv_inw_p)(unsigned long); 34 + u32 (*mv_inl_p)(unsigned long); 35 + void (*mv_outb_p)(u8, unsigned long); 36 + void (*mv_outw_p)(u16, unsigned long); 37 + void (*mv_outl_p)(u32, unsigned long); 40 38 41 - void (*mv_insb)(unsigned long port, void *addr, unsigned long count); 42 - void (*mv_insw)(unsigned long port, void *addr, unsigned long count); 43 - void (*mv_insl)(unsigned long port, void *addr, unsigned long count); 44 - void (*mv_outsb)(unsigned long port, const void *addr, unsigned long count); 45 - void (*mv_outsw)(unsigned long port, const void *addr, unsigned long count); 46 - void (*mv_outsl)(unsigned long port, const void *addr, unsigned long count); 39 + void (*mv_insb)(unsigned long, void *dst, unsigned long count); 40 + void (*mv_insw)(unsigned long, void *dst, unsigned long count); 41 + void (*mv_insl)(unsigned long, void *dst, unsigned long count); 42 + void (*mv_outsb)(unsigned long, const void *src, unsigned long count); 43 + void (*mv_outsw)(unsigned long, const void *src, unsigned long count); 44 + void (*mv_outsl)(unsigned long, const void *src, unsigned long count); 47 45 48 - unsigned char (*mv_readb)(unsigned long); 49 - unsigned short (*mv_readw)(unsigned long); 50 - unsigned int (*mv_readl)(unsigned long); 51 - void (*mv_writeb)(unsigned char, unsigned long); 52 - void (*mv_writew)(unsigned short, unsigned long); 53 - void (*mv_writel)(unsigned int, unsigned long); 54 - 55 - void* (*mv_ioremap)(unsigned long offset, unsigned long size); 56 - void (*mv_iounmap)(void *addr); 57 - 58 - unsigned long (*mv_isa_port2addr)(unsigned long offset); 46 + u8 (*mv_readb)(void __iomem *); 47 + u16 (*mv_readw)(void __iomem *); 48 + u32 (*mv_readl)(void __iomem *); 49 + void (*mv_writeb)(u8, void __iomem *); 50 + void (*mv_writew)(u16, void __iomem *); 51 + void (*mv_writel)(u32, void __iomem *); 59 52 60 53 int (*mv_irq_demux)(int irq); 61 54 ··· 59 66 60 67 void *(*mv_consistent_alloc)(struct device *, size_t, dma_addr_t *, gfp_t); 61 68 int (*mv_consistent_free)(struct device *, size_t, void *, dma_addr_t); 69 + 70 + void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size); 71 + void (*mv_ioport_unmap)(void __iomem *); 62 72 }; 63 73 64 74 extern struct sh_machine_vector sh_mv;