summaryrefslogtreecommitdiffstats
path: root/sys/scsi/scsiconf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* TL;DR -- don't configure devices that return insufficient INQUIRY data.krw2020-11-191-5/+14
| | | | | | | | | | | | | | | Treat INQUIRY data with fewer than SID_SCSI2_HDRLEN bytes as invalid. Use only INQUIRY data returned by the device. Get all available INQUIRY data (up to sizeof(struct scsi_inquiry_data)) even when SCSIDEBUG is not set. Tweak returned INQUIRY data so additional_length field does not point past end of returned data when available data is greater than sizeof(struct scsi_inquiry_data). Missing dmafree() spotted by gnezdo@. ok jmatthew@.
* Try to avoid a theoretical infinite loop while detaching all the scsi_link's onkrw2020-08-181-4/+3
| | | | | | the bus. Use SLIST_FOREACH_SAFE() rather than 'while (!SLIST_EMPTY())'' as there is a condition which would cause scsi_detach_link() to return without removing the scsi_link from the SLIST.
* Redistribute and tweak the scsi_[attach|probe|detach]_[bus|target|lun]() code tokrw2020-08-141-103/+94
| | | | | | make the three variants more similar and easier to understand. Ensures consistent error checks and eliminates pointless adapter_buswidth checks when processing the list of scsi_links.
* Explicitly #include <scsi/scsi_debug.h> rather than assuming scsiconf.h will dokrw2020-08-111-1/+2
| | | | | | | it. Prepares for removal of #include <scsi/scsi_debug.h> from scsiconf.h as soon as the alpha tester digs out from hurricane to compile last untested files.
* Minor code shuffle to get all *_activate(), *_probe() and *_detach() functionskrw2020-08-101-60/+60
| | | | | nestled together. Rename scsibusprint() to scsibussubprint() since it is used with scsibussubmatch().
* More code shuffling. Fix a rename missed in previous.krw2020-08-091-93/+89
|
* Shuffle functions and declarations around to more logical grouping. Nuke somekrw2020-08-091-384/+379
| | | | leading whitespace. Rename some local functions.
* scsi_link's are born knowing their bus. Use that instead of passing extrakrw2020-08-081-18/+19
| | | | scsibus_softc pointers around.
* Move remaining scsi bus initialization info from "prototype scsi link"krw2020-07-201-10/+8
| | | | | | | 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-11/+6
| | | | | | | adapter_buswidth, adapter_softc) from struct scsi_link to struct scsibus_attach_args. Additional compile tests by jmatthew@ (sparc64) and aoyam@ (luna88k).
* Access scsibus_softc info (luns, adapter, adapter_target,krw2020-07-161-5/+5
| | | | | adapter_softc, adapter_buswidth) via link->bus rather than using copies currently residing in the link.
* Beef up struct scsibus_softc to hold the information needed tokrw2020-07-161-34/+53
| | | | | | initialize the scsi_link's on the bus. After sucking this information out of the "prototype" link provided by the scsibus_attach_arg, no need to keep a pointer to that prototype.
* Nuke struct scsi_link's "scsibus" member. The two drivers using itkrw2020-07-051-2/+1
| | | | | | | | (ahc(4) and qlw(4)) can just compare the values of the "bus" member directly. A slightly different path to the same result that matthew@ traversed in his work culminating in scsiconf.h r1.146.
* Nuke unneeded 'sa_inqbuf' member of struct scsi_attach_args. It alwayskrw2020-06-301-2/+1
| | | | | points to the inquiry data contained in the struct scsi_link pointed to by the other member, sa_sc_link.
* Nuke unnecessary abstraction 'scsi_minphys()' which just callskrw2020-02-051-11/+1
| | | | | | 'minphys()'. Just use & check for NULL instead, since 'minphys()' is always called on the code path ([cd|sd|st]minphys) that calls physio().
* Various cleanup tweaks. 'return' is not a function. KNF. Whitespace,krw2019-12-081-89/+91
| | | | Comment fixes.
* Consistently use ISSET() to check for set flags.krw2019-11-231-8/+8
|
* Consistently use !ISSET() to check for unset flags.krw2019-11-231-2/+2
|
* Consistently use SET() to set bits.krw2019-11-231-5/+5
|
* Make sure that SDEV_NOSYNC abd SDEV_NOWIDE quirks are notkrw2019-11-091-20/+32
| | | | | | | inadvertantly set on devices for which they are irrelevant or incorrect. Lets these device operate at full speed. ok sthen@ deraadt@
* Add/tweak #endif comments to make spelunking via grep more rewarding.krw2019-09-271-6/+6
|
* Shuffle and consolidate SCSIDEBUG declarations into fewer sections inkrw2019-09-271-85/+2
| | | | more intuitive locations.
* Use consistent names for unused flags/quirks when printing same underkrw2019-09-241-6/+6
| | | | SCSIDEBUG.
* When printing the scsi_link info under SCSIDEBUG show state, luns,krw2019-09-231-38/+91
| | | | openings, flags and quirks.
* Update list of device types with combination of FreeBSD andkrw2019-09-161-47/+40
| | | | SPC-5. Add/Fix comments.
* Shorten normal dmesg attach verbiage and expand SCSIDEBUG verbiage.krw2019-09-031-134/+128
| | | | ok deraadt@
* Adopt the SCSI versioning #define's from FreeBSD. Eliminate thekrw2019-09-011-16/+9
| | | | | | | | | | | now unneeded version_to_spc() mapping array, a duplicate #define and a couple of magic numbers. Toss in some comments for future generations of spelunkers. Makes it possible to check for specific SPC versions when new features or eliminated features require such a check. No intentional functional change.
* Rectify error made in 2006. SPC-2 == SCSI-3, not SCSI-2!!krw2019-08-301-2/+2
| | | | | | | | Some cd/sd/safte/ses devices will now be correctly identified as SCSI-3 and gain all the advantages associated with that lofty status. e.g. READ CAP 16, REPORT LUNS. ok deraadt@
* Introduce SCSI0(), SCSI2() and SCSI3() defines to clarify (some) useskrw2019-08-281-4/+4
| | | | of SCSISPC() when checking the values of the INQUIRY version field.
* Refactor probing logic to mirror detach logic. i.e. put smarts inkrw2019-08-271-79/+98
| | | | | | | | | | | | scsi_probe() and make scsi_probe_bus(), scsi_probe_target() and scsi_probe_lun() simple wrappers around scsi_probe(). Abstract the determination of which luns to probe into a separate function. Thus eliminating the need to remove/add lun 0 link while probing devices modern enough to support REPORTLUNS. Which means the lun 0 link is no longer in different positions in the scsi_link list for such devices compared to older devices which are blindly probed until an invalid LUN is encountered.
* Simply logic of detaching things. scsi_detach_bus() folded intokrw2019-08-241-53/+44
| | | | | | | scsi_detach(), scsi_detach_target() and scsi_detach_lun() become simple wrappers of scsi_detach() invocations. No intentional functional change.
* T10/BSR INCITS 503 (SPC-5) is apparently a thing. Updatekrw2019-08-221-4/+4
| | | | | | | | | | version_to_spc() to map the formerly reserved value 0x07 in the INQUIRY version field to 5 (a.k.a. SPC-5), instead of 0 (a.k.a. device does not claim support for any SPC version). Tweak comment for 0x03 mapping to note it means compliance to SPC, not SPC-3. Tweak comment for 0x06 mappoing to specify the ANSI INCITS 513-2005 that documents SPC-4.
* scsi_probe_bus() always returns 0. Nobody but scsi_probe() evenkrw2019-08-201-6/+6
| | | | | pretended to care. So just make in a void, and explicitly return 0 in the appropriate case in scsi_probe().
* Every "goto bad" in scsi_probedev() deserves a SC_DEBUG().krw2019-08-181-6/+17
|
* Rename 'link' to 'link0' as it refers to target 0 only.krw2019-08-181-9/+9
|
* When activating or detaching a target don't search the scsi_link SLISTkrw2019-08-181-17/+37
| | | | | | | for each target:lun. Just travese the SLIST once taking care of relevant scsi_link's as they are encountered. ok jmatthew@
* sc_buswidth field in struct scsi_link is redundant. Just usekrw2019-08-181-5/+4
| | | | | adapter_link->adapter_buswidth, which supplied the value for sc_buswidth and is never changed.
* Nuke some unused variables, tweak some declarations andkrw2019-08-171-14/+14
| | | | variable names into a consistant idiom.
* scsi_[add|remove]_link() are local functions so move theirkrw2019-08-141-1/+3
| | | | declarations.
* Whitespace nit. Add {} around body of SLIST_FOREACH().krw2019-08-141-3/+4
|
* Tweak some comments.krw2019-08-141-7/+7
|
* If you use sys/param.h, you don't need sys/types.hderaadt2017-09-081-2/+1
|
* Standardize on calling local scsi_link variables 'link' instead ofkrw2016-03-121-57/+57
| | | | | | | | | | | 'sc_link'. 'sc_link' is a field in the various device *_softc structures, where the sc_ prefix was for 'softc'. Reduces potential mental confusion. Newer code from down under was already using 'link'. No functional change. Prompted by bluhm@'s adventures in scsi. ok dlg@ jmatthew@
* Enforce some naming sanity. Stop using 'sc_link' to mean two differentkrw2016-03-101-74/+74
| | | | | | | | things by renaming the field 'SLIST_HEAD(, scsi_link) sc_link' to 'sc_link_list' in struct scsibus_softc. Use 'sb' as the short name for scsibus_softc variables. Impetus from & ok bluhm@
* add some sizes to free. looked over by deraadttedu2015-08-231-9/+11
|
* More damned eye searing whitespace.krw2015-06-071-4/+4
|
* 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@
* we dont need sys/lock.h because we dont use lockmgr, but we do needdlg2015-02-111-2/+2
| | | | sys/atomic.h for atomic_setbits_int.
* convert bcopy to memcpy. ok dlg krwtedu2014-12-151-2/+2
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-7/+7
| | | | after discussions with beck deraadt kettenis.