uses one or the other. This required some changes to the ahc_reset()
function, and how early the probes had to allocate their softc.
Turn the AHC_IN/OUT* macros into inline functions and lowercase their names
to indicate this change. Geting AHC_OUTSB to work as a macro doing
conditional memory mapped I/O would have been too gross.
Stop setting STPWEN in the main driver and let the PCI front end do it
instead. It knows better.
Add the clearing of the QOUTQCNT variable during command complete processing
in the SCB paging case.
Go back to doing unconditional retries for the QUEUE FULL status condition.
This is really a kludge, but the code to handle it properly is on the SCSI
branch and will not make it into 2.2.
it automatically. The AHC_FORCE_PIO option wasn't having any effect because
the PCI probe code didn't include this file.
Fix some problems with the new sync and wide negotiation code. First off,
go back to async transfers by using a message reject again. The SCSI II and
III spec indicate that if a target's response to an initiater does not suit
(i.e. its too low), then performing a message reject is the appropriate
response. If, on the other hand, the initiator begins the negotiation and
we want to go async, we will send back an SDTR message with a 0 period and
offset.
Also fix a really bad negotiation problem caused by a missing "break". This
would usually hit people that had "smart" wide devices that immediately
attempt sync negotiation after a successful wide negotiation.
2.2 Candidate.
This involves expanding the support of the SEEPROM routines to deal with
the larger SEEPROMs on these cards and providing a mechanism to share
SCB arrays between multiple controllers.
Most of the 398X support came from Dan Eischer.
ahc_data -> ahc_softc
Clean up some more type bogons I missed from the last pass.
Be more clear when handing the NO_MATCH condition. NO_MATCH can also
happen when the sequencer encounters an SCB we've asked to be aborted.
- Add support for memory mapped I/O.
- Use DMA to get SCBs down to the adapters.
- Remove old paging code.
- Be much smarter about how we allocate SCB space. The old, simple method
wasted almost half a page per SCB. Ooops.
- Make command complete interrupt processing more efficient.
- Break the monolithic ahc_intr into sub-routines. The sub-routines handle
rare, special case events so the function call is not a penalty and the
removal of the code from the main routine most likely improves performance
instruction prefech will work better and less code is pushed into the cache.
- Never, ever allow tagged queueing if a device has disconnection disabled.
- Clean up and simplify timeout code. Many of the changes are to handle the
new DMA scheme.
I have only tested the ABP5140 card and only with a single CDROM drive
but it seems to work fine. This driver relies on features found only in
the SCSI branch so will not work in -current until those changes
are brought in. It also doesn't have any error handling code *yet*.
The goal is to use this driver as the development platform for the new
generic SCSI layer error recovery/handling code.
PCI and EISA front ends will show up as soon as I get my hands on
the cards. There are also a few issues in the driver that I need
to clear up with AdvanSys before I can suggest sticking one of
these cards in your server. 8-)
Thanks to AdvanSys for releasing this code under a suitable copyright.
Obtained from: Ported from the Linux driver writen by
bobf@advansys.com (Bob Frey).
mode when this occurs and allow the target to complete the transaction.
Force a retry on overruns since they are usually caused by termination or
cable problems.
before clearing the SELTO interrupt. We used to do this in the past, but
this outb got lost.
Turn ATN on ourselves as appropriate during a parity error instead of relying
on ENAUTOATNP.
Don't use a loop in RESTART_SEQUENCER. Its not necessary.
Add a panic for attempts to page in a non paged out SCB.
Re-order some of the interrupt routine for better performance.
NetBSD/OpenBSD support Submitted by:Noriyuki Soda <soda@sra.co.jp>,
Pete Bentley <pete@demon.net>,
Charles M. Hannum <mycroft@mit.edu>,
Theo de Raadt <deraadt@theos.com>
call of ahc_scsirate. Otherwise, the proper setting may not get set until
the next reconnection/selection.
The saved_queue used to re-order the QINFIFO during error recovery or
certain SCB paging operations should be an array of u_chars not ints.
saved_queue type error pointed out by: Noriyuki Soda <soda@sra.co.jp>
to use the full range of settings from 3.6-20MHz on any target.
Remove all Ultra settings except for the top three that are documented
to work. This fixes some problem reports with the last revision of the
driver since at least the 5.7MHz entry doesn't work in Ultra mode.
channel B first as approriate.
Only reset the SCSI bus if the RESET_SCSI bit of SCSICONF is set. This
makes the aic7xxx driver honor all of the configuration settings availible
in SCSI-Select or the ECU.
Fix a benign bug in the reset code that caused us to always wait a full
second after the chip reset. This should shave some time off the probe.
Bug found by pedrosal@nce.ufrj.br (Pedro Salenbauch)
It seems that only the top three sync rates are doubled when in ultra mode,
so update the syncrates table as appropriate.
Found by "Dan Willis" <dan@plutotech.com> and his SCSI bus analyzer
Ensure that queued commands are not touched by the abort code by setting
the SCB status to indicate what queue it is in.
Fix deadlocks when using SCB paging by using SCBs from the assigned_scbs
queue or an SCB that completed during the same interrupt if needed.
Don't ever use insl to pull SCBs from any of the controllers. You can
only do 8bit PIO reads. This only affected SCB paging.
With this checkin, SCB paging works quite a bit better, but I still have
some problems with it that may be caused by a firmware problem in my
PD1800s. It seems that using a tag number higher than the maximum number
of tags allowed by the device, confuses it. For example, if I queue
two commands, tagged 3 and 36, it never reconnects for tag 36.
strange results. This bug has been in here for a loooong time.
Many thanks to Pedro Salenbauch for finding this.
Submitted by: pedrosal@nce.ufrj.br (Pedro Salenbauch)
8 not the 18 I was using during some of my own testing. Ooops.
For those that want to change the number for experimentation, you can
set the value on line 1553 of this file.
(Rev E or greater), aic7850, aic7860, aic7870, and aic7880 controllers.
SCB paging is enabled with the option "AHC_SCBPAGING_ENABLE". Full
comments on the algorithm are at the top of i386/scsi/aic7xxx.c.
options "AHC_TAGENABLE" and "AHC_QUEUE_FULL" have been removed. The
default is 4 tags without SCB paging, 8 with.
Clear the SCSIRSTI bit after throwing a bus reset. Some cards seem to get
confused otherwise.
Handle SCSIRSTI interrupts before checking to see if there is a valid
SCB in use since this can happen. (Clears PR# i386/1123)
Clean up the way we determine the number of SCBs on the card
(courtesy of Dan Eischen).
Guard against attempts to negotiate wide to a narrow controller.
Fix some comments.
Update my copyrights.
QINCNT. The 7850 puts random garbage in the high bits and all my attempts
to determine the cause of this failed. This approach does seem to work
around the problem.
Go back to relying on the SCSIPERR interrupt instead of having the sequencer
interrupt at the beginning of ITloop after a parity error occured.
Determine the number of SCBs on a card automatically and base the qcntmask
on the number of SCBs.
Add entries for 11.4MHz, 8.8MHz, 8.0MHz, and 7.2MHz to ULTRA portion of
the syncrate table. They seem to work fine on the 2940UW I have here and
will allow more non-ultra devices (like my tape drive) to run sync while
the adapter is in ULTRA mode.
Return XS_SELTIMEOUT instead of XS_TIMEOUT for selection timeouts. I was
getting sick of waiting for the SCSI code to retry each non-existant unit
multiple times during boot and XS_SELTIMEOUT bypasses all retries.
Use new SLIST queue macros. This was inspired by NetBSD using TAILQs in
their SCSI drivers. For optimum cache hits, the free scb list should
be LIFO which is what the old and new code does. NetBSD implemented a
FIFO queue for some reason.
Spaces -> tabs.
Cleanse the SCSI subsystem of its internally defined types
u_int32, u_int16, u_int8, int32, int16, int8.
Use the system defined *_t types instead.
aic7xxx.c:
Fix the reset code.
Instead of queing up all of the SCBs that timeout during timeout
processing, we take the first and have it champion the effort.
Any other scbs that timeout during timeout handling are given
another lifetime to complete in the hopes that once timeout
handing is finished, they will complete normally. If one of
these SCBs times out a second time, we panic and Justin tries
again.
The other major change is to queue flag aborted SCBs during timeout
handling, and "ahc_done" them all at once as soon as we have the
controller back into a sane state. Calling ahc_done any earlier
will cause the SCSI subsystem to toss the command right back at
us and the attempt to queue the command will conflict with what
the timeout routine is trying to accomplish.
The aic7xxx driver will now respond to bus resets initiated by
other devices.
Simplify the initialization of adapters by pulling all card specific
initialization to the card specific modules.
Update comments and fix formating.
Pass struct ahc_data*'s to functions instead of unit numbers.
Take advantage of the quad word alignment of SCB fields.
Adapt to new sequencer changes:
1) Waiting scb list no longer has a tail.
2) Fill the message buffer as appropriate during a parity error.
3) Count all of the SGs involved in a residual instead of just
the current one.
The reset/abort code still needs a lot of work.
Reviewed by: David Greenman <davidg@FreeBSd.org>
all the other bt_XXX() functions in i386/scsi/bt*.
This the important effect of forcing a link error if the user is
still using the old "vector btintr" which is dangerously wrong
after Justin's updates to the driver.
The correct isa vector line for the bt driver is "vector bt_isa_intr".
Justin mentioned this in the commit message and updated LINT and
GENERIC. This change is to enforce that.. :-)
all buses.
Known problems:
-The PCI probe code has not been tested. Someone with a PCI Bt card will
have to validate it, but even if it is broken all cards the earlier version
of this driver found in ISA compatibility mode should still be found.
-Still missing the BT956 PCI ID, so it will be found as an ISA card until
someone suplies it.
-PCI interrupts go through an interrupt stub that returns an int until
we remove the edge-triggered PCI compatibiliity cruft.
-ISA interrupts go through an interrupt stub until they pass in (void *).
-The driver could support more mboxes and concurrent commands by allocating
structures separately and hanging them off the bt_data struct to get around
the 4K page limit. Someone with documentation should do this and also
enable tagged queuing.