summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/storage
Commit message (Collapse)AuthorAgeFilesLines
* Clear correct data structure.hselasky2013-09-111-1/+3
| | | | | MFC after: 1 week Approved by: re (hrs)
* Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on ↵sbz2013-01-303-3/+5
| | | | | | | device_method_t arrays Reviewed by: cognet Approved by: cognet
* Modify the FreeBSD USB kernel code so that it can be compiled directlyhselasky2013-01-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* Do not pretend to have autosense data when no such data is available.kan2013-01-191-3/+7
| | | | | | | | 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)
* Freeze device queue before returning errors to CAM. This is requiredmav2013-01-121-15/+20
| | | | | | for proper error recovery, including keeping original request order. Reviewed by: hselasky
* Fix more regression issue after r244503.hselasky2012-12-241-0/+4
| | | | | | | usbd_transfer_setup() does not set a default length for USB transfers. Only the number of frames is automatically setup. MFC after: 1 week
* Make sure all USB drivers allocate buffer memoryhselasky2012-12-201-83/+87
| | | | | | | | | | | | | 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
* Add support for throttling UMASS.hselasky2012-12-201-2/+24
| | | | | | Mostly useful for debugging purposes. MFC after: 1 week
* Add the UQ_MSC_NO_PREVENT_ALLOW quirk to handle devices that do not supportmarcel2012-11-051-0/+11
| | | | | | | | | 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@
* Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.hselasky2012-10-261-2/+1
| | | | | | | | Rearrange the tunables and belonging sysctl declarations, so that they are next to eachother. Submitted by: n_hibma @ MFC after: 1 week
* - Remove ancient checks for sim->softc == NULL. It can't be NULL, as it ismav2012-10-101-57/+3
| | | | | | | | | 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
* Fix compiler warnings, mostly signed issues,hselasky2012-04-023-23/+23
| | | | | | when USB modules are compiled with WARNS=9. MFC after: 1 weeks
* Style change: Expand redundant #if's. Remove a couple of empty lines.hselasky2012-03-011-101/+12
| | | | MFC after: 1 week
* Close a detach race. Make sure all pendinghselasky2012-03-011-2/+6
| | | | | | CCB's get canceled at device detach. MFC after: 1 week
* Enable power save mode for the USB storage device driver.hselasky2011-11-121-0/+3
| | | | MFC after: 1 week
* Style change.hselasky2011-11-123-21/+26
| | | | | | | | | | | | - Make it easier to port the USB code to other platforms by only using one set of memory functions for clearing and copying memory. None of the memory copies are overlapping. This means using bcopy() is not required. - Fix a compile warning when USB_HAVE_BUSDMA=0 - Add missing semicolon in avr32dci. - Update some comments. MFC after: 1 week
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-072-2/+2
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Add descriptor sense support to CAM, and honor sense residuals properly inken2011-10-031-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only. mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed. sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly. sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data(). ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key. mps_sas.c, mpt_cam.c: Set the sense residual properly. iir.c: Use scsi_set_sense_data() instead of building sense data by hand. iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly. umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly. isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual. MFC after: 3 days Sponsored by: Spectra Logic Corporation
* This patch adds automatic detection of USB mass storage deviceshselasky2011-09-021-6/+0
| | | | | | | | | | | | which does not support the no synchronize cache SCSI command. The __FreeBSD_version version macro has been bumped and external kernel modules needs to be recompiled after this patch. Approved by: re (kib) MFC after: 1 week PR: usb/160299
* - Export the URIO USB device ID's.hselasky2011-06-241-9/+12
| | | | | | - Add checks for configuration and interface index. MFC after: 3 days
* - Move all USB device ID arrays into so-called sections,hselasky2011-06-241-0/+5
| | | | | | | | | | | | sorted according to the mode which they support: host, device or dual mode - Add generic tool to extract these data: tools/bus_autoconf Discussed with: imp Suggested by: Robert Millan <rmh@debian.org> PR: misc/157903 MFC after: 14 days
* usb: change to one-pass probing of device driversavg2011-05-182-9/+2
| | | | | | | | | | | | | | | | | | | | | 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
* Rework change made at r203146. Instead of reporting all wire errors asmav2011-04-111-13/+19
| | | | | | | | | | | 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
* Remove unneeded includes of <sys/linker_set.h>. Other headers that usejhb2011-01-113-3/+0
| | | | | | it internally contain nested includes. Reviewed by: bde
* Allow umass to use bigger transactions for USB 3.0 devices. It is lessmav2010-10-161-0/+1
| | | | | | | | | | | | 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
* Print out correct USB connection speed for USB 3.0 mass storage devices.hselasky2010-10-041-6/+15
| | | | Approved by: thompsa (mentor)
* Reduce the need to accesss struct usb_device by providing functions to accessthompsa2010-09-021-10/+9
| | | | | | the product, manufacturer and serial strings. Submitted by: Hans Petter Selasky
* Add missing MODULE_VERSION() definitions, this resolves problems aroundthompsa2010-09-012-0/+2
| | | | | | | | duplicate module loads. PR: usb/125736 Submitted by: danger, mm Reviewed by: hselasky
* Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this hadthompsa2010-04-223-6/+6
| | | | | | the illusion of a tunable setting but was always turned on regardless. MFC after: 1 week
* Rework cam error handling to fix Mitsumi floppy drives.thompsa2010-01-291-4/+12
| | | | Submitted by: mav
* Simplify attach for UMASS_PROTO_CBI_I mode and change some switch() returnsthompsa2010-01-291-25/+27
| | | | | | into breaks. Submitted by: Hans Petter Selesky
* MFp4: Large set of CAM inprovements.mav2010-01-281-77/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* Remove extraneous semicolons, no functional changes.mbr2010-01-071-2/+2
| | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week
* Move all Mass Storage Quirks over to the USB quirk module.thompsa2009-12-231-685/+82
| | | | Submitted by: Hans Petter Selasky
* Remove overuse of exclamation marks in kernel printfs, there mere fact athompsa2009-11-261-1/+1
| | | | | | 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.
* Provide tunables for some of the usb sysctls that affect boot behaviour.thompsa2009-11-221-0/+2
| | | | Submitted by: Andriy Gapon
* Correct Olympus quirk.thompsa2009-11-081-1/+1
| | | | Submitted by: Pavel Gubin
* Add missing mtx_destroy().thompsa2009-11-081-0/+1
| | | | Submitted by: Sebastian Huber
* Change from CAM_TID_INVALID to CAM_SEL_TIMEOUT error code when the usb devicethompsa2009-10-201-2/+3
| | | | | | | | | | | | | | 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
* - Remove SAMSUNG_YP_U2 now that it is in the cam layerthompsa2009-09-281-4/+4
| | | | | | - Add quirk from Tobias Grosser for Western Mypassword Submitted by: Hans Petter Selasky
* Make umass(4) pass device USB serial number to CAM, making it possibletrasz2009-09-041-0/+46
| | | | | | | 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)
* Add mass storage quirks.alfred2009-08-241-0/+16
| | | | | | PR: usb/137138,usb/137226,usb/137789,usb/135372 Submitted by: hps
* - FIFO's are always opened separately in read and writealfred2009-08-241-3/+0
| | | | | | | | 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
* Sync to p4thompsa2009-06-271-1/+2
| | | | | | | | | - 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)
* Add quirks for Actions MP4 player.delphij2009-06-261-0/+4
| | | | | | Submitted by: John Hixson <john ixsystems com> Approved by: re (kib) MFC after: 2 weeks
* - Make struct usb_xfer opaque so that drivers can not access the internalsthompsa2009-06-233-283/+373
| | | | - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h
* use PROTO_DEFAULT.remko2009-06-211-1/+1
| | | | Requested by: hps
* Add support for the Myson Heden 8813.remko2009-06-211-0/+4
| | | | | | | | | | | 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)
* s/usb2_/usb_|usbd_/ on all function names for the USB stack.thompsa2009-06-153-94/+94
|
* Make variables static where appropriate.thompsa2009-06-132-3/+3
| | | | Found by: cscout
OpenPOWER on IntegriCloud