ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc64 / smp.h
1 /* 
2  * smp.h: PPC64 specific SMP code.
3  *
4  * Original was a copy of sparc smp.h.  Now heavily modified
5  * for PPC.
6  *
7  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
8  * Copyright (C) 1996-2001 Cort Dougan <cort@fsmlabs.com>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version
13  * 2 of the License, or (at your option) any later version.
14  */
15
16 #ifdef __KERNEL__
17 #ifndef _PPC64_SMP_H
18 #define _PPC64_SMP_H
19
20 #include <linux/config.h>
21 #include <linux/threads.h>
22 #include <linux/cpumask.h>
23 #include <linux/kernel.h>
24
25 #ifndef __ASSEMBLY__
26
27 #include <asm/paca.h>
28
29 #ifdef CONFIG_SMP
30
31 extern void smp_send_debugger_break(int cpu);
32 struct pt_regs;
33 extern void smp_message_recv(int, struct pt_regs *);
34
35
36 #define smp_processor_id() (get_paca()->xPacaIndex)
37 #define hard_smp_processor_id() (get_paca()->xHwProcNum)
38
39 /*
40  * Retrieve the state of a CPU:
41  * online:          CPU is in a normal run state
42  * possible:        CPU is a candidate to be made online
43  * available:       CPU is candidate for the 'possible' pool
44  *                  Used to get SMT threads started at boot time.
45  * present_at_boot: CPU was available at boot time.  Used in DLPAR
46  *                  code to handle special cases for processor start up.
47  */
48 extern cpumask_t cpu_present_at_boot;
49 extern cpumask_t cpu_online_map;
50 extern cpumask_t cpu_possible_map;
51 extern cpumask_t cpu_available_map;
52
53 #define cpu_present_at_boot(cpu) cpu_isset(cpu, cpu_present_at_boot)
54 #define cpu_online(cpu)          cpu_isset(cpu, cpu_online_map) 
55 #define cpu_possible(cpu)        cpu_isset(cpu, cpu_possible_map) 
56 #define cpu_available(cpu)       cpu_isset(cpu, cpu_available_map) 
57
58 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
59  *
60  * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
61  * in /proc/interrupts will be wrong!!! --Troy */
62 #define PPC_MSG_CALL_FUNCTION   0
63 #define PPC_MSG_RESCHEDULE      1
64 /* This is unused now */
65 #if 0
66 #define PPC_MSG_MIGRATE_TASK    2
67 #endif
68 #define PPC_MSG_DEBUGGER_BREAK  3
69
70 extern cpumask_t irq_affinity[];
71
72 void smp_init_iSeries(void);
73 void smp_init_pSeries(void);
74
75 extern int __cpu_disable(void);
76 extern void __cpu_die(unsigned int cpu);
77 extern void cpu_die(void) __attribute__((noreturn));
78 #endif /* !(CONFIG_SMP) */
79
80 #define get_hard_smp_processor_id(CPU) (paca[(CPU)].xHwProcNum)
81 #define set_hard_smp_processor_id(CPU, VAL) \
82         do { (paca[(CPU)].xHwProcNum = VAL); } while (0)
83
84 #endif /* __ASSEMBLY__ */
85
86 #endif /* !(_PPC64_SMP_H) */
87 #endif /* __KERNEL__ */