summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1995-08-23 23:03:17 +0000
committergibbs <gibbs@FreeBSD.org>1995-08-23 23:03:17 +0000
commit11e9122e645e253373e8b159fc45d1a53fc1ac4d (patch)
treed4f4128d9a2be93d2523b7ac739321140029f64f
parente56598df10ebf9b657775ea75c5aec0758d42faa (diff)
downloadFreeBSD-src-11e9122e645e253373e8b159fc45d1a53fc1ac4d.zip
FreeBSD-src-11e9122e645e253373e8b159fc45d1a53fc1ac4d.tar.gz
Remove hard coded assumption that SCSI busses have 7 targets.
Change some leading spaces to tabs. This change forces the controller drivers to allocate a scsibus_data struct via a call to scsi_alloc_bus(), fill in the adapter_link field, and optionally modify any other fields of the struct. Scsi_alloc_bus() initializes all fields to the default, so the changes in most drivers are very minimal. For drivers that support Wide controllers, the maxtarg field will have to be updated to allow probing of all targets (for an example, look at the aic7xxx driver). Scsi_attachdevs() now takes a scsibus_data* as its argument instead of an sc_link*. This allows us to expand the role of the scsibus_data struct for other bus level configuration setings (max number of transactions, current transaction opennings, etc for better tagged queuing support). Reviewed by: Rodney Grimes <rgrimes>, Peter Dufault <dufault>, Julian Elischer <julian>
-rw-r--r--sys/i386/scsi/aic7xxx.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/sys/i386/scsi/aic7xxx.c b/sys/i386/scsi/aic7xxx.c
index 930cd74..db66bfb 100644
--- a/sys/i386/scsi/aic7xxx.c
+++ b/sys/i386/scsi/aic7xxx.c
@@ -24,7 +24,7 @@
*
* commenced: Sun Sep 27 18:14:01 PDT 1992
*
- * $Id: aic7xxx.c,v 1.35 1995/08/14 08:29:15 gibbs Exp $
+ * $Id: aic7xxx.c,v 1.36 1995/08/15 08:54:21 gibbs Exp $
*/
/*
* TODO:
@@ -870,34 +870,54 @@ int
ahc_attach(unit)
int unit;
{
- struct ahc_data *ahc = ahcdata[unit];
+ struct ahc_data *ahc = ahcdata[unit];
+ struct scsibus_data *scbus;
- /*
- * fill in the prototype scsi_link.
- */
- ahc->sc_link.adapter_unit = unit;
- ahc->sc_link.adapter_targ = ahc->our_id;
- ahc->sc_link.adapter = &ahc_switch;
+ /*
+ * fill in the prototype scsi_link.
+ */
+ ahc->sc_link.adapter_unit = unit;
+ ahc->sc_link.adapter_targ = ahc->our_id;
+ ahc->sc_link.adapter = &ahc_switch;
ahc->sc_link.opennings = 2;
- ahc->sc_link.device = &ahc_dev;
+ ahc->sc_link.device = &ahc_dev;
ahc->sc_link.flags = DEBUGLEVEL;
ahc->sc_link.fordriver = 0;
- /*
- * ask the adapter what subunits are present
- */
+ /*
+ * Prepare the scsibus_data area for the upperlevel
+ * scsi code.
+ */
+ scbus = scsi_alloc_bus();
+ if(!scbus)
+ return 0;
+ scbus->adapter_link = &ahc->sc_link;
+ if(ahc->type & AHC_WIDE)
+ scbus->maxtarg = 15;
+
+ /*
+ * ask the adapter what subunits are present
+ */
printf("ahc%d: Probing channel A\n", unit);
- scsi_attachdevs(&(ahc->sc_link));
+ scsi_attachdevs(scbus);
+ scbus = NULL; /* Upper-level SCSI code owns this now */
if(ahc->type & AHC_TWIN) {
/* Configure the second scsi bus */
ahc->sc_link_b = ahc->sc_link;
- ahc->sc_link_b.adapter_targ = ahc->our_id_b;
- ahc->sc_link_b.adapter_bus = 1;
+ ahc->sc_link_b.adapter_targ = ahc->our_id_b;
+ ahc->sc_link_b.adapter_bus = 1;
ahc->sc_link_b.fordriver = (void *)SELBUSB;
+ scbus = scsi_alloc_bus();
+ if(!scbus)
+ return 0;
+ scbus->adapter_link = &ahc->sc_link_b;
+ if(ahc->type & AHC_WIDE)
+ scbus->maxtarg = 15;
printf("ahc%d: Probing Channel B\n", unit);
- scsi_attachdevs(&(ahc->sc_link_b));
+ scsi_attachdevs(scbus);
+ scbus = NULL; /* Upper-level SCSI code owns this now */
}
- return 1;
+ return 1;
}
void
OpenPOWER on IntegriCloud