diff options
author | Venki Pallipadi <venkatesh.pallipadi@intel.com> | 2007-07-11 15:18:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 13:55:54 -0400 |
commit | 1d67953f2bda8876045c24ae58841f27d9bb7572 (patch) | |
tree | 4f91c4037c6e8996cb3164f3f20489c471676f6c /arch/i386 | |
parent | e087db510cd96a75a614f6f6fcd5499ab21cb087 (diff) |
Use a new CPU feature word to cover features that are spread around
Some Intel features are spread around in different CPUID leafs like 0x5,
0x6 and 0xA. Make this feature detection code common across i386 and
x86_64.
Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
will be enabled automatically by current acpi-cpufreq driver.
Refer to Intel Software Developer's Manual for more details about the feature.
Thanks to hpa (H Peter Anvin) for the making the actual code detecting the
scattered features data-driven.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/cpu/Makefile | 2 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/addon_cpuid_features.c | 50 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/proc.c | 6 |
4 files changed, 59 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/Makefile b/arch/i386/kernel/cpu/Makefile index 74f27a463db0..0b6a8551e9e2 100644 --- a/arch/i386/kernel/cpu/Makefile +++ b/arch/i386/kernel/cpu/Makefile | |||
@@ -8,7 +8,7 @@ obj-y += amd.o | |||
8 | obj-y += cyrix.o | 8 | obj-y += cyrix.o |
9 | obj-y += centaur.o | 9 | obj-y += centaur.o |
10 | obj-y += transmeta.o | 10 | obj-y += transmeta.o |
11 | obj-y += intel.o intel_cacheinfo.o | 11 | obj-y += intel.o intel_cacheinfo.o addon_cpuid_features.o |
12 | obj-y += rise.o | 12 | obj-y += rise.o |
13 | obj-y += nexgen.o | 13 | obj-y += nexgen.o |
14 | obj-y += umc.o | 14 | obj-y += umc.o |
diff --git a/arch/i386/kernel/cpu/addon_cpuid_features.c b/arch/i386/kernel/cpu/addon_cpuid_features.c new file mode 100644 index 000000000000..3e91d3ee26ec --- /dev/null +++ b/arch/i386/kernel/cpu/addon_cpuid_features.c | |||
@@ -0,0 +1,50 @@ | |||
1 | |||
2 | /* | ||
3 | * Routines to indentify additional cpu features that are scattered in | ||
4 | * cpuid space. | ||
5 | */ | ||
6 | |||
7 | #include <linux/cpu.h> | ||
8 | |||
9 | #include <asm/processor.h> | ||
10 | |||
11 | struct cpuid_bit { | ||
12 | u16 feature; | ||
13 | u8 reg; | ||
14 | u8 bit; | ||
15 | u32 level; | ||
16 | }; | ||
17 | |||
18 | enum cpuid_regs { | ||
19 | CR_EAX = 0, | ||
20 | CR_ECX, | ||
21 | CR_EDX, | ||
22 | CR_EBX | ||
23 | }; | ||
24 | |||
25 | void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | ||
26 | { | ||
27 | u32 max_level; | ||
28 | u32 regs[4]; | ||
29 | const struct cpuid_bit *cb; | ||
30 | |||
31 | static const struct cpuid_bit cpuid_bits[] = { | ||
32 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, | ||
33 | { 0, 0, 0, 0 } | ||
34 | }; | ||
35 | |||
36 | for (cb = cpuid_bits; cb->feature; cb++) { | ||
37 | |||
38 | /* Verify that the level is valid */ | ||
39 | max_level = cpuid_eax(cb->level & 0xffff0000); | ||
40 | if (max_level < cb->level || | ||
41 | max_level > (cb->level | 0xffff)) | ||
42 | continue; | ||
43 | |||
44 | cpuid(cb->level, ®s[CR_EAX], ®s[CR_EBX], | ||
45 | ®s[CR_ECX], ®s[CR_EDX]); | ||
46 | |||
47 | if (regs[cb->reg] & (1 << cb->bit)) | ||
48 | set_bit(cb->feature, c->x86_capability); | ||
49 | } | ||
50 | } | ||
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 794d593c47eb..e5419a9dec88 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -353,6 +353,8 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 * c) | |||
353 | if ( xlvl >= 0x80000004 ) | 353 | if ( xlvl >= 0x80000004 ) |
354 | get_model_name(c); /* Default name */ | 354 | get_model_name(c); /* Default name */ |
355 | } | 355 | } |
356 | |||
357 | init_scattered_cpuid_features(c); | ||
356 | } | 358 | } |
357 | 359 | ||
358 | early_intel_workaround(c); | 360 | early_intel_workaround(c); |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index ed73091d3dd0..1e31b6caffb1 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -65,6 +65,12 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
65 | "osvw", "ibs", NULL, NULL, NULL, NULL, | 65 | "osvw", "ibs", NULL, NULL, NULL, NULL, |
66 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 66 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
67 | 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, | ||
68 | }; | 74 | }; |
69 | static const char * const x86_power_flags[] = { | 75 | static const char * const x86_power_flags[] = { |
70 | "ts", /* temperature sensor */ | 76 | "ts", /* temperature sensor */ |