Page MenuHomeFreeBSD

D59186.diff
No OneTemporary

D59186.diff

diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h
--- a/sys/dev/usb/controller/xhci.h
+++ b/sys/dev/usb/controller/xhci.h
@@ -419,6 +419,7 @@
uint8_t trb_index[XHCI_MAX_STREAMS];
uint8_t trb_halted;
uint8_t trb_running;
+ uint8_t trb_toggle_reset;
uint8_t trb_ep_mode;
uint8_t trb_ep_maxp;
};
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -3940,6 +3940,11 @@
if (epno == 0)
return (USB_ERR_NO_PIPE); /* invalid */
+ USB_BUS_LOCK(udev->bus);
+ drop = pepext->trb_toggle_reset;
+ pepext->trb_toggle_reset = 0;
+ USB_BUS_UNLOCK(udev->bus);
+
XHCI_CMD_LOCK(sc);
/* configure endpoint */
@@ -3957,14 +3962,16 @@
*/
switch (xhci_get_endpoint_state(udev, epno)) {
case XHCI_EPCTX_0_EPSTATE_DISABLED:
- case XHCI_EPCTX_0_EPSTATE_STOPPED:
drop = 0;
break;
+ case XHCI_EPCTX_0_EPSTATE_STOPPED:
+ break;
case XHCI_EPCTX_0_EPSTATE_HALTED:
err = xhci_cmd_reset_ep(sc, 0, epno, index);
- drop = (err != 0);
- if (drop)
+ if (err != 0) {
+ drop = 1;
DPRINTF("Could not reset endpoint %u\n", epno);
+ }
break;
default:
/*
@@ -3974,9 +3981,10 @@
* result, xHCI may refuse to receive or process the packet.
*/
err = xhci_cmd_stop_ep(sc, 0, epno, index);
- drop = (err != 0);
- if (drop)
+ if (err != 0) {
+ drop = 1;
DPRINTF("Could not stop endpoint %u\n", epno);
+ }
break;
}
@@ -4241,6 +4249,11 @@
USB_BUS_LOCK(udev->bus);
pepext->trb_halted = 1;
pepext->trb_running = 0;
+ /*
+ * The USB stack has cleared its own data toggle value and expects
+ * the hardware data toggle value to be cleared as well:
+ */
+ pepext->trb_toggle_reset = 1;
USB_BUS_UNLOCK(udev->bus);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 4, 9:13 AM (7 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37322314
Default Alt Text
D59186.diff (1 KB)

Event Timeline