3 /* XXXXXXXXXXXXXXXXX */
5 #define virt_to_bus virt_to_phys
6 #define bus_to_virt phys_to_virt
8 extern __inline__
unsigned long readb(unsigned long addr
)
10 return *(volatile unsigned char*)addr
;
13 extern __inline__
unsigned long readw(unsigned long addr
)
15 return *(volatile unsigned short*)addr
;
18 extern __inline__
unsigned long readl(unsigned long addr
)
20 return *(volatile unsigned long*)addr
;
23 extern __inline__
void writeb(unsigned short b
, unsigned long addr
)
25 *(volatile unsigned char*)addr
= b
;
28 extern __inline__
void writew(unsigned short b
, unsigned long addr
)
30 *(volatile unsigned short*)addr
= b
;
33 extern __inline__
void writel(unsigned int b
, unsigned long addr
)
35 *(volatile unsigned long*)addr
= b
;
38 extern __inline__
unsigned long inb_local(unsigned long addr
)
43 extern __inline__
void outb_local(unsigned char b
, unsigned long addr
)
45 return writeb(b
,addr
);
48 extern __inline__
unsigned long inb(unsigned long addr
)
53 extern __inline__
unsigned long inw(unsigned long addr
)
58 extern __inline__
unsigned long inl(unsigned long addr
)
63 extern __inline__
void outb(unsigned char b
, unsigned long addr
)
65 return writeb(b
,addr
);
68 extern __inline__
void outw(unsigned short b
, unsigned long addr
)
70 return writew(b
,addr
);
73 extern __inline__
void outl(unsigned int b
, unsigned long addr
)
75 return writel(b
,addr
);
83 #include <asm/addrspace.h>
86 * Change virtual addresses to physical addresses and vv.
87 * These are trivial on the 1:1 Linux/SuperH mapping
89 extern __inline__
unsigned long virt_to_phys(volatile void * address
)
91 return PHYSADDR(address
);
94 extern __inline__
void * phys_to_virt(unsigned long address
)
96 return (void *)KSEG0ADDR(address
);
99 extern void * ioremap(unsigned long phys_addr
, unsigned long size
);
100 extern void iounmap(void *addr
);
103 * readX/writeX() are used to access memory mapped devices. On some
104 * architectures the memory mapped IO stuff needs to be accessed
105 * differently. On the x86 architecture, we just read/write the
106 * memory location directly.
108 * On SH, we have the whole physical address space mapped at all times
109 * (as MIPS does), so "ioremap()" and "iounmap()" do not need to do
110 * anything. (This isn't true for all machines but we still handle
111 * these cases with wired TLB entries anyway ...)
113 * We cheat a bit and always return uncachable areas until we've fixed
114 * the drivers to handle caching properly.
116 extern __inline__
void * ioremap(unsigned long offset
, unsigned long size
)
118 return (void *) KSEG1ADDR(offset
);
122 * This one maps high address device memory and turns off caching for that area.
123 * it's useful if some control registers are in such an area and write combining
124 * or read caching is not desirable:
126 extern __inline__
void * ioremap_nocache (unsigned long offset
, unsigned long size
)
128 return (void *) KSEG1ADDR(offset
);
131 extern __inline__
void iounmap(void *addr
)
135 static __inline__
int check_signature(unsigned long io_addr
,
136 const unsigned char *signature
, int length
)
140 if (readb(io_addr
) != *signature
)
153 #define dma_cache_inv(_start,_size) do { } while (0)
154 #define dma_cache_wback(_start,_size) do { } while (0)
155 #define dma_cache_wback_inv(_start,_size) do { } while (0)
157 #endif /* __KERNEL__ */
158 #endif /* __ASM_SH_IO_H */