summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
2023-08-02Set a low water mark on scsi_xfer_pool and prime the pool. This way thereMark Kettenis
will always be some scsi_xfer structures around. Hopefully that means the pagedaemon can actually write out pages to swap if we're out of physical memory. ok krw@
2023-07-06Use mtx_init() to initialize stack-based mutexesVisa Hankala
mtx_init() ensures the mutex' lock_object has static storage duration. This makes it safe to re-enable WITNESS with stack-based mutexes. OK bluhm@ miod@
2023-05-25Disable witness for mutexes created on the stack which allowsKurt Miller
the ddb command 'show witness' to succeed without panicking. Leaving witness enabled on these mutexes saves a pointer to struct lock_type on the stack which gets clobbered resulting in a panic in witness_ddb_display_descendants(). okay miod@
2023-05-10Add flag SDEV_UFI so umass_scsi_attach() can provide informationKenneth R Westerback
sufficient to get sdgetdisklabel() to correctly set d_type to DTYPE_FLOPPY in the default disklabel. installboot(8) in particular likes to know it is dealing with a floppy. ok miod@
2023-04-27add support for I/O statistics so that tape speeds can be observed withRobert Nagy
iostat(8)
2023-04-11fix double words in commentsJonathan Gray
feedback and ok jmc@ miod, ok millert@
2022-10-23bzero(disklabel) or memset(disklabel,0) should be enough forKenneth R Westerback
anyone. No need to also set d_flags to 0.
2022-09-01Stop setting d_bbsize and d_sbsize. Nobody has paidKenneth R Westerback
any attention for some time. ok otto@ as part of larger diff
2022-07-02Remove unused device poll functions.Visa Hankala
Also remove unneeded includes of <sys/poll.h> and <sys/select.h>. Some addenda from jsg@. OK miod@ mpi@
2022-04-16constify SCSI adapter entry pointsChristian Weisgerber
ok krw@
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.
2022-02-27SC_DEBUG() requires an initialized scsi_link. ShuffleKenneth R Westerback
code to make it so. Pointed out by clang when prodded with SCSIDEBUG.
2022-01-11spellingJonathan Gray
2021-10-24Constify struct cfattach.Martin Pieuchot
ok visa@ a long time ago, ok krw@
2021-08-31add support for obtaining sense status and source slot of a mediaRobert Nagy
this fixes a bug in bacula where the catalog was not properly kept up-to-date if a tape was in a drive becuse its source slot was unknown based on code from FreeBSD; ok krw@ picker 0: sense: <0x00/0x00> voltag: <:0> avoltag: <:0> source: <> slot 0: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1168L1:0> avoltag: <:0> source: <slot 0> slot 1: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1187L1:0> avoltag: <:0> source: <slot 1> slot 2: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1184L1:0> avoltag: <:0> source: <slot 2> slot 3: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1195L1:0> avoltag: <:0> source: <slot 3> slot 4: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1037L1:0> avoltag: <:0> source: <slot 4> slot 5: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1038L1:0> avoltag: <:0> source: <slot 5> slot 6: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1166L1:0> avoltag: <:0> source: <slot 6> slot 7: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1167L1:0> avoltag: <:0> source: <slot 7> slot 8: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1180L1:0> avoltag: <:0> source: <slot 8> slot 9: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1186L1:0> avoltag: <:0> source: <slot 9> slot 10: <ACCESS> sense: <0x00/0x00> voltag: <:0> avoltag: <:0> source: <picker 0> slot 11: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1182L1:0> avoltag: <:0> source: <slot 11> slot 12: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1181L1:0> avoltag: <:0> source: <slot 12> slot 13: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1196L1:0> avoltag: <:0> source: <slot 13> slot 14: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1169L1:0> avoltag: <:0> source: <slot 14> slot 15: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1197L1:0> avoltag: <:0> source: <slot 15> slot 16: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1165L1:0> avoltag: <:0> source: <slot 16> slot 17: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1199L1:0> avoltag: <:0> source: <slot 17> slot 18: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1189L1:0> avoltag: <:0> source: <slot 18> slot 19: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1185L1:0> avoltag: <:0> source: <slot 19> slot 20: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1198L1:0> avoltag: <:0> source: <slot 20> slot 21: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1039L1:0> avoltag: <:0> source: <slot 21> slot 22: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1035L1:0> avoltag: <:0> source: <slot 22> slot 23: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1188L1:0> avoltag: <:0> source: <slot 23> drive 0: <ACCESS,FULL> sense: <0x00/0x00> voltag: <XX1183L1:0> avoltag: <:0> source: <slot 10>
2021-05-13Whitespace fix for unintentional unindenting event in r1.260.Kenneth R Westerback
Reported by Ashton Fagg via tech@. Thanks!
2021-03-12spellingJonathan Gray
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-10-14Introduce scsi_copy_internal_data() to copy 'faked' data from a driver to aKenneth R Westerback
scsi_xfer. Will replace various equivalent functions/hand-rolled chunks, none of which were setting xs->resid.
2020-09-23Remove 'void *sc_sdhook' member of sd_softc.Kenneth R Westerback
Unused since mpi@ removed sd_shutdown() in 2014.
2020-09-22Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd'Kenneth R Westerback
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@
2020-09-14No need to check for SDEV_DYING as the first thing in both branches of anKenneth R Westerback
if/else. Just do it once before the if. Move the SC_DEBUG() documenting entry into sdopen() to before the various error bailouts.
2020-09-13Always use READ(16)/WRITE(16) commands for disks large enough to requireKenneth R Westerback
READ(16)/WRITE(16) to access the last sectors Fixes (at least) large 512E (a.k.a. emulated 512-byte sector) devices plugged into overly helpful USB <-> ATA/ATAPI bridges. Which can tell you they are using 512-byte sector addresses but spontaneously/silently interpret READ(10)/WRITE(10) commands as using 4K sector addresses/sizes. Diagnosed and fix tested with James Cook. Thanks!
2020-09-12Use SID_SCSI2_RESPONSE instead of '2' when checking INQUIRY data format.Kenneth R Westerback
2020-09-12No need to check inq for NULL when it always points at the inqdata inside aKenneth R Westerback
scsi_link.
2020-09-12No need to ask for extra INQUIRY data, all available data is already cached inKenneth R Westerback
scsi_link's inqdata.
2020-09-08If SCSI_IGNORE_ILLEGAL_REQUEST is set no error is returned from scsi_xs_sync()Kenneth R Westerback
when the request is unsupported. So check mode sense(6) and mode sense(10) results for valid headers before passing the results back. Avoid overwriting any error that was returned. ok jmatthew@
2020-09-05Rename SID_INQUIRY_HDR (a.k.a. 5) to more explicit SID_SCSI2_HDRLEN and use itKenneth R Westerback
to replace various uses of '5' when calculating the amount of data in the INQUIRY response. Matches up more naturally with SID_SCSI2_ALEN. Also use to fix SCSIDEBUG display of INQUIRY responses to show correct count of bytes received/available.
2020-09-02Add #define SID_SCSI2_RESPONSE 0x2 to allow elimination of another bunch ofKenneth R Westerback
magic numbers. As the nearby comment says '< 2 is obsolete. >2 is reserved'. So 0x2 is just right.
2020-09-01Rename [READ|WRITE]_BIG to [READ|WRITE]_10. Rename struct scsi_rw_big toKenneth R Westerback
struct scsi_rw_10. ok gnezdo@ jmatthew@ (who also did sparc64 compile test)
2020-08-30Compactify SDEV_/ADEV_ flags & quirks to eliminate the gaps in bit use and thusKenneth R Westerback
allow shrinking the names arrays.
2020-08-29More recent MMC specificiations add READ(12)/WRITE(12). So add cd_cmd_rw12()Kenneth R Westerback
and let cdstart() use it if the requested i/o is unable to fit into a READ(10). Certainly better than silently truncating the i/o into a READ(10)/WRITE(10).
2020-08-29Use ISSET() to check b_flags for B_READ.Kenneth R Westerback
2020-08-29Missing u_int -> u_int32_t chunks from previous.Kenneth R Westerback
2020-08-29Use u_int32_t for nsecs, making it crystal clear that the valuesKenneth R Westerback
are expected to fit into a 4-byte field.
2020-08-29Have [cd|sd]_cmd_rw[6|10|12|16] return the length of the created command andKenneth R Westerback
have the caller assign it to xs->cmdlen. Pass in xs->cmd instead of xs. A slightly cleaner API that provides the potential of detecting and reacting to a failure to create the desired command.