1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/sys
Kenneth D. Merry 49dfe4a2d4 Fix an event handling bug with the mps(4) driver.
This bug manifested itself after repeated device arrivals and
departures.  The root of the problem was that the last entry in the
reply array wasn't initialized/allocated.  So every time we got
around to that event, we had a bogus address.

There were a couple more problems with the code that are also fixed:

 - The reply mechanism was being treated as sequential (indexed by
   sc->replycurindex) even though the spec says that the driver
   should use the ReplyFrameAddress field of the post queue
   descriptor to figure out where the reply is.  There is no
   guarantee that the reply descriptors will be used in sequential
   order.

 - The second word of the reply post queue descriptor wasn't being
   checked in mps_intr_locked() to make sure that it wasn't
   0xffffffff.  So the driver could potentially come across a
   partially DMAed descriptor.

 - The number of replies allocated was one less than the actual
   size of the queue.  Instead, it was the size of the number of
   replies that can be used at one time.  (Which is one less than
   the size of the queue.)

mps.c:		When initializing the entries in the reply free
		queue, make sure we initialize the full number that
		we tell the chip we have (sc->fqdepth), not the
		number that can be used at any one time (sc->num_replies).

		When allocating replies, make sure we allocate the
		number of replies that we've told the chip exist,
		not just the number that can be used simultaneously.

		Use the ReplyFrameAddress field of the post queue
		descriptor to figure out which reply is being
		referenced.  This is what the spec says to do, and
		the spec doesn't guarantee that the replies will be
		used in order.

		Put a check in to verify that the reply address passed
		back from the card is valid.  (Panic if it isn't, we'll
		panic when we try to deference the reply pointer in any
		case.)

		In mps_intr_locked(), verify that the second word of the
		post queue descriptor is not 0xffffffff in addition to
		verifying that the unused flag is not set, so we can
		make sure we didn't get a partially DMAed descriptor.

		Remove references to sc->replycurindex, it isn't needed
		now.

mpsvar.h:	Remove replycurindex from the softc, it isn't needed now.

Reviewed by:	scottl
2010-12-10 21:45:10 +00:00
..
amd64 Replace i386/i386/busdma_machdep.c and amd64/amd64/busdma_machdep.c 2010-12-09 06:41:50 +00:00
arm
boot
bsm
cam Fix a few issues related to the XPT_GDEV_ADVINFO CCB. 2010-12-10 21:38:51 +00:00
cddl
compat
conf Replace i386/i386/busdma_machdep.c and amd64/amd64/busdma_machdep.c 2010-12-09 06:41:50 +00:00
contrib
crypto
ddb
dev Fix an event handling bug with the mps(4) driver. 2010-12-10 21:45:10 +00:00
fs Disable attempts to establish a callback connection from the 2010-12-09 19:02:23 +00:00
gdb
geom Don't warn if a partition appears not to be aligned on a track boundary. 2010-12-07 20:46:11 +00:00
gnu
i386 When r207410 eliminated the acquisition and release of the page queues 2010-12-09 20:16:00 +00:00
ia64
isa
kern Refactor fork1() to make it easier to follow. No functional changes. 2010-12-10 08:33:56 +00:00
kgssapi
libkern
mips Fix compilation when DEBUG option is enabled. 2010-12-09 12:30:13 +00:00
modules
net Adds IFF_CANTCONFIG to IFF_CANTCHANGE that it shouldn't happen through 2010-12-07 20:31:04 +00:00
net80211
netatalk
netgraph
netinet
netinet6 Loosen the locking in nd6-free() again after r216022 to avoid 2010-12-07 22:43:29 +00:00
netipsec
netipx
netnatm
netncp
netsmb
nfs
nfsclient
nfsserver
nlm
opencrypto
pc98 Do not subtract 0.5% from estimated frequency if DELAY(9) is driven by TSC. 2010-12-08 23:40:41 +00:00
pci
powerpc
rpc
security
sparc64
sun4v
sys MFp4: 2010-12-09 02:42:02 +00:00
teken
tools
ufs
vm Fix a long standing (from the original 4.4BSD lite sources) race between 2010-12-09 21:02:22 +00:00
x86 Remove AMD Family 0Fh, Model 6Bh, Stepping 2 from the list of P-state 2010-12-09 21:29:36 +00:00
xdr
xen Postpone the unmasking of event channels (aka. interrupts) until after 2010-12-07 23:33:20 +00:00
Makefile