summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/umass_scsi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd'krw2020-09-221-5/+5
| | | | | | | | | | | | member of 'struct scsi_xfer' has always been pointed at the 'struct scsi_generic cmdstore' member of the same instance. So nuke 'cmdstore' and remove the '*' from cmd. Take the address of cmd as required by the various casts. No intentional functional change. luna88k test by aoyama@, sparc64 test by jmatthew@ Identification of 2009's last *cmd use and ok jmatthew@
* Remove needless uses of SDEV_ONLYBIG. It was always set when SDEV_UMASS was set,krw2020-08-261-4/+4
| | | | | | | | and was always checked in concert with SDEV_ATAPI. Just rely on SDEV_ATAPI and SDEV_UMASS in all but the one place sd(4) where SDEV_ONLYBIG is set independently of SDEV_ATAPI/_UMASS. ok jmatthew@
* Don't turn on SDEV_DB* flags via UDMASS_UPPER. If you want SCSI debug output,krw2020-07-291-3/+1
| | | | | ask for it the normal way. Less surprising and more effective, since you have to specify SCSIDEBUG/_BUS/_TARGET/_LUN separately anyway.
* Nuke unused struct scsi_link members of adapter softc's where thekrw2020-07-221-2/+1
| | | | driver successfully compiles on one or more of amd64, i386, hppa.
* Move remaining scsi bus initialization info from "prototype scsi link"krw2020-07-201-7/+6
| | | | | | | fields to struct scsibus_attach_args. Nuke the struct scsi_link * (saa_sc_link) in scaibus_attach_args. Explicitly initialize each field in scsibus_attach_args variables.
* Move the adapter related items (luns, adapter, adapter_target,krw2020-07-191-6/+6
| | | | | | | adapter_buswidth, adapter_softc) from struct scsi_link to struct scsibus_attach_args. Additional compile tests by jmatthew@ (sparc64) and aoyam@ (luna88k).
* Access adapter softc via link->bus->sb_adapter_softc.krw2020-07-161-3/+3
| | | | | | | | In sparc64 autoconf access 'luns' via sb_luns and 'adapter_buswidth' via sb_adapter_buswidth. Removes last post-config uses of the copies of bus related information in scsi_link.
* Build 'flags' in intermediate variable and shuffle sc_linkkrw2020-07-111-16/+17
| | | | initialization closer to config_found() invocation.
* Expunge some Captain Obvious comments, tweak whitespace a bit, move a debugkrw2020-07-111-2/+1
| | | | statement. All to make upcoming diff(s) smaller and easier to read.
* Nuke trailing whitespace.krw2020-06-271-2/+2
|
* No need to bzero()/memset() 'struct scsibus_attach_args' variableskrw2020-06-271-2/+1
| | | | immediately before initializing the only field in the struct.
* Nuke *_minphys() functions that either simply apply MAXPHYS or dokrw2020-02-131-10/+2
| | | | | | | | nothing at all. MAXPHYS will be applied in minphys() and nothing at all, well, doesn't do anything. Also remove any '#define <blah> MAXPHYS' statements used solely to disguise MAXPHYS in said functions.
* Shuffle some names around to make reading the code less headachekrw2020-01-261-4/+4
| | | | | | | | inducing. Rename scsi_adapter member 'scsi_minphys' to 'dev_minphys' to reflect what it is supposed to do. Use consistent naming convention (<dev>_minphys) for the actual device functions. No functional change.
* Drivers that implement their own *minphys() don't need to call thekrw2020-01-251-3/+1
| | | | | | | system minphys(). scsi_minphys() will do that and cd/sd/st will call scsi_minphys(). ok jmatthew@ as part of larger diff
* Use a consistant idiom/format when declaring scsi_adapter structureskrw2020-01-231-4/+2
| | | | | | | | | | | in drivers. Terse one liners, NULLs instead of 0's, explicitly specify all members, etc. Nuke #ifdef notyet blocks related to the scsi_adapter in aic. No intentional functional change. ok tedu@
* 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@.