From 4f14cc69ba971941b32eddc685568fa3a2e80471 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Tue, 8 Nov 2011 18:18:42 +0000 Subject: 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@ --- sys/dev/ic/ncr53c9x.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sys/dev/ic/ncr53c9x.c') 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); -- cgit v1.2.3