Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/aic79xx_osm.c
RevisionDateAuthorComments
 1.36  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.35  24-Apr-2021  thorpej branches: 1.35.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.34  10-Nov-2019  chs branches: 1.34.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.33  14-Jul-2016  msaitoh branches: 1.33.18;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.32  17-Oct-2013  christos branches: 1.32.6;
- remove unused variables
- move variables inside ifdef sections
- ifdef notdef unused code
- use __USE for debugging variables
 1.31  24-Feb-2010  dyoung branches: 1.31.10; 1.31.20; 1.31.24;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.30  08-Jan-2010  dyoung branches: 1.30.2;
Expand PMF_FN_* macros.
 1.29  26-Sep-2009  tsutsui Split device_t/softc. Tested on aic7901A.
 1.28  05-Sep-2009  tsutsui Make ahd_detach() take struct ahd_softc * rather than device_t
as well as ahd_attach(). (currently no backend calls it though)
 1.27  05-Sep-2009  tsutsui Use device_private() to get softc.
 1.26  05-Sep-2009  tsutsui - use local ahd_name() to print device name
- pass proper device_t types to config(9) functions
 1.25  05-Sep-2009  tsutsui Remove unnecessary casts against void pointers.
 1.24  02-Sep-2009  tsutsui Fix harmless pasto. (ahc -> ahd)
 1.23  02-Sep-2009  tsutsui TAB vs space cleanup.
 1.22  02-Sep-2009  tsutsui Replace shutdownhook_establish(9) with pmf_device_register1(9).
Untested, but mostly copied from ahc(4).

This may fix reboot failure problem on ahd(4) after pmf(9) merge:
http://mail-index.NetBSD.org/current-users/2007/12/10/0008.html
which was also seen on old ahc(4):
http://mail-index.NetBSD.org/port-sgimips/2008/01/05/msg000003.html
 1.21  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.20  24-Jun-2008  gmcgarry branches: 1.20.10;
Fix prototype of ahd_send_async(). Pull in dev/ic/aic7xxx_cam.h to get ac_code.
 1.19  08-Apr-2008  cegger branches: 1.19.4; 1.19.6; 1.19.8;
use aprint_*_dev and device_xname
 1.18  04-Mar-2007  christos branches: 1.18.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17  16-Nov-2006  christos branches: 1.17.4;
__unused removal on arguments; approved by core.
 1.16  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15  10-Apr-2006  bouyer branches: 1.15.8; 1.15.10;
Don't use ppr_options uninitialized. Coverity ID 2506.
 1.14  05-Dec-2005  bouyer branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10; 1.14.12;
Wrap debug printf in AHC_DEBUG. Pointed out by Izumi Tsutsui.
 1.13  28-Nov-2005  bouyer Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback.
Fix a panic in uvm reported by John R. Shannon on port-xen; patch tested on
ahc by me and on ahd by John.
 1.12  27-Feb-2005  perry branches: 1.12.2; 1.12.4; 1.12.10;
nuke trailing whitespace
 1.11  21-Feb-2005  thorpej Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.
 1.10  04-Oct-2004  fvdl branches: 1.10.4; 1.10.6;
Don't use sizeof on a pointer when you mean the whole structure.
 1.9  04-Oct-2004  fvdl No need to print out sense data just because it happened to arrive in
a pkt. Wrap that in AHD_DEBUG.
 1.8  21-Apr-2004  itojun avoid unbounded sprintf(), use snprintf()
 1.7  30-Oct-2003  simonb branches: 1.7.2; 1.7.4; 1.7.6;
Remove some assigned-to but otherwise unused variables.
 1.6  02-Sep-2003  fvdl * Make the ahc and ahd probes more alike.
* Remove some redundant code.
* ahd: Don't initiate negotiation for a discovery xs when the negotiation goal
is set. Just looking at the auto_negotiate mask is enough, and it can
cause an endless loop if the request gets requeued (happens with a
of a PPR negotiation, which ends with a busfree).
 1.5  29-Aug-2003  thorpej Apply the following change checked in 2003/05/04 00:20:07 by gibbs
to the FreeBSD ahd driver:

Correct spelling errors.

Switch to handling bad SCSI status as a sequencer interrupt
instead of having the kernel proccess these failures via
the completion queue. This is done because:

o The old scheme required us to pause the sequencer and clear
critical sections for each SCB. It seems that these pause
actions, if coincident with a sequencer FIFO interrupt, would
result in a FIFO interrupt getting lost or directing to the
wrong FIFO. This caused hangs when the driver was stressed
under high "queue full" loads.
o The completion code assumed that it was always called with
the sequencer running. This may not be the case in timeout
processing where completions occur manually via
ahd_pause_and_flushwork().
o With this scheme, the extra expense of clearing critical
sections is avoided since the sequencer will only self pause
once all pending selections have cleared and it is not in
a critical section.

aic79xx.c
Add code to handle the new BAD_SCB_STATUS sequencer
interrupt code. This just redirects the SCB through
the already existing ahd_complete_scb() code path.
Remove code in ahd_handle_scsi_status() that paused
the sequencer, made sure that no selections where
pending, and cleared critical sections. Bad
status SCBs are now only processed when all of these
conditions are true.

aic79xx.reg:
Add the BAD_SCB_STATUS sequencer interrupt code.

aic79xx.seq:
When completing an SCB upload to the host, if
we are doing this because the SCB contains non-zero
SCSI status, defer completing the SCB until there
are no pending selection events. When completing
these SCBs, use the new BAD_SCB_STATUS sequencer
interrupt. For all other uploaded SCBs (currently
only for underruns), the SCB is completed via the
normal done queue. Additionally, keep the SCB that
is currently being uploaded on the COMPLETE_DMA_SCB
list until the dma is completed, not just until the
DMA is started. This ensures that the DMA is restarted
properly should the host disable the DMA transfer for
some reason.

In our RevA workaround for Maxtor drives, guard against
the host pausing us while trying to pause I/O until the
first data-valid REQ by clearing the current snapshot
so that we can tell if the transfer has completed prior
to us noticing the REQINIT status.

In cfg4data_intr, shave off an instruction before getting
the data path running by adding an entrypoint to the
overrun handler to also increment the FIFO use count.

In the overrun handler, be sure to clear our LONGJMP
address in both exit paths.

Perform a few sequencer optimizations.

aic79xx.c:
Print the full path from the SCB when a packetized
status overrun occurs.

Remove references to LONGJMP_SCB which is being
removed from firmware usage.

Print the new SCB_FIFO_USE_COUNT field in the
per-SCB section of ahd_dump_card_state(). The
SCB_TAG field is now re-used by the sequencer,
so it no longer makes sense to reference this
field in the kernel driver.

aic79xx.h:
Re-arrange fields in the hardware SCB from largest
size type to smallest. This makes it easier to
move fields without changing field alignment.

The hardware scb tag field is now down near the
"spare" portion of the SCB to facilitate reuse
by the sequencer.

aic79xx.reg:
Remove LONGJMP_ADDR.

Rearrange SCB fields to match aic79xx.h.
Add SCB_FIFO_USE_COUNT as the first byte
of the SCB_TAG field.

aic79xx.seq:
Add a per-SCB "Fifos in use count" field and use
it to determine when it is safe (all data posted)
to deliver status back to the host. The old method
involved polling one or both FIFOs to verify that
the current task did not have pending data. This
makes running down the GSFIFO very cheap, so we
will empty the GSFIFO in one idle loop pass in
all cases.

Use this simplification of the completion process
to prune down the data FIFO teardown sequencer for
packetized transfers. Much more code is now shared
between the data residual and transfer complete cases.

Correct some issues in the packetized status handler.
It used to be possible to CLRCHN our FIFO before status
had fully transferred to the host. We also failed to
handle NONPACKREQ phases that could occur should a CRC
error occur during transmission of the status data packet.

Correct a few big endian issues:

aic79xx.c:
aic79xx_inline.h:
aic79xx_pci.c:
aic79xx_osm.c:
o Always get the SCB's tag via the SCB_GET_TAG acccessor
o Add missing use of byte swapping macros when touching
hscb fields.
o Don't double swap SEEPROM data when it is printed.
Correct a big-endian bug. We cannot assign a
o When assigning a 32bit LE variable to a 64bit LE
variable, we must be explict about how the words
of the 64bit LE variable are initialized. Cast to
(uint32_t*) to do this.

aic79xx.c:
In ahd_clear_critical_section(), hit CRLSCSIINT
after restoring the interrupt masks to avoid what
appears to be a glitch on SCSIINT. Any real SCSIINT
status will be persistent and will immidiately
reset SCSIINT. This clear should only get rid of
spurious SCSIINTs.

This glitch was the cause of the "Unexpected PKT busfree"
status that occurred under high queue full loads

Call ahd_fini_scbdata() after shutdown so that
any ahd_chip_init() routine that might access
SCB data will not access free'd memory.

Reset the bus on an IOERR since the chip doesn't
seem to reset to the new voltage level without
this.
Change offset calculation for scatter gather maps
so that the calculation is correct if an integral
multiple of sg lists does not fit in the allocation
size.

Adjust bus dma tag for data buffers based on 39BIT
addressing flag in our softc.

Use the QFREEZE count to simplify ahd_pause_and_flushworkd().
We can thus rely on the sequencer eventually clearing ENSELO.

In ahd_abort_scbs(), fix a bug that could potentially
corrupt sequencer state. The saved SCB was being
restored in the SCSI mode instead of the saved mode.
It turns out that the SCB did not need to be saved at all
as the scbptr is already restored by all subroutines
called during this function that modify that register.

aic79xx.c:
aic79xx.h:
aic79xx_pci.c:
Add support for parsing the seeprom vital product
data. The VPD data are currently unused.

aic79xx.h:
aic79xx.seq:
aic79xx_pci.c:
Add a firmware workaround to make the LED blink
brighter during packetized operations on the H2A.

aic79xx_inline.h:
The host does not use timer interrupts, so don't
gate our decision on whether or not to unpause
the sequencer on whether or not a timer interrupt
is pending.
 1.4  14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.3  21-Apr-2003  fvdl branches: 1.3.2;
Reset bus in attach, not at first access.
 1.2  21-Apr-2003  fvdl Set/report DT a bit more correctly.
 1.1  21-Apr-2003  fvdl ahd, driver for Adaptec 790x U320 controllers. Originally by Justin Gibbs
for FreeBSD, ported to NetBSD by Pascal Renauld, Network Storage Solutions,
Inc, plus a bunch of changes by me.

This driver is as yet untested in this final form, it will be added
to config files when it has been tested.
 1.3.2.6  11-Dec-2005  christos Sync with head.
 1.3.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.2.4  19-Oct-2004  skrll Sync with HEAD
 1.3.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1  03-Aug-2004  skrll Sync with HEAD
 1.7.6.1  16-Dec-2005  jmc Pullup rev 1.13-1.14 (requested by bouyer in ticket #10177)

Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback. Fixes a panic in uvm.
 1.7.4.1  16-Dec-2005  jmc Pullup rev 1.13-1.14 (requested by bouyer in ticket #10177)

Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback. Fixes a panic in uvm.
 1.7.2.1  16-Dec-2005  jmc Pullup rev 1.13-1.14 (requested by bouyer in ticket #10177)

Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback. Fixes a panic in uvm.
 1.10.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.4.1  29-Apr-2005  kent sync with -current
 1.12.10.1  29-Nov-2005  yamt sync with head.
 1.12.4.2  03-Sep-2007  yamt sync with head.
 1.12.4.1  21-Jun-2006  yamt sync with head.
 1.12.2.2  07-Dec-2005  tron Pull up following revision(s) (requested by bouyer in ticket #1033):
sys/dev/ic/aic7xxx_osm.c: revision 1.20
sys/dev/ic/aic79xx_osm.c: revision 1.14
Wrap debug printf in AHC_DEBUG. Pointed out by Izumi Tsutsui.
 1.12.2.1  29-Nov-2005  tron Pull up following revision(s) (requested by bouyer in ticket #1014):
sys/dev/ic/aic7xxx.c: revision 1.117
sys/dev/ic/aic79xxvar.h: revision 1.20
sys/dev/ic/aic79xx_osm.c: revision 1.13
sys/dev/ic/aic7xxx_inline.h: revision 1.7
sys/dev/ic/aic79xx.c: revision 1.32
sys/dev/ic/aic7xxx_osm.c: revision 1.19
sys/dev/ic/aic7xxxvar.h: revision 1.50
Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback.
Fix a panic in uvm reported by John R. Shannon on port-xen; patch tested on
ahc by me and on ahd by John.
 1.14.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.14.10.1  19-Apr-2006  elad sync with head.
 1.14.8.1  11-Apr-2006  yamt sync with head
 1.14.6.1  22-Apr-2006  simonb Sync with head.
 1.14.4.1  09-Sep-2006  rpaulo sync with head
 1.15.10.2  10-Dec-2006  yamt sync with head.
 1.15.10.1  22-Oct-2006  yamt sync with head
 1.15.8.1  18-Nov-2006  ad Sync with head.
 1.17.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.18.36.2  29-Jun-2008  mjf Sync with HEAD.
 1.18.36.1  02-Jun-2008  mjf Sync with HEAD.
 1.19.8.1  27-Jun-2008  simonb Sync with head.
 1.19.6.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.4.4  11-Mar-2010  yamt sync with head
 1.19.4.3  16-Sep-2009  yamt sync with head
 1.19.4.2  16-May-2009  yamt sync with head
 1.19.4.1  04-May-2009  yamt sync with head.
 1.20.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.31.24.1  18-May-2014  rmind sync with head
 1.31.20.2  03-Dec-2017  jdolecek update from HEAD
 1.31.20.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.10.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.6.1  05-Oct-2016  skrll Sync with HEAD
 1.33.18.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.34.10.1  21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.35.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed