Commit a940199f206dcf51c65fae27e2ce412f2c5a2b22

Authored by Andi Kleen
Committed by Linus Torvalds
1 parent de04f3220b

[PATCH] x86_64: Some cleanup in setup64.c

Minor cleanup.

Move things into their include files, remove obsolete includes, fix
indentation, remove obsolete special cases etc.

I also added the per cpu section to asm-generic/sections.h and fixed
init/main.c to use it.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 4 changed files with 7 additions and 16 deletions Side-by-side Diff

arch/x86_64/kernel/setup64.c
... ... @@ -12,6 +12,7 @@
12 12 #include <linux/string.h>
13 13 #include <linux/bootmem.h>
14 14 #include <linux/bitops.h>
  15 +#include <linux/module.h>
15 16 #include <asm/bootsetup.h>
16 17 #include <asm/pda.h>
17 18 #include <asm/pgtable.h>
18 19  
... ... @@ -22,10 +23,8 @@
22 23 #include <asm/smp.h>
23 24 #include <asm/i387.h>
24 25 #include <asm/percpu.h>
25   -#include <asm/mtrr.h>
26 26 #include <asm/proto.h>
27   -#include <asm/mman.h>
28   -#include <asm/numa.h>
  27 +#include <asm/sections.h>
29 28  
30 29 char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
31 30  
... ... @@ -33,11 +32,6 @@
33 32  
34 33 struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
35 34  
36   -extern struct task_struct init_task;
37   -
38   -extern unsigned char __per_cpu_start[], __per_cpu_end[];
39   -
40   -extern struct desc_ptr cpu_gdt_descr[];
41 35 struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
42 36  
43 37 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
... ... @@ -101,7 +95,7 @@
101 95 #endif
102 96  
103 97 for (i = 0; i < NR_CPUS; i++) {
104   - unsigned char *ptr;
  98 + char *ptr;
105 99  
106 100 if (!NODE_DATA(cpu_to_node(i))) {
107 101 printk("cpu with no node %d, num_online_nodes %d\n",
108 102  
... ... @@ -190,11 +184,7 @@
190 184 */
191 185 void __cpuinit cpu_init (void)
192 186 {
193   -#ifdef CONFIG_SMP
194 187 int cpu = stack_smp_processor_id();
195   -#else
196   - int cpu = smp_processor_id();
197   -#endif
198 188 struct tss_struct *t = &per_cpu(init_tss, cpu);
199 189 unsigned long v;
200 190 char *estacks = NULL;
... ... @@ -214,7 +204,7 @@
214 204  
215 205 printk("Initializing CPU#%d\n", cpu);
216 206  
217   - clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
  207 + clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
218 208  
219 209 /*
220 210 * Initialize the per-CPU GDT with the boot GDT,
include/asm-generic/sections.h
... ... @@ -11,6 +11,7 @@
11 11 extern char _sextratext[] __attribute__((weak));
12 12 extern char _eextratext[] __attribute__((weak));
13 13 extern char _end[];
  14 +extern char __per_cpu_start[], __per_cpu_end[];
14 15  
15 16 #endif /* _ASM_GENERIC_SECTIONS_H_ */
include/asm-x86_64/desc.h
... ... @@ -75,6 +75,7 @@
75 75 */
76 76 extern struct desc_struct default_ldt[];
77 77 extern struct gate_struct idt_table[];
  78 +extern struct desc_ptr cpu_gdt_descr[];
78 79  
79 80 static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)
80 81 {
... ... @@ -51,6 +51,7 @@
51 51 #include <asm/io.h>
52 52 #include <asm/bugs.h>
53 53 #include <asm/setup.h>
  54 +#include <asm/sections.h>
54 55  
55 56 /*
56 57 * This is one of the first .c files built. Error out early
... ... @@ -323,8 +324,6 @@
323 324 {
324 325 unsigned long size, i;
325 326 char *ptr;
326   - /* Created by linker magic */
327   - extern char __per_cpu_start[], __per_cpu_end[];
328 327  
329 328 /* Copy section for each CPU (we discard the original) */
330 329 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);