summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKanoj Sarcar <kanoj@engr.sgi.com>2001-03-02 08:42:17 +0000
committerKanoj Sarcar <kanoj@engr.sgi.com>2001-03-02 08:42:17 +0000
commit5ab307f5e6368d6e8eb5d758b41311458827ea39 (patch)
tree8bbcd229292163a6e5cdf5d27d02748ae120bf98 /include
parent1a811c4fbfd1671c78b64382cf16261ab75cd3ca (diff)
Add in mips64 specific support for handling 128 cpus.
Diffstat (limited to 'include')
-rw-r--r--include/asm-mips64/smp.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/include/asm-mips64/smp.h b/include/asm-mips64/smp.h
index 8ec23cc47..efb50ba18 100644
--- a/include/asm-mips64/smp.h
+++ b/include/asm-mips64/smp.h
@@ -11,10 +11,10 @@
#define __ASM_SMP_H
#include <linux/config.h>
-#include <linux/threads.h>
#ifdef CONFIG_SMP
+#include <linux/threads.h>
#include <linux/irq.h>
#if 0
@@ -47,15 +47,42 @@ extern int __cpu_number_map[NR_CPUS];
extern int __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
-#endif /* CONFIG_SMP */
+#endif
#define NO_PROC_ID (-1)
+#if (NR_CPUS <= _MIPS_SZLONG)
+
typedef unsigned long cpumask_t;
-#define CPUMASK_CLRALL(p) (p) = 0
-#define CPUMASK_SETB(p, bit) (p) |= 1 << (bit)
-#define CPUMASK_CLRB(p, bit) (p) &= ~(1ULL << (bit))
-#define CPUMASK_TSTB(p, bit) ((p) & (1ULL << (bit)))
+#define CPUMASK_CLRALL(p) (p) = 0
+#define CPUMASK_SETB(p, bit) (p) |= 1 << (bit)
+#define CPUMASK_CLRB(p, bit) (p) &= ~(1ULL << (bit))
+#define CPUMASK_TSTB(p, bit) ((p) & (1ULL << (bit)))
+
+#elif (NR_CPUS <= 128)
+
+/*
+ * The foll should work till 128 cpus.
+ */
+#define CPUMASK_SIZE (NR_CPUS/_MIPS_SZLONG)
+#define CPUMASK_INDEX(bit) ((bit) >> 6)
+#define CPUMASK_SHFT(bit) ((bit) & 0x3f)
+
+typedef struct {
+ unsigned long _bits[CPUMASK_SIZE];
+} cpumask_t;
+
+#define CPUMASK_CLRALL(p) (p)._bits[0] = 0, (p)._bits[1] = 0
+#define CPUMASK_SETB(p, bit) (p)._bits[CPUMASK_INDEX(bit)] |= \
+ (1ULL << CPUMASK_SHFT(bit))
+#define CPUMASK_CLRB(p, bit) (p)._bits[CPUMASK_INDEX(bit)] &= \
+ ~(1ULL << CPUMASK_SHFT(bit))
+#define CPUMASK_TSTB(p, bit) ((p)._bits[CPUMASK_INDEX(bit)] & \
+ (1ULL << CPUMASK_SHFT(bit)))
+
+#else
+#error cpumask macros only defined for 128p kernels
+#endif
#endif /* __ASM_SMP_H */