From owner-p4-projects@FreeBSD.ORG Wed Aug 11 18:25:53 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5294C106567E; Wed, 11 Aug 2010 18:25:53 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59894106566C for ; Wed, 11 Aug 2010 18:25:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 473D58FC22 for ; Wed, 11 Aug 2010 18:25:51 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7BIPpon083784 for ; Wed, 11 Aug 2010 18:25:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7BIPpbv083780 for perforce@freebsd.org; Wed, 11 Aug 2010 18:25:51 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 11 Aug 2010 18:25:51 GMT Message-Id: <201008111825.o7BIPpbv083780@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182110 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 18:25:54 -0000 http://p4web.freebsd.org/@@182110?ac=10 Change 182110 by hselasky@hselasky_laptop001 on 2010/08/08 22:06:26 USB core: - correct calculations for Super Speed USB. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#184 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#184 (text+ko) ==== @@ -322,6 +322,7 @@ usb_frcount_t x; uint8_t type; uint8_t zmps; + uint8_t mult; /* * Sanity check. The following parameters must be initialized before @@ -358,12 +359,36 @@ xfer->max_packet_count = 3; xfer->max_packet_size &= 0x7FF; break; + case USB_SPEED_SUPER: - if (xfer->endpoint->ecomp != NULL) - xfer->max_packet_count += xfer->endpoint->ecomp->bMaxBurst; + xfer->max_packet_count += (xfer->max_packet_size >> 11) & 3; + mult = 1; + + /* compute additional bMaxBurst */ + if (xfer->endpoint->ecomp != NULL) { + xfer->max_packet_count += + xfer->endpoint->ecomp->bMaxBurst; + + if (type == UE_ISOCHRONOUS) { + mult += + (xfer->endpoint->ecomp->bmAttributes & 3); + } + } + + xfer->max_packet_count *= mult; + /* check for invalid max packet count */ - if (xfer->max_packet_count > 15) - xfer->max_packet_count = 15; + if (type == UE_ISOCHRONOUS) { + if ((xfer->max_packet_count == 0) || + (xfer->max_packet_count > (16 * 3))) + xfer->max_packet_count = (16 * 3); + } else { + if ((xfer->max_packet_count == 0) || + (xfer->max_packet_count > (16 * 1))) + xfer->max_packet_count = (16 * 1); + } + + xfer->max_packet_size &= 0x7FF; break; default: break;