Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 1998 15:48:50 -0800
From:      Mike Smith <mike@smith.net.au>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        freebsd-alpha@FreeBSD.ORG
Subject:   Re: another small observation 
Message-ID:  <199811102348.PAA01499@dingo.cdrom.com>
In-Reply-To: Your message of "Tue, 10 Nov 1998 18:36:05 EST." <13896.52405.267251.355470@grasshopper.cs.duke.edu> 

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?

Looks about right, although I wouldn't even bother with the 's' option 
- expected behaviour is that 'halt' will drop you back to SRM, and I 
have no problems with that.  If you've tested this, then I'll commit a 
simplified version straight away.

> 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

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



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?199811102348.PAA01499>