]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/asm-alpha/io_trivial.h
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. */
5 /* This file may be included multiple times. */
7 #if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
8 __EXTERN_INLINE
unsigned int
9 IO_CONCAT(__IO_PREFIX
,ioread8
)(void __iomem
*a
)
11 return __kernel_ldbu(*(volatile u8 __force
*)a
);
14 __EXTERN_INLINE
unsigned int
15 IO_CONCAT(__IO_PREFIX
,ioread16
)(void __iomem
*a
)
17 return __kernel_ldwu(*(volatile u16 __force
*)a
);
21 IO_CONCAT(__IO_PREFIX
,iowrite8
)(u8 b
, void __iomem
*a
)
23 __kernel_stb(b
, *(volatile u8 __force
*)a
);
27 IO_CONCAT(__IO_PREFIX
,iowrite16
)(u16 b
, void __iomem
*a
)
29 __kernel_stw(b
, *(volatile u16 __force
*)a
);
33 #if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
34 __EXTERN_INLINE
unsigned int
35 IO_CONCAT(__IO_PREFIX
,ioread32
)(void __iomem
*a
)
37 return *(volatile u32 __force
*)a
;
41 IO_CONCAT(__IO_PREFIX
,iowrite32
)(u32 b
, void __iomem
*a
)
43 *(volatile u32 __force
*)a
= b
;
47 #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
49 IO_CONCAT(__IO_PREFIX
,readb
)(const volatile void __iomem
*a
)
51 return __kernel_ldbu(*(const volatile u8 __force
*)a
);
55 IO_CONCAT(__IO_PREFIX
,readw
)(const volatile void __iomem
*a
)
57 return __kernel_ldwu(*(const volatile u16 __force
*)a
);
61 IO_CONCAT(__IO_PREFIX
,writeb
)(u8 b
, volatile void __iomem
*a
)
63 __kernel_stb(b
, *(volatile u8 __force
*)a
);
67 IO_CONCAT(__IO_PREFIX
,writew
)(u16 b
, volatile void __iomem
*a
)
69 __kernel_stw(b
, *(volatile u16 __force
*)a
);
71 #elif IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 2
73 IO_CONCAT(__IO_PREFIX
,readb
)(const volatile void __iomem
*a
)
75 return IO_CONCAT(__IO_PREFIX
,ioread8
)((void __iomem
*)a
);
79 IO_CONCAT(__IO_PREFIX
,readw
)(const volatile void __iomem
*a
)
81 return IO_CONCAT(__IO_PREFIX
,ioread16
)((void __iomem
*)a
);
85 IO_CONCAT(__IO_PREFIX
,writeb
)(u8 b
, volatile void __iomem
*a
)
87 IO_CONCAT(__IO_PREFIX
,iowrite8
)(b
, (void __iomem
*)a
);
91 IO_CONCAT(__IO_PREFIX
,writew
)(u16 b
, volatile void __iomem
*a
)
93 IO_CONCAT(__IO_PREFIX
,iowrite16
)(b
, (void __iomem
*)a
);
97 #if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
99 IO_CONCAT(__IO_PREFIX
,readl
)(const volatile void __iomem
*a
)
101 return *(const volatile u32 __force
*)a
;
105 IO_CONCAT(__IO_PREFIX
,readq
)(const volatile void __iomem
*a
)
107 return *(const volatile u64 __force
*)a
;
111 IO_CONCAT(__IO_PREFIX
,writel
)(u32 b
, volatile void __iomem
*a
)
113 *(volatile u32 __force
*)a
= b
;
117 IO_CONCAT(__IO_PREFIX
,writeq
)(u64 b
, volatile void __iomem
*a
)
119 *(volatile u64 __force
*)a
= b
;
123 #if IO_CONCAT(__IO_PREFIX,trivial_iounmap)
124 __EXTERN_INLINE
void IO_CONCAT(__IO_PREFIX
,iounmap
)(volatile void __iomem
*a
)