summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authordavidb <davidb@NetBSD.org>1993-12-20 23:27:28 +0000
committerdavidb <davidb@NetBSD.org>1993-12-20 23:27:28 +0000
commitddefd2e1b816da7908afddf8cc0b64721a6e8797 (patch)
treecc7a52bf206f5ad24b5cbffcb8f984cbc7d17a2a /sys/dev
parent77342edbf3c2bc13f378c919969cf474244fb0a9 (diff)
Fixed bug where with two or more SCSI controllers of the same type, you
could not have devices at the same ID on each bus. This patch not directly applicable to magnum branch, which is using Julian's new SCSI code.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/eisa/aha1742.c30
-rw-r--r--sys/dev/isa/aha1542.c29
-rw-r--r--sys/dev/isa/bt742a.c31
-rw-r--r--sys/dev/isa/ultra14f.c30
-rw-r--r--sys/dev/isa/wd7000.c28
5 files changed, 91 insertions, 57 deletions
diff --git a/sys/dev/eisa/aha1742.c b/sys/dev/eisa/aha1742.c
index fa5690134af..53ccc860af6 100644
--- a/sys/dev/eisa/aha1742.c
+++ b/sys/dev/eisa/aha1742.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: aha1742.c,v 1.15 1993/12/20 09:05:24 mycroft Exp $
+ * $Id: aha1742.c,v 1.16 1993/12/20 23:27:33 davidb Exp $
*/
#include "ahb.h"
@@ -298,16 +298,7 @@ struct isa_driver ahbdriver = {
"ahb"
};
-struct scsi_switch ahb_switch = {
- "ahb",
- ahb_scsi_cmd,
- ahbminphys,
- 0,
- 0,
- ahb_adapter_info,
- 0, 0, 0
-};
-
+struct scsi_switch ahb_switch[NAHB];
/*
* Function to send a command out through a mailbox
@@ -460,10 +451,25 @@ int
ahb_attach(struct isa_device *dev)
{
static int firsttime;
+ static int firstswitch[NAHB];
int masunit = dev->id_masunit;
int r;
- r = scsi_attach(masunit, ahb_data[masunit].our_id, &ahb_switch,
+ if (!firstswitch[masunit]) {
+ firstswitch[masunit] = 1;
+ ahb_switch[masunit].name = "ahb";
+ ahb_switch[masunit].scsi_cmd = ahb_scsi_cmd;
+ ahb_switch[masunit].scsi_minphys = ahbminphys;
+ ahb_switch[masunit].open_target_lu = 0;
+ ahb_switch[masunit].close_target_lu = 0;
+ ahb_switch[masunit].adapter_info = ahb_adapter_info;
+ for (r = 0; r < 8; r++) {
+ ahb_switch[masunit].empty[r] = 0;
+ ahb_switch[masunit].used[r] = 0;
+ ahb_switch[masunit].printed[r] = 0;
+ }
+ }
+ r = scsi_attach(masunit, ahb_data[masunit].our_id, &ahb_switch[masunit],
&dev->id_physid, &dev->id_unit, dev->id_flags);
/* only one for all boards */
diff --git a/sys/dev/isa/aha1542.c b/sys/dev/isa/aha1542.c
index 17cfbf42fa7..13ecb6ac2b8 100644
--- a/sys/dev/isa/aha1542.c
+++ b/sys/dev/isa/aha1542.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: aha1542.c,v 1.15 1993/12/20 09:05:17 mycroft Exp $
+ * $Id: aha1542.c,v 1.16 1993/12/20 23:27:28 davidb Exp $
*/
/*
@@ -315,15 +315,7 @@ struct isa_driver ahadriver = {
"aha"
};
-struct scsi_switch aha_switch = {
- "aha",
- aha_scsi_cmd,
- ahaminphys,
- 0,
- 0,
- aha_adapter_info,
- 0, 0, 0
-};
+struct scsi_switch aha_switch[NAHA];
/*
* aha_cmd(unit, icnt, ocnt,wait, retval, ...)
@@ -485,17 +477,32 @@ int
ahaattach(struct isa_device *dev)
{
static int firsttime;
+ static int firstswitch[NAHA];
static u_long speedprint; /* max 32 aha controllers */
int masunit = dev->id_masunit;
int r;
+ if (!firstswitch[masunit]) {
+ firstswitch[masunit] = 1;
+ aha_switch[masunit].name = "aha";
+ aha_switch[masunit].scsi_cmd = aha_scsi_cmd;
+ aha_switch[masunit].scsi_minphys = ahaminphys;
+ aha_switch[masunit].open_target_lu = 0;
+ aha_switch[masunit].close_target_lu = 0;
+ aha_switch[masunit].adapter_info = aha_adapter_info;
+ for (r = 0; r < 8; r++) {
+ aha_switch[masunit].empty[r] = 0;
+ aha_switch[masunit].used[r] = 0;
+ aha_switch[masunit].printed[r] = 0;
+ }
+ }
if(!(speedprint & (1<<masunit))) {
DELAY(1000000);
speedprint |= (1<<masunit);
printf("aha%d: bus speed %dns\n", masunit, speed[masunit]);
}
- r = scsi_attach(masunit, aha_scsi_dev[masunit], &aha_switch,
+ r = scsi_attach(masunit, aha_scsi_dev[masunit], &aha_switch[masunit],
&dev->id_physid, &dev->id_unit, dev->id_flags);
/* only one for all boards */
diff --git a/sys/dev/isa/bt742a.c b/sys/dev/isa/bt742a.c
index 5d434a5c79d..64030722d2e 100644
--- a/sys/dev/isa/bt742a.c
+++ b/sys/dev/isa/bt742a.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: bt742a.c,v 1.10 1993/12/20 09:05:27 mycroft Exp $
+ * $Id: bt742a.c,v 1.11 1993/12/20 23:27:36 davidb Exp $
*/
/*
@@ -388,16 +388,8 @@ int bt_timeout();
void btminphys();
long int bt_adapter_info();
-struct scsi_switch bt_switch =
-{
- "bt",
- bt_scsi_cmd,
- btminphys,
- 0,
- 0,
- bt_adapter_info,
- 0,0,0
-};
+struct scsi_switch bt_switch[NBT];
+
#define BT_CMD_TIMEOUT_FUDGE 200 /* multiplied to get Secs */
#define BT_RESET_TIMEOUT 1000000
#define BT_SCSI_TIMEOUT_FUDGE 20 /* divided by for mSecs */
@@ -607,10 +599,25 @@ btattach(dev)
struct isa_dev *dev;
{
static int firsttime;
+ static int firstswitch[NBT];
int masunit = dev->id_masunit;
int r;
- r = scsi_attach(masunit, bt_scsi_dev[masunit], &bt_switch,
+ if (!firstswitch[masunit]) {
+ firstswitch[masunit] = 1;
+ bt_switch[masunit].name = "bt";
+ bt_switch[masunit].scsi_cmd = bt_scsi_cmd;
+ bt_switch[masunit].scsi_minphys = btminphys;
+ bt_switch[masunit].open_target_lu = 0;
+ bt_switch[masunit].close_target_lu = 0;
+ bt_switch[masunit].adapter_info = bt_adapter_info;
+ for (r = 0; r < 8; r++) {
+ bt_switch[masunit].empty[r] = 0;
+ bt_switch[masunit].used[r] = 0;
+ bt_switch[masunit].printed[r] = 0;
+ }
+ }
+ r = scsi_attach(masunit, bt_scsi_dev[masunit], &bt_switch[masunit],
&dev->id_physid, &dev->id_unit, dev->id_flags);
/* only one for all boards */
diff --git a/sys/dev/isa/ultra14f.c b/sys/dev/isa/ultra14f.c
index 5c7b170b51b..577e7b774c3 100644
--- a/sys/dev/isa/ultra14f.c
+++ b/sys/dev/isa/ultra14f.c
@@ -15,7 +15,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: ultra14f.c,v 1.15 1993/12/20 09:06:46 mycroft Exp $
+ * $Id: ultra14f.c,v 1.16 1993/12/20 23:27:39 davidb Exp $
*/
#include <sys/types.h>
@@ -291,16 +291,7 @@ int uha_debug = 0;
#define SUCCESS 0
#define PAGESIZ 4096
-struct scsi_switch uha_switch =
-{
- "uha",
- uha_scsi_cmd,
- uhaminphys,
- 0,
- 0,
- uha_adapter_info,
- 0,0,0
-};
+struct scsi_switch uha_switch[NUHA];
/* */
/***********************************************************************\
@@ -438,10 +429,25 @@ uha_attach(dev)
struct isa_dev *dev;
{
static int firsttime;
+ static int firstswitch[NUHA];
int masunit = dev->id_masunit;
int r;
- r = scsi_attach(masunit, uha_data[masunit].our_id, &uha_switch,
+ if (!firstswitch[masunit]) {
+ firstswitch[masunit] = 1;
+ uha_switch[masunit].name = "uha";
+ uha_switch[masunit].scsi_cmd = uha_scsi_cmd;
+ uha_switch[masunit].scsi_minphys = uhaminphys;
+ uha_switch[masunit].open_target_lu = 0;
+ uha_switch[masunit].close_target_lu = 0;
+ uha_switch[masunit].adapter_info = uha_adapter_info;
+ for (r = 0; r < 8; r++) {
+ uha_switch[masunit].empty[r] = 0;
+ uha_switch[masunit].used[r] = 0;
+ uha_switch[masunit].printed[r] = 0;
+ }
+ }
+ r = scsi_attach(masunit, uha_data[masunit].our_id, &uha_switch[masunit],
&dev->id_physid, &dev->id_unit, dev->id_flags);
/* only one for all boards */
diff --git a/sys/dev/isa/wd7000.c b/sys/dev/isa/wd7000.c
index 859835a5ae0..02aa13ac505 100644
--- a/sys/dev/isa/wd7000.c
+++ b/sys/dev/isa/wd7000.c
@@ -16,7 +16,7 @@
* scatter gather is done by the board, then look at one of the Adaptec
* drivers to finish off the job..
*
- * $Id: wd7000.c,v 1.8 1993/12/20 09:06:55 mycroft Exp $
+ * $Id: wd7000.c,v 1.9 1993/12/20 23:27:40 davidb Exp $
*/
#include "wds.h"
#if NWDS > 0
@@ -176,14 +176,7 @@ int wds_cmd(u_short, u_char *, int);
void wds_wait(int, int, int);
-struct scsi_switch wds_switch = {
- "wds",
- wds_scsi_cmd,
- wds_minphys,
- 0, 0,
- wds_adapter_info,
- 0, 0, 0,
-};
+struct scsi_switch wds_switch[NWDS];
struct isa_driver wdsdriver = {
wdsprobe,
@@ -584,6 +577,7 @@ int
wdsattach(struct isa_device *dev)
{
int masunit = dev->id_masunit;
+ static int firstswitch[NWDS];
static u_long versprobe /* max 32 controllers */
int r;
@@ -593,7 +587,21 @@ wdsattach(struct isa_device *dev)
printf("wds%d: getvers failed\n", masunit);
}
- r = scsi_attach(masunit, wds[masunit].devs, &wds_switch,
+ if (!firstswitch[masunit]) {
+ firstswitch[masunit] = 1;
+ wds_switch[masunit].name = "wds";
+ wds_switch[masunit].scsi_cmd = wds_scsi_cmd;
+ wds_switch[masunit].scsi_minphys = wdsminphys;
+ wds_switch[masunit].open_target_lu = 0;
+ wds_switch[masunit].close_target_lu = 0;
+ wds_switch[masunit].adapter_info = wds_adapter_info;
+ for (r = 0; r < 8; r++) {
+ wds_switch[masunit].empty[r] = 0;
+ wds_switch[masunit].used[r] = 0;
+ wds_switch[masunit].printed[r] = 0;
+ }
+ }
+ r = scsi_attach(masunit, wds[masunit].devs, &wds_switch[masunit],
&dev->id_physid, &dev->id_unit, dev->id_flags);
return r;
}