Module Name: src Committed By: martin Date: Fri Apr 2 18:34:16 UTC 2010
Modified Files: src/sys/arch/sparc64/include: bootinfo.h src/sys/arch/sparc64/sparc64: autoconf.c Log Message: Add a bootinfo node to allow the loader to override the boot device To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/include/bootinfo.h cvs rdiff -u -r1.173 -r1.174 src/sys/arch/sparc64/sparc64/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc64/include/bootinfo.h diff -u src/sys/arch/sparc64/include/bootinfo.h:1.4 src/sys/arch/sparc64/include/bootinfo.h:1.5 --- src/sys/arch/sparc64/include/bootinfo.h:1.4 Mon Apr 28 20:23:36 2008 +++ src/sys/arch/sparc64/include/bootinfo.h Fri Apr 2 18:34:16 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bootinfo.h,v 1.4 2008/04/28 20:23:36 martin Exp $ */ +/* $NetBSD: bootinfo.h,v 1.5 2010/04/02 18:34:16 martin Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -97,6 +97,7 @@ #define BTINFO_DTLB 102 #define BTINFO_ITLB 103 #define BTINFO_KERNEND 104 +#define BTINFO_BOOTDEV 105 #define LOOKUP_BOOTINFO(btp, info) \ do { \ @@ -125,4 +126,9 @@ uint64_t addr; }; +struct btinfo_bootdev { + struct btinfo_common common; + char name[1]; +}; + #endif /* _BOOTINFO_H_ */ Index: src/sys/arch/sparc64/sparc64/autoconf.c diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.173 src/sys/arch/sparc64/sparc64/autoconf.c:1.174 --- src/sys/arch/sparc64/sparc64/autoconf.c:1.173 Thu Mar 11 03:54:56 2010 +++ src/sys/arch/sparc64/sparc64/autoconf.c Fri Apr 2 18:34:16 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.173 2010/03/11 03:54:56 mrg Exp $ */ +/* $NetBSD: autoconf.c,v 1.174 2010/04/02 18:34:16 martin Exp $ */ /* * Copyright (c) 1996 @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.173 2010/03/11 03:54:56 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.174 2010/04/02 18:34:16 martin Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -346,17 +346,24 @@ static void get_bootpath_from_prom(void) { + struct btinfo_bootdev *bdev = NULL; char sbuf[OFPATHLEN], *cp; int chosen; /* * Grab boot path from PROM */ - if ((chosen = OF_finddevice("/chosen")) == -1 || - OF_getprop(chosen, "bootpath", sbuf, sizeof(sbuf)) < 0) + if ((chosen = OF_finddevice("/chosen")) == -1) return; - strcpy(ofbootpath, sbuf); + LOOKUP_BOOTINFO(bdev, BTINFO_BOOTDEV); + if (bdev) { + strcpy(ofbootpath, bdev->name); + } else { + if (OF_getprop(chosen, "bootpath", sbuf, sizeof(sbuf)) < 0) + return; + strcpy(ofbootpath, sbuf); + } DPRINTF(ACDB_BOOTDEV, ("bootpath: %s\n", ofbootpath)); ofbootpackage = prom_finddevice(ofbootpath);