2005-04-16 22:20:36 +00:00
|
|
|
#ifndef __ASM_SMP_H
|
|
|
|
#define __ASM_SMP_H
|
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/cpumask.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* We need the APIC definitions automatically as part of 'smp.h'
|
|
|
|
*/
|
2008-01-30 12:30:36 +00:00
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
|
|
# include <asm/mpspec.h>
|
|
|
|
# include <asm/apic.h>
|
|
|
|
# ifdef CONFIG_X86_IO_APIC
|
|
|
|
# include <asm/io_apic.h>
|
|
|
|
# endif
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
extern cpumask_t cpu_callin_map;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-03-23 08:03:29 +00:00
|
|
|
extern void (*mtrr_hook)(void);
|
|
|
|
extern void zap_low_mappings(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
#ifdef CONFIG_SMP
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* This function is needed by all SMP systems. It must _always_ be valid
|
|
|
|
* from the initial startup. We map APIC_BASE very early in page_setup(),
|
|
|
|
* so this is correct in the x86 case.
|
|
|
|
*/
|
2007-05-02 17:27:16 +00:00
|
|
|
DECLARE_PER_CPU(int, cpu_number);
|
|
|
|
#define raw_smp_processor_id() (x86_read_percpu(cpu_number))
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
extern int safe_smp_processor_id(void);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* We don't mark CPUs online until __cpu_up(), so we need another measure */
|
|
|
|
static inline int num_booting_cpus(void)
|
|
|
|
{
|
|
|
|
return cpus_weight(cpu_callout_map);
|
|
|
|
}
|
|
|
|
|
2005-11-09 05:42:33 +00:00
|
|
|
#else /* CONFIG_SMP */
|
2006-10-01 06:29:07 +00:00
|
|
|
#define safe_smp_processor_id() 0
|
2008-01-30 12:30:36 +00:00
|
|
|
#endif /* !CONFIG_SMP */
|
2006-10-06 09:11:56 +00:00
|
|
|
|
2007-05-09 09:33:27 +00:00
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
|
|
|
2008-03-23 08:03:29 +00:00
|
|
|
static inline int logical_smp_processor_id(void)
|
2008-01-30 12:30:36 +00:00
|
|
|
{
|
|
|
|
/* we don't want to mark this access volatile - bad code generation */
|
|
|
|
return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
|
|
|
|
}
|
|
|
|
|
|
|
|
# ifdef APIC_DEFINITION
|
2007-05-09 09:33:27 +00:00
|
|
|
extern int hard_smp_processor_id(void);
|
2008-01-30 12:30:36 +00:00
|
|
|
# else
|
|
|
|
# include <mach_apicdef.h>
|
2007-05-09 09:33:27 +00:00
|
|
|
static inline int hard_smp_processor_id(void)
|
|
|
|
{
|
|
|
|
/* we don't want to mark this access volatile - bad code generation */
|
2008-01-30 12:30:36 +00:00
|
|
|
return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID));
|
2007-05-09 09:33:27 +00:00
|
|
|
}
|
2008-01-30 12:30:36 +00:00
|
|
|
# endif /* APIC_DEFINITION */
|
2007-05-09 09:33:27 +00:00
|
|
|
|
|
|
|
#else /* CONFIG_X86_LOCAL_APIC */
|
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
# ifndef CONFIG_SMP
|
|
|
|
# define hard_smp_processor_id() 0
|
|
|
|
# endif
|
2007-05-09 09:33:27 +00:00
|
|
|
|
|
|
|
#endif /* CONFIG_X86_LOCAL_APIC */
|
|
|
|
|
2008-01-30 12:30:36 +00:00
|
|
|
#endif /* !ASSEMBLY */
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|