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

TOMOYO Linux Cross Reference
Linux/arch/mips/kernel/cpu-r3k-probe.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/mips/kernel/cpu-r3k-probe.c (Version linux-6.12-rc7) and /arch/m68k/kernel/cpu-r3k-probe.c (Version linux-6.8.12)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * Processor capabilities determination functi    
  4  *                                                
  5  * Copyright (C) xxxx  the Anonymous              
  6  * Copyright (C) 1994 - 2006 Ralf Baechle         
  7  * Copyright (C) 2003, 2004  Maciej W. Rozycki    
  8  * Copyright (C) 2001, 2004, 2011, 2012  MIPS     
  9  */                                               
 10 #include <linux/init.h>                           
 11 #include <linux/kernel.h>                         
 12 #include <linux/ptrace.h>                         
 13 #include <linux/smp.h>                            
 14 #include <linux/stddef.h>                         
 15 #include <linux/export.h>                         
 16                                                   
 17 #include <asm/bugs.h>                             
 18 #include <asm/cpu.h>                              
 19 #include <asm/cpu-features.h>                     
 20 #include <asm/cpu-type.h>                         
 21 #include <asm/fpu.h>                              
 22 #include <asm/mipsregs.h>                         
 23 #include <asm/elf.h>                              
 24 #include <asm/traps.h>                            
 25                                                   
 26 #include "fpu-probe.h"                            
 27                                                   
 28 /* Hardware capabilities */                       
 29 unsigned int elf_hwcap __read_mostly;             
 30 EXPORT_SYMBOL_GPL(elf_hwcap);                     
 31                                                   
 32 void __init check_bugs32(void)                    
 33 {                                                 
 34                                                   
 35 }                                                 
 36                                                   
 37 /*                                                
 38  * Probe whether cpu has config register by tr    
 39  * alternate cache bit and see whether it matt    
 40  * It's used by cpu_probe to distinguish betwe    
 41  */                                               
 42 static inline int cpu_has_confreg(void)           
 43 {                                                 
 44 #ifdef CONFIG_CPU_R3000                           
 45         unsigned long size1, size2;               
 46         unsigned long cfg = read_c0_conf();       
 47                                                   
 48         size1 = r3k_cache_size(ST0_ISC);          
 49         write_c0_conf(cfg ^ R30XX_CONF_AC);       
 50         size2 = r3k_cache_size(ST0_ISC);          
 51         write_c0_conf(cfg);                       
 52         return size1 != size2;                    
 53 #else                                             
 54         return 0;                                 
 55 #endif                                            
 56 }                                                 
 57                                                   
 58 static inline void set_elf_platform(int cpu, c    
 59 {                                                 
 60         if (cpu == 0)                             
 61                 __elf_platform = plat;            
 62 }                                                 
 63                                                   
 64 const char *__cpu_name[NR_CPUS];                  
 65 const char *__elf_platform;                       
 66 const char *__elf_base_platform;                  
 67                                                   
 68 void cpu_probe(void)                              
 69 {                                                 
 70         struct cpuinfo_mips *c = &current_cpu_    
 71         unsigned int cpu = smp_processor_id();    
 72                                                   
 73         /*                                        
 74          * Set a default elf platform, cpu pro    
 75          * overwrite it with a more precise va    
 76          */                                       
 77         set_elf_platform(cpu, "mips");            
 78                                                   
 79         c->processor_id = PRID_IMP_UNKNOWN;       
 80         c->fpu_id       = FPIR_IMP_NONE;          
 81         c->cputype      = CPU_UNKNOWN;            
 82         c->writecombine = _CACHE_UNCACHED;        
 83                                                   
 84         c->fpu_csr31    = FPU_CSR_RN;             
 85         c->fpu_msk31    = FPU_CSR_RSVD | FPU_C    
 86                           FPU_CSR_CONDX | FPU_    
 87                                                   
 88         c->srsets = 1;                            
 89                                                   
 90         c->processor_id = read_c0_prid();         
 91         switch (c->processor_id & (PRID_COMP_M    
 92         case PRID_COMP_LEGACY | PRID_IMP_R2000    
 93                 c->cputype = CPU_R2000;           
 94                 __cpu_name[cpu] = "R2000";        
 95                 c->options = MIPS_CPU_TLB | MI    
 96                              MIPS_CPU_NOFPUEX;    
 97                 if (__cpu_has_fpu())              
 98                         c->options |= MIPS_CPU    
 99                 c->tlbsize = 64;                  
100                 break;                            
101         case PRID_COMP_LEGACY | PRID_IMP_R3000    
102                 if ((c->processor_id & PRID_RE    
103                         if (cpu_has_confreg())    
104                                 c->cputype = C    
105                                 __cpu_name[cpu    
106                         } else {                  
107                                 c->cputype = C    
108                                 __cpu_name[cpu    
109                         }                         
110                 } else {                          
111                         c->cputype = CPU_R3000    
112                         __cpu_name[cpu] = "R30    
113                 }                                 
114                 c->options = MIPS_CPU_TLB | MI    
115                              MIPS_CPU_NOFPUEX;    
116                 if (__cpu_has_fpu())              
117                         c->options |= MIPS_CPU    
118                 c->tlbsize = 64;                  
119                 break;                            
120         }                                         
121                                                   
122         BUG_ON(!__cpu_name[cpu]);                 
123         BUG_ON(c->cputype == CPU_UNKNOWN);        
124                                                   
125         /*                                        
126          * Platform code can force the cpu typ    
127          * generation. In that case be sure th    
128          * manually setup otherwise it could t    
129          */                                       
130         BUG_ON(current_cpu_type() != c->cputyp    
131                                                   
132         if (mips_fpu_disabled)                    
133                 c->options &= ~MIPS_CPU_FPU;      
134                                                   
135         if (c->options & MIPS_CPU_FPU)            
136                 cpu_set_fpu_opts(c);              
137         else                                      
138                 cpu_set_nofpu_opts(c);            
139                                                   
140         reserve_exception_space(0, 0x400);        
141 }                                                 
142                                                   
143 void cpu_report(void)                             
144 {                                                 
145         struct cpuinfo_mips *c = &current_cpu_    
146                                                   
147         pr_info("CPU%d revision is: %08x (%s)\    
148                 smp_processor_id(), c->process    
149         if (c->options & MIPS_CPU_FPU)            
150                 pr_info("FPU revision is: %08x    
151 }                                                 
152                                                   

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