History log of /netbsd-current/sys/dev/scsipi/ss.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.91 23-Feb-2022 andvar

fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.


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.90 29-Sep-2020 msaitoh

s/occurence/occurrence/


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 nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.89 17-Jun-2017 mlelstv

The atapibus detach path did hold the channel mutex while calling into autoconf,
which would trigger a panic when unplugging a USB ATAPI CDROM.

Align detach code for scsibus and atapibus to fix this.

Also avoid races when detaching devices by replacing callout_stop with
callout_halt.


Revision tags: 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.88 20-Nov-2016 mlelstv

branches: 1.88.8;
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.


# 1.87 20-Nov-2016 pgoyette

Avoid calling bufq_free() from critical code sections.


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.86 25-Jul-2014 dholland

branches: 1.86.4; 1.86.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.85 16-Mar-2014 dholland

branches: 1.85.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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
# 1.84 28-Feb-2012 mbalmer

branches: 1.84.2; 1.84.4;
one line comments on one line.


# 1.83 28-Feb-2012 mbalmer

Unbreak the build.


# 1.82 28-Feb-2012 mbalmer

Remove a pointless #if 0, compiler will eliminate the code anways.
Noticed by skrll.


# 1.81 28-Feb-2012 mbalmer

Convert to device_t, aka softc/device_t split, and clean up a bit the code.


Revision tags: jmcneill-usbmp-base5 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.80 06-Dec-2009 dyoung

branches: 1.80.12; 1.80.16; 1.80.18;
Delete do-nothing device-activation hooks.


# 1.79 23-Nov-2009 rmind

Remove some unecessary includes sys/user.h header.


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-nbase jym-xensuspend-base
# 1.78 12-May-2009 cegger

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


# 1.77 12-May-2009 cegger

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


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.76 13-Jan-2009 yamt

branches: 1.76.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.


# 1.75 11-Jan-2009 cegger

make this compile


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 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-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
# 1.74 08-Jun-2008 tsutsui

branches: 1.74.6;
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-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base
# 1.73 05-Apr-2008 cegger

branches: 1.73.2; 1.73.4; 1.73.6;
use aprint_*_dev and device_xname


Revision tags: nick-csl-alignment-base5 ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking 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 vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-armv6-base matt-mips64-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base vmlocking-base
# 1.72 29-Jul-2007 ad

branches: 1.72.26; 1.72.28;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.71 09-Jul-2007 ad

branches: 1.71.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.70 04-Mar-2007 christos

branches: 1.70.2; 1.70.4;
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.69 16-Nov-2006 christos

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


Revision tags: yamt-splraiseipl-base2
# 1.68 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.67 03-Sep-2006 christos

branches: 1.67.2; 1.67.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.66 30-Mar-2006 thorpej

Use device_private().


# 1.65 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.64 20-Feb-2006 thorpej

branches: 1.64.2; 1.64.4; 1.64.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.


# 1.63 11-Dec-2005 christos

branches: 1.63.2; 1.63.4; 1.63.6;
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.62 15-Oct-2005 yamt

- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)


# 1.61 30-May-2005 christos

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


Revision tags: kent-audio2-base
# 1.60 31-Mar-2005 yamt

introduce a function to drain bufq and use it where appropriate.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2
# 1.59 01-Feb-2005 reinoud

branches: 1.59.4;
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.58 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.57 28-Oct-2004 yamt

branches: 1.57.4;
move buffer queue related stuffs from buf.h to their own header, bufq.h.


# 1.56 17-Oct-2004 bouyer

Adjust some debug printfs after b_bcount was changed from long to int.
From Patrick Welche on current-users@


# 1.55 17-Sep-2004 mycroft

Oops; fix ssrestart().


# 1.54 17-Sep-2004 mycroft

Do not manipulate xs->bp in "generic" code -- do it only in the psw_done
routine. As part of this, pass down our pre-parsed error code -- though this
interface will probably change later to accomodate better error handling.


# 1.53 27-Aug-2004 bouyer

Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is
competing for resources with other pools, including the the inode and vnode
pools which can grow quite large.

*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the
caller deal with the problem
start function of block devices drivers: dequeue the buffer after the
scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue
the buffer, and schedule a callout to call the start function after
some delay.
scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that
there is always some scsipi_xfer to play with. If scsipi_command() fails
because of pool_get(), we're sure there will be resources available later,
when the pending commands have completed.

Reviewed by Jason Thorpe and Havard Eidnes.
Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d"
printfs, but I choose to keep them for now, to help make sure the code does
what it should.


# 1.52 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


Revision tags: netbsd-2-0-base
# 1.51 14-Mar-2004 thorpej

branches: 1.51.2;
Use scsipi_adapter_minphys().


# 1.50 08-Sep-2003 mycroft

Use the const shaker.


# 1.49 29-Jun-2003 fvdl

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


# 1.48 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


# 1.47 20-Mar-2003 dbj

use PRId64 to printf bp->b_blkno, which is of type daddr_t


# 1.46 21-Jan-2003 simonb

Remove a line of unreachable code. It seems to be a remnant of starting
off with a different driver, and the way this code is structured the
offending line isn't needed.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
# 1.45 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.44 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.43 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.42 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.41 14-Sep-2002 chs

recognize HP ScanJet 4c.
add a catch-all case for other HP scanners.
remove a local version of atoi() in favor of strtoul() from libkern.


# 1.40 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: gehenna-devsw-base
# 1.39 22-Jul-2002 hannken

Convert to new device buffer queue interface.


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 eeh-devprop-base newlock-base ifpoll-base
# 1.38 15-Nov-2001 lukem

branches: 1.38.8;
don't need <sys/types.h> when including <sys/param.h>


# 1.37 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.36 18-Jul-2001 thorpej

branches: 1.36.2;
bcopy -> memcpy


# 1.35 26-Jun-2001 bouyer

branches: 1.35.2;
Make it compile with SCSIPI_DEBUG


# 1.34 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: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.33 01-Jan-2001 augustss

branches: 1.33.2;
Call vdevgone() with correct minor range.


# 1.32 01-Jan-2001 augustss

Support device detach.
Don't call scanjet_attach() for all HP scanners.
Also, ANSIfy while I'm here.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.31 31-May-2000 phil

Add an entry for the HP ScanJet 6300C.


Revision tags: minoura-xpg4dl-base
# 1.30 30-Mar-2000 augustss

branches: 1.30.2;
Get rid of register declarations.


Revision tags: chs-ubc2-newbase
# 1.29 21-Jan-2000 thorpej

Update for sys/buf.h/disksort_*() changes.


# 1.28 19-Jan-2000 abs

newline terminate ss: atatch message - from Roger Brooks


# 1.27 17-Jan-2000 abs

allow ioctl() on all scanner device nodes - now SANE can work with ss* driver


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

branches: 1.26.2; 1.26.8;
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.


Revision tags: kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.25 10-Feb-1999 bouyer

branches: 1.25.2;
Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson.


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

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


# 1.23 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.22 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.)


# 1.21 19-Aug-1998 explorer

ss->special could be NULL, so sane would crash the kernel.


Revision tags: eeh-paddr_t-base
# 1.20 22-Apr-1998 pk

Set a flag during auto-configuration, so SCSI_AUTOCONF can be passed
when doing additional I/O from the scanner attach functions.


# 1.19 12-Jan-1998 thorpej

Adjust for changes to config.


# 1.18 19-Nov-1997 augustss

Recognize HP ScanJet 5p.


Revision tags: netbsd-1-3-base marc-pcmcia-base
# 1.17 01-Oct-1997 enami

branches: 1.17.2;
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.


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

branches: 1.16.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.15 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.14 29-Nov-1996 thorpej

Add an inquiry pattern for the HP ScanJet 4p.
From Valtteri Vuorikoski <vuori@notcom.org>, PR #2957.


# 1.13 12-Oct-1996 christos

revert previous kprintf change


# 1.12 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.11 12-Jul-1996 is

Some MUSTEK scanners fill the vendor string in the SCSI identify
string with 0xFF instead of 0x20. Shorten the compare to 6 bytes to
take care of this.

Fixes PR #2617 by myself, which is based on a private problem report
by Neil Brewitt.


# 1.10 05-May-1996 christos

Cleanup the rest of the SCSIDEBUG printfs. From Bernd Ernesti.


# 1.9 30-Mar-1996 christos

- Eliminate scsi_conf.h
- Fix prototypes
- Fix PR/2248 [Problems with HP scanjet...]


# 1.8 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.7 05-Mar-1996 thorpej

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


# 1.6 19-Feb-1996 mycroft

Handle EOF a little differently.


# 1.5 18-Feb-1996 mycroft

Change variable name to avoid GCC warning.


# 1.4 18-Feb-1996 mycroft

Minor tweak; make sure window size is 0 on close.


# 1.3 18-Feb-1996 mycroft

Missed some prototyping foo.


# 1.2 18-Feb-1996 mycroft

Truncate to the window size in ssminphys(), not ssread().


# 1.1 18-Feb-1996 mycroft

Add SCSI scanner support by Kenneth Stailey and Joachim Koenig-Baltes,
hacked a bit. Needs more work.


# 1.90 29-Sep-2020 msaitoh

s/occurence/occurrence/


Revision tags: 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 nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.89 17-Jun-2017 mlelstv

The atapibus detach path did hold the channel mutex while calling into autoconf,
which would trigger a panic when unplugging a USB ATAPI CDROM.

Align detach code for scsibus and atapibus to fix this.

Also avoid races when detaching devices by replacing callout_stop with
callout_halt.


Revision tags: 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.88 20-Nov-2016 mlelstv

branches: 1.88.8;
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.


# 1.87 20-Nov-2016 pgoyette

Avoid calling bufq_free() from critical code sections.


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.86 25-Jul-2014 dholland

branches: 1.86.4; 1.86.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.85 16-Mar-2014 dholland

branches: 1.85.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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
# 1.84 28-Feb-2012 mbalmer

branches: 1.84.2; 1.84.4;
one line comments on one line.


# 1.83 28-Feb-2012 mbalmer

Unbreak the build.


# 1.82 28-Feb-2012 mbalmer

Remove a pointless #if 0, compiler will eliminate the code anways.
Noticed by skrll.


# 1.81 28-Feb-2012 mbalmer

Convert to device_t, aka softc/device_t split, and clean up a bit the code.


Revision tags: jmcneill-usbmp-base5 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.80 06-Dec-2009 dyoung

branches: 1.80.12; 1.80.16; 1.80.18;
Delete do-nothing device-activation hooks.


# 1.79 23-Nov-2009 rmind

Remove some unecessary includes sys/user.h header.


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-nbase jym-xensuspend-base
# 1.78 12-May-2009 cegger

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


# 1.77 12-May-2009 cegger

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


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.76 13-Jan-2009 yamt

branches: 1.76.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.


# 1.75 11-Jan-2009 cegger

make this compile


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 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-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
# 1.74 08-Jun-2008 tsutsui

branches: 1.74.6;
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-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base
# 1.73 05-Apr-2008 cegger

branches: 1.73.2; 1.73.4; 1.73.6;
use aprint_*_dev and device_xname


Revision tags: nick-csl-alignment-base5 ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking 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 vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-armv6-base matt-mips64-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base vmlocking-base
# 1.72 29-Jul-2007 ad

branches: 1.72.26; 1.72.28;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.71 09-Jul-2007 ad

branches: 1.71.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.70 04-Mar-2007 christos

branches: 1.70.2; 1.70.4;
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.69 16-Nov-2006 christos

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


Revision tags: yamt-splraiseipl-base2
# 1.68 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.67 03-Sep-2006 christos

branches: 1.67.2; 1.67.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.66 30-Mar-2006 thorpej

Use device_private().


# 1.65 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.64 20-Feb-2006 thorpej

branches: 1.64.2; 1.64.4; 1.64.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.


# 1.63 11-Dec-2005 christos

branches: 1.63.2; 1.63.4; 1.63.6;
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.62 15-Oct-2005 yamt

- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)


# 1.61 30-May-2005 christos

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


Revision tags: kent-audio2-base
# 1.60 31-Mar-2005 yamt

introduce a function to drain bufq and use it where appropriate.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2
# 1.59 01-Feb-2005 reinoud

branches: 1.59.4;
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.58 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.57 28-Oct-2004 yamt

branches: 1.57.4;
move buffer queue related stuffs from buf.h to their own header, bufq.h.


# 1.56 17-Oct-2004 bouyer

Adjust some debug printfs after b_bcount was changed from long to int.
From Patrick Welche on current-users@


# 1.55 17-Sep-2004 mycroft

Oops; fix ssrestart().


# 1.54 17-Sep-2004 mycroft

Do not manipulate xs->bp in "generic" code -- do it only in the psw_done
routine. As part of this, pass down our pre-parsed error code -- though this
interface will probably change later to accomodate better error handling.


# 1.53 27-Aug-2004 bouyer

Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is
competing for resources with other pools, including the the inode and vnode
pools which can grow quite large.

*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the
caller deal with the problem
start function of block devices drivers: dequeue the buffer after the
scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue
the buffer, and schedule a callout to call the start function after
some delay.
scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that
there is always some scsipi_xfer to play with. If scsipi_command() fails
because of pool_get(), we're sure there will be resources available later,
when the pending commands have completed.

Reviewed by Jason Thorpe and Havard Eidnes.
Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d"
printfs, but I choose to keep them for now, to help make sure the code does
what it should.


# 1.52 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


Revision tags: netbsd-2-0-base
# 1.51 14-Mar-2004 thorpej

branches: 1.51.2;
Use scsipi_adapter_minphys().


# 1.50 08-Sep-2003 mycroft

Use the const shaker.


# 1.49 29-Jun-2003 fvdl

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


# 1.48 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


# 1.47 20-Mar-2003 dbj

use PRId64 to printf bp->b_blkno, which is of type daddr_t


# 1.46 21-Jan-2003 simonb

Remove a line of unreachable code. It seems to be a remnant of starting
off with a different driver, and the way this code is structured the
offending line isn't needed.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
# 1.45 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.44 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.43 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.42 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.41 14-Sep-2002 chs

recognize HP ScanJet 4c.
add a catch-all case for other HP scanners.
remove a local version of atoi() in favor of strtoul() from libkern.


# 1.40 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: gehenna-devsw-base
# 1.39 22-Jul-2002 hannken

Convert to new device buffer queue interface.


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 eeh-devprop-base newlock-base ifpoll-base
# 1.38 15-Nov-2001 lukem

branches: 1.38.8;
don't need <sys/types.h> when including <sys/param.h>


# 1.37 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.36 18-Jul-2001 thorpej

branches: 1.36.2;
bcopy -> memcpy


# 1.35 26-Jun-2001 bouyer

branches: 1.35.2;
Make it compile with SCSIPI_DEBUG


# 1.34 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: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.33 01-Jan-2001 augustss

branches: 1.33.2;
Call vdevgone() with correct minor range.


# 1.32 01-Jan-2001 augustss

Support device detach.
Don't call scanjet_attach() for all HP scanners.
Also, ANSIfy while I'm here.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.31 31-May-2000 phil

Add an entry for the HP ScanJet 6300C.


Revision tags: minoura-xpg4dl-base
# 1.30 30-Mar-2000 augustss

branches: 1.30.2;
Get rid of register declarations.


Revision tags: chs-ubc2-newbase
# 1.29 21-Jan-2000 thorpej

Update for sys/buf.h/disksort_*() changes.


# 1.28 19-Jan-2000 abs

newline terminate ss: atatch message - from Roger Brooks


# 1.27 17-Jan-2000 abs

allow ioctl() on all scanner device nodes - now SANE can work with ss* driver


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

branches: 1.26.2; 1.26.8;
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.


Revision tags: kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.25 10-Feb-1999 bouyer

branches: 1.25.2;
Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson.


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

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


# 1.23 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.22 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.)


# 1.21 19-Aug-1998 explorer

ss->special could be NULL, so sane would crash the kernel.


Revision tags: eeh-paddr_t-base
# 1.20 22-Apr-1998 pk

Set a flag during auto-configuration, so SCSI_AUTOCONF can be passed
when doing additional I/O from the scanner attach functions.


# 1.19 12-Jan-1998 thorpej

Adjust for changes to config.


# 1.18 19-Nov-1997 augustss

Recognize HP ScanJet 5p.


Revision tags: netbsd-1-3-base marc-pcmcia-base
# 1.17 01-Oct-1997 enami

branches: 1.17.2;
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.


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

branches: 1.16.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.15 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.14 29-Nov-1996 thorpej

Add an inquiry pattern for the HP ScanJet 4p.
From Valtteri Vuorikoski <vuori@notcom.org>, PR #2957.


# 1.13 12-Oct-1996 christos

revert previous kprintf change


# 1.12 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.11 12-Jul-1996 is

Some MUSTEK scanners fill the vendor string in the SCSI identify
string with 0xFF instead of 0x20. Shorten the compare to 6 bytes to
take care of this.

Fixes PR #2617 by myself, which is based on a private problem report
by Neil Brewitt.


# 1.10 05-May-1996 christos

Cleanup the rest of the SCSIDEBUG printfs. From Bernd Ernesti.


# 1.9 30-Mar-1996 christos

- Eliminate scsi_conf.h
- Fix prototypes
- Fix PR/2248 [Problems with HP scanjet...]


# 1.8 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.7 05-Mar-1996 thorpej

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


# 1.6 19-Feb-1996 mycroft

Handle EOF a little differently.


# 1.5 18-Feb-1996 mycroft

Change variable name to avoid GCC warning.


# 1.4 18-Feb-1996 mycroft

Minor tweak; make sure window size is 0 on close.


# 1.3 18-Feb-1996 mycroft

Missed some prototyping foo.


# 1.2 18-Feb-1996 mycroft

Truncate to the window size in ssminphys(), not ssread().


# 1.1 18-Feb-1996 mycroft

Add SCSI scanner support by Kenneth Stailey and Joachim Koenig-Baltes,
hacked a bit. Needs more work.


# 1.89 17-Jun-2017 mlelstv

The atapibus detach path did hold the channel mutex while calling into autoconf,
which would trigger a panic when unplugging a USB ATAPI CDROM.

Align detach code for scsibus and atapibus to fix this.

Also avoid races when detaching devices by replacing callout_stop with
callout_halt.


Revision tags: 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.88 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.


# 1.87 20-Nov-2016 pgoyette

Avoid calling bufq_free() from critical code sections.


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.86 25-Jul-2014 dholland

branches: 1.86.4; 1.86.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.85 16-Mar-2014 dholland

branches: 1.85.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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
# 1.84 28-Feb-2012 mbalmer

branches: 1.84.2; 1.84.4;
one line comments on one line.


# 1.83 28-Feb-2012 mbalmer

Unbreak the build.


# 1.82 28-Feb-2012 mbalmer

Remove a pointless #if 0, compiler will eliminate the code anways.
Noticed by skrll.


# 1.81 28-Feb-2012 mbalmer

Convert to device_t, aka softc/device_t split, and clean up a bit the code.


Revision tags: jmcneill-usbmp-base5 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.80 06-Dec-2009 dyoung

branches: 1.80.12; 1.80.16; 1.80.18;
Delete do-nothing device-activation hooks.


# 1.79 23-Nov-2009 rmind

Remove some unecessary includes sys/user.h header.


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-nbase jym-xensuspend-base
# 1.78 12-May-2009 cegger

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


# 1.77 12-May-2009 cegger

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


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.76 13-Jan-2009 yamt

branches: 1.76.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.


# 1.75 11-Jan-2009 cegger

make this compile


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 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-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
# 1.74 08-Jun-2008 tsutsui

branches: 1.74.6;
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-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base
# 1.73 05-Apr-2008 cegger

branches: 1.73.2; 1.73.4; 1.73.6;
use aprint_*_dev and device_xname


Revision tags: nick-csl-alignment-base5 ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking 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 vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-armv6-base matt-mips64-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base vmlocking-base
# 1.72 29-Jul-2007 ad

branches: 1.72.26; 1.72.28;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.71 09-Jul-2007 ad

branches: 1.71.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.70 04-Mar-2007 christos

branches: 1.70.2; 1.70.4;
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.69 16-Nov-2006 christos

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


Revision tags: yamt-splraiseipl-base2
# 1.68 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.67 03-Sep-2006 christos

branches: 1.67.2; 1.67.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.66 30-Mar-2006 thorpej

Use device_private().


# 1.65 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.64 20-Feb-2006 thorpej

branches: 1.64.2; 1.64.4; 1.64.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.


# 1.63 11-Dec-2005 christos

branches: 1.63.2; 1.63.4; 1.63.6;
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.62 15-Oct-2005 yamt

- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)


# 1.61 30-May-2005 christos

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


Revision tags: kent-audio2-base
# 1.60 31-Mar-2005 yamt

introduce a function to drain bufq and use it where appropriate.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2
# 1.59 01-Feb-2005 reinoud

branches: 1.59.4;
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.58 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.57 28-Oct-2004 yamt

branches: 1.57.4;
move buffer queue related stuffs from buf.h to their own header, bufq.h.


# 1.56 17-Oct-2004 bouyer

Adjust some debug printfs after b_bcount was changed from long to int.
From Patrick Welche on current-users@


# 1.55 17-Sep-2004 mycroft

Oops; fix ssrestart().


# 1.54 17-Sep-2004 mycroft

Do not manipulate xs->bp in "generic" code -- do it only in the psw_done
routine. As part of this, pass down our pre-parsed error code -- though this
interface will probably change later to accomodate better error handling.


# 1.53 27-Aug-2004 bouyer

Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is
competing for resources with other pools, including the the inode and vnode
pools which can grow quite large.

*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the
caller deal with the problem
start function of block devices drivers: dequeue the buffer after the
scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue
the buffer, and schedule a callout to call the start function after
some delay.
scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that
there is always some scsipi_xfer to play with. If scsipi_command() fails
because of pool_get(), we're sure there will be resources available later,
when the pending commands have completed.

Reviewed by Jason Thorpe and Havard Eidnes.
Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d"
printfs, but I choose to keep them for now, to help make sure the code does
what it should.


# 1.52 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


Revision tags: netbsd-2-0-base
# 1.51 14-Mar-2004 thorpej

branches: 1.51.2;
Use scsipi_adapter_minphys().


# 1.50 08-Sep-2003 mycroft

Use the const shaker.


# 1.49 29-Jun-2003 fvdl

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


# 1.48 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


# 1.47 20-Mar-2003 dbj

use PRId64 to printf bp->b_blkno, which is of type daddr_t


# 1.46 21-Jan-2003 simonb

Remove a line of unreachable code. It seems to be a remnant of starting
off with a different driver, and the way this code is structured the
offending line isn't needed.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
# 1.45 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.44 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.43 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.42 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.41 14-Sep-2002 chs

recognize HP ScanJet 4c.
add a catch-all case for other HP scanners.
remove a local version of atoi() in favor of strtoul() from libkern.


# 1.40 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: gehenna-devsw-base
# 1.39 22-Jul-2002 hannken

Convert to new device buffer queue interface.


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 eeh-devprop-base newlock-base ifpoll-base
# 1.38 15-Nov-2001 lukem

branches: 1.38.8;
don't need <sys/types.h> when including <sys/param.h>


# 1.37 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.36 18-Jul-2001 thorpej

branches: 1.36.2;
bcopy -> memcpy


# 1.35 26-Jun-2001 bouyer

branches: 1.35.2;
Make it compile with SCSIPI_DEBUG


# 1.34 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: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.33 01-Jan-2001 augustss

branches: 1.33.2;
Call vdevgone() with correct minor range.


# 1.32 01-Jan-2001 augustss

Support device detach.
Don't call scanjet_attach() for all HP scanners.
Also, ANSIfy while I'm here.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.31 31-May-2000 phil

Add an entry for the HP ScanJet 6300C.


Revision tags: minoura-xpg4dl-base
# 1.30 30-Mar-2000 augustss

branches: 1.30.2;
Get rid of register declarations.


Revision tags: chs-ubc2-newbase
# 1.29 21-Jan-2000 thorpej

Update for sys/buf.h/disksort_*() changes.


# 1.28 19-Jan-2000 abs

newline terminate ss: atatch message - from Roger Brooks


# 1.27 17-Jan-2000 abs

allow ioctl() on all scanner device nodes - now SANE can work with ss* driver


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

branches: 1.26.2; 1.26.8;
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.


Revision tags: kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.25 10-Feb-1999 bouyer

branches: 1.25.2;
Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson.


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

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


# 1.23 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.22 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.)


# 1.21 19-Aug-1998 explorer

ss->special could be NULL, so sane would crash the kernel.


Revision tags: eeh-paddr_t-base
# 1.20 22-Apr-1998 pk

Set a flag during auto-configuration, so SCSI_AUTOCONF can be passed
when doing additional I/O from the scanner attach functions.


# 1.19 12-Jan-1998 thorpej

Adjust for changes to config.


# 1.18 19-Nov-1997 augustss

Recognize HP ScanJet 5p.


Revision tags: netbsd-1-3-base marc-pcmcia-base
# 1.17 01-Oct-1997 enami

branches: 1.17.2;
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.


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

branches: 1.16.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.15 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.14 29-Nov-1996 thorpej

Add an inquiry pattern for the HP ScanJet 4p.
From Valtteri Vuorikoski <vuori@notcom.org>, PR #2957.


# 1.13 12-Oct-1996 christos

revert previous kprintf change


# 1.12 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.11 12-Jul-1996 is

Some MUSTEK scanners fill the vendor string in the SCSI identify
string with 0xFF instead of 0x20. Shorten the compare to 6 bytes to
take care of this.

Fixes PR #2617 by myself, which is based on a private problem report
by Neil Brewitt.


# 1.10 05-May-1996 christos

Cleanup the rest of the SCSIDEBUG printfs. From Bernd Ernesti.


# 1.9 30-Mar-1996 christos

- Eliminate scsi_conf.h
- Fix prototypes
- Fix PR/2248 [Problems with HP scanjet...]


# 1.8 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.7 05-Mar-1996 thorpej

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


# 1.6 19-Feb-1996 mycroft

Handle EOF a little differently.


# 1.5 18-Feb-1996 mycroft

Change variable name to avoid GCC warning.


# 1.4 18-Feb-1996 mycroft

Minor tweak; make sure window size is 0 on close.


# 1.3 18-Feb-1996 mycroft

Missed some prototyping foo.


# 1.2 18-Feb-1996 mycroft

Truncate to the window size in ssminphys(), not ssread().


# 1.1 18-Feb-1996 mycroft

Add SCSI scanner support by Kenneth Stailey and Joachim Koenig-Baltes,
hacked a bit. Needs more work.


Revision tags: nick-nhusb-base-20161204
# 1.88 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.


# 1.87 20-Nov-2016 pgoyette

Avoid calling bufq_free() from critical code sections.


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.86 25-Jul-2014 dholland

branches: 1.86.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.85 16-Mar-2014 dholland

branches: 1.85.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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
# 1.84 28-Feb-2012 mbalmer

branches: 1.84.2; 1.84.4;
one line comments on one line.


# 1.83 28-Feb-2012 mbalmer

Unbreak the build.


# 1.82 28-Feb-2012 mbalmer

Remove a pointless #if 0, compiler will eliminate the code anways.
Noticed by skrll.


# 1.81 28-Feb-2012 mbalmer

Convert to device_t, aka softc/device_t split, and clean up a bit the code.


Revision tags: jmcneill-usbmp-base5 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.80 06-Dec-2009 dyoung

branches: 1.80.12; 1.80.16; 1.80.18;
Delete do-nothing device-activation hooks.


# 1.79 23-Nov-2009 rmind

Remove some unecessary includes sys/user.h header.


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-nbase jym-xensuspend-base
# 1.78 12-May-2009 cegger

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


# 1.77 12-May-2009 cegger

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


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.76 13-Jan-2009 yamt

branches: 1.76.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.


# 1.75 11-Jan-2009 cegger

make this compile


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 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-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
# 1.74 08-Jun-2008 tsutsui

branches: 1.74.6;
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-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base
# 1.73 05-Apr-2008 cegger

branches: 1.73.2; 1.73.4; 1.73.6;
use aprint_*_dev and device_xname


Revision tags: nick-csl-alignment-base5 ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 matt-armv6-prevmlocking 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 vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-armv6-base matt-mips64-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base vmlocking-base
# 1.72 29-Jul-2007 ad

branches: 1.72.26; 1.72.28;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.71 09-Jul-2007 ad

branches: 1.71.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.70 04-Mar-2007 christos

branches: 1.70.2; 1.70.4;
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.69 16-Nov-2006 christos

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


Revision tags: yamt-splraiseipl-base2
# 1.68 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.67 03-Sep-2006 christos

branches: 1.67.2; 1.67.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.66 30-Mar-2006 thorpej

Use device_private().


# 1.65 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.64 20-Feb-2006 thorpej

branches: 1.64.2; 1.64.4; 1.64.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.


# 1.63 11-Dec-2005 christos

branches: 1.63.2; 1.63.4; 1.63.6;
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.62 15-Oct-2005 yamt

- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)


# 1.61 30-May-2005 christos

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


Revision tags: kent-audio2-base
# 1.60 31-Mar-2005 yamt

introduce a function to drain bufq and use it where appropriate.


Revision tags: yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2
# 1.59 01-Feb-2005 reinoud

branches: 1.59.4;
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.58 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.57 28-Oct-2004 yamt

branches: 1.57.4;
move buffer queue related stuffs from buf.h to their own header, bufq.h.


# 1.56 17-Oct-2004 bouyer

Adjust some debug printfs after b_bcount was changed from long to int.
From Patrick Welche on current-users@


# 1.55 17-Sep-2004 mycroft

Oops; fix ssrestart().


# 1.54 17-Sep-2004 mycroft

Do not manipulate xs->bp in "generic" code -- do it only in the psw_done
routine. As part of this, pass down our pre-parsed error code -- though this
interface will probably change later to accomodate better error handling.


# 1.53 27-Aug-2004 bouyer

Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is
competing for resources with other pools, including the the inode and vnode
pools which can grow quite large.

*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the
caller deal with the problem
start function of block devices drivers: dequeue the buffer after the
scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue
the buffer, and schedule a callout to call the start function after
some delay.
scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that
there is always some scsipi_xfer to play with. If scsipi_command() fails
because of pool_get(), we're sure there will be resources available later,
when the pending commands have completed.

Reviewed by Jason Thorpe and Havard Eidnes.
Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d"
printfs, but I choose to keep them for now, to help make sure the code does
what it should.


# 1.52 21-Aug-2004 thorpej

Use ANSI function decls and make use of static.


Revision tags: netbsd-2-0-base
# 1.51 14-Mar-2004 thorpej

branches: 1.51.2;
Use scsipi_adapter_minphys().


# 1.50 08-Sep-2003 mycroft

Use the const shaker.


# 1.49 29-Jun-2003 fvdl

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


# 1.48 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


# 1.47 20-Mar-2003 dbj

use PRId64 to printf bp->b_blkno, which is of type daddr_t


# 1.46 21-Jan-2003 simonb

Remove a line of unreachable code. It seems to be a remnant of starting
off with a different driver, and the way this code is structured the
offending line isn't needed.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
# 1.45 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.44 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.43 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.42 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.41 14-Sep-2002 chs

recognize HP ScanJet 4c.
add a catch-all case for other HP scanners.
remove a local version of atoi() in favor of strtoul() from libkern.


# 1.40 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: gehenna-devsw-base
# 1.39 22-Jul-2002 hannken

Convert to new device buffer queue interface.


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 eeh-devprop-base newlock-base ifpoll-base
# 1.38 15-Nov-2001 lukem

branches: 1.38.8;
don't need <sys/types.h> when including <sys/param.h>


# 1.37 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.36 18-Jul-2001 thorpej

branches: 1.36.2;
bcopy -> memcpy


# 1.35 26-Jun-2001 bouyer

branches: 1.35.2;
Make it compile with SCSIPI_DEBUG


# 1.34 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: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.33 01-Jan-2001 augustss

branches: 1.33.2;
Call vdevgone() with correct minor range.


# 1.32 01-Jan-2001 augustss

Support device detach.
Don't call scanjet_attach() for all HP scanners.
Also, ANSIfy while I'm here.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.31 31-May-2000 phil

Add an entry for the HP ScanJet 6300C.


Revision tags: minoura-xpg4dl-base
# 1.30 30-Mar-2000 augustss

branches: 1.30.2;
Get rid of register declarations.


Revision tags: chs-ubc2-newbase
# 1.29 21-Jan-2000 thorpej

Update for sys/buf.h/disksort_*() changes.


# 1.28 19-Jan-2000 abs

newline terminate ss: atatch message - from Roger Brooks


# 1.27 17-Jan-2000 abs

allow ioctl() on all scanner device nodes - now SANE can work with ss* driver


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

branches: 1.26.2; 1.26.8;
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.


Revision tags: kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.25 10-Feb-1999 bouyer

branches: 1.25.2;
Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson.


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

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


# 1.23 20-Nov-1998 thorpej

Add adapter reference counting for SCSI and ATAPI devices.


Revision tags: chs-ubc-base
# 1.22 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.)


# 1.21 19-Aug-1998 explorer

ss->special could be NULL, so sane would crash the kernel.


Revision tags: eeh-paddr_t-base
# 1.20 22-Apr-1998 pk

Set a flag during auto-configuration, so SCSI_AUTOCONF can be passed
when doing additional I/O from the scanner attach functions.


# 1.19 12-Jan-1998 thorpej

Adjust for changes to config.


# 1.18 19-Nov-1997 augustss

Recognize HP ScanJet 5p.


Revision tags: netbsd-1-3-base marc-pcmcia-base
# 1.17 01-Oct-1997 enami

branches: 1.17.2;
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.


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

branches: 1.16.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.15 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.14 29-Nov-1996 thorpej

Add an inquiry pattern for the HP ScanJet 4p.
From Valtteri Vuorikoski <vuori@notcom.org>, PR #2957.


# 1.13 12-Oct-1996 christos

revert previous kprintf change


# 1.12 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.11 12-Jul-1996 is

Some MUSTEK scanners fill the vendor string in the SCSI identify
string with 0xFF instead of 0x20. Shorten the compare to 6 bytes to
take care of this.

Fixes PR #2617 by myself, which is based on a private problem report
by Neil Brewitt.


# 1.10 05-May-1996 christos

Cleanup the rest of the SCSIDEBUG printfs. From Bernd Ernesti.


# 1.9 30-Mar-1996 christos

- Eliminate scsi_conf.h
- Fix prototypes
- Fix PR/2248 [Problems with HP scanjet...]


# 1.8 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.7 05-Mar-1996 thorpej

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


# 1.6 19-Feb-1996 mycroft

Handle EOF a little differently.


# 1.5 18-Feb-1996 mycroft

Change variable name to avoid GCC warning.


# 1.4 18-Feb-1996 mycroft

Minor tweak; make sure window size is 0 on close.


# 1.3 18-Feb-1996 mycroft

Missed some prototyping foo.


# 1.2 18-Feb-1996 mycroft

Truncate to the window size in ssminphys(), not ssread().


# 1.1 18-Feb-1996 mycroft

Add SCSI scanner support by Kenneth Stailey and Joachim Koenig-Baltes,
hacked a bit. Needs more work.