From owner-p4-projects@FreeBSD.ORG Wed Sep 24 23:31:41 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C3FAF1065690; Wed, 24 Sep 2008 23:31:41 +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 886A2106568C for ; Wed, 24 Sep 2008 23:31:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 732ED8FC15 for ; Wed, 24 Sep 2008 23:31:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8ONVfoq049901 for ; Wed, 24 Sep 2008 23:31:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8ONVfqb049894 for perforce@freebsd.org; Wed, 24 Sep 2008 23:31:41 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 24 Sep 2008 23:31:41 GMT Message-Id: <200809242331.m8ONVfqb049894@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 150410 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 23:31:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=150410 Change 150410 by hselasky@hselasky_laptop001 on 2008/09/24 23:31:30 Fix endpoint allocation for simplex profiles in the USB template module. Tested and works. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#11 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#11 (text+ko) ==== @@ -507,17 +507,13 @@ return (0); /* we are done */ } if (ep->needs_ep_type == UE_CONTROL) { - ep->needs_in = 0; - ep->needs_out = 0; dir_in = 1; dir_out = 1; } else { if (ep->needs_in) { - ep->needs_in = 0; dir_in = 1; dir_out = 0; } else { - ep->needs_out = 0; dir_in = 0; dir_out = 1; } @@ -525,26 +521,26 @@ for (n = 1; n != (USB_EP_MAX / 2); n++) { + /* get HW endpoint profile */ + (ues->methods->get_hw_ep_profile) (ues->udev, &pf, n); + if (pf == NULL) { + /* end of profiles */ + break; + } /* check if IN-endpoint is reserved */ - if (dir_in) { + if (dir_in || pf->is_simplex) { if (ues->bmInAlloc[n / 8] & (1 << (n % 8))) { /* mismatch */ continue; } } /* check if OUT-endpoint is reserved */ - if (dir_out) { + if (dir_out || pf->is_simplex) { if (ues->bmOutAlloc[n / 8] & (1 << (n % 8))) { /* mismatch */ continue; } } - /* get HW endpoint profile */ - (ues->methods->get_hw_ep_profile) (ues->udev, &pf, n); - if (pf == NULL) { - /* end of profiles */ - break; - } /* check simplex */ if (pf->is_simplex == is_simplex) { /* mismatch */ @@ -578,16 +574,18 @@ pf = ep->pf; /* reserve IN-endpoint */ - if (dir_in || pf->is_simplex) { + if (dir_in) { ues->bmInAlloc[best_n / 8] |= (1 << (best_n % 8)); ep->hw_endpoint_in = best_n | UE_DIR_IN; + ep->needs_in = 0; } /* reserve OUT-endpoint */ - if (dir_out || pf->is_simplex) { + if (dir_out) { ues->bmOutAlloc[best_n / 8] |= (1 << (best_n % 8)); ep->hw_endpoint_out = best_n | UE_DIR_OUT; + ep->needs_out = 0; } return (0); /* got a match */ }