NetBSD Problem Report #49091

From t.hash425@gmail.com  Fri Aug  8 07:39:40 2014
Return-Path: <t.hash425@gmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5BFE0AC172
	for <gnats-bugs@gnats.netbsd.org>; Fri,  8 Aug 2014 07:39:40 +0000 (UTC)
Message-Id: <53E47EB7.70007@gmail.com>
Date: Fri, 08 Aug 2014 16:39:35 +0900
From: Takahiro HAYASHI <t.hash425@gmail.com>
To: gnats-bugs@gnats.NetBSD.org
Subject: xhci: wrong wMaxPacketSize value

>Number:         49091
>Category:       kern
>Synopsis:       xhci: wrong wMaxPacketSize value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 08 07:40:00 +0000 2014
>Closed-Date:    Mon Aug 11 10:44:02 +0000 2014
>Last-Modified:  Mon Aug 11 15:40:00 +0000 2014
>Originator:     Takahiro HAYASHI
>Release:        NetBSD 6.99.49
>Organization:
>Environment:
System: NetBSD tama 6.99.49 NetBSD 6.99.49 (XHCIDEBUG) #10: Fri Aug  8 15:00:46 JST 2014  root@halt:/build/head/obj.amd64/sys/arch/amd64/compile/XHCIDEBUG amd64
Architecture: x86_64
Machine: amd64
>Description:
	wMaxPacketSize must be (1 << bMaxPacketSize) (512),
	not plain value (9) when updating ep0 in xhci_new_device()
	in case 3.0 device is connected.

>How-To-Repeat:

>Fix:

--- src/sys/dev/usb/xhci.c	2014-08-05 22:24:27.000000000 +0900
+++ src/sys/dev/usb/xhci.c	2014-08-08 15:57:37.000000000 +0900
@@ -1524,10 +2159,17 @@ xhci_new_device(device_t parent, usbd_bu
  		err = usbd_get_initial_ddesc(dev, dd);
  		if (err)
  			return err;
-		USETW(dev->def_ep_desc.wMaxPacketSize, dd->bMaxPacketSize);
+		/* 4.8.2.1 */
+		if (speed == USB_SPEED_SUPER)
+			USETW(dev->def_ep_desc.wMaxPacketSize,
+			    (1 << dd->bMaxPacketSize));
+		else
+			USETW(dev->def_ep_desc.wMaxPacketSize,
+			    dd->bMaxPacketSize);
  		device_printf(sc->sc_dev, "%s bMaxPacketSize %u\n", __func__,
  		    dd->bMaxPacketSize);
-		xhci_update_ep0_mps(sc, xs, dd->bMaxPacketSize);
+		xhci_update_ep0_mps(sc, xs,
+		    UGETW(dev->def_ep_desc.wMaxPacketSize));
  		err = usbd_reload_device_desc(dev);
  		if (err)
  			return err;

-- 
t-hash

>Release-Note:

>Audit-Trail:
From: "Nick Hudson" <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49091 CVS commit: src/sys/dev/usb
Date: Mon, 11 Aug 2014 10:37:59 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Mon Aug 11 10:37:59 UTC 2014

 Modified Files:
 	src/sys/dev/usb: xhci.c

 Log Message:
 PR/49091: xhci: wrong wMaxPacketSize value

 While this is correct according to the specification only fixed sizes
 are allowed, i.e. 512 for SS, etc. Maybe these should be used?


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/xhci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Mon, 11 Aug 2014 10:44:02 +0000
State-Changed-Why:
Patch applied.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49091 CVS commit: [netbsd-7] src/sys/dev/usb
Date: Mon, 11 Aug 2014 15:36:45 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Aug 11 15:36:45 UTC 2014

 Modified Files:
 	src/sys/dev/usb [netbsd-7]: xhci.c

 Log Message:
 Pull up following revision(s) (requested by skrll in ticket #3):
 	sys/dev/usb/xhci.c: revision 1.24
 PR/49091: xhci: wrong wMaxPacketSize value
 While this is correct according to the specification only fixed sizes
 are allowed, i.e. 512 for SS, etc. Maybe these should be used?


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/usb/xhci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.