summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/umass_scsi.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2004-07-21 07:43:41 +0000
committerdlg <dlg@openbsd.org>2004-07-21 07:43:41 +0000
commitf04d6d19a881642b331e3cbe77c562cff0fb281e (patch)
treebddfe89c247c658935108a5c26a48fe6f3a9dd62 /sys/dev/usb/umass_scsi.c
parentneed to include bsd.own.mk here (diff)
downloadwireguard-openbsd-f04d6d19a881642b331e3cbe77c562cff0fb281e.tar.xz
wireguard-openbsd-f04d6d19a881642b331e3cbe77c562cff0fb281e.zip
from netbsd, umass.c 1.100 1.113 1.115, umass_scsipi.c 1.11, umassvar.h 1.21
log message for umass 1.98, umass_scsipi.c 1.11, umassvar.h 1.21: Fix several problems with CCI handling, and enable it: * We were never calling the callback function when we got a UFI CCI(!). * We were passing a bogus residual count on non-UFI CCIs. * After a REQUEST SENSE, the UFI CCI may include the ASC/ASCQ from the sense information -- don't consider this a failure. In addition, remove a horrible hack that was causing us to drop sense information on the floor and return empty INQUIRY responses, often in the case where there is a UNIT ATTENTION pending during the INQUIRY. (Some drives send the data and then fail, some don't.) log message for umass.c 1.113: Do not return STATUS_WIRE_FAILED in response to a CBI stall. This is perfectly normal, and is used to report errors. Instead, use STATUS_CMD_FAILED, which causes us to do a REQUEST SENSE. Should address PR 22960. log message for umass.c 1.115: Do not do a CBI reset before returning STATUS_CMD_FAILED. This causes any sense information to be thrown away, and is therefore nonsensical. ok krw@
Diffstat (limited to 'sys/dev/usb/umass_scsi.c')
-rw-r--r--sys/dev/usb/umass_scsi.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c
index f7b3a8a6203..0b5b38c85de 100644
--- a/sys/dev/usb/umass_scsi.c
+++ b/sys/dev/usb/umass_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umass_scsi.c,v 1.7 2004/02/21 00:47:42 krw Exp $ */
+/* $OpenBSD: umass_scsi.c,v 1.8 2004/07/21 07:43:41 dlg Exp $ */
/* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -356,6 +356,7 @@ umass_scsi_cb(struct umass_softc *sc, void *priv, int residue, int status)
DPRINTF(UDMASS_CMD, ("umass_scsi_cb: status cmd failed for "
"scsi op 0x%02x\n", xs->cmd->opcode));
/* fetch sense data */
+ sc->sc_sense = 1;
memset(&scbus->sc_sense_cmd, 0, sizeof(scbus->sc_sense_cmd));
scbus->sc_sense_cmd.opcode = REQUEST_SENSE;
scbus->sc_sense_cmd.byte2 = link->lun << SCSI_CMD_LUN_SHIFT;
@@ -405,20 +406,11 @@ umass_scsi_sense_cb(struct umass_softc *sc, void *priv, int residue,
DPRINTF(UDMASS_CMD,("umass_scsi_sense_cb: xs=%p residue=%d "
"status=%d\n", xs, residue, status));
+ sc->sc_sense = 0;
switch (status) {
case STATUS_CMD_OK:
case STATUS_CMD_UNKNOWN:
/* getting sense data succeeded */
- if (xs->cmd->opcode == INQUIRY && (xs->resid < xs->datalen ||
- (sc->sc_quirks & UMASS_QUIRK_RS_NO_CLEAR_UA /* XXX */))) {
- /*
- * Some drivers return SENSE errors even after INQUIRY.
- * The upper layer doesn't like that.
- */
- xs->error = XS_NOERROR;
- break;
- }
- /* XXX look at residue */
if (residue == 0 || residue == 14)/* XXX */
xs->error = XS_SENSE;
else