Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys add a "booted_method" string to aid in debugging double ...
details: https://anonhg.NetBSD.org/src/rev/d374a37c4346
branches: trunk
changeset: 357387:d374a37c4346
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 09 01:02:55 2017 +0000
description:
add a "booted_method" string to aid in debugging double boot matches.
diffstat:
sys/arch/x86/x86/x86_autoconf.c | 25 ++++++++++++++++---------
sys/dev/raidframe/rf_netbsdkintf.c | 6 ++++--
sys/kern/kern_subr.c | 5 +++--
sys/sys/device.h | 3 ++-
4 files changed, 25 insertions(+), 14 deletions(-)
diffs (165 lines):
diff -r 43d6e798cca7 -r d374a37c4346 sys/arch/x86/x86/x86_autoconf.c
--- a/sys/arch/x86/x86/x86_autoconf.c Thu Nov 09 01:01:33 2017 +0000
+++ b/sys/arch/x86/x86/x86_autoconf.c Thu Nov 09 01:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $ */
+/* $NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,11 +71,12 @@
#endif
static void
-dmatch(const char *func, device_t dv)
+dmatch(const char *func, device_t dv, const char *method)
{
- printf("WARNING: %s: double match for boot device (%s, %s)\n",
- func, device_xname(booted_device), device_xname(dv));
+ printf("WARNING: %s: double match for boot device (%s:%s %s:%s)\n",
+ func, booted_method, device_xname(booted_device),
+ method, device_xname(dv));
}
static int
@@ -358,6 +359,7 @@
if (strncmp(cd->cf_name, biv->devname, len) == 0 &&
biv->devname[len] - '0' == device_unit(dv)) {
booted_device = dv;
+ booted_method = "bootinfo/rootdevice";
booted_partition = biv->devname[len + 1] - 'a';
booted_nblks = 0;
break;
@@ -405,10 +407,11 @@
continue;
bootwedge_found:
if (booted_device) {
- dmatch(__func__, dv);
+ dmatch(__func__, dv, "bootinfo/bootwedge");
continue;
}
booted_device = dv;
+ booted_method = "bootinfo/bootwedge";
booted_partition = bid != NULL ? bid->partition : 0;
booted_nblks = biw->nblks;
booted_startblk = biw->startblk;
@@ -463,10 +466,11 @@
continue;
bootdisk_found:
if (booted_device) {
- dmatch(__func__, dv);
+ dmatch(__func__, dv, "bootinfo/bootdisk");
continue;
}
booted_device = dv;
+ booted_method = "bootinfo/bootdisk";
booted_partition = bid->partition;
booted_nblks = 0;
}
@@ -507,6 +511,7 @@
if (device_class(dv) == DV_DISK &&
device_is_a(dv, "cd")) {
booted_device = dv;
+ booted_method = "bootinfo/biosgeom";
booted_partition = 0;
booted_nblks = 0;
break;
@@ -552,7 +557,9 @@
if (booted_device != NULL) {
/* XXX should be a panic() */
- dmatch(__func__, dev);
- } else
+ dmatch(__func__, dev, "device/register");
+ } else {
booted_device = (isaboot != NULL) ? isaboot : pciboot;
+ booted_method = "device/register";
+ }
}
diff -r 43d6e798cca7 -r d374a37c4346 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Thu Nov 09 01:01:33 2017 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Thu Nov 09 01:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.350 2017/06/01 02:45:11 chs Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.350 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -568,6 +568,7 @@
rsc->sc_r.root_partition == 1 ||
rf_containsboot(&rsc->sc_r, booted_device)) {
booted_device = candidate_root;
+ booted_method = "raidframe/single";
booted_partition = 0; /* XXX assume 'a' */
}
} else if (num_root > 1) {
@@ -603,6 +604,7 @@
if (num_root == 1) {
booted_device = dksc->sc_dev;
+ booted_method = "raidframe/multi";
booted_partition = 0; /* XXX assume 'a' */
} else {
/* we can't guess.. require the user to answer... */
diff -r 43d6e798cca7 -r d374a37c4346 sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c Thu Nov 09 01:01:33 2017 +0000
+++ b/sys/kern/kern_subr.c Thu Nov 09 01:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_subr.c,v 1.217 2016/05/12 02:24:16 ozaki-r Exp $ */
+/* $NetBSD: kern_subr.c,v 1.218 2017/11/09 01:02:55 christos Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.217 2016/05/12 02:24:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.218 2017/11/09 01:02:55 christos Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@@ -156,6 +156,7 @@
* The device and partition that we booted from.
*/
device_t booted_device;
+const char *booted_method;
int booted_partition;
daddr_t booted_startblk;
uint64_t booted_nblks;
diff -r 43d6e798cca7 -r d374a37c4346 sys/sys/device.h
--- a/sys/sys/device.h Thu Nov 09 01:01:33 2017 +0000
+++ b/sys/sys/device.h Thu Nov 09 01:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.149 2016/06/19 09:35:06 bouyer Exp $ */
+/* $NetBSD: device.h,v 1.150 2017/11/09 01:02:55 christos Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -413,6 +413,7 @@
extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */
extern struct cftablelist allcftables; /* list of all cfdata tables */
extern device_t booted_device; /* the device we booted from */
+extern const char *booted_method; /* the method the device was found */
extern int booted_partition; /* the partition on that device */
extern daddr_t booted_startblk; /* or the start of a wedge */
extern uint64_t booted_nblks; /* and the size of that wedge */
Home |
Main Index |
Thread Index |
Old Index