Commit Graph

1501 Commits

Author SHA1 Message Date
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Benno Rice
22dfcd1b30 Identify the Intel ICH4 EHCI controller. 2005-06-10 08:28:22 +00:00
Warner Losh
0613b6f9c4 Power state management now done in PCI bus code 2005-06-05 22:53:09 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Damien Bergamini
150bb7c348 Fix WPA (802.11i) support.
Approved by:	silby (mentor)
2005-05-22 18:34:20 +00:00
Marius Strobl
cf87ad7afd Recognize the integrated USB controllers of Sun PCIO-2 chips which
are used onboard in most of the newer PCI-based sun4u machines
(cosmetic change as they were also already probed as generic OHCI
without this). Detect whether their intpin register is valid and
correct it if necessary, i.e. set the respective IVAR to the right
value for allocating the IRQ resource, as some of them come up
having it set to 0 (mainly those used in Blade 100 and the first
one on AX1105 boards). This fixes attaching affected controllers.
Correcting the intpin value might be better off in the PCI code
via a quirk table but on the other hand gem(4) and hem(4) also
correct it themselves and at least for the USB controller part
the intpin register is truely hardwired to 0 and can't be changed.
This means that we would have to hook up the quirk information
in a lot of places in the PCI code (i.e. whenever the value of the
intpin register is read from or written to the pci_devinfo of the
respective device) in order to do it the right way.

MFC after:	1 month
2005-05-19 23:00:46 +00:00
Warner Losh
ce86397a98 Add convenience functions to get port and interface. 2005-05-16 06:58:43 +00:00
Alexander Kabaev
59195c3a3d Plug a potential memory leak.
Noticed by: Coverity Prevent analysis tool.
2005-05-11 18:53:14 +00:00
Warner Losh
3ecc7feefc Take out Giant in uhub_child_* in giant. There's one place where we
could sleep which I think can lead to races.  However, there are fewer
with this code than without it.

Submitted by: Hans Petter Selasky
2005-05-11 15:21:22 +00:00
Julian Elischer
6efba7ef05 A patch to support Palm Tungsten T via USB-Cradle.
not suer where it comes from but suspect kimoto at ohnolab.org

MFC after:	1 week
2005-05-04 00:46:24 +00:00
Damien Bergamini
ceaec73d40 Initial import of ipw, iwi, ral and ural drivers:
ipw  - Intel PRO/Wireless 2100
iwi  - Intel PRO/Wireless 2200BG/2225BG/2915ABG
ral  - Ralink Technology RT2500
ural - Ralink Technology RT2500USB

Approved by:	silby (mentor)
2005-04-18 18:47:38 +00:00
Ian Dowse
f04d2ba47f Fix the handling of the UCS_RXSTOP flag so that it always tracks
whether or not the receive pipe is stopped. This ensures that we
do not attempt to start the same transfer twice, and it allows
ucomstop() to skip the restarting of the read pipe if it was not
originally running, such as when called indirectly from ucomreadcb().

PR:		kern/79420
MFC after:	1 day
2005-04-12 00:26:40 +00:00
Lukas Ertl
0ec44eb5e2 Add support for Sitecom USB to serial cable (v2)
PR:            usb/79230
Submitted by:  Rick van der Zwet <rick@wzoeterwoude.net>
2005-04-08 12:48:05 +00:00
Bernd Walter
1b285e5cce Add support for FTDI's FT2232C twin channel chip.
Tested by: Mike Tancsa <mike@sentex.net>
2005-04-05 22:09:18 +00:00
Bernd Walter
8a95014be7 remove usbd_errstr(err) from printf.
err has nothing to say about this specific error.
2005-04-05 22:03:07 +00:00
Ian Dowse
04d114aa99 Use the usb_callout_* API instead of timeout()/untimeout() in order
to avoid a race condition that can cause the ukbd timeout routine
to run after the keyboard has detached.

Reported and tested by:	wpaul
2005-03-30 08:32:41 +00:00
Ian Dowse
61c43c6d8d Don't defer the boot-time exploration of high-speed USB busses.
This ensures that we explore EHCI busses before their companion
controllers' busses, so that ports connected to full/low speed
devices will be properly routed to the companion controllers by the
time the OHCI/UHCI exploration occurs.
2005-03-27 15:31:23 +00:00
Maxim Sobolev
e33b116b78 Comment out rue_miibus_statchg() function. Using trial-and-error approach I
found it guilty in putting the card into unusable state after UP->DOWN->UP
media status change.

Looks like some of register writes in this functions mess up PHY interface.

No visible regressions has been found after commenting this code out -
the card properly handles forceful local mode changes and auto-detects changes
made remotely (tested with Auto, 10HD, 10FD, 100HD, 100FD).

Sponsored by:	PBXpress Inc.
MFC after:	3 days
2005-03-25 20:19:18 +00:00
Maxim Sobolev
ddbcc78273 Add /* _FOO_H_ */ after the final #endif to make danfe happy. 2005-03-25 13:22:58 +00:00
Maxim Sobolev
8eadbd831e Fix identation. 2005-03-25 12:55:06 +00:00
Maxim Sobolev
f1cc4b713e Add missed KUE_UNLOCK(). This is NOOP yet, but may be handy later on. 2005-03-25 12:53:26 +00:00
Maxim Sobolev
5135f8e687 Fix breakage in the previous commit caused by the last-minute change. 2005-03-25 12:50:57 +00:00
Maxim Sobolev
87fcbb8fe0 Protect against multiple inclusions. 2005-03-25 12:49:26 +00:00
Maxim Sobolev
d521dc21e7 Move Rx/Tx lists management routines into central location. 2005-03-25 12:42:30 +00:00
Maxim Sobolev
710fa1d820 GC unused fields. 2005-03-25 10:39:23 +00:00
Maxim Sobolev
9245facb49 GC unused field. 2005-03-25 09:48:24 +00:00
Ian Dowse
5e1f111310 Fix an incorrect NULL argument to usbd_set_interface() associated
with the ALT_IFACE_1 quirk.

PR:		usb/79190
Submitted by:	Hans Petter Selasky <hselasky@c2i.net>
2005-03-25 01:47:01 +00:00
Ian Dowse
e2b66de827 Use usbd_get_string() instead of calling usbd_get_string_desc()
with the wrong language parameter when retrieving the device serial
number. This invalid request caused some devices not to work at
all.

PR:		usb/79190
Submitted by:	Hans Petter Selasky <hselasky@c2i.net>
2005-03-25 01:44:38 +00:00
Maxim Sobolev
8a9cf808e6 Move xxx_newbuf() function, which was the same in all drivers into central
location.
2005-03-25 00:44:21 +00:00
Ian Dowse
70a18c2253 Use M_NOWAIT when allocating from a callout routine.
PR:	kern/73295
2005-03-25 00:38:46 +00:00
Maxim Sobolev
4562351ad0 Zaurus expecrs CRC to be in little-endian order, so that convert it into LE
on BE arches.

Obtained from:	OpenBSD
2005-03-22 16:35:15 +00:00
Maxim Sobolev
6bcf003260 Add USB Communication Device Class Ethernet driver. Originally written for
FreeBSD based on aue(4) it was picked by OpenBSD, then from OpenBSD ported
to NetBSD and finally NetBSD version merged with original one goes into
FreeBSD.

Obtained from:  http://www.gank.org/freebsd/cdce/
                NetBSD
                OpenBSD
2005-03-22 14:52:40 +00:00
Maxim Sobolev
c159c9d8bb Add the following products in preparation for addition of CDCE driver:
- G.Mate, Inc's YP3X00 PDA;

 - Prolific's PL2501 Host-Host interface;

 - Numver of Sharp's Zaurus PDAs.
2005-03-21 08:43:54 +00:00
Ian Dowse
20289f7920 Root hubs don't have transaction translators, so skip printing the
message about them if the hub depth is zero.
2005-03-20 23:45:00 +00:00
Ian Dowse
0b07d58eb3 Don't display the redundant `ehci_pci_attach: companion usbX'
messages unless EHCI debugging is enabled.

Suggested by:	scottl
2005-03-20 23:42:54 +00:00
Ian Dowse
a3a574f503 Remove trailing whitespace as per NetBSD's revision 1.91. Also
update the TODO comments to more closely match current reality.
2005-03-20 22:22:18 +00:00
Ian Dowse
4c11f583a3 Now that all architectures allow hooks to be inserted before
configure_final(), assert that "cold" is true in usb_cold_explore()
when there are busses to explore. When USB is kldloaded after boot,
usb_cold_explore() will still get invoked but the list of busses
to explore in that case should always be empty.
2005-03-19 19:27:38 +00:00
Ian Dowse
a3d327674a It was possible to have two threads concurrently aborting the same
transfer, which lead to panics or page faults. For example if a
transfer timed out, another thread could come along and attempt to
abort the same transfer while the timeout task was sleeping in
the *_abort_xfer() function.

Add an "aborting" flag to the private transfer state in each host
controller driver and use this to ensure that the abort is only
executed once. Also prioritise normal abort requests over timeouts
so that the callback is always given a status of USB_CANCELLED even
if the timeout-initiated abort began first.

The crashes caused by this bug were mainly reported in connection
with lpd printing to a USB printer.

PR:	usb/78208, usb/78986
2005-03-19 19:08:46 +00:00
Bernd Walter
65a5e4be3d initialize pp->p_sc so it can be referenced later.
dynamicaly allocate the per port array.
allow up to 32 serials per USB device.
ask the device for correct pipe sizes.
2005-03-17 22:47:18 +00:00
Ian Dowse
a7b66eb1ae Defer boot-time exploration of USB busses until all devices in the
system have been attached, but no later. This ensures that we do
not explore ohci or uhci busses before the companion echi controller
has been initialised, so it should fix the problem of multi-speed
USB devices getting attached as USB 1 devices first and then
re-attached as USB 2.

Some further changes are needed on architectures that do not currently
allow hooks to be inserted before configure_final() - alpha, ia64,
powerpc and sparc64. On these architectures the exploration will
now be delayed until the usb kthread runs.
2005-03-17 19:41:19 +00:00
Ian Dowse
7515d96b78 Add support for the ethernet port in the JVC MP-PRX1 port replicator. 2005-03-14 01:49:00 +00:00
Ian Dowse
bc7744545d Set the split transaction interrupt C-mask correctly. This is the
final piece needed to make split transaction interrupt pipes work,
which I thought I had already committed.
2005-03-14 01:03:50 +00:00
Ian Dowse
f4b4a6b096 The EHCI qTD token has a number of error status bits that are not
cleared if the host controller retries the transfer and is successful,
but we were interpreting these bits as indicating a fatal error.
Ignore these error bits, and instead use the HALTED bit to determine
if the transfer failed. Also update the USBD_STALLED detection to
ignore these bits.

Obtained from: OpenBSD
2005-03-13 23:48:17 +00:00
Ian Dowse
76d8aa3efe Fix the arrangement of periodic QH tree to give the correct interval
between passes over a QH. Previously the accesses to a QH were
bunched together in time, so the interval was often much longer
than intended. This now appears to match the diagrams in the EHCI
spec, so remove the XXX comment.
2005-03-13 04:07:40 +00:00
Ian Dowse
2f9b6e1f34 Fix the silly bug that prevented most EHCI interrupt transfers from
ever working correctly: the code was linking the QHs together but
then immediately overwriting the "next" pointers. Oops. Also
initialise qh_endphub, since the EHCI spec says that we should
always set the pipe multiplier field to something sensible.

This appears to make basic split transactions work, so enable split
transactions for control, bulk and interrupt pipes (split isochronous
transfers are not yet implemented). It should now be possible to
use USB1 devices even when they are connected through a USB2 hub.
2005-03-08 02:47:18 +00:00
Maxim Sobolev
21a69c81c0 Merge from NetBSD.
o usb_subr.c, add delta 1.119:

  Move usb_get_string() and make it public.

o usbdi.c, bring on par with 1.106, this includes:

  - Make an iterator abstraction for looping through all descriptors.

  - Whine about not being able to figure out default language if we are debugging.

  - Move usb_get_string() and make it public.

o usbdi.h, bring on par with 1.64, this includes:

  - Make an iterator abstraction for looping through all descriptors.

  - Move usb_get_string() and make it public.

o usbdi_util.c, bring on par with 1.42, this includes:

  - Add usbd_get_protocol().

  - Use NULL instead of 0.

  - Fix (mostly harmless) typo.

  - Move utility routine from uirda.c to usbdi_util.c.

o usbdi_util.h, bring on par with 1.31, this includes:

  - Add usbd_get_protocol().

  - Move utility routine from uirda.c to usbdi_util.c.

MFC after:	3 days
2005-03-01 08:01:22 +00:00
Warner Losh
2ece8174c1 Use BUS_PROBE_DEFAULT in preference to 0. Also for vx, return
BUS_PROBE_LOW_PRIORITY in stead of ifdef for devices that xl and vx
both support so that xl will snarf them on up.
2005-03-01 07:50:12 +00:00
Maxim Sobolev
d524bc1aa1 Sync with 1.9 from NetBSD, this includes:
o Add Ethernet descriptor.

o Use attribute packed for on-the-wire data structures.

MFC after:	3 days
2005-03-01 06:35:04 +00:00
Ian Dowse
e0a4f554be Abort any active transfers when the device detaches. This fixes a
few situations where we used to crash, but by no means all of them.
2005-02-14 02:17:53 +00:00
Ian Dowse
d83604e89a Add a new function usbd_abort_default_pipe() that aborts any transfers
on the default pipe. This is helpful in device detach routines to
stop any active control transfers.
2005-02-14 01:51:51 +00:00