Commit Graph

125 Commits

Author SHA1 Message Date
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
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +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
drochner bd2757a152 Remove the code which disables port status change interrupts for 1s
when one occured -- this makes that events get lost (or delayed until
the next change), in particular in the handover process from the EHCI
to a companion controller, laeving the port dead under some circumstances.
This fixes the "can't reconnect" symptom for me.
I don't see why the interrupt should be disabled - it is acknowledged
in the interrupt handler and shouldn't be active again until the next
status change.
2007-01-07 16:44:44 +00:00
drochner bdd5b724b5 in the interrupt endpoint descriptor of the simulated root hub, fix the
poll interval: since this is a highspeed device, it should be a "12"
(just for sanity; this stuff is not used by the kernel, only userland
usb exploration code might see it)
2006-11-30 16:25:28 +00:00
drochner 0b5d054c71 Remove the code which tried to guess the toggle bit after a short
transfer. It was wrong because it didn't consider block boundaries.
Instead, use the updated toggle from the transfer descriptor -- this
is supposedly cheaper than modulo arithmetics.
This fixes a problem similar to PR kern/34070 for me.
2006-11-28 20:58:12 +00:00
drochner 30cf9aac05 -fix interpretation of the poll interval in interrupt descriptors for
USB2/highspeed: This is an exponent now, not milliseconds.
 (There are wrong example descriptors for hubs in the USB2 spec; tolerate
  invalid values and assume 256ms which is good for hubs, just in case
  someone blindly copied from the book.)
-being here, fix an obvious memory leak
2006-11-22 21:10:36 +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 16f3fda8be fix incomplete initializers 2006-08-30 00:42:41 +00:00
blymn 3a0170518a Clean up bogus whitespace 2006-05-28 13:12:42 +00:00
christos 9a52196c1d Coverity CID 1131: Avoid NULL pointer dereference. 2006-04-14 17:27:08 +00:00
xtraeme e2aca22c8e From OpenBSD:
--
Add a workaround for VIA EHCI controllers which, under load, signal qTD
completion before they have performed writeback from the overlay qTD.

This condition would exhibit itself as a umass stall that never recovers.
--

This fixes the problem reported by Thomas Klausner on current-users@:
http://mail-index.netbsd.org/current-users/2006/01/17/0000.html
2006-01-17 12:30:00 +00:00
augustss 4bc39eaf86 Make the unused ehci_dump() function non-static. 2005-11-21 10:15:41 +00:00
augustss 992297a008 Keep a flag for each port that keeps track of if the port has been reset
instead of having one flag for the controller.

Also, don't try to modify read-only power bits if the controller doesn't
support power cobntrol.
2005-11-20 14:27:25 +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
christos a9cf21849d - const poisoning
- eliminate variable shadowing
2005-05-30 04:21:39 +00:00
augustss 3fefd3b866 Make sure all physical addresses are filled in the qTD even when we have
a page offset.

From Dan Ellis (as was the previous fix).
2005-05-05 20:54:34 +00:00
augustss 9a2e60d4f6 Make sure to honor the USBD_FORCE_SHORT_XFER flag and generate an empty
transfer when necessary.
2005-05-05 20:40:20 +00:00
wiz fbd2fc5eca Fix typo. 2005-05-01 21:47:11 +00:00
augustss 649ae4a707 Update TODO comment and copyright. 2005-05-01 19:45:40 +00:00
augustss 9c5fb57b96 Only complain when opening full speed isoc devices, other types seem to
work reasonably (even if there is no proper scheduling of the TT yet).
2005-05-01 19:35:07 +00:00
augustss 6aae573fe5 Fix the error check on completion of an xfer. Just because the qTD status
field has error bits set doesn't mean there has been an error, unless the
HALTED bit is set as well.  The old behaviour could result in a transfer
being considered failed by the software, but a success by the device.
This seems to have affected mostly mass storage devices.

Pointed out by Dan Ellis in kern/29731.
2005-05-01 19:24:39 +00:00
augustss 5adcc3d063 Timeout while polling is in ms not ticks.
From OpenBSD.
2005-05-01 14:21:27 +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
augustss abcf879dd7 Get bit reversal table right this time. 2005-04-27 23:39:54 +00:00
augustss c3aad684bd Interrupt polling was spread very unevenly. Use the same bit reversal
trick as in ohci.c to correct this.
2005-04-27 16:42:26 +00:00
augustss d514cae370 With the interrupt fix in the previous commit low and full speed devices
have a chance to work, so allow them (with a warning).
Make a small change to the transaction translator scheduling to make it
at least hobble along (again from Dan Ellis).
2005-04-27 16:20:26 +00:00
augustss 6490a3e8e5 Don't null the qh_link point in the interrupt tree after it has been
initialized.  From Dan Ellis in kern/30003.
2005-04-27 02:12:20 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +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 97cd51eada Don't error out if the number of companion controllers is wrong, just
omplain a go ahead.
2004-12-03 08:51:31 +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
augustss e2916e01dd Preserve some bits in the overlay qTD. 2004-10-25 10:29:49 +00:00
augustss d3c902a013 Add a comment. 2004-10-24 22:13:52 +00:00
augustss 2dc3c5521f Follow the spec more closely when updating the overlay qTD in the QH. 2004-10-24 22:12:24 +00:00
augustss becc42a193 Only delay interrupt my 2 miucroframes instead of 8. This improves
Ethernet performance.
2004-10-24 22:11:05 +00:00
augustss f0c6875478 No need to generate an interrupt at the data part of a control transfer,
it's generated by the status transfer.
2004-10-24 22:09:15 +00:00
augustss 3d0622d94b Make sure to update the data toggle on short transfers.
This makes my Ethernet adapter much happier.
2004-10-24 22:07:04 +00:00
augustss b702a8af08 Don't allow open of low/full speed pipes types that will not work yet. 2004-10-24 08:52:26 +00:00
augustss 90d454c7f7 Keep track of what high speed port (if any) a device belongs to so we can
set the transaction translator fields for the transfer.
Add a gross hack for split transaction completion in the ehci driver that
allows control transfers to be translated.  Interrupt transfers do not work.
Warn when any low/full speed device is opened.
2004-10-23 16:17:56 +00:00
augustss d1ea5ecc77 Turn the printf about needing toggle update into a DPRINTF. Things
seem to work even when this message appears.
Why is it there, Charles?
2004-10-23 13:36:43 +00:00
augustss 2c051a4b85 Add interrupt transfers. From OpenBSD.
Having interrupt transfers enables some more device types to be used,
most notably USB2 hubs.  USB2 hubs still cannot handle anything but
USB2 devices, because there is node code to handle hub Transaction Translation
yet.
XXX This code doesn't do good bw scheduling, but it's certainly better than
nothing. :)
2004-10-22 10:38:17 +00:00
augustss 6f9df049df Insert from ifdefs for soft interrupt related stuff. From OpenBSD. 2004-10-22 09:58:00 +00:00
augustss 176f75ee37 A little portability stuff. 2004-10-21 18:14:40 +00:00