Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix "spurious event" when command ring rolls over.
details: https://anonhg.NetBSD.org/src/rev/1461907b84be
branches: trunk
changeset: 347572:1461907b84be
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Sep 03 12:07:41 2016 +0000
description:
Fix "spurious event" when command ring rolls over.
When the enqueue pointer of command ring points at the last TRB,
address of Link TRB was stored in sc_command_addr.
It should be address of 0th TRB of ring.
>From t-hash
diffstat:
sys/dev/usb/xhci.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r eb7548c94355 -r 1461907b84be sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Sat Sep 03 12:06:50 2016 +0000
+++ b/sys/dev/usb/xhci.c Sat Sep 03 12:07:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.67 2016/09/03 12:07:41 skrll Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.67 2016/09/03 12:07:41 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2498,7 +2498,14 @@
/* XXX KASSERT may fire when cv_timedwait unlocks sc_lock */
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);
Home |
Main Index |
Thread Index |
Old Index