From owner-p4-projects@FreeBSD.ORG Wed Aug 6 19:49:11 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C0E9F1065685; Wed, 6 Aug 2008 19:49:10 +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 85267106567D for ; Wed, 6 Aug 2008 19:49:10 +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 71AE78FC20 for ; Wed, 6 Aug 2008 19:49:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m76JnAE1086317 for ; Wed, 6 Aug 2008 19:49:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m76JnAE8086315 for perforce@freebsd.org; Wed, 6 Aug 2008 19:49:10 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 6 Aug 2008 19:49:10 GMT Message-Id: <200808061949.m76JnAE8086315@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 146797 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, 06 Aug 2008 19:49:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=146797 Change 146797 by hselasky@hselasky_laptop001 on 2008/08/06 19:48:16 Sort some variables by size to reduce stack consumption on embedded platforms. Bugfix: If we do not have room for an USB transfer, then set the length to zero instead of clearing the ACTIVE bit, hence the latter solution would lead to an infinite loop. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#9 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#9 (text+ko) ==== @@ -2410,23 +2410,23 @@ struct usb2_fs_isoc_schedule *fss_start; struct usb2_fs_isoc_schedule *fss_end; struct usb2_fs_isoc_schedule *fss; + ehci_sitd_t *td; + ehci_sitd_t *td_last = NULL; + ehci_sitd_t **pp_last; + uint32_t *plen; uint32_t buf_offset; uint32_t nframes; uint32_t temp; uint32_t sitd_mask; - uint32_t *plen; uint16_t tlen; + uint8_t sa; + uint8_t sb; + uint8_t error; #ifdef USB_DEBUG uint8_t once = 1; #endif - uint8_t sa; - uint8_t sb; - uint8_t error; - ehci_sitd_t *td; - ehci_sitd_t *td_last = NULL; - ehci_sitd_t **pp_last; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", xfer, xfer->pipe->isoc_next, xfer->nframes); @@ -2523,7 +2523,13 @@ * full! */ error = usb2_fs_isoc_schedule_alloc(fss, &sa, *plen); - + if (error) { + /* + * The FULL speed schedule is FULL! Set length + * to zero. + */ + *plen = 0; + } if (*plen) { /* * only call "usb2_get_page()" when we have a @@ -2536,7 +2542,8 @@ * NOTE: We need to subtract one from the offset so * that we are on a valid page! */ - usb2_get_page(xfer->frbuffers, buf_offset - 1, &buf_res); + usb2_get_page(xfer->frbuffers, buf_offset - 1, + &buf_res); temp = buf_res.physaddr & ~0xFFF; } else { td->sitd_bp[0] = 0; @@ -2588,15 +2595,6 @@ (EHCI_SITD_ACTIVE | EHCI_SITD_SET_LEN(*plen)); } - if (error) { - /* - * The FULL speed schedule is FULL! Pretend that the - * transaction has been executed. The IOC bit should - * be active even if the ACTIVE bit is zero. - */ - td->sitd_status &= - ~htole32(EHCI_SITD_ACTIVE); - } usb2_pc_cpu_flush(td->page_cache); #ifdef USB_DEBUG @@ -2704,11 +2702,14 @@ { struct usb2_page_search buf_res; ehci_softc_t *sc = xfer->usb2_sc; + ehci_itd_t *td; + ehci_itd_t *td_last = NULL; + ehci_itd_t **pp_last; bus_size_t page_addr; + uint32_t *plen; uint32_t status; uint32_t buf_offset; uint32_t nframes; - uint32_t *plen; uint32_t itd_offset[8 + 1]; uint8_t x; uint8_t td_no; @@ -2718,9 +2719,6 @@ uint8_t once = 1; #endif - ehci_itd_t *td; - ehci_itd_t *td_last = NULL; - ehci_itd_t **pp_last; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", xfer, xfer->pipe->isoc_next, xfer->nframes);