mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Pay attention to the timeout value passed down by the upper layer.
(NetBSD src/sys/dev/usb/umass.c rev.1.67) PR: kern/58649 (Problem 1) Submitted by: SAKIYAMA Nobuo <sakichan@sakichan.org> MFC after: 1 week
This commit is contained in:
parent
0957570bf2
commit
dd4350b4a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124663
@ -241,7 +241,7 @@ 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);
|
||||
|
||||
@ -527,6 +527,8 @@ struct umass_softc {
|
||||
struct scsi_sense cam_scsi_sense;
|
||||
struct scsi_sense cam_scsi_test_unit_ready;
|
||||
|
||||
int timeout; /* in msecs */
|
||||
|
||||
int maxlun; /* maximum LUN number */
|
||||
};
|
||||
|
||||
@ -591,7 +593,7 @@ Static void umass_reset (struct umass_softc *sc,
|
||||
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,
|
||||
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,
|
||||
@ -606,7 +608,7 @@ Static int umass_cbi_adsc (struct umass_softc *sc,
|
||||
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,
|
||||
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);
|
||||
@ -1125,7 +1127,7 @@ umass_setup_transfer(struct umass_softc *sc, usbd_pipe_handle pipe,
|
||||
/* Initialiase a USB transfer and then schedule it */
|
||||
|
||||
(void) usbd_setup_xfer(xfer, pipe, (void *) sc, buffer, buflen, flags,
|
||||
UMASS_TIMEOUT, sc->state);
|
||||
sc->timeout, sc->state);
|
||||
|
||||
err = usbd_transfer(xfer);
|
||||
if (err && err != USBD_IN_PROGRESS) {
|
||||
@ -1149,7 +1151,7 @@ umass_setup_ctrl_transfer(struct umass_softc *sc, usbd_device_handle udev,
|
||||
/* Initialiase a USB control transfer and then schedule it */
|
||||
|
||||
(void) usbd_setup_default_xfer(xfer, udev, (void *) sc,
|
||||
UMASS_TIMEOUT, req, buffer, buflen, flags, sc->state);
|
||||
sc->timeout, req, buffer, buflen, flags, sc->state);
|
||||
|
||||
err = usbd_transfer(xfer);
|
||||
if (err && err != USBD_IN_PROGRESS) {
|
||||
@ -1246,13 +1248,16 @@ 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)
|
||||
{
|
||||
KASSERT(sc->proto & UMASS_PROTO_BBB,
|
||||
("%s: umass_bbb_transfer: wrong sc->proto 0x%02x\n",
|
||||
USBDEVNAME(sc->sc_dev), sc->proto));
|
||||
|
||||
/* Be a little generous. */
|
||||
sc->timeout = timeout + UMASS_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
|
||||
@ -1759,12 +1764,15 @@ 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)
|
||||
{
|
||||
KASSERT(sc->proto & (UMASS_PROTO_CBI|UMASS_PROTO_CBI_I),
|
||||
("%s: umass_cbi_transfer: wrong sc->proto 0x%02x\n",
|
||||
USBDEVNAME(sc->sc_dev), sc->proto));
|
||||
|
||||
/* Be a little generous. */
|
||||
sc->timeout = timeout + UMASS_TIMEOUT;
|
||||
|
||||
/*
|
||||
* Do a CBI transfer with cmdlen bytes from cmd, possibly
|
||||
* a data phase of datalen bytes from/to the device and finally a
|
||||
@ -2391,7 +2399,7 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
}
|
||||
sc->transfer(sc, ccb->ccb_h.target_lun, rcmd, rcmdlen,
|
||||
csio->data_ptr,
|
||||
csio->dxfer_len, dir,
|
||||
csio->dxfer_len, dir, ccb->ccb_h.timeout,
|
||||
umass_cam_cb, (void *) ccb);
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
@ -2569,7 +2577,7 @@ umass_cam_cb(struct umass_softc *sc, void *priv, int residue, int status)
|
||||
sc->transfer(sc, ccb->ccb_h.target_lun,
|
||||
rcmd, rcmdlen,
|
||||
&csio->sense_data,
|
||||
csio->sense_len, DIR_IN,
|
||||
csio->sense_len, DIR_IN, ccb->ccb_h.timeout,
|
||||
umass_cam_sense_cb, (void *) ccb);
|
||||
} else {
|
||||
panic("transform(REQUEST_SENSE) failed");
|
||||
@ -2669,7 +2677,7 @@ umass_cam_sense_cb(struct umass_softc *sc, void *priv, int residue, int status)
|
||||
&rcmd, &rcmdlen)) {
|
||||
sc->transfer(sc, ccb->ccb_h.target_lun,
|
||||
rcmd, rcmdlen,
|
||||
NULL, 0, DIR_NONE,
|
||||
NULL, 0, DIR_NONE, ccb->ccb_h.timeout,
|
||||
umass_cam_quirk_cb, (void *) ccb);
|
||||
} else {
|
||||
panic("transform(TEST_UNIT_READY) failed");
|
||||
|
Loading…
Reference in New Issue
Block a user