History log of /netbsd-current/sys/dev/ic/siop.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.105 08-Feb-2024 andvar

s/should't/shouldn't/ and s/mistmatch/mismatch/ in comments.


Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base
# 1.104 02-Nov-2022 andvar

s/ourselve/ourselves/ in comments.


Revision tags: bouyer-sunxi-drm-base
# 1.103 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
# 1.102 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: 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
# 1.101 24-Apr-2021 thorpej

branches: 1.101.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 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 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 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 yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 02-Nov-2013 gson

branches: 1.100.46;
Turn the "esiop_intr: I shouldn't be there !" panic into a printf
followed by a return from the interrupt handler. The condition is
triggered on some KVM virtual hosts, apparently harmlessly, and not
panicing makes it possible to boot a NetBSD GENERIC kernel on those
hosts. Also make the same change to siop to minimize divergence
between siop and esiop. Fixes PR kern/48277.


# 1.99 30-Oct-2013 gson

Fix incorrect function names in panic message strings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.98 13-Nov-2010 uebayasi

branches: 1.98.8; 1.98.18; 1.98.22;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.97 09-Sep-2010 jakllsch

Allow e?siop_dump_script() to work with on-chip RAM. Prefix
DUMP_SCRIPT with SIOP_. Additionally, avoid undefining DEBUG,
condition on SIOP_DEBUG instead.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.96 02-May-2010 jakllsch

Add (missing) newlines to error messages.


Revision tags: uebayasi-xip-base1
# 1.95 09-Apr-2010 jakllsch

Improve error paths in (e)siop_scsipi_request():

- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.

Analysis and fix from Michael L. Hitch in PR/42844.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-nbase
# 1.94 19-Oct-2009 bouyer

branches: 1.94.2; 1.94.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !


Revision tags: yamt-nfs-mp-base8
# 1.93 04-Sep-2009 tsutsui

Remove unnecessary whitespace.


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4
# 1.92 16-May-2009 tsutsui

Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)


# 1.91 15-May-2009 tsutsui

Split device_t/softc.

No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.90 15-Mar-2009 cegger

ansify function definitions


# 1.89 14-Mar-2009 dsl

ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.


# 1.88 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 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 nick-hppapmap-base2 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 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base
# 1.87 08-Apr-2008 cegger

branches: 1.87.4; 1.87.12; 1.87.14; 1.87.18;
use aprint_*_dev and device_xname


# 1.86 27-Mar-2008 skrll

Add support for the (non-pci) NCR 53c720/770 in big-endian mode.

From OpenBSD (Mark Kettenis)


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.85 19-Oct-2007 ad

branches: 1.85.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.84 30-Sep-2007 martin

branches: 1.84.2;
Do not stop callouts on polled commands. Problem noticed by Chris Ross
when trying to do a kernel dump on sparc64.
Approved by Manuel Bouyer.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.83 04-Mar-2007 christos

branches: 1.83.2; 1.83.14; 1.83.16; 1.83.18;
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.82 02-Nov-2006 garbled

branches: 1.82.4;
Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.


# 1.81 02-Nov-2006 garbled

Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.80 24-Dec-2005 perry

branches: 1.80.20; 1.80.22;
__inline__ -> inline


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.79 18-Nov-2005 bouyer

Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value
(eventually resid would not be updated at all if there was only one data
phase). To fix this, have the script save the offset in the data tables at
disconnect time if there was a transfer, and use this to compute the resid
if the current offset is 0.
Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi.
Fix kern/31990 by YAMAMOTO Takashi.


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.78 27-Feb-2005 perry

branches: 1.78.2; 1.78.4; 1.78.10;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.77 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.76 03-Oct-2004 bouyer

branches: 1.76.4; 1.76.6;
Add missing return, fix handling of Ignore Wide Residue messages.


# 1.75 17-May-2004 bouyer

Add support for the Ignore Wide Residue SCSI message.


# 1.74 17-May-2004 bouyer

when an unexpected disconnect occurs only compute the resid; do the
real save data pointers when we get the message (or rather, at disconnect
time following the message).
Factor out code to do this, and to deal with xs->resid, in siop_common.c.


# 1.73 17-May-2004 bouyer

Properly compute xs->resid, instead of assuming it'll always be 0 when
a command is done.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.72 16-Mar-2004 bouyer

branches: 1.72.4;
cbd -> cdb
Command Block Descriptor -> Command Descriptor Block
Pointed out by Allen Briggs.


# 1.71 15-Mar-2004 bouyer

Extract the code printing the CBD from scsipi_print_sense(), so that it's
usable in other context.
Use the new scsipi_print_cbd() to dump the command in case of timeout
in siop/esiop.


# 1.70 02-Nov-2003 wiz

Fix some typos. From Tom Cosgrove via jmc@openbsd.


# 1.69 28-Oct-2003 matt

fix bogus GCC uninitialized variable warning. Use TAILQ_FOREACH.


# 1.68 25-Oct-2003 christos

Fix uninitialized variable warnings


# 1.67 21-Oct-2003 simonb

Remove return after panic().


# 1.66 03-May-2003 wiz

branches: 1.66.2;
DMA, not dma nor Dma.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.65 08-Nov-2002 bouyer

in siop_reset(), reset sc_ntargets to 0. The number of targets will be
computed again in siop_add_reselsw()
in siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff.
If siop_add_dev() fails this time we would use the old reseloff, clobbering
memory now used for something else.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.64 26-Jul-2002 wiz

enouth -> enough.


# 1.63 18-Jul-2002 wiz

Spell 'should' correctly.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.62 18-May-2002 bouyer

branches: 1.62.2;
Be more verbose when returning XS_DRIVER_STUFFUP


# 1.61 16-May-2002 thorpej

Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().


# 1.60 25-Apr-2002 bouyer

branches: 1.60.2;
It's not safe to access the SCNTL1 register while the SCRIPT is running.
On the 1010 this can wedge the chip. So abort the script instead.
the abort interrupt will trigger a bus reset.


# 1.59 23-Apr-2002 bouyer

More copyright fixes, pointed out by Thomas. Thanks !


# 1.58 23-Apr-2002 bouyer

- factor out parts of (e)siop_attach() to siop_common_attach()
- Add support for DT transfers (aka Ultra/160) in esiop

Note that DT transfers are not enabled for 53c1010-33 rev 0 yet; if I trust
FreeBSD it has a bug which prevent them to do DT properly.
From the same source there may be issues with some revs of 53c1010-66.


# 1.57 23-Apr-2002 bouyer

Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.


# 1.56 23-Apr-2002 bouyer

Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
From Jason R Thorpe.


# 1.55 22-Apr-2002 bouyer

Fix last change: assign siop_cmd->tag in callers instead of siop_setuptables(),
and use siop_cmd->tag instead of xs->xs_tag_id. This way siop can use
xs->xs_tag_id + 1 without interferences with esiop.


# 1.54 22-Apr-2002 bouyer

In siop_setuptables(), use the proposed tag_id, not tag_id +1.
In siop.c bump siop_cmd->tag by one as tag id 0 is reserved for untagged cmds.


# 1.53 20-Apr-2002 bouyer

Move a few things around, so that ic/siop_common.c and pci/siop_pci_common.c
can be compiled without including siopvar.h.


# 1.52 18-Apr-2002 bouyer

If SIOP_SYMLED is defined, drive the activity LED though GPIO pin 1.


# 1.51 05-Apr-2002 bouyer

Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.


Revision tags: eeh-devprop-base newlock-base
# 1.50 01-Mar-2002 bouyer

As siop_morecbd() is called from the kernel thread, protect access to the
queues with splbio.


Revision tags: ifpoll-base
# 1.49 12-Jan-2002 tsutsui

Call malloc(9) with M_ZERO flag instead of memset() after malloc().


# 1.48 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base
# 1.47 14-Oct-2001 bouyer

Call siop_morecbd() only when scsipi ask us ADAPTER_REQ_GROW_RESOURCES.
This prevent using bus_dmamem_map() from interrupt context.
Should fix kern/13827.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.46 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.45 21-Jun-2001 bouyer

branches: 1.45.2;
Also print DSA addr in a DIAGNOSTING printf.


# 1.44 23-May-2001 bouyer

Call scsipi_channel_thaw() after scsipi_done() so that command ordering
is preserved.


# 1.43 30-Apr-2001 lukem

delint newline in string


# 1.42 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.41 07-Mar-2001 thorpej

Add BUS_DMA_STREAMING to data transfer maps.


# 1.40 01-Mar-2001 thorpej

branches: 1.40.2;
Differentiate a couple of similar error message, and add newlines
on the end of them.


# 1.39 11-Feb-2001 bouyer

Avoid sending new commands to the device if it has sense pending:
- run request sense command without disconnect
- don't restart the script before siop_scsicmd_end has been called if the
cmd didn't complete with good status.
- reserve slot 0 for request sense, to make sure it'll be sent first.


# 1.38 26-Jan-2001 bouyer

Add a few siop_table_sync() calls.


# 1.37 14-Nov-2000 thorpej

branches: 1.37.2;
NBPG -> PAGE_SIZE


# 1.36 23-Oct-2000 bouyer

Fixes related to QUEUE FULL status:
- move status handling in siop_scsicmd_end(), it's better than in siop_intr()
- define 2 internal SIOP status, for "no status reported by device" and
reset condition
- add a list of "urgent" command, to be executed before the list of command
queued the normal way; this is used for command which got aborted
by a QUEUE FULL and have to be requeued in order.
- Don't accept to send a Q_TAG message not immediatly folowing a IDENTIFY


# 1.35 23-Oct-2000 bouyer

Rearrange for script changes (scheduler core in main script, command part
of the scheduler in command table).
Add tagged command queuing support.


# 1.34 21-Oct-2000 bouyer

Ops, sync the script DMA map when the script RAM *don't* exists.


# 1.33 19-Oct-2000 bouyer

Adapt for script change: don't assume Ent_lun_switch_entry == 0


# 1.32 18-Oct-2000 bouyer

Ops, add proper bus_dmamap_sync() calls for reselect switch operations.


# 1.31 18-Oct-2000 bouyer

Adapt for new lun switch script.
Implement SCBUSACCEL ioctl.
Snapshot of work in progress on tagged queuing: we can send/receive
queue tag messages. Infrastructure to manage multiple commands per
devices not here yet.


# 1.30 06-Oct-2000 bouyer

Ops, disable debugging messages.


# 1.29 06-Oct-2000 bouyer

Fix recurent typo: shed->sched


# 1.28 06-Oct-2000 bouyer

Adapt for reselect handling from the script. While here, fix typo
(SIOP_SCXFER -> SIOP_SXFER).


# 1.27 27-Jul-2000 bouyer

Force 64bit arithmetic for timeout computation; a 32bit int opverflows for
large timeouts. Should fix PR kern/10575.


# 1.26 24-Jul-2000 bouyer

create a funcion, siop_busreset(), to reset the scsibus.
Reset the scsi bus at attach time, to be sure all devices start in narrow/async
mode.
Defer sync/wide negotiation until after whe have a valid
xs->sc_link->device_softc, so that we can honnor the NOSYNC/NOWIDE quirks.


# 1.25 19-Jul-2000 pk

Fixx off-by-one error in handlereset().


# 1.24 28-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.23 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


# 1.22 20-Jun-2000 bouyer

Patch from Eduardo Horvath: don't bus_dmamap_sync the script dma map if
it lives in the on-chip RAM !


Revision tags: netbsd-1-5-base
# 1.21 13-Jun-2000 bouyer

branches: 1.21.2;
sheduler->scheduler, as pointed out by Klaus Klein


# 1.20 12-Jun-2000 bouyer

Handle "scsi bus mode change" interrupts on 895 and higther.
Thanks to Hal Murray for reporting the problem and testing the fix.


# 1.19 07-Jun-2000 tsutsui

Adapt struct scsipi_adapter changes.


# 1.18 05-Jun-2000 bouyer

use the correct variable in a debug printf().


Revision tags: minoura-xpg4dl-base
# 1.17 25-May-2000 bouyer

branches: 1.17.2;
Separate the sheduler from the main script, allocate another DMA-safe
memory page for the sheduler. Put the main script in the on-chip RAM when
available.
Avoid a null-pointer dereference when DSA is invalid.


# 1.16 23-May-2000 bouyer

Allocate dynamically the command block descriptors.


# 1.15 15-May-2000 bouyer

Don't enable debug message by default.


# 1.14 15-May-2000 bouyer

- split siop.c in script-dependant vs script-independant part, for
comming esiop
- add a reset callback for bus-dependant registers settings


# 1.13 11-May-2000 bouyer

Use correct divider value for scxfer


# 1.12 06-May-2000 soren

Typos.


# 1.11 05-May-2000 bouyer

Ops, restore sync/wide parameters after a reselect.
Also, better handling of parity errors.


# 1.10 05-May-2000 bouyer

Rework the command queue, to avoid having commands blocked at the end
of the queue. Load is now properly balanced across all disks of the same bus.


# 1.9 04-May-2000 bouyer

When a WDTR message is rejected, initiate sync negotiation anyway.
When a SDTR message is rejected indicate that target is async
Add a missing bus_dma_sync call.


# 1.8 04-May-2000 bouyer

- LP64 issues in debug printfs.
- on a phase mismatch, do byte recovery only if we were in data phase.
Otherwise just clear the fifo.
- Properly handle reject of a sync or wide negotiation.


# 1.7 02-May-2000 bouyer

- do sync/wide negotiation
- use a circular queue for the start slots, so that order has better chances
to be preserved.


# 1.6 27-Apr-2000 bouyer

More big-endian fixes from Izumi Tsutsui.


# 1.5 27-Apr-2000 bouyer

Fix copyrigth notice.


# 1.4 26-Apr-2000 bouyer

Big-endian fixes from Izumi Tsutsui.


# 1.3 25-Apr-2000 bouyer

Ops, need to restore correct DSA value after a phase mismatch, we may have
been interrupted during a S/G operation.


# 1.2 25-Apr-2000 bouyer

- Change the script to start new commands in an asyncronous way, using
'command slots' in which the host can put command and wait for the script
to start them
- Change siop.c to do full disconnect/reslelect, allowing as much as one
command per target/lun to run in parallel.
- Fix bug in registers init where a board without BIOS would end at
ID 0 (now the driver works on alpha too).
- better handling of messages, sending back a MSG_EXT_SDTR in response to an
incoming MSG_EXT_SDTR, and MSG_MESSAGE_REJECT for unhandled messages.
- fix use of bus_dmamap_sync() and htole32().
- supports shared interrups
- change some int8 and int16 to int, for alpha and mips benefits ( suggested by
Toru Nishimura)


# 1.1 21-Apr-2000 bouyer

Snapshot of work in progress: new driver for the NCR 53c8xx SCSI controller
(the name 'siop' is still being discussed, may change).
Only basic disconnect/reselect for now, no sync/wide negotiation.
Tested with 810A, 875 and 895 on i386 only.
The bus-independant part should also be able to handle the 53c720 and 53c770.
A new driver with enhanced script should appear for the 825/875/895 'soon'.


# 1.104 02-Nov-2022 andvar

s/ourselve/ourselves/ in comments.


Revision tags: bouyer-sunxi-drm-base
# 1.103 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
# 1.102 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: 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
# 1.101 24-Apr-2021 thorpej

branches: 1.101.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 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 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 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 yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 02-Nov-2013 gson

branches: 1.100.46;
Turn the "esiop_intr: I shouldn't be there !" panic into a printf
followed by a return from the interrupt handler. The condition is
triggered on some KVM virtual hosts, apparently harmlessly, and not
panicing makes it possible to boot a NetBSD GENERIC kernel on those
hosts. Also make the same change to siop to minimize divergence
between siop and esiop. Fixes PR kern/48277.


# 1.99 30-Oct-2013 gson

Fix incorrect function names in panic message strings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.98 13-Nov-2010 uebayasi

branches: 1.98.8; 1.98.18; 1.98.22;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.97 09-Sep-2010 jakllsch

Allow e?siop_dump_script() to work with on-chip RAM. Prefix
DUMP_SCRIPT with SIOP_. Additionally, avoid undefining DEBUG,
condition on SIOP_DEBUG instead.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.96 02-May-2010 jakllsch

Add (missing) newlines to error messages.


Revision tags: uebayasi-xip-base1
# 1.95 09-Apr-2010 jakllsch

Improve error paths in (e)siop_scsipi_request():

- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.

Analysis and fix from Michael L. Hitch in PR/42844.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-nbase
# 1.94 19-Oct-2009 bouyer

branches: 1.94.2; 1.94.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !


Revision tags: yamt-nfs-mp-base8
# 1.93 04-Sep-2009 tsutsui

Remove unnecessary whitespace.


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4
# 1.92 16-May-2009 tsutsui

Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)


# 1.91 15-May-2009 tsutsui

Split device_t/softc.

No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.90 15-Mar-2009 cegger

ansify function definitions


# 1.89 14-Mar-2009 dsl

ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.


# 1.88 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 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 nick-hppapmap-base2 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 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base
# 1.87 08-Apr-2008 cegger

branches: 1.87.4; 1.87.12; 1.87.14; 1.87.18;
use aprint_*_dev and device_xname


# 1.86 27-Mar-2008 skrll

Add support for the (non-pci) NCR 53c720/770 in big-endian mode.

From OpenBSD (Mark Kettenis)


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.85 19-Oct-2007 ad

branches: 1.85.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.84 30-Sep-2007 martin

branches: 1.84.2;
Do not stop callouts on polled commands. Problem noticed by Chris Ross
when trying to do a kernel dump on sparc64.
Approved by Manuel Bouyer.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.83 04-Mar-2007 christos

branches: 1.83.2; 1.83.14; 1.83.16; 1.83.18;
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.82 02-Nov-2006 garbled

branches: 1.82.4;
Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.


# 1.81 02-Nov-2006 garbled

Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.80 24-Dec-2005 perry

branches: 1.80.20; 1.80.22;
__inline__ -> inline


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.79 18-Nov-2005 bouyer

Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value
(eventually resid would not be updated at all if there was only one data
phase). To fix this, have the script save the offset in the data tables at
disconnect time if there was a transfer, and use this to compute the resid
if the current offset is 0.
Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi.
Fix kern/31990 by YAMAMOTO Takashi.


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.78 27-Feb-2005 perry

branches: 1.78.2; 1.78.4; 1.78.10;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.77 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.76 03-Oct-2004 bouyer

branches: 1.76.4; 1.76.6;
Add missing return, fix handling of Ignore Wide Residue messages.


# 1.75 17-May-2004 bouyer

Add support for the Ignore Wide Residue SCSI message.


# 1.74 17-May-2004 bouyer

when an unexpected disconnect occurs only compute the resid; do the
real save data pointers when we get the message (or rather, at disconnect
time following the message).
Factor out code to do this, and to deal with xs->resid, in siop_common.c.


# 1.73 17-May-2004 bouyer

Properly compute xs->resid, instead of assuming it'll always be 0 when
a command is done.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.72 16-Mar-2004 bouyer

branches: 1.72.4;
cbd -> cdb
Command Block Descriptor -> Command Descriptor Block
Pointed out by Allen Briggs.


# 1.71 15-Mar-2004 bouyer

Extract the code printing the CBD from scsipi_print_sense(), so that it's
usable in other context.
Use the new scsipi_print_cbd() to dump the command in case of timeout
in siop/esiop.


# 1.70 02-Nov-2003 wiz

Fix some typos. From Tom Cosgrove via jmc@openbsd.


# 1.69 28-Oct-2003 matt

fix bogus GCC uninitialized variable warning. Use TAILQ_FOREACH.


# 1.68 25-Oct-2003 christos

Fix uninitialized variable warnings


# 1.67 21-Oct-2003 simonb

Remove return after panic().


# 1.66 03-May-2003 wiz

branches: 1.66.2;
DMA, not dma nor Dma.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.65 08-Nov-2002 bouyer

in siop_reset(), reset sc_ntargets to 0. The number of targets will be
computed again in siop_add_reselsw()
in siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff.
If siop_add_dev() fails this time we would use the old reseloff, clobbering
memory now used for something else.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.64 26-Jul-2002 wiz

enouth -> enough.


# 1.63 18-Jul-2002 wiz

Spell 'should' correctly.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.62 18-May-2002 bouyer

branches: 1.62.2;
Be more verbose when returning XS_DRIVER_STUFFUP


# 1.61 16-May-2002 thorpej

Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().


# 1.60 25-Apr-2002 bouyer

branches: 1.60.2;
It's not safe to access the SCNTL1 register while the SCRIPT is running.
On the 1010 this can wedge the chip. So abort the script instead.
the abort interrupt will trigger a bus reset.


# 1.59 23-Apr-2002 bouyer

More copyright fixes, pointed out by Thomas. Thanks !


# 1.58 23-Apr-2002 bouyer

- factor out parts of (e)siop_attach() to siop_common_attach()
- Add support for DT transfers (aka Ultra/160) in esiop

Note that DT transfers are not enabled for 53c1010-33 rev 0 yet; if I trust
FreeBSD it has a bug which prevent them to do DT properly.
From the same source there may be issues with some revs of 53c1010-66.


# 1.57 23-Apr-2002 bouyer

Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.


# 1.56 23-Apr-2002 bouyer

Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
From Jason R Thorpe.


# 1.55 22-Apr-2002 bouyer

Fix last change: assign siop_cmd->tag in callers instead of siop_setuptables(),
and use siop_cmd->tag instead of xs->xs_tag_id. This way siop can use
xs->xs_tag_id + 1 without interferences with esiop.


# 1.54 22-Apr-2002 bouyer

In siop_setuptables(), use the proposed tag_id, not tag_id +1.
In siop.c bump siop_cmd->tag by one as tag id 0 is reserved for untagged cmds.


# 1.53 20-Apr-2002 bouyer

Move a few things around, so that ic/siop_common.c and pci/siop_pci_common.c
can be compiled without including siopvar.h.


# 1.52 18-Apr-2002 bouyer

If SIOP_SYMLED is defined, drive the activity LED though GPIO pin 1.


# 1.51 05-Apr-2002 bouyer

Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.


Revision tags: eeh-devprop-base newlock-base
# 1.50 01-Mar-2002 bouyer

As siop_morecbd() is called from the kernel thread, protect access to the
queues with splbio.


Revision tags: ifpoll-base
# 1.49 12-Jan-2002 tsutsui

Call malloc(9) with M_ZERO flag instead of memset() after malloc().


# 1.48 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base
# 1.47 14-Oct-2001 bouyer

Call siop_morecbd() only when scsipi ask us ADAPTER_REQ_GROW_RESOURCES.
This prevent using bus_dmamem_map() from interrupt context.
Should fix kern/13827.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.46 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.45 21-Jun-2001 bouyer

branches: 1.45.2;
Also print DSA addr in a DIAGNOSTING printf.


# 1.44 23-May-2001 bouyer

Call scsipi_channel_thaw() after scsipi_done() so that command ordering
is preserved.


# 1.43 30-Apr-2001 lukem

delint newline in string


# 1.42 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.41 07-Mar-2001 thorpej

Add BUS_DMA_STREAMING to data transfer maps.


# 1.40 01-Mar-2001 thorpej

branches: 1.40.2;
Differentiate a couple of similar error message, and add newlines
on the end of them.


# 1.39 11-Feb-2001 bouyer

Avoid sending new commands to the device if it has sense pending:
- run request sense command without disconnect
- don't restart the script before siop_scsicmd_end has been called if the
cmd didn't complete with good status.
- reserve slot 0 for request sense, to make sure it'll be sent first.


# 1.38 26-Jan-2001 bouyer

Add a few siop_table_sync() calls.


# 1.37 14-Nov-2000 thorpej

branches: 1.37.2;
NBPG -> PAGE_SIZE


# 1.36 23-Oct-2000 bouyer

Fixes related to QUEUE FULL status:
- move status handling in siop_scsicmd_end(), it's better than in siop_intr()
- define 2 internal SIOP status, for "no status reported by device" and
reset condition
- add a list of "urgent" command, to be executed before the list of command
queued the normal way; this is used for command which got aborted
by a QUEUE FULL and have to be requeued in order.
- Don't accept to send a Q_TAG message not immediatly folowing a IDENTIFY


# 1.35 23-Oct-2000 bouyer

Rearrange for script changes (scheduler core in main script, command part
of the scheduler in command table).
Add tagged command queuing support.


# 1.34 21-Oct-2000 bouyer

Ops, sync the script DMA map when the script RAM *don't* exists.


# 1.33 19-Oct-2000 bouyer

Adapt for script change: don't assume Ent_lun_switch_entry == 0


# 1.32 18-Oct-2000 bouyer

Ops, add proper bus_dmamap_sync() calls for reselect switch operations.


# 1.31 18-Oct-2000 bouyer

Adapt for new lun switch script.
Implement SCBUSACCEL ioctl.
Snapshot of work in progress on tagged queuing: we can send/receive
queue tag messages. Infrastructure to manage multiple commands per
devices not here yet.


# 1.30 06-Oct-2000 bouyer

Ops, disable debugging messages.


# 1.29 06-Oct-2000 bouyer

Fix recurent typo: shed->sched


# 1.28 06-Oct-2000 bouyer

Adapt for reselect handling from the script. While here, fix typo
(SIOP_SCXFER -> SIOP_SXFER).


# 1.27 27-Jul-2000 bouyer

Force 64bit arithmetic for timeout computation; a 32bit int opverflows for
large timeouts. Should fix PR kern/10575.


# 1.26 24-Jul-2000 bouyer

create a funcion, siop_busreset(), to reset the scsibus.
Reset the scsi bus at attach time, to be sure all devices start in narrow/async
mode.
Defer sync/wide negotiation until after whe have a valid
xs->sc_link->device_softc, so that we can honnor the NOSYNC/NOWIDE quirks.


# 1.25 19-Jul-2000 pk

Fixx off-by-one error in handlereset().


# 1.24 28-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.23 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


# 1.22 20-Jun-2000 bouyer

Patch from Eduardo Horvath: don't bus_dmamap_sync the script dma map if
it lives in the on-chip RAM !


Revision tags: netbsd-1-5-base
# 1.21 13-Jun-2000 bouyer

branches: 1.21.2;
sheduler->scheduler, as pointed out by Klaus Klein


# 1.20 12-Jun-2000 bouyer

Handle "scsi bus mode change" interrupts on 895 and higther.
Thanks to Hal Murray for reporting the problem and testing the fix.


# 1.19 07-Jun-2000 tsutsui

Adapt struct scsipi_adapter changes.


# 1.18 05-Jun-2000 bouyer

use the correct variable in a debug printf().


Revision tags: minoura-xpg4dl-base
# 1.17 25-May-2000 bouyer

branches: 1.17.2;
Separate the sheduler from the main script, allocate another DMA-safe
memory page for the sheduler. Put the main script in the on-chip RAM when
available.
Avoid a null-pointer dereference when DSA is invalid.


# 1.16 23-May-2000 bouyer

Allocate dynamically the command block descriptors.


# 1.15 15-May-2000 bouyer

Don't enable debug message by default.


# 1.14 15-May-2000 bouyer

- split siop.c in script-dependant vs script-independant part, for
comming esiop
- add a reset callback for bus-dependant registers settings


# 1.13 11-May-2000 bouyer

Use correct divider value for scxfer


# 1.12 06-May-2000 soren

Typos.


# 1.11 05-May-2000 bouyer

Ops, restore sync/wide parameters after a reselect.
Also, better handling of parity errors.


# 1.10 05-May-2000 bouyer

Rework the command queue, to avoid having commands blocked at the end
of the queue. Load is now properly balanced across all disks of the same bus.


# 1.9 04-May-2000 bouyer

When a WDTR message is rejected, initiate sync negotiation anyway.
When a SDTR message is rejected indicate that target is async
Add a missing bus_dma_sync call.


# 1.8 04-May-2000 bouyer

- LP64 issues in debug printfs.
- on a phase mismatch, do byte recovery only if we were in data phase.
Otherwise just clear the fifo.
- Properly handle reject of a sync or wide negotiation.


# 1.7 02-May-2000 bouyer

- do sync/wide negotiation
- use a circular queue for the start slots, so that order has better chances
to be preserved.


# 1.6 27-Apr-2000 bouyer

More big-endian fixes from Izumi Tsutsui.


# 1.5 27-Apr-2000 bouyer

Fix copyrigth notice.


# 1.4 26-Apr-2000 bouyer

Big-endian fixes from Izumi Tsutsui.


# 1.3 25-Apr-2000 bouyer

Ops, need to restore correct DSA value after a phase mismatch, we may have
been interrupted during a S/G operation.


# 1.2 25-Apr-2000 bouyer

- Change the script to start new commands in an asyncronous way, using
'command slots' in which the host can put command and wait for the script
to start them
- Change siop.c to do full disconnect/reslelect, allowing as much as one
command per target/lun to run in parallel.
- Fix bug in registers init where a board without BIOS would end at
ID 0 (now the driver works on alpha too).
- better handling of messages, sending back a MSG_EXT_SDTR in response to an
incoming MSG_EXT_SDTR, and MSG_MESSAGE_REJECT for unhandled messages.
- fix use of bus_dmamap_sync() and htole32().
- supports shared interrups
- change some int8 and int16 to int, for alpha and mips benefits ( suggested by
Toru Nishimura)


# 1.1 21-Apr-2000 bouyer

Snapshot of work in progress: new driver for the NCR 53c8xx SCSI controller
(the name 'siop' is still being discussed, may change).
Only basic disconnect/reselect for now, no sync/wide negotiation.
Tested with 810A, 875 and 895 on i386 only.
The bus-independant part should also be able to handle the 53c720 and 53c770.
A new driver with enhanced script should appear for the 825/875/895 'soon'.


# 1.103 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
# 1.102 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: 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
# 1.101 24-Apr-2021 thorpej

branches: 1.101.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: netbsd-9-2-RELEASE thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 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 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 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 yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 02-Nov-2013 gson

branches: 1.100.46;
Turn the "esiop_intr: I shouldn't be there !" panic into a printf
followed by a return from the interrupt handler. The condition is
triggered on some KVM virtual hosts, apparently harmlessly, and not
panicing makes it possible to boot a NetBSD GENERIC kernel on those
hosts. Also make the same change to siop to minimize divergence
between siop and esiop. Fixes PR kern/48277.


# 1.99 30-Oct-2013 gson

Fix incorrect function names in panic message strings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.98 13-Nov-2010 uebayasi

branches: 1.98.8; 1.98.18; 1.98.22;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.97 09-Sep-2010 jakllsch

Allow e?siop_dump_script() to work with on-chip RAM. Prefix
DUMP_SCRIPT with SIOP_. Additionally, avoid undefining DEBUG,
condition on SIOP_DEBUG instead.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.96 02-May-2010 jakllsch

Add (missing) newlines to error messages.


Revision tags: uebayasi-xip-base1
# 1.95 09-Apr-2010 jakllsch

Improve error paths in (e)siop_scsipi_request():

- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.

Analysis and fix from Michael L. Hitch in PR/42844.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-nbase
# 1.94 19-Oct-2009 bouyer

branches: 1.94.2; 1.94.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !


Revision tags: yamt-nfs-mp-base8
# 1.93 04-Sep-2009 tsutsui

Remove unnecessary whitespace.


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4
# 1.92 16-May-2009 tsutsui

Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)


# 1.91 15-May-2009 tsutsui

Split device_t/softc.

No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.90 15-Mar-2009 cegger

ansify function definitions


# 1.89 14-Mar-2009 dsl

ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.


# 1.88 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 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 nick-hppapmap-base2 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 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base
# 1.87 08-Apr-2008 cegger

branches: 1.87.4; 1.87.12; 1.87.14; 1.87.18;
use aprint_*_dev and device_xname


# 1.86 27-Mar-2008 skrll

Add support for the (non-pci) NCR 53c720/770 in big-endian mode.

From OpenBSD (Mark Kettenis)


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.85 19-Oct-2007 ad

branches: 1.85.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.84 30-Sep-2007 martin

branches: 1.84.2;
Do not stop callouts on polled commands. Problem noticed by Chris Ross
when trying to do a kernel dump on sparc64.
Approved by Manuel Bouyer.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.83 04-Mar-2007 christos

branches: 1.83.2; 1.83.14; 1.83.16; 1.83.18;
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.82 02-Nov-2006 garbled

branches: 1.82.4;
Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.


# 1.81 02-Nov-2006 garbled

Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.80 24-Dec-2005 perry

branches: 1.80.20; 1.80.22;
__inline__ -> inline


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.79 18-Nov-2005 bouyer

Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value
(eventually resid would not be updated at all if there was only one data
phase). To fix this, have the script save the offset in the data tables at
disconnect time if there was a transfer, and use this to compute the resid
if the current offset is 0.
Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi.
Fix kern/31990 by YAMAMOTO Takashi.


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.78 27-Feb-2005 perry

branches: 1.78.2; 1.78.4; 1.78.10;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.77 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.76 03-Oct-2004 bouyer

branches: 1.76.4; 1.76.6;
Add missing return, fix handling of Ignore Wide Residue messages.


# 1.75 17-May-2004 bouyer

Add support for the Ignore Wide Residue SCSI message.


# 1.74 17-May-2004 bouyer

when an unexpected disconnect occurs only compute the resid; do the
real save data pointers when we get the message (or rather, at disconnect
time following the message).
Factor out code to do this, and to deal with xs->resid, in siop_common.c.


# 1.73 17-May-2004 bouyer

Properly compute xs->resid, instead of assuming it'll always be 0 when
a command is done.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.72 16-Mar-2004 bouyer

branches: 1.72.4;
cbd -> cdb
Command Block Descriptor -> Command Descriptor Block
Pointed out by Allen Briggs.


# 1.71 15-Mar-2004 bouyer

Extract the code printing the CBD from scsipi_print_sense(), so that it's
usable in other context.
Use the new scsipi_print_cbd() to dump the command in case of timeout
in siop/esiop.


# 1.70 02-Nov-2003 wiz

Fix some typos. From Tom Cosgrove via jmc@openbsd.


# 1.69 28-Oct-2003 matt

fix bogus GCC uninitialized variable warning. Use TAILQ_FOREACH.


# 1.68 25-Oct-2003 christos

Fix uninitialized variable warnings


# 1.67 21-Oct-2003 simonb

Remove return after panic().


# 1.66 03-May-2003 wiz

branches: 1.66.2;
DMA, not dma nor Dma.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.65 08-Nov-2002 bouyer

in siop_reset(), reset sc_ntargets to 0. The number of targets will be
computed again in siop_add_reselsw()
in siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff.
If siop_add_dev() fails this time we would use the old reseloff, clobbering
memory now used for something else.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.64 26-Jul-2002 wiz

enouth -> enough.


# 1.63 18-Jul-2002 wiz

Spell 'should' correctly.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.62 18-May-2002 bouyer

branches: 1.62.2;
Be more verbose when returning XS_DRIVER_STUFFUP


# 1.61 16-May-2002 thorpej

Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().


# 1.60 25-Apr-2002 bouyer

branches: 1.60.2;
It's not safe to access the SCNTL1 register while the SCRIPT is running.
On the 1010 this can wedge the chip. So abort the script instead.
the abort interrupt will trigger a bus reset.


# 1.59 23-Apr-2002 bouyer

More copyright fixes, pointed out by Thomas. Thanks !


# 1.58 23-Apr-2002 bouyer

- factor out parts of (e)siop_attach() to siop_common_attach()
- Add support for DT transfers (aka Ultra/160) in esiop

Note that DT transfers are not enabled for 53c1010-33 rev 0 yet; if I trust
FreeBSD it has a bug which prevent them to do DT properly.
From the same source there may be issues with some revs of 53c1010-66.


# 1.57 23-Apr-2002 bouyer

Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.


# 1.56 23-Apr-2002 bouyer

Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
From Jason R Thorpe.


# 1.55 22-Apr-2002 bouyer

Fix last change: assign siop_cmd->tag in callers instead of siop_setuptables(),
and use siop_cmd->tag instead of xs->xs_tag_id. This way siop can use
xs->xs_tag_id + 1 without interferences with esiop.


# 1.54 22-Apr-2002 bouyer

In siop_setuptables(), use the proposed tag_id, not tag_id +1.
In siop.c bump siop_cmd->tag by one as tag id 0 is reserved for untagged cmds.


# 1.53 20-Apr-2002 bouyer

Move a few things around, so that ic/siop_common.c and pci/siop_pci_common.c
can be compiled without including siopvar.h.


# 1.52 18-Apr-2002 bouyer

If SIOP_SYMLED is defined, drive the activity LED though GPIO pin 1.


# 1.51 05-Apr-2002 bouyer

Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.


Revision tags: eeh-devprop-base newlock-base
# 1.50 01-Mar-2002 bouyer

As siop_morecbd() is called from the kernel thread, protect access to the
queues with splbio.


Revision tags: ifpoll-base
# 1.49 12-Jan-2002 tsutsui

Call malloc(9) with M_ZERO flag instead of memset() after malloc().


# 1.48 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base
# 1.47 14-Oct-2001 bouyer

Call siop_morecbd() only when scsipi ask us ADAPTER_REQ_GROW_RESOURCES.
This prevent using bus_dmamem_map() from interrupt context.
Should fix kern/13827.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.46 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.45 21-Jun-2001 bouyer

branches: 1.45.2;
Also print DSA addr in a DIAGNOSTING printf.


# 1.44 23-May-2001 bouyer

Call scsipi_channel_thaw() after scsipi_done() so that command ordering
is preserved.


# 1.43 30-Apr-2001 lukem

delint newline in string


# 1.42 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.41 07-Mar-2001 thorpej

Add BUS_DMA_STREAMING to data transfer maps.


# 1.40 01-Mar-2001 thorpej

branches: 1.40.2;
Differentiate a couple of similar error message, and add newlines
on the end of them.


# 1.39 11-Feb-2001 bouyer

Avoid sending new commands to the device if it has sense pending:
- run request sense command without disconnect
- don't restart the script before siop_scsicmd_end has been called if the
cmd didn't complete with good status.
- reserve slot 0 for request sense, to make sure it'll be sent first.


# 1.38 26-Jan-2001 bouyer

Add a few siop_table_sync() calls.


# 1.37 14-Nov-2000 thorpej

branches: 1.37.2;
NBPG -> PAGE_SIZE


# 1.36 23-Oct-2000 bouyer

Fixes related to QUEUE FULL status:
- move status handling in siop_scsicmd_end(), it's better than in siop_intr()
- define 2 internal SIOP status, for "no status reported by device" and
reset condition
- add a list of "urgent" command, to be executed before the list of command
queued the normal way; this is used for command which got aborted
by a QUEUE FULL and have to be requeued in order.
- Don't accept to send a Q_TAG message not immediatly folowing a IDENTIFY


# 1.35 23-Oct-2000 bouyer

Rearrange for script changes (scheduler core in main script, command part
of the scheduler in command table).
Add tagged command queuing support.


# 1.34 21-Oct-2000 bouyer

Ops, sync the script DMA map when the script RAM *don't* exists.


# 1.33 19-Oct-2000 bouyer

Adapt for script change: don't assume Ent_lun_switch_entry == 0


# 1.32 18-Oct-2000 bouyer

Ops, add proper bus_dmamap_sync() calls for reselect switch operations.


# 1.31 18-Oct-2000 bouyer

Adapt for new lun switch script.
Implement SCBUSACCEL ioctl.
Snapshot of work in progress on tagged queuing: we can send/receive
queue tag messages. Infrastructure to manage multiple commands per
devices not here yet.


# 1.30 06-Oct-2000 bouyer

Ops, disable debugging messages.


# 1.29 06-Oct-2000 bouyer

Fix recurent typo: shed->sched


# 1.28 06-Oct-2000 bouyer

Adapt for reselect handling from the script. While here, fix typo
(SIOP_SCXFER -> SIOP_SXFER).


# 1.27 27-Jul-2000 bouyer

Force 64bit arithmetic for timeout computation; a 32bit int opverflows for
large timeouts. Should fix PR kern/10575.


# 1.26 24-Jul-2000 bouyer

create a funcion, siop_busreset(), to reset the scsibus.
Reset the scsi bus at attach time, to be sure all devices start in narrow/async
mode.
Defer sync/wide negotiation until after whe have a valid
xs->sc_link->device_softc, so that we can honnor the NOSYNC/NOWIDE quirks.


# 1.25 19-Jul-2000 pk

Fixx off-by-one error in handlereset().


# 1.24 28-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.23 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


# 1.22 20-Jun-2000 bouyer

Patch from Eduardo Horvath: don't bus_dmamap_sync the script dma map if
it lives in the on-chip RAM !


Revision tags: netbsd-1-5-base
# 1.21 13-Jun-2000 bouyer

branches: 1.21.2;
sheduler->scheduler, as pointed out by Klaus Klein


# 1.20 12-Jun-2000 bouyer

Handle "scsi bus mode change" interrupts on 895 and higther.
Thanks to Hal Murray for reporting the problem and testing the fix.


# 1.19 07-Jun-2000 tsutsui

Adapt struct scsipi_adapter changes.


# 1.18 05-Jun-2000 bouyer

use the correct variable in a debug printf().


Revision tags: minoura-xpg4dl-base
# 1.17 25-May-2000 bouyer

branches: 1.17.2;
Separate the sheduler from the main script, allocate another DMA-safe
memory page for the sheduler. Put the main script in the on-chip RAM when
available.
Avoid a null-pointer dereference when DSA is invalid.


# 1.16 23-May-2000 bouyer

Allocate dynamically the command block descriptors.


# 1.15 15-May-2000 bouyer

Don't enable debug message by default.


# 1.14 15-May-2000 bouyer

- split siop.c in script-dependant vs script-independant part, for
comming esiop
- add a reset callback for bus-dependant registers settings


# 1.13 11-May-2000 bouyer

Use correct divider value for scxfer


# 1.12 06-May-2000 soren

Typos.


# 1.11 05-May-2000 bouyer

Ops, restore sync/wide parameters after a reselect.
Also, better handling of parity errors.


# 1.10 05-May-2000 bouyer

Rework the command queue, to avoid having commands blocked at the end
of the queue. Load is now properly balanced across all disks of the same bus.


# 1.9 04-May-2000 bouyer

When a WDTR message is rejected, initiate sync negotiation anyway.
When a SDTR message is rejected indicate that target is async
Add a missing bus_dma_sync call.


# 1.8 04-May-2000 bouyer

- LP64 issues in debug printfs.
- on a phase mismatch, do byte recovery only if we were in data phase.
Otherwise just clear the fifo.
- Properly handle reject of a sync or wide negotiation.


# 1.7 02-May-2000 bouyer

- do sync/wide negotiation
- use a circular queue for the start slots, so that order has better chances
to be preserved.


# 1.6 27-Apr-2000 bouyer

More big-endian fixes from Izumi Tsutsui.


# 1.5 27-Apr-2000 bouyer

Fix copyrigth notice.


# 1.4 26-Apr-2000 bouyer

Big-endian fixes from Izumi Tsutsui.


# 1.3 25-Apr-2000 bouyer

Ops, need to restore correct DSA value after a phase mismatch, we may have
been interrupted during a S/G operation.


# 1.2 25-Apr-2000 bouyer

- Change the script to start new commands in an asyncronous way, using
'command slots' in which the host can put command and wait for the script
to start them
- Change siop.c to do full disconnect/reslelect, allowing as much as one
command per target/lun to run in parallel.
- Fix bug in registers init where a board without BIOS would end at
ID 0 (now the driver works on alpha too).
- better handling of messages, sending back a MSG_EXT_SDTR in response to an
incoming MSG_EXT_SDTR, and MSG_MESSAGE_REJECT for unhandled messages.
- fix use of bus_dmamap_sync() and htole32().
- supports shared interrups
- change some int8 and int16 to int, for alpha and mips benefits ( suggested by
Toru Nishimura)


# 1.1 21-Apr-2000 bouyer

Snapshot of work in progress: new driver for the NCR 53c8xx SCSI controller
(the name 'siop' is still being discussed, may change).
Only basic disconnect/reselect for now, no sync/wide negotiation.
Tested with 810A, 875 and 895 on i386 only.
The bus-independant part should also be able to handle the 53c720 and 53c770.
A new driver with enhanced script should appear for the 825/875/895 'soon'.


# 1.102 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: 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
# 1.101 24-Apr-2021 thorpej

branches: 1.101.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: netbsd-9-2-RELEASE thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 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 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 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 yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 02-Nov-2013 gson

branches: 1.100.46;
Turn the "esiop_intr: I shouldn't be there !" panic into a printf
followed by a return from the interrupt handler. The condition is
triggered on some KVM virtual hosts, apparently harmlessly, and not
panicing makes it possible to boot a NetBSD GENERIC kernel on those
hosts. Also make the same change to siop to minimize divergence
between siop and esiop. Fixes PR kern/48277.


# 1.99 30-Oct-2013 gson

Fix incorrect function names in panic message strings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.98 13-Nov-2010 uebayasi

branches: 1.98.8; 1.98.18; 1.98.22;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.97 09-Sep-2010 jakllsch

Allow e?siop_dump_script() to work with on-chip RAM. Prefix
DUMP_SCRIPT with SIOP_. Additionally, avoid undefining DEBUG,
condition on SIOP_DEBUG instead.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.96 02-May-2010 jakllsch

Add (missing) newlines to error messages.


Revision tags: uebayasi-xip-base1
# 1.95 09-Apr-2010 jakllsch

Improve error paths in (e)siop_scsipi_request():

- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.

Analysis and fix from Michael L. Hitch in PR/42844.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-nbase
# 1.94 19-Oct-2009 bouyer

branches: 1.94.2; 1.94.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !


Revision tags: yamt-nfs-mp-base8
# 1.93 04-Sep-2009 tsutsui

Remove unnecessary whitespace.


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4
# 1.92 16-May-2009 tsutsui

Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)


# 1.91 15-May-2009 tsutsui

Split device_t/softc.

No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.90 15-Mar-2009 cegger

ansify function definitions


# 1.89 14-Mar-2009 dsl

ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.


# 1.88 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 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 nick-hppapmap-base2 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 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base
# 1.87 08-Apr-2008 cegger

branches: 1.87.4; 1.87.12; 1.87.14; 1.87.18;
use aprint_*_dev and device_xname


# 1.86 27-Mar-2008 skrll

Add support for the (non-pci) NCR 53c720/770 in big-endian mode.

From OpenBSD (Mark Kettenis)


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.85 19-Oct-2007 ad

branches: 1.85.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.84 30-Sep-2007 martin

branches: 1.84.2;
Do not stop callouts on polled commands. Problem noticed by Chris Ross
when trying to do a kernel dump on sparc64.
Approved by Manuel Bouyer.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.83 04-Mar-2007 christos

branches: 1.83.2; 1.83.14; 1.83.16; 1.83.18;
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.82 02-Nov-2006 garbled

branches: 1.82.4;
Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.


# 1.81 02-Nov-2006 garbled

Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.80 24-Dec-2005 perry

branches: 1.80.20; 1.80.22;
__inline__ -> inline


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.79 18-Nov-2005 bouyer

Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value
(eventually resid would not be updated at all if there was only one data
phase). To fix this, have the script save the offset in the data tables at
disconnect time if there was a transfer, and use this to compute the resid
if the current offset is 0.
Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi.
Fix kern/31990 by YAMAMOTO Takashi.


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.78 27-Feb-2005 perry

branches: 1.78.2; 1.78.4; 1.78.10;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.77 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.76 03-Oct-2004 bouyer

branches: 1.76.4; 1.76.6;
Add missing return, fix handling of Ignore Wide Residue messages.


# 1.75 17-May-2004 bouyer

Add support for the Ignore Wide Residue SCSI message.


# 1.74 17-May-2004 bouyer

when an unexpected disconnect occurs only compute the resid; do the
real save data pointers when we get the message (or rather, at disconnect
time following the message).
Factor out code to do this, and to deal with xs->resid, in siop_common.c.


# 1.73 17-May-2004 bouyer

Properly compute xs->resid, instead of assuming it'll always be 0 when
a command is done.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.72 16-Mar-2004 bouyer

branches: 1.72.4;
cbd -> cdb
Command Block Descriptor -> Command Descriptor Block
Pointed out by Allen Briggs.


# 1.71 15-Mar-2004 bouyer

Extract the code printing the CBD from scsipi_print_sense(), so that it's
usable in other context.
Use the new scsipi_print_cbd() to dump the command in case of timeout
in siop/esiop.


# 1.70 02-Nov-2003 wiz

Fix some typos. From Tom Cosgrove via jmc@openbsd.


# 1.69 28-Oct-2003 matt

fix bogus GCC uninitialized variable warning. Use TAILQ_FOREACH.


# 1.68 25-Oct-2003 christos

Fix uninitialized variable warnings


# 1.67 21-Oct-2003 simonb

Remove return after panic().


# 1.66 03-May-2003 wiz

branches: 1.66.2;
DMA, not dma nor Dma.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.65 08-Nov-2002 bouyer

in siop_reset(), reset sc_ntargets to 0. The number of targets will be
computed again in siop_add_reselsw()
in siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff.
If siop_add_dev() fails this time we would use the old reseloff, clobbering
memory now used for something else.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.64 26-Jul-2002 wiz

enouth -> enough.


# 1.63 18-Jul-2002 wiz

Spell 'should' correctly.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.62 18-May-2002 bouyer

branches: 1.62.2;
Be more verbose when returning XS_DRIVER_STUFFUP


# 1.61 16-May-2002 thorpej

Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().


# 1.60 25-Apr-2002 bouyer

branches: 1.60.2;
It's not safe to access the SCNTL1 register while the SCRIPT is running.
On the 1010 this can wedge the chip. So abort the script instead.
the abort interrupt will trigger a bus reset.


# 1.59 23-Apr-2002 bouyer

More copyright fixes, pointed out by Thomas. Thanks !


# 1.58 23-Apr-2002 bouyer

- factor out parts of (e)siop_attach() to siop_common_attach()
- Add support for DT transfers (aka Ultra/160) in esiop

Note that DT transfers are not enabled for 53c1010-33 rev 0 yet; if I trust
FreeBSD it has a bug which prevent them to do DT properly.
From the same source there may be issues with some revs of 53c1010-66.


# 1.57 23-Apr-2002 bouyer

Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.


# 1.56 23-Apr-2002 bouyer

Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
From Jason R Thorpe.


# 1.55 22-Apr-2002 bouyer

Fix last change: assign siop_cmd->tag in callers instead of siop_setuptables(),
and use siop_cmd->tag instead of xs->xs_tag_id. This way siop can use
xs->xs_tag_id + 1 without interferences with esiop.


# 1.54 22-Apr-2002 bouyer

In siop_setuptables(), use the proposed tag_id, not tag_id +1.
In siop.c bump siop_cmd->tag by one as tag id 0 is reserved for untagged cmds.


# 1.53 20-Apr-2002 bouyer

Move a few things around, so that ic/siop_common.c and pci/siop_pci_common.c
can be compiled without including siopvar.h.


# 1.52 18-Apr-2002 bouyer

If SIOP_SYMLED is defined, drive the activity LED though GPIO pin 1.


# 1.51 05-Apr-2002 bouyer

Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.


Revision tags: eeh-devprop-base newlock-base
# 1.50 01-Mar-2002 bouyer

As siop_morecbd() is called from the kernel thread, protect access to the
queues with splbio.


Revision tags: ifpoll-base
# 1.49 12-Jan-2002 tsutsui

Call malloc(9) with M_ZERO flag instead of memset() after malloc().


# 1.48 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base
# 1.47 14-Oct-2001 bouyer

Call siop_morecbd() only when scsipi ask us ADAPTER_REQ_GROW_RESOURCES.
This prevent using bus_dmamem_map() from interrupt context.
Should fix kern/13827.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.46 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.45 21-Jun-2001 bouyer

branches: 1.45.2;
Also print DSA addr in a DIAGNOSTING printf.


# 1.44 23-May-2001 bouyer

Call scsipi_channel_thaw() after scsipi_done() so that command ordering
is preserved.


# 1.43 30-Apr-2001 lukem

delint newline in string


# 1.42 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.41 07-Mar-2001 thorpej

Add BUS_DMA_STREAMING to data transfer maps.


# 1.40 01-Mar-2001 thorpej

branches: 1.40.2;
Differentiate a couple of similar error message, and add newlines
on the end of them.


# 1.39 11-Feb-2001 bouyer

Avoid sending new commands to the device if it has sense pending:
- run request sense command without disconnect
- don't restart the script before siop_scsicmd_end has been called if the
cmd didn't complete with good status.
- reserve slot 0 for request sense, to make sure it'll be sent first.


# 1.38 26-Jan-2001 bouyer

Add a few siop_table_sync() calls.


# 1.37 14-Nov-2000 thorpej

branches: 1.37.2;
NBPG -> PAGE_SIZE


# 1.36 23-Oct-2000 bouyer

Fixes related to QUEUE FULL status:
- move status handling in siop_scsicmd_end(), it's better than in siop_intr()
- define 2 internal SIOP status, for "no status reported by device" and
reset condition
- add a list of "urgent" command, to be executed before the list of command
queued the normal way; this is used for command which got aborted
by a QUEUE FULL and have to be requeued in order.
- Don't accept to send a Q_TAG message not immediatly folowing a IDENTIFY


# 1.35 23-Oct-2000 bouyer

Rearrange for script changes (scheduler core in main script, command part
of the scheduler in command table).
Add tagged command queuing support.


# 1.34 21-Oct-2000 bouyer

Ops, sync the script DMA map when the script RAM *don't* exists.


# 1.33 19-Oct-2000 bouyer

Adapt for script change: don't assume Ent_lun_switch_entry == 0


# 1.32 18-Oct-2000 bouyer

Ops, add proper bus_dmamap_sync() calls for reselect switch operations.


# 1.31 18-Oct-2000 bouyer

Adapt for new lun switch script.
Implement SCBUSACCEL ioctl.
Snapshot of work in progress on tagged queuing: we can send/receive
queue tag messages. Infrastructure to manage multiple commands per
devices not here yet.


# 1.30 06-Oct-2000 bouyer

Ops, disable debugging messages.


# 1.29 06-Oct-2000 bouyer

Fix recurent typo: shed->sched


# 1.28 06-Oct-2000 bouyer

Adapt for reselect handling from the script. While here, fix typo
(SIOP_SCXFER -> SIOP_SXFER).


# 1.27 27-Jul-2000 bouyer

Force 64bit arithmetic for timeout computation; a 32bit int opverflows for
large timeouts. Should fix PR kern/10575.


# 1.26 24-Jul-2000 bouyer

create a funcion, siop_busreset(), to reset the scsibus.
Reset the scsi bus at attach time, to be sure all devices start in narrow/async
mode.
Defer sync/wide negotiation until after whe have a valid
xs->sc_link->device_softc, so that we can honnor the NOSYNC/NOWIDE quirks.


# 1.25 19-Jul-2000 pk

Fixx off-by-one error in handlereset().


# 1.24 28-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.23 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


# 1.22 20-Jun-2000 bouyer

Patch from Eduardo Horvath: don't bus_dmamap_sync the script dma map if
it lives in the on-chip RAM !


Revision tags: netbsd-1-5-base
# 1.21 13-Jun-2000 bouyer

branches: 1.21.2;
sheduler->scheduler, as pointed out by Klaus Klein


# 1.20 12-Jun-2000 bouyer

Handle "scsi bus mode change" interrupts on 895 and higther.
Thanks to Hal Murray for reporting the problem and testing the fix.


# 1.19 07-Jun-2000 tsutsui

Adapt struct scsipi_adapter changes.


# 1.18 05-Jun-2000 bouyer

use the correct variable in a debug printf().


Revision tags: minoura-xpg4dl-base
# 1.17 25-May-2000 bouyer

branches: 1.17.2;
Separate the sheduler from the main script, allocate another DMA-safe
memory page for the sheduler. Put the main script in the on-chip RAM when
available.
Avoid a null-pointer dereference when DSA is invalid.


# 1.16 23-May-2000 bouyer

Allocate dynamically the command block descriptors.


# 1.15 15-May-2000 bouyer

Don't enable debug message by default.


# 1.14 15-May-2000 bouyer

- split siop.c in script-dependant vs script-independant part, for
comming esiop
- add a reset callback for bus-dependant registers settings


# 1.13 11-May-2000 bouyer

Use correct divider value for scxfer


# 1.12 06-May-2000 soren

Typos.


# 1.11 05-May-2000 bouyer

Ops, restore sync/wide parameters after a reselect.
Also, better handling of parity errors.


# 1.10 05-May-2000 bouyer

Rework the command queue, to avoid having commands blocked at the end
of the queue. Load is now properly balanced across all disks of the same bus.


# 1.9 04-May-2000 bouyer

When a WDTR message is rejected, initiate sync negotiation anyway.
When a SDTR message is rejected indicate that target is async
Add a missing bus_dma_sync call.


# 1.8 04-May-2000 bouyer

- LP64 issues in debug printfs.
- on a phase mismatch, do byte recovery only if we were in data phase.
Otherwise just clear the fifo.
- Properly handle reject of a sync or wide negotiation.


# 1.7 02-May-2000 bouyer

- do sync/wide negotiation
- use a circular queue for the start slots, so that order has better chances
to be preserved.


# 1.6 27-Apr-2000 bouyer

More big-endian fixes from Izumi Tsutsui.


# 1.5 27-Apr-2000 bouyer

Fix copyrigth notice.


# 1.4 26-Apr-2000 bouyer

Big-endian fixes from Izumi Tsutsui.


# 1.3 25-Apr-2000 bouyer

Ops, need to restore correct DSA value after a phase mismatch, we may have
been interrupted during a S/G operation.


# 1.2 25-Apr-2000 bouyer

- Change the script to start new commands in an asyncronous way, using
'command slots' in which the host can put command and wait for the script
to start them
- Change siop.c to do full disconnect/reslelect, allowing as much as one
command per target/lun to run in parallel.
- Fix bug in registers init where a board without BIOS would end at
ID 0 (now the driver works on alpha too).
- better handling of messages, sending back a MSG_EXT_SDTR in response to an
incoming MSG_EXT_SDTR, and MSG_MESSAGE_REJECT for unhandled messages.
- fix use of bus_dmamap_sync() and htole32().
- supports shared interrups
- change some int8 and int16 to int, for alpha and mips benefits ( suggested by
Toru Nishimura)


# 1.1 21-Apr-2000 bouyer

Snapshot of work in progress: new driver for the NCR 53c8xx SCSI controller
(the name 'siop' is still being discussed, may change).
Only basic disconnect/reselect for now, no sync/wide negotiation.
Tested with 810A, 875 and 895 on i386 only.
The bus-independant part should also be able to handle the 53c720 and 53c770.
A new driver with enhanced script should appear for the 825/875/895 'soon'.


# 1.101 24-Apr-2021 thorpej

Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 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 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 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 yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 02-Nov-2013 gson

branches: 1.100.46;
Turn the "esiop_intr: I shouldn't be there !" panic into a printf
followed by a return from the interrupt handler. The condition is
triggered on some KVM virtual hosts, apparently harmlessly, and not
panicing makes it possible to boot a NetBSD GENERIC kernel on those
hosts. Also make the same change to siop to minimize divergence
between siop and esiop. Fixes PR kern/48277.


# 1.99 30-Oct-2013 gson

Fix incorrect function names in panic message strings.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.98 13-Nov-2010 uebayasi

branches: 1.98.8; 1.98.18; 1.98.22;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.97 09-Sep-2010 jakllsch

Allow e?siop_dump_script() to work with on-chip RAM. Prefix
DUMP_SCRIPT with SIOP_. Additionally, avoid undefining DEBUG,
condition on SIOP_DEBUG instead.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.96 02-May-2010 jakllsch

Add (missing) newlines to error messages.


Revision tags: uebayasi-xip-base1
# 1.95 09-Apr-2010 jakllsch

Improve error paths in (e)siop_scsipi_request():

- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.

Analysis and fix from Michael L. Hitch in PR/42844.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-nbase
# 1.94 19-Oct-2009 bouyer

branches: 1.94.2; 1.94.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !


Revision tags: yamt-nfs-mp-base8
# 1.93 04-Sep-2009 tsutsui

Remove unnecessary whitespace.


Revision tags: yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4
# 1.92 16-May-2009 tsutsui

Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)


# 1.91 15-May-2009 tsutsui

Split device_t/softc.

No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.90 15-Mar-2009 cegger

ansify function definitions


# 1.89 14-Mar-2009 dsl

ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.


# 1.88 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 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 nick-hppapmap-base2 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 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base
# 1.87 08-Apr-2008 cegger

branches: 1.87.4; 1.87.12; 1.87.14; 1.87.18;
use aprint_*_dev and device_xname


# 1.86 27-Mar-2008 skrll

Add support for the (non-pci) NCR 53c720/770 in big-endian mode.

From OpenBSD (Mark Kettenis)


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
# 1.85 19-Oct-2007 ad

branches: 1.85.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.84 30-Sep-2007 martin

branches: 1.84.2;
Do not stop callouts on polled commands. Problem noticed by Chris Ross
when trying to do a kernel dump on sparc64.
Approved by Manuel Bouyer.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.83 04-Mar-2007 christos

branches: 1.83.2; 1.83.14; 1.83.16; 1.83.18;
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.82 02-Nov-2006 garbled

branches: 1.82.4;
Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.


# 1.81 02-Nov-2006 garbled

Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.80 24-Dec-2005 perry

branches: 1.80.20; 1.80.22;
__inline__ -> inline


Revision tags: yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.79 18-Nov-2005 bouyer

Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value
(eventually resid would not be updated at all if there was only one data
phase). To fix this, have the script save the offset in the data tables at
disconnect time if there was a transfer, and use this to compute the resid
if the current offset is 0.
Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi.
Fix kern/31990 by YAMAMOTO Takashi.


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.78 27-Feb-2005 perry

branches: 1.78.2; 1.78.4; 1.78.10;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.77 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.76 03-Oct-2004 bouyer

branches: 1.76.4; 1.76.6;
Add missing return, fix handling of Ignore Wide Residue messages.


# 1.75 17-May-2004 bouyer

Add support for the Ignore Wide Residue SCSI message.


# 1.74 17-May-2004 bouyer

when an unexpected disconnect occurs only compute the resid; do the
real save data pointers when we get the message (or rather, at disconnect
time following the message).
Factor out code to do this, and to deal with xs->resid, in siop_common.c.


# 1.73 17-May-2004 bouyer

Properly compute xs->resid, instead of assuming it'll always be 0 when
a command is done.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.72 16-Mar-2004 bouyer

branches: 1.72.4;
cbd -> cdb
Command Block Descriptor -> Command Descriptor Block
Pointed out by Allen Briggs.


# 1.71 15-Mar-2004 bouyer

Extract the code printing the CBD from scsipi_print_sense(), so that it's
usable in other context.
Use the new scsipi_print_cbd() to dump the command in case of timeout
in siop/esiop.


# 1.70 02-Nov-2003 wiz

Fix some typos. From Tom Cosgrove via jmc@openbsd.


# 1.69 28-Oct-2003 matt

fix bogus GCC uninitialized variable warning. Use TAILQ_FOREACH.


# 1.68 25-Oct-2003 christos

Fix uninitialized variable warnings


# 1.67 21-Oct-2003 simonb

Remove return after panic().


# 1.66 03-May-2003 wiz

branches: 1.66.2;
DMA, not dma nor Dma.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.65 08-Nov-2002 bouyer

in siop_reset(), reset sc_ntargets to 0. The number of targets will be
computed again in siop_add_reselsw()
in siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff.
If siop_add_dev() fails this time we would use the old reseloff, clobbering
memory now used for something else.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.64 26-Jul-2002 wiz

enouth -> enough.


# 1.63 18-Jul-2002 wiz

Spell 'should' correctly.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.62 18-May-2002 bouyer

branches: 1.62.2;
Be more verbose when returning XS_DRIVER_STUFFUP


# 1.61 16-May-2002 thorpej

Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().


# 1.60 25-Apr-2002 bouyer

branches: 1.60.2;
It's not safe to access the SCNTL1 register while the SCRIPT is running.
On the 1010 this can wedge the chip. So abort the script instead.
the abort interrupt will trigger a bus reset.


# 1.59 23-Apr-2002 bouyer

More copyright fixes, pointed out by Thomas. Thanks !


# 1.58 23-Apr-2002 bouyer

- factor out parts of (e)siop_attach() to siop_common_attach()
- Add support for DT transfers (aka Ultra/160) in esiop

Note that DT transfers are not enabled for 53c1010-33 rev 0 yet; if I trust
FreeBSD it has a bug which prevent them to do DT properly.
From the same source there may be issues with some revs of 53c1010-66.


# 1.57 23-Apr-2002 bouyer

Bump the space for SCSI messages from 8 to 16 octets, as 8 may not be
enouth for IDENTIFY + TAG + PPR.
Get rid of constants in C code by use of a offsetof macro.


# 1.56 23-Apr-2002 bouyer

Enable software LED control based on LED0 feature, not #define.
For now, set the LED0 feature if SIOP_SYMLED is defined in siop_pci_common.c.
From Jason R Thorpe.


# 1.55 22-Apr-2002 bouyer

Fix last change: assign siop_cmd->tag in callers instead of siop_setuptables(),
and use siop_cmd->tag instead of xs->xs_tag_id. This way siop can use
xs->xs_tag_id + 1 without interferences with esiop.


# 1.54 22-Apr-2002 bouyer

In siop_setuptables(), use the proposed tag_id, not tag_id +1.
In siop.c bump siop_cmd->tag by one as tag id 0 is reserved for untagged cmds.


# 1.53 20-Apr-2002 bouyer

Move a few things around, so that ic/siop_common.c and pci/siop_pci_common.c
can be compiled without including siopvar.h.


# 1.52 18-Apr-2002 bouyer

If SIOP_SYMLED is defined, drive the activity LED though GPIO pin 1.


# 1.51 05-Apr-2002 bouyer

Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.


Revision tags: eeh-devprop-base newlock-base
# 1.50 01-Mar-2002 bouyer

As siop_morecbd() is called from the kernel thread, protect access to the
queues with splbio.


Revision tags: ifpoll-base
# 1.49 12-Jan-2002 tsutsui

Call malloc(9) with M_ZERO flag instead of memset() after malloc().


# 1.48 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base
# 1.47 14-Oct-2001 bouyer

Call siop_morecbd() only when scsipi ask us ADAPTER_REQ_GROW_RESOURCES.
This prevent using bus_dmamem_map() from interrupt context.
Should fix kern/13827.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.46 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.45 21-Jun-2001 bouyer

branches: 1.45.2;
Also print DSA addr in a DIAGNOSTING printf.


# 1.44 23-May-2001 bouyer

Call scsipi_channel_thaw() after scsipi_done() so that command ordering
is preserved.


# 1.43 30-Apr-2001 lukem

delint newline in string


# 1.42 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.41 07-Mar-2001 thorpej

Add BUS_DMA_STREAMING to data transfer maps.


# 1.40 01-Mar-2001 thorpej

branches: 1.40.2;
Differentiate a couple of similar error message, and add newlines
on the end of them.


# 1.39 11-Feb-2001 bouyer

Avoid sending new commands to the device if it has sense pending:
- run request sense command without disconnect
- don't restart the script before siop_scsicmd_end has been called if the
cmd didn't complete with good status.
- reserve slot 0 for request sense, to make sure it'll be sent first.


# 1.38 26-Jan-2001 bouyer

Add a few siop_table_sync() calls.


# 1.37 14-Nov-2000 thorpej

branches: 1.37.2;
NBPG -> PAGE_SIZE


# 1.36 23-Oct-2000 bouyer

Fixes related to QUEUE FULL status:
- move status handling in siop_scsicmd_end(), it's better than in siop_intr()
- define 2 internal SIOP status, for "no status reported by device" and
reset condition
- add a list of "urgent" command, to be executed before the list of command
queued the normal way; this is used for command which got aborted
by a QUEUE FULL and have to be requeued in order.
- Don't accept to send a Q_TAG message not immediatly folowing a IDENTIFY


# 1.35 23-Oct-2000 bouyer

Rearrange for script changes (scheduler core in main script, command part
of the scheduler in command table).
Add tagged command queuing support.


# 1.34 21-Oct-2000 bouyer

Ops, sync the script DMA map when the script RAM *don't* exists.


# 1.33 19-Oct-2000 bouyer

Adapt for script change: don't assume Ent_lun_switch_entry == 0


# 1.32 18-Oct-2000 bouyer

Ops, add proper bus_dmamap_sync() calls for reselect switch operations.


# 1.31 18-Oct-2000 bouyer

Adapt for new lun switch script.
Implement SCBUSACCEL ioctl.
Snapshot of work in progress on tagged queuing: we can send/receive
queue tag messages. Infrastructure to manage multiple commands per
devices not here yet.


# 1.30 06-Oct-2000 bouyer

Ops, disable debugging messages.


# 1.29 06-Oct-2000 bouyer

Fix recurent typo: shed->sched


# 1.28 06-Oct-2000 bouyer

Adapt for reselect handling from the script. While here, fix typo
(SIOP_SCXFER -> SIOP_SXFER).


# 1.27 27-Jul-2000 bouyer

Force 64bit arithmetic for timeout computation; a 32bit int opverflows for
large timeouts. Should fix PR kern/10575.


# 1.26 24-Jul-2000 bouyer

create a funcion, siop_busreset(), to reset the scsibus.
Reset the scsi bus at attach time, to be sure all devices start in narrow/async
mode.
Defer sync/wide negotiation until after whe have a valid
xs->sc_link->device_softc, so that we can honnor the NOSYNC/NOWIDE quirks.


# 1.25 19-Jul-2000 pk

Fixx off-by-one error in handlereset().


# 1.24 28-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.23 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


# 1.22 20-Jun-2000 bouyer

Patch from Eduardo Horvath: don't bus_dmamap_sync the script dma map if
it lives in the on-chip RAM !


Revision tags: netbsd-1-5-base
# 1.21 13-Jun-2000 bouyer

branches: 1.21.2;
sheduler->scheduler, as pointed out by Klaus Klein


# 1.20 12-Jun-2000 bouyer

Handle "scsi bus mode change" interrupts on 895 and higther.
Thanks to Hal Murray for reporting the problem and testing the fix.


# 1.19 07-Jun-2000 tsutsui

Adapt struct scsipi_adapter changes.


# 1.18 05-Jun-2000 bouyer

use the correct variable in a debug printf().


Revision tags: minoura-xpg4dl-base
# 1.17 25-May-2000 bouyer

branches: 1.17.2;
Separate the sheduler from the main script, allocate another DMA-safe
memory page for the sheduler. Put the main script in the on-chip RAM when
available.
Avoid a null-pointer dereference when DSA is invalid.


# 1.16 23-May-2000 bouyer

Allocate dynamically the command block descriptors.


# 1.15 15-May-2000 bouyer

Don't enable debug message by default.


# 1.14 15-May-2000 bouyer

- split siop.c in script-dependant vs script-independant part, for
comming esiop
- add a reset callback for bus-dependant registers settings


# 1.13 11-May-2000 bouyer

Use correct divider value for scxfer


# 1.12 06-May-2000 soren

Typos.


# 1.11 05-May-2000 bouyer

Ops, restore sync/wide parameters after a reselect.
Also, better handling of parity errors.


# 1.10 05-May-2000 bouyer

Rework the command queue, to avoid having commands blocked at the end
of the queue. Load is now properly balanced across all disks of the same bus.


# 1.9 04-May-2000 bouyer

When a WDTR message is rejected, initiate sync negotiation anyway.
When a SDTR message is rejected indicate that target is async
Add a missing bus_dma_sync call.


# 1.8 04-May-2000 bouyer

- LP64 issues in debug printfs.
- on a phase mismatch, do byte recovery only if we were in data phase.
Otherwise just clear the fifo.
- Properly handle reject of a sync or wide negotiation.


# 1.7 02-May-2000 bouyer

- do sync/wide negotiation
- use a circular queue for the start slots, so that order has better chances
to be preserved.


# 1.6 27-Apr-2000 bouyer

More big-endian fixes from Izumi Tsutsui.


# 1.5 27-Apr-2000 bouyer

Fix copyrigth notice.


# 1.4 26-Apr-2000 bouyer

Big-endian fixes from Izumi Tsutsui.


# 1.3 25-Apr-2000 bouyer

Ops, need to restore correct DSA value after a phase mismatch, we may have
been interrupted during a S/G operation.


# 1.2 25-Apr-2000 bouyer

- Change the script to start new commands in an asyncronous way, using
'command slots' in which the host can put command and wait for the script
to start them
- Change siop.c to do full disconnect/reslelect, allowing as much as one
command per target/lun to run in parallel.
- Fix bug in registers init where a board without BIOS would end at
ID 0 (now the driver works on alpha too).
- better handling of messages, sending back a MSG_EXT_SDTR in response to an
incoming MSG_EXT_SDTR, and MSG_MESSAGE_REJECT for unhandled messages.
- fix use of bus_dmamap_sync() and htole32().
- supports shared interrups
- change some int8 and int16 to int, for alpha and mips benefits ( suggested by
Toru Nishimura)


# 1.1 21-Apr-2000 bouyer

Snapshot of work in progress: new driver for the NCR 53c8xx SCSI controller
(the name 'siop' is still being discussed, may change).
Only basic disconnect/reselect for now, no sync/wide negotiation.
Tested with 810A, 875 and 895 on i386 only.
The bus-independant part should also be able to handle the 53c720 and 53c770.
A new driver with enhanced script should appear for the 825/875/895 'soon'.