提交 77313190 编写于 作者: I Ingo Molnar

x86, apic: clean up arch/x86/kernel/bigsmp_32.c

Impact: cleanup

- remove unnecessary indirections that were artifacts of the subarch code
- clean up include file section
- clean up various small details
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 5c615feb
/* /*
* APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs.
*
* Drives the local APIC in "clustered mode". * Drives the local APIC in "clustered mode".
*/ */
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <asm/mpspec.h>
#include <asm/apic.h>
#include <asm/fixmap.h>
#include <asm/apicdef.h>
#include <asm/ipi.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <asm/apicdef.h>
#include <asm/fixmap.h>
#include <asm/mpspec.h>
#include <asm/apic.h>
#include <asm/ipi.h>
static inline unsigned bigsmp_get_apic_id(unsigned long x) static inline unsigned bigsmp_get_apic_id(unsigned long x)
{ {
return (x >> 24) & 0xFF; return (x >> 24) & 0xFF;
} }
#define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
static inline int bigsmp_apic_id_registered(void) static inline int bigsmp_apic_id_registered(void)
{ {
return 1; return 1;
...@@ -36,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) ...@@ -36,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
#endif #endif
} }
#define APIC_DFR_VALUE (APIC_DFR_FLAT)
static inline unsigned long static inline unsigned long
bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid)
{ {
...@@ -52,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit) ...@@ -52,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit)
static inline unsigned long calculate_ldr(int cpu) static inline unsigned long calculate_ldr(int cpu)
{ {
unsigned long val, id; unsigned long val, id;
val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
id = xapic_phys_to_log_apicid(cpu); id = per_cpu(x86_bios_cpu_apicid, cpu);
val |= SET_APIC_LOGICAL_ID(id); val |= SET_APIC_LOGICAL_ID(id);
return val; return val;
} }
...@@ -70,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void) ...@@ -70,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void)
unsigned long val; unsigned long val;
int cpu = smp_processor_id(); int cpu = smp_processor_id();
apic_write(APIC_DFR, APIC_DFR_VALUE); apic_write(APIC_DFR, APIC_DFR_FLAT);
val = calculate_ldr(cpu); val = calculate_ldr(cpu);
apic_write(APIC_LDR, val); apic_write(APIC_LDR, val);
} }
static inline void bigsmp_setup_apic_routing(void) static inline void bigsmp_setup_apic_routing(void)
{ {
printk("Enabling APIC mode: %s. Using %d I/O APICs\n", printk(KERN_INFO
"Physflat", nr_ioapics); "Enabling APIC mode: Physflat. Using %d I/O APICs\n",
nr_ioapics);
} }
static inline int bigsmp_apicid_to_node(int logical_apicid) static inline int bigsmp_apicid_to_node(int logical_apicid)
...@@ -100,6 +100,7 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid) ...@@ -100,6 +100,7 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid)
} }
extern u8 cpu_2_logical_apicid[]; extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
static inline int bigsmp_cpu_to_logical_apicid(int cpu) static inline int bigsmp_cpu_to_logical_apicid(int cpu)
{ {
...@@ -175,21 +176,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d) ...@@ -175,21 +176,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d)
{ {
printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
dmi_bigsmp = 1; dmi_bigsmp = 1;
return 0; return 0;
} }
static const struct dmi_system_id bigsmp_dmi_table[] = { static const struct dmi_system_id bigsmp_dmi_table[] = {
{ hp_ht_bigsmp, "HP ProLiant DL760 G2", { hp_ht_bigsmp, "HP ProLiant DL760 G2",
{ DMI_MATCH(DMI_BIOS_VENDOR, "HP"), { DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
}
}, },
{ hp_ht_bigsmp, "HP ProLiant DL740", { hp_ht_bigsmp, "HP ProLiant DL740",
{ DMI_MATCH(DMI_BIOS_VENDOR, "HP"), { DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} DMI_MATCH(DMI_BIOS_VERSION, "P47-"),
}
}, },
{ } { } /* NULL entry stops DMI scanning */
}; };
static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask)
...@@ -204,6 +208,7 @@ static int probe_bigsmp(void) ...@@ -204,6 +208,7 @@ static int probe_bigsmp(void)
dmi_bigsmp = 1; dmi_bigsmp = 1;
else else
dmi_check_system(bigsmp_dmi_table); dmi_check_system(bigsmp_dmi_table);
return dmi_bigsmp; return dmi_bigsmp;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册