Commit Graph

125 Commits

Author SHA1 Message Date
Matt Jacob
f7c631bcf0 Push things closer to path failover by implementing loop down and
gone device timers and zombie state entries. There are tunables
that can be used to select a number of parameters.

loop_down_limit - how long to wait for loop to come back up before
declaring
all devices dead (default 300 seconds)

gone_device_time- how long to wait for a device that has appeared
to leave the loop or fabric to reappear (default 30 seconds)

Internal tunables include (which should be externalized):

quick_boot_time- how long to wait when booting for loop to come up

change_is_bad- whether or not to accept devices with the same
WWNN/WWPN that reappear at a different PortID as being the 'same'
device.

Keen students of some of the subtle issues here will ask how
one can keep devices from being re-accepted at all (the answer
is to set a gone_device_time to zero- that effectively would
be the same thing).
2006-11-14 08:45:48 +00:00
Matt Jacob
10365e5a68 Add 4Gb (24XX) support and lay the foundation for a lot of new stuff. 2006-11-02 03:21:32 +00:00
Matt Jacob
198b33587b Restore multi-version cleanliness. 2006-09-03 01:26:55 +00:00
John-Mark Gurney
378f231e7d add a newbus method for obtaining the bus's bus_dma_tag_t... This is
required by arches like sparc64 (not yet implemented) and sun4v where there
are seperate IOMMU's for each PCI bus...  For all other arches, it will
end up returning NULL, which makes it a no-op...

Convert a few drivers (the ones we've been working w/ on sun4v) to the
new convection...  Eventually all drivers will need to replace the parent
tag of NULL, w/ bus_get_dma_tag(dev), though dev is usually different for
each driver, and will require hand inspection...

Reviewed by:	scottl (earlier version)
2006-09-03 00:27:42 +00:00
Matt Jacob
8070de6398 More ispfwfunc definitions funnies which break pre-7.0 builds. 2006-09-01 05:03:42 +00:00
Matt Jacob
2298c14c62 Fix RELENG_4 code version- isp_roles wasn't getting initialized so
it ended up defaulting to ISP_ROLE_NONE. My testing hadn't caught it
because I was deliberatly setting role via ioctl.

Thanks to user Toni for lending me an alpha to test this on.

MFC after:	0 days
2006-08-21 00:46:10 +00:00
Matt Jacob
4cc9e3e7cc The register offset is within 4K, not 256 bytes, for some QLogic cards. 2006-08-14 05:36:26 +00:00
Matt Jacob
799881e094 Some rearrangement of headers to minimize diffs with outside of
FreeBSD repository and to clean up the license header so as to
not pollute the license with file function.

Zero all mailbox structures prior to use (just in case). Change
the outgoing mailbox count for INIT_FIRMWARE to be correct.
2006-07-16 20:11:50 +00:00
Matt Jacob
a887f1a657 Don't attach 2422's yet. It just confuses everyone. 2006-07-14 05:16:00 +00:00
Matt Jacob
9a5af41076 Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.

Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.

However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.

For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.

This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.

We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).

Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after:	2 months
2006-07-09 17:50:20 +00:00
Matt Jacob
8a97c03a7a Do various fixes to support firmware loading for the 2322
(and by extension, the 2422).

One peculiar thing I've found with the 2322 is that if you
don't force it to do Hard LoopID acquisition, the firmware
crashes. This took a while to figure out.

While we're at it, fix various bugs having to do with NVRAM
reading and option setting with respect to pieces of NVRAM.
2006-07-03 08:24:09 +00:00
Matt Jacob
099348678f Remove bzero/bcopy vestiges
Be cognizant as to whether we're running 2KLogin f/w in target mode and
do the appropriate loopid load based upon that.

Do a first cut (seems to work, at least for amd64) at 64 bit target
mode for fibre channel cards. We could probably also do it for SPI
cards, but that's not supported right now.
2006-05-22 06:51:48 +00:00
Matt Jacob
9cd7268e5a Some more gratuitous format and name changes.
Pull in some target mode changes from a private branch.
Pull in some more RELENG_4 compilation changes.

A lot of lines changed, but not much content change yet.
2006-04-21 18:30:01 +00:00
Matt Jacob
1dae40eb49 a) clean up some declaration stuff (i.e., make more modern with respect
to getting rid u_int for uint and so on).

b) Turn back on 64 bit DAC support. Cheeze it a bit in that we have two
DMA callback functions- one when we have bus_addr_t > 4 bits in width and
the other which should be normal. Even Cheezier in that we turn off setting
up DMA maps to be BUS_SPACE_MAXADDR if we're in ISP_TARGET_MODE. More work
on this in a week or so.

c) Tested under amd64 and 1MB DFLTPHYS, sparc64, i386 (PAE, but insufficient
memory to really test > 4GB). LINT check under amd64.

MFC after:	1 month
2006-02-15 00:31:48 +00:00
Matt Jacob
51effc8cd5 Actually, no, I had it wrong in 1.109. The arguments to bus_dma_create_tag
are bus_addr_t, not bus_size_t.

In any case, turn off DAC support entirely until it is revamped to actually
work *correctly* for 64 bit platforms (not using a PAE definition and for
both initiator and target mode).
2006-02-04 08:39:02 +00:00
Scott Long
4b2dc3c447 i386/PAE defines bus_size_t to be 32-bits when it likely should be 64-bits.
Fixing it is left for another day, so just hack around it for now.
2006-02-04 03:41:48 +00:00
Matt Jacob
53af7d226e Remove use of inlines and use the functions as a library.
Larger code space, possibly performance hit, but more portable.
Certainly less questionable use of inlining.

Suggested by: des
2006-02-02 21:31:34 +00:00
Matt Jacob
6c4266852d oops 2006-01-26 06:15:58 +00:00
Matt Jacob
8872e3d7e5 Put in at least an attempt to ID the 2422 (4Gb part) 2006-01-26 05:04:35 +00:00
Matt Jacob
e526523707 First of several commits as this driver is dusted off and maybe brought
up to date.  Principle changes for this reelase is to support 2K Port Login
firmware. This allows us to support the 2322 (and 2422 4Gb) cards which only
come with the 2K Port Login firmware. The 2322 should now work- but we don't
have firmware sets for it in ispfw (as the change to load 2K Port Login f/w
hasn't been made- that f/w is so big it has to be loaded in more than one
chunk).

Other changes are the beginnings of cleaning up some long standing target
mode issues. The next changes here will incorporate a lot of bug fixes
from others.

Finally, some copyright cleanup and attempts to make the parts of the
driver that are FreeBSD specific start conforming more to FreeBSD style.

MFC after:	1 month
2006-01-23 06:23:37 +00:00
John Baldwin
74a96f4337 Use uintmax_t and %j to print bus dma segment members rather than casting
to long long and using %ll.
2005-12-15 22:12:27 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Matt Jacob
b49c46747a Fix some incorrectly swapped fields in an ICB.
Access a PCI register with correct width.

Obtained from:	Dmitry Valeryevich Trikoz
2005-05-11 03:00:50 +00:00
Warner Losh
b77e575e1d Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:17:35 +00:00
Matt Jacob
dd1419abe1 Support the DELL OEM 2312 cards (1077,6312).
Many thanks to Stormweb for making the h/w available for testing.

MFC after:	2 days
2005-01-23 06:23:55 +00:00
Matt Jacob
6976709916 PAE support changes that included at least some minimal actual testing
with a kernel that booted.
2004-09-23 05:25:22 +00:00
Matt Jacob
6de9bf776e Do the small amount of tweaking to support PAE for at least initiator mode.
I was unable to test this as the PAE kernel crashed with a "cannot copy
LDT" before coming up. When this gets a bit more testing, I'll fix the PAE
conf file to allow isp devices.

PR:		59728
2004-09-07 08:04:09 +00:00
Nate Lawson
51e2355882 Store the target handles in a separate list from normal commands. Add a
CTIO fast post routine to handle CTIO completions.

Submitted by:	mjacob
2004-05-24 07:02:25 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Matt Jacob
87ab7d39a4 If we're defined to have a default role for target mode, make it
just ISP_ROLE_TARGET- not both.

MFC after:	1 week
2004-02-07 03:39:42 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
77e6a3b2dd Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:00:27 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Matt Jacob
76514802bd Make compiles (LINT and/or ISP_TARGET_MODE options) happier by making sure
printf type format args and actual args match.

Reviewed by:	Sam Leffler <sam@errno.com>
2003-01-02 04:21:52 +00:00
Matt Jacob
f556e83b61 This should enable 10160 support. As best as I can tell, the same
f/w as 12160 is used, and otherwise, this is just a single channel
variant of the 10160.

MFC after:	0 days
2002-10-11 17:28:01 +00:00
Matt Jacob
435a93378f Re-specify the bus space creation such that if we have ISP_DAC_SUPPORTED
defined, we set the address space limitation to BUS_SPACE_UNRESTRICTED,
otherwise to BUS_SPACE_MAXADDR_32BIT.

If we have a 1240, ULTRA2 or better, or an FC card, the boundary limit
is BUS_SPACE_UNRESTRICTED and segment limit is BUS_SPACE_MAXADDR_32BIT.

The older 1020/1040 cards have boundary and segment limits of
BUS_SPACE_MAXADDR_24BIT.
2002-09-23 05:02:53 +00:00
Matt Jacob
fc3bbaaa8b Fix the incorrect parsing of the Risc2Host isr. For RIO_16,
fast posting command completion, and fast post CTIO completion,
the upper half of Risc2Host is a copy of mailbox #1- *not*
mailbox #0.

MFC after:	1 day
2002-08-17 17:21:54 +00:00
Matt Jacob
43722a425a Don't test against default_iid being zero as a test for whether we
set something- iid 0 is valid.
2002-07-25 20:47:40 +00:00
Matt Jacob
72429e49f5 Make sure that if are in fact using 'full SMP', make the interrupt
flags include INTR_MPSAFE. Put the flags in a common place so that
both isp_sbus && isp_pci DTRT.

In isp_mbxdma setup, drop any locks prior to calling things like
bus_dmatag_create. This gets rid of these obnoxious WITNESS messages
about 'sleeping with locks held' blah blah blah blah blah.
2002-07-25 16:02:09 +00:00
Matt Jacob
73030e03ce 'Support' for ISP SBus cards.
This code does not imply that SBus cards work yet. They hang for me.
But I can't netboot the latest snapshot on my ultra1e, and things
hang at bus_setup_intr time.

Since I'm offline for a while, I thought I'd toss this in in case somebody
else who has a bit better luck wants to fart around with it. Please try
and wait until I get back to check things in.
2002-07-11 03:25:04 +00:00
Matt Jacob
ed753e824b Add override so that we can force set our hard loopdid.
MFC after:	1 week
2002-07-08 17:34:32 +00:00
Matt Jacob
fc08717104 Set all 23XX cards as 'touched' (we have trouble, unpredictably, about
running ABOUT FIRMWARE with some that were started by BIOS downloads).

Redo CTIO2 dma mapping- use continuation segments instead of multiple
CTIO2s. Thanks to Veritas for sponsoring this work (in a different
context).

MFC after:	1 week
2002-06-16 04:58:00 +00:00
Matt Jacob
029f13c671 Fix bus dma segment count to be based off of MAXPHYS, not BUS_SPACE_MAXSIZE.
Grumble. I've seen better documented architectures out of Redmond.

Redo fabric evaluation to not use GET ALL NEXT (GA_NXT). Switches seem
to be trying to wriggle out of supporting this well. Instead, use
GID_FT to get a list of Port IDs and then use GPN_ID/GNN_ID to find the
port and node wwn. This should make working on fabrics a bit cleaner and
more stable.

This also caused some cleanup of SNS subcommand canonicalization so that
we can actually check for FS_ACC and FS_RJT, and if we get an FS_RJT,
print out the reason and explanation codes.

We'll keep the old GA_NXT method around if people want to uncomment a
controlling definition in ispvar.h.

This also had us clean up ISPASYNC_FABRICDEV to use a local lportdb argument
and to have the caller explicitly say that a device is at the end of the
fabric list.

MFC after:	1 week
2002-04-04 23:46:01 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Matt Jacob
1923f73990 Redo stuff for sparc64- primarily fix bus dma implementation. The endian
stuff was right, but the busdma stuff was massively not right.

Didn't really test on ia64 or i386- don't have the former h/w and my
FreeBSD-current disk is unwell right now. Hope that this is okay.

MFC after:	1 week
2002-04-02 23:36:14 +00:00
Matt Jacob
d134aa0b20 More for f/w crash dumps (bug fixing and adding ioctl entry points
and hints to enable for specific units)

MFC after:	1 week
2002-02-18 00:00:34 +00:00
Matt Jacob
3f02619fb8 Hints for WWN are now WWNN and/or WWPN.
MFC after:	1 week
2002-02-17 06:34:21 +00:00
Matt Jacob
75c1e828c0 + A variety of 23XX changes:
disable MWI on 2300

	based on function code, set an 'isp_port' for the 2312- it's a
	separate instance, but the NVRAM is shared, and the second port's
	NVRAM is at offset 256.

+ Enable RIO operation for LVD SCSI cards. This makes a *big* difference
as even under reasonable load we get batched completions of about 30
commands at a time on, say, an ISP1080.

+ Do 'continuation' mailbox commands- this allows us to specify a work
area within the softc and 'continue' repeated mailbox commands. This is
more or less on an ad hoc basis and is currently only used for firmware
loading (which f/w now loads substantially faster becuase the calling
thread is only woken when all the f/w words are loaded- not for each
one of the 40000 f/w words that gets loaded).

+ If we're about to return from isp_intr with a 'bogus interrupt' indication,
and we're not a 23XX card, check to see whether the semaphore register is
currently *2* (not *1* as it should be) and whether there's an async completion
sitting in outgoing mailbox0. This seems to capture cases of lost fast posting
and RIO interrupts that the 12160 && 1080 have been known to pump out under
extreme load (extreme, as in > 250 active commands).

+ FC_SCRATCH_ACQUIRE/FC_SCRATCH_RELEASE macros.

+ Endian correct swizzle/unswizzle of an ATIO2 that has a WWPN in it.

MFC after:	1 week
2002-02-04 21:04:25 +00:00