Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Pass the "boothowto" from the bootloader to the ker...
details: https://anonhg.NetBSD.org/src/rev/2698c90b6c40
branches: trunk
changeset: 779447:2698c90b6c40
user: martin <martin%NetBSD.org@localhost>
date: Mon May 28 19:24:29 2012 +0000
description:
Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
diffstat:
sys/arch/sparc/include/bootinfo.h | 8 +++++++-
sys/arch/sparc/sparc/autoconf.c | 20 ++++++++++++++++++--
sys/arch/sparc/stand/boot/boot.c | 7 ++++++-
sys/arch/sparc/stand/ofwboot/boot.c | 20 +++++++++++++-------
sys/arch/sparc64/include/bootinfo.h | 8 +++++++-
sys/arch/sparc64/sparc64/autoconf.c | 19 +++++++++++++++++--
6 files changed, 68 insertions(+), 14 deletions(-)
diffs (299 lines):
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc/include/bootinfo.h
--- a/sys/arch/sparc/include/bootinfo.h Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc/include/bootinfo.h Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootinfo.h,v 1.5 2006/03/04 03:39:02 uwe Exp $ */
+/* $NetBSD: bootinfo.h,v 1.6 2012/05/28 19:24:29 martin Exp $ */
/*
* Copyright (c) 1997
@@ -42,6 +42,7 @@
#define BTINFO_MAGIC 1
#define BTINFO_SYMTAB 2
#define BTINFO_KERNELFILE 3
+#define BTINFO_BOOTHOWTO 4
struct btinfo_magic {
struct btinfo_common common;
@@ -60,6 +61,11 @@
char name[1]; /* variable length */
};
+struct btinfo_boothowto {
+ struct btinfo_common common;
+ int boothowto;
+};
+
#ifdef _KERNEL
void *lookup_bootinfo(int);
#endif
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.242 2011/07/17 23:18:23 mrg Exp $ */
+/* $NetBSD: autoconf.c,v 1.243 2012/05/28 19:24:29 martin Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.242 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.243 2012/05/28 19:24:29 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -75,6 +75,7 @@
#include <sys/msgbuf.h>
#include <sys/boot_flag.h>
#include <sys/ksyms.h>
+#include <sys/userconf.h>
#include <net/if.h>
#include <net/if_ether.h>
@@ -270,6 +271,7 @@
#else
extern int end[];
#endif
+ struct btinfo_boothowto *bi_howto;
prom_init();
@@ -352,6 +354,11 @@
(void*)bi_sym->esym);
}
#endif
+
+ if ((bi_howto = lookup_bootinfo(BTINFO_BOOTHOWTO)) != NULL) {
+ boothowto = bi_howto->boothowto;
+printf("initialized boothowt from bootloader: %x\n", boothowto);
+ }
}
#if defined(SUN4M) && !defined(MSIIEP)
@@ -915,12 +922,21 @@
cpu_configure(void)
{
struct pcb *pcb0;
+ bool userconf = (boothowto & RB_USERCONF) != 0;
/* initialise the softintr system */
sparc_softintr_init();
/* build the bootpath */
bootpath_build();
+ if (((boothowto & RB_USERCONF) != 0) && !userconf)
+ /*
+ * Old bootloaders do not pass boothowto, and MI code
+ * has already handled userconfig before we get here
+ * and finally fetch the right options. So if we missed
+ * it, just do it here.
+ */
+ userconf_prompt();
#if defined(SUN4)
if (CPU_ISSUN4) {
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc/stand/boot/boot.c
--- a/sys/arch/sparc/stand/boot/boot.c Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc/stand/boot/boot.c Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.27 2011/01/22 19:19:23 joerg Exp $ */
+/* $NetBSD: boot.c,v 1.28 2012/05/28 19:24:29 martin Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@@ -244,6 +244,7 @@
const char *k;
u_long marks[MARK_MAX], bootinfo;
struct btinfo_symtab bi_sym;
+ struct btinfo_boothowto bi_howto;
void *arg;
#ifdef HEAP_VARIABLE
@@ -337,6 +338,10 @@
bi_sym.esym = marks[MARK_END] & loadaddrmask;
bi_add(&bi_sym, BTINFO_SYMTAB, sizeof(bi_sym));
+ /* Add boothowto */
+ bi_howto.boothowto = boothowto;
+ bi_add(&bi_howto, BTINFO_BOOTHOWTO, sizeof(bi_howto));
+
/* Add kernel path to bootinfo */
i = sizeof(struct btinfo_common) + strlen(kernel) + 1;
/* Impose limit (somewhat arbitrary) */
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc/stand/ofwboot/boot.c
--- a/sys/arch/sparc/stand/ofwboot/boot.c Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc/stand/ofwboot/boot.c Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.28 2011/05/21 15:50:42 tsutsui Exp $ */
+/* $NetBSD: boot.c,v 1.29 2012/05/28 19:24:30 martin Exp $ */
/*
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
@@ -251,7 +251,8 @@
* Prepare boot information and jump directly to the kernel.
*/
static void
-jump_to_kernel(u_long *marks, char *kernel, char *args, void *ofw)
+jump_to_kernel(u_long *marks, char *kernel, char *args, void *ofw,
+ int boothowto)
{
int l, machine_tag;
long newargs[4];
@@ -259,6 +260,7 @@
vaddr_t bootinfo;
struct btinfo_symtab bi_sym;
struct btinfo_kernend bi_kend;
+ struct btinfo_boothowto bi_howto;
char *cp;
char bootline[PROM_MAX_PATH * 2];
@@ -279,6 +281,8 @@
bi_add(&bi_sym, BTINFO_SYMTAB, sizeof(bi_sym));
bi_kend.addr= bootinfo + BOOTINFO_SIZE;
bi_add(&bi_kend, BTINFO_KERNEND, sizeof(bi_kend));
+ bi_howto.boothowto = boothowto;
+ bi_add(&bi_howto, BTINFO_BOOTHOWTO, sizeof(bi_howto));
if (bootinfo_pass_bootdev) {
struct {
struct btinfo_common common;
@@ -355,7 +359,8 @@
}
static void
-start_kernel(char *kernel, char *bootline, void *ofw, int isfloppy)
+start_kernel(char *kernel, char *bootline, void *ofw, int isfloppy,
+ int boothowto)
{
int fd;
u_long marks[MARK_MAX];
@@ -381,7 +386,7 @@
if (fdloadfile(fd, marks, flags) != -1) {
close(fd);
- jump_to_kernel(marks, kernel, bootline, ofw);
+ jump_to_kernel(marks, kernel, bootline, ofw, boothowto);
}
}
(void)printf("Failed to load '%s'.\n", kernel);
@@ -496,7 +501,7 @@
void
main(void *ofw)
{
- int boothowto, i = 0, isfloppy;
+ int boothowto, i = 0, isfloppy, kboothowto;
char kernel[PROM_MAX_PATH];
char bootline[PROM_MAX_PATH];
@@ -509,7 +514,8 @@
/* Figure boot arguments */
strncpy(bootdev, prom_getbootpath(), sizeof(bootdev) - 1);
- boothowto = bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
+ kboothowto = boothowto =
+ bootoptions(prom_getbootargs(), bootdev, kernel, bootline);
isfloppy = bootdev_isfloppy(bootdev);
for (;; *kernel = '\0') {
@@ -549,7 +555,7 @@
}
check_boot_config();
- start_kernel(kernel, bootline, ofw, isfloppy);
+ start_kernel(kernel, bootline, ofw, isfloppy, kboothowto);
/*
* Try next name from kernel name list if not in askname mode,
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc64/include/bootinfo.h
--- a/sys/arch/sparc64/include/bootinfo.h Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc64/include/bootinfo.h Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootinfo.h,v 1.5 2010/04/02 18:34:16 martin Exp $ */
+/* $NetBSD: bootinfo.h,v 1.6 2012/05/28 19:24:30 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -98,6 +98,7 @@
#define BTINFO_ITLB 103
#define BTINFO_KERNEND 104
#define BTINFO_BOOTDEV 105
+#define BTINFO_BOOTHOWTO 106
#define LOOKUP_BOOTINFO(btp, info) \
do { \
@@ -131,4 +132,9 @@
char name[1];
};
+struct btinfo_boothowto {
+ struct btinfo_common common;
+ int boothowto;
+};
+
#endif /* _BOOTINFO_H_ */
diff -r 50b7ca762701 -r 2698c90b6c40 sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c Mon May 28 17:28:53 2012 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c Mon May 28 19:24:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.185 2012/01/30 12:19:45 martin Exp $ */
+/* $NetBSD: autoconf.c,v 1.186 2012/05/28 19:24:30 martin Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.185 2012/01/30 12:19:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.186 2012/05/28 19:24:30 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -73,6 +73,7 @@
#include <sys/boot_flag.h>
#include <sys/ksyms.h>
#include <sys/kauth.h>
+#include <sys/userconf.h>
#include <prop/proplib.h>
#include <net/if.h>
@@ -273,6 +274,7 @@
struct btinfo_count *bi_count;
struct btinfo_kernend *bi_kend;
struct btinfo_tlb *bi_tlb;
+ struct btinfo_boothowto *bi_howto;
extern void *romtba;
extern void* get_romtba(void);
@@ -348,6 +350,10 @@
cputyp = CPU_SUN4V;
}
+ bi_howto = lookup_bootinfo(BTINFO_BOOTHOWTO);
+ if (bi_howto)
+ boothowto = bi_howto->boothowto;
+
LOOKUP_BOOTINFO(bi_count, BTINFO_DTLB_SLOTS);
kernel_tlb_slots = bi_count->count;
LOOKUP_BOOTINFO(bi_tlb, BTINFO_DTLB);
@@ -465,9 +471,18 @@
void
cpu_configure(void)
{
+ bool userconf = (boothowto & RB_USERCONF) != 0;
/* fetch boot device settings */
get_bootpath_from_prom();
+ if (((boothowto & RB_USERCONF) != 0) && !userconf)
+ /*
+ * Old bootloaders do not pass boothowto, and MI code
+ * has already handled userconfig before we get here
+ * and finally fetch the right options. So if we missed
+ * it, just do it here.
+ */
+ userconf_prompt();
/* block clock interrupts and anything below */
splclock();
Home |
Main Index |
Thread Index |
Old Index