2002-05-28 20:51:43 +00:00
|
|
|
/* $NetBSD: ohci.c,v 1.125 2002/05/28 12:42:38 augustss Exp $ */
|
1999-01-13 00:50:02 +00:00
|
|
|
/* $FreeBSD$ */
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-08-16 09:10:43 +00:00
|
|
|
/* Also, already ported:
|
|
|
|
* $NetBSD: ohci.c,v 1.127 2002/08/07 20:03:19 augustss Exp $
|
|
|
|
*/
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
2000-05-14 16:43:10 +00:00
|
|
|
* by Lennart Augustsson (lennart@augustsson.net) at
|
1998-12-09 23:28:43 +00:00
|
|
|
* Carlstedt Research & Technology.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* USB Open Host Controller driver.
|
|
|
|
*
|
2002-04-01 21:13:22 +00:00
|
|
|
* OHCI spec: http://www.compaq.com/productinfo/development/openhci.html
|
|
|
|
* USB spec: http://www.usb.org/developers/data/usbspec.zip
|
1998-12-09 23:28:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/malloc.h>
|
1999-10-07 19:26:38 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1999-11-17 22:33:51 +00:00
|
|
|
#include <sys/kernel.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
#include <sys/device.h>
|
1999-11-08 21:06:21 +00:00
|
|
|
#include <sys/select.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
#elif defined(__FreeBSD__)
|
2002-04-26 22:48:23 +00:00
|
|
|
#include <sys/endian.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/bus.h>
|
1999-04-16 21:22:55 +00:00
|
|
|
#include <machine/bus_pio.h>
|
|
|
|
#include <machine/bus_memio.h>
|
1999-11-28 21:01:06 +00:00
|
|
|
#if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__)
|
1999-11-17 22:33:51 +00:00
|
|
|
#include <machine/cpu.h>
|
|
|
|
#endif
|
1999-04-16 21:22:55 +00:00
|
|
|
#endif
|
2002-04-07 16:36:30 +00:00
|
|
|
#include <sys/proc.h>
|
1999-11-17 22:33:51 +00:00
|
|
|
#include <sys/queue.h>
|
2002-07-31 13:33:55 +00:00
|
|
|
#include <sys/sysctl.h>
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
#include <machine/bus.h>
|
1999-01-07 23:07:57 +00:00
|
|
|
#include <machine/endian.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
#include <dev/usb/usb.h>
|
|
|
|
#include <dev/usb/usbdi.h>
|
|
|
|
#include <dev/usb/usbdivar.h>
|
|
|
|
#include <dev/usb/usb_mem.h>
|
1999-10-07 19:26:38 +00:00
|
|
|
#include <dev/usb/usb_quirks.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
#include <dev/usb/ohcireg.h>
|
|
|
|
#include <dev/usb/ohcivar.h>
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__)
|
2000-10-16 18:50:00 +00:00
|
|
|
#include <machine/clock.h>
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
#define delay(d) DELAY(d)
|
1999-04-11 20:50:33 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#if defined(__OpenBSD__)
|
|
|
|
struct cfdriver ohci_cd = {
|
|
|
|
NULL, "ohci", DV_DULL
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-04-11 20:50:33 +00:00
|
|
|
#define DPRINTF(x) if (ohcidebug) logprintf x
|
|
|
|
#define DPRINTFN(n,x) if (ohcidebug>(n)) logprintf x
|
2002-04-07 16:36:30 +00:00
|
|
|
int ohcidebug = 0;
|
2002-08-08 12:05:51 +00:00
|
|
|
SYSCTL_NODE(_hw_usb, OID_AUTO, ohci, CTLFLAG_RW, 0, "USB ohci");
|
|
|
|
SYSCTL_INT(_hw_usb_ohci, OID_AUTO, debug, CTLFLAG_RW,
|
2002-07-31 13:33:55 +00:00
|
|
|
&ohcidebug, 0, "ohci debug level");
|
2002-04-01 19:42:51 +00:00
|
|
|
#ifndef __NetBSD__
|
|
|
|
#define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
|
|
|
|
#endif
|
1999-04-11 20:50:33 +00:00
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
|
|
|
#define DPRINTFN(n,x)
|
1998-12-09 23:28:43 +00:00
|
|
|
#endif
|
|
|
|
|
2002-04-07 15:41:45 +00:00
|
|
|
/*
|
|
|
|
* The OHCI controller is little endian, so on big endian machines
|
|
|
|
* the data strored in memory needs to be swapped.
|
|
|
|
*/
|
|
|
|
#if defined(__OpenBSD__)
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
#define htole32(x) (bswap32(x))
|
|
|
|
#define le32toh(x) (bswap32(x))
|
|
|
|
#else
|
|
|
|
#define htole32(x) (x)
|
|
|
|
#define le32toh(x) (x)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
struct ohci_pipe;
|
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static ohci_soft_ed_t *ohci_alloc_sed(ohci_softc_t *);
|
|
|
|
Static void ohci_free_sed(ohci_softc_t *, ohci_soft_ed_t *);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static ohci_soft_td_t *ohci_alloc_std(ohci_softc_t *);
|
|
|
|
Static void ohci_free_std(ohci_softc_t *, ohci_soft_td_t *);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static ohci_soft_itd_t *ohci_alloc_sitd(ohci_softc_t *);
|
|
|
|
Static void ohci_free_sitd(ohci_softc_t *,ohci_soft_itd_t *);
|
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
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#if 0
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_free_std_chain(ohci_softc_t *, ohci_soft_td_t *,
|
|
|
|
ohci_soft_td_t *);
|
1999-11-17 22:33:51 +00:00
|
|
|
#endif
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status ohci_alloc_std_chain(struct ohci_pipe *,
|
2002-04-29 16:23:14 +00:00
|
|
|
ohci_softc_t *, int, int, usbd_xfer_handle,
|
2000-07-17 18:41:20 +00:00
|
|
|
ohci_soft_td_t *, ohci_soft_td_t **);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
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
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void ohci_shutdown(void *v);
|
|
|
|
Static void ohci_power(int, void *);
|
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
|
|
|
#endif
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status ohci_open(usbd_pipe_handle);
|
|
|
|
Static void ohci_poll(struct usbd_bus *);
|
2002-04-29 16:23:14 +00:00
|
|
|
Static void ohci_softintr(void *);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_waitintr(ohci_softc_t *, usbd_xfer_handle);
|
2002-04-01 13:18:11 +00:00
|
|
|
Static void ohci_add_done(ohci_softc_t *, ohci_physaddr_t);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void ohci_rhsc(ohci_softc_t *, usbd_xfer_handle);
|
|
|
|
|
|
|
|
Static usbd_status ohci_device_request(usbd_xfer_handle xfer);
|
|
|
|
Static void ohci_add_ed(ohci_soft_ed_t *, ohci_soft_ed_t *);
|
|
|
|
Static void ohci_rem_ed(ohci_soft_ed_t *, ohci_soft_ed_t *);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_hash_add_td(ohci_softc_t *, ohci_soft_td_t *);
|
|
|
|
Static void ohci_hash_rem_td(ohci_softc_t *, ohci_soft_td_t *);
|
|
|
|
Static ohci_soft_td_t *ohci_hash_find_td(ohci_softc_t *, ohci_physaddr_t);
|
2002-04-01 13:18:11 +00:00
|
|
|
Static void ohci_hash_add_itd(ohci_softc_t *, ohci_soft_itd_t *);
|
|
|
|
Static void ohci_hash_rem_itd(ohci_softc_t *, ohci_soft_itd_t *);
|
|
|
|
Static ohci_soft_itd_t *ohci_hash_find_itd(ohci_softc_t *, ohci_physaddr_t);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_setup_isoc(usbd_pipe_handle pipe);
|
|
|
|
Static void ohci_device_isoc_enter(usbd_xfer_handle);
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static usbd_status ohci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void ohci_freem(struct usbd_bus *, usb_dma_t *);
|
|
|
|
|
|
|
|
Static usbd_xfer_handle ohci_allocx(struct usbd_bus *);
|
|
|
|
Static void ohci_freex(struct usbd_bus *, usbd_xfer_handle);
|
|
|
|
|
|
|
|
Static usbd_status ohci_root_ctrl_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_root_ctrl_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_root_ctrl_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_root_ctrl_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_root_ctrl_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_root_intr_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_root_intr_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_root_intr_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_root_intr_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_root_intr_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_device_ctrl_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_device_ctrl_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_ctrl_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_ctrl_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_device_ctrl_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_device_bulk_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_device_bulk_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_bulk_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_bulk_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_device_bulk_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_device_intr_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_device_intr_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_intr_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_intr_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_device_intr_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static usbd_status ohci_device_isoc_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status ohci_device_isoc_start(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_isoc_abort(usbd_xfer_handle);
|
|
|
|
Static void ohci_device_isoc_close(usbd_pipe_handle);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_device_isoc_done(usbd_xfer_handle);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static usbd_status ohci_device_setintr(ohci_softc_t *sc,
|
2000-07-17 18:41:20 +00:00
|
|
|
struct ohci_pipe *pipe, int ival);
|
|
|
|
|
2001-07-05 10:09:22 +00:00
|
|
|
Static int ohci_str(usb_string_descriptor_t *, int, const char *);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static void ohci_timeout(void *);
|
2002-04-07 14:57:31 +00:00
|
|
|
Static void ohci_timeout_task(void *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void ohci_rhsc_able(ohci_softc_t *, int);
|
2002-04-07 10:09:23 +00:00
|
|
|
Static void ohci_rhsc_enable(void *);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void ohci_close_pipe(usbd_pipe_handle, ohci_soft_ed_t *);
|
|
|
|
Static void ohci_abort_xfer(usbd_xfer_handle, usbd_status);
|
2000-07-17 18:41:20 +00:00
|
|
|
|
|
|
|
Static void ohci_device_clear_toggle(usbd_pipe_handle pipe);
|
|
|
|
Static void ohci_noop(usbd_pipe_handle pipe);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void ohci_dumpregs(ohci_softc_t *);
|
|
|
|
Static void ohci_dump_tds(ohci_soft_td_t *);
|
|
|
|
Static void ohci_dump_td(ohci_soft_td_t *);
|
|
|
|
Static void ohci_dump_ed(ohci_soft_ed_t *);
|
2002-04-01 13:18:11 +00:00
|
|
|
Static void ohci_dump_itd(ohci_soft_itd_t *);
|
|
|
|
Static void ohci_dump_itds(ohci_soft_itd_t *);
|
1998-12-09 23:28:43 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-16 12:44:21 +00:00
|
|
|
#define OBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->sc_size, \
|
|
|
|
BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
|
|
|
|
#define OWRITE1(sc, r, x) \
|
|
|
|
do { OBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
|
|
|
|
#define OWRITE2(sc, r, x) \
|
|
|
|
do { OBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
|
|
|
|
#define OWRITE4(sc, r, x) \
|
|
|
|
do { OBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
|
|
|
|
#define OREAD1(sc, r) (OBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
|
|
|
|
#define OREAD2(sc, r) (OBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
|
|
|
|
#define OREAD4(sc, r) (OBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
/* Reverse the bits in a value 0 .. 31 */
|
2002-02-03 17:03:34 +00:00
|
|
|
Static u_int8_t revbits[OHCI_NO_INTRS] =
|
1998-12-09 23:28:43 +00:00
|
|
|
{ 0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0c, 0x1c,
|
|
|
|
0x02, 0x12, 0x0a, 0x1a, 0x06, 0x16, 0x0e, 0x1e,
|
|
|
|
0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d,
|
|
|
|
0x03, 0x13, 0x0b, 0x1b, 0x07, 0x17, 0x0f, 0x1f };
|
|
|
|
|
|
|
|
struct ohci_pipe {
|
|
|
|
struct usbd_pipe pipe;
|
|
|
|
ohci_soft_ed_t *sed;
|
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
|
|
|
union {
|
|
|
|
ohci_soft_td_t *td;
|
|
|
|
ohci_soft_itd_t *itd;
|
|
|
|
} tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Info needed for different pipe kinds. */
|
|
|
|
union {
|
|
|
|
/* Control pipe */
|
|
|
|
struct {
|
|
|
|
usb_dma_t reqdma;
|
|
|
|
u_int length;
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_soft_td_t *setup, *data, *stat;
|
1998-12-09 23:28:43 +00:00
|
|
|
} ctl;
|
|
|
|
/* Interrupt pipe */
|
|
|
|
struct {
|
|
|
|
int nslots;
|
|
|
|
int pos;
|
|
|
|
} intr;
|
|
|
|
/* Bulk pipe */
|
|
|
|
struct {
|
|
|
|
u_int length;
|
1999-10-07 19:26:38 +00:00
|
|
|
int isread;
|
1998-12-09 23:28:43 +00:00
|
|
|
} bulk;
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Iso pipe */
|
|
|
|
struct iso {
|
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
|
|
|
int next, inuse;
|
1999-10-07 19:26:38 +00:00
|
|
|
} iso;
|
1998-12-09 23:28:43 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OHCI_INTR_ENDPT 1
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static struct usbd_bus_methods ohci_bus_methods = {
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_open,
|
2002-01-26 12:04:22 +00:00
|
|
|
ohci_softintr,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_poll,
|
|
|
|
ohci_allocm,
|
|
|
|
ohci_freem,
|
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
|
|
|
ohci_allocx,
|
|
|
|
ohci_freex,
|
1999-10-07 19:26:38 +00:00
|
|
|
};
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_root_ctrl_methods = {
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_root_ctrl_transfer,
|
1999-01-07 23:07:57 +00:00
|
|
|
ohci_root_ctrl_start,
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_root_ctrl_abort,
|
|
|
|
ohci_root_ctrl_close,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_noop,
|
2002-01-21 04:15:39 +00:00
|
|
|
ohci_root_ctrl_done,
|
1998-12-09 23:28:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_root_intr_methods = {
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_root_intr_transfer,
|
1999-01-07 23:07:57 +00:00
|
|
|
ohci_root_intr_start,
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_root_intr_abort,
|
|
|
|
ohci_root_intr_close,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_noop,
|
|
|
|
ohci_root_intr_done,
|
1998-12-09 23:28:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_device_ctrl_methods = {
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_ctrl_transfer,
|
1999-01-07 23:07:57 +00:00
|
|
|
ohci_device_ctrl_start,
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_ctrl_abort,
|
|
|
|
ohci_device_ctrl_close,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_noop,
|
|
|
|
ohci_device_ctrl_done,
|
1998-12-09 23:28:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_device_intr_methods = {
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_intr_transfer,
|
1999-01-07 23:07:57 +00:00
|
|
|
ohci_device_intr_start,
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_intr_abort,
|
|
|
|
ohci_device_intr_close,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_device_clear_toggle,
|
|
|
|
ohci_device_intr_done,
|
1998-12-09 23:28:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_device_bulk_methods = {
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_bulk_transfer,
|
1999-01-07 23:07:57 +00:00
|
|
|
ohci_device_bulk_start,
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_device_bulk_abort,
|
|
|
|
ohci_device_bulk_close,
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_device_clear_toggle,
|
|
|
|
ohci_device_bulk_done,
|
1998-12-09 23:28:43 +00:00
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static struct usbd_pipe_methods ohci_device_isoc_methods = {
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_device_isoc_transfer,
|
|
|
|
ohci_device_isoc_start,
|
|
|
|
ohci_device_isoc_abort,
|
|
|
|
ohci_device_isoc_close,
|
|
|
|
ohci_noop,
|
|
|
|
ohci_device_isoc_done,
|
|
|
|
};
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
int
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_activate(device_ptr_t self, enum devact act)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
struct ohci_softc *sc = (struct ohci_softc *)self;
|
|
|
|
int rv = 0;
|
|
|
|
|
|
|
|
switch (act) {
|
|
|
|
case DVACT_ACTIVATE:
|
|
|
|
return (EOPNOTSUPP);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DVACT_DEACTIVATE:
|
|
|
|
if (sc->sc_child != NULL)
|
|
|
|
rv = config_deactivate(sc->sc_child);
|
2002-04-01 13:18:11 +00:00
|
|
|
sc->sc_dying = 1;
|
1999-11-17 22:33:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_detach(struct ohci_softc *sc, int flags)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
int rv = 0;
|
|
|
|
|
|
|
|
if (sc->sc_child != NULL)
|
|
|
|
rv = config_detach(sc->sc_child, flags);
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (rv != 0)
|
|
|
|
return (rv);
|
|
|
|
|
2002-04-07 10:09:23 +00:00
|
|
|
usb_uncallout(sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
|
|
|
|
|
2002-01-21 05:02:21 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
2000-03-15 22:27:24 +00:00
|
|
|
powerhook_disestablish(sc->sc_powerhook);
|
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
|
|
|
shutdownhook_disestablish(sc->sc_shutdownhook);
|
|
|
|
#endif
|
2002-04-07 15:07:23 +00:00
|
|
|
|
|
|
|
usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* free data structures XXX */
|
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_soft_ed_t *
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_alloc_sed(ohci_softc_t *sc)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_soft_ed_t *sed;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
int i, offs;
|
|
|
|
usb_dma_t dma;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_freeeds == NULL) {
|
1998-12-09 23:28:43 +00:00
|
|
|
DPRINTFN(2, ("ohci_alloc_sed: allocating chunk\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, OHCI_SED_SIZE * OHCI_SED_CHUNK,
|
|
|
|
OHCI_ED_ALIGN, &dma);
|
|
|
|
if (err)
|
2002-04-01 13:18:11 +00:00
|
|
|
return (NULL);
|
1999-10-07 19:26:38 +00:00
|
|
|
for(i = 0; i < OHCI_SED_CHUNK; i++) {
|
|
|
|
offs = i * OHCI_SED_SIZE;
|
2002-05-26 22:00:06 +00:00
|
|
|
sed = KERNADDR(&dma, offs);
|
2000-02-10 18:50:19 +00:00
|
|
|
sed->physaddr = DMAADDR(&dma, offs);
|
1998-12-09 23:28:43 +00:00
|
|
|
sed->next = sc->sc_freeeds;
|
|
|
|
sc->sc_freeeds = sed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sed = sc->sc_freeeds;
|
|
|
|
sc->sc_freeeds = sed->next;
|
1999-10-07 19:26:38 +00:00
|
|
|
memset(&sed->ed, 0, sizeof(ohci_ed_t));
|
1998-12-09 23:28:43 +00:00
|
|
|
sed->next = 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
return (sed);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_free_sed(ohci_softc_t *sc, ohci_soft_ed_t *sed)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
sed->next = sc->sc_freeeds;
|
|
|
|
sc->sc_freeeds = sed;
|
|
|
|
}
|
|
|
|
|
|
|
|
ohci_soft_td_t *
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_alloc_std(ohci_softc_t *sc)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_soft_td_t *std;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
int i, offs;
|
|
|
|
usb_dma_t dma;
|
2000-03-15 22:27:24 +00:00
|
|
|
int s;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_freetds == NULL) {
|
1998-12-09 23:28:43 +00:00
|
|
|
DPRINTFN(2, ("ohci_alloc_std: allocating chunk\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, OHCI_STD_SIZE * OHCI_STD_CHUNK,
|
|
|
|
OHCI_TD_ALIGN, &dma);
|
|
|
|
if (err)
|
2002-04-07 16:36:30 +00:00
|
|
|
return (NULL);
|
2002-01-21 05:02:21 +00:00
|
|
|
s = splusb();
|
1999-10-07 19:26:38 +00:00
|
|
|
for(i = 0; i < OHCI_STD_CHUNK; i++) {
|
|
|
|
offs = i * OHCI_STD_SIZE;
|
2002-05-26 22:00:06 +00:00
|
|
|
std = KERNADDR(&dma, offs);
|
2000-02-10 18:50:19 +00:00
|
|
|
std->physaddr = DMAADDR(&dma, offs);
|
1998-12-09 23:28:43 +00:00
|
|
|
std->nexttd = sc->sc_freetds;
|
|
|
|
sc->sc_freetds = std;
|
|
|
|
}
|
2002-01-21 05:02:21 +00:00
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
2002-01-21 05:02:21 +00:00
|
|
|
|
|
|
|
s = splusb();
|
1998-12-09 23:28:43 +00:00
|
|
|
std = sc->sc_freetds;
|
|
|
|
sc->sc_freetds = std->nexttd;
|
1999-10-07 19:26:38 +00:00
|
|
|
memset(&std->td, 0, sizeof(ohci_td_t));
|
2000-01-29 14:18:31 +00:00
|
|
|
std->nexttd = NULL;
|
2002-04-01 13:18:11 +00:00
|
|
|
std->xfer = NULL;
|
2000-03-15 22:27:24 +00:00
|
|
|
ohci_hash_add_td(sc, std);
|
|
|
|
splx(s);
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
return (std);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_free_std(ohci_softc_t *sc, ohci_soft_td_t *std)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2000-03-15 22:27:24 +00:00
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
ohci_hash_rem_td(sc, std);
|
1998-12-09 23:28:43 +00:00
|
|
|
std->nexttd = sc->sc_freetds;
|
|
|
|
sc->sc_freetds = std;
|
2002-01-21 05:02:21 +00:00
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_alloc_std_chain(struct ohci_pipe *opipe, ohci_softc_t *sc,
|
2002-04-29 16:23:14 +00:00
|
|
|
int alen, int rd, usbd_xfer_handle xfer,
|
|
|
|
ohci_soft_td_t *sp, ohci_soft_td_t **ep)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
ohci_soft_td_t *next, *cur;
|
|
|
|
ohci_physaddr_t dataphys, dataphysend;
|
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 intr, tdflags;
|
2000-02-10 18:50:19 +00:00
|
|
|
int offset = 0;
|
2002-04-29 16:23:14 +00:00
|
|
|
int len, curlen;
|
|
|
|
usb_dma_t *dma = &xfer->dmabuf;
|
|
|
|
u_int16_t flags = xfer->flags;
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-04-29 16:23:14 +00:00
|
|
|
DPRINTFN(alen < 4096,("ohci_alloc_std_chain: start len=%d\n", alen));
|
2000-02-10 18:50:19 +00:00
|
|
|
|
2002-04-29 16:23:14 +00:00
|
|
|
len = alen;
|
|
|
|
cur = sp;
|
2000-02-10 18:50:19 +00:00
|
|
|
|
2002-04-29 16:23:14 +00:00
|
|
|
dataphys = DMAADDR(dma, 0);
|
2002-12-20 18:47:39 +00:00
|
|
|
dataphysend = OHCI_PAGE(DMAADDR(dma, len - 1));
|
2002-04-29 16:23:14 +00:00
|
|
|
tdflags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
|
2002-04-07 16:36:30 +00:00
|
|
|
(flags & USBD_SHORT_XFER_OK ? OHCI_TD_R : 0) |
|
2002-04-29 16:23:14 +00:00
|
|
|
OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY);
|
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
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
for (;;) {
|
|
|
|
next = ohci_alloc_std(sc);
|
2002-04-07 16:36:30 +00:00
|
|
|
if (next == NULL)
|
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
|
|
|
goto nomem;
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
dataphys = DMAADDR(dma, offset);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* The OHCI hardware can handle at most one page crossing. */
|
2000-02-10 18:50:19 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
2002-12-20 18:47:39 +00:00
|
|
|
if (OHCI_PAGE(dataphys) == dataphysend ||
|
|
|
|
OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend)
|
2000-02-10 18:50:19 +00:00
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
/* XXX This is pretty broken: Because we do not allocate
|
|
|
|
* a contiguous buffer (contiguous in physical pages) we
|
|
|
|
* can only transfer one page in one go.
|
|
|
|
* So check whether the start and end of the buffer are on
|
|
|
|
* the same page.
|
|
|
|
*/
|
2002-12-20 18:47:39 +00:00
|
|
|
if (OHCI_PAGE(dataphys) == dataphysend)
|
2000-02-10 18:50:19 +00:00
|
|
|
#endif
|
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
/* we can handle it in this TD */
|
|
|
|
curlen = len;
|
|
|
|
} else {
|
2000-02-10 18:50:19 +00:00
|
|
|
/* XXX The calculation below is wrong and could
|
|
|
|
* result in a packet that is not a multiple of the
|
|
|
|
* MaxPacketSize in the case where the buffer does not
|
|
|
|
* start on an appropriate address (like for example in
|
|
|
|
* the case of an mbuf cluster). You'll get an early
|
|
|
|
* short packet.
|
|
|
|
*/
|
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1999-11-17 22:33:51 +00:00
|
|
|
/* must use multiple TDs, fill as much as possible. */
|
2002-02-03 17:03:34 +00:00
|
|
|
curlen = 2 * OHCI_PAGE_SIZE -
|
2000-02-10 18:50:19 +00:00
|
|
|
OHCI_PAGE_MASK(dataphys);
|
2002-12-20 18:47:39 +00:00
|
|
|
if (curlen > len) /* may have fit in one page */
|
|
|
|
curlen = len;
|
2000-02-10 18:50:19 +00:00
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
/* See comment above (XXX) */
|
2002-02-03 17:03:34 +00:00
|
|
|
curlen = OHCI_PAGE_SIZE -
|
2000-02-10 18:50:19 +00:00
|
|
|
OHCI_PAGE_MASK(dataphys);
|
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
}
|
|
|
|
DPRINTFN(4,("ohci_alloc_std_chain: dataphys=0x%08x "
|
|
|
|
"dataphysend=0x%08x len=%d curlen=%d\n",
|
|
|
|
dataphys, dataphysend,
|
|
|
|
len, curlen));
|
|
|
|
len -= curlen;
|
|
|
|
|
|
|
|
intr = len == 0 ? OHCI_TD_SET_DI(1) : OHCI_TD_NOINTR;
|
2001-12-30 23:02:31 +00:00
|
|
|
cur->td.td_flags = htole32(tdflags | intr);
|
|
|
|
cur->td.td_cbp = htole32(dataphys);
|
1999-11-17 22:33:51 +00:00
|
|
|
cur->nexttd = next;
|
2001-12-30 23:02:31 +00:00
|
|
|
cur->td.td_nexttd = htole32(next->physaddr);
|
|
|
|
cur->td.td_be = htole32(dataphys + curlen - 1);
|
1999-11-17 22:33:51 +00:00
|
|
|
cur->len = curlen;
|
|
|
|
cur->flags = OHCI_ADD_LEN;
|
|
|
|
DPRINTFN(10,("ohci_alloc_std_chain: cbp=0x%08x be=0x%08x\n",
|
|
|
|
dataphys, dataphys + curlen - 1));
|
|
|
|
if (len == 0)
|
|
|
|
break;
|
2002-12-20 18:47:39 +00:00
|
|
|
if (len < 0)
|
|
|
|
panic("Length went negative: %d curlen %d dma %p offset %08x", len, curlen, *dma, (int)offset);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(10,("ohci_alloc_std_chain: extend chain\n"));
|
2000-02-10 18:50:19 +00:00
|
|
|
offset += curlen;
|
1999-11-17 22:33:51 +00:00
|
|
|
cur = next;
|
|
|
|
}
|
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
|
|
|
if ((flags & USBD_FORCE_SHORT_XFER) &&
|
2002-04-29 16:23:14 +00:00
|
|
|
alen % UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize) == 0) {
|
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
|
|
|
/* Force a 0 length transfer at the end. */
|
2003-03-05 13:17:15 +00:00
|
|
|
|
|
|
|
cur->td.td_flags = htole32(tdflags | OHCI_TD_NOINTR);
|
|
|
|
cur = next;
|
|
|
|
|
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
|
|
|
next = ohci_alloc_std(sc);
|
2002-04-07 16:36:30 +00:00
|
|
|
if (next == NULL)
|
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
|
|
|
goto nomem;
|
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
cur->td.td_flags = htole32(tdflags | OHCI_TD_SET_DI(1));
|
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
|
|
|
cur->td.td_cbp = 0; /* indicate 0 length packet */
|
|
|
|
cur->nexttd = next;
|
2001-12-30 23:02:31 +00:00
|
|
|
cur->td.td_nexttd = htole32(next->physaddr);
|
2003-03-05 13:17:15 +00:00
|
|
|
cur->td.td_be = ~0;
|
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
|
|
|
cur->len = 0;
|
|
|
|
cur->flags = 0;
|
2002-04-29 16:23:14 +00:00
|
|
|
cur->xfer = xfer;
|
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
|
|
|
DPRINTFN(2,("ohci_alloc_std_chain: add 0 xfer\n"));
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
cur->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;
|
2002-04-29 16:23:14 +00:00
|
|
|
*ep = next;
|
1999-11-17 22:33:51 +00:00
|
|
|
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
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
|
|
|
|
|
|
|
nomem:
|
|
|
|
/* XXX free chain */
|
|
|
|
return (USBD_NOMEM);
|
1999-11-17 22:33:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_free_std_chain(ohci_softc_t *sc, ohci_soft_td_t *std,
|
|
|
|
ohci_soft_td_t *stdend)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
ohci_soft_td_t *p;
|
|
|
|
|
|
|
|
for (; std != stdend; std = p) {
|
|
|
|
p = std->nexttd;
|
|
|
|
ohci_free_std(sc, std);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#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
|
|
|
ohci_soft_itd_t *
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_alloc_sitd(ohci_softc_t *sc)
|
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
|
|
|
{
|
|
|
|
ohci_soft_itd_t *sitd;
|
|
|
|
usbd_status err;
|
2002-04-01 13:18:11 +00:00
|
|
|
int i, s, offs;
|
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
|
|
|
usb_dma_t dma;
|
|
|
|
|
|
|
|
if (sc->sc_freeitds == NULL) {
|
|
|
|
DPRINTFN(2, ("ohci_alloc_sitd: allocating chunk\n"));
|
2002-04-01 13:18:11 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, OHCI_SITD_SIZE * OHCI_SITD_CHUNK,
|
|
|
|
OHCI_ITD_ALIGN, &dma);
|
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
|
|
|
if (err)
|
2002-04-01 13:18:11 +00:00
|
|
|
return (NULL);
|
|
|
|
for(i = 0; i < OHCI_SITD_CHUNK; i++) {
|
|
|
|
offs = i * OHCI_SITD_SIZE;
|
2002-05-26 22:00:06 +00:00
|
|
|
sitd = KERNADDR(&dma, offs);
|
2000-02-10 18:50:19 +00:00
|
|
|
sitd->physaddr = DMAADDR(&dma, offs);
|
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
|
|
|
sitd->nextitd = sc->sc_freeitds;
|
|
|
|
sc->sc_freeitds = sitd;
|
|
|
|
}
|
|
|
|
}
|
2002-04-01 13:18:11 +00:00
|
|
|
|
|
|
|
s = splusb();
|
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
|
|
|
sitd = sc->sc_freeitds;
|
|
|
|
sc->sc_freeitds = sitd->nextitd;
|
|
|
|
memset(&sitd->itd, 0, sizeof(ohci_itd_t));
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd->nextitd = NULL;
|
|
|
|
sitd->xfer = NULL;
|
|
|
|
ohci_hash_add_itd(sc, sitd);
|
|
|
|
splx(s);
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
sitd->isdone = 0;
|
|
|
|
#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
|
|
|
return (sitd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_free_sitd(ohci_softc_t *sc, ohci_soft_itd_t *sitd)
|
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
|
|
|
{
|
2002-04-01 13:18:11 +00:00
|
|
|
int s;
|
|
|
|
|
|
|
|
DPRINTFN(10,("ohci_free_sitd: sitd=%p\n", sitd));
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (!sitd->isdone) {
|
|
|
|
panic("ohci_free_sitd: sitd=%p not done\n", sitd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
ohci_hash_rem_itd(sc, sitd);
|
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
|
|
|
sitd->nextitd = sc->sc_freeitds;
|
|
|
|
sc->sc_freeitds = sitd;
|
2002-04-01 13:18:11 +00:00
|
|
|
splx(s);
|
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
|
|
|
}
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_init(ohci_softc_t *sc)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_soft_ed_t *sed, *psed;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
int i;
|
2002-01-21 04:24:33 +00:00
|
|
|
u_int32_t s, ctl, ival, hcr, fm, per, rev, desca;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
DPRINTF(("ohci_init: start\n"));
|
1999-10-07 19:26:38 +00:00
|
|
|
#if defined(__OpenBSD__)
|
1999-11-17 22:33:51 +00:00
|
|
|
printf(",");
|
1999-10-07 19:26:38 +00:00
|
|
|
#else
|
1999-11-28 21:01:06 +00:00
|
|
|
printf("%s:", USBDEVNAME(sc->sc_bus.bdev));
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1999-11-28 21:01:06 +00:00
|
|
|
rev = OREAD4(sc, OHCI_REVISION);
|
1999-11-17 22:33:51 +00:00
|
|
|
printf(" OHCI version %d.%d%s\n", OHCI_REV_HI(rev), OHCI_REV_LO(rev),
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_REV_LEGACY(rev) ? ", legacy support" : "");
|
1999-11-17 22:33:51 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) {
|
2002-02-03 17:03:34 +00:00
|
|
|
printf("%s: unsupported OHCI revision\n",
|
1999-01-07 23:07:57 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
1999-11-28 21:01:06 +00:00
|
|
|
sc->sc_bus.usbrev = USBREV_UNKNOWN;
|
1998-12-09 23:28:43 +00:00
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
1999-11-28 21:01:06 +00:00
|
|
|
sc->sc_bus.usbrev = USBREV_1_0;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
for (i = 0; i < OHCI_HASH_SIZE; i++)
|
2002-04-01 13:18:11 +00:00
|
|
|
LIST_INIT(&sc->sc_hash_itds[i]);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
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
|
|
|
SIMPLEQ_INIT(&sc->sc_free_xfers);
|
|
|
|
|
2002-01-26 12:04:22 +00:00
|
|
|
/* XXX determine alignment by R/W */
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Allocate the HCCA area. */
|
2002-02-03 17:03:34 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, OHCI_HCCA_SIZE,
|
1999-11-28 21:01:06 +00:00
|
|
|
OHCI_HCCA_ALIGN, &sc->sc_hccadma);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err)
|
|
|
|
return (err);
|
2002-05-26 22:00:06 +00:00
|
|
|
sc->sc_hcca = KERNADDR(&sc->sc_hccadma, 0);
|
1998-12-09 23:28:43 +00:00
|
|
|
memset(sc->sc_hcca, 0, OHCI_HCCA_SIZE);
|
|
|
|
|
|
|
|
sc->sc_eintrs = OHCI_NORMAL_INTRS;
|
|
|
|
|
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
|
|
|
/* Allocate dummy ED that starts the control list. */
|
1998-12-09 23:28:43 +00:00
|
|
|
sc->sc_ctrl_head = ohci_alloc_sed(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_ctrl_head == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad1;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
sc->sc_ctrl_head->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
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
|
|
|
/* Allocate dummy ED that starts the bulk list. */
|
1998-12-09 23:28:43 +00:00
|
|
|
sc->sc_bulk_head = ohci_alloc_sed(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_bulk_head == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad2;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
sc->sc_bulk_head->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
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
|
|
|
/* Allocate dummy ED that starts the isochronous list. */
|
|
|
|
sc->sc_isoc_head = ohci_alloc_sed(sc);
|
|
|
|
if (sc->sc_isoc_head == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
|
|
|
goto bad3;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
sc->sc_isoc_head->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
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
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Allocate all the dummy EDs that make up the interrupt tree. */
|
|
|
|
for (i = 0; i < OHCI_NO_EDS; i++) {
|
|
|
|
sed = ohci_alloc_sed(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sed == NULL) {
|
1998-12-09 23:28:43 +00:00
|
|
|
while (--i >= 0)
|
|
|
|
ohci_free_sed(sc, sc->sc_eds[i]);
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_NOMEM;
|
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
|
|
|
goto bad4;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
/* All ED fields are set to 0. */
|
|
|
|
sc->sc_eds[i] = sed;
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
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
|
|
|
if (i != 0)
|
1998-12-09 23:28:43 +00:00
|
|
|
psed = sc->sc_eds[(i-1) / 2];
|
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
|
|
|
else
|
|
|
|
psed= sc->sc_isoc_head;
|
|
|
|
sed->next = psed;
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_nexted = htole32(psed->physaddr);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1998-12-09 23:28:43 +00:00
|
|
|
* Fill HCCA interrupt table. The bit reversal is to get
|
|
|
|
* the tree set up properly to spread the interrupts.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < OHCI_NO_INTRS; i++)
|
2002-02-03 17:03:34 +00:00
|
|
|
sc->sc_hcca->hcca_interrupt_table[revbits[i]] =
|
2001-12-30 23:02:31 +00:00
|
|
|
htole32(sc->sc_eds[OHCI_NO_EDS-OHCI_NO_INTRS+i]->physaddr);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-26 12:04:22 +00:00
|
|
|
if (ohcidebug > 15) {
|
|
|
|
for (i = 0; i < OHCI_NO_EDS; i++) {
|
|
|
|
printf("ed#%d ", i);
|
|
|
|
ohci_dump_ed(sc->sc_eds[i]);
|
|
|
|
}
|
|
|
|
printf("iso ");
|
|
|
|
ohci_dump_ed(sc->sc_isoc_head);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Determine in what context we are running. */
|
|
|
|
ctl = OREAD4(sc, OHCI_CONTROL);
|
|
|
|
if (ctl & OHCI_IR) {
|
|
|
|
/* SMM active, request change */
|
|
|
|
DPRINTF(("ohci_init: SMM active, request owner change\n"));
|
|
|
|
s = OREAD4(sc, OHCI_COMMAND_STATUS);
|
|
|
|
OWRITE4(sc, OHCI_COMMAND_STATUS, s | OHCI_OCR);
|
|
|
|
for (i = 0; i < 100 && (ctl & OHCI_IR); i++) {
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
1998-12-09 23:28:43 +00:00
|
|
|
ctl = OREAD4(sc, OHCI_CONTROL);
|
|
|
|
}
|
|
|
|
if ((ctl & OHCI_IR) == 0) {
|
1999-01-07 23:07:57 +00:00
|
|
|
printf("%s: SMM does not respond, resetting\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
|
|
|
goto reset;
|
|
|
|
}
|
2002-04-07 10:04:16 +00:00
|
|
|
#if 0
|
2002-04-07 16:36:30 +00:00
|
|
|
/* Don't bother trying to reuse the BIOS init, we'll reset it anyway. */
|
1998-12-09 23:28:43 +00:00
|
|
|
} else if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_RESET) {
|
|
|
|
/* BIOS started controller. */
|
|
|
|
DPRINTF(("ohci_init: BIOS active\n"));
|
|
|
|
if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_OPERATIONAL) {
|
|
|
|
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_OPERATIONAL);
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
2002-04-07 10:04:16 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
} else {
|
|
|
|
DPRINTF(("ohci_init: cold started\n"));
|
|
|
|
reset:
|
|
|
|
/* Controller was cold started. */
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, USB_BUS_RESET_DELAY);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-01-07 23:07:57 +00:00
|
|
|
/*
|
|
|
|
* This reset should not be necessary according to the OHCI spec, but
|
|
|
|
* without it some controllers do not start.
|
|
|
|
*/
|
|
|
|
DPRINTF(("%s: resetting\n", USBDEVNAME(sc->sc_bus.bdev)));
|
|
|
|
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, USB_BUS_RESET_DELAY);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/* We now own the host controller and the bus has been reset. */
|
|
|
|
ival = OHCI_GET_IVAL(OREAD4(sc, OHCI_FM_INTERVAL));
|
|
|
|
|
|
|
|
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_HCR); /* Reset HC */
|
|
|
|
/* Nominal time for a reset is 10 us. */
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
delay(10);
|
|
|
|
hcr = OREAD4(sc, OHCI_COMMAND_STATUS) & OHCI_HCR;
|
|
|
|
if (!hcr)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (hcr) {
|
1999-01-07 23:07:57 +00:00
|
|
|
printf("%s: reset timeout\n", USBDEVNAME(sc->sc_bus.bdev));
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
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
|
|
|
goto bad5;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
if (ohcidebug > 15)
|
|
|
|
ohci_dumpregs(sc);
|
|
|
|
#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
|
|
|
/* The controller is now in SUSPEND state, we have 2ms to finish. */
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
/* Set up HC registers. */
|
2000-02-10 18:50:19 +00:00
|
|
|
OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
|
|
|
|
OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
|
1999-11-17 22:33:51 +00:00
|
|
|
/* disable all interrupts and then switch on all desired interrupts */
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_ENABLE, sc->sc_eintrs | OHCI_MIE);
|
1999-11-17 22:33:51 +00:00
|
|
|
/* switch on desired functional features */
|
1998-12-09 23:28:43 +00:00
|
|
|
ctl = OREAD4(sc, OHCI_CONTROL);
|
|
|
|
ctl &= ~(OHCI_CBSR_MASK | OHCI_LES | OHCI_HCFS_MASK | OHCI_IR);
|
|
|
|
ctl |= OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE |
|
|
|
|
OHCI_RATIO_1_4 | OHCI_HCFS_OPERATIONAL;
|
|
|
|
/* And finally start it! */
|
|
|
|
OWRITE4(sc, OHCI_CONTROL, ctl);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The controller is now OPERATIONAL. Set a some final
|
|
|
|
* registers that should be set earlier, but that the
|
|
|
|
* controller ignores when in the SUSPEND state.
|
|
|
|
*/
|
|
|
|
fm = (OREAD4(sc, OHCI_FM_INTERVAL) & OHCI_FIT) ^ OHCI_FIT;
|
|
|
|
fm |= OHCI_FSMPS(ival) | ival;
|
|
|
|
OWRITE4(sc, OHCI_FM_INTERVAL, fm);
|
|
|
|
per = OHCI_PERIODIC(ival); /* 90% periodic */
|
|
|
|
OWRITE4(sc, OHCI_PERIODIC_START, per);
|
|
|
|
|
2002-01-21 04:24:33 +00:00
|
|
|
/* Fiddle the No OverCurrent Protection bit to avoid chip bug. */
|
|
|
|
desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
|
|
|
|
OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
|
|
|
|
OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
|
2002-04-01 13:21:43 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, OHCI_ENABLE_POWER_DELAY);
|
2002-01-21 04:24:33 +00:00
|
|
|
OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-04-01 13:21:43 +00:00
|
|
|
/*
|
|
|
|
* The AMD756 requires a delay before re-reading the register,
|
|
|
|
* otherwise it will occasionally report 0 ports.
|
|
|
|
*/
|
|
|
|
usb_delay_ms(&sc->sc_bus, OHCI_READ_DESC_DELAY);
|
1998-12-09 23:28:43 +00:00
|
|
|
sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
if (ohcidebug > 5)
|
|
|
|
ohci_dumpregs(sc);
|
|
|
|
#endif
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Set up the bus struct. */
|
1999-10-07 19:26:38 +00:00
|
|
|
sc->sc_bus.methods = &ohci_bus_methods;
|
1998-12-09 23:28:43 +00:00
|
|
|
sc->sc_bus.pipe_size = sizeof(struct ohci_pipe);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
2002-04-07 14:31:03 +00:00
|
|
|
sc->sc_control = sc->sc_intre = 0;
|
2000-03-15 22:27:24 +00:00
|
|
|
sc->sc_powerhook = powerhook_establish(ohci_power, sc);
|
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
|
|
|
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
|
|
|
|
#endif
|
2000-01-27 23:25:58 +00:00
|
|
|
|
2002-04-07 10:09:23 +00:00
|
|
|
usb_callout_init(sc->sc_tmo_rhsc);
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
|
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
|
|
|
bad5:
|
|
|
|
for (i = 0; i < OHCI_NO_EDS; i++)
|
|
|
|
ohci_free_sed(sc, sc->sc_eds[i]);
|
|
|
|
bad4:
|
|
|
|
ohci_free_sed(sc, sc->sc_isoc_head);
|
1998-12-09 23:28:43 +00:00
|
|
|
bad3:
|
|
|
|
ohci_free_sed(sc, sc->sc_ctrl_head);
|
|
|
|
bad2:
|
|
|
|
ohci_free_sed(sc, sc->sc_bulk_head);
|
|
|
|
bad1:
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_freemem(&sc->sc_bus, &sc->sc_hccadma);
|
|
|
|
return (err);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
struct ohci_softc *sc = (struct ohci_softc *)bus;
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
return (usb_allocmem(&sc->sc_bus, size, 0, dma));
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_freem(struct usbd_bus *bus, usb_dma_t *dma)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
struct ohci_softc *sc = (struct ohci_softc *)bus;
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_freemem(&sc->sc_bus, dma);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
usbd_xfer_handle
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_allocx(struct usbd_bus *bus)
|
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
|
|
|
{
|
|
|
|
struct ohci_softc *sc = (struct ohci_softc *)bus;
|
|
|
|
usbd_xfer_handle xfer;
|
|
|
|
|
|
|
|
xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
|
2002-04-07 15:12:07 +00:00
|
|
|
if (xfer != NULL) {
|
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
|
|
|
SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, xfer, next);
|
2002-04-07 15:12:07 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->busy_free != XFER_FREE) {
|
|
|
|
printf("ohci_allocx: xfer=%p not free, 0x%08x\n", xfer,
|
|
|
|
xfer->busy_free);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
} else {
|
2002-04-07 14:57:31 +00:00
|
|
|
xfer = malloc(sizeof(struct ohci_xfer), M_USB, M_NOWAIT);
|
2002-04-07 15:12:07 +00:00
|
|
|
}
|
|
|
|
if (xfer != NULL) {
|
2002-04-07 14:57:31 +00:00
|
|
|
memset(xfer, 0, sizeof (struct ohci_xfer));
|
2002-04-07 15:12:07 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
xfer->busy_free = XFER_BUSY;
|
|
|
|
#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
|
|
|
return (xfer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
|
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
|
|
|
{
|
|
|
|
struct ohci_softc *sc = (struct ohci_softc *)bus;
|
|
|
|
|
2002-04-07 15:12:07 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->busy_free != XFER_BUSY) {
|
|
|
|
printf("ohci_freex: xfer=%p not busy, 0x%08x\n", xfer,
|
2002-04-07 16:36:30 +00:00
|
|
|
xfer->busy_free);
|
2002-04-07 15:12:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
xfer->busy_free = XFER_FREE;
|
|
|
|
#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
|
|
|
SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Shut down the controller when the system is going down.
|
|
|
|
*/
|
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_shutdown(void *v)
|
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
|
|
|
{
|
|
|
|
ohci_softc_t *sc = v;
|
|
|
|
|
|
|
|
DPRINTF(("ohci_shutdown: stopping the HC\n"));
|
|
|
|
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle suspend/resume.
|
|
|
|
*
|
|
|
|
* We need to switch to polling mode here, because this routine is
|
|
|
|
* called from an intterupt context. This is all right since we
|
|
|
|
* are almost suspended anyway.
|
|
|
|
*/
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_power(int why, void *v)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
ohci_softc_t *sc = v;
|
2002-04-07 14:34:23 +00:00
|
|
|
u_int32_t ctl;
|
2002-04-07 14:31:03 +00:00
|
|
|
int s;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_power: sc=%p, why=%d\n", sc, why));
|
|
|
|
ohci_dumpregs(sc);
|
|
|
|
#endif
|
2002-04-07 14:31:03 +00:00
|
|
|
|
2002-04-07 14:40:15 +00:00
|
|
|
s = splhardusb();
|
2002-04-07 14:31:03 +00:00
|
|
|
switch (why) {
|
|
|
|
case PWR_SUSPEND:
|
|
|
|
case PWR_STANDBY:
|
2002-04-07 14:34:23 +00:00
|
|
|
sc->sc_bus.use_polling++;
|
2002-04-07 14:40:15 +00:00
|
|
|
ctl = OREAD4(sc, OHCI_CONTROL) & ~OHCI_HCFS_MASK;
|
|
|
|
if (sc->sc_control == 0) {
|
|
|
|
/*
|
|
|
|
* Preserve register values, in case that APM BIOS
|
|
|
|
* does not recover them.
|
|
|
|
*/
|
|
|
|
sc->sc_control = ctl;
|
|
|
|
sc->sc_intre = OREAD4(sc, OHCI_INTERRUPT_ENABLE);
|
|
|
|
}
|
|
|
|
ctl |= OHCI_HCFS_SUSPEND;
|
2002-04-07 14:34:23 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL, ctl);
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
|
|
|
|
sc->sc_bus.use_polling--;
|
2002-04-07 14:31:03 +00:00
|
|
|
break;
|
|
|
|
case PWR_RESUME:
|
2002-04-07 14:34:23 +00:00
|
|
|
sc->sc_bus.use_polling++;
|
2002-04-07 14:40:15 +00:00
|
|
|
/* Some broken BIOSes do not recover these values */
|
2002-05-26 22:13:09 +00:00
|
|
|
OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
|
2002-04-07 14:40:15 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
|
|
|
|
OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
|
|
|
|
if (sc->sc_intre)
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_ENABLE,
|
|
|
|
sc->sc_intre & (OHCI_ALL_INTRS | OHCI_MIE));
|
|
|
|
if (sc->sc_control)
|
|
|
|
ctl = sc->sc_control;
|
|
|
|
else
|
|
|
|
ctl = OREAD4(sc, OHCI_CONTROL);
|
|
|
|
ctl |= OHCI_HCFS_RESUME;
|
2002-04-07 14:34:23 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL, ctl);
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
|
|
|
|
ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL;
|
|
|
|
OWRITE4(sc, OHCI_CONTROL, ctl);
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
|
2002-04-07 14:40:15 +00:00
|
|
|
sc->sc_control = sc->sc_intre = 0;
|
2002-04-07 14:34:23 +00:00
|
|
|
sc->sc_bus.use_polling--;
|
2002-04-07 14:31:03 +00:00
|
|
|
break;
|
|
|
|
case PWR_SOFTSUSPEND:
|
|
|
|
case PWR_SOFTSTANDBY:
|
|
|
|
case PWR_SOFTRESUME:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
splx(s);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
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
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_dumpregs(ohci_softc_t *sc)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_dumpregs: rev=0x%08x control=0x%08x command=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_REVISION),
|
|
|
|
OREAD4(sc, OHCI_CONTROL),
|
|
|
|
OREAD4(sc, OHCI_COMMAND_STATUS)));
|
|
|
|
DPRINTF((" intrstat=0x%08x intre=0x%08x intrd=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_INTERRUPT_STATUS),
|
|
|
|
OREAD4(sc, OHCI_INTERRUPT_ENABLE),
|
|
|
|
OREAD4(sc, OHCI_INTERRUPT_DISABLE)));
|
|
|
|
DPRINTF((" hcca=0x%08x percur=0x%08x ctrlhd=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_HCCA),
|
|
|
|
OREAD4(sc, OHCI_PERIOD_CURRENT_ED),
|
|
|
|
OREAD4(sc, OHCI_CONTROL_HEAD_ED)));
|
|
|
|
DPRINTF((" ctrlcur=0x%08x bulkhd=0x%08x bulkcur=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_CONTROL_CURRENT_ED),
|
|
|
|
OREAD4(sc, OHCI_BULK_HEAD_ED),
|
|
|
|
OREAD4(sc, OHCI_BULK_CURRENT_ED)));
|
|
|
|
DPRINTF((" done=0x%08x fmival=0x%08x fmrem=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_DONE_HEAD),
|
|
|
|
OREAD4(sc, OHCI_FM_INTERVAL),
|
|
|
|
OREAD4(sc, OHCI_FM_REMAINING)));
|
|
|
|
DPRINTF((" fmnum=0x%08x perst=0x%08x lsthrs=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_FM_NUMBER),
|
|
|
|
OREAD4(sc, OHCI_PERIODIC_START),
|
|
|
|
OREAD4(sc, OHCI_LS_THRESHOLD)));
|
|
|
|
DPRINTF((" desca=0x%08x descb=0x%08x stat=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_RH_DESCRIPTOR_A),
|
|
|
|
OREAD4(sc, OHCI_RH_DESCRIPTOR_B),
|
|
|
|
OREAD4(sc, OHCI_RH_STATUS)));
|
|
|
|
DPRINTF((" port1=0x%08x port2=0x%08x\n",
|
|
|
|
OREAD4(sc, OHCI_RH_PORT_STATUS(1)),
|
|
|
|
OREAD4(sc, OHCI_RH_PORT_STATUS(2))));
|
|
|
|
DPRINTF((" HCCA: frame_number=0x%04x done_head=0x%08x\n",
|
2001-12-30 23:02:31 +00:00
|
|
|
le32toh(sc->sc_hcca->hcca_frame_number),
|
|
|
|
le32toh(sc->sc_hcca->hcca_done_head)));
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static int ohci_intr1(ohci_softc_t *);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
int
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_intr(void *p)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_softc_t *sc = p;
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc == NULL || sc->sc_dying)
|
2002-04-07 14:45:38 +00:00
|
|
|
return (0);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* If we get an interrupt while polling, then just ignore it. */
|
2000-01-10 22:33:43 +00:00
|
|
|
if (sc->sc_bus.use_polling) {
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("ohci_intr: ignored interrupt while polling\n");
|
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
return (0);
|
2000-01-10 22:33:43 +00:00
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
return (ohci_intr1(sc));
|
1999-11-17 22:33:51 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static int
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_intr1(ohci_softc_t *sc)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
1999-01-22 00:51:12 +00:00
|
|
|
u_int32_t intrs, eintrs;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_physaddr_t done;
|
|
|
|
|
2002-04-07 10:12:40 +00:00
|
|
|
DPRINTFN(14,("ohci_intr1: enter\n"));
|
|
|
|
|
1999-01-07 23:07:57 +00:00
|
|
|
/* In case the interrupt occurs before initialization has completed. */
|
1999-10-07 19:26:38 +00:00
|
|
|
if (sc == NULL || sc->sc_hcca == NULL) {
|
1999-01-07 23:07:57 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("ohci_intr: sc->sc_hcca == NULL\n");
|
|
|
|
#endif
|
1998-12-11 06:02:06 +00:00
|
|
|
return (0);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
1998-12-11 06:02:06 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
intrs = 0;
|
2001-12-30 23:02:31 +00:00
|
|
|
done = le32toh(sc->sc_hcca->hcca_done_head);
|
2000-01-26 08:46:41 +00:00
|
|
|
|
|
|
|
/* The LSb of done is used to inform the HC Driver that an interrupt
|
|
|
|
* condition exists for both the Done list and for another event
|
|
|
|
* recorded in HcInterruptStatus. On an interrupt from the HC, the HC
|
|
|
|
* Driver checks the HccaDoneHead Value. If this value is 0, then the
|
|
|
|
* interrupt was caused by other than the HccaDoneHead update and the
|
|
|
|
* HcInterruptStatus register needs to be accessed to determine that
|
|
|
|
* exact interrupt cause. If HccaDoneHead is nonzero, then a Done list
|
|
|
|
* update interrupt is indicated and if the LSb of done is nonzero,
|
|
|
|
* then an additional interrupt event is indicated and
|
|
|
|
* HcInterruptStatus should be checked to determine its cause.
|
|
|
|
*/
|
1998-12-09 23:28:43 +00:00
|
|
|
if (done != 0) {
|
1999-01-13 00:50:02 +00:00
|
|
|
if (done & ~OHCI_DONE_INTRS)
|
|
|
|
intrs = OHCI_WDH;
|
2000-01-26 08:46:41 +00:00
|
|
|
if (done & OHCI_DONE_INTRS) {
|
1998-12-09 23:28:43 +00:00
|
|
|
intrs |= OREAD4(sc, OHCI_INTERRUPT_STATUS);
|
2000-01-26 08:46:41 +00:00
|
|
|
done &= ~OHCI_DONE_INTRS;
|
|
|
|
}
|
2002-05-26 22:11:34 +00:00
|
|
|
sc->sc_hcca->hcca_done_head = 0;
|
2002-04-29 16:23:14 +00:00
|
|
|
} else
|
1998-12-09 23:28:43 +00:00
|
|
|
intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2001-08-23 01:16:10 +00:00
|
|
|
if (intrs == 0) /* nothing to be done (PCI shared interrupt) */
|
1998-12-09 23:28:43 +00:00
|
|
|
return (0);
|
2000-01-26 08:46:41 +00:00
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
intrs &= ~OHCI_MIE;
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_STATUS, intrs); /* Acknowledge */
|
1998-12-09 23:28:43 +00:00
|
|
|
eintrs = intrs & sc->sc_eintrs;
|
|
|
|
if (!eintrs)
|
|
|
|
return (0);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.intr_context++;
|
|
|
|
sc->sc_bus.no_intrs++;
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(7, ("ohci_intr: sc=%p intrs=0x%x(0x%x) eintrs=0x%x\n",
|
1998-12-09 23:28:43 +00:00
|
|
|
sc, (u_int)intrs, OREAD4(sc, OHCI_INTERRUPT_STATUS),
|
|
|
|
(u_int)eintrs));
|
|
|
|
|
|
|
|
if (eintrs & OHCI_SO) {
|
2002-04-07 14:25:02 +00:00
|
|
|
sc->sc_overrun_cnt++;
|
|
|
|
if (usbd_ratecheck(&sc->sc_overrun_ntc)) {
|
|
|
|
printf("%s: %u scheduling overruns\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev), sc->sc_overrun_cnt);
|
|
|
|
sc->sc_overrun_cnt = 0;
|
|
|
|
}
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX do what */
|
2002-04-07 10:21:16 +00:00
|
|
|
eintrs &= ~OHCI_SO;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
if (eintrs & OHCI_WDH) {
|
2002-04-01 13:18:11 +00:00
|
|
|
ohci_add_done(sc, done &~ OHCI_DONE_INTRS);
|
2002-01-26 12:04:22 +00:00
|
|
|
usb_schedsoftintr(&sc->sc_bus);
|
2002-04-07 10:21:16 +00:00
|
|
|
eintrs &= ~OHCI_WDH;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
if (eintrs & OHCI_RD) {
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("%s: resume detect\n", USBDEVNAME(sc->sc_bus.bdev));
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX process resume detect */
|
|
|
|
}
|
|
|
|
if (eintrs & OHCI_UE) {
|
1999-01-07 23:07:57 +00:00
|
|
|
printf("%s: unrecoverable error, controller halted\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
|
|
|
/* XXX what else */
|
|
|
|
}
|
|
|
|
if (eintrs & OHCI_RHSC) {
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_rhsc(sc, sc->sc_intrxfer);
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1998-12-09 23:28:43 +00:00
|
|
|
* Disable RHSC interrupt for now, because it will be
|
|
|
|
* on until the port has been reset.
|
|
|
|
*/
|
|
|
|
ohci_rhsc_able(sc, 0);
|
2002-04-07 10:09:23 +00:00
|
|
|
/* Do not allow RHSC interrupts > 1 per second */
|
|
|
|
usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
|
2002-04-07 10:21:16 +00:00
|
|
|
eintrs &= ~OHCI_RHSC;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.intr_context--;
|
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
if (eintrs != 0) {
|
|
|
|
/* Block unprocessed interrupts. XXX */
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, eintrs);
|
|
|
|
sc->sc_eintrs &= ~eintrs;
|
|
|
|
printf("%s: blocking intrs 0x%x\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev), eintrs);
|
|
|
|
}
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_rhsc_able(ohci_softc_t *sc, int on)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
DPRINTFN(4, ("ohci_rhsc_able: on=%d\n", on));
|
|
|
|
if (on) {
|
|
|
|
sc->sc_eintrs |= OHCI_RHSC;
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_ENABLE, OHCI_RHSC);
|
|
|
|
} else {
|
|
|
|
sc->sc_eintrs &= ~OHCI_RHSC;
|
|
|
|
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_RHSC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-07 10:09:23 +00:00
|
|
|
void
|
|
|
|
ohci_rhsc_enable(void *v_sc)
|
|
|
|
{
|
|
|
|
ohci_softc_t *sc = v_sc;
|
|
|
|
|
|
|
|
ohci_rhsc_able(sc, 1);
|
|
|
|
}
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-01-07 23:07:57 +00:00
|
|
|
char *ohci_cc_strs[] = {
|
|
|
|
"NO_ERROR",
|
|
|
|
"CRC",
|
|
|
|
"BIT_STUFFING",
|
|
|
|
"DATA_TOGGLE_MISMATCH",
|
|
|
|
"STALL",
|
|
|
|
"DEVICE_NOT_RESPONDING",
|
|
|
|
"PID_CHECK_FAILURE",
|
|
|
|
"UNEXPECTED_PID",
|
|
|
|
"DATA_OVERRUN",
|
|
|
|
"DATA_UNDERRUN",
|
|
|
|
"BUFFER_OVERRUN",
|
|
|
|
"BUFFER_UNDERRUN",
|
2000-01-28 13:05:26 +00:00
|
|
|
"reserved",
|
|
|
|
"reserved",
|
1999-01-07 23:07:57 +00:00
|
|
|
"NOT_ACCESSED",
|
2000-01-28 13:05:26 +00:00
|
|
|
"NOT_ACCESSED"
|
1999-01-07 23:07:57 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
void
|
|
|
|
ohci_add_done(ohci_softc_t *sc, ohci_physaddr_t done)
|
|
|
|
{
|
|
|
|
ohci_soft_itd_t *sitd, *sidone, **ip;
|
|
|
|
ohci_soft_td_t *std, *sdone, **p;
|
|
|
|
|
|
|
|
/* Reverse the done list. */
|
|
|
|
for (sdone = NULL, sidone = NULL; done != 0; ) {
|
|
|
|
std = ohci_hash_find_td(sc, done);
|
|
|
|
if (std != NULL) {
|
|
|
|
std->dnext = sdone;
|
|
|
|
done = le32toh(std->td.td_nexttd);
|
|
|
|
sdone = std;
|
|
|
|
DPRINTFN(10,("add TD %p\n", std));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
sitd = ohci_hash_find_itd(sc, done);
|
|
|
|
if (sitd != NULL) {
|
|
|
|
sitd->dnext = sidone;
|
|
|
|
done = le32toh(sitd->itd.itd_nextitd);
|
|
|
|
sidone = sitd;
|
|
|
|
DPRINTFN(5,("add ITD %p\n", sitd));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
panic("ohci_add_done: addr 0x%08lx not found\n", (u_long)done);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sdone & sidone now hold the done lists. */
|
|
|
|
/* Put them on the already processed lists. */
|
|
|
|
for (p = &sc->sc_sdone; *p != NULL; p = &(*p)->dnext)
|
|
|
|
;
|
|
|
|
*p = sdone;
|
|
|
|
for (ip = &sc->sc_sidone; *ip != NULL; ip = &(*ip)->dnext)
|
|
|
|
;
|
|
|
|
*ip = sidone;
|
|
|
|
}
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
void
|
2002-04-01 21:34:01 +00:00
|
|
|
ohci_softintr(void *v)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-04-01 21:34:01 +00:00
|
|
|
ohci_softc_t *sc = v;
|
2002-04-01 13:18:11 +00:00
|
|
|
ohci_soft_itd_t *sitd, *sidone, *sitdnext;
|
|
|
|
ohci_soft_td_t *std, *sdone, *stdnext;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_xfer_handle xfer;
|
2002-01-26 12:04:22 +00:00
|
|
|
int len, cc, s;
|
|
|
|
|
2002-04-07 10:12:40 +00:00
|
|
|
DPRINTFN(10,("ohci_softintr: enter\n:"));
|
|
|
|
|
2002-01-26 12:04:22 +00:00
|
|
|
sc->sc_bus.intr_context++;
|
|
|
|
|
|
|
|
s = splhardusb();
|
2002-04-01 13:18:11 +00:00
|
|
|
sdone = sc->sc_sdone;
|
|
|
|
sc->sc_sdone = NULL;
|
|
|
|
sidone = sc->sc_sidone;
|
|
|
|
sc->sc_sidone = NULL;
|
2002-01-26 12:04:22 +00:00
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-04-07 10:12:40 +00:00
|
|
|
DPRINTFN(10,("ohci_softintr: sdone=%p sidone=%p\n", sdone, sidone));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (ohcidebug > 10) {
|
|
|
|
DPRINTF(("ohci_process_done: TD done:\n"));
|
2002-04-07 16:36:30 +00:00
|
|
|
ohci_dump_tds(sdone);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
for (std = sdone; std; std = stdnext) {
|
1999-11-28 21:01:06 +00:00
|
|
|
xfer = std->xfer;
|
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
|
|
|
stdnext = std->dnext;
|
2002-04-29 16:23:14 +00:00
|
|
|
DPRINTFN(10, ("ohci_process_done: std=%p xfer=%p hcpriv=%p\n",
|
2002-01-21 05:02:21 +00:00
|
|
|
std, xfer, (xfer ? xfer->hcpriv : NULL)));
|
2000-03-15 22:27:24 +00:00
|
|
|
if (xfer == NULL || (std->flags & OHCI_TD_HANDLED)) {
|
2002-04-07 15:08:39 +00:00
|
|
|
/*
|
|
|
|
* xfer == NULL: There seems to be no xfer associated
|
2000-03-15 22:27:24 +00:00
|
|
|
* with this TD. It is tailp that happened to end up on
|
|
|
|
* the done queue.
|
|
|
|
* flags & OHCI_TD_HANDLED: The TD has already been
|
|
|
|
* handled by process_done and should not be done again.
|
2002-04-07 15:08:39 +00:00
|
|
|
* Shouldn't happen, but some chips are broken(?).
|
2000-03-15 22:27:24 +00:00
|
|
|
*/
|
|
|
|
continue;
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->status == USBD_CANCELLED ||
|
|
|
|
xfer->status == USBD_TIMEOUT) {
|
2002-04-29 16:23:14 +00:00
|
|
|
DPRINTF(("ohci_process_done: cancel/timeout %p\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer));
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Handled by abort routine. */
|
2002-04-01 13:18:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
|
|
|
|
cc = OHCI_TD_GET_CC(le32toh(std->td.td_flags));
|
|
|
|
if (cc == OHCI_CC_NO_ERROR) {
|
1999-10-07 19:26:38 +00:00
|
|
|
len = std->len;
|
|
|
|
if (std->td.td_cbp != 0)
|
2001-12-30 23:02:31 +00:00
|
|
|
len -= le32toh(std->td.td_be) -
|
|
|
|
le32toh(std->td.td_cbp) + 1;
|
2002-04-29 16:23:14 +00:00
|
|
|
DPRINTFN(10, ("ohci_process_done: len=%d, flags=0x%x\n",
|
|
|
|
len, std->flags));
|
1999-11-17 22:33:51 +00:00
|
|
|
if (std->flags & OHCI_ADD_LEN)
|
|
|
|
xfer->actlen += len;
|
1999-10-07 19:26:38 +00:00
|
|
|
if (std->flags & OHCI_CALL_DONE) {
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
|
|
|
usb_transfer_complete(xfer);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_free_std(sc, std);
|
1998-12-09 23:28:43 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Endpoint is halted. First unlink all the TDs
|
|
|
|
* belonging to the failed transfer, and then restart
|
|
|
|
* the endpoint.
|
|
|
|
*/
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_soft_td_t *p, *n;
|
2002-02-03 17:03:34 +00:00
|
|
|
struct ohci_pipe *opipe =
|
1999-11-17 22:33:51 +00:00
|
|
|
(struct ohci_pipe *)xfer->pipe;
|
|
|
|
|
2002-04-29 16:23:14 +00:00
|
|
|
DPRINTFN(15,("ohci_process_done: error cc=%d (%s)\n",
|
2001-12-30 23:02:31 +00:00
|
|
|
OHCI_TD_GET_CC(le32toh(std->td.td_flags)),
|
2002-04-29 16:23:14 +00:00
|
|
|
ohci_cc_strs[OHCI_TD_GET_CC(le32toh(std->td.td_flags))]));
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2000-03-15 22:27:24 +00:00
|
|
|
/* Mark all the TDs in the done queue for the current
|
|
|
|
* xfer as handled
|
|
|
|
*/
|
|
|
|
for (p = stdnext; p; p = p->dnext) {
|
|
|
|
if (p->xfer == xfer)
|
|
|
|
p->flags |= OHCI_TD_HANDLED;
|
|
|
|
}
|
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
/* remove TDs */
|
1999-11-17 22:33:51 +00:00
|
|
|
for (p = std; p->xfer == xfer; p = n) {
|
1998-12-09 23:28:43 +00:00
|
|
|
n = p->nexttd;
|
|
|
|
ohci_free_std(sc, p);
|
|
|
|
}
|
2000-03-15 22:27:24 +00:00
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
/* clear halt */
|
|
|
|
opipe->sed->ed.ed_headp = htole32(p->physaddr);
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
if (cc == OHCI_CC_STALL)
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_STALLED;
|
1998-12-09 23:28:43 +00:00
|
|
|
else
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_IOERROR;
|
|
|
|
usb_transfer_complete(xfer);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-26 12:04:22 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-01 13:18:11 +00:00
|
|
|
if (ohcidebug > 10) {
|
2002-04-07 10:12:40 +00:00
|
|
|
DPRINTF(("ohci_softintr: ITD done:\n"));
|
2002-04-01 13:18:11 +00:00
|
|
|
ohci_dump_itds(sidone);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
for (sitd = sidone; sitd != NULL; sitd = sitdnext) {
|
|
|
|
xfer = sitd->xfer;
|
|
|
|
sitdnext = sitd->dnext;
|
|
|
|
DPRINTFN(1, ("ohci_process_done: sitd=%p xfer=%p hcpriv=%p\n",
|
|
|
|
sitd, xfer, xfer ? xfer->hcpriv : 0));
|
|
|
|
if (xfer == NULL)
|
|
|
|
continue;
|
|
|
|
if (xfer->status == USBD_CANCELLED ||
|
|
|
|
xfer->status == USBD_TIMEOUT) {
|
|
|
|
DPRINTF(("ohci_process_done: cancel/timeout %p\n",
|
|
|
|
xfer));
|
|
|
|
/* Handled by abort routine. */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (sitd->isdone)
|
|
|
|
printf("ohci_softintr: sitd=%p is done\n", sitd);
|
|
|
|
sitd->isdone = 1;
|
|
|
|
#endif
|
|
|
|
cc = OHCI_ITD_GET_CC(le32toh(sitd->itd.itd_flags));
|
|
|
|
if (cc == OHCI_CC_NO_ERROR) {
|
|
|
|
/* XXX compute length for input */
|
2002-04-07 16:36:30 +00:00
|
|
|
struct ohci_pipe *opipe =
|
2002-04-01 13:18:11 +00:00
|
|
|
(struct ohci_pipe *)xfer->pipe;
|
|
|
|
if (sitd->flags & OHCI_CALL_DONE) {
|
|
|
|
opipe->u.iso.inuse -= xfer->nframes;
|
2002-04-01 20:01:41 +00:00
|
|
|
/* XXX update frlengths with actual length */
|
2002-04-01 13:18:11 +00:00
|
|
|
/* XXX xfer->actlen = actlen; */
|
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* XXX Do more */
|
|
|
|
xfer->status = USBD_IOERROR;
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-30 17:50:18 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 15:16:31 +00:00
|
|
|
if (sc->sc_softwake) {
|
|
|
|
sc->sc_softwake = 0;
|
|
|
|
wakeup(&sc->sc_softwake);
|
|
|
|
}
|
2002-09-30 17:50:18 +00:00
|
|
|
#endif /* USB_USE_SOFTINTR */
|
2002-04-01 13:18:11 +00:00
|
|
|
|
2002-01-26 12:04:22 +00:00
|
|
|
sc->sc_bus.intr_context--;
|
2002-04-07 10:12:40 +00:00
|
|
|
DPRINTFN(10,("ohci_softintr: done:\n"));
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-01-07 23:07:57 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_ctrl_done(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(10,("ohci_ctrl_done: xfer=%p\n", xfer));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (!(xfer->rqflags & URQ_REQUEST)) {
|
1998-12-09 23:28:43 +00:00
|
|
|
panic("ohci_ctrl_done: not a request\n");
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->hcpriv = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_intr_done(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_soft_ed_t *sed = opipe->sed;
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_soft_td_t *data, *tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(10,("ohci_intr_done: xfer=%p, actlen=%d\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer, xfer->actlen));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->hcpriv = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->pipe->repeat) {
|
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
|
|
|
data = opipe->tail.td;
|
1998-12-09 23:28:43 +00:00
|
|
|
tail = ohci_alloc_std(sc); /* XXX should reuse TD */
|
1999-11-17 22:33:51 +00:00
|
|
|
if (tail == NULL) {
|
|
|
|
xfer->status = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
tail->xfer = NULL;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_flags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
OHCI_TD_IN | OHCI_TD_NOCC |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->flags & USBD_SHORT_XFER_OK)
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_flags |= htole32(OHCI_TD_R);
|
|
|
|
data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0));
|
1999-11-17 22:33:51 +00:00
|
|
|
data->nexttd = tail;
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_nexttd = htole32(tail->physaddr);
|
2002-04-07 16:36:30 +00:00
|
|
|
data->td.td_be = htole32(le32toh(data->td.td_cbp) +
|
|
|
|
xfer->length - 1);
|
1999-11-17 22:33:51 +00:00
|
|
|
data->len = xfer->length;
|
|
|
|
data->xfer = xfer;
|
|
|
|
data->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;
|
|
|
|
xfer->hcpriv = data;
|
|
|
|
xfer->actlen = 0;
|
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_tailp = htole32(tail->physaddr);
|
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
|
|
|
opipe->tail.td = tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_bulk_done(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(10,("ohci_bulk_done: xfer=%p, actlen=%d\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer, xfer->actlen));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->hcpriv = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_rhsc(ohci_softc_t *sc, usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
usbd_pipe_handle pipe;
|
|
|
|
struct ohci_pipe *opipe;
|
|
|
|
u_char *p;
|
|
|
|
int i, m;
|
|
|
|
int hstatus;
|
|
|
|
|
|
|
|
hstatus = OREAD4(sc, OHCI_RH_STATUS);
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTF(("ohci_rhsc: sc=%p xfer=%p hstatus=0x%08x\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
sc, xfer, hstatus));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer == NULL) {
|
1998-12-09 23:28:43 +00:00
|
|
|
/* Just ignore the change. */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
pipe = xfer->pipe;
|
1998-12-09 23:28:43 +00:00
|
|
|
opipe = (struct ohci_pipe *)pipe;
|
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
p = KERNADDR(&xfer->dmabuf, 0);
|
1999-11-17 22:33:51 +00:00
|
|
|
m = min(sc->sc_noport, xfer->length * 8 - 1);
|
|
|
|
memset(p, 0, xfer->length);
|
1998-12-09 23:28:43 +00:00
|
|
|
for (i = 1; i <= m; i++) {
|
2002-04-01 13:26:27 +00:00
|
|
|
/* Pick out CHANGE bits from the status reg. */
|
1998-12-09 23:28:43 +00:00
|
|
|
if (OREAD4(sc, OHCI_RH_PORT_STATUS(i)) >> 16)
|
|
|
|
p[i/8] |= 1 << (i%8);
|
|
|
|
}
|
|
|
|
DPRINTF(("ohci_rhsc: change=0x%02x\n", *p));
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = xfer->length;
|
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_transfer_complete(xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_intr_done(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->hcpriv = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2002-01-21 04:15:39 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_ctrl_done(usbd_xfer_handle xfer)
|
2002-01-21 04:15:39 +00:00
|
|
|
{
|
|
|
|
xfer->hcpriv = NULL;
|
|
|
|
}
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/*
|
|
|
|
* Wait here until controller claims to have an interrupt.
|
|
|
|
* Then call ohci_intr and return. Use timeout to avoid waiting
|
|
|
|
* too long.
|
|
|
|
*/
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_waitintr(ohci_softc_t *sc, usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
int timo = xfer->timeout;
|
1998-12-09 23:28:43 +00:00
|
|
|
int usecs;
|
|
|
|
u_int32_t intrs;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
1998-12-09 23:28:43 +00:00
|
|
|
for (usecs = timo * 1000000 / hz; usecs > 0; usecs -= 1000) {
|
1999-01-07 23:07:57 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
break;
|
1998-12-09 23:28:43 +00:00
|
|
|
intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs;
|
1999-01-13 00:50:02 +00:00
|
|
|
DPRINTFN(15,("ohci_waitintr: 0x%04x\n", intrs));
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
if (ohcidebug > 15)
|
|
|
|
ohci_dumpregs(sc);
|
|
|
|
#endif
|
|
|
|
if (intrs) {
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_intr1(sc);
|
|
|
|
if (xfer->status != USBD_IN_PROGRESS)
|
1998-12-09 23:28:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
1999-01-07 23:07:57 +00:00
|
|
|
|
|
|
|
/* Timeout */
|
1998-12-09 23:28:43 +00:00
|
|
|
DPRINTF(("ohci_waitintr: timeout\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_TIMEOUT;
|
|
|
|
usb_transfer_complete(xfer);
|
1999-01-07 23:07:57 +00:00
|
|
|
/* XXX should free TD */
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_poll(struct usbd_bus *bus)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)bus;
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-07 10:12:40 +00:00
|
|
|
static int last;
|
|
|
|
int new;
|
|
|
|
new = OREAD4(sc, OHCI_INTERRUPT_STATUS);
|
|
|
|
if (new != last) {
|
|
|
|
DPRINTFN(10,("ohci_poll: intrs=0x%04x\n", new));
|
|
|
|
last = new;
|
|
|
|
}
|
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
if (OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs)
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_intr1(sc);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_request(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
|
|
|
usb_device_request_t *req = &xfer->request;
|
1998-12-09 23:28:43 +00:00
|
|
|
usbd_device_handle dev = opipe->pipe.device;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)dev->bus;
|
|
|
|
int addr = dev->address;
|
2002-04-29 16:23:14 +00:00
|
|
|
ohci_soft_td_t *data = 0;
|
|
|
|
ohci_soft_td_t *setup, *stat, *next, *tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_soft_ed_t *sed;
|
|
|
|
int isread;
|
|
|
|
int len;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
int s;
|
|
|
|
|
|
|
|
isread = req->bmRequestType & UT_READ;
|
|
|
|
len = UGETW(req->wLength);
|
|
|
|
|
1999-01-07 23:07:57 +00:00
|
|
|
DPRINTFN(3,("ohci_device_control type=0x%02x, request=0x%02x, "
|
|
|
|
"wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
|
1998-12-09 23:28:43 +00:00
|
|
|
req->bmRequestType, req->bRequest, UGETW(req->wValue),
|
2002-02-03 17:03:34 +00:00
|
|
|
UGETW(req->wIndex), len, addr,
|
1998-12-09 23:28:43 +00:00
|
|
|
opipe->pipe.endpoint->edesc->bEndpointAddress));
|
|
|
|
|
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
|
|
|
setup = opipe->tail.td;
|
1998-12-09 23:28:43 +00:00
|
|
|
stat = ohci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (stat == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad1;
|
|
|
|
}
|
|
|
|
tail = ohci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (tail == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad2;
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
tail->xfer = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
sed = opipe->sed;
|
|
|
|
opipe->u.ctl.length = len;
|
|
|
|
|
|
|
|
/* Update device address and length since they may have changed. */
|
|
|
|
/* XXX This only needs to be done once, but it's too early in open. */
|
2002-04-07 16:36:30 +00:00
|
|
|
/* XXXX Should not touch ED here! */
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags = htole32(
|
|
|
|
(le32toh(sed->ed.ed_flags) & ~(OHCI_ED_ADDRMASK | OHCI_ED_MAXPMASK)) |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_ED_SET_FA(addr) |
|
|
|
|
OHCI_ED_SET_MAXP(UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize)));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
/* Set up data transaction */
|
|
|
|
if (len != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
data = ohci_alloc_std(sc);
|
|
|
|
if (data == NULL) {
|
|
|
|
err = USBD_NOMEM;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad3;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_flags = htole32(
|
1998-12-09 23:28:43 +00:00
|
|
|
(isread ? OHCI_TD_IN : OHCI_TD_OUT) | OHCI_TD_NOCC |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_TD_TOGGLE_1 | OHCI_TD_NOINTR |
|
1999-11-17 22:33:51 +00:00
|
|
|
(xfer->flags & USBD_SHORT_XFER_OK ? OHCI_TD_R : 0));
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0));
|
1999-11-17 22:33:51 +00:00
|
|
|
data->nexttd = stat;
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_nexttd = htole32(stat->physaddr);
|
|
|
|
data->td.td_be = htole32(le32toh(data->td.td_cbp) + len - 1);
|
1999-11-17 22:33:51 +00:00
|
|
|
data->len = len;
|
|
|
|
data->xfer = xfer;
|
|
|
|
data->flags = OHCI_ADD_LEN;
|
|
|
|
|
|
|
|
next = data;
|
1999-10-07 19:26:38 +00:00
|
|
|
stat->flags = OHCI_CALL_DONE;
|
|
|
|
} else {
|
1998-12-09 23:28:43 +00:00
|
|
|
next = stat;
|
1999-11-17 22:33:51 +00:00
|
|
|
/* XXX ADD_LEN? */
|
|
|
|
stat->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
memcpy(KERNADDR(&opipe->u.ctl.reqdma, 0), req, sizeof *req);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
setup->td.td_flags = htole32(OHCI_TD_SETUP | OHCI_TD_NOCC |
|
2002-04-07 16:36:30 +00:00
|
|
|
OHCI_TD_TOGGLE_0 | OHCI_TD_NOINTR);
|
2001-12-30 23:02:31 +00:00
|
|
|
setup->td.td_cbp = htole32(DMAADDR(&opipe->u.ctl.reqdma, 0));
|
1998-12-09 23:28:43 +00:00
|
|
|
setup->nexttd = next;
|
2001-12-30 23:02:31 +00:00
|
|
|
setup->td.td_nexttd = htole32(next->physaddr);
|
|
|
|
setup->td.td_be = htole32(le32toh(setup->td.td_cbp) + sizeof *req - 1);
|
2002-04-07 16:36:30 +00:00
|
|
|
setup->len = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
setup->xfer = xfer;
|
1999-10-07 19:26:38 +00:00
|
|
|
setup->flags = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->hcpriv = setup;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
stat->td.td_flags = htole32(
|
2002-04-07 16:36:30 +00:00
|
|
|
(isread ? OHCI_TD_OUT : OHCI_TD_IN) |
|
|
|
|
OHCI_TD_NOCC | OHCI_TD_TOGGLE_1 | OHCI_TD_SET_DI(1));
|
1999-10-07 19:26:38 +00:00
|
|
|
stat->td.td_cbp = 0;
|
1998-12-09 23:28:43 +00:00
|
|
|
stat->nexttd = tail;
|
2001-12-30 23:02:31 +00:00
|
|
|
stat->td.td_nexttd = htole32(tail->physaddr);
|
1999-10-07 19:26:38 +00:00
|
|
|
stat->td.td_be = 0;
|
1998-12-09 23:28:43 +00:00
|
|
|
stat->len = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
stat->xfer = xfer;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
if (ohcidebug > 5) {
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_request:\n"));
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_dump_ed(sed);
|
|
|
|
ohci_dump_tds(setup);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Insert ED in schedule */
|
|
|
|
s = splusb();
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_tailp = htole32(tail->physaddr);
|
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
|
|
|
opipe->tail.td = tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->timeout && !sc->sc_bus.use_polling) {
|
Huge merge from NetBSD:
usbdi.c (1.61):
===================================================================
revision 1.61
date: 2000/01/31 20:13:07; author: augustss; lines: +20 -4
Change the way the HC done method is invoked a little.
===================================================================
usbdi.c (1.65):
===================================================================
revision 1.65
date: 2000/03/08 15:34:10; author: augustss; lines: +4 -2
Get the status right when a polled transfer times out.
===================================================================
ohci.c (1.79), uhci.c (1.89), uhcivar.h (1.24), usb_port.h (1.22),
usbdivar.h (1.48):
===================================================================
date: 2000/03/23 07:01:46; author: thorpej;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
===================================================================
uhci.c (1.80), usbdi.c (1.66):
===================================================================
date: 2000/03/23 18:59:10; author: thorpej;
Shake out some bugs from the callout changes.
===================================================================
ohci.c (1.80), uhci.c (1.91), uhcivar.h (1.25), usb_port.h (1.23),
usbdi.c (1.67), usbdivar.h (1.49):
===================================================================
date: 2000/03/24 22:03:30; author: augustss;
Some cleanup and renaming of the callouts used in USB drivers.
===================================================================
uhci.c (1.92), uhcivar.h (1.26):
===================================================================
date: 2000/03/24 22:57:58; author: augustss;
Two major changes:
Make each xfer have its own intr_info. This is necessary if we want
to queue multiple xfers on an endpoint. This should get rid of the
(mostly harmless) DIAGNOSTICs about intr_infos (not) being done.
Change (again!) how xfers are aborted. Aborting a TD is a nightmare
on the braindead UHCI controller. (Unless you stop the HC, thereby
losing isoc traffic.) Hopefully I got it right this time.
===================================================================
usbdivar.h (1.50):
===================================================================
revision 1.50
date: 2000/03/25 00:10:19; author: augustss; lines: +4 -2
GC an unsued field and add some DIAGNOSTIC in xfer.
===================================================================
ums.c: Use the callout functions instead of the timeout ones.
uhci.c (1.93):
===================================================================
revision 1.93
date: 2000/03/25 00:11:21; author: augustss;
lines: +26 -1
Add more DIAGNOSTIC when aborting isoc.
===================================================================
uhci.c (1.94), usbdivar.h (1.51):
===================================================================
date: 2000/03/25 07:13:05; author: augustss;
More DIAGNOSTIC.
Initialize a callout handle I forgot.
===================================================================
uhci.c (1.95):
===================================================================
revision 1.95
date: 2000/03/25 07:23:12; author: augustss;
Exp; lines: +24 -7
Improve uhci_dump_ii().
===================================================================
ohci.c (1.81), uhci.c (1.96), uhcivar.h (1.27), usb_subr.c (1.68),
usbdi.c (1.68), usbdivar.h (1.52):
===================================================================
date: 2000/03/25 18:02:33; author: augustss;
Rename and move around callout handles to make it more sane.
Add some DIAGNOSTIC.
Fix buglet in isoc abort on UHCI.
===================================================================
uhci.c (1.98):
===================================================================
revision 1.98
date: 2000/03/27 07:39:48; author: augustss; lines: +12 -4
Make it compile without DIAGNOSTIC.
===================================================================
uhci.c (1.99):
===================================================================
revision 1.99
date: 2000/03/27 08:01:09; author: augustss; lines: +1 -5
Remove some debug nonsense.
===================================================================
uhci.c (1.100):
===================================================================
revision 1.100
date: 2000/03/27 09:41:36; author: augustss; lines: +13 -3
Don't mess with QH in bulk abort for the moment.
===================================================================
uhci.c (1.102):
===================================================================
revision 1.102
date: 2000/03/27 22:42:57; author: augustss; lines: +66 -26
Be a little more careful when aborting.
Preallocate some TDs for large buffers.
===================================================================
uhci.c (1.103):
===================================================================
date: 2000/03/28 09:47:10; author: augustss; lines: +11 -1
Another patch for xfer abort...
XXX The current xfer queueing and aborting semantics should really
XXX be changed. It cannot be implemented in a sane way on UHCI.
XXX One day when I have lots of time I'll redesign it...
===================================================================
uhci.c (1.104): Correct a debug message.
uhci.c (1.105): Be more defensive in a DIAGNOSTIC test.
uhci.c (1.106):
===================================================================
revision 1.106
date: 2000/03/29 01:49:13; author: augustss; lines: +14 -309
*SIGH* Revert back to the old method of aborting xfers.
I had tested the new stuff for two months now, but as soon as I commited
it the problems started to appear. Murphy, no doubt...
===================================================================
usb_subr.c (1.70), usbdi.c (1.71), usbdivar.h (1.53):
===================================================================
revision 1.70
date: 2000/03/29 01:45:20; author: augustss; lines: +2 -1
Do not accept new xfers for queuing while a pipe is aborting.
===================================================================
2002-03-16 12:06:01 +00:00
|
|
|
usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
|
|
|
|
ohci_timeout, xfer);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-29 16:23:14 +00:00
|
|
|
if (ohcidebug > 20) {
|
|
|
|
delay(10000);
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_request: status=%x\n",
|
|
|
|
OREAD4(sc, OHCI_COMMAND_STATUS)));
|
2002-04-07 14:53:52 +00:00
|
|
|
ohci_dumpregs(sc);
|
|
|
|
printf("ctrl head:\n");
|
|
|
|
ohci_dump_ed(sc->sc_ctrl_head);
|
|
|
|
printf("sed:\n");
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_dump_ed(sed);
|
|
|
|
ohci_dump_tds(setup);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
|
|
|
|
bad3:
|
|
|
|
ohci_free_std(sc, tail);
|
|
|
|
bad2:
|
|
|
|
ohci_free_std(sc, stat);
|
|
|
|
bad1:
|
1999-11-17 22:33:51 +00:00
|
|
|
return (err);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add an ED to the schedule. Called at splusb().
|
|
|
|
*/
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_add_ed(ohci_soft_ed_t *sed, ohci_soft_ed_t *head)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-04-07 14:53:52 +00:00
|
|
|
DPRINTFN(8,("ohci_add_ed: sed=%p head=%p\n", sed, head));
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
1998-12-09 23:28:43 +00:00
|
|
|
sed->next = head->next;
|
1999-10-07 19:26:38 +00:00
|
|
|
sed->ed.ed_nexted = head->ed.ed_nexted;
|
1998-12-09 23:28:43 +00:00
|
|
|
head->next = sed;
|
2001-12-30 23:02:31 +00:00
|
|
|
head->ed.ed_nexted = htole32(sed->physaddr);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove an ED from the schedule. Called at splusb().
|
|
|
|
*/
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_rem_ed(ohci_soft_ed_t *sed, ohci_soft_ed_t *head)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_soft_ed_t *p;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX */
|
2002-12-09 00:55:50 +00:00
|
|
|
for (p = head; p != NULL && p->next != sed; p = p->next)
|
1998-12-09 23:28:43 +00:00
|
|
|
;
|
1999-11-17 22:33:51 +00:00
|
|
|
if (p == NULL)
|
1998-12-09 23:28:43 +00:00
|
|
|
panic("ohci_rem_ed: ED not found\n");
|
|
|
|
p->next = sed->next;
|
1999-10-07 19:26:38 +00:00
|
|
|
p->ed.ed_nexted = sed->ed.ed_nexted;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When a transfer is completed the TD is added to the done queue by
|
|
|
|
* the host controller. This queue is the processed by software.
|
|
|
|
* Unfortunately the queue contains the physical address of the TD
|
|
|
|
* and we have no simple way to translate this back to a kernel address.
|
|
|
|
* To make the translation possible (and fast) we use a hash table of
|
|
|
|
* TDs currently in the schedule. The physical address is used as the
|
|
|
|
* hash value.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HASH(a) (((a) >> 4) % OHCI_HASH_SIZE)
|
|
|
|
/* Called at splusb() */
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_hash_add_td(ohci_softc_t *sc, ohci_soft_td_t *std)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
int h = HASH(std->physaddr);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
LIST_INSERT_HEAD(&sc->sc_hash_tds[h], std, hnext);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called at splusb() */
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_hash_rem_td(ohci_softc_t *sc, ohci_soft_td_t *std)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
LIST_REMOVE(std, hnext);
|
|
|
|
}
|
|
|
|
|
|
|
|
ohci_soft_td_t *
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_hash_find_td(ohci_softc_t *sc, ohci_physaddr_t a)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
int h = HASH(a);
|
|
|
|
ohci_soft_td_t *std;
|
|
|
|
|
2000-01-29 14:41:48 +00:00
|
|
|
/* if these are present they should be masked out at an earlier
|
|
|
|
* stage.
|
|
|
|
*/
|
2002-01-21 05:02:21 +00:00
|
|
|
KASSERT((a&~OHCI_HEADMASK) == 0, ("%s: 0x%b has lower bits set\n",
|
2000-01-29 11:50:44 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev),
|
|
|
|
(int) a, "\20\1HALT\2TOGGLE"));
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
for (std = LIST_FIRST(&sc->sc_hash_tds[h]);
|
1999-11-28 21:01:06 +00:00
|
|
|
std != NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
std = LIST_NEXT(std, hnext))
|
|
|
|
if (std->physaddr == a)
|
|
|
|
return (std);
|
2000-01-27 23:25:58 +00:00
|
|
|
|
2000-01-29 14:53:47 +00:00
|
|
|
DPRINTF(("%s: ohci_hash_find_td: addr 0x%08lx not found\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev), (u_long) a));
|
2002-04-01 13:18:11 +00:00
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called at splusb() */
|
|
|
|
void
|
|
|
|
ohci_hash_add_itd(ohci_softc_t *sc, ohci_soft_itd_t *sitd)
|
|
|
|
{
|
|
|
|
int h = HASH(sitd->physaddr);
|
|
|
|
|
|
|
|
SPLUSBCHECK;
|
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
DPRINTFN(10,("ohci_hash_add_itd: sitd=%p physaddr=0x%08lx\n",
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd, (u_long)sitd->physaddr));
|
|
|
|
|
|
|
|
LIST_INSERT_HEAD(&sc->sc_hash_itds[h], sitd, hnext);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called at splusb() */
|
|
|
|
void
|
|
|
|
ohci_hash_rem_itd(ohci_softc_t *sc, ohci_soft_itd_t *sitd)
|
|
|
|
{
|
|
|
|
SPLUSBCHECK;
|
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
DPRINTFN(10,("ohci_hash_rem_itd: sitd=%p physaddr=0x%08lx\n",
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd, (u_long)sitd->physaddr));
|
|
|
|
|
|
|
|
LIST_REMOVE(sitd, hnext);
|
|
|
|
}
|
|
|
|
|
|
|
|
ohci_soft_itd_t *
|
|
|
|
ohci_hash_find_itd(ohci_softc_t *sc, ohci_physaddr_t a)
|
|
|
|
{
|
|
|
|
int h = HASH(a);
|
|
|
|
ohci_soft_itd_t *sitd;
|
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
for (sitd = LIST_FIRST(&sc->sc_hash_itds[h]);
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd != NULL;
|
|
|
|
sitd = LIST_NEXT(sitd, hnext))
|
|
|
|
if (sitd->physaddr == a)
|
|
|
|
return (sitd);
|
|
|
|
return (NULL);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_timeout(void *addr)
|
2002-04-07 14:57:31 +00:00
|
|
|
{
|
|
|
|
struct ohci_xfer *oxfer = addr;
|
2002-04-07 15:07:23 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)oxfer->xfer.pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
2002-04-07 14:57:31 +00:00
|
|
|
|
|
|
|
DPRINTF(("ohci_timeout: oxfer=%p\n", oxfer));
|
|
|
|
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc->sc_dying) {
|
|
|
|
ohci_abort_xfer(&oxfer->xfer, USBD_TIMEOUT);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-04-07 14:57:31 +00:00
|
|
|
/* Execute the abort in a process context. */
|
|
|
|
usb_init_task(&oxfer->abort_task, ohci_timeout_task, addr);
|
|
|
|
usb_add_task(oxfer->xfer.pipe->device, &oxfer->abort_task);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ohci_timeout_task(void *addr)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_xfer_handle xfer = addr;
|
|
|
|
int s;
|
|
|
|
|
2002-04-07 14:57:31 +00:00
|
|
|
DPRINTF(("ohci_timeout_task: xfer=%p\n", xfer));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
s = splusb();
|
1999-11-28 21:01:06 +00:00
|
|
|
ohci_abort_xfer(xfer, USBD_TIMEOUT);
|
1999-11-17 22:33:51 +00:00
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_dump_tds(ohci_soft_td_t *std)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
for (; std; std = std->nexttd)
|
|
|
|
ohci_dump_td(std);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_dump_td(ohci_soft_td_t *std)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-04-01 19:42:51 +00:00
|
|
|
char sbuf[128];
|
|
|
|
|
2002-04-07 14:49:14 +00:00
|
|
|
bitmask_snprintf((u_int32_t)le32toh(std->td.td_flags),
|
2002-04-01 19:42:51 +00:00
|
|
|
"\20\23R\24OUT\25IN\31TOG1\32SETTOGGLE",
|
|
|
|
sbuf, sizeof(sbuf));
|
|
|
|
|
2002-04-07 10:24:52 +00:00
|
|
|
printf("TD(%p) at %08lx: %s delay=%d ec=%d cc=%d\ncbp=0x%08lx "
|
2002-04-07 16:36:30 +00:00
|
|
|
"nexttd=0x%08lx be=0x%08lx\n",
|
2002-04-07 10:24:52 +00:00
|
|
|
std, (u_long)std->physaddr, sbuf,
|
|
|
|
OHCI_TD_GET_DI(le32toh(std->td.td_flags)),
|
|
|
|
OHCI_TD_GET_EC(le32toh(std->td.td_flags)),
|
|
|
|
OHCI_TD_GET_CC(le32toh(std->td.td_flags)),
|
|
|
|
(u_long)le32toh(std->td.td_cbp),
|
|
|
|
(u_long)le32toh(std->td.td_nexttd),
|
|
|
|
(u_long)le32toh(std->td.td_be));
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
void
|
|
|
|
ohci_dump_itd(ohci_soft_itd_t *sitd)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-04-07 10:24:52 +00:00
|
|
|
printf("ITD(%p) at %08lx: sf=%d di=%d fc=%d cc=%d\n"
|
2002-04-07 16:36:30 +00:00
|
|
|
"bp0=0x%08lx next=0x%08lx be=0x%08lx\n",
|
2002-04-07 10:24:52 +00:00
|
|
|
sitd, (u_long)sitd->physaddr,
|
|
|
|
OHCI_ITD_GET_SF(le32toh(sitd->itd.itd_flags)),
|
|
|
|
OHCI_ITD_GET_DI(le32toh(sitd->itd.itd_flags)),
|
|
|
|
OHCI_ITD_GET_FC(le32toh(sitd->itd.itd_flags)),
|
|
|
|
OHCI_ITD_GET_CC(le32toh(sitd->itd.itd_flags)),
|
|
|
|
(u_long)le32toh(sitd->itd.itd_bp0),
|
|
|
|
(u_long)le32toh(sitd->itd.itd_nextitd),
|
|
|
|
(u_long)le32toh(sitd->itd.itd_be));
|
2002-04-01 13:18:11 +00:00
|
|
|
for (i = 0; i < OHCI_ITD_NOFFSET; i++)
|
2002-04-07 10:24:52 +00:00
|
|
|
printf("offs[%d]=0x%04x ", i,
|
|
|
|
(u_int)le16toh(sitd->itd.itd_offset[i]));
|
|
|
|
printf("\n");
|
2002-04-01 13:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ohci_dump_itds(ohci_soft_itd_t *sitd)
|
|
|
|
{
|
|
|
|
for (; sitd; sitd = sitd->nextitd)
|
|
|
|
ohci_dump_itd(sitd);
|
|
|
|
}
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_dump_ed(ohci_soft_ed_t *sed)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
2002-04-01 19:42:51 +00:00
|
|
|
char sbuf[128], sbuf2[128];
|
|
|
|
|
2002-04-07 14:49:14 +00:00
|
|
|
bitmask_snprintf((u_int32_t)le32toh(sed->ed.ed_flags),
|
2002-04-01 19:42:51 +00:00
|
|
|
"\20\14OUT\15IN\16LOWSPEED\17SKIP\20ISO",
|
|
|
|
sbuf, sizeof(sbuf));
|
2002-04-07 14:49:14 +00:00
|
|
|
bitmask_snprintf((u_int32_t)le32toh(sed->ed.ed_headp),
|
2002-04-01 19:42:51 +00:00
|
|
|
"\20\1HALT\2CARRY", sbuf2, sizeof(sbuf2));
|
|
|
|
|
2002-04-07 10:24:52 +00:00
|
|
|
printf("ED(%p) at 0x%08lx: addr=%d endpt=%d maxp=%d flags=%s\ntailp=0x%08lx "
|
2002-04-01 19:42:51 +00:00
|
|
|
"headflags=%s headp=0x%08lx nexted=0x%08lx\n",
|
2002-02-03 17:03:34 +00:00
|
|
|
sed, (u_long)sed->physaddr,
|
2001-12-30 23:02:31 +00:00
|
|
|
OHCI_ED_GET_FA(le32toh(sed->ed.ed_flags)),
|
|
|
|
OHCI_ED_GET_EN(le32toh(sed->ed.ed_flags)),
|
2002-04-01 19:42:51 +00:00
|
|
|
OHCI_ED_GET_MAXP(le32toh(sed->ed.ed_flags)), sbuf,
|
|
|
|
(u_long)le32toh(sed->ed.ed_tailp), sbuf2,
|
2002-01-26 12:04:22 +00:00
|
|
|
(u_long)le32toh(sed->ed.ed_headp),
|
2002-04-07 10:24:52 +00:00
|
|
|
(u_long)le32toh(sed->ed.ed_nexted));
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_open(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
usbd_device_handle dev = pipe->device;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)dev->bus;
|
|
|
|
usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
|
|
|
u_int8_t addr = dev->address;
|
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_int8_t xfertype = ed->bmAttributes & UE_XFERTYPE;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_soft_ed_t *sed;
|
2002-04-07 16:36:30 +00:00
|
|
|
ohci_soft_td_t *std;
|
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
|
|
|
ohci_soft_itd_t *sitd;
|
|
|
|
ohci_physaddr_t tdphys;
|
|
|
|
u_int32_t fmt;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
int s;
|
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
|
|
|
int ival;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
DPRINTFN(1, ("ohci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
|
|
|
|
pipe, addr, ed->bEndpointAddress, sc->sc_addr));
|
Huge merge from NetBSD:
usbdi.c (1.61):
===================================================================
revision 1.61
date: 2000/01/31 20:13:07; author: augustss; lines: +20 -4
Change the way the HC done method is invoked a little.
===================================================================
usbdi.c (1.65):
===================================================================
revision 1.65
date: 2000/03/08 15:34:10; author: augustss; lines: +4 -2
Get the status right when a polled transfer times out.
===================================================================
ohci.c (1.79), uhci.c (1.89), uhcivar.h (1.24), usb_port.h (1.22),
usbdivar.h (1.48):
===================================================================
date: 2000/03/23 07:01:46; author: thorpej;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
===================================================================
uhci.c (1.80), usbdi.c (1.66):
===================================================================
date: 2000/03/23 18:59:10; author: thorpej;
Shake out some bugs from the callout changes.
===================================================================
ohci.c (1.80), uhci.c (1.91), uhcivar.h (1.25), usb_port.h (1.23),
usbdi.c (1.67), usbdivar.h (1.49):
===================================================================
date: 2000/03/24 22:03:30; author: augustss;
Some cleanup and renaming of the callouts used in USB drivers.
===================================================================
uhci.c (1.92), uhcivar.h (1.26):
===================================================================
date: 2000/03/24 22:57:58; author: augustss;
Two major changes:
Make each xfer have its own intr_info. This is necessary if we want
to queue multiple xfers on an endpoint. This should get rid of the
(mostly harmless) DIAGNOSTICs about intr_infos (not) being done.
Change (again!) how xfers are aborted. Aborting a TD is a nightmare
on the braindead UHCI controller. (Unless you stop the HC, thereby
losing isoc traffic.) Hopefully I got it right this time.
===================================================================
usbdivar.h (1.50):
===================================================================
revision 1.50
date: 2000/03/25 00:10:19; author: augustss; lines: +4 -2
GC an unsued field and add some DIAGNOSTIC in xfer.
===================================================================
ums.c: Use the callout functions instead of the timeout ones.
uhci.c (1.93):
===================================================================
revision 1.93
date: 2000/03/25 00:11:21; author: augustss;
lines: +26 -1
Add more DIAGNOSTIC when aborting isoc.
===================================================================
uhci.c (1.94), usbdivar.h (1.51):
===================================================================
date: 2000/03/25 07:13:05; author: augustss;
More DIAGNOSTIC.
Initialize a callout handle I forgot.
===================================================================
uhci.c (1.95):
===================================================================
revision 1.95
date: 2000/03/25 07:23:12; author: augustss;
Exp; lines: +24 -7
Improve uhci_dump_ii().
===================================================================
ohci.c (1.81), uhci.c (1.96), uhcivar.h (1.27), usb_subr.c (1.68),
usbdi.c (1.68), usbdivar.h (1.52):
===================================================================
date: 2000/03/25 18:02:33; author: augustss;
Rename and move around callout handles to make it more sane.
Add some DIAGNOSTIC.
Fix buglet in isoc abort on UHCI.
===================================================================
uhci.c (1.98):
===================================================================
revision 1.98
date: 2000/03/27 07:39:48; author: augustss; lines: +12 -4
Make it compile without DIAGNOSTIC.
===================================================================
uhci.c (1.99):
===================================================================
revision 1.99
date: 2000/03/27 08:01:09; author: augustss; lines: +1 -5
Remove some debug nonsense.
===================================================================
uhci.c (1.100):
===================================================================
revision 1.100
date: 2000/03/27 09:41:36; author: augustss; lines: +13 -3
Don't mess with QH in bulk abort for the moment.
===================================================================
uhci.c (1.102):
===================================================================
revision 1.102
date: 2000/03/27 22:42:57; author: augustss; lines: +66 -26
Be a little more careful when aborting.
Preallocate some TDs for large buffers.
===================================================================
uhci.c (1.103):
===================================================================
date: 2000/03/28 09:47:10; author: augustss; lines: +11 -1
Another patch for xfer abort...
XXX The current xfer queueing and aborting semantics should really
XXX be changed. It cannot be implemented in a sane way on UHCI.
XXX One day when I have lots of time I'll redesign it...
===================================================================
uhci.c (1.104): Correct a debug message.
uhci.c (1.105): Be more defensive in a DIAGNOSTIC test.
uhci.c (1.106):
===================================================================
revision 1.106
date: 2000/03/29 01:49:13; author: augustss; lines: +14 -309
*SIGH* Revert back to the old method of aborting xfers.
I had tested the new stuff for two months now, but as soon as I commited
it the problems started to appear. Murphy, no doubt...
===================================================================
usb_subr.c (1.70), usbdi.c (1.71), usbdivar.h (1.53):
===================================================================
revision 1.70
date: 2000/03/29 01:45:20; author: augustss; lines: +2 -1
Do not accept new xfers for queuing while a pipe is aborting.
===================================================================
2002-03-16 12:06:01 +00:00
|
|
|
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
2002-04-01 13:28:49 +00:00
|
|
|
std = NULL;
|
|
|
|
sed = NULL;
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
if (addr == sc->sc_addr) {
|
|
|
|
switch (ed->bEndpointAddress) {
|
|
|
|
case USB_CONTROL_ENDPOINT:
|
|
|
|
pipe->methods = &ohci_root_ctrl_methods;
|
|
|
|
break;
|
1999-10-07 19:26:38 +00:00
|
|
|
case UE_DIR_IN | OHCI_INTR_ENDPT:
|
1998-12-09 23:28:43 +00:00
|
|
|
pipe->methods = &ohci_root_intr_methods;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sed = ohci_alloc_sed(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sed == NULL)
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad0;
|
|
|
|
opipe->sed = sed;
|
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
|
|
|
if (xfertype == UE_ISOCHRONOUS) {
|
|
|
|
sitd = ohci_alloc_sitd(sc);
|
2002-08-16 09:10:43 +00:00
|
|
|
if (sitd == NULL)
|
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
|
|
|
goto bad1;
|
|
|
|
opipe->tail.itd = sitd;
|
2001-12-30 23:02:31 +00:00
|
|
|
tdphys = sitd->physaddr;
|
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
|
|
|
fmt = OHCI_ED_FORMAT_ISO;
|
2002-04-01 13:18:11 +00:00
|
|
|
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN)
|
|
|
|
fmt |= OHCI_ED_DIR_IN;
|
|
|
|
else
|
|
|
|
fmt |= OHCI_ED_DIR_OUT;
|
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
|
|
|
} else {
|
|
|
|
std = ohci_alloc_std(sc);
|
2002-08-16 09:10:43 +00:00
|
|
|
if (std == NULL)
|
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
|
|
|
goto bad1;
|
|
|
|
opipe->tail.td = std;
|
2001-12-30 23:02:31 +00:00
|
|
|
tdphys = std->physaddr;
|
2002-04-01 13:18:11 +00:00
|
|
|
fmt = OHCI_ED_FORMAT_GEN | OHCI_ED_DIR_TD;
|
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
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
OHCI_ED_SET_FA(addr) |
|
1998-12-09 23:28:43 +00:00
|
|
|
OHCI_ED_SET_EN(ed->bEndpointAddress) |
|
2002-02-16 00:51:26 +00:00
|
|
|
(dev->speed == USB_SPEED_LOW ? OHCI_ED_SPEED : 0) |
|
|
|
|
fmt |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize)));
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_headp = sed->ed.ed_tailp = htole32(tdphys);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
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
|
|
|
switch (xfertype) {
|
1998-12-09 23:28:43 +00:00
|
|
|
case UE_CONTROL:
|
|
|
|
pipe->methods = &ohci_device_ctrl_methods;
|
2002-02-03 17:03:34 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus,
|
|
|
|
sizeof(usb_device_request_t),
|
1999-11-17 22:33:51 +00:00
|
|
|
0, &opipe->u.ctl.reqdma);
|
|
|
|
if (err)
|
1998-12-09 23:28:43 +00:00
|
|
|
goto bad;
|
|
|
|
s = splusb();
|
|
|
|
ohci_add_ed(sed, sc->sc_ctrl_head);
|
|
|
|
splx(s);
|
|
|
|
break;
|
|
|
|
case UE_INTERRUPT:
|
|
|
|
pipe->methods = &ohci_device_intr_methods;
|
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
|
|
|
ival = pipe->interval;
|
|
|
|
if (ival == USBD_DEFAULT_INTERVAL)
|
|
|
|
ival = ed->bInterval;
|
|
|
|
return (ohci_device_setintr(sc, opipe, ival));
|
1998-12-09 23:28:43 +00:00
|
|
|
case UE_ISOCHRONOUS:
|
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
|
|
|
pipe->methods = &ohci_device_isoc_methods;
|
|
|
|
return (ohci_setup_isoc(pipe));
|
1998-12-09 23:28:43 +00:00
|
|
|
case UE_BULK:
|
|
|
|
pipe->methods = &ohci_device_bulk_methods;
|
|
|
|
s = splusb();
|
|
|
|
ohci_add_ed(sed, sc->sc_bulk_head);
|
|
|
|
splx(s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
|
|
|
|
bad:
|
2002-04-01 13:28:49 +00:00
|
|
|
if (std != NULL)
|
|
|
|
ohci_free_std(sc, std);
|
1998-12-09 23:28:43 +00:00
|
|
|
bad1:
|
2002-04-01 13:28:49 +00:00
|
|
|
if (sed != NULL)
|
|
|
|
ohci_free_sed(sc, sed);
|
1998-12-09 23:28:43 +00:00
|
|
|
bad0:
|
|
|
|
return (USBD_NOMEM);
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* Close a reqular pipe.
|
|
|
|
* Assumes that there are no pending transactions.
|
|
|
|
*/
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_close_pipe(usbd_pipe_handle pipe, ohci_soft_ed_t *head)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
|
|
|
ohci_soft_ed_t *sed = opipe->sed;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
#ifdef DIAGNOSTIC
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
2002-01-21 05:02:21 +00:00
|
|
|
if ((le32toh(sed->ed.ed_tailp) & OHCI_HEADMASK) !=
|
|
|
|
(le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) {
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_soft_td_t *std;
|
2002-04-07 10:21:16 +00:00
|
|
|
std = ohci_hash_find_td(sc, le32toh(sed->ed.ed_headp));
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("ohci_close_pipe: pipe not empty sed=%p hd=0x%x "
|
|
|
|
"tl=0x%x pipe=%p, std=%p\n", sed,
|
2001-12-30 23:02:31 +00:00
|
|
|
(int)le32toh(sed->ed.ed_headp),
|
|
|
|
(int)le32toh(sed->ed.ed_tailp),
|
1999-10-07 19:26:38 +00:00
|
|
|
pipe, std);
|
2002-04-07 10:24:52 +00:00
|
|
|
#ifdef USB_DEBUG
|
|
|
|
usbd_dump_pipe(&opipe->pipe);
|
|
|
|
#endif
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-07 10:21:16 +00:00
|
|
|
ohci_dump_ed(sed);
|
|
|
|
if (std)
|
|
|
|
ohci_dump_td(std);
|
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 2);
|
2002-01-21 05:02:21 +00:00
|
|
|
if ((le32toh(sed->ed.ed_tailp) & OHCI_HEADMASK) !=
|
2001-12-30 23:02:31 +00:00
|
|
|
(le32toh(sed->ed.ed_headp) & OHCI_HEADMASK))
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("ohci_close_pipe: pipe still not empty\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
ohci_rem_ed(sed, head);
|
2002-12-09 01:41:24 +00:00
|
|
|
/* Make sure the host controller is not touching this ED */
|
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
ohci_free_sed(sc, opipe->sed);
|
|
|
|
}
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* Abort a device request.
|
|
|
|
* If this routine is called at splusb() it guarantees that the request
|
|
|
|
* will be removed from the hardware scheduling and that the callback
|
|
|
|
* for it will be called with USBD_CANCELLED status.
|
|
|
|
* It's impossible to guarantee that the requested transfer will not
|
|
|
|
* have happened since the hardware runs concurrently.
|
|
|
|
* If the transaction has already happened we rely on the ordinary
|
|
|
|
* interrupt processing to process it.
|
|
|
|
*/
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
2002-04-07 10:21:16 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
|
|
|
ohci_soft_ed_t *sed = opipe->sed;
|
|
|
|
ohci_soft_td_t *p, *n;
|
|
|
|
ohci_physaddr_t headp;
|
|
|
|
int s, hit;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
DPRINTF(("ohci_abort_xfer: xfer=%p pipe=%p sed=%p\n", xfer, opipe,sed));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc->sc_dying) {
|
|
|
|
/* If we're dying, just do the software part. */
|
|
|
|
s = splusb();
|
|
|
|
xfer->status = status; /* make software ignore it */
|
2002-04-07 15:18:00 +00:00
|
|
|
usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
|
2002-04-07 15:07:23 +00:00
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
if (xfer->device->bus->intr_context || !curproc)
|
|
|
|
panic("ohci_abort_xfer: not in process context\n");
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
/*
|
|
|
|
* Step 1: Make interrupt routine and hardware ignore xfer.
|
|
|
|
*/
|
|
|
|
s = splusb();
|
|
|
|
xfer->status = status; /* make software ignore it */
|
Huge merge from NetBSD:
usbdi.c (1.61):
===================================================================
revision 1.61
date: 2000/01/31 20:13:07; author: augustss; lines: +20 -4
Change the way the HC done method is invoked a little.
===================================================================
usbdi.c (1.65):
===================================================================
revision 1.65
date: 2000/03/08 15:34:10; author: augustss; lines: +4 -2
Get the status right when a polled transfer times out.
===================================================================
ohci.c (1.79), uhci.c (1.89), uhcivar.h (1.24), usb_port.h (1.22),
usbdivar.h (1.48):
===================================================================
date: 2000/03/23 07:01:46; author: thorpej;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
===================================================================
uhci.c (1.80), usbdi.c (1.66):
===================================================================
date: 2000/03/23 18:59:10; author: thorpej;
Shake out some bugs from the callout changes.
===================================================================
ohci.c (1.80), uhci.c (1.91), uhcivar.h (1.25), usb_port.h (1.23),
usbdi.c (1.67), usbdivar.h (1.49):
===================================================================
date: 2000/03/24 22:03:30; author: augustss;
Some cleanup and renaming of the callouts used in USB drivers.
===================================================================
uhci.c (1.92), uhcivar.h (1.26):
===================================================================
date: 2000/03/24 22:57:58; author: augustss;
Two major changes:
Make each xfer have its own intr_info. This is necessary if we want
to queue multiple xfers on an endpoint. This should get rid of the
(mostly harmless) DIAGNOSTICs about intr_infos (not) being done.
Change (again!) how xfers are aborted. Aborting a TD is a nightmare
on the braindead UHCI controller. (Unless you stop the HC, thereby
losing isoc traffic.) Hopefully I got it right this time.
===================================================================
usbdivar.h (1.50):
===================================================================
revision 1.50
date: 2000/03/25 00:10:19; author: augustss; lines: +4 -2
GC an unsued field and add some DIAGNOSTIC in xfer.
===================================================================
ums.c: Use the callout functions instead of the timeout ones.
uhci.c (1.93):
===================================================================
revision 1.93
date: 2000/03/25 00:11:21; author: augustss;
lines: +26 -1
Add more DIAGNOSTIC when aborting isoc.
===================================================================
uhci.c (1.94), usbdivar.h (1.51):
===================================================================
date: 2000/03/25 07:13:05; author: augustss;
More DIAGNOSTIC.
Initialize a callout handle I forgot.
===================================================================
uhci.c (1.95):
===================================================================
revision 1.95
date: 2000/03/25 07:23:12; author: augustss;
Exp; lines: +24 -7
Improve uhci_dump_ii().
===================================================================
ohci.c (1.81), uhci.c (1.96), uhcivar.h (1.27), usb_subr.c (1.68),
usbdi.c (1.68), usbdivar.h (1.52):
===================================================================
date: 2000/03/25 18:02:33; author: augustss;
Rename and move around callout handles to make it more sane.
Add some DIAGNOSTIC.
Fix buglet in isoc abort on UHCI.
===================================================================
uhci.c (1.98):
===================================================================
revision 1.98
date: 2000/03/27 07:39:48; author: augustss; lines: +12 -4
Make it compile without DIAGNOSTIC.
===================================================================
uhci.c (1.99):
===================================================================
revision 1.99
date: 2000/03/27 08:01:09; author: augustss; lines: +1 -5
Remove some debug nonsense.
===================================================================
uhci.c (1.100):
===================================================================
revision 1.100
date: 2000/03/27 09:41:36; author: augustss; lines: +13 -3
Don't mess with QH in bulk abort for the moment.
===================================================================
uhci.c (1.102):
===================================================================
revision 1.102
date: 2000/03/27 22:42:57; author: augustss; lines: +66 -26
Be a little more careful when aborting.
Preallocate some TDs for large buffers.
===================================================================
uhci.c (1.103):
===================================================================
date: 2000/03/28 09:47:10; author: augustss; lines: +11 -1
Another patch for xfer abort...
XXX The current xfer queueing and aborting semantics should really
XXX be changed. It cannot be implemented in a sane way on UHCI.
XXX One day when I have lots of time I'll redesign it...
===================================================================
uhci.c (1.104): Correct a debug message.
uhci.c (1.105): Be more defensive in a DIAGNOSTIC test.
uhci.c (1.106):
===================================================================
revision 1.106
date: 2000/03/29 01:49:13; author: augustss; lines: +14 -309
*SIGH* Revert back to the old method of aborting xfers.
I had tested the new stuff for two months now, but as soon as I commited
it the problems started to appear. Murphy, no doubt...
===================================================================
usb_subr.c (1.70), usbdi.c (1.71), usbdivar.h (1.53):
===================================================================
revision 1.70
date: 2000/03/29 01:45:20; author: augustss; lines: +2 -1
Do not accept new xfers for queuing while a pipe is aborting.
===================================================================
2002-03-16 12:06:01 +00:00
|
|
|
usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
|
2002-04-07 10:21:16 +00:00
|
|
|
splx(s);
|
2000-01-29 14:41:48 +00:00
|
|
|
DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed));
|
2002-04-29 16:23:14 +00:00
|
|
|
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* force hardware skip */
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
/*
|
2002-04-07 10:21:16 +00:00
|
|
|
* Step 2: Wait until we know hardware has finished any possible
|
|
|
|
* use of the xfer. Also make sure the soft interrupt routine
|
|
|
|
* has run.
|
|
|
|
*/
|
2002-04-07 15:16:31 +00:00
|
|
|
usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */
|
|
|
|
s = splusb();
|
2002-09-30 17:50:18 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 15:16:31 +00:00
|
|
|
sc->sc_softwake = 1;
|
2002-09-30 17:50:18 +00:00
|
|
|
#endif /* USB_USE_SOFTINTR */
|
2002-04-07 15:16:31 +00:00
|
|
|
usb_schedsoftintr(&sc->sc_bus);
|
2002-09-30 17:50:18 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 15:16:31 +00:00
|
|
|
tsleep(&sc->sc_softwake, PZERO, "ohciab", 0);
|
2002-09-30 17:50:18 +00:00
|
|
|
#endif /* USB_USE_SOFTINTR */
|
2002-04-07 15:16:31 +00:00
|
|
|
splx(s);
|
|
|
|
|
2002-04-07 16:36:30 +00:00
|
|
|
/*
|
2002-04-07 10:21:16 +00:00
|
|
|
* Step 3: Remove any vestiges of the xfer from the hardware.
|
|
|
|
* The complication here is that the hardware may have executed
|
|
|
|
* beyond the xfer we're trying to abort. So as we're scanning
|
|
|
|
* the TDs of this xfer we check if the hardware points to
|
|
|
|
* any of them.
|
|
|
|
*/
|
|
|
|
s = splusb(); /* XXX why? */
|
1999-11-17 22:33:51 +00:00
|
|
|
p = xfer->hcpriv;
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (p == NULL) {
|
2000-01-27 23:25:58 +00:00
|
|
|
splx(s);
|
2002-04-07 10:21:16 +00:00
|
|
|
printf("ohci_abort_xfer: hcpriv is NULL\n");
|
1999-10-07 19:26:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-07 10:21:16 +00:00
|
|
|
if (ohcidebug > 1) {
|
|
|
|
DPRINTF(("ohci_abort_xfer: sed=\n"));
|
|
|
|
ohci_dump_ed(sed);
|
|
|
|
ohci_dump_tds(p);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
headp = le32toh(sed->ed.ed_headp) & OHCI_HEADMASK;
|
|
|
|
hit = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
for (; p->xfer == xfer; p = n) {
|
2002-04-07 10:21:16 +00:00
|
|
|
hit |= headp == p->physaddr;
|
1999-10-07 19:26:38 +00:00
|
|
|
n = p->nexttd;
|
|
|
|
ohci_free_std(sc, p);
|
|
|
|
}
|
2002-04-07 10:21:16 +00:00
|
|
|
/* Zap headp register if hardware pointed inside the xfer. */
|
|
|
|
if (hit) {
|
|
|
|
DPRINTFN(1,("ohci_abort_xfer: set hd=0x08%x, tl=0x%08x\n",
|
|
|
|
(int)p->physaddr, (int)le32toh(sed->ed.ed_tailp)));
|
|
|
|
sed->ed.ed_headp = htole32(p->physaddr); /* unlink TDs */
|
|
|
|
} else {
|
|
|
|
DPRINTFN(1,("ohci_abort_xfer: no hit\n"));
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
/*
|
|
|
|
* Step 4: Turn on hardware again.
|
|
|
|
*/
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); /* remove hardware skip */
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-07 10:21:16 +00:00
|
|
|
/*
|
|
|
|
* Step 5: Execute callback.
|
|
|
|
*/
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_transfer_complete(xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
/*
|
|
|
|
* Data structures and routines to emulate the root hub.
|
|
|
|
*/
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usb_device_descriptor_t ohci_devd = {
|
1998-12-09 23:28:43 +00:00
|
|
|
USB_DEVICE_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_DEVICE, /* type */
|
|
|
|
{0x00, 0x01}, /* USB version */
|
2002-01-02 18:28:45 +00:00
|
|
|
UDCLASS_HUB, /* class */
|
|
|
|
UDSUBCLASS_HUB, /* subclass */
|
2002-04-07 11:19:05 +00:00
|
|
|
UDPROTO_FSHUB, /* protocol */
|
1998-12-09 23:28:43 +00:00
|
|
|
64, /* max packet */
|
|
|
|
{0},{0},{0x00,0x01}, /* device id */
|
|
|
|
1,2,0, /* string indicies */
|
|
|
|
1 /* # of configurations */
|
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usb_config_descriptor_t ohci_confd = {
|
1998-12-09 23:28:43 +00:00
|
|
|
USB_CONFIG_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_CONFIG,
|
|
|
|
{USB_CONFIG_DESCRIPTOR_SIZE +
|
|
|
|
USB_INTERFACE_DESCRIPTOR_SIZE +
|
|
|
|
USB_ENDPOINT_DESCRIPTOR_SIZE},
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
UC_SELF_POWERED,
|
|
|
|
0 /* max power */
|
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usb_interface_descriptor_t ohci_ifcd = {
|
1998-12-09 23:28:43 +00:00
|
|
|
USB_INTERFACE_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_INTERFACE,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
2002-01-02 18:28:45 +00:00
|
|
|
UICLASS_HUB,
|
|
|
|
UISUBCLASS_HUB,
|
2002-04-07 11:19:05 +00:00
|
|
|
UIPROTO_FSHUB,
|
1998-12-09 23:28:43 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usb_endpoint_descriptor_t ohci_endpd = {
|
1998-12-09 23:28:43 +00:00
|
|
|
USB_ENDPOINT_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_ENDPOINT,
|
1999-10-07 19:26:38 +00:00
|
|
|
UE_DIR_IN | OHCI_INTR_ENDPT,
|
1998-12-09 23:28:43 +00:00
|
|
|
UE_INTERRUPT,
|
|
|
|
{8, 0}, /* max packet */
|
|
|
|
255
|
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usb_hub_descriptor_t ohci_hubd = {
|
1998-12-09 23:28:43 +00:00
|
|
|
USB_HUB_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_HUB,
|
|
|
|
0,
|
|
|
|
{0,0},
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
{0},
|
|
|
|
};
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static int
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_str(usb_string_descriptor_t *p, int l, const char *s)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (l == 0)
|
|
|
|
return (0);
|
|
|
|
p->bLength = 2 * strlen(s) + 2;
|
|
|
|
if (l == 1)
|
|
|
|
return (1);
|
|
|
|
p->bDescriptorType = UDESC_STRING;
|
|
|
|
l -= 2;
|
|
|
|
for (i = 0; s[i] && l > 1; i++, l -= 2)
|
|
|
|
USETW2(p->bString[i], 0, s[i]);
|
|
|
|
return (2*i+2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simulate a hardware hub by handling all the necessary requests.
|
|
|
|
*/
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_ctrl_transfer(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
|
|
|
|
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Pipe isn't running, start first */
|
|
|
|
return (ohci_root_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_ctrl_start(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)xfer->pipe->device->bus;
|
1998-12-09 23:28:43 +00:00
|
|
|
usb_device_request_t *req;
|
1999-10-07 19:26:38 +00:00
|
|
|
void *buf = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
int port, i;
|
1999-11-17 22:33:51 +00:00
|
|
|
int s, len, value, index, l, totlen = 0;
|
1998-12-09 23:28:43 +00:00
|
|
|
usb_port_status_t ps;
|
|
|
|
usb_hub_descriptor_t hubd;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
u_int32_t v;
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (!(xfer->rqflags & URQ_REQUEST))
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX panic */
|
|
|
|
return (USBD_INVAL);
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
req = &xfer->request;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(4,("ohci_root_ctrl_control type=0x%02x request=%02x\n",
|
1998-12-09 23:28:43 +00:00
|
|
|
req->bmRequestType, req->bRequest));
|
|
|
|
|
|
|
|
len = UGETW(req->wLength);
|
|
|
|
value = UGETW(req->wValue);
|
|
|
|
index = UGETW(req->wIndex);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
if (len != 0)
|
2000-02-10 18:50:19 +00:00
|
|
|
buf = KERNADDR(&xfer->dmabuf, 0);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
#define C(x,y) ((x) | ((y) << 8))
|
|
|
|
switch(C(req->bRequest, req->bmRequestType)) {
|
|
|
|
case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE):
|
|
|
|
case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE):
|
|
|
|
case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1999-01-07 23:07:57 +00:00
|
|
|
* DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops
|
1998-12-09 23:28:43 +00:00
|
|
|
* for the integrated root hub.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
case C(UR_GET_CONFIG, UT_READ_DEVICE):
|
|
|
|
if (len > 0) {
|
|
|
|
*(u_int8_t *)buf = sc->sc_conf;
|
|
|
|
totlen = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
|
|
|
|
DPRINTFN(8,("ohci_root_ctrl_control wValue=0x%04x\n", value));
|
|
|
|
switch(value >> 8) {
|
|
|
|
case UDESC_DEVICE:
|
|
|
|
if ((value & 0xff) != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
|
1999-10-07 19:26:38 +00:00
|
|
|
USETW(ohci_devd.idVendor, sc->sc_id_vendor);
|
1998-12-09 23:28:43 +00:00
|
|
|
memcpy(buf, &ohci_devd, l);
|
|
|
|
break;
|
|
|
|
case UDESC_CONFIG:
|
|
|
|
if ((value & 0xff) != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
totlen = l = min(len, USB_CONFIG_DESCRIPTOR_SIZE);
|
|
|
|
memcpy(buf, &ohci_confd, l);
|
|
|
|
buf = (char *)buf + l;
|
|
|
|
len -= l;
|
|
|
|
l = min(len, USB_INTERFACE_DESCRIPTOR_SIZE);
|
|
|
|
totlen += l;
|
|
|
|
memcpy(buf, &ohci_ifcd, l);
|
|
|
|
buf = (char *)buf + l;
|
|
|
|
len -= l;
|
|
|
|
l = min(len, USB_ENDPOINT_DESCRIPTOR_SIZE);
|
|
|
|
totlen += l;
|
|
|
|
memcpy(buf, &ohci_endpd, l);
|
|
|
|
break;
|
|
|
|
case UDESC_STRING:
|
|
|
|
if (len == 0)
|
|
|
|
break;
|
|
|
|
*(u_int8_t *)buf = 0;
|
|
|
|
totlen = 1;
|
|
|
|
switch (value & 0xff) {
|
|
|
|
case 1: /* Vendor */
|
|
|
|
totlen = ohci_str(buf, len, sc->sc_vendor);
|
|
|
|
break;
|
|
|
|
case 2: /* Product */
|
|
|
|
totlen = ohci_str(buf, len, "OHCI root hub");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
|
|
|
|
if (len > 0) {
|
|
|
|
*(u_int8_t *)buf = 0;
|
|
|
|
totlen = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_DEVICE):
|
|
|
|
if (len > 1) {
|
|
|
|
USETW(((usb_status_t *)buf)->wStatus,UDS_SELF_POWERED);
|
|
|
|
totlen = 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_INTERFACE):
|
|
|
|
case C(UR_GET_STATUS, UT_READ_ENDPOINT):
|
|
|
|
if (len > 1) {
|
|
|
|
USETW(((usb_status_t *)buf)->wStatus, 0);
|
|
|
|
totlen = 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
|
|
|
|
if (value >= USB_MAX_DEVICES) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
sc->sc_addr = value;
|
|
|
|
break;
|
|
|
|
case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
|
|
|
|
if (value != 0 && value != 1) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
sc->sc_conf = value;
|
|
|
|
break;
|
|
|
|
case C(UR_SET_DESCRIPTOR, UT_WRITE_DEVICE):
|
|
|
|
break;
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_DEVICE):
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_INTERFACE):
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT):
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
|
|
|
|
break;
|
|
|
|
case C(UR_SYNCH_FRAME, UT_WRITE_ENDPOINT):
|
|
|
|
break;
|
|
|
|
/* Hub requests */
|
|
|
|
case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_DEVICE):
|
|
|
|
break;
|
|
|
|
case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
|
1999-01-07 23:07:57 +00:00
|
|
|
DPRINTFN(8, ("ohci_root_ctrl_control: UR_CLEAR_PORT_FEATURE "
|
|
|
|
"port=%d feature=%d\n",
|
1998-12-09 23:28:43 +00:00
|
|
|
index, value));
|
|
|
|
if (index < 1 || index > sc->sc_noport) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
port = OHCI_RH_PORT_STATUS(index);
|
|
|
|
switch(value) {
|
|
|
|
case UHF_PORT_ENABLE:
|
|
|
|
OWRITE4(sc, port, UPS_CURRENT_CONNECT_STATUS);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_SUSPEND:
|
|
|
|
OWRITE4(sc, port, UPS_OVERCURRENT_INDICATOR);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_POWER:
|
2002-02-16 00:51:26 +00:00
|
|
|
/* Yes, writing to the LOW_SPEED bit clears power. */
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, port, UPS_LOW_SPEED);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_CONNECTION:
|
|
|
|
OWRITE4(sc, port, UPS_C_CONNECT_STATUS << 16);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_ENABLE:
|
|
|
|
OWRITE4(sc, port, UPS_C_PORT_ENABLED << 16);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_SUSPEND:
|
|
|
|
OWRITE4(sc, port, UPS_C_SUSPEND << 16);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_OVER_CURRENT:
|
|
|
|
OWRITE4(sc, port, UPS_C_OVERCURRENT_INDICATOR << 16);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_RESET:
|
|
|
|
OWRITE4(sc, port, UPS_C_PORT_RESET << 16);
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
switch(value) {
|
|
|
|
case UHF_C_PORT_CONNECTION:
|
|
|
|
case UHF_C_PORT_ENABLE:
|
|
|
|
case UHF_C_PORT_SUSPEND:
|
|
|
|
case UHF_C_PORT_OVER_CURRENT:
|
|
|
|
case UHF_C_PORT_RESET:
|
|
|
|
/* Enable RHSC interrupt if condition is cleared. */
|
|
|
|
if ((OREAD4(sc, port) >> 16) == 0)
|
|
|
|
ohci_rhsc_able(sc, 1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
|
|
|
|
if (value != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
v = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
|
|
|
|
hubd = ohci_hubd;
|
|
|
|
hubd.bNbrPorts = sc->sc_noport;
|
1999-01-07 23:07:57 +00:00
|
|
|
USETW(hubd.wHubCharacteristics,
|
2002-02-03 17:03:34 +00:00
|
|
|
(v & OHCI_NPS ? UHD_PWR_NO_SWITCH :
|
1998-12-09 23:28:43 +00:00
|
|
|
v & OHCI_PSM ? UHD_PWR_GANGED : UHD_PWR_INDIVIDUAL)
|
|
|
|
/* XXX overcurrent */
|
|
|
|
);
|
|
|
|
hubd.bPwrOn2PwrGood = OHCI_GET_POTPGT(v);
|
|
|
|
v = OREAD4(sc, OHCI_RH_DESCRIPTOR_B);
|
2002-02-03 17:03:34 +00:00
|
|
|
for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8)
|
1999-01-07 23:07:57 +00:00
|
|
|
hubd.DeviceRemovable[i++] = (u_int8_t)v;
|
|
|
|
hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i;
|
1998-12-09 23:28:43 +00:00
|
|
|
l = min(len, hubd.bDescLength);
|
|
|
|
totlen = l;
|
|
|
|
memcpy(buf, &hubd, l);
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
|
|
|
|
if (len != 4) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
memset(buf, 0, len); /* ? XXX */
|
|
|
|
totlen = len;
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
|
|
|
|
DPRINTFN(8,("ohci_root_ctrl_transfer: get port status i=%d\n",
|
|
|
|
index));
|
|
|
|
if (index < 1 || index > sc->sc_noport) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
if (len != 4) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
v = OREAD4(sc, OHCI_RH_PORT_STATUS(index));
|
|
|
|
DPRINTFN(8,("ohci_root_ctrl_transfer: port status=0x%04x\n",
|
|
|
|
v));
|
|
|
|
USETW(ps.wPortStatus, v);
|
|
|
|
USETW(ps.wPortChange, v >> 16);
|
|
|
|
l = min(len, sizeof ps);
|
|
|
|
memcpy(buf, &ps, l);
|
|
|
|
totlen = l;
|
|
|
|
break;
|
|
|
|
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
|
|
|
|
break;
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
|
|
|
|
if (index < 1 || index > sc->sc_noport) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
port = OHCI_RH_PORT_STATUS(index);
|
|
|
|
switch(value) {
|
|
|
|
case UHF_PORT_ENABLE:
|
|
|
|
OWRITE4(sc, port, UPS_PORT_ENABLED);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_SUSPEND:
|
|
|
|
OWRITE4(sc, port, UPS_SUSPEND);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_RESET:
|
1999-01-07 23:07:57 +00:00
|
|
|
DPRINTFN(5,("ohci_root_ctrl_transfer: reset port %d\n",
|
|
|
|
index));
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, port, UPS_RESET);
|
2002-04-07 11:42:39 +00:00
|
|
|
for (i = 0; i < 5; i++) {
|
2002-01-03 00:37:56 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus,
|
2002-04-07 11:42:39 +00:00
|
|
|
USB_PORT_ROOT_RESET_DELAY);
|
2002-04-07 15:07:23 +00:00
|
|
|
if (sc->sc_dying) {
|
|
|
|
err = USBD_IOERROR;
|
|
|
|
goto ret;
|
|
|
|
}
|
1998-12-09 23:28:43 +00:00
|
|
|
if ((OREAD4(sc, port) & UPS_RESET) == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DPRINTFN(8,("ohci port %d reset, status = 0x%04x\n",
|
|
|
|
index, OREAD4(sc, port)));
|
|
|
|
break;
|
|
|
|
case UHF_PORT_POWER:
|
1999-01-07 23:07:57 +00:00
|
|
|
DPRINTFN(2,("ohci_root_ctrl_transfer: set port power "
|
|
|
|
"%d\n", index));
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, port, UPS_PORT_POWER);
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1998-12-09 23:28:43 +00:00
|
|
|
goto ret;
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = totlen;
|
|
|
|
err = USBD_NORMAL_COMPLETION;
|
1998-12-09 23:28:43 +00:00
|
|
|
ret:
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = err;
|
|
|
|
s = splusb();
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Abort a root control request. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_ctrl_abort(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
/* Nothing to do, all transfers are synchronous. */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the root pipe. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_ctrl_close(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
DPRINTF(("ohci_root_ctrl_close\n"));
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Nothing to do. */
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_intr_transfer(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
|
|
|
|
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Pipe isn't running, start first */
|
|
|
|
return (ohci_root_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_intr_start(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_pipe_handle pipe = xfer->pipe;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_intrxfer = xfer;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Abort a root interrupt request. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_intr_abort(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
int s;
|
|
|
|
|
|
|
|
if (xfer->pipe->intrxfer == xfer) {
|
|
|
|
DPRINTF(("ohci_root_intr_abort: remove\n"));
|
|
|
|
xfer->pipe->intrxfer = NULL;
|
|
|
|
}
|
|
|
|
xfer->status = USBD_CANCELLED;
|
|
|
|
s = splusb();
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the root pipe. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_root_intr_close(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
DPRINTF(("ohci_root_intr_close\n"));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_intrxfer = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************/
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_ctrl_transfer(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
/* Pipe isn't running, start first */
|
|
|
|
return (ohci_device_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_ctrl_start(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)xfer->pipe->device->bus;
|
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (!(xfer->rqflags & URQ_REQUEST)) {
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX panic */
|
|
|
|
printf("ohci_device_ctrl_transfer: not a request\n");
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
err = ohci_device_request(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
if (sc->sc_bus.use_polling)
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_waitintr(sc, xfer);
|
1998-12-09 23:28:43 +00:00
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Abort a device control request. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_ctrl_abort(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("ohci_device_ctrl_abort: xfer=%p\n", xfer));
|
1999-11-28 21:01:06 +00:00
|
|
|
ohci_abort_xfer(xfer, USBD_CANCELLED);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close a device control pipe. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_ctrl_close(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
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
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_ctrl_close: pipe=%p\n", pipe));
|
|
|
|
ohci_close_pipe(pipe, sc->sc_ctrl_head);
|
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
|
|
|
ohci_free_std(sc, opipe->tail.td);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************/
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_clear_toggle(usbd_pipe_handle pipe)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
opipe->sed->ed.ed_headp &= htole32(~OHCI_TOGGLECARRY);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_noop(usbd_pipe_handle pipe)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_bulk_transfer(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
/* Pipe isn't running, start first */
|
|
|
|
return (ohci_device_bulk_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_bulk_start(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
1998-12-09 23:28:43 +00:00
|
|
|
usbd_device_handle dev = opipe->pipe.device;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)dev->bus;
|
|
|
|
int addr = dev->address;
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_soft_td_t *data, *tail, *tdp;
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_soft_ed_t *sed;
|
1999-10-07 19:26:38 +00:00
|
|
|
int s, len, isread, endpt;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->rqflags & URQ_REQUEST) {
|
1998-12-09 23:28:43 +00:00
|
|
|
/* XXX panic */
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("ohci_device_bulk_start: a request\n");
|
1998-12-09 23:28:43 +00:00
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
len = xfer->length;
|
|
|
|
endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
|
1999-10-07 19:26:38 +00:00
|
|
|
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
|
1998-12-09 23:28:43 +00:00
|
|
|
sed = opipe->sed;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(4,("ohci_device_bulk_start: xfer=%p len=%d isread=%d "
|
|
|
|
"flags=%d endpt=%d\n", xfer, len, isread, xfer->flags,
|
1999-10-07 19:26:38 +00:00
|
|
|
endpt));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
opipe->u.bulk.isread = isread;
|
|
|
|
opipe->u.bulk.length = len;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
/* Update device address */
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags = htole32(
|
|
|
|
(le32toh(sed->ed.ed_flags) & ~OHCI_ED_ADDRMASK) |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_ED_SET_FA(addr));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Allocate a chain of new TDs (including a new tail). */
|
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
|
|
|
data = opipe->tail.td;
|
2002-04-29 16:23:14 +00:00
|
|
|
err = ohci_alloc_std_chain(opipe, sc, len, isread, xfer,
|
|
|
|
data, &tail);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
tail->xfer = NULL;
|
|
|
|
xfer->hcpriv = data;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(4,("ohci_device_bulk_start: ed_flags=0x%08x td_flags=0x%08x "
|
|
|
|
"td_cbp=0x%08x td_be=0x%08x\n",
|
2001-12-30 23:02:31 +00:00
|
|
|
(int)le32toh(sed->ed.ed_flags),
|
|
|
|
(int)le32toh(data->td.td_flags),
|
|
|
|
(int)le32toh(data->td.td_cbp),
|
|
|
|
(int)le32toh(data->td.td_be)));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-07 16:36:30 +00:00
|
|
|
if (ohcidebug > 5) {
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_dump_ed(sed);
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_dump_tds(data);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
/* Insert ED in schedule */
|
|
|
|
s = splusb();
|
1999-11-17 22:33:51 +00:00
|
|
|
for (tdp = data; tdp != tail; tdp = tdp->nexttd) {
|
|
|
|
tdp->xfer = xfer;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_tailp = htole32(tail->physaddr);
|
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
|
|
|
opipe->tail.td = tail;
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP);
|
1998-12-09 23:28:43 +00:00
|
|
|
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->timeout && !sc->sc_bus.use_polling) {
|
Huge merge from NetBSD:
usbdi.c (1.61):
===================================================================
revision 1.61
date: 2000/01/31 20:13:07; author: augustss; lines: +20 -4
Change the way the HC done method is invoked a little.
===================================================================
usbdi.c (1.65):
===================================================================
revision 1.65
date: 2000/03/08 15:34:10; author: augustss; lines: +4 -2
Get the status right when a polled transfer times out.
===================================================================
ohci.c (1.79), uhci.c (1.89), uhcivar.h (1.24), usb_port.h (1.22),
usbdivar.h (1.48):
===================================================================
date: 2000/03/23 07:01:46; author: thorpej;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
===================================================================
uhci.c (1.80), usbdi.c (1.66):
===================================================================
date: 2000/03/23 18:59:10; author: thorpej;
Shake out some bugs from the callout changes.
===================================================================
ohci.c (1.80), uhci.c (1.91), uhcivar.h (1.25), usb_port.h (1.23),
usbdi.c (1.67), usbdivar.h (1.49):
===================================================================
date: 2000/03/24 22:03:30; author: augustss;
Some cleanup and renaming of the callouts used in USB drivers.
===================================================================
uhci.c (1.92), uhcivar.h (1.26):
===================================================================
date: 2000/03/24 22:57:58; author: augustss;
Two major changes:
Make each xfer have its own intr_info. This is necessary if we want
to queue multiple xfers on an endpoint. This should get rid of the
(mostly harmless) DIAGNOSTICs about intr_infos (not) being done.
Change (again!) how xfers are aborted. Aborting a TD is a nightmare
on the braindead UHCI controller. (Unless you stop the HC, thereby
losing isoc traffic.) Hopefully I got it right this time.
===================================================================
usbdivar.h (1.50):
===================================================================
revision 1.50
date: 2000/03/25 00:10:19; author: augustss; lines: +4 -2
GC an unsued field and add some DIAGNOSTIC in xfer.
===================================================================
ums.c: Use the callout functions instead of the timeout ones.
uhci.c (1.93):
===================================================================
revision 1.93
date: 2000/03/25 00:11:21; author: augustss;
lines: +26 -1
Add more DIAGNOSTIC when aborting isoc.
===================================================================
uhci.c (1.94), usbdivar.h (1.51):
===================================================================
date: 2000/03/25 07:13:05; author: augustss;
More DIAGNOSTIC.
Initialize a callout handle I forgot.
===================================================================
uhci.c (1.95):
===================================================================
revision 1.95
date: 2000/03/25 07:23:12; author: augustss;
Exp; lines: +24 -7
Improve uhci_dump_ii().
===================================================================
ohci.c (1.81), uhci.c (1.96), uhcivar.h (1.27), usb_subr.c (1.68),
usbdi.c (1.68), usbdivar.h (1.52):
===================================================================
date: 2000/03/25 18:02:33; author: augustss;
Rename and move around callout handles to make it more sane.
Add some DIAGNOSTIC.
Fix buglet in isoc abort on UHCI.
===================================================================
uhci.c (1.98):
===================================================================
revision 1.98
date: 2000/03/27 07:39:48; author: augustss; lines: +12 -4
Make it compile without DIAGNOSTIC.
===================================================================
uhci.c (1.99):
===================================================================
revision 1.99
date: 2000/03/27 08:01:09; author: augustss; lines: +1 -5
Remove some debug nonsense.
===================================================================
uhci.c (1.100):
===================================================================
revision 1.100
date: 2000/03/27 09:41:36; author: augustss; lines: +13 -3
Don't mess with QH in bulk abort for the moment.
===================================================================
uhci.c (1.102):
===================================================================
revision 1.102
date: 2000/03/27 22:42:57; author: augustss; lines: +66 -26
Be a little more careful when aborting.
Preallocate some TDs for large buffers.
===================================================================
uhci.c (1.103):
===================================================================
date: 2000/03/28 09:47:10; author: augustss; lines: +11 -1
Another patch for xfer abort...
XXX The current xfer queueing and aborting semantics should really
XXX be changed. It cannot be implemented in a sane way on UHCI.
XXX One day when I have lots of time I'll redesign it...
===================================================================
uhci.c (1.104): Correct a debug message.
uhci.c (1.105): Be more defensive in a DIAGNOSTIC test.
uhci.c (1.106):
===================================================================
revision 1.106
date: 2000/03/29 01:49:13; author: augustss; lines: +14 -309
*SIGH* Revert back to the old method of aborting xfers.
I had tested the new stuff for two months now, but as soon as I commited
it the problems started to appear. Murphy, no doubt...
===================================================================
usb_subr.c (1.70), usbdi.c (1.71), usbdivar.h (1.53):
===================================================================
revision 1.70
date: 2000/03/29 01:45:20; author: augustss; lines: +2 -1
Do not accept new xfers for queuing while a pipe is aborting.
===================================================================
2002-03-16 12:06:01 +00:00
|
|
|
usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
|
|
|
|
ohci_timeout, xfer);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#if 0
|
|
|
|
/* This goes wrong if we are too slow. */
|
2002-04-29 16:23:14 +00:00
|
|
|
if (ohcidebug > 10) {
|
|
|
|
delay(10000);
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_intr_transfer: status=%x\n",
|
|
|
|
OREAD4(sc, OHCI_COMMAND_STATUS)));
|
|
|
|
ohci_dump_ed(sed);
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_dump_tds(data);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-12-09 23:28:43 +00:00
|
|
|
splx(s);
|
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_bulk_abort(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("ohci_device_bulk_abort: xfer=%p\n", xfer));
|
1999-11-28 21:01:06 +00:00
|
|
|
ohci_abort_xfer(xfer, USBD_CANCELLED);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* Close a device bulk pipe.
|
|
|
|
*/
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_bulk_close(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
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
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_bulk_close: pipe=%p\n", pipe));
|
|
|
|
ohci_close_pipe(pipe, sc->sc_bulk_head);
|
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
|
|
|
ohci_free_std(sc, opipe->tail.td);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************/
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_intr_transfer(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
/* Pipe isn't running, start first */
|
|
|
|
return (ohci_device_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_intr_start(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
1998-12-09 23:28:43 +00:00
|
|
|
usbd_device_handle dev = opipe->pipe.device;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)dev->bus;
|
|
|
|
ohci_soft_ed_t *sed = opipe->sed;
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_soft_td_t *data, *tail;
|
1998-12-09 23:28:43 +00:00
|
|
|
int len;
|
|
|
|
int s;
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(3, ("ohci_device_intr_transfer: xfer=%p len=%d "
|
1999-01-07 23:07:57 +00:00
|
|
|
"flags=%d priv=%p\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer, xfer->length, xfer->flags, xfer->priv));
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->rqflags & URQ_REQUEST)
|
1998-12-09 23:28:43 +00:00
|
|
|
panic("ohci_device_intr_transfer: a request\n");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
len = xfer->length;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
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
|
|
|
data = opipe->tail.td;
|
1998-12-09 23:28:43 +00:00
|
|
|
tail = ohci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (tail == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NOMEM);
|
1999-11-17 22:33:51 +00:00
|
|
|
tail->xfer = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_flags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
OHCI_TD_IN | OHCI_TD_NOCC |
|
1999-01-07 23:07:57 +00:00
|
|
|
OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->flags & USBD_SHORT_XFER_OK)
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_flags |= htole32(OHCI_TD_R);
|
|
|
|
data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0));
|
1999-11-17 22:33:51 +00:00
|
|
|
data->nexttd = tail;
|
2001-12-30 23:02:31 +00:00
|
|
|
data->td.td_nexttd = htole32(tail->physaddr);
|
|
|
|
data->td.td_be = htole32(le32toh(data->td.td_cbp) + len - 1);
|
1999-11-17 22:33:51 +00:00
|
|
|
data->len = len;
|
|
|
|
data->xfer = xfer;
|
|
|
|
data->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;
|
|
|
|
xfer->hcpriv = data;
|
1998-12-09 23:28:43 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1998-12-09 23:28:43 +00:00
|
|
|
if (ohcidebug > 5) {
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_intr_transfer:\n"));
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_dump_ed(sed);
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_dump_tds(data);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Insert ED in schedule */
|
|
|
|
s = splusb();
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_tailp = htole32(tail->physaddr);
|
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
|
|
|
opipe->tail.td = tail;
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
1999-05-03 23:11:41 +00:00
|
|
|
#if 0
|
1999-11-17 22:33:51 +00:00
|
|
|
/*
|
|
|
|
* This goes horribly wrong, printing thousands of descriptors,
|
|
|
|
* because false references are followed due to the fact that the
|
|
|
|
* TD is gone.
|
|
|
|
*/
|
1999-10-07 19:26:38 +00:00
|
|
|
if (ohcidebug > 5) {
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 5);
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("ohci_device_intr_transfer: status=%x\n",
|
|
|
|
OREAD4(sc, OHCI_COMMAND_STATUS)));
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_dump_ed(sed);
|
1999-11-17 22:33:51 +00:00
|
|
|
ohci_dump_tds(data);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
1999-01-13 00:50:02 +00:00
|
|
|
splx(s);
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Abort a device control request. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_intr_abort(usbd_xfer_handle xfer)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->pipe->intrxfer == xfer) {
|
1998-12-09 23:28:43 +00:00
|
|
|
DPRINTF(("ohci_device_intr_abort: remove\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->pipe->intrxfer = NULL;
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
1999-11-28 21:01:06 +00:00
|
|
|
ohci_abort_xfer(xfer, USBD_CANCELLED);
|
1998-12-09 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close a device interrupt pipe. */
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_intr_close(usbd_pipe_handle pipe)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
|
|
|
int nslots = opipe->u.intr.nslots;
|
|
|
|
int pos = opipe->u.intr.pos;
|
|
|
|
int j;
|
|
|
|
ohci_soft_ed_t *p, *sed = opipe->sed;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
DPRINTFN(1,("ohci_device_intr_close: pipe=%p nslots=%d pos=%d\n",
|
|
|
|
pipe, nslots, pos));
|
|
|
|
s = splusb();
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP);
|
2002-01-21 05:02:21 +00:00
|
|
|
if ((le32toh(sed->ed.ed_tailp) & OHCI_HEADMASK) !=
|
2001-12-30 23:02:31 +00:00
|
|
|
(le32toh(sed->ed.ed_headp) & OHCI_HEADMASK))
|
1999-01-07 23:07:57 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 2);
|
2000-01-27 23:25:58 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
2002-01-21 05:02:21 +00:00
|
|
|
if ((le32toh(sed->ed.ed_tailp) & OHCI_HEADMASK) !=
|
2001-12-30 23:02:31 +00:00
|
|
|
(le32toh(sed->ed.ed_headp) & OHCI_HEADMASK))
|
2000-01-27 23:25:58 +00:00
|
|
|
panic("%s: Intr pipe %p still has TDs queued\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev), pipe);
|
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
|
|
|
|
for (p = sc->sc_eds[pos]; p && p->next != sed; p = p->next)
|
|
|
|
;
|
1999-11-17 22:33:51 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (p == NULL)
|
1998-12-09 23:28:43 +00:00
|
|
|
panic("ohci_device_intr_close: ED not found\n");
|
1999-11-17 22:33:51 +00:00
|
|
|
#endif
|
1998-12-09 23:28:43 +00:00
|
|
|
p->next = sed->next;
|
1999-10-07 19:26:38 +00:00
|
|
|
p->ed.ed_nexted = sed->ed.ed_nexted;
|
1998-12-09 23:28:43 +00:00
|
|
|
splx(s);
|
|
|
|
|
|
|
|
for (j = 0; j < nslots; j++)
|
1999-10-07 19:26:38 +00:00
|
|
|
--sc->sc_bws[(pos * nslots + j) % OHCI_NO_INTRS];
|
1998-12-09 23:28:43 +00:00
|
|
|
|
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
|
|
|
ohci_free_std(sc, opipe->tail.td);
|
1998-12-09 23:28:43 +00:00
|
|
|
ohci_free_sed(sc, opipe->sed);
|
|
|
|
}
|
|
|
|
|
2000-04-03 20:58:30 +00:00
|
|
|
Static usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_setintr(ohci_softc_t *sc, struct ohci_pipe *opipe, int ival)
|
1998-12-09 23:28:43 +00:00
|
|
|
{
|
|
|
|
int i, j, s, best;
|
|
|
|
u_int npoll, slow, shigh, nslots;
|
|
|
|
u_int bestbw, bw;
|
|
|
|
ohci_soft_ed_t *hsed, *sed = opipe->sed;
|
|
|
|
|
|
|
|
DPRINTFN(2, ("ohci_setintr: pipe=%p\n", opipe));
|
|
|
|
if (ival == 0) {
|
|
|
|
printf("ohci_setintr: 0 interval\n");
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
npoll = OHCI_NO_INTRS;
|
|
|
|
while (npoll > ival)
|
|
|
|
npoll /= 2;
|
|
|
|
DPRINTFN(2, ("ohci_setintr: ival=%d npoll=%d\n", ival, npoll));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We now know which level in the tree the ED must go into.
|
|
|
|
* Figure out which slot has most bandwidth left over.
|
|
|
|
* Slots to examine:
|
|
|
|
* npoll
|
|
|
|
* 1 0
|
|
|
|
* 2 1 2
|
|
|
|
* 4 3 4 5 6
|
|
|
|
* 8 7 8 9 10 11 12 13 14
|
|
|
|
* N (N-1) .. (N-1+N-1)
|
|
|
|
*/
|
|
|
|
slow = npoll-1;
|
|
|
|
shigh = slow + npoll;
|
|
|
|
nslots = OHCI_NO_INTRS / npoll;
|
|
|
|
for (best = i = slow, bestbw = ~0; i < shigh; i++) {
|
|
|
|
bw = 0;
|
|
|
|
for (j = 0; j < nslots; j++)
|
1999-10-07 19:26:38 +00:00
|
|
|
bw += sc->sc_bws[(i * nslots + j) % OHCI_NO_INTRS];
|
1998-12-09 23:28:43 +00:00
|
|
|
if (bw < bestbw) {
|
|
|
|
best = i;
|
|
|
|
bestbw = bw;
|
|
|
|
}
|
|
|
|
}
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(2, ("ohci_setintr: best=%d(%d..%d) bestbw=%d\n",
|
1998-12-09 23:28:43 +00:00
|
|
|
best, slow, shigh, bestbw));
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
hsed = sc->sc_eds[best];
|
|
|
|
sed->next = hsed->next;
|
1999-10-07 19:26:38 +00:00
|
|
|
sed->ed.ed_nexted = hsed->ed.ed_nexted;
|
1998-12-09 23:28:43 +00:00
|
|
|
hsed->next = sed;
|
2001-12-30 23:02:31 +00:00
|
|
|
hsed->ed.ed_nexted = htole32(sed->physaddr);
|
1998-12-09 23:28:43 +00:00
|
|
|
splx(s);
|
|
|
|
|
|
|
|
for (j = 0; j < nslots; j++)
|
1999-10-07 19:26:38 +00:00
|
|
|
++sc->sc_bws[(best * nslots + j) % OHCI_NO_INTRS];
|
1998-12-09 23:28:43 +00:00
|
|
|
opipe->u.intr.nslots = nslots;
|
|
|
|
opipe->u.intr.pos = best;
|
|
|
|
|
|
|
|
DPRINTFN(5, ("ohci_setintr: returns %p\n", opipe));
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/***********************/
|
|
|
|
|
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_transfer(usbd_xfer_handle xfer)
|
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
|
|
|
{
|
|
|
|
usbd_status err;
|
|
|
|
|
|
|
|
DPRINTFN(5,("ohci_device_isoc_transfer: xfer=%p\n", xfer));
|
|
|
|
|
|
|
|
/* Put it on our queue, */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
|
|
|
|
/* bail out on error, */
|
|
|
|
if (err && err != USBD_IN_PROGRESS)
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
/* XXX should check inuse here */
|
|
|
|
|
|
|
|
/* insert into schedule, */
|
|
|
|
ohci_device_isoc_enter(xfer);
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
/* and start if the pipe wasn't running */
|
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
|
|
|
if (!err)
|
|
|
|
ohci_device_isoc_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
|
|
|
|
|
|
|
|
return (err);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_enter(usbd_xfer_handle xfer)
|
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
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
|
|
|
usbd_device_handle dev = opipe->pipe.device;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)dev->bus;
|
|
|
|
ohci_soft_ed_t *sed = opipe->sed;
|
|
|
|
struct iso *iso = &opipe->u.iso;
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_soft_itd_t *sitd, *nsitd;
|
2002-04-01 13:18:11 +00:00
|
|
|
ohci_physaddr_t buf, offs, noffs, bp0;
|
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
|
|
|
int i, ncur, nframes;
|
|
|
|
int s;
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
DPRINTFN(1,("ohci_device_isoc_enter: used=%d next=%d xfer=%p "
|
|
|
|
"nframes=%d\n",
|
|
|
|
iso->inuse, iso->next, xfer, xfer->nframes));
|
|
|
|
|
|
|
|
if (sc->sc_dying)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (iso->next == -1) {
|
|
|
|
/* Not in use yet, schedule it a few frames ahead. */
|
|
|
|
iso->next = le32toh(sc->sc_hcca->hcca_frame_number) + 5;
|
2002-04-07 16:36:30 +00:00
|
|
|
DPRINTFN(2,("ohci_device_isoc_enter: start next=%d\n",
|
2002-04-01 13:18:11 +00:00
|
|
|
iso->next));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
sitd = opipe->tail.itd;
|
2000-02-10 18:50:19 +00:00
|
|
|
buf = DMAADDR(&xfer->dmabuf, 0);
|
2002-04-01 13:18:11 +00:00
|
|
|
bp0 = OHCI_PAGE(buf);
|
|
|
|
offs = OHCI_PAGE_OFFSET(buf);
|
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
|
|
|
nframes = xfer->nframes;
|
2002-04-01 13:18:11 +00:00
|
|
|
xfer->hcpriv = sitd;
|
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
|
|
|
for (i = ncur = 0; i < nframes; i++, ncur++) {
|
2002-04-01 13:18:11 +00:00
|
|
|
noffs = offs + xfer->frlengths[i];
|
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
|
|
|
if (ncur == OHCI_ITD_NOFFSET || /* all offsets used */
|
2002-04-07 16:36:30 +00:00
|
|
|
OHCI_PAGE(buf + noffs) > bp0 + OHCI_PAGE_SIZE) { /* too many page crossings */
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
/* Allocate next ITD */
|
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
|
|
|
nsitd = ohci_alloc_sitd(sc);
|
|
|
|
if (nsitd == NULL) {
|
|
|
|
/* XXX what now? */
|
2002-04-01 13:18:11 +00:00
|
|
|
printf("%s: isoc TD alloc failed\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
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
|
|
|
return;
|
|
|
|
}
|
2002-04-01 13:18:11 +00:00
|
|
|
|
|
|
|
/* Fill current ITD */
|
2001-12-30 23:02:31 +00:00
|
|
|
sitd->itd.itd_flags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
OHCI_ITD_NOCC |
|
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
|
|
|
OHCI_ITD_SET_SF(iso->next) |
|
2002-04-01 13:18:11 +00:00
|
|
|
OHCI_ITD_SET_DI(6) | /* delay intr a little */
|
|
|
|
OHCI_ITD_SET_FC(ncur));
|
|
|
|
sitd->itd.itd_bp0 = htole32(bp0);
|
|
|
|
sitd->nextitd = nsitd;
|
|
|
|
sitd->itd.itd_nextitd = htole32(nsitd->physaddr);
|
|
|
|
sitd->itd.itd_be = htole32(bp0 + offs - 1);
|
|
|
|
sitd->xfer = xfer;
|
|
|
|
sitd->flags = 0;
|
|
|
|
|
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
|
|
|
sitd = nsitd;
|
2002-02-03 17:03:34 +00:00
|
|
|
iso->next = iso->next + ncur;
|
2002-04-01 13:18:11 +00:00
|
|
|
bp0 = OHCI_PAGE(buf + offs);
|
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
|
|
|
ncur = 0;
|
|
|
|
}
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd->itd.itd_offset[ncur] = htole16(OHCI_ITD_MK_OFFS(offs));
|
|
|
|
offs = noffs;
|
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
|
|
|
}
|
|
|
|
nsitd = ohci_alloc_sitd(sc);
|
|
|
|
if (nsitd == NULL) {
|
|
|
|
/* XXX what now? */
|
2002-04-07 16:36:30 +00:00
|
|
|
printf("%s: isoc TD alloc failed\n",
|
2002-04-01 13:18:11 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
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
|
|
|
return;
|
|
|
|
}
|
2002-04-01 13:18:11 +00:00
|
|
|
/* Fixup last used ITD */
|
|
|
|
sitd->itd.itd_flags = htole32(
|
2002-02-03 17:03:34 +00:00
|
|
|
OHCI_ITD_NOCC |
|
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
|
|
|
OHCI_ITD_SET_SF(iso->next) |
|
|
|
|
OHCI_ITD_SET_DI(0) |
|
|
|
|
OHCI_ITD_SET_FC(ncur));
|
2002-04-01 13:18:11 +00:00
|
|
|
sitd->itd.itd_bp0 = htole32(bp0);
|
|
|
|
sitd->nextitd = nsitd;
|
|
|
|
sitd->itd.itd_nextitd = htole32(nsitd->physaddr);
|
|
|
|
sitd->itd.itd_be = htole32(bp0 + offs - 1);
|
|
|
|
sitd->xfer = xfer;
|
|
|
|
sitd->flags = OHCI_CALL_DONE;
|
|
|
|
|
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
|
|
|
iso->next = iso->next + ncur;
|
2002-04-01 13:18:11 +00:00
|
|
|
iso->inuse += nframes;
|
|
|
|
|
|
|
|
xfer->actlen = offs; /* XXX pretend we did it all */
|
|
|
|
|
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-01 13:18:11 +00:00
|
|
|
if (ohcidebug > 5) {
|
|
|
|
DPRINTF(("ohci_device_isoc_enter: frame=%d\n",
|
|
|
|
le32toh(sc->sc_hcca->hcca_frame_number)));
|
|
|
|
ohci_dump_itds(xfer->hcpriv);
|
|
|
|
ohci_dump_ed(sed);
|
|
|
|
}
|
|
|
|
#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
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
s = splusb();
|
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
|
|
|
opipe->tail.itd = nsitd;
|
2001-12-30 23:02:31 +00:00
|
|
|
sed->ed.ed_tailp = htole32(nsitd->physaddr);
|
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
|
|
|
splx(s);
|
2002-04-01 13:18:11 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-01 13:18:11 +00:00
|
|
|
if (ohcidebug > 5) {
|
|
|
|
delay(150000);
|
|
|
|
DPRINTF(("ohci_device_isoc_enter: after frame=%d\n",
|
|
|
|
le32toh(sc->sc_hcca->hcca_frame_number)));
|
|
|
|
ohci_dump_itds(xfer->hcpriv);
|
|
|
|
ohci_dump_ed(sed);
|
|
|
|
}
|
|
|
|
#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
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_start(usbd_xfer_handle xfer)
|
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
|
|
|
{
|
2002-04-01 13:18:11 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
|
|
|
|
|
|
|
DPRINTFN(5,("ohci_device_isoc_start: xfer=%p\n", xfer));
|
|
|
|
|
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->status != USBD_IN_PROGRESS)
|
2002-04-07 15:18:00 +00:00
|
|
|
printf("ohci_device_isoc_start: not in progress %p\n", xfer);
|
2002-04-01 13:18:11 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* XXX anything to do? */
|
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
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
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_abort(usbd_xfer_handle xfer)
|
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
|
|
|
{
|
2002-04-01 13:18:11 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
|
|
|
ohci_soft_ed_t *sed;
|
|
|
|
ohci_soft_itd_t *sitd;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
|
|
|
|
DPRINTFN(1,("ohci_device_isoc_abort: xfer=%p\n", xfer));
|
|
|
|
|
|
|
|
/* Transfer is already done. */
|
2002-04-07 16:36:30 +00:00
|
|
|
if (xfer->status != USBD_NOT_STARTED &&
|
2002-04-01 13:18:11 +00:00
|
|
|
xfer->status != USBD_IN_PROGRESS) {
|
|
|
|
splx(s);
|
|
|
|
printf("ohci_device_isoc_abort: early return\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Give xfer the requested abort code. */
|
|
|
|
xfer->status = USBD_CANCELLED;
|
|
|
|
|
|
|
|
sed = opipe->sed;
|
|
|
|
sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* force hardware skip */
|
|
|
|
|
|
|
|
sitd = xfer->hcpriv;
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (sitd == NULL) {
|
2002-04-07 10:02:45 +00:00
|
|
|
splx(s);
|
2002-04-01 13:18:11 +00:00
|
|
|
printf("ohci_device_isoc_abort: hcpriv==0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
for (; sitd->xfer == xfer; sitd = sitd->nextitd) {
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
DPRINTFN(1,("abort sets done sitd=%p\n", sitd));
|
|
|
|
sitd->isdone = 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
|
|
|
|
usb_delay_ms(&sc->sc_bus, OHCI_ITD_NOFFSET);
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
|
|
|
|
/* Run callback. */
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
|
|
|
|
sed->ed.ed_headp = htole32(sitd->physaddr); /* unlink TDs */
|
|
|
|
sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); /* remove hardware skip */
|
|
|
|
|
|
|
|
splx(s);
|
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
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_done(usbd_xfer_handle xfer)
|
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
|
|
|
{
|
2002-04-01 13:18:11 +00:00
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus;
|
2002-04-07 16:36:30 +00:00
|
|
|
ohci_soft_itd_t *sitd, *nsitd;
|
2002-04-01 13:18:11 +00:00
|
|
|
|
|
|
|
DPRINTFN(1,("ohci_device_isoc_done: xfer=%p\n", xfer));
|
|
|
|
|
|
|
|
for (sitd = xfer->hcpriv;
|
|
|
|
!(sitd->flags & OHCI_CALL_DONE);
|
|
|
|
sitd = nsitd) {
|
|
|
|
nsitd = sitd->nextitd;
|
|
|
|
DPRINTFN(1,("ohci_device_isoc_done: free sitd=%p\n", sitd));
|
|
|
|
ohci_free_sitd(sc, sitd);
|
|
|
|
}
|
|
|
|
ohci_free_sitd(sc, sitd);
|
|
|
|
xfer->hcpriv = NULL;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_setup_isoc(usbd_pipe_handle pipe)
|
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
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
2002-04-01 13:18:11 +00:00
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
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
|
|
|
struct iso *iso = &opipe->u.iso;
|
2002-04-01 13:18:11 +00:00
|
|
|
int s;
|
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
|
|
|
|
|
|
|
iso->next = -1;
|
|
|
|
iso->inuse = 0;
|
|
|
|
|
2002-04-01 13:18:11 +00:00
|
|
|
s = splusb();
|
|
|
|
ohci_add_ed(opipe->sed, sc->sc_isoc_head);
|
|
|
|
splx(s);
|
|
|
|
|
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
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-03 17:03:34 +00:00
|
|
|
ohci_device_isoc_close(usbd_pipe_handle pipe)
|
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
|
|
|
{
|
|
|
|
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
|
|
|
|
ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus;
|
|
|
|
|
|
|
|
DPRINTF(("ohci_device_isoc_close: pipe=%p\n", pipe));
|
|
|
|
ohci_close_pipe(pipe, sc->sc_isoc_head);
|
2002-04-01 13:18:11 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
opipe->tail.itd->isdone = 1;
|
|
|
|
#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
|
|
|
ohci_free_sitd(sc, opipe->tail.itd);
|
|
|
|
}
|