summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-15 05:50:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-15 05:50:45 +0000
commitdb62dea4a0e7fe4ea1cd296e357d0154db4a280f (patch)
tree844ce5eb80eca4c1b915a028d777c50f6a93afb6 /sys/scsi
parent38a0537c79c088049ded09e18103dfbdd179f900 (diff)
sc_link.adapter_buswidth, set to 16 if wide scsi. if 0 it gets converted
to 8 internally so that drivers do not need to init it for regular scsi :-)
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsiconf.c27
-rw-r--r--sys/scsi/scsiconf.h6
2 files changed, 27 insertions, 6 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 1a50875ccc7..d308fd0ec53 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -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;
}
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index e6e6a01042a..4e00d0b5383 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -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;
};
/*