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.
12 #include <linux/config.h>
16 #include <linux/threads.h>
17 #include <linux/irq.h>
19 #define smp_processor_id() (current->processor)
21 #define PROC_CHANGE_PENALTY 20
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]
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]
34 #define NO_PROC_ID (-1)
36 #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
37 #define SMP_CALL_FUNCTION 0x2
39 #if (NR_CPUS <= _MIPS_SZLONG)
41 typedef unsigned long cpumask_t;
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)))
48 #elif (NR_CPUS <= 128)
51 * The foll should work till 128 cpus.
53 #define CPUMASK_SIZE (NR_CPUS/_MIPS_SZLONG)
54 #define CPUMASK_INDEX(bit) ((bit) >> 6)
55 #define CPUMASK_SHFT(bit) ((bit) & 0x3f)
58 unsigned long _bits[CPUMASK_SIZE];
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)))
70 #error cpumask macros only defined for 128p kernels
73 struct call_data_struct {
81 extern struct call_data_struct *call_data;
83 extern cpumask_t cpu_online_map;
85 #endif /* __ASM_SMP_H */