Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 20:32:07 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r202830 - in head/sys/mips: include mips
Message-ID:  <201001222032.o0MKW79x077742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Jan 22 20:32:07 2010
New Revision: 202830
URL: http://svn.freebsd.org/changeset/base/202830

Log:
  Create a method of last resort for rebooting the mips processor: jump
  to the reset vector.  This works for many SoCs where other reset
  hardware is either missing or unknown.

Modified:
  head/sys/mips/include/md_var.h
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/include/md_var.h
==============================================================================
--- head/sys/mips/include/md_var.h	Fri Jan 22 20:30:54 2010	(r202829)
+++ head/sys/mips/include/md_var.h	Fri Jan 22 20:32:07 2010	(r202830)
@@ -52,6 +52,7 @@ uintptr_t MipsEmulateBranch(struct trapf
 void MipsSwitchFPState(struct thread *, struct trapframe *);
 u_long	kvtop(void *addr);
 int	is_physical_memory(vm_offset_t addr);
+void	mips_generic_reset(void);
 
 #define	is_cacheable_mem(pa)	is_physical_memory((pa))
 

Modified: head/sys/mips/mips/machdep.c
==============================================================================
--- head/sys/mips/mips/machdep.c	Fri Jan 22 20:30:54 2010	(r202829)
+++ head/sys/mips/mips/machdep.c	Fri Jan 22 20:32:07 2010	(r202830)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/cache.h>
 #include <machine/clock.h>
 #include <machine/cpu.h>
+#include <machine/cpuregs.h>
 #include <machine/hwfunc.h>
 #include <machine/intr_machdep.h>
 #include <machine/md_var.h>
@@ -359,6 +360,17 @@ mips_vector_init(void)
 }
 
 /*
+ * Many SoCs have a means to reset the core itself.  Others do not, or
+ * the method is unknown to us.  For those cases, we jump to the mips
+ * reset vector and hope for the best.  This works well in practice.
+ */
+void
+mips_generic_reset()
+{
+	((void(*)(void))(intptr_t)MIPS_VEC_RESET)();
+}
+
+/*
  * Initialise a struct pcpu.
  */
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001222032.o0MKW79x077742>