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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/sysdev/udbg_memcons.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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/powerpc/sysdev/udbg_memcons.c (Version linux-6.12-rc7) and /arch/i386/sysdev/udbg_memcons.c (Version linux-6.6.45)


** Warning: Cannot open xref database.

  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * A udbg backend which logs messages and read    
  4  * buffers.                                       
  5  *                                                
  6  * The console output can be read from memcons    
  7  * circular buffer whose next write position i    
  8  *                                                
  9  * Input may be passed by writing into the mem    
 10  * empty. The input buffer is empty when both     
 11  * *input_start == '\0'.                          
 12  *                                                
 13  * Copyright (C) 2003-2005 Anton Blanchard and    
 14  * Copyright (C) 2013 Alistair Popple, IBM Cor    
 15  */                                               
 16                                                   
 17 #include <linux/kernel.h>                         
 18 #include <asm/barrier.h>                          
 19 #include <asm/page.h>                             
 20 #include <asm/processor.h>                        
 21 #include <asm/udbg.h>                             
 22                                                   
 23 struct memcons {                                  
 24         char *output_start;                       
 25         char *output_pos;                         
 26         char *output_end;                         
 27         char *input_start;                        
 28         char *input_pos;                          
 29         char *input_end;                          
 30 };                                                
 31                                                   
 32 static char memcons_output[CONFIG_PPC_MEMCONS_    
 33 static char memcons_input[CONFIG_PPC_MEMCONS_I    
 34                                                   
 35 struct memcons memcons = {                        
 36         .output_start = memcons_output,           
 37         .output_pos = memcons_output,             
 38         .output_end = &memcons_output[CONFIG_P    
 39         .input_start = memcons_input,             
 40         .input_pos = memcons_input,               
 41         .input_end = &memcons_input[CONFIG_PPC    
 42 };                                                
 43                                                   
 44 static void memcons_putc(char c)                  
 45 {                                                 
 46         char *new_output_pos;                     
 47                                                   
 48         *memcons.output_pos = c;                  
 49         wmb();                                    
 50         new_output_pos = memcons.output_pos +     
 51         if (new_output_pos >= memcons.output_e    
 52                 new_output_pos = memcons.outpu    
 53                                                   
 54         memcons.output_pos = new_output_pos;      
 55 }                                                 
 56                                                   
 57 static int memcons_getc_poll(void)                
 58 {                                                 
 59         char c;                                   
 60         char *new_input_pos;                      
 61                                                   
 62         if (*memcons.input_pos) {                 
 63                 c = *memcons.input_pos;           
 64                                                   
 65                 new_input_pos = memcons.input_    
 66                 if (new_input_pos >= memcons.i    
 67                         new_input_pos = memcon    
 68                 else if (*new_input_pos == '\0    
 69                         new_input_pos = memcon    
 70                                                   
 71                 *memcons.input_pos = '\0';        
 72                 wmb();                            
 73                 memcons.input_pos = new_input_    
 74                 return c;                         
 75         }                                         
 76                                                   
 77         return -1;                                
 78 }                                                 
 79                                                   
 80 static int memcons_getc(void)                     
 81 {                                                 
 82         int c;                                    
 83                                                   
 84         while (1) {                               
 85                 c = memcons_getc_poll();          
 86                 if (c == -1)                      
 87                         cpu_relax();              
 88                 else                              
 89                         break;                    
 90         }                                         
 91                                                   
 92         return c;                                 
 93 }                                                 
 94                                                   
 95 void __init udbg_init_memcons(void)               
 96 {                                                 
 97         udbg_putc = memcons_putc;                 
 98         udbg_getc = memcons_getc;                 
 99         udbg_getc_poll = memcons_getc_poll;       
100 }                                                 
101                                                   

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