2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
14 #include <linux/config.h>
18 #include <linux/bitops.h>
19 #include <linux/linkage.h>
20 #include <linux/threads.h>
21 #include <linux/cpumask.h>
22 #include <asm/atomic.h>
24 #define raw_smp_processor_id() (current_thread_info()->cpu)
26 /* Map from cpu id to sequential logical cpu number. This will only
27 not be idempotent when cpus failed to come on-line. */
28 extern int __cpu_number_map
[NR_CPUS
];
29 #define cpu_number_map(cpu) __cpu_number_map[cpu]
31 /* The reverse map from sequential logical cpu number to cpu id. */
32 extern int __cpu_logical_map
[NR_CPUS
];
33 #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
35 #define NO_PROC_ID (-1)
37 struct call_data_struct
{
45 extern struct call_data_struct
*call_data
;
47 #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
48 #define SMP_CALL_FUNCTION 0x2
50 extern cpumask_t phys_cpu_present_map
;
51 extern cpumask_t cpu_online_map
;
52 #define cpu_possible_map phys_cpu_present_map
54 extern cpumask_t cpu_callout_map
;
55 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
56 static inline int num_booting_cpus(void)
58 return cpus_weight(cpu_callout_map
);
62 * These are defined by the board-specific code.
66 * Cause the function described by call_data to be executed on the passed
67 * cpu. When the function has finished, increment the finished field of
70 extern void core_send_ipi(int cpu
, unsigned int action
);
73 * Firmware CPU startup hook
75 extern void prom_boot_secondary(int cpu
, struct task_struct
*idle
);
78 * After we've done initial boot, this function is called to allow the
79 * board code to clean up state, if needed
81 extern void prom_init_secondary(void);
84 * Populate cpu_possible_map before smp_init, called from setup_arch.
86 extern void plat_smp_setup(void);
89 * Called after init_IRQ but before __cpu_up.
91 extern void prom_prepare_cpus(unsigned int max_cpus
);
94 * Last chance for the board code to finish SMP initialization before
95 * the CPU is "online".
97 extern void prom_smp_finish(void);
99 /* Hook for after all CPUs are online */
100 extern void prom_cpus_done(void);
102 extern void asmlinkage
smp_bootstrap(void);
105 * this function sends a 'reschedule' IPI to another CPU.
106 * it goes straight through and wastes no time serializing
107 * anything. Worst case is that we lose a reschedule ...
109 static inline void smp_send_reschedule(int cpu
)
111 core_send_ipi(cpu
, SMP_RESCHEDULE_YOURSELF
);
114 extern asmlinkage
void smp_call_function_interrupt(void);
116 #endif /* CONFIG_SMP */
118 #endif /* __ASM_SMP_H */