ispvar.h revision 72938
150477Speter/* $FreeBSD: head/sys/dev/isp/ispvar.h 72938 2001-02-23 05:35:50Z mjacob $ */
235388Smjacob/*
335388Smjacob * Soft Definitions for for Qlogic ISP SCSI adapters.
435388Smjacob *
566189Smjacob * Copyright (c) 1997, 1998, 1999, 2000 by Matthew Jacob
635388Smjacob * All rights reserved.
752347Smjacob *
835388Smjacob * Redistribution and use in source and binary forms, with or without
935388Smjacob * modification, are permitted provided that the following conditions
1035388Smjacob * are met:
1135388Smjacob * 1. Redistributions of source code must retain the above copyright
1235388Smjacob *    notice immediately at the beginning of the file, without modification,
1335388Smjacob *    this list of conditions, and the following disclaimer.
1466189Smjacob * 2. The name of the author may not be used to endorse or promote products
1535388Smjacob *    derived from this software without specific prior written permission.
1635388Smjacob *
1735388Smjacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1835388Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1935388Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2035388Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
2135388Smjacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2235388Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2335388Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2435388Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2535388Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2635388Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2735388Smjacob * SUCH DAMAGE.
2835388Smjacob *
2935388Smjacob */
3035388Smjacob
3135388Smjacob#ifndef	_ISPVAR_H
3235388Smjacob#define	_ISPVAR_H
3335388Smjacob
3444819Smjacob#if defined(__NetBSD__) || defined(__OpenBSD__)
3535388Smjacob#include <dev/ic/ispmbox.h>
3653487Smjacob#ifdef	ISP_TARGET_MODE
3753487Smjacob#include <dev/ic/isp_target.h>
3856004Smjacob#include <dev/ic/isp_tpublic.h>
3935388Smjacob#endif
4053487Smjacob#endif
4135388Smjacob#ifdef	__FreeBSD__
4235388Smjacob#include <dev/isp/ispmbox.h>
4353487Smjacob#ifdef	ISP_TARGET_MODE
4453487Smjacob#include <dev/isp/isp_target.h>
4556004Smjacob#include <dev/isp/isp_tpublic.h>
4635388Smjacob#endif
4753487Smjacob#endif
4835388Smjacob#ifdef	__linux__
4942131Smjacob#include "ispmbox.h"
5053487Smjacob#ifdef	ISP_TARGET_MODE
5153487Smjacob#include "isp_target.h"
5256004Smjacob#include "isp_tpublic.h"
5335388Smjacob#endif
5453487Smjacob#endif
5535388Smjacob
5664087Smjacob#define	ISP_CORE_VERSION_MAJOR	2
5764087Smjacob#define	ISP_CORE_VERSION_MINOR	0
5839235Sgibbs
5935388Smjacob/*
6043420Smjacob * Vector for bus specific code to provide specific services.
6135388Smjacob */
6235388Smjacobstruct ispsoftc;
6335388Smjacobstruct ispmdvec {
6435388Smjacob	u_int16_t	(*dv_rd_reg) __P((struct ispsoftc *, int));
6535388Smjacob	void		(*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
6635388Smjacob	int		(*dv_mbxdma) __P((struct ispsoftc *));
6735388Smjacob	int		(*dv_dmaset) __P((struct ispsoftc *,
6864087Smjacob		XS_T *, ispreq_t *, u_int16_t *, u_int16_t));
6935388Smjacob	void		(*dv_dmaclr)
7064087Smjacob		__P((struct ispsoftc *, XS_T *, u_int32_t));
7135388Smjacob	void		(*dv_reset0) __P((struct ispsoftc *));
7235388Smjacob	void		(*dv_reset1) __P((struct ispsoftc *));
7364087Smjacob	void		(*dv_dregs) __P((struct ispsoftc *, const char *));
7461772Smjacob	const u_int16_t	*dv_ispfw;	/* ptr to f/w */
7535388Smjacob	u_int16_t	dv_conf1;
7635388Smjacob	u_int16_t	dv_clock;	/* clock frequency */
7735388Smjacob};
7835388Smjacob
7964087Smjacob/*
8064087Smjacob * Overall parameters
8164087Smjacob */
8235388Smjacob#define	MAX_TARGETS	16
8344819Smjacob#define	MAX_FC_TARG	256
8449909Smjacob#define	ISP_MAX_TARGETS(isp)	(IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
8561772Smjacob#define	ISP_MAX_LUNS(isp)	(isp)->isp_maxluns
8649909Smjacob
8753487Smjacob
8853487Smjacob/*
8964087Smjacob * Macros to access ISP registers through bus specific layers-
9064087Smjacob * mostly wrappers to vector through the mdvec structure.
9153487Smjacob */
9253487Smjacob
9353487Smjacob#define	ISP_READ(isp, reg)	\
9453487Smjacob	(*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
9553487Smjacob
9653487Smjacob#define	ISP_WRITE(isp, reg, val)	\
9753487Smjacob	(*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
9853487Smjacob
9953487Smjacob#define	ISP_MBOXDMASETUP(isp)	\
10053487Smjacob	(*(isp)->isp_mdvec->dv_mbxdma)((isp))
10153487Smjacob
10253487Smjacob#define	ISP_DMASETUP(isp, xs, req, iptrp, optr)	\
10353487Smjacob	(*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
10453487Smjacob
10553487Smjacob#define	ISP_DMAFREE(isp, xs, hndl)	\
10653487Smjacob	if ((isp)->isp_mdvec->dv_dmaclr) \
10753487Smjacob	    (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))
10853487Smjacob
10953487Smjacob#define	ISP_RESET0(isp)	\
11053487Smjacob	if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp))
11153487Smjacob#define	ISP_RESET1(isp)	\
11253487Smjacob	if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp))
11364087Smjacob#define	ISP_DUMPREGS(isp, m)	\
11464087Smjacob	if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp),(m))
11553487Smjacob
11653487Smjacob#define	ISP_SETBITS(isp, reg, val)	\
11753487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val))
11853487Smjacob
11953487Smjacob#define	ISP_CLRBITS(isp, reg, val)	\
12053487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val))
12153487Smjacob
12264087Smjacob/*
12364087Smjacob * The MEMORYBARRIER macro is defined per platform (to provide synchronization
12464087Smjacob * on Request and Response Queues, Scratch DMA areas, and Registers)
12564087Smjacob *
12664087Smjacob * Defined Memory Barrier Synchronization Types
12764087Smjacob */
12864087Smjacob#define	SYNC_REQUEST	0	/* request queue synchronization */
12964087Smjacob#define	SYNC_RESULT	1	/* result queue synchronization */
13064087Smjacob#define	SYNC_SFORDEV	2	/* scratch, sync for ISP */
13164087Smjacob#define	SYNC_SFORCPU	3	/* scratch, sync for CPU */
13264087Smjacob#define	SYNC_REG	4	/* for registers */
13364087Smjacob
13464087Smjacob/*
13564087Smjacob * Request/Response Queue defines and macros.
13664087Smjacob * The maximum is defined per platform (and can be based on board type).
13764087Smjacob */
13864087Smjacob/* This is the size of a queue entry (request and response) */
13939235Sgibbs#define	QENTRY_LEN			64
14064087Smjacob/* Both request and result queue length must be a power of two */
14164087Smjacob#define	RQUEST_QUEUE_LEN(x)		MAXISPREQUEST(x)
14264087Smjacob#define	RESULT_QUEUE_LEN(x)		\
14364087Smjacob	(((MAXISPREQUEST(x) >> 2) < 64)? 64 : MAXISPREQUEST(x) >> 2)
14439235Sgibbs#define	ISP_QUEUE_ENTRY(q, idx)		((q) + ((idx) * QENTRY_LEN))
14539235Sgibbs#define	ISP_QUEUE_SIZE(n)		((n) * QENTRY_LEN)
14639235Sgibbs#define	ISP_NXT_QENTRY(idx, qlen)	(((idx) + 1) & ((qlen)-1))
14765140Smjacob#define	ISP_QFREE(in, out, qlen)	\
14839235Sgibbs	((in == out)? (qlen - 1) : ((in > out)? \
14952347Smjacob	((qlen - 1) - (in - out)) : (out - in - 1)))
15065140Smjacob#define	ISP_QAVAIL(isp)	\
15165140Smjacob	ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp))
15253487Smjacob
15353487Smjacob#define	ISP_ADD_REQUEST(isp, iptr)	\
15464087Smjacob	MEMORYBARRIER(isp, SYNC_REQUEST, iptr, QENTRY_LEN); \
15564087Smjacob	ISP_WRITE(isp, INMAILBOX4, iptr); \
15664087Smjacob	isp->isp_reqidx = iptr
15753487Smjacob
15835388Smjacob/*
15946968Smjacob * SCSI Specific Host Adapter Parameters- per bus, per target
16035388Smjacob */
16135388Smjacob
16235388Smjacobtypedef struct {
16346968Smjacob	u_int		isp_gotdparms		: 1,
16452347Smjacob			isp_req_ack_active_neg	: 1,
16552347Smjacob			isp_data_line_active_neg: 1,
16635388Smjacob			isp_cmd_dma_burst_enable: 1,
16735388Smjacob			isp_data_dma_burst_enabl: 1,
16842461Smjacob			isp_fifo_threshold	: 3,
16943420Smjacob			isp_ultramode		: 1,
17035388Smjacob			isp_diffmode		: 1,
17145040Smjacob			isp_lvdmode		: 1,
17265140Smjacob			isp_fast_mttr		: 1,	/* fast sram */
17335388Smjacob			isp_initiator_id	: 4,
17452347Smjacob			isp_async_data_setup	: 4;
17552347Smjacob	u_int16_t	isp_selection_timeout;
17652347Smjacob	u_int16_t	isp_max_queue_depth;
17735388Smjacob	u_int8_t	isp_tag_aging;
17852347Smjacob	u_int8_t	isp_bus_reset_delay;
17952347Smjacob	u_int8_t	isp_retry_count;
18052347Smjacob	u_int8_t	isp_retry_delay;
18135388Smjacob	struct {
18246968Smjacob		u_int	dev_enable	:	1,	/* ignored */
18346968Smjacob					:	1,
18443420Smjacob			dev_update	:	1,
18543420Smjacob			dev_refresh	:	1,
18645040Smjacob			exc_throttle	:	8,
18745040Smjacob			cur_offset	:	4,
18845040Smjacob			sync_offset	:	4;
18945040Smjacob		u_int8_t	cur_period;	/* current sync period */
19045040Smjacob		u_int8_t	sync_period;	/* goal sync period */
19145040Smjacob		u_int16_t	dev_flags;	/* goal device flags */
19245040Smjacob		u_int16_t	cur_dflags;	/* current device flags */
19335388Smjacob	} isp_devparam[MAX_TARGETS];
19446968Smjacob} sdparam;
19535388Smjacob
19635388Smjacob/*
19735388Smjacob * Device Flags
19835388Smjacob */
19939235Sgibbs#define	DPARM_DISC	0x8000
20039235Sgibbs#define	DPARM_PARITY	0x4000
20139235Sgibbs#define	DPARM_WIDE	0x2000
20239235Sgibbs#define	DPARM_SYNC	0x1000
20339235Sgibbs#define	DPARM_TQING	0x0800
20439235Sgibbs#define	DPARM_ARQ	0x0400
20539235Sgibbs#define	DPARM_QFRZ	0x0200
20639235Sgibbs#define	DPARM_RENEG	0x0100
20765140Smjacob#define	DPARM_NARROW	0x0080
20865140Smjacob#define	DPARM_ASYNC	0x0040
20965140Smjacob#define	DPARM_PPR	0x0020
21043793Smjacob#define	DPARM_DEFAULT	(0xFF00 & ~DPARM_QFRZ)
21139235Sgibbs#define	DPARM_SAFE_DFLT	(DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
21235388Smjacob
21339235Sgibbs
21445040Smjacob/* technically, not really correct, as they need to be rated based upon clock */
21565140Smjacob#define	ISP_80M_SYNCPARMS	0x0c09
21665140Smjacob#define	ISP_40M_SYNCPARMS	0x0c0a
21765140Smjacob#define	ISP_20M_SYNCPARMS	0x0c0c
21865140Smjacob#define	ISP_20M_SYNCPARMS_1040	0x080c
21952347Smjacob#define	ISP_10M_SYNCPARMS	0x0c19
22052347Smjacob#define	ISP_08M_SYNCPARMS	0x0c25
22152347Smjacob#define	ISP_05M_SYNCPARMS	0x0c32
22252347Smjacob#define	ISP_04M_SYNCPARMS	0x0c41
22335388Smjacob
22435388Smjacob/*
22535388Smjacob * Fibre Channel Specifics
22635388Smjacob */
22752347Smjacob#define	FL_PORT_ID		0x7e	/* FL_Port Special ID */
22852347Smjacob#define	FC_PORT_ID		0x7f	/* Fabric Controller Special ID */
22952347Smjacob#define	FC_SNS_ID		0x80	/* SNS Server Special ID */
23052347Smjacob
23135388Smjacobtypedef struct {
23252347Smjacob	u_int32_t		isp_fwoptions	: 16,
23372355Smjacob						: 3,
23472355Smjacob				isp_iid_set	: 1,
23548484Smjacob				loop_seen_once	: 1,
23648484Smjacob				isp_loopstate	: 3,	/* Current Loop State */
23748484Smjacob				isp_fwstate	: 3,	/* ISP F/W state */
23848484Smjacob				isp_gotdparms	: 1,
23959454Smjacob				isp_topo	: 3,
24048484Smjacob				isp_onfabric	: 1;
24172355Smjacob	u_int8_t		isp_iid;	/* 'initiator' id */
24239235Sgibbs	u_int8_t		isp_loopid;	/* hard loop id */
24339235Sgibbs	u_int8_t		isp_alpa;	/* ALPA */
24472355Smjacob	u_int32_t		isp_portid;
24552347Smjacob	volatile u_int16_t	isp_lipseq;	/* LIP sequence # */
24672355Smjacob	u_int16_t		isp_xxxxxx;
24739235Sgibbs	u_int8_t		isp_execthrottle;
24852347Smjacob	u_int8_t		isp_retry_delay;
24952347Smjacob	u_int8_t		isp_retry_count;
25052347Smjacob	u_int8_t		isp_reserved;
25139235Sgibbs	u_int16_t		isp_maxalloc;
25239235Sgibbs	u_int16_t		isp_maxfrmlen;
25348484Smjacob	u_int64_t		isp_nodewwn;
25448484Smjacob	u_int64_t		isp_portwwn;
25535388Smjacob	/*
25648484Smjacob	 * Port Data Base. This is indexed by 'target', which is invariate.
25748484Smjacob	 * However, elements within can move around due to loop changes,
25848484Smjacob	 * so the actual loop ID passed to the F/W is in this structure.
25948484Smjacob	 * The first time the loop is seen up, loopid will match the index
26048484Smjacob	 * (except for fabric nodes which are above mapped above FC_SNS_ID
26148484Smjacob	 * and are completely virtual), but subsequent LIPs can cause things
26248484Smjacob	 * to move around.
26344819Smjacob	 */
26448484Smjacob	struct lportdb {
26552347Smjacob		u_int
26660221Smjacob					loopid		: 8,
26771079Smjacob							: 2,
26871079Smjacob					was_fabric_dev	: 1,
26971079Smjacob					fabric_dev	: 1,
27060221Smjacob					loggedin	: 1,
27160221Smjacob					roles		: 2,
27260221Smjacob					valid		: 1;
27352347Smjacob		u_int32_t		portid;
27448484Smjacob		u_int64_t		node_wwn;
27548484Smjacob		u_int64_t		port_wwn;
27672355Smjacob	} portdb[MAX_FC_TARG], tport[FC_PORT_ID];
27744819Smjacob
27844819Smjacob	/*
27935388Smjacob	 * Scratch DMA mapped in area to fetch Port Database stuff, etc.
28035388Smjacob	 */
28148195Smjacob	caddr_t			isp_scratch;
28235388Smjacob	u_int32_t		isp_scdma;
28335388Smjacob} fcparam;
28435388Smjacob
28548484Smjacob#define	FW_CONFIG_WAIT		0
28648484Smjacob#define	FW_WAIT_AL_PA		1
28748484Smjacob#define	FW_WAIT_LOGIN		2
28848484Smjacob#define	FW_READY		3
28948484Smjacob#define	FW_LOSS_OF_SYNC		4
29048484Smjacob#define	FW_ERROR		5
29148484Smjacob#define	FW_REINIT		6
29248484Smjacob#define	FW_NON_PART		7
29335388Smjacob
29448484Smjacob#define	LOOP_NIL		0
29548484Smjacob#define	LOOP_LIP_RCVD		1
29648484Smjacob#define	LOOP_PDB_RCVD		2
29772355Smjacob#define	LOOP_SCANNING_FABRIC	3
29872355Smjacob#define	LOOP_FSCAN_DONE		4
29972355Smjacob#define	LOOP_SCANNING_LOOP	5
30072355Smjacob#define	LOOP_LSCAN_DONE		4
30172355Smjacob#define	LOOP_SYNCING_PDB	6
30248484Smjacob#define	LOOP_READY		7
30335388Smjacob
30459454Smjacob#define	TOPO_NL_PORT		0
30559454Smjacob#define	TOPO_FL_PORT		1
30659454Smjacob#define	TOPO_N_PORT		2
30759454Smjacob#define	TOPO_F_PORT		3
30859454Smjacob#define	TOPO_PTP_STUB		4
30959454Smjacob
31042131Smjacob/*
31135388Smjacob * Soft Structure per host adapter
31235388Smjacob */
31365140Smjacobtypedef struct ispsoftc {
31435388Smjacob	/*
31535388Smjacob	 * Platform (OS) specific data
31635388Smjacob	 */
31735388Smjacob	struct isposinfo	isp_osinfo;
31835388Smjacob
31935388Smjacob	/*
32053487Smjacob	 * Pointer to bus specific functions and data
32135388Smjacob	 */
32235388Smjacob	struct ispmdvec *	isp_mdvec;
32335388Smjacob
32435388Smjacob	/*
32553487Smjacob	 * (Mostly) nonvolatile state. Board specific parameters
32653487Smjacob	 * may contain some volatile state (e.g., current loop state).
32735388Smjacob	 */
32835388Smjacob
32953487Smjacob	void * 			isp_param;	/* type specific */
33053487Smjacob	u_int16_t		isp_fwrev[3];	/* Loaded F/W revision */
33153487Smjacob	u_int16_t		isp_romfw_rev[3]; /* PROM F/W revision */
33253487Smjacob	u_int16_t		isp_maxcmds;	/* max possible I/O cmds */
33353487Smjacob	u_int8_t		isp_type;	/* HBA Chip Type */
33453487Smjacob	u_int8_t		isp_revision;	/* HBA Chip H/W Revision */
33561772Smjacob	u_int32_t		isp_maxluns;	/* maximum luns supported */
33635388Smjacob
33771079Smjacob	u_int32_t		isp_clock	: 8,	/* input clock */
33871079Smjacob						: 6,
33971079Smjacob				isp_role	: 2,
34071079Smjacob						: 1,
34153487Smjacob				isp_touched	: 1,	/* board ever seen? */
34253487Smjacob				isp_bustype	: 1,	/* SBus or PCI */
34365140Smjacob				isp_loaded_fw	: 1,	/* loaded firmware */
34471079Smjacob				isp_dblev	: 12;	/* debug log mask */
34571079Smjacob
34671079Smjacob	u_int32_t		isp_confopts;		/* config options */
34771079Smjacob
34869522Smjacob	/*
34969522Smjacob	 * Instrumentation
35069522Smjacob	 */
35169522Smjacob	u_int64_t		isp_intcnt;		/* total int count */
35269522Smjacob	u_int64_t		isp_intbogus;		/* spurious int count */
35339235Sgibbs
35435388Smjacob	/*
35539235Sgibbs	 * Volatile state
35635388Smjacob	 */
35735388Smjacob
35862171Smjacob	volatile u_int32_t
35962171Smjacob		isp_mboxbsy	:	8,	/* mailbox command active */
36062171Smjacob				:	1,
36139235Sgibbs		isp_state	:	3,
36246968Smjacob		isp_sendmarker	:	2,	/* send a marker entry */
36346968Smjacob		isp_update	:	2,	/* update parameters */
36452347Smjacob		isp_nactive	:	16;	/* how many commands active */
36552347Smjacob	volatile u_int16_t	isp_reqodx;	/* index of last ISP pickup */
36652347Smjacob	volatile u_int16_t	isp_reqidx;	/* index of next request */
36752347Smjacob	volatile u_int16_t	isp_residx;	/* index of next result */
36852347Smjacob	volatile u_int16_t	isp_lasthdls;	/* last handle seed */
36962171Smjacob	volatile u_int16_t	isp_mboxtmp[MAX_MAILBOX];
37071079Smjacob	volatile u_int16_t	isp_lastmbxcmd;	/* last mbox command sent */
37135388Smjacob
37235388Smjacob	/*
37353487Smjacob	 * Active commands are stored here, indexed by handle functions.
37435388Smjacob	 */
37564087Smjacob	XS_T **isp_xflist;
37635388Smjacob
37735388Smjacob	/*
37852347Smjacob	 * request/result queue pointers and dma handles for them.
37935388Smjacob	 */
38048195Smjacob	caddr_t			isp_rquest;
38148195Smjacob	caddr_t			isp_result;
38235388Smjacob	u_int32_t		isp_rquest_dma;
38335388Smjacob	u_int32_t		isp_result_dma;
38465140Smjacob} ispsoftc_t;
38535388Smjacob
38649909Smjacob#define	SDPARAM(isp)	((sdparam *) (isp)->isp_param)
38749909Smjacob#define	FCPARAM(isp)	((fcparam *) (isp)->isp_param)
38849909Smjacob
38935388Smjacob/*
39064087Smjacob * ISP Driver Run States
39135388Smjacob */
39235388Smjacob#define	ISP_NILSTATE	0
39335388Smjacob#define	ISP_RESETSTATE	1
39435388Smjacob#define	ISP_INITSTATE	2
39535388Smjacob#define	ISP_RUNSTATE	3
39635388Smjacob
39735388Smjacob/*
39835388Smjacob * ISP Configuration Options
39935388Smjacob */
40035388Smjacob#define	ISP_CFG_NORELOAD	0x80	/* don't download f/w */
40143793Smjacob#define	ISP_CFG_NONVRAM		0x40	/* ignore NVRAM */
40253487Smjacob#define	ISP_CFG_FULL_DUPLEX	0x01	/* Full Duplex (Fibre Channel only) */
40353487Smjacob#define	ISP_CFG_OWNWWN		0x02	/* override NVRAM wwn */
40469522Smjacob#define	ISP_CFG_PORT_PREF	0x0C	/* Mask for Port Prefs (2200 only) */
40569522Smjacob#define	ISP_CFG_LPORT		0x00	/* prefer {N/F}L-Port connection */
40669522Smjacob#define	ISP_CFG_NPORT		0x04	/* prefer {N/F}-Port connection */
40769522Smjacob#define	ISP_CFG_NPORT_ONLY	0x08	/* insist on {N/F}-Port connection */
40869522Smjacob#define	ISP_CFG_LPORT_ONLY	0x0C	/* insist on {N/F}L-Port connection */
40935388Smjacob
41064087Smjacob/*
41171079Smjacob * Prior to calling isp_reset for the first time, the outer layer
41271079Smjacob * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH.
41371079Smjacob *
41471079Smjacob * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded,
41571079Smjacob * NVRAM read, and defaults set, but any further initialization (e.g.
41671079Smjacob * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done.
41771079Smjacob *
41871079Smjacob * If INITIATOR MODE isn't set, attempts to run commands will be stopped
41971079Smjacob * at isp_start and completed with the moral equivalent of SELECTION TIMEOUT.
42071079Smjacob *
42171079Smjacob * If TARGET MODE is set, it doesn't mean that the rest of target mode support
42271079Smjacob * needs to be enabled, or will even work. What happens with the 2X00 cards
42371079Smjacob * here is that if you have enabled it with TARGET MODE as part of the ICB
42471079Smjacob * options, but you haven't given the f/w any ram resources for ATIOs or
42571079Smjacob * Immediate Notifies, the f/w just handles what it can and you never see
42671079Smjacob * anything. Basically, it sends a single byte of data (the first byte,
42771079Smjacob * which you can set as part of the INITIALIZE CONTROL BLOCK command) for
42871079Smjacob * INQUIRY, and sends back QUEUE FULL status for any other command.
42971079Smjacob *
43071079Smjacob */
43171079Smjacob#define	ISP_ROLE_NONE		0x0
43271079Smjacob#define	ISP_ROLE_INITIATOR	0x1
43371079Smjacob#define	ISP_ROLE_TARGET		0x2
43471079Smjacob#define	ISP_ROLE_BOTH		(ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
43571079Smjacob#define	ISP_ROLE_EITHER		ISP_ROLE_BOTH
43671079Smjacob#ifndef	ISP_DEFAULT_ROLES
43771079Smjacob#define	ISP_DEFAULT_ROLES	ISP_ROLE_INITIATOR
43871079Smjacob#endif
43971079Smjacob
44071079Smjacob
44171079Smjacob/*
44264087Smjacob * Firmware related defines
44364087Smjacob */
44471079Smjacob#define	ISP_CODE_ORG			0x1000	/* default f/w code start */
44545282Smjacob#define	ISP_FW_REV(maj, min, mic)	((maj << 24) | (min << 16) | mic)
44671079Smjacob#define	ISP_FW_REVX(xp)			((xp[0]<<24) | (xp[1] << 16) | xp[2])
44739235Sgibbs
44835388Smjacob/*
44939235Sgibbs * Bus (implementation) types
45035388Smjacob */
45139235Sgibbs#define	ISP_BT_PCI		0	/* PCI Implementations */
45239235Sgibbs#define	ISP_BT_SBUS		1	/* SBus Implementations */
45339235Sgibbs
45439235Sgibbs/*
45539235Sgibbs * Chip Types
45639235Sgibbs */
45735388Smjacob#define	ISP_HA_SCSI		0xf
45839235Sgibbs#define	ISP_HA_SCSI_UNKNOWN	0x1
45939235Sgibbs#define	ISP_HA_SCSI_1020	0x2
46039235Sgibbs#define	ISP_HA_SCSI_1020A	0x3
46139235Sgibbs#define	ISP_HA_SCSI_1040	0x4
46239235Sgibbs#define	ISP_HA_SCSI_1040A	0x5
46339235Sgibbs#define	ISP_HA_SCSI_1040B	0x6
46445282Smjacob#define	ISP_HA_SCSI_1040C	0x7
46554671Smjacob#define	ISP_HA_SCSI_1240	0x8
46654671Smjacob#define	ISP_HA_SCSI_1080	0x9
46754671Smjacob#define	ISP_HA_SCSI_1280	0xa
46857145Smjacob#define	ISP_HA_SCSI_12160	0xb
46935388Smjacob#define	ISP_HA_FC		0xf0
47035388Smjacob#define	ISP_HA_FC_2100		0x10
47148484Smjacob#define	ISP_HA_FC_2200		0x20
47235388Smjacob
47344819Smjacob#define	IS_SCSI(isp)	(isp->isp_type & ISP_HA_SCSI)
47454671Smjacob#define	IS_1240(isp)	(isp->isp_type == ISP_HA_SCSI_1240)
47544819Smjacob#define	IS_1080(isp)	(isp->isp_type == ISP_HA_SCSI_1080)
47654671Smjacob#define	IS_1280(isp)	(isp->isp_type == ISP_HA_SCSI_1280)
47757145Smjacob#define	IS_12160(isp)	(isp->isp_type == ISP_HA_SCSI_12160)
47857145Smjacob
47957145Smjacob#define	IS_12X0(isp)	(IS_1240(isp) || IS_1280(isp))
48057145Smjacob#define	IS_DUALBUS(isp)	(IS_12X0(isp) || IS_12160(isp))
48157145Smjacob#define	IS_ULTRA2(isp)	(IS_1080(isp) || IS_1280(isp) || IS_12160(isp))
48257145Smjacob#define	IS_ULTRA3(isp)	(IS_12160(isp))
48357145Smjacob
48444819Smjacob#define	IS_FC(isp)	(isp->isp_type & ISP_HA_FC)
48557145Smjacob#define	IS_2100(isp)	(isp->isp_type == ISP_HA_FC_2100)
48657145Smjacob#define	IS_2200(isp)	(isp->isp_type == ISP_HA_FC_2200)
48744819Smjacob
48864087Smjacob/*
48964087Smjacob * DMA cookie macros
49064087Smjacob */
49164087Smjacob#define	DMA_MSW(x)	(((x) >> 16) & 0xffff)
49264087Smjacob#define	DMA_LSW(x)	(((x) & 0xffff))
49357145Smjacob
49435388Smjacob/*
49564087Smjacob * Core System Function Prototypes
49635388Smjacob */
49735388Smjacob
49835388Smjacob/*
49939235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with
50039235Sgibbs * a call to isp_init.
50135388Smjacob */
50235388Smjacobvoid isp_reset __P((struct ispsoftc *));
50335388Smjacob
50435388Smjacob/*
50535388Smjacob * Initialize Hardware to known state
50635388Smjacob */
50735388Smjacobvoid isp_init __P((struct ispsoftc *));
50835388Smjacob
50935388Smjacob/*
51039235Sgibbs * Reset the ISP and call completion for any orphaned commands.
51139235Sgibbs */
51264087Smjacobvoid isp_reinit __P((struct ispsoftc *));
51339235Sgibbs
51439235Sgibbs/*
51535388Smjacob * Interrupt Service Routine
51635388Smjacob */
51735388Smjacobint isp_intr __P((void *));
51835388Smjacob
51935388Smjacob/*
52064087Smjacob * Command Entry Point- Platform Dependent layers call into this
52135388Smjacob */
52264087Smjacobint isp_start __P((XS_T *));
52364087Smjacob/* these values are what isp_start returns */
52464087Smjacob#define	CMD_COMPLETE	101	/* command completed */
52564087Smjacob#define	CMD_EAGAIN	102	/* busy- maybe retry later */
52664087Smjacob#define	CMD_QUEUED	103	/* command has been queued for execution */
52764087Smjacob#define	CMD_RQLATER 	104	/* requeue this command later */
52835388Smjacob
52939235Sgibbs/*
53064087Smjacob * Command Completion Point- Core layers call out from this with completed cmds
53164087Smjacob */
53264087Smjacobvoid isp_done __P((XS_T *));
53364087Smjacob
53464087Smjacob/*
53543420Smjacob * Platform Dependent to External to Internal Control Function
53639235Sgibbs *
53772355Smjacob * Assumes locks are held on entry. You should note that with many of
53872355Smjacob * these commands and locks may be released while this is occurring.
53939235Sgibbs *
54072355Smjacob * A few notes about some of these functions:
54172355Smjacob *
54272355Smjacob * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
54372355Smjacob * The argument is a pointer to an integer which is the time, in microseconds,
54472355Smjacob * we should wait to see whether we have good link. This test, if successful,
54572355Smjacob * lets us know our connection topology and our Loop ID/AL_PA and so on.
54672355Smjacob * You can't get anywhere without this.
54772355Smjacob *
54872355Smjacob * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
54972355Smjacob * all entities using the FC Generic Services subcommand GET ALL NEXT.
55072355Smjacob * For each found entity, an ISPASYNC_FABRICDEV event is generated (see
55172355Smjacob * below).
55272355Smjacob *
55372355Smjacob * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
55472355Smjacob * topology is NL or FL port (private or public loop). Since the Qlogic f/w
55572355Smjacob * 'automatically' manages local loop connections, this function essentially
55672355Smjacob * notes the arrival, departure, and possible shuffling around of local loop
55772355Smjacob * entities. Thus for each arrival and departure this generates an isp_async
55872355Smjacob * event of ISPASYNC_PROMENADE (see below).
55972355Smjacob *
56072355Smjacob * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
56172355Smjacob * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
56272355Smjacob * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging
56372355Smjacob * and logging out of fabric devices (if one is on a fabric) and then marking
56472355Smjacob * the 'loop state' as being ready to now be used for sending commands to
56572355Smjacob * devices. Originally fabric name server and local loop scanning were
56672355Smjacob * part of this function. It's now been seperated to allow for finer control.
56739235Sgibbs */
56839235Sgibbstypedef enum {
56948484Smjacob	ISPCTL_RESET_BUS,		/* Reset Bus */
57048484Smjacob	ISPCTL_RESET_DEV,		/* Reset Device */
57148484Smjacob	ISPCTL_ABORT_CMD,		/* Abort Command */
57272355Smjacob	ISPCTL_UPDATE_PARAMS,		/* Update Operating Parameters (SCSI) */
57355364Smjacob	ISPCTL_FCLINK_TEST,		/* Test FC Link Status */
57472355Smjacob	ISPCTL_SCAN_FABRIC,		/* (Re)scan Fabric Name Server */
57572355Smjacob	ISPCTL_SCAN_LOOP,		/* (Re)scan Local Loop */
57655364Smjacob	ISPCTL_PDB_SYNC,		/* Synchronize Port Database */
57772355Smjacob	ISPCTL_SEND_LIP,		/* Send a LIP */
57872355Smjacob	ISPCTL_GET_POSMAP,		/* Get FC-AL position map */
57972938Smjacob	ISPCTL_RUN_MBOXCMD,		/* run a mailbox command */
58055364Smjacob	ISPCTL_TOGGLE_TMODE		/* toggle target mode */
58139235Sgibbs} ispctl_t;
58239235Sgibbsint isp_control __P((struct ispsoftc *, ispctl_t, void *));
58339235Sgibbs
58443420Smjacob
58539235Sgibbs/*
58643420Smjacob * Platform Dependent to Internal to External Control Function
58743420Smjacob * (each platform must provide such a function)
58843420Smjacob *
58972355Smjacob * Assumes locks are held.
59072355Smjacob *
59172355Smjacob * A few notes about some of these functions:
59272355Smjacob *
59372355Smjacob * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
59472355Smjacob * occurred that invalidates the list of fabric devices known and/or
59572355Smjacob * the list of known loop devices. The argument passed is a pointer
59672355Smjacob * whose values are defined below  (local loop change, name server
59772355Smjacob * change, other). 'Other' may simply be a LIP, or a change in
59872355Smjacob * connection topology.
59972355Smjacob *
60072355Smjacob * ISPASYNC_FABRIC_DEV announces the next element in a list of
60172355Smjacob * fabric device names we're getting out of the name server. The
60272355Smjacob * argument points to a GET ALL NEXT response structure. The list
60372355Smjacob * is known to terminate with an entry that refers to ourselves.
60472355Smjacob * One of the main purposes of this function is to allow outer
60572355Smjacob * layers, which are OS dependent, to set policy as to which fabric
60672355Smjacob * devices might actually be logged into (and made visible) later
60772355Smjacob * at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric
60872355Smjacob * devices that we can log into (256 less 3 'reserved' for F-port
60972355Smjacob * topologies), and fabrics can grow up to 8 million or so entries
61072355Smjacob * (24 bits of Port Address, less a wad of reserved spaces), clearly
61172355Smjacob * we had better let the OS determine login policy.
61272355Smjacob *
61372355Smjacob * ISPASYNC_PROMENADE has an argument that is a pointer to an integer which
61472355Smjacob * is an index into the portdb in the softc ('target'). Whether that entrie's
61572355Smjacob * valid tag is set or not says whether something has arrived or departed.
61672355Smjacob * The name refers to a favorite pastime of many city dwellers- watching
61772355Smjacob * people come and go, talking of Michaelangelo, and so on..
61872938Smjacob *
61972938Smjacob * ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a
62072938Smjacob * response queue entry not otherwise handled. The outer layer should
62172938Smjacob * return non-zero if it handled it. The 'arg' points to a (possibly only
62272938Smjacob * partially) massaged response queue entry (see the platform's
62372938Smjacob * ISP_UNSWIZZLE_RESPONSE macro).
62443420Smjacob */
62543420Smjacob
62643420Smjacobtypedef enum {
62772355Smjacob	ISPASYNC_NEW_TGT_PARAMS,	/* New Target Parameters Negotiated */
62848484Smjacob	ISPASYNC_BUS_RESET,		/* Bus Was Reset */
62948484Smjacob	ISPASYNC_LOOP_DOWN,		/* FC Loop Down */
63048484Smjacob	ISPASYNC_LOOP_UP,		/* FC Loop Up */
63172355Smjacob	ISPASYNC_CHANGE_NOTIFY,		/* FC Change Notification */
63272355Smjacob	ISPASYNC_FABRIC_DEV,		/* FC Fabric Device Arrival */
63372355Smjacob	ISPASYNC_PROMENADE,		/* FC Objects coming && going */
63455364Smjacob	ISPASYNC_TARGET_MESSAGE,	/* target message */
63555364Smjacob	ISPASYNC_TARGET_EVENT,		/* target asynchronous event */
63672355Smjacob	ISPASYNC_TARGET_ACTION,		/* other target command action */
63772938Smjacob	ISPASYNC_CONF_CHANGE,		/* Platform Configuration Change */
63872938Smjacob	ISPASYNC_UNHANDLED_RESPONSE	/* Unhandled Response Entry */
63943420Smjacob} ispasync_t;
64043420Smjacobint isp_async __P((struct ispsoftc *, ispasync_t, void *));
64143420Smjacob
64272355Smjacob#define	ISPASYNC_CHANGE_PDB	((void *) 0)
64372355Smjacob#define	ISPASYNC_CHANGE_SNS	((void *) 1)
64472355Smjacob#define	ISPASYNC_CHANGE_OTHER	((void *) 2)
64572355Smjacob
64643420Smjacob/*
64764087Smjacob * Platform Dependent Error and Debug Printout
64839235Sgibbs */
64970490Smjacob#ifdef	__GNUC__
65070490Smjacobvoid isp_prt __P((struct ispsoftc *, int level, const char *, ...))
65170490Smjacob	__attribute__((__format__(__printf__,3,4)));
65270490Smjacob#else
65364087Smjacobvoid isp_prt __P((struct ispsoftc *, int level, const char *, ...));
65470490Smjacob#endif
65570490Smjacob
65664087Smjacob#define	ISP_LOGALL	0x0	/* log always */
65764087Smjacob#define	ISP_LOGCONFIG	0x1	/* log configuration messages */
65864087Smjacob#define	ISP_LOGINFO	0x2	/* log informational messages */
65964087Smjacob#define	ISP_LOGWARN	0x4	/* log warning messages */
66064087Smjacob#define	ISP_LOGERR	0x8	/* log error messages */
66164087Smjacob#define	ISP_LOGDEBUG0	0x10	/* log simple debug messages */
66264087Smjacob#define	ISP_LOGDEBUG1	0x20	/* log intermediate debug messages */
66364087Smjacob#define	ISP_LOGDEBUG2	0x40	/* log most debug messages */
66464087Smjacob#define	ISP_LOGDEBUG3	0x100	/* log high frequency debug messages */
66564087Smjacob#define	ISP_LOGTDEBUG0	0x200	/* log simple debug messages (target mode) */
66664087Smjacob#define	ISP_LOGTDEBUG1	0x400	/* log intermediate debug messages (target) */
66764087Smjacob#define	ISP_LOGTDEBUG2	0x800	/* log all debug messages (target) */
66839235Sgibbs
66964087Smjacob/*
67064087Smjacob * Each Platform provides it's own isposinfo substructure of the ispsoftc
67164087Smjacob * defined above.
67264087Smjacob *
67364087Smjacob * Each platform must also provide the following macros/defines:
67464087Smjacob *
67564087Smjacob *
67664087Smjacob *	INLINE		-	platform specific define for 'inline' functions
67764087Smjacob *
67864087Smjacob *	ISP2100_SCRLEN	-	length for the Fibre Channel scratch DMA area
67964087Smjacob *
68064087Smjacob *	MEMZERO(dst, src)			platform zeroing function
68164087Smjacob *	MEMCPY(dst, src, count)			platform copying function
68264087Smjacob *	SNPRINTF(buf, bufsize, fmt, ...)	snprintf
68364087Smjacob *	STRNCAT(dstbuf, size, srcbuf)		strncat
68464087Smjacob *	USEC_DELAY(usecs)			microsecond spindelay function
68569522Smjacob *	USEC_SLEEP(isp, usecs)			microsecond sleep function
68664087Smjacob *
68764087Smjacob *	NANOTIME_T				nanosecond time type
68864087Smjacob *
68964087Smjacob *	GET_NANOTIME(NANOTIME_T *)		get current nanotime.
69064087Smjacob *
69164087Smjacob *	GET_NANOSEC(NANOTIME_T *)		get u_int64_t from NANOTIME_T
69264087Smjacob *
69364087Smjacob *	NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
69464087Smjacob *						subtract two NANOTIME_T values
69564087Smjacob *
69664087Smjacob *
69764087Smjacob *	MAXISPREQUEST(struct ispsoftc *)	maximum request queue size
69864087Smjacob *						for this particular board type
69964087Smjacob *
70064087Smjacob *	MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size)
70164087Smjacob *
70264087Smjacob *		Function/Macro the provides memory synchronization on
70364087Smjacob *		various objects so that the ISP's and the system's view
70464087Smjacob *		of the same object is consistent.
70564087Smjacob *
70664087Smjacob *	MBOX_ACQUIRE(struct ispsoftc *)		acquire lock on mailbox regs
70764087Smjacob *	MBOX_WAIT_COMPLETE(struct ispsoftc *)	wait for mailbox cmd to be done
70864087Smjacob *	MBOX_NOTIFY_COMPLETE(struct ispsoftc *)	notification of mbox cmd donee
70964087Smjacob *	MBOX_RELEASE(struct ispsoftc *)		release lock on mailbox regs
71064087Smjacob *
71172355Smjacob *
71264087Smjacob *	SCSI_GOOD	SCSI 'Good' Status
71364087Smjacob *	SCSI_CHECK	SCSI 'Check Condition' Status
71464087Smjacob *	SCSI_BUSY	SCSI 'Busy' Status
71564087Smjacob *	SCSI_QFULL	SCSI 'Queue Full' Status
71664087Smjacob *
71764087Smjacob *	XS_T		Platform SCSI transaction type (i.e., command for HBA)
71864087Smjacob *	XS_ISP(xs)	gets an instance out of an XS_T
71964087Smjacob *	XS_CHANNEL(xs)	gets the channel (bus # for DUALBUS cards) ""
72064087Smjacob *	XS_TGT(xs)	gets the target ""
72164087Smjacob *	XS_LUN(xs)	gets the lun ""
72264087Smjacob *	XS_CDBP(xs)	gets a pointer to the scsi CDB ""
72364087Smjacob *	XS_CDBLEN(xs)	gets the CDB's length ""
72464087Smjacob *	XS_XFRLEN(xs)	gets the associated data transfer length ""
72564087Smjacob *	XS_TIME(xs)	gets the time (in milliseconds) for this command
72664087Smjacob *	XS_RESID(xs)	gets the current residual count
72764087Smjacob *	XS_STSP(xs)	gets a pointer to the SCSI status byte ""
72864087Smjacob *	XS_SNSP(xs)	gets a pointer to the associate sense data
72964087Smjacob *	XS_SNSLEN(xs)	gets the length of sense data storage
73064087Smjacob *	XS_SNSKEY(xs)	dereferences XS_SNSP to get the current stored Sense Key
73164087Smjacob *	XS_TAG_P(xs)	predicate of whether this command should be tagged
73264087Smjacob *	XS_TAG_TYPE(xs)	which type of tag to use
73364087Smjacob *	XS_SETERR(xs)	set error state
73464087Smjacob *
73564087Smjacob *		HBA_NOERROR	command has no erros
73664087Smjacob *		HBA_BOTCH	hba botched something
73764087Smjacob *		HBA_CMDTIMEOUT	command timed out
73864087Smjacob *		HBA_SELTIMEOUT	selection timed out (also port logouts for FC)
73964087Smjacob *		HBA_TGTBSY	target returned a BUSY status
74064087Smjacob *		HBA_BUSRESET	bus reset destroyed command
74164087Smjacob *		HBA_ABORTED	command was aborted (by request)
74264087Smjacob *		HBA_DATAOVR	a data overrun was detected
74364087Smjacob *		HBA_ARQFAIL	Automatic Request Sense failed
74464087Smjacob *
74564087Smjacob *	XS_ERR(xs)	return current error state
74664087Smjacob *	XS_NOERR(xs)	there is no error currently set
74764087Smjacob *	XS_INITERR(xs)	initialize error state
74864087Smjacob *
74964087Smjacob *	XS_SAVE_SENSE(xs, sp)		save sense data
75064087Smjacob *
75164087Smjacob *	XS_SET_STATE_STAT(isp, sp, xs)	platform dependent interpreter of
75264087Smjacob *					response queue entry status bits
75364087Smjacob *
75464087Smjacob *
75564087Smjacob *	DEFAULT_IID(struct ispsoftc *)		Default SCSI initiator ID
75664087Smjacob *	DEFAULT_LOOPID(struct ispsoftc *)	Default FC Loop ID
75767047Smjacob *	DEFAULT_NODEWWN(struct ispsoftc *)	Default Node WWN
75867047Smjacob *	DEFAULT_PORTWWN(struct ispsoftc *)	Default Port WWN
75967047Smjacob *		These establish reasonable defaults for each platform.
76067047Smjacob * 		These must be available independent of card NVRAM and are
76167047Smjacob *		to be used should NVRAM not be readable.
76264087Smjacob *
76367047Smjacob *	ISP_NODEWWN(struct ispsoftc *)	FC Node WWN to use
76467047Smjacob *	ISP_PORTWWN(struct ispsoftc *)	FC Port WWN to use
76564087Smjacob *
76667047Smjacob *		These are to be used after NVRAM is read. The tags
76767047Smjacob *		in fcparam.isp_{node,port}wwn reflect the values
76867047Smjacob *		read from NVRAM (possibly corrected for card botches).
76967047Smjacob *		Each platform can take that information and override
77067047Smjacob *		it or ignore and return the Node and Port WWNs to be
77167047Smjacob * 		used when sending the Qlogic f/w the Initialization Control
77267047Smjacob *		Block.
77364087Smjacob *
77464087Smjacob *	(XXX these do endian specific transformations- in transition XXX)
77564087Smjacob *	ISP_SWIZZLE_ICB
77664087Smjacob *	ISP_UNSWIZZLE_AND_COPY_PDBP
77764087Smjacob *	ISP_SWIZZLE_CONTINUATION
77864087Smjacob *	ISP_SWIZZLE_REQUEST
77964087Smjacob *	ISP_UNSWIZZLE_RESPONSE
78064087Smjacob *	ISP_SWIZZLE_SNS_REQ
78164087Smjacob *	ISP_UNSWIZZLE_SNS_RSP
78264087Smjacob *	ISP_SWIZZLE_NVRAM_WORD
78364087Smjacob *
78464087Smjacob *
78564087Smjacob */
78635388Smjacob#endif	/* _ISPVAR_H */
787