summaryrefslogtreecommitdiff
path: root/sys/dev/ic/siop.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-07-01 00:02:09 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-07-01 00:02:09 +0000
commitd16282218a85e4493457adc269ddcaafd1ce9d92 (patch)
treebd9df525dee968d4b0bcb06fbfb5432fd122d426 /sys/dev/ic/siop.c
parent287ef2e00a84c7ab5fac3202f4e04a937a61fdd0 (diff)
If the adapter card needs to keep track of its own id on the bus, or
the width of the bus it is providing, it should rely on info in its softc. i.e. not on info in the prototype scsi_link that is passed out for other bits of the kernel to fiddle with. Most drivers already do this. Make it so for the laggards iha(4) and siop(4). Actually use the existing softc value in wd33c93.c. No intentional functional change.
Diffstat (limited to 'sys/dev/ic/siop.c')
-rw-r--r--sys/dev/ic/siop.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c
index a15ce0e608c..e841ce574ea 100644
--- a/sys/dev/ic/siop.c
+++ b/sys/dev/ic/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.77 2020/06/27 17:28:58 krw Exp $ */
+/* $OpenBSD: siop.c,v 1.78 2020/07/01 00:02:08 krw Exp $ */
/* $NetBSD: siop.c,v 1.79 2005/11/18 23:10:32 bouyer Exp $ */
/*
@@ -222,7 +222,7 @@ void
siop_reset(sc)
struct siop_softc *sc;
{
- int i, j;
+ int i, j, buswidth;
struct siop_lunsw *lunsw;
siop_common_reset(&sc->sc_c);
@@ -298,7 +298,8 @@ siop_reset(sc)
}
TAILQ_INIT(&sc->lunsw_list);
/* restore reselect switch */
- for (i = 0; i < sc->sc_c.sc_link.adapter_buswidth; i++) {
+ buswidth = (sc->sc_c.features & SF_BUS_WIDE) ? 16 : 8;
+ for (i = 0; i < buswidth; i++) {
struct siop_target *target;
if (sc->sc_c.targets[i] == NULL)
continue;
@@ -1258,7 +1259,7 @@ siop_handle_reset(sc)
struct cmd_list reset_list;
struct siop_cmd *siop_cmd, *next_siop_cmd;
struct siop_lun *siop_lun;
- int target, lun, tag;
+ int target, lun, tag, buswidth;
/*
* scsi bus reset. reset the chip and restart
* the queue. Need to clean up all active commands
@@ -1270,8 +1271,8 @@ siop_handle_reset(sc)
/*
* Process all commands: first commands being executed
*/
- for (target = 0; target < sc->sc_c.sc_link.adapter_buswidth;
- target++) {
+ buswidth = (sc->sc_c.features & SF_BUS_WIDE) ? 16 : 8;
+ for (target = 0; target < buswidth; target++) {
if (sc->sc_c.targets[target] == NULL)
continue;
for (lun = 0; lun < 8; lun++) {
@@ -2076,7 +2077,7 @@ siop_add_dev(sc, target, lun)
struct siop_target *siop_target =
(struct siop_target *)sc->sc_c.targets[target];
struct siop_lun *siop_lun = siop_target->siop_lun[lun];
- int i, ntargets;
+ int i, ntargets, buswidth;
if (siop_lun->reseloff > 0)
return;
@@ -2093,7 +2094,8 @@ siop_add_dev(sc, target, lun)
return;
}
/* count how many free targets we still have to probe */
- ntargets = (sc->sc_c.sc_link.adapter_buswidth - 1) - 1 - sc->sc_ntargets;
+ buswidth = (sc->sc_c.features & SF_BUS_WIDE) ? 16 : 8;
+ ntargets = (buswidth - 1) - 1 - sc->sc_ntargets;
/*
* we need 8 bytes for the lun sw additional entry, and