summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Aoyama <aoyama@cvs.openbsd.org>2007-01-12 21:41:54 +0000
committerKenji Aoyama <aoyama@cvs.openbsd.org>2007-01-12 21:41:54 +0000
commitae4f44026a982e17a006294f4d27e8a16032364e (patch)
tree6a71a2ebd6fa94e8e70e4b2aacbf493c487f3072
parent00a9f5438e4f496ec6faed00cbb07ca97ddba9c1 (diff)
Change the secondary CMMU's data cache turn on so that do not hog the
bus while they spin, as same as 3.8. This have been missed since CMMU initialize cleanup. Also m88k_cpus[] should have 4 elements on luna88k, even in non-MULTIPROCESSOR kernel. ok miod@
-rw-r--r--sys/arch/luna88k/conf/GENERIC5
-rw-r--r--sys/arch/luna88k/luna88k/locore.S28
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c36
-rw-r--r--sys/arch/m88k/include/cpu.h4
4 files changed, 40 insertions, 33 deletions
diff --git a/sys/arch/luna88k/conf/GENERIC b/sys/arch/luna88k/conf/GENERIC
index 8fadfc286af..b7376f7b24b 100644
--- a/sys/arch/luna88k/conf/GENERIC
+++ b/sys/arch/luna88k/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.11 2005/09/06 19:21:55 miod Exp $
+# $OpenBSD: GENERIC,v 1.12 2007/01/12 21:41:53 aoyama Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -16,6 +16,9 @@ maxusers 64 # estimated number of users
# Processor type
option M88100 # 88100 support; mandatory
+# Number of maximum processors
+option MAX_CPUS=4 # may have up to 4 processors
+
# Define this if your processor has the xxx.usr bug (mask C82N)
option ERRATA__XXX_USR
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S
index 1922dce1cab..81a5477308a 100644
--- a/sys/arch/luna88k/luna88k/locore.S
+++ b/sys/arch/luna88k/luna88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.12 2006/05/15 21:40:04 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.13 2007/01/12 21:41:53 aoyama Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -169,7 +169,6 @@ ASLOCAL(main_start)
bcnd eq0, r2, 3b
br 1b /* looks clear -- try to grab */
4:
-#ifdef MULTIPROCESSOR
/* now try to grab the master_mpu prize */
FLUSH_PIPELINE
or.u r11, r0, hi16(_ASM_LABEL(master_mpu))
@@ -185,14 +184,6 @@ ASLOCAL(main_start)
* We'll do that when we're ready for another CPU to go.
*/
bcnd ne0, r22, _ASM_LABEL(secondary_init)
-#else
- /*
- * On non-MP kernels, the main processor will never release
- * cpu_mutex, thus secondary processors will spin trying to
- * acquire the lock, with interrupts disabled.
- */
-#endif
- /* fall through to main_init if that's appropriate */
/*
* Main processor specific initialization (with cpu_mutex held).
@@ -275,11 +266,11 @@ ASLOCAL(main_panic)
text
.align 8
-#ifdef MULTIPROCESSOR
/*
* Secondary processor specific initialization (with cpu_mutex held).
*/
ASLOCAL(secondary_init)
+#ifdef MULTIPROCESSOR
/*
* While holding the cpu_mutex, the secondary cpu can use the slavestack
* to call secondary_pre_main() to determine its cpu number.
@@ -315,18 +306,24 @@ ASLOCAL(secondary_init)
* be offered.
*/
br _ASM_LABEL(cpu_switch_search)
+#else
+
+ /*
+ * Just keep the processor chewing in silence.
+ */
+1: br 1b
+
+#endif /* MULTIPROCESSOR */
-GLOBAL(cpu_boot_secondary_processors)
/*
* Release the cpu_mutex; secondary processors will now have their
* chance to initialize.
*/
+GLOBAL(cpu_boot_secondary_processors)
or.u r2, r0, hi16(_ASM_LABEL(cpu_mutex))
jmp.n r1
st r0, r2, lo16(_ASM_LABEL(cpu_mutex))
-#endif /* MULTIPROCESSOR */
-
/*
* void delay(int count)
*
@@ -383,11 +380,10 @@ ASLOCAL(u0)
GLOBAL(proc0paddr)
word _ASM_LABEL(u0) /* KVA of proc0 uarea */
-#ifdef MULTIPROCESSOR
/* The first processor that XMEMs this becomes the master */
ASLOCAL(master_mpu)
word 0
-#endif
+
/* XMEM spin lock -- controls access to master_mpu */
ASLOCAL(cpu_mutex)
word 0
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index fd43ad9270f..f77aa0d8af4 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.35 2006/11/18 22:58:25 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.36 2007/01/12 21:41:53 aoyama Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -1073,6 +1073,8 @@ luna88k_bootstrap()
#endif
cpuid_t cpu;
extern void m8820x_initialize_cpu(cpuid_t);
+ extern void m8820x_set_sapr(cpuid_t, apr_t);
+ extern void cpu_boot_secondary_processors(void);
cmmu = &cmmu8820x;
@@ -1099,20 +1101,6 @@ luna88k_bootstrap()
m88100_apply_patches();
/*
- * On the luna88k, secondary processors are not disabled while the
- * kernel is initializing. We just initialized the CMMUs tied to the
- * currently-running CPU; initialize the others with similar settings
- * here as well.
- */
- for (cpu = 0; cpu < max_cpus; cpu++) {
- if (cpu == master_cpu)
- continue;
- if (m88k_cpus[cpu].ci_alive == 0)
- continue;
- m8820x_initialize_cpu(cpu);
- }
-
- /*
* Now that set_cpu_number() set us with a valid cpu_info pointer,
* we need to initialize p_addr and curpcb before autoconf, for the
* fault handler to behave properly [except for badaddr() faults,
@@ -1145,6 +1133,24 @@ luna88k_bootstrap()
/* Initialize the "u-area" pages. */
bzero((caddr_t)curpcb, USPACE);
+
+ /*
+ * On the luna88k, secondary processors are not disabled while the
+ * kernel is initializing. We just initialized the CMMUs tied to the
+ * currently-running CPU; initialize the others with similar settings
+ * as well, after calling pmap_bootstrap() above.
+ */
+ for (cpu = 0; cpu < max_cpus; cpu++) {
+ if (cpu == master_cpu)
+ continue;
+ if (m88k_cpus[cpu].ci_alive == 0)
+ continue;
+ m8820x_initialize_cpu(cpu);
+ cmmu_set_sapr(cpu, kernel_pmap->pm_apr);
+ }
+ /* Release the cpu_mutex */
+ cpu_boot_secondary_processors();
+
#ifdef DEBUG
printf("leaving luna88k_bootstrap()\n");
#endif
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 3b7e7d57b6f..08b797c5372 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.17 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.18 2007/01/12 21:41:53 aoyama Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -65,9 +65,11 @@
#define MAX_CPUS 4
#endif
#else
+#if !defined(MAX_CPUS)
#undef MAX_CPUS
#define MAX_CPUS 1
#endif
+#endif
#ifndef _LOCORE