diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-11-08 18:18:42 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-11-08 18:18:42 +0000 |
commit | 4f14cc69ba971941b32eddc685568fa3a2e80471 (patch) | |
tree | 06a7a1e55affa9f7f74911ed67728cd5fb2b834a /sys/dev/ic/ncr53c9x.c | |
parent | 12982205255a286aa9949676295d37663d6559ed (diff) |
ncr53c9x (a.k.a. esp on sparc64) does not like 16-byte SCSI commands
such as READ_CAPACITY_16. So plugging SCSI-3 devices onto such a bus
can be problematic.
Cap the acceptable xs->cmdlen at 12 in ncr53c9x.c.
Problem noted and fix tested by Kurt Mosiejczuk. Thanks! Diff mostly
from miod@ with kibitzing from me.
ok miod@
Diffstat (limited to 'sys/dev/ic/ncr53c9x.c')
-rw-r--r-- | sys/dev/ic/ncr53c9x.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 1b71cb673fe..7cbef588576 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9x.c,v 1.51 2011/08/29 17:25:28 miod Exp $ */ +/* $OpenBSD: ncr53c9x.c,v 1.52 2011/11/08 18:18:41 krw Exp $ */ /* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */ /* @@ -802,6 +802,21 @@ ncr53c9x_scsi_cmd(xs) NCR_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, sc_link->target)); + /* + * Commands larger than 12 bytes seem to confuse the chip + * (at least on FAS366 flavours). + */ + if (xs->cmdlen > 12) { + memset(&xs->sense, 0, sizeof(xs->sense)); + /* sense data borrowed from gdt(4) */ + xs->sense.error_code = SSD_ERRCODE_VALID | SSD_ERRCODE_CURRENT; + xs->sense.flags = SKEY_ILLEGAL_REQUEST; + xs->sense.add_sense_code = 0x20; /* illcmd */ + xs->error = XS_SENSE; + scsi_done(xs); + return; + } + flags = xs->flags; ti = &sc->sc_tinfo[sc_link->target]; li = TINFO_LUN(ti, lun); |