1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef __ASM_OPENRISC_IO_H
21#define __ASM_OPENRISC_IO_H
22
23
24
25
26
27
28#define MAP_NOCACHE (0)
29#define MAP_WRCOMBINE (0)
30#define MAP_WRBACK (0)
31#define MAP_WRTHROUGH (0)
32
33static inline void *
34map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
35{
36 return (void *)paddr;
37}
38
39
40
41
42static inline void unmap_physmem(void *vaddr, unsigned long flags)
43{
44
45}
46
47
48
49
50static inline phys_addr_t virt_to_phys(void *vaddr)
51{
52 return (phys_addr_t)(vaddr);
53}
54
55
56
57
58
59
60
61
62#define readb(addr) (*(volatile unsigned char *) (addr))
63#define readw(addr) (*(volatile unsigned short *) (addr))
64#define readl(addr) (*(volatile unsigned int *) (addr))
65#define __raw_readb readb
66#define __raw_readw readw
67#define __raw_readl readl
68
69#define writeb(b, addr) ((*(volatile unsigned char *) (addr)) = (b))
70#define writew(b, addr) ((*(volatile unsigned short *) (addr)) = (b))
71#define writel(b, addr) ((*(volatile unsigned int *) (addr)) = (b))
72#define __raw_writeb writeb
73#define __raw_writew writew
74#define __raw_writel writel
75
76#define memset_io(a, b, c) memset((void *)(a), (b), (c))
77#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
78#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
79
80
81
82
83
84
85#define IO_BASE 0x0
86#define IO_SPACE_LIMIT 0xffffffff
87
88#define inb(port) readb((port + IO_BASE))
89#define outb(value, port) writeb((value), (port + IO_BASE))
90#define inb_p(port) inb((port))
91#define outb_p(value, port) outb((value), (port))
92
93
94
95
96
97#define xlate_dev_mem_ptr(p) __va(p)
98
99
100
101
102#define xlate_dev_kmem_ptr(p) p
103
104#define ioread8(addr) readb(addr)
105#define ioread16(addr) readw(addr)
106#define ioread32(addr) readl(addr)
107
108#define iowrite8(v, addr) writeb((v), (addr))
109#define iowrite16(v, addr) writew((v), (addr))
110#define iowrite32(v, addr) writel((v), (addr))
111
112#endif
113