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

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/mc146818rtc.h

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/x86/include/asm/mc146818rtc.h (Architecture sparc64) and /arch/ppc/include/asm-ppc/mc146818rtc.h (Architecture ppc)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 /*                                                
  3  * Machine dependent access functions for RTC     
  4  */                                               
  5 #ifndef _ASM_X86_MC146818RTC_H                    
  6 #define _ASM_X86_MC146818RTC_H                    
  7                                                   
  8 #include <asm/io.h>                               
  9 #include <asm/processor.h>                        
 10                                                   
 11 #ifndef RTC_PORT                                  
 12 #define RTC_PORT(x)     (0x70 + (x))              
 13 #define RTC_ALWAYS_BCD  1       /* RTC operate    
 14 #endif                                            
 15                                                   
 16 #if defined(CONFIG_X86_32)                        
 17 /*                                                
 18  * This lock provides nmi access to the CMOS/R    
 19  * special properties.  It is owned by a CPU a    
 20  * currently being accessed (if owned).  The i    
 21  * like a normal lock (normally).  However, in    
 22  * first check to see if its CPU owns the lock    
 23  * interrupted during the read/write of the de    
 24  * and performs the access and then restores t    
 25  * not, it locks normally.                        
 26  *                                                
 27  * Note that since we are working with NMIs, w    
 28  * a non-SMP machine just to mark that the loc    
 29  *                                                
 30  * This only works with compare-and-swap.  The    
 31  * atomically claim the lock and set the owner    
 32  */                                               
 33 #include <linux/smp.h>                            
 34 extern volatile unsigned long cmos_lock;          
 35                                                   
 36 /*                                                
 37  * All of these below must be called with inte    
 38  * disabled, etc.                                 
 39  */                                               
 40                                                   
 41 static inline void lock_cmos(unsigned char reg    
 42 {                                                 
 43         unsigned long new;                        
 44         new = ((smp_processor_id() + 1) << 8)     
 45         for (;;) {                                
 46                 if (cmos_lock) {                  
 47                         cpu_relax();              
 48                         continue;                 
 49                 }                                 
 50                 if (__cmpxchg(&cmos_lock, 0, n    
 51                         return;                   
 52         }                                         
 53 }                                                 
 54                                                   
 55 static inline void unlock_cmos(void)              
 56 {                                                 
 57         cmos_lock = 0;                            
 58 }                                                 
 59                                                   
 60 static inline int do_i_have_lock_cmos(void)       
 61 {                                                 
 62         return (cmos_lock >> 8) == (smp_proces    
 63 }                                                 
 64                                                   
 65 static inline unsigned char current_lock_cmos_    
 66 {                                                 
 67         return cmos_lock & 0xff;                  
 68 }                                                 
 69                                                   
 70 #define lock_cmos_prefix(reg)                     
 71         do {                                      
 72                 unsigned long cmos_flags;         
 73                 local_irq_save(cmos_flags);       
 74                 lock_cmos(reg)                    
 75                                                   
 76 #define lock_cmos_suffix(reg)                     
 77         unlock_cmos();                            
 78         local_irq_restore(cmos_flags);            
 79         } while (0)                               
 80 #else                                             
 81 #define lock_cmos_prefix(reg) do {} while (0)     
 82 #define lock_cmos_suffix(reg) do {} while (0)     
 83 #define lock_cmos(reg) do { } while (0)           
 84 #define unlock_cmos() do { } while (0)            
 85 #define do_i_have_lock_cmos() 0                   
 86 #define current_lock_cmos_reg() 0                 
 87 #endif                                            
 88                                                   
 89 /*                                                
 90  * The yet supported machines all access the R    
 91  * an ISA port access but the way to access th    
 92  */                                               
 93 #define CMOS_READ(addr) rtc_cmos_read(addr)       
 94 #define CMOS_WRITE(val, addr) rtc_cmos_write(v    
 95 unsigned char rtc_cmos_read(unsigned char addr    
 96 void rtc_cmos_write(unsigned char val, unsigne    
 97                                                   
 98 extern int mach_set_cmos_time(const struct tim    
 99 extern void mach_get_cmos_time(struct timespec    
100                                                   
101 #define RTC_IRQ 8                                 
102                                                   
103 #endif /* _ASM_X86_MC146818RTC_H */               
104                                                   

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