OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.336 / (download) - annotate - [select for diffs], Sat May 4 16:40:38 2024 UTC (5 weeks, 2 days ago) by kn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.335: +2 -2 lines
Diff to previous 1.335 (colored)

dma_free(9) just once in error case

buf is free'd and NULL, don't do it again to avoid a panic.

OK krw

Revision 1.335 / (download) - annotate - [select for diffs], Fri Nov 10 17:43:39 2023 UTC (7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.334: +3 -5 lines
Diff to previous 1.334 (colored)

scsi_xs_get() sets xs->flags via scsi_xs_io(). There is no need
to separately add another flag via SET(). Just pass the correct
combo to scsi_xs_get().

ok dlg@

Revision 1.334 / (download) - annotate - [select for diffs], Wed May 10 15:28:26 2023 UTC (13 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.333: +13 -7 lines
Diff to previous 1.333 (colored)

Add flag SDEV_UFI so umass_scsi_attach() can provide information
sufficient to get sdgetdisklabel() to correctly set d_type to
DTYPE_FLOPPY in the default disklabel.

installboot(8) in particular likes to know it is dealing with a
floppy.

ok miod@

Revision 1.333 / (download) - annotate - [select for diffs], Sun Oct 23 14:39:19 2022 UTC (19 months, 2 weeks ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.332: +1 -2 lines
Diff to previous 1.332 (colored)

bzero(disklabel) or memset(disklabel,0) should be enough for
anyone. No need to also set d_flags to 0.

Revision 1.332 / (download) - annotate - [select for diffs], Thu Sep 1 13:45:27 2022 UTC (21 months, 1 week ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.331: +1 -5 lines
Diff to previous 1.331 (colored)

Stop setting d_bbsize and d_sbsize. Nobody has paid
any attention for some time.

ok otto@ as part of larger diff

Revision 1.331 / (download) - annotate - [select for diffs], Sun Feb 27 02:27:55 2022 UTC (2 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.330: +5 -5 lines
Diff to previous 1.330 (colored)

SC_DEBUG() requires an initialized scsi_link. Shuffle
code to make it so.

Pointed out by clang when prodded with SCSIDEBUG.

Revision 1.330 / (download) - annotate - [select for diffs], Sun Oct 24 16:57:30 2021 UTC (2 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.329: +2 -2 lines
Diff to previous 1.329 (colored)

Constify struct cfattach.

ok visa@ a long time ago, ok krw@

Revision 1.329 / (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_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.328: +7 -7 lines
Diff to previous 1.328 (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.328 / (download) - annotate - [select for diffs], Mon Sep 14 18:44:54 2020 UTC (3 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.327: +9 -14 lines
Diff to previous 1.327 (colored)

No need to check for SDEV_DYING as the first thing in both branches of an
if/else. Just do it once before the if.

Move the SC_DEBUG() documenting entry into sdopen() to before the various error
bailouts.

Revision 1.327 / (download) - annotate - [select for diffs], Sun Sep 13 14:26:56 2020 UTC (3 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.326: +8 -7 lines
Diff to previous 1.326 (colored)

Always use READ(16)/WRITE(16) commands for disks large enough to require
READ(16)/WRITE(16) to access the last sectors

Fixes (at least) large 512E (a.k.a. emulated 512-byte sector) devices plugged
into overly helpful USB <-> ATA/ATAPI bridges. Which can tell you they are using
512-byte sector addresses but spontaneously/silently interpret
READ(10)/WRITE(10) commands as using 4K sector addresses/sizes.

Diagnosed and fix tested with James Cook. Thanks!

Revision 1.326 / (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.325: +3 -3 lines
Diff to previous 1.325 (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.325 / (download) - annotate - [select for diffs], Sat Aug 29 18:20:12 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.324: +2 -2 lines
Diff to previous 1.324 (colored)

Use ISSET() to check b_flags for B_READ.

Revision 1.324 / (download) - annotate - [select for diffs], Sat Aug 29 17:10:06 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.323: +9 -5 lines
Diff to previous 1.323 (colored)

Missing u_int -> u_int32_t chunks from previous.

Revision 1.323 / (download) - annotate - [select for diffs], Sat Aug 29 16:07:19 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.322: +7 -6 lines
Diff to previous 1.322 (colored)

Use u_int32_t for nsecs, making it crystal clear that the values
are expected to fit into a 4-byte field.

Revision 1.322 / (download) - annotate - [select for diffs], Sat Aug 29 02:03:31 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.321: +26 -26 lines
Diff to previous 1.321 (colored)

Have [cd|sd]_cmd_rw[6|10|12|16] return the length of the created command and
have the caller assign it to xs->cmdlen. Pass in xs->cmd instead of xs. A
slightly cleaner API that provides the potential of detecting and reacting to a
failure to create the desired command.

Revision 1.321 / (download) - annotate - [select for diffs], Fri Aug 28 21:01:54 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.320: +10 -17 lines
Diff to previous 1.320 (colored)

Shuffle [cd|sd]start code into closer alignment. Move the initialization of the
xs fields to a more convenient location, shrinking upcoming diffs. Nuke some
Captain Obvious comments.

Revision 1.320 / (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.319: +4 -13 lines
Diff to previous 1.319 (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.319 / (download) - annotate - [select for diffs], Wed Aug 26 13:57:20 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.318: +2 -6 lines
Diff to previous 1.318 (colored)

Remove needless uses of SDEV_ONLYBIG. It was always set when SDEV_UMASS was set,
and was always checked in concert with SDEV_ATAPI. Just rely on SDEV_ATAPI and
SDEV_UMASS in all but the one place sd(4) where SDEV_ONLYBIG is set
independently of SDEV_ATAPI/_UMASS.

ok jmatthew@

Revision 1.318 / (download) - annotate - [select for diffs], Sat Aug 22 15:07:11 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.317: +1 -5 lines
Diff to previous 1.317 (colored)

The last timeout_add(sc_timeout) died in the great XS_NO_CCB purge of 2017. Nuke
pointless timeout_set(sc_timoeut) and timeout_del(sc_timeout) calls and the
sc_timeout fields themselves.

Revision 1.317 / (download) - annotate - [select for diffs], Thu Aug 20 01:47:45 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.316: +37 -38 lines
Diff to previous 1.316 (colored)

Revert DYING. At least some USB memory sticks get very upset.

Revision 1.316 / (download) - annotate - [select for diffs], Wed Aug 19 14:53:39 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.315: +38 -37 lines
Diff to previous 1.315 (colored)

Nuke SDF_DYING, CDF_DYING and ST_DYING flags. Use the scsi_link flag
SDEV_S_DYING instead. Makes it clear that the scsi_link and the [cd|sd|st]
device  always agree on their state.

Revision 1.315 / (download) - annotate - [select for diffs], Sat Aug 15 17:50:45 2020 UTC (3 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.314: +2 -4 lines
Diff to previous 1.314 (colored)

The last SET()s of CDF_WAITING, SDF_WAITING, and ST_WAITING died in the great
XS_NO_CCB purge of 2017.

Nuke pointless ISSET()/CLR() checks and the #define's.

Revision 1.314 / (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.313: +2 -1 lines
Diff to previous 1.313 (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.313 / (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.312: +3 -3 lines
Diff to previous 1.312 (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.312 / (download) - annotate - [select for diffs], Tue Jun 30 18:43:37 2020 UTC (3 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.311: +4 -4 lines
Diff to previous 1.311 (colored)

Nuke unneeded 'sa_inqbuf' member of struct scsi_attach_args. It always
points to the inquiry data contained in the struct scsi_link pointed
to by the other member, sa_sc_link.

Revision 1.311 / (download) - annotate - [select for diffs], Tue Mar 10 02:01:21 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.310: +2 -2 lines
Diff to previous 1.310 (colored)

Access 4-byte address field with _4btol() not _8btol(), fixing
detecton of a 0 value.

CID 1488899

Revision 1.310 / (download) - annotate - [select for diffs], Thu Feb 20 16:26:02 2020 UTC (4 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.309: +3 -3 lines
Diff to previous 1.309 (colored)

Relax the grip the dead hand of QBUS (a.k.a. MAXPHYS) has on the
throat of physio().

Allows individual devices to eventually be modified to support larger
physio() (a.k.a. 'raw') i/o's if they prove capable of them.

No immediate functional change.

Tested for many weeks by and ok robert@.

Revision 1.309 / (download) - annotate - [select for diffs], Wed Feb 5 16:29:30 2020 UTC (4 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.308: +5 -4 lines
Diff to previous 1.308 (colored)

Nuke unnecessary abstraction 'scsi_minphys()' which just calls
'minphys()'. Just use & check for NULL instead, since 'minphys()' is
always called on the code path ([cd|sd|st]minphys) that calls
physio().

Revision 1.308 / (download) - annotate - [select for diffs], Sun Jan 26 00:53:31 2020 UTC (4 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.307: +3 -3 lines
Diff to previous 1.307 (colored)

Shuffle some names around to make reading the code less headache
inducing. Rename scsi_adapter member 'scsi_minphys' to 'dev_minphys'
to reflect what it is supposed to do. Use consistent naming convention
(<dev>_minphys) for the actual device functions.

No functional change.

Revision 1.307 / (download) - annotate - [select for diffs], Sat Jan 25 21:40:35 2020 UTC (4 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.306: +3 -1 lines
Diff to previous 1.306 (colored)

Ensure scsi_minphys() is always called on the physio() path.

Will allow simplification of individual driver *minphys() functions.

ok jmatthew@ as part of larger diff

Revision 1.306 / (download) - annotate - [select for diffs], Sun Dec 8 16:38:45 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.305: +173 -168 lines
Diff to previous 1.305 (colored)

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

Revision 1.305 / (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.304: +41 -33 lines
Diff to previous 1.304 (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.304 / (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.303: +6 -9 lines
Diff to previous 1.303 (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.303 / (download) - annotate - [select for diffs], Fri Nov 29 15:17:28 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.302: +5 -7 lines
Diff to previous 1.302 (colored)

DISK_PGCODE() #define includes a check for NULL, so no need to
do the same check before invoking it.

Revision 1.302 / (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.301: +4 -4 lines
Diff to previous 1.301 (colored)

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

Sets up some simplifications.

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

Reinitialize 'err' to ensure we are not checking a stale value.

Discovered by and ok tim@

Revision 1.300 / (download) - annotate - [select for diffs], Mon Nov 25 17:02:57 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.299: +21 -67 lines
Diff to previous 1.299 (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.299 / (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.298: +2 -2 lines
Diff to previous 1.298 (colored)

Consistently use ISSET() to check for set flags.

Revision 1.298 / (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.297: +3 -3 lines
Diff to previous 1.297 (colored)

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

Revision 1.297 / (download) - annotate - [select for diffs], Sat Nov 9 14:36:30 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.296: +67 -46 lines
Diff to previous 1.296 (colored)

Shuffle sd_get_parms() logic to ensure we only update sc->params with
a complete set of validated (possibly fictitious) data.

Add SCSIDEBUG output showing mismatch between disksize and cyls *
heads * sectors.

Revision 1.296 / (download) - annotate - [select for diffs], Sat Nov 9 12:14:16 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.295: +3 -3 lines
Diff to previous 1.295 (colored)

Fix SCSIDEBUG display of VPD inquiry data.

Remove extraneous whitespace in SCSIDEBUG read capacity display.

Revision 1.295 / (download) - annotate - [select for diffs], Sat Nov 9 10:21:52 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.294: +2 -2 lines
Diff to previous 1.294 (colored)

Fix SCSIDEBUG compile. Missed a %lx -> %x.

Revision 1.294 / (download) - annotate - [select for diffs], Fri Nov 8 16:13:28 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.293: +2 -2 lines
Diff to previous 1.293 (colored)

The u_long fields in struct disk_parms (secsize, heads, cyls, sectors)
are always initializd to u_int32_t values. And are then copied into u_int32_t
fields in the disklabel. Switch them to u_int32_t.

Cluebats and ok deraadt@ jca@

Revision 1.293 / (download) - annotate - [select for diffs], Thu Nov 7 17:45:22 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.292: +5 -5 lines
Diff to previous 1.292 (colored)

sd_size() is a wrapper around sd_read_cap_10() and sd_read_cap_16() so
rename it sd_read_cap().

Reduces possible confusion with the unrelated sdsize().

Revision 1.292 / (download) - annotate - [select for diffs], Wed Oct 23 13:50:49 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.291: +17 -32 lines
Diff to previous 1.291 (colored)

There used to be three possible return values from sd_get_parms(), but
for some years it's been a succeed/fail function. So switch to using
0/-1 as return values and nuke SDGP_RESULT_OFFLINE and SDGP_RESULT_OK
#defines. Shake out logic inside sd_get_parms() to take account of the
change, making it clearer. Removes a possible panic().

Revision 1.291 / (download) - annotate - [select for diffs], Tue Oct 22 15:46:40 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.290: +8 -8 lines
Diff to previous 1.290 (colored)

No need to always pass the same thing to sd_get_parms(). One less
parameter to worry about.

Revision 1.290 / (download) - annotate - [select for diffs], Sat Oct 19 17:30:43 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.289: +17 -17 lines
Diff to previous 1.289 (colored)

Use !ISSET() for unset flag checks.

Revision 1.289 / (download) - annotate - [select for diffs], Sat Oct 19 16:01:41 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.288: +54 -54 lines
Diff to previous 1.288 (colored)

Use ISSET() for the easier flag checks.

Revision 1.288 / (download) - annotate - [select for diffs], Sat Oct 19 14:13:18 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.287: +2 -2 lines
Diff to previous 1.287 (colored)

Fix typo in previous, link->flag is link->flags.

Revision 1.287 / (download) - annotate - [select for diffs], Sat Oct 19 14:01:31 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.286: +6 -6 lines
Diff to previous 1.286 (colored)

Resolve mix of '&=' and CLR() usage in favour of CLR().

Revision 1.286 / (download) - annotate - [select for diffs], Sat Oct 19 13:49:17 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.285: +12 -12 lines
Diff to previous 1.285 (colored)

Resolve mix of '|=' and SET() usage in favour of SET().

Revision 1.285 / (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.284: +2 -4 lines
Diff to previous 1.284 (colored)

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

Revision 1.284 / (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.283: +2 -2 lines
Diff to previous 1.283 (colored)

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

Revision 1.283 / (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.282: +6 -6 lines
Diff to previous 1.282 (colored)

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

Revision 1.282 / (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.281: +11 -1 lines
Diff to previous 1.281 (colored)

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

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

With the recent fixes to SCSI version detection we reproduced a
problem encountered by FreeBSD and Linux when they started to try
issuing READ CAPACITY 16 commands to 'newer' devices. i.e. some USB
devices return bad data instead of an error when they can't handle the
command.

Reproduce the FreeBSD solution (r233746 by mav@) by issuing READ
CAPACITY 16 commands only to devices that claim to be REALLY new
(a.k.a. newer than SPC-2, a.k.a. newer than SCSI-3), or which indicate
they really are bigger than can be reported via READ CAPACITY 10.

Should fix some USB devices claiming to have 71,776,119,061,217,281 or
33,601,071,049,867,265 sectors.

Revision 1.280 / (download) - annotate - [select for diffs], Sat Sep 14 13:30:48 2019 UTC (4 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.279: +2 -2 lines
Diff to previous 1.279 (colored)

Typo in comment. scsi_size() is actually sd_size().

Revision 1.279 / (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.278: +12 -3 lines
Diff to previous 1.278 (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.278 / (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.277: +3 -4 lines
Diff to previous 1.277 (colored)

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

Revision 1.277 / (download) - annotate - [select for diffs], Sun Jan 20 20:28:37 2019 UTC (5 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.276: +7 -7 lines
Diff to previous 1.276 (colored)

No leading space(s) before labels.

Prodded by guenther@

Revision 1.276 / (download) - annotate - [select for diffs], Sun Jan 20 03:28:19 2019 UTC (5 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.275: +7 -4 lines
Diff to previous 1.275 (colored)

When retiring a SCSI request, sometimes the buf's b_error value is
forcibly set to a value. Make sure that in all those cases the B_ERROR
flag is cleared (if b_error is being set to 0) or set (if b_error is
being set to non-zero) appropriately.

ok dlg@ jmatthew@

Revision 1.275 / (download) - annotate - [select for diffs], Sat Dec 30 23:08:29 2017 UTC (6 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.274: +2 -2 lines
Diff to previous 1.274 (colored)

Don't pull in <sys/file.h> just to get fcntl.h

ok deraadt@ krw@

Revision 1.274 / (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_2_BASE, OPENBSD_6_2
Changes since 1.273: +1 -2 lines
Diff to previous 1.273 (colored)

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

Revision 1.273 / (download) - annotate - [select for diffs], Mon May 29 14:08:49 2017 UTC (7 years ago) by sf
Branch: MAIN
Changes since 1.272: +5 -4 lines
Diff to previous 1.272 (colored)

sd: flush cache when closing writable FD

Don't skip the cache flush until the last opening of the device is
closed. Otherwise, when umounting a writable partition while a different
partition is still mounted read-only, the necessary disk flush may be
delayed for a very long time.

ok krw@ deraadt@

Revision 1.272 / (download) - annotate - [select for diffs], Mon May 29 14:05:31 2017 UTC (7 years ago) by sf
Branch: MAIN
Changes since 1.271: +25 -11 lines
Diff to previous 1.271 (colored)

Add an ioctl to tell storage devices to flush their internal caches

Currently implemented for wd and sd.
Initially ported from netbsd by pedro@

ok deraadt@

Revision 1.271 / (download) - annotate - [select for diffs], Mon May 29 07:47:13 2017 UTC (7 years ago) by krw
Branch: MAIN
Changes since 1.270: +1 -11 lines
Diff to previous 1.270 (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.270 / (download) - annotate - [select for diffs], Thu May 4 22:47:27 2017 UTC (7 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.269: +3 -3 lines
Diff to previous 1.269 (colored)

Also pass the blk offset to disk_unbusy(), so that it can pass it to
the random subsystem as entropy.  This value is pretty much unknown,
and anyways our entropy input ring does not saturate from knowns.
ok mikeb djm

Revision 1.269 / (download) - annotate - [select for diffs], Sat Mar 19 15:37:33 2016 UTC (8 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.268: +5 -4 lines
Diff to previous 1.268 (colored)

Do not run into sdgetdisklabel() when scsi disk is dying.  Add
special error handling in sdopen() as temporary hack.
OK krw@

Revision 1.268 / (download) - annotate - [select for diffs], Fri Mar 18 18:12:37 2016 UTC (8 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.267: +51 -1 lines
Diff to previous 1.267 (colored)

After sleeping and before accessing sc_link, check that scsi disk
is not dying.
OK krw@

Revision 1.267 / (download) - annotate - [select for diffs], Thu Mar 17 18:05:39 2016 UTC (8 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.266: +17 -2 lines
Diff to previous 1.266 (colored)

Do not access the scsi link structure in sdclose() if the disk
device is already dying.  Delete the sc_timeout when setting the
SDF_DYING flag as the timeout delete in sdclose() may not be reached.
OK krw@

Revision 1.266 / (download) - annotate - [select for diffs], Wed Mar 16 15:01:55 2016 UTC (8 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.265: +15 -5 lines
Diff to previous 1.265 (colored)

Add SDF_DYING checks to more functions in scsi disk, to prevent an
use after free of the scsi link structure during detach.
OK krw@

Revision 1.265 / (download) - annotate - [select for diffs], Sat Mar 12 15:16:04 2016 UTC (8 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.264: +104 -104 lines
Diff to previous 1.264 (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.264 / (download) - annotate - [select for diffs], Sat Mar 12 00:48:44 2016 UTC (8 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.263: +34 -2 lines
Diff to previous 1.263 (colored)

When unplugging an USB umass stick, the kernel could panic because
of a use after free.  In sdopen() the scsi link pointer is taken
from the scsi disk struct.  While the scsi disk memory is refcounted
by autoconf, the scsi link may be detached and freed during sleep.
The solution is to check wether the disk is dying after every sleep.
The SDF_DYING flag is set before scsi bus and scsi disk are detached,
so without this flag the link must be valid.
input and OK krw@

Revision 1.263 / (download) - annotate - [select for diffs], Wed Feb 3 21:42:12 2016 UTC (8 years, 4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.262: +7 -3 lines
Diff to previous 1.262 (colored)

Do not access the scsi link of the disk at the beginning of sdopen()
and sdminphys() if the scsi disk is dying.  The memory of the link
may have been freed already.
OK krw@

Revision 1.262 / (download) - annotate - [select for diffs], Wed Feb 3 15:16:33 2016 UTC (8 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.261: +81 -61 lines
Diff to previous 1.261 (colored)

When accessing the scsi link of a scsi disk, use a variable "sc_link"
everywhere.  This is the first step to fix a use after free of the
sc_link when the disk detaches.  If a function gets a scsi transfer,
the scsi link is always valid.  Call this variable "link" consistently.
OK krw@

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

More damned eye searing whitespace.

Revision 1.260 / (download) - annotate - [select for diffs], Thu Apr 2 14:24:02 2015 UTC (9 years, 2 months ago) by jasper
Branch: MAIN
Changes since 1.259: +2 -2 lines
Diff to previous 1.259 (colored)

use correct capitalization of 'BlackBerry'

"sure" deraadt@

Revision 1.259 / (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.258: +2 -2 lines
Diff to previous 1.258 (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.258 / (download) - annotate - [select for diffs], Mon Dec 15 02:11:57 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.257: +4 -4 lines
Diff to previous 1.257 (colored)

convert bcopy to memcpy. ok dlg krw

Revision 1.257 / (download) - annotate - [select for diffs], Thu Sep 18 18:47:29 2014 UTC (9 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.256: +6 -2 lines
Diff to previous 1.256 (colored)

Some disks, such as the Seagate Cheetah 73LP FC with Sun firmware
(ST373405FSUN72G) respond to a START STOP UNIT command that spins down the
disk with a "Logical Unit Not Ready, Initialization Command Required".
Besides causing some dmesg spam, our sd(4) driver responds to such a response
by spinning the disk back up.  Prevent this from happening by respecting
the SCSI_IGNORE_NOT_READY flag and using that flag when spinning down the
disk.

ok miod@

Revision 1.256 / (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.255: +1 -2 lines
Diff to previous 1.255 (colored)

remove uneeded proc.h includes
ok mpi@ kspillner@

Revision 1.255 / (download) - annotate - [select for diffs], Sat Jul 12 18:50:25 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.254: +2 -2 lines
Diff to previous 1.254 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.254 / (download) - annotate - [select for diffs], Thu Jul 10 19:13:55 2014 UTC (9 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.253: +3 -34 lines
Diff to previous 1.253 (colored)

Now that sd(4) drives under softraid0 have their cache flushed when
DVACT_POWERDOWN is propagated in this subtree, there is no need for
this shutdown hook anymore. RIP.

ok kettenis@

Revision 1.253 / (download) - annotate - [select for diffs], Wed Feb 19 10:15:35 2014 UTC (10 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.252: +6 -1 lines
Diff to previous 1.252 (colored)

If a disk returns a size of 0, treat it as an error to let the
driver re-probe for its capacity.

Allow to fully recognized Lexar JumpDrive S33 USB 3.0 sticks.

ok krw@, dlg@

Revision 1.252 / (download) - annotate - [select for diffs], Thu Feb 13 05:51:06 2014 UTC (10 years, 3 months ago) by halex
Branch: MAIN
Changes since 1.251: +4 -1 lines
Diff to previous 1.251 (colored)

if an attached sd(4) is readonly, make sure it's noticable in the
dmesg, or write operations just fail with EACCES for no obvious reason

ok krw@ tedu@

Revision 1.251 / (download) - annotate - [select for diffs], Fri Nov 1 17:36:19 2013 UTC (10 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.250: +4 -3 lines
Diff to previous 1.250 (colored)

Sprinkle (long long) casts where %lld is being used to print daddr_t
variables. Some random whitespace/knf repairs encountered on the way.

ok miod@ on inspection, feedback & more suggestions from millert@

Revision 1.250 / (download) - annotate - [select for diffs], Thu Oct 3 14:07:42 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.249: +4 -4 lines
Diff to previous 1.249 (colored)

Print daddr_t variables with %lld, u_int64_t variables with %llu.

Revision 1.249 / (download) - annotate - [select for diffs], Wed Oct 2 18:59:04 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.248: +10 -10 lines
Diff to previous 1.248 (colored)

Use u_int64_t instead of daddr_t parameters to sd_cmd_rw*() functions.
Ditto disksize field of sd_softc and a couple of local calculation
variables.

scsi/* now daddr_t clean except where they really are 512-byte
blocks.

Revision 1.248 / (download) - annotate - [select for diffs], Thu Sep 19 19:26:16 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.247: +17 -9 lines
Diff to previous 1.247 (colored)

Tweak types to keep daddr_t address and sector address separate.
Prefer DL_ macros over handrolling. Fix the loop to allow for bigger
(highly unlikely) bunches of bits to be broken up into rw_10 sized
(<= UINT32_MAX sectors) chunks. Add check to make sure i/o request
starts at a sector address.

Revision 1.247 / (download) - annotate - [select for diffs], Sun Sep 15 14:35:50 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.246: +9 -6 lines
Diff to previous 1.246 (colored)

Use DL_SECTOBLK() and DL_BLKTOSEC() to clarify code and remove
repeated handrolling of same code. Use daddr_t variable to
calculate daddr_t return values, and u_int64_t variables to
calculate disk sector values.

No functional change.

Revision 1.246 / (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.245: +14 -14 lines
Diff to previous 1.245 (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.245 / (download) - annotate - [select for diffs], Wed Dec 19 19:52:11 2012 UTC (11 years, 5 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.244: +34 -1 lines
Diff to previous 1.244 (colored)

Temporarily bring back the shutdown hook, but only use it to flush the disk
cache.  This shouldn't interfere with the hibernate code and makes sure we
still flush the cache for controller that don't pass DVACT_POWRDOWN down to
their children yet.  This will be removed when the autoconf subsystem gets
changed to do that for us by default.

ok deraadt@

Revision 1.244 / (download) - annotate - [select for diffs], Mon Oct 15 16:29:07 2012 UTC (11 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.243: +7 -1 lines
Diff to previous 1.243 (colored)

In DVACT_SUSPEND, do a flush of the disk. We do this in DVACT_POWERDOWN
as well, but it might be wise to flush before a hibernate operation, in
case hiberate looks at blocks which are in the buffer cache.
ok krw

Revision 1.243 / (download) - annotate - [select for diffs], Mon Oct 8 21:47:51 2012 UTC (11 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.242: +6 -46 lines
Diff to previous 1.242 (colored)

Revamp the sequences for suspend/hibernate -> resume so that the code
paths are reflexive.  It is now possible to fail part-way through a
suspend sequence, and recover along the resume code path.
Split DVACT_SUSPEND by adding a new DVACT_POWERDOWN method is used
after hibernate (and suspend too) to finish the job.  Some drivers
must be converted at the same time to use this instead of shutdown hooks
(the others will follow at a later time)
ok kettenis mlarkin

Revision 1.242 / (download) - annotate - [select for diffs], Mon Jul 9 12:58:01 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.241: +2 -2 lines
Diff to previous 1.241 (colored)

Revert previous.

The standards gpds are jealous gods. kettenis@ and beck@ have shown
EROFS is the wrong thing to return. So revert to EACCES until a
better error code is decided on.

Revision 1.241 / (download) - annotate - [select for diffs], Sun Jul 8 14:30:59 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.240: +2 -2 lines
Diff to previous 1.240 (colored)

Return EROFS when a read-write mount of a read-only sd(4) device
is attempted. This is instead of the current EACCES and is intended
to result in better error messages from mount(8).

Tweak default EROFS error text to mention fsck'ing in mount_ext2fs
and mount_msdos since they both have fsck's like ffs.

ok deraadt@ aja@ ian@ phessler@

Revision 1.240 / (download) - annotate - [select for diffs], Sun Jun 10 21:29:04 2012 UTC (12 years ago) by krw
Branch: MAIN
Changes since 1.239: +6 -3 lines
Diff to previous 1.239 (colored)

Do NOT make all check condition results report EIO. Only use EIO
when b_error has not already been set to something more informative,
e.g. EROFS.

DO check the result of ffs_sbupdate() and error out of a mount()
call when ffs_sbupdate() reports EROFS while attempting a rw mount.

Letting RW mounts proceed regardless of EROFS led to crashes and
usb problems for Oliver Seufer while using the RW/RO switches on
some usb devices. Fix developed using devices kindly supplied by
Oliver & Co.

ok miod@

Revision 1.239 / (download) - annotate - [select for diffs], Mon Oct 10 20:39:20 2011 UTC (12 years, 8 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.238: +5 -1 lines
Diff to previous 1.238 (colored)

Put the drive in standby mode when we're powering down the machine.

tested by dcoppa@, ok krw@, miod@

Revision 1.238 / (download) - annotate - [select for diffs], Mon Jul 18 00:13:16 2011 UTC (12 years, 10 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.237: +3 -3 lines
Diff to previous 1.237 (colored)

Fix an off-by-1 error and a 32-bit integer arithmetic overflow bug
that caused large disks to appear offline.

Discovered and tested by mlarkin@; ok dlg@

Revision 1.237 / (download) - annotate - [select for diffs], Tue Jul 12 04:25:49 2011 UTC (12 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.236: +3 -3 lines
Diff to previous 1.236 (colored)

fix some notyet code

Revision 1.236 / (download) - annotate - [select for diffs], Tue Jul 12 00:41:43 2011 UTC (12 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.235: +14 -9 lines
Diff to previous 1.235 (colored)

now that we know if a disk is thin provisioned (or an ssd), we can choose
to use the fifo bufq sorting on such disks. there's no point ordering io
if the real blocks arent in the order we think they are.

ok krw@ tedu@ miod@

Revision 1.235 / (download) - annotate - [select for diffs], Mon Jul 11 06:26:09 2011 UTC (12 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.234: +144 -3 lines
Diff to previous 1.234 (colored)

ask the disk about unmap (read trim) parameters. check if we have the
required vpd pages, then read them for the values we want.

we look for the max blocks per unmap, the max descriptors per unmap, and
which scsi command to use for unmapping (unmap will be preferred).

two fixes and ok matthew@

Revision 1.234 / (download) - annotate - [select for diffs], Mon Jul 11 00:22:15 2011 UTC (12 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.233: +120 -7 lines
Diff to previous 1.233 (colored)

disks report trim^Wunmap^Wif theyre thin provisioned via a bit in
the read cap 16 data. move the read cap code into sd.c so i can get
at this bit without much contorting, and to make it trivial to get
at the other interesting things in there later.

thin disks report themselves as "thin" in dmesg along with their
size now.

ok matthew@

Revision 1.233 / (download) - annotate - [select for diffs], Wed Jul 6 04:49:36 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.232: +5 -23 lines
Diff to previous 1.232 (colored)

Eliminate redundant buf validation checks in xxstrategy() methods now
that they're implemented consistently in bounds_check_with_label().

Also, per krw's request, change bounds_check_with_label() to return 0
if the checks succeed, and change the drivers to test == -1 instead of
<= 0.  (Man page update to follow; intentionally omitting
arch/vax/mba/hp.c from this commit because it doesn't even build
currently and miod@ promises to kill it soon.)

ok krw@

Revision 1.232 / (download) - annotate - [select for diffs], Sun Jul 3 15:47:18 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.231: +1 -3 lines
Diff to previous 1.231 (colored)

Remove config_activate() and DVACT_ACTIVATE.  PCMCIA's the only thing
that's ever used it, and it's long since been changed to use
DVACT_{QUIESCE,SUSPEND,RESUME} instead.

ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it
up a few weeks ago

Revision 1.231 / (download) - annotate - [select for diffs], Thu Jun 30 16:28:05 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.230: +5 -36 lines
Diff to previous 1.230 (colored)

Refactor some common open/close/detach disk driver code into
subr_disk.c.  For now just the MI disk drivers.

ok deraadt@, krw@; jsing@ liked the approach too

Revision 1.230 / (download) - annotate - [select for diffs], Sun Jun 19 04:55:34 2011 UTC (12 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.229: +2 -6 lines
Diff to previous 1.229 (colored)

Use disk_lock_nointr() in the xxclose() routines so that they cannot
be interrupted.
ok matthew

Revision 1.229 / (download) - annotate - [select for diffs], Sun Jun 19 04:35:06 2011 UTC (12 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.228: +7 -9 lines
Diff to previous 1.228 (colored)

Use disk_lock/disk_unlock directly and in the same way in these drivers,
rather than using various wrappings.  Convert vnd to using the sc_dk
rwlock instead of using one of its own.
ok matthew

Revision 1.228 / (download) - annotate - [select for diffs], Sun Jun 5 18:40:33 2011 UTC (13 years ago) by matthew
Branch: MAIN
Changes since 1.227: +1 -15 lines
Diff to previous 1.227 (colored)

Drop kernel support for the useless DIOCWLABEL ioctl and prune a lot
of silly flag twiddling code in various disk drivers.

ok deraadt@, miod@

N.B., users will need a -current disklabel(8) to be able to write new
disklabels to disk now.

Revision 1.227 / (download) - annotate - [select for diffs], Fri Jun 3 21:14:11 2011 UTC (13 years ago) by matthew
Branch: MAIN
Changes since 1.226: +2 -3 lines
Diff to previous 1.226 (colored)

Get rid of the wlabel argument to bounds_check_with_label().  It's
never done anything in OpenBSD and just clutters disk drivers with
silly flag handling.

More cleanup to follow.

ok deraadt@, millert@; no objections krw@

Revision 1.226 / (download) - annotate - [select for diffs], Tue May 31 17:35:35 2011 UTC (13 years ago) by matthew
Branch: MAIN
Changes since 1.225: +2 -2 lines
Diff to previous 1.225 (colored)

Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)
to return EBUSY if the user tries to modify an open partition's offset
or size.  Only sadness can result if a user tries this, and rejecting
it prevents a race between sdstart() and sdstrategy().

Curiously, there was already code in the kernel and in disklabel(8) to
detect/handle this, but it was effectively disabled because the disk
drivers always used something like "/* sc->sc_dk.dk_openmask */ 0",
and this commented out code has existed since even r1.1 in NetBSD.

I had no problems building a release and messing around with
disklabel(8) for a bit with this diff.  Canarying the more common MI
disk drivers until we gain confidence that there aren't any
regressions, then we can switch the remaining drivers.

"I am surprised you got me convinced that this stuff is safe" deraadt@
ok krw@

Revision 1.225 / (download) - annotate - [select for diffs], Fri Apr 8 10:37:39 2011 UTC (13 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.224: +3 -4 lines
Diff to previous 1.224 (colored)

Since we don't print "drive offline" anymore, there is no need to
print the "sdN:" at the start of the now empty line. Noted by
miod@.

Revision 1.224 / (download) - annotate - [select for diffs], Thu Apr 7 15:30:16 2011 UTC (13 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.223: +2 -2 lines
Diff to previous 1.223 (colored)

Do not use NULL in integer comparisons. No functional change.
ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@

Revision 1.223 / (download) - annotate - [select for diffs], Thu Apr 7 00:05:18 2011 UTC (13 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.222: +1 -2 lines
Diff to previous 1.222 (colored)

'disk offline' is not helpful. Silence is golden.

Prodded repeatedly by deraadt@

Revision 1.222 / (download) - annotate - [select for diffs], Thu Mar 31 18:42:48 2011 UTC (13 years, 2 months ago) by jasper
Branch: MAIN
Changes since 1.221: +2 -2 lines
Diff to previous 1.221 (colored)

- use nitems(); no binary change.

ok krw@

Revision 1.221 / (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.220: +14 -11 lines
Diff to previous 1.220 (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.220 / (download) - annotate - [select for diffs], Mon Feb 21 20:51:02 2011 UTC (13 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.219: +4 -1 lines
Diff to previous 1.219 (colored)

If a spin up command can't be started becaause of a lack of openings,
delay and retry the original command rather than immediately erroring
out.

Fixes USB drives that spin themselves down due to inactivity, as
confirmed by pirofti@ and jsg@.

ok miod@, rough agreement pending more general solution dlg@.

Revision 1.219 / (download) - annotate - [select for diffs], Fri Dec 24 02:45:33 2010 UTC (13 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.218: +28 -7 lines
Diff to previous 1.218 (colored)

Have sd(4) devices check for and respect read-only information the
way st(4) does. Have both decline to open read-only devices for
anything but read-only access.

Suggestion to fail opens rather than individual i/o's from deraadt@.

Problem USB device found and donated by chefren, who also tested
diffs. Thanks!

ok dlg@ marco@

Revision 1.218 / (download) - annotate - [select for diffs], Fri Sep 24 01:41:34 2010 UTC (13 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.217: +2 -2 lines
Diff to previous 1.217 (colored)

init err to 0 in sd_get_parms to avoid confusion when checking rigid
geometry. it doesnt matter waht the value there is cos rigid will be NULL,
but this is clearer.

Revision 1.217 / (download) - annotate - [select for diffs], Wed Sep 22 01:18:57 2010 UTC (13 years, 8 months ago) by matthew
Branch: MAIN
Changes since 1.216: +3 -3 lines
Diff to previous 1.216 (colored)

All users of physio(9) now pass NULL as the buf pointer argument, so
no point in keeping it around.

"i like this" thib@ (a while back); ok krw@ and oga@; reminder to
update the man page and tweaks jmc@

Revision 1.216 / (download) - annotate - [select for diffs], Tue Sep 21 12:20:53 2010 UTC (13 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.215: +2 -1 lines
Diff to previous 1.215 (colored)

Add a real DIOCGPDINFO, allowing access to the physical information
about the device rather than the contents of whichever disklabel
was read. Tweak whitespace in sd.c to make the code appearance
consistant.

Revision 1.215 / (download) - annotate - [select for diffs], Mon Sep 20 02:51:52 2010 UTC (13 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.214: +1 -2 lines
Diff to previous 1.214 (colored)

bufq_drain() does not need to be done in deactivate; we only need
to deactivate transactions we are currently doing.
ok dlg

Revision 1.214 / (download) - annotate - [select for diffs], Sun Sep 12 02:05:54 2010 UTC (13 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.213: +1 -5 lines
Diff to previous 1.213 (colored)

Garbage collect rot_rate from disk_parms. No longer in disk label so no
need to calculate and save. Not used anywhere in tree.

Revision 1.213 / (download) - annotate - [select for diffs], Sat Sep 11 22:40:10 2010 UTC (13 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.212: +45 -45 lines
Diff to previous 1.212 (colored)

Be more ruthlessly consistent in variable names for blk/block ==
512 == DEV_BSIZE units and variable-sized physical device 'sectors'.
I hope this reduces confusion a bit more. No change to .o files.

ok for intent miod@, with tweak.

Revision 1.212 / (download) - annotate - [select for diffs], Fri Sep 10 04:46:24 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.211: +2 -1 lines
Diff to previous 1.211 (colored)

scsi_xsh_del the io handler in deactivate to prevent it from being run on
a device thats now gone, or from being on the list of pending io when
the device is actually detached.

found and fix tested by jakemsr@
"go for it" jakemsr@

Revision 1.211 / (download) - annotate - [select for diffs], Wed Sep 8 15:16:22 2010 UTC (13 years, 9 months ago) by jsing
Branch: MAIN
Changes since 1.210: +2 -2 lines
Diff to previous 1.210 (colored)

Introduce a disk_lookup() function which calls device_lookup(), before
verifying that the resulting device is present on the disklist. This
avoids a race whereby the disk driver can be accessed as soon as the
softc has been allocated, but before the disk has completed
initialisation and has called disk_attach() (up until this point
dk_label is still a null pointer).

Cut cd(4), sd(4) and wd(4) across to disk_lookup(). All callers of
disk_attach() need to be tested and cut over in due course.

ok deraadt@ krw@

Revision 1.210 / (download) - annotate - [select for diffs], Wed Sep 8 14:47:12 2010 UTC (13 years, 9 months ago) by jsing
Branch: MAIN
Changes since 1.209: +1 -1 lines
Diff to previous 1.209 (colored)

Store a struct device pointer within struct disk and populate this when
disk_attach() is called by the device driver. We will be building on
this shortly.

ok deraadt@ krw@

Revision 1.209 / (download) - annotate - [select for diffs], Wed Sep 1 04:51:24 2010 UTC (13 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.208: +2 -2 lines
Diff to previous 1.208 (colored)

Restore compilability after bufq changes

Revision 1.208 / (download) - annotate - [select for diffs], Wed Sep 1 01:38:12 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.207: +9 -9 lines
Diff to previous 1.207 (colored)

make struct bufq a member of the softc for devices that use it,
rather than it being a pointer to something that needs to be allocated
at attach. since all these devices need a bufq to operate, it makes
sense to have it allocated as part of the softc and get bufq_init
to just initialise all its fields. it also gets rid of the possibility
that you wont be able to allocate the bufq struct during attach,
which is something you dont want to happen.

secondly, it consistently implements a split between wrapper functions
and the per discipline implementation of the bufq handlers. it
consistently does the locking in the wrappers rather than doing
half in the wrappers and the other half in the implementations.

it also consistently handles the outstanding bufq bq pointer in the
wrappers.

this hides most of the implementation inside kern_bufq.c. the only
stuff left in buf.h is for the bits each implementation needs to
put inside struct buf.

tested by thib@ krw@ and me
ok thib@ matthew@
no objection from krw@

Revision 1.207 / (download) - annotate - [select for diffs], Tue Aug 31 16:34:38 2010 UTC (13 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.206: +5 -9 lines
Diff to previous 1.206 (colored)

in the activate function, order the DVACT_ functions in the order they
can expect to be used

Revision 1.206 / (download) - annotate - [select for diffs], Sat Aug 28 20:23:22 2010 UTC (13 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.205: +1 -4 lines
Diff to previous 1.205 (colored)

Garbage collect struct dkdriver.

ok miod@; "please go ahead" jsing@

Revision 1.205 / (download) - annotate - [select for diffs], Tue Aug 3 19:37:17 2010 UTC (13 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.204: +4 -1 lines
Diff to previous 1.204 (colored)

Don't attempt to set the read or write caches on usb disks. It
breaks at least one previously working device, as discovered by
naddy@. dlg@ confirmed other kernels also avoid attempting this
operation on usb disks.

ok dlg@ deraadt@

Revision 1.204 / (download) - annotate - [select for diffs], Wed Jul 7 03:53:07 2010 UTC (13 years, 11 months ago) by marco
Branch: MAIN
Changes since 1.203: +1 -5 lines
Diff to previous 1.203 (colored)

Pull out disk sort.  I committed the wrong version of the diff and it
wasn't ok deraadt & dlg.

Revision 1.203 / (download) - annotate - [select for diffs], Tue Jul 6 16:16:48 2010 UTC (13 years, 11 months ago) by marco
Branch: MAIN
Changes since 1.202: +6 -2 lines
Diff to previous 1.202 (colored)

Enable FIFO IO for sd devices.  This time committed against the actual tree.

Tested by lots of people during c2k10

ok phessler krw thib

Revision 1.182.2.1 / (download) - annotate - [select for diffs], Tue Jul 6 08:48:50 2010 UTC (13 years, 11 months ago) by stephan
Branch: OPENBSD_4_7
Changes since 1.182: +9 -2 lines
Diff to previous 1.182 (colored) next main 1.183 (colored)

MFC, original commit from krw@:

Revision 1.202 / (download) - annotate - [select for diffs], Sat Jul 3 01:40:12 2010 UTC (13 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.201: +10 -5 lines
Diff to previous 1.201 (colored)

Stop disk on suspend and start it again upon resume.  Gets rid of the loud
click upon suspend that my laptop with ahci(4) has.

ok dlg@, ok marco@ on an earlier iteration of this diff

Revision 1.201 / (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.200: +8 -12 lines
Diff to previous 1.200 (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.200 / (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.199: +2 -1 lines
Diff to previous 1.199 (colored)

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

ok miod@, krw@

Revision 1.199 / (download) - annotate - [select for diffs], Wed Jun 30 19:06:29 2010 UTC (13 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.198: +12 -1 lines
Diff to previous 1.198 (colored)

Flush cache before suspend.

ok krw@, marco@

Revision 1.198 / (download) - annotate - [select for diffs], Mon Jun 28 08:35:46 2010 UTC (13 years, 11 months ago) by jsing
Branch: MAIN
Changes since 1.197: +5 -3 lines
Diff to previous 1.197 (colored)

Move disk_attach() to the end of the attach functions, at which point the
disk is now ready to handle I/O.

ok krw@ dlg@

Revision 1.197 / (download) - annotate - [select for diffs], Thu Jun 24 10:05:18 2010 UTC (13 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.196: +2 -2 lines
Diff to previous 1.196 (colored)

we cant rely on being able to sleep when dumping, so dont lose the
SCSI_NOSLEEP flag on the xs when setting extra flags by oring them in
rather than assigning them.

from matthew dempsky

Revision 1.196 / (download) - annotate - [select for diffs], Wed Jun 16 02:58:02 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.195: +22 -18 lines
Diff to previous 1.195 (colored)

Always check both the return value of scsi_do_mode_sense() and the
NULL'ness of the pointer to the actual page data. Fixes a NULL deref
when trying to set caching on my ASUS eeePC 1000HE's SD slot.

ok dlg@

Revision 1.195 / (download) - annotate - [select for diffs], Tue Jun 15 04:31:46 2010 UTC (13 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.194: +23 -8 lines
Diff to previous 1.194 (colored)

enable the write cache on disks during attach.

requested by deraadt@
ok krw@ marco@

Revision 1.194 / (download) - annotate - [select for diffs], Tue Jun 15 04:11:34 2010 UTC (13 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.193: +4 -4 lines
Diff to previous 1.193 (colored)

dont pass the dev_t from the scsi device drivers into the midlayer for
ioctl requests, and dont pass the proc pointers around for any ioctl
requests in scsi land at all. neither were used, so trim the fat.

ok krw@ marco@

Revision 1.193 / (download) - annotate - [select for diffs], Fri Jun 11 12:02:44 2010 UTC (14 years ago) by krw
Branch: MAIN
Changes since 1.192: +9 -3 lines
Diff to previous 1.192 (colored)

Restore an unusual XS_SENSE semantic that inadvertantly got lost
in the great re-write. If the scsi device *_interpret_sense()
function returns 0 that means there was no error.

Fixes restore(8) problems seen on certain tape drives.

Found and fix tested by Percey Piper. Suggestions from Matthew
Dempsky. Thanks!

ok dlg@

Revision 1.192 / (download) - annotate - [select for diffs], Wed Jun 2 13:32:13 2010 UTC (14 years ago) by dlg
Branch: MAIN
Changes since 1.191: +5 -2 lines
Diff to previous 1.191 (colored)

bring back the SDF_WAITING waiting flag while adapters still implement
NO_CCB.

if sd_buf_done is told that the adapter has no more ccbs via NO_CCB, this
sets a flag so sdstart doesnt try and queue more io straight away.

this fixes the lockups on ciss that halex and okan were experiencing after
the iopools code went in. it will fix any other hba that returns NO_CCB
too.

tested by me@, okan@, and halex@
ok krw@ okan@ halex@

Revision 1.191 / (download) - annotate - [select for diffs], Wed May 26 16:38:20 2010 UTC (14 years ago) by thib
Branch: MAIN
Changes since 1.190: +12 -15 lines
Diff to previous 1.190 (colored)

Trying this again. Mixing anoncvs with cvs is _not_ a good idea.

Reintroduce bufqs. A few changes since it was backed out after some good
comments from dlg@.

No need for a separate bufq.h, keep all of in buf.h; As requested by kittens
and deraadt.

Only sd(4) and wd(4) for now. The rest of the drivers will be converted soon,
also other goodies like heuristics for sd(4) for selecting the bufq type and
the death of disksort() are forthcoming.

Tested on: i386, amd64, sparc64, macppc, loongson and alpha by myself and
phessler.

OK art@, beck@, kettenis@, oga@

Revision 1.190 / (download) - annotate - [select for diffs], Thu May 20 00:04:38 2010 UTC (14 years ago) by krw
Branch: MAIN
Changes since 1.189: +17 -24 lines
Diff to previous 1.189 (colored)

Simplify new disk cache code so simpler people can understand it.
No functional change.

ok dlg@

Revision 1.189 / (download) - annotate - [select for diffs], Wed May 19 05:50:50 2010 UTC (14 years ago) by dlg
Branch: MAIN
Changes since 1.188: +1 -2 lines
Diff to previous 1.188 (colored)

remove unused flag.

Revision 1.188 / (download) - annotate - [select for diffs], Wed May 19 05:29:14 2010 UTC (14 years ago) by dlg
Branch: MAIN
Changes since 1.187: +79 -1 lines
Diff to previous 1.187 (colored)

add an ioctl that allows userland to get or set a disks read and write
caches, and implement handling of these ioctls on vanilla scsi disks.

discussed with krw@, marco@, miod@, kettenis@.
krw@ has a diff to make the sd.c code prettier coming shortly.

Revision 1.187 / (download) - annotate - [select for diffs], Tue May 18 04:41:14 2010 UTC (14 years ago) by dlg
Branch: MAIN
Changes since 1.186: +2 -1 lines
Diff to previous 1.186 (colored)

dont let sys/ioctl.h imply that you get the ioctls in dkio.h. this
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include
<sys/dkio.h> to the places that actually want and use the disk
ioctls.

this became an issue when krw@'s X build failed when he was testing
a change to dkio.h.
tested by krw@
help from and ok miod@

Revision 1.186 / (download) - annotate - [select for diffs], Fri Apr 30 02:17:06 2010 UTC (14 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.185: +6 -5 lines
Diff to previous 1.185 (colored)

unbreak dumps on scsi disks.

discovered by oga@

Revision 1.185 / (download) - annotate - [select for diffs], Fri Apr 23 15:25:21 2010 UTC (14 years, 1 month ago) by jsing
Branch: MAIN
Changes since 1.184: +0 -2 lines
Diff to previous 1.184 (colored)

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@

Revision 1.184 / (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.183: +4 -3 lines
Diff to previous 1.183 (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.183 / (download) - annotate - [select for diffs], Tue Apr 6 00:59:50 2010 UTC (14 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.182: +64 -87 lines
Diff to previous 1.182 (colored)

cut sd over to using the new shiny scsi_xsh api. instead of pushing io onto
the disk as soon as it gets any from the block layer, this now registers
a callback for when a resource becomes available on the bus.

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

Revision 1.182 / (download) - annotate - [select for diffs], Fri Jan 15 05:50:31 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.181: +6 -55 lines
Diff to previous 1.181 (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.181 / (download) - annotate - [select for diffs], Fri Jan 15 05:31:38 2010 UTC (14 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.180: +10 -3 lines
Diff to previous 1.180 (colored)

Restore XS_BUSY delay behaviour for buf i/o. Same as for sync path.

ok dlg@

Revision 1.180 / (download) - annotate - [select for diffs], Tue Jan 12 08:33:19 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (colored)

dont let the antisemaphore clear the WAITING flag so NO_CCB doesnt cause
us to loop forever.

follow sdstart through to to an adapters scsi_cmd handler and assume that
handler returns NO_CCB to enjoy the bug in full.

ok kettenis@ krw@ beck@

Revision 1.179 / (download) - annotate - [select for diffs], Mon Jan 11 11:16:38 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.178: +2 -1 lines
Diff to previous 1.178 (colored)

dlg@ lost the SCSI_IGNORE_ILLEGAL_REQUEST flag on all SYNCHRONIZE_CACHE
commands.

Noticed & fix tested by halex@.

ok dlg@

Revision 1.178 / (download) - annotate - [select for diffs], Mon Jan 11 00:44:40 2010 UTC (14 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.177: +5 -1 lines
Diff to previous 1.177 (colored)

Be as careful with sd/cd buf queue manipulations as was found necessary for
st's queue manipulations. i.e. ensure b_actb is correctly updated as the
queue becomes empty or has an i/o requeued on it.

Tested on claudio@'s backup crashing box.

ok dlg@ beck@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Jan 11 00:14:52 2010 UTC (14 years, 5 months ago) by beck
Branch: MAIN
Changes since 1.176: +17 -1 lines
Diff to previous 1.176 (colored)

Add mutex around work consuming loop in sdstart - this ensures that only
one thread will be grabbing xs's at a time and dequeuing work, but avoids
a race between notification there is work to do and exiting the loop
releasing the xs's.

Fixes problem noticed by claudio where usb disks would hang with the new
minty dlg midlayer.

ok krw@, dlg@, tested by claudio@

Revision 1.176 / (download) - annotate - [select for diffs], Sat Jan 9 21:12:06 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.175: +1 -14 lines
Diff to previous 1.175 (colored)

dont try to prevent multiple concurrent runs of a devices start routine
by setting flags around the loop. there is a race which can prevent
necessary work being completed by any of the currently running instances
of xxstart.

the caveat with the removal of this code is because multiple xxstarts can
be running at the same time they can cause io reordering, but that is less
of a problem than no io.

found by and fix tested by claudio@
debugged with krw@ claudio@ beck@ deraadt@

Revision 1.175 / (download) - annotate - [select for diffs], Tue Jan 5 01:21:34 2010 UTC (14 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.174: +5 -3 lines
Diff to previous 1.174 (colored)

only call disk_unbusy when we're finished with the io (or we're requeuing
it when we hit NO_CCB). retried io would call unbusy twice before this
change.

noticed by deraadt@

Revision 1.174 / (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.173: +2 -21 lines
Diff to previous 1.173 (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.173 / (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.172: +6 -6 lines
Diff to previous 1.172 (colored)

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

ok dlg@

Revision 1.172 / (download) - annotate - [select for diffs], Sun Dec 6 17:24:28 2009 UTC (14 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.171: +2 -2 lines
Diff to previous 1.171 (colored)

Nuke SCSI_URGENT after removing its only use, in ncr53c9x.c. That use
was to try to play dangerous games with tagged queuing.

ok marco@

Revision 1.171 / (download) - annotate - [select for diffs], Sun Dec 6 07:26:35 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.170: +170 -170 lines
Diff to previous 1.170 (colored)

consistently refer to the softc pointer as sc, not sd.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Dec 6 03:35:27 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.169: +7 -1 lines
Diff to previous 1.169 (colored)

biodone must be called at splbio.

Revision 1.169 / (download) - annotate - [select for diffs], Thu Dec 3 14:31:03 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.168: +16 -2 lines
Diff to previous 1.168 (colored)

prevent a completion interrupt pulling io of the buf queue and shoving it
down to the disk while a process is doing the same thing. this will avoid
some relatively minor io reordering from occurring.

discovered by krw@ during his long dark trek through the code. requested
by marco@

Revision 1.168 / (download) - annotate - [select for diffs], Thu Dec 3 06:09:30 2009 UTC (14 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.167: +2 -1 lines
Diff to previous 1.167 (colored)

set the length of the cdb when synchronising cache.

noticed by deraadt@ and miod@

Revision 1.167 / (download) - annotate - [select for diffs], Tue Dec 1 03:43:17 2009 UTC (14 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.166: +6 -1 lines
Diff to previous 1.166 (colored)

Mark disk as dirty when starting a write to it. Restores issuing of
SYNCHRONIZE_CACHE commands on device close.

ok dlg@ marco@

Revision 1.166 / (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.165: +16 -2 lines
Diff to previous 1.165 (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.165 / (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.164: +224 -235 lines
Diff to previous 1.164 (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.164 / (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.163: +235 -224 lines
Diff to previous 1.163 (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.163 / (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.162: +29 -16 lines
Diff to previous 1.162 (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.162 / (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.161: +208 -232 lines
Diff to previous 1.161 (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.161 / (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.160: +232 -208 lines
Diff to previous 1.160 (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.160 / (download) - annotate - [select for diffs], Wed Oct 21 20:32:02 2009 UTC (14 years, 7 months ago) by marco
Branch: MAIN
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored)

use _lto8b to calculate 64 bit address.  Fixes issue ckuethe saw at 2TB
boundary.

miod "go for it."

Revision 1.159 / (download) - annotate - [select for diffs], Tue Oct 13 19:33:19 2009 UTC (14 years, 8 months ago) by pirofti
Branch: MAIN
Changes since 1.158: +3 -3 lines
Diff to previous 1.158 (colored)

Get rid of devact enum, substitute it with an int and coresponding defines.

This is needed for the addition of further suspend/resume actions.

Okay deraadt@, marco@.

Revision 1.158 / (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.157: +208 -232 lines
Diff to previous 1.157 (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.157 / (download) - annotate - [select for diffs], Thu Aug 13 15:23:11 2009 UTC (14 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.156: +9 -9 lines
Diff to previous 1.156 (colored)

Replace the error strings that were being passed around with much simpler
errnos.  Note that the error strings are being ignored, since we long ago
decided to not spam the console, and there is no other nice way to use the
errors (without changing the ioctls to pass it back)
The errno is now useful, since we can pass b_error from failing IO up, and
the drive can decide how to use that
ok miod

Revision 1.156 / (download) - annotate - [select for diffs], Wed Jun 17 01:30:30 2009 UTC (14 years, 11 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.155: +33 -7 lines
Diff to previous 1.155 (colored)

Revert bufq's. this is inline with the major midlayer reverts that
have been going on. this appears to bring us back to stable state.

lots of testing by oga and ariane and my self.

Revision 1.155 / (download) - annotate - [select for diffs], Wed Jun 3 22:09:30 2009 UTC (15 years ago) by thib
Branch: MAIN
Changes since 1.154: +6 -32 lines
Diff to previous 1.154 (colored)

add a flexible buffer queue (bufq) api, based on the never used
one by tedu@. It doesn't do anything smart yet, it just uses
plain old disksort. we also keep the old method of queueing bufs
since some miods have crazy MD drivers that need some love.

ok beck@, art@
tested by many on many archs.

Revision 1.154 / (download) - annotate - [select for diffs], Mon Feb 16 21:19:07 2009 UTC (15 years, 3 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.153: +2 -2 lines
Diff to previous 1.153 (colored)

Extend the scsi_adapter minphys() callback to take a struct scsi_link *
as additional argument. This will allow intermediate layers between
scsi devices such as sd and scsi host adapters to take appropriate
action if necessary.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Aug 24 09:08:49 2008 UTC (15 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored)

dont display disk geometry (cyls/heads/sectors) since it mostly lies these
days. if you really want it still you can fetch it via disklabel(8).

ok krw@ deraadt@

Revision 1.152 / (download) - annotate - [select for diffs], Fri Aug 1 01:44:20 2008 UTC (15 years, 10 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.151: +7 -6 lines
Diff to previous 1.151 (colored)

silence failures to run scsi_prevent. dmesg spam sucks.

ok krw@ marco@ miod@ deraadt@

Revision 1.151 / (download) - annotate - [select for diffs], Tue Jul 8 12:17:48 2008 UTC (15 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.150: +7 -12 lines
Diff to previous 1.150 (colored)

this makes the code in sdattach less dense by collapsing the flags we pass
to all the scsi midlayer code into a local variable.

ok krw@ marco@

Revision 1.150 / (download) - annotate - [select for diffs], Thu Jun 26 05:42:20 2008 UTC (15 years, 11 months ago) by ray
Branch: MAIN
Changes since 1.149: +1 -8 lines
Diff to previous 1.149 (colored)

First pass at removing clauses 3 and 4 from NetBSD licenses.

Not sure what's more surprising: how long it took for NetBSD to
catch up to the rest of the BSDs (including UCB), or the amount of
code that NetBSD has claimed for itself without attributing to the
actual authors.

OK deraadt@

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

fgsch@ points out my last commit changed the retry limit for CD capacity
commands. Bump limit back to the standard 4, and at the same time eliminate
SDRETRIES and CDRETRIES (both defined to 4) in favour of a new define,
SCSI_RETRIES, also defined to 4.

Revision 1.148 / (download) - annotate - [select for diffs], Sun Jun 15 00:52:25 2008 UTC (15 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (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.147 / (download) - annotate - [select for diffs], Sun Jun 15 00:36:41 2008 UTC (15 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.146: +2 -3 lines
Diff to previous 1.146 (colored)

Don't bypass partition bounds check for RAW_PART. We now guarantee that
RAW_PART will always be 0 -> disksize, so the bounds check will always
pass for i/o's to valid addresses. Now the i/o will be properly truncated
if it goes past the end of the device. This prevents various adverse
impacts of issuing i/o's for data past the end of the device.

Repeatedly requested by todd@.

ok weingart@ deraadt@

Revision 1.146 / (download) - annotate - [select for diffs], Tue Jun 10 04:46:07 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.145: +7 -5 lines
Diff to previous 1.145 (colored)

When copying stuff from code that runs with interrupts enabled to code
that may run without interrupts, don't forget to add scsi_autoconf
to the flags and POLL for the result rather than wait for an interrupt that
will never come. Fixes Dale's Iomega Jazz drive on the ahc here, and no
doubt many other device combinations.

Revision 1.145 / (download) - annotate - [select for diffs], Mon Jun 2 17:01:13 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.144: +4 -5 lines
Diff to previous 1.144 (colored)

Don't spew sense errors (e.g. 'media not present') when probing a
device. Fallout from doing better PREVENT ALLOW dance.

Prodded by marco@ as a result of a report from Andreas Kahari on tech@.

Revision 1.144 / (download) - annotate - [select for diffs], Sat May 24 18:53:46 2008 UTC (16 years ago) by krw
Branch: MAIN
Changes since 1.143: +2 -2 lines
Diff to previous 1.143 (colored)

SDEV_UMASS devices skip the mode page dance to set blksize. So initialize
blksize to 0 to avoid confusing garbage values with useful info.

Noticed by jolan@.

Revision 1.143 / (download) - annotate - [select for diffs], Fri May 9 06:19:33 2008 UTC (16 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.142: +24 -11 lines
Diff to previous 1.142 (colored)

Lock in removable media while trying to determine the disk parameters. This
should fix a number of 'drive offline' situations where the device claims
it has no media loaded until the lock in occurs. Like a Blackberry Pearl
Todd Fries found and probably other USB devices. Move the lock in during
device open to before the test unit ready to eliminate similar spurious
rejections of the device.

Feedback from marco@, tests by todd@ and miod@.

ok deraadt@ beck@ dlg@ miod@

Revision 1.142 / (download) - annotate - [select for diffs], Fri Mar 21 19:57:44 2008 UTC (16 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.141: +6 -1 lines
Diff to previous 1.141 (colored)

USB Floppies are umass devices so we always use the default 63/255
geometry.  But 63 * 255 > 2880 and the cylinder count becomes 0.  So
if we end up with a valid disksize but 0 cylinders, set heads =
cylinders = 1 and sectors-per-track = disksize.

Revision 1.141 / (download) - annotate - [select for diffs], Fri Dec 28 16:19:15 2007 UTC (16 years, 5 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.140: +2 -2 lines
Diff to previous 1.140 (colored)

massage the way vpds are defined. rename the page used for the devices
serial number and split the vpd header out for use in other places. while
here define the device identification page bits too.

ok krw@ marco@

Revision 1.140 / (download) - annotate - [select for diffs], Fri Nov 23 14:44:59 2007 UTC (16 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.139: +3 -1 lines
Diff to previous 1.139 (colored)

if we cant fetch the serial then fill it with "(unknown)".

Revision 1.139 / (download) - annotate - [select for diffs], Sun Nov 11 16:46:51 2007 UTC (16 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.138: +5 -4 lines
Diff to previous 1.138 (colored)

Revert useless textual optimization that resulted in 16 bytes being
sent to the adapter instead of the 10 bytes the scsi_sychronize_cache
command actually occupies. This freaked out the ahc on jsing@'s SGI
and probably others.

Found, isolated, fix tested, and ok jsing@

Revision 1.138 / (download) - annotate - [select for diffs], Tue Nov 6 02:49:19 2007 UTC (16 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.137: +17 -33 lines
Diff to previous 1.137 (colored)

Fix SDF_DIRTY handling, eliminate useless SDF_FLUSHING. The sd_flush()
called from the last sdclose() on a device will now reset SDF_DIRTY
after submitting the SYNCHRONIZE CACHE command. sddone() need not
worry about SDF_DIRTY since it was never called for the SYNCHRONIZE
CACHE command anyway.

This eliminates a spurious SYNCHRONIZE CACHE command being issued for
every sd device from sd_shutdown().

ok dlg@

Revision 1.137 / (download) - annotate - [select for diffs], Sat Sep 15 19:22:18 2007 UTC (16 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.136: +29 -6 lines
Diff to previous 1.136 (colored)

Allow to pull out an usb stick with ffs filesystem while mounted
and a file is written onto the stick.  Without these fixes the
machine panics or hangs.
The usb fix calls the callback when the stick is pulled out to free
the associated buffers.  Otherwise we have busy buffers for ever
and the automatic unmount will panic.
The change in the scsi layer prevents passing down further dirty
buffers to usb after the stick has been deactivated.
In vfs the automatic unmount has moved from the function vgonel()
to vop_generic_revoke().  Both are called when the sd device's vnode
is removed.  In vgonel() the VXLOCK is already held which can cause
a deadlock.  So call dounmount() earlier.

ok krw@, I like this marco@, tested by ian@

Revision 1.136 / (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.135: +16 -10 lines
Diff to previous 1.135 (colored)

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

Tested, tweaked and ok otto@

Revision 1.135 / (download) - annotate - [select for diffs], Wed Jun 20 18:15:47 2007 UTC (16 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.134: +11 -22 lines
Diff to previous 1.134 (colored)

b_cylinder does not need to be set on the callpath down into drivers.
cpu_disklabel can go away, since nothing anymore needs to use it; ok miod

Revision 1.134 / (download) - annotate - [select for diffs], Mon Jun 18 20:55:52 2007 UTC (16 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.133: +6 -3 lines
Diff to previous 1.133 (colored)

avoid modification race in DIOCRLDINFO; ok krw miod

Revision 1.133 / (download) - annotate - [select for diffs], Fri Jun 8 05:27:58 2007 UTC (17 years ago) by deraadt
Branch: MAIN
Changes since 1.132: +2 -1 lines
Diff to previous 1.132 (colored)

all drivers should spoof version 1 labels

Revision 1.132 / (download) - annotate - [select for diffs], Thu Jun 7 05:29:44 2007 UTC (17 years ago) by deraadt
Branch: MAIN
Changes since 1.131: +4 -6 lines
Diff to previous 1.131 (colored)

in OpenBSD as all old BSD unix, RAW_PART always starts at 0, so no
need for special case code; ok krw

Revision 1.131 / (download) - annotate - [select for diffs], Wed Jun 6 17:15:14 2007 UTC (17 years ago) by deraadt
Branch: MAIN
Changes since 1.130: +8 -7 lines
Diff to previous 1.130 (colored)

now that all partition size/offsets are potentially 64-bit, change the
type of all variables to daddr64_t.  this includes the APIs for XXsize()
and XXdump(), all range checks inside bio drivers, internal variables
for disklabel handling, and even uvm's swap offsets.  re-read numerous
times by otto, miod, krw, thib to look for errors

Revision 1.130 / (download) - annotate - [select for diffs], Tue Jun 5 00:38:23 2007 UTC (17 years ago) by deraadt
Branch: MAIN
Changes since 1.129: +6 -6 lines
Diff to previous 1.129 (colored)

use six new macros to access & store the 48-bit disklabel fields related
to size.  tested on almost all machines, double checked by miod and krw
next comes the type handling surrounding these values

Revision 1.129 / (download) - annotate - [select for diffs], Fri Jun 1 00:07:48 2007 UTC (17 years ago) by krw
Branch: MAIN
Changes since 1.128: +1 -6 lines
Diff to previous 1.128 (colored)

Don't initialize d_partitions[RAW_DISK] just before calling
readdisklabel(), since all readdisklabel()'s do that already.

ok deraadt@

Revision 1.128 / (download) - annotate - [select for diffs], Thu May 31 18:07:18 2007 UTC (17 years ago) by krw
Branch: MAIN
Changes since 1.127: +32 -6 lines
Diff to previous 1.127 (colored)

Use 12 and 16 byte read/write commands as required by the size/length
of the I/O being attempted. Throw in a comment typo fix to properly
refer to sectors and not blocks.

ok marco@

Revision 1.127 / (download) - annotate - [select for diffs], Sat Apr 28 02:24:21 2007 UTC (17 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.126: +2 -2 lines
Diff to previous 1.126 (colored)

Fix comments above DISKMINOR uses. DISKMINOR provides minor not major
number (wd.c), and the uses are to find the minimum minor to be
detached.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Apr 26 11:18:54 2007 UTC (17 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.125: +20 -27 lines
Diff to previous 1.125 (colored)

Use the standard DISKPART/DISKUNIT/etc. defines rather than identical
but differently named SD/CD ones. No change to .o files.

ok deraadt@ dlg@

Revision 1.125 / (download) - annotate - [select for diffs], Sat Apr 14 16:32:30 2007 UTC (17 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.124: +4 -5 lines
Diff to previous 1.124 (colored)

For devices unwilling or unable to report geometry, change the 'fake'
geometry used to 255 heads and 63 sectors/track from 64 heads and 32
sectors. 255/63 makes the cylinders as large as PC/BIOS compatibility
allows, increasing the size of devices that can be supported.

ok pedro@ (long ago) marco@ millert@ weingart@

Revision 1.124 / (download) - annotate - [select for diffs], Fri Apr 13 18:56:26 2007 UTC (17 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.123: +9 -7 lines
Diff to previous 1.123 (colored)

If a removable device refuses to process PREVENT_ALLOW to lock the
media in while the device is open, allow the open anyway. Fixes some
USB devices which do odd things when presented by PREVENT_ALLOW.

Suggestion from mickey@.

ok millert@ marco@

Revision 1.123 / (download) - annotate - [select for diffs], Wed Apr 11 10:54:57 2007 UTC (17 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.122: +24 -13 lines
Diff to previous 1.122 (colored)

Use a separate function to remove the buffers in sddetach.
No functional change.

ok krw

Revision 1.122 / (download) - annotate - [select for diffs], Tue Apr 10 16:41:45 2007 UTC (17 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.121: +9 -9 lines
Diff to previous 1.121 (colored)

Name and cast all struct sd_softc *sd the same way.  No binary change.

ok krw

Revision 1.121 / (download) - annotate - [select for diffs], Wed Apr 4 12:44:17 2007 UTC (17 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.120: +28 -79 lines
Diff to previous 1.120 (colored)

sprinkle some ansification around.

no binary change, and ok krw@ marco@

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

implement the DK INFO ioctl so userland can query the disks product,
vendor, etc details.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Feb 21 01:32:21 2007 UTC (17 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.118: +10 -8 lines
Diff to previous 1.118 (colored)

Don't unconditionally spin up SDEV_UMASS devices. They almost
certainly don't need it, or are capable of reporting themselves in
need of a spin up.  Feedback from various agreeing it is unlikely such
devices exist.

Fixes devices found by Markus Bergkvist and Johan M:son Lindman.

ok dlg@

Revision 1.118 / (download) - annotate - [select for diffs], Mon Feb 12 00:30:17 2007 UTC (17 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.117: +1 -2 lines
Diff to previous 1.117 (colored)

Don't need a 'return' just before exiting a function.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Feb 3 23:47:18 2007 UTC (17 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

Make comment match code.  ok pedro

Revision 1.116 / (download) - annotate - [select for diffs], Thu Dec 21 02:05:46 2006 UTC (17 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

Fix some comment typos. 'immediatly' -> 'immediately', 'tranfer' ->
'transfer', 'tranfered' -> 'transferred'.

Revision 1.115 / (download) - annotate - [select for diffs], Tue Dec 12 02:44:36 2006 UTC (17 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.114: +41 -12 lines
Diff to previous 1.114 (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.114 / (download) - annotate - [select for diffs], Tue Nov 28 16:56:50 2006 UTC (17 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored)

rename scsibus_attach_args to scsi_attach_args. this can help avoid
confusing when trying to attach scsibus to a hba, since it is really meant
for attaching scsi devices to scsibus.

ok deraadt@ marco@

Revision 1.113 / (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.112: +2 -2 lines
Diff to previous 1.112 (colored)

more magic removal
ok miod@, deraadt@

Revision 1.112 / (download) - annotate - [select for diffs], Mon Nov 27 20:15:09 2006 UTC (17 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.111: +5 -6 lines
Diff to previous 1.111 (colored)

get rid of the rest of the asc/ascq magic codes in scsi
ok marco@, deraadt@

Revision 1.111 / (download) - annotate - [select for diffs], Sat Oct 7 23:40:07 2006 UTC (17 years, 8 months ago) by beck
Branch: MAIN
Changes since 1.110: +3 -3 lines
Diff to previous 1.110 (colored)

make cd-roms retry forever while the device indicates that it is
"becoming ready" - this is done in the exact same way that it
was done for tape in st.c. This commit adds a cd specific interpret_sense
routine to cd.c that will catch the becoming ready case and handle it.
This also removes the need to use crazy timeouts to catch this case.

ok krw@

Revision 1.110 / (download) - annotate - [select for diffs], Sat Jul 29 02:40:46 2006 UTC (17 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (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.109 / (download) - annotate - [select for diffs], Sun Jul 23 02:50:20 2006 UTC (17 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.108: +1 -10 lines
Diff to previous 1.108 (colored)

remove some scsi ioctls, most importantly the ones that can reprobe the
bus. supporting these complicates the midlayer unnecessarily.

ok krw@

Revision 1.108 / (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.107: +2 -2 lines
Diff to previous 1.107 (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.107 / (download) - annotate - [select for diffs], Tue Jul 11 21:55:46 2006 UTC (17 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

the scsi_link structure contained a copy of the inquiry flags and the whole
inquiry. this removes the flags member and makes all its users refer to the
whole inquiry now.

ok miod@ krw@

Revision 1.106 / (download) - annotate - [select for diffs], Thu May 18 00:10:05 2006 UTC (18 years ago) by krw
Branch: MAIN
Changes since 1.105: +16 -11 lines
Diff to previous 1.105 (colored)

Test the state of a disk *after* spinning it up and not before. This
prevents the issuing of sizing inquiries to non-existant or non-responsive
devices like empty slots on a USB card reader.

Also try to avoid *extremely* unlikely loop of scsi_start() commands, by
not using sd_interpret_sense() until after the disk is spinning.

ok dlg@

Revision 1.105 / (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.104: +4 -4 lines
Diff to previous 1.104 (colored)

Zap trailing whitespace.

Revision 1.104 / (download) - annotate - [select for diffs], Wed Mar 15 20:20:42 2006 UTC (18 years, 3 months ago) by miod
Branch: MAIN
Changes since 1.103: +1 -3 lines
Diff to previous 1.103 (colored)

Nuke dk_establish(), no longer used.

Revision 1.103 / (download) - annotate - [select for diffs], Sun Mar 5 14:58:10 2006 UTC (18 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.102: +1 -6 lines
Diff to previous 1.102 (colored)

Remove NetBSDism NRND. Pointed out by Mickey.

ok miod@ marco@

Revision 1.102 / (download) - annotate - [select for diffs], Sat Mar 4 19:33:22 2006 UTC (18 years, 3 months ago) by miod
Branch: MAIN
Changes since 1.101: +2 -2 lines
Diff to previous 1.101 (colored)

Typos grab bag of the month, eyeballed by jmc@

Revision 1.101 / (download) - annotate - [select for diffs], Sat Jan 21 12:18:49 2006 UTC (18 years, 4 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.100: +5 -13 lines
Diff to previous 1.100 (colored)

Invoke disk_detach() and related cleanup work in detach(), rather than
zeroref() - just to be on the safe side, should we mess up our ref count.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Nov 17 23:58:41 2005 UTC (18 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.99: +5 -3 lines
Diff to previous 1.99 (colored)

Don't forget to device_unref() in sdclose() if sdlock() fails; ok krw@

Revision 1.99 / (download) - annotate - [select for diffs], Thu Nov 17 21:25:58 2005 UTC (18 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.98: +2 -3 lines
Diff to previous 1.98 (colored)

Use sectors as the size units for the RAW_PART (i.e. 'c') partition in
spoofed sd disklabels. Sectors are the partition size units used and
documented everywhere else in the tree. sd ensures a sector will
always be a multiple of 512.

Fixes disklabel(8) error messages and partition size display for sd
devices that have no OpenBSD disklabel and a sectorsize > 512. Noted
by Robert Szasz on his Sony Hi-MD device.

ok pedro@ marco@

Revision 1.98 / (download) - annotate - [select for diffs], Sun Nov 13 16:10:05 2005 UTC (18 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.97: +11 -18 lines
Diff to previous 1.97 (colored)

Allow removable disks to be spun up if they ask for initialization
after being opened.  Use SC_DEBUG() to suppress some verbiage during
spin up. Return actual errors encountered during attempt to spin up,
rather than always returning EIO.

ok dlg@

Revision 1.97 / (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.96: +5 -9 lines
Diff to previous 1.96 (colored)

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

ok dlg@

Revision 1.96 / (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.95: +3 -2 lines
Diff to previous 1.95 (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.95 / (download) - annotate - [select for diffs], Mon Oct 10 20:06:12 2005 UTC (18 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored)

Make some panic messages more useful.

Revision 1.94 / (download) - annotate - [select for diffs], Mon Sep 19 04:25:00 2005 UTC (18 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.93: +9 -9 lines
Diff to previous 1.93 (colored)

Use variable to eliminate repeated calculation. More readable. No
functional change.

ok dlg@

Revision 1.93 / (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.92: +2 -2 lines
Diff to previous 1.92 (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.92 / (download) - annotate - [select for diffs], Sun Sep 11 17:18:53 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.91: +11 -3 lines
Diff to previous 1.91 (colored)

Some UMASS devices blow up if MODE SENSE buffer length is 0 (aka 256).
Some blow up if buffer length is not 0. Just fake geometry for all
UMASS devices since it's almost always fictitious anyway. One step on
the road to eliminate geometry entirely.

Fixes Ed Wandasiewicz's 2nd gen iPod mini and Sebastiaan Indesteege's
UBest Technology device.

ok marco@

Revision 1.91 / (download) - annotate - [select for diffs], Thu Sep 8 03:33:55 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.90: +5 -5 lines
Diff to previous 1.90 (colored)

free(NULL, ...) is not safe in the kernel. So check for NULL'ness
before free()'ing buf in sd_get_parms(). Tweak code so there is only
one free(buf, ...) to worry about.

ok deraadt@.

Revision 1.90 / (download) - annotate - [select for diffs], Sat Aug 27 03:50:04 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.89: +3 -3 lines
Diff to previous 1.89 (colored)

Put in missing parenthesis and thus always pass
SCSI_IGNORE_ILLEGAL_REQUEST and SCSI_IGNORE_MEDIA_CHANGE flags to
scsi_test_unit_ready() and scsi_start() during sdopen(). Re-enables
use of devices that don't support START_STOP or TEST_UNIT_READY
commands.

Noted by and fix tested by Jason Crawford on VMWare disks.

ok dlg@ henning@, supportive comments from miod@.

Revision 1.89 / (download) - annotate - [select for diffs], Wed Aug 24 01:19:47 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Test xs->bp before de-referencing it. Initialize it to NULL, not 0.

ok deraadt@

Revision 1.88 / (download) - annotate - [select for diffs], Tue Aug 23 23:38:00 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.87: +18 -9 lines
Diff to previous 1.87 (colored)

Move uses of struct scsi_mode_sense_buf (255 bytes each) from the
stack into malloc'd memory.

ok deraadt@

Revision 1.87 / (download) - annotate - [select for diffs], Tue Aug 23 23:31:04 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.86: +8 -10 lines
Diff to previous 1.86 (colored)

Spin up sd units even if TEST_UNIT_READY says they're ready.

Use consistant scsi_autoconf and SCSI_SILENT flags in
scsi_test_unit()/scsi_start() pairs.

Fixes some hppa, vax, sparc systems that do not spin up disks
automatically. Keeps USB card readers and such reasonably quiet.

Noted by millert@ (hppa), henning@ (sparc) and hshoexer@ (vax).

ok deraadt@

Revision 1.86 / (download) - annotate - [select for diffs], Sun Aug 21 16:25:52 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.85: +10 -3 lines
Diff to previous 1.85 (colored)

Some devices go berserk when asked for mode sense pages they don't
have. Some devices return four bytes less information than requested
for the PAGE_RIGID_GEOMETRY page. Put the two together and older
Conner drives don't work because we rejected the short page and asked
for the PAGE_FLEX_GEOMETY page. Noted by hshoexer@ and kettenis@.

Also should fix the problems with a device miod@ reported that did a
similar short PAGE_FLEX_GEOMETRY.

ok deraadt@

Revision 1.85 / (download) - annotate - [select for diffs], Thu Aug 18 22:59:21 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.84: +20 -1 lines
Diff to previous 1.84 (colored)

Only allow blocksizes that are powers of 2 between 512 and 64K. An sd
device that returns any other value via READ CAPACITY or MODE SENSE
will be marked 'drive offline'. Prevents divide by zero when
calculating disk size in MB, amoung other interesting possibilities.

ok mickey@ dlg@ deraadt@ millert@ marco@

Revision 1.84 / (download) - annotate - [select for diffs], Wed Aug 17 02:17:51 2005 UTC (18 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.83: +13 -15 lines
Diff to previous 1.83 (colored)

Use defines for disk mode page codes. Check returned mode pages to
ensure they are the ones requested. No functional change unless
garbage was being returned.

ok marco@

Revision 1.83 / (download) - annotate - [select for diffs], Fri Aug 12 01:49:08 2005 UTC (18 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.82: +25 -29 lines
Diff to previous 1.82 (colored)

Move disk mode page structure declarations out of scsi_disk_pages
union declaration to allow pointers to individual page types. Simplify
sd.c code by using individual page type pointers. No functional
change.

ok tdeval@

Revision 1.82 / (download) - annotate - [select for diffs], Sat Jul 30 15:54:45 2005 UTC (18 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.81: +8 -4 lines
Diff to previous 1.81 (colored)

Use the blocksize returned from scsi_size() in preference to all
other values as was intended. As opposed to overwriting it with
scsi_do_mode_sense() calls.

May help PR4313.

ok tdeval@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Jul 5 00:55:25 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.80: +6 -9 lines
Diff to previous 1.80 (colored)

Since scsi_link now includes a copy of the INQUIRY data, don't keep a
copy of the vendor/product/revision fields in sd_softc. Just use the
INQUIRY data to build the disklabel 'label' when required. No
functional change.

Revision 1.80 / (download) - annotate - [select for diffs], Sat Jul 2 15:39:55 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.79: +3 -4 lines
Diff to previous 1.79 (colored)

Remove unused cd_softc.name field. Use the saved INQUIRY data in
scsi_link to determine device type, rather than keeping a copy in
sd_softc.type. Remove unused sd_softc.type field.

Revision 1.79 / (download) - annotate - [select for diffs], Sat Jul 2 14:32:17 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.78: +1 -4 lines
Diff to previous 1.78 (colored)

Remove unused struct sd_ops.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Jul 2 03:49:47 2005 UTC (18 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.77: +149 -19 lines
Diff to previous 1.77 (colored)

Don't use READ FORMAT CAPACITIES to determine the size of ATAPI sd
devices. Use READ CAPACITY like NetBSD, FreeBSD, Linux and OpenSolaris
do. Well, NetBSD keeps READ FORMAT CAPACITIES as a backup. Fixes
problems with devices (such as my IBM USB Memory Key) which return
block counts that are off by one for READ FORMAT CAPACITIES.

This eliminates the significant difference between sd_atapi.c and
sd_scsi.c so merge sd_scsi.c into sd.c and just be careful to mark
ATAPI removable devices as both SDEV_NOSYNCCACHE and unable to return
MODE SENSE page 4 info.

All geometry faking is now in one place. Where it can be 'improved'.

sd_scsi.c, sd_atapi.c and atapi_disk.h will be removed as a result.

Revision 1.77 / (download) - annotate - [select for diffs], Tue May 3 00:29:16 2005 UTC (19 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.76: +8 -8 lines
Diff to previous 1.76 (colored)

sdstrategy() shouldn't use values in disklabel until SDEV_MEDIA_LOADED
is checked.  Fixes crash during boot when a device has no media
loaded. e.g. a usb card reader with empty slots. From NetBSD. Problem
was introduced by last commit to allow RAW_PART+S_IFCHAR opens to
always succeed.

ok millert@ marco@

Revision 1.76 / (download) - annotate - [select for diffs], Sun May 1 19:29:17 2005 UTC (19 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.75: +12 -5 lines
Diff to previous 1.75 (colored)

Allow RAW_PART+S_IFCHR device opens to succeed even if media not
present. A successful open is required for ioctl's to work.  Mostly
from NetBSD, partly correcting previous code cleanup error.

From deraadt@, treat MTIOCTOP+MTRETEN as CDIOCCLOSE for cd devices
(i.e. close the cd drawer).

ok deraadt@.

Revision 1.75 / (download) - annotate - [select for diffs], Wed Apr 6 02:51:13 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (colored)

De-register scsi.

Revision 1.74 / (download) - annotate - [select for diffs], Tue Apr 5 02:01:50 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.73: +32 -39 lines
Diff to previous 1.73 (colored)

Clean up some logic. Use better error handling for sd devices. Be
quiet if raw partition access tried. Be more careful with
SDEV_MEDIA_LOADED. Inspired by some NetBSD changes.

ok marco@

Revision 1.73 / (download) - annotate - [select for diffs], Wed Mar 30 02:40:42 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.72: +13 -14 lines
Diff to previous 1.72 (colored)

Comment typo, minor knf. No code change.

Revision 1.72 / (download) - annotate - [select for diffs], Fri Mar 25 05:07:43 2005 UTC (19 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.71: +10 -6 lines
Diff to previous 1.71 (colored)

Since START_STOP is an optional command that a device need not
support, don't penalize devices that don't support it. May help some
usb devices.

ok marco@

Revision 1.71 / (download) - annotate - [select for diffs], Sun Feb 27 01:12:11 2005 UTC (19 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.70: +5 -1 lines
Diff to previous 1.70 (colored)

If test_unit_ready() in sdattach() returns EIO, try to spin up unit
exactly as is done in sdopen(). This improves the chances of getting
valid geometry/size and avoiding 'drive offline' errors, without
subjecting the device to anything it won't see anyway.

No impact on devices that already work. Fixes problem with Jim Rees'
Hitachi DK23DA in an Archos Multimedia Jukebox. Without adding quirks!

Tested by Jim Rees. ok marco@.

Revision 1.41.2.9 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:08 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.41.2.8: +57 -70 lines
Diff to previous 1.41.2.8 (colored) to branchpoint 1.41 (colored) next main 1.42 (colored)

Merge with the trunk

Revision 1.70 / (download) - annotate - [select for diffs], Fri May 28 23:50:15 2004 UTC (20 years ago) by krw
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.69: +39 -43 lines
Diff to previous 1.69 (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.69 / (download) - annotate - [select for diffs], Mon May 17 23:57:51 2004 UTC (20 years ago) by krw
Branch: MAIN
Changes since 1.68: +4 -4 lines
Diff to previous 1.68 (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.68 / (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.67: +8 -9 lines
Diff to previous 1.67 (colored)

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

ok deraadt@

Revision 1.67 / (download) - annotate - [select for diffs], Sat Feb 21 00:47:42 2004 UTC (20 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.66: +11 -20 lines
Diff to previous 1.66 (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.41.2.8 / (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.41.2.7: +18 -12 lines
Diff to previous 1.41.2.7 (colored) to branchpoint 1.41 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.66 / (download) - annotate - [select for diffs], Sun Feb 15 02:45:47 2004 UTC (20 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.65: +4 -3 lines
Diff to previous 1.65 (colored)

new arg to disk_unbusy, to record separate read/write statistics.
looked at by various, testing henning@ mcbride@ dan weeks
mostly from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>

Revision 1.65 / (download) - annotate - [select for diffs], Sun Jan 25 21:51:18 2004 UTC (20 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

Be less verbose in sdattach() by suppressing the display of detailed
sense information when attempting to discover the disk size.

USB 6-in-1 readers have a bunch of LUNs and otherwise produce many
'Medium Not Present' details everytime they are plugged in. Noticed
by grange@.

Requested by and ok deraadt@.

Revision 1.64 / (download) - annotate - [select for diffs], Sun Jan 25 00:52:49 2004 UTC (20 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

Use %lu to print u_long values, not %d or %ld. Fixes display of
negative number of sectors for very large (i.e. RAID) disks. Noticed
by Marco Peereboom.

ok deraadt@.

Revision 1.63 / (download) - annotate - [select for diffs], Mon Jan 5 02:57:01 2004 UTC (20 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.62: +15 -9 lines
Diff to previous 1.62 (colored)

Don't issue PREVENT_ALLOW commands to disk devices during sdopen() or
sdclose() unless they identified themselves as removable.

ok deraadt@.

Revision 1.62 / (download) - annotate - [select for diffs], Tue Jun 24 22:42:07 2003 UTC (20 years, 11 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.61: +2 -2 lines
Diff to previous 1.61 (colored)

try to devise drive's rpm and default to 3600 should we fail miserably.
derived from pr2815 from Marco Peereboom
krw@ deraadt@ ok

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

Sync SMP branch to -current

Revision 1.61 / (download) - annotate - [select for diffs], Wed May 21 23:43:58 2003 UTC (21 years ago) by krw
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

Make sure that the first scsi command issued to a device during
sdattach() has the flag SCSI_IGNORE_MEDIA_CHANGE set. This was not
true for devices with the quirk SDEV_NOSTARTUNIT, such as some umass
devices.

This fixes the display of the disk parameters for any loaded media.
Previously the displayed parameters would show 0 size, 0 sectors and a
faked number of cylinders, etc. By ignoring the error generated by
devices trying to tell us the media may have changed since the last
command the SCSI command completes correctly and valid values are
obtained/displayed. We are interested in the current values and
unconcerned about any previous ones.

Tested by drahn@.

Revision 1.51.4.3 / (download) - annotate - [select for diffs], Mon May 19 22:28:21 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.51.4.2: +26 -13 lines
Diff to previous 1.51.4.2 (colored) to branchpoint 1.51 (colored) next main 1.52 (colored)

sync

Revision 1.60 / (download) - annotate - [select for diffs], Sun May 18 16:06:35 2003 UTC (21 years ago) by mickey
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

constify the quirck tables and fix the scsi_inqmatch() proto accordingly; krw@ ok

Revision 1.59 / (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.58: +3 -3 lines
Diff to previous 1.58 (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.41.2.6 / (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.41.2.5: +23 -11 lines
Diff to previous 1.41.2.5 (colored) to branchpoint 1.41 (colored)

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

Revision 1.58 / (download) - annotate - [select for diffs], Tue May 6 11:40:34 2003 UTC (21 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.57: +21 -9 lines
Diff to previous 1.57 (colored)

sprintf -> snprintf. strncpy -> bcopy since d_packname is not really a
string.

Ensure that all of d_packname is used by not null-terminating string
that is put in it.

Suggestions and motivation to remove strncpy() from deraadt@.

ok deraadt@ tedu@.

Revision 1.57 / (download) - annotate - [select for diffs], Sun Apr 6 03:02:44 2003 UTC (21 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.56: +4 -4 lines
Diff to previous 1.56 (colored)

The disklabel fields d_packname and d_typename are not null terminated strings
and should not be created or used as such.

This fixes some instances of both behaviours, and sets the stage for some
strcpy -> strncpy fixup.

ok tdeval@ millert@ deraadt@

Revision 1.41.2.5 / (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.41.2.4: +14 -3 lines
Diff to previous 1.41.2.4 (colored) to branchpoint 1.41 (colored)

Sync the SMP branch with 3.3

Revision 1.56 / (download) - annotate - [select for diffs], Mon Dec 30 21:50:29 2002 UTC (21 years, 5 months ago) by grange
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.55: +2 -1 lines
Diff to previous 1.55 (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.51.4.2 / (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.51.4.1: +9 -3 lines
Diff to previous 1.51.4.1 (colored) to branchpoint 1.51 (colored)

sync to -current

Revision 1.55 / (download) - annotate - [select for diffs], Wed Sep 4 23:07:28 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.54: +8 -1 lines
Diff to previous 1.54 (colored)

Add support for RBC (simplified direct) devices.
ok costa@, krw@

Revision 1.54 / (download) - annotate - [select for diffs], Mon Aug 12 06:59:46 2002 UTC (21 years, 10 months ago) by fgsch
Branch: MAIN
Changes since 1.53: +2 -3 lines
Diff to previous 1.53 (colored)

initialize part earlier in case of debugging.

Revision 1.51.4.1 / (download) - annotate - [select for diffs], Tue Jun 11 03:32:14 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.51: +21 -17 lines
Diff to previous 1.51 (colored)

Sync UBC branch to -current

Revision 1.53 / (download) - annotate - [select for diffs], Sun Jun 9 00:05:57 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.52: +6 -2 lines
Diff to previous 1.52 (colored)

More (the last round?) of splasserts and splbio around biodone.

Revision 1.41.2.4 / (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.41.2.3: +16 -16 lines
Diff to previous 1.41.2.3 (colored) to branchpoint 1.41 (colored)

Merge in -current from roughly a week ago

Revision 1.52 / (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.51: +16 -16 lines
Diff to previous 1.51 (colored)

First round of __P removal in sys

Revision 1.41.2.3 / (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.41.2.2: +3 -16 lines
Diff to previous 1.41.2.2 (colored) to branchpoint 1.41 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.51 / (download) - annotate - [select for diffs], Mon Oct 8 01:50:48 2001 UTC (22 years, 8 months ago) by drahn
Branch: MAIN
CVS Tags: UBC_BASE, OPENBSD_3_0_BASE, OPENBSD_3_0
Branch point for: UBC
Changes since 1.50: +2 -1 lines
Diff to previous 1.50 (colored)

Add a new quirk type, SDEV_NOCDB6, some USB devices like ATAPI
do not support 6 byte CDBs.
This quirk is used for OLYMPUS USB cameras.
Loosely based on code in FreeBSD.
ok costa@

Revision 1.50 / (download) - annotate - [select for diffs], Sun Aug 26 00:45:08 2001 UTC (22 years, 9 months ago) by fgsch
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

remove useless INUSE references from scsi_xfer->flags; art@ miod@ ok.

Revision 1.49 / (download) - annotate - [select for diffs], Mon Aug 6 20:50:25 2001 UTC (22 years, 10 months ago) by miod
Branch: MAIN
Changes since 1.48: +1 -15 lines
Diff to previous 1.48 (colored)

Remove legacy __BDEVSW_DUMP_OLD_TYPE code.

Revision 1.41.2.2 / (download) - annotate - [select for diffs], Wed Jul 4 11:00:07 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.41.2.1: +10 -12 lines
Diff to previous 1.41.2.1 (colored) to branchpoint 1.41 (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.48 / (download) - annotate - [select for diffs], Fri Jun 22 14:35:43 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.47: +10 -12 lines
Diff to previous 1.47 (colored)

KNF

Revision 1.41.2.1 / (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.41: +180 -93 lines
Diff to previous 1.41 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.47 / (download) - annotate - [select for diffs], Wed Dec 13 15:33:24 2000 UTC (23 years, 6 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.46: +1 -7 lines
Diff to previous 1.46 (colored)

move back to unlimitted openings

Revision 1.46 / (download) - annotate - [select for diffs], Fri Oct 13 17:55:00 2000 UTC (23 years, 8 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.45: +7 -1 lines
Diff to previous 1.45 (colored)

Matthew Jacob <mjacob@feral.com>:
Mickey did the right thing, but we'll have to figure out what that broke as
well.

Revision 1.45 / (download) - annotate - [select for diffs], Thu Sep 21 17:57:19 2000 UTC (23 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.44: +47 -53 lines
Diff to previous 1.44 (colored)

do not limit openings to defined SDOUTSTANDING value of 4, since many controllers can do more; presumably all the cotrollers initialize openings to the right value; also replace some spaces w/ tabs

Revision 1.44 / (download) - annotate - [select for diffs], Wed Sep 20 00:58:03 2000 UTC (23 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.43: +3 -1 lines
Diff to previous 1.43 (colored)

make SDOUTSTANDING redefinable, since some controller can handle more than 4 xfers simultaneously; deraadt@ ok

Revision 1.43 / (download) - annotate - [select for diffs], Tue Apr 18 05:53:17 2000 UTC (24 years, 1 month ago) by csapuntz
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.42: +170 -79 lines
Diff to previous 1.42 (colored)



sd and scsibus detach

cdlock/cdunlock now through disk_lock/disk_unlock

Revision 1.42 / (download) - annotate - [select for diffs], Sat Apr 8 19:19:33 2000 UTC (24 years, 2 months ago) by csapuntz
Branch: MAIN
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)



These days, attach can occur outside the tsleep-restricted world of
BSD autoconf.

Don't use POLL & NOSLEEP mode if attaching after autoconf

Revision 1.41 / (download) - annotate - [select for diffs], Sun Dec 5 02:49:17 1999 UTC (24 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: kame_19991208, SMP_BASE
Branch point for: SMP
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

correct printout labels

Revision 1.40 / (download) - annotate - [select for diffs], Tue Aug 24 01:20:22 1999 UTC (24 years, 9 months ago) by csapuntz
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.39: +4 -2 lines
Diff to previous 1.39 (colored)



Added type field to scsi_addr to reflect bus/device type (ATAPI or SCSI).
Updated ioctls to match

Minor patches in anticipation of wd->sd translation layer

Revision 1.39 / (download) - annotate - [select for diffs], Tue Aug 10 23:09:49 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +5 -1 lines
Diff to previous 1.38 (colored)

support DIOCRLDINFO

Revision 1.38 / (download) - annotate - [select for diffs], Sun Jul 25 11:13:08 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +2 -3 lines
Diff to previous 1.37 (colored)

gets even worse..

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jul 25 11:12:32 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.36: +2 -3 lines
Diff to previous 1.36 (colored)

another costa bug.. erk

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jul 25 07:09:19 1999 UTC (24 years, 10 months ago) by csapuntz
Branch: MAIN
Changes since 1.35: +194 -236 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Fri Jul 23 06:17:09 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +3 -2 lines
Diff to previous 1.34 (colored)

use READ_BIG for atapi; LS-120 works now

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jul 22 23:06:51 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +10 -4 lines
Diff to previous 1.33 (colored)

for drives <10MB of so, print #.##MB for the size

Revision 1.33 / (download) - annotate - [select for diffs], Sun May 9 20:41:48 1999 UTC (25 years, 1 month ago) by weingart
Branch: MAIN
Changes since 1.32: +18 -7 lines
Diff to previous 1.32 (colored)

Fix sdsize() to not call sdopen()/sdclose() unless it is needed.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Oct 4 01:37:55 1998 UTC (25 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.31: +23 -11 lines
Diff to previous 1.31 (colored)

Add DIOCGPDINFO support

Revision 1.31 / (download) - annotate - [select for diffs], Sat Oct 3 21:19:01 1998 UTC (25 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Add a "spoofonly" argument to readdisklabel() which will be used to
implement an ioctl to get a spoofed label even for disks that have
a label on them.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 1 05:11:11 1998 UTC (25 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.29: +44 -3 lines
Diff to previous 1.29 (colored)

Put vendor + model in spoofed label, not 'fictious'

Revision 1.29 / (download) - annotate - [select for diffs], Sat May 2 16:48:21 1998 UTC (26 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.28: +6 -6 lines
Diff to previous 1.28 (colored)

Set blksize to DEV_BSIZE, not 512.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Apr 25 00:38:13 1998 UTC (26 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.27: +8 -2 lines
Diff to previous 1.27 (colored)

set d_bbsize and d_sbsize in spoofed label to values correct for ffs

Revision 1.27 / (download) - annotate - [select for diffs], Fri Mar 27 18:40:53 1998 UTC (26 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.26: +7 -5 lines
Diff to previous 1.26 (colored)

Fix strncpy usage and call a cdrom a cdrom in the fake label

Revision 1.26 / (download) - annotate - [select for diffs], Sat Oct 18 10:37:19 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

avoid "no disklabel" error messages

Revision 1.25 / (download) - annotate - [select for diffs], Fri Aug 8 21:47:06 1997 UTC (26 years, 10 months ago) by niklas
Branch: MAIN
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

Change the bounds_check_with_label API to also take a cpu_disklabel
reference for making transferral of meta-information possible from
readdisklabel to bounds_check_with_label.  The first (and maybe only)
thing that will use this is the multi-disklabel-format code on the
alpha where the labelsector is passed via cpu_disklabel so the label
write-protection can work correctly no matter what label was found.

Also use a new macro DKBAD to get at the dkbad field of the cpu_disklabel
implementations that contain it.  This too is for multi-disklabel
architectures where the "bad" field can be inside a union.  Use this
macro as a means for a driver to check if an architecture supports
dkbad constructs.

Remove proto of bounds_check_with_label from all MD disklabel.h as it
is in sys/disklabel.h.

I have not been able to test the changes everywhere, if I break anything
I apologize, and promise to fix it as soon as I become aware of it.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Jul 26 21:07:36 1997 UTC (26 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Report total number of blocks for a scsi disk since on modern drives
total sectors > cyl * head * sec/head.  Inspired by der Mouse
<mouse@rodents.montreal.qc.ca>

Revision 1.23 / (download) - annotate - [select for diffs], Mon Apr 14 04:09:16 1997 UTC (27 years, 2 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.22: +150 -74 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Sat Jan 4 08:50:21 1997 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +7 -6 lines
Diff to previous 1.21 (colored)

readdisklabel() with correct dev_t

Revision 1.21 / (download) - annotate - [select for diffs], Wed Dec 11 19:08:18 1996 UTC (27 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

b_resid cleanups, pointed out by minoura@kw.netlaputa.or.jp in netbsd pr#3007

Revision 1.20 / (download) - annotate - [select for diffs], Tue Dec 3 08:08:00 1996 UTC (27 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

clear sense buffer for mode sense 4, dms@celtech.com

Revision 1.19 / (download) - annotate - [select for diffs], Thu Oct 31 01:09:25 1996 UTC (27 years, 7 months ago) by niklas
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

$OpenBSD RCSIDs + comment fix in sd.c

Revision 1.18 / (download) - annotate - [select for diffs], Wed Aug 7 00:09:17 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.17: +4 -2 lines
Diff to previous 1.17 (colored)

disk_unbusy if op failed to enqueue

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jul 12 08:57:57 1996 UTC (27 years, 11 months ago) by pefo
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

Fixed wrong type of argument passing for SCIOCREASSIGN.
(thanks Theo).

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jul 11 22:17:46 1996 UTC (27 years, 11 months ago) by pefo
Branch: MAIN
Changes since 1.15: +8 -1 lines
Diff to previous 1.15 (colored)

Make use of existing SCSI block reassign code.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jun 16 03:07:21 1996 UTC (28 years ago) by downsj
Branch: MAIN
Changes since 1.14: +32 -4 lines
Diff to previous 1.14 (colored)

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

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jun 10 07:31:20 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.13: +9 -2 lines
Diff to previous 1.13 (colored)

do not check SDEV_MEDIA_LOADED because it does not matter

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jun 10 00:44:00 1996 UTC (28 years ago) by downsj
Branch: MAIN
Changes since 1.12: +38 -18 lines
Diff to previous 1.12 (colored)

Several changes:
	* Implemented NetBSD PR#2529, adding ZIP 100.
	* Added MTIOCTOP support to acd, cd, and sd.
	* Implemented eject on close for acd, cd, and sd.

`mt -f /dev/rcd0d offline' now ejects a mounted {acd|cd|sd} when it is
unmounted.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jun 1 09:35:03 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.11: +2 -4 lines
Diff to previous 1.11 (colored)

all ports have dk_establish

Revision 1.11 / (download) - annotate - [select for diffs], Wed May 22 11:57:30 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.10: +9 -7 lines
Diff to previous 1.10 (colored)

unload after last close

Revision 1.10 / (download) - annotate - [select for diffs], Fri May 10 12:31:39 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

SC_DEBUG cleanup

Revision 1.9 / (download) - annotate - [select for diffs], Mon May 6 11:33:37 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.8: +4 -4 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:55 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:31:10 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +39 -88 lines
Diff to previous 1.6 (colored)

partial sync with netbsd 960418, more to come

Revision 1.6 / (download) - annotate - [select for diffs], Fri Apr 19 16:10:17 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.5: +6 -3 lines
Diff to previous 1.5 (colored)

NetBSD 960317 merge

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

Sync w/ NetBSD:
- Implement DIOCLOCK and DIOCEJECT.  DIOCEJECT is limited to removable
  media.  Fixes PR #1975.
- scsi prototypes

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jan 14 21:44:30 1996 UTC (28 years, 5 months ago) by briggs
Branch: MAIN
Changes since 1.3: +5 -4 lines
Diff to previous 1.3 (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.3 / (download) - annotate - [select for diffs], Fri Jan 12 20:21:33 1996 UTC (28 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +52 -29 lines
Diff to previous 1.2 (colored)

from netbsd;
New generic disk framework.  Highlights:
New metrics handling.  Metrics are now kept in the new `struct disk'.
Busy time is now stored as a timeval, and transfer count in bytes.
Storage for disklabels is now dynamically allocated, so that the size
of the disk structure is not machine-dependent.
Several new functions for attaching and detaching disks, and handling
metrics calculation.
Old-style instrumentation is still supported in drivers that did it
before.  However, old-style instrumentation is being deprecated, and
will go away once the userland utilities are updated for the new
framework.
For usage and architectural details, see the forthcoming disk(9)
manual page.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Dec 14 05:56:35 1995 UTC (28 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +77 -20 lines
Diff to previous 1.1 (colored)

from netbsd:
If the read or write request can fit into a 6-byte cdb, then
use a 6-byte cdb, otherwise use the 10-byte as before.
In sdattach(), make a note if the device is "ancient" (i.e.
inqbuf.version & SID_ANSII == 0).
Implement sdminphys(): if the device is "ancient", shorten the
transfer so it will fit into a 6-byte cdb.

In sdminphys(), add a comment about the semantics of the "length" field
in a 6-byte read/write cdb (namely, length == 0 really means 256), and
that we handle this conservatively by limiting the transfer to 255 blocks.
*sigh* One just never knows how a pre-scsi-1 device is going to behave.

Remove a couple of now unneeded assignments.

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.