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

TOMOYO Linux Cross Reference
Linux/include/linux/nvram.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 /include/linux/nvram.h (Version linux-6.12-rc7) and /include/linux/nvram.h (Version ccs-tools-1.8.12)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _LINUX_NVRAM_H                            
  3 #define _LINUX_NVRAM_H                            
  4                                                   
  5 #include <linux/errno.h>                          
  6 #include <uapi/linux/nvram.h>                     
  7                                                   
  8 #ifdef CONFIG_PPC                                 
  9 #include <asm/machdep.h>                          
 10 #endif                                            
 11                                                   
 12 /**                                               
 13  * struct nvram_ops - NVRAM functionality made    
 14  * @read: validate checksum (if any) then load    
 15  * @write: store a range of bytes to NVRAM the    
 16  * @read_byte: load a single byte from NVRAM      
 17  * @write_byte: store a single byte to NVRAM      
 18  * @get_size: return the fixed number of bytes    
 19  *                                                
 20  * Architectures which provide an nvram ops st    
 21  * of these methods. If the NVRAM hardware can    
 22  * at a time then it may be sufficient to prov    
 23  * If the NVRAM has a checksum (and it is to b    
 24  * .write methods can be used to implement tha    
 25  *                                                
 26  * Portable drivers may use the wrapper functi    
 27  * The nvram_read() and nvram_write() function    
 28  * methods when available and fall back on the    
 29  * methods otherwise.                             
 30  */                                               
 31                                                   
 32 struct nvram_ops {                                
 33         ssize_t         (*get_size)(void);        
 34         unsigned char   (*read_byte)(int);        
 35         void            (*write_byte)(unsigned    
 36         ssize_t         (*read)(char *, size_t    
 37         ssize_t         (*write)(char *, size_    
 38 #if defined(CONFIG_X86) || defined(CONFIG_M68K    
 39         long            (*initialize)(void);      
 40         long            (*set_checksum)(void);    
 41 #endif                                            
 42 };                                                
 43                                                   
 44 extern const struct nvram_ops arch_nvram_ops;     
 45                                                   
 46 static inline ssize_t nvram_get_size(void)        
 47 {                                                 
 48 #ifdef CONFIG_PPC                                 
 49         if (ppc_md.nvram_size)                    
 50                 return ppc_md.nvram_size();       
 51 #else                                             
 52         if (arch_nvram_ops.get_size)              
 53                 return arch_nvram_ops.get_size    
 54 #endif                                            
 55         return -ENODEV;                           
 56 }                                                 
 57                                                   
 58 static inline unsigned char nvram_read_byte(in    
 59 {                                                 
 60 #ifdef CONFIG_PPC                                 
 61         if (ppc_md.nvram_read_val)                
 62                 return ppc_md.nvram_read_val(a    
 63 #else                                             
 64         if (arch_nvram_ops.read_byte)             
 65                 return arch_nvram_ops.read_byt    
 66 #endif                                            
 67         return 0xFF;                              
 68 }                                                 
 69                                                   
 70 static inline void nvram_write_byte(unsigned c    
 71 {                                                 
 72 #ifdef CONFIG_PPC                                 
 73         if (ppc_md.nvram_write_val)               
 74                 ppc_md.nvram_write_val(addr, v    
 75 #else                                             
 76         if (arch_nvram_ops.write_byte)            
 77                 arch_nvram_ops.write_byte(val,    
 78 #endif                                            
 79 }                                                 
 80                                                   
 81 static inline ssize_t nvram_read_bytes(char *b    
 82 {                                                 
 83         ssize_t nvram_size = nvram_get_size();    
 84         loff_t i;                                 
 85         char *p = buf;                            
 86                                                   
 87         if (nvram_size < 0)                       
 88                 return nvram_size;                
 89         for (i = *ppos; count > 0 && i < nvram    
 90                 *p = nvram_read_byte(i);          
 91         *ppos = i;                                
 92         return p - buf;                           
 93 }                                                 
 94                                                   
 95 static inline ssize_t nvram_write_bytes(char *    
 96 {                                                 
 97         ssize_t nvram_size = nvram_get_size();    
 98         loff_t i;                                 
 99         char *p = buf;                            
100                                                   
101         if (nvram_size < 0)                       
102                 return nvram_size;                
103         for (i = *ppos; count > 0 && i < nvram    
104                 nvram_write_byte(*p, i);          
105         *ppos = i;                                
106         return p - buf;                           
107 }                                                 
108                                                   
109 static inline ssize_t nvram_read(char *buf, si    
110 {                                                 
111 #ifdef CONFIG_PPC                                 
112         if (ppc_md.nvram_read)                    
113                 return ppc_md.nvram_read(buf,     
114 #else                                             
115         if (arch_nvram_ops.read)                  
116                 return arch_nvram_ops.read(buf    
117 #endif                                            
118         return nvram_read_bytes(buf, count, pp    
119 }                                                 
120                                                   
121 static inline ssize_t nvram_write(char *buf, s    
122 {                                                 
123 #ifdef CONFIG_PPC                                 
124         if (ppc_md.nvram_write)                   
125                 return ppc_md.nvram_write(buf,    
126 #else                                             
127         if (arch_nvram_ops.write)                 
128                 return arch_nvram_ops.write(bu    
129 #endif                                            
130         return nvram_write_bytes(buf, count, p    
131 }                                                 
132                                                   
133 #endif  /* _LINUX_NVRAM_H */                      
134                                                   

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