Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108989454
D26064.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26064.diff
View Options
Index: head/sys/dev/usb/controller/xhci.c
===================================================================
--- head/sys/dev/usb/controller/xhci.c
+++ head/sys/dev/usb/controller/xhci.c
@@ -3808,6 +3808,28 @@
}
}
+static uint8_t
+xhci_get_endpoint_state(struct usb_device *udev, uint8_t epno)
+{
+ struct xhci_softc *sc = XHCI_BUS2SC(udev->bus);
+ struct usb_page_search buf_dev;
+ struct xhci_hw_dev *hdev;
+ struct xhci_dev_ctx *pdev;
+ uint32_t temp;
+
+ MPASS(epno != 0);
+
+ hdev = &sc->sc_hw.devs[udev->controller_slot_id];
+
+ usbd_get_page(&hdev->device_pc, 0, &buf_dev);
+ pdev = buf_dev.buffer;
+ usb_pc_cpu_invalidate(&hdev->device_pc);
+
+ temp = xhci_ctx_get_le32(sc, &pdev->ctx_ep[epno - 1].dwEpCtx0);
+
+ return (XHCI_EPCTX_0_EPSTATE_GET(temp));
+}
+
static usb_error_t
xhci_configure_reset_endpoint(struct usb_xfer *xfer)
{
@@ -3861,16 +3883,20 @@
* Get the endpoint into the stopped state according to the
* endpoint context state diagram in the XHCI specification:
*/
-
- err = xhci_cmd_stop_ep(sc, 0, epno, index);
-
- if (err != 0)
- DPRINTF("Could not stop endpoint %u\n", epno);
-
- err = xhci_cmd_reset_ep(sc, 0, epno, index);
-
- if (err != 0)
- DPRINTF("Could not reset endpoint %u\n", epno);
+ switch (xhci_get_endpoint_state(udev, epno)) {
+ case XHCI_EPCTX_0_EPSTATE_STOPPED:
+ break;
+ case XHCI_EPCTX_0_EPSTATE_HALTED:
+ err = xhci_cmd_reset_ep(sc, 0, epno, index);
+ if (err != 0)
+ DPRINTF("Could not reset endpoint %u\n", epno);
+ break;
+ default:
+ err = xhci_cmd_stop_ep(sc, 0, epno, index);
+ if (err != 0)
+ DPRINTF("Could not stop endpoint %u\n", epno);
+ break;
+ }
err = xhci_cmd_set_tr_dequeue_ptr(sc,
(pepext->physaddr + (stream_id * sizeof(struct xhci_trb) *
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 8:41 AM (13 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16358988
Default Alt Text
D26064.diff (1 KB)
Attached To
Mode
D26064: Check XHCI endpoint state before issuing XHCI endpoint commands
Attached
Detach File
Event Timeline
Log In to Comment