diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index b0c294174357..0602a68d7e6b 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -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 , * Nick Hibma @@ -94,7 +94,7 @@ */ #include -__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" @@ -181,12 +181,12 @@ Static void umass_reset(struct umass_softc *sc, transfer_cb_f cb, void *priv); /* Bulk-Only related functions */ 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); + void *cmd, int cmdlen, + void *data, int datalen, int dir, + 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); + usbd_private_handle priv, + usbd_status err); usbd_status umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun); @@ -195,9 +195,9 @@ Static int umass_cbi_adsc(struct umass_softc *sc, char *buffer,int buflen, usbd_xfer_handle xfer); 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); + void *cmd, int cmdlen, + void *data, int datalen, int dir, + 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,8 +916,8 @@ 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) + 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 @@ -1401,8 +1404,8 @@ 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) + void *cmd, int cmdlen, void *data, int datalen, int dir, + 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 diff --git a/sys/dev/usb/umassbus.c b/sys/dev/usb/umassbus.c index 330eb6eb90ed..c3724d4506b9 100644 --- a/sys/dev/usb/umassbus.c +++ b/sys/dev/usb/umassbus.c @@ -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 -__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: diff --git a/sys/dev/usb/umassvar.h b/sys/dev/usb/umassvar.h index 58d440e86a2b..260ab5fdb10a 100644 --- a/sys/dev/usb/umassvar.h +++ b/sys/dev/usb/umassvar.h @@ -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 , * Nick Hibma @@ -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);