Commit Graph

199 Commits

Author SHA1 Message Date
jmcneill 1706b83ae7 aprint-ify. 2009-09-01 21:46:07 +00:00
cegger 217d969936 Initialize callout and lists before we check for errors.
This fixes crashes in ohci_detach() when ohci_init() failed.
2009-04-18 06:27:17 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
drochner fdb6ecdb00 free memory on detach, fixes memory leak, from Andreas Jacobs per
PR kern/39322
2008-08-13 09:43:56 +00:00
bouyer efe8b350b3 Add appropriate bus_dmamap_sync() calls to uhci(4), ohci(4) and ehci(4),
as proposed on tech-kern@.
While all DMA memory used in the USB framework is mapped BUS_DMAMAP_COHERENT
(including data memory, which is memcpy'd from/to USB-private buffers),
the CPU can reorder loads or stores from/to main memory, causing the
controller to have an incoherent view of the DMA descriptors lists for a
short time. bus_dmamap_sync() should contain memory barriers that prevents
the CPU from reordering load/store. Note that BUS_DMAMAP_COHERENT is
still required for the DMA descriptor lists - these can't work properly
with software cache coherency.
This fixes "host controller process error/host controller halted" errors
I'm occasionally seeing with a umodem device on uhci on x86.
Thanks to Michael Lorenz for testing it on his O2, and Izumi Tsutsui on
his Cobalt Qube 2700.
2008-06-28 17:42:53 +00:00
nonaka 0591571b21 Added missing splx() at ohci_resume(). 2008-06-04 12:38:58 +00:00
drochner 26a4d5b843 fix argument to usb_setup_reserve() (called from USB host adapter drivers)
to be device_t consistently, from Quentin Garnier
2008-05-21 17:19:44 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
nakayama 136678d875 Fix ohci brokenness in previous commit. 2008-03-29 02:20:41 +00:00
drochner fd0ded75ed split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
2008-03-28 17:14:45 +00:00
dyoung 347c1a2644 Use device_t and accessors.
In ohci_{pci,cardbus}_attach, do not get the device_t by casting
the softc to void *, but use `self' instead.
2008-03-07 21:48:46 +00:00
dyoung 2e3b67d337 Register the shutdown hook using pmf_device_register1(). 2008-03-07 21:36:51 +00:00
dyoung 1fa24f5705 Add method to detach children.
Temporary: use PMF_FN_PROTO, PMF_FN_ARGS.
2008-02-22 22:22:27 +00:00
drochner d9459c5f21 share some code for USB root hub emulation which is common in the 3
host controller implementations, start with two little functions
which fake up string descriptors (which were inconststent, language
table fetching didn't interoperate with other code in the tree)
2008-02-03 10:57:11 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
kiyohara 2db72b9118 * splsoftusb, IPL_SOFTUSB, and IPL_HARDUSB defines in usbdi.h
-> the current names are confusing (didn't change other drivers)
* fix invalid memory access in usbd_transfer (kern/24636)
-> needed for this driver
* fix USB HC detach race condition (kern/32011)
-> main patch needed for this driver, sc_dying changes in other drivers
not necessary but seem right to me

Patch from Matthew Orgass.
  http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
2007-08-15 04:00:33 +00:00
drochner 8fd98300b1 -in root hub emulation, return a sane value as language code
-constify "methods" tables and (partly) descriptor templates
2007-02-26 13:26:45 +00:00
mlelstv 1fb16b2557 The diagnostic code doesn't track busy_free correctly when a
device gets removed. However, when the diagnostic check fails,
it is much better to complete the free operation than to abort
it, because this just causes an infinite loop.
2007-02-10 07:52:29 +00:00
drochner 60e1a2a1cb Kill the "bus powered" bit in the configuration descriptor. This doesn't
exist in newer spec revisions, and is recommended to be set to 1.
So call it _MBO and also use it in the fake root hub descriptors, just
for sanity, even if nothing ever looks at it.
2007-01-19 22:46:21 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
joerg 8934eeb830 Split the USB task queue into two parts, one for normal device tasks and
one for tasks of the host controllers. This is needed for drivers like
ural(4) that want to do synchronous USB transfers from the task handler.
Before the split timeouts could not be handled correctly as the task
thread was still blocked. From FreeBSD.
2006-10-31 20:43:31 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
jmcneill f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
christos db87199efc use c99 initializers 2006-09-03 07:06:39 +00:00
mrg 0337fbac37 make [OU]READ[124]() real inline functions instead of macros. 2006-05-12 01:25:00 +00:00
christos de067efed8 Revert previous panic change, I'll fix it differently. 2006-04-15 01:07:51 +00:00
christos 24da938ec7 Coverity CID 1115: It is quite pointless to have a DIAGNOSTIC panic that
checks a variable for being NULL, and if we are not in DIAGNOSTIC code, to
just dereference it causing a crash!
2006-04-14 17:07:23 +00:00
christos d8ff0a7b54 Coverity CID 1132: avoid NULL derefs. 2006-04-14 17:04:06 +00:00
christos 162bcf9406 If dying, return after doing the software part [as noted in the comment
but not done]. Pointed out by Greg Troxel.
2006-03-30 19:08:31 +00:00
tron 378a8ea134 Make OHCI work on Au1500 systems running in big-endian mode.
Patch contributed by Garrett D'Amore in PR port-evbmips/31912.
2005-12-19 21:57:27 +00:00
augustss 88f620ab3d Make it possible to decide endianess dynamically. From port-evbmips/31912
by "Garrett D'Amore" <garrett_damore@tadpole.com>.
2005-11-14 13:40:23 +00:00
augustss 7dd02394b7 Make sure we don't enable host controller interrupts until all
initialization is finished.
2005-07-18 11:08:00 +00:00
drochner 31924c84cd cast-qual fallout 2005-05-31 19:20:37 +00:00
skrll 35de2b7d10 Fix interrupt out transfers.
Reviewed by Lennart.
2005-05-28 07:44:37 +00:00
augustss cfff5f5e7a Only look at USBD_FORCE_SHORT_XFER for writes. 2005-05-08 08:12:08 +00:00
augustss 77e2a0a080 In eohci_waitintr, xfer->timeout is in ms, not hz.
From OpenBSD.
2005-05-01 01:14:30 +00:00
augustss 7beafdee3a Fix some spelling errors.
From OpenBSD.
2005-05-01 01:10:06 +00:00
augustss 31e5d222f7 Preserve any configuration data that may have been set by SMM/BIOS over
chip reset.

From OpenBSD.
2005-05-01 01:03:11 +00:00
augustss e556a8eca4 If the SMM driver had enabled ownership change interrupts, re-enable them
temporarily before we attempt to take control.

From OpenBSD.
2005-05-01 00:45:55 +00:00
augustss 5b3acf742e Fix a race condition in xfer abort. Derived from a FreeBSD patch.
An xfer could be aborted twice (which means that the second abort might
access deallocated memory).  This happened when an xfer timed out and
the timeout started an abort.  While that abort was taking place the
xfer could be cancelled (usually by closing the pipe), causing a second
abort to begin.
This is now handled by having flags indicating the abort state of an xfer.

Hopefully this will fix the occasional crashes when printing.
2005-04-30 14:38:40 +00:00
toshii 2db3ae3497 Correct status value check for OHCI isoc transfer;
the spec says that "not accessed" is 111x, not 1111.
2005-04-17 14:46:49 +00:00
mycroft e63d9a6eae Restructure interrupt handling a little:
* Only futz with the done list in the soft interrupt handler.  In the hard
  interrupt handler, do nothing except mask WDH and queue the soft interrupt.
  This simplifies a bunch of code, removes two O(n^2) queue manipulations,
  and gets rid of some really sketchy stuff around the queue head access.
* Use the auto-masking code at the end of the interrupt handler for both WDH
  and RHSC interrupts.  Again, this reduces the code a little, and avoids
  multiple writebacks to the chip registers.
2005-03-11 19:25:22 +00:00
mycroft 2d562a01e2 Copyright maintenance. 2005-03-02 11:37:27 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
joff 330c69ca0e Make sure to ack the interrupt even if we are ignoring it. Otherwise, we will
keep coming back.
2004-12-22 19:36:13 +00:00
fvdl a3cea30b50 Implement an USB memory reserve. Allocate some memory per host controller
in the wanted bus_dma space. If an allocation fails during operation
(i.e. when hotplugging an umass device), fall back to using the reserve.

The amount can be configured as USB_MEM_RESERVE. The default value is
256k.

Ideally, there would be a way to steal pages in the desired area from
UVM, but that's far more complicated, and this is not intrusive, plus
it works.
2004-12-21 16:41:24 +00:00
augustss d32a749096 Allow strings descriptor 0 to be fetched. It's the default language index. 2004-10-26 20:46:16 +00:00
mycroft 584d70dbc1 Avoid touching the xfer after calling usb_transfer_complete(), as the
driver callback may have recycled it.  From PR 25960.
2004-07-17 20:24:15 +00:00
mycroft b48bbc8b8a Fix an error in a printf() format.
Swap the order that two items are written; possibly fixes a race condition
that would affect isoc transfers.
2004-07-06 04:53:09 +00:00