Commit Graph

469 Commits

Author SHA1 Message Date
Matt Jacob
75f7d77928 Mote that how the pad bytes can be divided in half and used by either
the target mode code or outer layers.

Increase cd_tagval to be 32 bits since it will have to now carry 16
bits of parallel SCSI ATIO handle as well as a normal tag (if any).
2001-03-14 04:13:30 +00:00
Matt Jacob
e2ec5cf0f9 In order to save ourselves grief with the SUNPRO compiler under
Solaris (which, for reasons unknown to me, chokes on u_int16_t
as a typedef of unsigned short if used in a transitional (mixed K&R
and ANSI) way), we'll go the extra mile and fully ANSIfy things.
2001-03-14 04:11:56 +00:00
Matt Jacob
d8d5f2adc5 more 32 to 16 bit handle conversions 2001-03-04 18:42:51 +00:00
Matt Jacob
24d52eb7b5 More 32 to 16 bit handle stuff. Roll core minor version. 2001-03-04 18:42:23 +00:00
Matt Jacob
3bfa867765 Remove a superfluous newline in a string (isp_prt adds this).
Fix a missed conversion of 32 to 16 bit handles.
2001-03-04 18:41:23 +00:00
Matt Jacob
5f5aafe1fc Switch to using 16 bit handles instead of 32 bit handles.
This is a pretty invasive change, but there are three good
reasons to do this:

1. We'll never have > 16 bits of handle.
2. We can (eventually) enable the RIO (Reduced Interrupt Operation)
bits which return multiple completing 16 bit handles in mailbox
registers.
3. The !)$*)$*~)@$*~)$* Qlogic target mode for parallel SCSI spec
changed such that at_reserved (which was 32 bits) was split into
two pieces- and one of which was a 16 bit handle id that functions
like the at_rxid for Fibre Channel (a tag for the f/w to correlate
CTIOs with a particular command). Since we had to muck with that
and this changed the whole handler architecture, we might as well...

Propagate new at_handle on through int ct_fwhandle. Follow
implications of changing to 16 bit handles.

These above changes at least get Qlogic 1040 cards working in target
mode again. 1080/12160 cards don't work yet.

In isp.c:
Prepare for doing all loop management in outer layers.
2001-03-02 06:28:55 +00:00
Matt Jacob
715ec7e9a7 Fix isp_print_qentry to print all four lines- it's been broken for months. 2001-03-02 04:48:41 +00:00
Mark Murray
ed34d0ade2 Turn on interrupt-entropy harvesting for all/any mass storage devices
I could find. I have no doubt missed a couple.

Interrupt entropy harvesting is still conditional on the
kern.random.sys.harvest_interrupt sysctl.
2001-03-01 17:09:09 +00:00
Matt Jacob
6e5c5328c4 Eliminate the use of the getenv_int stuff we'd been using (with a bitmap
for selecting unit). Instead, use the resource hints mechanism.

One unfortunate situation here is that there is no resource_quad_value
function- which is what I needed for WWN boot time replacement. Worse-
you can't store the hint as just plain

hint.isp.0.nodewwn="0x50000000aaaa0001"

because this gets interpreted as an int- incorrectly because it can't
be converted to an int. I can't even get this as a string. To work
around this particular case for nodewwn && portwwn setting, this
rather grotesque form will be used:

hint.isp.0.nodewwn="w50000000aaaa0001"
hint.isp.0.portwwn="w50000000aaaa0002"

At the same time, if we have no hinted WWN, set the default WWN (which, btw,
gets overridden if the card has valid NVRAM, which is usual) to
0x400000007F000009ull (which translates to NAA == IPv4, 127.0.0.9).

Eliminate more printf's and replace them either with device_printf or
isp_prt calls.
2001-03-01 02:21:36 +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
3c75bb14be Finally eliminate as many of the printf calls as possible (still leaving
ones where we have a CAM path) and replacing them with calls to isp_prt.,

Eliminate isp_unit references- we no longer have an isp_unit- we now
have an isp_dev that device_get_unit can work with.
2001-03-01 02:14:54 +00:00
Matt Jacob
b0a3ba7e28 Fix at2_entry_t to reflect what the firmware actually writes (instead
of just deriving from SCSI at_entry_t). In this case, there is no
'suggested sense' for FC cards.
2001-02-27 00:14:39 +00:00
Matt Jacob
4102f2f6ef Fix a longstanding bug- we had the sense of what bit 14
for the ICB firmware options meant- *I* had taken it to
mean that if you set it, Node Name would be ignored and
derived from Port Name. Actually, it meant the opposite.
As a consequence- change ICBOPT_USE_PORTNAME to the
define ICBOPT_BOTH_WWNS- makes more sense.

Fix wrong input bitmap for MBOX_DUMP_RAM command. Call
ISP_DUMPREGS if we get a f/w crash. Add ISPCTL_RUN_MBOXCMD
control command (so outer layers can run a mailbox command
directly) and add a ISPASYNC_UNHANDLED_RESPONSE hook so
outer layers can understand response queue entries we
might not know about.
2001-02-23 05:35:50 +00:00
Matt Jacob
410b556714 Eliminate ISP2100_FABRIC- we always allow for fabric now. Add an
isp_iid_set/isp_iid for fibre channel- this is because we now
fake a port database entry for ourselves. Add the additional loop
states between LOOP_PDB_RCVD and LOOP_READY.

Change and comment on a wad of Fibre Channel isp_control functions.
Change and comment on some of the ISPASYNC Fibre Channel events.
2001-02-11 03:56:48 +00:00
Matt Jacob
b21d3f4ef8 Add structure defining FC-AL position maps. The only tool that I know of
that really uses this is luxadm(8) under Solaris.
2001-02-11 03:53:58 +00:00
Matt Jacob
b9b599fe4c Shuffle around how we do isp_disable management- make sure we return 0 so
the unit number doesn't get reused.

Make sure that if we've compiled for ISP_TARGET_MODE we set the
default role to be ISP_ROLE_INITIATOR|ISP_ROLE_TARGET.

Do some misc other cleanups.
2001-02-11 03:53:23 +00:00
Matt Jacob
6b528b1a1e Add isp_fc_runstate function- this function's purpose is to, in stages,
and depending on role, make sure link is up, scan the fabric (if we're
connected to a fabric), scan the local loop (if appropriate), merge
the results into the local port database then, check once again
to make sure we have f/w at FW_READY state and the the loopstate
is LOOP_READY.
2001-02-11 03:52:04 +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
Matt Jacob
d6e5500f27 Do some cleanup based upon adapter role- mainly not enabling interrupts
if we're ISP_ROLE_NONE. Change ISPASYNC_LOGGED_INOUT to ISPASYNC_PROMENADE.
Make sure we note if something is a fabric device.

Target mode:
Finally fix (to a first approximation) SCSI Target Mode again- we needed
to correctly check against CAM_TARGET_WILDCARD and CAM_LUN_WILDCARD
so that targbh won't confuse us. Comment out the drainqueue stuff for
now. Use isp_fc_runstate instead if isp_control/ISPCTL_FCLINK_TEST.
2001-02-11 03:47:39 +00:00
Matt Jacob
b2b4adaa33 Minor stuff:
Remove ISP2100_FABRIC defines- we always handle fabric now. Insert
isp_getmap helper function (for getting Loop Position map). Make
sure we (for our own benefit) mark req_state_flags with RQSF_GOT_SENSE
for Fibre Channel if we got sense data- the !*$)!*$)~*$)*$ Qlogic
f/w doesn't do so. Add ISPCTL_SCAN_FABRIC, ISPCTL_SCAN_LOOP, ISPCTL_SEND_LIP,
and ISPCTL_GET_POSMAP isp_control functions. Correctly send async notifications
upstream for changes in the name server, changes in the port database, and
f/w crashes. Correctly set topology when we get a ASYNC_PTPMODE event.

Major stuff:
Quite massively redo how we handle Loop events- we've now added several
intermediate states between LOOP_PDB_RCVD and LOOP_READY. This allows us
a lot finer control about how we scan fabric, whether we go further
than scanning fabric, how we look at the local loop, and whether we
merge entries at the level or not. This is the next to last step for
moving managing loop state out of the core module entirely (whereupon
loop && fabric events will simply freeze the command queue and a thread
will run to figure out what's changed and *it* will re-enable the queu).
This fine amount of control also gets us closer to having an external
policy engine decide which fabric devices we really want to log into.
2001-02-11 03:44:43 +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
Jeroen Ruigrok van der Werven
f09deb6962 Fix typo: wierd -> weird.
There is no such thing as wierd in the english language.
2001-02-06 09:25:10 +00:00
Matt Jacob
d69a5f7d9c Guard against overflow of the calculated timeout value. 2001-01-16 07:15:36 +00:00
Matt Jacob
7afb656f3f Add was_fabric_dev/fabric_dev tags to our local FC database structure
(so we can see rapidly whether something was a fabric device but is
now gone).

Add a tag which says what role this adapter should take. It can take
on the value of None, Target, Initiator or Both. None is useful for
warm failover purposes. Remove the ISP_CFG_NOINIT silliness since
a role of "None" does this.

Add a isp_lastmbxcmd tag to store the opcode for the last mailbox
command used.
2001-01-15 18:40:37 +00:00
Matt Jacob
144ff11903 Put in offset definitions for FPM and FBM registers, plus just enough
bits defined so we can reset them.
2001-01-15 18:37:14 +00:00
Matt Jacob
df1590c05d Set default adapter role. 2001-01-15 18:36:39 +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
70d2cccebd Do more cleanup of the usage of 0..125 for F-port topologies. 2001-01-15 18:34:49 +00:00
Matt Jacob
6677e7f89e When resetting the Qlogic 2X00 units, reset the FPM (Fibre Protocol
Module) and FBM (Fibre Buffer Modules). Also remember to clear the
semaphore registers. Tell the RISC processor to not halt on FPM
parity errors.

Throw out the ISP_CFG_NOINIT silliness and instead go to the use of
adapter 'roles' to see whether one completes initialization or not
(mostly for Fibre Channel). The ultimate intent, btw, of all of this
is to have a warm standby adapter for failover reasons.  Because
we do roles now, setting of Target Capable Class 3 service parameters
in the ICB for the 2x00 cards reflects from role. Also, in isp_start,
if we're not supporting an initiator role, we bounce outgoing commands
with a Selection Timeout error. Also clean out the TOGGLE_TMODE
goop for FC- there is no toggling of target mode like there is
for parallel SCSI cards.

Do more cleanup with respect to using target ids 0..125 in F-port
topologies. Also keep track of things which *were* fabric devices
so that when you rescan the fabric you can notify the outer layers
when fabric devices go away.

Only force a LOGOUT for fabric devices if they're still logged in
(i.e., you cat their Port Database entry. Clean up the Get All Next
scanning.

Finally, use a new tag in the softc to store the opcode for the
last mailbox command used so we can report which opcode timed
out.
2001-01-15 18:33:08 +00:00
Matt Jacob
3fc3cadde6 ISPASYNC_PDB_CHANGED -> ISPASYNC_LOGGED_INOUT. 2001-01-09 02:49:02 +00:00
Matt Jacob
0ecded8a13 Add some SNS "Register FC4 type" subcommand defines. Add some defines
that are pertinetnt for state flags on Qlogic 2X00 status completion
entries.
2001-01-09 02:48:44 +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
4b9d588e2c Follow the ISPASYNC_PDB_CHANGED -> ISPASYNC_LOGGED_INOUT change. Also,
ISPASYNC_NOTIFY_CHANGE now is for both local loop && fabric changes.
2001-01-09 02:47:15 +00:00
Matt Jacob
0433833d0d Add a isp_register_fc4_type function so that we work with McData switches
that require us to register our FC4 types of interest. Allow ourselves, in
F-port topologies, to start logging in fabric devices in the target 0..125
range. Change ISPASYNC_PDB_CHANGED (misnamed) to ISPASYNC_LOGGED_INOUT.
Fix (*SMACK*) again some default WWN stuff. This is *really* hard to get
right across all the range of platforms.
2001-01-09 02:46:23 +00:00
Matt Jacob
3486bfe084 add missing length argument 2001-01-09 02:12:42 +00:00
Matt Jacob
91f1caa2d8 Fix problems with incomplete conversions from printf to isp_prt. 2000-12-31 20:50:56 +00:00
Matt Jacob
56c6d0d775 Change the modification of what could be a const string. Apparently the
construct:

	char *foo;
	...
	foo = "XXX";
	...
	foo[1] = 'Y';

is wrong. IT blew up on NetBSD-sparc64 because that platform write-protects
constant strings.
2000-12-30 20:09:26 +00:00
Matt Jacob
e9423e211e Add in Bill Sommerfeld's -Wformat stuff. Add a ISP_CFG_NOINIT option
to keep from completing initialization when isp_init is called.
2000-12-29 19:17:18 +00:00
Matt Jacob
8ead30564e Add in Bill Sommerfelds -Wformat changes. Set up default node && port
WWNs correctly (Again!) - this time for the case that we're not going
to fully init the adapter if isp_init is called (with ISP_CFG_NOINIT
set in options). The pupose for this is to bring the adapter up to
almost ready to go, get info out of NVRAM, but to not start it up- leaving
it until later to actually start things up if wanted (and possibly with
different roles selected).
2000-12-29 19:12:44 +00:00
Matt Jacob
f09b192280 Set up to do a local interrupt fielding before calling common code-
allows us to grab lock as we should.
2000-12-29 19:10:16 +00:00
Matt Jacob
c40e096ed6 Make sure we do locking if we call isp_intr.
Make sure we enter Giant for now if we call into cam for completion.
2000-12-29 19:06:32 +00:00
Matt Jacob
7325560821 add a couple off offset defines for ATIO2s 2000-12-28 23:27:54 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +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
bfbab17021 Replace some more printfs with isp_prt's. Use isp_prt/ISP_LOGDEBUG0
for rate setting/getting printouts.
2000-12-05 07:39:54 +00:00
Matt Jacob
f7dddf8a54 Remove more printfs and use either isp_prt or device_printf. Remember
to set ISP_LOGINFO if bootverbose is set.
2000-12-05 07:38:41 +00:00
David Malone
ea8b5a9ae9 More M_ZERO patches.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	mjacob
2000-12-03 20:46:54 +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
81babfd043 Make the Not RESPONSE in RESPONSE QUEUE message have a bit more info
(specifically, how many entries we've looked at so far). Maintain
interrupt instrumentation. Use USEC_SLEEP instead of USEC_DELAY in
a number of places (this allows us to drop locks and sleep instead
of spin). Track changes to configuration options for topology preference.
Fix botched order of printout for Channel, Target, Lun.
2000-12-02 18:08:35 +00:00
Matt Jacob
67afe757a2 Add interrupt instrumentation. Change ISP_CFG_NPORT config option to
a set of options that allows specific loop, loop-only, nport, nport-only
topology settings. Define a required macro for all platforms (USEC_SLEEP).
2000-12-02 18:06:03 +00:00
Matt Jacob
aa0898c0e0 I'm dropping the MAINTAINER request and see what happens. If it becomes
too hard for me to keep in sync with other platforms, FreeBSD will go
it's own way.
2000-10-31 05:55:54 +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
Matt Jacob
3395b0568a Whoops! Forgot to commit this when I committed the other (turnin on locks)
change. Sorry about that.
2000-10-25 04:40:49 +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
39f3fc6f69 remove "SERVICING_INTERRUPT" nonsense 2000-10-17 18:15:30 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +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
c914d4237d Redo how default Node and Port WWNs are determined (again!). This is so
we don't stomp on the differences between ports for a Qlogic 2202.
2000-10-12 23:49:09 +00:00
Matt Jacob
9cf43b9716 Change some default macro usages/definitions/requirements. 2000-10-12 23:47:03 +00:00
Matt Jacob
aa57fd6fa5 some copyright cleanups 2000-09-21 20:16:04 +00:00
Matt Jacob
c0cfc79790 Inintialize the queue index stuff from what the f/w sends back- just
in case it's insane enough to not do what you tell it to.

Print out (LOGINFO level) initiator ID.
2000-09-21 17:06:45 +00:00
Matt Jacob
e11a1ee870 Per msmith's request, don't attach to Qlogic 12160 id'd cards that have
a certain SubVendorID.
2000-09-07 20:27:40 +00:00
Doug Rabson
21c3015a24 * Completely rewrite the alpha busspace to hide the implementation from
the drivers.
* Remove legacy inx/outx support from chipset and replace with macros
  which call busspace.
* Rework pci config accesses to route through the pcib device instead of
  calling a MD function directly.

With these changes it is possible to cleanly support machines which have
more than one independantly numbered PCI busses. As a bonus, the new
busspace implementation should be measurably faster than the old one.
2000-08-28 21:48:13 +00:00
Matt Jacob
84267b9edd remove clause 3 licence 2000-08-27 23:39:23 +00:00
Matt Jacob
b6b6ad2f23 various fixes 2000-08-27 23:38:44 +00:00
Matt Jacob
3ea883b46d Add a comment as to where stdarg.h applies. 2000-08-03 03:05:50 +00:00
John Baldwin
7d615c1d8b Use <machine/stdarg.h> instead of <stdarg.h> so that this will compile.
While I'm at it, move the #include line up to the top of the file.
2000-08-03 02:47:06 +00:00
Matt Jacob
c7d5594134 Add in macros && masks so that mailbox command errors can be
selectively printed/supressed in isp_mboxcmd.
2000-08-01 06:55:08 +00:00
Matt Jacob
d0d5832ac7 Major whacking for core version 2.0. A major motivator for 2.0 and these
changes is that there's now a Solaris port of this driver, so some things
in the core version had to change (not much, but some).

In order, from the top.....:

A lot of error strings are gathered in one place at the head of the file.
This caused me to rewrite them to look consistent (with respect to
things like 'Port 0x%' and 'Target %d' and 'Loop ID 0x%x'.

The major mailbox function, isp_mboxcmd, now takes a third argument,
which is a mask that selectively says whether mailbox command failures
will be logged. This will substantially reduce a lot of spurious noise
from the driver.

At the first run through isp_reset we used to try and get the current
running firmware's revision by issuing a mailbox command. This would
invariably fail on alpha's with anything but a Qlogic 1040 since SRM
doesn't *start* the f/w on these cards. Instead, we now see whether we're
sitting ROM state before trying to get a running BIOS loaded f/w version.

All CFGPRINTF/PRINTF/IDPRINTF macros have been replaced with calls to
isp_prt. There are seperate print levels that can be independently
set (see ispvar.h), which include debugging, etc.

All SYS_DELAY macros are now USEC_DELAY macros. RQUEST_QUEUE_LEN and
RESULT_QUEUE_LEN now take ispsoftc as a parameter- the Fibre Channel
cards and the Ultra2/Ultra3 cards can have 16 bit request queue entry
indices, so we can make a 1024 entry index for them instead of the
256 entries we've had until now.

A major change it to fix isp_fclink_test to actually only wait the
delay of time specified in the microsecond argument being passed.
The problem has always been that a call to isp_mboxcmd to get he
current firmware state takes an unknown (sometimes long) amount of
time- this is if the firmware is busy doing PLOGIs while we ask
it what's up. So, up until now, the usdelay argument has been
a joke. The net effect has been that if you boot without being plugged
into a good loop or into a switch, you hang. Massively annonying, and
hard to fix because the actual time delta was impossible to know
from just guessing. Now, using the new GET_NANOTIME macros, a precise
and measured amount of USEC_DELAY calls are done so that only the
specified usecdelay is allowed to pass. This means that if the initial
startup of the firmware if followed by a call from isp_freebsd.c:isp_attach
to isp_control(isp, ISP_FCLINK_TEST, &tdelay) where tdelay is 2 * 1000000,
no more than two seconds will actually elapse before we leave concluding
that the cable is unhooked. Jeez. About time....

Change the ispscsicmd entry point to isp_start, and the XS_CMD_DONE
macro to a call to the platform supplied isp_done (sane naming).

Limit our size of request queue completions we'll look at at interrupt
time. Since we've increased the size of the Request Queue (and the
size of the Response Queue proportionally), let's not create an
interrupt stack overflow by having to keep a max completion list
(forw links are not an option because this is common code with
some platforms that don't have link space in their XS_T structures).
A limit of 32 is not unreasonable- I doubt there'd be even this many
request queue completions at a time- remember, most boards now use
fast posting for normal command completion instead of filling out
response queue entries.

In the isp_mboxcmd cleanup, also create an array of command
names so that "ABOUT FIRMWARE" can be printed instead of "CMD #8".

Remove the isp_lostcmd function- it's been deprecated for a while.
Remove isp_dumpregs- the ISP_DUMPREGS goes to the specific bus
register dump fucntion.

Various other cleanups.
2000-08-01 06:51:05 +00:00
Matt Jacob
b09b009594 Core version 2.0 rewrite. In this file we replace isp_tdebug with
isp_prt calls. We now use an argument to the  ISPCTL_FCLINK_TEST
call. We change all IDPRINTF macros to isp_prt calls. We add
the isp_prt function here.
2000-08-01 06:31: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
16dd34376c Remove isp_prtstst (now in case statement in isp.c). Remove
isp2100_fw_statename as an INLINE (now a function in isp.c). Remove
isp2100_pdb_statename (unused). Redo all ISP_SCSI_XFER_T as XS_T types.
Change all RQUEST_QUEUE_LEN/RESULT_QUEUE_LEN macros to take a parameter.
Add isp_print_bytes function.
2000-08-01 06:26:04 +00:00
Matt Jacob
10549c059a Remove isp_tdebug. Change all PRINTF macros to the now common
isp_prt logging function.
2000-08-01 06:24:01 +00:00
Matt Jacob
69fbe07a2e Fix typo. Remove isp_tdebug (we'll use ISP_LOGTDEBUG2 in isp->isp_dblev
as a selector now). Change DFLT_CMD_CNT to a fixed amount for now.
2000-08-01 06:23:24 +00:00
Matt Jacob
a6db0ba6d3 Add in lengths of SBus or PCI registers. 2000-08-01 06:21:21 +00:00
Matt Jacob
53cff3bb65 Rewrite for version 2.0. Some structural changes, but also
a substantial amount of commenting about what each platform
specific definitions are supposed to be.
2000-08-01 06:10:21 +00:00
Matt Jacob
d02373f1a0 Part of major rewrite for core version 2.0- clarification of
mdvec structure, removal of printf/CFGPRINTF in place of isp_prt
calls. Parameterization of RQUEST_QUEUE_LEN/RESULT_QUEUE_LEN.
2000-08-01 05:16:49 +00:00
Matt Jacob
482cf5c2e7 Add in some new IN_XXX and CT_XXXX flags in preparation
for the rototilling that !*$)~@!$_@*_(~@$*_(~@$*~@$*
Qlogic F/W changes will need.
2000-07-18 07:06:47 +00:00
Matt Jacob
d37162ca7a If debugging set, zero out an incoming response entry
when we're done reading it (makes checking things easier).
Before calling isp_notify_ack make sure we're at RUNSTATE-
elsewise we can be responding to LIPs or SCSI bus resets
before we've finished some of the wiring.
2000-07-18 07:05:37 +00:00
Matt Jacob
910fb4f6ee The SERVICING_INTERRUPT isn't quite safe yet. 2000-07-18 07:04:07 +00:00
Matt Jacob
f48ce1882f Add a isp_target_putback_atio- we aren't using CCINCR at this time, so
we need a function that tells the Qlogic f/w that a target mode command
is done, so increase the resource count for that lun. Add in a timeout
function to kick the putback again if we fail to do it the first time (we
may not have the request queue space for ATIO push). Split the function
isp_handle_platform_ctio into two parts so that the timeout function for
the ATIO push or isp_handle_platform_ctio can inform CAM that the requested
CTIO(s) are now done.

Clean up (cough) residual handling. What we need for Fibre Channel
is to preserve the at_datalen field from the original incoming ATIO
so we can calculate a 'true' residual.  Unfortunately, we're not
guaranteed to get that back from CAM. We'll *try* to find it hiding
in the periph_priv field (layering violation)- but if an ATIO was
passed in from user land- forget it. This means that we'll probably
get residuals wrong for Fibre Channel commands we're completing
with an error. It's too late to 4.1 release to fix this- too bad.
Luckily the only device we'd really care about this occurring on
is a tape device and they're still so rare as FC attached devices
that this can be considered an untested combination anyway.

Remove all CCINCR usage (resource autoreplenish). When we've proved
to ourself that things are working properly, we can add it back
in.

Make sure we propage 'suggested' sense data from the incoming ATIO
into the created system ATIO- and set sense_len appropriately.
Correctly propagate tag values.

Fall back to the model of generating (well, the functions in isp_pci.c
do the work) multiple CTIOs based upon what we get from XPT. Instead
of being able to pair Qlogic generated ATIOs with CAM ATIOs, and then
to pair CAM CTIOs with Qlogic CTIOs, we have to take the CTIO passed
to us from XPT, and if it implies that we have to generate extra
Qlogic CTIOs, so be it. This means that we have to wait until the
last CTIO in a sequence we generated completes before calling xpt_done.

Executive summary- target mode actually now pretty much works well
enough to tell folks about.
2000-07-18 06:58:28 +00:00
Matt Jacob
c77d11d0cc Raise debug level for some messages. Fix botched inversion
about MBOX_COMMAND_ERROR vs. MBOX_COMMAND_PARAM_ERROR.
2000-07-18 06:46:48 +00:00
Matt Jacob
05fbcbb000 Keep interrupts blocked for all of isp_pci_attach. Redo DMA routines
for target mode for cleanliness and accuracy.
2000-07-18 06:40:22 +00:00
Matt Jacob
1fcf5deb4a Oops! If we're deciding a command is now really dead, make *darned*
sure that it really is by issuing a ISPCTL_ABORT_CMD just on the
off chance the f/w will start it up again and, ha ha, start using
the DMA resources we gave it but are now taking away.
2000-07-05 06:44:17 +00:00
Matt Jacob
3e97a5b432 Clean up ISPCTL_ABORT_CMD function to not be too chatty if it succeeds,
or even if it fails with INVALID_PARM (which just means that the handle
doesn't refer to an active commane).
2000-07-05 06:41:36 +00:00
Matt Jacob
c464389f4b Remove obsolete isp_dogactive tag. 2000-07-04 01:06:42 +00:00
Matt Jacob
8bdda719ae Fix completely stupid and idiotiuc sprintfs in isp_inline.h with
with the STRNCAT function.
2000-07-04 01:06:23 +00:00
Matt Jacob
f6e75de230 Add in config_hook for catching when interrupts are safe- this allows
us to not the ints are ok and also to (re)ENABLE isp interrupts. Remove
all splcam()/splx() invocates and replace them with ISP_LOCK/ISP_UNLOCK
macros.
2000-07-04 01:05:43 +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
1d460ef8d5 Change delay loop in new isp_mboxcmd to the use of the new MBOX_WAIT_COMPLETE
macro. Change notification of completion of a mailbox command in isp_intr
to MBOX_NOTIFY_COMPLETE macro.
2000-07-04 01:02:38 +00:00
Matt Jacob
469b6b9efb Change startup locking. Use new isp_handle_index function
for indexing off of handles to get dma maps.
2000-07-04 01:01:15 +00:00
Matt Jacob
28445eef28 Fix usage of DELAY (SYS_DELAY is the platform independent local
define).  Fix stupidity wrt checking whether we've gone to
LOOP_PDB_RCVD loopstate- it's okay to be greater than this state.
D'oh! Protect calls to isp_pdb_sync and isp_fclink_state with IS_FC
macros.

Completely redo mailbox command routine (in preparation to make this
possibly wait rather than poll for completion).

Make a major attempt to solve the 'lost interrupt' problem

1. Problem

The Qlogic cards would appear to 'lose' interrupts, i.e., a legitimate
regular SCSI command placed on the request queue would never complete
and the watchdog routine in the driver would eventually wakeup and
catch it. This would typically only happen on Alphas, although a
couple folks with 700MHz Intel platforms have also seen this.

For a long time I thought it was a foulup with f/w negotiations of
SYNC and/or WIDE as it always seemed to happen right after the
platform it was running on had done a SET TARGET PARAMETERS mailbox
command to (re)enable sync && wide (after initially forcing
ASYNC/NARROW at startup). However, occasionally, the same thing
would also occur for the Fibre Channel cards as well (which, ahem,
have no SET TARGET PARAMETERS for transfer mode).

After finally putting in a better set of watchdog routines for the
platforms for this driver, it seemed to be the case that the command
in question (usually a READ CAPACITY) just had up and died- the
watchdog routine would catch it after ~10 seconds. For some platforms
(NetBSD/OpenBSD)- an ABORT COMMAND mailbox command was sent (which
would always fail- indicating that the f/w denied knowledge of this
command, i.e., the f/w thought it was a done command). In any case,
retrying the command worked. But this whole problem needed to be
really fixed.

2. A False Step That Went in The Right Direction

The mailbox code was completely rewritten to no longer try and grab
the mailbox semaphore register and to try and 'by hand' complete
async fast posting completions. It was also rewritten to now have
separate in && out bitpatterns for registers to load to start and
retrieve to complete. This means that isp_intr now handles mailbox
completions.

This substantially simplifies the mailbox handling code, and carries
things 90% toward getting this to be a non-polled routine for this
driver.

This did not solve the problem, though.

3. Register Debouncing

I saw some comments in some errata sheets and some notes in a Qlogic
produced Linux driver (for the Qlogic 2100) that seemed to indicate
that debouncing of reads of the mailbox registers might be needed,
so I added this.  This did not affect the problem. In fact, it made
the problem worse for non-2100 cards.

5. Interrupt masking/unmasking

The driver *used* to do a substantial amount of masking/unmasking
of the interrupt control register. This was done to make sure that
the core common code could just assume it would never get pre-empted.

This apparently substantially contributed to the lost interrupt
problem.  The rewrite of the ICR (Interrupt Control Register),
which is a separate register from the ISR (Interrupt Status Register)
should not have caused any change to interrupt assertions pending.
The manual does not state that it will, and the register layout
seems to imply that the ICR is just an active route gate. We only
enable PCI Interrupts and RISC Interrupts- this should mean that
when the f/w asserts a RISC interrupt and (and the ICR allows RISC
Interrupts) and we have PCI Interrupts enabled, we should get a
PCI interrupt. Apparently this is a latch- not a signal route.

Removing this got rid of *most* but not all, lost interrupts.

5. Watchdog Smartening

I made sure that the watchdog routine would catch cases where the
Qlogic's ISR showed an interrupt assertion. The watchdog routine
now calls the interrupt service routine if it sees this. Some
additional internal state flags were added so that the watchdog
routine could then know whether the command it was in the middle
of burying (because we had time it out) was in fact completed by
the interrupt service routine.

6. Occasional Constipation Of Commands..

In running some very strenous high IOPs tests (generating about
11000 interrupts/second across one Qlogic 1040, one Qlogic 1080
and one Qlogic 2200 on an Alpha PC164), I found that I would get
occasional but regular 'watchdog timeouts' on both the 1080 and
the 2100 cards. This is under FreeBSD, and the watchdog timeout
routine just marks the command in error and retries it.

Invariably, right after this 'watchdog timeout' error, I'd get a
command completion for the command that I had thought timed out.
That is, I'd get a command completion, but the handle returned by
the firmware mapped to no current command. The frequency of this
problem is low under such a load- it would usually take an 30
minutes per 'lost' interrupt.

I doubled the timeout for commands to see if it just was an edge
case of waiting too short a period. This has no effect.

I gathered and printed out microtimes for the watchdog completed
command and the completion that couldn't find a command- it was
always the case that the order of occurrence was "timeout, completion"
separated by a time on the order of 100 to 150 ms.

This caused me to consider 'firmware constipation' as to be a
possible culprit. That is, resubmission of a command to the device
that had suffered a watchdog timeout seemed to cause the presumed
dead command to show back up.

I added code in the watchdog routine that, when first entered for
the command, marks the command with a flag, reissues a local timeout
call for one second later, but also then issues a MARKER Request
Queue entry to the Qlogic f/w. A MARKER entry is used typically
after a Bus Reset to cause the f/w to get synchronized with respect
to either a Bus, a Nexus or a Target.

Since I've added this code, I always now see the occasional watchdog
timeout, but the command that was about to be terminated always
now seems to be completed after the MARKER entry is issued (and
before the timeout extension fires, which would come back and
*really* terminate the command).
2000-06-27 19:44:31 +00:00
Matt Jacob
b85389e117 Add in the enabling of interrupts (to isp_attach). Clean up a busted
comment. Check against firmware state- not loop state when enabling
target mode. Other changes have to do with no longer enabling/disabling
interrupts at will.

Rearchitect command watchdog timeouts-

First of all, set the timeout period for a command that has a
timeout (in isp_action) to the period of time requested *plus* two
seconds. We don't want the Qlogic firmware and the host system to
race each other to report a dead command (the watchdog is there to
catch dead and/or broken firmware).

Next, make sure that the command being watched isn't done yet. If
it's not done yet, check for INT_PENDING and call isp_intr- if that
said it serviced an interrupt, check to see whether the command is
now done (this is what the "IN WATCHDOG" private flag is for- if
isp_intr completes the command, it won't call xpt_done on it because
isp_watchdog is still looking at the command).

If no interrupt was pending, or the command wasn't completed, check
to see if we've set the private 'grace period' flag. If so, the
command really *is* dead, so report it as dead and complete it with
a CAM_CMD_TIMEOUT value.

If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL
Marker Request Queue entry and re-set the timeout for one second
from now (see Revision 1.45 isp.c notes for more on this) to give
the firmware a final chance to complete this command.
2000-06-27 19:31:02 +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
e2adf86e4e Add 8 bits of volatile mailbox busy mask- this will be the bitmask of
output mailbox values we want to get back out of the chip once a mailbox
command is done. Add storage for the maximum number of output mailbox
registers to the softc.

Roll minor version number.
2000-06-27 19:17:39 +00:00
Matt Jacob
40e88de6c3 Add mailbox bitmask macros (numbers of available mailbox registers
based upon Qlogic chip type). Define maximum mailboxes. Add INT_PENDING_MASK
macro. Change mailbox offset macro name.
2000-06-27 19:15:43 +00:00
Matt Jacob
986973a448 Add an isp_handle_index function- this is prepatory to loading more into
the handle (i.e., generation number), so we will now need a function that
will take a handle and return a flat index [ 0 .. maxhandles-1 ] for
auxillary routines that need an index to get at buddy store values
(like dma maps or xflist pointers).
2000-06-27 19:14:14 +00:00
Matt Jacob
56aef50302 Clean up firmware load issues and remove darn near all config options.
Force alphas to prefer mem mapping as the default.

Basically, we have a pointer to a function which we can call which will
return us a pointer to firmware for the card we have. We call this function
(if it's non-NULL) with the address of our mdvec f/w pointer.

The way this works is that if ispfw (as a module or a static) is loaded,
it initializes the pointer in isp_pci, so we can call into to it to fetch
a pointer to a f/w set.

If ispfw is MOD_UNLOADed, it's retained a pointer to our mdvec f/w pointers,
which then get zeroed out so we don't have any references to data that's
now gone from kernel memory. Removing the f/w saves ~360KBytes.

Alas, there is no autounload mechanism that works for is here.
2000-06-18 05:18:55 +00:00
Matt Jacob
526539764e Removing this bulky one large f/w file. This f/w is now in dev/ispfw. 2000-06-18 04:59:47 +00:00
Matt Jacob
fb1d37adcd Once we have firmware running (if isp_reset) and this is the first time
through, establish what our LUN width is. Unfortunately, we can't ask
the f/w. If we loaded the f/w, we'll now assume we have expanded LUNs
(SCCLUN for fibre channel, just plain 32 LUN for SCSI). If we didn't
load firmware, assume 8 LUNs for SCSI and 1 LUN for Fibre Channel. We
have to assume only one LUN for Fibre Channel because the LUN setting
in Request Queue entries is in different places whether we have SCCLUN
firmware or not, so the only LUN guaranteed to work for both is LUN 0.

Clean up the rest of isp.c so that ISP2100_SCCLUN defines aren't used-
instead use run time determinants based upon isp->isp_maxluns.

After starting firmware, delay 500us to give it a chance to get rolling.

Fix the interrupt service routine to check for both isr && sema being zero
before thinking this was a spurious interrupt.  Following the manuals,
allow for both Mailbox as well as Queue Reponse type interrupts for regular
SCSI.
2000-06-18 04:56:17 +00:00
Matt Jacob
2ad50ca5f4 Remove all ISP2100_SCCLUN define protected code and replace it with
runtime checks.
2000-06-18 04:50:26 +00:00
Matt Jacob
2133e16f18 Remove all ISP2100_SCCLUN define based code and replace it with runtime
comparisons against the tag isp_maxluns- if > 16, we're SCCLUN based.

On initial regular SCSI startup, disable auto-disconnect.
2000-06-18 04:48:28 +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
5e09512c51 Roll core minor version. Set ISP_MAX_LUNS to be off of new isp_maxluns
tag in softc.
2000-06-18 04:45:51 +00:00
Matt Jacob
d22fcb6b75 add "disable autodisconnect" flags 2000-06-18 04:44:41 +00:00
Matt Jacob
22e83dac1e cleanup i_int_X vs. uint_X definitions 2000-06-18 04:43:55 +00:00
Matt Jacob
ee9fc94ca5 add MBOX_GET_RESOURCE_COUNT command 2000-06-18 04:41:14 +00:00
Matt Jacob
52df5dfdab Fix breakage to target mode support.
What we'd like to know is whether or not we have a listener
upstream that really hasn't configured yet. If we do, then
we can give a more sensible reply here. If not, then we can
reject this out of hand.

Choices for what to send were
	Not Ready, Unit Not Self-Configured Yet
	(0x2,0x3e,0x00)
for the former and
	Illegal Request, Logical Unit Not Supported
	(0x5,0x25,0x00)
for the latter.

We used to decide whether there was at least one listener
based upon whether the black hole driver was configured.

However, recent config(8) changes have made this hard to do
at this time.

Actually, we didn't use the above quite yet, but were sure considering it.
2000-06-12 23:08:31 +00:00
Matt Jacob
6d1d7d4c87 Fix some breakage about how we build WWNs. Do some other fabric related
changes: consider a new PDB entry different if Class 3 service parameter
roles change (!!!). Do some checking as we're getting a port database
that traps whether things change while we're doing so. Handle N-port
and F-ports correctly. Fix the fabric login loop to retain a login/binding
if things haven't changed (I mean, why logout a device only to log it back
in). No longer accept, after fabric logins, garbage if we can't get a PDB
entry that matches the device we've just logged into- if it doesn't, log
it out as it is very unlikely to still be what we thought it was. Get rid
of some of the debounce loops because we could get stuck there.
2000-05-09 01:14:43 +00:00
Matt Jacob
a200278c54 roll platform minor 2000-05-09 01:09:46 +00:00
Matt Jacob
686f419d48 Roll core minor version. Change our 'fabdev' tag to 'loggedin'. 2000-05-09 01:09:23 +00:00
Matt Jacob
cc8df88b70 Add in a watchdog routine to catch cases where we've dropped the command.
Apparently the f/w has finished the command, but somehow an interrupt is
being lost. So, we just plain wedge when booting alphas.

This is a general routine we've needed for a while.
2000-05-09 01:08:21 +00:00
Matt Jacob
a96d513df9 The storage for WWN from NVRAM is actually the PORT WWN, not the NODE WWN. 2000-05-09 01:06:47 +00:00
Matt Jacob
c41767dc4e Conrrect a macro with parenthesis. 2000-05-09 01:06:18 +00:00
Matt Jacob
16c9a708a4 Now that we fixed the isp_sendmarker botch, we can now do initial bus
resets for ULTRA2/ULTRA3 cards again (which were turned off really because
of a botch for dual bus configurations).
2000-04-21 19:18:06 +00:00
Matt Jacob
d465588a93 Roll minor version. Increase size (and add defines for) topology storage. 2000-04-21 02:06:30 +00:00
Matt Jacob
9dae880716 Some minor tweaklets. 2000-04-21 02:05:54 +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
c88f65e2c0 Pick up topology more sanely at f/w startup. Change the restrictions of
where we can have targets (based on topology).

Much more importantly, make sure all mods to isp_sendmarker or |= so
we don't lose the marking of a bus that needs to have a marker sent for it.
2000-04-21 02:04:34 +00:00
Matt Jacob
b581c6e08f Update (finally) 1.15.37 to 1.19.03 for the 2100. This allows us to not
require full logins after a LIP, which always led to loop resets, and
various other perturbations.

Update 2200 f/w from 2.01.00 release to 2.01.09 release.
2000-04-21 02:01:06 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Matt Jacob
0b69cead4d roll platform versions to 5.0 2000-03-15 18:49:44 +00:00
Matt Jacob
6ca3a52f59 Don't do bus resets for ULTRA2 or later cards because what seems to
happen currently is that several commands issued *after* the bus reset are
then reported destroyed.
2000-03-13 16:30:00 +00:00
Matt Jacob
eb76ec8076 Add in mailbox return codes for failed fabric logins (port_id_used,
loop_id_used, etc...)

Do a more precise structure for Get All Next name server responses.

Approved: jkh
2000-02-29 05:54:48 +00:00
Matt Jacob
adde48b322 Minor non-FreeBSD changes (keeping source sync'd).
Approved: jkh
2000-02-29 05:53:41 +00:00
Matt Jacob
40cfc8fe8e Prettier print of fabric devices being attached- say what kind of
port they are (e.g., F_Port vs. N_Port).

Approved: jkh
2000-02-29 05:53:10 +00:00
Matt Jacob
cf74f2682e Slightly cleaner fabric support (whiter whites! redder reds!).. No,
seriously- only attempt to logout a previously logged in fabric device.

Fix a longstanding bug for aborting overtime commands- handle halves
have always been reversed.

Clean up some error messages to indicate channel number.

Approved:jkh
2000-02-29 05:52:14 +00:00
Matt Jacob
2e56bc770d Clean up defines for correct 12160/1080 exclusion. Final 4.0.
approved: JKH
2000-02-29 05:48:46 +00:00
Matt Jacob
b6f774e39b Fix ITDEBUG macro.
Approved: jkh
2000-02-15 00:54:26 +00:00
Matt Jacob
14a3729325 Correctly identify which bus of dual bus SCSI adapters some target mode
commands (enable/disable/modify lun && immediate notify) we're talking about.

Approved: jkh
2000-02-15 00:53:49 +00:00
Matt Jacob
d667c06c77 Clean up some target mode debug messages. Fix (finally, I believe)
Andrew's problems with SCSI on some alphas- do not call isp_update
directly to update parameters- just mark them as being ready to
update for the next command- the system would just hang on a READ
CAPACITY for a drive. Really annoying because it wouldn't even timeout
(and it has a timeout) so either the SET PARAMETERS call was nuking
things or the f/w was really dropping the ball.

approved: jkh

Reviewed by:	gallatin@freebsd.org
2000-02-15 00:52:52 +00:00
Matt Jacob
e142669a43 If the CDB length is greater than 12 for parallel SCSI, ispscsicmd has
made the initial queue entry a EXTENDED CMD queue entry, so we have to
go straight to continuation segments for any data segments.

approved: jkh
2000-02-15 00:50:01 +00:00
Matt Jacob
fe4d046167 Clean out residual bogosity for fast posting stuff- ISP_NO_FASTPOST_SCSI
is gone as a define. We just don't support fast posting for anything less
than the 1240/1080/1280/12160 or Fibre Channel cards.

Put in support for CDB's larger than 12 bytes for parallel SCSI (up to 44
bytes are allowed).

Approved: jkh
2000-02-15 00:35:00 +00:00
Matt Jacob
960f6939af Add in 12160 (Ultra3) support. Redo things to use the newbus code.
Approved: jkh@freebsd.org

PR:		16141
2000-02-11 19:45:17 +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
af4d01494d Correct a minor typo in error message.
Approved: jkh@freebsd.org
2000-02-11 19:36:30 +00:00
Matt Jacob
c2e7467339 Add in new async mbox defines for 2200- point to point stuff.
Add in definitions for the extended initialization control block
(2200 only again).

Approved: jkh@freebsd.org
2000-02-11 19:35:42 +00:00
Matt Jacob
c211f23b90 Add in 12160 (Ultra3) NVRAM definitions.
Approved: jkh@freebsd.org
2000-02-11 19:34:33 +00:00
Matt Jacob
fd589c2e36 Add in 12160 (Ultra3) firmware. Gawd, this file is bulky.
Approved: jkh@freebsd.org
2000-02-11 19:32:51 +00:00
Matt Jacob
0f38a25b52 Restructure nvram reading routine to split out to separate functions
for 1020/1X80/12160/2X00- for readability. Add in 12160 (Ultra3)
support- but not with PPR just yet.  Fix and clarify fetching of
return parameter for getting firmware rev which for the 2200 contains
the connection topology (Private Loop (NL-port), N-port, FL-port,
F-port). Synthesize the connection topology for the 2100 which can
only be Private Loop or FL-port. Handle a couple of new async
mailbox commands which signify connection in Point-to-Point mode
(N-port or F-port) or indicate various toe stubbing getting to same.

Approved: jkh@freebsd.org
2000-02-11 19:31:32 +00:00
Matt Jacob
83fbc5665e Add 12160 (Ultra3) defines. Add config option flag for forcing point-to-point
instead of FC-AL (2200 only).

Approved: jkh@freebsd.org
2000-02-11 19:25:01 +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
003a310f5f Remove compile warning not seen when compiling with target mode enabled. 2000-01-15 07:06:44 +00:00
Matt Jacob
65b024e1bf Redo FC target mode dma routine to try and generate an extra CTIO
in the not so odd case of Moving Data *AND* Sending Status in last CTIO *AND*
status is a CHECK CONDITION *AND* we have Sense Data to send.
2000-01-15 01:54:36 +00:00
Matt Jacob
0719e3345c clean up for SBus Ultra (yes, we do not do that here yet) 2000-01-15 01:52:01 +00:00
Matt Jacob
00a8e1748b a whale of a lot of target mode cleanup 2000-01-15 01:50:48 +00:00
Matt Jacob
0c02c31bc0 cleanup- it was not MI code as it should have been 2000-01-15 01:49:09 +00:00
Matt Jacob
427469a4a8 cleanup 2000-01-15 01:48:24 +00:00
Matt Jacob
6b016bfd75 include public target mode functions 2000-01-15 01:47:10 +00:00
Matt Jacob
b5a11b0bc5 public target mode stuff 2000-01-15 01:46:37 +00:00
Matt Jacob
abde225be8 tighten up printout 2000-01-15 01:43:19 +00:00
Matt Jacob
ec9509a376 add MAINTAINER file for clarity 2000-01-13 18:45:14 +00:00
Matt Jacob
e85919b9f8 change debug printout lefvels for a couple of places 2000-01-09 21:47:39 +00:00
Matt Jacob
32ecc7a2e7 oop, use PRINTF not printf in MI code 2000-01-04 05:17:48 +00:00
Matt Jacob
92a1e54959 Clean up some debug printing. Find the correct lun when SCCLUN is
defined. If we complete with a check condition but no sense data,
say we had an AUTOSENSE failure.
2000-01-04 03:45:49 +00:00
Matt Jacob
3da7ba4d41 Make Fibre Channel cards correctly note the presence/absence
of ARQ data and punt the dealing with its presence/absence
to the platform layers.
2000-01-04 03:44:21 +00:00
Matt Jacob
79e2d3b5b3 set default target mode debug to 0 2000-01-04 03:43:03 +00:00
Matt Jacob
31adfa66a3 add clarifying tag define for FC 2000-01-04 03:42:19 +00:00
Matt Jacob
4242692117 Add in an isp_tdebug environment variable. Clean up some debugging
printouts for clarity.
2000-01-04 03:41:40 +00:00
Matt Jacob
ea49c6e4fe These are platform independent functions for target mode support.
This is just a first pass at this and is likely to change a bit
over the next month.
2000-01-04 00:00:08 +00:00
Matt Jacob
0615a54798 These are platform independent definitions for target mode support-
code gratefully borrowed from Patrick Stirling who did a lot of the
grunt work on this years ago. There are also some beginnings of
swizzle macros in case we go to a big endian machine. This is just
a first pass at this and is likely to change a bit over the next
2000-01-03 23:58:41 +00:00
Matt Jacob
d81ba9d532 Make a static chain of isp softcs- gdb usage becomes a lot easier.
Add in a very large amount of target mode support code- this is just
a first pass at this. It's a difficult thing because some of the code
can be in platform independent areas (see isp_target.?) but a lot has
to be in platform dependent areas because of not only the tight coupling
of received commands/events and the specific OS subsystem but because
the platform independent code has (deliberately) no event/wait mechanisms.
2000-01-03 23:55:30 +00:00
Matt Jacob
ac1fd1487e Raise default FCP logintime to 60 seconds. Move the position
of where we could have seen the loop up at least once so it
makes sense. Change some stuff in ispscsicmd so we don't get
stuck there if the loop has never come up yet. Add in some
target mode support code.
2000-01-03 23:52:41 +00:00
Matt Jacob
9e11e5bea2 Support target mode operations. This involves having some variant
dma mapping callback routines to select from as target mode
entries are handled a fair bit differently from normal initiator
mode entries.
2000-01-03 23:50:13 +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
f38e1372e5 add isp_print_qentry inline function 2000-01-03 22:14:24 +00:00
Matt Jacob
41593b2586 Roll minor revision number and add a more finalized list
of target mode related enums.
2000-01-03 22:13:40 +00:00
Matt Jacob
361959970f Add missing target mode flag and fix the RQSTYPE_CTIO0
to be CTIO as it should be.
2000-01-03 22:12:53 +00:00
Matt Jacob
762fa8a53f Add in missing ENABLE TARGET MODE opcode. 1999-12-27 08:47:11 +00:00
Matt Jacob
34b4347208 Oops- got the initiator and initiator/target f/w reversed for
the 1080/1240/1280 case.
1999-12-22 00:18:15 +00:00
Matt Jacob
f9e908dcf2 Clean up lun width determination based upon f/w revisions
for the parallel SCSI cards (4.55..4.65 :: 8.55..8.65).
1999-12-20 01:35:04 +00:00
Matt Jacob
9ee303fb46 Clean up some f/w revision checking wrt enabling fast posting.
Make sure we set defaults sanely for dual-bus adapters.
1999-12-20 01:34:01 +00:00
Matt Jacob
b69bf8a01d add initiator-only mode f/w for 1040 && 1080/1280/1240 1999-12-20 01:30:52 +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
571354dc81 clean up sprintf and have buffer that won't overflow 1999-12-03 06:56:23 +00:00
Matt Jacob
7457966f26 turn some messages into CFGPRINT messages 1999-12-03 06:55:39 +00:00
Matt Jacob
38dace9790 Clean up stupidity in the isp_handle_other_response function- indexes
of queue entries have to be at least 16 bits now! If we're running
a 2100 less than rev 5, turn off loop fairness (per Qlogic errata). Fix
typo in checking against 2200 F/W revision. Slightly fix/reorder fabric
login stuff. Change to usage of isp_getrqentry for code clarity. Add some
defensive dual bus assumptions. Various cleanups, etc...
1999-11-21 03:18:22 +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
840e8002a0 Add a isp_getrqentry inline function (that is, find the next available
request queue entry if any are left).
1999-11-21 03:14:04 +00:00
Matt Jacob
80ae565585 Fix some includes for when we (eventually) get target mode working again.
Role the core version minor number. Change the arguments to the dma
setup function to use a u_int16_t for the output request loop pointer
(truly amazing that this hasn't blown up in anyones face so far). Do
some shuffling around of some items.
1999-11-21 03:12:58 +00:00
Matt Jacob
28e9826fd4 Put *back* the f/w, this time with a BSD style licence as approved
by Qlogic. The firmware is now also kept from compiling by default
unless some config options are set.

While we're at it, roll the 2200 f/w to 2.01.0. Still need to get the
1.17.26 2100 f/w working as it solves a lot of problems but it doesn't
want to work yet with this driver (:-)).
1999-11-21 03:08:29 +00:00
Matt Jacob
9637d68c97 Fix dmasetup functions to have 16 bit queue indices. Get the chip revision
out of the PCI CLASS reg and store it in the softc. Use the getenv_quad
function to get a WWN override from the environment. Look for a config
value for same. Make slightly less lame the wwn seed construction.
1999-11-21 02:56:17 +00:00
Andrew Gallatin
a3f09ae6e1 Remove calls to alpha_register_pci_scsi(). After Mike's recent boot
changes, it no longer exists and is preventing alpha kernels from building.

reviewed by: msmith
1999-11-05 13:10:39 +00:00
Matt Jacob
fdc79fd3fc correct moronic typo 1999-11-01 04:39:52 +00:00
Matt Jacob
fed92c475e Organize things to cope with the (possible) lack of downloadable
firmware a bit better.
1999-10-30 19:35:11 +00:00
Matt Jacob
57dd0656a5 Remove firmware from tree until a better copyright from Qlogic is forthcoming. 1999-10-30 19:33:45 +00:00
Matt Jacob
03322f8625 Use pointer to f/w in md structure as to whether f/w exists or not.
If firmware length isn't specified, extract from the 4th short into
the firmware.
1999-10-30 19:32:44 +00:00
Matt Jacob
2668d67e9c I was misinformed. I cannot get away from specifying tags for FC. Some devices
are happy w/o them- some are unhappy (IBM drives).
1999-10-28 02:48:42 +00:00
Matt Jacob
83d62096d6 nuke a debug printout I thought I had already nuked 1999-10-26 22:25:13 +00:00
Matt Jacob
5e73516b7b remember to initialize mailbox 2 for FC isp bus resets 1999-10-22 17:03:03 +00:00
Matt Jacob
a95ae1936f Add in inclusion of machine/md_var.h (so alpha_scsi_bus_register or what
have you is prototyped). Removed code versions in md struct- not used
any more. Allocate transfer dma maps and xflist stuff in mbxdmasetup based
upon isp->isp_maxcmds. Allow for multiple calls to mbxdmasetup (for
isp_reset cases).
1999-10-17 19:03:11 +00:00
Matt Jacob
fc0685ea06 Remove some target mode stuff. It will get re-introduced in a different
file later. Do some pencil-sharpening types of minor changes. Change
how active commands are remembered (using new inline functions to get
handles, etc..). Now do a GET FIRMWARE STATUS after firing up the f/w as
outgoing mailbox 2 will tell you the f/w's notion of the max commands
that can be supported. Attempt to retrieve loop topology. Add in the
appropriate SWIZZLE/UNSWIZZLE macros calls (this is a no-op on Little
Endian machines but is needed for sparc (on other platforms)). Move
the temp port database we use to find out where things have moved to
after a LIP to the softc and off the kernel stack. Follow Qlogic's
hint and don't bother setting a tag for commands that don't have
this enabled (presumably the f/w will do it's own selection then).
Use an INT_PENDING macro to check for an interrupt. The call to
ISP_DMAFREE now just takes the handle- not the 'handle-1' which was
a layering violation. Use CFGPRINTF in a couple of places to make
things less chatty if not booting verbose, or CAMDEBUG compiles, etc..
1999-10-17 18:58:22 +00:00
Matt Jacob
ab6c4b31c6 Add in isp_debug variable. It defaults to zero unless CAMDEBUG is defined
where it defaults to one. Change simq width allocation to the max number
of commands supported by the HBA after f/w fires up- not the constant
MAXISPREQUEST value. Do some stylistic changes.
1999-10-17 18:50:47 +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
Matt Jacob
7e90346eec Roll core version number. Do some stylistic changes. Ensure that
the result queue length is never less than 64. Move (ick) temp port
database used for post-LIP merging off the kernel stack and put it
into the softc. Remove some target mode stuff which will come back
later in a different file. Change how the list of outstanding commands
are stored (now allocated at mailbox setup time to be just enough for
the max for a specific HBA which can vary). Keep a rotating seed of
the last index for this in the softc. Increase the count of active
commands from 10 to 16 bits.
1999-10-17 18:45:31 +00:00
Matt Jacob
b996239f46 add in an INT_PENDING macro 1999-10-17 18:41:47 +00:00
Matt Jacob
327d3cc65b Remove target mode definitions (they'll come back later in
a different file).
1999-10-17 18:41:21 +00:00
Matt Jacob
f4e5fd3676 Add a file where inline functions for the Qlogic isp cards can go. This reduces
duplication in all the platform specific header files.
1999-10-17 18:15:05 +00:00