Pay attention to the timeout value passed down by the scsipi layer.

This commit is contained in:
augustss 2001-11-25 19:05:22 +00:00
parent 4fbe7a81e0
commit 596224e54f
3 changed files with 30 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: umass.c,v 1.66 2001/11/23 01:15:28 augustss Exp $ */
/* $NetBSD: umass.c,v 1.67 2001/11/25 19:05:22 augustss Exp $ */
/*-
* Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>,
* Nick Hibma <n_hibma@freebsd.org>
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.66 2001/11/23 01:15:28 augustss Exp $");
__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.67 2001/11/25 19:05:22 augustss Exp $");
#include "atapibus.h"
@ -183,7 +183,7 @@ Static void umass_bbb_reset(struct umass_softc *sc, int status);
Static void umass_bbb_transfer(struct umass_softc *sc, int lun,
void *cmd, int cmdlen,
void *data, int datalen, int dir,
transfer_cb_f cb, void *priv);
u_int timeout, transfer_cb_f cb, void *priv);
Static void umass_bbb_state(usbd_xfer_handle xfer,
usbd_private_handle priv,
usbd_status err);
@ -197,7 +197,7 @@ Static void umass_cbi_reset(struct umass_softc *sc, int status);
Static void umass_cbi_transfer(struct umass_softc *sc, int lun,
void *cmd, int cmdlen,
void *data, int datalen, int dir,
transfer_cb_f cb, void *priv);
u_int timeout, transfer_cb_f cb, void *priv);
Static void umass_cbi_state(usbd_xfer_handle xfer,
usbd_private_handle priv, usbd_status err);
@ -916,7 +916,7 @@ umass_bbb_reset(struct umass_softc *sc, int status)
Static void
umass_bbb_transfer(struct umass_softc *sc, int lun, void *cmd, int cmdlen,
void *data, int datalen, int dir,
void *data, int datalen, int dir, u_int timeout,
transfer_cb_f cb, void *priv)
{
static int dCBWtag = 42; /* unique for CBW of transfer */
@ -928,6 +928,9 @@ umass_bbb_transfer(struct umass_softc *sc, int lun, void *cmd, int cmdlen,
("sc->proto == 0x%02x wrong for umass_bbb_transfer\n",
sc->proto));
/* Be a little generous. */
sc->timeout = timeout + USBD_DEFAULT_TIMEOUT;
/*
* Do a Bulk-Only transfer with cmdlen bytes from cmd, possibly
* a data phase of datalen bytes from/to the device and finally a
@ -1402,7 +1405,7 @@ umass_cbi_reset(struct umass_softc *sc, int status)
Static void
umass_cbi_transfer(struct umass_softc *sc, int lun,
void *cmd, int cmdlen, void *data, int datalen, int dir,
transfer_cb_f cb, void *priv)
u_int timeout, transfer_cb_f cb, void *priv)
{
DPRINTF(UDMASS_CBI,("%s: umass_cbi_transfer cmd=0x%02x, len=%d\n",
USBDEVNAME(sc->sc_dev), *(u_char*)cmd, datalen));
@ -1414,6 +1417,9 @@ umass_cbi_transfer(struct umass_softc *sc, int lun,
if (sc->sc_dying)
return;
/* Be a little generous. */
sc->timeout = timeout + USBD_DEFAULT_TIMEOUT;
/*
* Do a CBI transfer with cmdlen bytes from cmd, possibly
* a data phase of datalen bytes from/to the device and finally a

View File

@ -1,4 +1,4 @@
/* $NetBSD: umassbus.c,v 1.13 2001/11/13 07:56:04 augustss Exp $ */
/* $NetBSD: umassbus.c,v 1.14 2001/11/25 19:05:23 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: umassbus.c,v 1.13 2001/11/13 07:56:04 augustss Exp $");
__KERNEL_RCSID(0, "$NetBSD: umassbus.c,v 1.14 2001/11/25 19:05:23 augustss Exp $");
#include "atapibus.h"
#include "scsibus.h"
@ -339,7 +339,8 @@ umass_scsipi_request(struct scsipi_channel *chan,
sc->sc_xfer_flags = USBD_SYNCHRONOUS;
sc->bus.sc_sync_status = USBD_INVAL;
sc->transfer(sc, periph->periph_lun, cmd, cmdlen,
xs->data, xs->datalen, dir, 0, xs);
xs->data, xs->datalen, dir, xs->timeout,
0, xs);
sc->sc_xfer_flags = 0;
DPRINTF(UDMASS_SCSI, ("umass_scsi_cmd: done err=%d\n",
sc->bus.sc_sync_status));
@ -361,7 +362,8 @@ umass_scsipi_request(struct scsipi_channel *chan,
" datalen=%d\n",
dir, cmdlen, xs->datalen));
sc->transfer(sc, periph->periph_lun, cmd, cmdlen,
xs->data, xs->datalen, dir, umass_scsipi_cb, xs);
xs->data, xs->datalen, dir, xs->timeout,
umass_scsipi_cb, xs);
return;
}
@ -476,7 +478,7 @@ umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
sc->transfer(sc, periph->periph_lun,
&sc->bus.sc_sense_cmd, cmdlen,
&xs->sense, sizeof(xs->sense), DIR_IN,
umass_scsipi_sense_cb, xs);
xs->timeout, umass_scsipi_sense_cb, xs);
return;
case STATUS_WIRE_FAILED:

View File

@ -1,4 +1,4 @@
/* $NetBSD: umassvar.h,v 1.3 2001/04/17 00:50:13 augustss Exp $ */
/* $NetBSD: umassvar.h,v 1.4 2001/11/25 19:05:23 augustss Exp $ */
/*-
* Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>,
* Nick Hibma <n_hibma@freebsd.org>
@ -139,7 +139,8 @@ typedef void (*transfer_cb_f)(struct umass_softc *sc, void *priv,
typedef void (*wire_reset_f)(struct umass_softc *sc, int status);
typedef void (*wire_transfer_f)(struct umass_softc *sc, int lun,
void *cmd, int cmdlen, void *data, int datalen,
int dir, transfer_cb_f cb, void *priv);
int dir, u_int timeout, transfer_cb_f cb,
void *priv);
typedef void (*wire_state_f)(usbd_xfer_handle xfer,
usbd_private_handle priv, usbd_status err);