diff options
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/mpath.c | 6 | ||||
-rw-r--r-- | sys/scsi/scsiconf.c | 41 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 11 |
3 files changed, 27 insertions, 31 deletions
diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index 9e50a970fe6..3e5939ebaf8 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.24 2011/07/11 01:02:48 dlg Exp $ */ +/* $OpenBSD: mpath.c,v 1.25 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> @@ -129,13 +129,13 @@ mpath_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter = &mpath_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = MPATH_BUSWIDTH; + sc->sc_link.adapter_buswidth = MPATH_BUSWIDTH; + sc->sc_link.luns = 1; sc->sc_link.openings = 1024; /* XXX magical */ sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = MPATH_BUSWIDTH; - saa.saa_luns = 1; sc->sc_scsibus = (struct scsibus_softc *)config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index e001fa97092..925387ee15e 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.179 2011/07/06 00:45:52 matthew Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.180 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -155,20 +155,16 @@ scsibusattach(struct device *parent, struct device *self, void *aux) scsi_autoconf = 0; sc_link_proto->bus = sb; + sc_link_proto->scsibus = sb->sc_dev.dv_unit; sb->adapter_link = sc_link_proto; if (sb->adapter_link->adapter_buswidth == 0) sb->adapter_link->adapter_buswidth = 8; - if (saa->saa_targets == 0) - saa->saa_targets = sb->adapter_link->adapter_buswidth; - sb->sc_targets = saa->saa_targets; + sb->sc_buswidth = sb->adapter_link->adapter_buswidth; 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_targets); - if (sb->adapter_link->adapter_target < sb->sc_targets) + printf(": %d targets", sb->sc_buswidth); + if (sb->adapter_link->adapter_target < sb->sc_buswidth) printf(", initiator %d", sb->adapter_link->adapter_target); if (sb->adapter_link->port_wwn != 0x0 && sb->adapter_link->node_wwn != 0x0) { @@ -218,7 +214,7 @@ scsi_activate_bus(struct scsibus_softc *sc, int act) { int target, rv = 0, r; - for (target = 0; target < sc->sc_targets; target++) { + for (target = 0; target < sc->sc_buswidth; target++) { r = scsi_activate_target(sc, target, act); if (r) rv = r; @@ -231,7 +227,7 @@ scsi_activate_target(struct scsibus_softc *sc, int target, int act) { int lun, rv = 0, r; - for (lun = 0; lun < sc->sc_luns; lun++) { + for (lun = 0; lun < sc->adapter_link->luns; lun++) { r = scsi_activate_lun(sc, target, lun, act); if (r) rv = r; @@ -347,9 +343,10 @@ 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 < sc->sc_targets; i++) + for (i = 0; i < alink->adapter_buswidth; i++) scsi_probe_target(sc, i); return (0); @@ -358,6 +355,7 @@ 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; @@ -408,7 +406,7 @@ scsi_probe_target(struct scsibus_softc *sc, int target) } dumbscan: - for (i = 1; i < sc->sc_luns; i++) { + for (i = 1; i < alink->luns; i++) { if (scsi_probe_lun(sc, target, i) == EINVAL) break; } @@ -421,9 +419,9 @@ scsi_probe_lun(struct scsibus_softc *sc, int target, int lun) { struct scsi_link *alink = sc->adapter_link; - if (target < 0 || target >= sc->sc_targets || + if (target < 0 || target >= alink->adapter_buswidth || target == alink->adapter_target || - lun < 0 || lun >= sc->sc_luns) + lun < 0 || lun >= alink->luns) return (ENXIO); return (scsi_probedev(sc, target, lun)); @@ -432,9 +430,10 @@ 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 < sc->sc_targets; i++) { + for (i = 0; i < alink->adapter_buswidth; i++) { err = scsi_detach_target(sc, i, flags); if (err != 0 && err != ENXIO) rv = err; @@ -449,11 +448,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 >= sc->sc_targets || + if (target < 0 || target >= alink->adapter_buswidth || target == alink->adapter_target) return (ENXIO); - for (i = 0; i < sc->sc_luns; i++) { /* nicer backwards? */ + for (i = 0; i < alink->luns; i++) { /* nicer backwards? */ if (scsi_get_link(sc, target, i) == NULL) continue; @@ -472,9 +471,9 @@ scsi_detach_lun(struct scsibus_softc *sc, int target, int lun, int flags) struct scsi_link *link; int rv; - if (target < 0 || target >= sc->sc_targets || + if (target < 0 || target >= alink->adapter_buswidth || target == alink->adapter_target || - lun < 0 || lun >= sc->sc_luns) + lun < 0 || lun >= alink->luns) return (ENXIO); link = scsi_get_link(sc, target, lun); @@ -1023,7 +1022,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 && scsi->sc_luns > 1 && + scsi_get_link(scsi, target, 1) == NULL && sc_link->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 302e537bdb8..5463c2539cf 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.148 2011/07/09 00:34:59 matthew Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.149 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -353,8 +353,10 @@ struct scsi_link { SLIST_ENTRY(scsi_link) bus_list; u_int state; +#define SDEV_S_WAITING (1<<0) #define SDEV_S_DYING (1<<1) + u_int8_t scsibus; /* the Nth scsibus */ u_int8_t luns; u_int16_t target; /* targ of this dev */ u_int16_t lun; /* lun of this dev */ @@ -401,8 +403,6 @@ struct scsi_link { struct scsi_iopool *pool; }; -#define SCSI_NO_ADAPTER_TARGET ((u_int16_t) -1) - int scsiprint(void *, const char *); /* @@ -419,8 +419,6 @@ struct scsi_inquiry_pattern { struct scsibus_attach_args { struct scsi_link *saa_sc_link; - u_int16_t saa_targets; - u_int16_t saa_luns; }; /* @@ -435,8 +433,7 @@ 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_targets; - u_int16_t sc_luns; + u_int16_t sc_buswidth; }; /* |