summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1995-04-26 07:38:35 +0000
committerrgrimes <rgrimes@FreeBSD.org>1995-04-26 07:38:35 +0000
commitc44d8d839255674d88dd0ff7f8864f9ff1de16e3 (patch)
tree24df10a4538485fad6b9c892a48e103c8c1fb9a2
parentb90c96a965d72f8bb4acca3f366bfb2e6f6241d2 (diff)
downloadFreeBSD-src-c44d8d839255674d88dd0ff7f8864f9ff1de16e3.zip
FreeBSD-src-c44d8d839255674d88dd0ff7f8864f9ff1de16e3.tar.gz
Add outb to keyboard controller to do a cpu_reset, this fixes 2 known
cases of motherboards that failed to reboot.
-rw-r--r--sys/amd64/amd64/vm_machdep.c15
-rw-r--r--sys/i386/i386/vm_machdep.c15
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 8c3c70a..e150688 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.34 1995/03/16 18:11:33 bde Exp $
+ * $Id: vm_machdep.c,v 1.35 1995/03/19 14:28:41 davidg Exp $
*/
#include "npx.h"
@@ -50,12 +50,15 @@
#include <sys/vnode.h>
#include <sys/user.h>
+#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/md_var.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
+#include <i386/isa/isa.h>
+
#ifdef BOUNCE_BUFFERS
vm_map_t io_map;
volatile int kvasfreecnt;
@@ -804,6 +807,16 @@ vunmapbuf(bp)
void
cpu_reset() {
+ /*
+ * Attempt to do a CPU reset via the keyboard controller,
+ * do not turn of the GateA20, as any machine that fails
+ * to do the reset here would then end up in no man's land.
+ */
+ outb(IO_KBD + 4, 0xFE);
+ DELAY(500000); /* wait 0.5 sec to see if that did it */
+ printf("Keyboard reset did not work, attempting CPU shutdown\n");
+ DELAY(1000000); /* wait 1 sec for printf to complete */
+
/* force a shutdown by unmapping entire address space ! */
bzero((caddr_t) PTD, NBPG);
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 8c3c70a..e150688 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.34 1995/03/16 18:11:33 bde Exp $
+ * $Id: vm_machdep.c,v 1.35 1995/03/19 14:28:41 davidg Exp $
*/
#include "npx.h"
@@ -50,12 +50,15 @@
#include <sys/vnode.h>
#include <sys/user.h>
+#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/md_var.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
+#include <i386/isa/isa.h>
+
#ifdef BOUNCE_BUFFERS
vm_map_t io_map;
volatile int kvasfreecnt;
@@ -804,6 +807,16 @@ vunmapbuf(bp)
void
cpu_reset() {
+ /*
+ * Attempt to do a CPU reset via the keyboard controller,
+ * do not turn of the GateA20, as any machine that fails
+ * to do the reset here would then end up in no man's land.
+ */
+ outb(IO_KBD + 4, 0xFE);
+ DELAY(500000); /* wait 0.5 sec to see if that did it */
+ printf("Keyboard reset did not work, attempting CPU shutdown\n");
+ DELAY(1000000); /* wait 1 sec for printf to complete */
+
/* force a shutdown by unmapping entire address space ! */
bzero((caddr_t) PTD, NBPG);
OpenPOWER on IntegriCloud