Skip to content

Commit 8bdbd96

Browse files
Alan CoxIngo Molnar
authored andcommitted
x86/cpu: Clean up various files a bit
No code changes except printk levels (although some of the K6 mtrr code might be clearer if there were a few as would splitting out some of the intel cache code). Signed-off-by: Alan Cox <alan@linux.intel.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent e90476d commit 8bdbd96

11 files changed

Lines changed: 144 additions & 129 deletions

File tree

‎arch/x86/kernel/cpu/amd.c‎

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <linux/bitops.h>
33
#include <linux/mm.h>
44

5-
#include <asm/io.h>
5+
#include <linux/io.h>
66
#include <asm/processor.h>
77
#include <asm/apic.h>
88
#include <asm/cpu.h>
@@ -45,8 +45,8 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
4545
#define CBAR_ENB (0x80000000)
4646
#define CBAR_KEY (0X000000CB)
4747
if (c->x86_model == 9 || c->x86_model == 10) {
48-
if (inl (CBAR) & CBAR_ENB)
49-
outl (0 | CBAR_KEY, CBAR);
48+
if (inl(CBAR) & CBAR_ENB)
49+
outl(0 | CBAR_KEY, CBAR);
5050
}
5151
}
5252

@@ -87,9 +87,10 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
8787
d = d2-d;
8888

8989
if (d > 20*K6_BUG_LOOP)
90-
printk("system stability may be impaired when more than 32 MB are used.\n");
90+
printk(KERN_CONT
91+
"system stability may be impaired when more than 32 MB are used.\n");
9192
else
92-
printk("probably OK (after B9730xxxx).\n");
93+
printk(KERN_CONT "probably OK (after B9730xxxx).\n");
9394
printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
9495
}
9596

@@ -219,8 +220,9 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
219220
if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) {
220221
rdmsr(MSR_K7_CLK_CTL, l, h);
221222
if ((l & 0xfff00000) != 0x20000000) {
222-
printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l,
223-
((l & 0x000fffff)|0x20000000));
223+
printk(KERN_INFO
224+
"CPU: CLK_CTL MSR was %x. Reprogramming to %x\n",
225+
l, ((l & 0x000fffff)|0x20000000));
224226
wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h);
225227
}
226228
}
@@ -398,7 +400,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
398400
u32 level;
399401

400402
level = cpuid_eax(1);
401-
if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
403+
if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
402404
set_cpu_cap(c, X86_FEATURE_REP_GOOD);
403405
}
404406
if (c->x86 == 0x10 || c->x86 == 0x11)
@@ -487,27 +489,30 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
487489
* benefit in doing so.
488490
*/
489491
if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) {
490-
printk(KERN_DEBUG "tseg: %010llx\n", tseg);
491-
if ((tseg>>PMD_SHIFT) <
492+
printk(KERN_DEBUG "tseg: %010llx\n", tseg);
493+
if ((tseg>>PMD_SHIFT) <
492494
(max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) ||
493-
((tseg>>PMD_SHIFT) <
495+
((tseg>>PMD_SHIFT) <
494496
(max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) &&
495-
(tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
496-
set_memory_4k((unsigned long)__va(tseg), 1);
497+
(tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
498+
set_memory_4k((unsigned long)__va(tseg), 1);
497499
}
498500
}
499501
#endif
500502
}
501503

502504
#ifdef CONFIG_X86_32
503-
static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
505+
static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
506+
unsigned int size)
504507
{
505508
/* AMD errata T13 (order #21922) */
506509
if ((c->x86 == 6)) {
507-
if (c->x86_model == 3 && c->x86_mask == 0) /* Duron Rev A0 */
510+
/* Duron Rev A0 */
511+
if (c->x86_model == 3 && c->x86_mask == 0)
508512
size = 64;
513+
/* Tbird rev A1/A2 */
509514
if (c->x86_model == 4 &&
510-
(c->x86_mask == 0 || c->x86_mask == 1)) /* Tbird rev A1/A2 */
515+
(c->x86_mask == 0 || c->x86_mask == 1))
511516
size = 256;
512517
}
513518
return size;

‎arch/x86/kernel/cpu/bugs.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void __init check_fpu(void)
8181

8282
boot_cpu_data.fdiv_bug = fdiv_bug;
8383
if (boot_cpu_data.fdiv_bug)
84-
printk("Hmm, FPU with FDIV bug.\n");
84+
printk(KERN_WARNING "Hmm, FPU with FDIV bug.\n");
8585
}
8686

8787
static void __init check_hlt(void)
@@ -98,7 +98,7 @@ static void __init check_hlt(void)
9898
halt();
9999
halt();
100100
halt();
101-
printk("OK.\n");
101+
printk(KERN_CONT "OK.\n");
102102
}
103103

104104
/*
@@ -122,9 +122,9 @@ static void __init check_popad(void)
122122
* CPU hard. Too bad.
123123
*/
124124
if (res != 12345678)
125-
printk("Buggy.\n");
125+
printk(KERN_CONT "Buggy.\n");
126126
else
127-
printk("OK.\n");
127+
printk(KERN_CONT "OK.\n");
128128
#endif
129129
}
130130

@@ -156,7 +156,7 @@ void __init check_bugs(void)
156156
{
157157
identify_boot_cpu();
158158
#ifndef CONFIG_SMP
159-
printk("CPU: ");
159+
printk(KERN_INFO "CPU: ");
160160
print_cpu_info(&boot_cpu_data);
161161
#endif
162162
check_config();

‎arch/x86/kernel/cpu/bugs_64.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void __init check_bugs(void)
1515
{
1616
identify_boot_cpu();
1717
#if !defined(CONFIG_SMP)
18-
printk("CPU: ");
18+
printk(KERN_INFO "CPU: ");
1919
print_cpu_info(&boot_cpu_data);
2020
#endif
2121
alternative_instructions();

‎arch/x86/kernel/cpu/common.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <asm/hypervisor.h>
1919
#include <asm/processor.h>
2020
#include <asm/sections.h>
21-
#include <asm/topology.h>
22-
#include <asm/cpumask.h>
21+
#include <linux/topology.h>
22+
#include <linux/cpumask.h>
2323
#include <asm/pgtable.h>
2424
#include <asm/atomic.h>
2525
#include <asm/proto.h>
@@ -28,13 +28,13 @@
2828
#include <asm/desc.h>
2929
#include <asm/i387.h>
3030
#include <asm/mtrr.h>
31-
#include <asm/numa.h>
31+
#include <linux/numa.h>
3232
#include <asm/asm.h>
3333
#include <asm/cpu.h>
3434
#include <asm/mce.h>
3535
#include <asm/msr.h>
3636
#include <asm/pat.h>
37-
#include <asm/smp.h>
37+
#include <linux/smp.h>
3838

3939
#ifdef CONFIG_X86_LOCAL_APIC
4040
#include <asm/uv/uv.h>

‎arch/x86/kernel/cpu/cyrix.c‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#include <linux/delay.h>
44
#include <linux/pci.h>
55
#include <asm/dma.h>
6-
#include <asm/io.h>
6+
#include <linux/io.h>
77
#include <asm/processor-cyrix.h>
88
#include <asm/processor-flags.h>
9-
#include <asm/timer.h>
9+
#include <linux/timer.h>
1010
#include <asm/pci-direct.h>
1111
#include <asm/tsc.h>
1212

@@ -282,7 +282,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
282282
* The 5510/5520 companion chips have a funky PIT.
283283
*/
284284
if (vendor == PCI_VENDOR_ID_CYRIX &&
285-
(device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
285+
(device == PCI_DEVICE_ID_CYRIX_5510 ||
286+
device == PCI_DEVICE_ID_CYRIX_5520))
286287
mark_tsc_unstable("cyrix 5510/5520 detected");
287288
}
288289
#endif
@@ -299,7 +300,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
299300
* ? : 0x7x
300301
* GX1 : 0x8x GX1 datasheet 56
301302
*/
302-
if ((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <= dir1 && dir1 <= 0x8f))
303+
if ((0x30 <= dir1 && dir1 <= 0x6f) ||
304+
(0x80 <= dir1 && dir1 <= 0x8f))
303305
geode_configure();
304306
return;
305307
} else { /* MediaGX */
@@ -427,9 +429,12 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c)
427429
printk(KERN_INFO "Enabling CPUID on Cyrix processor.\n");
428430
local_irq_save(flags);
429431
ccr3 = getCx86(CX86_CCR3);
430-
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
431-
setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80); /* enable cpuid */
432-
setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
432+
/* enable MAPEN */
433+
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
434+
/* enable cpuid */
435+
setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
436+
/* disable MAPEN */
437+
setCx86(CX86_CCR3, ccr3);
433438
local_irq_restore(flags);
434439
}
435440
}

‎arch/x86/kernel/cpu/hypervisor.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
static inline void __cpuinit
2929
detect_hypervisor_vendor(struct cpuinfo_x86 *c)
3030
{
31-
if (vmware_platform()) {
31+
if (vmware_platform())
3232
c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
33-
} else {
33+
else
3434
c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
35-
}
3635
}
3736

3837
unsigned long get_hypervisor_tsc_freq(void)

‎arch/x86/kernel/cpu/intel.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
#include <linux/sched.h>
88
#include <linux/thread_info.h>
99
#include <linux/module.h>
10+
#include <linux/uaccess.h>
1011

1112
#include <asm/processor.h>
1213
#include <asm/pgtable.h>
1314
#include <asm/msr.h>
14-
#include <asm/uaccess.h>
1515
#include <asm/ds.h>
1616
#include <asm/bugs.h>
1717
#include <asm/cpu.h>
1818

1919
#ifdef CONFIG_X86_64
20-
#include <asm/topology.h>
20+
#include <linux/topology.h>
2121
#include <asm/numa_64.h>
2222
#endif
2323

@@ -174,7 +174,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
174174
#ifdef CONFIG_X86_F00F_BUG
175175
/*
176176
* All current models of Pentium and Pentium with MMX technology CPUs
177-
* have the F0 0F bug, which lets nonprivileged users lock up the system.
177+
* have the F0 0F bug, which lets nonprivileged users lock up the
178+
* system.
178179
* Note that the workaround only should be initialized once...
179180
*/
180181
c->f00f_bug = 0;
@@ -207,7 +208,7 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
207208
printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n");
208209
printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
209210
lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
210-
wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
211+
wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
211212
}
212213
}
213214

@@ -283,7 +284,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
283284
/* Intel has a non-standard dependency on %ecx for this CPUID level. */
284285
cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
285286
if (eax & 0x1f)
286-
return ((eax >> 26) + 1);
287+
return (eax >> 26) + 1;
287288
else
288289
return 1;
289290
}

0 commit comments

Comments
 (0)