Module Name:    src
Committed By:   matt
Date:           Sun Feb 28 23:46:18 UTC 2010

Modified Files:
        src/sys/arch/sbmips/sbmips [matt-nb5-mips64]: cpu.c machdep.c
Added Files:
        src/sys/arch/sbmips/conf [matt-nb5-mips64]: GENERIC.MP GENERIC64.MP

Log Message:
Add MP versions of GENERIC and GENERIC64 (untested).
Start adding the MP bits for sbmips.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/sbmips/conf/GENERIC.MP \
    src/sys/arch/sbmips/conf/GENERIC64.MP
cvs rdiff -u -r1.18.16.3 -r1.18.16.4 src/sys/arch/sbmips/sbmips/cpu.c
cvs rdiff -u -r1.38.10.6 -r1.38.10.7 src/sys/arch/sbmips/sbmips/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sbmips/sbmips/cpu.c
diff -u src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.3 src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.4
--- src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.3	Wed Jan 13 21:16:13 2010
+++ src/sys/arch/sbmips/sbmips/cpu.c	Sun Feb 28 23:46:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.18.16.3 2010/01/13 21:16:13 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.18.16.4 2010/02/28 23:46:18 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18.16.3 2010/01/13 21:16:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18.16.4 2010/02/28 23:46:18 matt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -83,26 +83,16 @@
 static void
 cpu_attach(device_t parent, device_t self, void *aux)
 {
-	struct cpu_info * const ci = curcpu();
+	struct cpu_info *ci;
 	const char * const xname = device_xname(self);
 	int plldiv;
 	uint32_t config;
 
-	/* XXX this code must run on the target CPU */
-	config = mips3_cp0_config_read();
-	config &= ~MIPS3_CONFIG_K0_MASK;
-	config |= 0x05;				/* XXX.  cacheable coherent */
-	mips3_cp0_config_write(config);
-
 	found++;
 
-	/*
-	 * Flush all of the caches, so that any lines marked non-coherent will
-	 * be flushed.  Don't need to worry about L2; it's always
-	 * coherent (XXX???).
-	 */
-	mips_icache_sync_all();
-	mips_dcache_wbinv_all();
+	/* XXX this code must run on the target CPU */
+	config = mips3_cp0_config_read();
+	KASSERT((config & MIPS3_CONFIG_K0_MASK) == 5);
 
 	/* Determine CPU frequency */
 
@@ -118,30 +108,36 @@
 		aprint_normal("%s", xname);
 	}
 
-	ci->ci_cpu_freq = 50000000 * plldiv;
-	/* Compute the delay divisor. */
-	ci->ci_divisor_delay = (ci->ci_cpu_freq + 500000) / 1000000;
-	/* Compute clock cycles per hz */
-	ci->ci_cycles_per_hz = (ci->ci_cpu_freq + hz / 2 ) / hz;
-
-	aprint_normal(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
-	    ci->ci_cpu_freq / 1000000,
-	    (ci->ci_cpu_freq % 1000000) / 10000,
-	    ci->ci_cycles_per_hz, ci->ci_divisor_delay);
-
-	/*
-	 * If we're the primary CPU, no more work to do; we're already
-	 * running!
-	 */
 	if (found == 1) {
+		ci = curcpu();
+		ci->ci_cpu_freq = 50000000 * plldiv;
+		/* Compute the delay divisor. */
+		ci->ci_divisor_delay = (ci->ci_cpu_freq + 500000) / 1000000;
+		/* Compute clock cycles per hz */
+		ci->ci_cycles_per_hz = (ci->ci_cpu_freq + hz / 2 ) / hz;
+
+		aprint_normal(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
+		    ci->ci_cpu_freq / 1000000,
+		    (ci->ci_cpu_freq % 1000000) / 10000,
+		    ci->ci_cycles_per_hz, ci->ci_divisor_delay);
+
+		/*
+		 * If we're the primary CPU, no more work to do; we're already
+		 * running!
+		 */
 		aprint_normal("%s: ", xname);
 		cpu_identify(self);
 	} else {
 #if defined(MULTIPROCESSOR)
-# error!
+		ci = cpu_info_alloc(NULL, found);
+		KASSERT(ci);
+		// * spinup
 #else
 		aprint_normal("%s: processor off-line; multiprocessor support "
 		    "not present in kernel\n", xname);
+		return;
 #endif
 	}
+
+	cpu_attach_common(self, ci);
 }

Index: src/sys/arch/sbmips/sbmips/machdep.c
diff -u src/sys/arch/sbmips/sbmips/machdep.c:1.38.10.6 src/sys/arch/sbmips/sbmips/machdep.c:1.38.10.7
--- src/sys/arch/sbmips/sbmips/machdep.c:1.38.10.6	Mon Feb  1 04:18:31 2010
+++ src/sys/arch/sbmips/sbmips/machdep.c	Sun Feb 28 23:46:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.38.10.6 2010/02/01 04:18:31 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.38.10.7 2010/02/28 23:46:18 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38.10.6 2010/02/01 04:18:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38.10.7 2010/02/28 23:46:18 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ddbparam.h"       /* for SYMTAB_SPACE */
@@ -344,6 +344,10 @@
 		Debugger();
 #endif
 	}
+
+#ifdef MULTIPROCESSOR
+	mips_fixup_exceptions(mips_fixup_zero_relative);
+#endif
 }
 
 /*
@@ -352,32 +356,10 @@
 void
 cpu_startup(void)
 {
-	vaddr_t minaddr, maxaddr;
-	char pbuf[9];
-
-	/*
-	 * Good {morning,afternoon,evening,night}.
-	 */
-	printf("%s%s", copyright, version);
-	format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
-	printf("total memory = %s\n", pbuf);
-
-	minaddr = 0;
-	/*
-	 * Allocate a submap for physio.
-	 */
-	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE,
-	    0, false, NULL);
-
-
 	/*
-	 * (No need to allocate an mbuf cluster submap.  Mbuf clusters
-	 * are allocated via the pool allocator, and we use KSEG to
-	 * map those pages.)
+	 * Just do the common stuff.
 	 */
-
-	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
-	printf("avail memory = %s\n", pbuf);
+	cpu_startup_common();
 }
 
 int	waittime = -1;
@@ -470,6 +452,8 @@
 {
 	int rv;
 
+	rv = 2;			/* Uncached. */
+
 	/* Check each DRAM region. */
 	if ((pa >= 0x0000000000   && pa <= 0x000fffffff) ||	/* DRAM 0 */
 	    (pa >= 0x0080000000   && pa <= 0x008fffffff) ||	/* DRAM 1 */
@@ -480,10 +464,7 @@
 #endif
 	   0) {
 		rv = 5;		/* Cacheable coherent. */
-		goto done;
 	}
 
-	rv = 2;			/* Uncached. */
-done:
 	return (rv);
 }

Added files:

Index: src/sys/arch/sbmips/conf/GENERIC.MP
diff -u /dev/null src/sys/arch/sbmips/conf/GENERIC.MP:1.1.2.1
--- /dev/null	Sun Feb 28 23:46:18 2010
+++ src/sys/arch/sbmips/conf/GENERIC.MP	Sun Feb 28 23:46:18 2010
@@ -0,0 +1,11 @@
+
+include "arch/sbmips/conf/GENERIC"
+
+options 	MULTIPROCESSOR
+options 	LOCKDEBUG
+
+pseudo-device	lockstat
+
+no options	SYMTAB_SPACE
+options		SYMTAB_SPACE=640000
+
Index: src/sys/arch/sbmips/conf/GENERIC64.MP
diff -u /dev/null src/sys/arch/sbmips/conf/GENERIC64.MP:1.1.2.1
--- /dev/null	Sun Feb 28 23:46:18 2010
+++ src/sys/arch/sbmips/conf/GENERIC64.MP	Sun Feb 28 23:46:18 2010
@@ -0,0 +1,11 @@
+
+include "arch/sbmips/conf/GENERIC64"
+
+options 	MULTIPROCESSOR
+options 	LOCKDEBUG
+
+pseudo-device	lockstat
+
+no options	SYMTAB_SPACE
+options		SYMTAB_SPACE=640000
+

Reply via email to