diff options
-rw-r--r-- | sys/scsi/scsiconf.c | 40 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 7 |
2 files changed, 26 insertions, 21 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 454e8fbc219..e001fa97092 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.178 2011/07/05 21:39:56 matthew Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.179 2011/07/06 00:45:52 matthew Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -158,12 +158,17 @@ scsibusattach(struct device *parent, struct device *self, void *aux) sb->adapter_link = sc_link_proto; if (sb->adapter_link->adapter_buswidth == 0) sb->adapter_link->adapter_buswidth = 8; - sb->sc_buswidth = sb->adapter_link->adapter_buswidth; + if (saa->saa_targets == 0) + saa->saa_targets = sb->adapter_link->adapter_buswidth; + sb->sc_targets = saa->saa_targets; if (sb->adapter_link->luns == 0) sb->adapter_link->luns = 8; + if (saa->saa_luns == 0) + saa->saa_luns = sb->adapter_link->luns; + sb->sc_luns = saa->saa_luns; - printf(": %d targets", sb->sc_buswidth); - if (sb->adapter_link->adapter_target < sb->sc_buswidth) + printf(": %d targets", sb->sc_targets); + if (sb->adapter_link->adapter_target < sb->sc_targets) printf(", initiator %d", sb->adapter_link->adapter_target); if (sb->adapter_link->port_wwn != 0x0 && sb->adapter_link->node_wwn != 0x0) { @@ -213,7 +218,7 @@ scsi_activate_bus(struct scsibus_softc *sc, int act) { int target, rv = 0, r; - for (target = 0; target < sc->sc_buswidth; target++) { + for (target = 0; target < sc->sc_targets; target++) { r = scsi_activate_target(sc, target, act); if (r) rv = r; @@ -226,7 +231,7 @@ scsi_activate_target(struct scsibus_softc *sc, int target, int act) { int lun, rv = 0, r; - for (lun = 0; lun < sc->adapter_link->luns; lun++) { + for (lun = 0; lun < sc->sc_luns; lun++) { r = scsi_activate_lun(sc, target, lun, act); if (r) rv = r; @@ -342,10 +347,9 @@ scsibus_bioctl(struct device *dev, u_long cmd, caddr_t addr) int scsi_probe_bus(struct scsibus_softc *sc) { - struct scsi_link *alink = sc->adapter_link; int i; - for (i = 0; i < alink->adapter_buswidth; i++) + for (i = 0; i < sc->sc_targets; i++) scsi_probe_target(sc, i); return (0); @@ -354,7 +358,6 @@ scsi_probe_bus(struct scsibus_softc *sc) int scsi_probe_target(struct scsibus_softc *sc, int target) { - struct scsi_link *alink = sc->adapter_link; struct scsi_link *link; struct scsi_report_luns_data *report; int i, nluns, lun; @@ -405,7 +408,7 @@ scsi_probe_target(struct scsibus_softc *sc, int target) } dumbscan: - for (i = 1; i < alink->luns; i++) { + for (i = 1; i < sc->sc_luns; i++) { if (scsi_probe_lun(sc, target, i) == EINVAL) break; } @@ -418,9 +421,9 @@ scsi_probe_lun(struct scsibus_softc *sc, int target, int lun) { struct scsi_link *alink = sc->adapter_link; - if (target < 0 || target >= alink->adapter_buswidth || + if (target < 0 || target >= sc->sc_targets || target == alink->adapter_target || - lun < 0 || lun >= alink->luns) + lun < 0 || lun >= sc->sc_luns) return (ENXIO); return (scsi_probedev(sc, target, lun)); @@ -429,10 +432,9 @@ scsi_probe_lun(struct scsibus_softc *sc, int target, int lun) int scsi_detach_bus(struct scsibus_softc *sc, int flags) { - struct scsi_link *alink = sc->adapter_link; int i, err, rv = 0; - for (i = 0; i < alink->adapter_buswidth; i++) { + for (i = 0; i < sc->sc_targets; i++) { err = scsi_detach_target(sc, i, flags); if (err != 0 && err != ENXIO) rv = err; @@ -447,11 +449,11 @@ scsi_detach_target(struct scsibus_softc *sc, int target, int flags) struct scsi_link *alink = sc->adapter_link; int i, err, rv = 0; - if (target < 0 || target >= alink->adapter_buswidth || + if (target < 0 || target >= sc->sc_targets || target == alink->adapter_target) return (ENXIO); - for (i = 0; i < alink->luns; i++) { /* nicer backwards? */ + for (i = 0; i < sc->sc_luns; i++) { /* nicer backwards? */ if (scsi_get_link(sc, target, i) == NULL) continue; @@ -470,9 +472,9 @@ scsi_detach_lun(struct scsibus_softc *sc, int target, int lun, int flags) struct scsi_link *link; int rv; - if (target < 0 || target >= alink->adapter_buswidth || + if (target < 0 || target >= sc->sc_targets || target == alink->adapter_target || - lun < 0 || lun >= alink->luns) + lun < 0 || lun >= sc->sc_luns) return (ENXIO); link = scsi_get_link(sc, target, lun); @@ -1021,7 +1023,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun) * point to prevent such helpfulness before it causes confusion. */ if (lun == 0 && (sc_link->flags & SDEV_UMASS) && - scsi_get_link(scsi, target, 1) == NULL && sc_link->luns > 1 && + scsi_get_link(scsi, target, 1) == NULL && scsi->sc_luns > 1 && (usbinqbuf = dma_alloc(sizeof(*usbinqbuf), M_NOWAIT)) != NULL) { sc_link->lun = 1; diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index a8e10e0a9d3..12ba4a1747c 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.146 2011/07/05 21:39:56 matthew Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.147 2011/07/06 00:45:52 matthew Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -417,6 +417,8 @@ struct scsi_inquiry_pattern { struct scsibus_attach_args { struct scsi_link *saa_sc_link; + u_int16_t saa_targets; + u_int16_t saa_luns; }; /* @@ -431,7 +433,8 @@ struct scsibus_softc { struct device sc_dev; struct scsi_link *adapter_link; /* prototype supplied by adapter */ SLIST_HEAD(, scsi_link) sc_link; - u_int16_t sc_buswidth; + u_int16_t sc_targets; + u_int16_t sc_luns; }; /* |