History log of /freebsd-10.3-release/sys/dev/aic7xxx/aicasm/aicasm.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 236571 04-Jun-2012 dim

Make aicasm compile without warnings if -Wpointer-sign is enabled.

MFC after: 3 days


# 224046 15-Jul-2011 emaste

Improve portability #defines for compiling aicasm on other systems.

Submitted by: Robert Millan rmh debian.org
Obtained from: Debian GNU/kFreeBSD


# 201261 30-Dec-2009 ed

Add missing `void' keywords.


# 198327 21-Oct-2009 brueffer

Add a missing free() call.

PR: 138379
Submitted by: Patroklos Argyroudis <argp@census-labs.com>
Reviewed by: gibbs
MFC after: 1 week


# 193244 01-Jun-2009 delphij

Code cleanups to make this WARNS=6 clean.

PR: bin/96128


# 139749 06-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 126891 12-Mar-2004 trhodes

These are changes to allow to use the Intel C/C++ compiler (lang/icc)
to build the kernel. It doesn't affect the operation if gcc.

Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as
icc v8 may define __GNUC__ some parts may look strange but are
necessary.

Additional changes:
- in_cksum.[ch]:
* use a generic C version instead of the assembly version in the !gcc
case (ASM code breaks with the optimizations icc does)
-> no bad checksums with an icc compiled kernel
Help from: andre, grehan, das
Stolen from: alpha version via ppc version
The entire checksum code should IMHO be replaced with the DragonFly
version (because it isn't guaranteed future revisions of gcc will
include similar optimizations) as in:
---snip---
Revision Changes Path
1.12 +1 -0 src/sys/conf/files.i386
1.4 +142 -558 src/sys/i386/i386/in_cksum.c
1.5 +33 -69 src/sys/i386/include/in_cksum.h
1.5 +2 -0 src/sys/netinet/igmp.c
1.6 +0 -1 src/sys/netinet/in.h
1.6 +2 -0 src/sys/netinet/ip_icmp.c

1.4 +3 -4 src/contrib/ipfilter/ip_compat.h
1.3 +1 -2 src/sbin/natd/icmp.c
1.4 +0 -1 src/sbin/natd/natd.c
1.48 +1 -0 src/sys/conf/files
1.2 +0 -1 src/sys/conf/files.amd64
1.13 +0 -1 src/sys/conf/files.i386
1.5 +0 -1 src/sys/conf/files.pc98
1.7 +1 -1 src/sys/contrib/ipfilter/netinet/fil.c
1.10 +2 -3 src/sys/contrib/ipfilter/netinet/ip_compat.h
1.10 +1 -1 src/sys/contrib/ipfilter/netinet/ip_fil.c
1.7 +1 -1 src/sys/dev/netif/txp/if_txp.c
1.7 +1 -1 src/sys/net/ip_mroute/ip_mroute.c
1.7 +1 -2 src/sys/net/ipfw/ip_fw2.c
1.6 +1 -2 src/sys/netinet/igmp.c
1.4 +158 -116 src/sys/netinet/in_cksum.c
1.6 +1 -1 src/sys/netinet/ip_gre.c
1.7 +1 -2 src/sys/netinet/ip_icmp.c
1.10 +1 -1 src/sys/netinet/ip_input.c
1.10 +1 -2 src/sys/netinet/ip_output.c
1.13 +1 -2 src/sys/netinet/tcp_input.c
1.9 +1 -2 src/sys/netinet/tcp_output.c
1.10 +1 -1 src/sys/netinet/tcp_subr.c
1.10 +1 -1 src/sys/netinet/tcp_syncache.c
1.9 +1 -2 src/sys/netinet/udp_usrreq.c

1.5 +1 -2 src/sys/netinet6/ipsec.c
1.5 +1 -2 src/sys/netproto/ipsec/ipsec.c
1.5 +1 -1 src/sys/netproto/ipsec/ipsec_input.c
1.4 +1 -2 src/sys/netproto/ipsec/ipsec_output.c

and finally remove
sys/i386/i386 in_cksum.c
sys/i386/include in_cksum.h
---snip---
- endian.h:
* DTRT in C++ mode
- quad.h:
* we don't use gcc v1 anymore, remove support for it
Suggested by: bde (long ago)
- assym.h:
* avoid zero-length arrays (remove dependency on a gcc specific
feature)
This change changes the contents of the object file, but as it's
only used to generate some values for a header, and the generator
knows how to handle this, there's no impact in the gcc case.
Explained by: bde
Submitted by: Marius Strobl <marius@alchemy.franken.de>
- aicasm.c:
* minor change to teach it about the way icc spells "-nostdinc"
Not approved by: gibbs (no reply to my mail)
- bump __FreeBSD_version (lang/icc needs to know about the changes)

Incarnations of this patch survive gcc compiles since a loooong time,
I use it on my desktop. An icc compiled kernel works since Nov. 2003
(exceptions: snd_* if used as modules), it survives a build of the
entire ports collection with icc.

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by: -arch
Submitted by: netchild


# 123578 17-Dec-2003 gibbs

When outputing a code listing, properly display
macros that expand to multiple instructions.


# 102668 31-Aug-2002 gibbs

Update assembler syntax and assembler to allow generation of register
description tables used for diagnostic "pretty printing".


# 97893 05-Jun-2002 gibbs

Silence GCC warnings about multi-line strings.

Sync Perforce IDs.


# 95376 24-Apr-2002 gibbs

Add macro functionality.

Staticize and allow unique naming of data structures so that more
than on sequencer program can be statically compiled into the kernel
at a time.


# 79873 18-Jul-2001 gibbs

Add support for parsing version strings out of assembler source files
and outputing them in generated files.

Fixed a few other scanner bugs that for some reason didn't show up until
these modifications were made.

MFC after: 10 days


# 71999 04-Feb-2001 phk

Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)


# 68578 10-Nov-2000 gibbs

Sync perforce IDs.


# 66648 05-Oct-2000 gibbs

Correct pedantic errors in arrays generated by the assembler (trailing
comma in array declarations).

Output a constant indicating the number of critical section entries
in the firmware.


# 66270 22-Sep-2000 gibbs

Add Perforce RCSIDs for easy revision correlation to my local tree.

Add support for constructing a table of critical section regions in
the firmware image. The kernel driver will soon have support for
single stepping the sequencer outside of a critical region prior
to starting exception handling.


# 65943 16-Sep-2000 gibbs

Move aicasm to its own subdirectory.


# 63457 18-Jul-2000 gibbs

o Convert to <inttypes.h> style fixed sized types to facilitate porting to
other systems.

o Normalize copyright text.

o Clean up probe code function interfaces by passing around a single
structure of common arguments instead of passing "too many" args
in each function call.

o Add support for the AAA-131 as a SCSI adapter.

o Add support for the AHA-4944 courtesy of "Matthew N. Dodd" <winter@jurai.net

o Correct manual termination support for PCI cards. The bit definitions
for manual termination control in the SEEPROM were incorrect.

o Add support for extracting NVRAM information from SCB 2 for BIOSen
that use this mechanism to pass this data to OS drivers.

o Properly set the STPWLEVEL bit in PCI config space based on the
setting in an SEEPROM.

o Go back to useing 32byte SCBs for all controllers. The current
firmware allows us to embed 12byte cdbs on all controllers in
a 32byte SCB, and larger cdbs are rarely used, so it is a
better use of this space to offer more SCBs (32).

o Add support for U160 transfers.

o Add an idle loop executed during data transfers that prefetches
S/G segments on controllers that have a secondary DMA engine
(aic789X).

o Improve the performance of reselections by avoiding an extra
one byte DMA in the case of an SCB lookup miss for the reselecting
target. We now keep a 16byte "untagged target" array on the card
for dealing with untagged reselections. If the controller has
external SCB ram and can support 64byte SCBs, then we use an
"untagged target/lun" array to maximize concurrency. Without
external SCB ram, the controller is limited to one untagged
transaction per target, auto-request sense operations excluded.

o Correct the setup of the STPWEN bit in SXFRCTL1. This control
line is tri-stated until set to one, so set it to one and then
set it to the desired value.

o Add tagged queuing support to our target role implementation.

o Handle the common cases of the ignore wide residue message
in firmware.

o Add preliminary support for 39bit addressing.

o Add support for assembling on big-endian machines. Big-endian
support is not complete in the driver.

o Correctly remove SCBs in the waiting for selection queue when
freezing a device queue.

o Now that we understand more about the autoflush bug on the
aic7890, only use the workaround on devices that need it.

o Add a workaround for the "aic7890 hangs the system when you
attempt to pause it" problem. We can now pause the aic7890
safely regardless of what instruction it is executing.


# 60938 26-May-2000 jake

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


# 60833 23-May-2000 jake

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


# 50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49931 16-Aug-1999 gibbs

Fix a few compiler nits.

Submitted by: Bill Fumerola <billf@jade.chc-chimes.com>


# 44966 23-Mar-1999 gibbs

Use TCL_CHANNEL/SCSI_ID/etc. macros in more locations.

Don't mess with the IRQMS bit in the host control register unless
we are an aic7770 chip.

Use calling context to determine if the card is already paused when
we update the target message request bit field in controller scratch
ram. Looking at the paused bit in the HCNTRL register opened up a
race condition.

Insert delays in the target message request update routine as a temporary
work around for what looks like a chip bug. I'm still investigating this
one.

Fix the Abort/Abort Tag/BDR handler to pull its message from the message
buffer in our softc instead of attempting to get it from a register on
the controller. The message is never recorded by the controller in the
new message scheme.

Don't rely on having an SCB when a BDR occurs. We can issue these during
invalid reconnects to.

Fix a few cases where we were restarting the sequencer but then still
falling out of a switch statement to unpause the sequencer again.
This could cause us to mess up sequencer state if it generated another
pausing interrupt between the time of the restart and unpause.

Kill the 'transceiver settle' loop during card initialization. I
failed to realize that a controller that is not connected to any
cables will never settle or enable the SCSI transceivers at all.
The correct solution is to monitor the IOERR interrupt which indicates
that the transceiver state has changed (UW<->LVD).

Modify the aic7xxx assembler to properly echo input when stdin is not
a tty.


# 39220 15-Sep-1998 gibbs

Massive overhaul of the aic7xxx driver:
- Convert to CAM
- Use a new DMA based queuing and paging scheme
- Add preliminary target mode support
- Add support for the aic789X chips
- Take advantage of external SRAM on more controllers.
- Numerous bug fixes and performance improvements.


# 29050 03-Sep-1997 gibbs

Make the aic7xxx sequencer assembler compile in the kernel's object
directory. Rename (via repository copy) some files so that the potential
for future conflicts is minimized.

PR: conf/4363


# 26997 27-Jun-1997 gibbs

Modify my copyright notice to allow the sequencer to be used with GPLed
software (aka Linux).

Fix a few bugs in the sequencer assembler.

Make it easy to compiler the assembler with debugging turned on.


# 24794 10-Apr-1997 gibbs

aic7xxx.seq:
Be consistant about testing for parity errors after waiting for a
REQ on the bus.

Don't ack the last byte in a transaction until after we've cleared
all target state.

aic7xxx_asm.c:
Test the return value of getopt against -1 not EOF. (Yet another
shameless victum of the style guide being wrong).


# 23991 18-Mar-1997 gibbs

aic7xxx.seq:
Stick 4 more, twin channel only, instructions behind
.if ( TWIN_CHANNEL)

aic7xxx_asm.c:
Add the -O options which allows the specification of which options
to include in a program listing. This makes it possible to easily
determine the address of any instruction in the program across
different hardware/option configurations. Updated usage() as well.


# 23925 16-Mar-1997 gibbs

Makefile gram.y scan.l sequencer.h symbol.c symbol.h aic7xxx_asm.c:
New sequencer assembler for the aic7xxx adapters. This assembler
performs some amount of register type checking, allows bit
manipulation of symbolic constants, and generates "patch tables"
for conditionalized downloading of portions of the program.
This makes it easier to take full advantage of the different
features of the aic7xxx cards without imposing run time penalies
or being bound to the small memory footprints of the low end
cards for features like target mode.

aic7xxx.reg:
New, assembler parsed, register definitions fo the aic7xxx cards.
This was done primarily in anticipation of 7810 support which
will have a different register layout, but should be able to use
the same assembler. The kernel aic7xxx driver consumes a generated
file in the compile directory to get the definitions of the register
locations.

aic7xxx.seq:
Convert to the slighly different syntax of the new assembler.

Conditionalize SCB_PAGING, ultra, and twin features which shaves
quite a bit of space once the program is downloaded.

Add code to leave the selection hardware enabled during reconnects
that win bus arbitration. This ensures that we will rearbitrate
as soon as the bus goes free instead of delaying for a bit.

When we expect the bus to go free, perform all of the cleanup
associated with that event "up front" and enter a loop awaiting
bus free. If we see a REQ first, complain, but attempt to
continue. This will hopefully address, or at least help diagnose,
the "target didn't send identify" messages that have been reported.

Spelling corrections obtained from NetBSD.


# 22975 22-Feb-1997 peter

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 14934 31-Mar-1996 gibbs

aic7xxx.seq:
Fix support for the aic7850 by looking only at the relavent bits of the
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.

Don't trust SCSIPERR to tell us when there is a parity error. On
some revs of the 7870 and the 7880, this bit follows the parity of
the current byte. Instead of using a SEQINT to tell the kernel,
re-enable the standard parity error interrupt since it seems to pause
the sequencer right at the time of the error which is the effect we were
looking for anyway.

aic7xxx_reg.h:
Remove PARITY_ERROR seqeuncer interrupt type, its no longer used.

Define QCOUNTMASK as the SRAM location for the mask to use on the
QINCNT register. QCOUNTMASK is determined by the number of SCBs
supported by the device we're working on.

aic7xxx_asm.c
Properly check the return value of fopen, and define the arg list
in getopt correctly.
Submitted by: Pete Bentley <pete@demon.net>


# 13230 05-Jan-1996 gibbs

Null terminate execl's argument list.

Submitted by: Ron Lenk <rlenk@widget.xmission.com>


# 13177 03-Jan-1996 gibbs

The long awaited stability patch set for the aic7xxx driver:

1) Use cpp to preprocess the sequencer code.

2) Convert all "magic numbers" to #defines shared by the sequencer and
kernel driver via the aic7xxx_reg.h file. (The assembler still needs
to be re-written in lex/yacc to allow ~|& type constructions).

3) Raise ATN on parity errors for "in" phases and send an initiator detected
error or message-in parity error message as appropriate.

4) Turn off the reselection hardware from the time or a (re)connection to
busfree. It seems that some fast targets were able to reconnect before
the sequencer was able to see busfree.

5) The message buffer is considered "in-use" when there is a positive length
count. The ACTIVE_MSG flag was unnecesary.

6) Properly set SCB_NEXT_WAITING to SCB_LIST_HEAD in scbs being added to
the waiting scb list. This is a change in how the list code works to
facilitate some planned work in the reset code.

7) The fields in the SCB have be re-arranged to be quad-word aligned.

8) The inb code has been rewritten to catch phasemisses and be more efficient.

9) Go back to "snooping the bus" to determine if the incomming identify
message will be followed by a simple queue message. Its much faster than
doing a search through the SCBs.

10) Implement better tag range checking for incomming tags.

11) Make sdtr_to_rate more accurate (use 25 instead of 24 in calculations -
must have been asleep that night).

12) Rearrange some routines to reduce code complexity and size.

13) Update comments and formatting.

14) Fixed bugs I've forgotten about??

Reviewed by: David Greenman <davidg@FreeBSD.org>


# 8876 30-May-1995 rgrimes

Remove trailing whitespace.


# 7857 15-Apr-1995 gibbs

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.


# 7532 31-Mar-1995 gibbs

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).


# 7118 17-Mar-1995 gibbs

Make the aic7xxx assembler take quoted strings as a single token.
Make $Id the version variable which required the quoted string "feature".


# 5775 22-Jan-1995 gibbs

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.


# 5647 16-Jan-1995 gibbs

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.


# 4614 18-Nov-1994 gibbs

Previous changes to the sequencer compiler backed out. We go back to
generating the .h file, and a pregenerated file is included.


# 4608 18-Nov-1994 jkh

Make the compiler spit out a .c file instead of a .h file.


# 4568 17-Nov-1994 gibbs

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)