Home | History | Annotate | Line # | Download | only in libsa
promboot.c revision 1.1
      1 /*	$NetBSD: promboot.c,v 1.1 2001/06/14 12:57:15 fredette Exp $	*/
      2 
      3 
      4 #include <sys/param.h>
      5 #include <sys/reboot.h>
      6 
      7 #include <machine/mon.h>
      8 
      9 #include "stand.h"
     10 #include "libsa.h"
     11 
     12 int 	debug = 0;
     13 int 	prom_boothow;
     14 char *	prom_bootfile;
     15 char	prom_bootdev[32];
     16 
     17 /*
     18  * Get useful info from the PROM bootparams struct, i.e.:
     19  * arg[0] = sd(0,0,0)netbsd
     20  * arg[1] = -sa
     21  */
     22 
     23 void
     24 prom_get_boot_info()
     25 {
     26 	struct bootparam *bp;
     27 	char	c, *src, *dst;
     28 
     29 #ifdef	DEBUG
     30 	printf("prom_get_boot_info\n");
     31 #endif
     32 
     33 	bp = *romVectorPtr->bootParam;
     34 
     35 	/* Get device and file names. */
     36 	src = bp->argPtr[0];
     37 	dst = prom_bootdev;
     38 	*dst++ = *src++;
     39 	*dst++ = *src++;
     40 	if (*src == '(') {
     41 		while (*src) {
     42 			c = *src++;
     43 			*dst++ = c;
     44 			if (c == ')')
     45 				break;
     46 		}
     47 		*dst = '\0';
     48 	}
     49 	prom_bootfile = src;
     50 
     51 	/* Get boothowto flags. */
     52 	src = bp->argPtr[1];
     53 	if (src && (*src == '-')) {
     54 		while (*src) {
     55 			switch (*src++) {
     56 			case 'a':
     57 				prom_boothow |= RB_ASKNAME;
     58 				break;
     59 			case 's':
     60 				prom_boothow |= RB_SINGLE;
     61 				break;
     62 			case 'd':
     63 				prom_boothow |= RB_KDB;
     64 				debug++;
     65 				break;
     66 			}
     67 		}
     68 	}
     69 
     70 	if (debug) {
     71 		printf("Debug level %d - enter c to continue...", debug);
     72 		/* This will print "\nAbort at ...\n" */
     73 		breakpoint();
     74 	}
     75 }
     76