Home | History | Annotate | Download | only in scsipi
History log of /src/sys/dev/scsipi/scsipi_base.h
RevisionDateAuthorComments
 1.24  26-Feb-2017  maya Add a DEBUG assert for the problem noted in PR kern/51731
of some drivers not sufficiently locking.

The relevant drivers might not work, but if someone gets around to them
then the problem could be visible.

sd doesn't trip the assert.
 1.23  20-Nov-2016  mlelstv branches: 1.23.2;
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.22  28-Apr-2008  martin branches: 1.22.44; 1.22.64; 1.22.68;
Remove clause 3 and 4 from TNF licenses
 1.21  16-Nov-2006  christos branches: 1.21.48; 1.21.50; 1.21.52;
__unused removal on arguments; approved by core.
 1.20  16-Feb-2006  perry branches: 1.20.14; 1.20.16;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.19  24-Dec-2005  perry branches: 1.19.2; 1.19.4; 1.19.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.18  11-Dec-2005  christos merge ktrace-lwp.
 1.17  01-Feb-2005  reinoud branches: 1.17.6;
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.16  31-Jan-2005  reinoud As part of cleaning up sys/scsipi, replace all u_char by uint8_t and
replace all `short' with int16_t.
 1.15  18-Sep-2004  mycroft branches: 1.15.4;
Standardize some variable names and the calling pattern for scsipi_command().
Use void pointer casts.
 1.14  21-Aug-2004  thorpej - De-__P.
- Use ANSI function decls.
 1.13  06-Jan-2003  matt branches: 1.13.2;
Add multiple inclusion protection.
 1.12  18-Jul-2001  thorpej bcopy -> memcpy
 1.11  25-Apr-2001  bouyer branches: 1.11.2;
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.10  28-Feb-2000  thorpej branches: 1.10.6;
Make sure to initialize xs->req_sense_length (to 0). This appears to be
a historical leftover, and very few drivers actually look at it. But the
PCI `ncr' driver does, and if this field is not initialized to its default
value, that driver will fall over flat on its face when it attempts to get
sense data from a target.
 1.9  08-Dec-1998  thorpej branches: 1.9.4; 1.9.10;
Remove xs_free_list; it no longer exists.
 1.8  15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.7  13-Feb-1998  enami Backout previous change, and rather, remove all protection but the one
actually currently required. Suggested by Charles M. Hannum.
 1.6  13-Feb-1998  enami Fix or add protection for mutiple inclusion.
 1.5  15-Jan-1998  cgd add support for an ATAPI attachment for 'sd'.
fix 'cd' driver's NCD_SCSI bogosity (was using testing wrong macro!)
clean up in various ways:
* make common atapi_mode_{sense,select}() functions.
* put ATAPI data structures in more sensible headers, split up by
device type.
* include headers a bit more carefully.
* pass flags to attachment-specific cd functions, and use them.
* get rid of SCSI bits in scsipi_base.h's scsipi_make_xs(), move
them into the correct place in scsi_base.c.
* fix minor typo in struct name in scsipiconf.h (which was apparently
never used except in a #define later in the same file).
* use __attribute__ to force 4-byte alignment for xs command store,
so that architectures trying to bus_space_write_multi_N() (where
N > 1) that data to a controller won't lose.
* clean up a few comments in typos, and make a few #defines easier to
understand/maintain.
* rename cd_link.h to cdvar.h (via repository copy). This is exactly
what a 'var' file is supposed to be.
 1.4  01-Oct-1997  enami Cosmetic changes to keep coding style consistency in this directory;

- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.
 1.3  19-Sep-1997  cgd mark scsipi_make_xs() as potentially unused, so that this can be
compiled with -Wunused without optimization/inlining enabled.
Also, make it a little bit closer to KNF.
 1.2  27-Aug-1997  bouyer branches: 1.2.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.1  01-Jul-1997  bouyer branches: 1.1.2;
file scsipi_base.h was initially added on branch bouyer-scsipi.
 1.1.2.1  01-Jul-1997  bouyer New merged scsi/atapi code. Tested on i386 and sparc. Commiting to a branch
for now, so that it can be tested on other ports too.
The config sheme is as follow:
New merged scsi/atapi code. Tested on i386 and sparc. Commiting to a branch
for now, so that it can be tested on other ports too.
The config sheme is as follow:
scsibus at aha
sd at scsibus
cd at scsibus
atapibus at wdc
cd at atapibus
cd has bus-specific config and function front-end in scsicd.c and atapicd.c
The call to theses functions from cd.c is conditionned to
NSCSICD and NATAPICD (all defined in cd.h by config).
 1.2.2.4  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.3  22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2  27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1  27-Aug-1997  thorpej file scsipi_base.h was added on branch marc-pcmcia on 1997-08-27 23:33:24 +0000
 1.9.10.4  15-Jan-2001  bouyer Handle CHECK CONDITION status in mid-layer:
the REQUEST_SENSE command is generated from scsipi_complete() so it can
tsleep() (we use a regular scsipi_command() call for this). Add a new
periph_flag, PERIPH_SENSE, and a new xs_control, XS_CTL_REQSENSE.
When PERIPH_SENSE is set only xfer with XS_CTL_REQSENSE may be sent
(same logic as PERIPH_RECOVERING but with higther priority). xfer with
XS_CTL_REQSENSE need to have XS_CTL_URGENT urgent too.
XS_CTL_USERCMD xfers are now handled in scsipi_complete().

We need to pay special attention to SCSI resets, as we may have:
- an aborted REQUEST_SENSE. In this case we need to requeue the original
command, not the request sense.
- sense pending for a command no longer in the queue but for which a
request sense has not yet been queued. In this case we should not issue
the request sense but requeue the original command instead.

For this:
- the xfer with the CHECK CONDITION status is stored in the scsipi_periph
(periph_xscheck); the CHECK CONDITION is tested in scsipi_done, PERIPH_SENSE
and periph_xscheck is set here.
- XS_CTL_REQSENSE xfers are not allowed to be requeued, and are terminated
with EINTR in case of reset.
- we have a new async event, "ASYNC_EVENT_RESET", which cleanup the
xfer in periph_xscheck.
- appropriate splbio/splx to avoid race condition (especially,
scsipi_request_sense() runs at splbio. Should not be a real problem as it
doesn't happen often.

While I'm there kill req_sense_length from struct scsipi_xfer, it's always set
to 0 and only checked by a few drivers.
 1.9.10.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.9.10.2  04-Feb-2000  thorpej Make sure the channel's completion thread exits when the channel
is detached, and completely encapsulate the way periph's are stored
by the channel.
 1.9.10.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.9.4.1  28-Feb-2000  he Pull up revision 1.10 (requested by thorpej):
Make sure to initialize the ``req_sense_length'' field. Fixes
a serious problem with the PCI ``ncr'' driver.
 1.10.6.3  07-Jan-2003  thorpej Sync with HEAD.
 1.10.6.2  24-Aug-2001  nathanw Catch up with -current.
 1.10.6.1  21-Jun-2001  nathanw Catch up to -current.
 1.11.2.1  03-Aug-2001  lukem update to -current
 1.13.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.13.2.1  25-Aug-2004  skrll Sync with HEAD.
 1.15.4.1  29-Apr-2005  kent sync with -current
 1.17.6.1  30-Dec-2006  yamt sync with head.
 1.19.6.1  22-Apr-2006  simonb Sync with head.
 1.19.4.1  09-Sep-2006  rpaulo sync with head
 1.19.2.1  18-Feb-2006  yamt sync with head.
 1.20.16.1  10-Dec-2006  yamt sync with head.
 1.20.14.1  18-Nov-2006  ad Sync with head.
 1.21.52.1  16-May-2008  yamt sync with head.
 1.21.50.1  18-May-2008  yamt sync with head.
 1.21.48.1  02-Jun-2008  mjf Sync with HEAD.
 1.22.68.2  20-Mar-2017  pgoyette Sync with HEAD
 1.22.68.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.22.64.2  28-Aug-2017  skrll Sync with HEAD
 1.22.64.1  05-Dec-2016  skrll Sync with HEAD
 1.22.44.1  03-Dec-2017  jdolecek update from HEAD
 1.23.2.1  21-Apr-2017  bouyer Sync with HEAD

RSS XML Feed