提交 cbe879fc 编写于 作者: G Glauber de Oliveira Costa 提交者: Ingo Molnar

x86: define bios to apicid mapping

This mapping already exists in x86_64, just provide it for
i386
Signed-off-by: NGlauber Costa <gcosta@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 7e1efc0c
...@@ -70,6 +70,12 @@ void *x86_cpu_to_apicid_early_ptr; ...@@ -70,6 +70,12 @@ void *x86_cpu_to_apicid_early_ptr;
DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID; DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID;
EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
u16 x86_bios_cpu_apicid_init[NR_CPUS] __initdata
= { [0 ... NR_CPUS-1] = BAD_APICID };
void *x86_bios_cpu_apicid_early_ptr;
DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
u8 apicid_2_node[MAX_APICID]; u8 apicid_2_node[MAX_APICID];
static void map_cpu_to_logical_apicid(void); static void map_cpu_to_logical_apicid(void);
......
#ifndef __ASM_MACH_APIC_H #ifndef __ASM_MACH_APIC_H
#define __ASM_MACH_APIC_H #define __ASM_MACH_APIC_H
#define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
extern u8 bios_cpu_apicid[];
#define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu])
#define esr_disable (1) #define esr_disable (1)
static inline int apic_id_registered(void) static inline int apic_id_registered(void)
...@@ -90,7 +87,7 @@ static inline int apicid_to_node(int logical_apicid) ...@@ -90,7 +87,7 @@ static inline int apicid_to_node(int logical_apicid)
static inline int cpu_present_to_apicid(int mps_cpu) static inline int cpu_present_to_apicid(int mps_cpu)
{ {
if (mps_cpu < NR_CPUS) if (mps_cpu < NR_CPUS)
return (int) bios_cpu_apicid[mps_cpu]; return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
return BAD_APICID; return BAD_APICID;
} }
......
#ifndef __ASM_MACH_APIC_H #ifndef __ASM_MACH_APIC_H
#define __ASM_MACH_APIC_H #define __ASM_MACH_APIC_H
extern u8 bios_cpu_apicid[]; #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
#define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu])
#define esr_disable (1) #define esr_disable (1)
static inline int apic_id_registered(void) static inline int apic_id_registered(void)
...@@ -80,7 +78,7 @@ extern void enable_apic_mode(void); ...@@ -80,7 +78,7 @@ extern void enable_apic_mode(void);
extern int apic_version [MAX_APICS]; extern int apic_version [MAX_APICS];
static inline void setup_apic_routing(void) static inline void setup_apic_routing(void)
{ {
int apic = bios_cpu_apicid[smp_processor_id()]; int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
(apic_version[apic] == 0x14) ? (apic_version[apic] == 0x14) ?
"Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]); "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]);
...@@ -102,7 +100,7 @@ static inline int cpu_present_to_apicid(int mps_cpu) ...@@ -102,7 +100,7 @@ static inline int cpu_present_to_apicid(int mps_cpu)
if (!mps_cpu) if (!mps_cpu)
return boot_cpu_physical_apicid; return boot_cpu_physical_apicid;
else if (mps_cpu < NR_CPUS) else if (mps_cpu < NR_CPUS)
return (int) bios_cpu_apicid[mps_cpu]; return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
else else
return BAD_APICID; return BAD_APICID;
} }
......
...@@ -40,7 +40,6 @@ static inline unsigned long check_apicid_present(int bit) ...@@ -40,7 +40,6 @@ static inline unsigned long check_apicid_present(int bit)
#define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
extern u8 bios_cpu_apicid[];
extern u8 cpu_2_logical_apicid[]; extern u8 cpu_2_logical_apicid[];
static inline void init_apic_ldr(void) static inline void init_apic_ldr(void)
...@@ -110,7 +109,7 @@ static inline int cpu_to_logical_apicid(int cpu) ...@@ -110,7 +109,7 @@ static inline int cpu_to_logical_apicid(int cpu)
static inline int cpu_present_to_apicid(int mps_cpu) static inline int cpu_present_to_apicid(int mps_cpu)
{ {
if (mps_cpu < NR_CPUS) if (mps_cpu < NR_CPUS)
return (int)bios_cpu_apicid[mps_cpu]; return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
else else
return BAD_APICID; return BAD_APICID;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册