Commit Graph

120 Commits

Author SHA1 Message Date
Justin T. Gibbs
475791c882 Change SCB_LIST_NULL to 0xff from 0x10 to allow for 255 commands. This
is needed for 3940 support.

Have tagged commands look to see if a target is "busy" with a non tagged
command before executing.  This prevents overlapped tagged and non tagged
commands which can happen since request sense commands are not tagged.
1995-07-04 20:58:57 +00:00
Rodney W. Grimes
9b2e535452 Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
David Greenman
57cb71573d Fixes to the aic7xxx sequencer code and device driver from Justin Gibbs:
1) If a target initiated a sync negotiation with us and happened to chose a
value above 15, the old code inadvertantly truncated it with an "& 0x0f".
If the periferal picked something really bad like 0x32, you'd end up with
an offset of 2 which would hang the drive since it didn't expect to ever
get something so low.  We now do a MIN(maxoffset, given_offset).

2) In the case of Wide cards, we were turning on sync transfers after a
sucessfull wide negotiation.  Now we leave the offset alone in the per
target scratch space (which implies asyncronous transfers since we initialize
it that way) until a syncronous negotation occurs.

3) We were advertizing a max offset of 15 instead of 8 for wide devices.

4) If the upper level SCSI code sent down a "SCSI_RESET", it would hang the
system because we would end up sending a null command to the sequencer.  Now
we handle SCSI_RESET correctly by having the sequencer interrupt us when it
is about to fill the message buffer so that we can fill it in ourselves.
The sequencer will also "simulate" a command complete for these "message only"
SCBs so that the kernel driver can finish up properly.  The cdplay utility
will send a "SCSI_REST" to the cdplayer if you use the reset command.

5) The code that handles SCSIINTs was broken in that if more than one type
of error was true at once, we'd do outbs without the card being paused.
The else clause after the busfree case was also an accident waiting to
happen.  I've now turned this into an if, else if, else type of thing, since
in most cases when we handle one type of error, it should be okay to ignore
the rest (ie if we have a SELTO, who cares if there was a parity error on
the transaction?), but the section should really be rewritten after 2.0.5.
This fix was the least obtrusive way to patch the problem.

6) Only tag either SDTR or WDTR negotiation on an SCB.  The real problem is
that I don't account for the case when an SCB that is tagged to do a particular
type of negotiation completes or SELTOs (selection timeout) without the
negotiation taking place, so the accounting of sdtrpending and wdtrpending
gets screwed up.  In the wide case, if we tag it to do both wdtr and sdtr,
it only performs wdtr (since wdtr must occur first and we spread out the
negotiation over two commands) so we always have sdtrpending set for that
target and we never do a real SDTR.  I fill properly fix the accounting
after 2.0.5 goes out the door, but this works (as confirmed by Dan) on
wide targets.

Other stuff that is also included:

1) Don't do a bzero when recycling SCBs.  The only thing that must explicitly
be set to zero is the scb control byte which is done in ahc_get_scb.  We also
need to set the SG_list_pointer and SG_list_count to 0 for commands that do
not transfer data.

2) Mask the interrupt type printout for the aic7870 case.  The bit we were
using to determine interrupt type is only valid for the aic7770.


Submitted by:	Justin Gibbs
1995-05-17 07:06:02 +00:00
Justin T. Gibbs
c28447da4c Restructure the arbitration loop to allow for reselections that win out over
the adapter's selections.  Many fast periferals were getting upset when
the sequencer decided to rearbitrate after the device had already won
arbitration.  This also forced the creation of a list threaded through
the SCBs (since we don't have enough space anywhere else) of commands that
are awaiting reselection.  This list is run down before any new transactions
from the input queue are allowed.  The list is appened to whenever we begin
a selection (simple case since the selecting device is always at the head)
and by the kernel driver whenever a request sense occurs.  In the common
case, the list is only one element long, but when a reselection wins out
over a selection and that reselection generates a request sense, the
outstanding selection required for the retreval of the sense code grows
the list.  On machines with many targets, this might cause the list to grow
large, so this solution, which will allow up to the maximum number of I/O
requests capible of the card elements in the list, was chosen.  The list
manipulation is trivial and adds three sequencer instructions of overhead
to the selection phase.

This fixes the "target busy" errors from micropolis drives and the bursty
I/O problem when performing I/O between a Quantum Grand Prix and any other
device.  I anticipate that this will correct many of the problems that
have been reported with this driver.

Reviewed by: Wcarchive and David Greenman
1995-04-27 17:44:27 +00:00
Justin T. Gibbs
3cddb2a3e2 John Aycock's BSD copyrighted sequencer assembler and sequencer code. This
is identical to the older version, just the copyright has changed.  Many
thanks go to Dean Gehnert of the Linux camp who went the extra mile to make
this happen.

Other changes:

Update assembler man page to include the -v and -D options

Merge in Dean's latest changes to the assembler

Have the sequencer do a MSG_REJECT when the negotiated syncronous rate
is lower than the adapter supports.  This forces asyncronous mode which
is faster at these rates anyway.

This code will be moved shortly to the non-gpld portion of the tree.
1995-04-15 21:45:56 +00:00
Justin T. Gibbs
0b000afb3b More code optimizations. Use a slightly different approach to decide
whether a reconnecting target is a tagged device or not.
1995-04-09 06:40:16 +00:00
Justin T. Gibbs
cc865dd008 Off by one error in -MSG-START+0 was just Justin being tired -- revert to
old value.

Remove unnecessary check for active messages in setup SCB.  This same test
would also jump to p_mesgin_done which would "ACK" an extra time possibly
confusing the target.

Tell the kernel driver whenever we send an ABORT_TAG message.
1995-04-01 19:51:40 +00:00
Justin T. Gibbs
5743c01c3f Major overhaul of the aic7xxx driver:
- Report valid residual byte counts.  We actually pause the sequencer
	  when the residual is non-zero.  I thought about using DMA to do this,
	  bus sequencer program space is tight.

	- Fix embarassing off by one error in the computation of a 2's
	  compliment variable.  This was most likely the cause of the
	  many problems reported with the tagged queuing code.

	- Handle "MAX_SYNC" as a special case (ie we are the ones starting
	  the sync negotiation sequence).  This was done so that the target
	  scratch area can be initialed to 0 offset (asyncronous transfers)
	  safely.  The initialization to 0 (was 15) is necessary since in
	  some cases a Wide negotiation could run into problems if SCSIRATE
	  was set wrong and we went into data(in/out).

	- Trim the DMA routines a little by using some procedures.  Net
	  effect is more functionality with 3 less instructions after this
	  update.

	- Toggle the WIDEODD bit of the DFCNTRL whenever this is not the
	  last SG block.  It has no effect in the 8bit bus configuration,
	  but in the Wide configuration ensures that the overlap byte is
	  held in the SCSI block if the transfer is odd so it will end
	  up in the next SG (the correct behavior).
1995-03-31 14:06:02 +00:00
Justin T. Gibbs
b8d72a5ae8 Make the aic7xxx assembler take quoted strings as a single token.
Make $Id the version variable which required the quoted string "feature".
1995-03-17 23:54:17 +00:00
Justin T. Gibbs
06f0e1ceb8 Be careful to maintain the bits in SBLKCTL that are reserved. 1995-03-07 09:00:44 +00:00
Justin T. Gibbs
7325b76b7d Add tagged queueing support to the aic7xxx sequencer code. 1995-02-22 01:37:52 +00:00
Justin T. Gibbs
1bca1a0922 Have version number track CSV version number. No other change. 1995-02-03 17:18:44 +00:00
Justin T. Gibbs
c135d93bbf aic7xxx.c:
Print out the length of the compiled sequencer program.

aic7xxx.seq:
	More optimizations.  Replace generic bcopy routine with bcopy_3
and bcopy_4 (ie unroll the loops) since these are the only two cases used.
Initialize SIMODE1 and SXFRCTL1 from the kernel in ahc_init instead of
at each selection/reselection since this is expensive and only needs to
be done once.  Condense function returns into previous instruction if possible.
Reorder some sections to kill superflous jumps.  These optimizations kill
the ~150k/s penalty adding support for Twin/Wide cards was costing since
the last place in the commaon path of execution where we had to do ugly,
convoluted testing for the type of card in the sequencer has gone away.
Next stop tagged queuing and target mode.
1995-01-22 00:46:53 +00:00
Justin T. Gibbs
0d56403998 At $Ids to all files. Have the sequencer use DMA to tranfer its SCB
(SCSI control block) instead of having the host PIO it down.  Also
reimplement WDTR and SDTR optimization to remove code in the sequencer
and place the responsibility of knowing when to initiate SDTR or WDTR
on the kernel driver.  This vastly shortens the sequencer program yet
yeilds the same performance.
1995-01-16 16:31:21 +00:00
Justin T. Gibbs
20c5e65572 Full support for 294x and Wide devices. Fixed month old bug in the SCSI
sense retrieval code that messed up CDROM devices.  This code will also
responde correctly to SDTR and WDTR messages from devices that start a
negotiation sequence.
1995-01-13 02:22:11 +00:00
Justin T. Gibbs
8ff1d93efb Update the sequencer code to handle both channels of Twin channel devices.
You can now sling 14 devices off of a 274xT.  In the process of adding
twin channel support, I removed all evident restrictions on supporting
Wide channeled devices, but I do not have a Wide controller to test them
on.

aic7770_seq.h, the pre-compiled header, is no longer needed since config
handles this dependancy.
1994-12-31 19:26:54 +00:00
Justin T. Gibbs
cb0d548bf4 Merge in latest Linux sequencer code release with my changes. This should
make the sequencer code fully compatible with the aic7870 (ie 294x adaptors).
I've also added to my local mods putting the sequencer into "FASTMODE" clock.
This gives upwards of 2M/sec write preformance improvement in some scenarios.
There haven't been any reports of this causing problems, and I have been
reaping the benifits of it for more than a week now.

This also includes a new version of the pre-generated file <ugh>

Obtained from: John Aycock (aycock@cpsc.ucalgary.ca) and myself
1994-11-29 23:04:23 +00:00
Justin T. Gibbs
8d244f9e3b Previous changes to the sequencer compiler backed out. We go back to
generating the .h file, and a pregenerated file is included.
1994-11-18 09:11:35 +00:00
Jordan K. Hubbard
9cc6cb724f Make the compiler spit out a .c file instead of a .h file. 1994-11-18 08:17:20 +00:00
Justin T. Gibbs
0ef8c3017a John Aycock's aic7770 sequencer code and assembler. There is currently
a discussion going on about removing this code from the burden of the
GPL, but it won't happen before Beta, and this code should be tested
before release.

Supports 27/2842 class adaptec cards and is almost capable of supporting
aic7870 based adapters (294X series cards).  It does not support Wide
controllers or the second channel on Twin boards although I have work in
progress on getting both channels and running.

I have also added a few performance improvements to this version that give
us approximately a 25% boost over the original driver.  These patches have
been submitted to the author.

Obtained from: Linux aic7770 driver (John Aycock - aycock@cpsc.ucalgary.ca)
1994-11-17 20:19:10 +00:00