diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:33 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:33 -0500 |
commit | 5300db887e251276eaab2801af297acf4b53b9eb (patch) | |
tree | c5c055c2efa238bd47e43af85b9cd4f57ed2c8a0 | |
parent | 26996dd22b3cbc9dbe18cf908d2f844a116b6ec1 (diff) |
x86: unify x86_cpuinfo struct.
x86_cpuinfo is one more to the family of "not fundamentally different"
structs. It's unified in processor.h, with very specific fields enclosed
around ifdefs.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 6 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 82 | ||||
-rw-r--r-- | include/asm-x86/processor_32.h | 67 | ||||
-rw-r--r-- | include/asm-x86/processor_64.h | 57 |
4 files changed, 85 insertions, 127 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 69507ae8a65..ecd13c0e854 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -427,7 +427,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
427 | 427 | ||
428 | printk(KERN_DEBUG "CPU: After generic identify, caps:"); | 428 | printk(KERN_DEBUG "CPU: After generic identify, caps:"); |
429 | for (i = 0; i < NCAPINTS; i++) | 429 | for (i = 0; i < NCAPINTS; i++) |
430 | printk(" %08lx", c->x86_capability[i]); | 430 | printk(" %08x", c->x86_capability[i]); |
431 | printk("\n"); | 431 | printk("\n"); |
432 | 432 | ||
433 | if (this_cpu->c_identify) { | 433 | if (this_cpu->c_identify) { |
@@ -435,7 +435,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
435 | 435 | ||
436 | printk(KERN_DEBUG "CPU: After vendor identify, caps:"); | 436 | printk(KERN_DEBUG "CPU: After vendor identify, caps:"); |
437 | for (i = 0; i < NCAPINTS; i++) | 437 | for (i = 0; i < NCAPINTS; i++) |
438 | printk(" %08lx", c->x86_capability[i]); | 438 | printk(" %08x", c->x86_capability[i]); |
439 | printk("\n"); | 439 | printk("\n"); |
440 | } | 440 | } |
441 | 441 | ||
@@ -493,7 +493,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
493 | 493 | ||
494 | printk(KERN_DEBUG "CPU: After all inits, caps:"); | 494 | printk(KERN_DEBUG "CPU: After all inits, caps:"); |
495 | for (i = 0; i < NCAPINTS; i++) | 495 | for (i = 0; i < NCAPINTS; i++) |
496 | printk(" %08lx", c->x86_capability[i]); | 496 | printk(" %08x", c->x86_capability[i]); |
497 | printk("\n"); | 497 | printk("\n"); |
498 | 498 | ||
499 | /* | 499 | /* |
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index 8b56c23f043..2b896b0aa3f 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -10,6 +10,9 @@ struct mm_struct; | |||
10 | #include <asm/page.h> | 10 | #include <asm/page.h> |
11 | #include <asm/percpu.h> | 11 | #include <asm/percpu.h> |
12 | #include <asm/system.h> | 12 | #include <asm/system.h> |
13 | #include <asm/percpu.h> | ||
14 | #include <linux/cpumask.h> | ||
15 | #include <linux/cache.h> | ||
13 | 16 | ||
14 | /* | 17 | /* |
15 | * Default implementation of macro that returns current | 18 | * Default implementation of macro that returns current |
@@ -30,6 +33,85 @@ static inline void *current_text_addr(void) | |||
30 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | 33 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 |
31 | #endif | 34 | #endif |
32 | 35 | ||
36 | /* | ||
37 | * CPU type and hardware bug flags. Kept separately for each CPU. | ||
38 | * Members of this structure are referenced in head.S, so think twice | ||
39 | * before touching them. [mj] | ||
40 | */ | ||
41 | |||
42 | struct cpuinfo_x86 { | ||
43 | __u8 x86; /* CPU family */ | ||
44 | __u8 x86_vendor; /* CPU vendor */ | ||
45 | __u8 x86_model; | ||
46 | __u8 x86_mask; | ||
47 | #ifdef CONFIG_X86_32 | ||
48 | char wp_works_ok; /* It doesn't on 386's */ | ||
49 | char hlt_works_ok; /* Problems on some 486Dx4's and old 386's */ | ||
50 | char hard_math; | ||
51 | char rfu; | ||
52 | char fdiv_bug; | ||
53 | char f00f_bug; | ||
54 | char coma_bug; | ||
55 | char pad0; | ||
56 | #else | ||
57 | /* number of 4K pages in DTLB/ITLB combined(in pages)*/ | ||
58 | int x86_tlbsize; | ||
59 | __u8 x86_virt_bits, x86_phys_bits; | ||
60 | /* cpuid returned core id bits */ | ||
61 | __u8 x86_coreid_bits; | ||
62 | /* Max extended CPUID function supported */ | ||
63 | __u32 extended_cpuid_level; | ||
64 | #endif | ||
65 | int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */ | ||
66 | __u32 x86_capability[NCAPINTS]; | ||
67 | char x86_vendor_id[16]; | ||
68 | char x86_model_id[64]; | ||
69 | int x86_cache_size; /* in KB - valid for CPUS which support this | ||
70 | call */ | ||
71 | int x86_cache_alignment; /* In bytes */ | ||
72 | int x86_power; | ||
73 | unsigned long loops_per_jiffy; | ||
74 | #ifdef CONFIG_SMP | ||
75 | cpumask_t llc_shared_map; /* cpus sharing the last level cache */ | ||
76 | #endif | ||
77 | unsigned char x86_max_cores; /* cpuid returned max cores value */ | ||
78 | unsigned char apicid; | ||
79 | unsigned short x86_clflush_size; | ||
80 | #ifdef CONFIG_SMP | ||
81 | unsigned char booted_cores; /* number of cores as seen by OS */ | ||
82 | __u8 phys_proc_id; /* Physical processor id. */ | ||
83 | __u8 cpu_core_id; /* Core id */ | ||
84 | __u8 cpu_index; /* index into per_cpu list */ | ||
85 | #endif | ||
86 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | ||
87 | |||
88 | #define X86_VENDOR_INTEL 0 | ||
89 | #define X86_VENDOR_CYRIX 1 | ||
90 | #define X86_VENDOR_AMD 2 | ||
91 | #define X86_VENDOR_UMC 3 | ||
92 | #define X86_VENDOR_NEXGEN 4 | ||
93 | #define X86_VENDOR_CENTAUR 5 | ||
94 | #define X86_VENDOR_TRANSMETA 7 | ||
95 | #define X86_VENDOR_NSC 8 | ||
96 | #define X86_VENDOR_NUM 9 | ||
97 | #define X86_VENDOR_UNKNOWN 0xff | ||
98 | |||
99 | extern struct cpuinfo_x86 boot_cpu_data; | ||
100 | |||
101 | #ifdef CONFIG_SMP | ||
102 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | ||
103 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) | ||
104 | #define current_cpu_data cpu_data(smp_processor_id()) | ||
105 | #else | ||
106 | #define cpu_data(cpu) boot_cpu_data | ||
107 | #define current_cpu_data boot_cpu_data | ||
108 | #endif | ||
109 | |||
110 | extern void print_cpu_info(struct cpuinfo_x86 *); | ||
111 | extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); | ||
112 | extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); | ||
113 | extern unsigned short num_cache_leaves; | ||
114 | |||
33 | static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, | 115 | static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, |
34 | unsigned int *ecx, unsigned int *edx) | 116 | unsigned int *ecx, unsigned int *edx) |
35 | { | 117 | { |
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 8380243a19d..f0f7ca48444 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
@@ -14,83 +14,16 @@ | |||
14 | #include <asm/cpufeature.h> | 14 | #include <asm/cpufeature.h> |
15 | #include <asm/msr.h> | 15 | #include <asm/msr.h> |
16 | #include <asm/system.h> | 16 | #include <asm/system.h> |
17 | #include <linux/cache.h> | ||
18 | #include <linux/threads.h> | 17 | #include <linux/threads.h> |
19 | #include <asm/percpu.h> | ||
20 | #include <linux/cpumask.h> | ||
21 | #include <linux/init.h> | 18 | #include <linux/init.h> |
22 | #include <asm/desc_defs.h> | 19 | #include <asm/desc_defs.h> |
23 | 20 | ||
24 | /* | 21 | /* |
25 | * CPU type and hardware bug flags. Kept separately for each CPU. | ||
26 | * Members of this structure are referenced in head.S, so think twice | ||
27 | * before touching them. [mj] | ||
28 | */ | ||
29 | |||
30 | struct cpuinfo_x86 { | ||
31 | __u8 x86; /* CPU family */ | ||
32 | __u8 x86_vendor; /* CPU vendor */ | ||
33 | __u8 x86_model; | ||
34 | __u8 x86_mask; | ||
35 | char wp_works_ok; /* It doesn't on 386's */ | ||
36 | char hlt_works_ok; /* Problems on some 486Dx4's and old 386's */ | ||
37 | char hard_math; | ||
38 | char rfu; | ||
39 | int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */ | ||
40 | unsigned long x86_capability[NCAPINTS]; | ||
41 | char x86_vendor_id[16]; | ||
42 | char x86_model_id[64]; | ||
43 | int x86_cache_size; /* in KB - valid for CPUS which support this | ||
44 | call */ | ||
45 | int x86_cache_alignment; /* In bytes */ | ||
46 | char fdiv_bug; | ||
47 | char f00f_bug; | ||
48 | char coma_bug; | ||
49 | char pad0; | ||
50 | int x86_power; | ||
51 | unsigned long loops_per_jiffy; | ||
52 | #ifdef CONFIG_SMP | ||
53 | cpumask_t llc_shared_map; /* cpus sharing the last level cache */ | ||
54 | #endif | ||
55 | unsigned char x86_max_cores; /* cpuid returned max cores value */ | ||
56 | unsigned char apicid; | ||
57 | unsigned short x86_clflush_size; | ||
58 | #ifdef CONFIG_SMP | ||
59 | unsigned char booted_cores; /* number of cores as seen by OS */ | ||
60 | __u8 phys_proc_id; /* Physical processor id. */ | ||
61 | __u8 cpu_core_id; /* Core id */ | ||
62 | __u8 cpu_index; /* index into per_cpu list */ | ||
63 | #endif | ||
64 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | ||
65 | |||
66 | #define X86_VENDOR_INTEL 0 | ||
67 | #define X86_VENDOR_CYRIX 1 | ||
68 | #define X86_VENDOR_AMD 2 | ||
69 | #define X86_VENDOR_UMC 3 | ||
70 | #define X86_VENDOR_NEXGEN 4 | ||
71 | #define X86_VENDOR_CENTAUR 5 | ||
72 | #define X86_VENDOR_TRANSMETA 7 | ||
73 | #define X86_VENDOR_NSC 8 | ||
74 | #define X86_VENDOR_NUM 9 | ||
75 | #define X86_VENDOR_UNKNOWN 0xff | ||
76 | |||
77 | /* | ||
78 | * capabilities of CPUs | 22 | * capabilities of CPUs |
79 | */ | 23 | */ |
80 | |||
81 | extern struct cpuinfo_x86 boot_cpu_data; | ||
82 | extern struct cpuinfo_x86 new_cpu_data; | 24 | extern struct cpuinfo_x86 new_cpu_data; |
83 | extern struct tss_struct doublefault_tss; | 25 | extern struct tss_struct doublefault_tss; |
84 | 26 | ||
85 | #ifdef CONFIG_SMP | ||
86 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | ||
87 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) | ||
88 | #define current_cpu_data cpu_data(smp_processor_id()) | ||
89 | #else | ||
90 | #define cpu_data(cpu) boot_cpu_data | ||
91 | #define current_cpu_data boot_cpu_data | ||
92 | #endif | ||
93 | |||
94 | /* | 27 | /* |
95 | * the following now lives in the per cpu area: | 28 | * the following now lives in the per cpu area: |
96 | * extern int cpu_llc_id[NR_CPUS]; | 29 | * extern int cpu_llc_id[NR_CPUS]; |
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h index 7fe5c1461c8..5045abe91e3 100644 --- a/include/asm-x86/processor_64.h +++ b/include/asm-x86/processor_64.h | |||
@@ -15,65 +15,9 @@ | |||
15 | #include <asm/current.h> | 15 | #include <asm/current.h> |
16 | #include <asm/system.h> | 16 | #include <asm/system.h> |
17 | #include <asm/mmsegment.h> | 17 | #include <asm/mmsegment.h> |
18 | #include <asm/percpu.h> | ||
19 | #include <linux/personality.h> | 18 | #include <linux/personality.h> |
20 | #include <linux/cpumask.h> | ||
21 | #include <asm/desc_defs.h> | 19 | #include <asm/desc_defs.h> |
22 | 20 | ||
23 | /* | ||
24 | * CPU type and hardware bug flags. Kept separately for each CPU. | ||
25 | */ | ||
26 | |||
27 | struct cpuinfo_x86 { | ||
28 | __u8 x86; /* CPU family */ | ||
29 | __u8 x86_vendor; /* CPU vendor */ | ||
30 | __u8 x86_model; | ||
31 | __u8 x86_mask; | ||
32 | int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */ | ||
33 | __u32 x86_capability[NCAPINTS]; | ||
34 | char x86_vendor_id[16]; | ||
35 | char x86_model_id[64]; | ||
36 | int x86_cache_size; /* in KB */ | ||
37 | int x86_clflush_size; | ||
38 | int x86_cache_alignment; | ||
39 | int x86_tlbsize; /* number of 4K pages in DTLB/ITLB combined(in pages)*/ | ||
40 | __u8 x86_virt_bits, x86_phys_bits; | ||
41 | __u8 x86_max_cores; /* cpuid returned max cores value */ | ||
42 | __u8 x86_coreid_bits; /* cpuid returned core id bits */ | ||
43 | __u32 x86_power; | ||
44 | __u32 extended_cpuid_level; /* Max extended CPUID function supported */ | ||
45 | unsigned long loops_per_jiffy; | ||
46 | #ifdef CONFIG_SMP | ||
47 | cpumask_t llc_shared_map; /* cpus sharing the last level cache */ | ||
48 | #endif | ||
49 | __u8 apicid; | ||
50 | #ifdef CONFIG_SMP | ||
51 | __u8 booted_cores; /* number of cores as seen by OS */ | ||
52 | __u8 phys_proc_id; /* Physical Processor id. */ | ||
53 | __u8 cpu_core_id; /* Core id. */ | ||
54 | __u8 cpu_index; /* index into per_cpu list */ | ||
55 | #endif | ||
56 | } ____cacheline_aligned; | ||
57 | |||
58 | #define X86_VENDOR_INTEL 0 | ||
59 | #define X86_VENDOR_CYRIX 1 | ||
60 | #define X86_VENDOR_AMD 2 | ||
61 | #define X86_VENDOR_UMC 3 | ||
62 | #define X86_VENDOR_NEXGEN 4 | ||
63 | #define X86_VENDOR_CENTAUR 5 | ||
64 | #define X86_VENDOR_TRANSMETA 7 | ||
65 | #define X86_VENDOR_NUM 8 | ||
66 | #define X86_VENDOR_UNKNOWN 0xff | ||
67 | |||
68 | #ifdef CONFIG_SMP | ||
69 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | ||
70 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) | ||
71 | #define current_cpu_data cpu_data(smp_processor_id()) | ||
72 | #else | ||
73 | #define cpu_data(cpu) boot_cpu_data | ||
74 | #define current_cpu_data boot_cpu_data | ||
75 | #endif | ||
76 | |||
77 | extern char ignore_irq13; | 21 | extern char ignore_irq13; |
78 | 22 | ||
79 | extern void identify_cpu(struct cpuinfo_x86 *); | 23 | extern void identify_cpu(struct cpuinfo_x86 *); |
@@ -110,7 +54,6 @@ union i387_union { | |||
110 | struct i387_fxsave_struct fxsave; | 54 | struct i387_fxsave_struct fxsave; |
111 | }; | 55 | }; |
112 | 56 | ||
113 | extern struct cpuinfo_x86 boot_cpu_data; | ||
114 | /* Save the original ist values for checking stack pointers during debugging */ | 57 | /* Save the original ist values for checking stack pointers during debugging */ |
115 | struct orig_ist { | 58 | struct orig_ist { |
116 | unsigned long ist[7]; | 59 | unsigned long ist[7]; |