Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2003, 2004 Ralf Baechle
0007  * Copyright (C) 2004  Maciej W. Rozycki
0008  */
0009 #ifndef __ASM_CPU_TYPE_H
0010 #define __ASM_CPU_TYPE_H
0011 
0012 #include <linux/smp.h>
0013 #include <linux/compiler.h>
0014 
0015 static inline int __pure __get_cpu_type(const int cpu_type)
0016 {
0017     switch (cpu_type) {
0018 #if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
0019     defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
0020     case CPU_LOONGSON2EF:
0021 #endif
0022 
0023 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON64
0024     case CPU_LOONGSON64:
0025 #endif
0026 
0027 #if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
0028     defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
0029     case CPU_LOONGSON32:
0030 #endif
0031 
0032 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
0033     case CPU_4KC:
0034     case CPU_ALCHEMY:
0035     case CPU_PR4450:
0036 #endif
0037 
0038 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \
0039     defined(CONFIG_SYS_HAS_CPU_MIPS32_R2)
0040     case CPU_4KEC:
0041     case CPU_XBURST:
0042 #endif
0043 
0044 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
0045     case CPU_4KSC:
0046     case CPU_24K:
0047     case CPU_34K:
0048     case CPU_1004K:
0049     case CPU_74K:
0050     case CPU_1074K:
0051     case CPU_M14KC:
0052     case CPU_M14KEC:
0053     case CPU_INTERAPTIV:
0054     case CPU_PROAPTIV:
0055 #endif
0056 
0057 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R5
0058     case CPU_M5150:
0059     case CPU_P5600:
0060 #endif
0061 
0062 #if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \
0063     defined(CONFIG_SYS_HAS_CPU_MIPS32_R5) || \
0064     defined(CONFIG_SYS_HAS_CPU_MIPS32_R6) || \
0065     defined(CONFIG_SYS_HAS_CPU_MIPS64_R2) || \
0066     defined(CONFIG_SYS_HAS_CPU_MIPS64_R5) || \
0067     defined(CONFIG_SYS_HAS_CPU_MIPS64_R6)
0068     case CPU_QEMU_GENERIC:
0069 #endif
0070 
0071 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
0072     case CPU_5KC:
0073     case CPU_5KE:
0074     case CPU_20KC:
0075     case CPU_25KF:
0076     case CPU_SB1:
0077     case CPU_SB1A:
0078 #endif
0079 
0080 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
0081     /*
0082      * All MIPS64 R2 processors have their own special symbols.  That is,
0083      * there currently is no pure R2 core
0084      */
0085 #endif
0086 
0087 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R6
0088     case CPU_M6250:
0089 #endif
0090 
0091 #ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
0092     case CPU_I6400:
0093     case CPU_I6500:
0094     case CPU_P6600:
0095 #endif
0096 
0097 #ifdef CONFIG_SYS_HAS_CPU_R3000
0098     case CPU_R2000:
0099     case CPU_R3000:
0100     case CPU_R3000A:
0101     case CPU_R3041:
0102     case CPU_R3051:
0103     case CPU_R3052:
0104     case CPU_R3081:
0105     case CPU_R3081E:
0106 #endif
0107 
0108 #ifdef CONFIG_SYS_HAS_CPU_R4300
0109     case CPU_R4300:
0110     case CPU_R4310:
0111 #endif
0112 
0113 #ifdef CONFIG_SYS_HAS_CPU_R4X00
0114     case CPU_R4000PC:
0115     case CPU_R4000SC:
0116     case CPU_R4000MC:
0117     case CPU_R4200:
0118     case CPU_R4400PC:
0119     case CPU_R4400SC:
0120     case CPU_R4400MC:
0121     case CPU_R4600:
0122     case CPU_R4700:
0123     case CPU_R4640:
0124     case CPU_R4650:
0125 #endif
0126 
0127 #ifdef CONFIG_SYS_HAS_CPU_TX49XX
0128     case CPU_TX49XX:
0129 #endif
0130 
0131 #ifdef CONFIG_SYS_HAS_CPU_R5000
0132     case CPU_R5000:
0133 #endif
0134 
0135 #ifdef CONFIG_SYS_HAS_CPU_R5500
0136     case CPU_R5500:
0137 #endif
0138 
0139 #ifdef CONFIG_SYS_HAS_CPU_NEVADA
0140     case CPU_NEVADA:
0141 #endif
0142 
0143 #ifdef CONFIG_SYS_HAS_CPU_R10000
0144     case CPU_R10000:
0145     case CPU_R12000:
0146     case CPU_R14000:
0147     case CPU_R16000:
0148 #endif
0149 #ifdef CONFIG_SYS_HAS_CPU_RM7000
0150     case CPU_RM7000:
0151     case CPU_SR71000:
0152 #endif
0153 #ifdef CONFIG_SYS_HAS_CPU_SB1
0154     case CPU_SB1:
0155     case CPU_SB1A:
0156 #endif
0157 #ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
0158     case CPU_CAVIUM_OCTEON:
0159     case CPU_CAVIUM_OCTEON_PLUS:
0160     case CPU_CAVIUM_OCTEON2:
0161     case CPU_CAVIUM_OCTEON3:
0162 #endif
0163 
0164 #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
0165     defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
0166     case CPU_BMIPS32:
0167     case CPU_BMIPS3300:
0168 #endif
0169 
0170 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
0171     case CPU_BMIPS4350:
0172 #endif
0173 
0174 #ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
0175     case CPU_BMIPS4380:
0176 #endif
0177 
0178 #ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
0179     case CPU_BMIPS5000:
0180 #endif
0181         break;
0182     default:
0183         unreachable();
0184     }
0185 
0186     return cpu_type;
0187 }
0188 
0189 static inline int __pure current_cpu_type(void)
0190 {
0191     const int cpu_type = current_cpu_data.cputype;
0192 
0193     return __get_cpu_type(cpu_type);
0194 }
0195 
0196 static inline int __pure boot_cpu_type(void)
0197 {
0198     const int cpu_type = cpu_data[0].cputype;
0199 
0200     return __get_cpu_type(cpu_type);
0201 }
0202 
0203 #endif /* __ASM_CPU_TYPE_H */