More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
/* $NetBSD: usbdi.h,v 1.39 2000/01/19 00:23:59 augustss Exp $ */
|
1999-01-22 00:51:12 +00:00
|
|
|
/* $FreeBSD$ */
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
1999-01-07 23:07:57 +00:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Lennart Augustsson (augustss@carlstedt.se) at
|
|
|
|
* Carlstedt Research & Technology.
|
1998-11-26 23:13:13 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct usbd_bus *usbd_bus_handle;
|
|
|
|
typedef struct usbd_device *usbd_device_handle;
|
|
|
|
typedef struct usbd_interface *usbd_interface_handle;
|
|
|
|
typedef struct usbd_pipe *usbd_pipe_handle;
|
1999-11-17 22:33:51 +00:00
|
|
|
typedef struct usbd_xfer *usbd_xfer_handle;
|
1998-11-26 23:13:13 +00:00
|
|
|
typedef void *usbd_private_handle;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
typedef enum { /* keep in sync with usbd_status_msgs */
|
|
|
|
USBD_NORMAL_COMPLETION = 0, /* must be 0 */
|
1998-11-26 23:13:13 +00:00
|
|
|
USBD_IN_PROGRESS,
|
|
|
|
/* errors */
|
|
|
|
USBD_PENDING_REQUESTS,
|
|
|
|
USBD_NOT_STARTED,
|
|
|
|
USBD_INVAL,
|
|
|
|
USBD_NOMEM,
|
|
|
|
USBD_CANCELLED,
|
|
|
|
USBD_BAD_ADDRESS,
|
|
|
|
USBD_IN_USE,
|
|
|
|
USBD_NO_ADDR,
|
|
|
|
USBD_SET_ADDR_FAILED,
|
|
|
|
USBD_NO_POWER,
|
|
|
|
USBD_TOO_DEEP,
|
|
|
|
USBD_IOERROR,
|
|
|
|
USBD_NOT_CONFIGURED,
|
|
|
|
USBD_TIMEOUT,
|
|
|
|
USBD_SHORT_XFER,
|
|
|
|
USBD_STALLED,
|
1999-01-07 23:07:57 +00:00
|
|
|
USBD_INTERRUPTED,
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
USBD_ERROR_MAX, /* must be last */
|
1998-11-26 23:13:13 +00:00
|
|
|
} usbd_status;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
typedef void (*usbd_callback) __P((usbd_xfer_handle, usbd_private_handle,
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status));
|
|
|
|
|
|
|
|
/* Open flags */
|
|
|
|
#define USBD_EXCLUSIVE_USE 0x01
|
|
|
|
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
/* Use default (specified by ep. desc.) interval on interrupt pipe */
|
|
|
|
#define USBD_DEFAULT_INTERVAL (-1)
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
/* Request flags */
|
1999-11-17 22:33:51 +00:00
|
|
|
#define USBD_NO_COPY 0x01 /* do not copy data to DMA buffer */
|
|
|
|
#define USBD_SYNCHRONOUS 0x02 /* wait for completion */
|
1999-10-07 19:26:38 +00:00
|
|
|
/* in usb.h #define USBD_SHORT_XFER_OK 0x04*/ /* allow short reads */
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
#define USBD_FORCE_SHORT_XFER 0x08 /* force last short packet on write */
|
|
|
|
|
|
|
|
/* XXX Temporary hack XXX */
|
|
|
|
#define USBD_NO_TSLEEP 0x80 /* XXX use busy wait */
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#define USBD_NO_TIMEOUT 0
|
|
|
|
#define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */
|
|
|
|
|
1999-06-01 07:22:01 +00:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#define USB_CDEV_MAJOR 108
|
|
|
|
#endif
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status usbd_open_pipe
|
|
|
|
__P((usbd_interface_handle iface, u_int8_t address,
|
|
|
|
u_int8_t flags, usbd_pipe_handle *pipe));
|
|
|
|
usbd_status usbd_close_pipe __P((usbd_pipe_handle pipe));
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status usbd_transfer __P((usbd_xfer_handle req));
|
1999-11-28 21:01:06 +00:00
|
|
|
usbd_xfer_handle usbd_alloc_xfer __P((usbd_device_handle));
|
|
|
|
usbd_status usbd_free_xfer __P((usbd_xfer_handle xfer));
|
|
|
|
void usbd_setup_xfer
|
1999-11-17 22:33:51 +00:00
|
|
|
__P((usbd_xfer_handle xfer, usbd_pipe_handle pipe,
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_private_handle priv, void *buffer,
|
|
|
|
u_int32_t length, u_int16_t flags, u_int32_t timeout,
|
|
|
|
usbd_callback));
|
1999-11-28 21:01:06 +00:00
|
|
|
void usbd_setup_default_xfer
|
1999-11-17 22:33:51 +00:00
|
|
|
__P((usbd_xfer_handle xfer, usbd_device_handle dev,
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_private_handle priv, u_int32_t timeout,
|
|
|
|
usb_device_request_t *req, void *buffer,
|
|
|
|
u_int32_t length, u_int16_t flags, usbd_callback));
|
1999-11-28 21:01:06 +00:00
|
|
|
void usbd_setup_isoc_xfer
|
1999-11-17 22:33:51 +00:00
|
|
|
__P((usbd_xfer_handle xfer, usbd_pipe_handle pipe,
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_private_handle priv, u_int16_t *frlengths,
|
1999-11-17 22:33:51 +00:00
|
|
|
u_int32_t nframes, u_int16_t flags, usbd_callback));
|
1999-11-28 21:01:06 +00:00
|
|
|
void usbd_get_xfer_status
|
1999-11-17 22:33:51 +00:00
|
|
|
__P((usbd_xfer_handle xfer, usbd_private_handle *priv,
|
1998-11-26 23:13:13 +00:00
|
|
|
void **buffer, u_int32_t *count, usbd_status *status));
|
|
|
|
usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor
|
|
|
|
__P((usbd_interface_handle iface, u_int8_t address));
|
|
|
|
usbd_status usbd_abort_pipe __P((usbd_pipe_handle pipe));
|
|
|
|
usbd_status usbd_clear_endpoint_stall __P((usbd_pipe_handle pipe));
|
|
|
|
usbd_status usbd_clear_endpoint_stall_async __P((usbd_pipe_handle pipe));
|
2000-01-25 18:40:39 +00:00
|
|
|
void usbd_clear_endpoint_toggle __P((usbd_pipe_handle pipe));
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status usbd_endpoint_count
|
|
|
|
__P((usbd_interface_handle dev, u_int8_t *count));
|
|
|
|
usbd_status usbd_interface_count
|
|
|
|
__P((usbd_device_handle dev, u_int8_t *count));
|
|
|
|
usbd_status usbd_interface2device_handle
|
|
|
|
__P((usbd_interface_handle iface, usbd_device_handle *dev));
|
|
|
|
usbd_status usbd_device2interface_handle
|
1999-10-07 19:26:38 +00:00
|
|
|
__P((usbd_device_handle dev, u_int8_t ifaceno, usbd_interface_handle *iface));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_device_handle usbd_pipe2device_handle __P((usbd_pipe_handle));
|
1999-11-17 22:33:51 +00:00
|
|
|
void *usbd_alloc_buffer __P((usbd_xfer_handle req, u_int32_t size));
|
|
|
|
void usbd_free_buffer __P((usbd_xfer_handle req));
|
|
|
|
void *usbd_get_buffer __P((usbd_xfer_handle xfer));
|
|
|
|
usbd_status usbd_sync_transfer __P((usbd_xfer_handle req));
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status usbd_open_pipe_intr
|
|
|
|
__P((usbd_interface_handle iface, u_int8_t address,
|
|
|
|
u_int8_t flags, usbd_pipe_handle *pipe,
|
|
|
|
usbd_private_handle priv, void *buffer,
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
u_int32_t length, usbd_callback, int));
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status usbd_do_request
|
1999-10-07 19:26:38 +00:00
|
|
|
__P((usbd_device_handle pipe, usb_device_request_t *req, void *data));
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_status usbd_do_request_async
|
1999-10-07 19:26:38 +00:00
|
|
|
__P((usbd_device_handle pipe, usb_device_request_t *req, void *data));
|
1999-01-07 23:07:57 +00:00
|
|
|
usbd_status usbd_do_request_flags
|
1999-10-07 19:26:38 +00:00
|
|
|
__P((usbd_device_handle pipe, usb_device_request_t *req,
|
1999-01-07 23:07:57 +00:00
|
|
|
void *data, u_int16_t flags, int *));
|
1998-11-26 23:13:13 +00:00
|
|
|
usb_interface_descriptor_t *usbd_get_interface_descriptor
|
|
|
|
__P((usbd_interface_handle iface));
|
|
|
|
usb_config_descriptor_t *usbd_get_config_descriptor
|
|
|
|
__P((usbd_device_handle dev));
|
|
|
|
usb_device_descriptor_t *usbd_get_device_descriptor
|
|
|
|
__P((usbd_device_handle dev));
|
|
|
|
usbd_status usbd_set_interface __P((usbd_interface_handle, int));
|
1999-01-07 23:07:57 +00:00
|
|
|
int usbd_get_no_alts __P((usb_config_descriptor_t *, int));
|
|
|
|
usbd_status usbd_get_interface
|
|
|
|
__P((usbd_interface_handle iface, u_int8_t *aiface));
|
|
|
|
void usbd_fill_deviceinfo
|
|
|
|
__P((usbd_device_handle dev, struct usb_device_info *di));
|
|
|
|
int usbd_get_interface_altindex __P((usbd_interface_handle iface));
|
|
|
|
|
|
|
|
usb_interface_descriptor_t *usbd_find_idesc
|
|
|
|
__P((usb_config_descriptor_t *cd, int iindex, int ano));
|
|
|
|
usb_endpoint_descriptor_t *usbd_find_edesc
|
|
|
|
__P((usb_config_descriptor_t *cd, int ifaceidx, int altidx,
|
|
|
|
int endptidx));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
void usbd_dopoll __P((usbd_interface_handle));
|
|
|
|
void usbd_set_polling __P((usbd_interface_handle iface, int on));
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
const char *usbd_errstr __P((usbd_status err));
|
|
|
|
|
|
|
|
void usbd_add_event __P((int, usbd_device_handle));
|
|
|
|
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
void usbd_devinfo __P((usbd_device_handle, int, char *));
|
|
|
|
struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle));
|
|
|
|
usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor
|
|
|
|
__P((usbd_interface_handle iface, u_int8_t address));
|
|
|
|
|
|
|
|
usbd_status usbd_reload_device_desc __P((usbd_device_handle));
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
/* NetBSD attachment information */
|
|
|
|
|
|
|
|
/* Attach data */
|
|
|
|
struct usb_attach_arg {
|
1999-01-07 23:07:57 +00:00
|
|
|
int port;
|
|
|
|
int configno;
|
|
|
|
int ifaceno;
|
1999-10-07 19:26:38 +00:00
|
|
|
int vendor;
|
|
|
|
int product;
|
|
|
|
int release;
|
1999-01-07 23:07:57 +00:00
|
|
|
usbd_device_handle device; /* current device */
|
|
|
|
usbd_interface_handle iface; /* current interface */
|
1998-11-26 23:13:13 +00:00
|
|
|
int usegeneric;
|
1999-01-07 23:07:57 +00:00
|
|
|
usbd_interface_handle *ifaces; /* all interfaces */
|
|
|
|
int nifaces; /* number of interfaces */
|
1998-11-26 23:13:13 +00:00
|
|
|
};
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1998-11-26 23:13:13 +00:00
|
|
|
/* Match codes. */
|
|
|
|
/* First five codes is for a whole device. */
|
|
|
|
#define UMATCH_VENDOR_PRODUCT_REV 14
|
|
|
|
#define UMATCH_VENDOR_PRODUCT 13
|
|
|
|
#define UMATCH_VENDOR_DEVCLASS_DEVPROTO 12
|
|
|
|
#define UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO 11
|
|
|
|
#define UMATCH_DEVCLASS_DEVSUBCLASS 10
|
|
|
|
/* Next six codes are for interfaces. */
|
|
|
|
#define UMATCH_VENDOR_PRODUCT_REV_CONF_IFACE 9
|
|
|
|
#define UMATCH_VENDOR_PRODUCT_CONF_IFACE 8
|
|
|
|
#define UMATCH_VENDOR_IFACESUBCLASS_IFACEPROTO 7
|
|
|
|
#define UMATCH_VENDOR_IFACESUBCLASS 6
|
|
|
|
#define UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO 5
|
|
|
|
#define UMATCH_IFACECLASS_IFACESUBCLASS 4
|
|
|
|
#define UMATCH_IFACECLASS 3
|
|
|
|
#define UMATCH_IFACECLASS_GENERIC 2
|
|
|
|
/* Generic driver */
|
|
|
|
#define UMATCH_GENERIC 1
|
|
|
|
/* No match */
|
|
|
|
#define UMATCH_NONE 0
|
|
|
|
|
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
/* FreeBSD needs values less than zero */
|
1999-10-07 20:58:43 +00:00
|
|
|
#define UMATCH_VENDOR_PRODUCT_REV (-10)
|
|
|
|
#define UMATCH_VENDOR_PRODUCT (-20)
|
|
|
|
#define UMATCH_VENDOR_DEVCLASS_DEVPROTO (-30)
|
|
|
|
#define UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO (-40)
|
|
|
|
#define UMATCH_DEVCLASS_DEVSUBCLASS (-50)
|
|
|
|
#define UMATCH_VENDOR_PRODUCT_REV_CONF_IFACE (-60)
|
|
|
|
#define UMATCH_VENDOR_PRODUCT_CONF_IFACE (-70)
|
|
|
|
#define UMATCH_VENDOR_IFACESUBCLASS_IFACEPROTO (-80)
|
|
|
|
#define UMATCH_VENDOR_IFACESUBCLASS (-90)
|
|
|
|
#define UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO (-100)
|
|
|
|
#define UMATCH_IFACECLASS_IFACESUBCLASS (-110)
|
|
|
|
#define UMATCH_IFACECLASS (-120)
|
|
|
|
#define UMATCH_IFACECLASS_GENERIC (-130)
|
|
|
|
#define UMATCH_GENERIC (-140)
|
|
|
|
#define UMATCH_NONE (ENXIO)
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
#endif
|
1999-05-20 20:02:37 +00:00
|
|
|
|
1999-01-07 23:07:57 +00:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
int usbd_driver_load __P((module_t mod, int what, void *arg));
|
|
|
|
#endif
|
|
|
|
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* splusb MUST be the lowest level interrupt so that within USB callbacks
|
|
|
|
* the level can be raised the appropriate level.
|
|
|
|
* XXX Should probably use a softsplusb.
|
|
|
|
*/
|
1999-01-07 23:07:57 +00:00
|
|
|
/* XXX */
|
|
|
|
#define splusb splbio
|
|
|
|
#define IPL_USB IPL_BIO
|
|
|
|
/* XXX */
|