summaryrefslogtreecommitdiff
path: root/sys/arch/sun3/stand/libsa/promboot.c
blob: b8fa8100349e4b4ca92e067c53893f5af6ae0c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

#include <sys/param.h>
#include <sys/reboot.h>

#include <machine/mon.h>

#include "stand.h"
#include "promboot.h"

char prom_bootdev[32];
char *prom_bootfile;
int prom_boothow;
int debug = 0;

/*
 * Get useful info from the PROM bootparams struct, i.e.:
 * arg[0] = sd(0,0,0)bsd
 * arg[1] = -sa
 */

void
prom_get_boot_info()
{
	MachMonBootParam *bpp;
	char	c, *src, *dst;

#ifdef	DEBUG
	printf("prom_get_boot_info\n");
#endif

	bpp = *romp->bootParam;

	/* Get device and file names. */
	src = bpp->argPtr[0];
	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. */
	src = bpp->argPtr[1];
	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++;
				break;
			}
		}
	}

	if (debug) {
		printf("Debug level %d - enter c to continue...", debug);
		/* This will print "\nAbort at ...\n" */
		asm("	trap #0");
	}
}