freebsd-nq/sys
Justin T. Gibbs 789902c3ae Correct a very rare case where command ordering could be compromised
by a transaction performing a driver handled message sequence (an
scb with the MK_MESSAGE flag set).

SCBs that perform host managed messaging must always be
at the head of their per-target selection queue so that
the firmware knows to manually assert ATN if the current
negotiation agreement is packetized.  In the past we
guaranteed this by queuing these SCBs separarately in
the execution queue.  This exposes the system to potential
command reordering in two cases:

1) Another SCB for the same ITL nexus is queued that does
   not have the MK_MESSAGE flag set.  This SCB will be
   queued to the per-target list which can be serviced
   before the MK_MESSAGE scb that preceeded it.

2) If the target cannot accept all of the commands in the
   per-target selection queue in one selection, the remainder
   is queued to the tail of the selection queues so as to
   effect round-robin scheduling.  This could allow the
   MK_MESSAGE scb to be sent to the target before the
   requeued commands.

This commit changes the firmware policy to defer queuing
MK_MESSAGE SCBs into the selection queues until this can
be done without affecting order.  This means that the
target's selection queue is either empty, or the last
SCB on the execution queue is also a MK_MESSAGE SCB.
During any wait, the firmware halts the download of new
SCBs so only a single "holding location" is required.

Luckily, MK_MESSAGE SCBs are rare and typically occur only
during CAM's bus probe where only one command is outstanding
at a time.  However, during some recovery scenarios, the
reordering *could* occur.

aic79xx.c:
	Update ahd_search_qinfifo() and helper routines to
	search for pending MK_MESSAGE scbs and properly
	restitch the execution queue if either the MK_MESSAGE
	SCB is being aborted, or the MK_MESSAGE SCB can be
	queued due to the execution queue draining due to
	aborts.

	Enable LQOBUSFREE status to assert an interrupt.
	This should be redundant since a BUSFREE interrupt
	should always occur along with an LQOBUSFREE event,
	but on the Rev A, this doesn't seem to be guaranteed.

	When a PPR request is rejected when a previously
	existing packetized agreement is in place, assume
	that the target has been reset without our knowledge
	and revert to async/narrow transfers.  This corrects
	two issues: the stale ENATNO setting that was used
	to send the PPR is cleared so the firmware is not
	confused by a future packetized selection with
	ATN asserted but no MK_MESSAGE flag in the SCB and
	it speeds up recovery by aborting any pending
	packetized transactions that by definition are now
	dead.

	When re-queueing SCBs after a failed negotiation
	attempt, ensure command ordering by freezing the
	device queue first.

	Traverse the list of pending SCBs rather than the
	whole SCB array on the controller when pushing
	MK_MESSAGE flag changes out to the controller.
	The original code was optimized for the aic7xxx
	controllers where there are fewer controller slots
	then pending SCBs and the firmware picks SCB
	slots.  For the U320 controller, the hope is
	that we have fewer pending SCBs then the 512
	slots on the controller.

	Enhance some diagnostics.

	Factor out some common code.

aic79xx.h:
	Add prototype for new ahd_done_with_status() that is
	used to factor out some commone code.

aic79xx.reg:
	Add definisions for the pending MK_MESSAGE SCB.

aic79xx.seq:
	Defer MK_MESSAGE SCB queing to the execution queue
	so as to preserve command ordering.  Re-arrange some
	of the selection processing code so the above change
	had no performance impact on the common code path.

	Close a few critical section holes.

	When entering a non-packetized phase, manually enable
	busfree interrupts, since the controller hardware
	does not do this automatically.

aic79xx_inline.h:
	Enhance logging for queued SCBs.

aic79xx_osm.c:
	Add new a new DDB ahd command, ahd_dump, which
	invokes the ahd_dump_card_state() routine on the
	unit specified with the ahd_sunit DDB command.

aic79xx_pci.c:
	Turn on the BUSFREEREV bug for the Rev B. controller.
	This is required to close the busfree during non-packetized
	phase hole.
2004-08-04 17:55:34 +00:00
..
alpha Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
amd64 Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
arm Instead of calling ia32_pause() conditionally on __i386__ or __amd64__ 2004-08-03 18:44:27 +00:00
boot Add PowerPC bridge instruction flag to the assembler to help out 2004-08-02 03:06:21 +00:00
cam Quirk for SEGRAND NP-900 USB MP3Player 2004-07-18 05:39:14 +00:00
coda Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
compat In ndis_alloc_bufpool() and ndis_alloc_packetpool(), the test to see if 2004-08-01 21:15:29 +00:00
conf Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
contrib Initialize s variable early to shut up GCC warnings. 2004-07-28 06:14:44 +00:00
crypto Use __FBSDID(). 2004-06-14 00:38:54 +00:00
ddb Damage control. Correcly advance symtab and strtab pointers, not 2004-07-28 08:59:08 +00:00
dev Correct a very rare case where command ordering could be compromised 2004-08-04 17:55:34 +00:00
doc Experimental support for using doxygen to generate kernel documentation. 2004-07-11 16:13:57 +00:00
fs Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
gdb Introduce the GDB debugger backend for the new KDB framework. The 2004-07-10 17:47:22 +00:00
geom - Add "prefer" balance algorithm. When used, only disk with the biggest 2004-08-04 12:09:53 +00:00
gnu Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
i4b Fix a possible hang which apparently occurs during a warm boot (cold boot 2004-07-18 20:13:31 +00:00
i386 Unbreak LINT by making sure that method is always defined. 2004-08-04 14:29:22 +00:00
ia64 Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
isa Add support for the Synaptics Touchpad mouse driver. I reworked the 2004-07-30 00:59:40 +00:00
isofs/cd9660 Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
kern Instead of calling ia32_pause() conditionally on __i386__ or __amd64__ 2004-08-03 18:44:27 +00:00
libkern Convert the vfsconf list to a TAILQ. 2004-07-27 22:32:01 +00:00
modules Bump WARNS to 2 for all other ACPI drivers and minor cleanup. 2004-08-03 21:27:43 +00:00
net Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
net80211 Add a new network interface flag, IFF_NEEDSGIANT, which will allow 2004-07-27 23:20:45 +00:00
netatalk Further function forward declaration white space tweaks. 2004-07-19 17:18:58 +00:00
netatm Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
netgraph Implement minimalistic L2TP sessions statistics and correct man page 2004-08-03 06:52:55 +00:00
netinet Fix Skinny and PPTP NAT'ing after the introduction of the {ip,tcp,udp}_next 2004-08-04 15:17:08 +00:00
netinet6 Disallow a particular kind of port theft described by the following scenario: 2004-07-28 13:03:07 +00:00
netipsec Add required includes for post-sorwakeup() change to fix FAST_IPSEC 2004-06-23 01:58:22 +00:00
netipx Avoid casts as lvalues. Declare local variable as u_char * instead of 2004-07-28 06:58:23 +00:00
netkey Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
netnatm Constify send and receive space constants in natm. 2004-06-24 03:11:29 +00:00
netncp Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
netsmb Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
nfsclient Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
nfsserver If debug.mpsafenet is non-zero, run the NFS server callout without 2004-07-24 02:32:27 +00:00
opencrypto Push acquisition of Giant from fdrop_closed() into fo_close() so that 2004-07-22 18:35:43 +00:00
pc98 Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
pccard Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pci Unbreak DEVICE_POLLING build / LINT. Sorry! 2004-08-02 10:08:28 +00:00
posix4
powerpc Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
rpc fix array index out of bounds in rpc->rc_srtt[], rpc->rc_sdrtt[] 2004-07-15 22:21:25 +00:00
security * Add a "how" argument to uma_zone constructors and initialization functions 2004-08-02 00:18:36 +00:00
sparc64 Making a loadable null.ko for /dev/(null|zero) proved rather 2004-08-03 19:24:54 +00:00
sys Remove redundant definition. 2004-08-03 02:39:24 +00:00
tools Pass doxygen doc comments through to the output. 2004-07-11 16:14:24 +00:00
ufs Put a version element in the VFS filesystem configuration structure 2004-07-30 22:08:52 +00:00
vm In dev_pager_updatefake, m->valid is typically 0 on entry. It 2004-08-04 08:58:58 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00