summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/umass_scsi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Simplify/refactor the way vendor/product/serial informations arelandry2018-05-011-2/+2
| | | | | | | | | | | | | | | | | | gathered from usb devices. Cache them early in usbd_new_device() instead of querying the device several times (the content wont change anyway) and uselessly generating usb traffic (which could conflict with other access..) The heuristic stays the same, first look in the device descriptor, then try to match against usb_known_vendors/usb_known_products, then fallback to use the idVendor/idProduct codes. Remove the now useless 'usedev' parameter from usbd_fill_deviceinfo(). Tested from bsd & bsd.rd. suggested by and ok mpi@
* Fold umass_atapi_attach() and umass_scsi_setup() into umass_scsi_attach() tokrw2016-08-031-55/+29
| | | | | | shorten and simplify code. No intentional functional change.
* Set SDEV_UMASS on all umass devices, even when they use ATAPI orkrw2016-08-011-3/+3
| | | | | | | | | | | | UFI command sets. Probe all the LUNs a device reports instead of assuming ATAPI and UFI devices always have 1 LUN. Motivated by the device David Vasek reported as claiming to be ATAPI but wanting to use >1 LUN. Committing quickly to smoke out the inevitable device that works in the exact opposite way. All hail USB. ok kettenis@
* Refactor umass_detach() in order to pass a size to free(9).mpi2015-12-161-8/+22
| | | | Based on a diff from Mathieu <naabed AT poolp DOT org>.
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* Fix debug printfs.mpi2014-08-081-5/+5
|
* Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().pirofti2013-11-061-2/+2
| | | | Okay mpi@
* correct tv_sec handling in debug codederaadt2013-04-221-7/+7
| | | | ok guenther
* Backout a bunch of my SCSI commits from c2k11. At least one of thesematthew2011-07-171-8/+8
| | | | | | is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
* Switch umass(4) to use a single target scsibus withmatthew2011-07-091-7/+6
| | | | | | | SCSI_NO_ADAPTER_TARGET instead of a two target bus with a reserved "host" target. ok krw@
* First batch of converting SCSI HBAs from setting saa_targets andmatthew2011-07-081-4/+5
| | | | | | saa_luns instead of adapter_buswidth and luns in the prototype link. ok dlg@, miod@
* On OpenBSD, we've always attached scsibus(4) to umass(4), even formatthew2011-05-241-14/+8
| | | | | | | ATAPI devices. atapiscsi(4) is only for handling ATAPI devices on an ATA bus, so umass(4) shouldn't care about it. ok krw@, dlg@; no objections from deraadt@
* Simplify umass devid generation. Only use the last 12 characters ofmatthew2011-04-191-10/+14
| | | | | | | the USB serial number so as to limit the overall devid to just 20 characters. "Lovely!" deraadt@
* Include USB vendor and product ids when manufacturing a unique disk idmatthew2011-04-191-5/+11
| | | | | | from a USB serial number, as recommended by the umass spec. ok dlg@
* add a new "serial" devid type for scsi devices. add code to usb that fakesdlg2011-04-061-1/+23
| | | | | | it up by using the usb devices iSerial thing. ok deraadt@
* umass is set up to only handle one command on the bus at any pointdlg2010-09-211-1/+36
| | | | | | | | | | | | | | in time, which is a problem if your umass device has multiple luns on it. if multiple commands are issued at the same time then they step on some shared state, which in turn causes some interesting panics. this diff introduces an iopool in umass so only one command can be "allocated" and scheduled at a time. found, reproduced and investigated by krw@ fix verified by krw@ ok matthew@ krw@
* Remove all adapter-specific 'struct scsi_device's. They are never used. Firstkrw2010-06-281-9/+1
| | | | | | | | step in elminating 'struct scsi_device' entirely. Spotted and initial diff from matthew@. ok matthew@ dlg@ deraadt@ marco@ miod@
* New scsi code seems to be stable. Pluck previously identifiedkrw2010-05-201-10/+2
| | | | | | | low-hanging splbio/splx pairs that are no longer needed and see if this reveals any hidden scsi flaws. ok dlg@
* Change the scsi_cmd function member of scsi_adapter from int tokrw2010-03-231-7/+5
| | | | | | | | | | | | | void. Use XS_NO_CCB error in the scsi command (xs) to report the NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE confusion and untangles the midlayer from the adapter a bit more. Eyes and some fixes by miod@ There may be some compile issues on little used (i.e. I don't have any) drivers but the change is mechanical and thus easy to remedy. ok dlg@
* Fix another long standing double scsi_done() bug. This time when akrw2010-01-131-28/+44
| | | | | | | POLL'ed command returned a SENSE error. Found on claudio's USB stick which doesn't like SYNCH CACHE commands. ok dlg@
* Zap all setting of ITSDONE in drivers that don't look at it. Nobodykrw2010-01-091-5/+1
| | | | | | | else cares so it's just noise. Drivers that actually look at ITSDONE are unchanged. ok marco@ (for his files) dlg@ beck@
* Revert the 'optimization' I attempted in r1.21 since it turns outkrw2009-07-021-3/+9
| | | | | | | | | that returning COMPLETE for non-SCSI_POLL commands is significant. Fixes double free of xs and subsequent crashes caused by pulling out USB media while i/o is active. Problem analyzed & fix discovered by hshoexer@. A more general fix may follow post-4.6. ok miod@ deraadt@.
* Extend the scsi_adapter minphys() callback to take a struct scsi_link *miod2009-02-161-3/+3
| | | | | | as additional argument. This will allow intermediate layers between scsi devices such as sd and scsi host adapters to take appropriate action if necessary.
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* Merge show_scsi_xs() and show_scsi_cmd() and move invocation so thekrw2008-06-131-8/+1
| | | | | | | | | | | | | debug output shows the xs/command before it's issued rather than displaying it on command completion. Some commands don't come back and it would be nice to see their details. While here nuke invocations of scsi_show* in umass. If you want SCSI debug output use SCSI debug options. Only affects SCSI debug output. ok marco@
* Doh. Setting ITSDONE and returning SUCCESSFULLY_QUEUED just meanskrw2007-10-201-9/+3
| | | | | | there is another splbio()/splx and a check for ITSDONE before falling into the COMPLETE case. So just return COMPLETE if the command has completed (or never started). Simpler all around.
* DO NOT access xs after calling scsi_done(xs). It's not there anymore.krw2007-10-201-6/+8
| | | | 'totally OK' deraadt@
* malloc+memset(,0,) -> malloc+M_ZERO. 'Fixes' not zeroing of allkrw2007-10-091-4/+2
| | | | | allocated memory, as I can't see an obvious initialization of the memory elsewhere. NetBSD uses M_ZERO here.
* Remove the definition and use of umass/umass_quirks related macros.mbalmer2007-06-131-3/+3
| | | | | | No binary change. ok dlg.
* Remove the definition and use of the USBDEVNAME macro.mbalmer2007-06-101-7/+7
| | | | | | | (This might look easy, but it was a big diff. Thanks to dlg and especially jsg for looking over it; we found at least four mistakes in the initial diff.) ok jsg.
* Remove the definition and use of the USBDEV macro. It only created confusionmbalmer2007-06-101-3/+3
| | | | | | | | and the address of it's argument: USBDEV(sc->sc_dev) yields &sc->sc_dev. No binary changes. ok jsg.
* unitialized variable, busted by dlg, fixed by dlgderaadt2006-11-301-1/+3
|
* give scsi controllers a real attach args to fill in when attaching scsibus.dlg2006-11-281-4/+10
| | | | ok miod@ marco@ deraadt@
* PQUIK_NOMODESENSE no longer does anything, and PQUIRK_NOBIGMODESENSE waskrw2005-05-251-9/+2
| | | | | defined to be 0. Expunge references. Null entries in quirks table will be removed later.
* Try to ensure that UFI/ATAPI USB umass devices always get the zerokrw2005-05-141-3/+1
| | | | | | | | | | | | padded 12 byte commands mandated by the standard. Adapt the Linux data length twiddling on certain commands. We used to have some of this in a different form, curtesy of csapuntz@, but it got lost in subsequent merges. Fixes the USB card reader of Quentin Barnes who provided much testing and feedback for over a year! Tested by drahn@, ok marco@, 'this is good stuff' deraadt@.
* Add SDEV_UMASS flag, analogous to SDEV_ATAPI, and use it to force akrw2005-04-271-1/+2
| | | | | | | | | | full LUN scan on UMASS SCSI targets. UMASS provides reliable max lun information so we shouldn't waste time. Fixes many x-in-1 card reader/writers that report identical INQUIRY information for every slot they provide. Lots of diagnosis and testing by dlg@, ok dlg@, 'I can live with this' marco@.
* Add support for polled umass/SCSI transactions. Should eliminate the panicspascoe2005-04-011-18/+23
| | | | | | seen at reboot time after writing to umass devices. ok dlg@, testing markus@
* remove an unused vardlg2004-07-221-4/+2
| | | | ok krw@
* from netbsd, umass.c 1.100 1.113 1.115, umass_scsipi.c 1.11, umassvar.h 1.21dlg2004-07-211-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | log message for umass 1.98, umass_scsipi.c 1.11, umassvar.h 1.21: Fix several problems with CCI handling, and enable it: * We were never calling the callback function when we got a UFI CCI(!). * We were passing a bogus residual count on non-UFI CCIs. * After a REQUEST SENSE, the UFI CCI may include the ASC/ASCQ from the sense information -- don't consider this a failure. In addition, remove a horrible hack that was causing us to drop sense information on the floor and return empty INQUIRY responses, often in the case where there is a UNIT ATTENTION pending during the INQUIRY. (Some drives send the data and then fail, some don't.) log message for umass.c 1.113: Do not return STATUS_WIRE_FAILED in response to a CBI stall. This is perfectly normal, and is used to report errors. Instead, use STATUS_CMD_FAILED, which causes us to do a REQUEST SENSE. Should address PR 22960. log message for umass.c 1.115: Do not do a CBI reset before returning STATUS_CMD_FAILED. This causes any sense information to be thrown away, and is therefore nonsensical. ok krw@
* Eliminate the quirks SDEV_NOSTARTUNIT, UMASS_QUIRK_NO_START_STOP, andkrw2004-02-211-21/+1
| | | | | | | UMASS_QUIRK_FORCE_SHORT_INQUIRY. Fixes a bunch of USB devices. Based on work by Mycroft in NetBSD. ok tdeval@ deraadt@.
* Nuke SDEV_NOLUNS, SDEV_FORCELUNS, and PQUIRK_FORCELUNS quirks. Alsokrw2004-01-141-3/+2
| | | | | | | | | | | | | | moreluns field in scsi_link structure. Instead, treat an INQUIRY result that duplicates the INQUIRY result of LUN 0 as proof the LUN does not exist. Compensate for lack of SDEV_NOLUNS where necessary by setting sc_link->luns to 1, which has the same effect. From Marco Peereboom. Don't issue Test Unit Ready command before INQUIRY command - not necessary and potentially harmful to devices with ADEV_NOTUR quirk since quirks have not been set yet. From mycroft@NetBSD ok deraadt@, mvme* changes by miod@.
* Make debug printf a real debug.grange2004-01-101-3/+3
| | | | ok nate@
* Mention in the 'status cmd failed' message the scsi command thatkrw2003-05-171-2/+3
| | | | | | failed. ok nate@.
* sync with NetBSD and add various local hacks to make things work correctlynate2003-05-171-0/+464
| | | | with our scsi layer
* Meant to commit only ulpt and committed everything. Most things weren't readynate2002-05-071-488/+0
|
* Sync ulpt driver with NetBSDnate2002-05-071-0/+488