1 /* $NetBSD: promboot.c,v 1.2 2002/05/15 04:07:43 lukem 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 #ifdef DEBUG 13 int debug = 0; 14 #endif /* DEBUG */ 15 int prom_boothow; 16 char * prom_bootfile; 17 char prom_bootdev[32]; 18 19 /* 20 * Get useful info from the PROM bootparams struct, i.e.: 21 * arg[0] = sd(0,0,0)netbsd 22 * arg[1] = -sa 23 */ 24 25 void 26 prom_get_boot_info() 27 { 28 struct bootparam *bp; 29 char c, *src, *dst; 30 31 #ifdef DEBUG 32 printf("prom_get_boot_info\n"); 33 #endif 34 35 bp = *romVectorPtr->bootParam; 36 37 /* Get device and file names. */ 38 src = bp->argPtr[0]; 39 dst = prom_bootdev; 40 *dst++ = *src++; 41 *dst++ = *src++; 42 if (*src == '(') { 43 while (*src) { 44 c = *src++; 45 *dst++ = c; 46 if (c == ')') 47 break; 48 } 49 *dst = '\0'; 50 } 51 prom_bootfile = src; 52 53 /* Get boothowto flags. */ 54 src = bp->argPtr[1]; 55 if (src && (*src == '-')) { 56 while (*src) { 57 switch (*src++) { 58 case 'a': 59 prom_boothow |= RB_ASKNAME; 60 break; 61 case 's': 62 prom_boothow |= RB_SINGLE; 63 break; 64 case 'd': 65 prom_boothow |= RB_KDB; 66 #ifdef DEBUG 67 debug++; 68 #endif /* DEBUG */ 69 break; 70 } 71 } 72 } 73 74 #ifdef DEBUG 75 if (debug) { 76 printf("Debug level %d - enter c to continue...", debug); 77 /* This will print "\nAbort at ...\n" */ 78 breakpoint(); 79 } 80 #endif /* DEBUG */ 81 } 82