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

TOMOYO Linux Cross Reference
Linux/arch/m68k/emu/nfcon.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/m68k/emu/nfcon.c (Version linux-6.12-rc7) and /arch/alpha/emu/nfcon.c (Version linux-6.8.12)


  1 /*                                                  1 
  2  * ARAnyM console driver                          
  3  *                                                
  4  * This file is subject to the terms and condi    
  5  * License.  See the file COPYING in the main     
  6  * for more details.                              
  7  */                                               
  8                                                   
  9 #include <linux/module.h>                         
 10 #include <linux/init.h>                           
 11 #include <linux/console.h>                        
 12 #include <linux/tty.h>                            
 13 #include <linux/tty_driver.h>                     
 14 #include <linux/tty_flip.h>                       
 15 #include <linux/slab.h>                           
 16 #include <linux/err.h>                            
 17 #include <linux/uaccess.h>                        
 18 #include <linux/io.h>                             
 19                                                   
 20 #include <asm/natfeat.h>                          
 21                                                   
 22 static int stderr_id;                             
 23 static struct tty_port nfcon_tty_port;            
 24 static struct tty_driver *nfcon_tty_driver;       
 25                                                   
 26 static void nfputs(const u8 *str, size_t count    
 27 {                                                 
 28         u8 buf[68];                               
 29         unsigned long phys = virt_to_phys(buf)    
 30                                                   
 31         buf[64] = 0;                              
 32         while (count > 64) {                      
 33                 memcpy(buf, str, 64);             
 34                 nf_call(stderr_id, phys);         
 35                 str += 64;                        
 36                 count -= 64;                      
 37         }                                         
 38         memcpy(buf, str, count);                  
 39         buf[count] = 0;                           
 40         nf_call(stderr_id, phys);                 
 41 }                                                 
 42                                                   
 43 static void nfcon_write(struct console *con, c    
 44                         unsigned int count)       
 45 {                                                 
 46         nfputs(str, count);                       
 47 }                                                 
 48                                                   
 49 static struct tty_driver *nfcon_device(struct     
 50 {                                                 
 51         *index = 0;                               
 52         return console_is_registered(con) ? nf    
 53 }                                                 
 54                                                   
 55 static struct console nf_console = {              
 56         .name   = "nfcon",                        
 57         .write  = nfcon_write,                    
 58         .device = nfcon_device,                   
 59         .flags  = CON_PRINTBUFFER,                
 60         .index  = -1,                             
 61 };                                                
 62                                                   
 63                                                   
 64 static int nfcon_tty_open(struct tty_struct *t    
 65 {                                                 
 66         return 0;                                 
 67 }                                                 
 68                                                   
 69 static void nfcon_tty_close(struct tty_struct     
 70 {                                                 
 71 }                                                 
 72                                                   
 73 static ssize_t nfcon_tty_write(struct tty_stru    
 74                                size_t count)      
 75 {                                                 
 76         nfputs(buf, count);                       
 77         return count;                             
 78 }                                                 
 79                                                   
 80 static int nfcon_tty_put_char(struct tty_struc    
 81 {                                                 
 82         u8 temp[2] = { ch, 0 };                   
 83                                                   
 84         nf_call(stderr_id, virt_to_phys(temp))    
 85         return 1;                                 
 86 }                                                 
 87                                                   
 88 static unsigned int nfcon_tty_write_room(struc    
 89 {                                                 
 90         return 64;                                
 91 }                                                 
 92                                                   
 93 static const struct tty_operations nfcon_tty_o    
 94         .open           = nfcon_tty_open,         
 95         .close          = nfcon_tty_close,        
 96         .write          = nfcon_tty_write,        
 97         .put_char       = nfcon_tty_put_char,     
 98         .write_room     = nfcon_tty_write_room    
 99 };                                                
100                                                   
101 #ifndef MODULE                                    
102                                                   
103 static int __init nf_debug_setup(char *arg)       
104 {                                                 
105         if (strcmp(arg, "nfcon"))                 
106                 return 0;                         
107                                                   
108         stderr_id = nf_get_id("NF_STDERR");       
109         if (stderr_id) {                          
110                 /*                                
111                  * The console will be enabled    
112                  * as a kernel parameter. Sinc    
113                  * of enabling consoles, it mu    
114                  */                               
115                 nf_console.flags |= CON_ENABLE    
116                 register_console(&nf_console);    
117         }                                         
118                                                   
119         return 0;                                 
120 }                                                 
121                                                   
122 early_param("debug", nf_debug_setup);             
123                                                   
124 #endif /* !MODULE */                              
125                                                   
126 static int __init nfcon_init(void)                
127 {                                                 
128         struct tty_driver *driver;                
129         int res;                                  
130                                                   
131         stderr_id = nf_get_id("NF_STDERR");       
132         if (!stderr_id)                           
133                 return -ENODEV;                   
134                                                   
135         driver = tty_alloc_driver(1, TTY_DRIVE    
136         if (IS_ERR(driver))                       
137                 return PTR_ERR(driver);           
138                                                   
139         tty_port_init(&nfcon_tty_port);           
140                                                   
141         driver->driver_name = "nfcon";            
142         driver->name = "nfcon";                   
143         driver->type = TTY_DRIVER_TYPE_SYSTEM;    
144         driver->subtype = SYSTEM_TYPE_TTY;        
145         driver->init_termios = tty_std_termios    
146                                                   
147         tty_set_operations(driver, &nfcon_tty_    
148         tty_port_link_device(&nfcon_tty_port,     
149         res = tty_register_driver(driver);        
150         if (res) {                                
151                 pr_err("failed to register nfc    
152                 tty_driver_kref_put(driver);      
153                 tty_port_destroy(&nfcon_tty_po    
154                 return res;                       
155         }                                         
156                                                   
157         nfcon_tty_driver = driver;                
158                                                   
159         if (!console_is_registered(&nf_console    
160                 register_console(&nf_console);    
161                                                   
162         return 0;                                 
163 }                                                 
164                                                   
165 static void __exit nfcon_exit(void)               
166 {                                                 
167         unregister_console(&nf_console);          
168         tty_unregister_driver(nfcon_tty_driver    
169         tty_driver_kref_put(nfcon_tty_driver);    
170         tty_port_destroy(&nfcon_tty_port);        
171 }                                                 
172                                                   
173 module_init(nfcon_init);                          
174 module_exit(nfcon_exit);                          
175                                                   
176 MODULE_DESCRIPTION("Atari NatFeat console driv    
177 MODULE_LICENSE("GPL");                            
178                                                   

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