Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 1998 18:36:05 -0500 (EST)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Mike Smith <mike@smith.net.au>
Cc:        freebsd-alpha@FreeBSD.ORG
Subject:   Re: another small observation 
Message-ID:  <13896.52405.267251.355470@grasshopper.cs.duke.edu>
In-Reply-To: <199811102223.OAA00993@dingo.cdrom.com>
References:  <13896.47289.309597.453451@grasshopper.cs.duke.edu> <199811102223.OAA00993@dingo.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Mike Smith writes:
 > No.  The Alpha should register an at_shutdown hook which checks for 
 > RB_HALT and calls the appropriate halt routine.  cpu_halt() should also 
 > die.

Sorry.. I didn't know at_shutdown() even existed.  How's the following?

Index: /sys/alpha/alpha/machdep.c
===================================================================
RCS file: /scratch/freebsd-cvs/src/sys/alpha/alpha/machdep.c,v
retrieving revision 1.20
diff -u -r1.20 machdep.c
--- machdep.c	1998/11/02 00:14:50	1.20
+++ machdep.c	1998/11/10 23:29:28
@@ -132,6 +132,7 @@
 #include <machine/chipset.h>
 #include <machine/vmparam.h>
 #include <machine/elf.h>
+#include <machine/cons.h>
 #include <ddb/ddb.h>
 #include <alpha/alpha/db_instruction.h>
 #include <sys/vnode.h>
@@ -212,6 +213,32 @@
 #define offsetof(type, member)	((size_t)(&((type *)0)->member))
 
 static void
+alpha_srm_shutdown(int howto, void* arg2)
+{
+	if(howto & RB_HALT) {
+		printf("\n");
+		printf("The operating system has halted.\n");
+		printf("Please press 's' to drop into the SRM console, "
+		       "or any other key to reboot.\n\n");
+		switch (cngetc()) {
+		case 's' :
+		case 'S' :	
+			printf("returning to the SRM console...\n");	
+		case -1:		/* No console, just die */
+			alpha_pal_halt();
+			/* NOTREACHED */
+		default:
+			/*  
+			 *  this doesn't actually do anything -- it
+			 *  would be nice if howto was passed by reference
+			 */
+			howto &= ~RB_HALT;
+			break;
+		}
+	}
+}
+
+static void
 cpu_startup(dummy)
 	void *dummy;
 {
@@ -394,6 +421,7 @@
 	 */
 	bufinit();
 	vm_pager_bufferinit();
+	at_shutdown_pri(alpha_srm_shutdown, 0, SHUTDOWN_FINAL, SHUTDOWN_PRI_LAST);
 
 }
 



BTW - it would be nice if howto was passed in by reference.  The way
it stands now, you'll see some silliness like this if you decide you
really want to just reboot:


	syncing disks... 5 4 done
	
	The operating system has halted.
	Please press 's' to drop into the SRM console, or any other key to reboot
<press any key but S or s>	
	
	The operating system has halted.
	Please press any key to reboot.
	
	Rebooting...


Drew
------------------------------------------------------------------------------
Andrew Gallatin, Sr Systems Programmer	http://www.cs.duke.edu/~gallatin
Duke University				Email: gallatin@cs.duke.edu
Department of Computer Science		Phone: (919) 660-6590

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message



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