diff --git a/share/man/man4/ugen.4 b/share/man/man4/ugen.4 index 7fed60a27ab1..602389b88201 100644 --- a/share/man/man4/ugen.4 +++ b/share/man/man4/ugen.4 @@ -1,4 +1,4 @@ -.\" $NetBSD: ugen.4,v 1.28 2009/12/21 19:04:36 gdt Exp $ +.\" $NetBSD: ugen.4,v 1.29 2009/12/23 01:04:45 pooka Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,6 @@ .Nd USB generic device support .Sh SYNOPSIS .Cd "ugen* at uhub? flags N" -.Cd options UGEN_BULK_RA_WB .Sh DESCRIPTION The .Nm @@ -109,29 +108,22 @@ and .Xr write 2 should be used. All IO operations on a bulk endpoint are normally unbuffered. -On kernels built with the -.Dv UGEN_BULK_RA_WB -option, the +The .Dv USB_SET_BULK_RA and .Dv USB_SET_BULK_WB .Xr ioctl 2 -calls are available, and enable read-ahead and write-behind buffering -respectively. +calls enable read-ahead and write-behind buffering, respectively. This buffering supports fixed-sized USB transfers and is intended for devices with regular and continuing data transfers. When read-ahead or write-behind are enabled, the file descriptor may be set to use non-blocking IO. .Pp -When in a -.Dv UGEN_BULK_RA_WB -mode, +When in a read-ahead/writeback mode, .Xr select 2 for read and write operates normally, returning true if there is data in the read buffer and space in the write buffer, respectively. -When not in a -.Dv UGEN_BULK_RA_WB -mode, +When not, .Xr select 2 always returns true, because there is no way to predict how the device will respond to a read or write request. diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 4a76252eb6d7..13f14bbdca4e 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.259 2009/12/05 20:11:03 pooka Exp $ +# $NetBSD: GENERIC,v 1.260 2009/12/23 01:04:45 pooka Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.259 $" +#ident "GENERIC-$Revision: 1.260 $" maxusers 64 # estimated number of users @@ -905,8 +905,6 @@ radio* at udsbr? # USB Generic driver ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB # USB 3G datacards u3g* at uhub? port ? diff --git a/sys/arch/evbarm/conf/MPCSA_GENERIC b/sys/arch/evbarm/conf/MPCSA_GENERIC index 1b6cd2f35b85..4ec60cd08f2f 100644 --- a/sys/arch/evbarm/conf/MPCSA_GENERIC +++ b/sys/arch/evbarm/conf/MPCSA_GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: MPCSA_GENERIC,v 1.11 2009/12/05 20:11:11 pooka Exp $ +# $NetBSD: MPCSA_GENERIC,v 1.12 2009/12/23 01:04:46 pooka Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/evbarm/conf/std.mpcsa" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.11 $" +#ident "GENERIC-$Revision: 1.12 $" maxusers 32 # estimated number of users @@ -574,8 +574,6 @@ ucom* at uvscom? portno ? # USB Generic driver #ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -#options UGEN_BULK_RA_WB # IrDA and Consumer Ir devices diff --git a/sys/arch/evbppc/conf/OPENBLOCKS266_OPT b/sys/arch/evbppc/conf/OPENBLOCKS266_OPT index f8a91c7abc06..25d69f952828 100644 --- a/sys/arch/evbppc/conf/OPENBLOCKS266_OPT +++ b/sys/arch/evbppc/conf/OPENBLOCKS266_OPT @@ -1,4 +1,4 @@ -# $NetBSD: OPENBLOCKS266_OPT,v 1.10 2009/01/03 17:47:24 christos Exp $ +# $NetBSD: OPENBLOCKS266_OPT,v 1.11 2009/12/23 01:04:46 pooka Exp $ # include "arch/evbppc/conf/OPENBLOCKS266" @@ -264,9 +264,6 @@ radio* at udsbr? # USB Generic driver ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB - # CardBus IEEE1394 controllers fwohci* at cardbus? function ? # IEEE1394 Open Host Controller diff --git a/sys/arch/i386/conf/ALL b/sys/arch/i386/conf/ALL index 15654425021e..a138291b3b6d 100644 --- a/sys/arch/i386/conf/ALL +++ b/sys/arch/i386/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.222 2009/12/05 20:11:15 pooka Exp $ +# $NetBSD: ALL,v 1.223 2009/12/23 01:04:46 pooka Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.222 $" +#ident "ALL-$Revision: 1.223 $" maxusers 64 # estimated number of users @@ -1288,8 +1288,6 @@ wsmouse* at xboxcontroller? mux 0 # USB Generic driver ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB # USB 3G datacards u3g* at uhub? port ? diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index e618eaf17ef7..129c66c22015 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.954 2009/12/05 20:11:15 pooka Exp $ +# $NetBSD: GENERIC,v 1.955 2009/12/23 01:04:46 pooka Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.954 $" +#ident "GENERIC-$Revision: 1.955 $" maxusers 64 # estimated number of users @@ -1234,8 +1234,6 @@ radio* at udsbr? # USB Generic driver ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB # USB 3G datacards u3g* at uhub? port ? diff --git a/sys/arch/i386/conf/XBOX b/sys/arch/i386/conf/XBOX index 44eeb262fcee..1593056773ff 100644 --- a/sys/arch/i386/conf/XBOX +++ b/sys/arch/i386/conf/XBOX @@ -1,4 +1,4 @@ -# $NetBSD: XBOX,v 1.16 2009/03/27 21:04:35 ad Exp $ +# $NetBSD: XBOX,v 1.17 2009/12/23 01:04:46 pooka Exp $ # # XBOX -- A basic Microsoft XBox kernel config file. # @@ -244,8 +244,6 @@ wsmouse* at xboxcontroller? mux 0 # USB Generic driver ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB # Audio Devices diff --git a/sys/arch/iyonix/conf/GENERIC b/sys/arch/iyonix/conf/GENERIC index 516304879214..5f08e4327ea7 100644 --- a/sys/arch/iyonix/conf/GENERIC +++ b/sys/arch/iyonix/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.56 2009/12/05 20:11:15 pooka Exp $ +# $NetBSD: GENERIC,v 1.57 2009/12/23 01:04:46 pooka Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/iyonix/conf/std.iyonix" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.56 $" +#ident "GENERIC-$Revision: 1.57 $" maxusers 32 # estimated number of users @@ -647,8 +647,6 @@ ucom* at uvscom? portno ? # USB Generic driver #ugen* at uhub? port ? -# On ugen bulk endpoints, perform read-ahead and write-behind. -#options UGEN_BULK_RA_WB # IrDA and Consumer Ir devices diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb index 894307ed4b29..02e06c8f909b 100644 --- a/sys/dev/usb/files.usb +++ b/sys/dev/usb/files.usb @@ -1,4 +1,4 @@ -# $NetBSD: files.usb,v 1.92 2009/11/30 16:18:34 tsutsui Exp $ +# $NetBSD: files.usb,v 1.93 2009/12/23 01:04:45 pooka Exp $ # # Config file and device description for machine-independent USB code. # Included by ports that need it. Ports that use it must provide @@ -54,7 +54,6 @@ file dev/usb/ucom.c ucom | ucombus needs-flag # Generic devices -defflag UGEN_BULK_RA_WB device ugen attach ugen at usbdevif file dev/usb/ugen.c ugen needs-flag diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index f601ee3922ee..ce346a094f55 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.106 2009/12/06 21:40:31 dyoung Exp $ */ +/* $NetBSD: ugen.c,v 1.107 2009/12/23 01:04:45 pooka Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.106 2009/12/06 21:40:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.107 2009/12/23 01:04:45 pooka Exp $"); #include "opt_ugen_bulk_ra_wb.h" #include "opt_compat_netbsd.h" @@ -107,13 +107,11 @@ struct ugen_endpoint { u_char *limit; /* end of circular buffer (isoc) */ u_char *cur; /* current read location (isoc) */ u_int32_t timeout; -#ifdef UGEN_BULK_RA_WB u_int32_t ra_wb_bufsize; /* requested size for RA/WB buffer */ u_int32_t ra_wb_reqsize; /* requested xfer length for RA/WB */ u_int32_t ra_wb_used; /* how much is in buffer */ u_int32_t ra_wb_xferlen; /* current xfer length for RA/WB */ usbd_xfer_handle ra_wb_xfer; -#endif struct isoreq { struct ugen_endpoint *sce; usbd_xfer_handle xfer; @@ -183,12 +181,10 @@ Static void ugenintr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status); Static void ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status); -#ifdef UGEN_BULK_RA_WB Static void ugen_bulkra_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status); Static void ugen_bulkwb_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status); -#endif Static int ugen_do_read(struct ugen_softc *, int, struct uio *, int); Static int ugen_do_write(struct ugen_softc *, int, struct uio *, int); Static int ugen_do_ioctl(struct ugen_softc *, int, u_long, @@ -441,14 +437,12 @@ ugenopen(dev_t dev, int flag, int mode, struct lwp *l) edesc->bEndpointAddress, 0, &sce->pipeh); if (err) return (EIO); -#ifdef UGEN_BULK_RA_WB sce->ra_wb_bufsize = UGEN_BULK_RA_WB_BUFSIZE; /* * Use request size for non-RA/WB transfers * as the default. */ sce->ra_wb_reqsize = UGEN_BBSIZE; -#endif break; case UE_ISOCHRONOUS: if (dir == OUT) @@ -554,13 +548,11 @@ ugenclose(dev_t dev, int flag, int mode, struct lwp *l) for (i = 0; i < UGEN_NISOREQS; ++i) usbd_free_xfer(sce->isoreqs[i].xfer); break; -#ifdef UGEN_BULK_RA_WB case UE_BULK: if (sce->state & (UGEN_BULK_RA | UGEN_BULK_WB)) /* ibuf freed below */ usbd_free_xfer(sce->ra_wb_xfer); break; -#endif default: break; } @@ -644,7 +636,6 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) } break; case UE_BULK: -#ifdef UGEN_BULK_RA_WB if (sce->state & UGEN_BULK_RA) { DPRINTFN(5, ("ugenread: BULK_RA req: %zd used: %d\n", uio->uio_resid, sce->ra_wb_used)); @@ -717,7 +708,6 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) splx(s); break; } -#endif xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == 0) return (ENOMEM); @@ -813,11 +803,9 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][OUT]; u_int32_t n; int error = 0; -#ifdef UGEN_BULK_RA_WB int s; u_int32_t tn; char *dbuf; -#endif usbd_xfer_handle xfer; usbd_status err; @@ -842,7 +830,6 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, switch (sce->edesc->bmAttributes & UE_XFERTYPE) { case UE_BULK: -#ifdef UGEN_BULK_RA_WB if (sce->state & UGEN_BULK_WB) { DPRINTFN(5, ("ugenwrite: BULK_WB req: %zd used: %d\n", uio->uio_resid, sce->ra_wb_used)); @@ -924,7 +911,6 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, splx(s); break; } -#endif xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == 0) return (EIO); @@ -1169,7 +1155,6 @@ ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr, selnotify(&sce->rsel, 0, 0); } -#ifdef UGEN_BULK_RA_WB Static void ugen_bulkra_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) @@ -1301,7 +1286,6 @@ ugen_bulkwb_intr(usbd_xfer_handle xfer, usbd_private_handle addr, } selnotify(&sce->rsel, 0, 0); } -#endif Static usbd_status ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) @@ -1453,7 +1437,6 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, sce->timeout = *(int *)addr; return (0); case USB_SET_BULK_RA: -#ifdef UGEN_BULK_RA_WB if (endpt == USB_CONTROL_ENDPOINT) return (EINVAL); sce = &sc->sc_endpoints[endpt][IN]; @@ -1522,11 +1505,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, sce->ibuf = NULL; } return (0); -#else - return (EOPNOTSUPP); -#endif case USB_SET_BULK_WB: -#ifdef UGEN_BULK_RA_WB if (endpt == USB_CONTROL_ENDPOINT) return (EINVAL); sce = &sc->sc_endpoints[endpt][OUT]; @@ -1580,12 +1559,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, sce->ibuf = NULL; } return (0); -#else - return (EOPNOTSUPP); -#endif case USB_SET_BULK_RA_OPT: case USB_SET_BULK_WB_OPT: -#ifdef UGEN_BULK_RA_WB { struct usb_bulk_ra_wb_opt *opt; @@ -1612,9 +1587,6 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, sce->ra_wb_reqsize = opt->ra_wb_request_size; return (0); } -#else - return (EOPNOTSUPP); -#endif default: break; } @@ -1905,7 +1877,6 @@ ugenpoll(dev_t dev, int events, struct lwp *l) selrecord(l, &sce_in->rsel); break; case UE_BULK: -#ifdef UGEN_BULK_RA_WB if (sce_in->state & UGEN_BULK_RA) { if (sce_in->ra_wb_used > 0) revents |= events & @@ -1914,7 +1885,6 @@ ugenpoll(dev_t dev, int events, struct lwp *l) selrecord(l, &sce_in->rsel); break; } -#endif /* * We have no easy way of determining if a read will * yield any data or a write will happen. @@ -1932,7 +1902,6 @@ ugenpoll(dev_t dev, int events, struct lwp *l) /* XXX unimplemented */ break; case UE_BULK: -#ifdef UGEN_BULK_RA_WB if (sce_out->state & UGEN_BULK_WB) { if (sce_out->ra_wb_used < sce_out->limit - sce_out->ibuf) @@ -1942,7 +1911,6 @@ ugenpoll(dev_t dev, int events, struct lwp *l) selrecord(l, &sce_out->rsel); break; } -#endif /* * We have no easy way of determining if a read will * yield any data or a write will happen. @@ -1996,7 +1964,6 @@ filt_ugenread_isoc(struct knote *kn, long hint) return (1); } -#ifdef UGEN_BULK_RA_WB static int filt_ugenread_bulk(struct knote *kn, long hint) { @@ -2038,7 +2005,6 @@ filt_ugenwrite_bulk(struct knote *kn, long hint) return (1); } -#endif static const struct filterops ugenread_intr_filtops = { 1, NULL, filt_ugenrdetach, filt_ugenread_intr }; @@ -2046,16 +2012,11 @@ static const struct filterops ugenread_intr_filtops = static const struct filterops ugenread_isoc_filtops = { 1, NULL, filt_ugenrdetach, filt_ugenread_isoc }; -#ifdef UGEN_BULK_RA_WB static const struct filterops ugenread_bulk_filtops = { 1, NULL, filt_ugenrdetach, filt_ugenread_bulk }; static const struct filterops ugenwrite_bulk_filtops = { 1, NULL, filt_ugenrdetach, filt_ugenwrite_bulk }; -#else -static const struct filterops ugen_seltrue_filtops = - { 1, NULL, filt_ugenrdetach, filt_seltrue }; -#endif int ugenkqfilter(dev_t dev, struct knote *kn) @@ -2085,17 +2046,8 @@ ugenkqfilter(dev_t dev, struct knote *kn) kn->kn_fop = &ugenread_isoc_filtops; break; case UE_BULK: -#ifdef UGEN_BULK_RA_WB kn->kn_fop = &ugenread_bulk_filtops; break; -#else - /* - * We have no easy way of determining if a read will - * yield any data or a write will happen. - * So, emulate "seltrue". - */ - kn->kn_fop = &ugen_seltrue_filtops; -#endif break; default: return (EINVAL); @@ -2115,16 +2067,7 @@ ugenkqfilter(dev_t dev, struct knote *kn) return (EINVAL); case UE_BULK: -#ifdef UGEN_BULK_RA_WB kn->kn_fop = &ugenwrite_bulk_filtops; -#else - /* - * We have no easy way of determining if a read will - * yield any data or a write will happen. - * So, emulate "seltrue". - */ - kn->kn_fop = &ugen_seltrue_filtops; -#endif break; default: return (EINVAL);