diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-09-04 15:09:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-04 15:09:47 -0400 |
commit | 0a488a53d7ca46ac638c30079072c57e50cfcc7b (patch) | |
tree | a2fab0de7f85019c98c348a93c275f243e2a0392 /arch/x86/kernel/cpu/common_64.c | |
parent | 01b2e16a7a9be6573cba5d594d6659b3c6cb46a0 (diff) |
x86: move 32bit related functions together
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/common_64.c')
-rw-r--r-- | arch/x86/kernel/cpu/common_64.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c index f1fb94e766b..b2da0413532 100644 --- a/arch/x86/kernel/cpu/common_64.c +++ b/arch/x86/kernel/cpu/common_64.c | |||
@@ -37,6 +37,8 @@ | |||
37 | 37 | ||
38 | #include "cpu.h" | 38 | #include "cpu.h" |
39 | 39 | ||
40 | static struct cpu_dev *this_cpu __cpuinitdata; | ||
41 | |||
40 | /* We need valid kernel segments for data and code in long mode too | 42 | /* We need valid kernel segments for data and code in long mode too |
41 | * IRET will check the segment types kkeil 2000/10/28 | 43 | * IRET will check the segment types kkeil 2000/10/28 |
42 | * Also sysret mandates a special GDT layout | 44 | * Also sysret mandates a special GDT layout |
@@ -78,7 +80,6 @@ static struct cpu_dev __cpuinitdata default_cpu = { | |||
78 | .c_vendor = "Unknown", | 80 | .c_vendor = "Unknown", |
79 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | 81 | .c_x86_vendor = X86_VENDOR_UNKNOWN, |
80 | }; | 82 | }; |
81 | static struct cpu_dev *this_cpu __cpuinitdata; | ||
82 | 83 | ||
83 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) | 84 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) |
84 | { | 85 | { |
@@ -112,7 +113,7 @@ int __cpuinit get_model_name(struct cpuinfo_x86 *c) | |||
112 | 113 | ||
113 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | 114 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) |
114 | { | 115 | { |
115 | unsigned int n, dummy, ebx, ecx, edx; | 116 | unsigned int n, dummy, ebx, ecx, edx, l2size; |
116 | 117 | ||
117 | n = c->extended_cpuid_level; | 118 | n = c->extended_cpuid_level; |
118 | 119 | ||
@@ -125,15 +126,17 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | |||
125 | c->x86_tlbsize = 0; | 126 | c->x86_tlbsize = 0; |
126 | } | 127 | } |
127 | 128 | ||
128 | if (n >= 0x80000006) { | 129 | if (n < 0x80000006) /* Some chips just has a large L1. */ |
129 | cpuid(0x80000006, &dummy, &ebx, &ecx, &edx); | 130 | return; |
130 | ecx = cpuid_ecx(0x80000006); | ||
131 | c->x86_cache_size = ecx >> 16; | ||
132 | c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); | ||
133 | 131 | ||
134 | printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n", | 132 | cpuid(0x80000006, &dummy, &ebx, &ecx, &edx); |
135 | c->x86_cache_size, ecx & 0xFF); | 133 | l2size = ecx >> 16; |
136 | } | 134 | c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); |
135 | |||
136 | c->x86_cache_size = l2size; | ||
137 | |||
138 | printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n", | ||
139 | l2size, ecx & 0xFF); | ||
137 | } | 140 | } |
138 | 141 | ||
139 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) | 142 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) |
@@ -142,14 +145,13 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
142 | u32 eax, ebx, ecx, edx; | 145 | u32 eax, ebx, ecx, edx; |
143 | int index_msb, core_bits; | 146 | int index_msb, core_bits; |
144 | 147 | ||
145 | cpuid(1, &eax, &ebx, &ecx, &edx); | ||
146 | |||
147 | |||
148 | if (!cpu_has(c, X86_FEATURE_HT)) | 148 | if (!cpu_has(c, X86_FEATURE_HT)) |
149 | return; | 149 | return; |
150 | if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) | 150 | if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) |
151 | goto out; | 151 | goto out; |
152 | 152 | ||
153 | cpuid(1, &eax, &ebx, &ecx, &edx); | ||
154 | |||
153 | smp_num_siblings = (ebx & 0xff0000) >> 16; | 155 | smp_num_siblings = (ebx & 0xff0000) >> 16; |
154 | 156 | ||
155 | if (smp_num_siblings == 1) { | 157 | if (smp_num_siblings == 1) { |
@@ -175,6 +177,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
175 | c->cpu_core_id = phys_pkg_id(index_msb) & | 177 | c->cpu_core_id = phys_pkg_id(index_msb) & |
176 | ((1 << core_bits) - 1); | 178 | ((1 << core_bits) - 1); |
177 | } | 179 | } |
180 | |||
178 | out: | 181 | out: |
179 | if ((c->x86_max_cores * smp_num_siblings) > 1) { | 182 | if ((c->x86_max_cores * smp_num_siblings) > 1) { |
180 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 183 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", |
@@ -182,7 +185,6 @@ out: | |||
182 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | 185 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", |
183 | c->cpu_core_id); | 186 | c->cpu_core_id); |
184 | } | 187 | } |
185 | |||
186 | #endif | 188 | #endif |
187 | } | 189 | } |
188 | 190 | ||
@@ -405,10 +407,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
405 | c->x86_model = c->x86_mask = 0; /* So far unknown... */ | 407 | c->x86_model = c->x86_mask = 0; /* So far unknown... */ |
406 | c->x86_vendor_id[0] = '\0'; /* Unset */ | 408 | c->x86_vendor_id[0] = '\0'; /* Unset */ |
407 | c->x86_model_id[0] = '\0'; /* Unset */ | 409 | c->x86_model_id[0] = '\0'; /* Unset */ |
408 | c->x86_clflush_size = 64; | ||
409 | c->x86_cache_alignment = c->x86_clflush_size; | ||
410 | c->x86_max_cores = 1; | 410 | c->x86_max_cores = 1; |
411 | c->x86_coreid_bits = 0; | 411 | c->x86_coreid_bits = 0; |
412 | c->x86_clflush_size = 64; | ||
413 | c->x86_cache_alignment = c->x86_clflush_size; | ||
412 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 414 | memset(&c->x86_capability, 0, sizeof c->x86_capability); |
413 | 415 | ||
414 | generic_identify(c); | 416 | generic_identify(c); |