From owner-p4-projects@FreeBSD.ORG Thu Aug 28 06:09:54 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 778F11065671; Thu, 28 Aug 2008 06:09:54 +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 237CB106566B for ; Thu, 28 Aug 2008 06:09:54 +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 163B98FC14 for ; Thu, 28 Aug 2008 06:09:54 +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 m7S69rDA034913 for ; Thu, 28 Aug 2008 06:09:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7S69rMW034911 for perforce@freebsd.org; Thu, 28 Aug 2008 06:09:53 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 28 Aug 2008 06:09:53 GMT Message-Id: <200808280609.m7S69rMW034911@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 148679 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: Thu, 28 Aug 2008 06:09:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=148679 Change 148679 by hselasky@hselasky_laptop001 on 2008/08/28 06:08:54 Fix a comment and optimise the data transfer path. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#8 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#8 (text+ko) ==== @@ -271,7 +271,7 @@ DPRINTFN(4, "csr=0x%02x\n", csr); /* - * UNDOCUMENTED: If DATAEND is set we should not call the + * NOTE: If DATAEND is set we should not call the * callback, hence the status stage is not complete. */ if (csr & MUSB2_MASK_CSR0L_DATAEND) { @@ -427,6 +427,24 @@ if (buf_res.length > count) { buf_res.length = count; } + /* check if we can optimise */ + if ((!(USB_P2U(buf_res.buffer) & 3)) && + (buf_res.length >= 4)) { + uint32_t temp; + + /* receive data 4 bytes at a time */ + bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } /* receive data */ bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, buf_res.length); @@ -502,6 +520,24 @@ if (buf_res.length > count) { buf_res.length = count; } + /* check if we can optimise */ + if ((!(USB_P2U(buf_res.buffer) & 3)) && + (buf_res.length >= 4)) { + uint32_t temp; + + /* transmit data 4 bytes at a time */ + bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(0), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } /* transmit data */ bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, buf_res.length); @@ -571,7 +607,7 @@ uint8_t to; uint8_t got_short; - to = 2; /* don't loop forever! */ + to = 8; /* don't loop forever! */ got_short = 0; /* get pointer to softc */ @@ -624,9 +660,28 @@ if (buf_res.length > count) { buf_res.length = count; } + /* check if we can optimise */ + if ((!(USB_P2U(buf_res.buffer) & 3)) && + (buf_res.length >= 4)) { + uint32_t temp; + + /* receive data 4 bytes at a time */ + bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } /* receive data */ bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, - MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, buf_res.length); + MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, + buf_res.length); /* update counters */ count -= buf_res.length; @@ -660,7 +715,7 @@ uint8_t csr; uint8_t to; - to = 2; /* don't loop forever! */ + to = 8; /* don't loop forever! */ /* get pointer to softc */ sc = MUSBOTG_PC2SC(td->pc); @@ -697,9 +752,28 @@ if (buf_res.length > count) { buf_res.length = count; } + /* check if we can optimise */ + if ((!(USB_P2U(buf_res.buffer) & 3)) && + (buf_res.length >= 4)) { + uint32_t temp; + + /* transmit data 4 bytes at a time */ + bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, + MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, + buf_res.length / 4); + + temp = buf_res.length & ~3; + + /* update counters */ + count -= temp; + td->offset += temp; + td->remainder -= temp; + continue; + } /* transmit data */ bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, - MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, buf_res.length); + MUSB2_REG_EPFIFO(td->ep_no), buf_res.buffer, + buf_res.length); /* update counters */ count -= buf_res.length; @@ -775,6 +849,7 @@ musbotg_interrupt_poll(struct musbotg_softc *sc) { struct usb2_xfer *xfer; + uint8_t to = 2; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -783,6 +858,8 @@ goto repeat; } } + if (--to) + goto repeat; return; }