revision 1.101
date: 2001/02/20 15:20:32; author: minoura;
Re-initialize some registers after resuming from suspend.
Some APM BIOSes do not restore them.
Reviewd by augustss.
revision 1.97
date: 2000/12/31 14:29:54; author: augustss; state: Exp; lines: +17 -3
Make the controller survive suspend/resume. Thanks to Steve Woodford
<steve@mctavish.co.uk> for testing.
revision 1.95
date: 2000/12/13 03:09:06; author: augustss; state: Exp; lines: +19 -3
Make the ohci driver not hang suspend/resume. It still doesn't resume
correctly. From itohy@netbsd.org (ITOH Yasufumi) PR kern/11714.
usbdi.c (1.86), usbdivar.h (1.66)
[Some partial, because most of this was merged in a while ago]
date: 2001/11/20 13:48:03; author: augustss;
Keep track of device speed for USB 2.0.
revision 1.106
date: 2001/11/09 15:01:57; author: augustss; state: Exp; lines: +73 -57
Fix a bug in xfer abort processing when the HC executes ahead of what
the driver aborts.
Don't block RHSC interrupts.
revision 1.103
date: 2001/09/11 07:00:19; author: augustss; state: Exp; lines: +4 -1
Don't go top mode OPERATIONAL (before reset) on startup even
if BIOS claims to have initialized the controller.
(1.39), usbdi.c (1.79), usbdi.h (1.47), usbdivar.h (1.62)
date: 2001/01/21 02:39:52; author: augustss;
Add code to use soft interrupt to handle USB interrupt processing.
Don't enable the code since it doesn't work with the kludgy Ethernet
drivers.
date: 2000/08/08 19:51:46; author: tv; state: Exp; lines: +24 -13
%b -> bitmask_snprintf()
Because this code is shared, add a macro for bitmask_snprintf()
that should expand to the equivalent snprintf() on non-NetBSD
systems. This is only used in ?HCI_DEBUG cases anyway.
ohci.c (1.85), ohcireg.h (1.17):
----------------------------
date: 2000/04/01 09:27:35; author: augustss;
Add a delay before reading the number of ports from the controller to
avoid getting 0 from it.
----------------------------
ohci.c (1.83), ohcireg.h (1.16), ohcivar.h (1.21)
===================================================================
date: 2000/03/29 01:46:26; author: augustss;
A first stab at support for isochronous transfers.
===================================================================
ohcivar.h (1.22), uhcivar.h (1.29):
============================================================
date: 2000/04/25 09:20:55; author: augustss;
Move the size of the mapped bus_space region into the bus
independent softc.
============================================================
ohci.c (1.88), uhci.c (1.112):
============================================================
date: 2000/04/25 14:28:13; author: augustss;
Insert (very conservative!) bus_space_barrier() calls at
all register accesses.
The bus_space(9) man page says you've gotta have them...
============================================================
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.
===================================================================
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):
- bwap16() and bswap32(). These have optimized implementations on some
architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
versa, using a naming scheme like le16toh(), htole16().
These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
conversion (while the normal access functions would if the bus endianess
differs from the CPU endianess).
htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.
Make use of the new functions in a few places where local implementations
of the same functionality existed.
Reviewed by: mike, bde
Tested on alpha by: mike
1/ conditionalise (#if 0) function that is not used.
Unused code left in place for netBSD compatibility.
2/ Recode loop to convince gcc that it does initialise a variable
(use do-while instead of for() so gcc knows that we always go through
at least once. Feel free to check my logic.
ohci.c: revision 1.72 and 1.73
ohcivar.h: revision 1.19 and 1.20
uhci.c: revision 1.85
usbdi.h: a small part of revision 1.40
usbdivar.h: revision 1.47
Relevant commit messages from NetBSD are:
date: 2000/02/22 11:30:54; author: augustss; state: Exp;
Prepare a little for having USB interrupt processing done
outside the hard interrupt level (in a thread or a softintr).
No real soft processing done yet.
----------------------------
date: 2000/02/01 05:42:53; author: augustss; state: Exp;
Put some #ifdefs around power and shutdown hooks.
ohci.c: -r1.69 to 1.71
ohcireg.h: -r1.14
Some of these deltas are based upon patches that we submitted back to
NetBSD. They got manifested slightly differently though, so I've brought
back those differences to bring our code bases closer together.
The logs from the NetBSD version of ohci.c:
revision 1.71
date: 2000/02/01 05:42:52; author: augustss; state: Exp; lines: +13 -2
Put some #ifdefs around power and shutdown hooks.
----------------------------
revision 1.70
date: 2000/01/31 22:35:13; author: augustss; state: Exp; lines: +7 -7
Rename TAILMASK to HEADMASK, since it really masks the head pointer.
From FreeBSD.
----------------------------
revision 1.69
date: 2000/01/31 22:09:13; author: augustss; state: Exp; lines: +18 -14
Change where the has table for physical-to-virtual address translation
is handled. Partly from FreeBSD.
ohci.c: -r1.68
ohcireg.h: -r1.13
date: 2000/01/31 20:17:25; author: augustss; state: Exp;
Fiddle with over-current protect when turning on port power to make
things work for some OHCI controllers.
date: 2000/02/29 21:37:01; author: augustss; state: Exp;
Distinguish between device and interface classes.
(I finally found a document that said that they were different.)
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
interrupt threads to run with it always >= 1, so that malloc can
detect M_WAITOK from "interrupt" context. This is also necessary
in order to context switch from sched_ithd() directly.
Reviewed By: peter
<sys/proc.h> to <sys/systm.h>.
Correctly document the #includes needed in the manpage.
Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
This makes it possible to handle the done queue even when the end of tail
TD has ended up on the done queue as well (the xfer in this case is NULL
but the next field is valid, so we simply skip that element.
Make sure we mark all the handled transfers as handled.
Stop using powerhooks. They are a NetBSD-ism.
problem was basically (for offset > 4096):
vtophys(addr) + offset != vtophys(addr + offset)
Also, use TD's with a maximum size of 4k instead of 8kb for OHCI
controllers.
This problem occurs in drivers that use large transfer sizes:
umass, host2host and ethernet with jumbo frames.
Some controllers submit bogus pointers to the Done queue.
ohci_hash_find_td fails to find these in its hash and panics. Instead of
panicing we now assume the whole done queue is lost and let the timeout
code to clean up the mess after us.
- 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.
- more req[uest]->xfer changes.
- get the corresponding NetBSD Id's right
ohci.c
- move untimeout above print statement
- remove usb_delay that panics the system (tsleep in intr context) when
ohcidebug > 5.
ugen.c
- create the devices for endpoints with make_dev.
uhub.c
- change from using usbdebug to uhubdebug
- add more debugging statements
Cleaning up the code:
- Declare many functions static
- Change variable names to make them more self explanatory
- Change usbd_request_handle -> usbd_xfer_handle
- Syntactical changes
- Remove some unused code
- Other KNF changes
Interrupt context handling
- Change delay to usbd_delay_ms were possible (takes polling mode into
account)
- Change detection mechanism for interrupt context
Add support for pre-allocation DMA-able memory by device driver
Add preliminary support for isochronous to the UHCI driver (not for OHCI
yet).
usb.c, uhci.c, ohci.c
- Initial attempt at detachable USB host controllers
- Handle the use_polling flag with a lttle more care and only set it if
we are cold booting.
usb.c, uhci.c ohci.c, usbdi.c usbdi_util.c usb_subr.c
- Make sure an aborted pipe is marked as not running.
- Start queued request in the right order.
- Insert some more DIAGNOSTIC sanity checks.
- Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN.
usb.c, usb_subr.c
- Add an event mechanism so that a userland process can watch devices
come and go.
ohci.c
- Handle the case when a USB transfer is so long that it crosses two
page (4K) boundaries. OHCI cannot do that with a single TD so we make
a chain.
ulpt.c
- Use a bigger buffer when transferring data.
- Pre-allocate the DMA buffer. This makes the driver slightly more
efficient.
- Comment out the GET_DEVICE_ID code, because for some unknown reason it
causes printing to fail sometimes.
usb.h
- Add a macro to extract the isoc type.
- Add a macro to check whether the routine has been entered after splusb
and if not, complain.
usbdi.c
- Fix a glitch in dequeueing and aborting requests on interrupt pipes.
- Add a flag in the request to determine if the data copying is done by
the driver or the usbdi layer.
- Some cleanup and improvements in the uhci and ohci drivers
- Support for plugging and unplugging devices improved
- Now available is bulk transport over OHCI controllers
- Resume and suspend have been temporarily been disabled again. Proper
support for it is available in the uhci.c and ohci.c files but I have
not yet spent the brain cycles to use it.
- OpenBSD now uses the USB stack as well
- Add FreeBSD tags
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.
(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)
This is a checkpoint of work-in-progress, but is quite functional.
The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.
Approved by: core
2) create function usbd_errstr which turns a usbd_status into a sensible
error message
3) Change the printf in DPRINTF to logprintf which is a define for
log(KERN_DEBUG, x)
memory address space rather than IO space.. reflect this when looking for the
interface revision register.
If this is not true for them all then we probably need some smarter code.