Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

patch: add instrumentation to xen/x86/autoconf.c



Here is some instrumentation I found useful during my recent debugging.
If there are no objections I'd like to commit soon.

Add some DPRINTF #ifdef DEBUG_GEOM like arch/x86/x86/x86_autoconf.c.
Set booted_method like in arch/x86/x86/x86_autoconf.c.
Whitespace nit in is_valid_disk().

Index: autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/autoconf.c,v
retrieving revision 1.21
diff -u -r1.21 autoconf.c
--- autoconf.c	22 Dec 2018 07:45:58 -0000	1.21
+++ autoconf.c	20 Jan 2019 22:20:39 -0000
@@ -101,6 +101,12 @@
 #include <i386/pci/pcibios.h>
 #endif
 
+#ifdef DEBUG_GEOM
+#define DPRINTF(a) printf a
+#else
+#define DPRINTF(a)
+#endif
+
 /*
  * Determine i/o configuration for a machine.
  */
@@ -170,8 +176,10 @@
 	union xen_cmdline_parseinfo xcp;
 	static char bootspecbuf[sizeof(xcp.xcp_bootdev)];
 
-	if (booted_device)
+	if (booted_device) {
+		DPRINTF(("%s: preset booted_device: %s\n", __func__, device_xname(booted_device)));
 		return;
+	}
 
 	xen_parse_cmdline(XEN_PARSE_BOOTDEV, &xcp);
 
@@ -197,17 +205,22 @@
 			continue;
 
 		if (is_disk && strlen(xcp.xcp_bootdev) > strlen(devname)) {
+			/* XXX check device_cfdata as in x86_autoconf.c? */
 			booted_partition = toupper(
 				xcp.xcp_bootdev[strlen(devname)]) - 'A';
+			DPRINTF(("%s: booted_partition: %d\n", __func__, booted_partition));
 		}
 
 		booted_device = dv;
+		booted_method = "bootinfo/bootdev";
 		break;
 	}
 	deviter_release(&di);
 
-	if (booted_device)
+	if (booted_device) {
+		DPRINTF(("%s: booted_device: %s\n", __func__, device_xname(booted_device)));
 		return;
+	}
 
 	/*
 	 * not a boot device name, pass through to MI code
@@ -215,6 +228,8 @@
 	if (xcp.xcp_bootdev[0] != '\0') {
 		strlcpy(bootspecbuf, xcp.xcp_bootdev, sizeof(bootspecbuf));
 		bootspec = bootspecbuf;
+		booted_method = "bootinfo/bootspec";
+		DPRINTF(("%s: bootspec: %s\n", __func__, bootspec));
 		return;
 	}
 }
@@ -359,7 +374,6 @@
 static int
 is_valid_disk(device_t dv)
 {
-
 	if (device_class(dv) != DV_DISK)
 		return (0);
 


Home | Main Index | Thread Index | Old Index