Messages in this thread Patch in this message | | | Subject | Re: [PATCH -tip] x86: apic/apic.c default_init_apic_ldr() is required only for X86_32 | From | Jaswinder Singh Rajput <> | Date | Thu, 14 May 2009 14:54:10 +0530 |
| |
On Thu, 2009-05-14 at 14:19 +0530, Jaswinder Singh Rajput wrote: > On Thu, 2009-05-14 at 09:53 +0200, Thomas Gleixner wrote: > > On Thu, 14 May 2009, Jaswinder Singh Rajput wrote: > > > > > > default_init_apic_ldr() is also required for 64 bit so moving it out > > > from CONFIG_X86_32. > > > > [linux-2.6-tip]$ git grep default_init_apic_ldr arch/x86/ > > arch/x86/include/asm/apic.h:extern void default_init_apic_ldr(void); > > arch/x86/kernel/apic/apic.c:void default_init_apic_ldr(void) > > arch/x86/kernel/apic/probe_32.c: .init_apic_ldr = default_init_apic_ldr, > > > > I have a hard time to see how 64bit requires that function. > > > > Here is new patch to make you easy :-) > > [PATCH] x86: apic/apic.c default_init_apic_ldr() is required only for X86_32 > > default_init_apic_ldr() is used only by X86_32. >
I think it will be better to use this:
[PATCH-tip] x86: apic/apic.c move default_init_apic_ldr() and default_apicid_to_node() to probe_32.c
default_init_apic_ldr() and default_apicid_to_node() is used only by probe_32.c so move them to probe_32.c and make them static.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> --- arch/x86/include/asm/apic.h | 11 ----------- arch/x86/kernel/apic/apic.c | 21 --------------------- arch/x86/kernel/apic/probe_32.c | 27 +++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 32 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 229d0be..bc9eca8 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -473,15 +473,6 @@ extern void default_setup_apic_routing(void); extern struct apic apic_default; -/* - * Set up the logical destination ID. - * - * Intel recommends to set DFR, LDR and TPR before enabling - * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel - * document number 292116). So here it goes... - */ -extern void default_init_apic_ldr(void); - static inline int default_apic_id_registered(void) { return physid_isset(read_apic_id(), phys_cpu_present_map); @@ -492,8 +483,6 @@ static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) return cpuid_apic >> index_msb; } -extern int default_apicid_to_node(int logical_apicid); - #endif static inline unsigned int diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index d6d4ffd..b97fd65 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1941,27 +1941,6 @@ int hard_smp_processor_id(void) return read_apic_id(); } -void default_init_apic_ldr(void) -{ - unsigned long val; - - apic_write(APIC_DFR, APIC_DFR_VALUE); - val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; - val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); - apic_write(APIC_LDR, val); -} - -#ifdef CONFIG_X86_32 -int default_apicid_to_node(int logical_apicid) -{ -#ifdef CONFIG_SMP - return apicid_2_node[hard_smp_processor_id()]; -#else - return 0; -#endif -} -#endif - /* * Power management */ diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 440a8bc..47c8a49 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -93,6 +93,33 @@ static int probe_default(void) return 1; } +/* + * Set up the logical destination ID. + * + * Intel recommends to set DFR, LDR and TPR before enabling + * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel + * document number 292116). So here it goes... + */ + +static void default_init_apic_ldr(void) +{ + unsigned long val; + + apic_write(APIC_DFR, APIC_DFR_VALUE); + val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; + val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); + apic_write(APIC_LDR, val); +} + +static int default_apicid_to_node(int logical_apicid) +{ +#ifdef CONFIG_SMP + return apicid_2_node[hard_smp_processor_id()]; +#else + return 0; +#endif +} + struct apic apic_default = { .name = "default", -- 1.6.0.6
| |