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

TOMOYO Linux Cross Reference
Linux/arch/arm64/kernel/io.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm64/kernel/io.c (Architecture mips) and /arch/sparc64/kernel/io.c (Architecture sparc64)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Based on arch/arm/kernel/io.c                  
  4  *                                                
  5  * Copyright (C) 2012 ARM Ltd.                    
  6  */                                               
  7                                                   
  8 #include <linux/export.h>                         
  9 #include <linux/types.h>                          
 10 #include <linux/io.h>                             
 11                                                   
 12 /*                                                
 13  * Copy data from IO memory space to "real" me    
 14  */                                               
 15 void __memcpy_fromio(void *to, const volatile     
 16 {                                                 
 17         while (count && !IS_ALIGNED((unsigned     
 18                 *(u8 *)to = __raw_readb(from);    
 19                 from++;                           
 20                 to++;                             
 21                 count--;                          
 22         }                                         
 23                                                   
 24         while (count >= 8) {                      
 25                 *(u64 *)to = __raw_readq(from)    
 26                 from += 8;                        
 27                 to += 8;                          
 28                 count -= 8;                       
 29         }                                         
 30                                                   
 31         while (count) {                           
 32                 *(u8 *)to = __raw_readb(from);    
 33                 from++;                           
 34                 to++;                             
 35                 count--;                          
 36         }                                         
 37 }                                                 
 38 EXPORT_SYMBOL(__memcpy_fromio);                   
 39                                                   
 40 /*                                                
 41  * This generates a memcpy that works on a fro    
 42  * bits. Count is in terms of the number of bi    
 43  * optimizes to use the STR groupings when pos    
 44  */                                               
 45 #define memcpy_toio_aligned(to, from, count, b    
 46         ({                                        
 47                 volatile u##bits __iomem *_to     
 48                 const u##bits *_from = from;      
 49                 size_t _count = count;            
 50                 const u##bits *_end_from = _fr    
 51                                                   
 52                 for (; _from < _end_from; _fro    
 53                         __const_memcpy_toio_al    
 54                 if ((_count % 8) >= 4) {          
 55                         __const_memcpy_toio_al    
 56                         _from += 4;               
 57                         _to += 4;                 
 58                 }                                 
 59                 if ((_count % 4) >= 2) {          
 60                         __const_memcpy_toio_al    
 61                         _from += 2;               
 62                         _to += 2;                 
 63                 }                                 
 64                 if (_count % 2)                   
 65                         __const_memcpy_toio_al    
 66         })                                        
 67                                                   
 68 void __iowrite64_copy_full(void __iomem *to, c    
 69 {                                                 
 70         memcpy_toio_aligned(to, from, count, 6    
 71         dgh();                                    
 72 }                                                 
 73 EXPORT_SYMBOL(__iowrite64_copy_full);             
 74                                                   
 75 void __iowrite32_copy_full(void __iomem *to, c    
 76 {                                                 
 77         memcpy_toio_aligned(to, from, count, 3    
 78         dgh();                                    
 79 }                                                 
 80 EXPORT_SYMBOL(__iowrite32_copy_full);             
 81                                                   
 82 /*                                                
 83  * Copy data from "real" memory space to IO me    
 84  */                                               
 85 void __memcpy_toio(volatile void __iomem *to,     
 86 {                                                 
 87         while (count && !IS_ALIGNED((unsigned     
 88                 __raw_writeb(*(u8 *)from, to);    
 89                 from++;                           
 90                 to++;                             
 91                 count--;                          
 92         }                                         
 93                                                   
 94         while (count >= 8) {                      
 95                 __raw_writeq(*(u64 *)from, to)    
 96                 from += 8;                        
 97                 to += 8;                          
 98                 count -= 8;                       
 99         }                                         
100                                                   
101         while (count) {                           
102                 __raw_writeb(*(u8 *)from, to);    
103                 from++;                           
104                 to++;                             
105                 count--;                          
106         }                                         
107 }                                                 
108 EXPORT_SYMBOL(__memcpy_toio);                     
109                                                   
110 /*                                                
111  * "memset" on IO memory space.                   
112  */                                               
113 void __memset_io(volatile void __iomem *dst, i    
114 {                                                 
115         u64 qc = (u8)c;                           
116                                                   
117         qc |= qc << 8;                            
118         qc |= qc << 16;                           
119         qc |= qc << 32;                           
120                                                   
121         while (count && !IS_ALIGNED((unsigned     
122                 __raw_writeb(c, dst);             
123                 dst++;                            
124                 count--;                          
125         }                                         
126                                                   
127         while (count >= 8) {                      
128                 __raw_writeq(qc, dst);            
129                 dst += 8;                         
130                 count -= 8;                       
131         }                                         
132                                                   
133         while (count) {                           
134                 __raw_writeb(c, dst);             
135                 dst++;                            
136                 count--;                          
137         }                                         
138 }                                                 
139 EXPORT_SYMBOL(__memset_io);                       
140                                                   

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php