Commit Graph

18 Commits

Author SHA1 Message Date
Matt Jacob
c748b5e634 Explicitly decode GetAllNext SNS Response back *as*
a GetAllNext response. Otherwise, we won't unswizzle
it correctly. This was found on linux/PPC.

This mandated creating another inline: isp_get_gan_response.
2001-12-11 21:58:04 +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
9927912756 Macroize request/response in/out queue pointer access. 2001-07-04 18:52:23 +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
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
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
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
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
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
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
abde225be8 tighten up printout 2000-01-15 01:43:19 +00:00
Matt Jacob
32ecc7a2e7 oop, use PRINTF not printf in MI code 2000-01-04 05:17:48 +00:00
Matt Jacob
f38e1372e5 add isp_print_qentry inline function 2000-01-03 22:14:24 +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
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
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