2003-11-09 23:56:19 +00:00
|
|
|
/* $NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $ */
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2003-07-14 18:49:18 +00:00
|
|
|
/* Also already incorporated from NetBSD:
|
2003-07-14 18:52:12 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $
|
2003-07-14 18:56:33 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.173 2003/05/13 04:41:59 gson Exp $
|
2003-11-09 23:59:53 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.175 2003/09/12 16:18:08 mycroft Exp $
|
2003-11-10 00:08:41 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.176 2003/11/04 19:11:21 mycroft Exp $
|
2004-05-23 11:43:34 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.177 2003/12/29 08:17:10 toshii Exp $
|
|
|
|
* $NetBSD: uhci.c,v 1.178 2004/03/02 16:32:05 martin Exp $
|
2004-07-19 20:47:46 +00:00
|
|
|
* $NetBSD: uhci.c,v 1.180 2004/07/17 20:12:03 mycroft Exp $
|
2003-07-14 18:14:15 +00:00
|
|
|
*/
|
|
|
|
|
2003-08-24 17:55:58 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2003-07-14 17:58:26 +00:00
|
|
|
|
2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
1998-11-26 23:13:13 +00:00
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
1999-01-07 23:07:57 +00:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
2000-05-14 16:43:10 +00:00
|
|
|
* by Lennart Augustsson (lennart@augustsson.net) at
|
1999-01-07 23:07:57 +00:00
|
|
|
* Carlstedt Research & Technology.
|
1998-11-26 23:13:13 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* USB Universal Host Controller driver.
|
1999-10-07 19:26:38 +00:00
|
|
|
* Handles e.g. PIIX3 and PIIX4.
|
1998-11-26 23:13:13 +00:00
|
|
|
*
|
2002-01-03 02:10:31 +00:00
|
|
|
* UHCI spec: http://developer.intel.com/design/USB/UHCI11D.htm
|
2003-07-14 18:14:15 +00:00
|
|
|
* USB spec: http://www.usb.org/developers/docs/usbspec.zip
|
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
|
|
|
* PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf
|
|
|
|
* ftp://download.intel.com/design/intarch/datashts/29056201.pdf
|
1998-11-26 23:13:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
1999-10-07 19:26:38 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1998-11-26 23:13:13 +00:00
|
|
|
#include <sys/device.h>
|
1999-11-08 21:06:21 +00:00
|
|
|
#include <sys/select.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
#elif defined(__FreeBSD__)
|
2002-04-26 22:48:23 +00:00
|
|
|
#include <sys/endian.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/bus.h>
|
1999-11-17 22:33:51 +00:00
|
|
|
#include <machine/bus_pio.h>
|
|
|
|
#if defined(DIAGNOSTIC) && defined(__i386__)
|
|
|
|
#include <machine/cpu.h>
|
|
|
|
#endif
|
1998-11-26 23:13:13 +00:00
|
|
|
#endif
|
2002-04-07 18:33:12 +00:00
|
|
|
#include <sys/proc.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
#include <sys/queue.h>
|
2002-07-31 13:33:55 +00:00
|
|
|
#include <sys/sysctl.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#include <machine/bus.h>
|
1999-10-07 19:26:38 +00:00
|
|
|
#include <machine/endian.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#include <dev/usb/usb.h>
|
|
|
|
#include <dev/usb/usbdi.h>
|
|
|
|
#include <dev/usb/usbdivar.h>
|
|
|
|
#include <dev/usb/usb_mem.h>
|
|
|
|
#include <dev/usb/usb_quirks.h>
|
|
|
|
|
|
|
|
#include <dev/usb/uhcireg.h>
|
|
|
|
#include <dev/usb/uhcivar.h>
|
|
|
|
|
2002-01-20 23:48:43 +00:00
|
|
|
/* Use bandwidth reclamation for control transfers. Some devices choke on it. */
|
|
|
|
/*#define UHCI_CTL_LOOP */
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
#if defined(__FreeBSD__)
|
2000-10-16 18:50:00 +00:00
|
|
|
#include <machine/clock.h>
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#define delay(d) DELAY(d)
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
|
|
|
|
|
|
|
|
#if defined(__OpenBSD__)
|
|
|
|
struct cfdriver uhci_cd = {
|
|
|
|
NULL, "uhci", DV_DULL
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_softc_t *thesc;
|
1999-10-07 19:26:38 +00:00
|
|
|
#define DPRINTF(x) if (uhcidebug) printf x
|
|
|
|
#define DPRINTFN(n,x) if (uhcidebug>(n)) printf x
|
2002-01-03 02:10:31 +00:00
|
|
|
int uhcidebug = 0;
|
|
|
|
int uhcinoloop = 0;
|
2002-08-08 12:05:51 +00:00
|
|
|
SYSCTL_NODE(_hw_usb, OID_AUTO, uhci, CTLFLAG_RW, 0, "USB uhci");
|
|
|
|
SYSCTL_INT(_hw_usb_uhci, OID_AUTO, debug, CTLFLAG_RW,
|
2002-07-31 13:33:55 +00:00
|
|
|
&uhcidebug, 0, "uhci debug level");
|
2002-08-08 12:05:51 +00:00
|
|
|
SYSCTL_INT(_hw_usb_uhci, OID_AUTO, loop, CTLFLAG_RW,
|
|
|
|
&uhcinoloop, 0, "uhci noloop");
|
2002-01-03 02:10:31 +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)
|
|
|
|
#endif
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* The UHCI controller is little endian, so on big endian machines
|
|
|
|
* the data strored in memory needs to be swapped.
|
|
|
|
*/
|
2002-02-27 17:16:18 +00:00
|
|
|
#if defined(__OpenBSD__)
|
1999-10-07 19:26:38 +00:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
2001-12-30 23:02:31 +00:00
|
|
|
#define htole32(x) (bswap32(x))
|
|
|
|
#define le32toh(x) (bswap32(x))
|
1999-10-07 19:26:38 +00:00
|
|
|
#else
|
2001-12-30 23:02:31 +00:00
|
|
|
#define htole32(x) (x)
|
|
|
|
#define le32toh(x) (x)
|
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
struct uhci_pipe {
|
|
|
|
struct usbd_pipe pipe;
|
1999-07-25 18:54:22 +00:00
|
|
|
int nexttoggle;
|
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
|
|
|
|
|
|
|
u_char aborting;
|
|
|
|
usbd_xfer_handle abortstart, abortend;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Info needed for different pipe kinds. */
|
1998-11-26 23:13:13 +00:00
|
|
|
union {
|
|
|
|
/* Control pipe */
|
|
|
|
struct {
|
|
|
|
uhci_soft_qh_t *sqh;
|
|
|
|
usb_dma_t reqdma;
|
1999-01-07 23:07:57 +00:00
|
|
|
uhci_soft_td_t *setup, *stat;
|
1998-11-26 23:13:13 +00:00
|
|
|
u_int length;
|
|
|
|
} ctl;
|
|
|
|
/* Interrupt pipe */
|
|
|
|
struct {
|
|
|
|
int npoll;
|
2003-02-28 19:28:29 +00:00
|
|
|
int isread;
|
1998-11-26 23:13:13 +00:00
|
|
|
uhci_soft_qh_t **qhs;
|
|
|
|
} intr;
|
|
|
|
/* Bulk pipe */
|
|
|
|
struct {
|
|
|
|
uhci_soft_qh_t *sqh;
|
|
|
|
u_int length;
|
|
|
|
int isread;
|
|
|
|
} bulk;
|
1999-01-07 23:07:57 +00:00
|
|
|
/* Iso pipe */
|
|
|
|
struct iso {
|
|
|
|
uhci_soft_td_t **stds;
|
1999-10-07 19:26:38 +00:00
|
|
|
int next, inuse;
|
1999-01-07 23:07:57 +00:00
|
|
|
} iso;
|
1998-11-26 23:13:13 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2002-04-07 09:57:23 +00:00
|
|
|
Static void uhci_globalreset(uhci_softc_t *);
|
2003-07-14 18:07:54 +00:00
|
|
|
Static usbd_status uhci_portreset(uhci_softc_t*, int);
|
2002-04-07 09:57:23 +00:00
|
|
|
Static void uhci_reset(uhci_softc_t *);
|
2002-04-07 18:33:12 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
Static void uhci_shutdown(void *v);
|
|
|
|
Static void uhci_power(int, void *);
|
2002-02-27 09:16:00 +00:00
|
|
|
#endif
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_run(uhci_softc_t *, int run);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static uhci_soft_td_t *uhci_alloc_std(uhci_softc_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_free_std(uhci_softc_t *, uhci_soft_td_t *);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static uhci_soft_qh_t *uhci_alloc_sqh(uhci_softc_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_free_sqh(uhci_softc_t *, uhci_soft_qh_t *);
|
2002-04-07 18:33:12 +00:00
|
|
|
#if 0
|
|
|
|
Static void uhci_enter_ctl_q(uhci_softc_t *, uhci_soft_qh_t *,
|
|
|
|
uhci_intr_info_t *);
|
|
|
|
Static void uhci_exit_ctl_q(uhci_softc_t *, uhci_soft_qh_t *);
|
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
Static void uhci_free_std_chain(uhci_softc_t *,
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_soft_td_t *, uhci_soft_td_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_alloc_std_chain(struct uhci_pipe *,
|
2002-02-03 17:03:34 +00:00
|
|
|
uhci_softc_t *, int, int, u_int16_t, usb_dma_t *,
|
2000-07-17 18:41:20 +00:00
|
|
|
uhci_soft_td_t **, uhci_soft_td_t **);
|
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
|
|
|
Static void uhci_poll_hub(void *);
|
2000-08-01 22:40:23 +00:00
|
|
|
Static void uhci_waitintr(uhci_softc_t *, usbd_xfer_handle);
|
|
|
|
Static void uhci_check_intr(uhci_softc_t *, uhci_intr_info_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_idone(uhci_intr_info_t *);
|
2000-08-01 22:40:23 +00:00
|
|
|
|
|
|
|
Static void uhci_abort_xfer(usbd_xfer_handle, usbd_status status);
|
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_timeout(void *);
|
2002-04-07 18:03:45 +00:00
|
|
|
Static void uhci_timeout_task(void *);
|
2002-01-20 20:12:25 +00:00
|
|
|
Static void uhci_add_ls_ctrl(uhci_softc_t *, uhci_soft_qh_t *);
|
|
|
|
Static void uhci_add_hs_ctrl(uhci_softc_t *, uhci_soft_qh_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_add_bulk(uhci_softc_t *, uhci_soft_qh_t *);
|
2002-01-20 20:12:25 +00:00
|
|
|
Static void uhci_remove_ls_ctrl(uhci_softc_t *,uhci_soft_qh_t *);
|
|
|
|
Static void uhci_remove_hs_ctrl(uhci_softc_t *,uhci_soft_qh_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_remove_bulk(uhci_softc_t *,uhci_soft_qh_t *);
|
|
|
|
Static int uhci_str(usb_string_descriptor_t *, int, char *);
|
2002-01-20 20:12:25 +00:00
|
|
|
Static void uhci_add_loop(uhci_softc_t *sc);
|
|
|
|
Static void uhci_rem_loop(uhci_softc_t *sc);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_setup_isoc(usbd_pipe_handle pipe);
|
|
|
|
Static void uhci_device_isoc_enter(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-08-01 22:40:23 +00:00
|
|
|
Static usbd_status uhci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_freem(struct usbd_bus *, usb_dma_t *);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_xfer_handle uhci_allocx(struct usbd_bus *);
|
|
|
|
Static void uhci_freex(struct usbd_bus *, usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_device_ctrl_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_device_ctrl_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_ctrl_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_ctrl_close(usbd_pipe_handle);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_device_ctrl_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_device_intr_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_device_intr_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_intr_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_intr_close(usbd_pipe_handle);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_device_intr_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_device_bulk_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_device_bulk_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_bulk_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_bulk_close(usbd_pipe_handle);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_device_bulk_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_device_isoc_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_device_isoc_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_isoc_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_device_isoc_close(usbd_pipe_handle);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_device_isoc_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_root_ctrl_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_root_ctrl_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_root_ctrl_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_root_ctrl_close(usbd_pipe_handle);
|
2002-01-21 03:44:00 +00:00
|
|
|
Static void uhci_root_ctrl_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_root_intr_transfer(usbd_xfer_handle);
|
|
|
|
Static usbd_status uhci_root_intr_start(usbd_xfer_handle);
|
|
|
|
Static void uhci_root_intr_abort(usbd_xfer_handle);
|
|
|
|
Static void uhci_root_intr_close(usbd_pipe_handle);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_root_intr_done(usbd_xfer_handle);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_open(usbd_pipe_handle);
|
|
|
|
Static void uhci_poll(struct usbd_bus *);
|
2002-04-01 21:34:01 +00:00
|
|
|
Static void uhci_softintr(void *);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static usbd_status uhci_device_request(usbd_xfer_handle xfer);
|
2000-04-03 20:58:30 +00:00
|
|
|
|
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
|
|
|
Static void uhci_add_intr(uhci_softc_t *, uhci_soft_qh_t *);
|
2002-04-07 18:33:12 +00:00
|
|
|
Static void uhci_remove_intr(uhci_softc_t *, uhci_soft_qh_t *);
|
2002-02-03 17:03:34 +00:00
|
|
|
Static usbd_status uhci_device_setintr(uhci_softc_t *sc,
|
2000-07-17 18:41:20 +00:00
|
|
|
struct uhci_pipe *pipe, int ival);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_device_clear_toggle(usbd_pipe_handle pipe);
|
|
|
|
Static void uhci_noop(usbd_pipe_handle pipe);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2004-10-03 16:12:29 +00:00
|
|
|
Static __inline uhci_soft_qh_t *uhci_find_prev_qh(uhci_soft_qh_t *,
|
|
|
|
uhci_soft_qh_t *);
|
2002-01-20 20:12:25 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_dump_all(uhci_softc_t *);
|
2000-07-17 18:41:20 +00:00
|
|
|
Static void uhci_dumpregs(uhci_softc_t *);
|
|
|
|
Static void uhci_dump_qhs(uhci_soft_qh_t *);
|
|
|
|
Static void uhci_dump_qh(uhci_soft_qh_t *);
|
|
|
|
Static void uhci_dump_tds(uhci_soft_td_t *);
|
|
|
|
Static void uhci_dump_td(uhci_soft_td_t *);
|
2002-01-03 02:10:31 +00:00
|
|
|
Static void uhci_dump_ii(uhci_intr_info_t *ii);
|
|
|
|
void uhci_dump(void);
|
1998-11-26 23:13:13 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-16 12:44:21 +00:00
|
|
|
#define UBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->sc_size, \
|
|
|
|
BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
|
|
|
|
#define UWRITE1(sc, r, x) \
|
2003-07-14 17:58:26 +00:00
|
|
|
do { UBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); \
|
|
|
|
} while (/*CONSTCOND*/0)
|
2002-03-16 12:44:21 +00:00
|
|
|
#define UWRITE2(sc, r, x) \
|
2003-07-14 17:58:26 +00:00
|
|
|
do { UBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); \
|
|
|
|
} while (/*CONSTCOND*/0)
|
2002-03-16 12:44:21 +00:00
|
|
|
#define UWRITE4(sc, r, x) \
|
2003-07-14 17:58:26 +00:00
|
|
|
do { UBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); \
|
|
|
|
} while (/*CONSTCOND*/0)
|
2002-03-16 12:44:21 +00:00
|
|
|
#define UREAD1(sc, r) (UBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
|
|
|
|
#define UREAD2(sc, r) (UBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
|
|
|
|
#define UREAD4(sc, r) (UBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#define UHCICMD(sc, cmd) UWRITE2(sc, UHCI_CMD, cmd)
|
|
|
|
#define UHCISTS(sc) UREAD2(sc, UHCI_STS)
|
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
#define UHCI_RESET_TIMEOUT 100 /* ms, reset timeout */
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
#define UHCI_CURFRAME(sc) (UREAD2(sc, UHCI_FRNUM) & UHCI_FRNUM_MASK)
|
|
|
|
|
|
|
|
#define UHCI_INTR_ENDPT 1
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
struct usbd_bus_methods uhci_bus_methods = {
|
|
|
|
uhci_open,
|
2002-01-26 12:04:22 +00:00
|
|
|
uhci_softintr,
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_poll,
|
|
|
|
uhci_allocm,
|
|
|
|
uhci_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
|
|
|
uhci_allocx,
|
|
|
|
uhci_freex,
|
1999-10-07 19:26:38 +00:00
|
|
|
};
|
1999-01-07 23:07:57 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
struct usbd_pipe_methods uhci_root_ctrl_methods = {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_root_ctrl_transfer,
|
|
|
|
uhci_root_ctrl_start,
|
|
|
|
uhci_root_ctrl_abort,
|
|
|
|
uhci_root_ctrl_close,
|
|
|
|
uhci_noop,
|
2002-01-21 03:44:00 +00:00
|
|
|
uhci_root_ctrl_done,
|
1999-10-07 19:26:38 +00:00
|
|
|
};
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
struct usbd_pipe_methods uhci_root_intr_methods = {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_root_intr_transfer,
|
|
|
|
uhci_root_intr_start,
|
|
|
|
uhci_root_intr_abort,
|
|
|
|
uhci_root_intr_close,
|
|
|
|
uhci_noop,
|
|
|
|
uhci_root_intr_done,
|
|
|
|
};
|
1999-05-30 12:49:39 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
struct usbd_pipe_methods uhci_device_ctrl_methods = {
|
|
|
|
uhci_device_ctrl_transfer,
|
|
|
|
uhci_device_ctrl_start,
|
|
|
|
uhci_device_ctrl_abort,
|
|
|
|
uhci_device_ctrl_close,
|
|
|
|
uhci_noop,
|
|
|
|
uhci_device_ctrl_done,
|
|
|
|
};
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
struct usbd_pipe_methods uhci_device_intr_methods = {
|
|
|
|
uhci_device_intr_transfer,
|
|
|
|
uhci_device_intr_start,
|
|
|
|
uhci_device_intr_abort,
|
|
|
|
uhci_device_intr_close,
|
|
|
|
uhci_device_clear_toggle,
|
|
|
|
uhci_device_intr_done,
|
|
|
|
};
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
struct usbd_pipe_methods uhci_device_bulk_methods = {
|
|
|
|
uhci_device_bulk_transfer,
|
|
|
|
uhci_device_bulk_start,
|
|
|
|
uhci_device_bulk_abort,
|
|
|
|
uhci_device_bulk_close,
|
|
|
|
uhci_device_clear_toggle,
|
|
|
|
uhci_device_bulk_done,
|
|
|
|
};
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
struct usbd_pipe_methods uhci_device_isoc_methods = {
|
|
|
|
uhci_device_isoc_transfer,
|
|
|
|
uhci_device_isoc_start,
|
|
|
|
uhci_device_isoc_abort,
|
|
|
|
uhci_device_isoc_close,
|
|
|
|
uhci_noop,
|
|
|
|
uhci_device_isoc_done,
|
|
|
|
};
|
1999-08-17 07:36:34 +00:00
|
|
|
|
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
|
|
|
#define uhci_add_intr_info(sc, ii) \
|
2003-07-14 18:47:27 +00:00
|
|
|
LIST_INSERT_HEAD(&(sc)->sc_intrhead, (ii), list)
|
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
|
|
|
#define uhci_del_intr_info(ii) \
|
2003-07-14 18:47:27 +00:00
|
|
|
do { \
|
|
|
|
LIST_REMOVE((ii), list); \
|
|
|
|
(ii)->list.le_prev = NULL; \
|
|
|
|
} while (0)
|
|
|
|
#define uhci_active_intr_info(ii) ((ii)->list.le_prev != NULL)
|
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
|
|
|
|
2004-10-03 16:12:29 +00:00
|
|
|
Static __inline uhci_soft_qh_t *
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_find_prev_qh(uhci_soft_qh_t *pqh, uhci_soft_qh_t *sqh)
|
|
|
|
{
|
|
|
|
DPRINTFN(15,("uhci_find_prev_qh: pqh=%p sqh=%p\n", pqh, sqh));
|
|
|
|
|
|
|
|
for (; pqh->hlink != sqh; pqh = pqh->hlink) {
|
2002-07-31 14:34:36 +00:00
|
|
|
#if defined(DIAGNOSTIC) || defined(USB_DEBUG)
|
2002-01-20 20:12:25 +00:00
|
|
|
if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) {
|
|
|
|
printf("uhci_find_prev_qh: QH not found\n");
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return (pqh);
|
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2002-04-07 09:57:23 +00:00
|
|
|
uhci_globalreset(uhci_softc_t *sc)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
UHCICMD(sc, UHCI_CMD_GRESET); /* global reset */
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_BUS_RESET_DELAY); /* wait a little */
|
|
|
|
UHCICMD(sc, 0); /* do nothing */
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_init(uhci_softc_t *sc)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
int i, j;
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_soft_qh_t *clsqh, *chsqh, *bsqh, *sqh, *lsqh;
|
1999-08-17 07:36:34 +00:00
|
|
|
uhci_soft_td_t *std;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(1,("uhci_init: start\n"));
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
thesc = sc;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 2)
|
|
|
|
uhci_dumpregs(sc);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
UWRITE2(sc, UHCI_INTR, 0); /* disable interrupts */
|
2002-04-07 09:57:23 +00:00
|
|
|
uhci_globalreset(sc); /* reset the controller */
|
|
|
|
uhci_reset(sc);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Allocate and initialize real frame array. */
|
2002-02-03 17:03:34 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus,
|
1999-11-17 22:33:51 +00:00
|
|
|
UHCI_FRAMELIST_COUNT * sizeof(uhci_physaddr_t),
|
|
|
|
UHCI_FRAMELIST_ALIGN, &sc->sc_dma);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
2000-02-10 18:50:19 +00:00
|
|
|
sc->sc_pframes = KERNADDR(&sc->sc_dma, 0);
|
1999-10-07 19:26:38 +00:00
|
|
|
UWRITE2(sc, UHCI_FRNUM, 0); /* set frame number to 0 */
|
2000-02-10 18:50:19 +00:00
|
|
|
UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0)); /* set frame list*/
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
2002-01-20 20:12:25 +00:00
|
|
|
* Allocate a TD, inactive, that hangs from the last QH.
|
|
|
|
* This is to avoid a bug in the PIIX that makes it run berserk
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
std = uhci_alloc_std(sc);
|
|
|
|
if (std == NULL)
|
|
|
|
return (USBD_NOMEM);
|
|
|
|
std->link.std = NULL;
|
|
|
|
std->td.td_link = htole32(UHCI_PTR_T);
|
|
|
|
std->td.td_status = htole32(0); /* inactive */
|
|
|
|
std->td.td_token = htole32(0);
|
|
|
|
std->td.td_buffer = htole32(0);
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
/* Allocate the dummy QH marking the end and used for looping the QHs.*/
|
|
|
|
lsqh = uhci_alloc_sqh(sc);
|
|
|
|
if (lsqh == NULL)
|
|
|
|
return (USBD_NOMEM);
|
|
|
|
lsqh->hlink = NULL;
|
|
|
|
lsqh->qh.qh_hlink = htole32(UHCI_PTR_T); /* end of QH chain */
|
|
|
|
lsqh->elink = std;
|
|
|
|
lsqh->qh.qh_elink = htole32(std->physaddr | UHCI_PTR_TD);
|
|
|
|
sc->sc_last_qh = lsqh;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Allocate the dummy QH where bulk traffic will be queued. */
|
1998-11-26 23:13:13 +00:00
|
|
|
bsqh = uhci_alloc_sqh(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (bsqh == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NOMEM);
|
2002-01-20 20:12:25 +00:00
|
|
|
bsqh->hlink = lsqh;
|
|
|
|
bsqh->qh.qh_hlink = htole32(lsqh->physaddr | UHCI_PTR_QH);
|
2002-01-20 12:08:09 +00:00
|
|
|
bsqh->elink = NULL;
|
2001-12-30 23:02:31 +00:00
|
|
|
bsqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
1998-11-26 23:13:13 +00:00
|
|
|
sc->sc_bulk_start = sc->sc_bulk_end = bsqh;
|
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
/* Allocate dummy QH where high speed control traffic will be queued. */
|
|
|
|
chsqh = uhci_alloc_sqh(sc);
|
|
|
|
if (chsqh == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NOMEM);
|
2002-01-20 20:12:25 +00:00
|
|
|
chsqh->hlink = bsqh;
|
|
|
|
chsqh->qh.qh_hlink = htole32(bsqh->physaddr | UHCI_PTR_QH);
|
|
|
|
chsqh->elink = NULL;
|
|
|
|
chsqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
sc->sc_hctl_start = sc->sc_hctl_end = chsqh;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
/* Allocate dummy QH where control traffic will be queued. */
|
|
|
|
clsqh = uhci_alloc_sqh(sc);
|
|
|
|
if (clsqh == NULL)
|
|
|
|
return (USBD_NOMEM);
|
|
|
|
clsqh->hlink = bsqh;
|
|
|
|
clsqh->qh.qh_hlink = htole32(chsqh->physaddr | UHCI_PTR_QH);
|
|
|
|
clsqh->elink = NULL;
|
|
|
|
clsqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
sc->sc_lctl_start = sc->sc_lctl_end = clsqh;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1998-11-26 23:13:13 +00:00
|
|
|
* Make all (virtual) frame list pointers point to the interrupt
|
1999-10-07 19:26:38 +00:00
|
|
|
* queue heads and the interrupt queue heads at the control
|
|
|
|
* queue head and point the physical frame list to the virtual.
|
1998-11-26 23:13:13 +00:00
|
|
|
*/
|
|
|
|
for(i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
|
|
|
|
std = uhci_alloc_std(sc);
|
|
|
|
sqh = uhci_alloc_sqh(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (std == NULL || sqh == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NOMEM);
|
|
|
|
std->link.sqh = sqh;
|
2002-01-20 12:08:09 +00:00
|
|
|
std->td.td_link = htole32(sqh->physaddr | UHCI_PTR_QH);
|
2001-12-30 23:02:31 +00:00
|
|
|
std->td.td_status = htole32(UHCI_TD_IOS); /* iso, inactive */
|
|
|
|
std->td.td_token = htole32(0);
|
|
|
|
std->td.td_buffer = htole32(0);
|
2002-01-20 20:12:25 +00:00
|
|
|
sqh->hlink = clsqh;
|
|
|
|
sqh->qh.qh_hlink = htole32(clsqh->physaddr | UHCI_PTR_QH);
|
2002-01-03 02:10:31 +00:00
|
|
|
sqh->elink = NULL;
|
2001-12-30 23:02:31 +00:00
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
1998-11-26 23:13:13 +00:00
|
|
|
sc->sc_vframes[i].htd = std;
|
|
|
|
sc->sc_vframes[i].etd = std;
|
|
|
|
sc->sc_vframes[i].hqh = sqh;
|
|
|
|
sc->sc_vframes[i].eqh = sqh;
|
2002-02-03 17:03:34 +00:00
|
|
|
for (j = i;
|
|
|
|
j < UHCI_FRAMELIST_COUNT;
|
1998-11-26 23:13:13 +00:00
|
|
|
j += UHCI_VFRAMELIST_COUNT)
|
2001-12-30 23:02:31 +00:00
|
|
|
sc->sc_pframes[j] = htole32(std->physaddr);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
LIST_INIT(&sc->sc_intrhead);
|
1998-11-26 23:13:13 +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);
|
|
|
|
|
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_init(sc->sc_poll_handle);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Set up the bus struct. */
|
|
|
|
sc->sc_bus.methods = &uhci_bus_methods;
|
|
|
|
sc->sc_bus.pipe_size = sizeof(struct uhci_pipe);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1999-10-07 19:26:38 +00:00
|
|
|
sc->sc_suspend = PWR_RESUME;
|
2000-03-15 22:12:47 +00:00
|
|
|
sc->sc_powerhook = powerhook_establish(uhci_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(uhci_shutdown, sc);
|
|
|
|
#endif
|
2002-01-03 02:10:31 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(1,("uhci_init: enabling\n"));
|
2002-02-03 17:03:34 +00:00
|
|
|
UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE |
|
1999-08-23 21:00:08 +00:00
|
|
|
UHCI_INTR_IOCE | UHCI_INTR_SPIE); /* enable interrupts */
|
|
|
|
|
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
|
|
|
UHCICMD(sc, UHCI_CMD_MAXP); /* Assume 64 byte packets at frame end */
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
return (uhci_run(sc, 1)); /* and here we go... */
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
int
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_activate(device_ptr_t self, enum devact act)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
struct uhci_softc *sc = (struct uhci_softc *)self;
|
|
|
|
int rv = 0;
|
|
|
|
|
|
|
|
switch (act) {
|
|
|
|
case DVACT_ACTIVATE:
|
|
|
|
return (EOPNOTSUPP);
|
|
|
|
|
|
|
|
case DVACT_DEACTIVATE:
|
|
|
|
if (sc->sc_child != NULL)
|
|
|
|
rv = config_deactivate(sc->sc_child);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
2004-08-02 15:37:35 +00:00
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
|
|
|
|
int
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_detach(struct uhci_softc *sc, int flags)
|
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
|
|
|
usbd_xfer_handle xfer;
|
1999-11-17 22:33:51 +00:00
|
|
|
int rv = 0;
|
|
|
|
|
2004-08-02 15:37:35 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1999-11-17 22:33:51 +00:00
|
|
|
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);
|
2004-08-02 15:37:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
UWRITE2(sc, UHCI_INTR, 0); /* disable interrupts */
|
|
|
|
uhci_run(sc, 0);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
1999-11-17 22:33:51 +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);
|
2000-03-15 22:12:47 +00:00
|
|
|
#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
|
|
|
|
|
|
|
/* Free all xfers associated with this HC. */
|
|
|
|
for (;;) {
|
|
|
|
xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
|
|
|
|
if (xfer == NULL)
|
|
|
|
break;
|
2003-11-09 23:54:21 +00:00
|
|
|
SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, 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
|
|
|
free(xfer, M_USB);
|
2002-02-03 17:03:34 +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
|
|
|
|
|
|
|
/* XXX free other data structures XXX */
|
2004-08-02 15:37:35 +00:00
|
|
|
usb_freemem(&sc->sc_bus, &sc->sc_dma);
|
1999-11-17 22:33:51 +00:00
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
2003-07-15 22:42:37 +00:00
|
|
|
return (usb_allocmem(bus, size, 0, dma));
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_freem(struct usbd_bus *bus, usb_dma_t *dma)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
2003-07-15 22:42:37 +00:00
|
|
|
usb_freemem(bus, dma);
|
1998-11-26 23:13:13 +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
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_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 uhci_softc *sc = (struct uhci_softc *)bus;
|
|
|
|
usbd_xfer_handle xfer;
|
|
|
|
|
|
|
|
xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
|
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
|
|
|
if (xfer != NULL) {
|
2003-11-09 23:54:21 +00:00
|
|
|
SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->busy_free != XFER_FREE) {
|
|
|
|
printf("uhci_allocx: xfer=%p not free, 0x%08x\n", xfer,
|
|
|
|
xfer->busy_free);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
xfer = malloc(sizeof(struct uhci_xfer), M_USB, M_NOWAIT);
|
|
|
|
}
|
|
|
|
if (xfer != NULL) {
|
|
|
|
memset(xfer, 0, sizeof (struct uhci_xfer));
|
|
|
|
UXFER(xfer)->iinfo.sc = sc;
|
2004-08-02 15:37:35 +00:00
|
|
|
usb_init_task(&UXFER(xfer)->abort_task, uhci_timeout_task,
|
|
|
|
xfer);
|
2005-03-19 19:08:46 +00:00
|
|
|
UXFER(xfer)->uhci_xfer_flags = 0;
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
UXFER(xfer)->iinfo.isdone = 1;
|
2002-04-01 21:43:53 +00:00
|
|
|
xfer->busy_free = XFER_BUSY;
|
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
|
|
|
#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
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_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 uhci_softc *sc = (struct uhci_softc *)bus;
|
|
|
|
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->busy_free != XFER_BUSY) {
|
|
|
|
printf("uhci_freex: xfer=%p not busy, 0x%08x\n", xfer,
|
|
|
|
xfer->busy_free);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
xfer->busy_free = XFER_FREE;
|
|
|
|
if (!UXFER(xfer)->iinfo.isdone) {
|
|
|
|
printf("uhci_freex: !isdone\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_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
|
|
|
{
|
|
|
|
uhci_softc_t *sc = v;
|
|
|
|
|
|
|
|
DPRINTF(("uhci_shutdown: stopping the HC\n"));
|
|
|
|
uhci_run(sc, 0); /* stop the controller */
|
|
|
|
}
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* Handle suspend/resume.
|
|
|
|
*
|
|
|
|
* We need to switch to polling mode here, because this routine is
|
2002-01-03 02:10:31 +00:00
|
|
|
* called from an interrupt context. This is all right since we
|
1999-10-07 19:26:38 +00:00
|
|
|
* are almost suspended anyway.
|
1998-11-26 23:13:13 +00:00
|
|
|
*/
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_power(int why, void *v)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = v;
|
|
|
|
int cmd;
|
|
|
|
int s;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-04-01 21:18:50 +00:00
|
|
|
s = splhardusb();
|
1999-10-07 19:26:38 +00:00
|
|
|
cmd = UREAD2(sc, UHCI_CMD);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTF(("uhci_power: sc=%p, why=%d (was %d), cmd=0x%x\n",
|
1999-10-07 19:26:38 +00:00
|
|
|
sc, why, sc->sc_suspend, cmd));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
if (why != PWR_RESUME) {
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 2)
|
|
|
|
uhci_dumpregs(sc);
|
|
|
|
#endif
|
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
|
|
|
if (sc->sc_intr_xfer != NULL)
|
|
|
|
usb_uncallout(sc->sc_poll_handle, uhci_poll_hub,
|
|
|
|
sc->sc_intr_xfer);
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.use_polling++;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_run(sc, 0); /* stop the controller */
|
2000-08-07 00:04:53 +00:00
|
|
|
|
|
|
|
/* save some state if BIOS doesn't */
|
|
|
|
sc->sc_saved_frnum = UREAD2(sc, UHCI_FRNUM);
|
|
|
|
sc->sc_saved_sof = UREAD1(sc, UHCI_SOF);
|
|
|
|
|
2002-04-01 21:42:43 +00:00
|
|
|
UWRITE2(sc, UHCI_INTR, 0); /* disable intrs */
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
UHCICMD(sc, cmd | UHCI_CMD_EGSM); /* enter global suspend */
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
|
|
|
|
sc->sc_suspend = why;
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.use_polling--;
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_power: cmd=0x%x\n", UREAD2(sc, UHCI_CMD)));
|
|
|
|
} else {
|
1999-11-17 22:33:51 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (sc->sc_suspend == PWR_RESUME)
|
|
|
|
printf("uhci_power: weird, resume without suspend.\n");
|
|
|
|
#endif
|
|
|
|
sc->sc_bus.use_polling++;
|
1999-10-07 19:26:38 +00:00
|
|
|
sc->sc_suspend = why;
|
2004-01-12 14:18:55 +00:00
|
|
|
UWRITE2(sc, UHCI_INTR, 0); /* disable interrupts */
|
|
|
|
uhci_globalreset(sc); /* reset the controller */
|
|
|
|
uhci_reset(sc);
|
1999-10-07 19:26:38 +00:00
|
|
|
if (cmd & UHCI_CMD_RS)
|
|
|
|
uhci_run(sc, 0); /* in case BIOS has started it */
|
2000-08-07 00:04:53 +00:00
|
|
|
|
2004-08-02 15:37:35 +00:00
|
|
|
uhci_globalreset(sc);
|
|
|
|
uhci_reset(sc);
|
|
|
|
|
2000-08-07 00:04:53 +00:00
|
|
|
/* restore saved state */
|
|
|
|
UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0));
|
|
|
|
UWRITE2(sc, UHCI_FRNUM, sc->sc_saved_frnum);
|
|
|
|
UWRITE1(sc, UHCI_SOF, sc->sc_saved_sof);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
UHCICMD(sc, cmd | UHCI_CMD_FGR); /* force global resume */
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
|
|
|
|
UHCICMD(sc, cmd & ~UHCI_CMD_EGSM); /* back to normal */
|
2002-02-03 17:03:34 +00:00
|
|
|
UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE |
|
1999-10-07 19:26:38 +00:00
|
|
|
UHCI_INTR_IOCE | UHCI_INTR_SPIE); /* re-enable intrs */
|
2002-12-26 13:25:57 +00:00
|
|
|
UHCICMD(sc, UHCI_CMD_MAXP);
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_run(sc, 1); /* and start traffic again */
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
|
1999-11-17 22:33:51 +00:00
|
|
|
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
|
|
|
if (sc->sc_intr_xfer != NULL)
|
|
|
|
usb_callout(sc->sc_poll_handle, sc->sc_ival,
|
|
|
|
uhci_poll_hub, sc->sc_intr_xfer);
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 2)
|
|
|
|
uhci_dumpregs(sc);
|
|
|
|
#endif
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2000-04-03 20:58:30 +00:00
|
|
|
Static void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_dumpregs(uhci_softc_t *sc)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
DPRINTFN(-1,("%s regs: cmd=%04x, sts=%04x, intr=%04x, frnum=%04x, "
|
|
|
|
"flbase=%08x, sof=%04x, portsc1=%04x, portsc2=%04x\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev),
|
|
|
|
UREAD2(sc, UHCI_CMD),
|
|
|
|
UREAD2(sc, UHCI_STS),
|
|
|
|
UREAD2(sc, UHCI_INTR),
|
|
|
|
UREAD2(sc, UHCI_FRNUM),
|
|
|
|
UREAD4(sc, UHCI_FLBASEADDR),
|
|
|
|
UREAD1(sc, UHCI_SOF),
|
|
|
|
UREAD2(sc, UHCI_PORTSC1),
|
|
|
|
UREAD2(sc, UHCI_PORTSC2)));
|
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_dump_td(uhci_soft_td_t *p)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
2002-04-01 19:42:51 +00:00
|
|
|
char sbuf[128], sbuf2[128];
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(-1,("TD(%p) at %08lx = link=0x%08lx status=0x%08lx "
|
|
|
|
"token=0x%08lx buffer=0x%08lx\n",
|
|
|
|
p, (long)p->physaddr,
|
2001-12-30 23:02:31 +00:00
|
|
|
(long)le32toh(p->td.td_link),
|
|
|
|
(long)le32toh(p->td.td_status),
|
|
|
|
(long)le32toh(p->td.td_token),
|
|
|
|
(long)le32toh(p->td.td_buffer)));
|
2002-04-01 19:42:51 +00:00
|
|
|
|
2002-04-07 14:49:14 +00:00
|
|
|
bitmask_snprintf((u_int32_t)le32toh(p->td.td_link), "\20\1T\2Q\3VF",
|
2002-04-01 19:42:51 +00:00
|
|
|
sbuf, sizeof(sbuf));
|
2002-04-07 14:49:14 +00:00
|
|
|
bitmask_snprintf((u_int32_t)le32toh(p->td.td_status),
|
2002-04-01 19:42:51 +00:00
|
|
|
"\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
|
|
|
|
"STALLED\30ACTIVE\31IOC\32ISO\33LS\36SPD",
|
|
|
|
sbuf2, sizeof(sbuf2));
|
|
|
|
|
|
|
|
DPRINTFN(-1,(" %s %s,errcnt=%d,actlen=%d pid=%02x,addr=%d,endpt=%d,"
|
|
|
|
"D=%d,maxlen=%d\n", sbuf, sbuf2,
|
2001-12-30 23:02:31 +00:00
|
|
|
UHCI_TD_GET_ERRCNT(le32toh(p->td.td_status)),
|
|
|
|
UHCI_TD_GET_ACTLEN(le32toh(p->td.td_status)),
|
|
|
|
UHCI_TD_GET_PID(le32toh(p->td.td_token)),
|
|
|
|
UHCI_TD_GET_DEVADDR(le32toh(p->td.td_token)),
|
|
|
|
UHCI_TD_GET_ENDPT(le32toh(p->td.td_token)),
|
|
|
|
UHCI_TD_GET_DT(le32toh(p->td.td_token)),
|
|
|
|
UHCI_TD_GET_MAXLEN(le32toh(p->td.td_token))));
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_dump_qh(uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(-1,("QH(%p) at %08x: hlink=%08x elink=%08x\n", sqh,
|
2001-12-30 23:02:31 +00:00
|
|
|
(int)sqh->physaddr, le32toh(sqh->qh.qh_hlink),
|
|
|
|
le32toh(sqh->qh.qh_elink)));
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
#if 1
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_dump(void)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_dump_all(thesc);
|
|
|
|
}
|
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
void
|
|
|
|
uhci_dump_all(uhci_softc_t *sc)
|
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dumpregs(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
printf("intrs=%d\n", sc->sc_bus.no_intrs);
|
2002-01-03 02:10:31 +00:00
|
|
|
/*printf("framelist[i].link = %08x\n", sc->sc_framelist[0].link);*/
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_dump_qh(sc->sc_lctl_start);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_dump_qhs(uhci_soft_qh_t *sqh)
|
1999-11-17 22:33:51 +00:00
|
|
|
{
|
|
|
|
uhci_dump_qh(sqh);
|
|
|
|
|
|
|
|
/* uhci_dump_qhs displays all the QHs and TDs from the given QH onwards
|
|
|
|
* Traverses sideways first, then down.
|
|
|
|
*
|
|
|
|
* QH1
|
|
|
|
* QH2
|
|
|
|
* No QH
|
|
|
|
* TD2.1
|
|
|
|
* TD2.2
|
|
|
|
* TD1.1
|
|
|
|
* etc.
|
|
|
|
*
|
|
|
|
* TD2.x being the TDs queued at QH2 and QH1 being referenced from QH1.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
if (sqh->hlink != NULL && !(le32toh(sqh->qh.qh_hlink) & UHCI_PTR_T))
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_dump_qhs(sqh->hlink);
|
|
|
|
else
|
|
|
|
DPRINTF(("No QH\n"));
|
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
if (sqh->elink != NULL && !(le32toh(sqh->qh.qh_elink) & UHCI_PTR_T))
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_dump_tds(sqh->elink);
|
|
|
|
else
|
|
|
|
DPRINTF(("No TD\n"));
|
|
|
|
}
|
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_dump_tds(uhci_soft_td_t *std)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_soft_td_t *td;
|
|
|
|
|
|
|
|
for(td = std; td != NULL; td = td->link.std) {
|
|
|
|
uhci_dump_td(td);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Check whether the link pointer in this TD marks
|
|
|
|
* the link pointer as end of queue. This avoids
|
|
|
|
* printing the free list in case the queue/TD has
|
|
|
|
* already been moved there (seatbelt).
|
|
|
|
*/
|
2001-12-30 23:02:31 +00:00
|
|
|
if (le32toh(td->td.td_link) & UHCI_PTR_T ||
|
|
|
|
le32toh(td->td.td_link) == 0)
|
1999-11-17 22:33:51 +00:00
|
|
|
break;
|
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
2002-02-10 15:38:47 +00:00
|
|
|
|
|
|
|
Static void
|
|
|
|
uhci_dump_ii(uhci_intr_info_t *ii)
|
|
|
|
{
|
|
|
|
usbd_pipe_handle pipe;
|
|
|
|
usb_endpoint_descriptor_t *ed;
|
|
|
|
usbd_device_handle dev;
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
#define DONE ii->isdone
|
|
|
|
#else
|
|
|
|
#define DONE 0
|
|
|
|
#endif
|
|
|
|
if (ii == NULL) {
|
|
|
|
printf("ii NULL\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ii->xfer == NULL) {
|
|
|
|
printf("ii %p: done=%d xfer=NULL\n",
|
|
|
|
ii, DONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pipe = ii->xfer->pipe;
|
|
|
|
if (pipe == NULL) {
|
|
|
|
printf("ii %p: done=%d xfer=%p pipe=NULL\n",
|
|
|
|
ii, DONE, ii->xfer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pipe->endpoint == NULL) {
|
|
|
|
printf("ii %p: done=%d xfer=%p pipe=%p pipe->endpoint=NULL\n",
|
|
|
|
ii, DONE, ii->xfer, pipe);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (pipe->device == NULL) {
|
|
|
|
printf("ii %p: done=%d xfer=%p pipe=%p pipe->device=NULL\n",
|
|
|
|
ii, DONE, ii->xfer, pipe);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ed = pipe->endpoint->edesc;
|
|
|
|
dev = pipe->device;
|
|
|
|
printf("ii %p: done=%d xfer=%p dev=%p vid=0x%04x pid=0x%04x addr=%d pipe=%p ep=0x%02x attr=0x%02x\n",
|
|
|
|
ii, DONE, ii->xfer, dev,
|
|
|
|
UGETW(dev->ddesc.idVendor),
|
|
|
|
UGETW(dev->ddesc.idProduct),
|
|
|
|
dev->address, pipe,
|
|
|
|
ed->bEndpointAddress, ed->bmAttributes);
|
|
|
|
#undef DONE
|
|
|
|
}
|
|
|
|
|
2002-03-19 22:14:08 +00:00
|
|
|
void uhci_dump_iis(struct uhci_softc *sc);
|
|
|
|
void
|
|
|
|
uhci_dump_iis(struct uhci_softc *sc)
|
|
|
|
{
|
|
|
|
uhci_intr_info_t *ii;
|
|
|
|
|
|
|
|
printf("intr_info list:\n");
|
|
|
|
for (ii = LIST_FIRST(&sc->sc_intrhead); ii; ii = LIST_NEXT(ii, list))
|
|
|
|
uhci_dump_ii(ii);
|
|
|
|
}
|
|
|
|
|
|
|
|
void iidump(void);
|
|
|
|
void iidump(void) { uhci_dump_iis(thesc); }
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* This routine is executed periodically and simulates interrupts
|
|
|
|
* from the root controller interrupt pipe for port status change.
|
1999-08-17 07:36:34 +00:00
|
|
|
*/
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
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
|
|
|
uhci_poll_hub(void *addr)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_xfer_handle xfer = addr;
|
|
|
|
usbd_pipe_handle pipe = xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
|
|
|
|
int s;
|
|
|
|
u_char *p;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
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
|
|
|
DPRINTFN(20, ("uhci_poll_hub\n"));
|
1999-05-01 23:46:02 +00:00
|
|
|
|
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(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
|
1999-05-01 23:46:02 +00:00
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
p = KERNADDR(&xfer->dmabuf, 0);
|
1999-10-07 19:26:38 +00:00
|
|
|
p[0] = 0;
|
|
|
|
if (UREAD2(sc, UHCI_PORTSC1) & (UHCI_PORTSC_CSC|UHCI_PORTSC_OCIC))
|
|
|
|
p[0] |= 1<<1;
|
|
|
|
if (UREAD2(sc, UHCI_PORTSC2) & (UHCI_PORTSC_CSC|UHCI_PORTSC_OCIC))
|
|
|
|
p[0] |= 1<<2;
|
|
|
|
if (p[0] == 0)
|
|
|
|
/* No change, try again in a while */
|
|
|
|
return;
|
1999-05-01 23:46:02 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = 1;
|
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
1999-10-07 19:26:38 +00:00
|
|
|
s = splusb();
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->device->bus->intr_context++;
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
xfer->device->bus->intr_context--;
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_intr_done(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-01-21 03:44:00 +00:00
|
|
|
void
|
|
|
|
uhci_root_ctrl_done(usbd_xfer_handle xfer)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
/*
|
|
|
|
* Let the last QH loop back to the high speed control transfer QH.
|
|
|
|
* This is what intel calls "bandwidth reclamation" and improves
|
|
|
|
* USB performance a lot for some devices.
|
|
|
|
* If we are already looping, just count it.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
uhci_add_loop(uhci_softc_t *sc) {
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-20 23:48:43 +00:00
|
|
|
if (uhcinoloop)
|
|
|
|
return;
|
|
|
|
#endif
|
2002-01-20 20:12:25 +00:00
|
|
|
if (++sc->sc_loops == 1) {
|
2002-01-20 23:48:43 +00:00
|
|
|
DPRINTFN(5,("uhci_start_loop: add\n"));
|
2002-01-20 20:12:25 +00:00
|
|
|
/* Note, we don't loop back the soft pointer. */
|
2002-02-03 17:03:34 +00:00
|
|
|
sc->sc_last_qh->qh.qh_hlink =
|
2002-01-20 20:12:25 +00:00
|
|
|
htole32(sc->sc_hctl_start->physaddr | UHCI_PTR_QH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_rem_loop(uhci_softc_t *sc) {
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-20 23:48:43 +00:00
|
|
|
if (uhcinoloop)
|
|
|
|
return;
|
|
|
|
#endif
|
2002-01-20 20:12:25 +00:00
|
|
|
if (--sc->sc_loops == 0) {
|
|
|
|
DPRINTFN(5,("uhci_end_loop: remove\n"));
|
|
|
|
sc->sc_last_qh->qh.qh_hlink = htole32(UHCI_PTR_T);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add high speed control QH, called at splusb(). */
|
|
|
|
void
|
|
|
|
uhci_add_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_qh_t *eqh;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(10, ("uhci_add_ctrl: sqh=%p\n", sqh));
|
2002-01-20 20:12:25 +00:00
|
|
|
eqh = sc->sc_hctl_end;
|
1999-10-07 19:26:38 +00:00
|
|
|
sqh->hlink = eqh->hlink;
|
|
|
|
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
|
|
|
|
eqh->hlink = sqh;
|
2002-01-20 12:08:09 +00:00
|
|
|
eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
|
2002-01-20 20:12:25 +00:00
|
|
|
sc->sc_hctl_end = sqh;
|
2002-01-20 23:48:43 +00:00
|
|
|
#ifdef UHCI_CTL_LOOP
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_add_loop(sc);
|
2002-01-20 23:48:43 +00:00
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
/* Remove high speed control QH, called at splusb(). */
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_remove_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_qh_t *pqh;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
DPRINTFN(10, ("uhci_remove_hs_ctrl: sqh=%p\n", sqh));
|
2002-01-20 23:48:43 +00:00
|
|
|
#ifdef UHCI_CTL_LOOP
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_rem_loop(sc);
|
2002-01-20 23:48:43 +00:00
|
|
|
#endif
|
2002-01-20 23:38:33 +00:00
|
|
|
/*
|
|
|
|
* The T bit should be set in the elink of the QH so that the HC
|
|
|
|
* doesn't follow the pointer. This condition may fail if the
|
|
|
|
* the transferred packet was short so that the QH still points
|
|
|
|
* at the last used TD.
|
|
|
|
* In this case we set the T bit and wait a little for the HC
|
|
|
|
* to stop looking at the TD.
|
|
|
|
*/
|
|
|
|
if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) {
|
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
|
|
|
}
|
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
pqh = uhci_find_prev_qh(sc->sc_hctl_start, sqh);
|
|
|
|
pqh->hlink = sqh->hlink;
|
1999-10-07 19:26:38 +00:00
|
|
|
pqh->qh.qh_hlink = sqh->qh.qh_hlink;
|
2002-01-20 23:38:33 +00:00
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
2002-01-20 20:12:25 +00:00
|
|
|
if (sc->sc_hctl_end == sqh)
|
|
|
|
sc->sc_hctl_end = pqh;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add low speed control QH, called at splusb(). */
|
|
|
|
void
|
|
|
|
uhci_add_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
|
|
|
{
|
|
|
|
uhci_soft_qh_t *eqh;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
SPLUSBCHECK;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
DPRINTFN(10, ("uhci_add_ls_ctrl: sqh=%p\n", sqh));
|
|
|
|
eqh = sc->sc_lctl_end;
|
2002-04-07 18:33:12 +00:00
|
|
|
sqh->hlink = eqh->hlink;
|
2002-01-20 20:12:25 +00:00
|
|
|
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
|
2002-04-07 18:33:12 +00:00
|
|
|
eqh->hlink = sqh;
|
2002-01-20 20:12:25 +00:00
|
|
|
eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
|
|
|
|
sc->sc_lctl_end = sqh;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove low speed control QH, called at splusb(). */
|
|
|
|
void
|
|
|
|
uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
|
|
|
{
|
|
|
|
uhci_soft_qh_t *pqh;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
SPLUSBCHECK;
|
2002-02-03 17:03:34 +00:00
|
|
|
|
2002-01-20 20:12:25 +00:00
|
|
|
DPRINTFN(10, ("uhci_remove_ls_ctrl: sqh=%p\n", sqh));
|
2002-01-20 23:38:33 +00:00
|
|
|
/* See comment in uhci_remove_hs_ctrl() */
|
|
|
|
if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) {
|
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
|
|
|
}
|
2002-01-20 20:12:25 +00:00
|
|
|
pqh = uhci_find_prev_qh(sc->sc_lctl_start, sqh);
|
|
|
|
pqh->hlink = sqh->hlink;
|
|
|
|
pqh->qh.qh_hlink = sqh->qh.qh_hlink;
|
2002-01-20 23:38:33 +00:00
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
2002-01-20 20:12:25 +00:00
|
|
|
if (sc->sc_lctl_end == sqh)
|
|
|
|
sc->sc_lctl_end = pqh;
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add bulk QH, called at splusb(). */
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_add_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_qh_t *eqh;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(10, ("uhci_add_bulk: sqh=%p\n", sqh));
|
|
|
|
eqh = sc->sc_bulk_end;
|
2002-04-07 18:33:12 +00:00
|
|
|
sqh->hlink = eqh->hlink;
|
1999-10-07 19:26:38 +00:00
|
|
|
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
|
2002-04-07 18:33:12 +00:00
|
|
|
eqh->hlink = sqh;
|
2002-01-20 12:08:09 +00:00
|
|
|
eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
|
1999-10-07 19:26:38 +00:00
|
|
|
sc->sc_bulk_end = sqh;
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_add_loop(sc);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove bulk QH, called at splusb(). */
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_remove_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_qh_t *pqh;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
SPLUSBCHECK;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(10, ("uhci_remove_bulk: sqh=%p\n", sqh));
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_rem_loop(sc);
|
2002-01-20 23:38:33 +00:00
|
|
|
/* See comment in uhci_remove_hs_ctrl() */
|
|
|
|
if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) {
|
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
|
|
|
}
|
2002-01-20 20:12:25 +00:00
|
|
|
pqh = uhci_find_prev_qh(sc->sc_bulk_start, sqh);
|
2002-04-07 18:33:12 +00:00
|
|
|
pqh->hlink = sqh->hlink;
|
1999-10-07 19:26:38 +00:00
|
|
|
pqh->qh.qh_hlink = sqh->qh.qh_hlink;
|
2002-01-20 23:38:33 +00:00
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
1999-10-07 19:26:38 +00:00
|
|
|
if (sc->sc_bulk_end == sqh)
|
|
|
|
sc->sc_bulk_end = pqh;
|
|
|
|
}
|
|
|
|
|
2002-04-07 09:52:49 +00:00
|
|
|
Static int uhci_intr1(uhci_softc_t *);
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
int
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_intr(void *arg)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_softc_t *sc = arg;
|
2002-04-07 09:52:49 +00:00
|
|
|
|
2002-04-07 14:45:38 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (0);
|
|
|
|
|
2002-04-07 09:52:49 +00:00
|
|
|
DPRINTFN(15,("uhci_intr: real interrupt\n"));
|
|
|
|
if (sc->sc_bus.use_polling) {
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
printf("uhci_intr: ignored interrupt while polling\n");
|
|
|
|
#endif
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
return (uhci_intr1(sc));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
uhci_intr1(uhci_softc_t *sc)
|
|
|
|
{
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
int status;
|
|
|
|
int ack;
|
|
|
|
|
Fix one bug and make one minor enhancement:
- In uhci_intr() check to see if sc->sc_bus.bdev is NULL, and if it is,
ack any pending interrupts and disable them, then return. It is possible
for interrupts to be delivered the moment a handler is set up at attach
time in uhci_pci.c, particularly when attempting to kldload the usb.ko
module after the system is already up. However the driver isn't ready
to field interrupts at that time and certain pointers in the softc
struct aren't initialized yet, and we invariably end up falling off
the end of one of them. The effect is that kldloading the usb module
will panic the system in uhci_intr(). This added sanity check stops
this from happening: I can now kldload the usb.ko module without any
problems and load/attach other USB drivers after it.
Of course the uhci driver has no detach method, but that's another
problem.
- In uhci_run(), set the UHCI_CMD_MAXP bit in the command register to
allow 64-byte packets to be used for full speed bandwidth reclamation.
Certain high speed devices (in this case the ADMtek USB ethernet
adapter) require this bit to be set, otherwise babble errors occur
at the end of large (between 1100 and 1500 byte) transfers. This
should not affect other devices, although supposedly it is less efficient
than the 32-byte setting. Unfortunately, this is a per-bus setting,
not a per-device setting, so we can't just enable it for certain
devices on the USB bus.
1999-12-23 05:18:58 +00:00
|
|
|
/*
|
|
|
|
* It can happen that an interrupt will be delivered to
|
|
|
|
* us before the device has been fully attached and the
|
|
|
|
* softc struct has been configured. Usually this happens
|
|
|
|
* when kldloading the USB support as a module after the
|
|
|
|
* system has been booted. If we detect this condition,
|
|
|
|
* we need to squelch the unwanted interrupts until we're
|
|
|
|
* ready for them.
|
|
|
|
*/
|
|
|
|
if (sc->sc_bus.bdev == NULL) {
|
|
|
|
UWRITE2(sc, UHCI_STS, 0xFFFF); /* ack pending interrupts */
|
|
|
|
uhci_run(sc, 0); /* stop the controller */
|
|
|
|
UWRITE2(sc, UHCI_INTR, 0); /* disable interrupts */
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 15) {
|
2002-04-07 09:52:49 +00:00
|
|
|
DPRINTF(("%s: uhci_intr1\n", USBDEVNAME(sc->sc_bus.bdev)));
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dumpregs(sc);
|
|
|
|
}
|
|
|
|
#endif
|
2002-04-07 18:03:45 +00:00
|
|
|
status = UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS;
|
2002-04-01 20:04:00 +00:00
|
|
|
if (status == 0) /* The interrupt was not for us. */
|
|
|
|
return (0);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-04-01 21:56:42 +00:00
|
|
|
#if defined(DIAGNOSTIC) && defined(__NetBSD__)
|
|
|
|
if (sc->sc_suspend != PWR_RESUME)
|
|
|
|
printf("uhci_intr: suspended sts=0x%x\n", status);
|
|
|
|
#endif
|
|
|
|
|
2002-04-01 13:36:09 +00:00
|
|
|
if (sc->sc_suspend != PWR_RESUME) {
|
|
|
|
printf("%s: interrupt while not operating ignored\n",
|
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
2002-04-01 21:42:43 +00:00
|
|
|
UWRITE2(sc, UHCI_STS, status); /* acknowledge the ints */
|
2002-04-01 13:36:09 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
ack = 0;
|
|
|
|
if (status & UHCI_STS_USBINT)
|
|
|
|
ack |= UHCI_STS_USBINT;
|
|
|
|
if (status & UHCI_STS_USBEI)
|
|
|
|
ack |= UHCI_STS_USBEI;
|
|
|
|
if (status & UHCI_STS_RD) {
|
|
|
|
ack |= UHCI_STS_RD;
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("%s: resume detect\n", USBDEVNAME(sc->sc_bus.bdev));
|
2002-01-03 02:10:31 +00:00
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
if (status & UHCI_STS_HSE) {
|
1999-05-01 23:46:02 +00:00
|
|
|
ack |= UHCI_STS_HSE;
|
2000-06-15 15:23:12 +00:00
|
|
|
printf("%s: host system error\n", USBDEVNAME(sc->sc_bus.bdev));
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
if (status & UHCI_STS_HCPE) {
|
1999-05-01 23:46:02 +00:00
|
|
|
ack |= UHCI_STS_HCPE;
|
2002-02-03 17:03:34 +00:00
|
|
|
printf("%s: host controller process error\n",
|
2000-06-15 15:23:12 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
1999-05-01 23:46:02 +00:00
|
|
|
}
|
|
|
|
if (status & UHCI_STS_HCH) {
|
|
|
|
/* no acknowledge needed */
|
2002-04-01 21:52:45 +00:00
|
|
|
if (!sc->sc_dying) {
|
|
|
|
printf("%s: host controller halted\n",
|
2002-04-01 20:14:23 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-04-01 21:52:45 +00:00
|
|
|
uhci_dump_all(sc);
|
|
|
|
#endif
|
|
|
|
}
|
2002-01-21 03:35:55 +00:00
|
|
|
sc->sc_dying = 1;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-05-01 23:46:02 +00:00
|
|
|
|
2002-04-01 21:18:50 +00:00
|
|
|
if (!ack)
|
|
|
|
return (0); /* nothing to acknowledge */
|
|
|
|
UWRITE2(sc, UHCI_STS, ack); /* acknowledge the ints */
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.no_intrs++;
|
2002-01-26 12:04:22 +00:00
|
|
|
usb_schedsoftintr(&sc->sc_bus);
|
|
|
|
|
2003-11-09 23:59:53 +00:00
|
|
|
DPRINTFN(15, ("%s: uhci_intr: exit\n", USBDEVNAME(sc->sc_bus.bdev)));
|
2002-01-26 12:04:22 +00:00
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-04-01 21:34:01 +00:00
|
|
|
uhci_softintr(void *v)
|
2002-01-26 12:04:22 +00:00
|
|
|
{
|
2002-04-01 21:34:01 +00:00
|
|
|
uhci_softc_t *sc = v;
|
2004-05-23 11:43:34 +00:00
|
|
|
uhci_intr_info_t *ii, *nextii;
|
2002-01-26 12:04:22 +00:00
|
|
|
|
2002-04-01 22:03:37 +00:00
|
|
|
DPRINTFN(10,("%s: uhci_softintr (%d)\n", USBDEVNAME(sc->sc_bus.bdev),
|
|
|
|
sc->sc_bus.intr_context));
|
2002-01-26 12:04:22 +00:00
|
|
|
|
|
|
|
sc->sc_bus.intr_context++;
|
1999-11-17 22:33:51 +00:00
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
/*
|
|
|
|
* Interrupts on UHCI really suck. When the host controller
|
|
|
|
* interrupts because a transfer is completed there is no
|
|
|
|
* way of knowing which transfer it was. You can scan down
|
|
|
|
* the TDs and QHs of the previous frame to limit the search,
|
|
|
|
* but that assumes that the interrupt was not delayed by more
|
|
|
|
* than 1 ms, which may not always be true (e.g. after debug
|
|
|
|
* output on a slow console).
|
|
|
|
* We scan all interrupt descriptors to see if any have
|
|
|
|
* completed.
|
|
|
|
*/
|
2004-05-23 11:43:34 +00:00
|
|
|
LIST_FOREACH_SAFE(ii, &sc->sc_intrhead, list, nextii)
|
1998-11-26 23:13:13 +00:00
|
|
|
uhci_check_intr(sc, ii);
|
|
|
|
|
2002-09-30 17:50:18 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 18:03:45 +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-07 18:03:45 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_bus.intr_context--;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Check for an interrupt. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t *std, *lstd;
|
1999-01-07 23:07:57 +00:00
|
|
|
u_int32_t status;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
DPRINTFN(15, ("uhci_check_intr: ii=%p\n", ii));
|
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (ii == NULL) {
|
1998-11-26 23:13:13 +00:00
|
|
|
printf("uhci_check_intr: no ii? %p\n", ii);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2002-04-07 18:13:16 +00:00
|
|
|
if (ii->xfer->status == USBD_CANCELLED ||
|
|
|
|
ii->xfer->status == USBD_TIMEOUT) {
|
|
|
|
DPRINTF(("uhci_check_intr: aborted xfer=%p\n", ii->xfer));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (ii->stdstart == NULL)
|
1999-04-20 21:35:27 +00:00
|
|
|
return;
|
1999-10-07 19:26:38 +00:00
|
|
|
lstd = ii->stdend;
|
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (lstd == NULL) {
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("uhci_check_intr: std==0\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* If the last TD is still active we need to check whether there
|
2003-01-01 18:49:04 +00:00
|
|
|
* is an error somewhere in the middle, or whether there was a
|
1999-10-07 19:26:38 +00:00
|
|
|
* short packet (SPD and not ACTIVE).
|
|
|
|
*/
|
2001-12-30 23:02:31 +00:00
|
|
|
if (le32toh(lstd->td.td_status) & UHCI_TD_ACTIVE) {
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(12, ("uhci_check_intr: active ii=%p\n", ii));
|
1999-10-07 19:26:38 +00:00
|
|
|
for (std = ii->stdstart; std != lstd; std = std->link.std) {
|
2001-12-30 23:02:31 +00:00
|
|
|
status = le32toh(std->td.td_status);
|
2000-01-28 02:15:31 +00:00
|
|
|
/* If there's an active TD the xfer isn't done. */
|
|
|
|
if (status & UHCI_TD_ACTIVE)
|
|
|
|
break;
|
|
|
|
/* Any kind of error makes the xfer done. */
|
|
|
|
if (status & UHCI_TD_STALLED)
|
|
|
|
goto done;
|
2002-01-03 02:10:31 +00:00
|
|
|
/* We want short packets, and it is short: it's done */
|
2000-01-28 02:15:31 +00:00
|
|
|
if ((status & UHCI_TD_SPD) &&
|
2002-02-03 17:03:34 +00:00
|
|
|
UHCI_TD_GET_ACTLEN(status) <
|
2002-01-03 02:10:31 +00:00
|
|
|
UHCI_TD_GET_MAXLEN(le32toh(std->td.td_token)))
|
1998-11-26 23:13:13 +00:00
|
|
|
goto done;
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(12, ("uhci_check_intr: ii=%p std=%p still active\n",
|
|
|
|
ii, ii->stdstart));
|
1998-11-26 23:13:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-01-03 02:10:31 +00:00
|
|
|
done:
|
|
|
|
DPRINTFN(12, ("uhci_check_intr: ii=%p done\n", ii));
|
2004-11-12 02:57:35 +00:00
|
|
|
usb_uncallout(ii->xfer->timeout_handle, uhci_timeout, ii);
|
2004-11-16 00:48:27 +00:00
|
|
|
usb_rem_task(ii->xfer->pipe->device, &UXFER(ii->xfer)->abort_task);
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_idone(ii);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Called at splusb() */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_idone(uhci_intr_info_t *ii)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_xfer_handle xfer = ii->xfer;
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1998-11-26 23:13:13 +00:00
|
|
|
uhci_soft_td_t *std;
|
1999-11-17 22:33:51 +00:00
|
|
|
u_int32_t status = 0, nstatus;
|
1999-10-07 19:26:38 +00:00
|
|
|
int actlen;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(12, ("uhci_idone: ii=%p\n", ii));
|
1998-11-26 23:13:13 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
int s = splhigh();
|
1998-11-26 23:13:13 +00:00
|
|
|
if (ii->isdone) {
|
|
|
|
splx(s);
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
printf("uhci_idone: ii is done!\n ");
|
|
|
|
uhci_dump_ii(ii);
|
|
|
|
#else
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("uhci_idone: ii=%p is done!\n", ii);
|
2002-01-03 02:10:31 +00:00
|
|
|
#endif
|
1998-11-26 23:13:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ii->isdone = 1;
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
#endif
|
2002-04-07 18:33:12 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->nframes != 0) {
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Isoc transfer, do things differently. */
|
|
|
|
uhci_soft_td_t **stds = upipe->u.iso.stds;
|
2002-04-01 20:01:41 +00:00
|
|
|
int i, n, nframes, len;
|
1999-04-20 21:35:27 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(5,("uhci_idone: ii=%p isoc ready\n", ii));
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
nframes = xfer->nframes;
|
1999-10-07 19:26:38 +00:00
|
|
|
actlen = 0;
|
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
|
|
|
n = UXFER(xfer)->curframe;
|
1999-10-07 19:26:38 +00:00
|
|
|
for (i = 0; i < nframes; i++) {
|
|
|
|
std = stds[n];
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 5) {
|
|
|
|
DPRINTFN(-1,("uhci_idone: isoc TD %d\n", i));
|
|
|
|
uhci_dump_td(std);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (++n >= UHCI_VFRAMELIST_COUNT)
|
|
|
|
n = 0;
|
2001-12-30 23:02:31 +00:00
|
|
|
status = le32toh(std->td.td_status);
|
2002-04-01 20:01:41 +00:00
|
|
|
len = UHCI_TD_GET_ACTLEN(status);
|
|
|
|
xfer->frlengths[i] = len;
|
|
|
|
actlen += len;
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
upipe->u.iso.inuse -= nframes;
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = actlen;
|
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
2002-04-01 22:03:37 +00:00
|
|
|
goto end;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-04-20 21:35:27 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-11-28 21:01:06 +00:00
|
|
|
DPRINTFN(10, ("uhci_idone: ii=%p, xfer=%p, pipe=%p ready\n",
|
|
|
|
ii, xfer, upipe));
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 10)
|
1999-08-17 07:36:34 +00:00
|
|
|
uhci_dump_tds(ii->stdstart);
|
|
|
|
#endif
|
1999-04-20 21:35:27 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* The transfer is done, compute actual length and status. */
|
|
|
|
actlen = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
for (std = ii->stdstart; std != NULL; std = std->link.std) {
|
2001-12-30 23:02:31 +00:00
|
|
|
nstatus = le32toh(std->td.td_status);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (nstatus & UHCI_TD_ACTIVE)
|
1999-10-07 19:26:38 +00:00
|
|
|
break;
|
1999-11-11 22:32:55 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
status = nstatus;
|
2001-12-30 23:02:31 +00:00
|
|
|
if (UHCI_TD_GET_PID(le32toh(std->td.td_token)) !=
|
|
|
|
UHCI_TD_PID_SETUP)
|
1999-10-07 19:26:38 +00:00
|
|
|
actlen += UHCI_TD_GET_ACTLEN(status);
|
2003-11-10 00:08:41 +00:00
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* UHCI will report CRCTO in addition to a STALL or NAK
|
|
|
|
* for a SETUP transaction. See section 3.2.2, "TD
|
|
|
|
* CONTROL AND STATUS".
|
|
|
|
*/
|
|
|
|
if (status & (UHCI_TD_STALLED | UHCI_TD_NAK))
|
|
|
|
status &= ~UHCI_TD_CRCTO;
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
/* If there are left over TDs we need to update the toggle. */
|
1999-11-17 22:33:51 +00:00
|
|
|
if (std != NULL)
|
2001-12-30 23:02:31 +00:00
|
|
|
upipe->nexttoggle = UHCI_TD_GET_DT(le32toh(std->td.td_token));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
status &= UHCI_TD_ERROR;
|
2002-04-07 18:33:12 +00:00
|
|
|
DPRINTFN(10, ("uhci_idone: actlen=%d, status=0x%x\n",
|
1999-10-07 19:26:38 +00:00
|
|
|
actlen, status));
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = actlen;
|
1999-10-07 19:26:38 +00:00
|
|
|
if (status != 0) {
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
char sbuf[128];
|
|
|
|
|
|
|
|
bitmask_snprintf((u_int32_t)status,
|
|
|
|
"\20\22BITSTUFF\23CRCTO\24NAK\25"
|
|
|
|
"BABBLE\26DBUFFER\27STALLED\30ACTIVE",
|
|
|
|
sbuf, sizeof(sbuf));
|
|
|
|
|
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((status == UHCI_TD_STALLED)*10,
|
1999-10-07 19:26:38 +00:00
|
|
|
("uhci_idone: error, addr=%d, endpt=0x%02x, "
|
2002-01-03 02:10:31 +00:00
|
|
|
"status 0x%s\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->pipe->device->address,
|
|
|
|
xfer->pipe->endpoint->edesc->bEndpointAddress,
|
2002-01-03 02:10:31 +00:00
|
|
|
sbuf));
|
|
|
|
#endif
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
if (status == UHCI_TD_STALLED)
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_STALLED;
|
1999-10-07 19:26:38 +00:00
|
|
|
else
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_IOERROR; /* more info XXX */
|
1998-11-26 23:13:13 +00:00
|
|
|
} else {
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_NORMAL_COMPLETION;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
2002-04-01 22:03:37 +00:00
|
|
|
|
2002-04-07 18:33:12 +00:00
|
|
|
end:
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_transfer_complete(xfer);
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(12, ("uhci_idone: ii=%p done\n", ii));
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* Called when a request does not complete.
|
|
|
|
*/
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_timeout(void *addr)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_intr_info_t *ii = addr;
|
2002-04-07 18:03:45 +00:00
|
|
|
struct uhci_xfer *uxfer = UXFER(ii->xfer);
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)uxfer->xfer.pipe;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)upipe->pipe.device->bus;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
DPRINTF(("uhci_timeout: uxfer=%p\n", uxfer));
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
if (sc->sc_dying) {
|
|
|
|
uhci_abort_xfer(&uxfer->xfer, USBD_TIMEOUT);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Execute the abort in a process context. */
|
|
|
|
usb_add_task(uxfer->xfer.pipe->device, &uxfer->abort_task);
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
void
|
|
|
|
uhci_timeout_task(void *addr)
|
|
|
|
{
|
|
|
|
usbd_xfer_handle xfer = addr;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
DPRINTF(("uhci_timeout_task: xfer=%p\n", xfer));
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
uhci_abort_xfer(xfer, USBD_TIMEOUT);
|
|
|
|
splx(s);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* Wait here until controller claims to have an interrupt.
|
|
|
|
* Then call uhci_intr and return. Use timeout to avoid waiting
|
|
|
|
* too long.
|
|
|
|
* Only used during boot when interrupts are not enabled yet.
|
|
|
|
*/
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_waitintr(uhci_softc_t *sc, usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
int timo = xfer->timeout;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_intr_info_t *ii;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(10,("uhci_waitintr: timeout = %dms\n", timo));
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
1999-10-07 19:26:38 +00:00
|
|
|
for (; timo >= 0; timo--) {
|
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
|
|
|
DPRINTFN(20,("uhci_waitintr: 0x%04x\n", UREAD2(sc, UHCI_STS)));
|
2004-10-28 20:24:50 +00:00
|
|
|
if (UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS)
|
2002-04-07 09:52:49 +00:00
|
|
|
uhci_intr1(sc);
|
2003-03-11 09:12:55 +00:00
|
|
|
if (xfer->status != USBD_IN_PROGRESS)
|
|
|
|
return;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Timeout */
|
|
|
|
DPRINTF(("uhci_waitintr: timeout\n"));
|
|
|
|
for (ii = LIST_FIRST(&sc->sc_intrhead);
|
2002-02-03 17:03:34 +00:00
|
|
|
ii != NULL && ii->xfer != xfer;
|
1999-10-07 19:26:38 +00:00
|
|
|
ii = LIST_NEXT(ii, list))
|
|
|
|
;
|
|
|
|
#ifdef DIAGNOSTIC
|
1999-11-17 22:33:51 +00:00
|
|
|
if (ii == NULL)
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_waitintr: lost intr_info");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
|
|
|
uhci_idone(ii);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_poll(struct usbd_bus *bus)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)bus;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2004-10-28 20:24:50 +00:00
|
|
|
if (UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS)
|
2002-04-07 09:52:49 +00:00
|
|
|
uhci_intr1(sc);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_reset(uhci_softc_t *sc)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
int n;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
UHCICMD(sc, UHCI_CMD_HCRESET);
|
|
|
|
/* The reset bit goes low when the controller is done. */
|
2002-02-03 17:03:34 +00:00
|
|
|
for (n = 0; n < UHCI_RESET_TIMEOUT &&
|
1999-10-07 19:26:38 +00:00
|
|
|
(UREAD2(sc, UHCI_CMD) & UHCI_CMD_HCRESET); n++)
|
2002-01-03 02:10:31 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
1999-10-07 19:26:38 +00:00
|
|
|
if (n >= UHCI_RESET_TIMEOUT)
|
2002-02-03 17:03:34 +00:00
|
|
|
printf("%s: controller did not reset\n",
|
1999-10-07 19:26:38 +00:00
|
|
|
USBDEVNAME(sc->sc_bus.bdev));
|
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_run(uhci_softc_t *sc, int run)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
int s, n, 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
|
|
|
u_int16_t cmd;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
run = run != 0;
|
2002-04-01 21:18:50 +00:00
|
|
|
s = splhardusb();
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_run: setting run=%d\n", run));
|
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
|
|
|
cmd = UREAD2(sc, UHCI_CMD);
|
|
|
|
if (run)
|
|
|
|
cmd |= UHCI_CMD_RS;
|
|
|
|
else
|
|
|
|
cmd &= ~UHCI_CMD_RS;
|
|
|
|
UHCICMD(sc, cmd);
|
1999-10-07 19:26:38 +00:00
|
|
|
for(n = 0; n < 10; n++) {
|
|
|
|
running = !(UREAD2(sc, UHCI_STS) & UHCI_STS_HCH);
|
|
|
|
/* return when we've entered the state we want */
|
|
|
|
if (run == running) {
|
|
|
|
splx(s);
|
|
|
|
DPRINTF(("uhci_run: done cmd=0x%x sts=0x%x\n",
|
|
|
|
UREAD2(sc, UHCI_CMD), UREAD2(sc, UHCI_STS)));
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 1);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
printf("%s: cannot %s\n", USBDEVNAME(sc->sc_bus.bdev),
|
|
|
|
run ? "start" : "stop");
|
|
|
|
return (USBD_IOERROR);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Memory management routines.
|
|
|
|
* uhci_alloc_std allocates TDs
|
|
|
|
* uhci_alloc_sqh allocates QHs
|
|
|
|
* These two routines do their own free list management,
|
|
|
|
* partly for speed, partly because allocating DMAable memory
|
|
|
|
* has page size granularaity so much memory would be wasted if
|
1999-01-07 23:07:57 +00:00
|
|
|
* only one TD/QH (32 bytes) was placed in each allocated chunk.
|
1998-11-26 23:13:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
uhci_soft_td_t *
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_alloc_std(uhci_softc_t *sc)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
|
|
|
uhci_soft_td_t *std;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
int i, offs;
|
1998-11-26 23:13:13 +00:00
|
|
|
usb_dma_t dma;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_freetds == NULL) {
|
1998-11-26 23:13:13 +00:00
|
|
|
DPRINTFN(2,("uhci_alloc_std: allocating chunk\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, UHCI_STD_SIZE * UHCI_STD_CHUNK,
|
|
|
|
UHCI_TD_ALIGN, &dma);
|
|
|
|
if (err)
|
1999-10-07 19:26:38 +00:00
|
|
|
return (0);
|
|
|
|
for(i = 0; i < UHCI_STD_CHUNK; i++) {
|
|
|
|
offs = i * UHCI_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);
|
1999-10-07 19:26:38 +00:00
|
|
|
std->link.std = sc->sc_freetds;
|
1998-11-26 23:13:13 +00:00
|
|
|
sc->sc_freetds = std;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std = sc->sc_freetds;
|
1999-10-07 19:26:38 +00:00
|
|
|
sc->sc_freetds = std->link.std;
|
|
|
|
memset(&std->td, 0, sizeof(uhci_td_t));
|
1998-11-26 23:13:13 +00:00
|
|
|
return std;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_free_std(uhci_softc_t *sc, uhci_soft_td_t *std)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
#define TD_IS_FREE 0x12345678
|
2001-12-30 23:02:31 +00:00
|
|
|
if (le32toh(std->td.td_token) == TD_IS_FREE) {
|
1998-11-26 23:13:13 +00:00
|
|
|
printf("uhci_free_std: freeing free TD %p\n", std);
|
|
|
|
return;
|
|
|
|
}
|
2001-12-30 23:02:31 +00:00
|
|
|
std->td.td_token = htole32(TD_IS_FREE);
|
1998-11-26 23:13:13 +00:00
|
|
|
#endif
|
1999-10-07 19:26:38 +00:00
|
|
|
std->link.std = sc->sc_freetds;
|
1998-11-26 23:13:13 +00:00
|
|
|
sc->sc_freetds = std;
|
|
|
|
}
|
|
|
|
|
|
|
|
uhci_soft_qh_t *
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_alloc_sqh(uhci_softc_t *sc)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_qh_t *sqh;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
int i, offs;
|
|
|
|
usb_dma_t dma;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (sc->sc_freeqhs == NULL) {
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(2, ("uhci_alloc_sqh: allocating chunk\n"));
|
1999-11-17 22:33:51 +00:00
|
|
|
err = usb_allocmem(&sc->sc_bus, UHCI_SQH_SIZE * UHCI_SQH_CHUNK,
|
|
|
|
UHCI_QH_ALIGN, &dma);
|
|
|
|
if (err)
|
|
|
|
return (0);
|
1999-10-07 19:26:38 +00:00
|
|
|
for(i = 0; i < UHCI_SQH_CHUNK; i++) {
|
|
|
|
offs = i * UHCI_SQH_SIZE;
|
2002-05-26 22:00:06 +00:00
|
|
|
sqh = KERNADDR(&dma, offs);
|
2000-02-10 18:50:19 +00:00
|
|
|
sqh->physaddr = DMAADDR(&dma, offs);
|
1999-10-07 19:26:38 +00:00
|
|
|
sqh->hlink = sc->sc_freeqhs;
|
|
|
|
sc->sc_freeqhs = sqh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sqh = sc->sc_freeqhs;
|
|
|
|
sc->sc_freeqhs = sqh->hlink;
|
|
|
|
memset(&sqh->qh, 0, sizeof(uhci_qh_t));
|
|
|
|
return (sqh);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_free_sqh(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
sqh->hlink = sc->sc_freeqhs;
|
|
|
|
sc->sc_freeqhs = sqh;
|
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_free_std_chain(uhci_softc_t *sc, uhci_soft_td_t *std,
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_soft_td_t *stdend)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t *p;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
for (; std != stdend; std = p) {
|
|
|
|
p = std->link.std;
|
|
|
|
uhci_free_std(sc, std);
|
|
|
|
}
|
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
|
|
|
|
int rd, u_int16_t flags, usb_dma_t *dma,
|
|
|
|
uhci_soft_td_t **sp, uhci_soft_td_t **ep)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_td_t *p, *lastp;
|
|
|
|
uhci_physaddr_t lastlink;
|
|
|
|
int i, ntd, l, tog, maxp;
|
|
|
|
u_int32_t status;
|
|
|
|
int addr = upipe->pipe.device->address;
|
|
|
|
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-16 00:51:26 +00:00
|
|
|
DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%d speed=%d "
|
2002-02-03 17:03:34 +00:00
|
|
|
"flags=0x%x\n", addr, UE_GET_ADDR(endpt), len,
|
2002-02-16 00:51:26 +00:00
|
|
|
upipe->pipe.device->speed, flags));
|
1999-10-07 19:26:38 +00:00
|
|
|
maxp = UGETW(upipe->pipe.endpoint->edesc->wMaxPacketSize);
|
|
|
|
if (maxp == 0) {
|
|
|
|
printf("uhci_alloc_std_chain: maxp=0\n");
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
ntd = (len + maxp - 1) / maxp;
|
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) && len % maxp == 0)
|
|
|
|
ntd++;
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(10, ("uhci_alloc_std_chain: maxp=%d ntd=%d\n", maxp, ntd));
|
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 (ntd == 0) {
|
|
|
|
*sp = *ep = 0;
|
|
|
|
DPRINTFN(-1,("uhci_alloc_std_chain: ntd=0\n"));
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
tog = upipe->nexttoggle;
|
|
|
|
if (ntd % 2 == 0)
|
|
|
|
tog ^= 1;
|
|
|
|
upipe->nexttoggle = tog ^ 1;
|
2002-01-03 02:10:31 +00:00
|
|
|
lastp = NULL;
|
1999-10-07 19:26:38 +00:00
|
|
|
lastlink = UHCI_PTR_T;
|
|
|
|
ntd--;
|
|
|
|
status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(3) | UHCI_TD_ACTIVE);
|
2002-02-16 00:51:26 +00:00
|
|
|
if (upipe->pipe.device->speed == USB_SPEED_LOW)
|
1999-10-07 19:26:38 +00:00
|
|
|
status |= UHCI_TD_LS;
|
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_SHORT_XFER_OK)
|
1999-10-07 19:26:38 +00:00
|
|
|
status |= UHCI_TD_SPD;
|
|
|
|
for (i = ntd; i >= 0; i--) {
|
|
|
|
p = uhci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (p == NULL) {
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_free_std_chain(sc, lastp, NULL);
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NOMEM);
|
|
|
|
}
|
|
|
|
p->link.std = lastp;
|
2002-01-20 12:08:09 +00:00
|
|
|
p->td.td_link = htole32(lastlink | UHCI_PTR_VF | UHCI_PTR_TD);
|
1999-10-07 19:26:38 +00:00
|
|
|
lastp = p;
|
|
|
|
lastlink = p->physaddr;
|
2001-12-30 23:02:31 +00:00
|
|
|
p->td.td_status = htole32(status);
|
1999-10-07 19:26:38 +00:00
|
|
|
if (i == ntd) {
|
|
|
|
/* last TD */
|
|
|
|
l = len % maxp;
|
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 (l == 0 && !(flags & USBD_FORCE_SHORT_XFER))
|
|
|
|
l = maxp;
|
1999-10-07 19:26:38 +00:00
|
|
|
*ep = p;
|
|
|
|
} else
|
|
|
|
l = maxp;
|
2002-02-03 17:03:34 +00:00
|
|
|
p->td.td_token =
|
2001-12-30 23:02:31 +00:00
|
|
|
htole32(rd ? UHCI_TD_IN (l, endpt, addr, tog) :
|
2002-01-03 02:10:31 +00:00
|
|
|
UHCI_TD_OUT(l, endpt, addr, tog));
|
2001-12-30 23:02:31 +00:00
|
|
|
p->td.td_buffer = htole32(DMAADDR(dma, i * maxp));
|
1999-10-07 19:26:38 +00:00
|
|
|
tog ^= 1;
|
|
|
|
}
|
|
|
|
*sp = lastp;
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(10, ("uhci_alloc_std_chain: nexttog=%d\n",
|
1999-10-07 19:26:38 +00:00
|
|
|
upipe->nexttoggle));
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_clear_toggle(usbd_pipe_handle pipe)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
|
|
|
upipe->nexttoggle = 0;
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_noop(usbd_pipe_handle pipe)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_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);
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
2002-01-03 02:10:31 +00:00
|
|
|
* Pipe isn't running (otherwise err would be USBD_INPROG),
|
|
|
|
* so start it first.
|
1999-11-17 22:33:51 +00:00
|
|
|
*/
|
|
|
|
return (uhci_device_bulk_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_bulk_start(usbd_xfer_handle xfer)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1998-11-26 23:13:13 +00:00
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_soft_td_t *data, *dataend;
|
1998-11-26 23:13:13 +00:00
|
|
|
uhci_soft_qh_t *sqh;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
int len, isread, endpt;
|
1998-11-26 23:13:13 +00:00
|
|
|
int s;
|
|
|
|
|
2003-07-14 18:47:27 +00:00
|
|
|
DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%d flags=%d ii=%p\n",
|
|
|
|
xfer, xfer->length, xfer->flags, ii));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-01-21 03:35:55 +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)
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_device_bulk_transfer: a request");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
len = xfer->length;
|
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
|
|
|
endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
|
1999-10-07 19:26:38 +00:00
|
|
|
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
|
1999-08-17 07:36:34 +00:00
|
|
|
sqh = upipe->u.bulk.sqh;
|
|
|
|
|
|
|
|
upipe->u.bulk.isread = isread;
|
1999-10-07 19:26:38 +00:00
|
|
|
upipe->u.bulk.length = len;
|
1999-08-17 07:36:34 +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
|
|
|
err = uhci_alloc_std_chain(upipe, sc, len, isread, xfer->flags,
|
|
|
|
&xfer->dmabuf, &data, &dataend);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err)
|
|
|
|
return (err);
|
2001-12-30 23:02:31 +00:00
|
|
|
dataend->td.td_status |= htole32(UHCI_TD_IOC);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 8) {
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("uhci_device_bulk_transfer: data(1)\n"));
|
|
|
|
uhci_dump_tds(data);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Set up interrupt info. */
|
1999-11-17 22:33:51 +00:00
|
|
|
ii->xfer = xfer;
|
|
|
|
ii->stdstart = data;
|
|
|
|
ii->stdend = dataend;
|
1998-11-26 23:13:13 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
2002-04-07 18:33:12 +00:00
|
|
|
if (!ii->isdone) {
|
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
|
|
|
printf("uhci_device_bulk_transfer: not done, ii=%p\n", ii);
|
2002-04-07 18:33:12 +00:00
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
ii->isdone = 0;
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sqh->elink = data;
|
2002-01-20 12:08:09 +00:00
|
|
|
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
s = splusb();
|
|
|
|
uhci_add_bulk(sc, sqh);
|
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
|
|
|
uhci_add_intr_info(sc, ii);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
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),
|
|
|
|
uhci_timeout, ii);
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
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
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
1999-08-17 07:36:34 +00:00
|
|
|
splx(s);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 10) {
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("uhci_device_bulk_transfer: data(2)\n"));
|
|
|
|
uhci_dump_tds(data);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (sc->sc_bus.use_polling)
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_waitintr(sc, xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Abort a device bulk request. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_bulk_abort(usbd_xfer_handle xfer)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_device_bulk_abort:\n"));
|
1999-11-28 21:01:06 +00:00
|
|
|
uhci_abort_xfer(xfer, USBD_CANCELLED);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
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 18:10:10 +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.
|
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
|
|
|
*/
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
2005-03-19 19:08:46 +00:00
|
|
|
struct uhci_xfer *uxfer = UXFER(xfer);
|
|
|
|
uhci_intr_info_t *ii = &uxfer->iinfo;
|
2002-04-07 18:03:45 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)upipe->pipe.device->bus;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t *std;
|
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
|
|
|
int s;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-28 21:01:06 +00:00
|
|
|
DPRINTFN(1,("uhci_abort_xfer: xfer=%p, status=%d\n", xfer, status));
|
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
if (sc->sc_dying) {
|
|
|
|
/* If we're dying, just do the software part. */
|
|
|
|
s = splusb();
|
2004-11-12 02:57:35 +00:00
|
|
|
xfer->status = status; /* make software ignore it */
|
|
|
|
usb_uncallout(xfer->timeout_handle, uhci_timeout, xfer);
|
|
|
|
usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
|
2004-11-16 00:48:27 +00:00
|
|
|
usb_transfer_complete(xfer);
|
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
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
}
|
2002-04-07 18:33:12 +00:00
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
if (xfer->device->bus->intr_context || !curproc)
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_abort_xfer: not in process context");
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2005-03-19 19:08:46 +00:00
|
|
|
/*
|
|
|
|
* If an abort is already in progress then just wait for it to
|
|
|
|
* complete and return.
|
|
|
|
*/
|
|
|
|
if (uxfer->uhci_xfer_flags & UHCI_XFER_ABORTING) {
|
|
|
|
DPRINTFN(2, ("uhci_abort_xfer: already aborting\n"));
|
|
|
|
/* No need to wait if we're aborting from a timeout. */
|
|
|
|
if (status == USBD_TIMEOUT)
|
|
|
|
return;
|
|
|
|
/* Override the status which might be USBD_TIMEOUT. */
|
|
|
|
xfer->status = status;
|
|
|
|
DPRINTFN(2, ("uhci_abort_xfer: waiting for abort to finish\n"));
|
|
|
|
uxfer->uhci_xfer_flags |= UHCI_XFER_ABORTWAIT;
|
|
|
|
while (uxfer->uhci_xfer_flags & UHCI_XFER_ABORTING)
|
|
|
|
tsleep(&uxfer->uhci_xfer_flags, PZERO, "uhciaw", 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-12 02:57:35 +00:00
|
|
|
/*
|
|
|
|
* Step 1: Make interrupt routine and hardware ignore xfer.
|
|
|
|
*/
|
|
|
|
s = splusb();
|
2005-03-19 19:08:46 +00:00
|
|
|
uxfer->uhci_xfer_flags |= UHCI_XFER_ABORTING;
|
2004-11-12 02:57:35 +00:00
|
|
|
xfer->status = status; /* make software ignore it */
|
|
|
|
usb_uncallout(xfer->timeout_handle, uhci_timeout, ii);
|
|
|
|
usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
|
|
|
|
DPRINTFN(1,("uhci_abort_xfer: stop ii=%p\n", ii));
|
|
|
|
for (std = ii->stdstart; std != NULL; std = std->link.std)
|
|
|
|
std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
|
|
|
|
splx(s);
|
|
|
|
|
2003-07-04 01:50:39 +00:00
|
|
|
/*
|
2002-04-07 18:03:45 +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 18:10:10 +00:00
|
|
|
usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
|
1999-10-07 19:26:38 +00:00
|
|
|
s = splusb();
|
2002-09-30 17:50:18 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 18:03:45 +00:00
|
|
|
sc->sc_softwake = 1;
|
2002-09-30 17:50:18 +00:00
|
|
|
#endif /* USB_USE_SOFTINTR */
|
2002-04-07 18:03:45 +00:00
|
|
|
usb_schedsoftintr(&sc->sc_bus);
|
2003-07-04 01:50:39 +00:00
|
|
|
#ifdef USB_USE_SOFTINTR
|
2002-04-07 18:10:10 +00:00
|
|
|
DPRINTFN(1,("uhci_abort_xfer: tsleep\n"));
|
2002-04-07 18:03:45 +00:00
|
|
|
tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
|
2002-09-30 17:50:18 +00:00
|
|
|
#endif /* USB_USE_SOFTINTR */
|
2002-04-07 18:03:45 +00:00
|
|
|
splx(s);
|
2003-07-04 01:50:39 +00:00
|
|
|
|
2002-04-07 18:03:45 +00:00
|
|
|
/*
|
|
|
|
* Step 3: Execute callback.
|
|
|
|
*/
|
2002-04-07 18:10:10 +00:00
|
|
|
DPRINTFN(1,("uhci_abort_xfer: callback\n"));
|
2002-04-07 18:03:45 +00:00
|
|
|
s = splusb();
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
ii->isdone = 1;
|
|
|
|
#endif
|
2005-03-19 19:08:46 +00:00
|
|
|
/* Do the wakeup first to avoid touching the xfer after the callback. */
|
|
|
|
uxfer->uhci_xfer_flags &= ~UHCI_XFER_ABORTING;
|
|
|
|
if (uxfer->uhci_xfer_flags & UHCI_XFER_ABORTWAIT) {
|
|
|
|
uxfer->uhci_xfer_flags &= ~UHCI_XFER_ABORTWAIT;
|
|
|
|
wakeup(&uxfer->uhci_xfer_flags);
|
|
|
|
}
|
2002-04-07 18:03:45 +00:00
|
|
|
usb_transfer_complete(xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Close a device bulk pipe. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_bulk_close(usbd_pipe_handle pipe)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
1999-08-17 07:36:34 +00:00
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
uhci_free_sqh(sc, upipe->u.bulk.sqh);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_ctrl_transfer(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
2002-04-07 18:33:12 +00:00
|
|
|
/*
|
2002-01-03 02:10:31 +00:00
|
|
|
* Pipe isn't running (otherwise err would be USBD_INPROG),
|
|
|
|
* so start it first.
|
1999-11-17 22:33:51 +00:00
|
|
|
*/
|
|
|
|
return (uhci_device_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_ctrl_start(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
|
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-21 03:35:55 +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))
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_device_ctrl_transfer: not a request");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
err = uhci_device_request(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
if (sc->sc_bus.use_polling)
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_waitintr(sc, xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_intr_transfer(usbd_xfer_handle xfer)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
2002-01-03 02:10:31 +00:00
|
|
|
* Pipe isn't running (otherwise err would be USBD_INPROG),
|
|
|
|
* so start it first.
|
1999-11-17 22:33:51 +00:00
|
|
|
*/
|
|
|
|
return (uhci_device_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_intr_start(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-08-17 07:36:34 +00:00
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_soft_td_t *data, *dataend;
|
1999-08-17 07:36:34 +00:00
|
|
|
uhci_soft_qh_t *sqh;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
2003-02-28 19:28:29 +00:00
|
|
|
int isread, endpt;
|
1999-10-07 19:26:38 +00:00
|
|
|
int i, s;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2002-01-21 03:35:55 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(3,("uhci_device_intr_transfer: xfer=%p len=%d flags=%d\n",
|
|
|
|
xfer, xfer->length, xfer->flags));
|
1999-08-17 07:36:34 +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)
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_device_intr_transfer: a request");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2003-02-28 19:28:29 +00:00
|
|
|
endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
|
|
|
|
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
|
|
|
|
sqh = upipe->u.bulk.sqh;
|
|
|
|
|
|
|
|
upipe->u.intr.isread = isread;
|
|
|
|
|
|
|
|
err = uhci_alloc_std_chain(upipe, sc, xfer->length, isread,
|
|
|
|
xfer->flags, &xfer->dmabuf, &data,
|
|
|
|
&dataend);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err)
|
|
|
|
return (err);
|
2001-12-30 23:02:31 +00:00
|
|
|
dataend->td.td_status |= htole32(UHCI_TD_IOC);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-08-17 07:36:34 +00:00
|
|
|
if (uhcidebug > 10) {
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("uhci_device_intr_transfer: data(1)\n"));
|
|
|
|
uhci_dump_tds(data);
|
1999-08-17 07:36:34 +00:00
|
|
|
uhci_dump_qh(upipe->u.intr.qhs[0]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
/* Set up interrupt info. */
|
1999-11-17 22:33:51 +00:00
|
|
|
ii->xfer = xfer;
|
|
|
|
ii->stdstart = data;
|
|
|
|
ii->stdend = dataend;
|
1999-08-17 07:36:34 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
2002-04-07 18:33:12 +00:00
|
|
|
if (!ii->isdone) {
|
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
|
|
|
printf("uhci_device_intr_transfer: not done, ii=%p\n", ii);
|
2002-04-07 18:33:12 +00:00
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
ii->isdone = 0;
|
|
|
|
#endif
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(10,("uhci_device_intr_transfer: qhs[0]=%p\n",
|
1999-08-17 07:36:34 +00:00
|
|
|
upipe->u.intr.qhs[0]));
|
|
|
|
for (i = 0; i < upipe->u.intr.npoll; i++) {
|
|
|
|
sqh = upipe->u.intr.qhs[i];
|
1999-11-17 22:33:51 +00:00
|
|
|
sqh->elink = data;
|
2002-01-20 12:08:09 +00:00
|
|
|
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
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
|
|
|
uhci_add_intr_info(sc, ii);
|
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
1999-08-17 07:36:34 +00:00
|
|
|
splx(s);
|
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 10) {
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("uhci_device_intr_transfer: data(2)\n"));
|
|
|
|
uhci_dump_tds(data);
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dump_qh(upipe->u.intr.qhs[0]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Abort a device control request. */
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_ctrl_abort(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
DPRINTF(("uhci_device_ctrl_abort:\n"));
|
1999-11-28 21:01:06 +00:00
|
|
|
uhci_abort_xfer(xfer, USBD_CANCELLED);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close a device control pipe. */
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_ctrl_close(usbd_pipe_handle pipe)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Abort a device interrupt request. */
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_intr_abort(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(1,("uhci_device_intr_abort: xfer=%p\n", xfer));
|
|
|
|
if (xfer->pipe->intrxfer == xfer) {
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTFN(1,("uhci_device_intr_abort: remove\n"));
|
2002-04-07 18:10:10 +00:00
|
|
|
xfer->pipe->intrxfer = NULL;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-11-28 21:01:06 +00:00
|
|
|
uhci_abort_xfer(xfer, USBD_CANCELLED);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Close a device interrupt pipe. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_intr_close(usbd_pipe_handle pipe)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
|
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
|
|
|
int i, npoll;
|
|
|
|
int s;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
/* Unlink descriptors from controller data structures. */
|
|
|
|
npoll = upipe->u.intr.npoll;
|
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
|
|
|
s = splusb();
|
1998-11-26 23:13:13 +00:00
|
|
|
for (i = 0; i < npoll; i++)
|
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
|
|
|
uhci_remove_intr(sc, upipe->u.intr.qhs[i]);
|
|
|
|
splx(s);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1998-11-26 23:13:13 +00:00
|
|
|
* We now have to wait for any activity on the physical
|
|
|
|
* descriptors to stop.
|
|
|
|
*/
|
1999-01-07 23:07:57 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 2);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
|
|
|
for(i = 0; i < npoll; i++)
|
|
|
|
uhci_free_sqh(sc, upipe->u.intr.qhs[i]);
|
1999-10-07 19:26:38 +00:00
|
|
|
free(upipe->u.intr.qhs, M_USBHC);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* XXX free other resources */
|
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_request(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
|
|
|
usb_device_request_t *req = &xfer->request;
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
|
|
|
int addr = dev->address;
|
|
|
|
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_soft_td_t *setup, *data, *stat, *next, *dataend;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_qh_t *sqh;
|
|
|
|
int len;
|
|
|
|
u_int32_t ls;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
int isread;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
DPRINTFN(3,("uhci_device_control type=0x%02x, request=0x%02x, "
|
|
|
|
"wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
|
|
|
|
req->bmRequestType, req->bRequest, UGETW(req->wValue),
|
|
|
|
UGETW(req->wIndex), UGETW(req->wLength),
|
|
|
|
addr, endpt));
|
|
|
|
|
2002-02-16 00:51:26 +00:00
|
|
|
ls = dev->speed == USB_SPEED_LOW ? UHCI_TD_LS : 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
isread = req->bmRequestType & UT_READ;
|
|
|
|
len = UGETW(req->wLength);
|
|
|
|
|
|
|
|
setup = upipe->u.ctl.setup;
|
|
|
|
stat = upipe->u.ctl.stat;
|
|
|
|
sqh = upipe->u.ctl.sqh;
|
|
|
|
|
|
|
|
/* Set up data transaction */
|
|
|
|
if (len != 0) {
|
|
|
|
upipe->nexttoggle = 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
|
|
|
err = uhci_alloc_std_chain(upipe, sc, len, isread, xfer->flags,
|
|
|
|
&xfer->dmabuf, &data, &dataend);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
next = data;
|
|
|
|
dataend->link.std = stat;
|
2002-01-20 12:08:09 +00:00
|
|
|
dataend->td.td_link = htole32(stat->physaddr | UHCI_PTR_VF | UHCI_PTR_TD);
|
1999-10-07 19:26:38 +00:00
|
|
|
} else {
|
|
|
|
next = stat;
|
|
|
|
}
|
|
|
|
upipe->u.ctl.length = len;
|
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
memcpy(KERNADDR(&upipe->u.ctl.reqdma, 0), req, sizeof *req);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
setup->link.std = next;
|
2002-01-20 12:08:09 +00:00
|
|
|
setup->td.td_link = htole32(next->physaddr | UHCI_PTR_VF | UHCI_PTR_TD);
|
2001-12-30 23:02:31 +00:00
|
|
|
setup->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
|
|
|
|
UHCI_TD_ACTIVE);
|
|
|
|
setup->td.td_token = htole32(UHCI_TD_SETUP(sizeof *req, endpt, addr));
|
|
|
|
setup->td.td_buffer = htole32(DMAADDR(&upipe->u.ctl.reqdma, 0));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
stat->link.std = NULL;
|
2001-12-30 23:02:31 +00:00
|
|
|
stat->td.td_link = htole32(UHCI_PTR_T);
|
2002-02-03 17:03:34 +00:00
|
|
|
stat->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
|
1999-10-07 19:26:38 +00:00
|
|
|
UHCI_TD_ACTIVE | UHCI_TD_IOC);
|
2002-02-03 17:03:34 +00:00
|
|
|
stat->td.td_token =
|
2001-12-30 23:02:31 +00:00
|
|
|
htole32(isread ? UHCI_TD_OUT(0, endpt, addr, 1) :
|
2002-01-03 02:10:31 +00:00
|
|
|
UHCI_TD_IN (0, endpt, addr, 1));
|
2001-12-30 23:02:31 +00:00
|
|
|
stat->td.td_buffer = htole32(0);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-11-17 22:33:51 +00:00
|
|
|
if (uhcidebug > 10) {
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_device_request: before transfer\n"));
|
|
|
|
uhci_dump_tds(setup);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Set up interrupt info. */
|
1999-11-17 22:33:51 +00:00
|
|
|
ii->xfer = xfer;
|
1999-10-07 19:26:38 +00:00
|
|
|
ii->stdstart = setup;
|
|
|
|
ii->stdend = stat;
|
|
|
|
#ifdef DIAGNOSTIC
|
2002-04-07 18:33:12 +00:00
|
|
|
if (!ii->isdone) {
|
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
|
|
|
printf("uhci_device_request: not done, ii=%p\n", ii);
|
2002-04-07 18:33:12 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
ii->isdone = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sqh->elink = setup;
|
2002-01-20 12:08:09 +00:00
|
|
|
sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
s = splusb();
|
2002-02-16 00:51:26 +00:00
|
|
|
if (dev->speed == USB_SPEED_LOW)
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_add_ls_ctrl(sc, sqh);
|
|
|
|
else
|
|
|
|
uhci_add_hs_ctrl(sc, sqh);
|
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
|
|
|
uhci_add_intr_info(sc, ii);
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 12) {
|
|
|
|
uhci_soft_td_t *std;
|
|
|
|
uhci_soft_qh_t *xqh;
|
|
|
|
uhci_soft_qh_t *sxqh;
|
|
|
|
int maxqh = 0;
|
|
|
|
uhci_physaddr_t link;
|
|
|
|
DPRINTF(("uhci_enter_ctl_q: follow from [0]\n"));
|
|
|
|
for (std = sc->sc_vframes[0].htd, link = 0;
|
2002-01-20 12:08:09 +00:00
|
|
|
(link & UHCI_PTR_QH) == 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
std = std->link.std) {
|
2001-12-30 23:02:31 +00:00
|
|
|
link = le32toh(std->td.td_link);
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dump_td(std);
|
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
sxqh = (uhci_soft_qh_t *)std;
|
|
|
|
uhci_dump_qh(sxqh);
|
|
|
|
for (xqh = sxqh;
|
|
|
|
xqh != NULL;
|
2002-02-03 17:03:34 +00:00
|
|
|
xqh = (maxqh++ == 5 || xqh->hlink == sxqh ||
|
2002-01-03 02:10:31 +00:00
|
|
|
xqh->hlink == xqh ? NULL : xqh->hlink)) {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dump_qh(xqh);
|
|
|
|
}
|
|
|
|
DPRINTF(("Enqueued QH:\n"));
|
|
|
|
uhci_dump_qh(sqh);
|
|
|
|
uhci_dump_tds(sqh->elink);
|
|
|
|
}
|
|
|
|
#endif
|
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),
|
|
|
|
uhci_timeout, ii);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
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
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_transfer(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(5,("uhci_device_isoc_transfer: xfer=%p\n", xfer));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
/* Put it on our queue, */
|
1999-11-17 22:33:51 +00:00
|
|
|
err = usb_insert_transfer(xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
/* bail out on error, */
|
1999-11-17 22:33:51 +00:00
|
|
|
if (err && err != USBD_IN_PROGRESS)
|
|
|
|
return (err);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
/* XXX should check inuse here */
|
|
|
|
|
|
|
|
/* insert into schedule, */
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_device_isoc_enter(xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
/* and start if the pipe wasn't running */
|
1999-11-17 22:33:51 +00:00
|
|
|
if (!err)
|
|
|
|
uhci_device_isoc_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
return (err);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_enter(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-01-07 23:07:57 +00:00
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
1999-10-07 19:26:38 +00:00
|
|
|
struct iso *iso = &upipe->u.iso;
|
2002-02-03 17:03:34 +00:00
|
|
|
uhci_soft_td_t *std;
|
1999-10-07 19:26:38 +00:00
|
|
|
u_int32_t buf, len, status;
|
|
|
|
int s, i, next, nframes;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(5,("uhci_device_isoc_enter: used=%d next=%d xfer=%p "
|
1999-10-07 19:26:38 +00:00
|
|
|
"nframes=%d\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
iso->inuse, iso->next, xfer, xfer->nframes));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-21 03:35:55 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return;
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->status == USBD_IN_PROGRESS) {
|
1999-10-07 19:26:38 +00:00
|
|
|
/* This request has already been entered into the frame list */
|
2002-01-03 02:10:31 +00:00
|
|
|
printf("uhci_device_isoc_enter: xfer=%p in frame list\n", xfer);
|
1999-11-28 21:01:06 +00:00
|
|
|
/* XXX */
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (iso->inuse >= UHCI_VFRAMELIST_COUNT)
|
|
|
|
printf("uhci_device_isoc_enter: overflow!\n");
|
1999-01-07 23:07:57 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
next = iso->next;
|
|
|
|
if (next == -1) {
|
|
|
|
/* Not in use yet, schedule it a few frames ahead. */
|
|
|
|
next = (UREAD2(sc, UHCI_FRNUM) + 3) % UHCI_VFRAMELIST_COUNT;
|
|
|
|
DPRINTFN(2,("uhci_device_isoc_enter: start next=%d\n", next));
|
|
|
|
}
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
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
|
|
|
UXFER(xfer)->curframe = next;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2000-02-10 18:50:19 +00:00
|
|
|
buf = DMAADDR(&xfer->dmabuf, 0);
|
2001-12-30 23:02:31 +00:00
|
|
|
status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(0) |
|
|
|
|
UHCI_TD_ACTIVE |
|
|
|
|
UHCI_TD_IOS);
|
1999-11-17 22:33:51 +00:00
|
|
|
nframes = xfer->nframes;
|
1999-10-07 19:26:38 +00:00
|
|
|
s = splusb();
|
|
|
|
for (i = 0; i < nframes; i++) {
|
|
|
|
std = iso->stds[next];
|
|
|
|
if (++next >= UHCI_VFRAMELIST_COUNT)
|
|
|
|
next = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
len = xfer->frlengths[i];
|
2001-12-30 23:02:31 +00:00
|
|
|
std->td.td_buffer = htole32(buf);
|
1999-10-07 19:26:38 +00:00
|
|
|
if (i == nframes - 1)
|
2001-12-30 23:02:31 +00:00
|
|
|
status |= UHCI_TD_IOC;
|
|
|
|
std->td.td_status = htole32(status);
|
|
|
|
std->td.td_token &= htole32(~UHCI_TD_MAXLEN_MASK);
|
|
|
|
std->td.td_token |= htole32(UHCI_TD_SET_MAXLEN(len));
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 5) {
|
|
|
|
DPRINTFN(5,("uhci_device_isoc_enter: TD %d\n", i));
|
|
|
|
uhci_dump_td(std);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
buf += len;
|
|
|
|
}
|
|
|
|
iso->next = next;
|
1999-11-17 22:33:51 +00:00
|
|
|
iso->inuse += xfer->nframes;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_start(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)upipe->pipe.device->bus;
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t *end;
|
|
|
|
int s, i;
|
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(5,("uhci_device_isoc_start: xfer=%p\n", xfer));
|
|
|
|
|
2002-01-21 03:35:55 +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->status != USBD_IN_PROGRESS)
|
|
|
|
printf("uhci_device_isoc_start: not in progress %p\n", xfer);
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Find the last TD */
|
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
|
|
|
i = UXFER(xfer)->curframe + xfer->nframes;
|
1999-10-07 19:26:38 +00:00
|
|
|
if (i >= UHCI_VFRAMELIST_COUNT)
|
|
|
|
i -= UHCI_VFRAMELIST_COUNT;
|
|
|
|
end = upipe->u.iso.stds[i];
|
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (end == NULL) {
|
|
|
|
printf("uhci_device_isoc_start: end == NULL\n");
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
s = splusb();
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Set up interrupt info. */
|
1999-11-17 22:33:51 +00:00
|
|
|
ii->xfer = xfer;
|
1999-10-07 19:26:38 +00:00
|
|
|
ii->stdstart = end;
|
|
|
|
ii->stdend = end;
|
|
|
|
#ifdef DIAGNOSTIC
|
2002-01-03 02:10:31 +00:00
|
|
|
if (!ii->isdone)
|
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
|
|
|
printf("uhci_device_isoc_start: not done, ii=%p\n", ii);
|
1999-10-07 19:26:38 +00:00
|
|
|
ii->isdone = 0;
|
|
|
|
#endif
|
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
|
|
|
uhci_add_intr_info(sc, ii);
|
2002-02-03 17:03:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
splx(s);
|
|
|
|
|
|
|
|
return (USBD_IN_PROGRESS);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_abort(usbd_xfer_handle xfer)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t **stds = upipe->u.iso.stds;
|
|
|
|
uhci_soft_td_t *std;
|
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
|
|
|
int i, n, s, nframes, maxlen, len;
|
2002-04-07 18:33:12 +00:00
|
|
|
|
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
|
|
|
s = splusb();
|
2002-04-07 18:33:12 +00:00
|
|
|
|
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
|
|
|
/* Transfer is already done. */
|
2002-04-07 18:33:12 +00:00
|
|
|
if (xfer->status != USBD_NOT_STARTED &&
|
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
|
|
|
xfer->status != USBD_IN_PROGRESS) {
|
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
}
|
2002-04-07 18:33:12 +00:00
|
|
|
|
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
|
|
|
/* Give xfer the requested abort code. */
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = USBD_CANCELLED;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
/* make hardware ignore it, */
|
1999-11-17 22:33:51 +00:00
|
|
|
nframes = xfer->nframes;
|
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
|
|
|
n = UXFER(xfer)->curframe;
|
|
|
|
maxlen = 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
for (i = 0; i < nframes; i++) {
|
|
|
|
std = stds[n];
|
2001-12-30 23:02:31 +00:00
|
|
|
std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
|
2002-04-01 20:18:21 +00:00
|
|
|
len = UHCI_TD_GET_MAXLEN(le32toh(std->td.td_token));
|
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
|
|
|
if (len > maxlen)
|
|
|
|
maxlen = len;
|
1999-10-07 19:26:38 +00:00
|
|
|
if (++n >= UHCI_VFRAMELIST_COUNT)
|
|
|
|
n = 0;
|
|
|
|
}
|
2002-04-07 18:33:12 +00:00
|
|
|
|
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
|
|
|
/* and wait until we are sure the hardware has finished. */
|
|
|
|
delay(maxlen);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
UXFER(xfer)->iinfo.isdone = 1;
|
|
|
|
#endif
|
|
|
|
/* Run callback and remove from interrupt list. */
|
|
|
|
usb_transfer_complete(xfer);
|
2002-04-07 18:33:12 +00:00
|
|
|
|
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
|
|
|
splx(s);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_close(usbd_pipe_handle pipe)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_td_t *std, *vstd;
|
1999-01-07 23:07:57 +00:00
|
|
|
struct iso *iso;
|
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
|
|
|
int i, s;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure all TDs are marked as inactive.
|
|
|
|
* Wait for completion.
|
|
|
|
* Unschedule.
|
|
|
|
* Deallocate.
|
|
|
|
*/
|
|
|
|
iso = &upipe->u.iso;
|
|
|
|
|
|
|
|
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++)
|
2001-12-30 23:02:31 +00:00
|
|
|
iso->stds[i]->td.td_status &= htole32(~UHCI_TD_ACTIVE);
|
1999-01-07 23:07:57 +00:00
|
|
|
usb_delay_ms(&sc->sc_bus, 2); /* wait for completion */
|
|
|
|
|
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
|
|
|
s = splusb();
|
1999-01-07 23:07:57 +00:00
|
|
|
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
|
|
|
|
std = iso->stds[i];
|
1999-10-07 19:26:38 +00:00
|
|
|
for (vstd = sc->sc_vframes[i].htd;
|
1999-11-17 22:33:51 +00:00
|
|
|
vstd != NULL && vstd->link.std != std;
|
1999-10-07 19:26:38 +00:00
|
|
|
vstd = vstd->link.std)
|
1999-01-07 23:07:57 +00:00
|
|
|
;
|
1999-11-17 22:33:51 +00:00
|
|
|
if (vstd == NULL) {
|
1999-01-07 23:07:57 +00:00
|
|
|
/*panic*/
|
1999-10-07 19:26:38 +00:00
|
|
|
printf("uhci_device_isoc_close: %p not found\n", std);
|
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
|
|
|
splx(s);
|
1999-01-07 23:07:57 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
vstd->link = std->link;
|
|
|
|
vstd->td.td_link = std->td.td_link;
|
1999-01-07 23:07:57 +00:00
|
|
|
uhci_free_std(sc, std);
|
|
|
|
}
|
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
|
|
|
splx(s);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
free(iso->stds, M_USBHC);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_setup_isoc(usbd_pipe_handle pipe)
|
1999-01-07 23:07:57 +00:00
|
|
|
{
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
|
|
|
usbd_device_handle dev = upipe->pipe.device;
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
|
|
|
|
int addr = upipe->pipe.device->address;
|
|
|
|
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
|
1999-10-07 19:26:38 +00:00
|
|
|
int rd = UE_GET_DIR(endpt) == UE_DIR_IN;
|
|
|
|
uhci_soft_td_t *std, *vstd;
|
|
|
|
u_int32_t token;
|
1999-01-07 23:07:57 +00:00
|
|
|
struct iso *iso;
|
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
|
|
|
int i, s;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
|
|
|
iso = &upipe->u.iso;
|
|
|
|
iso->stds = malloc(UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *),
|
2003-02-19 05:47:46 +00:00
|
|
|
M_USBHC, M_WAITOK);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
2001-12-30 23:02:31 +00:00
|
|
|
token = rd ? UHCI_TD_IN (0, endpt, addr, 0) :
|
|
|
|
UHCI_TD_OUT(0, endpt, addr, 0);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Allocate the TDs and mark as inactive; */
|
1999-01-07 23:07:57 +00:00
|
|
|
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
|
1999-10-07 19:26:38 +00:00
|
|
|
std = uhci_alloc_std(sc);
|
|
|
|
if (std == 0)
|
|
|
|
goto bad;
|
2001-12-30 23:02:31 +00:00
|
|
|
std->td.td_status = htole32(UHCI_TD_IOS); /* iso, inactive */
|
|
|
|
std->td.td_token = htole32(token);
|
1999-10-07 19:26:38 +00:00
|
|
|
iso->stds[i] = std;
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Insert TDs into schedule. */
|
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
|
|
|
s = splusb();
|
1999-01-07 23:07:57 +00:00
|
|
|
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
|
|
|
|
std = iso->stds[i];
|
1999-10-07 19:26:38 +00:00
|
|
|
vstd = sc->sc_vframes[i].htd;
|
|
|
|
std->link = vstd->link;
|
|
|
|
std->td.td_link = vstd->td.td_link;
|
|
|
|
vstd->link.std = std;
|
2002-01-20 12:08:09 +00:00
|
|
|
vstd->td.td_link = htole32(std->physaddr | UHCI_PTR_TD);
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
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
|
|
|
splx(s);
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
iso->next = -1;
|
|
|
|
iso->inuse = 0;
|
1999-01-07 23:07:57 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
|
|
|
|
bad:
|
1999-01-07 23:07:57 +00:00
|
|
|
while (--i >= 0)
|
|
|
|
uhci_free_std(sc, iso->stds[i]);
|
1999-10-07 19:26:38 +00:00
|
|
|
free(iso->stds, M_USBHC);
|
|
|
|
return (USBD_NOMEM);
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_isoc_done(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTFN(4, ("uhci_isoc_done: length=%d\n", xfer->actlen));
|
1999-08-17 07:36:34 +00:00
|
|
|
|
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
|
|
|
if (ii->xfer != xfer)
|
|
|
|
/* Not on interrupt list, ignore it. */
|
|
|
|
return;
|
|
|
|
|
2003-07-14 18:49:18 +00:00
|
|
|
if (!uhci_active_intr_info(ii))
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (xfer->busy_free != XFER_BUSY) {
|
|
|
|
printf("uhci_device_isoc_done: xfer=%p not busy 0x%08x\n",
|
|
|
|
xfer, xfer->busy_free);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ii->stdend == NULL) {
|
|
|
|
printf("uhci_device_isoc_done: xfer=%p stdend==NULL\n", xfer);
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
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
|
|
|
uhci_dump_ii(ii);
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Turn off the interrupt since it is active even if the TD is not. */
|
2001-12-30 23:02:31 +00:00
|
|
|
ii->stdend->td.td_status &= htole32(~UHCI_TD_IOC);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
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
|
|
|
uhci_del_intr_info(ii); /* remove from active list */
|
2002-01-03 02:10:31 +00:00
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (ii->stdend == NULL) {
|
|
|
|
printf("uhci_device_isoc_done: xfer=%p stdend==NULL\n", xfer);
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_dump_ii(ii);
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_intr_done(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = ii->sc;
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_qh_t *sqh;
|
|
|
|
int i, npoll;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(5, ("uhci_device_intr_done: length=%d\n", xfer->actlen));
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
npoll = upipe->u.intr.npoll;
|
|
|
|
for(i = 0; i < npoll; i++) {
|
|
|
|
sqh = upipe->u.intr.qhs[i];
|
2002-01-03 02:10:31 +00:00
|
|
|
sqh->elink = NULL;
|
2001-12-30 23:02:31 +00:00
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_free_std_chain(sc, ii->stdstart, NULL);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* XXX Wasteful. */
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->pipe->repeat) {
|
|
|
|
uhci_soft_td_t *data, *dataend;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(5,("uhci_device_intr_done: requeing\n"));
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* This alloc cannot fail since we freed the chain above. */
|
2003-02-28 19:28:29 +00:00
|
|
|
uhci_alloc_std_chain(upipe, sc, xfer->length,
|
|
|
|
upipe->u.intr.isread, xfer->flags,
|
1999-11-17 22:33:51 +00:00
|
|
|
&xfer->dmabuf, &data, &dataend);
|
2001-12-30 23:02:31 +00:00
|
|
|
dataend->td.td_status |= htole32(UHCI_TD_IOC);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2002-07-31 14:34:36 +00:00
|
|
|
#ifdef USB_DEBUG
|
1999-10-07 19:26:38 +00:00
|
|
|
if (uhcidebug > 10) {
|
1999-11-17 22:33:51 +00:00
|
|
|
DPRINTF(("uhci_device_intr_done: data(1)\n"));
|
|
|
|
uhci_dump_tds(data);
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_dump_qh(upipe->u.intr.qhs[0]);
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
ii->stdstart = data;
|
|
|
|
ii->stdend = dataend;
|
1999-10-07 19:26:38 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
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 (!ii->isdone) {
|
|
|
|
printf("uhci_device_intr_done: not done, ii=%p\n", ii);
|
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
ii->isdone = 0;
|
|
|
|
#endif
|
|
|
|
for (i = 0; i < npoll; i++) {
|
|
|
|
sqh = upipe->u.intr.qhs[i];
|
1999-11-17 22:33:51 +00:00
|
|
|
sqh->elink = data;
|
2002-01-20 12:08:09 +00:00
|
|
|
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
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
|
|
|
xfer->status = USBD_IN_PROGRESS;
|
|
|
|
/* The ii is already on the examined list, just leave it. */
|
1999-10-07 19:26:38 +00:00
|
|
|
} else {
|
2002-01-03 02:10:31 +00:00
|
|
|
DPRINTFN(5,("uhci_device_intr_done: removing\n"));
|
2003-07-14 18:47:27 +00:00
|
|
|
if (uhci_active_intr_info(ii))
|
|
|
|
uhci_del_intr_info(ii);
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Deallocate request data structures */
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_ctrl_done(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = ii->sc;
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-08-17 07:36:34 +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))
|
2003-07-14 18:56:33 +00:00
|
|
|
panic("uhci_device_ctrl_done: not a request");
|
1999-08-17 07:36:34 +00:00
|
|
|
#endif
|
|
|
|
|
2003-07-14 18:47:27 +00:00
|
|
|
if (!uhci_active_intr_info(ii))
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
uhci_del_intr_info(ii); /* remove from active list */
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2002-02-16 00:51:26 +00:00
|
|
|
if (upipe->pipe.device->speed == USB_SPEED_LOW)
|
2002-01-20 20:12:25 +00:00
|
|
|
uhci_remove_ls_ctrl(sc, upipe->u.ctl.sqh);
|
|
|
|
else
|
|
|
|
uhci_remove_hs_ctrl(sc, upipe->u.ctl.sqh);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
if (upipe->u.ctl.length != 0)
|
|
|
|
uhci_free_std_chain(sc, ii->stdstart->link.std, ii->stdend);
|
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(5, ("uhci_device_ctrl_done: length=%d\n", xfer->actlen));
|
1999-08-17 07:36:34 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Deallocate request data structures */
|
1999-08-17 07:36:34 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_bulk_done(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
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
|
|
|
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = ii->sc;
|
1999-11-17 22:33:51 +00:00
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(5,("uhci_device_bulk_done: xfer=%p ii=%p sc=%p upipe=%p\n",
|
2003-07-14 18:47:27 +00:00
|
|
|
xfer, ii, sc, upipe));
|
|
|
|
|
|
|
|
if (!uhci_active_intr_info(ii))
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
uhci_del_intr_info(ii); /* remove from active list */
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
uhci_remove_bulk(sc, upipe->u.bulk.sqh);
|
|
|
|
|
2002-01-03 02:10:31 +00:00
|
|
|
uhci_free_std_chain(sc, ii->stdstart, NULL);
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(5, ("uhci_device_bulk_done: length=%d\n", xfer->actlen));
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1998-11-26 23:13:13 +00:00
|
|
|
/* Add interrupt QH, called with vflock. */
|
|
|
|
void
|
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
|
|
|
uhci_add_intr(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
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
|
|
|
struct uhci_vframe *vf = &sc->sc_vframes[sqh->pos];
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_soft_qh_t *eqh;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
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
|
|
|
DPRINTFN(4, ("uhci_add_intr: n=%d sqh=%p\n", sqh->pos, sqh));
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
eqh = vf->eqh;
|
|
|
|
sqh->hlink = eqh->hlink;
|
|
|
|
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
|
|
|
|
eqh->hlink = sqh;
|
2002-01-20 12:08:09 +00:00
|
|
|
eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
|
1998-11-26 23:13:13 +00:00
|
|
|
vf->eqh = sqh;
|
|
|
|
vf->bandwidth++;
|
|
|
|
}
|
|
|
|
|
2002-04-07 18:33:12 +00:00
|
|
|
/* Remove interrupt QH. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
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
|
|
|
uhci_remove_intr(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
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
|
|
|
struct uhci_vframe *vf = &sc->sc_vframes[sqh->pos];
|
1998-11-26 23:13:13 +00:00
|
|
|
uhci_soft_qh_t *pqh;
|
|
|
|
|
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
|
|
|
DPRINTFN(4, ("uhci_remove_intr: n=%d sqh=%p\n", sqh->pos, sqh));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-01-20 23:38:33 +00:00
|
|
|
/* See comment in uhci_remove_ctrl() */
|
|
|
|
if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) {
|
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
pqh = uhci_find_prev_qh(vf->hqh, sqh);
|
1999-10-07 19:26:38 +00:00
|
|
|
pqh->hlink = sqh->hlink;
|
|
|
|
pqh->qh.qh_hlink = sqh->qh.qh_hlink;
|
2002-01-20 23:38:33 +00:00
|
|
|
delay(UHCI_QH_REMOVE_DELAY);
|
1998-11-26 23:13:13 +00:00
|
|
|
if (vf->eqh == sqh)
|
|
|
|
vf->eqh = pqh;
|
|
|
|
vf->bandwidth--;
|
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_soft_qh_t *sqh;
|
|
|
|
int i, npoll, s;
|
|
|
|
u_int bestbw, bw, bestoffs, offs;
|
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(2, ("uhci_device_setintr: pipe=%p\n", upipe));
|
1999-10-07 19:26:38 +00:00
|
|
|
if (ival == 0) {
|
|
|
|
printf("uhci_setintr: 0 interval\n");
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ival > UHCI_VFRAMELIST_COUNT)
|
|
|
|
ival = UHCI_VFRAMELIST_COUNT;
|
|
|
|
npoll = (UHCI_VFRAMELIST_COUNT + ival - 1) / ival;
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(2, ("uhci_device_setintr: ival=%d npoll=%d\n", ival, npoll));
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
upipe->u.intr.npoll = npoll;
|
2002-02-03 17:03:34 +00:00
|
|
|
upipe->u.intr.qhs =
|
2003-02-19 05:47:46 +00:00
|
|
|
malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_WAITOK);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
1999-10-07 19:26:38 +00:00
|
|
|
* Figure out which offset in the schedule that has most
|
|
|
|
* bandwidth left over.
|
|
|
|
*/
|
|
|
|
#define MOD(i) ((i) & (UHCI_VFRAMELIST_COUNT-1))
|
|
|
|
for (bestoffs = offs = 0, bestbw = ~0; offs < ival; offs++) {
|
|
|
|
for (bw = i = 0; i < npoll; i++)
|
|
|
|
bw += sc->sc_vframes[MOD(i * ival + offs)].bandwidth;
|
|
|
|
if (bw < bestbw) {
|
|
|
|
bestbw = bw;
|
|
|
|
bestoffs = offs;
|
|
|
|
}
|
|
|
|
}
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(1, ("uhci_device_setintr: bw=%d offs=%d\n", bestbw, bestoffs));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
for(i = 0; i < npoll; i++) {
|
|
|
|
upipe->u.intr.qhs[i] = sqh = uhci_alloc_sqh(sc);
|
2002-01-03 02:10:31 +00:00
|
|
|
sqh->elink = NULL;
|
2001-12-30 23:02:31 +00:00
|
|
|
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
|
1999-10-07 19:26:38 +00:00
|
|
|
sqh->pos = MOD(i * ival + bestoffs);
|
|
|
|
}
|
|
|
|
#undef MOD
|
|
|
|
|
|
|
|
s = splusb();
|
|
|
|
/* Enter QHs into the controller data structures. */
|
|
|
|
for(i = 0; i < npoll; i++)
|
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
|
|
|
uhci_add_intr(sc, upipe->u.intr.qhs[i]);
|
2002-03-19 21:44:49 +00:00
|
|
|
splx(s);
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(5, ("uhci_device_setintr: returns %p\n", upipe));
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open a new pipe. */
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_open(usbd_pipe_handle pipe)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
|
|
|
|
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
|
|
|
|
usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
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;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
|
|
|
DPRINTFN(1, ("uhci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
|
2002-02-03 17:03:34 +00:00
|
|
|
pipe, pipe->device->address,
|
1999-10-07 19:26:38 +00:00
|
|
|
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
|
|
|
|
|
|
|
upipe->aborting = 0;
|
|
|
|
upipe->nexttoggle = 0;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
if (pipe->device->address == sc->sc_addr) {
|
|
|
|
switch (ed->bEndpointAddress) {
|
|
|
|
case USB_CONTROL_ENDPOINT:
|
|
|
|
pipe->methods = &uhci_root_ctrl_methods;
|
|
|
|
break;
|
|
|
|
case UE_DIR_IN | UHCI_INTR_ENDPT:
|
|
|
|
pipe->methods = &uhci_root_intr_methods;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (USBD_INVAL);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (ed->bmAttributes & UE_XFERTYPE) {
|
|
|
|
case UE_CONTROL:
|
|
|
|
pipe->methods = &uhci_device_ctrl_methods;
|
|
|
|
upipe->u.ctl.sqh = uhci_alloc_sqh(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (upipe->u.ctl.sqh == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
goto bad;
|
|
|
|
upipe->u.ctl.setup = uhci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (upipe->u.ctl.setup == NULL) {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_free_sqh(sc, upipe->u.ctl.sqh);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
upipe->u.ctl.stat = uhci_alloc_std(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (upipe->u.ctl.stat == NULL) {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_free_sqh(sc, upipe->u.ctl.sqh);
|
|
|
|
uhci_free_std(sc, upipe->u.ctl.setup);
|
|
|
|
goto bad;
|
|
|
|
}
|
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, &upipe->u.ctl.reqdma);
|
|
|
|
if (err) {
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_free_sqh(sc, upipe->u.ctl.sqh);
|
|
|
|
uhci_free_std(sc, upipe->u.ctl.setup);
|
|
|
|
uhci_free_std(sc, upipe->u.ctl.stat);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case UE_INTERRUPT:
|
|
|
|
pipe->methods = &uhci_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 (uhci_device_setintr(sc, upipe, ival));
|
1999-10-07 19:26:38 +00:00
|
|
|
case UE_ISOCHRONOUS:
|
|
|
|
pipe->methods = &uhci_device_isoc_methods;
|
|
|
|
return (uhci_setup_isoc(pipe));
|
|
|
|
case UE_BULK:
|
|
|
|
pipe->methods = &uhci_device_bulk_methods;
|
|
|
|
upipe->u.bulk.sqh = uhci_alloc_sqh(sc);
|
1999-11-17 22:33:51 +00:00
|
|
|
if (upipe->u.bulk.sqh == NULL)
|
1999-10-07 19:26:38 +00:00
|
|
|
goto bad;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
bad:
|
|
|
|
return (USBD_NOMEM);
|
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* Data structures and routines to emulate the root hub.
|
|
|
|
*/
|
1998-11-26 23:13:13 +00:00
|
|
|
usb_device_descriptor_t uhci_devd = {
|
|
|
|
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-01-03 02:10:31 +00:00
|
|
|
UDPROTO_FSHUB, /* protocol */
|
1998-11-26 23:13:13 +00:00
|
|
|
64, /* max packet */
|
|
|
|
{0},{0},{0x00,0x01}, /* device id */
|
|
|
|
1,2,0, /* string indicies */
|
|
|
|
1 /* # of configurations */
|
|
|
|
};
|
|
|
|
|
|
|
|
usb_config_descriptor_t uhci_confd = {
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
|
|
|
usb_interface_descriptor_t uhci_ifcd = {
|
|
|
|
USB_INTERFACE_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_INTERFACE,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
2002-01-02 18:28:45 +00:00
|
|
|
UICLASS_HUB,
|
|
|
|
UISUBCLASS_HUB,
|
2002-01-03 02:10:31 +00:00
|
|
|
UIPROTO_FSHUB,
|
1998-11-26 23:13:13 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
usb_endpoint_descriptor_t uhci_endpd = {
|
|
|
|
USB_ENDPOINT_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_ENDPOINT,
|
1999-10-07 19:26:38 +00:00
|
|
|
UE_DIR_IN | UHCI_INTR_ENDPT,
|
1998-11-26 23:13:13 +00:00
|
|
|
UE_INTERRUPT,
|
|
|
|
{8},
|
|
|
|
255
|
|
|
|
};
|
|
|
|
|
|
|
|
usb_hub_descriptor_t uhci_hubd_piix = {
|
|
|
|
USB_HUB_DESCRIPTOR_SIZE,
|
|
|
|
UDESC_HUB,
|
|
|
|
2,
|
|
|
|
{ UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0 },
|
|
|
|
50, /* power on to power good */
|
|
|
|
0,
|
|
|
|
{ 0x00 }, /* both ports are removable */
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_str(usb_string_descriptor_t *p, int l, char *s)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
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);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
2003-07-14 18:07:54 +00:00
|
|
|
/*
|
|
|
|
* The USB hub protocol requires that SET_FEATURE(PORT_RESET) also
|
|
|
|
* enables the port, and also states that SET_FEATURE(PORT_ENABLE)
|
|
|
|
* should not be used by the USB subsystem. As we cannot issue a
|
|
|
|
* SET_FEATURE(PORT_ENABLE) externally, we must ensure that the port
|
|
|
|
* will be enabled as part of the reset.
|
|
|
|
*
|
|
|
|
* On the VT83C572, the port cannot be successfully enabled until the
|
|
|
|
* outstanding "port enable change" and "connection status change"
|
|
|
|
* events have been reset.
|
|
|
|
*/
|
|
|
|
Static usbd_status
|
|
|
|
uhci_portreset(uhci_softc_t *sc, int index)
|
|
|
|
{
|
|
|
|
int lim, port, x;
|
|
|
|
|
|
|
|
if (index == 1)
|
|
|
|
port = UHCI_PORTSC1;
|
|
|
|
else if (index == 2)
|
|
|
|
port = UHCI_PORTSC2;
|
|
|
|
else
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
|
|
|
x = URWMASK(UREAD2(sc, port));
|
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_PR);
|
|
|
|
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_PORT_ROOT_RESET_DELAY);
|
|
|
|
|
|
|
|
DPRINTFN(3,("uhci port %d reset, status0 = 0x%04x\n",
|
|
|
|
index, UREAD2(sc, port)));
|
|
|
|
|
|
|
|
x = URWMASK(UREAD2(sc, port));
|
|
|
|
UWRITE2(sc, port, x & ~UHCI_PORTSC_PR);
|
|
|
|
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
DPRINTFN(3,("uhci port %d reset, status1 = 0x%04x\n",
|
|
|
|
index, UREAD2(sc, port)));
|
|
|
|
|
|
|
|
x = URWMASK(UREAD2(sc, port));
|
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_PE);
|
|
|
|
|
|
|
|
for (lim = 10; --lim > 0;) {
|
|
|
|
usb_delay_ms(&sc->sc_bus, USB_PORT_RESET_DELAY);
|
|
|
|
|
|
|
|
x = UREAD2(sc, port);
|
|
|
|
|
|
|
|
DPRINTFN(3,("uhci port %d iteration %u, status = 0x%04x\n",
|
|
|
|
index, lim, x));
|
|
|
|
|
|
|
|
if (!(x & UHCI_PORTSC_CCS)) {
|
|
|
|
/*
|
|
|
|
* No device is connected (or was disconnected
|
|
|
|
* during reset). Consider the port reset.
|
|
|
|
* The delay must be long enough to ensure on
|
|
|
|
* the initial iteration that the device
|
|
|
|
* connection will have been registered. 50ms
|
|
|
|
* appears to be sufficient, but 20ms is not.
|
|
|
|
*/
|
|
|
|
DPRINTFN(3,("uhci port %d loop %u, device detached\n",
|
|
|
|
index, lim));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x & (UHCI_PORTSC_POEDC | UHCI_PORTSC_CSC)) {
|
|
|
|
/*
|
|
|
|
* Port enabled changed and/or connection
|
|
|
|
* status changed were set. Reset either or
|
|
|
|
* both raised flags (by writing a 1 to that
|
|
|
|
* bit), and wait again for state to settle.
|
|
|
|
*/
|
|
|
|
UWRITE2(sc, port, URWMASK(x) |
|
|
|
|
(x & (UHCI_PORTSC_POEDC | UHCI_PORTSC_CSC)));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x & UHCI_PORTSC_PE)
|
|
|
|
/* Port is enabled */
|
|
|
|
break;
|
|
|
|
|
|
|
|
UWRITE2(sc, port, URWMASK(x) | UHCI_PORTSC_PE);
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINTFN(3,("uhci port %d reset, status2 = 0x%04x\n",
|
|
|
|
index, UREAD2(sc, port)));
|
|
|
|
|
|
|
|
if (lim <= 0) {
|
|
|
|
DPRINTFN(1,("uhci port %d reset timed out\n", index));
|
|
|
|
return (USBD_TIMEOUT);
|
|
|
|
}
|
2003-07-14 18:42:58 +00:00
|
|
|
|
2003-07-14 18:07:54 +00:00
|
|
|
sc->sc_isreset = 1;
|
|
|
|
return (USBD_NORMAL_COMPLETION);
|
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/*
|
|
|
|
* Simulate a hardware hub by handling all the necessary requests.
|
|
|
|
*/
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_ctrl_transfer(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
/*
|
2002-01-03 02:10:31 +00:00
|
|
|
* Pipe isn't running (otherwise err would be USBD_INPROG),
|
|
|
|
* so start it first.
|
1999-11-17 22:33:51 +00:00
|
|
|
*/
|
|
|
|
return (uhci_root_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-10-07 19:26:38 +00:00
|
|
|
}
|
1999-01-07 23:07:57 +00:00
|
|
|
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_ctrl_start(usbd_xfer_handle xfer)
|
1999-08-17 07:36:34 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
|
1999-10-07 19:26:38 +00:00
|
|
|
usb_device_request_t *req;
|
|
|
|
void *buf = NULL;
|
|
|
|
int port, x;
|
1999-11-17 22:33:51 +00:00
|
|
|
int s, len, value, index, status, change, l, totlen = 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
usb_port_status_t ps;
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_status err;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-01-21 03:35:55 +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))
|
2003-07-04 23:11:13 +00:00
|
|
|
panic("uhci_root_ctrl_transfer: not a request");
|
1999-10-07 19:26:38 +00:00
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
req = &xfer->request;
|
1998-11-26 23:13:13 +00:00
|
|
|
|
2002-02-03 17:03:34 +00:00
|
|
|
DPRINTFN(2,("uhci_root_ctrl_control type=0x%02x request=%02x\n",
|
1998-11-26 23:13:13 +00:00
|
|
|
req->bmRequestType, req->bRequest));
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
len = UGETW(req->wLength);
|
1998-11-26 23:13:13 +00:00
|
|
|
value = UGETW(req->wValue);
|
|
|
|
index = UGETW(req->wIndex);
|
1999-08-17 07:36:34 +00:00
|
|
|
|
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-11-26 23:13:13 +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-11-26 23:13:13 +00:00
|
|
|
* for the integrated root hub.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
case C(UR_GET_CONFIG, UT_READ_DEVICE):
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len > 0) {
|
1998-11-26 23:13:13 +00:00
|
|
|
*(u_int8_t *)buf = sc->sc_conf;
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 1;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
|
|
|
|
DPRINTFN(2,("uhci_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;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
|
|
|
|
USETW(uhci_devd.idVendor, sc->sc_id_vendor);
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &uhci_devd, l);
|
|
|
|
break;
|
|
|
|
case UDESC_CONFIG:
|
|
|
|
if ((value & 0xff) != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = l = min(len, USB_CONFIG_DESCRIPTOR_SIZE);
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &uhci_confd, l);
|
|
|
|
buf = (char *)buf + l;
|
1999-10-07 19:26:38 +00:00
|
|
|
len -= l;
|
|
|
|
l = min(len, USB_INTERFACE_DESCRIPTOR_SIZE);
|
|
|
|
totlen += l;
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &uhci_ifcd, l);
|
|
|
|
buf = (char *)buf + l;
|
1999-10-07 19:26:38 +00:00
|
|
|
len -= l;
|
|
|
|
l = min(len, USB_ENDPOINT_DESCRIPTOR_SIZE);
|
|
|
|
totlen += l;
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &uhci_endpd, l);
|
|
|
|
break;
|
|
|
|
case UDESC_STRING:
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len == 0)
|
1998-11-26 23:13:13 +00:00
|
|
|
break;
|
|
|
|
*(u_int8_t *)buf = 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 1;
|
1998-11-26 23:13:13 +00:00
|
|
|
switch (value & 0xff) {
|
|
|
|
case 1: /* Vendor */
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = uhci_str(buf, len, sc->sc_vendor);
|
1998-11-26 23:13:13 +00:00
|
|
|
break;
|
|
|
|
case 2: /* Product */
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = uhci_str(buf, len, "UHCI root hub");
|
1998-11-26 23:13:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len > 0) {
|
1998-11-26 23:13:13 +00:00
|
|
|
*(u_int8_t *)buf = 0;
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 1;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_DEVICE):
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len > 1) {
|
1998-11-26 23:13:13 +00:00
|
|
|
USETW(((usb_status_t *)buf)->wStatus,UDS_SELF_POWERED);
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 2;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_INTERFACE):
|
|
|
|
case C(UR_GET_STATUS, UT_READ_ENDPOINT):
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len > 1) {
|
1998-11-26 23:13:13 +00:00
|
|
|
USETW(((usb_status_t *)buf)->wStatus, 0);
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 2;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
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;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
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;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
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;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
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(3, ("uhci_root_ctrl_control: UR_CLEAR_PORT_FEATURE "
|
|
|
|
"port=%d feature=%d\n",
|
1998-11-26 23:13:13 +00:00
|
|
|
index, value));
|
|
|
|
if (index == 1)
|
|
|
|
port = UHCI_PORTSC1;
|
|
|
|
else if (index == 2)
|
|
|
|
port = UHCI_PORTSC2;
|
|
|
|
else {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
switch(value) {
|
|
|
|
case UHF_PORT_ENABLE:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x & ~UHCI_PORTSC_PE);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_SUSPEND:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x & ~UHCI_PORTSC_SUSP);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_RESET:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x & ~UHCI_PORTSC_PR);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_CONNECTION:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_CSC);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_ENABLE:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_POEDC);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_OVER_CURRENT:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_OCIC);
|
|
|
|
break;
|
|
|
|
case UHF_C_PORT_RESET:
|
|
|
|
sc->sc_isreset = 0;
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_NORMAL_COMPLETION;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
case UHF_PORT_CONNECTION:
|
|
|
|
case UHF_PORT_OVER_CURRENT:
|
|
|
|
case UHF_PORT_POWER:
|
|
|
|
case UHF_PORT_LOW_SPEED:
|
|
|
|
case UHF_C_PORT_SUSPEND:
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_BUS_STATE, UT_READ_CLASS_OTHER):
|
|
|
|
if (index == 1)
|
|
|
|
port = UHCI_PORTSC1;
|
|
|
|
else if (index == 2)
|
|
|
|
port = UHCI_PORTSC2;
|
|
|
|
else {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len > 0) {
|
2002-02-03 17:03:34 +00:00
|
|
|
*(u_int8_t *)buf =
|
1998-11-26 23:13:13 +00:00
|
|
|
(UREAD2(sc, port) & UHCI_PORTSC_LS) >>
|
|
|
|
UHCI_PORTSC_LS_SHIFT;
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = 1;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
|
2004-05-23 11:43:34 +00:00
|
|
|
if ((value & 0xff) != 0) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
l = min(len, USB_HUB_DESCRIPTOR_SIZE);
|
|
|
|
totlen = l;
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &uhci_hubd_piix, l);
|
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len != 4) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
memset(buf, 0, len);
|
|
|
|
totlen = len;
|
1998-11-26 23:13:13 +00:00
|
|
|
break;
|
|
|
|
case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
|
|
|
|
if (index == 1)
|
|
|
|
port = UHCI_PORTSC1;
|
|
|
|
else if (index == 2)
|
|
|
|
port = UHCI_PORTSC2;
|
|
|
|
else {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-10-07 19:26:38 +00:00
|
|
|
if (len != 4) {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
x = UREAD2(sc, port);
|
|
|
|
status = change = 0;
|
2002-01-03 02:10:31 +00:00
|
|
|
if (x & UHCI_PORTSC_CCS)
|
1998-11-26 23:13:13 +00:00
|
|
|
status |= UPS_CURRENT_CONNECT_STATUS;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_CSC)
|
1998-11-26 23:13:13 +00:00
|
|
|
change |= UPS_C_CONNECT_STATUS;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_PE)
|
1998-11-26 23:13:13 +00:00
|
|
|
status |= UPS_PORT_ENABLED;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_POEDC)
|
1998-11-26 23:13:13 +00:00
|
|
|
change |= UPS_C_PORT_ENABLED;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_OCI)
|
1998-11-26 23:13:13 +00:00
|
|
|
status |= UPS_OVERCURRENT_INDICATOR;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_OCIC)
|
1998-11-26 23:13:13 +00:00
|
|
|
change |= UPS_C_OVERCURRENT_INDICATOR;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_SUSP)
|
1998-11-26 23:13:13 +00:00
|
|
|
status |= UPS_SUSPEND;
|
2002-02-03 17:03:34 +00:00
|
|
|
if (x & UHCI_PORTSC_LSDA)
|
1998-11-26 23:13:13 +00:00
|
|
|
status |= UPS_LOW_SPEED;
|
|
|
|
status |= UPS_PORT_POWER;
|
|
|
|
if (sc->sc_isreset)
|
|
|
|
change |= UPS_C_PORT_RESET;
|
|
|
|
USETW(ps.wPortStatus, status);
|
|
|
|
USETW(ps.wPortChange, change);
|
1999-10-07 19:26:38 +00:00
|
|
|
l = min(len, sizeof ps);
|
1998-11-26 23:13:13 +00:00
|
|
|
memcpy(buf, &ps, l);
|
1999-10-07 19:26:38 +00:00
|
|
|
totlen = l;
|
1998-11-26 23:13:13 +00:00
|
|
|
break;
|
|
|
|
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
|
|
|
|
break;
|
|
|
|
case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
|
|
|
|
if (index == 1)
|
|
|
|
port = UHCI_PORTSC1;
|
|
|
|
else if (index == 2)
|
|
|
|
port = UHCI_PORTSC2;
|
|
|
|
else {
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
switch(value) {
|
|
|
|
case UHF_PORT_ENABLE:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_PE);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_SUSPEND:
|
2002-01-03 00:46:47 +00:00
|
|
|
x = URWMASK(UREAD2(sc, port));
|
1998-11-26 23:13:13 +00:00
|
|
|
UWRITE2(sc, port, x | UHCI_PORTSC_SUSP);
|
|
|
|
break;
|
|
|
|
case UHF_PORT_RESET:
|
2003-07-14 18:07:54 +00:00
|
|
|
err = uhci_portreset(sc, index);
|
|
|
|
goto ret;
|
2000-08-13 18:21:18 +00:00
|
|
|
case UHF_PORT_POWER:
|
|
|
|
/* Pretend we turned on power */
|
|
|
|
err = USBD_NORMAL_COMPLETION;
|
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
case UHF_C_PORT_CONNECTION:
|
|
|
|
case UHF_C_PORT_ENABLE:
|
|
|
|
case UHF_C_PORT_OVER_CURRENT:
|
|
|
|
case UHF_PORT_CONNECTION:
|
|
|
|
case UHF_PORT_OVER_CURRENT:
|
|
|
|
case UHF_PORT_LOW_SPEED:
|
|
|
|
case UHF_C_PORT_SUSPEND:
|
|
|
|
case UHF_C_PORT_RESET:
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1999-11-17 22:33:51 +00:00
|
|
|
err = USBD_IOERROR;
|
1999-10-07 19:26:38 +00:00
|
|
|
goto ret;
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->actlen = totlen;
|
|
|
|
err = USBD_NORMAL_COMPLETION;
|
1999-10-07 19:26:38 +00:00
|
|
|
ret:
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer->status = err;
|
|
|
|
s = splusb();
|
|
|
|
usb_transfer_complete(xfer);
|
|
|
|
splx(s);
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_IN_PROGRESS);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Abort a root control request. */
|
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_ctrl_abort(usbd_xfer_handle xfer)
|
1998-11-26 23:13:13 +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
|
|
|
/* Nothing to do, all transfers are synchronous. */
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Close the root pipe. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_ctrl_close(usbd_pipe_handle pipe)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_root_ctrl_close\n"));
|
|
|
|
}
|
1999-08-17 07:36:34 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Abort a root interrupt request. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_intr_abort(usbd_xfer_handle xfer)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
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(sc->sc_poll_handle, uhci_poll_hub, xfer);
|
|
|
|
sc->sc_intr_xfer = NULL;
|
2002-04-07 18:33:12 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
if (xfer->pipe->intrxfer == xfer) {
|
|
|
|
DPRINTF(("uhci_root_intr_abort: remove\n"));
|
|
|
|
xfer->pipe->intrxfer = 0;
|
|
|
|
}
|
|
|
|
xfer->status = USBD_CANCELLED;
|
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
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
UXFER(xfer)->iinfo.isdone = 1;
|
|
|
|
#endif
|
1999-11-17 22:33:51 +00:00
|
|
|
usb_transfer_complete(xfer);
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_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;
|
1999-10-07 19:26:38 +00:00
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
/* Insert last in queue. */
|
|
|
|
err = usb_insert_transfer(xfer);
|
|
|
|
if (err)
|
|
|
|
return (err);
|
|
|
|
|
2003-07-04 01:50:39 +00:00
|
|
|
/*
|
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
|
|
|
* Pipe isn't running (otherwise err would be USBD_INPROG),
|
|
|
|
* so start it first.
|
1999-11-17 22:33:51 +00:00
|
|
|
*/
|
|
|
|
return (uhci_root_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue)));
|
1999-01-07 23:07:57 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Start a transfer on the root interrupt pipe */
|
|
|
|
usbd_status
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_intr_start(usbd_xfer_handle xfer)
|
1999-10-07 19:26:38 +00:00
|
|
|
{
|
1999-11-17 22:33:51 +00:00
|
|
|
usbd_pipe_handle pipe = xfer->pipe;
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
|
|
|
|
|
2003-07-14 18:56:33 +00:00
|
|
|
DPRINTFN(3, ("uhci_root_intr_start: xfer=%p len=%d flags=%d\n",
|
1999-11-17 22:33:51 +00:00
|
|
|
xfer, xfer->length, xfer->flags));
|
1999-10-07 19:26:38 +00:00
|
|
|
|
2002-01-21 03:35:55 +00:00
|
|
|
if (sc->sc_dying)
|
|
|
|
return (USBD_IOERROR);
|
|
|
|
|
1999-11-17 22:33:51 +00:00
|
|
|
sc->sc_ival = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
|
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(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
|
|
|
|
sc->sc_intr_xfer = xfer;
|
1999-10-07 19:26:38 +00:00
|
|
|
return (USBD_IN_PROGRESS);
|
|
|
|
}
|
1998-11-26 23:13:13 +00:00
|
|
|
|
1999-10-07 19:26:38 +00:00
|
|
|
/* Close the root interrupt pipe. */
|
1998-11-26 23:13:13 +00:00
|
|
|
void
|
2000-08-01 22:40:23 +00:00
|
|
|
uhci_root_intr_close(usbd_pipe_handle pipe)
|
1998-11-26 23:13:13 +00:00
|
|
|
{
|
1999-10-07 19:26:38 +00:00
|
|
|
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
|
1999-08-17 07:36:34 +00:00
|
|
|
|
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(sc->sc_poll_handle, uhci_poll_hub, sc->sc_intr_xfer);
|
|
|
|
sc->sc_intr_xfer = NULL;
|
1999-10-07 19:26:38 +00:00
|
|
|
DPRINTF(("uhci_root_intr_close\n"));
|
1998-11-26 23:13:13 +00:00
|
|
|
}
|