Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/scsipi/scsiconf.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/scsipi/scsiconf.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.255.4.3 retrieving revision 1.256 diff -u -p -r1.255.4.3 -r1.256 --- src/sys/dev/scsipi/scsiconf.c 2011/05/31 03:04:55 1.255.4.3 +++ src/sys/dev/scsipi/scsiconf.c 2010/04/27 18:55:12 1.256 @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.255.4.3 2011/05/31 03:04:55 rmind Exp $ */ +/* $NetBSD: scsiconf.c,v 1.256 2010/04/27 18:55:12 dyoung Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.255.4.3 2011/05/31 03:04:55 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.256 2010/04/27 18:55:12 dyoung Exp $"); #include #include @@ -56,13 +56,12 @@ __KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v #include #include #include -#include -#include #include #include #include #include #include +#include #include #include @@ -82,10 +81,9 @@ struct scsi_initq { TAILQ_ENTRY(scsi_initq) scsi_initq; }; -static ONCE_DECL(scsi_conf_ctrl); -static TAILQ_HEAD(, scsi_initq) scsi_initq_head; -static kmutex_t scsibus_qlock; -static kcondvar_t scsibus_qcv; +static TAILQ_HEAD(, scsi_initq) scsi_initq_head = + TAILQ_HEAD_INITIALIZER(scsi_initq_head); +static struct simplelock scsibus_interlock = SIMPLELOCK_INITIALIZER; static int scsi_probe_device(struct scsibus_softc *, int, int); @@ -121,16 +119,6 @@ const struct scsipi_bustype scsi_bustype scsi_kill_pending, }; -static int -scsibus_init(void) -{ - - TAILQ_INIT(&scsi_initq_head); - mutex_init(&scsibus_qlock, MUTEX_DEFAULT, IPL_NONE); - cv_init(&scsibus_qcv, "scsinitq"); - return 0; -} - int scsiprint(void *aux, const char *pnp) { @@ -187,8 +175,6 @@ scsibusattach(device_t parent, device_t if (scsipi_adapter_addref(chan->chan_adapter)) return; - RUN_ONCE(&scsi_conf_ctrl, scsibus_init); - /* Initialize the channel structure first */ chan->chan_init_cb = scsibus_config; chan->chan_init_cb_arg = sc; @@ -223,23 +209,25 @@ scsibus_config(struct scsipi_channel *ch } /* Make sure the devices probe in scsibus order to avoid jitter. */ - mutex_enter(&scsibus_qlock); + simple_lock(&scsibus_interlock); for (;;) { scsi_initq = TAILQ_FIRST(&scsi_initq_head); if (scsi_initq->sc_channel == chan) break; - cv_wait(&scsibus_qcv, &scsibus_qlock); + ltsleep(&scsi_initq_head, PRIBIO, "scsi_initq", 0, + &scsibus_interlock); } - mutex_exit(&scsibus_qlock); + + simple_unlock(&scsibus_interlock); scsi_probe_bus(sc, -1, -1); - mutex_enter(&scsibus_qlock); + simple_lock(&scsibus_interlock); TAILQ_REMOVE(&scsi_initq_head, scsi_initq, scsi_initq); - cv_broadcast(&scsibus_qcv); - mutex_exit(&scsibus_qlock); + simple_unlock(&scsibus_interlock); free(scsi_initq, M_DEVBUF); + wakeup(&scsi_initq_head); scsipi_adapter_delref(chan->chan_adapter); @@ -256,20 +244,11 @@ scsibusdetach(device_t self, int flags) struct scsipi_xfer *xs; int error; - /* - * Detach all of the periphs. - */ - if ((error = scsipi_target_detach(chan, -1, -1, flags)) != 0) - return error; - pmf_device_deregister(self); /* * Process outstanding commands (which will never complete as the * controller is gone). - * - * XXX Surely this is redundant? If we get this far, the - * XXX peripherals have all been detached. */ for (ctarget = 0; ctarget < chan->chan_ntargets; ctarget++) { if (ctarget == chan->chan_id) @@ -287,10 +266,16 @@ scsibusdetach(device_t self, int flags) } /* + * Detach all of the periphs. + */ + error = scsipi_target_detach(chan, -1, -1, flags); + + /* * Now shut down the channel. + * XXX only if no errors ? */ scsipi_channel_shutdown(chan); - return 0; + return (error); } /* @@ -619,11 +604,9 @@ static const struct scsi_quirk_inquiry_p "FUJITSU ", "M2624S-512 ", ""}, PQUIRK_CAP_SYNC}, {{T_DIRECT, T_FIXED, "SEAGATE ", "SX336704LC" , ""}, PQUIRK_CAP_SYNC | PQUIRK_CAP_WIDE16}, - {{T_DIRECT, T_FIXED, - "SEAGATE ", "SX173404LC", ""}, PQUIRK_CAP_SYNC | PQUIRK_CAP_WIDE16}, {{T_DIRECT, T_REMOV, - "IOMEGA", "ZIP 100", "J.03"}, PQUIRK_NOLUNS|PQUIRK_NOSYNC}, + "IOMEGA", "ZIP 100", "J.03"}, PQUIRK_NOLUNS}, {{T_DIRECT, T_REMOV, "INSITE", "I325VM", ""}, PQUIRK_NOLUNS},