Commit Graph

55 Commits

Author SHA1 Message Date
Andriy Gapon
cd10bffa61 usb: change to one-pass probing of device drivers
This brings USB bus more in line with how newbus is supposed to be used.
Also, because of the two-pass probing the following message was produced
by devd in default configuration when almost any USB device was
connected:
	Unknown USB device: vendor <> product <> bus <>
This should be fixed now.

Note that many USB device drivers pass some information from probe
method to attach method via ivars.  For this to continue working we rely
on the fact that the subr_bus code calls probe method of a winning driver
again before calling its attach method in the case where multiple
drivers claim to support a device.  This is done because device
description is set in successful probe methods and we want to get a correct
device description from a winning driver.  So now this logic is re-used
for setting ivars too.

Reviewed by:	hselasky
MFC after:	1 month
2011-05-18 07:40:12 +00:00
Alexander Motin
669d9046a9 Rework change made at r203146. Instead of reporting all wire errors as
SCSI status errors to CAM (that was wrong, as it too often turned retriable
wire errors into non-retriable REQUEST SENSE errors), do it only for STALL
errors on control pipe of the CBI devices. STALL on control pipe is just
a one of the ways to report error for CBI devices.

PR:		usb/150401, usb/154593.
Reviewed by:	hselasky
MFC after:	1 week
2011-04-11 08:23:27 +00:00
John Baldwin
58ccf5b41c Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by:	bde
2011-01-11 13:59:06 +00:00
Alexander Motin
0aa99d33b5 Allow umass to use bigger transactions for USB 3.0 devices. It is less
important for USB 2.0 devices and some of them reported to have problems
with large transactions. But USB 3.0 benchmarks show that limited number
of transactions per second on USB makes impossible to reach high transfer
speeds without using bigger transactions.

On my tests this change allows to read up to 220MB/s from USB-attached SSD
(at block size of 256-512KB), comparing to only 113MB/s without it.

Reviewed by:	hselasky
2010-10-16 19:29:37 +00:00
Hans Petter Selasky
c791ca5046 Print out correct USB connection speed for USB 3.0 mass storage devices.
Approved by:    thompsa (mentor)
2010-10-04 23:30:44 +00:00
Andrew Thompson
ae538d8533 Reduce the need to accesss struct usb_device by providing functions to access
the product, manufacturer and serial strings.

Submitted by:	Hans Petter Selasky
2010-09-02 04:39:45 +00:00
Andrew Thompson
910cb8feb9 Add missing MODULE_VERSION() definitions, this resolves problems around
duplicate module loads.

PR:		usb/125736
Submitted by:	danger, mm
Reviewed by:	hselasky
2010-09-01 23:47:53 +00:00
Andrew Thompson
b850ecc180 Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after:	1 week
2010-04-22 21:31:34 +00:00
Andrew Thompson
2155c5d814 Rework cam error handling to fix Mitsumi floppy drives.
Submitted by:	mav
2010-01-29 02:38:34 +00:00
Andrew Thompson
c2b2c741a0 Simplify attach for UMASS_PROTO_CBI_I mode and change some switch() returns
into breaks.

Submitted by:	Hans Petter Selesky
2010-01-29 02:35:50 +00:00
Alexander Motin
83c5d981ac MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
Martin Blapp
c2ede4b379 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +00:00
Andrew Thompson
eb58441685 Move all Mass Storage Quirks over to the USB quirk module.
Submitted by:	Hans Petter Selasky
2009-12-23 01:16:24 +00:00
Andrew Thompson
767cb2e29d Remove overuse of exclamation marks in kernel printfs, there mere fact a
message has been printed is enough to get someones attention. Also remove the
line number for DPRINTF/DPRINTFN, it already prints the funtion name and a
unique message.
2009-11-26 00:43:17 +00:00
Andrew Thompson
c13fd8d42b Provide tunables for some of the usb sysctls that affect boot behaviour.
Submitted by:	Andriy Gapon
2009-11-22 21:21:22 +00:00
Andrew Thompson
a1f7c632cc Correct Olympus quirk.
Submitted by:	Pavel Gubin
2009-11-08 21:08:50 +00:00
Andrew Thompson
9dac8e0ed2 Add missing mtx_destroy().
Submitted by:	Sebastian Huber
2009-11-08 21:07:47 +00:00
Andrew Thompson
11cf5c2f81 Change from CAM_TID_INVALID to CAM_SEL_TIMEOUT error code when the usb device
has been yanked, this works around a cam recounting bug when
CAM_DEV_UNCONFIGURED is set late in the detach. In certain conditions the
reference to the XPT device would not be released which would cause the usb
explore thread to sleep forever on "simfree", preventing any new usb devices to
be found/ejected on the bus.

This is intended to be a quick workaround to the problem without touching CAM
so it can be merged to 8.0.

Suggested by:	mav
MFC after:	3 days
2009-10-20 21:29:46 +00:00
Andrew Thompson
a4fcd5cae9 - Remove SAMSUNG_YP_U2 now that it is in the cam layer
- Add quirk from Tobias Grosser for Western Mypassword

Submitted by:	Hans Petter Selasky
2009-09-28 08:00:17 +00:00
Edward Tomasz Napierala
c977dd609b Make umass(4) pass device USB serial number to CAM, making it possible
to e.g. retrieve it using camcontrol(8).

Reviewed by:	scottl, hps (earlier version)
Obtained from:	Wheel Sp. z o.o. (http://www.wheel.pl)
2009-09-04 09:57:03 +00:00
Alfred Perlstein
77c33ae7cc Add mass storage quirks.
PR:             usb/137138,usb/137226,usb/137789,usb/135372

Submitted by:	hps
2009-08-24 05:02:36 +00:00
Alfred Perlstein
03a7d05c2d - FIFO's are always opened separately in read and write
direction even if the actual device is opened for read and
        write. Fix fflags check so that the UFM and URIO drivers work.
Reported by: Krassimir Slavchev

Submitted by:	hps
2009-08-24 04:59:09 +00:00
Andrew Thompson
29bd7d7e9a Sync to p4
- Add support for devices that handle set and clear stall in hardware.
 - Add missing get timestamp function
 - Add more xfer flags

Submitted by:	Hans Petter Selasky
Approved by:	re (kib)
2009-06-27 21:23:30 +00:00
Xin LI
8c9d12305b Add quirks for Actions MP4 player.
Submitted by:	John Hixson <john ixsystems com>
Approved by:	re (kib)
MFC after:	2 weeks
2009-06-26 21:47:37 +00:00
Andrew Thompson
ed6d949afd - Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just   usb.h and usbdi.h
2009-06-23 02:19:59 +00:00
Remko Lodder
b24516038c use PROTO_DEFAULT.
Requested by:	hps
2009-06-21 13:13:13 +00:00
Remko Lodder
2088cbe832 Add support for the Myson Heden 8813.
Note that I also added the usbdev to the list, because the 8813 version
is not yet known there. I might have twisted the sorting there but because
8813 comes before 8818, I added it before that (with _8813 to differentiate)
the item.

PR:		135628
Submitted by:	Yoshikazu GOTO <goto at on-link dot jp>
Approved by:	imp (mentor, implicit)
2009-06-21 11:21:16 +00:00
Andrew Thompson
a593f6b8de s/usb2_/usb_|usbd_/ on all function names for the USB stack. 2009-06-15 01:02:43 +00:00
Andrew Thompson
a8675cae2b Make variables static where appropriate.
Found by:	cscout
2009-06-13 04:56:45 +00:00
Andrew Thompson
ae60fdfba2 Rename usb pipes to endpoints as it better represents what they are, and struct
usb_pipe may be used for a different purpose later on.
2009-06-07 19:41:11 +00:00
Daniel Eischen
b1e4b9fcc4 Add a NO_SYNCHRONIZE_CACHE quirk for an AIPTEK2
part identified as Sunplus Technology Inc.  This
happens to sit in a Rosewill RX81U-ES-25A 2.5" SATA
to USB 2.0 external enclosure.

Reviewed by:    Hans Petter Selasky
2009-05-31 14:48:51 +00:00
Andrew Thompson
e0a69b51ac s/usb2_/usb_/ on all typedefs for the USB stack. 2009-05-29 18:46:57 +00:00
Andrew Thompson
760bc48e7e s/usb2_/usb_/ on all C structs for the USB stack. 2009-05-28 17:36:36 +00:00
Andrew Thompson
9360ae4073 Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.
Submitted by:	Hans Petter Selasky
2009-05-21 01:48:42 +00:00
Andrew Thompson
f29a072444 - rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by:	Hans Petter Selasky [1]
2009-05-21 00:04:17 +00:00
Andrew Thompson
7261357fbc Ensure the bmRequestType is the right type for the incoming control request.
Submitted by:	Hans Petter Selasky
2009-05-13 18:26:55 +00:00
Andrew Thompson
3a67e91430 Sync to P4
Add umass quirks for Alcor AU6390, Cypress PATA 6830XX and MPMan MPF400.

Submitted by:	Hans Petter Selasky
2009-05-13 18:03:23 +00:00
Andrew Thompson
6b1bca02b9 Remove USB shutdown methods from device drivers as its the host controllers
responsibility to detach the bus.

PR:		usb/133896
Submitted by:	Hans Petter Selasky
2009-05-05 15:39:29 +00:00
Andrew Thompson
4eae601ebd MFp4 //depot/projects/usb@159909
- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
  "usb2_config" has a new field called "usb_mode" which select for which mode
  the current xfer entry is active. Options are: a) Device mode only b) Host
  mode only (default-by-zero) c) Both modes.  This change was scripted using
  the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
  the code for the function uses less memory than the table itself.

Submitted by:	Hans Petter Selasky
2009-04-05 18:20:38 +00:00
Andrew Thompson
3b52b6f172 MFp4 //depot/projects/usb@159908
Reduce the amount of memory used by better sizing buffer arrays.

Submitted by:	Hans Petter Selasky
2009-04-05 18:20:24 +00:00
Andrew Thompson
01e1df136a MFp4 //depot/projects/usb@159562
Reapply r190173 with compilation fixed on 64bit arches.

Submitted by:	Hans Petter Selasky
2009-04-05 18:18:01 +00:00
Warner Losh
e952f9cf75 NO_INQUIRY is wrong for this device. Alternatively, if it is right,
it is right for only a tiny fraction of these devices and this
wild-card entry is too broad.

# I run a kernel without this entry at all without ill effects...
2009-03-22 13:17:46 +00:00
Andrew Thompson
96a7948cf6 Revert r190173 as it breaks 64bit arches. 2009-03-21 05:44:22 +00:00
Andrew Thompson
d891ddcaea Add umass quirk.
PR:			usb/132799
Reported by:		Yoshihiro Ota
Submitted by:		Hans Petter Selasky
2009-03-20 22:17:27 +00:00
Andrew Thompson
090f65a6f6 MFp4 //depot/projects/usb@159517
Fix warnings with the IAR compiler.

Submitted by:	Hans Petter Selasky
2009-03-20 22:10:36 +00:00
Andrew Thompson
578d0eff90 MFp4 //depot/projects/usb @159431,159437,159438
- start using the new USB typedefs in the USB core
- Remove usage of USB_ADD_BYTES()

Submitted by:	Hans Petter Selasky
2009-03-20 21:50:54 +00:00
Andrew Thompson
ab42e8b2df MFp4 //depot/projects/usb @159430
- Move tunable defines into usb_core.h and dependancy towards usb_defs.h
- Leave hardcoded defines in "usb_defs.h".
- Allow overriding all tunable defines.
- Add more customisable typedefs.
- Correct maximum device number.

Submitted by:	Hans Petter Selasky
2009-03-20 19:04:31 +00:00
Andrew Thompson
c629193176 MFp4 //depot/projects/usb @159379,159380
Fixes for 8-bit and 16-bit compilation.

Submitted by:	Hans Petter Selasky
2009-03-20 18:59:53 +00:00
Andrew Thompson
296ade6016 MFp4 //depot/projects/usb @159375,159376,159377
Further remove dependancy towards Giant.

Submitted by:	Hans Petter Selasky
2009-03-20 18:56:27 +00:00
Andrew Thompson
39fcd91bb5 MFp4 //depot/projects/usb 159238,159275
Add umass quirks.

Submitted by:	Michael Gmelin
2009-03-17 01:42:46 +00:00