Merge branch 'x86/cpu' into x86/x2apic
[deliverable/linux.git] / arch / x86 / kernel / cpu / addon_cpuid_features.c
CommitLineData
1d67953f
VP
1/*
2 * Routines to indentify additional cpu features that are scattered in
3 * cpuid space.
4 */
1d67953f
VP
5#include <linux/cpu.h>
6
8d4a4300 7#include <asm/pat.h>
1d67953f
VP
8#include <asm/processor.h>
9
10struct cpuid_bit {
11 u16 feature;
12 u8 reg;
13 u8 bit;
14 u32 level;
15};
16
17enum cpuid_regs {
18 CR_EAX = 0,
19 CR_ECX,
20 CR_EDX,
21 CR_EBX
22};
23
24void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
25{
26 u32 max_level;
27 u32 regs[4];
28 const struct cpuid_bit *cb;
29
30 static const struct cpuid_bit cpuid_bits[] = {
31 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
32 { 0, 0, 0, 0 }
33 };
34
35 for (cb = cpuid_bits; cb->feature; cb++) {
36
37 /* Verify that the level is valid */
38 max_level = cpuid_eax(cb->level & 0xffff0000);
39 if (max_level < cb->level ||
40 max_level > (cb->level | 0xffff))
41 continue;
42
43 cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
44 &regs[CR_ECX], &regs[CR_EDX]);
45
46 if (regs[cb->reg] & (1 << cb->bit))
53756d37 47 set_cpu_cap(c, cb->feature);
1d67953f
VP
48 }
49}
8d4a4300
TG
50
51#ifdef CONFIG_X86_PAT
52void __cpuinit validate_pat_support(struct cpuinfo_x86 *c)
53{
97cfab6a
AH
54 if (!cpu_has_pat)
55 pat_disable("PAT not supported by CPU.");
56
8d4a4300 57 switch (c->x86_vendor) {
8d4a4300
TG
58 case X86_VENDOR_INTEL:
59 if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
60 return;
61 break;
ee863ba7 62 case X86_VENDOR_AMD:
873b274a
DJ
63 case X86_VENDOR_CENTAUR:
64 case X86_VENDOR_TRANSMETA:
65 return;
8d4a4300
TG
66 }
67
97cfab6a 68 pat_disable("PAT disabled. Not yet verified on this CPU type.");
8d4a4300
TG
69}
70#endif
This page took 0.318518 seconds and 5 git commands to generate.