Module Name: src Committed By: christos Date: Sat Oct 12 16:49:01 UTC 2013
Modified Files: src/sys/dev/ata: ata.c src/sys/dev/cardbus: cardslot.c src/sys/dev/ieee1394: firewire.c src/sys/dev/pcmcia: wdc_pcmcia.c src/sys/dev/scsipi: scsiconf.c src/sys/dev/sdmmc: ld_sdmmc.c sdmmc.c src/sys/dev/usb: usb.c src/sys/kern: subr_autoconf.c src/sys/sys: device.h Log Message: Pass the device name in, so we can debug what deferred drivers did not work. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/dev/ata/ata.c cvs rdiff -u -r1.54 -r1.55 src/sys/dev/cardbus/cardslot.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ieee1394/firewire.c cvs rdiff -u -r1.123 -r1.124 src/sys/dev/pcmcia/wdc_pcmcia.c cvs rdiff -u -r1.270 -r1.271 src/sys/dev/scsipi/scsiconf.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sdmmc/ld_sdmmc.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sdmmc/sdmmc.c cvs rdiff -u -r1.144 -r1.145 src/sys/dev/usb/usb.c cvs rdiff -u -r1.227 -r1.228 src/sys/kern/subr_autoconf.c cvs rdiff -u -r1.143 -r1.144 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/dev/ata/ata.c diff -u src/sys/dev/ata/ata.c:1.128 src/sys/dev/ata/ata.c:1.129 --- src/sys/dev/ata/ata.c:1.128 Wed Aug 7 08:50:17 2013 +++ src/sys/dev/ata/ata.c Sat Oct 12 12:49:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.128 2013/08/07 12:50:17 blymn Exp $ */ +/* $NetBSD: ata.c,v 1.129 2013/10/12 16:49:00 christos Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.128 2013/08/07 12:50:17 blymn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.129 2013/10/12 16:49:00 christos Exp $"); #include "opt_ata.h" @@ -267,7 +267,7 @@ atabusconfig(struct atabus_softc *atabus ata_delref(chp); - config_pending_decr(); + config_pending_decr(atac->atac_dev); } /* @@ -394,7 +394,7 @@ atabusconfig_thread(void *arg) ata_delref(chp); - config_pending_decr(); + config_pending_decr(atac->atac_dev); kthread_exit(0); } @@ -518,7 +518,7 @@ atabus_attach(device_t parent, device_t initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK); initq->atabus_sc = sc; TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq); - config_pending_incr(); + config_pending_incr(sc->sc_dev); if ((error = kthread_create(PRI_NONE, 0, NULL, atabus_thread, sc, &chp->ch_thread, "%s", device_xname(self))) != 0) @@ -1715,7 +1715,7 @@ atabus_rescan(device_t self, const char initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK); initq->atabus_sc = sc; TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq); - config_pending_incr(); + config_pending_incr(sc->sc_dev); chp->ch_flags |= ATACH_TH_RESCAN; wakeup(&chp->ch_thread); Index: src/sys/dev/cardbus/cardslot.c diff -u src/sys/dev/cardbus/cardslot.c:1.54 src/sys/dev/cardbus/cardslot.c:1.55 --- src/sys/dev/cardbus/cardslot.c:1.54 Sat Oct 27 13:18:15 2012 +++ src/sys/dev/cardbus/cardslot.c Sat Oct 12 12:49:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cardslot.c,v 1.54 2012/10/27 17:18:15 chs Exp $ */ +/* $NetBSD: cardslot.c,v 1.55 2013/10/12 16:49:00 christos Exp $ */ /* * Copyright (c) 1999 and 2000 @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.54 2012/10/27 17:18:15 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.55 2013/10/12 16:49:00 christos Exp $"); #include "opt_cardslot.h" @@ -147,7 +147,7 @@ cardslotattach(device_t parent, device_t } if (csc != NULL || psc != NULL) { - config_pending_incr(); + config_pending_incr(self); if (kthread_create(PRI_NONE, 0, NULL, cardslot_event_thread, sc, &sc->sc_event_thread, "%s", device_xname(self))) { aprint_error_dev(sc->sc_dev, @@ -298,7 +298,7 @@ cardslot_event_thread(void *arg) splx(s); if (first) { first = 0; - config_pending_decr(); + config_pending_decr(sc->sc_dev); } (void) tsleep(&sc->sc_events, PWAIT, "cardslotev", 0); continue; Index: src/sys/dev/ieee1394/firewire.c diff -u src/sys/dev/ieee1394/firewire.c:1.42 src/sys/dev/ieee1394/firewire.c:1.43 --- src/sys/dev/ieee1394/firewire.c:1.42 Sat Aug 4 22:47:52 2012 +++ src/sys/dev/ieee1394/firewire.c Sat Oct 12 12:49:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: firewire.c,v 1.42 2012/08/05 02:47:52 riastradh Exp $ */ +/* $NetBSD: firewire.c,v 1.43 2013/10/12 16:49:00 christos Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.42 2012/08/05 02:47:52 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.43 2013/10/12 16:49:00 christos Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -256,13 +256,13 @@ firewireattach(device_t parent, device_t callout_schedule(&fc->timeout_callout, hz); /* Tell config we will have started a thread to scan the bus. */ - config_pending_incr(); + config_pending_incr(self); /* create thread */ if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, fw_bus_probe_thread, fc, &fc->probe_thread, "fw%dprobe", device_unit(fc->bdev))) { aprint_error_dev(self, "kthread_create failed\n"); - config_pending_decr(); + config_pending_decr(self); } devlist = malloc(sizeof(struct firewire_dev_list), M_DEVBUF, M_NOWAIT); @@ -1962,7 +1962,7 @@ fw_bus_probe_thread(void *arg) * once = true; * } */ - config_pending_decr(); + config_pending_decr(fc->bdev); mutex_enter(&fc->wait_lock); while (fc->status != FWBUSDETACH) { Index: src/sys/dev/pcmcia/wdc_pcmcia.c diff -u src/sys/dev/pcmcia/wdc_pcmcia.c:1.123 src/sys/dev/pcmcia/wdc_pcmcia.c:1.124 --- src/sys/dev/pcmcia/wdc_pcmcia.c:1.123 Tue Jul 31 11:50:37 2012 +++ src/sys/dev/pcmcia/wdc_pcmcia.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_pcmcia.c,v 1.123 2012/07/31 15:50:37 bouyer Exp $ */ +/* $NetBSD: wdc_pcmcia.c,v 1.124 2013/10/12 16:49:01 christos Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.123 2012/07/31 15:50:37 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.124 2013/10/12 16:49:01 christos Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -316,7 +316,7 @@ wdc_pcmcia_attach(device_t parent, devic * and probe properly, so give them half a second. * See PR 25659 for details. */ - config_pending_incr(); + config_pending_incr(self); tsleep(wdc_pcmcia_attach, PWAIT, "wdcattach", hz / 2); wdcattach(&sc->ata_channel); @@ -324,7 +324,7 @@ wdc_pcmcia_attach(device_t parent, devic if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "unable to establish power handler\n"); - config_pending_decr(); + config_pending_decr(self); ata_delref(&sc->ata_channel); sc->sc_state = WDC_PCMCIA_ATTACHED; return; Index: src/sys/dev/scsipi/scsiconf.c diff -u src/sys/dev/scsipi/scsiconf.c:1.270 src/sys/dev/scsipi/scsiconf.c:1.271 --- src/sys/dev/scsipi/scsiconf.c:1.270 Sun Sep 15 09:53:51 2013 +++ src/sys/dev/scsipi/scsiconf.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.270 2013/09/15 13:53:51 martin Exp $ */ +/* $NetBSD: scsiconf.c,v 1.271 2013/10/12 16:49:01 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.270 2013/09/15 13:53:51 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.271 2013/10/12 16:49:01 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -241,7 +241,7 @@ scsibusattach(device_t parent, device_t scsi_initq = malloc(sizeof(struct scsi_initq), M_DEVBUF, M_WAITOK); scsi_initq->sc_channel = chan; TAILQ_INSERT_TAIL(&scsi_initq_head, scsi_initq, scsi_initq); - config_pending_incr(); + config_pending_incr(sc->sc_dev); if (scsipi_channel_init(chan)) { aprint_error_dev(sc->sc_dev, "failed to init channel\n"); return; @@ -288,7 +288,7 @@ scsibus_config(struct scsipi_channel *ch scsipi_adapter_delref(chan->chan_adapter); - config_pending_decr(); + config_pending_decr(sc->sc_dev); } static int Index: src/sys/dev/sdmmc/ld_sdmmc.c diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.11 src/sys/dev/sdmmc/ld_sdmmc.c:1.12 --- src/sys/dev/sdmmc/ld_sdmmc.c:1.11 Fri Dec 14 18:53:56 2012 +++ src/sys/dev/sdmmc/ld_sdmmc.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_sdmmc.c,v 1.11 2012/12/14 23:53:56 jakllsch Exp $ */ +/* $NetBSD: ld_sdmmc.c,v 1.12 2013/10/12 16:49:01 christos Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.11 2012/12/14 23:53:56 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.12 2013/10/12 16:49:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -135,7 +135,7 @@ ld_sdmmc_attach(device_t parent, device_ * It is avoided that the error occurs when the card attaches it, * when wedge is supported. */ - config_pending_incr(); + config_pending_incr(self); if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, ld_sdmmc_doattach, sc, &lwp, "%sattach", device_xname(self))) { aprint_error_dev(self, "couldn't create thread\n"); @@ -157,7 +157,7 @@ ld_sdmmc_doattach(void *arg) ssc->sc_busclk / 1000, ssc->sc_busclk % 1000); else aprint_normal(" %u KHz\n", ssc->sc_busclk % 1000); - config_pending_decr(); + config_pending_decr(ld->sc_dv); kthread_exit(0); } Index: src/sys/dev/sdmmc/sdmmc.c diff -u src/sys/dev/sdmmc/sdmmc.c:1.20 src/sys/dev/sdmmc/sdmmc.c:1.21 --- src/sys/dev/sdmmc/sdmmc.c:1.20 Sat Dec 22 16:24:49 2012 +++ src/sys/dev/sdmmc/sdmmc.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch Exp $ */ +/* $NetBSD: sdmmc.c,v 1.21 2013/10/12 16:49:01 christos Exp $ */ /* $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $ */ /* @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.21 2013/10/12 16:49:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -170,7 +170,7 @@ sdmmc_attach(device_t parent, device_t s * Create the event thread that will attach and detach cards * and perform other lengthy operations. */ - config_pending_incr(); + config_pending_incr(self); config_interrupts(self, sdmmc_doattach); } @@ -252,7 +252,7 @@ sdmmc_task_thread(void *arg) struct sdmmc_task *task; sdmmc_discover_task(sc); - config_pending_decr(); + config_pending_decr(sc->sc_dev); mutex_enter(&sc->sc_tskq_mtx); for (;;) { Index: src/sys/dev/usb/usb.c diff -u src/sys/dev/usb/usb.c:1.144 src/sys/dev/usb/usb.c:1.145 --- src/sys/dev/usb/usb.c:1.144 Sat Sep 14 10:06:40 2013 +++ src/sys/dev/usb/usb.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.144 2013/09/14 14:06:40 jakllsch Exp $ */ +/* $NetBSD: usb.c,v 1.145 2013/10/12 16:49:01 christos Exp $ */ /* * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.144 2013/09/14 14:06:40 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.145 2013/10/12 16:49:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -316,7 +316,7 @@ usb_doattach(device_t self) sc->sc_dying = 1; } - config_pending_incr(); + config_pending_incr(self); if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); @@ -402,7 +402,7 @@ usb_event_thread(void *arg) usb_discover(sc); if (sc->sc_bus->lock) mutex_exit(sc->sc_bus->lock); - config_pending_decr(); + config_pending_decr(sc->sc_bus->usbctl); if (sc->sc_bus->lock) mutex_enter(sc->sc_bus->lock); Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.227 src/sys/kern/subr_autoconf.c:1.228 --- src/sys/kern/subr_autoconf.c:1.227 Fri Jun 28 11:33:40 2013 +++ src/sys/kern/subr_autoconf.c Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.227 2013/06/28 15:33:40 christos Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.228 2013/10/12 16:49:01 christos Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.227 2013/06/28 15:33:40 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.228 2013/10/12 16:49:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -436,8 +436,8 @@ config_interrupts_thread(void *cookie) while ((dc = TAILQ_FIRST(&interrupt_config_queue)) != NULL) { TAILQ_REMOVE(&interrupt_config_queue, dc, dc_queue); (*dc->dc_func)(dc->dc_dev); + config_pending_decr(dc->dc_dev); kmem_free(dc, sizeof(*dc)); - config_pending_decr(); } kthread_exit(0); } @@ -1906,7 +1906,7 @@ config_defer(device_t dev, void (*func)( dc->dc_dev = dev; dc->dc_func = func; TAILQ_INSERT_TAIL(&deferred_config_queue, dc, dc_queue); - config_pending_incr(); + config_pending_incr(dev); } /* @@ -1940,7 +1940,7 @@ config_interrupts(device_t dev, void (*f dc->dc_dev = dev; dc->dc_func = func; TAILQ_INSERT_TAIL(&interrupt_config_queue, dc, dc_queue); - config_pending_incr(); + config_pending_incr(dev); } /* @@ -1990,8 +1990,8 @@ config_process_deferred(struct deferred_ if (parent == NULL || dc->dc_dev->dv_parent == parent) { TAILQ_REMOVE(queue, dc, dc_queue); (*dc->dc_func)(dc->dc_dev); + config_pending_decr(dc->dc_dev); kmem_free(dc, sizeof(*dc)); - config_pending_decr(); } } } @@ -2000,16 +2000,19 @@ config_process_deferred(struct deferred_ * Manipulate the config_pending semaphore. */ void -config_pending_incr(void) +config_pending_incr(device_t dev) { mutex_enter(&config_misc_lock); config_pending++; +#ifdef DEBUG_AUTOCONF + printf("%s: %s %d\n", __func__, device_xname(dev), config_pending); +#endif mutex_exit(&config_misc_lock); } void -config_pending_decr(void) +config_pending_decr(device_t dev) { #ifdef DIAGNOSTIC @@ -2018,6 +2021,9 @@ config_pending_decr(void) #endif mutex_enter(&config_misc_lock); config_pending--; +#ifdef DEBUG_AUTOCONF + printf("%s: %s %d\n", __func__, device_xname(dev), config_pending); +#endif if (config_pending == 0) cv_broadcast(&config_misc_cv); mutex_exit(&config_misc_lock); Index: src/sys/sys/device.h diff -u src/sys/sys/device.h:1.143 src/sys/sys/device.h:1.144 --- src/sys/sys/device.h:1.143 Sat Oct 27 13:18:40 2012 +++ src/sys/sys/device.h Sat Oct 12 12:49:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.143 2012/10/27 17:18:40 chs Exp $ */ +/* $NetBSD: device.h,v 1.144 2013/10/12 16:49:01 christos Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -469,8 +469,8 @@ void config_defer(device_t, void (*)(dev void config_deferred(device_t); void config_interrupts(device_t, void (*)(device_t)); void config_mountroot(device_t, void (*)(device_t)); -void config_pending_incr(void); -void config_pending_decr(void); +void config_pending_incr(device_t); +void config_pending_decr(device_t); void config_create_interruptthreads(void); void config_create_mountrootthreads(void);