make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-mips64 / smp.h
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  */
9 #ifndef __ASM_SMP_H
10 #define __ASM_SMP_H
11
12 #include <linux/config.h>
13
14 #ifdef CONFIG_SMP
15
16 #include <linux/threads.h>
17 #include <linux/irq.h>
18
19 #define smp_processor_id()      (current->processor)
20
21 #define PROC_CHANGE_PENALTY     20
22
23 /* Map from cpu id to sequential logical cpu number.  This will only
24    not be idempotent when cpus failed to come on-line.  */
25 extern int __cpu_number_map[NR_CPUS];
26 #define cpu_number_map(cpu)  __cpu_number_map[cpu]
27
28 /* The reverse map from sequential logical cpu number to cpu id.  */
29 extern int __cpu_logical_map[NR_CPUS];
30 #define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
31
32 #endif
33
34 #define NO_PROC_ID      (-1)
35
36 #define SMP_RESCHEDULE_YOURSELF 0x1     /* XXX braindead */
37 #define SMP_CALL_FUNCTION       0x2
38
39 #if (NR_CPUS <= _MIPS_SZLONG)
40
41 typedef unsigned long   cpumask_t;
42
43 #define CPUMASK_CLRALL(p)       (p) = 0
44 #define CPUMASK_SETB(p, bit)    (p) |= 1UL << (bit)
45 #define CPUMASK_CLRB(p, bit)    (p) &= ~(1UL << (bit))
46 #define CPUMASK_TSTB(p, bit)    ((p) & (1UL << (bit)))
47
48 #elif (NR_CPUS <= 128)
49
50 /*
51  * The foll should work till 128 cpus.
52  */
53 #define CPUMASK_SIZE            (NR_CPUS/_MIPS_SZLONG)
54 #define CPUMASK_INDEX(bit)      ((bit) >> 6)
55 #define CPUMASK_SHFT(bit)       ((bit) & 0x3f)
56
57 typedef struct {
58         unsigned long   _bits[CPUMASK_SIZE];
59 } cpumask_t;
60
61 #define CPUMASK_CLRALL(p)       (p)._bits[0] = 0, (p)._bits[1] = 0
62 #define CPUMASK_SETB(p, bit)    (p)._bits[CPUMASK_INDEX(bit)] |= \
63                                         (1UL << CPUMASK_SHFT(bit))
64 #define CPUMASK_CLRB(p, bit)    (p)._bits[CPUMASK_INDEX(bit)] &= \
65                                         ~(1UL << CPUMASK_SHFT(bit))
66 #define CPUMASK_TSTB(p, bit)    ((p)._bits[CPUMASK_INDEX(bit)] & \
67                                         (1UL << CPUMASK_SHFT(bit)))
68
69 #else
70 #error cpumask macros only defined for 128p kernels
71 #endif
72
73 struct call_data_struct {
74         void            (*func)(void *);
75         void            *info;
76         atomic_t        started;
77         atomic_t        finished;
78         int             wait;
79 };
80
81 extern struct call_data_struct *call_data;
82
83 extern cpumask_t cpu_online_map;
84
85 #endif /* __ASM_SMP_H */