From owner-p4-projects@FreeBSD.ORG Wed Dec 26 09:48:37 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9E02F16A41B; Wed, 26 Dec 2007 09:48:37 +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 4D1F816A419 for ; Wed, 26 Dec 2007 09:48:37 +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 4794913C44B for ; Wed, 26 Dec 2007 09:48:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBQ9mbFc041591 for ; Wed, 26 Dec 2007 09:48:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBQ9mbpi041588 for perforce@freebsd.org; Wed, 26 Dec 2007 09:48:37 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 26 Dec 2007 09:48:37 GMT Message-Id: <200712260948.lBQ9mbpi041588@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 131662 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, 26 Dec 2007 09:48:37 -0000 http://perforce.freebsd.org/chv.cgi?CH=131662 Change 131662 by hselasky@hselasky_laptop001 on 2007/12/26 09:47:50 Bugfix. Add some more debug prints. And make sure that short received frames terminate the TD. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#5 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#5 (text+ko) ==== @@ -301,7 +301,7 @@ csr = bus_space_read_4(td->io_tag, td->io_hdl, td->status_reg); - DPRINTFN(4, "csr=0x%08x rem=%d\n", csr, td->remainder); + DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder); temp = csr; temp &= (AT91_UDP_CSR_RX_DATA_BK0 | @@ -387,8 +387,10 @@ uint32_t temp; uint16_t count; uint8_t to; + uint8_t got_short; to = 2; /* don't loop forever! */ + got_short = 0; /* check if any of the FIFO banks have data */ repeat: @@ -396,7 +398,7 @@ csr = bus_space_read_4(td->io_tag, td->io_hdl, td->status_reg); - DPRINTFN(4, "csr=0x%08x\n", csr); + DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder); if (csr & AT91_UDP_CSR_RXSETUP) { if (td->remainder == 0) { @@ -436,6 +438,7 @@ if (count < td->max_packet_size) { /* we have a short packet */ td->short_pkt = 1; + got_short = 1; } else { /* invalid USB packet */ td->error = 1; @@ -490,7 +493,7 @@ */ /* check if we are complete */ - if (td->remainder == 0) { + if ((td->remainder == 0) || got_short) { if (td->short_pkt) { /* we are complete */ return (0); @@ -520,7 +523,7 @@ csr = bus_space_read_4(td->io_tag, td->io_hdl, td->status_reg); - DPRINTFN(4, "csr=0x%08x rem=%d\n", csr, td->remainder); + DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder); if (csr & AT91_UDP_CSR_RXSETUP) { /* @@ -1267,7 +1270,7 @@ mtx_assert(&(udev->bus->mtx), MA_OWNED); - DPRINTFN(4, "\n"); + DPRINTFN(4, "pipe=%p\n", pipe); if (xfer) { /* cancel any ongoing transfers */ @@ -1291,7 +1294,7 @@ mtx_assert(&(udev->bus->mtx), MA_OWNED); - DPRINTFN(4, "\n"); + DPRINTFN(4, "pipe=%p\n", pipe); /* reset pipe state */