diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-05-24 06:21:45 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-05-24 06:21:45 +0000 |
commit | d60346bb423a606a6913cec591c32e57b6c9430c (patch) | |
tree | fac6f9f466a55a083142521a4891b736eb2019a6 /sys/dev/usb/umass.c | |
parent | 285e264ade22002eaddaafc4b84537cb1b8e8685 (diff) |
Angelos' Fuji camera is an 8070i device and it only accepts 12 byte CDBs.
I'm going to guess that ATAPI and QIC157 devices also want 12-byte CDBs.
So, pad CDBs to be 12 bytes for ATAPI, QIC157, 8070i (as well as UFI devices)
Also, remove an overly paranoid check in BBB state machine which
actually violates the spec. This is half of getting Angelos' Olympus
camera to work. The other half involves a semi-violent rewrite of the
sd scsi driver to make it more tolerant.
Diffstat (limited to 'sys/dev/usb/umass.c')
-rw-r--r-- | sys/dev/usb/umass.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 1b214cd72ed..4f64a171dd6 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.10 2001/02/24 00:06:32 mickey Exp $ */ +/* $OpenBSD: umass.c,v 1.11 2001/05/24 06:21:44 csapuntz Exp $ */ /* $NetBSD: umass.c,v 1.49 2001/01/21 18:56:38 augustss Exp $ */ /*- * Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>, @@ -193,6 +193,7 @@ int umassdebug = 0; /* Generic definitions */ #define UFI_COMMAND_LENGTH 12 +#define ATAPI_COMMAND_LENGTH 12 /* Direction for umass_*_transfer */ #define DIR_NONE 0 @@ -1786,7 +1787,9 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, panic("%s: transferred %d bytes instead of %d bytes\n", USBDEVNAME(sc->sc_dev), sc->transfer_actlen, sc->transfer_datalen); - } else if (sc->transfer_datalen - sc->transfer_actlen + } +#if 0 + else if (sc->transfer_datalen - sc->transfer_actlen != UGETDW(sc->csw.dCSWDataResidue)) { DPRINTF(UDMASS_BBB, ("%s: actlen=%d != residue=%d\n", USBDEVNAME(sc->sc_dev), @@ -1796,7 +1799,9 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, umass_bbb_reset(sc, STATUS_WIRE_FAILED); return; - } else if (sc->csw.bCSWStatus == CSWSTATUS_FAILED) { + } +#endif + else if (sc->csw.bCSWStatus == CSWSTATUS_FAILED) { DPRINTF(UDMASS_BBB, ("%s: Command Failed, res = %d\n", USBDEVNAME(sc->sc_dev), UGETDW(sc->csw.dCSWDataResidue))); @@ -3116,6 +3121,8 @@ umass_scsipi_cmd(xs) microtime(&sc->tv); #endif + memset(&trcmd, 0, sizeof(trcmd)); + #if defined(__NetBSD__) DIF(UDMASS_UPPER, sc_link->flags |= DEBUGLEVEL); #endif @@ -3216,6 +3223,12 @@ umass_scsipi_cmd(xs) cmd= &trcmd; } + if (sc->proto & PROTO_ATAPI) { + bcopy(cmd, &trcmd, cmdlen); + cmd = &trcmd; + cmdlen = ATAPI_COMMAND_LENGTH; + } + if (xs->xs_control & XS_CTL_POLL) { /* Use sync transfer. XXX Broken! */ DPRINTF(UDMASS_SCSI, ("umass_scsi_cmd: sync dir=%d\n", dir)); @@ -3329,6 +3342,9 @@ umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status) cmdlen = sizeof(sc->sc_sense_cmd); if (sc->proto & PROTO_UFI) cmdlen = UFI_COMMAND_LENGTH; + else if (sc->proto & PROTO_ATAPI) + cmdlen = ATAPI_COMMAND_LENGTH; + sc->transfer(sc, SCSI_LINK_LUN(sc_link), &sc->sc_sense_cmd, cmdlen, &xs->sense, sizeof(xs->sense), DIR_IN, |