debuggers.hg

view xen/include/asm-x86/smp.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 46f8fc57b1a4
line source
1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
4 /*
5 * We need the APIC definitions automatically as part of 'smp.h'
6 */
7 #ifndef __ASSEMBLY__
8 #include <xen/config.h>
9 #include <xen/kernel.h>
10 #include <xen/cpumask.h>
11 #include <asm/current.h>
12 #endif
14 #ifdef CONFIG_X86_LOCAL_APIC
15 #ifndef __ASSEMBLY__
16 #include <asm/bitops.h>
17 #include <asm/mpspec.h>
18 #ifdef CONFIG_X86_IO_APIC
19 #include <asm/io_apic.h>
20 #endif
21 #include <asm/apic.h>
22 #endif
23 #endif
25 #define BAD_APICID -1U
26 #ifdef CONFIG_SMP
27 #ifndef __ASSEMBLY__
29 /*
30 * Private routines/data
31 */
33 extern void smp_alloc_memory(void);
34 extern int pic_mode;
35 extern int smp_num_siblings;
36 extern cpumask_t cpu_sibling_map[];
37 extern cpumask_t cpu_core_map[];
39 extern void (*mtrr_hook) (void);
41 #ifdef CONFIG_X86_64
42 extern void zap_low_mappings(void);
43 #else
44 extern void zap_low_mappings(l2_pgentry_t *base);
45 #endif
47 #define MAX_APICID 256
48 extern u32 x86_cpu_to_apicid[];
50 #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
52 /* State of each CPU. */
53 #define CPU_ONLINE 0x0002 /* CPU is up */
54 #define CPU_DEAD 0x0004 /* CPU is dead */
55 DECLARE_PER_CPU(int, cpu_state);
57 #ifdef CONFIG_HOTPLUG_CPU
58 #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
59 extern int cpu_down(unsigned int cpu);
60 extern int cpu_up(unsigned int cpu);
61 extern void cpu_exit_clear(void);
62 extern void cpu_uninit(void);
63 extern void disable_nonboot_cpus(void);
64 extern void enable_nonboot_cpus(void);
65 #else
66 static inline int cpu_is_offline(int cpu) {return 0;}
67 static inline void disable_nonboot_cpus(void) {}
68 static inline void enable_nonboot_cpus(void) {}
69 #endif
71 /*
72 * This function is needed by all SMP systems. It must _always_ be valid
73 * from the initial startup. We map APIC_BASE very early in page_setup(),
74 * so this is correct in the x86 case.
75 */
76 #define raw_smp_processor_id() (get_processor_id())
78 extern cpumask_t cpu_callout_map;
79 extern cpumask_t cpu_callin_map;
80 extern cpumask_t cpu_possible_map;
82 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
83 static inline int num_booting_cpus(void)
84 {
85 return cpus_weight(cpu_callout_map);
86 }
88 #ifdef CONFIG_X86_LOCAL_APIC
90 static inline int hard_smp_processor_id(void)
91 {
92 /* we don't want to mark this access volatile - bad code generation */
93 return get_apic_id();
94 }
96 static __inline int logical_smp_processor_id(void)
97 {
98 /* we don't want to mark this access volatile - bad code generation */
99 return get_logical_apic_id();
100 }
102 #endif
104 extern int __cpu_disable(void);
105 extern void __cpu_die(unsigned int cpu);
106 #endif /* !__ASSEMBLY__ */
108 #else /* CONFIG_SMP */
110 #define cpu_physical_id(cpu) boot_cpu_physical_apicid
112 #define NO_PROC_ID 0xFF /* No processor magic marker */
114 #endif
115 #endif