~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/kernel/iomap.c

Version: ~ [ linux-6.2-rc3 ] ~ [ linux-6.1.5 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.87 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.162 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.228 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.269 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.302 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * arch/sh/kernel/iomap.c
  4  *
  5  * Copyright (C) 2000  Niibe Yutaka
  6  * Copyright (C) 2005 - 2007 Paul Mundt
  7  */
  8 #include <linux/module.h>
  9 #include <linux/io.h>
 10 
 11 unsigned int ioread8(void __iomem *addr)
 12 {
 13         return readb(addr);
 14 }
 15 EXPORT_SYMBOL(ioread8);
 16 
 17 unsigned int ioread16(void __iomem *addr)
 18 {
 19         return readw(addr);
 20 }
 21 EXPORT_SYMBOL(ioread16);
 22 
 23 unsigned int ioread16be(void __iomem *addr)
 24 {
 25         return be16_to_cpu(__raw_readw(addr));
 26 }
 27 EXPORT_SYMBOL(ioread16be);
 28 
 29 unsigned int ioread32(void __iomem *addr)
 30 {
 31         return readl(addr);
 32 }
 33 EXPORT_SYMBOL(ioread32);
 34 
 35 unsigned int ioread32be(void __iomem *addr)
 36 {
 37         return be32_to_cpu(__raw_readl(addr));
 38 }
 39 EXPORT_SYMBOL(ioread32be);
 40 
 41 void iowrite8(u8 val, void __iomem *addr)
 42 {
 43         writeb(val, addr);
 44 }
 45 EXPORT_SYMBOL(iowrite8);
 46 
 47 void iowrite16(u16 val, void __iomem *addr)
 48 {
 49         writew(val, addr);
 50 }
 51 EXPORT_SYMBOL(iowrite16);
 52 
 53 void iowrite16be(u16 val, void __iomem *addr)
 54 {
 55         __raw_writew(cpu_to_be16(val), addr);
 56 }
 57 EXPORT_SYMBOL(iowrite16be);
 58 
 59 void iowrite32(u32 val, void __iomem *addr)
 60 {
 61         writel(val, addr);
 62 }
 63 EXPORT_SYMBOL(iowrite32);
 64 
 65 void iowrite32be(u32 val, void __iomem *addr)
 66 {
 67         __raw_writel(cpu_to_be32(val), addr);
 68 }
 69 EXPORT_SYMBOL(iowrite32be);
 70 
 71 /*
 72  * These are the "repeat MMIO read/write" functions.
 73  * Note the "__raw" accesses, since we don't want to
 74  * convert to CPU byte order. We write in "IO byte
 75  * order" (we also don't have IO barriers).
 76  */
 77 static inline void mmio_insb(void __iomem *addr, u8 *dst, int count)
 78 {
 79         while (--count >= 0) {
 80                 u8 data = __raw_readb(addr);
 81                 *dst = data;
 82                 dst++;
 83         }
 84 }
 85 
 86 static inline void mmio_insw(void __iomem *addr, u16 *dst, int count)
 87 {
 88         while (--count >= 0) {
 89                 u16 data = __raw_readw(addr);
 90                 *dst = data;
 91                 dst++;
 92         }
 93 }
 94 
 95 static inline void mmio_insl(void __iomem *addr, u32 *dst, int count)
 96 {
 97         while (--count >= 0) {
 98                 u32 data = __raw_readl(addr);
 99                 *dst = data;
100                 dst++;
101         }
102 }
103 
104 static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count)
105 {
106         while (--count >= 0) {
107                 __raw_writeb(*src, addr);
108                 src++;
109         }
110 }
111 
112 static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count)
113 {
114         while (--count >= 0) {
115                 __raw_writew(*src, addr);
116                 src++;
117         }
118 }
119 
120 static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count)
121 {
122         while (--count >= 0) {
123                 __raw_writel(*src, addr);
124                 src++;
125         }
126 }
127 
128 void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
129 {
130         mmio_insb(addr, dst, count);
131 }
132 EXPORT_SYMBOL(ioread8_rep);
133 
134 void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
135 {
136         mmio_insw(addr, dst, count);
137 }
138 EXPORT_SYMBOL(ioread16_rep);
139 
140 void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
141 {
142         mmio_insl(addr, dst, count);
143 }
144 EXPORT_SYMBOL(ioread32_rep);
145 
146 void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
147 {
148         mmio_outsb(addr, src, count);
149 }
150 EXPORT_SYMBOL(iowrite8_rep);
151 
152 void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
153 {
154         mmio_outsw(addr, src, count);
155 }
156 EXPORT_SYMBOL(iowrite16_rep);
157 
158 void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
159 {
160         mmio_outsl(addr, src, count);
161 }
162 EXPORT_SYMBOL(iowrite32_rep);
163 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp