patch-2.4.7 linux/include/asm-mips64/smp.h
Next file: linux/include/asm-mips64/sn/types.h
Previous file: linux/include/asm-mips64/siginfo.h
Back to the patch index
Back to the overall index
- Lines: 61
- Date:
Wed Jul 4 11:50:39 2001
- Orig file:
v2.4.6/linux/include/asm-mips64/smp.h
- Orig date:
Fri Mar 2 11:30:15 2001
diff -u --recursive --new-file v2.4.6/linux/include/asm-mips64/smp.h linux/include/asm-mips64/smp.h
@@ -1,3 +1,12 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
+ * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
+ */
+
#ifndef __ASM_SMP_H
#define __ASM_SMP_H
@@ -38,12 +47,42 @@
extern int __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
-/* Good enough for toy^Wupto 64 CPU Origins. */
-extern unsigned long cpu_present_mask;
-#define cpu_online_map cpu_present_mask
-
#endif
#define NO_PROC_ID (-1)
-#endif __ASM_SMP_H
+#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)))
+
+#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 */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)