DM USB: xHCI: workaround for Stop Endpoint Command handling

This patch is one workaround to resolve a crash issue for certain brand
touch screen (eGalaxTouch EXC7200-7368v1.01). The formal fix should
follow the xHCI spec to stop xfer and generate transfer completed event
trb prior to Stop Endpoint Command complete event trb. It should be a
big change and for short term, do nothing for the stop endpoint command
which is no other side effect be observed so far.

Tracked-On: #1413
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu 2018-10-18 23:09:50 +08:00 committed by Xie, Nanlin
parent ecf0585bf2
commit 6a9a46ac47
3 changed files with 8 additions and 20 deletions

View File

@ -2053,7 +2053,8 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
epid = XHCI_TRB_3_EP_GET(trb->dwTrb3);
UPRINTF(LDBG, "reset ep %u: slot %u\r\n", epid, slot);
UPRINTF(LDBG, "reset ep %u: slot %u cmd_type: %02X\r\n", epid, slot,
XHCI_TRB_3_TYPE_GET(trb->dwTrb3));
cmderr = XHCI_TRB_ERROR_SUCCESS;
@ -2083,6 +2084,12 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
goto done;
}
/* FIXME: Currently nothing to do when Stop Endpoint Command is
* received. Will refine it strictly according to xHCI spec.
*/
if (type == XHCI_TRB_TYPE_STOP_EP)
goto done;
devep = &dev->eps[epid];
if (devep->ep_xfer != NULL)
USB_DATA_XFER_RESET(devep->ep_xfer);

View File

@ -244,22 +244,6 @@ usb_dev_comp_req(struct libusb_transfer *libusb_xfer)
}
}
/* in case the xfer is reset by the USB_DATA_XFER_RESET */
if (xfer->reset == 1) {
UPRINTF(LDBG, "ep%d reset detected\r\n", xfer->epid);
xfer->reset = 0;
/* ONLY interrupt transfer needs this.
* The transfer here is an old one before endpoint reset, so it
* should be discarded. But for bulk transfer, the transfer here
* is a new one after reset, so it should be kept.
*/
if (usb_dev_get_ep_type(req->udev, xfer->pid & 1,
xfer->epid / 2) == USB_ENDPOINT_INT) {
UPRINTF(LDBG, "goto reset out\r\n");
goto reset_out;
}
}
/* handle the blocks belong to this request */
buf_idx = 0;
idx = req->blk_start;
@ -323,7 +307,6 @@ out:
if (do_intr && g_ctx.intr_cb)
g_ctx.intr_cb(xfer->dev, NULL);
reset_out:
/* unlock and release memory */
USB_DATA_XFER_UNLOCK(xfer);
libusb_free_transfer(libusb_xfer);

View File

@ -168,7 +168,6 @@ struct usb_data_xfer {
void *dev; /* struct pci_xhci_dev_emu *dev */
int epid; /* related endpoint id */
int pid; /* token id */
int reset; /* detect ep reset */
int status;
pthread_mutex_t mtx;
};
@ -219,7 +218,6 @@ enum USB_ERRCODE {
memset((x)->data, 0, sizeof((x)->data)); \
(x)->ndata = 0; \
(x)->head = (x)->tail = 0; \
(x)->reset = 1; \
pthread_mutex_unlock((&(x)->mtx)); \
} while (0)