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

TOMOYO Linux Cross Reference
Linux/arch/sparc/include/asm/io_32.h

Version: ~ [ linux-5.1-rc2 ] ~ [ linux-5.0.4 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.31 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.108 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.165 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.177 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.137 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __SPARC_IO_H
  3 #define __SPARC_IO_H
  4 
  5 #include <linux/kernel.h>
  6 #include <linux/ioport.h>  /* struct resource */
  7 
  8 #define IO_SPACE_LIMIT 0xffffffff
  9 
 10 #define memset_io(d,c,sz)     _memset_io(d,c,sz)
 11 #define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
 12 #define memcpy_toio(d,s,sz)   _memcpy_toio(d,s,sz)
 13 
 14 #include <asm-generic/io.h>
 15 
 16 static inline void _memset_io(volatile void __iomem *dst,
 17                               int c, __kernel_size_t n)
 18 {
 19         volatile void __iomem *d = dst;
 20 
 21         while (n--) {
 22                 writeb(c, d);
 23                 d++;
 24         }
 25 }
 26 
 27 static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
 28                                   __kernel_size_t n)
 29 {
 30         char *d = dst;
 31 
 32         while (n--) {
 33                 char tmp = readb(src);
 34                 *d++ = tmp;
 35                 src++;
 36         }
 37 }
 38 
 39 static inline void _memcpy_toio(volatile void __iomem *dst, const void *src,
 40                                 __kernel_size_t n)
 41 {
 42         const char *s = src;
 43         volatile void __iomem *d = dst;
 44 
 45         while (n--) {
 46                 char tmp = *s++;
 47                 writeb(tmp, d);
 48                 d++;
 49         }
 50 }
 51 
 52 /*
 53  * SBus accessors.
 54  *
 55  * SBus has only one, memory mapped, I/O space.
 56  * We do not need to flip bytes for SBus of course.
 57  */
 58 static inline u8 sbus_readb(const volatile void __iomem *addr)
 59 {
 60         return *(__force volatile u8 *)addr;
 61 }
 62 
 63 static inline u16 sbus_readw(const volatile void __iomem *addr)
 64 {
 65         return *(__force volatile u16 *)addr;
 66 }
 67 
 68 static inline u32 sbus_readl(const volatile void __iomem *addr)
 69 {
 70         return *(__force volatile u32 *)addr;
 71 }
 72 
 73 static inline void sbus_writeb(u8 b, volatile void __iomem *addr)
 74 {
 75         *(__force volatile u8 *)addr = b;
 76 }
 77 
 78 static inline void sbus_writew(u16 w, volatile void __iomem *addr)
 79 {
 80         *(__force volatile u16 *)addr = w;
 81 }
 82 
 83 static inline void sbus_writel(u32 l, volatile void __iomem *addr)
 84 {
 85         *(__force volatile u32 *)addr = l;
 86 }
 87 
 88 static inline void sbus_memset_io(volatile void __iomem *__dst, int c,
 89                                   __kernel_size_t n)
 90 {
 91         while(n--) {
 92                 sbus_writeb(c, __dst);
 93                 __dst++;
 94         }
 95 }
 96 
 97 static inline void sbus_memcpy_fromio(void *dst,
 98                                       const volatile void __iomem *src,
 99                                       __kernel_size_t n)
100 {
101         char *d = dst;
102 
103         while (n--) {
104                 char tmp = sbus_readb(src);
105                 *d++ = tmp;
106                 src++;
107         }
108 }
109 
110 static inline void sbus_memcpy_toio(volatile void __iomem *dst,
111                                     const void *src,
112                                     __kernel_size_t n)
113 {
114         const char *s = src;
115         volatile void __iomem *d = dst;
116 
117         while (n--) {
118                 char tmp = *s++;
119                 sbus_writeb(tmp, d);
120                 d++;
121         }
122 }
123 
124 #ifdef __KERNEL__
125 
126 /*
127  * Bus number may be embedded in the higher bits of the physical address.
128  * This is why we have no bus number argument to ioremap().
129  */
130 void iounmap(volatile void __iomem *addr);
131 /* Create a virtual mapping cookie for an IO port range */
132 void __iomem *ioport_map(unsigned long port, unsigned int nr);
133 void ioport_unmap(void __iomem *);
134 
135 /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
136 struct pci_dev;
137 void pci_iounmap(struct pci_dev *dev, void __iomem *);
138 
139 static inline int sbus_can_dma_64bit(void)
140 {
141         return 0; /* actually, sparc_cpu_model==sun4d */
142 }
143 static inline int sbus_can_burst64(void)
144 {
145         return 0; /* actually, sparc_cpu_model==sun4d */
146 }
147 struct device;
148 void sbus_set_sbus64(struct device *, int);
149 
150 #endif
151 
152 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED          1
153 
154 
155 #endif /* !(__SPARC_IO_H) */
156 

~ [ 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