Home | History | Annotate | Download | only in scsipi
History log of /src/sys/dev/scsipi/ss.c
RevisionDateAuthorComments
 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.
 1.90  29-Sep-2020  msaitoh s/occurence/occurrence/
 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.
 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.
 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.
 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.
 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.
 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.
 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.
 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
 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.
 1.73  05-Apr-2008  cegger branches: 1.73.2; 1.73.4; 1.73.6;
use aprint_*_dev and device_xname
 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.
 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
 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.
 1.69  16-Nov-2006  christos branches: 1.69.4;
__unused removal on arguments; approved by core.
 1.68  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.67  03-Sep-2006  christos branches: 1.67.2; 1.67.4;
add missing initializer
 1.66  30-Mar-2006  thorpej Use device_private().
 1.65  28-Mar-2006  thorpej Use device_unit().
 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.
 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
 1.60  31-Mar-2005  yamt introduce a function to drain bufq and use it where appropriate.
 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.
 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.
 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.
 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
 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.
 1.39  22-Jul-2002  hannken Convert to new device buffer queue interface.
 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
 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
 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.
 1.31  31-May-2000  phil Add an entry for the HP ScanJet 6300C.
 1.30  30-Mar-2000  augustss branches: 1.30.2;
Get rid of register declarations.
 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
 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.
 1.25  10-Feb-1999  bouyer branches: 1.25.2;
Abort transfer if b_blkno is negative. Closes PR kern/5553 by Johan Danielsson.
 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.
 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.
 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.
 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.
 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.16.2.3  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.2.2  27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.2.1  27-Aug-1997  thorpej file ss.c was added on branch marc-pcmcia on 1997-08-27 23:33:34 +0000
 1.17.2.1  22-Nov-1997  mellon Pull rev 1.18 up from trunk (augustss)
 1.25.2.2  20-Jan-2000  he Pull up revision 1.28 (requested by abs):
Newline terminate 'ss:' attach message.
 1.25.2.1  17-Jan-2000  he Pull up revision 1.27 (requested by abs):
Allow ioctl() on all scanner device nodes - allows SANE to work.
 1.26.8.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.26.2.6  21-Apr-2001  bouyer Get rid of references to sc_link/scsipi_link in debug or comments.
 1.26.2.5  06-Jan-2001  bouyer Make compile.
 1.26.2.4  05-Jan-2001  bouyer Sync with HEAD
 1.26.2.3  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.

Main changes to the scsipi code itself:
- add a scsipi_channel->type to allow umass to attach to both atapibus and
scsibus. Will die when IDE is converted from ata_atapi_attach to
scsipi_channel/scsipi_adapter
- Add a chan_defquirks to scsipi_channel so that adapters can pass a default
set of quirks to be set for each device attached
- add adapt_getgeom and adapt_accesschk callbacks
 1.26.2.2  01-Nov-1999  thorpej Fixup the SC_DEBUG() stuff for the new world order.
 1.26.2.1  19-Oct-1999  thorpej Completely rewritten scsipi_xfer execution engine:
- 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).

There is a lot more work to do, but this correctly functions for the most
part on several file servers I run.
 1.30.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.33.2.8  11-Nov-2002  nathanw Catch up to -current
 1.33.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.33.2.6  17-Sep-2002  nathanw Catch up to -current.
 1.33.2.5  01-Aug-2002  nathanw Catch up to -current.
 1.33.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.33.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.33.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.33.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.35.2.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.35.2.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.35.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.35.2.1  03-Aug-2001  lukem update to -current
 1.36.2.2  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.36.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.38.8.2  29-Aug-2002  gehenna catch up with -current.
 1.38.8.1  16-May-2002  gehenna Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
 1.49.2.10  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.2.9  01-Apr-2005  skrll Sync with HEAD.
 1.49.2.8  02-Nov-2004  skrll Sync with HEAD.
 1.49.2.7  19-Oct-2004  skrll Sync with HEAD
 1.49.2.6  21-Sep-2004  skrll Fix the sync with head I botched.
 1.49.2.5  18-Sep-2004  skrll Sync with HEAD.
 1.49.2.4  03-Sep-2004  skrll Sync with HEAD
 1.49.2.3  25-Aug-2004  skrll Sync with HEAD.
 1.49.2.2  03-Aug-2004  skrll Sync with HEAD
 1.49.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.51.2.1  11-Sep-2004  he Pull up revision 1.53 (via patch, requested by bouyer in ticket #837):
Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
The theory is that other consumers of pool memory is causing
this memory shortage in certain somewhat hard to reproduce
situations.
This is done by giving scsipi_command an extra argument to
optionally pass a preallocated scsipi_xfer, and allocating a
scsipi_xfer before dequeueing a buffer in the various *start()
functions. If the allocation of a scsipi_xfer fails, schedule
a callout for delayed invocation of the start function. Also
reserve one page for scsipi_xfer structs, to ensure that we will
eventually have some available once pending commands complete.
Should fix PR#25670.
 1.57.4.1  29-Apr-2005  kent sync with -current
 1.59.4.1  06-Apr-2005  tron Pull up revision 1.60 (requested by yamt in ticket #112):
introduce a function to drain bufq and use it where appropriate.
 1.61.2.3  03-Sep-2007  yamt sync with head.
 1.61.2.2  30-Dec-2006  yamt sync with head.
 1.61.2.1  21-Jun-2006  yamt sync with head.
 1.63.6.1  22-Apr-2006  simonb Sync with head.
 1.63.4.1  09-Sep-2006  rpaulo sync with head
 1.63.2.1  01-Mar-2006  yamt sync with head.
 1.64.6.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.64.4.1  19-Apr-2006  elad sync with head.
 1.64.2.2  03-Sep-2006  yamt sync with head.
 1.64.2.1  01-Apr-2006  yamt sync with head.
 1.67.4.2  10-Dec-2006  yamt sync with head.
 1.67.4.1  22-Oct-2006  yamt sync with head
 1.67.2.1  18-Nov-2006  ad Sync with head.
 1.69.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.70.4.1  11-Jul-2007  mjf Sync with head.
 1.70.2.3  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.70.2.2  01-Jul-2007  ad Adapt to callout API change.
 1.70.2.1  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.71.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.72.28.2  29-Jul-2007  ad 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.
 1.72.28.1  29-Jul-2007  ad file ss.c was added on branch matt-mips64 on 2007-07-29 12:50:24 +0000
 1.72.26.5  17-Jan-2009  mjf Sync with HEAD.
 1.72.26.4  29-Jun-2008  mjf Sync with HEAD.
 1.72.26.3  02-Jun-2008  mjf Sync with HEAD.
 1.72.26.2  06-Apr-2008  mjf - after some discussion with agc@ i agreed it would be a good idea to move
device_unregister_* to device_deregister_* to be more like the pmf(9)
functions, especially since a lot of the time the function calls are next
to each other.

- add device_register_name() support for dk(4).
 1.72.26.1  05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.73.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.73.4.3  11-Mar-2010  yamt sync with head
 1.73.4.2  16-May-2009  yamt sync with head
 1.73.4.1  04-May-2009  yamt sync with head.
 1.73.2.1  17-Jun-2008  yamt sync with head.
 1.74.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.76.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.80.18.1  02-Mar-2012  riz Pull up following revision(s) (requested by mbalmer in ticket #65):
sys/dev/scsipi/ss_scanjet.c: revision 1.52
sys/dev/scsipi/ss.c: revision 1.81
sys/dev/scsipi/ssvar.h: revision 1.19
sys/dev/scsipi/ss_mustek.c: revision 1.41
Convert to device_t, aka softc/device_t split, and clean up a bit the code.
 1.80.16.3  06-Mar-2012  mrg sync to -current
 1.80.16.2  06-Mar-2012  mrg sync to -current
 1.80.16.1  04-Mar-2012  mrg sync to latest -current.
 1.80.12.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.80.12.1  17-Apr-2012  yamt sync with head
 1.84.4.1  18-May-2014  rmind sync with head
 1.84.2.3  03-Dec-2017  jdolecek update from HEAD
 1.84.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.84.2.1  12-Sep-2012  tls Initial snapshot of work to eliminate 64K MAXPHYS. Basically works for
physio (I/O to raw devices); needs more doing to get it going with the
filesystems, but it shouldn't damage data.

All work's been done on amd64 so far. Not hard to add support to other
ports. If others want to pitch in, one very helpful thing would be to
sort out when and how IDE disks can do 128K or larger transfers, and
adjust the various PCI IDE (or at least ahcisata) drivers and wd.c
accordingly -- it would make testing much easier. Another very helpful
thing would be to implement a smart minphys() for RAIDframe along the
lines detailed in the MAXPHYS-NOTES file.
 1.85.2.1  10-Aug-2014  tls Rebase.
 1.86.8.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.86.4.2  28-Aug-2017  skrll Sync with HEAD
 1.86.4.1  05-Dec-2016  skrll Sync with HEAD
 1.88.8.1  21-Jun-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #53):
sys/dev/scsipi/atapiconf.c: revision 1.91
sys/dev/scsipi/cd.c: revision 1.341
sys/dev/scsipi/scsi_base.c: revision 1.92
sys/dev/scsipi/scsiconf.c: revision 1.280
sys/dev/scsipi/scsipi_base.c: revisions 1.176, 1.177
sys/dev/scsipi/sd.c: revision 1.325
sys/dev/scsipi/ss.c: revision 1.89
sys/dev/scsipi/st.c: revision 1.231
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.
--
pass config_detach error to caller.

RSS XML Feed