aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/include/asm/io_trivial.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/alpha/include/asm/io_trivial.h')
-rw-r--r--arch/alpha/include/asm/io_trivial.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/io_trivial.h b/arch/alpha/include/asm/io_trivial.h
new file mode 100644
index 000000000000..1c77f10b4b36
--- /dev/null
+++ b/arch/alpha/include/asm/io_trivial.h
@@ -0,0 +1,131 @@
1/* Trivial implementations of basic i/o routines. Assumes that all
2 of the hard work has been done by ioremap and ioportmap, and that
3 access to i/o space is linear. */
4
5/* This file may be included multiple times. */
6
7#if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
8__EXTERN_INLINE unsigned int
9IO_CONCAT(__IO_PREFIX,ioread8)(void __iomem *a)
10{
11 return __kernel_ldbu(*(volatile u8 __force *)a);
12}
13
14__EXTERN_INLINE unsigned int
15IO_CONCAT(__IO_PREFIX,ioread16)(void __iomem *a)
16{
17 return __kernel_ldwu(*(volatile u16 __force *)a);
18}
19
20__EXTERN_INLINE void
21IO_CONCAT(__IO_PREFIX,iowrite8)(u8 b, void __iomem *a)
22{
23 __kernel_stb(b, *(volatile u8 __force *)a);
24}
25
26__EXTERN_INLINE void
27IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)
28{
29 __kernel_stw(b, *(volatile u16 __force *)a);
30}
31#endif
32
33#if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
34__EXTERN_INLINE unsigned int
35IO_CONCAT(__IO_PREFIX,ioread32)(void __iomem *a)
36{
37 return *(volatile u32 __force *)a;
38}
39
40__EXTERN_INLINE void
41IO_CONCAT(__IO_PREFIX,iowrite32)(u32 b, void __iomem *a)
42{
43 *(volatile u32 __force *)a = b;
44}
45#endif
46
47#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
48__EXTERN_INLINE u8
49IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
50{
51 return __kernel_ldbu(*(const volatile u8 __force *)a);
52}
53
54__EXTERN_INLINE u16
55IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
56{
57 return __kernel_ldwu(*(const volatile u16 __force *)a);
58}
59
60__EXTERN_INLINE void
61IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
62{
63 __kernel_stb(b, *(volatile u8 __force *)a);
64}
65
66__EXTERN_INLINE void
67IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
68{
69 __kernel_stw(b, *(volatile u16 __force *)a);
70}
71#elif IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 2
72__EXTERN_INLINE u8
73IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
74{
75 void __iomem *addr = (void __iomem *)a;
76 return IO_CONCAT(__IO_PREFIX,ioread8)(addr);
77}
78
79__EXTERN_INLINE u16
80IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
81{
82 void __iomem *addr = (void __iomem *)a;
83 return IO_CONCAT(__IO_PREFIX,ioread16)(addr);
84}
85
86__EXTERN_INLINE void
87IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
88{
89 void __iomem *addr = (void __iomem *)a;
90 IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
91}
92
93__EXTERN_INLINE void
94IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
95{
96 void __iomem *addr = (void __iomem *)a;
97 IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
98}
99#endif
100
101#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
102__EXTERN_INLINE u32
103IO_CONCAT(__IO_PREFIX,readl)(const volatile void __iomem *a)
104{
105 return *(const volatile u32 __force *)a;
106}
107
108__EXTERN_INLINE u64
109IO_CONCAT(__IO_PREFIX,readq)(const volatile void __iomem *a)
110{
111 return *(const volatile u64 __force *)a;
112}
113
114__EXTERN_INLINE void
115IO_CONCAT(__IO_PREFIX,writel)(u32 b, volatile void __iomem *a)
116{
117 *(volatile u32 __force *)a = b;
118}
119
120__EXTERN_INLINE void
121IO_CONCAT(__IO_PREFIX,writeq)(u64 b, volatile void __iomem *a)
122{
123 *(volatile u64 __force *)a = b;
124}
125#endif
126
127#if IO_CONCAT(__IO_PREFIX,trivial_iounmap)
128__EXTERN_INLINE void IO_CONCAT(__IO_PREFIX,iounmap)(volatile void __iomem *a)
129{
130}
131#endif