OpenBSD CVS

CVS log for src/sys/scsi/scsi_base.c


[BACK] Up to [local] / src / sys / scsi

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.283 / (download) - annotate - [select for diffs], Wed Aug 2 19:58:52 2023 UTC (10 months, 1 week ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.282: +3 -1 lines
Diff to previous 1.282 (colored)

Set a low water mark on scsi_xfer_pool and prime the pool.  This way there
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@

Revision 1.282 / (download) - annotate - [select for diffs], Thu Jul 6 10:17:43 2023 UTC (11 months ago) by visa
Branch: MAIN
Changes since 1.281: +4 -3 lines
Diff to previous 1.281 (colored)

Use mtx_init() to initialize stack-based mutexes

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@

Revision 1.281 / (download) - annotate - [select for diffs], Thu May 25 19:35:58 2023 UTC (12 months, 2 weeks ago) by kurt
Branch: MAIN
Changes since 1.280: +3 -2 lines
Diff to previous 1.280 (colored)

Disable witness for mutexes created on the stack which allows
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@

Revision 1.280 / (download) - annotate - [select for diffs], Mon Feb 28 14:48:11 2022 UTC (2 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.279: +66 -3 lines
Diff to previous 1.279 (colored)

Shuffle some SCSIDEBUG code to simplify code, tersify the
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.

Revision 1.279 / (download) - annotate - [select for diffs], Thu May 13 02:22:33 2021 UTC (3 years ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.278: +2 -2 lines
Diff to previous 1.278 (colored)

Whitespace fix for unintentional unindenting event in r1.260.

Reported by Ashton Fagg via tech@. Thanks!

Revision 1.278 / (download) - annotate - [select for diffs], Thu Nov 19 13:45:15 2020 UTC (3 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.277: +27 -24 lines
Diff to previous 1.277 (colored)

TL;DR -- don't configure devices that return insufficient INQUIRY data.

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@.

Revision 1.277 / (download) - annotate - [select for diffs], Wed Oct 14 23:40:33 2020 UTC (3 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.276: +21 -1 lines
Diff to previous 1.276 (colored)

Introduce scsi_copy_internal_data() to copy 'faked' data from a driver to a
scsi_xfer. Will replace various equivalent functions/hand-rolled chunks, none of
which were setting xs->resid.

Revision 1.276 / (download) - annotate - [select for diffs], Tue Sep 22 19:32:53 2020 UTC (3 years, 8 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.275: +15 -16 lines
Diff to previous 1.275 (colored)

Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd'
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@

Revision 1.275 / (download) - annotate - [select for diffs], Tue Sep 8 12:36:42 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.274: +5 -2 lines
Diff to previous 1.274 (colored)

If SCSI_IGNORE_ILLEGAL_REQUEST is set no error is returned from scsi_xs_sync()
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@

Revision 1.274 / (download) - annotate - [select for diffs], Sat Sep 5 14:21:52 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.273: +8 -7 lines
Diff to previous 1.273 (colored)

Rename SID_INQUIRY_HDR (a.k.a. 5) to more explicit SID_SCSI2_HDRLEN and use it
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.

Revision 1.273 / (download) - annotate - [select for diffs], Tue Sep 1 12:17:53 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.272: +6 -6 lines
Diff to previous 1.272 (colored)

Rename [READ|WRITE]_BIG to [READ|WRITE]_10. Rename struct scsi_rw_big to
struct scsi_rw_10.

ok gnezdo@ jmatthew@ (who also did sparc64 compile test)

Revision 1.272 / (download) - annotate - [select for diffs], Sun Aug 30 19:41:25 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.271: +1 -8 lines
Diff to previous 1.271 (colored)

Compactify SDEV_/ADEV_ flags & quirks to eliminate the gaps in bit use and thus
allow shrinking the names arrays.

Revision 1.271 / (download) - annotate - [select for diffs], Fri Aug 28 15:18:14 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.270: +2 -2 lines
Diff to previous 1.270 (colored)

Nuke CDF_ANCIENT, SDF_ANCIENT SDEV_ONLYBIG and bogus check of SID_RelAdr in
favour of simply using the device's claimed SCSI level of support. Except of
course for ATAPI/USB devices which often don't claim anything. Keep assuming
they are at least SCSI-2. Use consistant tests in
sdminphys/cdminphys/sdstart/cdstart.

Revision 1.270 / (download) - annotate - [select for diffs], Wed Aug 19 22:46:19 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored)

Replace last 2 'blah & (flag1 | flag2) == 0' with !ISSET(blah, (flag1 | flag2)).

Revision 1.269 / (download) - annotate - [select for diffs], Tue Aug 11 15:23:57 2020 UTC (3 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.268: +2 -1 lines
Diff to previous 1.268 (colored)

Explicitly #include <scsi/scsi_debug.h> rather than assuming scsiconf.h will do
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.

Revision 1.268 / (download) - annotate - [select for diffs], Mon Jul 27 19:19:49 2020 UTC (3 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.267: +30 -23 lines
Diff to previous 1.267 (colored)

Refactor scsi_show_flags() to allow 32-bit flags. Display unnamed flags as one
hex value after named flags. Make flag name arrays NULL terminated rathar than
fixed size.

Revision 1.267 / (download) - annotate - [select for diffs], Mon Jul 27 13:08:25 2020 UTC (3 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.266: +2 -2 lines
Diff to previous 1.266 (colored)

SDEV_2NDBUS is gone. Update flagnames[] appropriately.

Revision 1.266 / (download) - annotate - [select for diffs], Thu Jul 16 14:44:55 2020 UTC (3 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.265: +2 -2 lines
Diff to previous 1.265 (colored)

Access scsibus_softc info (luns, adapter, adapter_target,
adapter_softc, adapter_buswidth) via link->bus rather than using
copies currently residing in the link.

Revision 1.265 / (download) - annotate - [select for diffs], Thu Mar 12 19:21:01 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.264: +13 -12 lines
Diff to previous 1.264 (colored)

Pass scsi_mode_sense_buf pointers to scsi_mode_sense[_buf]() rather
than scsi_mode_header[_big] pointers to the same data.

Continues the umtamgling and simplification of the mode sense code.

CID 1491299
CID 1491297

Revision 1.264 / (download) - annotate - [select for diffs], Thu Mar 12 16:15:03 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.263: +4 -3 lines
Diff to previous 1.263 (colored)

Check for short mode sense error inside scsi_mode_sense_big()
rather than after the only invocation.

No functional change.

Revision 1.263 / (download) - annotate - [select for diffs], Thu Mar 12 13:49:25 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.262: +13 -9 lines
Diff to previous 1.262 (colored)

Eliminate 'len' parameter from scsi_mode_sense[_big](). It's
always sizeof(struct scsi_mode_sense_buf).

No functional change.

Revision 1.262 / (download) - annotate - [select for diffs], Wed Mar 11 19:23:08 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.261: +9 -9 lines
Diff to previous 1.261 (colored)

No need to pass 20000 to scsi_mode_sense[_big]() as the desired
xs->timeout.

Just set xs->timeout to 20000 and drop the parameter.

No functional change.

Revision 1.261 / (download) - annotate - [select for diffs], Wed Jan 22 00:17:46 2020 UTC (4 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.260: +8 -7 lines
Diff to previous 1.260 (colored)

scsi_delay(): sleep without lbolt

If we want to sleep for a multiple of seconds we can do that without
involving lbolt.

This may cause some paths to sleep longer than they have on average,
as sleeping on lbolt wakes you up within one second, not after one
second.  If this is a problem we will need to shorten the intervals
given to scsi_delay().

With insight from deraadt@.

ok krw@

Revision 1.260 / (download) - annotate - [select for diffs], Fri Dec 6 13:53:26 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.259: +155 -155 lines
Diff to previous 1.259 (colored)

Various cleanup tweaks. 'return' is not a function. KNF. Whitespace,
Comment fixes.

Revision 1.259 / (download) - annotate - [select for diffs], Thu Dec 5 19:53:05 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.258: +5 -4 lines
Diff to previous 1.258 (colored)

Don't discard error from mode sense (6) if mode sense (10) is
not attempted.

Revision 1.258 / (download) - annotate - [select for diffs], Thu Dec 5 18:42:14 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.257: +10 -19 lines
Diff to previous 1.257 (colored)

Shrink scsi_mode_do_sense() parameter list by eliminating the three
pointers returning possible block descriptor values for block size,
block count and density. Most calls were passing "NULL, NULL, NULL"
since they did not care.

Call scsi_parse_blkdesc() directly in those few cases where one or
more of the values is of interest.

No intentional functional change.

Revision 1.257 / (download) - annotate - [select for diffs], Thu Dec 5 16:33:53 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.256: +7 -9 lines
Diff to previous 1.256 (colored)

No need for 'byte2' parameter to scsi_mode_sense[_big]() since we
always pass 0. i.e. never disable block descriptors, never accept
long LBA values.

Revision 1.256 / (download) - annotate - [select for diffs], Thu Dec 5 16:16:01 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.255: +9 -1 lines
Diff to previous 1.255 (colored)

Move prototypes for scsi_mode_sense(), scsi_mode_sense_big(),
scsi_mode_sense_page() and scsi_mode_sense_big_page() into
scsi_base.c.

They are just internal helper functions for scsi_do_mode_sense().

Revision 1.255 / (download) - annotate - [select for diffs], Wed Dec 4 10:22:05 2019 UTC (4 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.254: +6 -5 lines
Diff to previous 1.254 (colored)

Convert infinite sleeps to {m,t}sleep_nsec(9).

ok krw@, jca@

Revision 1.254 / (download) - annotate - [select for diffs], Tue Dec 3 15:58:28 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.253: +24 -11 lines
Diff to previous 1.253 (colored)

Check for expected mode sense page code as well as expected mode page length when
constructing the pointer to the page data. Remove now unneeded DISK_PGCODE().

Usual misc whitespace/modernization tweaks to functions being modified.

Revision 1.253 / (download) - annotate - [select for diffs], Tue Dec 3 13:25:57 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.252: +46 -20 lines
Diff to previous 1.252 (colored)

Add display of mode sense data to SCSIDEBUG.

Revision 1.252 / (download) - annotate - [select for diffs], Mon Dec 2 17:53:05 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.251: +3 -1 lines
Diff to previous 1.251 (colored)

Have SCSIDEBUG show the number of bytes of VPD inquiry data received,
not the number of bytes that were available in the buffer.

Revision 1.251 / (download) - annotate - [select for diffs], Mon Dec 2 15:10:27 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.250: +3 -2 lines
Diff to previous 1.250 (colored)

Don't forget the scsi_vpd_header when calculating the number of bytes
obtained by scsi_inquire_vpd().

Revision 1.250 / (download) - annotate - [select for diffs], Sun Dec 1 16:56:26 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.249: +14 -14 lines
Diff to previous 1.249 (colored)

Tweak variable names to be consistent with 'pg_code' and 'pg_length'
field names in sense mode structs.

Revision 1.249 / (download) - annotate - [select for diffs], Sun Dec 1 16:26:10 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.248: +3 -3 lines
Diff to previous 1.248 (colored)

Make prototype and implementation signatures the same by removing
'const' from the only two 'const int' instances.

Revision 1.248 / (download) - annotate - [select for diffs], Thu Nov 28 17:25:59 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.247: +50 -36 lines
Diff to previous 1.247 (colored)

Abstract mode sense block descriptor parsing into a separate function.

Revision 1.247 / (download) - annotate - [select for diffs], Thu Nov 28 16:41:07 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.246: +2 -2 lines
Diff to previous 1.246 (colored)

Align an annoying comment.

Revision 1.246 / (download) - annotate - [select for diffs], Thu Nov 28 16:27:35 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.245: +3 -6 lines
Diff to previous 1.245 (colored)

Always pass a pointer to 'big' to scsi_do_mode_sense().

Sets up some simplifications.

Revision 1.245 / (download) - annotate - [select for diffs], Tue Nov 26 20:48:03 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.244: +1 -7 lines
Diff to previous 1.244 (colored)

Don't zero existing values for density, block_count and block_size in
scsi_do_mode_sense(). Just update the values when valid data is
available. Initialize the variables passed to scsi_do_mode_sense() in
the one instance where they weren't already set.

Fixes issue with softraid crypto volumes on 4K-sector disks.

Found, fix tested, and ok tim@

Revision 1.244 / (download) - annotate - [select for diffs], Mon Nov 25 17:02:56 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.243: +73 -1 lines
Diff to previous 1.243 (colored)

Move struct scsi_read_cap_data and struct scsi_read_cap_data_16 to
scsi_all.h.

Add scsi_read_cap_10() and scsi_read_cap_16() functions to
scsi_base.c, i.e. move logic to do actual READ_CAPACITY commands out
of sd_read_cap() and sd_read_cap_16().

This will allow the READ_CAPACITY code to be reused by cd(4).

Return -1 for errors where the error code is just discarded, reducing
ENOMEM, ENXIO, EIO uses.

No intentional functional change.

Revision 1.243 / (download) - annotate - [select for diffs], Sat Nov 23 17:10:13 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.242: +14 -14 lines
Diff to previous 1.242 (colored)

Consistently use ISSET() to check for set flags.

Revision 1.242 / (download) - annotate - [select for diffs], Sat Nov 23 12:27:32 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.241: +4 -4 lines
Diff to previous 1.241 (colored)

Consistently use !ISSET() to check for unset flags.

Revision 1.241 / (download) - annotate - [select for diffs], Fri Nov 22 15:34:29 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.240: +4 -4 lines
Diff to previous 1.240 (colored)

Be consistent and always use CLR() to clear flags.

Revision 1.240 / (download) - annotate - [select for diffs], Thu Nov 21 23:22:14 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.239: +8 -8 lines
Diff to previous 1.239 (colored)

Be consistent and always use [!]ISSET() to test flags in xs->flags.

Revision 1.239 / (download) - annotate - [select for diffs], Thu Nov 21 22:31:27 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.238: +2 -2 lines
Diff to previous 1.238 (colored)

Be consistent and always use SET() to set flags in xs->flags.

Revision 1.238 / (download) - annotate - [select for diffs], Sat Nov 9 12:15:50 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.237: +9 -5 lines
Diff to previous 1.237 (colored)

Fix SCSIDEBUG display of VPD inquiry data.

Remove extraneous whitespace in SCSIDEBUG read capacity display.

Revision 1.237 / (download) - annotate - [select for diffs], Sun Sep 29 17:57:36 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.236: +2 -4 lines
Diff to previous 1.236 (colored)

Introduce SC_DEBUG_SENSE() and simplify code by eliminating a bunch
of three line SCSIDEBUG chunks.

Revision 1.236 / (download) - annotate - [select for diffs], Sun Sep 29 16:10:30 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.235: +8 -6 lines
Diff to previous 1.235 (colored)

Move some logic inside scsi_show_xs() instead of surrounding the
single invocation of the same. Clearer.

Revision 1.235 / (download) - annotate - [select for diffs], Sun Sep 29 15:47:29 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.234: +5 -5 lines
Diff to previous 1.234 (colored)

Tweak some whitespace to make autoindenter happy. Use consistent naming idiom for
the debug functions.

Revision 1.234 / (download) - annotate - [select for diffs], Fri Sep 27 17:22:31 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.233: +12 -12 lines
Diff to previous 1.233 (colored)

Add/tweak #endif comments to make spelunking via grep more rewarding.

Revision 1.233 / (download) - annotate - [select for diffs], Fri Sep 27 16:03:45 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.232: +142 -66 lines
Diff to previous 1.232 (colored)

Shuffle and consolidate SCSIDEBUG declarations into fewer sections in
more intuitive locations.

Revision 1.232 / (download) - annotate - [select for diffs], Mon Sep 23 15:21:17 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.231: +20 -1 lines
Diff to previous 1.231 (colored)

When printing the scsi_link info under SCSIDEBUG show state, luns,
openings, flags and quirks.

Revision 1.231 / (download) - annotate - [select for diffs], Sat Sep 21 00:12:15 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.230: +34 -11 lines
Diff to previous 1.230 (colored)

Expand scsi_inquiry_data to 96 bytes to include new fields. If the
device claims to have more than the 36 bytes of SCSI2 data, issue a
2nd INQUIRY (under SCSIDEBUG!) to get up to 96 bytes of data.

Add some length sanity checks to debug output. Print VPD data under
SCSIDEBUG.

Revision 1.230 / (download) - annotate - [select for diffs], Fri Sep 20 15:35:42 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.229: +8 -1 lines
Diff to previous 1.229 (colored)

Print inquiry and read capacity (10 and 16) data under SCSIDEBUG.

Revision 1.229 / (download) - annotate - [select for diffs], Sun Sep 1 15:03:32 2019 UTC (4 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.228: +7 -11 lines
Diff to previous 1.228 (colored)

Adopt the SCSI versioning #define's from FreeBSD. Eliminate the
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.

Revision 1.228 / (download) - annotate - [select for diffs], Wed Aug 28 15:17:23 2019 UTC (4 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.227: +3 -3 lines
Diff to previous 1.227 (colored)

Introduce SCSI0(), SCSI2() and SCSI3() defines to clarify (some) uses
of SCSISPC() when checking the values of the INQUIRY version field.

Revision 1.227 / (download) - annotate - [select for diffs], Fri Sep 8 05:36:53 2017 UTC (6 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.226: +1 -2 lines
Diff to previous 1.226 (colored)

If you use sys/param.h, you don't need sys/types.h

Revision 1.226 / (download) - annotate - [select for diffs], Mon May 29 07:47:13 2017 UTC (7 years ago) by krw
Branch: MAIN
Changes since 1.225: +1 -2 lines
Diff to previous 1.225 (colored)

To prevent anyone else from stumbling on this (now) archaic bit of
history, nuke all mentions of XS_NO_CCB and the #define.

2006 - 2017. R.I.P.

ok kettenis@ inferred ok dlg@

Revision 1.225 / (download) - annotate - [select for diffs], Thu Sep 15 02:00:18 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.224: +5 -8 lines
Diff to previous 1.224 (colored)

all pools have their ipl set via pool_setipl, so fold it into pool_init.

the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.

most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.

the manpage and subr_pool.c bits i did myself.

ok tedu@ jmatthew@

@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);

Revision 1.224 / (download) - annotate - [select for diffs], Sat Mar 12 15:16:04 2016 UTC (8 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.223: +49 -49 lines
Diff to previous 1.223 (colored)

Standardize on calling local scsi_link variables 'link' instead of
'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@

Revision 1.223 / (download) - annotate - [select for diffs], Thu Mar 10 13:56:14 2016 UTC (8 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.222: +10 -10 lines
Diff to previous 1.222 (colored)

Enforce some naming sanity. Stop using 'sc_link' to mean two different
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@

Revision 1.222 / (download) - annotate - [select for diffs], Mon Mar 7 18:44:00 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.221: +2 -2 lines
Diff to previous 1.221 (colored)

Sync no-argument function declaration and definition by adding (void).
ok mpi@ millert@

Revision 1.221 / (download) - annotate - [select for diffs], Sun Jun 7 19:13:27 2015 UTC (9 years ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.220: +6 -6 lines
Diff to previous 1.220 (colored)

More damned eye searing whitespace.

Revision 1.220 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:52 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.219: +1 -2 lines
Diff to previous 1.219 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.219 / (download) - annotate - [select for diffs], Sun Mar 8 20:49:38 2015 UTC (9 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.218: +2 -2 lines
Diff to previous 1.218 (colored)

Fix some format specifiers in debug code.

Pointed out by Kor son of Rynar (sic) when trying to test
some debug code.

ok matthew@

Revision 1.218 / (download) - annotate - [select for diffs], Tue Jan 27 03:17:37 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.217: +7 -7 lines
Diff to previous 1.217 (colored)

remove the second void * argument on tasks.

when workqs were introduced, we provided a second argument so you
could pass a thing and some context to work on it in. there were
very few things that took advantage of the second argument, so when
i introduced pools i suggested removing it. since tasks were meant
to replace workqs, it was requested that we keep the second argument
to make porting from workqs to tasks easier.

now that workqs are gone, i had a look at the use of the second
argument again and found only one good use of it (vdsp(4) on sparc64
if you're interested) and a tiny handful of questionable uses. the
vast majority of tasks only used a single argument. i have since
modified all tasks that used two args to only use one, so now we
can remove the second argument.

so this is a mechanical change. all tasks only passed NULL as their
second argument, so we can just remove it.

ok krw@

Revision 1.217 / (download) - annotate - [select for diffs], Sat Sep 20 16:18:23 2014 UTC (9 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.216: +2 -2 lines
Diff to previous 1.216 (colored)

Fix bug in taskq conversion that would lead to a null pointer dereference.

ok krw@, jsg@

Revision 1.216 / (download) - annotate - [select for diffs], Sun Sep 14 14:17:26 2014 UTC (9 years, 8 months ago) by jsg
Branch: MAIN
Changes since 1.215: +1 -2 lines
Diff to previous 1.215 (colored)

remove uneeded proc.h includes
ok mpi@ kspillner@

Revision 1.215 / (download) - annotate - [select for diffs], Tue Sep 9 05:43:25 2014 UTC (9 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.214: +13 -7 lines
Diff to previous 1.214 (colored)

rework the hotplug requests to use tasks rather than workqs.

tested on mpi(4) sas.

Revision 1.214 / (download) - annotate - [select for diffs], Tue Jul 1 02:31:16 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.213: +3 -1 lines
Diff to previous 1.213 (colored)

take the biglock before calling the xs completion handler.

should be safe to call the midlayer io path without the biglock now.

Revision 1.213 / (download) - annotate - [select for diffs], Tue Jul 1 02:11:46 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.212: +3 -1 lines
Diff to previous 1.212 (colored)

take the biglock when calling an adapters scsi_cmd handler.

Revision 1.212 / (download) - annotate - [select for diffs], Tue Jul 1 01:56:39 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.211: +29 -6 lines
Diff to previous 1.211 (colored)

start on being able to safely run io through the midlayer without
the kernel biglock. the plan is to have the midlayer assume its
running without the biglock, but that it cant call adapters or
devices without taking the biglock first.

this diff just wraps the calls to the adapter iopool get and put
handlers up in the biglock.

this is safe now because of kettenis' commit to src/sys/kern/init_main.c
r1.120. ive been running this in various places since early 2011.

Revision 1.211 / (download) - annotate - [select for diffs], Tue Apr 22 07:29:11 2014 UTC (10 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.210: +3 -23 lines
Diff to previous 1.210 (colored)

factor out the code that figures out whether you're probing or detaching
a whole bus, a target, or a specific lun on a target from the bioctl
and scsi_req paths.

i want to reuse this factored code for something claudio wants.

Revision 1.210 / (download) - annotate - [select for diffs], Mon Jan 27 23:44:40 2014 UTC (10 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.209: +3 -3 lines
Diff to previous 1.209 (colored)

poison the io "allocated" by the default pool allocator so any attempt to
use it should cause a fault.

based on discussion with miod@

Revision 1.209 / (download) - annotate - [select for diffs], Sat Jan 18 02:42:30 2014 UTC (10 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.208: +5 -6 lines
Diff to previous 1.208 (colored)

rename scsi_ioh_runqueue to scsi_iopool_run, and make it available
outside scsi_base.c.

this will allow adapters to restrict access to iopool resources
based on some state, and then kick the pending requests on the pool
when the state comes good again.

ive been avoiding this for a long time, but it is the least worst
way to deal with some uses of XS_NO_CCB.

discussion with kettenis@ helped me decide this was right.

Revision 1.208 / (download) - annotate - [select for diffs], Mon Oct 7 17:54:23 2013 UTC (10 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.207: +2 -2 lines
Diff to previous 1.207 (colored)

typo

Revision 1.207 / (download) - annotate - [select for diffs], Fri Sep 27 11:43:19 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.206: +1 -109 lines
Diff to previous 1.206 (colored)

scsi_size() is now used only by cd(4). So move it from scsi_base.c
to cd.c and call it cd_size(), like sd_size() lives in sd.c.

Tweak some daddr_t variables to u_int64_t on the way, when they are
for disk sector numbers, not 512-byte block numbers.

Revision 1.206 / (download) - annotate - [select for diffs], Thu Aug 29 02:54:36 2013 UTC (10 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.205: +7 -7 lines
Diff to previous 1.205 (colored)

rename scsi_sem_{enter,leave} to scsi_pending_{start,finish}. these are
the wrappers around handling of pending work, theyre not semaphores.

names from tedu@
ok krw@ guenther@

Revision 1.205 / (download) - annotate - [select for diffs], Tue Aug 27 00:05:36 2013 UTC (10 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.204: +4 -2 lines
Diff to previous 1.204 (colored)

make scsi_sem_leave only run again once, no matter how many times
other things scsi_sem_enter. the things protected by this do as
much work as they can, so they only need to be told to try again
once.

this isnt a semaphore anymore (and probably never was) so there's
a name change coming too.

Revision 1.204 / (download) - annotate - [select for diffs], Mon Aug 26 01:37:13 2013 UTC (10 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.203: +23 -8 lines
Diff to previous 1.203 (colored)

make scsi_{xsh,ioh}_{add,del} return whether they moved something
on or off the queues so things calling them can tell if something
is or isnt going to happen.

Revision 1.203 / (download) - annotate - [select for diffs], Sun Aug 25 23:31:39 2013 UTC (10 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.202: +1 -4 lines
Diff to previous 1.202 (colored)

move the prototypes of scsi_sem_{enter,leave} into a header so things
other than scsi_base.c can use them.

Revision 1.202 / (download) - annotate - [select for diffs], Tue Jun 11 16:42:17 2013 UTC (11 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.201: +3 -3 lines
Diff to previous 1.201 (colored)

final removal of daddr64_t.  daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others

Revision 1.201 / (download) - annotate - [select for diffs], Sun Jul 1 19:32:55 2012 UTC (11 years, 11 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.200: +10 -1 lines
Diff to previous 1.200 (colored)

Do not try to send a 10 byte MODE_SENSE request to non-ATAPI non-UMASS
devices which advertize themselves as non-SCSI2-aware, since this command
appeared in the SCSI-2 specification.
This makes the Insite Floptical work when connected to a controller which
correctly handles spontaneous deselection (which happens when a non-zero
lun on said floptical device is addressed), such an esp(4) but not wdsc(4).
This is step one of getting Floptical devices working on SGI systems.

feedback and ok krw@

Revision 1.200 / (download) - annotate - [select for diffs], Wed Jun 15 01:10:05 2011 UTC (13 years ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.199: +24 -23 lines
Diff to previous 1.199 (colored)

factor the common bits out of code that builds scsi inquiry commands into
scsi_init_inquiry(). cut the compiled INQUIRY code over to it.

ok and tweaks from krw@
ok matthew@

Revision 1.199 / (download) - annotate - [select for diffs], Thu Mar 17 21:30:24 2011 UTC (13 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.198: +11 -14 lines
Diff to previous 1.198 (colored)

use dma_alloc/dma_free instead of malloc to allocate buffers which need
to be in the right address space.
help from matthew and krw

Revision 1.198 / (download) - annotate - [select for diffs], Wed Mar 2 04:38:01 2011 UTC (13 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.197: +117 -1 lines
Diff to previous 1.197 (colored)

Sync ASC/ASCQ errors with www.t10.org/lists/asc-num.txt of 11/15/10.
Prompted by dlg@'s tape library trying to report a failure to thread
a media (0x53, 0x04).

Revision 1.197 / (download) - annotate - [select for diffs], Mon Sep 20 00:19:47 2010 UTC (13 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.196: +16 -8 lines
Diff to previous 1.196 (colored)

bring back scsi_base.c r1.195 and scsiconf.h r1.138 now that
src/sys/dev/ata/atascsi.c r1.92 solves the problem that my scsi_link
change tickled.

tested by josh elsasser who reported the problem in pr6470
deraadt@ is letting it in again so it can get widespread testing

Revision 1.196 / (download) - annotate - [select for diffs], Fri Sep 17 23:19:02 2010 UTC (13 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.195: +7 -15 lines
Diff to previous 1.195 (colored)

revert scsi_base.c r1.195 and scsiconf.h r1.138 as it screws up with some
disks in atascsi.

as reported in pr6470

Revision 1.195 / (download) - annotate - [select for diffs], Tue Sep 14 01:39:44 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.194: +16 -8 lines
Diff to previous 1.194 (colored)

the openings member of scsi_link is the maximum number of commands that a
scsi device can have in flight. instead of counting users of openings on
the bus by taking away from the openings value, count the number of
pending commands on the bus in a new pending variable.

this lets us know how many outstanding commands there are. we can then use
that to make sure that all commands a device has generated get completed
before detaching the device. this helps avoid resource leaks and use after
frees.

tested by me on pci ehci/umass, fc mpi, and sas mpi.
tested by jakemsr on cardbus ohci umass.
it found issues in sas mpi which were fixed as a result of this diff.
ok krw@

Revision 1.194 / (download) - annotate - [select for diffs], Wed Sep 8 11:04:39 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.193: +28 -11 lines
Diff to previous 1.193 (colored)

let things request the detach of everything on the whole bus, rather than
just a target/lun.

Revision 1.193 / (download) - annotate - [select for diffs], Mon Aug 30 02:47:56 2010 UTC (13 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.192: +16 -12 lines
Diff to previous 1.192 (colored)

Avoid possible aliasing-related compiler issues by always writing to
cmd->opcode through the type casted command pointer rather than
through xs->cmd->opcode.

Requested by deraadt@; ok krw@.

Revision 1.192 / (download) - annotate - [select for diffs], Wed Aug 25 00:31:35 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.191: +148 -32 lines
Diff to previous 1.191 (colored)

add scsi_iopool_destroy and scsi_link_shutdown. when a link or
device are going away, this will walk the pool and link queues and
wake up processes that are sleeping while waiting for an io or xs.
they will return NULL to the scsi_{xs,io}_get callers, which should
then check if they device is still alive. all other handlers that
are registered on the queues should be removed by their owners
before the destroy/shutdown funcs are called.

lots of help and discussion with matthew@
ok matthew@

Revision 1.166.2.1 / (download) - annotate - [select for diffs], Tue Aug 24 09:10:14 2010 UTC (13 years, 9 months ago) by stephan
Branch: OPENBSD_4_7
Changes since 1.166: +2 -1 lines
Diff to previous 1.166 (colored) next main 1.167 (colored)

MFC, original commit from dlg:
--------------------------------------------------------------------------
if we're going to set ITSDONE when an xfer is done cos the adapter expects
it, we should clear it before we issue it to the adapter too. retried
commands would have ITSDONE still set otherwise.
--------------------------------------------------------------------------

ok krw@

Revision 1.191 / (download) - annotate - [select for diffs], Sat Aug 7 03:50:02 2010 UTC (13 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored)

No "\n" needed at the end of panic() strings.

Bogus chunks pointed out by matthew@ and miod@. No cookies for
marco@ and jasper@.

ok deraadt@ miod@ matthew@ jasper@ macro@

Revision 1.190 / (download) - annotate - [select for diffs], Wed Jul 28 01:53:12 2010 UTC (13 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.189: +1 -5 lines
Diff to previous 1.189 (colored)

No need to bzero() malloc'd memory if we used M_ZERO.

ok matthew@

Revision 1.189 / (download) - annotate - [select for diffs], Tue Jul 27 04:41:56 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
Changes since 1.188: +38 -1 lines
Diff to previous 1.188 (colored)

Add scsi_cmd_rw_decode() for decoding any SCSI READ or WRITE command,
and update atascsi(4) to make use of it.  (Other HBAs will be updated
post-release.)  Should allow for use of SATA drives with >2^32 LBAs.

ok deraadt@, dlg@, krw@

Revision 1.188 / (download) - annotate - [select for diffs], Tue Jul 27 04:17:10 2010 UTC (13 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.187: +31 -26 lines
Diff to previous 1.187 (colored)

the queue entry and state variables in the xsh and ioh structs are part
of a separate struct which the ioh struct includes for no good reason
anymore. just put the vars directly in the ioh.

this removes this useless abstraction.

ok krw@ matthew@

Revision 1.187 / (download) - annotate - [select for diffs], Sun Jul 25 15:39:32 2010 UTC (13 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.186: +3 -3 lines
Diff to previous 1.186 (colored)

Restore previous behaviour of always bzero()'ing the buf passed to
scsi_inquire_vpd(). scsi_inquire_vpd() oddness noted by jsg@ after
report of macppc problems by kili@.

Revision 1.186 / (download) - annotate - [select for diffs], Sat Jul 24 04:01:52 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
Changes since 1.185: +5 -10 lines
Diff to previous 1.185 (colored)

Get rid of scsi_deinit(), and change scsi_init() back to a one-time
initialization strategy, rather than pretending to do user reference
counting.  Previously, we would re-initialize the SCSI pool(9)s, which
had the fun consequence of causing sysctl(kern.pool.npools) to
infinite loop at IPL_VM.

ok krw@

Revision 1.185 / (download) - annotate - [select for diffs], Thu Jul 22 05:21:58 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
Changes since 1.184: +2 -2 lines
Diff to previous 1.184 (colored)

In scsi_inquire_vpd(), actually just return EJUSTRETURN when dealing
with UMASS devices.  Fixes scsi_scsi_cmd() removal regression.

ok dlg@

Revision 1.184 / (download) - annotate - [select for diffs], Thu Jul 22 00:31:06 2010 UTC (13 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.183: +214 -166 lines
Diff to previous 1.183 (colored)

Eliminate scsi_scsi_cmd() now that ss(4) is gone and with it the
last bastardized sync and buf call through scsi_scsi_cmd(). Flatten
code to call scsi_xs_sync() directly for all commands.

Airplane typos shaken out by various.

ok dlg@ matthew@ deraadt@

Revision 1.183 / (download) - annotate - [select for diffs], Tue Jul 6 01:07:28 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.182: +6 -4 lines
Diff to previous 1.182 (colored)

Fix monumental cock-up with SCSI_SILENT and SCSI_IGNORE_ILLEGAL_REQUEST
flags which I perpetrated when I paid insufficient attention to
dlg@'s original diff.

Belatedly tested by marco@ and myself. Bad marco@. Bad krw@.

ok marco@

Revision 1.182 / (download) - annotate - [select for diffs], Sat Jul 3 01:55:28 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.181: +13 -19 lines
Diff to previous 1.181 (colored)

Get rid of EAGAIN, retry scsi_xs_sync() commands (after a scsi_delay())
that get XS_NO_CCB until retry limit exceeded. On to getting rid
of XS_NO_CCB.

ok matthew@ "so be it" dlg@

Revision 1.181 / (download) - annotate - [select for diffs], Fri Jul 2 23:57:46 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.180: +19 -13 lines
Diff to previous 1.180 (colored)

Always try READ CAPACITY(16) on SCSI-3 devices. If it fails, return
the READ CAPACITY(10) values already retrieved. Creates the possibility
to look at other interesting READ CAPACITY(16) data for future
consideration.

ok matthew@ marco@ deraadt@

Revision 1.180 / (download) - annotate - [select for diffs], Fri Jul 2 00:04:11 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.179: +7 -5 lines
Diff to previous 1.179 (colored)

Use M_NOWAIT only if SCSI_NOSLEEP is set, as is the usual idiom. From
matthew@ who won't be home until late.

ok matthew@ & tedu@.

Revision 1.179 / (download) - annotate - [select for diffs], Thu Jul 1 22:20:01 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.178: +21 -10 lines
Diff to previous 1.178 (colored)

Move rdcap/rdcap16 structs used to get info about disk size off of
stack and malloc/free them instead. First stirrings of the tide of
de-stacking to come.

Feedback, fixes and ok matthew@ & tedu@.

Revision 1.178 / (download) - annotate - [select for diffs], Thu Jul 1 05:11:18 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.177: +27 -39 lines
Diff to previous 1.177 (colored)

Die struct scsi_device! Die! Instead, save a pointer to the routine
to interpret sense errors. This is initialized to the basic
interpretation routine, and specific scsi drivers (sd/st/cd) can
replace this with their own. While here kill EJUSTRETURN dance and
make more specialized interpretation routines directly call the
basic routine if desired.

Fixes by matthew@ to my first diff. Most original work by dlg@.

ok matthew@ marco@ dlg@

Revision 1.177 / (download) - annotate - [select for diffs], Thu Jul 1 03:01:37 2010 UTC (13 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.176: +2 -1 lines
Diff to previous 1.176 (colored)

Restore setting xs->bp; fixes ncr(4) on VAX.

ok miod@, krw@

Revision 1.176 / (download) - annotate - [select for diffs], Mon Jun 28 09:11:21 2010 UTC (13 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.175: +1 -3 lines
Diff to previous 1.175 (colored)

remove a lonely remnant from some debug code that snuck in.

Revision 1.175 / (download) - annotate - [select for diffs], Mon Jun 14 10:03:33 2010 UTC (14 years ago) by thib
Branch: MAIN
Changes since 1.174: +1 -69 lines
Diff to previous 1.174 (colored)

remove the scsi_buf_* functions as these have been
replaced by BUFQ's.

OK krw@, dlg@

Revision 1.174 / (download) - annotate - [select for diffs], Tue Jun 1 10:11:05 2010 UTC (14 years ago) by dlg
Branch: MAIN
Changes since 1.173: +2 -1 lines
Diff to previous 1.173 (colored)

if we're going to set ITSDONE when an xfer is done cos the adapter expects
it, we should clear it before we issue it to the adapter too. retried
commands would have ITSDONE still set otherwise.

Revision 1.173 / (download) - annotate - [select for diffs], Mon May 24 21:51:49 2010 UTC (14 years ago) by krw
Branch: MAIN
Changes since 1.172: +2 -2 lines
Diff to previous 1.172 (colored)

"scsi_ioh_add:" -> "scsi_ioh_del:" in scsi_ioh_del() panic msg.

Spotted by Matthew Dempsky. Thanks!

Revision 1.172 / (download) - annotate - [select for diffs], Sat Apr 17 04:14:52 2010 UTC (14 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.171: +4 -3 lines
Diff to previous 1.171 (colored)

ramdisks need to compile; ok dlg

Revision 1.171 / (download) - annotate - [select for diffs], Sat Apr 17 00:51:13 2010 UTC (14 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.170: +3 -3 lines
Diff to previous 1.170 (colored)

use the iopools mutex to protect the semaphore wrapping the openings
runqueue. less is more sometimes.

Revision 1.170 / (download) - annotate - [select for diffs], Fri Apr 16 09:51:30 2010 UTC (14 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.169: +79 -63 lines
Diff to previous 1.169 (colored)

fix an fatal flaw with iopools.

an xshandler gets put on a series of lists as it allocates different
resources, and uses the same tailq entry on each of these lists as
its only supposed to be on one of them at a time. however, it was
possible for the xshandler to be added to both at the same time,
therefore corrupting the lists and leading to a panic.

this diff moves from using separate flags for each queue an xshandler
could be on to having a single state variable that shows which one
it is on (or not on). this prevents an xshandler on the io runqueue
from being added to the openings runqueue, which in turn prevents
the list corruption.

some operations have been reordered to avoid races and complexity
in this little state machine.

Revision 1.169 / (download) - annotate - [select for diffs], Mon Apr 12 09:51:48 2010 UTC (14 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.168: +1 -3 lines
Diff to previous 1.168 (colored)

i snuck fine grained locking into the midlayer as part of all the
other stuff ive been doing in here. everything that needs protection
inside the midlayer and the scsi device drivers (sd, cd, etc) uses
mutexes now.

this pushes splbio out of the midlayer. splbio is only taken before
biodone is called now.

ok beck@ marco@ krw@ deraadt@. theyre all terrified, but they all
say if we're going to do then now is the right stage of the dev
cycle.

Revision 1.168 / (download) - annotate - [select for diffs], Tue Apr 6 00:58:00 2010 UTC (14 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.167: +413 -39 lines
Diff to previous 1.167 (colored)

implement a new mechanism for allocating resources on the bus.

instead of optimistically trying to use a resource by executing an
xs and then failing when there's no room for it, this puts things
that want to use the hardware on a runqueue. as resources become
available on the bus then consumers on the runqueue are popped off
and guaranteed access to the resource.

the resources are generally "ccbs" in adapter drivers, so this
abstracts a way for the midlayer to get access to them into something
called iopools.

it also provides a callback api for consumers of resources to use:
the scsi_ioh api for things that want direct access to the ccbs,
and the scsi_xsh api for things that want to issue a scsi_xfer on
the bus. these apis have been modelled on the timeout api.

scsi_xs_get and therefore scsi_scs_cmd have been cut over to using these
apis internally, so if they are allowed to sleep then can wait on the
runqueue for a resource to become available and therefore guarantee that
when executed on an adapter providing an iopool that they will succeed.

ok krw@ beck@ marco@
tested by many including krw@ beck@ mk@ okan@ todd@

Revision 1.167 / (download) - annotate - [select for diffs], Tue Mar 23 01:57:20 2010 UTC (14 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.166: +4 -21 lines
Diff to previous 1.166 (colored)

Change the scsi_cmd function member of scsi_adapter from int to
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@

Revision 1.166 / (download) - annotate - [select for diffs], Fri Jan 15 06:27:12 2010 UTC (14 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE
Branch point for: OPENBSD_4_7
Changes since 1.165: +15 -15 lines
Diff to previous 1.165 (colored)

Oops. Respect the various IGNORE flags when not in SCSIDEBUG mode.
Should quieten booting again.

And thus ends n2k10.

Revision 1.165 / (download) - annotate - [select for diffs], Fri Jan 15 05:50:31 2010 UTC (14 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.164: +57 -1 lines
Diff to previous 1.164 (colored)

Abstract and merge the manual buf queue manipulating functions into
one place for easier debugging and maintenance. No intended functional
changes.

ok dlg@

Revision 1.164 / (download) - annotate - [select for diffs], Thu Jan 14 04:56:08 2010 UTC (14 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.163: +23 -19 lines
Diff to previous 1.163 (colored)

Print sense data during SCSIDEBUG again. Always print the decoded
data when SCSIDEBUG is set, irrespective of SCSI_SILENT. Tweak
output a bit.

Noticed in output generated by todd@.

Revision 1.163 / (download) - annotate - [select for diffs], Thu Jan 14 00:32:46 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.162: +7 -7 lines
Diff to previous 1.162 (colored)

Tweak names a bit. show_mem -> scsi_show_mem, show_scsi_xs ->
scsi_xs_show.

No functional change.

Revision 1.162 / (download) - annotate - [select for diffs], Wed Jan 13 10:53:11 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.161: +10 -9 lines
Diff to previous 1.161 (colored)

Get new xs's with PR_ZERO to ensure all shiny new fields get
initialized. Bring back panics on non-NULL done and cookie fields,
but put inside DIAGNOSTIC.

ok dlg@

Revision 1.161 / (download) - annotate - [select for diffs], Wed Jan 13 08:04:39 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.160: +1 -4 lines
Diff to previous 1.160 (colored)

Cookie or done is set on entry to scsi_xs_sync(). Take panic() out
until we figure out why.

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jan 13 05:08:55 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.159: +4 -1 lines
Diff to previous 1.159 (colored)

when checking an xs for errors, first check if the device the xs is for
is dying. if so, return ENXIO.

this should make detach of devices during scsi attaches less dangerous.

idea (and the first version of this diff) ok deraadt@
ok krw@

Revision 1.159 / (download) - annotate - [select for diffs], Wed Jan 13 03:09:05 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.158: +4 -1 lines
Diff to previous 1.158 (colored)

scsi_xs_sync uses the xs cookie and done pointers, so users of scsi_xs_sync
cannot. panic if theyre set before scsi_xs_sync is called.

question raised by and ok krw@

Revision 1.158 / (download) - annotate - [select for diffs], Wed Jan 13 02:46:19 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.157: +2 -2 lines
Diff to previous 1.157 (colored)

Oops. Restore decrement of xs->retries I optimized away. Not everything
is dlg@'s fault.

ok dlg@

Revision 1.157 / (download) - annotate - [select for diffs], Wed Jan 13 00:49:24 2010 UTC (14 years, 5 months ago) by jcs
Branch: MAIN
Changes since 1.156: +2 -2 lines
Diff to previous 1.156 (colored)

typo in panic message

Revision 1.156 / (download) - annotate - [select for diffs], Sun Jan 10 23:06:43 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.155: +13 -11 lines
Diff to previous 1.155 (colored)

Restore delay on XS_BUSY result, just in case it is needed somewhere. Polish
logic to eliminate FALLTHROUGH craziness.

ok marco@ dlg@

Revision 1.155 / (download) - annotate - [select for diffs], Sun Jan 10 00:10:23 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.154: +2 -1 lines
Diff to previous 1.154 (colored)

Set ITSDONE in scsi_done() and zap trivial instances of setting it
in the drivers just before calling scsi_done().

ok dlg@ beck@

Revision 1.154 / (download) - annotate - [select for diffs], Sat Jan 9 22:24:34 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.153: +3 -8 lines
Diff to previous 1.153 (colored)

panic with a nice message if scsi_xs_sync_done gets called twice
rather than generating a fluffy printf.

Revision 1.153 / (download) - annotate - [select for diffs], Sat Jan 9 21:04:55 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.152: +5 -0 lines
Diff to previous 1.152 (colored)

always try to restart io on a device when an opening is made available from
scsi_xs_put.

Revision 1.152 / (download) - annotate - [select for diffs], Thu Jan 7 00:11:15 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.151: +9 -1 lines
Diff to previous 1.151 (colored)

warn if scsi_done has been called twice on an xs in the scsi_xs_sync path
rather than panic.

ok krw@

Revision 1.151 / (download) - annotate - [select for diffs], Mon Jan 4 11:46:17 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.150: +0 -3 lines
Diff to previous 1.150 (colored)

nothing in the midlayer cares about ITSDONE anymore. if a command is done,
the adapter will call scsi_done on it.

Revision 1.150 / (download) - annotate - [select for diffs], Mon Jan 4 00:45:58 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.149: +93 -85 lines
Diff to previous 1.149 (colored)

introduce scsi_xs_sync. this will synchronously execute a scsi_xfer
and do the appropriate sleeps, retries, error processing, and finally
returns an errno style value to the caller.

this cuts scsi_scsi_cmd, the ioctl code, sd_flush, and scsi_inquiry over
to scsi_xs_sync.

ok krw@

Revision 1.149 / (download) - annotate - [select for diffs], Fri Jan 1 07:06:27 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.148: +2 -8 lines
Diff to previous 1.148 (colored)

deck chair shuffling

Revision 1.148 / (download) - annotate - [select for diffs], Fri Jan 1 06:30:27 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.147: +4 -4 lines
Diff to previous 1.147 (colored)

split the flags used in a scsi_link structure to represent its state at
runtime out into a separate state variable. only operate on the state bits
with atomic ops. introduce the DYING state so things that sleep can figure
out if they should keep going or not.

Revision 1.147 / (download) - annotate - [select for diffs], Wed Dec 9 21:02:51 2009 UTC (14 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.146: +2 -2 lines
Diff to previous 1.146 (colored)

Nuke stray comment referencing deceased TRY_AGAIN_LATER that dlg@
snuck back in.

Noticed by kettenis@.

Revision 1.146 / (download) - annotate - [select for diffs], Mon Dec 7 00:09:27 2009 UTC (14 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.145: +73 -1 lines
Diff to previous 1.145 (colored)

Re-enable SCSIDEBUG display of commands and data. Original diff
from dlg@, tweaking by me to make it compile.

ok dlg@

Revision 1.145 / (download) - annotate - [select for diffs], Tue Dec 1 01:50:35 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.144: +1 -2 lines
Diff to previous 1.144 (colored)

properly handle all xs states that can be returned by an adapter in sd.

requested by krw@ after spending a week munging through my code.

Revision 1.144 / (download) - annotate - [select for diffs], Tue Dec 1 01:40:02 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.143: +133 -330 lines
Diff to previous 1.143 (colored)

put the midlayer changes back in.

the two issues affecting it last time are gone. the first, mishandling of
TRY_AGAIN_LATER is not relevant now that krw got rid of TRY_AGAIN_LATER.
the second, the misbehaving IBM disk was found to be a problem with siop
using ordered tags on most ops combined with the speed of the new code.

putting this in so we can move forward.

ok krw@ "commit please" marco@

Revision 1.143 / (download) - annotate - [select for diffs], Sun Nov 22 20:09:53 2009 UTC (14 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.142: +3 -13 lines
Diff to previous 1.142 (colored)

Nuke TRY_AGAIN_LATER now that no driver returns it.

ok marco@

Revision 1.142 / (download) - annotate - [select for diffs], Thu Nov 12 06:20:27 2009 UTC (14 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.141: +336 -164 lines
Diff to previous 1.141 (colored)

revert midlayer back to it was before i put my big rewrite in. this is
causing a weird problems on an alpha and also appears responsible for
isp(4) weirdness i havent had a chance to examine yet.

sigh, this makes me sad.

Revision 1.141 / (download) - annotate - [select for diffs], Tue Nov 10 10:51:03 2009 UTC (14 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.140: +1 -2 lines
Diff to previous 1.140 (colored)

remove a stale comment from a previous revision of the diff i
committed. i hate comments. i read and change the code and then
forget about the comments.

pointed out by krw@

Revision 1.140 / (download) - annotate - [select for diffs], Tue Nov 10 10:18:59 2009 UTC (14 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.139: +79 -34 lines
Diff to previous 1.139 (colored)

fix the NO_CCB handling i broke when working on simplifying the midlayer.

marco@ discovered my rewrite retried commands rejected by an adapter
from a timeout, which was trivially starved by normal io going to
disks. this diff allows an xs to be marked as XS_NO_CCB, which will
cause it to be returned to the device driver to be retried as part
of the normal io queue.

tested by krw@ marco@ johan@
ok krw@ marco@

Revision 1.139 / (download) - annotate - [select for diffs], Tue Nov 10 10:13:08 2009 UTC (14 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.138: +127 -343 lines
Diff to previous 1.138 (colored)

backout the backout marco did of my code because of the NO_CCB breakage.
the fix for the NO_CCB breakage will follow shortly.

tested by krw@ marco@ johan@
ok krw@ marco@

Revision 1.138 / (download) - annotate - [select for diffs], Thu Nov 5 03:33:52 2009 UTC (14 years, 7 months ago) by marco
Branch: MAIN
Changes since 1.137: +343 -127 lines
Diff to previous 1.137 (colored)

The big diff dlg committed to the midlayer breaks NO_CCB and
TRY_AGAIN_LATER.  NO_CCB is a timer based mechanism that can trivially
be made to fail by running IO to two or more disks simultaneously.  The
TRY_AGAIN_LATER thing is more subtle because it now is a permanent
failure instead of transient however this is much harder to hit because
something must have gone wrong before it hits.

ok deraadt krw miod

Revision 1.137 / (download) - annotate - [select for diffs], Tue Oct 27 11:38:24 2009 UTC (14 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.136: +2 -2 lines
Diff to previous 1.136 (colored)

if (!ISSET(flags, SCSI_NOSLEEP)) return; else sleep(); is wrong.

found with krw while looking at #6247. tested locally with iogen and
scsi(8). this fixes a null deref in the ioctl path where there shouldnt be
one.

ok krw@

Revision 1.136 / (download) - annotate - [select for diffs], Mon Sep 14 00:03:28 2009 UTC (14 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.135: +126 -342 lines
Diff to previous 1.135 (colored)

rework the scsi midlayer to start addressing some problems i have
with it which became extremely annoying with what mpath wants to
do.

the major change is a new interface for submitting scsi commands.
previously the only way for drivers like sd, cd, st, etc to push
commands onto the hardware was via scsi_scsi_cmd(). the problem
with scsi_scsi_cmd is that it doesnt tell the caller if the command
failed, was queued, or completed unless you shoved a buf down with
it. this is important for mpath which wants to know what the physical
path to the device did so it can report it back to the midlayer
which called it.

this provides a new api which lets drivers like cd/sd/st/mpath etc
allocate an xs, fill it in, and provide a completion routine which
the midlayer will call with the state of the command when it is
finished with it. the caller is then responsible for freeing the
xs.

from the hba side of thing, the return code from the scsi_cmd
entrypoint is largely ignored now, and it is now always the
responsibility of the hba driver to call scsi_done when it has
completed the io, rather than returning COMPLETE and expecting the
midlayer to do it for you.

i have emulated scsi_scsi_cmd on top of this new api so existing
users of it will continue to work. sd(4) has been reworked to use
the new api directly to both demonstrate its use and test that the
new api actually does work.

this diff was mostly written in a day at f2k9. thanks to miod for poking
through hba drivers to help mitigate against fallout from the change to
the COMPLETE semantic. this has been reviewed by krw who didnt spot
anything wrong.

thanks to dave del debbio for testing.

ok deraadt@

Revision 1.135 / (download) - annotate - [select for diffs], Wed Sep 2 14:19:50 2009 UTC (14 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.134: +9 -14 lines
Diff to previous 1.134 (colored)

take advantage of workq_queue_task.

Revision 1.134 / (download) - annotate - [select for diffs], Thu Aug 13 21:35:56 2009 UTC (14 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.133: +4 -2 lines
Diff to previous 1.133 (colored)

make scsi_done set ITSDONE on the xs. this means hba drivers dont have to
do it (but doesnt preclude them using it internally).

discussed with krw@ miod@ and deraadt@

Revision 1.133 / (download) - annotate - [select for diffs], Thu Aug 13 19:49:31 2009 UTC (14 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.132: +84 -1 lines
Diff to previous 1.132 (colored)

provide an api for an interrupt (or something like it) to notify the
midlayer that a scsi device has appeared or dissapeared. the midlayer will
queue an event and run it in the system workq (which has process context)
to handle the attach or detach.

Revision 1.132 / (download) - annotate - [select for diffs], Tue Jun 2 06:33:04 2009 UTC (15 years ago) by yuo
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.131: +9 -4 lines
Diff to previous 1.131 (colored)

did not issue scsi_inquire with EVPD flag for USB mass strage class
device, as some devices will be stalled by the request.

ok krw@

Revision 1.131 / (download) - annotate - [select for diffs], Sat Jul 26 18:55:31 2008 UTC (15 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

Silence scsi_inquire_vpd() so devices that don't understand the necessary
INQUIRY options don't spam dmesg during probe. Seen by miod@ and kettenis@
for SCSI CD's.

ok miod@

Revision 1.130 / (download) - annotate - [select for diffs], Sat Jul 5 16:07:01 2008 UTC (15 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.129: +16 -4 lines
Diff to previous 1.129 (colored)

When SCSIDEBUG'ing, print data about to be written (for commands
flagged SCSI_DATA_OUT) and data that has been returned (for commands
flagged SCSI_DATA_IN). This is better than just printing the data
buffer before the command is issued since that does not include any
data that has been read. e.g. INQUIRY data, as thib@ and I discovered.

ok marco@

Revision 1.129 / (download) - annotate - [select for diffs], Sun Jun 22 16:32:05 2008 UTC (15 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.128: +8 -8 lines
Diff to previous 1.128 (colored)

Replace MUSTEK_RETRIES, SCANJET_RETRIES and ST_RETRIES with SCSI_RETRIES,
all defined to 4. Replace some magic number 4's with SCSI_RETRIES. Fix a
few lines that were now too long.

Revision 1.128 / (download) - annotate - [select for diffs], Sat Jun 21 21:35:27 2008 UTC (15 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.127: +4 -4 lines
Diff to previous 1.127 (colored)

Oops. Forgot to actually change the retries in scsi_size() to SCSI_RETRIES.

Revision 1.127 / (download) - annotate - [select for diffs], Sun Jun 15 00:52:25 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.126: +4 -3 lines
Diff to previous 1.126 (colored)

Treat SENSE_NOT_READY_INIT_REQUIRED sense errors the same as
SENSE_NOT_READY_BECOMING_READY sense errors. Some devices such as USB
Zip250 drives return the former when they mean the latter. Give the
first TEST UNIT READY command three times the usual retries so more
devices have time to get ready. This allows more removable devices to
detect media details and avoid issuing 'drive offline' messages.

ok marco@

Revision 1.126 / (download) - annotate - [select for diffs], Sat Jun 14 01:57:51 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.125: +1 -4 lines
Diff to previous 1.125 (colored)

Nuke ADEV_NOTUR, always issue TEST UNIT READY to clear out power-up
errors before issuing INQUIRY. Fixes Sony YE-Data floppy drive and
probably other devices at the cost of possibly breaking some 10 year
old CD-ROM drives. Un-special cases mvme68k which was forcing these
initial TURs.

Now wait for the inevitable weird USB device that breaks to surface.

ok marco@ deraadt@

Revision 1.125 / (download) - annotate - [select for diffs], Fri Jun 13 04:27:08 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.124: +13 -15 lines
Diff to previous 1.124 (colored)

Merge show_scsi_xs() and show_scsi_cmd() and move invocation so the
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@

Revision 1.124 / (download) - annotate - [select for diffs], Sun Nov 25 22:28:53 2007 UTC (16 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.123: +4 -2 lines
Diff to previous 1.123 (colored)

dont use the adapter_softc member of scsi_link as a softc anymore. the
"adapter_softc" is simply a way for the adapter to determine what scsibus
it is now dealing with, not a pointer back to the adapters device struct.

ok deraadt@ marco@

Revision 1.123 / (download) - annotate - [select for diffs], Sun Sep 16 01:30:24 2007 UTC (16 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.122: +1 -2 lines
Diff to previous 1.122 (colored)

MALLOC/FREE -> malloc/free, M_ZERO, extraneous casts,
extraneous #include <malloc.h>

Revision 1.122 / (download) - annotate - [select for diffs], Sat Jun 23 19:19:49 2007 UTC (16 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.121: +36 -19 lines
Diff to previous 1.121 (colored)

Implement disk sizes > 2^32-1. Code modelled on NetBSD.

Tested, tweaked and ok otto@

Revision 1.121 / (download) - annotate - [select for diffs], Thu May 31 18:21:44 2007 UTC (17 years ago) by dlg
Branch: MAIN
Changes since 1.120: +2 -84 lines
Diff to previous 1.120 (colored)

remove the scsi task thread, and replace it with the system workq.

"just :wq and do it" tedu@

Revision 1.120 / (download) - annotate - [select for diffs], Tue Apr 10 17:47:56 2007 UTC (17 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.119: +3 -3 lines
Diff to previous 1.119 (colored)

``it's'' -> ``its'' when the grammar gods require this change.

Revision 1.119 / (download) - annotate - [select for diffs], Tue Apr 3 04:47:59 2007 UTC (17 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.118: +26 -1 lines
Diff to previous 1.118 (colored)

add a wrapper for querying vpd inquiry pages

Revision 1.118 / (download) - annotate - [select for diffs], Tue Apr 3 04:15:50 2007 UTC (17 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.117: +5 -3 lines
Diff to previous 1.117 (colored)

modernise scsi_inquiry. the length field has grown and now theres pages to
query.

ok krw@

Revision 1.117 / (download) - annotate - [select for diffs], Tue Dec 12 02:44:36 2006 UTC (17 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.116: +21 -18 lines
Diff to previous 1.116 (colored)

Give the SCSI layer the ability to requeue i/o's rejected by a driver
using the new NO_CCB result. Currently a no-op since no driver produces
that result.

ok dlg@ marco@ deraadt@

Revision 1.116 / (download) - annotate - [select for diffs], Mon Nov 27 23:14:22 2006 UTC (17 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.115: +5 -4 lines
Diff to previous 1.115 (colored)

more magic removal
ok miod@, deraadt@

Revision 1.115 / (download) - annotate - [select for diffs], Mon Nov 27 18:24:43 2006 UTC (17 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.114: +57 -46 lines
Diff to previous 1.114 (colored)

rework asc/ascq handling to get rid of "magic" 0x values in the code, changes
asc/ascq handling to deal with the pair together rather than seperately, since
modern scsi has long since polluted the "categories" of asc enough that you
pretty much need to always look as ascq.

ok krw@ deraadt@, dlg@

Revision 1.114 / (download) - annotate - [select for diffs], Sat Nov 4 06:03:51 2006 UTC (17 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

kthread_create returns an int, not a pointer. compare the return value to
0, not NULL.

Revision 1.113 / (download) - annotate - [select for diffs], Fri Sep 22 00:33:41 2006 UTC (17 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.112: +93 -6 lines
Diff to previous 1.112 (colored)

implement a kernel thread that can be used by the midlayer or scsi drivers
when they need a process context to do something. the most obvious task
that springs to mind is attaches and detaches of devices on scsibus.

ok krw@ marco@ deraadt@

Revision 1.112 / (download) - annotate - [select for diffs], Fri Aug 4 21:35:51 2006 UTC (17 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.111: +32 -2 lines
Diff to previous 1.111 (colored)

Add ENOMEDIUM and EMEDIUMTYPE to report medium errors to userland programs
when using removable media devices, along with changes to scsi_base to
detect such cases in tapes other devices. This makes tar, dd, and friends
report a semi useful error message instead of nonsense when there is nothing
in the device.

Includes libc minor bump, and will require the corresponding sets change.

ok krw@ deraadt@

Revision 1.111 / (download) - annotate - [select for diffs], Sat Jul 29 02:40:45 2006 UTC (17 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (colored)

The version field of scsi_inquiry_data is not a simple numeric value
that specifies the version of SCSI being supported. Even the ANSI part
that we use is complex. 4 means 2, 5 means 3 and 6 means 4. Translate
and use the value correctly. Fixes SCSI5 and SCSI6 in dmesg. And
properly protects SCSI2 devices from getting SCSI3 commands.

"seems like an elegant solution to me" millert@ ok dlg@ marco@

Revision 1.110 / (download) - annotate - [select for diffs], Sun Jul 23 14:34:55 2006 UTC (17 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.109: +25 -1 lines
Diff to previous 1.109 (colored)

Use REPORT LUNS to get the list of LUNs to probe. If such a list is
obtained probe the LUNs given without checking for duplicate INQUIRY
data.

For non-USB, non-ATAPI, devices claiming to be SCSI-3 compliant. And
the target must have something attached at LUN 0.

If REPORT LUNS can't be used or isn't supported, the old scan process
is used.

Fixes Fibre Channel and SCSI enclosure devices that provide identical
INQUIRY data for all LUNs and were thus being misprobed as having
only LUN 0.

Tested by Bob Kitella, dlg@, beck@. Suggestions from deraadt@.

ok dlg@ beck@

Revision 1.109 / (download) - annotate - [select for diffs], Sat Jul 22 18:44:28 2006 UTC (17 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.108: +9 -8 lines
Diff to previous 1.108 (colored)

If the LUN is > 7, don't try to stuff it into the three bits available
in the CDB for pre-IDENTIFY device LUNs.

Revision 1.108 / (download) - annotate - [select for diffs], Sat Jul 15 00:04:11 2006 UTC (17 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.107: +4 -1 lines
Diff to previous 1.107 (colored)

catch "Media Removal Prevented" for devices that are capable of telling us
when we're not allowed to yank things out of them.  Instead of returning a
generic EIO and having the kernel printf a scsi sense to the console,
we now return EBUSY to userland and avoid the dmesg spewing.
ok krw@

Revision 1.107 / (download) - annotate - [select for diffs], Thu Jul 13 11:46:16 2006 UTC (17 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

Eliminate scsi_link field 'scsi_version' and just use the INQUIRY data
stored in scsi_link. That's where the value came from anyway. Move 'luns'
field to where 'scsi_version' used to be to preserve alignment.

ok dlg@

Revision 1.106 / (download) - annotate - [select for diffs], Tue Jul 11 13:15:30 2006 UTC (17 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.105: +4 -2 lines
Diff to previous 1.105 (colored)

scsi_get_xs raises splbio, but didnt lower it on error. tsk tsk.

ok krw@

Revision 1.105 / (download) - annotate - [select for diffs], Tue Jul 11 09:12:54 2006 UTC (17 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.104: +157 -221 lines
Diff to previous 1.104 (colored)

knf and ansi. no binary change

Revision 1.104 / (download) - annotate - [select for diffs], Sun May 28 17:15:23 2006 UTC (18 years ago) by beck
Branch: MAIN
Changes since 1.103: +5 -4 lines
Diff to previous 1.103 (colored)


Add PCATCH to tsleep flags when a scsi command is waiting for an opening
or is waiting to be retried, abort it when a signal interrupts the tsleep().

This fixes what was commited in version 1.92 to work properly.

ok krw@

Revision 1.103 / (download) - annotate - [select for diffs], Sat May 13 18:11:03 2006 UTC (18 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

When SCSIDEBUG'ing, display the return value of scsi_interpret_sense()
in hex. This makes it consistant with the display of the same value in
other messages.

Revision 1.102 / (download) - annotate - [select for diffs], Thu May 11 00:45:59 2006 UTC (18 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.101: +8 -8 lines
Diff to previous 1.101 (colored)

Zap trailing whitespace.

Revision 1.101 / (download) - annotate - [select for diffs], Sun May 7 20:50:21 2006 UTC (18 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.100: +12 -2 lines
Diff to previous 1.100 (colored)

If a device says a MODE SENSE command worked fine, do *not* try a MODE
SENSE BIG command even if no page data was returned.  Just accept the
fact that the device does not have any such page data.

This is more in line with the spec, and unbreaks devices (like the
Neodio 8-in-1 USB Card Reader donated by Manuel Pata) which freak out
when getting a MODE SENSE BIG.

Should not break any 'working' device.

ok pedro@ dlg@ marco@ 'Looks correct.' miod@

Revision 1.100 / (download) - annotate - [select for diffs], Sun May 7 00:20:05 2006 UTC (18 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.99: +32 -32 lines
Diff to previous 1.99 (colored)

Zap a bunch of trailing whitespace.

Revision 1.99 / (download) - annotate - [select for diffs], Mon Feb 6 17:37:28 2006 UTC (18 years, 4 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

typos from alexey dobriyan;

Revision 1.98 / (download) - annotate - [select for diffs], Mon Nov 28 16:51:29 2005 UTC (18 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

fix month-old breakage found by genududes (after henning's breakage)

Revision 1.97 / (download) - annotate - [select for diffs], Sun Nov 13 14:29:57 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.96: +8 -5 lines
Diff to previous 1.96 (colored)

ATAPI Tape drives need 6 byte MODE SENSE commands according to at
least one spec. Unlike other ATAPI devices.

Fixes PR #4611.

Revision 1.96 / (download) - annotate - [select for diffs], Sun Nov 13 03:27:42 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.95: +6 -1 lines
Diff to previous 1.95 (colored)

Use SCSI_DELAY only once. Document it. Default to no delay.

Fixes two second system 'freeze' when umass device plugged in. Speeds
up boot by not waiting for a minimum of 2 seconds at each scsi bus.

ok jmc@ pedro@ deraadt@

Revision 1.95 / (download) - annotate - [select for diffs], Sun Nov 13 02:39:45 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.94: +1 -2 lines
Diff to previous 1.94 (colored)

Use scsi_delay() instead of delay() when waiting for scsi disk to
become ready. Make verbiage SC_DEBUG().

ok dlg@

Revision 1.94 / (download) - annotate - [select for diffs], Mon Nov 7 23:49:32 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.93: +9 -7 lines
Diff to previous 1.93 (colored)

Death to superfluous verbiage. Suppress errors when getting the parameters
for a raw partition like we suppress errors for the other operations on raw
partitions. Replace 'could not get size' with more specific and informative
SC_DEBUG() output. Silences a usb card reader that fgsch@ found. Now attach
message is only 'sdX: drive offline'.

Tested & ok fgsch@

Revision 1.93 / (download) - annotate - [select for diffs], Wed Nov 2 01:36:05 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.92: +37 -24 lines
Diff to previous 1.92 (colored)

Abstract delay code out and call it directly from XX_interpret_sense.
Makes the logic simpler by eliminating the XS_BUSY dance in xs->error,
and will allow individual device types to delay different lengths on
certain conditions.

Allow SCSI_NOSLEEP commands to be retried without waiting. Who knows,
they may work even without a delay.

ok marco@

Revision 1.92 / (download) - annotate - [select for diffs], Sat Oct 22 16:51:28 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.91: +10 -3 lines
Diff to previous 1.91 (colored)

When a scsi command is waiting for an opening or is waiting to be retried,
abort it when a signal interrupts the tsleep().

Suggested by deraadt@.

"I really like this" deraadt@ "I like this" marco@

Revision 1.91 / (download) - annotate - [select for diffs], Sun Oct 16 19:16:36 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.90: +8 -4 lines
Diff to previous 1.90 (colored)

Don't pound UNIT ATTENTION retries in as fast as possible. If we are
going to retry the command, pause for a second to let the condition
clear. Just as we do for certain NOT READY conditions.

Found with the help of, and fixes Ed Wandasiewicz's IBM USB Memory
key.

ok deraadt@

Revision 1.90 / (download) - annotate - [select for diffs], Mon Oct 10 20:06:11 2005 UTC (18 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.89: +5 -6 lines
Diff to previous 1.89 (colored)

Make some panic messages more useful.

Revision 1.89 / (download) - annotate - [select for diffs], Tue Oct 4 20:58:10 2005 UTC (18 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

shorter name for wait channel

Revision 1.88 / (download) - annotate - [select for diffs], Sun Sep 11 17:34:27 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.87: +12 -14 lines
Diff to previous 1.87 (colored)

Simplify code by changing struct scsi_mode_sense_buf{ union {}
headers; } to just union scsi_mode_sense_buf {}. No functional change.

ok marco@

Revision 1.87 / (download) - annotate - [select for diffs], Mon Aug 29 00:41:44 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.86: +8 -2 lines
Diff to previous 1.86 (colored)

If a buffer larger than the max allowed is offered to scsi_mode_sense()
or scsi_mode_sense_big(), use as much of it as is allowed. Don't justi
mask off the higher bits and possibly leave yourself with 0 space.

Fixes problem aoyama@ found on luna88k tape drive.

ok deraadt@.

Revision 1.86 / (download) - annotate - [select for diffs], Mon Aug 1 22:42:50 2005 UTC (18 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.85: +4 -1 lines
Diff to previous 1.85 (colored)

Return 0 as the block size when READ_CAPACITY fails in scsi_size().
Prevents garbage being used as ssblksize in sd_get_parms(). Perhaps
another nail in the coffin for PR4313.

Revision 1.85 / (download) - annotate - [select for diffs], Thu Jun 23 00:31:44 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.84: +6 -2 lines
Diff to previous 1.84 (colored)

Don't discard the blocksize information provided by the READ CAPACITY
command. Return it in a new parameter to scsi_size.

Revision 1.84 / (download) - annotate - [select for diffs], Sat Jun 18 01:09:03 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.83: +4 -4 lines
Diff to previous 1.83 (colored)

Shorten a couple of structure names:

scsi_mode_direct_blk_desc -> scsi_direct_blk_desc
scsi_mode_blk_desc_big -> scsi_blk_desc_big

Revision 1.83 / (download) - annotate - [select for diffs], Sat Jun 18 00:52:15 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.82: +32 -25 lines
Diff to previous 1.82 (colored)

Switch to trying 6 byte MODE SENSE commands (for non ATAPI devices at
least) before 10 byte MODE SENSE. Some older devices can't/won't
distinguish between the two and return 6 byte MODE SENSE data for 10
byte requests.

Check that at least a full header was returned.

Tested by miod@ hshoexer@ and Ed Wandasiewisz on troublesome devices.

Revision 1.82 / (download) - annotate - [select for diffs], Sun Jun 12 21:40:05 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.81: +32 -48 lines
Diff to previous 1.81 (colored)

It turns out you need to ask for 16 byte block descriptors. We don't,
so eliminate code dealing with 16 byte block descriptors. No one else
seems to use them anyway. Add define for appropriate permission bit in
case we ever need it.

Simplify and clean up scsi_do_mode_sense() code as a result.

Strengthen check to ensure block descriptor data is a valid by
checking if it is a multiple of 8 bytes rather than just > 8 bytes.

Moves code to closer to what it was before scsi_do_mode_sense().

Revision 1.81 / (download) - annotate - [select for diffs], Thu Jun 9 00:16:09 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.80: +2 -2 lines
Diff to previous 1.80 (colored)

Fix typo in ASC/ASQ messages: DEnied -> Denied.

Revision 1.80 / (download) - annotate - [select for diffs], Sun Jun 5 21:27:07 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.79: +8 -7 lines
Diff to previous 1.79 (colored)

Fix scsi_mode_select() and scsi_mode_select_big() to send just the
required number of bytes, rather than a full scsi_mode_sense_buf. Some
devices (e.g. my HP SureStore DAT/24) decline to accept such oversized
transfers. Instead, force callers to fill in the data_length field in
the header and use that information to set the size of the transfer.

Revision 1.79 / (download) - annotate - [select for diffs], Sat Jun 4 01:25:02 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.78: +29 -9 lines
Diff to previous 1.78 (colored)

Make scsi_do_mode_sense() aware of the difference between the 8 byte
general block descriptor and the 8 byte direct block descriptor, and
return the correct values for density, block_count and block_size
based on the type of the device.  First cut has T_SEQUENTIAL (i.e.
tape devices) as the only device type using general block descriptors,
so the behaviour change is minimal.

Revision 1.78 / (download) - annotate - [select for diffs], Fri Jun 3 15:50:10 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.77: +7 -3 lines
Diff to previous 1.77 (colored)

Tweak scsi_do_mode_sense(). NetBSD was right and I was wrong. Sigh.
Add 'big' parameter to report which mode sense header type is being
returned. Eliminate icky pointer arithmetic, since it won't work if
only block descriptors are returned by the device.

No functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Jun 2 23:49:28 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Fix pasto - use correct pointer to extract block count from 8 byte
block descriptors. Not that we actually use this information anywhere.

Revision 1.76 / (download) - annotate - [select for diffs], Tue May 31 01:15:31 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.75: +5 -6 lines
Diff to previous 1.75 (colored)

Remove unused sc_err1() parameter 'async'. Lint.

Revision 1.75 / (download) - annotate - [select for diffs], Sat May 28 23:59:18 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.74: +5 -1 lines
Diff to previous 1.74 (colored)

Sprinkle some /* FALLTHROUGH */'s as suggested by lint.

Revision 1.74 / (download) - annotate - [select for diffs], Sat May 28 23:45:06 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

'openings' is u_int16_t, so 'openings <= 0' is wrong. Lint.

Revision 1.73 / (download) - annotate - [select for diffs], Sat May 28 23:32:25 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Forgot to specify parameter type. Lint.

Revision 1.72 / (download) - annotate - [select for diffs], Sat May 28 23:26:09 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

snprintf returns int not size_t. Thank you lint.

Revision 1.71 / (download) - annotate - [select for diffs], Sat May 28 06:16:33 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.70: +8 -3 lines
Diff to previous 1.70 (colored)

Add _lto8b() and _8btol() to decode nblocks field of
scsi_mode_blk_desc_big. Will be needed to move st to new mode sense
function.

Be a bit more careful with types of parameters to scsi_do_mode_sense,
using u_int32_t instead of int.

No functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Wed May 25 20:52:41 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.69: +109 -1 lines
Diff to previous 1.69 (colored)

Introduce safer, more general mode sense capability. Transparently use
both 10 byte and 6 byte MODE SENSE commands and just return error
checked values.

Convert sd_scsi.c to use new mechanism for non-optical drives. USB
umass devices will now display actual mode sense info if it is
available via a 10 byte MODE SENSE. Which may mean 0 heads, etc. is
shown until cosmetics are finalized.

ok marco@ 'that is pretty cool' deraadt@

Revision 1.69 / (download) - annotate - [select for diffs], Sun May 22 01:12:47 2005 UTC (19 years ago) by krw
Branch: MAIN
Changes since 1.68: +4 -3 lines
Diff to previous 1.68 (colored)

Check if the scsi_request has been released in the COMPLETE case as
was already done in the SUCCESSFULLY_QUEUED case. Shouldn't happen,
but better safe than sorry if some driver completes it's io
immediately.

Also don't recompute saved flags if the request is retried.

ok marco@

Revision 1.68 / (download) - annotate - [select for diffs], Sat May 14 00:20:43 2005 UTC (19 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.67: +69 -5 lines
Diff to previous 1.67 (colored)

Add scsi_mode_[sense|select]_big() and use it instead of
atapi_mode_[sense|select](). This will allow the removal of
atapi_base.c and atapi_all.h files, and sets the stage for better usb
mode sense handling amoung other things.

Remove cd_scsibus_[get|set]_mode() and
sd_scsibus_mode_sense() shims in favour of scsi_mode_[sense|select]().
Add zero'ing of reserved length field in scsi_mode_select(). Change
some uchar * type parameters to scsi_mode_header *.

No functional changes. Mostly from NetBSD.

ok dlg@.

Revision 1.67 / (download) - annotate - [select for diffs], Thu Apr 28 10:16:04 2005 UTC (19 years, 1 month ago) by moritz
Branch: MAIN
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

more snprintf error checking. ok krw@

Revision 1.66 / (download) - annotate - [select for diffs], Sun Apr 17 18:55:45 2005 UTC (19 years, 1 month ago) by tom
Branch: MAIN
Changes since 1.65: +1 -1 lines
Diff to previous 1.65 (colored)

Fix typo

ok krw@

Revision 1.65 / (download) - annotate - [select for diffs], Tue Apr 5 12:13:16 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.64: +58 -1 lines
Diff to previous 1.64 (colored)

Factor out scsi_mode_sense() and scsi_mode_select() like NetBSD does.
Eliminate some duplicate structures and defines along the way. SCSI CD
drives will now pay attention to the 'flags' parameter for MODE SENSE
and MODE SELECT commands. No other functional change.

ok tdeval@

Revision 1.64 / (download) - annotate - [select for diffs], Fri Apr 1 23:34:39 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.63: +23 -13 lines
Diff to previous 1.63 (colored)

Cleanup SKEY_NOT_READY logic. Only retry command if it's likely the
condition is going to clear up, which speeds up boot by avoiding
delays in disk matching. Return ENODEV if media is not present, which
avoids trying to spin up disks that are not present. Use ENODEV in
amd64/i386 dkcsum.c to filter failure reports.

Mostly from NetBSD.

ok marco@

Revision 1.63 / (download) - annotate - [select for diffs], Thu Mar 24 12:52:01 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.62: +17 -4 lines
Diff to previous 1.62 (colored)

If READ CAPACITY(10) says there are more than 0xffffffff sectors,
report 0xffffffff and print a message. READ CAPACITY(16) is needed to
get the actual size in this case.

ok tdeval@ (a while ago) marco@

Revision 1.62 / (download) - annotate - [select for diffs], Sat Jul 31 11:31:30 2004 UTC (19 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.61: +1 -19 lines
Diff to previous 1.61 (colored)

Remove scsi_change_def() and related command structure. Its only use
in the tree is #ifdef'd out and is fundamentally wrong anyway - it
tries to force *all* devices to SCSI-2. Also recent SCSI specs seem to
have marked the command as obsolete. Bonus - eliminates another
undocumented option (SCSI_2_DEF).

Found in a list of unused kernel functions posted to tech-kern@netbsd
by Krister Walfridsson in 2002.

ok marco@ tdeval@

Revision 1.25.4.11 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:08 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.25.4.10: +168 -220 lines
Diff to previous 1.25.4.10 (colored) to branchpoint 1.25 (colored) next main 1.26 (colored)

Merge with the trunk

Revision 1.61 / (download) - annotate - [select for diffs], Fri May 28 23:50:14 2004 UTC (20 years ago) by krw
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.60: +80 -86 lines
Diff to previous 1.60 (colored)

Clean up sense error logic and printing a bit, partly inspired by
NetBSD. Try to limit special handling of sense errors in sd and st to
a minimum.

ok marco@

Revision 1.60 / (download) - annotate - [select for diffs], Mon May 17 23:57:51 2004 UTC (20 years ago) by krw
Branch: MAIN
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (colored)

Elminate SCSIRET_* synonyms for EJUSTRETURN and ERESTART by using
EJUSTRETURN and ERESTART instead. Delete unused SCSIRET_RETRY define.
From NetBSD.

ok marco@

Revision 1.59 / (download) - annotate - [select for diffs], Thu May 13 01:56:09 2004 UTC (20 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.58: +50 -82 lines
Diff to previous 1.58 (colored)

More cleanup of SCSI sense printing. Better output, more readable code.

ok millert@ deraadt@.

Revision 1.58 / (download) - annotate - [select for diffs], Sun May 9 05:33:59 2004 UTC (20 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.57: +3 -51 lines
Diff to previous 1.57 (colored)

Eliminate verbosity parameter to scsi_print_sense and the associated
chunk of code. It was never executed unless you were debugging a
mvmex8k 'vs' device.

ok miod@ (mvmex8k bits) marco@ deraadt@

Revision 1.57 / (download) - annotate - [select for diffs], Sun May 9 04:01:59 2004 UTC (20 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored)

Add missing <cr>'s to various SC_DEBUG() calls, along with a few other
SC_DEBUG() spacing tweaks.

ok deraadt@

Revision 1.55.2.1 / (download) - annotate - [select for diffs], Fri Apr 30 22:07:37 2004 UTC (20 years, 1 month ago) by brad
Branch: OPENBSD_3_5
Changes since 1.55: +2 -27 lines
Diff to previous 1.55 (colored) next main 1.56 (colored)

MFC:
Fix by krw@

Restore siop's (and possibly others) ability to negotiate tags/wide/sync by
reverting to a single (short) INQUIRY command during probe. Compensate in siop
by trying PPR on all targets on SCSI-3 buses and falling back to WDTR/SDTR if
PPR rejected.

Problem found by mickey@. Tested on a wide variety of devices by Marco.

ok deraadt@ krw@

Revision 1.56 / (download) - annotate - [select for diffs], Sun Apr 18 00:49:29 2004 UTC (20 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.55: +2 -27 lines
Diff to previous 1.55 (colored)

Restore siop's (and possibly others) ability to negotiate tags/wide/sync by
reverting to a single (short) INQUIRY command during probe. Compensate in siop
by trying PPR on all targets on SCSI-3 buses and falling back to WDTR/SDTR if
PPR rejected.

Problem found by mickey@. Tested on a wide variety of devices by Marco.

ok marco@ deraadt@.

Revision 1.55 / (download) - annotate - [select for diffs], Sun Mar 14 22:46:47 2004 UTC (20 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE
Branch point for: OPENBSD_3_5
Changes since 1.54: +14 -1 lines
Diff to previous 1.54 (colored)

Last pre-3.5 tweak: restore bus scanning to full speed by not performing
double INQURY commands on LUNs that will be skipped anyway.

From Marco Peereboom.

ok deraadt@.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Feb 21 00:47:42 2004 UTC (20 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.53: +23 -8 lines
Diff to previous 1.53 (colored)

Eliminate the quirks SDEV_NOSTARTUNIT, UMASS_QUIRK_NO_START_STOP, and
UMASS_QUIRK_FORCE_SHORT_INQUIRY. Fixes a bunch of USB devices. Based
on work by Mycroft in NetBSD.

ok tdeval@ deraadt@.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Feb 21 00:34:27 2004 UTC (20 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.52: +27 -3 lines
Diff to previous 1.52 (colored)

Fix a race. scsi_done() can free a scsi_xfer, so relying on the values
of fields in the scsi_xfer after scsi_done() could have been called is
bad.

cdrecord can now safely burn cd's at high speeds.

Found by grange@, original diff by costa@, cleaned up by grange@ and
further polished by me following input from deraadt@.

ok grange@ costa@ deraadt@.

Revision 1.25.4.10 / (download) - annotate - [select for diffs], Thu Feb 19 11:01:30 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.25.4.9: +450 -108 lines
Diff to previous 1.25.4.9 (colored) to branchpoint 1.25 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.52 / (download) - annotate - [select for diffs], Tue Feb 17 23:50:46 2004 UTC (20 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

bzero scsi_xfer's as they come out of the pool to ensure there is no
leakage from one use to the next. There is no such thing as too much
paranoia.

ok deraadt@.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Feb 7 22:39:15 2004 UTC (20 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.50: +10 -3 lines
Diff to previous 1.50 (colored)

If scsi_probe_bus() is called with a particular lun, ensure that lun 0
information is available to make the new lun validation logic work.
i.e. don't find phantom luns just because the user asks about them.

Also ensure the lun value given does not exceed the maximum valid lun
for a bus, rather than assuming the maximum valid lun is 7.

ok tdeval@ deraadt@.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Jan 10 09:12:07 2004 UTC (20 years, 5 months ago) by grange
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

Print sense info only for valid key; from NetBSD.
ok tdeval@ krw@

Revision 1.49 / (download) - annotate - [select for diffs], Thu Jan 8 17:30:52 2004 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.48: +49 -40 lines
Diff to previous 1.48 (colored)

More sense message improvements from Marco Peereboom.

Clarify some logic and make type usage more consistant.

ok tdeval@.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jan 4 03:25:30 2004 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.47: +56 -58 lines
Diff to previous 1.47 (colored)

Rewrite scsi_decode_sense() to clean up code; eliminate many magic
numbers; fix passing a NULL to %s under some circumstances; fix the
bit index mask; etc.

No change in output.

ok deraadt@.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Jan 2 05:46:09 2004 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.46: +2 -3 lines
Diff to previous 1.46 (colored)

Treat all commands returning a sense data ASC of 0x29 as having
suffered a reset condition. Newer devices return a variety of ASCQ
values now (0x00 -> 0x07) rather than just 0x00. Such commands will
now be retried rather than returning EIO.

Started off when Marco Peereboom's SCSI analyzer saw some ASC/ASCQ
results of 0x29/0x02.

ok miod@.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Jan 2 05:30:32 2004 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.45: +350 -9 lines
Diff to previous 1.45 (colored)

Add in missing ASC/ASCQ descriptions for non-RAMDISK (i.e.
non-SCSITERSE) kernels. Brings the list up to SCSI-3.

From Marco Peereboom (marco at peereboom dot us).

ok deraadt@.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Dec 24 13:20:05 2003 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.44: +3 -2 lines
Diff to previous 1.44 (colored)

Make error message more informative by showing bad value that caused
the error to be emitted.

ok miod@.

Revision 1.44 / (download) - annotate - [select for diffs], Fri Sep 26 21:43:32 2003 UTC (20 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

Typos: defintion -> definition, proccess -> process

There are more occurences hiding in binutils, lynx and afs but I am too
lazy to report them upstream at the moment.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Jun 26 02:00:56 2003 UTC (20 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.42: +1 -7 lines
Diff to previous 1.42 (colored)

Simplify code a bit by eliminating a few early returns in the sense
key case statement and let the common code after the case do the right
thing.

Return EINVAL for sense key SKEY_ILLEGAL_REQUEST whether SCSI_SILENT
is set or not.

ok tdeval@ nate@

Revision 1.25.4.9 / (download) - annotate - [select for diffs], Sat Jun 7 11:07:44 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.25.4.8: +4 -1 lines
Diff to previous 1.25.4.8 (colored) to branchpoint 1.25 (colored)

Sync SMP branch to -current

Revision 1.31.4.4 / (download) - annotate - [select for diffs], Mon May 19 22:28:21 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.31.4.3: +38 -23 lines
Diff to previous 1.31.4.3 (colored) to branchpoint 1.31 (colored) next main 1.32 (colored)

sync

Revision 1.42 / (download) - annotate - [select for diffs], Fri May 16 19:54:05 2003 UTC (21 years, 1 month ago) by krw
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.41: +4 -1 lines
Diff to previous 1.41 (colored)

Provide most if not all the support required for the usb changes Nate
is trying to bring in.

1) Change name of SDEV_NOCDB6 to SDEV_ONLYBIG to align it with the
same quirk in NetBSD, and make it more clear what it is trying to do.
i.e. force the use of READ_BIG/WRITE_BIG commands, not suppress all
use of 6 byte CDB's.

2) Check SDEV_ONLYBIG in cd.c as well as sd.c. i.e. both places where
a choice is made to use the 6 or 10 byte versions of READ/WRITE.

3) Actually make use of the ADEV_NOTUR (No TEST UNIT READY) quirk to
suppress the emission of TEST UNIT READY commands.

4) Add some explanatory comments from NetBSD to scsiconf.h so that the
use of the quirks is made clear.

ok miod@ tdeval@ nate@

Revision 1.25.4.8 / (download) - annotate - [select for diffs], Tue May 13 19:36:57 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.25.4.7: +25 -16 lines
Diff to previous 1.25.4.7 (colored) to branchpoint 1.25 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.41 / (download) - annotate - [select for diffs], Sat May 3 02:20:32 2003 UTC (21 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.40: +25 -16 lines
Diff to previous 1.40 (colored)

sprintf -> snprintf.

Almost identical to a previously submitted diff from tedu@.

ok tedu@ tdeval@

Revision 1.25.4.7 / (download) - annotate - [select for diffs], Fri Mar 28 00:08:47 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.25.4.6: +19 -9 lines
Diff to previous 1.25.4.6 (colored) to branchpoint 1.25 (colored)

Sync the SMP branch with 3.3

Revision 1.40 / (download) - annotate - [select for diffs], Thu Feb 20 04:02:06 2003 UTC (21 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.39: +5 -6 lines
Diff to previous 1.39 (colored)

Eliminate unused parameter to scsi_free_xs().

ok deraadt@ tdeval@

Revision 1.39 / (download) - annotate - [select for diffs], Mon Dec 30 21:50:28 2002 UTC (21 years, 5 months ago) by grange
Branch: MAIN
Changes since 1.38: +4 -3 lines
Diff to previous 1.38 (colored)

Add new parameter to scsi_test_unit_ready(): retries number.
Use increased retries number and don't ignore SCSI_IGNORE_NOT_READY
when call scsi_test_unit_ready() for cd-rom, this makes system wait
if drive is loading media.
Tested by millert@ and fgsch@; some input and ok from krw@.
Problem reported by The lord of the CD-writers
Igor Grabin <violent@death.kiev.ua>.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Nov 30 18:46:56 2002 UTC (21 years, 6 months ago) by nate
Branch: MAIN
Changes since 1.37: +4 -1 lines
Diff to previous 1.37 (colored)

Actually implement the NODOORLOCK quirk

Revision 1.31.4.3 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:49 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.31.4.2: +2 -2 lines
Diff to previous 1.31.4.2 (colored) to branchpoint 1.31 (colored)

sync to -current

Revision 1.37 / (download) - annotate - [select for diffs], Wed Sep 4 23:11:10 2002 UTC (21 years, 9 months ago) by tdeval
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Write sentences.

Revision 1.31.4.2 / (download) - annotate - [select for diffs], Tue Jun 11 03:32:13 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.31.4.1: +15 -8 lines
Diff to previous 1.31.4.1 (colored) to branchpoint 1.31 (colored)

Sync UBC branch to -current

Revision 1.36 / (download) - annotate - [select for diffs], Wed May 22 01:04:06 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.35: +3 -1 lines
Diff to previous 1.35 (colored)

Eh, mark scsi_free_xs with splassert(IPL_BIO) too.
I know it's called the right way _now_, but that can change.

Revision 1.35 / (download) - annotate - [select for diffs], Wed May 22 00:20:58 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.34: +6 -1 lines
Diff to previous 1.34 (colored)

splassert(IPL_BIO) in scsi_done (its children have this assumption).
protect scsi_free_xs in scsi_scsi_cmd with splbio.
ok by deraadt@ and krw@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Apr 21 10:42:40 2002 UTC (22 years, 1 month ago) by art
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

Use PR_, not M_ flags to pool_get.

Revision 1.25.4.6 / (download) - annotate - [select for diffs], Thu Mar 28 14:52:01 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.25.4.5: +6 -6 lines
Diff to previous 1.25.4.5 (colored) to branchpoint 1.25 (colored)

Merge in -current from roughly a week ago

Revision 1.33 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:13 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.32: +7 -7 lines
Diff to previous 1.32 (colored)

First round of __P removal in sys

Revision 1.25.4.5 / (download) - annotate - [select for diffs], Wed Mar 6 02:17:13 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.25.4.4: +2 -2 lines
Diff to previous 1.25.4.4 (colored) to branchpoint 1.25 (colored)

Merge in trunk

Revision 1.31.4.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:48 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jan 23 00:39:48 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Pool deals fairly well with physical memory shortage, but it doesn't deal
well (not at all) with shortages of the vm_map where the pages are mapped
(usually kmem_map).

Try to deal with it:
 - group all information the backend allocator for a pool in a separate
   struct. The pool will only have a pointer to that struct.
 - change the pool_init API to reflect that.
 - link all pools allocating from the same allocator on a linked list.
 - Since an allocator is responsible to wait for physical memory it will
   only fail (waitok) when it runs out of its backing vm_map, carefully
   drain pools using the same allocator so that va space is freed.
   (see comments in code for caveats and details).
 - change pool_reclaim to return if it actually succeeded to free some
   memory, use that information to make draining easier and more efficient.
 - get rid of PR_URGENT, noone uses it.

Revision 1.25.4.4 / (download) - annotate - [select for diffs], Wed Oct 31 03:30:30 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.25.4.3: +42 -30 lines
Diff to previous 1.25.4.3 (colored) to branchpoint 1.25 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.31 / (download) - annotate - [select for diffs], Sat Aug 25 19:29:16 2001 UTC (22 years, 9 months ago) by fgsch
Branch: MAIN
CVS Tags: UBC_BASE, OPENBSD_3_0_BASE, OPENBSD_3_0
Branch point for: UBC
Changes since 1.30: +42 -26 lines
Diff to previous 1.30 (colored)

Change scsi_[free|get]_xs to use pool(9); art@ krw@ miod@ ok.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Aug 19 15:07:34 2001 UTC (22 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.29: +1 -5 lines
Diff to previous 1.29 (colored)

More old timeouts removal, mainly affected unused/unmaintained code.

Revision 1.25.4.3 / (download) - annotate - [select for diffs], Wed Jul 4 11:00:03 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.25.4.2: +21 -21 lines
Diff to previous 1.25.4.2 (colored) to branchpoint 1.25 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Jun 22 14:35:42 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.28: +21 -21 lines
Diff to previous 1.28 (colored)

KNF

Revision 1.25.4.2 / (download) - annotate - [select for diffs], Mon May 14 22:44:59 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.25.4.1: +6 -3 lines
Diff to previous 1.25.4.1 (colored) to branchpoint 1.25 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.28 / (download) - annotate - [select for diffs], Sun Feb 18 22:38:44 2001 UTC (23 years, 3 months ago) by fgsch
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

In scsi_print_sense, add 0x when printing the opcode to clarify it's
base 16; suggested by Quentin Barnes <qbarnes@urbana.css.mot.com>, ok
by costa@.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jan 22 19:10:13 2001 UTC (23 years, 4 months ago) by csapuntz
Branch: MAIN
Changes since 1.26: +5 -2 lines
Diff to previous 1.26 (colored)



Reduce # of retries on scsi_test_unit_ready to 5. This means that devices
that don't support it will only hang the system in boot-up for 50 seconds
as opposed to 500 seconds.

Return 0 from scsi_start if the device doesn't support START/STOP unit.

Revision 1.25.4.1 / (download) - annotate - [select for diffs], Thu Mar 2 07:04:47 2000 UTC (24 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

Sync with -current

Revision 1.26 / (download) - annotate - [select for diffs], Wed Mar 1 18:12:04 2000 UTC (24 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

Initialize xs->req_sense_length to 0.  This is not used by many
scsi drivers, other than dev/pci/ncr.c, but if req_sense_length is
not zero (either explicitly or through chance) the ncr driver will
fail during initialization.  This fixes the occasionaly ncr driver
init problems; thorpej@netbsd.org

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jul 25 07:09:19 1999 UTC (24 years, 10 months ago) by csapuntz
Branch: MAIN
CVS Tags: kame_19991208, SMP_BASE, OPENBSD_2_6_BASE, OPENBSD_2_6
Branch point for: SMP
Changes since 1.24: +29 -14 lines
Diff to previous 1.24 (colored)



Merge sd stuff from NetBSD-current. Helps with LS-120, ZIP

More SCSI logic from NetBSD-current

Some tape fixes. ATAPI tapes do not work yet for most operations.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Apr 20 19:04:34 1999 UTC (25 years, 1 month ago) by weingart
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Spelling error in comment.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Feb 7 00:14:25 1999 UTC (25 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

print INFO FIELD as unsigned

Revision 1.22 / (download) - annotate - [select for diffs], Sat Dec 19 01:32:26 1998 UTC (25 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +16 -5 lines
Diff to previous 1.21 (colored)

for sense code "Logical Unit Is in Process Of Becoming Ready", make
the sense code evaluation function return ERESTART with xs->error = XS_BUSY;
then higher up catch this case and drop into the scbusy tsleep code.
For exabyte 8500 units, this makes st opening reprobe repeatedly, rather
than fail with an EIO while the tape is being loaded.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Feb 14 08:56:50 1998 UTC (26 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

clear scsi_xfer's status byte before executing or re-executing the command.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Dec 31 01:22:10 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

return EROFS for write protect; is

Revision 1.19 / (download) - annotate - [select for diffs], Thu Sep 11 21:05:22 1997 UTC (26 years, 9 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.18: +11 -6 lines
Diff to previous 1.18 (colored)

Fix setting up of the LUN field of the CDB

Revision 1.18 / (download) - annotate - [select for diffs], Fri Sep 5 05:56:49 1997 UTC (26 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.17: +21 -66 lines
Diff to previous 1.17 (colored)

Add SCSITERSE option which omits the (large) ASC/ASCQ table.
Old scsi error printing code is now gone.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Sep 5 05:19:52 1997 UTC (26 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

fix compilation problem when SCSIVERBOSE=0

Revision 1.16 / (download) - annotate - [select for diffs], Fri Sep 5 04:04:06 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.15: +31 -38 lines
Diff to previous 1.15 (colored)

clean up sense info printing further

Revision 1.15 / (download) - annotate - [select for diffs], Wed Sep 3 17:23:20 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +209 -217 lines
Diff to previous 1.14 (colored)

simplify verbose error reporting

Revision 1.14 / (download) - annotate - [select for diffs], Tue Sep 2 17:15:35 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +2 -3 lines
Diff to previous 1.13 (colored)

delete extra \n

Revision 1.13 / (download) - annotate - [select for diffs], Fri Aug 22 04:43:25 1997 UTC (26 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.12: +454 -4 lines
Diff to previous 1.12 (colored)

Add more detailed SCSI error printing by Matthew Jacob.  Enabled by
default.  Use "option SCSIVERBOSE=0" to turn off (only added 8Kb to my kernel).
From the NetBSD commit message:
    Add in more detailed SCSI error printing, based off of final SCSI-2 spec.
    This will also print out things like progress indicator errors, and will
    also dump out additional sense bytes that haven't been decoded.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Jul 3 17:47:29 1997 UTC (26 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

print correct sense bytes

Revision 1.11 / (download) - annotate - [select for diffs], Mon Apr 14 04:09:07 1997 UTC (27 years, 2 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.10: +41 -51 lines
Diff to previous 1.10 (colored)

Merge in various pieces of current NetBSD scsi code, including but not limited
to:

* New changer driver.
* Better optical support.
* Different `done' semantics.
* New quirks for SCSI QIC tape driver, SCSI floppy drives.
* Better support for SCSI-I devices.

Everybody needs to test this.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Jun 16 03:07:19 1996 UTC (28 years ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

NetBSD PR#2535: add mode sense 5 and floppy support in our framework.

Revision 1.9 / (download) - annotate - [select for diffs], Mon May 6 11:33:35 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

from netbsd; SCSIDEBUG printf() fixes

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 2 13:17:52 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.7: +2 -3 lines
Diff to previous 1.7 (colored)

no sys/cpu.h, fix bugs in ch

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 21 22:30:50 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +27 -63 lines
Diff to previous 1.6 (colored)

partial sync with netbsd 960418, more to come

Revision 1.6 / (download) - annotate - [select for diffs], Thu Feb 29 13:12:22 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

Fix typo in comment

Revision 1.5 / (download) - annotate - [select for diffs], Tue Feb 20 01:46:33 1996 UTC (28 years, 3 months ago) by briggs
Branch: MAIN
Changes since 1.4: +23 -3 lines
Diff to previous 1.4 (colored)

Sync. w/ NetBSD: scsi prototypes.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 31 15:04:03 1996 UTC (28 years, 4 months ago) by briggs
Branch: MAIN
Changes since 1.3: +7 -4 lines
Diff to previous 1.3 (colored)

COMMAND ABORTED sense key is 0xb, not 0xa.  Also clean up diagnostic message.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jan 14 21:44:28 1996 UTC (28 years, 5 months ago) by briggs
Branch: MAIN
Changes since 1.2: +15 -2 lines
Diff to previous 1.2 (colored)

From NetBSD: (required for last change to scsi_base.c in case we get
	      "command aborted" status)
Handle cases like the following:
        - controller calls scsi_done() with error XS_TIMEOUT
        - scsi_done() calls sddone()
        - sddone() calls disk_unbusy()
        - scsi_done() calls controller to retry command (missing the
          call to disk_busy())
        - controller calls scsi_done()
        - scsi_done() calls sddone()
        - sddone() calls disk_busy(), which panics because of the imbalance.
Bug noticed by Leo Weppleman, who also suggested this fix; pass an additional
boolean argument ("complete") to the device's "done" routine, with a
value of `0' passed from the previous call to "done", and add an additional
call to "done" when the xfer resources are freed.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jan 14 21:34:43 1996 UTC (28 years, 5 months ago) by briggs
Branch: MAIN
Changes since 1.1: +6 -0 lines
Diff to previous 1.1 (colored)

Retry a command when we get a command aborted message for it.
This might be a transient error.  Do complain about it, though.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:53:24 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:53:24 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.