CVS commit: src/sys/arch/evbmips/rmixl

2015-06-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun 10 22:33:06 UTC 2015

Modified Files:
src/sys/arch/evbmips/rmixl: autoconf.c

Log Message:
Match sd and ld in addition to wd.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbmips/rmixl/autoconf.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/evbmips/rmixl/autoconf.c
diff -u src/sys/arch/evbmips/rmixl/autoconf.c:1.7 src/sys/arch/evbmips/rmixl/autoconf.c:1.8
--- src/sys/arch/evbmips/rmixl/autoconf.c:1.7	Sat Oct 27 17:17:51 2012
+++ src/sys/arch/evbmips/rmixl/autoconf.c	Wed Jun 10 22:33:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.7 2012/10/27 17:17:51 chs Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.8 2015/06/10 22:33:06 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.7 2012/10/27 17:17:51 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.8 2015/06/10 22:33:06 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -83,17 +83,19 @@ extern int	netboot;
 static void
 findroot(void)
 {
-	device_t dv;
-	deviter_t di;
-
 	if (booted_device)
 		return;
 
 	if ((booted_device == NULL)  netboot == 0) {
+		device_t dv;
+		deviter_t di;
+
 		for (dv = deviter_first(di, DEVITER_F_ROOT_FIRST); dv != NULL;
 		dv = deviter_next(di)) {
-			if (device_class(dv) == DV_DISK 
-			device_is_a(dv, wd))
+			if (device_class(dv) == DV_DISK
+			 (device_is_a(dv, wd)
+|| device_is_a(dv, sd)
+|| device_is_a(dv, ld)))
 booted_device = dv;
 		}
 		deviter_release(di);



CVS commit: src/sys/arch/evbmips/rmixl

2015-06-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun 10 22:32:32 UTC 2015

Modified Files:
src/sys/arch/evbmips/rmixl: machdep.c

Log Message:
Avoid using curpcb (use lwp_getpcb(curlwp)) instead.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbmips/rmixl/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/evbmips/rmixl/machdep.c
diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.15 src/sys/arch/evbmips/rmixl/machdep.c:1.16
--- src/sys/arch/evbmips/rmixl/machdep.c:1.15	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/evbmips/rmixl/machdep.c	Wed Jun 10 22:32:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.15 2015/06/01 22:55:12 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.16 2015/06/10 22:32:32 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.15 2015/06/01 22:55:12 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.16 2015/06/10 22:32:32 matt Exp $);
 
 #define __INTR_PRIVATE
 
@@ -1018,7 +1018,7 @@ cpu_reboot(int howto, char *bootstr)
 {
 
 	/* Take a snapshot before clobbering any registers. */
-	savectx(curpcb);
+	savectx(lwp_getpcb(curlwp));
 
 	if (cold) {
 		howto |= RB_HALT;



CVS commit: src/sys/arch/evbmips/rmixl

2012-03-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Mar  3 00:20:34 UTC 2012

Modified Files:
src/sys/arch/evbmips/rmixl: machdep.c

Log Message:
Remove redundant common declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbmips/rmixl/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/evbmips/rmixl/machdep.c
diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.12 src/sys/arch/evbmips/rmixl/machdep.c:1.13
--- src/sys/arch/evbmips/rmixl/machdep.c:1.12	Fri Mar  2 16:20:55 2012
+++ src/sys/arch/evbmips/rmixl/machdep.c	Sat Mar  3 00:20:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.12 2012/03/02 16:20:55 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.13 2012/03/03 00:20:33 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.12 2012/03/02 16:20:55 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.13 2012/03/03 00:20:33 matt Exp $);
 
 #define __INTR_PRIVATE
 
@@ -197,9 +197,6 @@ static u_long rmixl_physaddr_storage[
 /* For sysctl_hw. */
 extern char cpu_model[];
 
-/* Our exported CPU info; we can have only one. */  
-struct cpu_info cpu_info_store;
-
 /* Maps for VM objects. */
 struct vm_map *phys_map = NULL;
 



CVS commit: src/sys/arch/evbmips/rmixl

2011-04-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Apr 11 23:12:41 UTC 2011

Modified Files:
src/sys/arch/evbmips/rmixl: machdep.c

Log Message:
Add code to fixup the text segment to replace loads
from L_CPU(MIPS_CURLWP) or curlwp-l_cpu with
loads from COP0 register OSSCRATCH.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbmips/rmixl/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/evbmips/rmixl/machdep.c
diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.7 src/sys/arch/evbmips/rmixl/machdep.c:1.8
--- src/sys/arch/evbmips/rmixl/machdep.c:1.7	Sun Feb 20 07:48:35 2011
+++ src/sys/arch/evbmips/rmixl/machdep.c	Mon Apr 11 23:12:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2011/02/20 07:48:35 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.8 2011/04/11 23:12:41 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.7 2011/02/20 07:48:35 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.8 2011/04/11 23:12:41 matt Exp $);
 
 #define __INTR_PRIVATE
 
@@ -108,12 +108,14 @@
 #include ksyms.h
 
 #if NKSYMS || defined(DDB) || defined(LKM)
-#include machine/db_machdep.h
+#include mips/db_machdep.h
 #include ddb/db_extern.h
 #endif
 
-#include machine/cpu.h
-#include machine/psl.h
+#include mips/cpu.h
+#include mips/psl.h
+#include mips/cache.h
+#include mips/mips_opcode.h
 
 #include com.h
 #if NCOM == 0
@@ -228,6 +230,7 @@
 static void rmixl_wakeup_info_print(volatile rmixlfw_cpu_wakeup_info_t *);
 #endif	/* MACHDEP_DEBUG */
 #endif	/* MULTIPROCESSOR */
+static void rmixl_fixup_curcpu(void);
 
 /*
  * Do all the stuff that locore normally does before calling main().
@@ -414,6 +417,7 @@
 		:: r(cpu_info_store), n(MIPS_COP_0_OSSCRATCH));
 	mips_fixup_exceptions(rmixl_fixup_cop0_oscratch);
 #endif
+	rmixl_fixup_curcpu();
 }
 
 /*
@@ -483,6 +487,43 @@
 #endif /* MULTIPROCESSOR */
 
 /*
+ * The following changes all	lX	rN, L_CPU(MIPS_CURLWP) [curlwp-l_cpu]
+ * to			 	[d]mfc0	rN, $22 [MIPS_COP_0_OSSCRATCH]
+ *
+ * the mfc0 is 3 cycles shorter than the load.
+ */
+#define	LOAD_CURCPU_0	((MIPS_CURLWP_REG  21) | offsetof(lwp_t, l_cpu))
+#define	MFC0_CURCPU_0	((OP_COP0  26) | (MIPS_COP_0_OSSCRATCH  11))
+#ifdef _LP64
+#define	LOAD_CURCPU	((uint32_t)(OP_LD  26) | LOAD_CURCPU_0)
+#define	MFC0_CURCPU	((uint32_t)(OP_DMF  21) | MFC0_CURCPU_0)
+#else
+#define	LOAD_CURCPU	((uint32_t)(OP_LW  26) | LOAD_CURCPU_0)
+#define	MFC0_CURCPU	((uint32_t)(OP_MF  21) | MFC0_CURCPU_0)
+#endif
+#define	LOAD_CURCPU_MASK	0xffe0
+
+static void
+rmixl_fixup_curcpu(void)
+{
+	extern uint32_t _ftext[];
+	extern uint32_t _etext[];
+
+	for (uint32_t *insnp = _ftext; insnp  _etext; insnp++) {
+		const uint32_t insn = *insnp;
+		if (__predict_false((insn  LOAD_CURCPU_MASK) == LOAD_CURCPU)) {
+			/*
+			 * Since the register to loaded is located in bits
+			 * 16-20 for the mfc0 and the load instruction we can
+			 * just change the instruction bits around it.
+			 */
+			*insnp = insn ^ LOAD_CURCPU ^ MFC0_CURCPU;
+			mips_icache_sync_range((vaddr_t)insnp, 4);
+		}
+	}
+}
+
+/*
  * ram_seg_resv - cut reserved regions out of segs, fragmenting as needed
  *
  * we simply build a new table of segs, then copy it back over the given one



CVS commit: src/sys/arch/evbmips/rmixl

2011-04-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 12 00:21:11 UTC 2011

Modified Files:
src/sys/arch/evbmips/rmixl: machdep.c

Log Message:
Make sure we init MIPS COP0 OSSCRATCH for UP as well as for MP.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/rmixl/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/evbmips/rmixl/machdep.c
diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.8 src/sys/arch/evbmips/rmixl/machdep.c:1.9
--- src/sys/arch/evbmips/rmixl/machdep.c:1.8	Mon Apr 11 23:12:41 2011
+++ src/sys/arch/evbmips/rmixl/machdep.c	Tue Apr 12 00:21:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.8 2011/04/11 23:12:41 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.9 2011/04/12 00:21:10 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.8 2011/04/11 23:12:41 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.9 2011/04/12 00:21:10 matt Exp $);
 
 #define __INTR_PRIVATE
 
@@ -408,13 +408,13 @@
 	if (boothowto  RB_KDB)
 		Debugger();
 #endif
-#ifdef MULTIPROCESSOR
 	/*
 	 * store (cpu#0) curcpu in COP0 OSSCRATCH0
 	 * used in exception vector
 	 */
 	__asm __volatile(dmtc0 %0,$%1
 		:: r(cpu_info_store), n(MIPS_COP_0_OSSCRATCH));
+#ifdef MULTIPROCESSOR
 	mips_fixup_exceptions(rmixl_fixup_cop0_oscratch);
 #endif
 	rmixl_fixup_curcpu();



CVS commit: src/sys/arch/evbmips/rmixl

2009-12-19 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 20 04:11:37 UTC 2009

Modified Files:
src/sys/arch/evbmips/rmixl: autoconf.c machdep.c

Log Message:
Fix few problems in evbmips/rmixl:
- mach_init: use mips_init_lwp0_uarea(), do not hardcode it.  Do not call
  ksyms_init(), it's called in MI.  Also, avoid struct user in few places.
- findroot: use deviter interface.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/rmixl/autoconf.c \
src/sys/arch/evbmips/rmixl/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/evbmips/rmixl/autoconf.c
diff -u src/sys/arch/evbmips/rmixl/autoconf.c:1.2 src/sys/arch/evbmips/rmixl/autoconf.c:1.3
--- src/sys/arch/evbmips/rmixl/autoconf.c:1.2	Mon Dec 14 00:46:02 2009
+++ src/sys/arch/evbmips/rmixl/autoconf.c	Sun Dec 20 04:11:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2 2009/12/14 00:46:02 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.3 2009/12/20 04:11:37 rmind Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.2 2009/12/14 00:46:02 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.3 2009/12/20 04:11:37 rmind Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -83,31 +83,31 @@
 static void
 findroot(void)
 {
-	struct device *dv;
+	device_t dv;
+	deviter_t di;
 
 	if (booted_device)
 		return;
 
-	if ((booted_device == NULL)  netboot == 0)
-		for (dv = TAILQ_FIRST(alldevs); dv != NULL;
-		 dv = TAILQ_NEXT(dv, dv_list))
+	if ((booted_device == NULL)  netboot == 0) {
+		for (dv = deviter_first(di, DEVITER_F_ROOT_FIRST); dv != NULL;
+		dv = deviter_next(di)) {
 			if (device_class(dv) == DV_DISK 
 			device_is_a(dv, wd))
-booted_device = dv;
-
+booted_device = dv;
+		}
+		deviter_release(di);
+	}
 	/*
 	 * XXX Match up MBR boot specification with BSD disklabel for root?
 	 */
 	booted_partition = 0;
-
-	return;
 }
 
 void
-device_register(dev, aux)
-	struct device *dev;
-	void *aux;
+device_register(struct device *dev, void *aux)
 {
+
 	if ((booted_device == NULL)  (netboot == 1))
 		if (device_class(dev) == DV_IFNET)
 			booted_device = dev;
Index: src/sys/arch/evbmips/rmixl/machdep.c
diff -u src/sys/arch/evbmips/rmixl/machdep.c:1.2 src/sys/arch/evbmips/rmixl/machdep.c:1.3
--- src/sys/arch/evbmips/rmixl/machdep.c:1.2	Mon Dec 14 00:46:03 2009
+++ src/sys/arch/evbmips/rmixl/machdep.c	Sun Dec 20 04:11:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.2 2009/12/14 00:46:03 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.3 2009/12/20 04:11:37 rmind Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.2 2009/12/14 00:46:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.3 2009/12/20 04:11:37 rmind Exp $);
 
 #include opt_ddb.h
 #include opt_com.h
@@ -124,7 +124,6 @@
 #include sys/kernel.h
 #include sys/buf.h
 #include sys/reboot.h
-#include sys/user.h
 #include sys/mount.h
 #include sys/kcore.h
 #include sys/boot_flag.h
@@ -268,7 +267,7 @@
 mach_init(int argc, int32_t *argv, void *envp, int64_t infop)
 {
 	struct rmixl_config *rcp = rmixl_configuration;
-	void *kernend, *v;
+	void *kernend;
 	u_long memsize;
 	u_int vm_cluster_cnt;
 	uint32_t r;
@@ -402,27 +401,9 @@
 	pmap_bootstrap();
 
 	/*
-	 * Allocate space for proc0's USPACE.
+	 * Allocate uarea page for lwp0 and set it.
 	 */
-	v = (void *)uvm_pageboot_alloc(USPACE); 
-	lwp0.l_addr = proc0paddr = (struct user *)v;
-	lwp0.l_md.md_regs = (struct frame *)((char *)v + USPACE) - 1;
-#ifdef _LP64
-lwp0.l_md.md_regs-f_regs[_R_SR] = MIPS_SR_KX;
-#endif
-proc0paddr-u_pcb.pcb_context.val[_L_SR] =
-#ifdef _LP64
-MIPS_SR_KX |
-#endif  
-MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
-
-
-	/*
-	 * Initialize debuggers, and break into them, if appropriate.
-	 */
-#if NKSYMS || defined(DDB) || defined(LKM)
-	ksyms_init(0, 0, 0);
-#endif
+	mips_init_lwp0_uarea();
 
 #if defined(DDB)
 	if (boothowto  RB_KDB)
@@ -844,14 +825,12 @@
 int	waittime = -1;
 
 void
-cpu_reboot(howto, bootstr)
-	int howto;
-	char *bootstr;
+cpu_reboot(int howto, char *bootstr)
 {
 
 	/* Take a snapshot before clobbering any registers. */
 	if (curproc)
-		savectx((struct user *)curpcb);
+		savectx(curpcb);
 
 	if (cold) {
 		howto |= RB_HALT;