Commit Graph

1659 Commits

Author SHA1 Message Date
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
Maxim Konovalov
b01f957bcd o Remove rev. 1.30 leftover. From Damien: However, this code path
is never taken since there aren't any 802.11a ural(4) sticks available
on the market.

PR:		kern/99676
Submitted by:	KIYOHARA Takashi
Reviewed by:	damien
MFC after:	1 week
2006-07-01 13:39:04 +00:00
Takanori Watanabe
84c269d3f3 Comment fix.
Pointed out by: ume via IRC
2006-06-29 06:31:13 +00:00
Takanori Watanabe
bc5f8a4e55 Willcom WSIM DD support. 2006-06-29 06:17:48 +00:00
Matteo Riondato
0a8d09fe8a Add a forgotten "," 2006-06-19 16:31:58 +00:00
Matteo Riondato
d8eab5725f Add Hamlet eXagerate XURS232 USB-Serial adapter
PR:		usb/98983
Submitted by:	Massimo Lusetti
MFC after:	1 week
2006-06-19 16:30:35 +00:00
Alexander Leidinger
8cc6aade65 Add support for the Aceeca Mez1000 RDA.
PR:		82839
Submitted by:	Mike Durian <durian@shadetreesoftware.com>
2006-06-18 17:55:29 +00:00
Alexander Leidinger
8128fd701e Add support for:
- Curitel PC5740 Wireless Modem (Verizon's PCMCIA card)
 - Sierra MC5720 Wireless Modem (Built in to Thinkpad X60s)

PR:		98908
Submitted by:	Michael Collette <metrol@metrol.net>
2006-06-18 17:54:33 +00:00
Alexander Leidinger
04cb71301e Add support for:
- Curitel PC5740 Wireless Modem (Verizon's PCMCIA card)
 - Sierra MC5720 Wireless Modem (Built in to Thinkpad X60s)

The scanner in the PR is already supported.

PR:		98908
Submitted by:	Michael Collette <metrol@metrol.net>
2006-06-18 17:43:38 +00:00
Alexander Leidinger
4e93c5c41e Add Epson Perfection 1270 scanner. All other scanners in the PR are already
detected, but with a different name.

PR:		98106
Submitted by:	Lars Engels <lars.engels@0x20.net>
2006-06-18 17:29:16 +00:00
Alexander Leidinger
e932b6c236 When attaching an Xbox 360 gamepad a computer, the LED on the gamepad
blinks by default. When the operating system (read: normally an Xbox
360) initializes the gamepad, the LED stops blinking.

Change our uhid code to do the same.

PR:		97169
Submitted by:	Ed Schouten <ed@fxq.nl>
2006-06-18 17:18:17 +00:00
Ian Dowse
c62502d1f6 Fix a number of cases where ugen would panic, especially when the
device went away while open or if you tried to change the config
number while devices were open. Based on the patch from the PR with
a number of changes as discussed with the submitter.

PR:		usb/97271
Submitted by:	Anish Mistry
2006-06-05 14:44:39 +00:00
Ian Dowse
a48ddf5b85 Add a sleep lock that protects access to sequences of blocking
axe_cmd() calls. Without this the device can get confused if multiple
threads attempt these operations concurrently. The problem was
easily reproducible by running "ifconfig axe0" in a loop because
eventually it would conflict with axe_tick_task().

A similar approach is probably required in all USB ethernet drivers.
2006-06-04 14:42:38 +00:00
Ian Dowse
3b63ffa20c Allow zero-length read/write operations to get through to the
hardware. Also set both the read and write timeouts from the
USB_SET_TIMEOUT ioctl.
2006-06-03 10:37:42 +00:00
Sam Leffler
ff046a6c6b add missed calls to bpf_peers_present 2006-06-02 23:14:40 +00:00
Christian S.J. Peron
16d878cc99 Fix the following bpf(4) race condition which can result in a panic:
(1) bpf peer attaches to interface netif0
	(2) Packet is received by netif0
	(3) ifp->if_bpf pointer is checked and handed off to bpf
	(4) bpf peer detaches from netif0 resulting in ifp->if_bpf being
	    initialized to NULL.
	(5) ifp->if_bpf is dereferenced by bpf machinery
	(6) Kaboom

This race condition likely explains the various different kernel panics
reported around sending SIGINT to tcpdump or dhclient processes. But really
this race can result in kernel panics anywhere you have frequent bpf attach
and detach operations with high packet per second load.

Summary of changes:

- Remove the bpf interface's "driverp" member
- When we attach bpf interfaces, we now set the ifp->if_bpf member to the
  bpf interface structure. Once this is done, ifp->if_bpf should never be
  NULL. [1]
- Introduce bpf_peers_present function, an inline operation which will do
  a lockless read bpf peer list associated with the interface. It should
  be noted that the bpf code will pickup the bpf_interface lock before adding
  or removing bpf peers. This should serialize the access to the bpf descriptor
  list, removing the race.
- Expose the bpf_if structure in bpf.h so that the bpf_peers_present function
  can use it. This also removes the struct bpf_if; hack that was there.
- Adjust all consumers of the raw if_bpf structure to use bpf_peers_present

Now what happens is:

	(1) Packet is received by netif0
	(2) Check to see if bpf descriptor list is empty
	(3) Pickup the bpf interface lock
	(4) Hand packet off to process

From the attach/detach side:

	(1) Pickup the bpf interface lock
	(2) Add/remove from bpf descriptor list

Now that we are storing the bpf interface structure with the ifnet, there is
is no need to walk the bpf interface list to locate the correct bpf interface.
We now simply look up the interface, and initialize the pointer. This has a
nice side effect of changing a bpf interface attach operation from O(N) (where
N is the number of bpf interfaces), to O(1).

[1] From now on, we can no longer check ifp->if_bpf to tell us whether or
    not we have any bpf peers that might be interested in receiving packets.

In collaboration with:	sam@
MFC after:	1 month
2006-06-02 19:59:33 +00:00
Ian Dowse
46f1e0d36c If a zero-length bulk or interrupt transfer is requested then assume
USBD_FORCE_SHORT_XFER to ensure that we actually build and execute
a transfer. This means that the various alloc_sqtd_chain functions
will always construct a transfer, so it is safe to modify the
allocated descriptors on return. Previously there were cases where
a zero length transfer would cause a NULL dereference.

Reported by:	bp
2006-05-28 23:37:04 +00:00
Ian Dowse
368030a87a Use the limited scatter-gather capabilities of ehci, ohci and uhci
host controllers to avoid the need to allocate any multi-page
physically contiguous memory blocks. This makes it possible to use
USB devices reliably on low-memory systems or when memory is too
fragmented for contiguous allocations to succeed.

The USB subsystem now uses bus_dmamap_load() directly on the buffers
supplied by USB peripheral drivers, so this also avoids having to
copy data back and forth before and after transfers. The ehci and
ohci controllers support scatter/gather as long as the buffer is
contiguous in the virtual address space. For uhci the hardware
cannot handle a physical address discontinuity within a USB packet,
so it is necessary to copy small memory fragments at times.
2006-05-28 05:27:09 +00:00
Ian Dowse
e97ba859b3 NULL out ii->stdstart and ii->stdend when they are invalid. This
is not necessary for correct operation but makes it clearer that
freed transfer descriptors cannot be accessed.
2006-05-28 01:17:13 +00:00
Ian Dowse
a7c15197cf Fix a harmless typo where the software pointer in the dummy QH for
control transfers did not match the hardware pointer.
2006-05-28 01:07:46 +00:00
Ian Dowse
203eec4b02 Defer axe_tick processing to a USB task, since axe miibus operations
need to sleep. This avoids an INVARIANTS panic. It looks like if_rue
and if_aue need a similar change, but I don't have hardware to test.
2006-05-27 23:46:13 +00:00
Ian Dowse
093daa268f Attempt to follow the procedure described in section 4.10 of the
EHCI spec for linking in new qTDs into an asynchronous QH. This
requires that there is a qTD marked as not active and not halted
at the start of the QH's list, and the hardware will know to re-fetch
the qTD on each pass rather than just looking at the overlay qTD:

  "The host controller must be able to advance the queue from the
  Fetch QH state in order to avoid all hardware/software race
  conditions. This simple mechanism allows software to simply link
  qTDs to the queue head and activate them, then the host controller
  will always find them if/when they are reachable."

This is achieved by keeping an "inactivesqtd" entry on the QH list,
and re-using it each time as the start of the next transfer, and
allocating a new qTD to become the next inactivesqtd. Then a new
transfer can be activated by just setting its "active" flag, which
avoids all the previous messing with overlay qTD state in
ehci_set_qh_qtd().
2006-05-24 03:04:11 +00:00
Ian Dowse
1bbda613eb When usb_event_thread() first starts, wait significantly longer
before starting exploring (4 seconds), and extend the wait period
if new USB buses are attached while waiting.

This works around a problem seen when there is more than one EHCI
controller in the system and you kldload usb.ko after the system
has booted. The problem is that usb.ko contains 3 separate PCI
drivers which get initialised one by one (uhci, ohci, ehci), and
when each driver is initialised, all PCI buses are re-probed after
just the addition of that driver. This means that there can be a
significant delay between the attaching of a companion controller
and the subsequent EHCI attach, so it is possible for the companion
controller's USB 1.x bus to be scanned before the EHCI driver gets
a chance to check if there is really a USB 2.x device connected.
2006-05-23 01:27:23 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
Warner Losh
f4d167bdda Don't use ", but instead use ' instead. I suppose I could have also
used \".  When compiling with USB_VERBOSE, this causes syntax issues.

Noticed by:  Hans Petter Selasky
2006-04-27 17:33:25 +00:00
Florent Thoumie
e79417e5d4 - Add support for the Acer Acerscan 640BT.
- Add documentation bits.

PR:		usb/95616
Submitted by:	Matthieu Guegan <lesaint@gcu.info>
Approved by:	cperciva (mentor)
MFC after:	3 days
2006-04-11 10:44:31 +00:00
Florent Thoumie
281f5eff33 - Add support for the Epson RX425 scanner.
PR:		usb/95346
Submitted by:	Matthieu Guegan <lesaint@gcu.info>
Approved by:	cperciva (mentor)
MFC after:	3 days
2006-04-10 10:21:09 +00:00
Sam Leffler
512537d1a4 stop device so we don't panic on card removal when active
MFC after:	3 days
2006-03-24 19:11:26 +00:00
Ian Dowse
3ee42667a4 Correct the calculation of the report size and only look at reports
that have the specified kind, instead of assuming that there is
only one report of the right kind in the report descriptor.

Submitted by:	Morten Johansen
Obtained from:	NetBSD (indirectly)
PR:		usb/77604
2006-03-22 02:04:12 +00:00
Ian Dowse
1ecfb7ed3d Oops - fix the build in the !USB_DEBUG case. 2006-03-18 17:57:34 +00:00
Ian Dowse
a6725353dd Let the EHCI hardware track the toggle state for bulk and interrupt
transfers. This fixes some cases where the software toggle tracking
was not doing the right thing. For example, a short transfer that
transferred 0 bytes of the requested qTD transfer size does cause
a toggle change, but the existing code was assuming it didn't.

Reported and tested by: pav
MFC after:	2 weeks
2006-03-18 13:55:16 +00:00
Ian Dowse
fad8387468 Sony DSC cameras with revision number 6.0 require the same quirk
as those reporting revision 5.0.

Reported by:	Brian Reichert
MFC after:	1 week
2006-03-17 18:16:22 +00:00
Poul-Henning Kamp
327643e3ca When we get an unknown ATAPI comand, try it even if it is not listed,
in all likelyhood just passing it through will work.
2006-03-05 17:52:32 +00:00
Warner Losh
e8bfdb2a33 Don't free ifaces yet, should fix a panic 2006-03-01 06:31:24 +00:00
Maksim Yevmenkin
2d6b1da721 Make ukbd(4) to not delay break scancodes in "raw" mode.
Developed with:		Norbert Koch < NKoch at demig dot de >
No response from:	freebsd-current@
Tested by:		Norbert Koch < NKoch at demig dot de >
MFC after:		1 day
2006-02-28 03:34:06 +00:00
Warner Losh
04a6a8a8e5 Since we set the decription, we don't need to also print it. Noticed by: ru@ 2006-02-27 19:40:37 +00:00
Warner Losh
b0e8c55437 Don't forget to free the ifaces when we free the ivars 2006-02-27 19:36:22 +00:00
Ian Dowse
564d760afe Add the Tripp-Lite U209-000-R serial adapter.
PR:		usb/78543, usb/93347
MFC after:	1 week
2006-02-27 01:01:27 +00:00