Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/aic6360.c
RevisionDateAuthorComments
 1.107  10-May-2023  riastradh aic(4): Use config_detach_children.
 1.106  05-Apr-2023  andvar s/esssentially/essentially/ in comment.
 1.105  01-Jan-2022  andvar fix typos in comments, mainly basicly -> basically.
 1.104  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.103  24-Apr-2021  thorpej branches: 1.103.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.102  03-Sep-2018  riastradh branches: 1.102.14;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.101  28-Oct-2017  riastradh branches: 1.101.2; 1.101.4;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.100  11-Jan-2017  skrll adatper -> adapter
 1.99  23-Nov-2009  rmind branches: 1.99.22; 1.99.40; 1.99.44;
Remove some unecessary includes sys/user.h header.
 1.98  12-Nov-2009  dyoung Remove superfluous activation hook.
 1.97  22-Sep-2009  tsutsui Split device_t/softc. Tested on AHA-1520B at ISA and ISAPnP.

XXX: ISA attachment shouldn't match cards in ISAPnP mode.
 1.96  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.95  11-Jun-2008  drochner branches: 1.95.10;
don't use cfdriver_t->cd_devs directly
 1.94  08-Apr-2008  cegger branches: 1.94.2; 1.94.4; 1.94.6; 1.94.8;
use aprint_*_dev and device_xname
 1.93  19-Oct-2007  ad branches: 1.93.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.92  16-Nov-2006  christos branches: 1.92.8; 1.92.22; 1.92.24; 1.92.28;
__unused removal on arguments; approved by core.
 1.91  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.90  28-Aug-2006  xtraeme branches: 1.90.2; 1.90.4;
Remove unused variable 'periph' to make this build.
 1.89  27-Aug-2006  christos typo
 1.88  27-Aug-2006  christos ifdef out unreachable code.
 1.87  20-Feb-2006  thorpej branches: 1.87.2;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
 1.86  24-Dec-2005  perry branches: 1.86.2; 1.86.4; 1.86.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.85  11-Dec-2005  christos merge ktrace-lwp.
 1.84  27-Feb-2005  perry branches: 1.84.4;
nuke trailing whitespace
 1.83  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.82  24-Aug-2004  thorpej branches: 1.82.4; 1.82.6;
Use ANSI function decls and more use of static.
 1.81  07-Aug-2004  mycroft Copy a bug fix from spc. If the target transferred too much, we would return
a bogus residual count.
 1.80  02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.79  21-Feb-2003  tsutsui branches: 1.79.2;
hz -> Hz
 1.78  05-Apr-2002  bouyer Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.
 1.77  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.76  13-Nov-2001  lukem add/cleanup RCSID
 1.75  04-Nov-2001  tsutsui Use common macro to check message length.
 1.74  07-Jul-2001  thorpej branches: 1.74.2; 1.74.6;
bzero -> memset
 1.73  07-Jul-2001  thorpej bcopy -> memcpy
 1.72  30-Apr-2001  lukem delint
 1.71  25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.70  05-May-2000  matt branches: 1.70.6;
LP64 printf fix. (I wish size_t was unsigned long on all platforms).
 1.69  30-Mar-2000  augustss Remove register declarations.
 1.68  30-Mar-2000  simonb Delete redundant decl of aicattach(), it's in aic6360var.h.
 1.67  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.66  20-Mar-2000  enami - Test the generic device active flag instead of home grown one.
- Test also it in wdcintr.
 1.65  30-Oct-1999  enami Add and delete a reference to an adapter at aicattach(), to make sure
that the adapter is disabled even if it wasn't enabled/disabled during
configuring its children. This fixes the bug that if an aic pcmcia card
is inserted in a slot during boot, further attaching of any card on the
slot fails once the card is removed.
 1.64  20-Oct-1999  enami Cancel active transfers on aic/wdc detach.
Also makes LS-120 drive works for me again.
 1.63  30-Sep-1999  thorpej branches: 1.63.2; 1.63.4; 1.63.6;
Update for SCSPI changes.
 1.62  26-Sep-1999  enami Allow to detach aic, but turned off by default. The patchable variable
aic_dodetach controlls this.
 1.61  05-Dec-1998  mjacob Update HBAs to incorporate the new max_lun property.
 1.60  19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.59  10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.58  04-Jul-1998  jonathan defopt DDB.
 1.57  23-May-1998  matt Changes so that these compile on NetBSD/alpha as well as NetBSD/i386.
 1.56  13-Jan-1998  enami Don't include <machine/pio.h> and <dev/isa/isavar.h>. Instead,
include <machine/bus.h> directly.
 1.55  12-Jan-1998  thorpej Adjust for config changes.
 1.54  06-Oct-1997  christos branches: 1.54.2;
From Enami Tsugutomo: Busify and split the aic6360 driver.
 1.53  27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.52  10-Dec-1996  thorpej branches: 1.52.8; 1.52.10;
Fill in sc_link.max_target
 1.51  13-Oct-1996  christos backout kprintf changes
 1.50  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.49  28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.48  27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.47  18-Jun-1996  mycroft Remove some unneeded FIFO flushes and reorder some register changes per the
6360 manual. Turn off synchronous negotiation.
 1.46  12-May-1996  mycroft Use intr.h.
 1.45  29-Apr-1996  christos - prototype fixes
 1.44  11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.43  03-Apr-1996  mycroft Minor optimization, and do a CLRCH after (re)selection just to be safe.
 1.42  03-Apr-1996  mycroft * Change message priorities so that ABORT comes after IDENTIFY.
* Add an ACB_RESET flag, so that a BUS DEVICE RESET can be queued within the
driver.
* If ACB_ABORT or ACB_RESET is set during reselection, schedule a message and
assert ATN.
* Optimize aic_datain_pio(), aic_dataout_pio() and aicintr() somewhat.
* Schedule a timeout only when we select the target, so that commands can't
time out prematurely.
 1.41  01-Apr-1996  mycroft Several things:
1) If we get an unexpected disconnect, issue a REQUEST SENSE, as recommended
by the SCSI-2 spec. If the target created a contingent allegiance condition,
this will clear it. Also, if it happened while sending a SDTR or WDTR message,
disable negotiation for that target.
2) Since some lame devices still don't deal correctly, make sure we deassert
ATN if our last message out is interrupted. If we get a MESSAGE PARITY ERROR,
we'll reassert ATN anyway. This should ensure that we never have to send a
MESSAGE NO OPERATION.
3) Set AIC_ABORTING only when actually sending a BUS DEVICE RESET or ABORT,
so we get better error detection.
4) Other internal reorganization of no consequence.
 1.40  30-Mar-1996  mycroft Use `{in.out}b(iobase + ...' rather than including the base address in
the register definitions.
 1.39  17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.38  24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.37  30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.36  03-Oct-1995  mycroft branches: 1.36.2;
Modularize the CCB/MSCP/ACB/ECB handling a little. No functional changes.
 1.35  26-Sep-1995  thorpej Don't declare Debugger(). It's handled in <sys/systm.h>
 1.34  14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.33  12-Aug-1995  mycroft minphys() functions really should return void.
 1.32  24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.31  17-Apr-1995  cgd clean up several ISA device interfaces: autoconfiguration, header
inclusion, and interrupt configuration. more work still needs to be done,
but it's getting better...
 1.30  02-Feb-1995  mycroft Comment a potential bit of lossage.
 1.29  01-Feb-1995  mycroft Various:
* Make synchronous negotiation work.
* Use the bitbucket when the target requests too much data.
* Loop in aicintr() until we get to a state where we have to wait.
 1.28  01-Feb-1995  mycroft Correct some more of the synchronous stuff, and omit it completely if
AIC_USE_SYNCHRONOUS is 0.
 1.27  01-Feb-1995  mycroft Various:
* Always enable disconnection.
* Add some more per-controller variables: initiator ID, clock frequency,
min and max sync period.
* Correct sync period calculations.
* Remove sc_progress.
* Move most of the reselection handling into a separate function.
* Remove some outdated comments.
* Remove message bytes from FIFO even when dropping them on the floor.
* Some cosmetic cleanup.
 1.26  13-Jan-1995  mycroft Simplify some sanity checks.
 1.25  07-Jan-1995  mycroft Don't print line numbers in most of the diagnostics.
 1.24  07-Jan-1995  mycroft Cosmetic changes, to look more like the new esp.c will.
 1.23  03-Jan-1995  mycroft Add interrupt sharing types.
 1.22  31-Dec-1994  mycroft Fix non-serious typo.
 1.21  28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.20  30-Nov-1994  mycroft Don't stall the queue on CHECK SENSE if we get a reselect while selecting.
 1.19  29-Nov-1994  mycroft Fix a null pointer reference.
 1.18  29-Nov-1994  mycroft Add an assertion mechanism to check for more abnormal conditions.
 1.17  29-Nov-1994  mycroft For consistency...
 1.16  29-Nov-1994  mycroft Handle BUS FREE phase a little differently, to get better error detection. Other
cleanup.
 1.15  29-Nov-1994  mycroft Disable debugging breakpoints by default.
 1.14  29-Nov-1994  mycroft * Redo most of the message and phase state machines. Multiple pending
message outs should now work correctly (including retransmissions).
Multiple messages ins should be more efficient. Missing REQ after
reselection phase should now (correctly) cause a wait with ENREQINIT
set.

* Abstract out the reselection out sequence, and use it directly to
get sense info. (This is somewhat faster than the generic done/sched
sequence.)

* If there are no ACBs available, wait interruptibly for one.

* Leave the interrupt registers alone during message in/out; just
watch for phase change. Don't (incorrectly) reenable interrupts
during data in/out; defer that to aicintr().

* Handle command pointer per SCSI 2 spec.

* Other minor coding improvements.
 1.13  18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.12  04-Nov-1994  mycroft No longer needs icu.h.
 1.11  04-Nov-1994  mycroft Change all of the uses of IRQ{0-15} and bit masks to use plain numbers
rather than bit shifting.
 1.10  03-Nov-1994  mycroft Update to match autoconfig code.
 1.9  27-Oct-1994  cgd new RCS ID format.
 1.8  17-Oct-1994  cgd change, requested by Jarle Greipsland
 1.7  08-Aug-1994  mycroft Minor update.
 1.6  07-Aug-1994  mycroft Avoid using DFIFOHF, which doesn't exist on 6260 chips. Turn off
AIC_USE_DWORDS by default.
 1.5  05-May-1994  cgd branches: 1.5.2;
lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.4  03-May-1994  mycroft Fix argument to aic_sched_msgout() is several places, and condense some code.
 1.3  29-Apr-1994  cgd change timeout/untimeout/wakeup/sleep/tsleep args to void *
 1.2  26-Apr-1994  mycroft Style nits.
 1.1  26-Apr-1994  mycroft Add Adaptec 6360 driver from Jarle Greipsland, with some changes by me.
 1.5.2.3  17-Oct-1994  cgd from trunk
 1.5.2.2  08-Aug-1994  mycroft update from trunk
 1.5.2.1  07-Aug-1994  mycroft update from trunk
 1.36.2.1  18-Oct-1995  pk Add missing parentheses (from Jarle Greipsland; PR#1603).
 1.52.10.1  27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.8.1  01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.54.2.2  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.54.2.1  06-Oct-1997  thorpej file aic6360.c was added on branch marc-pcmcia on 1997-10-14 10:22:17 +0000
 1.63.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.63.4.1  15-Nov-1999  fvdl Sync with -current
 1.63.2.5  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.63.2.4  26-Oct-1999  thorpej Update for:

Deal a little more gracefully with the fact that xfer mode parameters
are for the I_T Nexus, and make all xfer mode updates `async events'.
 1.63.2.3  20-Oct-1999  thorpej Sync w/ trunk.
 1.63.2.2  19-Oct-1999  thorpej Don't sleep waiting for a CCB; if we get to the CCB allocation phase, we're
guaranteed to have one.
 1.63.2.1  19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.70.6.5  17-Apr-2002  nathanw Catch up to -current.
 1.70.6.4  08-Jan-2002  nathanw Catch up to -current.
 1.70.6.3  14-Nov-2001  nathanw Catch up to -current.
 1.70.6.2  24-Aug-2001  nathanw Catch up with -current.
 1.70.6.1  21-Jun-2001  nathanw Catch up to -current.
 1.74.6.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.74.2.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.74.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.79.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.79.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.79.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.79.2.3  25-Aug-2004  skrll Sync with HEAD.
 1.79.2.2  12-Aug-2004  skrll Sync with HEAD.
 1.79.2.1  03-Aug-2004  skrll Sync with HEAD
 1.82.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.82.4.1  29-Apr-2005  kent sync with -current
 1.84.4.3  27-Oct-2007  yamt sync with head.
 1.84.4.2  30-Dec-2006  yamt sync with head.
 1.84.4.1  21-Jun-2006  yamt sync with head.
 1.86.6.1  22-Apr-2006  simonb Sync with head.
 1.86.4.1  09-Sep-2006  rpaulo sync with head
 1.86.2.1  01-Mar-2006  yamt sync with head.
 1.87.2.1  03-Sep-2006  yamt sync with head.
 1.90.4.2  10-Dec-2006  yamt sync with head.
 1.90.4.1  22-Oct-2006  yamt sync with head
 1.90.2.1  18-Nov-2006  ad Sync with head.
 1.92.28.1  25-Oct-2007  bouyer Sync with HEAD.
 1.92.24.1  06-Nov-2007  matt sync with HEAD
 1.92.22.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.92.8.1  23-Oct-2007  ad Sync with head.
 1.93.16.2  29-Jun-2008  mjf Sync with HEAD.
 1.93.16.1  02-Jun-2008  mjf Sync with HEAD.
 1.94.8.1  18-Jun-2008  simonb Sync with head.
 1.94.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.94.4.3  11-Mar-2010  yamt sync with head
 1.94.4.2  16-May-2009  yamt sync with head
 1.94.4.1  04-May-2009  yamt sync with head.
 1.94.2.1  17-Jun-2008  yamt sync with head.
 1.95.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.99.44.1  20-Mar-2017  pgoyette Sync with HEAD
 1.99.40.1  05-Feb-2017  skrll Sync with HEAD
 1.99.22.1  03-Dec-2017  jdolecek update from HEAD
 1.101.4.1  10-Jun-2019  christos Sync with HEAD
 1.101.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.102.14.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.103.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed