summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/include
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-04-01 12:30:39 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-04-01 12:30:39 +0000
commite85b5e73777f1d7a0a7df6a87e0aa4b74a73f81e (patch)
treeb0b0b43fb063764200a09d5ba400a55c6d757bb3 /sys/arch/hppa/include
parent60c4f7d793c56bb8e10434a6b79e87ddc1bb60a5 (diff)
Allow for multiple CPUs by moving to an array of cpu_info.
ok kettenis@
Diffstat (limited to 'sys/arch/hppa/include')
-rw-r--r--sys/arch/hppa/include/cpu.h42
1 files changed, 32 insertions, 10 deletions
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index c853e9dd93b..09d8a862d07 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.64 2010/03/28 16:26:47 jsing Exp $ */
+/* $OpenBSD: cpu.h,v 1.65 2010/04/01 12:30:38 jsing Exp $ */
/*
* Copyright (c) 2000-2004 Michael Shalayeff
@@ -64,10 +64,15 @@
#ifndef _LOCORE
#ifdef _KERNEL
+#include <sys/device.h>
#include <sys/queue.h>
#include <sys/sched.h>
struct cpu_info {
+ struct device *ci_dev;
+ int ci_cpuid;
+ hppa_hpa_t ci_hpa;
+
struct proc *ci_curproc;
volatile int ci_cpl;
@@ -78,17 +83,34 @@ struct cpu_info {
u_int32_t ci_randseed;
};
-extern struct cpu_info cpu_info_primary;
+#ifdef MULTIPROCESSOR
+#define HPPA_MAXCPUS 1
+#else
+#define HPPA_MAXCPUS 4
+#endif
+
+extern struct cpu_info cpu_info[HPPA_MAXCPUS];
+
+#define MAXCPUS HPPA_MAXCPUS
+
+static __inline struct cpu_info *
+curcpu(void)
+{
+ struct cpu_info *ci;
+
+ asm volatile ("mfctl %%cr29, %0" : "=r"(ci));
+
+ return ci;
+}
+
+#define cpu_number() (curcpu()->ci_cpuid)
-#define curcpu() (&cpu_info_primary)
+#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0)
+#define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0)
+#define CPU_INFO_ITERATOR int
+#define CPU_INFO_FOREACH(cii, ci) \
+ for (cii = 0, ci = &cpu_info[0]; cii < ncpus; cii++, ci++)
-#define CPU_IS_PRIMARY(ci) 1
-#define CPU_INFO_ITERATOR int
-#define CPU_INFO_FOREACH(cii, ci) \
- for (cii = 0, ci = curcpu(); ci != NULL; ci = NULL)
-#define CPU_INFO_UNIT(ci) 0
-#define MAXCPUS 1
-#define cpu_number() 0
#define cpu_unidle(ci)
/* types */