Commit Graph

57 Commits

Author SHA1 Message Date
mjacob e2f3e02af9 Do not enable interrupt driven mailbox commands for non-FC scsi. 2002-09-01 22:30:09 +00:00
mjacob 93ad4971f1 Various changes to allow for overriding just loopid and/or iid.
Fix a random 23XX ISR reading bug. Be chattier about HBA_BOTCH
errors. More f/w cashdump layering.
2002-08-12 21:33:39 +00:00
mjacob fc73c60a36 Add support for ISP_FC_GETHINFO which can tell you connection topology,
current speed, loopid, etc.
2002-06-15 00:20:18 +00:00
yamt 7d0fd357f6 make auto const variables static. 2002-06-08 16:51:38 +00:00
mjacob c8513a96b0 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.
2002-04-04 23:38:43 +00:00
mjacob 91f80cf3fc Implement F/W crashdumps for 2200 && 2300 cards (kernel compile option).
Distinguish between 2312 and 2300 cards (they *are* different). Enable
RIO (Reduced Interrupt Operation) for the LVD cards (hey- I've seen
batched completions of the 30 commands at a time with this,....)...

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

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

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

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

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

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

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

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

Additional changes:

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

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

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

Nuke some additional __P macros.
2001-12-14 00:13:44 +00:00
lukem a4bae8b066 add/cleanup RCSID 2001-11-13 13:14:31 +00:00
mjacob 01e394b10d Now that we have a fixed thaw thingie- we can turn back on sleeping
on mailbox commands.
2001-09-28 16:23:19 +00:00
mjacob 7492be3d51 Fix a misspelled error message.
Temp work around problems where if we allow for non-polled mailbox commands
we got nailed by hardclock calling is for a timed thaw. Basically, this
means we only enable non-polled mailbox commands in the FC kthread when it
calls isp_fc_runstate.
2001-09-05 23:08:23 +00:00
mjacob 6bb9f4a949 Add support for 2 Gigabit cards (2300/2312). This necessitated a change
in how interrupts are down- the 23XX has not only a different place to check
for an interrupt, but unlike all other QLogic cards, you have to read the
status as a 32 bit word- not 16 bit words. Rather than have device specific
functions as called from the core module (in isp_intr), it makes more sense
to have the platform/bus modules do the gruntwork of splitting out the
isr, semaphore register and the first outgoing mailbox register (if needed)
*prior* to calling isp_intr (if calling isp_intr is necessary at all).
2001-09-01 07:12:23 +00:00
mjacob 0134959e74 If I've told myself once, I've told myself 1000 times- *NEVER* commit
w/o test compiling first. Argh. I nuked one extra line that I shouldn't
have.
2001-07-07 01:44:21 +00:00
mjacob 5089fba315 Defer turning off the no_mbox_ints flag until after the system is ready
for interrupts. Handle FW crashes in outer layer.
2001-07-06 16:17:17 +00:00
mjacob c9de53f96e Create a kernel thread for Fibre Channel cards. This is the new
way of doing business- modulo some startup spasms and peculiarities
of the way kthreads are started (*after* configuration, weird) and
some strangeness with the freeze/thaw code, what now happens is
that any of Loop Down, LIP, Loop Reset or Port Datbase or Name
Server Database Changed ASYNC events cause the queues to freeze
for this channel.  The arrival of a Loop UP is not relevant.

What *is* relevant is that the Port Datbase or Name Server Changed
async event indicate that it's okay to go and (re)evaluate the
state of the FC link and (re)probe local loop and fabric membership.
We have a kthread do this because it's *sooooo* much nicer to be
able to sleep while doing the 130-250 mailbox commands it'll take
to re-evaluate things.

When the state is well known again, we can unfreeze the channel
queues.  Then, as commands start arriving, we simply can start them
or bounce them with XS_SELTIMEOUT (if the device in question has
gone away).  Previously, we did lazy evaluation, which meant that
if a change occurred, we would wait until the very *next* command
to go rebuild stuff.

The reason this is not sensible is:

 a) Even with sleeping, you can hang up your system because you might be
 making some poor stat(2) call pay the price of re-evaluating the whole
 fabric.

 b) If we ever really want to get to dynamic attachment/detachment, we
 should find out sooner, rather than later, where things get to.

Split off ispminphys_1020 from ispminphys- a 1020 has a 24 bit limit-
not anything newer.

Re-enable LIPs and Loop Resets as async events- this allows the outer
layer to set policy about them.

Roll platform major && minor. Remove bogus waitq (no longer used).
Remove callout entry in softc (no longer used). Define some shorthands
for channels. Clean up a variety of cruft left over from the
thorpej_scsipi changeover.
2001-05-25 21:45:55 +00:00
mjacob a1dd9d78ee It's 'role None', not 'role No'.
Also, pay attention to the difference in the ISPASYNC_CHANGE_NOTIFY
between loop and fabric changes.
2001-05-16 03:52:10 +00:00
bouyer 937a7a3ed9 Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
  ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
  to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
  peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
  recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
  scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
  (no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
  set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
  the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
  will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
2001-04-25 17:53:04 +00:00
mjacob 78a44662f5 Add initial implementation of ISP_SDBLEV, ISP_RESETHBA, ISP_FC_RESCAN,
ISP_FC_LIP and ISP_FC_GETDINFO ioctls.
2001-04-10 21:52:00 +00:00
mjacob 8d81f18e84 Handles are now 16 bits. ANSIfy. 2001-03-14 05:44:21 +00:00
mjacob 25bc760687 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.
2001-02-12 23:30:12 +00:00
mjacob 5599d31360 ISPASYNC_PDB_CHANGED->ISPASYNC_LOGGED_INOUT. And also, ISPASYNC_CHANGE_NOTIFY
is for both local loop and fabric cases now.
2001-01-09 18:54:53 +00:00
mjacob d4c32f2a63 Apply nearly all of Bill Sommerfeld's -Wformat patches. The one
change I didn't take is the %llu format- I can't have a common
across multiple platform module assume a %ll argument capability-
which really pointed out that I shouldn't be trying to *print*
something which could long long.
2000-12-28 22:27:46 +00:00
mjacob 0dae1b3d9a Turn ISP_LOCK/ISP_UNLOCK into ISP_ILOCK/ISP_IUNLOCK macros for routines
that are driven from a timeout (oops, they're on the interrupt stack).
2000-12-28 21:37:04 +00:00
mjacob 829a533bfb Restore the change fvdl made. Sorry about not noticing it. The
header (about 'Maintainer') is supposed to help encourage folks
to coordinate with me.
2000-12-28 08:11:52 +00:00
wiz c8b0b91e7e Fix pathnames in comment. 2000-12-23 01:37:57 +00:00
mjacob af2807f9f7 Finally fix this driver to be sensible about the ENDIAN dance. It's not
quite simply a question of the Qlogic being little endian and having
to have stuff swapped on big endian machines- it also has to do with the
fact that the SBus and PCI DMA layouts are wierd with respect to this.

At any rate, now finally fixed- works on Mac G4, tested it on a SS10
for sparc, checked on alpha to see if I've broken anything, and as
soon as I get another spare afternoon I'll finally install a sparc64
version which should just work (as it'll be like the Mac).
2000-12-09 08:06:31 +00:00
fvdl 0888965bb7 Remove uninitialized variable usage (it was redundant anyway). 2000-12-04 11:05:32 +00:00
mjacob ffdbddbd79 Add in commented-out hiwater measurement.
Remove egregious older bug which had us refusing to log into
fabric devices unless they were NL ports. Whuff.
2000-10-16 05:15:55 +00:00
mjacob 22ef6ec857 Add a maintenance note. Change all splbio's to use the ISP_LOCK/ISP_UNLOCK
or ISP_ILOCK/ISP_IUNLOCK macros.
2000-08-14 07:08:12 +00:00
mjacob 0dc8c1fb35 Remove ispcmd_slow routine- SCBUSACCEL routine will set/clear tag/wide/sync.
Make some changes about where some things sit in the softc.
2000-08-08 22:58:30 +00:00
mjacob 068c76fc80 Core version 2.0 (platform version 1.0) rewrite of ISP driver. Some
interace cleanups, some new common functions. The major impact that
will be noticeable right away is that if you boot with not Fibre connected
to the FC cards, you no longer hang indefinitely.
2000-08-01 23:55:09 +00:00
mjacob 58a60a43f2 Gah. Bad port from FreeBSD code (thanks Robert Elz) for setting
up default timeout for watchdogging commands.
2000-07-07 03:14:53 +00:00
mjacob a743834a38 Redo watchdogs to handle cases of false death of commands- time
each command now.. Get rid of SCCLUn stuff. Use an isp_done routine
to handle cases of watchdog and isp_done racing to completion.
2000-07-05 22:23:05 +00:00
he 084953b8f7 Update from Matthew Jacob:
Correctly account for F-port vs. F-port (no FLOGI_ACC) topologies.
  Make sure we get a port database entry for the fabric name server.
  Preserve fabric logins if the device didn't change across fabric
  or port database changes, or the device has already logged into
  us (e.g., for target/initiator dual role devices like Veritas
  SANbox). Propagate class 3 service parameter changes where devices
  can change roles.

  Fix all occurrences of setting a sendmarker so that setting it
  for one bus on dual bus cards doesn't wipe a pending sendmarker
  for other busses on the same card :-;.

  Comments added and clarifications made in some of the target mode code.
2000-05-13 16:53:03 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
mjacob 50f2620822 add 80 MHz case 2000-02-12 02:25:28 +00:00
mjacob 83931d33df clean unused fwrev stuff 1999-12-20 00:38:21 +00:00
mjacob edf809c8b6 Dual LVD (1280) support. 1999-12-16 05:35:42 +00:00
mjacob 60416909de Oops. The compiler didn't catch this 'used before set'. Kudos
to Sean Doran for finding it and being nice in telling me.
1999-12-05 18:20:53 +00:00
mjacob f5c2acedc2 (wow- I thought I'd already committed most of this).
Clean up some isp_attach time stuff- if ISP2100_FABRIC is defined try *really*
hard to make sure that we get the firmware state to FW_READY and see the
loop state where the Port Database is ready to be gathered- if we don't do
this it's unlikely we will be able to correctly query the nameserver because
we won't see that we're on a fabric.

Clean up the completely broken and stupid attempts to hot switch the
'slow' start routine out of the way. Sigh.

Turn speed announcements into CFGPRINTF functions (available only if DEBUG
defined).
1999-12-04 03:04:59 +00:00
mjacob 5781cfe433 some comments added 1999-10-17 01:23:21 +00:00
mjacob 02911581bb Add in an ioctl entry point so scsictl mediated bus resets will work.
Redo how we start commands- do a 'slow' start function which then
looks to see when we're done the configuration process at which point
it *then* enables sync/wide mode. Set the max openings amount to the
true max openings- not a synthetic. Add a timeout driven command requeue
function so that Loop Down events well freeze things until a later point
in time where they might be restarted.
1999-10-14 02:31:11 +00:00
thorpej fe12736867 Update for SCSIPI changes. Note that capabilities update is disabled
until Matt Jacob has a change to update the driver for the latest
firmware, etc. since update device parameters seems to fail once the
system is really up and running, and eventually causes the controller
to wedge.  This may be due to a firmware bug.

Per discussion with Matt.
1999-09-30 23:06:18 +00:00
mjacob f428cf36fa Change to approved NASA/Ames copyright. Add Fabric support. Fix SCCLUN support.
Add code that tries to track LoopID shifting.
1999-07-05 20:31:35 +00:00
mjacob 61bf929d14 Do a fairly large internal restructuring to accomodate dual-bus host adapters
(e.g., the 1240). Include the new 1080/1240 NVRAM layout reading code. Some
moderately significant mailbox changes were necessary also to accomodate a
second channel.
1999-05-12 18:59:23 +00:00
mjacob a529f8f3b4 firmware revision now a triple 1999-04-04 02:29:34 +00:00
mjacob 99d46bf762 add isp1080 support and some basic PDB change stuff 1999-03-26 22:39:44 +00:00
mjacob 008b51d0a6 Update the driver with some infrastructure for the 1080. Fix an embarrassing
clock botch bug. Additional infrastructure for PDB change stuff.
1999-03-17 06:15:47 +00:00
mjacob 6a8ebccd6a Do SCSI Bus resets in this layer (now). Don't do it for Fibre Channel yet
(we get LOOP DOWN events, and we'll hang on that at this time).

Add other isp_async cases- ISPASYNC_LOOP_DOWN and ISPASYNC_LOOP_UP. DOWN
will cause internal queuing until UP, whereupon a timeout will fire up
any pending xfers. It doesn't really keep commands from getting destroyed
by loop down events, but at least minimizes the damage. This was much
easier to implement with CAM.
1999-02-09 00:42:22 +00:00
mjacob 6bcdc2b5d2 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:31:50 +00:00
mjacob e5e787230b clean up headers; move uninit/watch to outer layers 1998-12-28 19:10:43 +00:00