diff options
-rw-r--r-- | arch/x86/kernel/cpu/Makefile | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/feature_names.c | 83 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/proc.c | 74 | ||||
-rw-r--r-- | arch/x86/kernel/setup_64.c | 76 | ||||
-rw-r--r-- | include/asm-x86/cpufeature.h | 12 |
5 files changed, 93 insertions, 153 deletions
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index cfdb2f3bd763..a0c4d7c5dbd7 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o | 5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o |
6 | obj-y += feature_names.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_X86_32) += common.o proc.o bugs.o | 8 | obj-$(CONFIG_X86_32) += common.o proc.o bugs.o |
8 | obj-$(CONFIG_X86_32) += amd.o | 9 | obj-$(CONFIG_X86_32) += amd.o |
diff --git a/arch/x86/kernel/cpu/feature_names.c b/arch/x86/kernel/cpu/feature_names.c new file mode 100644 index 000000000000..ee975ac6bbcb --- /dev/null +++ b/arch/x86/kernel/cpu/feature_names.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Strings for the various x86 capability flags. | ||
3 | * | ||
4 | * This file must not contain any executable code. | ||
5 | */ | ||
6 | |||
7 | #include "asm/cpufeature.h" | ||
8 | |||
9 | /* | ||
10 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
11 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
12 | * have meaning as far as Linux is concerned. Note that it's important | ||
13 | * to realize there is a difference between this table and CPUID -- if | ||
14 | * applications want to get the raw CPUID data, they should access | ||
15 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
16 | */ | ||
17 | const char * const x86_cap_flags[NCAPINTS*32] = { | ||
18 | /* Intel-defined */ | ||
19 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
20 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
21 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
22 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
23 | |||
24 | /* AMD-defined */ | ||
25 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
26 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
27 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | ||
28 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
29 | "3dnowext", "3dnow", | ||
30 | |||
31 | /* Transmeta-defined */ | ||
32 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
33 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
34 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
35 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
36 | |||
37 | /* Other (Linux-defined) */ | ||
38 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
39 | NULL, NULL, NULL, NULL, | ||
40 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
41 | "pebs", "bts", NULL, NULL, | ||
42 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
44 | |||
45 | /* Intel-defined (#2) */ | ||
46 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
47 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
48 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
49 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
50 | |||
51 | /* VIA/Cyrix/Centaur-defined */ | ||
52 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
53 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
54 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
55 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
56 | |||
57 | /* AMD-defined (#2) */ | ||
58 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
59 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
60 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
61 | "skinit", "wdt", NULL, NULL, | ||
62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
64 | |||
65 | /* Auxiliary (Linux-defined) */ | ||
66 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
68 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
69 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
70 | }; | ||
71 | |||
72 | const char *const x86_power_flags[32] = { | ||
73 | "ts", /* temperature sensor */ | ||
74 | "fid", /* frequency id control */ | ||
75 | "vid", /* voltage id control */ | ||
76 | "ttp", /* thermal trip */ | ||
77 | "tm", | ||
78 | "stc", | ||
79 | "100mhzsteps", | ||
80 | "hwpstate", | ||
81 | "", /* tsc invariant mapped to constant_tsc */ | ||
82 | /* nothing */ | ||
83 | }; | ||
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 028213260148..af11d31dce0a 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
@@ -10,80 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | static int show_cpuinfo(struct seq_file *m, void *v) | 11 | static int show_cpuinfo(struct seq_file *m, void *v) |
12 | { | 12 | { |
13 | /* | ||
14 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
15 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
16 | * have meaning as far as Linux is concerned. Note that it's important | ||
17 | * to realize there is a difference between this table and CPUID -- if | ||
18 | * applications want to get the raw CPUID data, they should access | ||
19 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
20 | */ | ||
21 | static const char * const x86_cap_flags[] = { | ||
22 | /* Intel-defined */ | ||
23 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
24 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
25 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
26 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
27 | |||
28 | /* AMD-defined */ | ||
29 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
30 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
31 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | ||
32 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
33 | "3dnowext", "3dnow", | ||
34 | |||
35 | /* Transmeta-defined */ | ||
36 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
37 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
38 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
39 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
40 | |||
41 | /* Other (Linux-defined) */ | ||
42 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
43 | NULL, NULL, NULL, NULL, | ||
44 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
45 | "pebs", "bts", NULL, "sync_rdtsc", | ||
46 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
47 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
48 | |||
49 | /* Intel-defined (#2) */ | ||
50 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
51 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
52 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
53 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
54 | |||
55 | /* VIA/Cyrix/Centaur-defined */ | ||
56 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
57 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
58 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
59 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
60 | |||
61 | /* AMD-defined (#2) */ | ||
62 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
63 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
64 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
65 | "skinit", "wdt", NULL, NULL, | ||
66 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
68 | |||
69 | /* Auxiliary (Linux-defined) */ | ||
70 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
71 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
72 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
73 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
74 | }; | ||
75 | static const char * const x86_power_flags[] = { | ||
76 | "ts", /* temperature sensor */ | ||
77 | "fid", /* frequency id control */ | ||
78 | "vid", /* voltage id control */ | ||
79 | "ttp", /* thermal trip */ | ||
80 | "tm", | ||
81 | "stc", | ||
82 | "100mhzsteps", | ||
83 | "hwpstate", | ||
84 | "", /* constant_tsc - moved to flags */ | ||
85 | /* nothing */ | ||
86 | }; | ||
87 | struct cpuinfo_x86 *c = v; | 13 | struct cpuinfo_x86 *c = v; |
88 | int i, n = 0; | 14 | int i, n = 0; |
89 | int fpu_exception; | 15 | int fpu_exception; |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 18df70c534b9..c8939dfddfba 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -1068,82 +1068,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1068 | struct cpuinfo_x86 *c = v; | 1068 | struct cpuinfo_x86 *c = v; |
1069 | int cpu = 0, i; | 1069 | int cpu = 0, i; |
1070 | 1070 | ||
1071 | /* | ||
1072 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
1073 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
1074 | * have meaning as far as Linux is concerned. Note that it's important | ||
1075 | * to realize there is a difference between this table and CPUID -- if | ||
1076 | * applications want to get the raw CPUID data, they should access | ||
1077 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
1078 | */ | ||
1079 | static const char *const x86_cap_flags[] = { | ||
1080 | /* Intel-defined */ | ||
1081 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
1082 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
1083 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
1084 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
1085 | |||
1086 | /* AMD-defined */ | ||
1087 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1088 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
1089 | NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, | ||
1090 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
1091 | "3dnowext", "3dnow", | ||
1092 | |||
1093 | /* Transmeta-defined */ | ||
1094 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
1095 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1096 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1097 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1098 | |||
1099 | /* Other (Linux-defined) */ | ||
1100 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
1101 | NULL, NULL, NULL, NULL, | ||
1102 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
1103 | "pebs", "bts", NULL, "sync_rdtsc", | ||
1104 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1105 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1106 | |||
1107 | /* Intel-defined (#2) */ | ||
1108 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
1109 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
1110 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
1111 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1112 | |||
1113 | /* VIA/Cyrix/Centaur-defined */ | ||
1114 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
1115 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
1116 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1117 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1118 | |||
1119 | /* AMD-defined (#2) */ | ||
1120 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
1121 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
1122 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
1123 | "skinit", "wdt", NULL, NULL, | ||
1124 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1126 | |||
1127 | /* Auxiliary (Linux-defined) */ | ||
1128 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1129 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1130 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1131 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1132 | }; | ||
1133 | static const char *const x86_power_flags[] = { | ||
1134 | "ts", /* temperature sensor */ | ||
1135 | "fid", /* frequency id control */ | ||
1136 | "vid", /* voltage id control */ | ||
1137 | "ttp", /* thermal trip */ | ||
1138 | "tm", | ||
1139 | "stc", | ||
1140 | "100mhzsteps", | ||
1141 | "hwpstate", | ||
1142 | "", /* tsc invariant mapped to constant_tsc */ | ||
1143 | /* nothing */ | ||
1144 | }; | ||
1145 | |||
1146 | |||
1147 | #ifdef CONFIG_SMP | 1071 | #ifdef CONFIG_SMP |
1148 | cpu = c->cpu_index; | 1072 | cpu = c->cpu_index; |
1149 | #endif | 1073 | #endif |
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h index 3fb7dfa7fc91..3adc9cf0f391 100644 --- a/include/asm-x86/cpufeature.h +++ b/include/asm-x86/cpufeature.h | |||
@@ -4,9 +4,6 @@ | |||
4 | #ifndef _ASM_X86_CPUFEATURE_H | 4 | #ifndef _ASM_X86_CPUFEATURE_H |
5 | #define _ASM_X86_CPUFEATURE_H | 5 | #define _ASM_X86_CPUFEATURE_H |
6 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | #include <linux/bitops.h> | ||
9 | #endif | ||
10 | #include <asm/required-features.h> | 7 | #include <asm/required-features.h> |
11 | 8 | ||
12 | #define NCAPINTS 8 /* N 32-bit words worth of info */ | 9 | #define NCAPINTS 8 /* N 32-bit words worth of info */ |
@@ -115,6 +112,13 @@ | |||
115 | */ | 112 | */ |
116 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ | 113 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ |
117 | 114 | ||
115 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | ||
116 | |||
117 | #include <linux/bitops.h> | ||
118 | |||
119 | extern const char * const x86_cap_flags[NCAPINTS*32]; | ||
120 | extern const char * const x86_power_flags[32]; | ||
121 | |||
118 | #define cpu_has(c, bit) \ | 122 | #define cpu_has(c, bit) \ |
119 | (__builtin_constant_p(bit) && \ | 123 | (__builtin_constant_p(bit) && \ |
120 | ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ | 124 | ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ |
@@ -204,4 +208,6 @@ | |||
204 | 208 | ||
205 | #endif /* CONFIG_X86_64 */ | 209 | #endif /* CONFIG_X86_64 */ |
206 | 210 | ||
211 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ | ||
212 | |||
207 | #endif /* _ASM_X86_CPUFEATURE_H */ | 213 | #endif /* _ASM_X86_CPUFEATURE_H */ |