Subject: SCSI device driver problem
To: None <tech-kern@netbsd.org>
From: Andy Doran <ad@netbsd.org>
List: tech-kern
Date: 09/27/1999 22:10:27
Hi. I'm having a problem with a SCSI device driver that I've written. Apart
from this annoyance, it seems rock solid:
scsibus0 at dpt0 channel 0: 8 targets, 8 luns per target
sd0 at scsibus0 targ 0 lun 0: <SEAGATE, ST32151N, 0094> SCSI2 0/direct fixed
sd0: 2049 MB, 4177 cyl, 8 head, 125 sec, 512 bytes/sect x 4197402 sectors
probe(dpt0:0:1): Check Condition on CDB: 0x12 20 00 00 2c 00
SENSE KEY: Illegal Request
ASC/ASCQ: Logical Unit Not Supported
I've tried a Jaz drive and it provokes the same thing. The HBA in question
is a DPT board: I feel it may be something the HBA is doing, since the it
has to screw with every command to provide cacheing and RAID. Teaching
scsipi that it should be quiet about 'Logical Unit Not Supported' while
probing solves the problem (at least visually). I'm not sure this is the
right thing to do though. Diffs below.
Any comments or suggestions would be appreciated.
- ad
Index: scsiconf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.127
diff -u -r1.127 scsiconf.c
--- scsiconf.c 1999/09/19 23:45:28 1.127
+++ scsiconf.c 1999/09/27 21:11:54
@@ -701,7 +701,7 @@
/* Now go ask the device all about itself. */
bzero(&inqbuf, sizeof(inqbuf));
- if (scsipi_inquire(sc_link, &inqbuf, SCSI_AUTOCONF) != 0)
+ if (scsipi_inquire(sc_link, &inqbuf, SCSI_AUTOCONF | SCSI_PROBE) != 0)
goto bad;
{
Index: scsipi_base.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsipi_base.c,v
retrieving revision 1.23
diff -u -r1.23 scsipi_base.c
--- scsipi_base.c 1999/09/11 21:39:53 1.23
+++ scsipi_base.c 1999/09/27 21:11:58
@@ -318,6 +318,14 @@
return (0);
if ((xs->flags & SCSI_SILENT) != 0)
return (EIO);
+ /*
+ * If we're probing and the device indicates LUNs
+ * aren't supported, shut up about it.
+ */
+ if ((xs->flags & SCSI_PROBE) != 0 &&
+ sense->add_sense_code == 0x25 &&
+ sense->add_sense_code_qual == 0x00)
+ return (EINVAL);
error = EINVAL;
break;
case SKEY_UNIT_ATTENTION:
Index: scsipiconf.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/scsipiconf.h,v
retrieving revision 1.31
diff -u -r1.31 scsipiconf.h
--- scsipiconf.h 1999/09/11 21:39:53 1.31
+++ scsipiconf.h 1999/09/27 21:11:59
@@ -304,6 +304,7 @@
#define SCSI_TARGET 0x2000 /* This defines a TARGET mode op. */
#define SCSI_ESCAPE 0x4000 /* Escape operation */
#define SCSI_URGENT 0x8000 /* Urgent operation (e.g., HTAG) */
+#define SCSI_PROBE 0x1000000 /* We are probing the target */
/* 0x00ff0000 reserved for ATAPI. */
/*