Home | History | Annotate | Download | only in sbus
History log of /src/sys/dev/sbus/isp_sbus.c
RevisionDateAuthorComments
 1.81  07-Sep-2012  macallan set isp_xffree, like the PCI frontend does
now this works again
 1.80  26-Mar-2010  mjacob branches: 1.80.8; 1.80.14; 1.80.16;
Synchronize with other platforms:

Strongly architect handles so we can more easily detect bogus
handles. This switches us to a full 32 bits for all handles.

Handle the case of FC disks disappearing and then reappearing-
at least at the FC transport level.

Some better and finer control of debug and non-debug printouts.
 1.79  17-Sep-2009  tsutsui branches: 1.79.2; 1.79.4;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.78  07-Sep-2009  tsutsui Split device_t/softc.
Tested QLogic 1020 Fast Wide SCSI HBA at PCI.
Sbus attachment is untested, but not so much quirks in it.
 1.77  25-Jun-2009  mjacob Update ISP driver to latest and greatest. Includes support for the 8Gb part.
 1.76  17-May-2009  tsutsui Use device_private() to get struct sbus_softc from device_t parent.

XXX: sbus_softc has been split from device_t on sparc, but not on sparc64!?
 1.75  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.74  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.73  07-Apr-2008  cegger branches: 1.73.4; 1.73.18;
use device_xname() and get rid of isp_name
 1.72  05-Apr-2008  cegger use aprint_*_dev and device_xname
 1.71  11-Mar-2008  mjacob Checkpoint of some fairly major isp(4) rototilling.

Reintroduce more of a 'channel' concept in preparation for NP-IV support.
This gets rid of the chanA/chanB concept as the 2400 can have up to 128
virtual channels. Actually, with MID firmware you can also have the 2200
and 2300 support 'channels, but they do it with an FL-Port topology.
Because FC cards can now have 'channels', just about every support
function for fibre channel had to be redone to have a channel index
as well. Rototill isp_ioctl.h for channel stuff as well.

Pick up a lot of work about fabric management (hopefully better) and keep
work in place that will allow for dynamic attachment/detachment of devices
(if I can figure out how to make the midlayer support it).

Merge the target code with external trees. Eventually it might even
be sorted out on NetBSD.

Update some firmware stuff.
 1.70  19-Oct-2007  ad branches: 1.70.12; 1.70.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.69  07-Jul-2007  mjacob branches: 1.69.6; 1.69.8; 1.69.12;
Remove some #if'd out dead code.
Put in the boundary limit for SBus/ISP dma engines (16MiB).
 1.68  24-May-2007  mjacob Major update to isp(4) driver to bring it in line with external sources.

The major changes are:

+ 4Gb (24XX) card support
+ Rewritten fabric and loop evaluation code
+ New f/w sets

The 4Gb changes required major rototilling, which caused a rewrite of
fabric and loop eval code. The latter can now be set up to tune for
dynamic device arrival/departure if the framework is set up for it,
or to be firm about waiting for devices.

Testing has been principally on amd64, i386 and sparc64 and seems to
not have broken things for me.
 1.67  04-Mar-2007  christos branches: 1.67.2; 1.67.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.66  15-Oct-2006  martin branches: 1.66.4;
Missing initializers
 1.65  29-Mar-2006  thorpej branches: 1.65.8; 1.65.10;
Use device_cfdata().
 1.64  11-Dec-2005  christos branches: 1.64.4; 1.64.6; 1.64.8; 1.64.10; 1.64.12;
merge ktrace-lwp.
 1.63  27-Feb-2005  perry branches: 1.63.4;
nuke trailing whitespace
 1.62  17-Mar-2004  pk branches: 1.62.8; 1.62.10;
Rename PROM_getprop*() => prom_getprop*().
 1.61  04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.60  03-May-2003  wiz branches: 1.60.2;
DMA, not dma nor Dma.
 1.59  10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.58  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.57  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.56  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.55  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.54  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.53  18-May-2002  mjacob Pointy hat to me on the last delta.
 1.52  17-May-2002  mjacob Replicate change that Matt Thomas made in isp_pci- if we get ENOMEM/EAGAIN
in bus_dmamap_load, return CMD_EAGAIN rather than just make the command dead.
 1.51  21-Mar-2002  eeh branches: 1.51.4;
Fixup attachment code to use sbus_promaddr_to_handle() and not specify
BUS_SPACE_MAP_LINEAR.
 1.50  11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.49  21-Feb-2002  mjacob Implement F/W crashdumps for 2200 && 2300 cards (kernel compile option).

Distinguish between 2312 and 2300 cards (they *are* different). Enable
RIO (Reduced Interrupt Operation) for the LVD cards (hey- I've seen
batched completions of the 30 commands at a time with this,....)...

If we get a Port Logout on local loop topologies, we have to force the
f/w to log back in. The easiest way (for us) to do this is to force
a LIP. This also will wake up the disk that probably just had a f/w crash.

Implement mailbox 'continuations'- this allows interrupts to re-drive
a mailbox command if it's one that just essentially repeats the previous
mailbox command (e.g., f/w download). This saves a boatload of sleep/wakeup
twitches.

If we're not a 2300 and we're about to return with a 'bogus interrupt'- check
the semaphore register to be non-zero at all and outgoing mailbox 0- this
seems to be where some of the lost ISP1080 commands came from.
 1.48  14-Dec-2001  mjacob Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.

The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).

One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.

Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.

For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.

Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).

Additional changes:

Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.

Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).

Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.

Nuke some additional __P macros.
 1.47  13-Nov-2001  lukem add RCSIDs
 1.46  26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.45  01-Sep-2001  mjacob branches: 1.45.2;
Add support for 2 Gigabit cards (2300/2312). This necessitated a change
in how interrupts are down- the 23XX has not only a different place to check
for an interrupt, but unlike all other QLogic cards, you have to read the
status as a 32 bit word- not 16 bit words. Rather than have device specific
functions as called from the core module (in isp_intr), it makes more sense
to have the platform/bus modules do the gruntwork of splitting out the
isr, semaphore register and the first outgoing mailbox register (if needed)
*prior* to calling isp_intr (if calling isp_intr is necessary at all).
 1.44  06-Jul-2001  mjacob branches: 1.44.2;
twiddle isp_xflist calculation to match more closes isp_pci.c
 1.43  12-Apr-2001  mjacob Clean up bus dma code for request/response queues.
 1.42  14-Mar-2001  mjacob ansify code
 1.41  08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw(), and add
BUS_DMA_STREAMING to data transfer map loads.
 1.40  28-Feb-2001  mjacob branches: 1.40.2;
Oh, god, make the pain stop. "Fix" this one more time- but for the next
to last time.

It turns out that in fact, sparc64 was *not* working. There is a discussion
within the tech-kern@netbsd.org mail list as of just prior to this date
that contains the details.

Suffice to say that for sparc64 we have to add back in the usage
of BUS_DMA_COHERENT again to the call to bus_dmamap_load_raw. PK
added the usage of bus_dmamap_load_raw- which agrees with the
man page description of it- but now does not match what the
original BusDma author seems to think it's supposed to do.

While we're at it, do a specific set of steps for setting up and,
if necessary, tearing down, mailbox dma mappings.
 1.39  25-Feb-2001  mjacob this was *still* wrong
 1.38  25-Feb-2001  mjacob More Kudos to Izumi: fix another argument to bus_dmamap_sync
 1.37  24-Feb-2001  mjacob Now that the underlying code for bus_dmamap_sync appears to do the
right thing, don't use the illegal and "just worked by chance" addition
of BUS_DMA_COHERENT to bus_dmamap_load_raw. There still is a necessity
to add to the architecture to allow one to hint that this should be
a cache coherent mapping.

Fix offset argument to be zero for flushing data tranfers. Kudos to Izumi
for spotting this.
 1.36  23-Feb-2001  mjacob Add missing BUS_DMA_COHERENT to bus_dmamap_load_raw calls for request
and response queues- this makes this work on UltraSparc now.
 1.35  23-Feb-2001  mjacob Implement bootverbose recognition. Move interrupt registry up a bit so we can
use interrupting mailbox commands for isp_init. Set default HBA role.
Rename request/response dma maps to be more consistent with PCI version.
Enable bus_dmamap_sync on request queue- we already do this for response
queue- better do it for the request queue as well.

Checked to be working against a Sparc10.
 1.34  23-Dec-2000  wiz Fix pathnames in comment.
 1.33  22-Oct-2000  mjacob fix SBus bursting *correctly* this time
 1.32  17-Oct-2000  mjacob quiet chatty boot messages
 1.31  16-Oct-2000  mjacob Turn on 32 byte bursting for ISP
 1.30  14-Aug-2000  mjacob Add a maintenance note. Add a bus specific isp_sbus_intr function- this is
so we, ahem, note we're on an interrupt stack so we don't try and sleep
on any mailbox commands we might want to run.
 1.29  01-Aug-2000  mjacob Core version 2.0 (platform version 1.0) rewrite of ISP driver. Some
interace cleanups, some new common functions. The major impact that
will be noticeable right away is that if you boot with not Fibre connected
to the FC cards, you no longer hang indefinitely.
 1.28  09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.27  05-Jul-2000  mjacob Use new isp_handle_index inline function. Change order in whch
some things are done. Remember to enable interrupts after calling
isp_reset but before isp_attach.
 1.26  10-May-2000  pk branches: 1.26.4;
No need to specify page alignment; this is automatic.
 1.25  10-May-2000  pk Fix bogus `boundary' argument in bus_dmamap_create().
 1.24  09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.23  19-Feb-2000  mjacob correct oops on last checkin
 1.22  19-Feb-2000  mjacob Handle > 12 byte CDBs.
 1.21  14-Jan-2000  mjacob There is no readily available tool to set NVRAM on isp's on sparc,
so ignore it.
 1.20  09-Jan-2000  mjacob The trigger for not downloading f/w is now a
NULL f/w pointer, not a nonzero f/w length.
 1.19  09-Jan-2000  mjacob The sense of being able to sleep for DMA resources was reversed. Oops.
 1.18  20-Dec-1999  mjacob get back to looking at config flags
 1.17  04-Dec-1999  mjacob Add back in inclusion of microcode and rationalize it. request/response
queue indices need to be u_int16_t wide.
 1.16  21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.15  28-Oct-1999  mjacob Remove reference to loadable f/w.
 1.14  14-Oct-1999  mjacob branches: 1.14.2; 1.14.4;
We alloc xflist and dma maps in mailbox setup. We swizzle endian stuff
at the end of dma setup.
 1.13  30-Sep-1999  thorpej branches: 1.13.2;
Update for SCSPI changes.
 1.12  27-May-1999  pk Fix bus_size_t/size_t/int confusion.
 1.11  25-Apr-1999  pk It is no longer necessary to protect bus_dma_[un]load() at splbio, since
sparc bus_dma*() functions now protect their own internals..
 1.10  26-Mar-1999  mjacob branches: 1.10.2;
roll internal release tag
 1.9  23-Mar-1999  pk Call bus_dma_[un]load() at splbio.
 1.8  17-Mar-1999  mjacob prototype 1080/1240 support caused register offset rewhack
 1.7  09-Feb-1999  mjacob roll internal release level
 1.6  30-Jan-1999  mjacob roll internal release tag and finally use bus_space I/O
 1.5  10-Jan-1999  mjacob turn on SBUS bursts
 1.4  28-Dec-1998  mjacob clean up headers
 1.3  18-Sep-1998  mjacob Make changes as required for new return values from dma setup routine
for isp. Unable to test in running kernel because they're not buildable today,
but should be okay.
 1.2  08-Sep-1998  mjacob add bustype tag to softc
 1.1  27-Aug-1998  mrg move isp_sbus attachment into /sys/dev/sbus.
 1.10.2.3  15-Jan-2000  he Pull up revisions 1.19-1.20 (via patch, requested by mjacob):
Fix a bug where the sense of when to sleep waiting for DMA
resources was reversed. Fix internal functionality where it's
now a firmware pointer being NULL instead of firmware length
being zero that disables f/w loading.
 1.10.2.2  08-Jan-2000  he Pull up revisions 1.12,1.14-1.18 (via patch, requested by mjacob):
Untangle Qlogic firmware copyright problems and update firmware.
Untangle some MD support issues for said firmware. Add 1280 (Dual
LVD), 1240 (Dual Ultra), 2200 (2nd Generation Qlogic FC chipset).
Fix some synchronous negotiation problems for parallel SCSI.
Firm up some Fabric Support issues.
 1.10.2.1  26-Apr-1999  perry branches: 1.10.2.1.2;
pullup 1.10->1.11 (pk)
 1.10.2.1.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.4.1  15-Nov-1999  fvdl Sync with -current
 1.14.2.6  21-Apr-2001  bouyer Sync with HEAD
 1.14.2.5  27-Mar-2001  bouyer Sync with HEAD.
 1.14.2.4  12-Mar-2001  bouyer Sync with HEAD.
 1.14.2.3  05-Jan-2001  bouyer Sync with HEAD
 1.14.2.2  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.14.2.1  20-Oct-1999  thorpej Eliminate sleeping from adapter routines.
 1.26.4.5  20-Mar-2001  he Pull up revision 1.42 (requested by mjacob):
ANSIfication and conversion of handles to 16 bits.
 1.26.4.4  16-Mar-2001  he Pull up revision 1.35 (via patch) and 1.36-1.40 (requested by mjacob):
Set default HBA role (to ISP_ROLE_INITIATOR).
 1.26.4.3  25-Jan-2001  jhawk Pull up revisions 1.31-1.34 (requested by mjacob):
Add in correct SBus bursting; upgrade to 2.01.26 firmware; pull to latest
initiator mode level; make changes to WWN default handling; quiet
chatty boot messages; fix endian code so MacPPC works; fix bug in
lock recursion counter; fix bug which excluded all but NL-ports from
being logged into on a fabric.
 1.26.4.2  28-Aug-2000  mjacob Complete rewrite of internals for isp core version 2.0.
Pullup to netbsd-1-5 approved by thorpej@netbsd.org.
 1.26.4.1  19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.40.2.12  11-Dec-2002  thorpej Sync with HEAD.
 1.40.2.11  18-Oct-2002  nathanw Catch up to -current.
 1.40.2.10  20-Jun-2002  nathanw Catch up to -current.
 1.40.2.9  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.40.2.8  28-Feb-2002  nathanw Catch up to -current.
 1.40.2.7  08-Jan-2002  nathanw Catch up to -current.
 1.40.2.6  14-Nov-2001  nathanw Catch up to -current.
 1.40.2.5  08-Oct-2001  nathanw Catch up to -current.
 1.40.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.40.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.40.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.40.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.44.2.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.44.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.44.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.45.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.51.4.1  30-May-2002  gehenna Catch up with -current.
 1.60.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.60.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1  03-Aug-2004  skrll Sync with HEAD
 1.62.10.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.62.8.1  29-Apr-2005  kent sync with -current
 1.63.4.5  17-Mar-2008  yamt sync with head.
 1.63.4.4  27-Oct-2007  yamt sync with head.
 1.63.4.3  03-Sep-2007  yamt sync with head.
 1.63.4.2  30-Dec-2006  yamt sync with head.
 1.63.4.1  21-Jun-2006  yamt sync with head.
 1.64.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.64.10.1  19-Apr-2006  elad sync with head.
 1.64.8.1  01-Apr-2006  yamt sync with head.
 1.64.6.1  22-Apr-2006  simonb Sync with head.
 1.64.4.1  09-Sep-2006  rpaulo sync with head
 1.65.10.1  22-Oct-2006  yamt sync with head
 1.65.8.1  18-Nov-2006  ad Sync with head.
 1.66.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.67.4.1  11-Jul-2007  mjf Sync with head.
 1.67.2.3  23-Oct-2007  ad Sync with head.
 1.67.2.2  15-Jul-2007  ad Sync with head.
 1.67.2.1  27-May-2007  ad Sync with head.
 1.69.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.69.8.2  23-Mar-2008  matt sync with HEAD
 1.69.8.1  06-Nov-2007  matt sync with HEAD
 1.69.6.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.70.16.2  02-Jun-2008  mjf Sync with HEAD.
 1.70.16.1  03-Apr-2008  mjf Sync with HEAD.
 1.70.12.1  24-Mar-2008  keiichi sync with head.
 1.73.18.2  23-Jul-2009  jym Sync with HEAD.
 1.73.18.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.73.4.6  11-Aug-2010  yamt sync with head.
 1.73.4.5  11-Mar-2010  yamt sync with head
 1.73.4.4  16-Sep-2009  yamt sync with head
 1.73.4.3  18-Jul-2009  yamt sync with head.
 1.73.4.2  20-Jun-2009  yamt sync with head
 1.73.4.1  16-May-2009  yamt sync with head
 1.79.4.1  30-May-2010  rmind sync with head
 1.79.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.80.16.1  01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.80.14.1  13-Sep-2012  riz Pull up following revision(s) (requested by macallan in ticket #550):
sys/dev/sbus/isp_sbus.c: revision 1.81
set isp_xffree, like the PCI frontend does
now this works again
 1.80.8.1  30-Oct-2012  yamt sync with head

RSS XML Feed