diff options
Diffstat (limited to 'sys')
31 files changed, 126 insertions, 125 deletions
diff --git a/sys/arch/mac68k/dev/ncr5380.c b/sys/arch/mac68k/dev/ncr5380.c index 1bf683c46ba..a7dc3f974c9 100644 --- a/sys/arch/mac68k/dev/ncr5380.c +++ b/sys/arch/mac68k/dev/ncr5380.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380.c,v 1.42 2011/07/05 20:34:45 matthew Exp $ */ +/* $OpenBSD: ncr5380.c,v 1.43 2011/07/17 22:46:47 matthew Exp $ */ /* $NetBSD: ncr5380.c,v 1.38 1996/12/19 21:48:18 scottr Exp $ */ /* @@ -409,7 +409,7 @@ ncr5380_show_scsi_cmd(struct scsi_xfer *xs) int i = 0; if (!(xs->flags & SCSI_RESET)) { - printf("(%d:%d:%d,0x%x)-", xs->sc_link->bus->sc_dev.dv_unit, + printf("(%d:%d:%d,0x%x)-", xs->sc_link->scsibus, xs->sc_link->target, xs->sc_link->lun, xs->sc_link->flags); while (i < xs->cmdlen) { if (i) @@ -419,8 +419,8 @@ ncr5380_show_scsi_cmd(struct scsi_xfer *xs) printf("-\n"); } else { - printf("(%d:%d:%d)-RESET-\n", xs->sc_link->bus->sc_dev.dv_unit, - xs->sc_link->target, xs->sc_link->lun); + printf("(%d:%d:%d)-RESET-\n", + xs->sc_link->scsibus,xs->sc_link->target, xs->sc_link->lun); } } diff --git a/sys/arch/mvme68k/dev/vsbic.c b/sys/arch/mvme68k/dev/vsbic.c index f1387d69e8d..615d834b7f3 100644 --- a/sys/arch/mvme68k/dev/vsbic.c +++ b/sys/arch/mvme68k/dev/vsbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbic.c,v 1.7 2011/07/08 22:09:26 matthew Exp $ */ +/* $OpenBSD: vsbic.c,v 1.8 2011/07/17 22:46:47 matthew Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -537,13 +537,13 @@ vsbic_attach(struct device *parent, struct device *self, void *args) vmeintr_establish(sc->sc_vec, &sc->sc_ih, DEVNAME(sc)); sc->sc_link.adapter = &vsbic_swtch; + sc->sc_link.adapter_buswidth = 8; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = sc->sc_id; sc->sc_link.openings = VSBIC_NUMOPENINGS; bzero(&saa, sizeof saa); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = 8; tmp = bootpart; if (ca->ca_paddr != bootaddr) diff --git a/sys/arch/mvme88k/dev/vsbic.c b/sys/arch/mvme88k/dev/vsbic.c index 985ca0ff60a..e9b8826cff0 100644 --- a/sys/arch/mvme88k/dev/vsbic.c +++ b/sys/arch/mvme88k/dev/vsbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbic.c,v 1.8 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: vsbic.c,v 1.9 2011/07/17 22:46:47 matthew Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -537,13 +537,13 @@ vsbic_attach(struct device *parent, struct device *self, void *args) vmeintr_establish(sc->sc_vec, &sc->sc_ih, DEVNAME(sc)); sc->sc_link.adapter = &vsbic_swtch; + sc->sc_link.adapter_buswidth = 8; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = sc->sc_id; sc->sc_link.openings = VSBIC_NUMOPENINGS; bzero(&saa, sizeof saa); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = 8; tmp = bootpart; if (ca->ca_paddr != bootaddr) diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c index d3adc1e0faf..be7af5a9ef8 100644 --- a/sys/arch/sparc64/dev/vdsk.c +++ b/sys/arch/sparc64/dev/vdsk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsk.c,v 1.28 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: vdsk.c,v 1.29 2011/07/17 22:46:47 matthew Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis * @@ -342,13 +342,13 @@ vdsk_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter = &sc->sc_switch; sc->sc_link.adapter_softc = self; + sc->sc_link.adapter_buswidth = 2; + sc->sc_link.luns = 1; /* XXX slices should be presented as luns? */ sc->sc_link.adapter_target = 2; sc->sc_link.openings = sc->sc_vd->vd_nentries - 1; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = 2; - saa.saa_luns = 1; /* XXX slices should be presented as luns? */ config_found(self, &saa, scsiprint); return; diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 8c31f13c07e..1fab3995104 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.113 2011/07/16 16:48:42 matthew Exp $ */ +/* $OpenBSD: autoconf.c,v 1.114 2011/07/17 22:46:47 matthew Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -1361,8 +1361,11 @@ device_register(struct device *dev, void *aux) } if (strcmp(devname, "scsibus") == 0) { + struct scsibus_attach_args *saa = aux; + struct scsi_link *sl = saa->saa_sc_link; + if (strcmp(bp->name, "fp") == 0 && - bp->val[0] == dev->dv_unit) { + bp->val[0] == sl->scsibus) { DPRINTF(ACDB_BOOTDEV, ("\t-- matched component %s to %s\n", bp->name, dev->dv_xname)); bootpath_store(1, bp + 1); diff --git a/sys/arch/vax/dec/sii.c b/sys/arch/vax/dec/sii.c index 1a7a801d547..75cd717b15c 100644 --- a/sys/arch/vax/dec/sii.c +++ b/sys/arch/vax/dec/sii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sii.c,v 1.12 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: sii.c,v 1.13 2011/07/17 22:46:47 matthew Exp $ */ /* $NetBSD: sii.c,v 1.42 2000/06/02 20:20:29 mhitch Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -198,6 +198,7 @@ sii_attach(sc) * fill in the prototype scsi_link. */ sc->sc_link.adapter = &sii_scsiswitch; + sc->sc_link.adapter_buswidth = 8; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = sc->sc_regs->id & SII_IDMSK; sc->sc_link.openings = 1; /* driver can't queue requests yet */ @@ -207,7 +208,6 @@ sii_attach(sc) */ bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = 8; config_found(&sc->sc_dev, &saa, scsiprint); } diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index c38319d5eaa..ba958774044 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.114 2011/07/09 06:24:41 dlg Exp $ */ +/* $OpenBSD: atascsi.c,v 1.115 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -50,7 +50,6 @@ struct atascsi { struct scsi_link as_link; struct scsibus_softc *as_scsibus; - int as_nports; int as_capability; int as_ncqdepth; }; @@ -180,7 +179,6 @@ atascsi_attach(struct device *self, struct atascsi_attach_args *aaa) as->as_cookie = aaa->aaa_cookie; as->as_methods = aaa->aaa_methods; as->as_capability = aaa->aaa_capability; - as->as_nports = aaa->aaa_nports; as->as_ncqdepth = aaa->aaa_ncmds; /* copy from template and modify for ourselves */ @@ -191,16 +189,16 @@ atascsi_attach(struct device *self, struct atascsi_attach_args *aaa) /* fill in our scsi_link */ as->as_link.adapter = &as->as_switch; as->as_link.adapter_softc = as; - as->as_link.adapter_target = SCSI_NO_ADAPTER_TARGET; + as->as_link.adapter_buswidth = aaa->aaa_nports; + as->as_link.luns = SATA_PMP_MAX_PORTS; + as->as_link.adapter_target = aaa->aaa_nports; as->as_link.openings = 1; as->as_host_ports = malloc(sizeof(struct atascsi_host_port *) * - as->as_nports, M_DEVBUF, M_WAITOK | M_ZERO); + aaa->aaa_nports, M_DEVBUF, M_WAITOK | M_ZERO); bzero(&saa, sizeof(saa)); saa.saa_sc_link = &as->as_link; - saa.saa_targets = as->as_nports; - saa.saa_luns = SATA_PMP_MAX_PORTS; /* stash the scsibus so we can do hotplug on it */ as->as_scsibus = (struct scsibus_softc *)config_found(self, &saa, @@ -250,7 +248,7 @@ atascsi_lookup_port(struct scsi_link *link) struct atascsi *as = link->adapter_softc; struct atascsi_host_port *ahp; - if (link->target >= as->as_nports) + if (link->target >= as->as_link.adapter_buswidth) return (NULL); ahp = as->as_host_ports[link->target]; @@ -273,7 +271,7 @@ atascsi_probe(struct scsi_link *link) u_int16_t cmdset; port = link->target; - if (port >= as->as_nports) + if (port >= as->as_link.adapter_buswidth) return (ENXIO); /* if this is a PMP port, check it's valid */ @@ -455,7 +453,7 @@ atascsi_free(struct scsi_link *link) int port; port = link->target; - if (port >= as->as_nports) + if (port >= as->as_link.adapter_buswidth) return; ahp = as->as_host_ports[port]; diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index 5e9026a8f02..4a0129d3abe 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.98 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.99 2011/07/17 22:46:48 matthew Exp $ */ /* * This code is derived from code with the copyright below. @@ -232,7 +232,9 @@ atapiscsi_attach(parent, self, aux) as->drive = drvp->drive; as->sc_adapterlink.adapter_softc = as; as->sc_adapterlink.adapter_target = 7; + as->sc_adapterlink.adapter_buswidth = 2; as->sc_adapterlink.adapter = &atapiscsi_switch; + as->sc_adapterlink.luns = 1; as->sc_adapterlink.openings = 1; as->sc_adapterlink.flags = SDEV_ATAPI; @@ -270,8 +272,6 @@ atapiscsi_attach(parent, self, aux) bzero(&saa, sizeof(saa)); saa.saa_sc_link = &as->sc_adapterlink; - saa.saa_targets = 2; - saa.saa_luns = 1; child = config_found((struct device *)as, &saa, scsiprint); diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index f1ea04f3dfd..61d936b7bca 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.53 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: aac.c,v 1.54 2011/07/17 22:46:48 matthew Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -263,11 +263,11 @@ aac_attach(struct aac_softc *sc) sc->aac_link.adapter = &aac_switch; sc->aac_link.openings = (sc->total_fibs - 8) / (sc->aac_container_count ? sc->aac_container_count : 1); + sc->aac_link.adapter_buswidth = AAC_MAX_CONTAINERS; sc->aac_link.adapter_target = AAC_MAX_CONTAINERS; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->aac_link; - saa.saa_targets = AAC_MAX_CONTAINERS; config_found(&sc->aac_dev, &saa, scsiprint); diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c index a184700170b..4c34513eaf6 100644 --- a/sys/dev/ic/aic7xxx_openbsd.c +++ b/sys/dev/ic/aic7xxx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.c,v 1.50 2011/07/05 22:40:57 matthew Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.c,v 1.51 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -94,7 +94,6 @@ ahc_attach(struct ahc_softc *ahc) /* Configure the second scsi bus */ ahc->sc_channel_b = ahc->sc_channel; ahc->sc_channel_b.adapter_target = ahc->our_id_b; - ahc->sc_channel_b.flags |= SDEV_2NDBUS; } #ifndef DEBUG @@ -112,25 +111,22 @@ ahc_attach(struct ahc_softc *ahc) if ((ahc->features & AHC_TWIN) && ahc->flags & AHC_RESET_BUS_B) ahc_reset_channel(ahc, 'B', TRUE); + bzero(&saa, sizeof(saa)); if ((ahc->flags & AHC_PRIMARY_CHANNEL) == 0) { - bzero(&saa, sizeof(saa)); saa.saa_sc_link = &ahc->sc_channel; ahc->sc_child = config_found((void *)&ahc->sc_dev, &saa, scsiprint); if (ahc->features & AHC_TWIN) { - bzero(&saa, sizeof(saa)); saa.saa_sc_link = &ahc->sc_channel_b; ahc->sc_child_b = config_found((void *)&ahc->sc_dev, &saa, scsiprint); } } else { if (ahc->features & AHC_TWIN) { - bzero(&saa, sizeof(saa)); saa.saa_sc_link = &ahc->sc_channel_b; ahc->sc_child = config_found((void *)&ahc->sc_dev, &saa, scsiprint); } - bzero(&saa, sizeof(saa)); saa.saa_sc_link = &ahc->sc_channel; ahc->sc_child_b = config_found((void *)&ahc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/ic/aic7xxx_openbsd.h b/sys/dev/ic/aic7xxx_openbsd.h index 1da78a530d7..bc1848f13c1 100644 --- a/sys/dev/ic/aic7xxx_openbsd.h +++ b/sys/dev/ic/aic7xxx_openbsd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.h,v 1.20 2011/07/04 22:17:23 matthew Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.h,v 1.21 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -88,7 +88,7 @@ /****************************** Platform Macros *******************************/ #define SCSI_IS_SCSIBUS_B(ahc, sc_link) \ - (((sc_link)->flags & SDEV_2NDBUS) != 0) + ((sc_link)->scsibus == (ahc)->sc_channel_b.scsibus) #define SCSI_SCSI_ID(ahc, sc_link) \ (SCSI_IS_SCSIBUS_B(ahc, sc_link) ? ahc->our_id_b : ahc->our_id) #define SCSI_CHANNEL(ahc, sc_link) \ diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index e064130404b..8eed13e4c4b 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.219 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: ami.c,v 1.220 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -520,6 +520,7 @@ ami_attach(struct ami_softc *sc) sc->sc_link.adapter_softc = sc; sc->sc_link.adapter = &ami_switch; sc->sc_link.adapter_target = sc->sc_maxunits; + sc->sc_link.adapter_buswidth = sc->sc_maxunits; sc->sc_link.pool = &sc->sc_iopool; #ifdef AMI_DEBUG @@ -545,7 +546,6 @@ ami_attach(struct ami_softc *sc) bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = sc->sc_maxunits; config_found(&sc->sc_dev, &saa, scsiprint); @@ -587,11 +587,11 @@ ami_attach(struct ami_softc *sc) rsc->sc_proctarget = -1; /* TODO fetch it from the controller */ rsc->sc_link.adapter_target = 16; + rsc->sc_link.adapter_buswidth = 16; rsc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &rsc->sc_link; - saa.saa_targets = 16; ptbus = (struct scsibus_softc *)config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index feafb207806..95fdb91694f 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.47 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: cac.c,v 1.48 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -245,6 +245,7 @@ cac_init(struct cac_softc *sc, int startfw) sc->sc_link.adapter_softc = sc; sc->sc_link.adapter = &cac_switch; sc->sc_link.adapter_target = cinfo.num_drvs; + sc->sc_link.adapter_buswidth = cinfo.num_drvs; sc->sc_link.openings = CAC_MAX_CCBS / sc->sc_nunits; if (sc->sc_link.openings < 4 ) sc->sc_link.openings = 4; @@ -252,7 +253,6 @@ cac_init(struct cac_softc *sc, int startfw) bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = cinfo.num_drvs; config_found(&sc->sc_dv, &saa, scsiprint); diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index 987b4142a36..80e1226c55e 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciss.c,v 1.65 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: ciss.c,v 1.66 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2005,2006 Michael Shalayeff @@ -366,12 +366,12 @@ ciss_attach(struct ciss_softc *sc) sc->sc_link.adapter_softc = sc; sc->sc_link.openings = sc->maxcmd; sc->sc_link.adapter = &ciss_switch; + sc->sc_link.luns = 1; sc->sc_link.adapter_target = sc->maxunits; + sc->sc_link.adapter_buswidth = sc->maxunits; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = sc->maxunits; - saa.saa_luns = 1; scsibus = (struct scsibus_softc *)config_found_sm(&sc->sc_dev, &saa, scsiprint, NULL); diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index 77233069b0f..4c168be0c6b 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.59 2011/07/09 01:50:41 matthew Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.60 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved. @@ -156,7 +156,9 @@ gdt_attach(struct gdt_softc *sc) sc->sc_link.adapter_softc = sc; sc->sc_link.adapter = &gdt_switch; /* openings will be filled in later. */ - sc->sc_link.adapter_target = SCSI_NO_ADAPTER_TARGET; + sc->sc_link.adapter_buswidth = + (sc->sc_class & GDT_FC) ? GDT_MAXID : GDT_MAX_HDRIVES; + sc->sc_link.adapter_target = sc->sc_link.adapter_buswidth; sc->sc_link.pool = &sc->sc_iopool; if (!gdt_internal_cmd(sc, GDT_SCREENSERVICE, GDT_INIT, 0, 0, 0)) { @@ -478,7 +480,6 @@ gdt_attach(struct gdt_softc *sc) bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = (sc->sc_class & GDT_FC) ? GDT_MAXID : GDT_MAX_HDRIVES; config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index b65534d939c..ef68f444187 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.120 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: mfi.c,v 1.121 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -746,11 +746,11 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop) sc->sc_link.adapter_softc = sc; sc->sc_link.adapter = &mfi_switch; sc->sc_link.adapter_target = MFI_MAX_LD; + sc->sc_link.adapter_buswidth = sc->sc_max_ld; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = sc->sc_max_ld; config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 75fec2e2334..b4d244fd00f 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.173 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: mpi.c,v 1.174 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org> @@ -344,12 +344,12 @@ mpi_attach(struct mpi_softc *sc) sc->sc_link.adapter = &mpi_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = sc->sc_target; + sc->sc_link.adapter_buswidth = sc->sc_buswidth; sc->sc_link.openings = sc->sc_maxcmds / sc->sc_buswidth; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = sc->sc_buswidth; /* config_found() returns the scsibus attached to us */ sc->sc_scsibus = (struct scsibus_softc *) config_found(&sc->sc_dev, diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index c59614dbf76..984727c6410 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380sbc.c,v 1.29 2011/07/05 20:34:45 matthew Exp $ */ +/* $OpenBSD: ncr5380sbc.c,v 1.30 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: ncr5380sbc.c,v 1.13 1996/10/13 01:37:25 christos Exp $ */ /* @@ -2433,7 +2433,7 @@ ncr5380_show_scsi_cmd(xs) if ( ! ( xs->flags & SCSI_RESET ) ) { printf("si(%d:%d:%d)-", - xs->sc_link->bus->sc_dev.dv_unit, xs->sc_link->target, + xs->sc_link->scsibus, xs->sc_link->target, xs->sc_link->lun); while (i < xs->cmdlen) { if (i) printf(","); @@ -2442,7 +2442,7 @@ ncr5380_show_scsi_cmd(xs) printf("-\n"); } else { printf("si(%d:%d:%d)-RESET-\n", - xs->sc_link->bus->sc_dev.dv_unit, xs->sc_link->target, + xs->sc_link->scsibus, xs->sc_link->target, xs->sc_link->lun); } } diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c index 4570f86570d..d1aca481b44 100644 --- a/sys/dev/ic/twe.c +++ b/sys/dev/ic/twe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe.c,v 1.40 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: twe.c,v 1.41 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved. @@ -400,11 +400,11 @@ twe_attach(sc) sc->sc_link.adapter = &twe_switch; sc->sc_link.adapter_target = TWE_MAX_UNITS; sc->sc_link.openings = TWE_MAXCMDS / nunits; + sc->sc_link.adapter_buswidth = TWE_MAX_UNITS; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = TWE_MAX_UNITS; config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c index 3f884066ac5..1c2e1084109 100644 --- a/sys/dev/pci/ahc_pci.c +++ b/sys/dev/pci/ahc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahc_pci.c,v 1.54 2011/07/04 22:17:23 matthew Exp $ */ +/* $OpenBSD: ahc_pci.c,v 1.55 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: ahc_pci.c,v 1.43 2003/08/18 09:16:22 taca Exp $ */ /* @@ -42,7 +42,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: ahc_pci.c,v 1.54 2011/07/04 22:17:23 matthew Exp $ + * $Id: ahc_pci.c,v 1.55 2011/07/17 22:46:48 matthew Exp $ * * //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $ * @@ -737,6 +737,12 @@ ahc_pci_attach(parent, self, aux) for (i = 0; i < AHC_NUM_TARGETS; i++) TAILQ_INIT(&ahc->untagged_queues[i]); + /* + * SCSI_IS_SCSIBUS_B() must returns false until sc_channel_b + * has been properly initialized. XXX Breaks if >254 scsi buses. + */ + ahc->sc_channel_b.scsibus = 0xff; + ahc->dev_softc = pa; ahc_set_name(ahc, ahc->sc_dev.dv_xname); diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index 0c4752483a2..67f55c1c8f7 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.94 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: arc.c,v 1.95 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -597,12 +597,12 @@ arc_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter = &arc_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = ARC_MAX_TARGET; + sc->sc_link.adapter_buswidth = ARC_MAX_TARGET; sc->sc_link.openings = sc->sc_req_count; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = ARC_MAX_TARGET; child = config_found(self, &saa, scsiprint); sc->sc_scsibus = (struct scsibus_softc *)child; diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index fec6b481191..11582a6bc9e 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.107 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: ips.c,v 1.108 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org> @@ -732,17 +732,18 @@ ips_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_nunits > 0) sc->sc_scsi_link.openings = sc->sc_nccbs / sc->sc_nunits; sc->sc_scsi_link.adapter_target = sc->sc_nunits; + sc->sc_scsi_link.adapter_buswidth = sc->sc_nunits; sc->sc_scsi_link.adapter = &ips_scsi_adapter; sc->sc_scsi_link.adapter_softc = sc; sc->sc_scsi_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_scsi_link; - saa.saa_targets = sc->sc_nunits; sc->sc_scsibus = (struct scsibus_softc *)config_found(self, &saa, scsiprint); /* For each channel attach SCSI pass-through bus */ + bzero(&saa, sizeof(saa)); for (i = 0; i < IPS_MAXCHANS; i++) { struct ips_pt *pt; struct scsi_link *link; @@ -780,7 +781,6 @@ ips_attach(struct device *parent, struct device *self, void *aux) link->adapter_softc = pt; link->pool = &sc->sc_iopool; - bzero(&saa, sizeof(saa)); saa.saa_sc_link = link; config_found(self, &saa, scsiprint); } diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index 1e227a6ae65..e103676120d 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpii.c,v 1.44 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: mpii.c,v 1.45 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru> * Copyright (c) 2009 James Giannoules @@ -2246,13 +2246,13 @@ mpii_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter = &mpii_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = -1; + sc->sc_link.adapter_buswidth = sc->sc_max_devices; + sc->sc_link.luns = 1; sc->sc_link.openings = sc->sc_request_depth - 1; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = sc->sc_max_devices; - saa.saa_luns = 1; /* config_found() returns the scsibus attached to us */ sc->sc_scsibus = (struct scsibus_softc *) config_found(&sc->sc_dev, diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c index 74b262a6101..b27f5d45086 100644 --- a/sys/dev/sdmmc/sdmmc_scsi.c +++ b/sys/dev/sdmmc/sdmmc_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_scsi.c,v 1.29 2011/07/09 02:11:29 matthew Exp $ */ +/* $OpenBSD: sdmmc_scsi.c,v 1.30 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -33,7 +33,8 @@ #include <dev/sdmmc/sdmmc_scsi.h> #include <dev/sdmmc/sdmmcvar.h> -#define SDMMC_SCSIID_MAX 0x10 +#define SDMMC_SCSIID_HOST 0x00 +#define SDMMC_SCSIID_MAX 0x0f #define SDMMC_SCSI_MAXCMDS 8 @@ -104,15 +105,15 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc) scbus = malloc(sizeof *scbus, M_DEVBUF, M_WAITOK | M_ZERO); scbus->sc_tgt = malloc(sizeof(*scbus->sc_tgt) * - SDMMC_SCSIID_MAX, M_DEVBUF, M_WAITOK | M_ZERO); + (SDMMC_SCSIID_MAX+1), M_DEVBUF, M_WAITOK | M_ZERO); /* * Each card that sent us a CID in the identification stage - * gets a SCSI ID, whether it is a memory card or not. + * gets a SCSI ID > 0, whether it is a memory card or not. */ - scbus->sc_ntargets = 0; + scbus->sc_ntargets = 1; SIMPLEQ_FOREACH(sf, &sc->sf_head, sf_list) { - if (scbus->sc_ntargets >= SDMMC_SCSIID_MAX) + if (scbus->sc_ntargets >= SDMMC_SCSIID_MAX+1) break; scbus->sc_tgt[scbus->sc_ntargets].card = sf; scbus->sc_ntargets++; @@ -129,18 +130,18 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc) scbus->sc_adapter.scsi_cmd = sdmmc_scsi_cmd; scbus->sc_adapter.scsi_minphys = sdmmc_scsi_minphys; - scbus->sc_link.adapter_target = SCSI_NO_ADAPTER_TARGET; + scbus->sc_link.adapter_target = SDMMC_SCSIID_HOST; + scbus->sc_link.adapter_buswidth = scbus->sc_ntargets; scbus->sc_link.adapter_softc = sc; + scbus->sc_link.luns = 1; scbus->sc_link.openings = 1; scbus->sc_link.adapter = &scbus->sc_adapter; scbus->sc_link.pool = &scbus->sc_iopool; bzero(&saa, sizeof(saa)); - saa.saa.saa_sc_link = &scbus->sc_link; - saa.saa.saa_targets = scbus->sc_ntargets; - saa.saa.saa_luns = 1; + saa.scsi_link = &scbus->sc_link; - scbus->sc_child = config_found(&sc->sc_dev, &saa.saa, scsiprint); + scbus->sc_child = config_found(&sc->sc_dev, &saa, scsiprint); if (scbus->sc_child == NULL) { printf("%s: can't attach scsibus\n", sc->sc_dev.dv_xname); goto free_ccbs; diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h index a3960a09f47..2c1542dd84b 100644 --- a/sys/dev/sdmmc/sdmmcvar.h +++ b/sys/dev/sdmmc/sdmmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcvar.h,v 1.19 2011/07/09 00:39:29 matthew Exp $ */ +/* $OpenBSD: sdmmcvar.h,v 1.20 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -182,7 +182,7 @@ struct sdmmc_softc { * Attach devices at the sdmmc bus. */ struct sdmmc_attach_args { - struct scsibus_attach_args saa; /* XXX */ + struct scsi_link *scsi_link; /* XXX */ struct sdmmc_function *sf; }; diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index fd6cb8514fd..a59f5ef5c73 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.244 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: softraid.c,v 1.245 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -1662,11 +1662,11 @@ sr_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter_softc = sc; sc->sc_link.adapter = &sr_switch; sc->sc_link.adapter_target = SR_MAX_LD; + sc->sc_link.adapter_buswidth = SR_MAX_LD; + sc->sc_link.luns = 1; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = SR_MAX_LD; - saa.saa_luns = 1; sc->sc_scsibus = (struct scsibus_softc *)config_found(&sc->sc_dev, &saa, scsiprint); diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index 83adb2e768b..beb1624f4ff 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.37 2011/07/09 04:37:53 matthew Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.38 2011/07/17 22:46:48 matthew Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -62,7 +62,8 @@ struct umass_scsi_softc { }; -#define UMASS_SCSIID_DEVICE 0x00 +#define UMASS_SCSIID_HOST 0x00 +#define UMASS_SCSIID_DEVICE 0x01 int umass_scsi_probe(struct scsi_link *); void umass_scsi_cmd(struct scsi_xfer *); @@ -90,14 +91,13 @@ umass_scsi_attach(struct umass_softc *sc) struct umass_scsi_softc *scbus; scbus = umass_scsi_setup(sc); - scbus->sc_link.adapter_target = SCSI_NO_ADAPTER_TARGET; + scbus->sc_link.adapter_target = UMASS_SCSIID_HOST; + scbus->sc_link.luns = sc->maxlun + 1; scbus->sc_link.flags &= ~SDEV_ATAPI; scbus->sc_link.flags |= SDEV_UMASS; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &scbus->sc_link; - saa.saa_targets = 1; - saa.saa_luns = sc->maxlun + 1; DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: SCSI\n" "sc = 0x%x, scbus = 0x%x\n", @@ -119,14 +119,13 @@ umass_atapi_attach(struct umass_softc *sc) struct umass_scsi_softc *scbus; scbus = umass_scsi_setup(sc); - scbus->sc_link.adapter_target = SCSI_NO_ADAPTER_TARGET; + scbus->sc_link.adapter_target = UMASS_SCSIID_HOST; + scbus->sc_link.luns = 1; scbus->sc_link.openings = 1; scbus->sc_link.flags |= SDEV_ATAPI; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &scbus->sc_link; - saa.saa_targets = 1; - saa.saa_luns = 1; DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n" "sc = 0x%x, scbus = 0x%x\n", @@ -153,6 +152,7 @@ umass_scsi_setup(struct umass_softc *sc) scsi_iopool_init(&scbus->sc_iopool, scbus, umass_io_get, umass_io_put); /* Fill in the link. */ + scbus->sc_link.adapter_buswidth = 2; scbus->sc_link.adapter = &umass_scsi_switch; scbus->sc_link.adapter_softc = sc; scbus->sc_link.openings = 1; diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index 369d7a9e3e7..3da371c1636 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.25 2011/07/08 22:09:27 matthew Exp $ */ +/* $OpenBSD: vscsi.c,v 1.26 2011/07/17 22:46:48 matthew Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -150,12 +150,12 @@ vscsi_attach(struct device *parent, struct device *self, void *aux) sc->sc_link.adapter = &vscsi_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = 256; + sc->sc_link.adapter_buswidth = 256; sc->sc_link.openings = 1; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - saa.saa_targets = 256; sc->sc_scsibus = (struct scsibus_softc *)config_found(&sc->sc_dev, &saa, scsiprint); 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; }; /* |