From 1b20a98f643c3d53f6286a25774915cefa98dfa9 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 3 Feb 2005 23:54:22 +0000 Subject: [PATCH] Generate more useful -v information on the console during device attach. The complete device chain is output prior to each attach. The normal device_print_child() is now moved from before the attach to after the attach so the correct resource information gets reported, especially the correct IRQ. --- sys/kern/subr_bus.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5c849b2dfe..b24fb26968 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_bus.c,v 1.54.2.9 2002/10/10 15:13:32 jhb Exp $ - * $DragonFly: src/sys/kern/subr_bus.c,v 1.21 2004/07/08 12:43:32 joerg Exp $ + * $DragonFly: src/sys/kern/subr_bus.c,v 1.22 2005/02/03 23:54:22 dillon Exp $ */ #include "opt_bus.h" @@ -1050,13 +1050,33 @@ device_probe_and_attach(device_t dev) } return(error); } - + + /* + * Output the exact device chain prior to the attach in case the + * system locks up during attach, and generate the full info after + * the attach so correct irq and other information is displayed. + */ + if (bootverbose && !device_is_quiet(dev)) { + device_t tmp; + + printf("ATTACH "); + printf("%s", device_get_nameunit(dev)); + for (tmp = dev->parent; tmp; tmp = tmp->parent) { + const char *desc; + + if ((desc = device_get_desc(tmp)) != NULL) + printf(".%s[%s]", device_get_nameunit(tmp), desc); + else + printf(".%s", device_get_nameunit(tmp)); + } + printf("\n"); + } + error = DEVICE_ATTACH(dev); if (!device_is_quiet(dev)) device_print_child(bus, dev); - error = DEVICE_ATTACH(dev); - if (!error) + if (error == 0) { dev->state = DS_ATTACHED; - else { + } else { printf("device_probe_and_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); /* Unset the class that was set in device_probe_child */ -- 2.41.0