From af98e47ac496ec0d5f53f22a08c6ed052b86265e Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Fri, 16 May 2003 19:54:06 +0000 Subject: Provide most if not all the support required for the usb changes Nate is trying to bring in. 1) Change name of SDEV_NOCDB6 to SDEV_ONLYBIG to align it with the same quirk in NetBSD, and make it more clear what it is trying to do. i.e. force the use of READ_BIG/WRITE_BIG commands, not suppress all use of 6 byte CDB's. 2) Check SDEV_ONLYBIG in cd.c as well as sd.c. i.e. both places where a choice is made to use the 6 or 10 byte versions of READ/WRITE. 3) Actually make use of the ADEV_NOTUR (No TEST UNIT READY) quirk to suppress the emission of TEST UNIT READY commands. 4) Add some explanatory comments from NetBSD to scsiconf.h so that the use of the quirks is made clear. ok miod@ tdeval@ nate@ --- sys/scsi/cd.c | 3 ++- sys/scsi/scsi_base.c | 5 ++++- sys/scsi/scsiconf.c | 4 ++-- sys/scsi/scsiconf.h | 10 +++++----- sys/scsi/sd.c | 6 +++--- 5 files changed, 16 insertions(+), 12 deletions(-) (limited to 'sys/scsi') diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index e7ce0a29e3b..b4536cb5994 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.68 2003/04/06 03:02:44 krw Exp $ */ +/* $OpenBSD: cd.c,v 1.69 2003/05/16 19:54:05 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -667,6 +667,7 @@ cdstart(v) * fit in a "small" cdb, use it. */ if (!(sc_link->flags & SDEV_ATAPI) && + !(sc_link->quirks & SDEV_ONLYBIG) && ((blkno & 0x1fffff) == blkno) && ((nblks & 0xff) == nblks)) { /* diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 370cbac2d0e..d934526eeaf 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.41 2003/05/03 02:20:32 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.42 2003/05/16 19:54:05 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -254,6 +254,9 @@ scsi_test_unit_ready(sc_link, retries, flags) { struct scsi_test_unit_ready scsi_cmd; + if (sc_link->quirks & ADEV_NOTUR) + return 0; + bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.opcode = TEST_UNIT_READY; diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index dabdb3f2ef2..d8a20be3509 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.70 2002/12/30 21:50:28 grange Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.71 2003/05/16 19:54:05 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -502,7 +502,7 @@ struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = { {{T_DIRECT, T_FIXED, "NEC ", "D3847 ", "0307"}, SDEV_NOLUNS}, {{T_DIRECT, T_REMOV, - "OLYMPUS ", "C-", ""}, SDEV_NOCDB6|SDEV_NOSYNCCACHE}, + "OLYMPUS ", "C-", ""}, SDEV_ONLYBIG|SDEV_NOSYNCCACHE}, {{T_DIRECT, T_FIXED, "QUANTUM ", "ELS85S ", ""}, SDEV_AUTOSAVE}, {{T_DIRECT, T_FIXED, diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 9b1342fe8f9..c34f2b8de00 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.37 2003/02/20 04:02:06 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.38 2003/05/16 19:54:05 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -182,10 +182,10 @@ struct scsi_link { #define SDEV_NOSYNCCACHE 0x0100 /* no SYNCHRONIZE_CACHE */ #define ADEV_NOSENSE 0x0200 /* No request sense - ATAPI */ #define ADEV_LITTLETOC 0x0400 /* little-endian TOC - ATAPI */ -#define ADEV_NOCAPACITY 0x0800 -#define ADEV_NOTUR 0x1000 -#define ADEV_NODOORLOCK 0x2000 -#define SDEV_NOCDB6 0x4000 /* does not support 6 byte CDB */ +#define ADEV_NOCAPACITY 0x0800 /* no READ CD CAPACITY */ +#define ADEV_NOTUR 0x1000 /* No TEST UNIT READY */ +#define ADEV_NODOORLOCK 0x2000 /* can't lock door */ +#define SDEV_ONLYBIG 0x4000 /* always use READ_BIG and WRITE_BIG */ u_int8_t inquiry_flags; /* copy of flags from probe INQUIRY */ u_int8_t inquiry_flags2; /* copy of flags2 from probe INQUIRY */ struct scsi_device *device; /* device entry points etc. */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 36f3ed0d773..f43397976e3 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.58 2003/05/06 11:40:34 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.59 2003/05/16 19:54:05 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -202,7 +202,7 @@ sdattach(parent, self, aux) } if (!(sc_link->inquiry_flags & SID_RelAdr)) - sc_link->quirks |= SDEV_NOCDB6; + sc_link->quirks |= SDEV_ONLYBIG; /* * Note if this device is ancient. This is used in sdminphys(). @@ -699,7 +699,7 @@ sdstart(v) * fit in a "small" cdb, use it. */ if (!(sc_link->flags & SDEV_ATAPI) && - !(sc_link->quirks & SDEV_NOCDB6) && + !(sc_link->quirks & SDEV_ONLYBIG) && ((blkno & 0x1fffff) == blkno) && ((nblks & 0xff) == nblks)) { /* -- cgit v1.2.3