Commit Graph

1896 Commits

Author SHA1 Message Date
Warner Losh
bd6bb69705 Expand usb_port.h macros. 2007-06-18 22:30:08 +00:00
Warner Losh
70c1d26317 Expand usb_callout_init 2007-06-18 22:28:32 +00:00
Warner Losh
70f16d924f Finish removal of usb_port.h macros. 2007-06-18 22:27:57 +00:00
Warner Losh
a5509ec848 Use device_foo_t to declare kobj methods
Fix shutdown type to return int rather than void.
2007-06-18 22:25:46 +00:00
Warner Losh
bb92e05941 minor style(9) polishing
# but we need a usb_match function, if we don't already have one...
2007-06-18 02:15:58 +00:00
Warner Losh
6cf684e14a Remove USBGETSOFTC, USB_ATTACH_START, USB_DETACH_START and
USB_DECLARE_DRIVER_INIT from the usb network drivers.
2007-06-17 18:46:26 +00:00
Warner Losh
fc5d431363 Expand USB_MATCH_START 2007-06-17 16:24:49 +00:00
Warner Losh
2e447a2d92 Remove USB_DO_ATTACH 2007-06-17 07:34:34 +00:00
Warner Losh
7a86867fc0 Expand USB_DO_ATTACH inline.
Remove device_t dv, since it is no longer needed.
Add sizeof(device_t) to replace sizeof dv.
Change device_detach(dev) to device_detach(dev->subdevs[i]) since the type
of dev isn't right!  Not sure when this was introduced, but it likely would
lead to a crash on disconnect.

MFC After: 1 week
2007-06-17 07:33:59 +00:00
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Wilko Bulte
ff9d7fae6a Per request (to core) by the person refered to in the comment. 2007-06-16 19:23:14 +00:00
Warner Losh
200d9c860d Expand callout compatibility macros in the main usb bridges. 2007-06-14 16:23:31 +00:00
Warner Losh
a73530728e Move PWR_* from usb_port.h to usb.h 2007-06-14 16:12:04 +00:00
Warner Losh
058cc61a3e Move malloc definitions to usb.h.
Also, remove usb_malloc_type: it was unused.
Remove METHODS_NONE: it was unused.
Move include of opt_usb.h from usb_port.h to usb.h, since usb_port.h is
going away (there will be a usb_compat.h for out-of-tree drivers that want it).
2007-06-14 15:09:21 +00:00
Warner Losh
6f93a78c1a config_detach is just used in one place, so expand it inline. 2007-06-13 20:58:57 +00:00
Warner Losh
2283429409 Remove more unnecessary and unwanted __OtherBSD__ ifdefs. 2007-06-13 06:00:10 +00:00
Warner Losh
63ba0d2d76 Remove more __OtherBSD__ ifdefs that don't make sense, and haven't for
some time.
2007-06-13 05:45:48 +00:00
Warner Losh
778e5b6687 Expand USB_DETACH, USB_ATTACH and USB_MATCH inline. No functional
change, and MD5's appear to be the same.
2007-06-13 05:37:59 +00:00
Warner Losh
828dd7cd00 Remove compat macros. md5 the same. 2007-06-12 21:35:18 +00:00
Warner Losh
9ab3a4add1 First pass at removing __OtherBSD__. We can't blindly remove all of
them in bulk because there is at least one feature that's
unimplemented on FreeBSD that needs to be done and these are good
placeholders.
2007-06-12 19:40:20 +00:00
Warner Losh
f3ece13593 Don't pretend to support !BSD systems. 2007-06-12 19:01:32 +00:00
Warner Losh
5ea892ec7c Remove usb_kthread_create*. They are now unused. 2007-06-12 18:52:29 +00:00
Warner Losh
015454acee unifdef -D__FreeBSD__ -U__NetBSD__ -U__OpenBSD__
Use kthread_create directly
2007-06-12 18:52:07 +00:00
Warner Losh
4f9929e80f Eliminate usb_thread_t. 2007-06-12 17:30:54 +00:00
Warner Losh
0f5a2cb6b7 Remove USBDEV() macro. We do not need a macro that is defined as its
only argument.  It was used inconsistently in the tree, so remove it.
2007-06-12 16:52:07 +00:00
Warner Losh
e4255d701d clalloc and clfree are useles. Remove them. Remove dead code that's
always been dead for years, but has been obfuscated by these macros.
2007-06-12 16:41:29 +00:00
Warner Losh
645016c0e4 Expand USB_ATTACH_{ERROR,SUCCESS}_RETURN inline and eliminate from
usb_port.h.  They aren't needed, and are a legacy of this code's past.
2007-06-12 15:37:19 +00:00
Warner Losh
930ed6f61b Expand DECLARE_USB_DMA_T inline in the one place it is used and eliminate
from usb_port.h.
2007-06-11 06:21:50 +00:00
Warner Losh
c02f7d824d Eliminate USB_ATTACH_SETUP and USB_MATCH_SETUP. They are no longer in
the tree.
2007-06-11 06:18:34 +00:00
Warner Losh
2a88b253af Prefer device_printf over printf. 2007-06-11 06:14:42 +00:00
Warner Losh
478124e645 Minor tweak. 2007-06-11 06:03:32 +00:00
Warner Losh
339075ea3d Prefer device_printf to printf
Eliminate rue_unit from softc

# saves ~200 bytes
2007-06-11 06:01:05 +00:00
Warner Losh
9b1defb041 Prefer device_printf to printf
Remove keu_unit from softc

# this change saves about 180 bytes in the module, all in text
2007-06-11 05:50:47 +00:00
Warner Losh
b4b82058d3 Get rid of useless devinfo stuff
Kill bogus bzero
prefer device_printf to printf

Reviewed by: alfred@
2007-06-11 05:44:28 +00:00
Warner Losh
68069d1337 Prefer device_printf to printf where sane.
Elimiante cue_unit from softc.
2007-06-11 05:42:47 +00:00
Sam Leffler
68e8e04e93 Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
  fully enumerated and uniquely identify the operating characteristics;
  these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
  background scanning and roaming
o move scanning support into loadable modules based on the operating
  mode to enable different policies and reduce the memory footprint
  on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
  mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
  we use a simple algorithm to trigger a roam: we threshold the rssi
  and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
  drivers but is incomplete; it's included now to establish a baseline
  for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
  prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
  encapsulation (note this can be used with any card that can tx+rx
  large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
  authentication and association failures
o enable the addition of sta mode power save support for drivers that need
  net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
  results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
  index into the rate set; this needs to be extended to deal with
  multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing

Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
       dynamic turbo (lightly tested), 11n (sniffing only and needs
       new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
       rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested

This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others.  Much of the scanning work was supported by
Atheros.  The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
Warner Losh
ab8c137045 Prefer device_printf over printf
Eliminate cdce_unit from softc.
2007-06-10 07:33:48 +00:00
Warner Losh
ed6ed00ed0 Prefer device_printf over printf. Eliminate axe_unit as it is no
longer required.
2007-06-10 07:24:32 +00:00
Matt Jacob
fc2ca23fa3 Remove unused variable. 2007-06-10 04:51:03 +00:00
Matt Jacob
16ccae5559 Complete an initialization to make gcc 4.2 happy. 2007-06-10 01:28:55 +00:00
Matt Jacob
cffc6c3fe1 Initialize devname. 2007-06-10 01:28:26 +00:00
Warner Losh
a5b1cb0cd0 Remove devinfo junk.
Remove bogus bzero/memset
Expand USB_ATTACH_SETUP
Minor nits
2007-06-09 06:42:19 +00:00
Warner Losh
07f51bab6d Remove lots of extra junk:
o other bsd defines, there's no way this would work there
o devinfo junk
2007-06-09 06:40:17 +00:00
Warner Losh
80170fd0c4 Kill devinfo stuff. It is no longer needed.
Kill bogus bzero as necessary.
Minor tidy.
Expand USB_ATTACH_SETUP inline where needed.
2007-06-09 06:39:43 +00:00
Warner Losh
7f5ede5819 Kill USB_MATCH_SETUP, since this is the only place it was used in the tree.
While I'm here, kill devinfo junk.
2007-06-09 06:38:19 +00:00
Warner Losh
e491a67b63 Try to set the data multiplexed feature, but don't care if there's an
error doing so.  It seems an increasing number of phones have this
quirk, and we're not keeping up.  There appears to be nothing bad that
happens for non-quirked phones.

Minor cleanups:
o prefer device_printf over printf
o kill devinfo stuff
o minor other preening.
2007-06-09 06:37:17 +00:00
Warner Losh
e591b223d8 The devinfo stuff has been moved up into the parent bus. There's no
need to do it at all anymore.  Remove it from here.  Expand
USB_ATTACH_SETUP inline now that it is one line and we're moving away
from the compat macros.  Remove some bzero calls that turn out not be
be necessary.
2007-06-09 06:31:07 +00:00
Warner Losh
58ba374e3d Cleanup messages printed on attach. Since the description gets set to
what we print, don't print it anymore.  And don't compute it anymore.
And don't malloc/free memory for it anymore.  While I'm here, prefer
device_printf where appropriate.
2007-06-08 22:25:09 +00:00
Christian Brueffer
578e607926 Remove compat ifdefs for version < 500014 from the rest of the USB files.
Approved by:	rwatson (mentor)
MFC after:	1 week
2007-06-07 09:29:37 +00:00
Warner Losh
cf93a36f82 Fix spaces introduced in last commit 2007-06-07 06:05:53 +00:00
Warner Losh
1fdf3b1b35 Add more IDs for the uftdi driver. Slight tweaks to patch by me.
Submitted by:  Thorsten Trampisch
PR: 113384
2007-06-05 21:06:17 +00:00
David Malone
041b706b2f Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported.  In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.
2007-06-04 18:25:08 +00:00
Warner Losh
965f1e2a4a Add more devices from the hps tree. These appear to have come from
OpenBSD's if_ral.c.

I didn't make the LINKSYS4 -> CISCOLINKSYS name change, nor did I
include the RALINK RT2573 that's supported by the rum(4) driver.  I
didn't merge any code changes either.
2007-05-29 20:05:13 +00:00
Alexander Kabaev
b27167c85e Remove local static redefinition of ucom_devclass. 2007-05-19 04:57:15 +00:00
Christian Brueffer
3f054080e6 Add missing curly braces.
Approved by:	rwatson (mentor)
2007-05-12 05:56:58 +00:00
Christian Brueffer
c9960ef732 ALTQify.
Submitted by:	J.R. Oldroyd
Reviewed by:	mlaier
Approved by:	rwatson (mentor)
MFC after:	1 week
2007-05-12 05:56:10 +00:00
Christian Brueffer
224aecbcdf Remove compat ifdefs for FreeBSD versions < 500014, makes the code
quite a bit easier to read.

Approved by:	rwatson (mentor)
MFC after:	1 weeks
2007-05-12 05:53:53 +00:00
Kevin Lo
eb6e110a7a - Remove dependency on deprecated if_watchdog ABI.
- Move amrr code into net80211 itself.
- Handle ->INIT state transition in ural_newstate() to eliminate the race.

Tested with a ASUS WL-167g.
2007-05-09 09:32:41 +00:00
Maxim Konovalov
717d7ba708 o Add AnyData ADU-E100H modem. Sort a list of ubsa(4) supported devices.
PR:		usb/95803
Submitted by:	Jindrich Fucik
Tested by:	R.Mahmatkhanov
MFC after:	2 weeks
2007-05-08 18:51:40 +00:00
Kevin Lo
e43719c485 Do not set address early. It fix problems when SET_ADDR_FAILED happens
on the hubs.

Reviewed by: imp
2007-05-08 03:25:05 +00:00
Dag-Erling Smørgrav
c8285e3723 Unbreak the build on 64-bit architectures as well. 2007-05-06 21:06:08 +00:00
Dag-Erling Smørgrav
f679c6ff12 Unbreak the build. 2007-05-06 14:25:52 +00:00
Kevin Lo
0738dfc386 Add support for Ralink Technology RT2501USB/RT2601USB devices.
Reviewed by: sam, sephe
Obtained from: OpenBSD
2007-05-06 10:07:21 +00:00
Christian Brueffer
8d2896ac91 Remove pre-5.0 compat cruft.
Approved by:	rwatson (mentor)
MFC after:	1 week
2007-05-01 11:17:29 +00:00
Takanori Watanabe
0f23397d3f Add MELCO PC-OP-RS Universal remote ID. 2007-04-30 16:15:19 +00:00
Sepherosa Ziehau
3629c47471 Nuke unnecessary setting of ural(4)'s security registers. ural(4) only
supports software encrypt/decrypt.

The nuked code itself is quite problematic, as pointed out by sam@ ---
wk->wk_keyix should be replaced by the loop count.

Tested with WEP/TKIP/CCMP/no-protection.

Approved by:	sam@ (mentor)
Noticed by:	Hans Petter Selasky <hselasky@c2i.net>
2007-04-24 11:18:55 +00:00
Sepherosa Ziehau
b03cfe2396 - Fix mbuf/node leakage in drivers' raw_xmit().
- For ural(4):
  o  Fix node leakage in ural_start(), if ural_tx_mgt() fails.
  o  Fix mbuf leakage in ural_tx_{mgt,data}(), if usbd_transfer() fails.
  o  In ural_tx_{mgt,data}(), set ural_tx_data.{m,ni} to NULL, if
     usbd_transfer() fails, so they will not be freed again in ural_stop().

Approved by:	sam (mentor)
2007-04-19 13:09:57 +00:00
Scott Long
2b83592fdc Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM.  Drivers that are not yet MPSAFE register Giant and operate as
usual.  RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.
2007-04-15 08:49:19 +00:00
Maxim Konovalov
b274ce9ef2 o Extend the list of supported CDMA-2000 terminals.
Submitted by:	R.Mahmatkhanov
MFC after:	10 days
2007-04-13 18:15:07 +00:00
Kevin Lo
6d361569d5 Since the driver uses mutexes, remove splusb() and splx(). 2007-04-03 05:59:17 +00:00
Alexander Leidinger
2acfcc2d4c Make it obvious that we don't care about the return value of
usbd_endpoint_count(), the failure case is handled implicit in the
following code.

Found by:	Coverity Prevent (tm)
CID:		56
2007-04-01 13:46:39 +00:00
John Baldwin
4e7f640dfb Optimize sx locks to use simple atomic operations for the common cases of
obtaining and releasing shared and exclusive locks.  The algorithms for
manipulating the lock cookie are very similar to that rwlocks.  This patch
also adds support for exclusive locks using the same algorithm as mutexes.

A new sx_init_flags() function has been added so that optional flags can be
specified to alter a given locks behavior.  The flags include SX_DUPOK,
SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature
to the similar flags for mutexes.

Adaptive spinning on select locks may be enabled by enabling the
ADAPTIVE_SX kernel option.  Only locks initialized with the SX_ADAPTIVESPIN
flag via sx_init_flags() will adaptively spin.

The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock()
are now performed inline in non-debug kernels.  As a result, <sys/sx.h> now
requires <sys/lock.h> to be included prior to <sys/sx.h>.

The new kernel option SX_NOINLINE can be used to disable the aforementioned
inlining in non-debug kernels.

The size of struct sx has changed, so the kernel ABI is probably greatly
disturbed.

MFC after:	1 month
Submitted by:	attilio
Tested by:	kris, pjd
2007-03-31 23:23:42 +00:00
Julian Elischer
6f5d1a3c01 Don't assume the run bit is still set after a suspend.
Submitted by: Andrea Bittau ( adotbittauatcsdotucldotacdotuk)
MFC After: 1 week
2007-03-27 18:55:06 +00:00
Maxim Konovalov
d986a9f435 o A quirk for Sagem USB-Serial controller.
PR:		usb/109613
Submitted by:	Mayr Gerald
MFC after:	1 month
2007-03-24 09:27:58 +00:00
Maxim Konovalov
bbb4f3ad1e o Add several CDMA-2000 terminals.
PR:		usb/109838
Submitted by:	R.Mahmatkhanov
MFC after:	1 month
2007-03-24 09:25:56 +00:00
Sam Leffler
fa393cd523 allow net80211 to fillin rate sets
MFC after:	2 weeks
2007-03-11 22:43:35 +00:00
Warner Losh
76ddd31f5a Some USB mass storage devices return the number of sectors in response
to a READ_CAPACITY request rather than the maximum sector (off by one
problem).  This causes a huge cascade of errors as the geom tasting
code tries to read the last sector (which isn't really there in the
face of this error).  automated tools that manipulate disk labels and
such also have issues.

Create a new quirk READ_CAPACITY_OFFBY1 and add a quirk for the
SanDISK ImageMate that I have that suffers from this problem (the
SDDR-31).  It intercepts the READ_CAPACITY response and adjusts it
from number of sectors to max sector for devices with this quirk.

Reading the Linux source suggests that there are a host of
other devices with this issue, including iPods and some popular
cameras.  I've not added quirks for them, since I don't have the
devices in front of me to test.
2007-02-27 22:33:50 +00:00
Warner Losh
9995cc7a29 Entries sorted by id number, not name 2007-02-27 22:27:53 +00:00
John Baldwin
4d70511ac3 Use pause() rather than tsleep() on stack variables and function pointers. 2007-02-27 17:23:29 +00:00
John Baldwin
f36511e7f8 Use pause() rather than using tsleep() on a dummy variable. 2007-02-27 17:19:33 +00:00
Warner Losh
21ab16bd5b Catchup with filters 2007-02-23 19:34:52 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Nick Hibma
814ee007c3 Initialise {transport,protocol}{,_version} fields during a PATH_INQ to avoid a
warning message.
2007-02-21 07:46:40 +00:00
Lukas Ertl
c24406ad47 Add support for Huawei Technologies Mobile card (3G).
Submitted by:  Thorsten Schroeder <ths_AT_dev.io>
MFC in:        3 days
2007-02-09 15:59:28 +00:00
Lukas Ertl
92fb2d84f5 Add support for another 3G card and update man page accordingly.
The patch from the PR was a little outdated w/regards to the
Vodafone vendor string.

PR:            kern/106033
Submitted by:  Volker Werth <volker_AT_vwsoft.com>
MFC in:        3 days
2007-02-04 22:14:18 +00:00
Florent Thoumie
2b5fb13e20 Fix build (sc->dev => sc->sc_dev). 2007-02-03 21:11:11 +00:00
Warner Losh
df96f93d49 It turns out we were mallocing too early, so move the allocation so we
don't leak.
2007-02-03 19:11:09 +00:00
Warner Losh
5f1413947b Fix memory leak of devinfop
PR: 108719
Submitted by: Antoine Brodin
2007-02-03 16:41:55 +00:00
Warner Losh
f254d5b0d1 Fix possible memory leaks of devinfo.
PR: 108719
Submitted by: Antoine Brodin
2007-02-03 16:38:32 +00:00
Warner Losh
881c241ce3 Fix non-use, but not memory leak, of devinfop. Set the device's
description here.  The fix in the PR isn't necessary at all for memory
leaks, but we weren't setting the device description.

While I'm here, remove some of the obfuscating macros in attach.

PR: 108719
2007-02-03 16:33:47 +00:00
Warner Losh
9b4f44b31e Fix memory leak of devinfo. The leak itself was documented in
PR/108719, but there's a simpler fix: free it after it is used, and
then get rid of the redundant frees this causes.  Other leaks in this
PR not yet fixed.

While I'm here, remove NetBSD/OpenBSD code and some of the portability
#defines that were getting in the way of understanding this code.  The
devinfo bug was harder to spot because one needed to know that
device_set_desc_copy() was used inside of one of them (one that didn't
take an argument!).

Prefer device_printf(sc->sc_dev, "...") to printf("%s:...",
device_get_nameunit(sc->sc_dev)).  This saves almost 300 bytes.

PR: 108719
Submitted by: Antoine Brodin
2007-02-03 16:19:28 +00:00
Max Laier
fe46dc7031 Add ALTQ support for aue(4).
Tested by:	Greg Hennessy, Volker
MFC after:	1 week
2007-02-03 13:53:22 +00:00
Takanori Watanabe
c5286e1196 Add support for serial communication with Windows CE based Handheld Computer.
Obtained from:	NetBSD
2007-01-28 11:56:14 +00:00
Takanori Watanabe
224b9013e8 Add some vendor IDs mainly from NetBSD. 2007-01-28 10:46:32 +00:00
Marius Strobl
c2175ff5ca Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).
2007-01-21 19:32:51 +00:00
Markus Brueffer
740ae2a34c Fix a buffer overflow iff USB_DEBUG is set, hw.usb.ums.debug is > 5 and the
total size of all input reports is < 6.

PR:		usb/106435
Submitted by:	Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Approved by:	emax (mentor)
MFC after:	3 days
2007-01-17 03:50:45 +00:00
Alfred Perlstein
a2630c7c78 Remove my "custom" locks that allow for lock acquire abort, they are
not needed if the proper ordering is done in attach and shutdown.

Remove usage of if_timer/watchdog and roll my own by piggybacking
off the tick() function.

Use the new usb system to allocate task queues instead of using
the system wide thread for taskqueues.
2007-01-08 23:24:21 +00:00
Alfred Perlstein
b262697660 Add the following functions to abstract away the creation of task threads
for usb.  I hope that this will eventually be used for generic devices
that need full fledged blocking threads for event processing.

Create a taskqueue:
void usb_ether_task_init(device_t, int, struct usb_taskqueue *);

Enqueue a task:
void usb_ether_task_enqueue(struct usb_taskqueue *, struct task *);

Wait for all tasks queued to complete:
void usb_ether_task_drain(struct usb_taskqueue *, struct task *);

Destroy the taskqueue:
void usb_ether_task_destroy(struct usb_taskqueue *);
2007-01-08 23:21:06 +00:00
Luigi Rizzo
d64492c407 protect against multiple inclusion (this is useful when you
start working with third party usb modules, where sometimes it
is not easy to set the inclusion order so that there are no multiple
inclusions, yet you want to compile with high WARNS levels).

I am not sure if there is a standard for having a leading and/or trailing _
in the macro name, the usb code seems to use both.

There are still several unprotected headers here so it might be useful
to do the same thing on other files as well as the need arises.

MFC After: 3 days
2007-01-03 10:50:03 +00:00
Jung-uk Kim
0c4578975e Back out revision 1.33. usb/98983 was misfiled and the patch had no effect.
The originator confirmed the adapter works fine without the patch.

Tested by:	Massimo Lusetti (mlusetti at gmail dot com)
2006-12-26 17:43:46 +00:00
Alfred Perlstein
cc8317f2b0 Fix a deadlock in detach/shutdown.
The problem was that I was acquiring the driver sx lock and then waiting
for a taskqueue to drain, however the taskqueue itself would try to
acquire the lock as well leading to a deadlock.

To fix the problem roll my own exclusive lock that allows for lock
cancellation.  This is a normal exclusive lock, however if someone
marks it as "dead" then all waiters who request an error return will
get back an error instead of continuing to wait for the lock.

In this particular case, the shutdown and detach functions kill the
lock while the async task thread tries to acquire the lock but will
abort if the lock returns an error.

The other option was to drop the driver lock mid-detach and mid-shutdown,
mid-detach was a ok, however mid-shutdown was not.

While I'm here, fix a bug in what appears to be the mii link status
word in the softc going out to lunch.  Explicitly set the status
word to 1 after initializing the mii.  This would result in an interface
that would never respond to "if_start" requests as the mii interface
would always look down.
2006-12-23 17:18:18 +00:00
Alfred Perlstein
61b2399c19 Use callouts to prevent races.
Cleanup debug code.
2006-12-13 22:38:56 +00:00
Alfred Perlstein
7b74982d4e defer all processing to a full fledged thread.
once usb is SMP safe, this should be the first SMPsafe
usb ethernet driver.
2006-12-11 09:57:41 +00:00
Alfred Perlstein
06a061cef3 Stop INVARIANTS panics in if_aue with a stopgap.
aue_tick calls several synchronous usb functions from a timeout(9),
this is very broken since a timeout(9) is run as an interrupt
and the usb functions tsleep.

A stopgap fix is to schedule a taskqueue task from the timeout
and defer work to that taskqueue task.
2006-11-29 19:19:44 +00:00
Florent Thoumie
454cb2de5b Add a quirk for devices recognized as usb keyboards not to be hooked by
ukbd(4).

PR:		usb/105669
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after:	1 week
2006-11-28 21:13:07 +00:00
Doug Barton
ea69d32d60 Write the short vendor name in ALL CAPS, since it will become
a #define.

Submitted by:	brooks
2006-11-27 20:33:13 +00:00
Marius Strobl
10d8cebc7a Refine the previous change to only call bus_dmamap_sync() in case of
an URQ_REQUEST when DMA segments are passed to usbd_start_transfer();
when the request doesn't include the optional data buffer the size of
the transfer (xfer->length) is 0, in which case usbd_transfer() won't
create a DMA map but call usbd_start_transfer() with no DMA segments.
With the previous change this could result in the bus_dmamap_sync()
implementation dereferencing the NULL-pointer passed as the DMA map
argument.
While at it fix what appears to be a typo in usbd_start_transfer();
in order to determine wheter usbd_start_transfer() was called with
DMA segments check whether the number of segments is > 0 rather than
the pointer to them being > 0.

OK'ed by:	imp
2006-11-27 18:39:02 +00:00
Poul-Henning Kamp
a5d7a1aed7 Add entry and no-UHID quirk for I-tuner networks USB-LCD 2x20 as found
in http://www.mini-box.com/Mini-Box-M200-LCD
2006-11-26 11:07:37 +00:00
Doug Barton
4b15724254 I mistakenly committed the wrong version of my patch (sorry).
s/O2/O2Micro, as that's how they seem to prefer it, and remove
what is now one blank line too many.
2006-11-24 06:51:49 +00:00
Doug Barton
e3e0cf8246 Add a vendor ID for O2Micro, obtained from
http://www.usb.org/developers/tools

Add a product ID for the Dell TrueMobile 350 Bluetooth USB Adapter
obtained from NetBSD's usbdevs file.
2006-11-23 00:58:40 +00:00
Sam Leffler
0a0b5b012d add codes for Atheros USB devices; shuffle one ural code to
avoid conflict

Obtained from:	openbsd
MFC after:	1 month
2006-11-23 00:50:48 +00:00
Warner Losh
5128f7357c Fix coherency issue. From submitter:
I have been debugging the usb problems some more. Your were
	right in your assumption (thanks for the pointer) about lack
	of calls to bus_dmamap_sync().  In usbdi.c bus_dmamap_sync()
	does get used for transfers that move data from PC to USB and
	it is used for transfers that move data from USB to PC. But
	someone forgot that control transfers consist of possibly two
	data chunks : the request itself and optionally a buffer of
	data that should be transfered to or from the USB device.  On
	requests to the control endpoint without additional data
	bus_dmamap_sync() didn't get called. For some reason my first
	tests with umass worked (due to enough cache poisening I
	guess).  The attached patch adds a call to bus_dmamap_sync()
	to usbdi.c and now all devices I have tried work out of the
	box.  I have successfully transfered large files using the
	if_axe driver and I have mounted several different umass
	devices.

submitted by: Daan Vreeken
sponsored by: Vitsch Electronics
reviewed by: cognet@
2006-11-22 17:56:36 +00:00
Doug Barton
79506f19fb Acknowledge (dearly) departed files 2006-11-21 22:29:06 +00:00
Maxim Konovalov
9aab0d96da o Add uark(4), a driver for Arkmicro Technologies ARK3116 based serial
adapters.

Submitted by:	Alex Rodin
Obtained from:	OpenBSD
Reviewed by:	-usb
MFC after:	6 weeks
2006-11-15 09:13:25 +00:00
Florent Thoumie
a47ca15be9 Fix USB printer Xerox WorkCentre M15 adding a quirk to bypass
reported bidirectional functionality.

PR:		usb/104704
Submitted by:	Eygene <rea-fbsd@codelabs.ru>
X-MFC after:	6.2-RELEASE
2006-11-11 23:53:25 +00:00
Matt Jacob
bd3fd815a7 2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.
2006-11-02 00:54:38 +00:00
Matt Jacob
fa9ed86506 The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by:	freebsd-scsi and specific stakeholders
2006-10-31 05:53:29 +00:00
Kevin Lo
127ce9bca0 Add support for Option GT 3G/3G quad datacard in ubsa.
Approved by: cognet
2006-10-31 02:27:24 +00:00
Ruslan Ermilov
f280a8fbd3 Fix non-working CAPS LED under X by applying fix from atkbd.c,v 1.27:
: revision 1.27
: date: 2000/05/28 12:43:24;  author: ache;  state: Exp;  lines: +3 -2
: Manipulate with AltGR Led (really CapsLock Led) only in K_XLATE mode, because
: all other modes not set ALKED flag and it means that CapsLock always turned
: off for them.
: Real bug example is X11 which never turn on CapsLock with Russian keyboard.
:
: PR:             18651
: Submitted by:   "Mike E. Matsnev" <mike@po.cs.msu.su>

MFC after:	3 days
2006-10-25 12:22:19 +00:00
Ian Dowse
9145721957 Use a different task queue for host controller and peripheral driver
tasks. Since the host controllers rely on tasks to process transfer
timeouts, if a synchronous transfer from a driver was invoked from
a task and timed out, it would never complete because the single
task thread was stuck performing the synchronous transfer so couldn't
process the timeout.

This affected the axe, udav and ural drivers.

Problem hardware provided by:	guido
2006-10-19 01:15:58 +00:00
Florent Thoumie
f45164d8b1 Add a USB umass(4) quirk for Panasonic KXL-840AN CD-R drive.
PR:		usb/81073
Submitted by:	James E. Flemer <jflemer@alum.rpi.edu>
MFC after:	3 days
2006-10-07 20:08:37 +00:00
Florent Thoumie
bff4edd817 Add a USB quirk for CMOTECH CDMA USB modem.
PR:		usb/97948
Submitted by:	Alexei Volkov <kot@kotzone.ru>
MFC after:	3 days
2006-10-07 19:42:45 +00:00
Florent Thoumie
b804b1868e Add a USB quirk for Motorola A41x/V32x USB phones.
PR:		usb/97512
Submitted by:	Mark Diekhans <markd@kermodei.com>
MFC after:	3 days
2006-10-07 19:27:53 +00:00
Florent Thoumie
bd4029713f Add support for Novatech NV902 wireless NIC in ural(4).
PR:		usb/102852
Submitted by:	Jonathan Fosburgh <jonathan@fosburgh.org>
MFC after:	3 days
2006-10-07 18:18:40 +00:00
Florent Thoumie
774b7afefb Add support for Epson Stylus CX4200 in uscanner(4).
PR:		usb/102851
Submitted by:	Jonathan Fosburgh <jonathan@fosburgh.org>
MFC after:	3 days
2006-10-07 18:09:27 +00:00
Florent Thoumie
cfa3f4d8ab Add support for Psion Gold Port Ethernet USB NIC.
PR:		usb/102296
Submitted by:	Volker <volker@vwsoft.com>
MFC after:	3 days
2006-10-07 18:03:39 +00:00
Florent Thoumie
d25cbeac2c Add support for Netgear FA101 ethernet USB NIC.
PR:		usb/102286
Submitted by:	Volker <volker@vwsoft.com>
MFC after:	3 days
2006-10-07 17:58:50 +00:00
Florent Thoumie
be1bd380c5 Add a quirk for the Belkin FC6550-AVR UPS.
PR:		usb/102260
Submitted by:	David Grochowski <grocho98@students.rowan.edu>
MFC after:	3 days
2006-10-07 17:47:16 +00:00
Florent Thoumie
0c56f2bcd6 Add support for Familiar Linux powered iPaq handhelds to cdce(4).
PR:		usb/103865
Submitted by:	Alexey Roslyakov <internetworking@mail.ru>
MFC after:	3 days
2006-10-07 17:35:37 +00:00
Florent Thoumie
6d28d23bb9 Add quirk for Logitech iFeel MouseMan USB mouse.
PR:		usb/101066
Submitted by:	Heiko Przybyl <zuxez@uni.de>
MFC after:	3 days
2006-10-07 17:16:48 +00:00
Florent Thoumie
da9b42184b - Add support for Epson USB Scanners (3590 [1] and 4990 [2]).
- Add entries in the uscanner.4 man page (along with missing 3500).

PR:		usb/100957 [1], usb/100992 [2]
Submitted by:	Jim Teresco <terescoj@teresco.org> [1],
		Walter C. Pelissero <walter.pelissero@iesy.net> [2]
MFC after:	3 days
2006-10-07 16:00:59 +00:00
Ian Dowse
dff926577b Fix compile in non-debug case. 2006-10-03 08:38:08 +00:00
Ian Dowse
9c63c3f400 When changing the device address and max packet size in usbd_new_device(),
close and re-open the default pipe instead of relying on the host
controller driver to notice the changes. Remove the unreliable code
that attempted to update these fields while the pipe was active.
This fixes a case where the hardware could cache and continue to
use the old address, resulting in a "getting first desc failed"
error.

PR:		usb/103167
2006-10-03 01:13:26 +00:00
Ian Dowse
a55e16f4f7 Don't attempt to insert the transfer in an error case where it has
already been inserted.
2006-10-03 01:04:11 +00:00
Ruslan Ermilov
1997f96b85 Ignore the UKBD_DFLT_KEYMAP option when compiling as a module.
The parallel LINT build sometimes broke if kernel-depend wasn't
fast enough in generating ukbdmap.h.  If someone thinks this
option would still be useful for the module, a proper fix is
to add the code generating ukbdmap.h into modules/ukbd/Makefile
and backing this change out.
2006-10-02 16:02:41 +00:00
Ruslan Ermilov
9fddcc6661 Fix our ioctl(2) implementation when the argument is "int". New
ioctls passing integer arguments should use the _IOWINT() macro.
This fixes a lot of ioctl's not working on sparc64, most notable
being keyboard/syscons ioctls.

Full ABI compatibility is provided, with the bonus of fixing the
handling of old ioctls on sparc64.

Reviewed by:	bde (with contributions)
Tested by:	emax, marius
MFC after:	1 week
2006-09-27 19:57:02 +00:00
Olivier Houchard
b098674792 Use usbd_clear_endpoint_stall_async() when clearing endpoint stalls in
an interrupt context.

Obtained from:	NetBSD
MFC after:	1 week
2006-09-22 12:45:42 +00:00
Tom Rhodes
16b392d51d Yank FreeBSD specific code out from under ifdef.
Remove compatibility ifdefs.

Reviewed/Ok'ed by:	imp
2006-09-10 15:20:39 +00:00
Warner Losh
2deae8fa2f More removing compatibility macros.
md5 still the same.

"Dave, stop.  I feel my mind slipping away." -- hal
2006-09-07 00:06:42 +00:00
Warner Losh
730503190d Only include FreeBSD defines. This file is slated to go to the happy
hunting ground in the sky.

Also, remove the #defines OBE.
2006-09-06 23:49:36 +00:00
Warner Losh
56635f6bd3 s/Static/static/g
s/device_ptr_t/device_t/g

No md5 changes in the .o's

# Note to the md5 tracking club: $FreeBSD$ changes md5 after every commit
# so you need to checkout -kk to get $FreeBSD$ instead of the actual value
# of the keyword.
2006-09-06 23:44:25 +00:00
Warner Losh
f455418269 More antideclarification.
md5 still the same after all these years (and after -g was removed).
2006-09-06 23:29:53 +00:00
Warner Losh
da271ed509 Remove the portibility layer goo.
Produces the same .o as before.

md5 by: /sbin/md5
2006-09-06 21:53:28 +00:00
John-Mark Gurney
378f231e7d add a newbus method for obtaining the bus's bus_dma_tag_t... This is
required by arches like sparc64 (not yet implemented) and sun4v where there
are seperate IOMMU's for each PCI bus...  For all other arches, it will
end up returning NULL, which makes it a no-op...

Convert a few drivers (the ones we've been working w/ on sun4v) to the
new convection...  Eventually all drivers will need to replace the parent
tag of NULL, w/ bus_get_dma_tag(dev), though dev is usually different for
each driver, and will require hand inspection...

Reviewed by:	scottl (earlier version)
2006-09-03 00:27:42 +00:00
Warner Losh
5657c870dc Don't put a ; after while (0)
Submitted by:	jmg
2006-08-17 22:42:56 +00:00
Bruce M Simpson
d180698897 Add identifier for the Epson CX3650 all-in-one scanner function.
This enables the scanner function on these devices to be detected
and probed by uscanner(4), but only when ulpt is not loaded.

PR:		usb/92462
Submitted by:	Friedrich Volkmann
MFC after:	30 days
2006-08-06 12:01:42 +00:00
Sam Leffler
4350e12f23 remove unneccessary null ptr check
Coverity ID:	173918
2006-08-02 04:55:04 +00:00
Sam Leffler
9ee0e22742 support for 802.11 packet injection via bpf
Reviewed by:	arch@
MFC after:	1 month
2006-07-26 03:30:50 +00:00
Warner Losh
dbde02fe74 Add a few more devices to the supported list. Specifically, the PHAROS and
the silly dongly I just bought at Radio Shack.
2006-07-24 19:47:00 +00:00
Andrew Thompson
3bdf75a5ca Change the multicast calculation to be the same as the other usb drivers and
avoid calling into the usb code with the lock held. This doenst fix the
fundamental usb sleeping problem but at least the adapter can be used.
2006-07-05 00:49:26 +00:00