atmel_serial: fix bugs in probe() error path and remove()
[pv_ops_mirror.git] / arch / x86 / kernel / cpu / addon_cpuid_features.c
blob238468ae19931be3116e1e9de9ae0f0c1db1d2e2
2 /*
3 * Routines to indentify additional cpu features that are scattered in
4 * cpuid space.
5 */
7 #include <linux/cpu.h>
9 #include <asm/processor.h>
11 struct cpuid_bit {
12 u16 feature;
13 u8 reg;
14 u8 bit;
15 u32 level;
18 enum cpuid_regs {
19 CR_EAX = 0,
20 CR_ECX,
21 CR_EDX,
22 CR_EBX
25 void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
27 u32 max_level;
28 u32 regs[4];
29 const struct cpuid_bit *cb;
31 static const struct cpuid_bit cpuid_bits[] = {
32 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
33 { 0, 0, 0, 0 }
36 for (cb = cpuid_bits; cb->feature; cb++) {
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;
44 cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
45 &regs[CR_ECX], &regs[CR_EDX]);
47 if (regs[cb->reg] & (1 << cb->bit))
48 set_cpu_cap(c, cb->feature);