Commit 6bfa0568 authored by Robert Sprowson's avatar Robert Sprowson

Fix "spurious event" when command ring rolls over

xhci.c: From NetBSD 1.67.

Version 0.20. Tagged as 'XHCIDriver-0_20'
parent 1a1fd436
/* (0.19)
/* (0.20)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.19
#define Module_MajorVersion_CMHG 0.20
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Jul 2017
#define Module_MajorVersion "0.19"
#define Module_Version 19
#define Module_MajorVersion "0.20"
#define Module_Version 20
#define Module_MinorVersion ""
#define Module_Date "13 Jul 2017"
......@@ -18,6 +18,6 @@
#define Module_ComponentName "XHCIDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/XHCIDriver"
#define Module_FullVersion "0.19"
#define Module_HelpVersion "0.19 (13 Jul 2017)"
#define Module_LibraryVersionInfo "0:19"
#define Module_FullVersion "0.20"
#define Module_HelpVersion "0.20 (13 Jul 2017)"
#define Module_LibraryVersionInfo "0:20"
......@@ -1098,7 +1098,7 @@ xhci_configure_endpoint(usbd_pipe_handle pipe)
/* XXX ensure input context is available? */
memset(xhci_slot_get_icv(sc, xs, 0), 0, sc->sc_pgsz);
memset(xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL), 0, sc->sc_pgsz);
cp = xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL);
cp[0] = htole32(0);
......@@ -2338,7 +2338,14 @@ xhci_do_command(struct xhci_softc * const sc, struct xhci_trb * const trb,
#endif
KASSERT(sc->sc_command_addr == 0);
sc->sc_command_addr = xhci_ring_trbp(cr, cr->xr_ep);
/*
* If enqueue pointer points at last of ring, it's Link TRB,
* command TRB will be stored in 0th TRB.
*/
if (cr->xr_ep == cr->xr_ntrb - 1)
sc->sc_command_addr = xhci_ring_trbp(cr, 0);
else
sc->sc_command_addr = xhci_ring_trbp(cr, cr->xr_ep);
mutex_enter(&cr->xr_lock);
xhci_ring_put(sc, cr, NULL, trb, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment