mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-06 20:09:01 +00:00
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:
parent
ecf0585bf2
commit
6a9a46ac47
@ -2053,7 +2053,8 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
|
|||||||
|
|
||||||
epid = XHCI_TRB_3_EP_GET(trb->dwTrb3);
|
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;
|
cmderr = XHCI_TRB_ERROR_SUCCESS;
|
||||||
|
|
||||||
@ -2083,6 +2084,12 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
|
|||||||
goto done;
|
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];
|
devep = &dev->eps[epid];
|
||||||
if (devep->ep_xfer != NULL)
|
if (devep->ep_xfer != NULL)
|
||||||
USB_DATA_XFER_RESET(devep->ep_xfer);
|
USB_DATA_XFER_RESET(devep->ep_xfer);
|
||||||
|
@ -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 */
|
/* handle the blocks belong to this request */
|
||||||
buf_idx = 0;
|
buf_idx = 0;
|
||||||
idx = req->blk_start;
|
idx = req->blk_start;
|
||||||
@ -323,7 +307,6 @@ out:
|
|||||||
if (do_intr && g_ctx.intr_cb)
|
if (do_intr && g_ctx.intr_cb)
|
||||||
g_ctx.intr_cb(xfer->dev, NULL);
|
g_ctx.intr_cb(xfer->dev, NULL);
|
||||||
|
|
||||||
reset_out:
|
|
||||||
/* unlock and release memory */
|
/* unlock and release memory */
|
||||||
USB_DATA_XFER_UNLOCK(xfer);
|
USB_DATA_XFER_UNLOCK(xfer);
|
||||||
libusb_free_transfer(libusb_xfer);
|
libusb_free_transfer(libusb_xfer);
|
||||||
|
@ -168,7 +168,6 @@ struct usb_data_xfer {
|
|||||||
void *dev; /* struct pci_xhci_dev_emu *dev */
|
void *dev; /* struct pci_xhci_dev_emu *dev */
|
||||||
int epid; /* related endpoint id */
|
int epid; /* related endpoint id */
|
||||||
int pid; /* token id */
|
int pid; /* token id */
|
||||||
int reset; /* detect ep reset */
|
|
||||||
int status;
|
int status;
|
||||||
pthread_mutex_t mtx;
|
pthread_mutex_t mtx;
|
||||||
};
|
};
|
||||||
@ -219,7 +218,6 @@ enum USB_ERRCODE {
|
|||||||
memset((x)->data, 0, sizeof((x)->data)); \
|
memset((x)->data, 0, sizeof((x)->data)); \
|
||||||
(x)->ndata = 0; \
|
(x)->ndata = 0; \
|
||||||
(x)->head = (x)->tail = 0; \
|
(x)->head = (x)->tail = 0; \
|
||||||
(x)->reset = 1; \
|
|
||||||
pthread_mutex_unlock((&(x)->mtx)); \
|
pthread_mutex_unlock((&(x)->mtx)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user