Module Name:    src
Committed By:   christos
Date:           Thu Nov  9 01:02:56 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: x86_autoconf.c
        src/sys/dev/raidframe: rf_netbsdkintf.c
        src/sys/kern: kern_subr.c
        src/sys/sys: device.h

Log Message:
add a "booted_method" string to aid in debugging double boot matches.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.350 -r1.351 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/kern_subr.c
cvs rdiff -u -r1.149 -r1.150 src/sys/sys/device.h

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/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.75 src/sys/arch/x86/x86/x86_autoconf.c:1.76
--- src/sys/arch/x86/x86/x86_autoconf.c:1.75	Tue Sep 20 20:00:07 2016
+++ src/sys/arch/x86/x86/x86_autoconf.c	Wed Nov  8 20:02:56 2017
@@ -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 @@ int x86_ndisks;
 #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 @@ findroot(void)
 			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 @@ findroot(void)
 			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 @@ findroot(void)
 			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 @@ findroot(void)
 				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 @@ device_register(device_t dev, void *aux)
 
 	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";
+	}
 }

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.350 src/sys/dev/raidframe/rf_netbsdkintf.c:1.351
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.350	Wed May 31 22:45:11 2017
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Nov  8 20:02:56 2017
@@ -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 @@ rf_buildroothack(RF_ConfigSet_t *config_
 		    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 @@ rf_buildroothack(RF_ConfigSet_t *config_
 
 		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... */

Index: src/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.217 src/sys/kern/kern_subr.c:1.218
--- src/sys/kern/kern_subr.c:1.217	Wed May 11 22:24:16 2016
+++ src/sys/kern/kern_subr.c	Wed Nov  8 20:02:55 2017
@@ -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 @@ int md_is_root = 0;
  * 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;

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.149 src/sys/sys/device.h:1.150
--- src/sys/sys/device.h:1.149	Sun Jun 19 05:35:06 2016
+++ src/sys/sys/device.h	Wed Nov  8 20:02:55 2017
@@ -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 @@ struct pdevinit {
 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 */

Reply via email to