History log of /netbsd-current/sys/dev/scsipi/ch.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.95 26-Sep-2021 thorpej

Use seltrue_filtops rather than rolling our own with filt_seltrue.


# 1.94 26-Sep-2021 thorpej

Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.93 18-Dec-2020 thorpej

Use sel{record,remove}_knote().


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.92 25-Oct-2017 maya

branches: 1.92.18;
Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.91 20-Nov-2016 mlelstv

Make scsipi framework MPSAFE.

Data structures are now protected by a per-adapter mutex at IPL_BIO
that is created by the scsibus or atapibus instance when the adapter
is configured.
The enable reference counter and the channel freeze counter which are
currently used by HBA code before the adapter is configured, are made
atomic.
The target drivers are now all tagged as D_MPSAFE.

Almost all HBA drivers still require the kernel lock to present,
so all callbacks into HBA code are still protected by kernel lock
unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.

TODO: refactor sd and cd to use dksubr.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.90 25-Jul-2014 dholland

branches: 1.90.4; 1.90.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.89 16-Mar-2014 dholland

branches: 1.89.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.88 09-Aug-2013 kardel

bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.87 27-Oct-2012 chs

branches: 1.87.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.86 23-Nov-2009 rmind

branches: 1.86.12; 1.86.22;
Remove some unecessary includes sys/user.h header.


Revision tags: jym-xensuspend-nbase
# 1.85 21-Oct-2009 rmind

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.84 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.83 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base mjf-devfs2-base
# 1.82 08-Jun-2008 tsutsui

branches: 1.82.12;
Use device_lookup_private() rather than using cd_devs[] directly to get softc.

XXX maybe we should change a type of cd_devs[] in struct cfdriver
from (void *) to device_t.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.81 28-Apr-2008 martin

branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.80 05-Apr-2008 cegger

branches: 1.80.2; 1.80.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.79 01-Mar-2008 rmind

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase mjf-devfs-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.78 05-Dec-2007 pooka

branches: 1.78.8; 1.78.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 1.77 04-Mar-2007 christos

branches: 1.77.14; 1.77.16; 1.77.22; 1.77.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.76 16-Nov-2006 christos

branches: 1.76.4;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.75 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.74 28-Aug-2006 christos

branches: 1.74.2; 1.74.4;
add missing initializer


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base simonb-timecounters-base
# 1.73 30-Mar-2006 thorpej

Use device_private().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.72 11-Dec-2005 christos

branches: 1.72.4; 1.72.6; 1.72.8; 1.72.10; 1.72.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.71 30-May-2005 christos

branches: 1.71.2;
- remove bogus casts
- add more const


Revision tags: kent-audio2-base
# 1.70 25-Apr-2005 drochner

fix more SSD_RCODE_VALID misuse introduced in cleanup


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base
# 1.69 27-Feb-2005 perry

nuke trailing whitespace


# 1.68 21-Feb-2005 thorpej

Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.


Revision tags: yamt-km-base2
# 1.67 01-Feb-2005 reinoud

Backing out changes to clean up scsipi. I was pointed out there were
problems i hadn't seen. To prevent lossage i'd decided to back off all
changes and let them be reviewed on tech-kern.


# 1.66 31-Jan-2005 reinoud

Fix LP64 problems introduced by my u_long->uint32_t conversion.


# 1.65 31-Jan-2005 reinoud

Part of the cleanup of sys/scsipi's use of types; rename all u_int* to
uint* and change the u_long's to uint32_t's where possible. Note that the
iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.64 18-Sep-2004 mycroft

branches: 1.64.4; 1.64.6;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.


# 1.63 17-Sep-2004 mycroft

Remove the "xfer" argument to scsipi_command().


# 1.62 09-Sep-2004 bouyer

Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


# 1.61 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


# 1.60 23-Jun-2004 seb

Remove special handling of ASC/ASCQ 0x29/0x00 ("Power On, Reset, or Bus
Device Reset Occurred") when the device is not opened. So let the default
error handler deal with that.

This fix the retrieval of the sense page during autoconfig.

Provided by mycroft@.
Approved by bouyer@.


# 1.59 23-Apr-2004 itojun

use bounded string ops


Revision tags: netbsd-2-0-base
# 1.58 08-Sep-2003 mycroft

branches: 1.58.2;
Use the const shaker.


# 1.57 29-Jun-2003 fvdl

branches: 1.57.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.56 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.55 26-Nov-2002 christos

si_ -> sel_


Revision tags: kqueue-aftermerge
# 1.54 23-Oct-2002 jdolecek

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe


Revision tags: kqueue-beforemerge kqueue-base
# 1.53 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.52 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.51 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.50 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.49 06-May-2002 bouyer

branches: 1.49.2;
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.48 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.47 18-Jul-2001 thorpej

branches: 1.47.2;
bzero -> memset


# 1.46 19-Jun-2001 lukem

branches: 1.46.2;
delint


# 1.45 14-May-2001 bouyer

Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.


# 1.44 25-Apr-2001 bouyer

Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base thorpej_scsipi_base
# 1.43 09-Jun-2000 enami

branches: 1.43.4;
Prevent a process being swapped out during I/O if the data buffer is
allocated on stack. This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.


Revision tags: minoura-xpg4dl-base chs-ubc2-newbase
# 1.42 04-Jan-2000 mjacob

branches: 1.42.2;
oops, bad patch


# 1.41 04-Jan-2000 mjacob

- If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
we don't really support that yet. Also, key more correctly off of ASC/ASCQ
instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
we get params (from chopen time even) a policy decision that is not the
default for now- this can be a dangerous practice as well as time consuming.
It's dangerous in that you can have a hung open when all you really want
to do is do a read of parameters- and parameters, including slot status,
are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
done- all the elements whos status your read are going to be marked with
an exception- so leave it up to the application to decide how important
this is.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.40 30-Sep-1999 thorpej

branches: 1.40.2;
Cleanup the scsipi_xfer flags:
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.


# 1.39 09-Sep-1999 thorpej

Rework the changer driver a bit:
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.


Revision tags: chs-ubc2-base
# 1.38 04-Apr-1999 bouyer

Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.


Revision tags: netbsd-1-4-base
# 1.37 17-Dec-1998 gibbs

branches: 1.37.2;
Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.


Revision tags: kenh-if-detach-base
# 1.36 08-Dec-1998 thorpej

When closing, wait for pending xfers to drain before deleting the reference
to the adapter.


# 1.35 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.34 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


Revision tags: eeh-paddr_t-base
# 1.33 03-Jul-1998 mjacob

kern/5514: take the submitter's advice, at least partially. The time it
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.

I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.

As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.


# 1.32 12-Jan-1998 thorpej

Adjust for changes to config.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.31 18-Oct-1997 thorpej

Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.


Revision tags: marc-pcmcia-base
# 1.30 01-Oct-1997 thorpej

Add missing SCSI_DATA_IN when issuing a READ_ELEMENT_STATUS command.
Noticed by Dave Huang <khym@bga.com>.


# 1.29 01-Oct-1997 enami

Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.


# 1.28 29-Sep-1997 mjacob

Add 'initialize element status' command; note (for future fixing in ch.c)
that a number of jukeboxes can't cope with DBD (disable block descriptors)-
we'll have to fix that some day.


Revision tags: thorpej-signal-base
# 1.27 27-Aug-1997 bouyer

branches: 1.27.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.


# 1.26 21-Feb-1997 thorpej

- Tidy up some printf code in chattach().
- Implement a simple quirks framework for changers.
- Add a quirk for the Spectra 9000 8mm tape library; it requires a
slightly-longer-than-1-minute delay to take tape inventory. Many
thanks to David Webster at Cygnus Solutions for testing this for me.


# 1.25 05-Dec-1996 cgd

branches: 1.25.6;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.24 12-Oct-1996 christos

revert previous kprintf change


# 1.23 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.22 18-Sep-1996 thorpej

For ioctl commands which may change the device's state, ensure that
the caller has the device open for writing.


# 1.21 19-Apr-1996 christos

branches: 1.21.4;
gcc -Wall delinting: unused variables, assignments inside if's and missing
arguments in printf statements.


# 1.20 03-Apr-1996 thorpej

New SCSI media changer driver, written from scratch by me. Some
influence from the old driver (written by Stefan Grefen) and from
an autochanger driver written by the Systems Programming Group at the
University of Utah Computer Science Department (currently residing
in src/sys/arch/hp300/dev/ac.c).


# 1.19 30-Mar-1996 christos

Eliminate scsi_conf.h.


# 1.18 19-Mar-1996 mycroft

Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.


# 1.17 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.16 05-Mar-1996 thorpej

Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1958.


# 1.15 14-Feb-1996 christos

scsi prototypes


# 1.14 16-Jan-1995 mycroft

Remove unused macros.


# 1.13 28-Dec-1994 mycroft

Numerous changes. Many bugs fixed, better autoconfig, a few new features.


# 1.12 21-Nov-1994 mycroft

Clean up open and close routines somewhat.


# 1.11 21-Nov-1994 mycroft

Replace dev_unit with device_softc in scsi_link. Change argument to foostart()
to void*.


# 1.10 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.9 20-Oct-1994 mycroft

First cut at making user-level SCSI commands work. This is untested.
Partly from John Brezak.


# 1.8 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.7 11-Apr-1994 mycroft

Fix various types. Remove some outdated flags.


# 1.6 29-Mar-1994 mycroft

New SCSI system, based on Julian's more recent work.


# 1.5 17-Dec-1993 mycroft

Canonicalize all #includes.


# 1.4 01-Aug-1993 mycroft

branches: 1.4.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


# 1.3 20-May-1993 cgd

branches: 1.3.2;
add rcsids and clean up file headers


# 1.2 20-Apr-1993 mycroft

Display more meaningful message on SCSI `unit attention'.


# 1.1 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.94 26-Sep-2021 thorpej

Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.93 18-Dec-2020 thorpej

Use sel{record,remove}_knote().


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.92 25-Oct-2017 maya

branches: 1.92.18;
Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.91 20-Nov-2016 mlelstv

Make scsipi framework MPSAFE.

Data structures are now protected by a per-adapter mutex at IPL_BIO
that is created by the scsibus or atapibus instance when the adapter
is configured.
The enable reference counter and the channel freeze counter which are
currently used by HBA code before the adapter is configured, are made
atomic.
The target drivers are now all tagged as D_MPSAFE.

Almost all HBA drivers still require the kernel lock to present,
so all callbacks into HBA code are still protected by kernel lock
unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.

TODO: refactor sd and cd to use dksubr.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.90 25-Jul-2014 dholland

branches: 1.90.4; 1.90.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.89 16-Mar-2014 dholland

branches: 1.89.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.88 09-Aug-2013 kardel

bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.87 27-Oct-2012 chs

branches: 1.87.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.86 23-Nov-2009 rmind

branches: 1.86.12; 1.86.22;
Remove some unecessary includes sys/user.h header.


Revision tags: jym-xensuspend-nbase
# 1.85 21-Oct-2009 rmind

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.84 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.83 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base mjf-devfs2-base
# 1.82 08-Jun-2008 tsutsui

branches: 1.82.12;
Use device_lookup_private() rather than using cd_devs[] directly to get softc.

XXX maybe we should change a type of cd_devs[] in struct cfdriver
from (void *) to device_t.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.81 28-Apr-2008 martin

branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.80 05-Apr-2008 cegger

branches: 1.80.2; 1.80.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.79 01-Mar-2008 rmind

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase mjf-devfs-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.78 05-Dec-2007 pooka

branches: 1.78.8; 1.78.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 1.77 04-Mar-2007 christos

branches: 1.77.14; 1.77.16; 1.77.22; 1.77.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.76 16-Nov-2006 christos

branches: 1.76.4;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.75 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.74 28-Aug-2006 christos

branches: 1.74.2; 1.74.4;
add missing initializer


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base simonb-timecounters-base
# 1.73 30-Mar-2006 thorpej

Use device_private().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.72 11-Dec-2005 christos

branches: 1.72.4; 1.72.6; 1.72.8; 1.72.10; 1.72.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.71 30-May-2005 christos

branches: 1.71.2;
- remove bogus casts
- add more const


Revision tags: kent-audio2-base
# 1.70 25-Apr-2005 drochner

fix more SSD_RCODE_VALID misuse introduced in cleanup


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base
# 1.69 27-Feb-2005 perry

nuke trailing whitespace


# 1.68 21-Feb-2005 thorpej

Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.


Revision tags: yamt-km-base2
# 1.67 01-Feb-2005 reinoud

Backing out changes to clean up scsipi. I was pointed out there were
problems i hadn't seen. To prevent lossage i'd decided to back off all
changes and let them be reviewed on tech-kern.


# 1.66 31-Jan-2005 reinoud

Fix LP64 problems introduced by my u_long->uint32_t conversion.


# 1.65 31-Jan-2005 reinoud

Part of the cleanup of sys/scsipi's use of types; rename all u_int* to
uint* and change the u_long's to uint32_t's where possible. Note that the
iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.64 18-Sep-2004 mycroft

branches: 1.64.4; 1.64.6;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.


# 1.63 17-Sep-2004 mycroft

Remove the "xfer" argument to scsipi_command().


# 1.62 09-Sep-2004 bouyer

Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


# 1.61 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


# 1.60 23-Jun-2004 seb

Remove special handling of ASC/ASCQ 0x29/0x00 ("Power On, Reset, or Bus
Device Reset Occurred") when the device is not opened. So let the default
error handler deal with that.

This fix the retrieval of the sense page during autoconfig.

Provided by mycroft@.
Approved by bouyer@.


# 1.59 23-Apr-2004 itojun

use bounded string ops


Revision tags: netbsd-2-0-base
# 1.58 08-Sep-2003 mycroft

branches: 1.58.2;
Use the const shaker.


# 1.57 29-Jun-2003 fvdl

branches: 1.57.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.56 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.55 26-Nov-2002 christos

si_ -> sel_


Revision tags: kqueue-aftermerge
# 1.54 23-Oct-2002 jdolecek

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe


Revision tags: kqueue-beforemerge kqueue-base
# 1.53 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.52 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.51 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.50 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.49 06-May-2002 bouyer

branches: 1.49.2;
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.48 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.47 18-Jul-2001 thorpej

branches: 1.47.2;
bzero -> memset


# 1.46 19-Jun-2001 lukem

branches: 1.46.2;
delint


# 1.45 14-May-2001 bouyer

Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.


# 1.44 25-Apr-2001 bouyer

Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base thorpej_scsipi_base
# 1.43 09-Jun-2000 enami

branches: 1.43.4;
Prevent a process being swapped out during I/O if the data buffer is
allocated on stack. This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.


Revision tags: minoura-xpg4dl-base chs-ubc2-newbase
# 1.42 04-Jan-2000 mjacob

branches: 1.42.2;
oops, bad patch


# 1.41 04-Jan-2000 mjacob

- If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
we don't really support that yet. Also, key more correctly off of ASC/ASCQ
instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
we get params (from chopen time even) a policy decision that is not the
default for now- this can be a dangerous practice as well as time consuming.
It's dangerous in that you can have a hung open when all you really want
to do is do a read of parameters- and parameters, including slot status,
are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
done- all the elements whos status your read are going to be marked with
an exception- so leave it up to the application to decide how important
this is.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.40 30-Sep-1999 thorpej

branches: 1.40.2;
Cleanup the scsipi_xfer flags:
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.


# 1.39 09-Sep-1999 thorpej

Rework the changer driver a bit:
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.


Revision tags: chs-ubc2-base
# 1.38 04-Apr-1999 bouyer

Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.


Revision tags: netbsd-1-4-base
# 1.37 17-Dec-1998 gibbs

branches: 1.37.2;
Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.


Revision tags: kenh-if-detach-base
# 1.36 08-Dec-1998 thorpej

When closing, wait for pending xfers to drain before deleting the reference
to the adapter.


# 1.35 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.34 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


Revision tags: eeh-paddr_t-base
# 1.33 03-Jul-1998 mjacob

kern/5514: take the submitter's advice, at least partially. The time it
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.

I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.

As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.


# 1.32 12-Jan-1998 thorpej

Adjust for changes to config.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.31 18-Oct-1997 thorpej

Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.


Revision tags: marc-pcmcia-base
# 1.30 01-Oct-1997 thorpej

Add missing SCSI_DATA_IN when issuing a READ_ELEMENT_STATUS command.
Noticed by Dave Huang <khym@bga.com>.


# 1.29 01-Oct-1997 enami

Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.


# 1.28 29-Sep-1997 mjacob

Add 'initialize element status' command; note (for future fixing in ch.c)
that a number of jukeboxes can't cope with DBD (disable block descriptors)-
we'll have to fix that some day.


Revision tags: thorpej-signal-base
# 1.27 27-Aug-1997 bouyer

branches: 1.27.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.


# 1.26 21-Feb-1997 thorpej

- Tidy up some printf code in chattach().
- Implement a simple quirks framework for changers.
- Add a quirk for the Spectra 9000 8mm tape library; it requires a
slightly-longer-than-1-minute delay to take tape inventory. Many
thanks to David Webster at Cygnus Solutions for testing this for me.


# 1.25 05-Dec-1996 cgd

branches: 1.25.6;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.24 12-Oct-1996 christos

revert previous kprintf change


# 1.23 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.22 18-Sep-1996 thorpej

For ioctl commands which may change the device's state, ensure that
the caller has the device open for writing.


# 1.21 19-Apr-1996 christos

branches: 1.21.4;
gcc -Wall delinting: unused variables, assignments inside if's and missing
arguments in printf statements.


# 1.20 03-Apr-1996 thorpej

New SCSI media changer driver, written from scratch by me. Some
influence from the old driver (written by Stefan Grefen) and from
an autochanger driver written by the Systems Programming Group at the
University of Utah Computer Science Department (currently residing
in src/sys/arch/hp300/dev/ac.c).


# 1.19 30-Mar-1996 christos

Eliminate scsi_conf.h.


# 1.18 19-Mar-1996 mycroft

Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.


# 1.17 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.16 05-Mar-1996 thorpej

Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1958.


# 1.15 14-Feb-1996 christos

scsi prototypes


# 1.14 16-Jan-1995 mycroft

Remove unused macros.


# 1.13 28-Dec-1994 mycroft

Numerous changes. Many bugs fixed, better autoconfig, a few new features.


# 1.12 21-Nov-1994 mycroft

Clean up open and close routines somewhat.


# 1.11 21-Nov-1994 mycroft

Replace dev_unit with device_softc in scsi_link. Change argument to foostart()
to void*.


# 1.10 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.9 20-Oct-1994 mycroft

First cut at making user-level SCSI commands work. This is untested.
Partly from John Brezak.


# 1.8 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.7 11-Apr-1994 mycroft

Fix various types. Remove some outdated flags.


# 1.6 29-Mar-1994 mycroft

New SCSI system, based on Julian's more recent work.


# 1.5 17-Dec-1993 mycroft

Canonicalize all #includes.


# 1.4 01-Aug-1993 mycroft

branches: 1.4.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


# 1.3 20-May-1993 cgd

branches: 1.3.2;
add rcsids and clean up file headers


# 1.2 20-Apr-1993 mycroft

Display more meaningful message on SCSI `unit attention'.


# 1.1 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.93 18-Dec-2020 thorpej

Use sel{record,remove}_knote().


Revision tags: thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.92 25-Oct-2017 maya

Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.91 20-Nov-2016 mlelstv

Make scsipi framework MPSAFE.

Data structures are now protected by a per-adapter mutex at IPL_BIO
that is created by the scsibus or atapibus instance when the adapter
is configured.
The enable reference counter and the channel freeze counter which are
currently used by HBA code before the adapter is configured, are made
atomic.
The target drivers are now all tagged as D_MPSAFE.

Almost all HBA drivers still require the kernel lock to present,
so all callbacks into HBA code are still protected by kernel lock
unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.

TODO: refactor sd and cd to use dksubr.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.90 25-Jul-2014 dholland

branches: 1.90.4; 1.90.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.89 16-Mar-2014 dholland

branches: 1.89.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.88 09-Aug-2013 kardel

bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.87 27-Oct-2012 chs

branches: 1.87.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.86 23-Nov-2009 rmind

branches: 1.86.12; 1.86.22;
Remove some unecessary includes sys/user.h header.


Revision tags: jym-xensuspend-nbase
# 1.85 21-Oct-2009 rmind

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.84 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.83 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base mjf-devfs2-base
# 1.82 08-Jun-2008 tsutsui

branches: 1.82.12;
Use device_lookup_private() rather than using cd_devs[] directly to get softc.

XXX maybe we should change a type of cd_devs[] in struct cfdriver
from (void *) to device_t.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.81 28-Apr-2008 martin

branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.80 05-Apr-2008 cegger

branches: 1.80.2; 1.80.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.79 01-Mar-2008 rmind

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase mjf-devfs-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.78 05-Dec-2007 pooka

branches: 1.78.8; 1.78.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 1.77 04-Mar-2007 christos

branches: 1.77.14; 1.77.16; 1.77.22; 1.77.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.76 16-Nov-2006 christos

branches: 1.76.4;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.75 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.74 28-Aug-2006 christos

branches: 1.74.2; 1.74.4;
add missing initializer


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base simonb-timecounters-base
# 1.73 30-Mar-2006 thorpej

Use device_private().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.72 11-Dec-2005 christos

branches: 1.72.4; 1.72.6; 1.72.8; 1.72.10; 1.72.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.71 30-May-2005 christos

branches: 1.71.2;
- remove bogus casts
- add more const


Revision tags: kent-audio2-base
# 1.70 25-Apr-2005 drochner

fix more SSD_RCODE_VALID misuse introduced in cleanup


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base
# 1.69 27-Feb-2005 perry

nuke trailing whitespace


# 1.68 21-Feb-2005 thorpej

Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.


Revision tags: yamt-km-base2
# 1.67 01-Feb-2005 reinoud

Backing out changes to clean up scsipi. I was pointed out there were
problems i hadn't seen. To prevent lossage i'd decided to back off all
changes and let them be reviewed on tech-kern.


# 1.66 31-Jan-2005 reinoud

Fix LP64 problems introduced by my u_long->uint32_t conversion.


# 1.65 31-Jan-2005 reinoud

Part of the cleanup of sys/scsipi's use of types; rename all u_int* to
uint* and change the u_long's to uint32_t's where possible. Note that the
iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.64 18-Sep-2004 mycroft

branches: 1.64.4; 1.64.6;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.


# 1.63 17-Sep-2004 mycroft

Remove the "xfer" argument to scsipi_command().


# 1.62 09-Sep-2004 bouyer

Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


# 1.61 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


# 1.60 23-Jun-2004 seb

Remove special handling of ASC/ASCQ 0x29/0x00 ("Power On, Reset, or Bus
Device Reset Occurred") when the device is not opened. So let the default
error handler deal with that.

This fix the retrieval of the sense page during autoconfig.

Provided by mycroft@.
Approved by bouyer@.


# 1.59 23-Apr-2004 itojun

use bounded string ops


Revision tags: netbsd-2-0-base
# 1.58 08-Sep-2003 mycroft

branches: 1.58.2;
Use the const shaker.


# 1.57 29-Jun-2003 fvdl

branches: 1.57.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.56 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.55 26-Nov-2002 christos

si_ -> sel_


Revision tags: kqueue-aftermerge
# 1.54 23-Oct-2002 jdolecek

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe


Revision tags: kqueue-beforemerge kqueue-base
# 1.53 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.52 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.51 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.50 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.49 06-May-2002 bouyer

branches: 1.49.2;
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.48 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.47 18-Jul-2001 thorpej

branches: 1.47.2;
bzero -> memset


# 1.46 19-Jun-2001 lukem

branches: 1.46.2;
delint


# 1.45 14-May-2001 bouyer

Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.


# 1.44 25-Apr-2001 bouyer

Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base thorpej_scsipi_base
# 1.43 09-Jun-2000 enami

branches: 1.43.4;
Prevent a process being swapped out during I/O if the data buffer is
allocated on stack. This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.


Revision tags: minoura-xpg4dl-base chs-ubc2-newbase
# 1.42 04-Jan-2000 mjacob

branches: 1.42.2;
oops, bad patch


# 1.41 04-Jan-2000 mjacob

- If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
we don't really support that yet. Also, key more correctly off of ASC/ASCQ
instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
we get params (from chopen time even) a policy decision that is not the
default for now- this can be a dangerous practice as well as time consuming.
It's dangerous in that you can have a hung open when all you really want
to do is do a read of parameters- and parameters, including slot status,
are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
done- all the elements whos status your read are going to be marked with
an exception- so leave it up to the application to decide how important
this is.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.40 30-Sep-1999 thorpej

branches: 1.40.2;
Cleanup the scsipi_xfer flags:
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.


# 1.39 09-Sep-1999 thorpej

Rework the changer driver a bit:
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.


Revision tags: chs-ubc2-base
# 1.38 04-Apr-1999 bouyer

Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.


Revision tags: netbsd-1-4-base
# 1.37 17-Dec-1998 gibbs

branches: 1.37.2;
Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.


Revision tags: kenh-if-detach-base
# 1.36 08-Dec-1998 thorpej

When closing, wait for pending xfers to drain before deleting the reference
to the adapter.


# 1.35 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.34 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


Revision tags: eeh-paddr_t-base
# 1.33 03-Jul-1998 mjacob

kern/5514: take the submitter's advice, at least partially. The time it
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.

I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.

As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.


# 1.32 12-Jan-1998 thorpej

Adjust for changes to config.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.31 18-Oct-1997 thorpej

Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.


Revision tags: marc-pcmcia-base
# 1.30 01-Oct-1997 thorpej

Add missing SCSI_DATA_IN when issuing a READ_ELEMENT_STATUS command.
Noticed by Dave Huang <khym@bga.com>.


# 1.29 01-Oct-1997 enami

Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.


# 1.28 29-Sep-1997 mjacob

Add 'initialize element status' command; note (for future fixing in ch.c)
that a number of jukeboxes can't cope with DBD (disable block descriptors)-
we'll have to fix that some day.


Revision tags: thorpej-signal-base
# 1.27 27-Aug-1997 bouyer

branches: 1.27.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.


# 1.26 21-Feb-1997 thorpej

- Tidy up some printf code in chattach().
- Implement a simple quirks framework for changers.
- Add a quirk for the Spectra 9000 8mm tape library; it requires a
slightly-longer-than-1-minute delay to take tape inventory. Many
thanks to David Webster at Cygnus Solutions for testing this for me.


# 1.25 05-Dec-1996 cgd

branches: 1.25.6;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.24 12-Oct-1996 christos

revert previous kprintf change


# 1.23 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.22 18-Sep-1996 thorpej

For ioctl commands which may change the device's state, ensure that
the caller has the device open for writing.


# 1.21 19-Apr-1996 christos

branches: 1.21.4;
gcc -Wall delinting: unused variables, assignments inside if's and missing
arguments in printf statements.


# 1.20 03-Apr-1996 thorpej

New SCSI media changer driver, written from scratch by me. Some
influence from the old driver (written by Stefan Grefen) and from
an autochanger driver written by the Systems Programming Group at the
University of Utah Computer Science Department (currently residing
in src/sys/arch/hp300/dev/ac.c).


# 1.19 30-Mar-1996 christos

Eliminate scsi_conf.h.


# 1.18 19-Mar-1996 mycroft

Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.


# 1.17 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.16 05-Mar-1996 thorpej

Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1958.


# 1.15 14-Feb-1996 christos

scsi prototypes


# 1.14 16-Jan-1995 mycroft

Remove unused macros.


# 1.13 28-Dec-1994 mycroft

Numerous changes. Many bugs fixed, better autoconfig, a few new features.


# 1.12 21-Nov-1994 mycroft

Clean up open and close routines somewhat.


# 1.11 21-Nov-1994 mycroft

Replace dev_unit with device_softc in scsi_link. Change argument to foostart()
to void*.


# 1.10 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.9 20-Oct-1994 mycroft

First cut at making user-level SCSI commands work. This is untested.
Partly from John Brezak.


# 1.8 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.7 11-Apr-1994 mycroft

Fix various types. Remove some outdated flags.


# 1.6 29-Mar-1994 mycroft

New SCSI system, based on Julian's more recent work.


# 1.5 17-Dec-1993 mycroft

Canonicalize all #includes.


# 1.4 01-Aug-1993 mycroft

branches: 1.4.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


# 1.3 20-May-1993 cgd

branches: 1.3.2;
add rcsids and clean up file headers


# 1.2 20-Apr-1993 mycroft

Display more meaningful message on SCSI `unit attention'.


# 1.1 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


# 1.92 25-Oct-2017 maya

Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};


Revision tags: matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.91 20-Nov-2016 mlelstv

Make scsipi framework MPSAFE.

Data structures are now protected by a per-adapter mutex at IPL_BIO
that is created by the scsibus or atapibus instance when the adapter
is configured.
The enable reference counter and the channel freeze counter which are
currently used by HBA code before the adapter is configured, are made
atomic.
The target drivers are now all tagged as D_MPSAFE.

Almost all HBA drivers still require the kernel lock to present,
so all callbacks into HBA code are still protected by kernel lock
unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.

TODO: refactor sd and cd to use dksubr.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.90 25-Jul-2014 dholland

branches: 1.90.4; 1.90.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.89 16-Mar-2014 dholland

branches: 1.89.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.88 09-Aug-2013 kardel

bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.87 27-Oct-2012 chs

branches: 1.87.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.86 23-Nov-2009 rmind

branches: 1.86.12; 1.86.22;
Remove some unecessary includes sys/user.h header.


Revision tags: jym-xensuspend-nbase
# 1.85 21-Oct-2009 rmind

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.84 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.83 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base mjf-devfs2-base
# 1.82 08-Jun-2008 tsutsui

branches: 1.82.12;
Use device_lookup_private() rather than using cd_devs[] directly to get softc.

XXX maybe we should change a type of cd_devs[] in struct cfdriver
from (void *) to device_t.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.81 28-Apr-2008 martin

branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.80 05-Apr-2008 cegger

branches: 1.80.2; 1.80.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.79 01-Mar-2008 rmind

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase mjf-devfs-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.78 05-Dec-2007 pooka

branches: 1.78.8; 1.78.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 1.77 04-Mar-2007 christos

branches: 1.77.14; 1.77.16; 1.77.22; 1.77.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.76 16-Nov-2006 christos

branches: 1.76.4;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.75 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.74 28-Aug-2006 christos

branches: 1.74.2; 1.74.4;
add missing initializer


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base simonb-timecounters-base
# 1.73 30-Mar-2006 thorpej

Use device_private().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.72 11-Dec-2005 christos

branches: 1.72.4; 1.72.6; 1.72.8; 1.72.10; 1.72.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.71 30-May-2005 christos

branches: 1.71.2;
- remove bogus casts
- add more const


Revision tags: kent-audio2-base
# 1.70 25-Apr-2005 drochner

fix more SSD_RCODE_VALID misuse introduced in cleanup


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base
# 1.69 27-Feb-2005 perry

nuke trailing whitespace


# 1.68 21-Feb-2005 thorpej

Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.


Revision tags: yamt-km-base2
# 1.67 01-Feb-2005 reinoud

Backing out changes to clean up scsipi. I was pointed out there were
problems i hadn't seen. To prevent lossage i'd decided to back off all
changes and let them be reviewed on tech-kern.


# 1.66 31-Jan-2005 reinoud

Fix LP64 problems introduced by my u_long->uint32_t conversion.


# 1.65 31-Jan-2005 reinoud

Part of the cleanup of sys/scsipi's use of types; rename all u_int* to
uint* and change the u_long's to uint32_t's where possible. Note that the
iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.64 18-Sep-2004 mycroft

branches: 1.64.4; 1.64.6;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.


# 1.63 17-Sep-2004 mycroft

Remove the "xfer" argument to scsipi_command().


# 1.62 09-Sep-2004 bouyer

Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


# 1.61 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


# 1.60 23-Jun-2004 seb

Remove special handling of ASC/ASCQ 0x29/0x00 ("Power On, Reset, or Bus
Device Reset Occurred") when the device is not opened. So let the default
error handler deal with that.

This fix the retrieval of the sense page during autoconfig.

Provided by mycroft@.
Approved by bouyer@.


# 1.59 23-Apr-2004 itojun

use bounded string ops


Revision tags: netbsd-2-0-base
# 1.58 08-Sep-2003 mycroft

branches: 1.58.2;
Use the const shaker.


# 1.57 29-Jun-2003 fvdl

branches: 1.57.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.56 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.55 26-Nov-2002 christos

si_ -> sel_


Revision tags: kqueue-aftermerge
# 1.54 23-Oct-2002 jdolecek

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe


Revision tags: kqueue-beforemerge kqueue-base
# 1.53 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.52 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.51 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.50 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.49 06-May-2002 bouyer

branches: 1.49.2;
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.48 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.47 18-Jul-2001 thorpej

branches: 1.47.2;
bzero -> memset


# 1.46 19-Jun-2001 lukem

branches: 1.46.2;
delint


# 1.45 14-May-2001 bouyer

Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.


# 1.44 25-Apr-2001 bouyer

Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base thorpej_scsipi_base
# 1.43 09-Jun-2000 enami

branches: 1.43.4;
Prevent a process being swapped out during I/O if the data buffer is
allocated on stack. This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.


Revision tags: minoura-xpg4dl-base chs-ubc2-newbase
# 1.42 04-Jan-2000 mjacob

branches: 1.42.2;
oops, bad patch


# 1.41 04-Jan-2000 mjacob

- If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
we don't really support that yet. Also, key more correctly off of ASC/ASCQ
instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
we get params (from chopen time even) a policy decision that is not the
default for now- this can be a dangerous practice as well as time consuming.
It's dangerous in that you can have a hung open when all you really want
to do is do a read of parameters- and parameters, including slot status,
are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
done- all the elements whos status your read are going to be marked with
an exception- so leave it up to the application to decide how important
this is.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.40 30-Sep-1999 thorpej

branches: 1.40.2;
Cleanup the scsipi_xfer flags:
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.


# 1.39 09-Sep-1999 thorpej

Rework the changer driver a bit:
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.


Revision tags: chs-ubc2-base
# 1.38 04-Apr-1999 bouyer

Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.


Revision tags: netbsd-1-4-base
# 1.37 17-Dec-1998 gibbs

branches: 1.37.2;
Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.


Revision tags: kenh-if-detach-base
# 1.36 08-Dec-1998 thorpej

When closing, wait for pending xfers to drain before deleting the reference
to the adapter.


# 1.35 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.34 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


Revision tags: eeh-paddr_t-base
# 1.33 03-Jul-1998 mjacob

kern/5514: take the submitter's advice, at least partially. The time it
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.

I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.

As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.


# 1.32 12-Jan-1998 thorpej

Adjust for changes to config.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.31 18-Oct-1997 thorpej

Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.


Revision tags: marc-pcmcia-base
# 1.30 01-Oct-1997 thorpej

Add missing SCSI_DATA_IN when issuing a READ_ELEMENT_STATUS command.
Noticed by Dave Huang <khym@bga.com>.


# 1.29 01-Oct-1997 enami

Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.


# 1.28 29-Sep-1997 mjacob

Add 'initialize element status' command; note (for future fixing in ch.c)
that a number of jukeboxes can't cope with DBD (disable block descriptors)-
we'll have to fix that some day.


Revision tags: thorpej-signal-base
# 1.27 27-Aug-1997 bouyer

branches: 1.27.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.


# 1.26 21-Feb-1997 thorpej

- Tidy up some printf code in chattach().
- Implement a simple quirks framework for changers.
- Add a quirk for the Spectra 9000 8mm tape library; it requires a
slightly-longer-than-1-minute delay to take tape inventory. Many
thanks to David Webster at Cygnus Solutions for testing this for me.


# 1.25 05-Dec-1996 cgd

branches: 1.25.6;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.24 12-Oct-1996 christos

revert previous kprintf change


# 1.23 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.22 18-Sep-1996 thorpej

For ioctl commands which may change the device's state, ensure that
the caller has the device open for writing.


# 1.21 19-Apr-1996 christos

branches: 1.21.4;
gcc -Wall delinting: unused variables, assignments inside if's and missing
arguments in printf statements.


# 1.20 03-Apr-1996 thorpej

New SCSI media changer driver, written from scratch by me. Some
influence from the old driver (written by Stefan Grefen) and from
an autochanger driver written by the Systems Programming Group at the
University of Utah Computer Science Department (currently residing
in src/sys/arch/hp300/dev/ac.c).


# 1.19 30-Mar-1996 christos

Eliminate scsi_conf.h.


# 1.18 19-Mar-1996 mycroft

Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.


# 1.17 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.16 05-Mar-1996 thorpej

Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1958.


# 1.15 14-Feb-1996 christos

scsi prototypes


# 1.14 16-Jan-1995 mycroft

Remove unused macros.


# 1.13 28-Dec-1994 mycroft

Numerous changes. Many bugs fixed, better autoconfig, a few new features.


# 1.12 21-Nov-1994 mycroft

Clean up open and close routines somewhat.


# 1.11 21-Nov-1994 mycroft

Replace dev_unit with device_softc in scsi_link. Change argument to foostart()
to void*.


# 1.10 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.9 20-Oct-1994 mycroft

First cut at making user-level SCSI commands work. This is untested.
Partly from John Brezak.


# 1.8 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.7 11-Apr-1994 mycroft

Fix various types. Remove some outdated flags.


# 1.6 29-Mar-1994 mycroft

New SCSI system, based on Julian's more recent work.


# 1.5 17-Dec-1993 mycroft

Canonicalize all #includes.


# 1.4 01-Aug-1993 mycroft

branches: 1.4.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


# 1.3 20-May-1993 cgd

branches: 1.3.2;
add rcsids and clean up file headers


# 1.2 20-Apr-1993 mycroft

Display more meaningful message on SCSI `unit attention'.


# 1.1 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


Revision tags: nick-nhusb-base-20161204
# 1.91 20-Nov-2016 mlelstv

Make scsipi framework MPSAFE.

Data structures are now protected by a per-adapter mutex at IPL_BIO
that is created by the scsibus or atapibus instance when the adapter
is configured.
The enable reference counter and the channel freeze counter which are
currently used by HBA code before the adapter is configured, are made
atomic.
The target drivers are now all tagged as D_MPSAFE.

Almost all HBA drivers still require the kernel lock to present,
so all callbacks into HBA code are still protected by kernel lock
unless the driver is tagged as SCSIPI_ADAPT_MPSAFE.

TODO: refactor sd and cd to use dksubr.


Revision tags: pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.90 25-Jul-2014 dholland

branches: 1.90.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.89 16-Mar-2014 dholland

branches: 1.89.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.88 09-Aug-2013 kardel

bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.87 27-Oct-2012 chs

branches: 1.87.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.86 23-Nov-2009 rmind

branches: 1.86.12; 1.86.22;
Remove some unecessary includes sys/user.h header.


Revision tags: jym-xensuspend-nbase
# 1.85 21-Oct-2009 rmind

Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.84 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.83 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base mjf-devfs2-base
# 1.82 08-Jun-2008 tsutsui

branches: 1.82.12;
Use device_lookup_private() rather than using cd_devs[] directly to get softc.

XXX maybe we should change a type of cd_devs[] in struct cfdriver
from (void *) to device_t.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.81 28-Apr-2008 martin

branches: 1.81.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.80 05-Apr-2008 cegger

branches: 1.80.2; 1.80.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.79 01-Mar-2008 rmind

Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase mjf-devfs-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.78 05-Dec-2007 pooka

branches: 1.78.8; 1.78.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 1.77 04-Mar-2007 christos

branches: 1.77.14; 1.77.16; 1.77.22; 1.77.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.76 16-Nov-2006 christos

branches: 1.76.4;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.75 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.74 28-Aug-2006 christos

branches: 1.74.2; 1.74.4;
add missing initializer


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base simonb-timecounters-base
# 1.73 30-Mar-2006 thorpej

Use device_private().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.72 11-Dec-2005 christos

branches: 1.72.4; 1.72.6; 1.72.8; 1.72.10; 1.72.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.71 30-May-2005 christos

branches: 1.71.2;
- remove bogus casts
- add more const


Revision tags: kent-audio2-base
# 1.70 25-Apr-2005 drochner

fix more SSD_RCODE_VALID misuse introduced in cleanup


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base
# 1.69 27-Feb-2005 perry

nuke trailing whitespace


# 1.68 21-Feb-2005 thorpej

Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.


Revision tags: yamt-km-base2
# 1.67 01-Feb-2005 reinoud

Backing out changes to clean up scsipi. I was pointed out there were
problems i hadn't seen. To prevent lossage i'd decided to back off all
changes and let them be reviewed on tech-kern.


# 1.66 31-Jan-2005 reinoud

Fix LP64 problems introduced by my u_long->uint32_t conversion.


# 1.65 31-Jan-2005 reinoud

Part of the cleanup of sys/scsipi's use of types; rename all u_int* to
uint* and change the u_long's to uint32_t's where possible. Note that the
iocl definitions/hooks have to be ulong (or u_long) or they'll bomb out.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.64 18-Sep-2004 mycroft

branches: 1.64.4; 1.64.6;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.


# 1.63 17-Sep-2004 mycroft

Remove the "xfer" argument to scsipi_command().


# 1.62 09-Sep-2004 bouyer

Make the xxstart() functions reentrant again, as some drivers HBA can call
scsipi_done() from their scsipi_request().
For this, add a struct scsipi_xfer * argument to scsipi_command().
If not NULL scsipi_command() will use this to enqueue this xfer, otherwise
it'll try to allocate a new one. This scsipi_xfer has to be allocated
and initialised by scsipi_make_xs() or equivalent.
In xxstart(), allocate a scsipi_xfer using scsipi_make_xs(), and if not NULL,
dequeue the buffer before calling scsipi_command(). This makes sure that
scsipi_command() will not fail, and also makes sure that xxstart() won't
be called again between the BUFQ_PEEK() and BUFQ_GET().

Fix "dequeued wrong buf" panics reported by Juergen Hannken-Illjes in
private mail and Andreas Wrede on current-users@.
Thanks to Jason Thorpe and Chuck Silver for review, and Andreas Wrede for
testing the patch.


# 1.61 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


# 1.60 23-Jun-2004 seb

Remove special handling of ASC/ASCQ 0x29/0x00 ("Power On, Reset, or Bus
Device Reset Occurred") when the device is not opened. So let the default
error handler deal with that.

This fix the retrieval of the sense page during autoconfig.

Provided by mycroft@.
Approved by bouyer@.


# 1.59 23-Apr-2004 itojun

use bounded string ops


Revision tags: netbsd-2-0-base
# 1.58 08-Sep-2003 mycroft

branches: 1.58.2;
Use the const shaker.


# 1.57 29-Jun-2003 fvdl

branches: 1.57.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.56 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.55 26-Nov-2002 christos

si_ -> sel_


Revision tags: kqueue-aftermerge
# 1.54 23-Oct-2002 jdolecek

merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe


Revision tags: kqueue-beforemerge kqueue-base
# 1.53 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.52 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.51 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.50 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.49 06-May-2002 bouyer

branches: 1.49.2;
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.48 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.47 18-Jul-2001 thorpej

branches: 1.47.2;
bzero -> memset


# 1.46 19-Jun-2001 lukem

branches: 1.46.2;
delint


# 1.45 14-May-2001 bouyer

Use SCSI/ATAPI common definition for MODE_{SELECT,SENSE}{,_BIG}. Define
functions to send theses commands in scsipi_base.c and use them instead
of ad-hoc commands setups.


# 1.44 25-Apr-2001 bouyer

Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base thorpej_scsipi_base
# 1.43 09-Jun-2000 enami

branches: 1.43.4;
Prevent a process being swapped out during I/O if the data buffer is
allocated on stack. This potential problem is noticed by Noriyuki Soda
and the idea and sample code to fix is given by Jason R. Thorpe.


Revision tags: minoura-xpg4dl-base chs-ubc2-newbase
# 1.42 04-Jan-2000 mjacob

branches: 1.42.2;
oops, bad patch


# 1.41 04-Jan-2000 mjacob

- If the user application issues an INITIALIZE ELEMENT STATUS which
succeeds, note that we now are valid.

- Don't attempt to try and run initialize element status from interrupt level-
we don't really support that yet. Also, key more correctly off of ASC/ASCQ
instead of just the sense key.

- Make the practice of doing an INITIALIZE ELEMENT STATUS automatically when
we get params (from chopen time even) a policy decision that is not the
default for now- this can be a dangerous practice as well as time consuming.
It's dangerous in that you can have a hung open when all you really want
to do is do a read of parameters- and parameters, including slot status,
are perfectly fine to read even before an INITIALIZE ELEMENT STATUS is
done- all the elements whos status your read are going to be marked with
an exception- so leave it up to the application to decide how important
this is.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.40 30-Sep-1999 thorpej

branches: 1.40.2;
Cleanup the scsipi_xfer flags:
- `flags' is now gone, replaced with `xs_control' and `xs_status'.
- Massive cleanup of the control flags. Now we explicitly say that
a job is to complete asynchronously, rather than relying on side-effects,
and use a new flag to now that device discovery is being performed.
- Do SCSI device discovery interrupt-driven.


# 1.39 09-Sep-1999 thorpej

Rework the changer driver a bit:
- Take note of magazine changes, and enqueue "Element Status Changed" events
that user processes can read or select on.
- Normalize some structure names.
- Report back more status about changer elements:
* Volume tags (e.g. barcode labels on the backs of your tapes)
* External device names (for drive units in a changer)
* Last element a unit of media was moved from
* Sense information for SCSI changer elements in EXCEPT condition
* Vendor-specific data if the user requests it.
- Add support for setting volume tags.


Revision tags: chs-ubc2-base
# 1.38 04-Apr-1999 bouyer

Adjust timeout for 'ielem' to match the comment: 5 mn (not 5s) per element +
10mn initial.


Revision tags: netbsd-1-4-base
# 1.37 17-Dec-1998 gibbs

branches: 1.37.2;
Return ENODEV when the device capability check fails for MOVE and EXCHANGE
operations.


Revision tags: kenh-if-detach-base
# 1.36 08-Dec-1998 thorpej

When closing, wait for pending xfers to drain before deleting the reference
to the adapter.


# 1.35 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.34 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


Revision tags: eeh-paddr_t-base
# 1.33 03-Jul-1998 mjacob

kern/5514: take the submitter's advice, at least partially. The time it
takes to do IELEM can be proportional to the number of elements, but is
also affected by wierd things like how readable the barcodes on the
media are. There are worst case scenarios I've seen where there are
white labels on the back of tapes with pencilled in labels which is
*just* close enough to being a bar code that an Exabyte 120 would
peer at them myopically and long enough for a *really* long time to
pass in inventorying the jukebox.

I've upped the limit to be proportional to 5 minutes per element. That
is long enough that someone I'm sure will complain about "you wait
to long and should time out" for broken h/w.

As is also noted in the PR, there are a lot of other issues here. It's
really also a question as to whether to update this driver or go
with CAM's driver. This one doesn't have switching between block
descriptors and not, doesn't support volume tag setting, and so on.
Time is limited. This PR should have been closed and fixed right away,
tho.


# 1.32 12-Jan-1998 thorpej

Adjust for changes to config.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.31 18-Oct-1997 thorpej

Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.


Revision tags: marc-pcmcia-base
# 1.30 01-Oct-1997 thorpej

Add missing SCSI_DATA_IN when issuing a READ_ELEMENT_STATUS command.
Noticed by Dave Huang <khym@bga.com>.


# 1.29 01-Oct-1997 enami

Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.


# 1.28 29-Sep-1997 mjacob

Add 'initialize element status' command; note (for future fixing in ch.c)
that a number of jukeboxes can't cope with DBD (disable block descriptors)-
we'll have to fix that some day.


Revision tags: thorpej-signal-base
# 1.27 27-Aug-1997 bouyer

branches: 1.27.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.


# 1.26 21-Feb-1997 thorpej

- Tidy up some printf code in chattach().
- Implement a simple quirks framework for changers.
- Add a quirk for the Spectra 9000 8mm tape library; it requires a
slightly-longer-than-1-minute delay to take tape inventory. Many
thanks to David Webster at Cygnus Solutions for testing this for me.


# 1.25 05-Dec-1996 cgd

branches: 1.25.6;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.24 12-Oct-1996 christos

revert previous kprintf change


# 1.23 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.22 18-Sep-1996 thorpej

For ioctl commands which may change the device's state, ensure that
the caller has the device open for writing.


# 1.21 19-Apr-1996 christos

branches: 1.21.4;
gcc -Wall delinting: unused variables, assignments inside if's and missing
arguments in printf statements.


# 1.20 03-Apr-1996 thorpej

New SCSI media changer driver, written from scratch by me. Some
influence from the old driver (written by Stefan Grefen) and from
an autochanger driver written by the Systems Programming Group at the
University of Utah Computer Science Department (currently residing
in src/sys/arch/hp300/dev/ac.c).


# 1.19 30-Mar-1996 christos

Eliminate scsi_conf.h.


# 1.18 19-Mar-1996 mycroft

Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.


# 1.17 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.16 05-Mar-1996 thorpej

Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1958.


# 1.15 14-Feb-1996 christos

scsi prototypes


# 1.14 16-Jan-1995 mycroft

Remove unused macros.


# 1.13 28-Dec-1994 mycroft

Numerous changes. Many bugs fixed, better autoconfig, a few new features.


# 1.12 21-Nov-1994 mycroft

Clean up open and close routines somewhat.


# 1.11 21-Nov-1994 mycroft

Replace dev_unit with device_softc in scsi_link. Change argument to foostart()
to void*.


# 1.10 30-Oct-1994 cgd

be more careful with types, also pull in headers where necessary.


# 1.9 20-Oct-1994 mycroft

First cut at making user-level SCSI commands work. This is untested.
Partly from John Brezak.


# 1.8 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.7 11-Apr-1994 mycroft

Fix various types. Remove some outdated flags.


# 1.6 29-Mar-1994 mycroft

New SCSI system, based on Julian's more recent work.


# 1.5 17-Dec-1993 mycroft

Canonicalize all #includes.


# 1.4 01-Aug-1993 mycroft

branches: 1.4.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.


# 1.3 20-May-1993 cgd

branches: 1.3.2;
add rcsids and clean up file headers


# 1.2 20-Apr-1993 mycroft

Display more meaningful message on SCSI `unit attention'.


# 1.1 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied