sc_link.adapter_buswidth, set to 16 if wide scsi. if 0 it gets converted
authorderaadt <deraadt@openbsd.org>
Wed, 15 Jan 1997 05:50:27 +0000 (05:50 +0000)
committerderaadt <deraadt@openbsd.org>
Wed, 15 Jan 1997 05:50:27 +0000 (05:50 +0000)
to 8 internally so that drivers do not need to init it for regular scsi :-)

sys/dev/ic/aic7xxx.c
sys/dev/pci/ncr.c
sys/scsi/scsiconf.c
sys/scsi/scsiconf.h

index bbc7d26..ec8a51f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: aic7xxx.c,v 1.14 1996/11/28 23:27:43 niklas Exp $     */
+/*     $OpenBSD: aic7xxx.c,v 1.15 1997/01/15 05:50:38 deraadt Exp $    */
 /*     $NetBSD: aic7xxx.c,v 1.17 1996/10/21 22:34:04 thorpej Exp $     */
 
 /*
@@ -651,6 +651,10 @@ ahc_attach(ahc)
        ahc->sc_link.fordriver = 0;
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
        ahc->sc_link.adapter_target = ahc->our_id;
+#ifdef __OpenBSD__
+       if(ahc->type & AHC_WIDE)
+               ahc->sc_link.adapter_buswidth = 16;
+#endif
 #ifndef __OpenBSD__
        ahc->sc_link.channel = 0;
 #endif
@@ -674,6 +678,10 @@ ahc_attach(ahc)
                ahc->sc_link_b.fordriver = (void *)SELBUSB;
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
                ahc->sc_link_b.adapter_target = ahc->our_id_b;
+#ifdef __OpenBSD__
+               if(ahc->type & AHC_WIDE)
+                       ahc->sc_link.adapter_buswidth = 16;
+#endif
 #ifndef __OpenBSD__
                ahc->sc_link_b.channel = 1;
 #endif
index 6f0659f..cf627ac 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ncr.c,v 1.22 1996/11/30 23:04:38 downsj Exp $ */
+/*     $OpenBSD: ncr.c,v 1.23 1997/01/15 05:50:44 deraadt Exp $        */
 /*     $NetBSD: ncr.c,v 1.48 1996/10/25 21:33:33 cgd Exp $     */
 
 /**************************************************************************
@@ -3640,6 +3640,7 @@ static    void ncr_attach (pcici_t config_id, int unit)
 #if defined(__NetBSD__) || defined(__OpenBSD__)
        np->sc_link.adapter_softc = np;
        np->sc_link.adapter_target = np->myaddr;
+       np->sc_link.adapter_buswidth = MAX_TARGET;
        np->sc_link.openings = 1;
 #ifndef __OpenBSD__
        np->sc_link.channel      = SCSI_CHANNEL_ONLY_ONE;
index 1a50875..d308fd0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: scsiconf.c,v 1.19 1996/11/28 13:20:37 niklas Exp $    */
+/*     $OpenBSD: scsiconf.c,v 1.20 1997/01/15 05:50:27 deraadt Exp $   */
 /*     $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $       */
 
 /*
@@ -122,10 +122,28 @@ scsibusattach(parent, self, aux)
 {
        struct scsibus_softc *sb = (struct scsibus_softc *)self;
        struct scsi_link *sc_link_proto = aux;
+       int nbytes, i;
 
        sc_link_proto->scsibus = sb->sc_dev.dv_unit;
        sb->adapter_link = sc_link_proto;
-       printf("\n");
+       if (sb->adapter_link->adapter_buswidth == 0)
+               sb->adapter_link->adapter_buswidth = 8;
+       sb->sc_buswidth = sb->adapter_link->adapter_buswidth;
+
+       printf(": %d targets\n", sb->sc_buswidth);
+
+       nbytes = sb->sc_buswidth * sizeof(struct scsi_link **);
+       sb->sc_link = (struct scsi_link ***)malloc(nbytes, M_DEVBUF, M_NOWAIT);
+       if (sb->sc_link == NULL)
+               panic("scsibusattach: can't allocate target links");
+       nbytes = 8 * sizeof(struct scsi_link *);
+       for (i = 0; i <= sb->sc_buswidth; i++) {
+               sb->sc_link[i] = (struct scsi_link **)malloc(nbytes,
+                   M_DEVBUF, M_NOWAIT);
+               if (sb->sc_link[i] == NULL)
+                       panic("scsibusattach: can't allocate lun links");
+               bzero(sb->sc_link[i], nbytes);
+       }
 
 #if defined(SCSI_DELAY) && SCSI_DELAY > 2
        printf("%s: waiting for scsi devices to settle\n",
@@ -196,10 +214,11 @@ scsi_probe_bus(bus, target, lun)
        scsi_addr = scsi->adapter_link->adapter_target;
 
        if (target == -1) {
-               maxtarget = 7;
+               maxtarget = scsi->adapter_link->adapter_buswidth - 1;
                mintarget = 0;
        } else {
-               if (target < 0 || target > 7)
+               if (target < 0 ||
+                   target >= scsi->adapter_link->adapter_buswidth)
                        return EINVAL;
                maxtarget = mintarget = target;
        }
index e6e6a01..4e00d0b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: scsiconf.h,v 1.8 1996/10/31 01:09:25 niklas Exp $     */
+/*     $OpenBSD: scsiconf.h,v 1.9 1997/01/15 05:50:29 deraadt Exp $    */
 /*     $NetBSD: scsiconf.h,v 1.29 1996/03/19 03:07:50 mycroft Exp $    */
 
 /*
@@ -139,6 +139,7 @@ struct scsi_link {
        u_int8_t target;                /* targ of this dev */
        u_int8_t lun;                   /* lun of this dev */
        u_int8_t adapter_target;        /* what are we on the scsi bus */
+       u_int8_t adapter_buswidth;      /* 8 (regular) or 16 (wide). (0 becomes 8) */
        u_int8_t openings;              /* available operations */
        u_int8_t active;                /* operations in progress */
        u_int16_t flags;                /* flags that all devices have */
@@ -184,8 +185,9 @@ struct scsi_inquiry_pattern {
 struct scsibus_softc {
        struct device sc_dev;
        struct scsi_link *adapter_link;         /* prototype supplied by adapter */
-       struct scsi_link *sc_link[8][8];
+       struct scsi_link ***sc_link;
        u_int8_t moreluns;
+       u_int8_t sc_buswidth;
 };
 
 /*