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 the logic around TT Hub Slot ID, TT Port Num...
details: https://anonhg.NetBSD.org/src/rev/5e42faf322b5
branches: trunk
changeset: 358293:5e42faf322b5
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Dec 20 08:21:11 2017 +0000
description:
Fix the logic around TT Hub Slot ID, TT Port Number and Multi-TT in
xhci_setup_tthub. TT Hub/Port need to reference the upstream HS hub and
Multi-TT needs to reflect the capabilities of a HS hub itself or the same
upstream HS hub.
diffstat:
sys/dev/usb/xhci.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diffs (84 lines):
diff -r acd70895bbc4 -r 5e42faf322b5 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Wed Dec 20 08:10:13 2017 +0000
+++ b/sys/dev/usb/xhci.c Wed Dec 20 08:21:11 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.82 2017/12/19 16:04:27 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.83 2017/12/20 08:21:11 skrll Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.82 2017/12/19 16:04:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.83 2017/12/20 08:21:11 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -3134,10 +3134,10 @@
xhci_setup_tthub(struct usbd_pipe *pipe, uint32_t *cp)
{
struct usbd_device *dev = pipe->up_dev;
- struct usbd_device *myhub = dev->ud_myhub;
struct usbd_port *myhsport = dev->ud_myhsport;
usb_device_descriptor_t * const dd = &dev->ud_ddesc;
uint32_t speed = dev->ud_speed;
+ uint8_t rhaddr = dev->ud_bus->ub_rhaddr;
uint8_t tthubslot, ttportnum;
bool ishub;
bool usemtt;
@@ -3159,8 +3159,8 @@
* parent hub is not HS hub ||
* attached to root hub.
*/
- if (myhsport && myhub && myhub->ud_depth &&
- myhub->ud_speed == USB_SPEED_HIGH &&
+ if (myhsport &&
+ myhsport->up_parent->ud_addr != rhaddr &&
(speed == USB_SPEED_LOW || speed == USB_SPEED_FULL)) {
ttportnum = myhsport->up_portno;
tthubslot = myhsport->up_parent->ud_addr;
@@ -3185,29 +3185,30 @@
DPRINTFN(4, "nports=%jd ttt=%jd", hd->bNbrPorts, ttt, 0, 0);
}
-#define IS_TTHUB(dd) \
- ((dd)->bDeviceProtocol == UDPROTO_HSHUBSTT || \
- (dd)->bDeviceProtocol == UDPROTO_HSHUBMTT)
+#define IS_MTTHUB(dd) \
+ ((dd)->bDeviceProtocol == UDPROTO_HSHUBMTT)
/*
* MTT flag is set if
- * 1. this is HS hub && MTT is enabled
- * or
- * 2. this is not hub && this is LS or FS device &&
- * MTT of parent HS hub (and its parent, too) is enabled
+ * 1. this is HS hub && MTTs are supported and enabled; or
+ * 2. this is LS or FS device && there is a parent HS hub where MTTs
+ * are supported and enabled.
+ *
+ * XXX enabled is not tested yet
*/
- if (ishub && speed == USB_SPEED_HIGH && IS_TTHUB(dd))
+ if (ishub && speed == USB_SPEED_HIGH && IS_MTTHUB(dd))
usemtt = true;
- else if (!ishub && (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) &&
- myhub && myhub->ud_depth && myhub->ud_speed == USB_SPEED_HIGH &&
- myhsport && IS_TTHUB(&myhsport->up_parent->ud_ddesc))
+ else if ((speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) &&
+ myhsport &&
+ myhsport->up_parent->ud_addr != rhaddr &&
+ IS_MTTHUB(&myhsport->up_parent->ud_ddesc))
usemtt = true;
else
usemtt = false;
DPRINTFN(4, "class %ju proto %ju ishub %jd usemtt %jd",
dd->bDeviceClass, dd->bDeviceProtocol, ishub, usemtt);
-#undef IS_TTHUB
+#undef IS_MTTHUB
cp[0] |=
XHCI_SCTX_0_HUB_SET(ishub ? 1 : 0) |
Home |
Main Index |
Thread Index |
Old Index