Generate more useful -v information on the console during device attach.
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 3 Feb 2005 23:54:22 +0000 (23:54 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 3 Feb 2005 23:54:22 +0000 (23:54 +0000)
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

index 5c849b2..b24fb26 100644 (file)
@@ -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 */