NetBSD/sys/arch/sun3/stand/libsa/promboot.c

76 lines
1.2 KiB
C
Raw Normal View History

1998-02-05 07:56:24 +03:00
/* $NetBSD: promboot.c,v 1.6 1998/02/05 04:57:13 gwr Exp $ */
1998-01-05 10:02:46 +03:00
1995-06-02 00:37:44 +04:00
#include <sys/param.h>
#include <sys/reboot.h>
#include <machine/mon.h>
#include "stand.h"
1998-02-05 07:56:24 +03:00
#include "libsa.h"
1995-06-02 00:37:44 +04:00
1998-02-05 07:56:24 +03:00
int debug = 0;
int prom_boothow;
char * prom_bootfile;
char prom_bootdev[32];
1995-06-02 00:37:44 +04:00
/*
* Get useful info from the PROM bootparams struct, i.e.:
* arg[0] = sd(0,0,0)netbsd
* arg[1] = -sa
*/
void
prom_get_boot_info()
{
1997-02-05 20:39:21 +03:00
struct bootparam *bp;
1995-06-02 00:37:44 +04:00
char c, *src, *dst;
#ifdef DEBUG
printf("prom_get_boot_info\n");
#endif
1997-02-05 20:39:21 +03:00
bp = *romVectorPtr->bootParam;
1995-06-02 00:37:44 +04:00
/* Get device and file names. */
1997-02-05 20:39:21 +03:00
src = bp->argPtr[0];
1995-06-02 00:37:44 +04:00
dst = prom_bootdev;
*dst++ = *src++;
*dst++ = *src++;
if (*src == '(') {
while (*src) {
c = *src++;
*dst++ = c;
if (c == ')')
break;
}
*dst = '\0';
}
prom_bootfile = src;
/* Get boothowto flags. */
1997-02-05 20:39:21 +03:00
src = bp->argPtr[1];
1995-06-02 00:37:44 +04:00
if (src && (*src == '-')) {
while (*src) {
switch (*src++) {
case 'a':
prom_boothow |= RB_ASKNAME;
break;
case 's':
prom_boothow |= RB_SINGLE;
break;
case 'd':
prom_boothow |= RB_KDB;
debug++;
1995-06-02 00:37:44 +04:00
break;
}
}
}
if (debug) {
printf("Debug level %d - enter c to continue...", debug);
/* This will print "\nAbort at ...\n" */
1998-02-05 07:56:24 +03:00
breakpoint();
}
1995-06-02 00:37:44 +04:00
}