From owner-p4-projects@FreeBSD.ORG Mon Jun 12 07:50:15 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D710A16A473; Mon, 12 Jun 2006 07:50:14 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6893416A41F for ; Mon, 12 Jun 2006 07:50:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19DE443D48 for ; Mon, 12 Jun 2006 07:50:14 +0000 (GMT) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5C7m0TV029660 for ; Mon, 12 Jun 2006 07:48:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5C7m0RN029656 for perforce@freebsd.org; Mon, 12 Jun 2006 07:48:00 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 12 Jun 2006 07:48:00 GMT Message-Id: <200606120748.k5C7m0RN029656@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 99040 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: Mon, 12 Jun 2006 07:50:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=99040 Change 99040 by hselasky@hselasky_mini_itx on 2006/06/12 07:47:19 New feature: If bufsize == 0, use wMaxPacketSize instead when configuring USB transfers. This is useful for setting up interrupt transfers. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/README#3 edit .. //depot/projects/usb/src/sys/dev/usb/ehci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#4 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/README#3 (text+ko) ==== @@ -211,8 +211,10 @@ USBD_USE_POLLING USBD_SELF_DESTRUCT -- The "bufsize" field sets the total pipe buffer size in bytes. This - field is mandatory. +- The "bufsize" field sets the total pipe buffer size in bytes. If + this field is zero, "wMaxPacketSize" will be used. This is useful for + setting up interrupt pipes. For control transfers "bufsize" includes the + length of the request structure. This field is mandatory. - The "callback" field sets the USB callback. This field is mandatory. ==== //depot/projects/usb/src/sys/dev/usb/ehci.c#4 (text+ko) ==== @@ -3417,7 +3417,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -3453,6 +3452,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -3544,7 +3549,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; /* memory is allocated at * highest alignment ==== //depot/projects/usb/src/sys/dev/usb/ohci.c#4 (text+ko) ==== @@ -2421,7 +2421,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -2476,6 +2475,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -2492,7 +2497,7 @@ } else if(xfer->pipe->methods == &ohci_device_isoc_methods) { - nitd = (setup->bufsize / OHCI_PAGE_SIZE) + + nitd = (xfer->length / OHCI_PAGE_SIZE) + (max_frames / OHCI_ITD_NOFFSET) + 1 /* EXTRA */; ntd = 0; } @@ -2536,7 +2541,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; size += ((-size) & (OHCI_ITD_ALIGN-1)); /* align data */ ==== //depot/projects/usb/src/sys/dev/usb/uhci.c#4 (text+ko) ==== @@ -2711,7 +2711,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -2747,6 +2746,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -2806,7 +2811,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; size += ((-size) & (UHCI_TD_ALIGN-1)); /* align data */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#4 (text+ko) ==== @@ -251,8 +251,7 @@ for(setup = setup_start, n = n_setup; n--; setup++) { - if((setup->bufsize == 0) || - (setup->bufsize == 0xffffffff)) + if(setup->bufsize == 0xffffffff) { error = USBD_BAD_BUFSIZE; PRINTF(("invalid bufsize\n"));