Commit Graph

58 Commits

Author SHA1 Message Date
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
Matt Jacob
4fd13c1ba2 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). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.

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.

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

MFC after:	2 weeks
2001-12-11 00:18:45 +00:00
Matt Jacob
71793c0dc4 Some patches from Doug for ia64 support- the principle one being the
appropriate cache flush that provides MEMORY_BARRIER in between handoffs
between host && RISC processor for the shared memory request/response
queues.

Submitted by:	dfr@nlsystems.com
2001-10-07 18:18:50 +00:00
Matt Jacob
53036e9289 Begin to implement target mode that for Fibre Channel has a private
per-command component that we *don't* try and pass thru CAM. CAM just
is too risky and too much of a pain- structures get copied, but not
all info of interest can be considered safely transported thru all
consumers (including user space) from the incoming ATIO to the outgoing
CTIO- it's just much safer to have a buddy structure, identified by the
command's tag which *does* make it thru safely.

Pay attention to link speed and report 200MB/s xfer speed for a
23XX card in 2GPs mode.

MFC after:	1 week
2001-10-01 03:48:42 +00:00
Matt Jacob
f6a3bcf86c I don't know what I was thinking- if I have two separate busses on on
SIM (as is true for the 1280 and the 12160), then I have to have separate
flags && status for *both* busses. *Whap*.

Implement condition variables for coordination with some target mode
events. It's nice to use these and not panic in obscure little places
in the kernel like 'propagate_priority' just because we went to sleep
holding a mutex, or some other absurd thing.

MFC after:	4 weeks
2001-09-04 21:33:06 +00:00
Matt Jacob
126ec86486 Add 2 Gigabit Fibre Channel support (2300 && 2312 cards). This required
some reworking (and consequent cleanup) of the interrupt service code.

Also begin to start a cleanup of target mode support that will (eventually)
not require more inforamtion routed with the ATIO to come back with the
CTIO other than tag.

MFC after:	4 weeks
2001-08-31 21:39:04 +00:00
Matt Jacob
3910362ab8 Roll minor version. Remove ISP_SMPLOCK nonsense. We're using full locking,
and that's final.

MFC after:	1 week
2001-07-25 04:21:53 +00:00
Matt Jacob
6a23026c6e Fix botch for state levels. Role minor release. Start adding code for a
'force logout' path.

MFC after:	4 weeks
2001-06-05 17:11:06 +00:00
Matt Jacob
5d57194434 Spring MegaChange #1.
----

Make a device for each ISP- really usable only with devfs and add an ioctl
entry point (this can be used to (re)set debug levels, reset the HBA,
rescan the fabric, issue lips, etc).

----

Add in a kernel thread for Fibre Channel cards. The purpose of this
thread is to be woken up to clean up after Fibre Channel events
block things.  Basically, any FC event that casts doubt on the
location or identify of FC devices blocks the queues. When, and
if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED
async event, we activate the kthread which will then, in full thread
context, re-evaluate the local loop and/or the fabric. When it's
satisfied that things are stable, it can then release the blocked
queues and let commands flow again.

The prior mechanism was a lazy evaluation. That is, the next command
to come down the pipe after change events would pay the full price
for re-evaluation. And if this was done off of a softcall, it really
could hang up the system.

These changes brings the FreeBSD port more in line with the Solaris,
Linux and NetBSD ports. It also, more importantly, gets us being
more proactive about topology changes which could then be reflected
upwards to CAM so that the periph driver can be informed sooner
rather than later when things arrive or depart.

---

Add in the (correct) usage of locking macros- we now have lock transition
macros which allow us to transition from holding the CAM lock (Giant)
and grabbing the softc lock and vice versa. Switch over to having this
HBA do real locking. Some folks claim this won't be a win. They're right.
But you have to start somewhere, and this will begin to teach us how
to DTRT for HBAs, etc.

--

Start putting in prototype 2300 support.  Add back in LIP
and Loop Reset as async events that each platform will handle.
Add in another int_bogus instrumentation point.

Do some more substantial target mode cleanups.

MFC after:	8 weeks
2001-05-28 21:20:43 +00:00
Matt Jacob
1209134a70 Roll platform minor.
Change target mode state definitions to be aware of 'channel' (for the
dualbus 1280/12160 cards).
2001-04-04 21:56:15 +00:00
John Baldwin
f34fa851e0 Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
2001-03-28 09:17:56 +00:00
Matt Jacob
c9a6d60b09 Go to a default port and default node wwn model. Eliminate isp_name
and isp_unit and just store the device_t, fer gosh sakes.... Include
sys/bus.h for use by isp_pci.c.
2001-03-01 02:15:58 +00:00
Matt Jacob
250bc0aa8b Roll minor version. Remove ISP2100_FABRIC define (unneeded now).
Comment out usage of ISP_SMPLOCK- I have my doubts that this works sanely
as yet because CAM itself still needs Giant. I *was* dropping my lock
and grabbing Giant when doing the upcall for completion, but this is all
seems ridiculous until CAM is fixed.
2001-02-11 03:48:54 +00:00
Bosko Milekic
9ed346bab0 Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
Matt Jacob
fe4a3254ce Use the isp_lastmbxcmd tag to report timed out mailbox commands.
Arrrggghhhh! Very likely fix 22650 by remembering to, ahem, set
CAM_AUTOSNS_VALID when one has sense data.
2001-01-15 18:36:09 +00:00
Matt Jacob
27d1caa3cd Up tsleep && poll time for mailbox commands from 2 to 10 seconds. Print
out the mailbox command opcode if the command times out.
2001-01-09 02:47:56 +00:00
Matt Jacob
4081cc88c9 Only call ISP_UNLOCK/ISP_LOCK if isp->isp_osinfo.intsok in USEC_SLEEP.
Add a test against isp->isp_osinfo.islocked prior to trying to see
whether --isp->isp_osinfo.islocked is zero to cause us to unlock
(non-SMPLOCK case).
2000-12-05 07:41:53 +00:00
Matt Jacob
e5f2f488c5 Add USEC_SLEEP macro support. Change the location at which we define
ISP_LOCK/ISP_UNLOCK macros.
2000-12-02 18:33:29 +00:00
Matt Jacob
650789cb1b Get rid of ridiculous ISP_PVS macro. Instead, just set an
ISP_SMPLOCK define based on the previous 5.4 major/minor release
define of PVS- because this allows us to turn it off easier.
2000-10-25 04:42:46 +00:00
John Baldwin
35e0e5b311 Catch up to moving headers:
- machine/ipl.h -> sys/ipl.h
- machine/mutex.h -> sys/mutex.h
2000-10-20 07:58:15 +00:00
Matt Jacob
e92fbe47e2 Roll minor revision- for once we'll use this because.... if revision >= 5.4,
compile time will build in mutex locks, otherwise the old locking (splcam/splx
with a recursion counter) will be compiled in.

We still depend on config_intr_hook to tell us when it's okay to call
msleep instead of polling. It'd be real nice if we could do this early
enough to not hang up a machine struggling with a bad Fibre Channel loop,
but that's still to come.
2000-10-17 18:18:14 +00:00
Matt Jacob
e5d4e19714 Make changes required by change in how default and usable node and port
WWNS are made and used.
2000-10-12 23:59:40 +00:00
Matt Jacob
aa57fd6fa5 some copyright cleanups 2000-09-21 20:16:04 +00:00
Matt Jacob
b6b6ad2f23 various fixes 2000-08-27 23:38:44 +00:00
Matt Jacob
18ccaecd45 Core version 2.0 cleanup/rewrite. Things get rearranged and changed
quite a bit so that all of the ports have a similar set of required
macros/definitions (and in similar places in the isp_<platform>.h
file).

Some new macros/functions added- Mailbox Acquire/Relase macros,
NANOTIME macros, SNPRINTf and STRNCAT. MemoryBarrier beomes
MEMORYBARRIER with much stronger types.
2000-08-01 06:29:55 +00:00
Matt Jacob
910fb4f6ee The SERVICING_INTERRUPT isn't quite safe yet. 2000-07-18 07:04:07 +00:00
Matt Jacob
df9d46b6d9 Add in isp_lock/isp_unlock inlines. Add in an islocked/intsok flag
to isp_osinfo substructure (all in prep for SMP). Define MBOX_WAIT_COMPLETE
and MBOX_NOTIFY_COMPLETE macros so that we can now (temp) use tsleep
to wait for mailbox completion. Requires us to guess whether we're
servicing an interrupt or not- will use intr_nesting_level.

Add local strncat function.
2000-07-04 01:04:35 +00:00
Matt Jacob
cc28790740 Clean up private storage so that we can use the spriv_field0 to
store a bitmask of whether we've set a value into ccb->ccb_h.status,
whether we're in the watchdog routine for this command now, whether
we've set a grace period for this command and whether this command is
actually done.

See comments of rev 1.45 of isp.c for more complete information.
2000-06-27 19:22:13 +00:00
Matt Jacob
be44b164d0 Roll platform minor number. Force definition of SCSI_ISP_FABRIC
(we always support fabric now). Remove SCCLUN definition (we always
support SCCLUN now, if we load the f/w). Add typedef definition of an
external firmware fetch function.
2000-06-18 04:47:12 +00:00
Matt Jacob
a200278c54 roll platform minor 2000-05-09 01:09:46 +00:00
Matt Jacob
05914a3f9d Add in the now required malloc.h include. I guess somebody
was busy hackin' w/o checking kernel compiles.
2000-04-21 02:05:13 +00:00
Matt Jacob
0b69cead4d roll platform versions to 5.0 2000-03-15 18:49:44 +00:00
Matt Jacob
66dcc0e99f Turn back on fast posting- the code that turns it off (for 1020/1040) is
now in isp.c

Approved: jkh@freebsd.org
2000-02-11 19:37:56 +00:00
Matt Jacob
997f6ab3d7 There seems to be some problems, particularly on alpha, with
FAST POSTING enabled for parallel SCSI. Be sure about things
and disable it for now.
2000-01-21 20:54:22 +00:00
Matt Jacob
40b27503d8 Role platform minor revision. Add in some target mode only
private structure definitions.
2000-01-03 22:15:16 +00:00
Matt Jacob
22e1dc858b Add Dual LVD bus (1280) support 1999-12-16 05:42:02 +00:00
Matt Jacob
7e35bc405b roll platform minor 1999-12-03 06:56:43 +00:00
Matt Jacob
6db20c3127 Add storage/access for a default WWN. A miscellaneous tweak or two. 1999-11-21 03:15:11 +00:00
Matt Jacob
67b6f02b5e Roll platform major && minor (major now tracks FreeBSD major release).
Add in null SWIZZLE definitions. Add in CFGPRINTF define. Change default
debug level to refer to an external isp_debug variable. Remove inline
functions as they're now in isp_inline.h and include that file.
1999-10-17 18:48:16 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Matt Jacob
1a43c1fc14 add in SIMQFRZ_TIMED && CMD_RQLATER defines 1999-08-16 20:04:06 +00:00
Matt Jacob
3692397b0d add 2200 f/w; fix botched define 1999-07-05 20:42:08 +00:00
Matt Jacob
b460c5c9a9 Merge defunct isp_freebsd_cam.h into this file. Do some appropriate
changes like rolling minor revision levels and defines where we now
do default WWN seeding in the platform files.
1999-07-02 23:10:34 +00:00
Matt Jacob
bb430bf78d Clean up some sprintfs. Add in a SCSI_QFULL an XS_CHANNEL definition
for 2.X versions. Disable fast posting for FC.
1999-05-11 05:03:33 +00:00
Matt Jacob
bc3dacd6c7 Fix for pre-CAM kernels (again). Turn back on fast posting. 1999-04-04 01:34:06 +00:00
Matt Jacob
4394c92f52 Add in 1080 LVD support and some basis also for the 1240. The port database
printout is now enabled.
1999-03-25 22:52:45 +00:00
Matt Jacob
57c801f5cf A wad of changes- prepping for 1080/1240 support (which caused a massive
thwank in register layout goop). A different mboxcmd approach. Some PDB change
infrastructure. Some better management of loopdown/loopup events (keep them
distinct from resource starvation for simq freeze/unfreeze actions).
1999-03-17 05:04:39 +00:00
Matt Jacob
289b93c044 roll internal release tag 1999-02-09 01:05:42 +00:00
Matt Jacob
cbf57b472d Implement and use Fast Posting for both parallel && fibre. Redo a bit of
the startup code. Implement a call to outer framework function so that
asynchronous events can be handled (e.g., speed negotiation, target mode).

Roll internal release tags.
1999-01-30 07:29:00 +00:00
Matt Jacob
bff85e290f Suggested by bde@freebsd.org- memcpy not necessarily good to use. D'oh- not in
the BSD DKI. Stop being lazy and finish the defines so MEMCPY becomes bzero
for FreeBSD.
1999-01-10 11:15:23 +00:00