Commit a940199f authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[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: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent de04f322
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/module.h>
#include <asm/bootsetup.h> #include <asm/bootsetup.h>
#include <asm/pda.h> #include <asm/pda.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -22,10 +23,8 @@ ...@@ -22,10 +23,8 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/i387.h> #include <asm/i387.h>
#include <asm/percpu.h> #include <asm/percpu.h>
#include <asm/mtrr.h>
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/mman.h> #include <asm/sections.h>
#include <asm/numa.h>
char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
...@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; ...@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
extern struct task_struct init_task;
extern unsigned char __per_cpu_start[], __per_cpu_end[];
extern struct desc_ptr cpu_gdt_descr[];
struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
...@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void) ...@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void)
#endif #endif
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < NR_CPUS; i++) {
unsigned char *ptr; char *ptr;
if (!NODE_DATA(cpu_to_node(i))) { if (!NODE_DATA(cpu_to_node(i))) {
printk("cpu with no node %d, num_online_nodes %d\n", printk("cpu with no node %d, num_online_nodes %d\n",
...@@ -190,11 +184,7 @@ void __cpuinit check_efer(void) ...@@ -190,11 +184,7 @@ void __cpuinit check_efer(void)
*/ */
void __cpuinit cpu_init (void) void __cpuinit cpu_init (void)
{ {
#ifdef CONFIG_SMP
int cpu = stack_smp_processor_id(); int cpu = stack_smp_processor_id();
#else
int cpu = smp_processor_id();
#endif
struct tss_struct *t = &per_cpu(init_tss, cpu); struct tss_struct *t = &per_cpu(init_tss, cpu);
unsigned long v; unsigned long v;
char *estacks = NULL; char *estacks = NULL;
...@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void) ...@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void)
printk("Initializing CPU#%d\n", cpu); printk("Initializing CPU#%d\n", cpu);
clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
/* /*
* Initialize the per-CPU GDT with the boot GDT, * Initialize the per-CPU GDT with the boot GDT,
......
...@@ -11,5 +11,6 @@ extern char _sinittext[], _einittext[]; ...@@ -11,5 +11,6 @@ extern char _sinittext[], _einittext[];
extern char _sextratext[] __attribute__((weak)); extern char _sextratext[] __attribute__((weak));
extern char _eextratext[] __attribute__((weak)); extern char _eextratext[] __attribute__((weak));
extern char _end[]; extern char _end[];
extern char __per_cpu_start[], __per_cpu_end[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */ #endif /* _ASM_GENERIC_SECTIONS_H_ */
...@@ -75,6 +75,7 @@ struct desc_ptr { ...@@ -75,6 +75,7 @@ struct desc_ptr {
*/ */
extern struct desc_struct default_ldt[]; extern struct desc_struct default_ldt[];
extern struct gate_struct idt_table[]; extern struct gate_struct idt_table[];
extern struct desc_ptr cpu_gdt_descr[];
static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)
{ {
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/bugs.h> #include <asm/bugs.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/sections.h>
/* /*
* This is one of the first .c files built. Error out early * This is one of the first .c files built. Error out early
...@@ -323,8 +324,6 @@ static void __init setup_per_cpu_areas(void) ...@@ -323,8 +324,6 @@ static void __init setup_per_cpu_areas(void)
{ {
unsigned long size, i; unsigned long size, i;
char *ptr; char *ptr;
/* Created by linker magic */
extern char __per_cpu_start[], __per_cpu_end[];
/* Copy section for each CPU (we discard the original) */ /* Copy section for each CPU (we discard the original) */
size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment