]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
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. | |
5 | * | |
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 | |
10 | */ | |
11 | #ifndef __ASM_SMP_H | |
12 | #define __ASM_SMP_H | |
13 | ||
1da177e4 LT |
14 | |
15 | #ifdef CONFIG_SMP | |
16 | ||
17 | #include <linux/bitops.h> | |
18 | #include <linux/linkage.h> | |
19 | #include <linux/threads.h> | |
20 | #include <linux/cpumask.h> | |
21 | #include <asm/atomic.h> | |
22 | ||
39c715b7 | 23 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
1da177e4 LT |
24 | |
25 | /* Map from cpu id to sequential logical cpu number. This will only | |
26 | not be idempotent when cpus failed to come on-line. */ | |
27 | extern int __cpu_number_map[NR_CPUS]; | |
28 | #define cpu_number_map(cpu) __cpu_number_map[cpu] | |
29 | ||
30 | /* The reverse map from sequential logical cpu number to cpu id. */ | |
31 | extern int __cpu_logical_map[NR_CPUS]; | |
32 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | |
33 | ||
34 | #define NO_PROC_ID (-1) | |
35 | ||
36 | struct call_data_struct { | |
37 | void (*func)(void *); | |
38 | void *info; | |
39 | atomic_t started; | |
40 | atomic_t finished; | |
41 | int wait; | |
42 | }; | |
43 | ||
44 | extern struct call_data_struct *call_data; | |
45 | ||
46 | #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ | |
47 | #define SMP_CALL_FUNCTION 0x2 | |
48 | ||
49 | extern cpumask_t phys_cpu_present_map; | |
1da177e4 LT |
50 | #define cpu_possible_map phys_cpu_present_map |
51 | ||
9b6695a8 RB |
52 | /* |
53 | * These are defined by the board-specific code. | |
54 | */ | |
1da177e4 LT |
55 | |
56 | /* | |
57 | * Cause the function described by call_data to be executed on the passed | |
58 | * cpu. When the function has finished, increment the finished field of | |
59 | * call_data. | |
60 | */ | |
61 | extern void core_send_ipi(int cpu, unsigned int action); | |
62 | ||
63 | /* | |
64 | * Firmware CPU startup hook | |
65 | */ | |
66 | extern void prom_boot_secondary(int cpu, struct task_struct *idle); | |
67 | ||
68 | /* | |
69 | * After we've done initial boot, this function is called to allow the | |
70 | * board code to clean up state, if needed | |
71 | */ | |
72 | extern void prom_init_secondary(void); | |
73 | ||
74 | /* | |
9b6695a8 RB |
75 | * Populate cpu_possible_map before smp_init, called from setup_arch. |
76 | */ | |
77 | extern void plat_smp_setup(void); | |
78 | ||
79 | /* | |
722ace9d | 80 | * Called in smp_prepare_cpus. |
1da177e4 | 81 | */ |
722ace9d | 82 | extern void plat_prepare_cpus(unsigned int max_cpus); |
1da177e4 LT |
83 | |
84 | /* | |
85 | * Last chance for the board code to finish SMP initialization before | |
86 | * the CPU is "online". | |
87 | */ | |
88 | extern void prom_smp_finish(void); | |
89 | ||
90 | /* Hook for after all CPUs are online */ | |
91 | extern void prom_cpus_done(void); | |
92 | ||
93 | extern void asmlinkage smp_bootstrap(void); | |
94 | ||
95 | /* | |
96 | * this function sends a 'reschedule' IPI to another CPU. | |
97 | * it goes straight through and wastes no time serializing | |
98 | * anything. Worst case is that we lose a reschedule ... | |
99 | */ | |
100 | static inline void smp_send_reschedule(int cpu) | |
101 | { | |
102 | core_send_ipi(cpu, SMP_RESCHEDULE_YOURSELF); | |
103 | } | |
104 | ||
105 | extern asmlinkage void smp_call_function_interrupt(void); | |
106 | ||
107 | #endif /* CONFIG_SMP */ | |
108 | ||
109 | #endif /* __ASM_SMP_H */ |