Commit Graph

3050 Commits

Author SHA1 Message Date
Hans Petter Selasky
5b0752bbc1 Add some defines to limit USB memory usage in reduced memory systems. 2013-05-03 09:23:06 +00:00
Hans Petter Selasky
fa49bce566 Allow the default USB template to be specified at compile time. 2013-05-03 08:19:09 +00:00
Hans Petter Selasky
c77a24c24a Add new USB API to get the port path of a USB device.
MFC after:	2 weeks
Requested by:	emaste @
2013-05-03 07:44:58 +00:00
Gleb Smirnoff
47e8d432d5 Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
Hans Petter Selasky
751aaf5a93 Add convenience wrapper functions to run callbacks in the context of the
USB explore thread.
2013-04-23 10:42:15 +00:00
Hans Petter Selasky
0cfbd57ebc Add descriptive comment. 2013-04-23 06:26:54 +00:00
Hans Petter Selasky
d81b160aa5 Add OHCI controller ID.
MFC after:	2 weeks
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2013-04-21 16:02:50 +00:00
Gabor Kovesdan
f0d0985ee9 - Correct mispellings of word miscellaneous
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
2013-04-17 11:43:46 +00:00
Alexander Motin
ec5cd81891 Add ID for ASMedia ASM1042 USB 3.0 controller.
MFC after:	1 week
2013-04-10 17:43:20 +00:00
Hans Petter Selasky
3550618d0b Fix regression issue after r248910.
PR:		arm/177685
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2013-04-07 13:03:57 +00:00
Hans Petter Selasky
a1e969b8b2 Add new USB ID.
PR:		usb/177666
Submitted by:	Nicolai Petri <nicolai@petri.dk>
2013-04-06 17:00:11 +00:00
Hans Petter Selasky
15d4edd3d4 Add missing ifdef's for reduced feature compilations. 2013-04-03 10:31:13 +00:00
Hans Petter Selasky
11a1335af9 Add new USB ID.
MFC after:	1 week
Submitted by:	Bruce Simpson <bms@fastmail.net>
2013-04-03 06:45:21 +00:00
Hans Petter Selasky
3232aae327 Add new USB ID.
PR:		usb/177173
MFC after:	1 week
2013-03-21 07:04:17 +00:00
Aleksandr Rybalko
a2c472e741 Integrate Efika MX project back to home.
Sponsored by:	The FreeBSD Foundation
2013-03-20 15:39:27 +00:00
Hans Petter Selasky
76be9c89ba Fix spelling. 2013-03-20 11:51:26 +00:00
Hans Petter Selasky
565d8205f3 Add new USB ID.
PR:		usb/177105
MFC after:	1 week
2013-03-19 12:52:13 +00:00
Hans Petter Selasky
bd247e9ddd Add new USB ID.
PR:		usb/177013
MFC after:	1 week
2013-03-18 07:02:58 +00:00
Hans Petter Selasky
a1a10f530c Fix typo. 2013-03-13 15:42:04 +00:00
Hans Petter Selasky
23de050b72 - Make quirk for reading device descriptor from broken USB devices.
Else they won't enumerate at all:
hw.usb.full_ddesc=1
- Reduce the USB descriptor read timeout from 1000ms to
500ms. Typical value for LOW speed devices is 50-100ms.
- Enumerate USB device a maximum of 3 times when a port
connection change event is detected, before giving up.

MFC after:	1 month
2013-03-13 15:38:01 +00:00
Gavin Atkinson
cd4c88cad4 Add support for Optoelectronics USB barcode readers to uftdi(4).
Add entries for other Optoelectronics devices to usbdevs.

MFC after:	1 week
2013-03-11 22:17:39 +00:00
Hans Petter Selasky
2e39e9ee71 Fix init/uninit function type. 2013-02-25 10:57:35 +00:00
Hans Petter Selasky
8cb536dd39 Add new USB ID.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2013-02-25 08:24:21 +00:00
Hans Petter Selasky
1b9c9ab29a Fix bad EEPROM parsing code.
MFC after:	2 weeks
2013-02-18 17:55:27 +00:00
Hans Petter Selasky
aafcb73207 Add USB API to read power draw on USB devices.
Update usbconfig to print power draw on USB devices.

MFC after:	2 weeks
Submitted by:	Matt Burke @ icritical.com
2013-02-14 12:22:40 +00:00
Hans Petter Selasky
626d8465fb Remove unused variable.
MFC after:	1 week
2013-02-13 15:43:15 +00:00
Hans Petter Selasky
a18a7a414a Resolve a LOR after r246616. Protect control requests using the USB device
enumeration lock. Make sure all callers of usbd_enum_lock() check the return
value. Remove the control transfer specific lock. Bump the FreeBSD version
number, hence external USB modules may need to be recompiled due to a USB
device structure change.

MFC after:	1 week
2013-02-13 12:35:17 +00:00
Hans Petter Selasky
b7f9bfb502 Add new USB ID to FTDI driver.
MFC after:	1 week
PR:		kern/175893
Submitted by:	Tomek
2013-02-13 08:28:27 +00:00
Hans Petter Selasky
6950c75f40 - Move scratch data from the USB bus structure to the USB device structure
so that simultaneous access cannot happen. Protect scratch area using
the enumeration lock. Also reduce stack usage in usbd_transfer_setup()
by moving some big stack members to the scratch area. This saves around
200 bytes of stack.
- Fix a whitespace.

MFC after:	1 week
2013-02-10 10:56:13 +00:00
Hans Petter Selasky
74b50dd979 Fix correct use of USB header files. 2013-02-10 10:55:20 +00:00
Hans Petter Selasky
645e4d17f0 - Streamline detach logic in wlan drivers, so that
freed memory cannot be used during detach.
- Remove all panic() calls from the urtw driver because
  panic() is not appropriate here.
- Remove redundant checks for device detached in
  device detach callbacks.
- Use DEVMETHOD_END to mark end of device methods.

MFC after:	2 weeks
2013-02-10 10:36:16 +00:00
Hans Petter Selasky
056e0b5dcd Make sure we don't leak command buffers when a USB
command transfer fails.

MFC after:	1 week
Reported by:	Ian FREISLICH
2013-02-08 22:51:09 +00:00
Hans Petter Selasky
2d8a425be0 Fix regression issue after r244503:
Correct init order to fix a NULL pointer access.

MFC after:	1 week
Reported by:	Ian FREISLICH
2013-02-08 21:15:47 +00:00
Hans Petter Selasky
9b3a48ee6f Add defines to more easily allow a single threaded version of the FreeBSD
USB stack. This is useful for non-kernel purposes, like the loader.
2013-02-05 14:44:25 +00:00
Hans Petter Selasky
ff182db6c8 Fix some nits. 2013-02-05 13:30:07 +00:00
Hans Petter Selasky
664413a163 Fix for hardware checksum offloading in SMSC driver.
This also fixes IPv6 support for this particular hardware.

Submitted by:	Daisuke Aoyama
2013-02-01 07:26:25 +00:00
Hans Petter Selasky
7b0866b032 Make use of USB ID sections configurable. 2013-02-01 07:05:43 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Hans Petter Selasky
e465b973a1 Do not unnecessarily split a string literal, because
splitting it makes it hard to grep.

Submitted by:	Christoph Mallon
2013-01-30 16:08:05 +00:00
Hans Petter Selasky
b51875c9f6 Use string literals in string descriptors for marginally
better readability.

Submitted by:	Christoph Mallon
2013-01-30 16:05:54 +00:00
Hans Petter Selasky
01923b399d Use an anonymous struct for generated string descriptors.
Submitted by:	Christoph Mallon
2013-01-30 15:49:37 +00:00
Hans Petter Selasky
23ab08715c Provide one global language string descriptor for
american english instead of giving each module its
own.

Submitted by:	Christoph Mallon
2013-01-30 15:46:26 +00:00
Hans Petter Selasky
d2b99310b1 Modify the FreeBSD USB kernel code so that it can be compiled directly
into the FreeBSD boot loader, typically for non-USB aware BIOSes, EFI systems
or embedded platforms. This is also useful for out of the system compilation
of the FreeBSD USB stack for various purposes. The USB kernel files can
now optionally include a global header file which should include all needed
definitions required to compile the FreeBSD USB stack. When the global USB
header file is included, no other USB header files will be included by
default.

Add new file containing the USB stack configuration for the
FreeBSD loader build.

Replace some __FBSDID()'s by /* $FreeBSD$ */ comments. Now all
USB files follow the same style.

Use cases:
 - console in loader via USB
 - loading kernel via USB

Discussed with:		Hiroki Sato, hrs @ EuroBSDCon
2013-01-30 15:26:04 +00:00
Hans Petter Selasky
7e7b1248d1 Add missing header file inclusion guard. 2013-01-30 10:59:42 +00:00
Hans Petter Selasky
250fb892d3 Add missing NULL pointer check.
Reported by:	Lars Engels
MFC after:	1 week
2013-01-30 07:48:43 +00:00
John Baldwin
a8df530ddc Mark 'ticks', 'time_second', and 'time_uptime' as volatile to prevent the
compiler from caching their values in tight loops.

Reviewed by:	bde
MFC after:	1 week
2013-01-28 19:38:13 +00:00
Hans Petter Selasky
3758c66a4f Remove some extra and not needed space characters.
MFC after:	1 week
2013-01-28 10:52:24 +00:00
Hans Petter Selasky
1ef133b390 Add new USB ID.
Submitted by:	Ramil
PR:		usb/175639
MFC after:	1 week
2013-01-28 07:22:44 +00:00
Hans Petter Selasky
b7b11d00f6 Fix regression issue after r244500 and r244503:
If a BUSDMA load operation results in a single segment which
is greater than the PAGE_SIZE, the USB computed physical
addresses will not be correct. Make sure that the first
segment is unfolded like the sub-sequent segments are into
USB_PAGE_SIZE big ranges.

Found by:	Alexander Nedotsukov
MFC after:	1 week
2013-01-27 18:01:03 +00:00
Hans Petter Selasky
5a47db4708 Add new USB quirk.
PR:		usb/175599
Submitted by:	Juan J Lopez
MFC after:	1 week
2013-01-26 13:44:24 +00:00
Hans Petter Selasky
a9216e0b16 Add new quirk and correct old one.
PR:		usb/175454
MFC after:	1 week
2013-01-21 07:02:41 +00:00
Alexander Kabaev
e15f85e71c Do not pretend to have autosense data when no such data is available.
Make umass return an error code if SCSI sense retrieval request
has failed. Make sure scsi_error_action honors SF_NO_RETRY and
SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes.

Reviewed by: hselasky (umass), scottl (cam)
2013-01-19 03:19:39 +00:00
Hans Petter Selasky
c25ca7790c Add new u3g device quirk.
Submitted by:	Lowell Gilbert
MFC after:	1 week
2013-01-14 17:41:04 +00:00
Alexander Motin
cda00e8ccd Freeze device queue before returning errors to CAM. This is required
for proper error recovery, including keeping original request order.

Reviewed by:	hselasky
2013-01-12 11:36:23 +00:00
Hans Petter Selasky
bdf43bb5c3 Bugfix: Fix sizeof() argument.
Found by:	Haakon Loevdal
MFC after:	1 week
2013-01-10 08:06:12 +00:00
Hans Petter Selasky
60867f577a Fix detection of Razer Copperhead as a USB mouse.
Factor out USB mouse and keyboard detection logic.
Reject USB keyboards which have mouse alike HID items
in their HID descriptors.

Submitted by:	Matthew W
MFC after:	1 week
2013-01-10 07:45:46 +00:00
Hans Petter Selasky
6317f31612 Shave off another register write to save some more
microseconds of PCI access time.

Tested by:	sos @
Submitted by:	sos @
MFC after:	1 week
2013-01-08 19:38:57 +00:00
Hans Petter Selasky
878b1fbdce Optimise the XHCI interrupt handling.
This patch will save CPU time when the XHCI interrupt is
shared with other devices.
Only check event rings when interrupt bits are set.
Otherwise would indicate hiding possible hardware fault(s).

Tested by:	sos @
Submitted by:	sos @
MFC after:	1 week
2013-01-07 16:38:13 +00:00
Hans Petter Selasky
d021dd19b6 Fix for "run0: wcid=xx out of range" error message.
MFC after:	1 week
PR:		usb/174963
Submitted by:	PseudoCylon <moonlightakkiy@yahoo.ca>
2013-01-04 20:44:17 +00:00
Hans Petter Selasky
92e2321883 Add new USB ID.
PR:		usb/174814
Submitted by:	Andy Balholm
MFC after:	1 week
2012-12-29 21:22:38 +00:00
Mark Johnston
7716eb4c40 Add the NO_SYNC_CACHE quirk for all Apple USB MSC devices, as they
typically do not handle the SYNCHRONIZE_CACHE command - they either
return an error or the firmware enters a reset loop.

Reviewed by:	hselasky
Approved by:	rstone (co-mentor)
MFC after:	2 weeks
2012-12-26 22:21:27 +00:00
Hans Petter Selasky
607bbcba30 Fix more regression issue after r244503.
usbd_transfer_setup() does not set a default length for USB transfers.
Only the number of frames is automatically setup.

MFC after:	1 week
2012-12-24 10:10:18 +00:00
Hans Petter Selasky
2691bc24f1 Fix regression issue after r244503.
MFC after:	1 week
2012-12-23 10:21:01 +00:00
Hans Petter Selasky
1a7c3e9097 Regression issue:
Use a boundary of zero, hence a PAGE_SIZE boundary
is implied by all memory allocations.

Background:
Busdma has problems to allocate more than PAGE_SIZE
bytes when the boundary is PAGE_SIZE bytes too.
Initially it was thought that a boundary of PAGE_SIZE
bytes will only affect loading of DMA memory, so that
segments get split correctly, but it also affects
allocation of DMA'able memory.

Solution:
USB can detect big segments and split them as required
by the USB code.

MFC after:	1 week
Reported by:	gonzo
2012-12-21 14:17:39 +00:00
Hans Petter Selasky
c180b3986d Make sure all USB drivers allocate buffer memory
through the USB API and/or busdma.

The following assumptions have been made:
umass - buffers passed from CAM/SCSI layer are OK
network - mbufs are OK.

Some other nits while at it.

MFC after:	1 week
Suggested by:	imp
2012-12-20 18:38:02 +00:00
Hans Petter Selasky
a6d2f40ec8 Allocate separate USB buffers for DMA'ed data, so that
DMA data does not reside next to non DMA data. This
might cause more memory to be allocated, but solves
problems on platforms using manual cache
synchronization.

Add a convenience function to get the buffer only
from a USB transfer's page cache structure.

MFC after:	1 week
Suggested by:	imp
2012-12-20 18:13:37 +00:00
Hans Petter Selasky
f578aba724 Add support for throttling UMASS.
Mostly useful for debugging purposes.

MFC after:	1 week
2012-12-20 17:14:10 +00:00
Hans Petter Selasky
3d6709a572 Make sure we block recursion on TTY's inwakeup callback
Suggested by:	davide
MFC after:	1 week
2012-12-20 16:21:02 +00:00
Hans Petter Selasky
9fbf6da58c Add new USB ID.
MFC after:	1 week
Submitted by:	Artyom Mirgorodskiy
2012-12-09 09:58:44 +00:00
Gleb Smirnoff
c6499eccad Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.
2012-12-04 09:32:43 +00:00
Hans Petter Selasky
5e184962dd - Add support for Etron EJ168 USB 3.0 Host Controllers.
This brand of controllers expects that the number of
contexts specified in the input slot context points
to an active endpoint context, else it refuses to
operate.

- Ring the correct doorbell when streams mode is used.
- Wrap one or two long lines.

Tested by:	Markus Pfeiffer (DragonFlyBSD)
MFC after:	1 week
2012-12-01 22:13:38 +00:00
Eitan Adler
1a12569c85 Add support for AT&T Sierra Wireless USB 3G adapter
PR:		kern/173982
Submitted by:	Eric Camachat <eric@camachat.org>
Approved by:	cperciva (implicit)
MFC after:	1 week
2012-11-29 00:32:03 +00:00
Hans Petter Selasky
8e5e664ccc Remove no longer needed quirk.
Submitted by:	Mark Johnston
2012-11-23 08:22:06 +00:00
Oleksandr Tymoshenko
82b036b9c6 Look for MAC address in FDT tree nodes that are usb network devices and
have either "mac-address" or "local-mac-addrress" property.
2012-11-23 03:34:12 +00:00
Hans Petter Selasky
9efb73396e Fix uplcom clear stall logic for PL2303HX.
Submitted by:	Mark Johnston
MFC after:	1 week
2012-11-21 22:04:40 +00:00
Hans Petter Selasky
b70f0569e8 Add new USB IDs.
MFC after:	1 week
PR:		usb/173503
2012-11-12 07:25:51 +00:00
Hans Petter Selasky
e71628651b Fix LOW and FULL speed USB INTERRUPT endpoint support for the
DWC OTG driver. Fix a hang issue when using LOW and FULL speed
BULK traffic. Make sure we don't ask for data in the last
microframe. This allows using devices like USB mice and USB
keyboards connected to the RPI-B.

Suggested by:	gonzo @
2012-11-09 16:28:58 +00:00
Hans Petter Selasky
78abbdd54f Make the USB ethernet methods constant again in if_udav.c,
so that both adapter variants can be attached at the same
time.

MFC after:	0 days
2012-11-08 16:31:13 +00:00
Kevin Lo
b72d9fd455 Add new USB device ID. 2012-11-08 09:29:05 +00:00
Hans Petter Selasky
9a630052d4 Add lock asserts instead of "auto-locking".
MFC after:	1 weeks
Suggested by:	ed @
2012-11-07 18:59:42 +00:00
Hans Petter Selasky
3b8e984374 The tty_inwakeup callback appears to be called both locked and unlocked.
Handle the required locking automatically for now.

MFC after:	1 weeks
2012-11-07 18:44:05 +00:00
Hans Petter Selasky
3e2d883535 Patch to improve USB serial console.
MFC after:	1 weeks
Submitted by:	Bruce Evans
2012-11-07 08:13:56 +00:00
Marcel Moolenaar
ef3afadd29 Add the UQ_MSC_NO_PREVENT_ALLOW quirk to handle devices that do not support
the 'PREVENT/ALLOW MEDIUM REMOVAL' SCSI command. An example of such a
device is the STmicro ST72682. We send the SCSI command for every open and
close, which can result in a significant amount of spam on the console
during boot.

Reviewed by:	hps@
2012-11-05 21:03:38 +00:00
Hans Petter Selasky
d30d96ea57 Add a jitter buffer in the common USB serial driver code which
temporarily stores characters if the TTY buffer is full when
used a as a console. This can happen when a console is suspended.
Also properly do the flow stop signalling when this happens and
flow start when the condition changes back to normal again.

Bump __FreeBSD_version to force external kernel modules
to be recompiled. No kernel API changes.

MFC after:	1 week
Suggested by:	ed @
2012-11-05 17:50:40 +00:00
Marcel Moolenaar
db43ed3750 Allow using the embedded EHCI host controller in Freescale SoCs
by adding the missing bits. See ehci_fsl.c for their use.
2012-11-03 21:05:32 +00:00
Hans Petter Selasky
7a75e881d7 If a USB mass storage device doesn't respond properly
to the initial SCSI INQUIRY command, enable all quirks.
This fixes detection of some Transcend TS2GUFM devices.

MFC after:	1 week
Reported by:	Michael Dexter
2012-10-30 16:56:16 +00:00
Hans Petter Selasky
3557aa50ce Add support for Fast Track Ultra 8R from M-audio.
MFC after:	1 week
2012-10-26 11:41:57 +00:00
Hans Petter Selasky
83cadd7dcc Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.
Rearrange the tunables and belonging sysctl declarations, so
that they are next to eachother.

Submitted by:	n_hibma @
MFC after:	1 week
2012-10-26 06:04:47 +00:00
Hans Petter Selasky
3750641271 Make several timing parameters of the USB enumeration sequence tuneable.
Also update the port reset time from 250ms to 50ms. Some USB devices
have a hard limit in hardware at 222ms for the port reset time and will
not enumerate unless this delay is closer to the usb.org defined value.
This patch can fix enumeration with some USB devices.

Tested by:	Guido van Rooij
Submitted by:	Nick Hibma
MFC after:	1 week
2012-10-24 07:23:29 +00:00
Eitan Adler
db702c59cf remove duplicate semicolons where possible.
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:37 +00:00
Eitan Adler
68ea9fd7d6 Make uhid attach to devices that look like keyboards
or mice if the quirk which prevents higher level
drivers from attaching is set.

PR:		usb/172458
Submitted by:	Vitaly Magerya <vmagerya@gmail.com>
Reviewed by:	hselasky
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:25 +00:00
Eitan Adler
3d6e060835 Add support for iPhone 5 tethering.
PR:		usb/172172
Submitted by:	Ali Mashtizadeh <mashtizadeh@gmail.com>
Approved by:	cperciva
MFC after:	1 week
2012-10-21 03:30:36 +00:00
Gleb Smirnoff
42a58907c3 Make the "struct if_clone" opaque to users of the cloning API. Users
now use function calls:

  if_clone_simple()
  if_clone_advanced()

to initialize a cloner, instead of macros that initialize if_clone
structure.

Discussed with:		brooks, bz, 1 year ago
2012-10-16 13:37:54 +00:00
Nick Hibma
da016e84de Implement modem control in u3g. Tested on Option GTM382W, Huawei E220,
and Sierra Wireless MC8790V. Also implement the .ucom_poll method.

Note: This makes it possible to use lqr/echo in ppp.conf. And it
resolves ppp hanging during the PPp> phase.

Reviewed by:	hps
MFC after:	1 week
2012-10-14 19:15:54 +00:00
Eitan Adler
d6025c7bb7 Add support for the extrememory Snippy
PR:		usb/159611
Submitted by:	Fabian Keil <fk@fabiankeil.de>
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:45 +00:00
Eitan Adler
c0f4985dbd Add support for Feiya Elango USB MicroSD
PR:		usb/153599
Submitted by:	CyberLeo <cyberleo@cyberleo.net>
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:40 +00:00
Eitan Adler
35ed5bb738 Add support for the Buffalo RUF2 flash drive.
PR:		usb/166848
Submitted by:	Andrew Gregory <andrew@scss.com.au>
Reviewed by:	hselasky
Approved by:	cperciva (implicit)
MFC after:	3 days
2012-10-14 17:26:32 +00:00
Alexander Motin
72acfaabbf - Remove ancient checks for sim->softc == NULL. It can't be NULL, as it is
set not-NULL during SIM registration and set to UMASS_GONE on destruction.
Debug messages there look broken for at least 9 years, as they dereference
softc value that was just checked to be equal to NULL.
 - Remove magic pointer value UMASS_GONE and use simple NULL instead.

Found by:	Clang Static Analyzer
2012-10-10 22:02:11 +00:00
Kevin Lo
9823d52705 Revert previous commit...
Pointyhat to:	kevlo (myself)
2012-10-10 08:36:38 +00:00
Kevin Lo
a10cee30c9 Prefer NULL over 0 for pointers 2012-10-09 08:27:40 +00:00