Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint/stand/netboot Implemented support for boo...
details: https://anonhg.NetBSD.org/src/rev/eea03a0f14eb
branches: trunk
changeset: 755002:eea03a0f14eb
user: phx <phx%NetBSD.org@localhost>
date: Wed May 19 15:05:58 2010 +0000
description:
Implemented support for boot arguments.
diffstat:
sys/arch/sandpoint/stand/netboot/Makefile | 3 +-
sys/arch/sandpoint/stand/netboot/entry.S | 6 +++-
sys/arch/sandpoint/stand/netboot/main.c | 42 +++++++++++++++++++++++++-----
3 files changed, 40 insertions(+), 11 deletions(-)
diffs (128 lines):
diff -r f4c7cafa30c2 -r eea03a0f14eb sys/arch/sandpoint/stand/netboot/Makefile
--- a/sys/arch/sandpoint/stand/netboot/Makefile Wed May 19 15:04:51 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/Makefile Wed May 19 15:05:58 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2010/05/17 17:50:08 phx Exp $
+# $NetBSD: Makefile,v 1.18 2010/05/19 15:05:58 phx Exp $
S= ${.CURDIR}/../../../..
@@ -11,7 +11,6 @@
CPPFLAGS+= -D_STANDALONE -DSUPPORT_DHCP
#CPPFLAGS+= -DCONSNAME=\"com\" -DCONSPORT=0x3f8 -DCONSSPEED=115200
#CPPFLAGS+= -DCONSNAME=\"eumb\" -DCONSPORT=0x4600 -DCONSSPEED=57600
-#CPPFLAGS+= -DSTART_DDB_SESSION
CPPFLAGS+= -nostdinc -I. -I${.OBJDIR} -I${S}
DBG= -Os
diff -r f4c7cafa30c2 -r eea03a0f14eb sys/arch/sandpoint/stand/netboot/entry.S
--- a/sys/arch/sandpoint/stand/netboot/entry.S Wed May 19 15:04:51 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/entry.S Wed May 19 15:05:58 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: entry.S,v 1.6 2010/05/13 10:40:02 phx Exp $ */
+/* $NetBSD: entry.S,v 1.7 2010/05/19 15:05:58 phx Exp $ */
#include <powerpc/psl.h>
#include <powerpc/spr.h>
@@ -9,6 +9,8 @@
.text
.globl _start
_start:
+ mr 30,3
+ mr 31,4
mfspr 11,SPR_HID0
andi. 0,11,HID0_DCE
ori 11,11,HID0_ICE
@@ -89,6 +91,8 @@
addi 1,1,-4
bl brdsetup
+ mr 3,30
+ mr 4,31
bl main
hang: b hang
diff -r f4c7cafa30c2 -r eea03a0f14eb sys/arch/sandpoint/stand/netboot/main.c
--- a/sys/arch/sandpoint/stand/netboot/main.c Wed May 19 15:04:51 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/main.c Wed May 19 15:05:58 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.30 2010/05/18 15:07:50 phx Exp $ */
+/* $NetBSD: main.c,v 1.31 2010/05/19 15:05:58 phx Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,6 +40,23 @@
#include "globals.h"
+static const struct bootarg {
+ const char *name;
+ int value;
+} bootargs[] = {
+ { "multi", RB_AUTOBOOT },
+ { "auto", RB_AUTOBOOT },
+ { "ask", RB_ASKNAME },
+ { "single", RB_SINGLE },
+ { "ddb", RB_KDB },
+ { "userconf", RB_USERCONF },
+ { "norm", AB_NORMAL },
+ { "quiet", AB_QUIET },
+ { "verb", AB_VERBOSE },
+ { "silent", AB_SILENT },
+ { "debug", AB_DEBUG }
+};
+
void *bootinfo; /* low memory reserved to pass bootinfo structures */
int bi_size; /* BOOTINFO_MAXSIZE */
char *bi_next;
@@ -48,7 +65,7 @@
char rootdev[4]; /* NIF nickname, filled by netif_init() */
uint8_t en[6]; /* NIC macaddr, fill by netif_init() */
-void main(void);
+void main(int, char **);
void bi_init(void *);
void bi_add(void *, int, int);
@@ -62,7 +79,7 @@
uint32_t busclock, cpuclock;
void
-main(void)
+main(int argc, char *argv[])
{
struct btinfo_memory bi_mem;
struct btinfo_console bi_cons;
@@ -73,7 +90,7 @@
unsigned long marks[MARK_MAX];
unsigned lata[1][2], lnif[1][2];
unsigned memsize, tag;
- int b, d, f, fd, howto, n;
+ int b, d, f, fd, howto, i, n;
/* determine SDRAM size */
memsize = mpc107memsize();
@@ -143,10 +160,19 @@
if (fdloadfile(fd, marks, LOAD_KERNEL) < 0)
goto loadfail;
- howto = RB_SINGLE | AB_VERBOSE;
-#ifdef START_DDB_SESSION
- howto |= RB_KDB;
-#endif
+ /* get boot mode and boot options */
+ howto = RB_AUTOBOOT;
+ for (n = 1; n < argc; n++) {
+ for (i = 0; i < sizeof(bootargs) / sizeof(bootargs[0]); i++) {
+ if (strncasecmp(argv[n], bootargs[i].name,
+ strlen(bootargs[i].name)) == 0) {
+ howto |= bootargs[i].value;
+ break;
+ }
+ }
+ if (i >= sizeof(bootargs) / sizeof(bootargs[0]))
+ break; /* break on first garbage argument */
+ }
bootinfo = (void *)0x4000;
bi_init(bootinfo);
Home |
Main Index |
Thread Index |
Old Index