summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.c
AgeCommit message (Collapse)Author
2024-09-04Fix some spelling.Marcus Glocker
Input and ok jmc@, jsg@
2022-04-06Avoid traversing SLIST twice to remove a link.Kenneth R Westerback
From millert@
2022-04-06Recognize LUN 0 device if SID_QUAL_LU_OFFLINE and T_NODEVICE areKenneth R Westerback
true. This enables the discovery and probing of other LUNs the target has to offer. Add uk* to amd64 RAMDISK_CD so such devices are configured. Allows bsd.rd as well as bsd[.mp] to boot on Oracle Cloud amd64 instances. Issue reported by Ryan Kavanagh and Scott Nicholas via bugs@. Original diff and much subsequent testing by Scott. Thanks! ok dlg@ jmatthew@
2022-04-02Add a paranoia/future proofing check for link->pool == NULL toKenneth R Westerback
the SDEV_OWN_IOPL flag check. Ambiguous/inconsistant code pointed out by Coverity #1515557.
2022-04-02Bring back r1.247, using scsi_detach_link() to releaseKenneth R Westerback
a partially configured struct scsi_link. Problematic code path found by jungle Boogie was plugged by r1.249.
2022-03-28Only SLIST_REMOVE() a link when the link is on the list.Kenneth R Westerback
Avoids a potential panic.
2022-03-24Revert previous. Breaks probing native IDE devices.Kenneth R Westerback
Problem reported by jungle Boogie via bugs@
2022-03-23When configuring a scsi_link that has passed dev_probe() butKenneth R Westerback
fallen at one of the subsequent hurdles of scsi_probe_link() don't partially replicate scsi_discard_link(). Just call scsi_discard_link(). It now handles such partially configured scsi_link's.
2022-03-22Nuke increasingly pointless comment. Shorten a line andKenneth R Westerback
compare pointer to NULL instead of 0. No functional change.
2022-03-21Whitespace tweaks.Kenneth R Westerback
2022-03-21No point in calling scsi_link_shutdown() if link->pool is NULL.Kenneth R Westerback
Ditto config_detach() if link->device_softc is NULL. Currently just some extra paranoia, but will allow simplification of exit logic in scsi_probe_link() and other future uses of scsi_detach_link() on partially configured links. No intentional functional change.
2022-03-03r1.241 was the culprit. Unrevert r1.240.Kenneth R Westerback
2022-03-03Revert r1.241 and r1.240 which may have broken softraid.Kenneth R Westerback
2022-03-02Abstract the memory allocation, scsibus_softc data copying andKenneth R Westerback
flag setting bits of creating a scsi_link into scsi_alloc_link(). Shrinks the bloated scsi_probe_link() a bit, makes it possible to eventually create a useable scsi_link even when scsi_probe_link() can't attach a device. Developed from part of a diff submitted by Scott Nicholas via tech@.
2022-03-02Move the code obtaining the LUN 0 scsi_link used to determine theKenneth R Westerback
LUNs available to a target into scsi_get_target_luns(). Clearer code and prep for future changes. No functional change. Extracted from a larger diff submitted by Scott Nicholas via tech@.
2022-02-28Shuffle some SCSIDEBUG code to simplify code, tersify theKenneth R Westerback
emitted verbiage, and show INQUIRY header & vendor info early so humans can more easily determine what scsi_probe_link() will do. No functional change outside SCSIDEBUG.
2021-10-24Constify struct cfattach.Martin Pieuchot
ok visa@ a long time ago, ok krw@
2020-11-19TL;DR -- don't configure devices that return insufficient INQUIRY data.Kenneth R Westerback
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@.
2020-08-18Try to avoid a theoretical infinite loop while detaching all the scsi_link's onKenneth R Westerback
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.
2020-08-14Redistribute and tweak the scsi_[attach|probe|detach]_[bus|target|lun]() code toKenneth R Westerback
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.
2020-08-11Explicitly #include <scsi/scsi_debug.h> rather than assuming scsiconf.h will doKenneth R Westerback
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.
2020-08-10Minor code shuffle to get all *_activate(), *_probe() and *_detach() functionsKenneth R Westerback
nestled together. Rename scsibusprint() to scsibussubprint() since it is used with scsibussubmatch().
2020-08-09More code shuffling. Fix a rename missed in previous.Kenneth R Westerback
2020-08-09Shuffle functions and declarations around to more logical grouping. Nuke someKenneth R Westerback
leading whitespace. Rename some local functions.
2020-08-08scsi_link's are born knowing their bus. Use that instead of passing extraKenneth R Westerback
scsibus_softc pointers around.
2020-07-20Move remaining scsi bus initialization info from "prototype scsi link"Kenneth R Westerback
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.
2020-07-19Move the adapter related items (luns, adapter, adapter_target,Kenneth R Westerback
adapter_buswidth, adapter_softc) from struct scsi_link to struct scsibus_attach_args. Additional compile tests by jmatthew@ (sparc64) and aoyam@ (luna88k).
2020-07-16Access scsibus_softc info (luns, adapter, adapter_target,Kenneth R Westerback
adapter_softc, adapter_buswidth) via link->bus rather than using copies currently residing in the link.
2020-07-16Beef up struct scsibus_softc to hold the information needed toKenneth R Westerback
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.
2020-07-05Nuke struct scsi_link's "scsibus" member. The two drivers using itKenneth R Westerback
(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.
2020-06-30Nuke unneeded 'sa_inqbuf' member of struct scsi_attach_args. It alwaysKenneth R Westerback
points to the inquiry data contained in the struct scsi_link pointed to by the other member, sa_sc_link.
2020-02-05Nuke unnecessary abstraction 'scsi_minphys()' which just callsKenneth R Westerback
'minphys()'. Just use & check for NULL instead, since 'minphys()' is always called on the code path ([cd|sd|st]minphys) that calls physio().
2019-12-08Various cleanup tweaks. 'return' is not a function. KNF. Whitespace,Kenneth R Westerback
Comment fixes.
2019-11-23Consistently use ISSET() to check for set flags.Kenneth R Westerback
2019-11-23Consistently use !ISSET() to check for unset flags.Kenneth R Westerback
2019-11-23Consistently use SET() to set bits.Kenneth R Westerback
2019-11-09Make sure that SDEV_NOSYNC abd SDEV_NOWIDE quirks are notKenneth R Westerback
inadvertantly set on devices for which they are irrelevant or incorrect. Lets these device operate at full speed. ok sthen@ deraadt@
2019-09-27Add/tweak #endif comments to make spelunking via grep more rewarding.Kenneth R Westerback
2019-09-27Shuffle and consolidate SCSIDEBUG declarations into fewer sections inKenneth R Westerback
more intuitive locations.
2019-09-24Use consistent names for unused flags/quirks when printing same underKenneth R Westerback
SCSIDEBUG.
2019-09-23When printing the scsi_link info under SCSIDEBUG show state, luns,Kenneth R Westerback
openings, flags and quirks.
2019-09-16Update list of device types with combination of FreeBSD andKenneth R Westerback
SPC-5. Add/Fix comments.
2019-09-03Shorten normal dmesg attach verbiage and expand SCSIDEBUG verbiage.Kenneth R Westerback
ok deraadt@
2019-09-01Adopt the SCSI versioning #define's from FreeBSD. Eliminate theKenneth R Westerback
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.
2019-08-30Rectify error made in 2006. SPC-2 == SCSI-3, not SCSI-2!!Kenneth R Westerback
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@
2019-08-28Introduce SCSI0(), SCSI2() and SCSI3() defines to clarify (some) usesKenneth R Westerback
of SCSISPC() when checking the values of the INQUIRY version field.
2019-08-27Refactor probing logic to mirror detach logic. i.e. put smarts inKenneth R Westerback
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.
2019-08-24Simply logic of detaching things. scsi_detach_bus() folded intoKenneth R Westerback
scsi_detach(), scsi_detach_target() and scsi_detach_lun() become simple wrappers of scsi_detach() invocations. No intentional functional change.
2019-08-22T10/BSR INCITS 503 (SPC-5) is apparently a thing. UpdateKenneth R Westerback
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.
2019-08-20scsi_probe_bus() always returns 0. Nobody but scsi_probe() evenKenneth R Westerback
pretended to care. So just make in a void, and explicitly return 0 in the appropriate case in scsi_probe().