summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>2000-05-30 01:08:23 +0000
committeraugustss <augustss@NetBSD.org>2000-05-30 01:08:23 +0000
commit997c3c5b8a0b568d601a19d6e18b897e073c8aeb (patch)
tree54bd0a19606e07e2cca6792810a028d28359f6fc /sys/dev
parented26506c25d1482c3e5e4a4a3dc33dce34fef6af (diff)
Add a quirk, SDEV_ONLYBIG, which implies that the device cannot handle
the 6 byte versions of READ, WRITE, and MODE_SENSE. This greatly simplifies the UFI (USB Floppy) handling.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/scsipi/cd.c5
-rw-r--r--sys/dev/scsipi/scsipiconf.h3
-rw-r--r--sys/dev/scsipi/sd.c5
-rw-r--r--sys/dev/scsipi/sd_scsi.c29
4 files changed, 29 insertions, 13 deletions
diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c
index 1132b3355ba..5d132b4cecf 100644
--- a/sys/dev/scsipi/cd.c
+++ b/sys/dev/scsipi/cd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.139 2000/05/16 05:45:52 thorpej Exp $ */
+/* $NetBSD: cd.c,v 1.140 2000/05/30 01:08:23 augustss Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -661,7 +661,8 @@ cdstart(v)
* fit in a "small" cdb, use it.
*/
if (((bp->b_rawblkno & 0x1fffff) == bp->b_rawblkno) &&
- ((nblks & 0xff) == nblks) && sc_link->type == BUS_SCSI) {
+ ((nblks & 0xff) == nblks) && sc_link->type == BUS_SCSI &&
+ !(sc_link->quirks & SDEV_ONLYBIG)) {
/*
* We can fit in a small cdb.
*/
diff --git a/sys/dev/scsipi/scsipiconf.h b/sys/dev/scsipi/scsipiconf.h
index b1c4fd45506..ec7205cbde9 100644
--- a/sys/dev/scsipi/scsipiconf.h
+++ b/sys/dev/scsipi/scsipiconf.h
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipiconf.h,v 1.41 2000/05/29 20:13:06 bouyer Exp $ */
+/* $NetBSD: scsipiconf.h,v 1.42 2000/05/30 01:08:24 augustss Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -207,6 +207,7 @@ struct scsipi_link {
#define ADEV_NOTUR 0x1000 /* no TEST_UNIT_READY command */
#define ADEV_NODOORLOCK 0x2000 /* device can't lock door */
#define ADEV_NOSENSE 0x4000 /* device can't handle request sense */
+#define SDEV_ONLYBIG 0x8000 /* only use SCSI_{READ,WRITE}_BIG */
struct scsipi_device *device; /* device entry points etc. */
void *device_softc; /* needed for call to foo_start */
diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c
index 35944a56646..e614cebc095 100644
--- a/sys/dev/scsipi/sd.c
+++ b/sys/dev/scsipi/sd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.161 2000/05/23 10:20:14 bouyer Exp $ */
+/* $NetBSD: sd.c,v 1.162 2000/05/30 01:08:25 augustss Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -718,7 +718,8 @@ sdstart(v)
* fit in a "small" cdb, use it.
*/
if (((bp->b_rawblkno & 0x1fffff) == bp->b_rawblkno) &&
- ((nblks & 0xff) == nblks) && sc_link->type == BUS_SCSI) {
+ ((nblks & 0xff) == nblks) && sc_link->type == BUS_SCSI &&
+ !(sc_link->quirks & SDEV_ONLYBIG)) {
/*
* We can fit in a small cdb.
*/
diff --git a/sys/dev/scsipi/sd_scsi.c b/sys/dev/scsipi/sd_scsi.c
index bc037ce21b3..45890140c55 100644
--- a/sys/dev/scsipi/sd_scsi.c
+++ b/sys/dev/scsipi/sd_scsi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sd_scsi.c,v 1.12 2000/03/29 03:43:32 simonb Exp $ */
+/* $NetBSD: sd_scsi.c,v 1.13 2000/05/30 01:08:25 augustss Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -160,7 +160,10 @@ sd_scsibus_mode_sense(sd, scsipi_sense, page, flags)
struct sd_scsibus_mode_sense_data *scsipi_sense;
int page, flags;
{
- struct scsi_mode_sense scsipi_cmd;
+ struct scsi_mode_sense sense_cmd;
+ struct scsi_mode_sense_big sensebig_cmd;
+ struct scsipi_generic *cmd;
+ int len;
/*
* Make sure the sense buffer is clean before we do
@@ -169,17 +172,27 @@ sd_scsibus_mode_sense(sd, scsipi_sense, page, flags)
*/
bzero(scsipi_sense, sizeof(*scsipi_sense));
- bzero(&scsipi_cmd, sizeof(scsipi_cmd));
- scsipi_cmd.opcode = SCSI_MODE_SENSE;
- scsipi_cmd.page = page;
- scsipi_cmd.length = 0x20;
+ if (sd->sc_link->quirks & SDEV_ONLYBIG) {
+ memset(&sensebig_cmd, 0, sizeof(sensebig_cmd));
+ sensebig_cmd.opcode = SCSI_MODE_SENSE_BIG;
+ sensebig_cmd.page = page;
+ _lto2b(0x20, sensebig_cmd.length);
+ cmd = (struct scsipi_generic *)&sensebig_cmd;
+ len = sizeof(sensebig_cmd);
+ } else {
+ memset(&sense_cmd, 0, sizeof(sense_cmd));
+ sense_cmd.opcode = SCSI_MODE_SENSE;
+ sense_cmd.page = page;
+ sense_cmd.length = 0x20;
+ cmd = (struct scsipi_generic *)&sense_cmd;
+ len = sizeof(sense_cmd);
+ }
/*
* If the command worked, use the results to fill out
* the parameter structure
*/
return (scsipi_command(sd->sc_link,
- (struct scsipi_generic *)&scsipi_cmd, sizeof(scsipi_cmd),
- (u_char *)scsipi_sense, sizeof(*scsipi_sense),
+ cmd, len, (u_char *)scsipi_sense, sizeof(*scsipi_sense),
SDRETRIES, 6000, NULL, flags | XS_CTL_DATA_IN | XS_CTL_SILENT));
}