ispvar.h revision 77776
150477Speter/* $FreeBSD: head/sys/dev/isp/ispvar.h 77776 2001-06-05 17:11:06Z 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
5773530Smjacob#define	ISP_CORE_VERSION_MINOR	1
5839235Sgibbs
5935388Smjacob/*
6043420Smjacob * Vector for bus specific code to provide specific services.
6135388Smjacob */
6235388Smjacobstruct ispsoftc;
6335388Smjacobstruct ispmdvec {
6474229Smjacob	u_int16_t	(*dv_rd_reg) (struct ispsoftc *, int);
6574229Smjacob	void		(*dv_wr_reg) (struct ispsoftc *, int, u_int16_t);
6674229Smjacob	int		(*dv_mbxdma) (struct ispsoftc *);
6774229Smjacob	int		(*dv_dmaset) (struct ispsoftc *,
6874229Smjacob		XS_T *, ispreq_t *, u_int16_t *, u_int16_t);
6935388Smjacob	void		(*dv_dmaclr)
7074229Smjacob		(struct ispsoftc *, XS_T *, u_int16_t);
7174229Smjacob	void		(*dv_reset0) (struct ispsoftc *);
7274229Smjacob	void		(*dv_reset1) (struct ispsoftc *);
7374229Smjacob	void		(*dv_dregs) (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,
23377776Smjacob						: 2,
23472355Smjacob				isp_iid_set	: 1,
23548484Smjacob				loop_seen_once	: 1,
23677776Smjacob				isp_loopstate	: 4,	/* 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,
26777776Smjacob							: 1,
26877776Smjacob					force_logout	: 1,
26971079Smjacob					was_fabric_dev	: 1,
27071079Smjacob					fabric_dev	: 1,
27160221Smjacob					loggedin	: 1,
27260221Smjacob					roles		: 2,
27360221Smjacob					valid		: 1;
27452347Smjacob		u_int32_t		portid;
27548484Smjacob		u_int64_t		node_wwn;
27648484Smjacob		u_int64_t		port_wwn;
27772355Smjacob	} portdb[MAX_FC_TARG], tport[FC_PORT_ID];
27844819Smjacob
27944819Smjacob	/*
28035388Smjacob	 * Scratch DMA mapped in area to fetch Port Database stuff, etc.
28135388Smjacob	 */
28248195Smjacob	caddr_t			isp_scratch;
28335388Smjacob	u_int32_t		isp_scdma;
28435388Smjacob} fcparam;
28535388Smjacob
28648484Smjacob#define	FW_CONFIG_WAIT		0
28748484Smjacob#define	FW_WAIT_AL_PA		1
28848484Smjacob#define	FW_WAIT_LOGIN		2
28948484Smjacob#define	FW_READY		3
29048484Smjacob#define	FW_LOSS_OF_SYNC		4
29148484Smjacob#define	FW_ERROR		5
29248484Smjacob#define	FW_REINIT		6
29348484Smjacob#define	FW_NON_PART		7
29435388Smjacob
29548484Smjacob#define	LOOP_NIL		0
29648484Smjacob#define	LOOP_LIP_RCVD		1
29748484Smjacob#define	LOOP_PDB_RCVD		2
29872355Smjacob#define	LOOP_SCANNING_FABRIC	3
29972355Smjacob#define	LOOP_FSCAN_DONE		4
30072355Smjacob#define	LOOP_SCANNING_LOOP	5
30177776Smjacob#define	LOOP_LSCAN_DONE		6
30277776Smjacob#define	LOOP_SYNCING_PDB	7
30377776Smjacob#define	LOOP_READY		8
30435388Smjacob
30559454Smjacob#define	TOPO_NL_PORT		0
30659454Smjacob#define	TOPO_FL_PORT		1
30759454Smjacob#define	TOPO_N_PORT		2
30859454Smjacob#define	TOPO_F_PORT		3
30959454Smjacob#define	TOPO_PTP_STUB		4
31059454Smjacob
31142131Smjacob/*
31235388Smjacob * Soft Structure per host adapter
31335388Smjacob */
31465140Smjacobtypedef struct ispsoftc {
31535388Smjacob	/*
31635388Smjacob	 * Platform (OS) specific data
31735388Smjacob	 */
31835388Smjacob	struct isposinfo	isp_osinfo;
31935388Smjacob
32035388Smjacob	/*
32153487Smjacob	 * Pointer to bus specific functions and data
32235388Smjacob	 */
32335388Smjacob	struct ispmdvec *	isp_mdvec;
32435388Smjacob
32535388Smjacob	/*
32653487Smjacob	 * (Mostly) nonvolatile state. Board specific parameters
32753487Smjacob	 * may contain some volatile state (e.g., current loop state).
32835388Smjacob	 */
32935388Smjacob
33053487Smjacob	void * 			isp_param;	/* type specific */
33153487Smjacob	u_int16_t		isp_fwrev[3];	/* Loaded F/W revision */
33253487Smjacob	u_int16_t		isp_romfw_rev[3]; /* PROM F/W revision */
33353487Smjacob	u_int16_t		isp_maxcmds;	/* max possible I/O cmds */
33453487Smjacob	u_int8_t		isp_type;	/* HBA Chip Type */
33553487Smjacob	u_int8_t		isp_revision;	/* HBA Chip H/W Revision */
33661772Smjacob	u_int32_t		isp_maxluns;	/* maximum luns supported */
33735388Smjacob
33871079Smjacob	u_int32_t		isp_clock	: 8,	/* input clock */
33971079Smjacob						: 6,
34071079Smjacob				isp_role	: 2,
34171079Smjacob						: 1,
34253487Smjacob				isp_touched	: 1,	/* board ever seen? */
34353487Smjacob				isp_bustype	: 1,	/* SBus or PCI */
34465140Smjacob				isp_loaded_fw	: 1,	/* loaded firmware */
34571079Smjacob				isp_dblev	: 12;	/* debug log mask */
34671079Smjacob
34771079Smjacob	u_int32_t		isp_confopts;		/* config options */
34871079Smjacob
34969522Smjacob	/*
35069522Smjacob	 * Instrumentation
35169522Smjacob	 */
35269522Smjacob	u_int64_t		isp_intcnt;		/* total int count */
35369522Smjacob	u_int64_t		isp_intbogus;		/* spurious int count */
35439235Sgibbs
35535388Smjacob	/*
35639235Sgibbs	 * Volatile state
35735388Smjacob	 */
35835388Smjacob
35962171Smjacob	volatile u_int32_t
36062171Smjacob		isp_mboxbsy	:	8,	/* mailbox command active */
36162171Smjacob				:	1,
36239235Sgibbs		isp_state	:	3,
36346968Smjacob		isp_sendmarker	:	2,	/* send a marker entry */
36446968Smjacob		isp_update	:	2,	/* update parameters */
36552347Smjacob		isp_nactive	:	16;	/* how many commands active */
36652347Smjacob	volatile u_int16_t	isp_reqodx;	/* index of last ISP pickup */
36752347Smjacob	volatile u_int16_t	isp_reqidx;	/* index of next request */
36852347Smjacob	volatile u_int16_t	isp_residx;	/* index of next result */
36952347Smjacob	volatile u_int16_t	isp_lasthdls;	/* last handle seed */
37062171Smjacob	volatile u_int16_t	isp_mboxtmp[MAX_MAILBOX];
37171079Smjacob	volatile u_int16_t	isp_lastmbxcmd;	/* last mbox command sent */
37235388Smjacob
37335388Smjacob	/*
37453487Smjacob	 * Active commands are stored here, indexed by handle functions.
37535388Smjacob	 */
37664087Smjacob	XS_T **isp_xflist;
37735388Smjacob
37835388Smjacob	/*
37952347Smjacob	 * request/result queue pointers and dma handles for them.
38035388Smjacob	 */
38148195Smjacob	caddr_t			isp_rquest;
38248195Smjacob	caddr_t			isp_result;
38335388Smjacob	u_int32_t		isp_rquest_dma;
38435388Smjacob	u_int32_t		isp_result_dma;
38565140Smjacob} ispsoftc_t;
38635388Smjacob
38749909Smjacob#define	SDPARAM(isp)	((sdparam *) (isp)->isp_param)
38849909Smjacob#define	FCPARAM(isp)	((fcparam *) (isp)->isp_param)
38949909Smjacob
39035388Smjacob/*
39164087Smjacob * ISP Driver Run States
39235388Smjacob */
39335388Smjacob#define	ISP_NILSTATE	0
39435388Smjacob#define	ISP_RESETSTATE	1
39535388Smjacob#define	ISP_INITSTATE	2
39635388Smjacob#define	ISP_RUNSTATE	3
39735388Smjacob
39835388Smjacob/*
39935388Smjacob * ISP Configuration Options
40035388Smjacob */
40135388Smjacob#define	ISP_CFG_NORELOAD	0x80	/* don't download f/w */
40243793Smjacob#define	ISP_CFG_NONVRAM		0x40	/* ignore NVRAM */
40353487Smjacob#define	ISP_CFG_FULL_DUPLEX	0x01	/* Full Duplex (Fibre Channel only) */
40453487Smjacob#define	ISP_CFG_OWNWWN		0x02	/* override NVRAM wwn */
40569522Smjacob#define	ISP_CFG_PORT_PREF	0x0C	/* Mask for Port Prefs (2200 only) */
40669522Smjacob#define	ISP_CFG_LPORT		0x00	/* prefer {N/F}L-Port connection */
40769522Smjacob#define	ISP_CFG_NPORT		0x04	/* prefer {N/F}-Port connection */
40869522Smjacob#define	ISP_CFG_NPORT_ONLY	0x08	/* insist on {N/F}-Port connection */
40969522Smjacob#define	ISP_CFG_LPORT_ONLY	0x0C	/* insist on {N/F}L-Port connection */
41035388Smjacob
41164087Smjacob/*
41271079Smjacob * Prior to calling isp_reset for the first time, the outer layer
41371079Smjacob * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH.
41471079Smjacob *
41571079Smjacob * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded,
41671079Smjacob * NVRAM read, and defaults set, but any further initialization (e.g.
41771079Smjacob * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done.
41871079Smjacob *
41971079Smjacob * If INITIATOR MODE isn't set, attempts to run commands will be stopped
42071079Smjacob * at isp_start and completed with the moral equivalent of SELECTION TIMEOUT.
42171079Smjacob *
42271079Smjacob * If TARGET MODE is set, it doesn't mean that the rest of target mode support
42371079Smjacob * needs to be enabled, or will even work. What happens with the 2X00 cards
42471079Smjacob * here is that if you have enabled it with TARGET MODE as part of the ICB
42571079Smjacob * options, but you haven't given the f/w any ram resources for ATIOs or
42671079Smjacob * Immediate Notifies, the f/w just handles what it can and you never see
42771079Smjacob * anything. Basically, it sends a single byte of data (the first byte,
42871079Smjacob * which you can set as part of the INITIALIZE CONTROL BLOCK command) for
42971079Smjacob * INQUIRY, and sends back QUEUE FULL status for any other command.
43071079Smjacob *
43171079Smjacob */
43271079Smjacob#define	ISP_ROLE_NONE		0x0
43371079Smjacob#define	ISP_ROLE_INITIATOR	0x1
43471079Smjacob#define	ISP_ROLE_TARGET		0x2
43571079Smjacob#define	ISP_ROLE_BOTH		(ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
43671079Smjacob#define	ISP_ROLE_EITHER		ISP_ROLE_BOTH
43771079Smjacob#ifndef	ISP_DEFAULT_ROLES
43871079Smjacob#define	ISP_DEFAULT_ROLES	ISP_ROLE_INITIATOR
43971079Smjacob#endif
44071079Smjacob
44171079Smjacob
44271079Smjacob/*
44364087Smjacob * Firmware related defines
44464087Smjacob */
44571079Smjacob#define	ISP_CODE_ORG			0x1000	/* default f/w code start */
44645282Smjacob#define	ISP_FW_REV(maj, min, mic)	((maj << 24) | (min << 16) | mic)
44771079Smjacob#define	ISP_FW_REVX(xp)			((xp[0]<<24) | (xp[1] << 16) | xp[2])
44839235Sgibbs
44935388Smjacob/*
45039235Sgibbs * Bus (implementation) types
45135388Smjacob */
45239235Sgibbs#define	ISP_BT_PCI		0	/* PCI Implementations */
45339235Sgibbs#define	ISP_BT_SBUS		1	/* SBus Implementations */
45439235Sgibbs
45539235Sgibbs/*
45639235Sgibbs * Chip Types
45739235Sgibbs */
45835388Smjacob#define	ISP_HA_SCSI		0xf
45939235Sgibbs#define	ISP_HA_SCSI_UNKNOWN	0x1
46039235Sgibbs#define	ISP_HA_SCSI_1020	0x2
46139235Sgibbs#define	ISP_HA_SCSI_1020A	0x3
46239235Sgibbs#define	ISP_HA_SCSI_1040	0x4
46339235Sgibbs#define	ISP_HA_SCSI_1040A	0x5
46439235Sgibbs#define	ISP_HA_SCSI_1040B	0x6
46545282Smjacob#define	ISP_HA_SCSI_1040C	0x7
46654671Smjacob#define	ISP_HA_SCSI_1240	0x8
46754671Smjacob#define	ISP_HA_SCSI_1080	0x9
46854671Smjacob#define	ISP_HA_SCSI_1280	0xa
46957145Smjacob#define	ISP_HA_SCSI_12160	0xb
47035388Smjacob#define	ISP_HA_FC		0xf0
47135388Smjacob#define	ISP_HA_FC_2100		0x10
47248484Smjacob#define	ISP_HA_FC_2200		0x20
47377365Smjacob#define	ISP_HA_FC_2300		0x30
47435388Smjacob
47544819Smjacob#define	IS_SCSI(isp)	(isp->isp_type & ISP_HA_SCSI)
47654671Smjacob#define	IS_1240(isp)	(isp->isp_type == ISP_HA_SCSI_1240)
47744819Smjacob#define	IS_1080(isp)	(isp->isp_type == ISP_HA_SCSI_1080)
47854671Smjacob#define	IS_1280(isp)	(isp->isp_type == ISP_HA_SCSI_1280)
47957145Smjacob#define	IS_12160(isp)	(isp->isp_type == ISP_HA_SCSI_12160)
48057145Smjacob
48157145Smjacob#define	IS_12X0(isp)	(IS_1240(isp) || IS_1280(isp))
48257145Smjacob#define	IS_DUALBUS(isp)	(IS_12X0(isp) || IS_12160(isp))
48357145Smjacob#define	IS_ULTRA2(isp)	(IS_1080(isp) || IS_1280(isp) || IS_12160(isp))
48457145Smjacob#define	IS_ULTRA3(isp)	(IS_12160(isp))
48557145Smjacob
48677365Smjacob#define	IS_FC(isp)	((isp)->isp_type & ISP_HA_FC)
48777365Smjacob#define	IS_2100(isp)	((isp)->isp_type == ISP_HA_FC_2100)
48877365Smjacob#define	IS_2200(isp)	((isp)->isp_type == ISP_HA_FC_2200)
48977365Smjacob#define	IS_2300(isp)	((isp)->isp_type == ISP_HA_FC_2300)
49044819Smjacob
49177365Smjacob/* 2300 Support isn't ready yet */
49277365Smjacob#define	ISP_DISABLE_2300_SUPPORT	1
49377365Smjacob
49464087Smjacob/*
49564087Smjacob * DMA cookie macros
49664087Smjacob */
49764087Smjacob#define	DMA_MSW(x)	(((x) >> 16) & 0xffff)
49864087Smjacob#define	DMA_LSW(x)	(((x) & 0xffff))
49957145Smjacob
50035388Smjacob/*
50164087Smjacob * Core System Function Prototypes
50235388Smjacob */
50335388Smjacob
50435388Smjacob/*
50539235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with
50639235Sgibbs * a call to isp_init.
50735388Smjacob */
50874229Smjacobvoid isp_reset(struct ispsoftc *);
50935388Smjacob
51035388Smjacob/*
51135388Smjacob * Initialize Hardware to known state
51235388Smjacob */
51374229Smjacobvoid isp_init(struct ispsoftc *);
51435388Smjacob
51535388Smjacob/*
51639235Sgibbs * Reset the ISP and call completion for any orphaned commands.
51739235Sgibbs */
51874229Smjacobvoid isp_reinit(struct ispsoftc *);
51939235Sgibbs
52039235Sgibbs/*
52135388Smjacob * Interrupt Service Routine
52235388Smjacob */
52374229Smjacobint isp_intr(void *);
52435388Smjacob
52535388Smjacob/*
52664087Smjacob * Command Entry Point- Platform Dependent layers call into this
52735388Smjacob */
52874229Smjacobint isp_start(XS_T *);
52964087Smjacob/* these values are what isp_start returns */
53064087Smjacob#define	CMD_COMPLETE	101	/* command completed */
53164087Smjacob#define	CMD_EAGAIN	102	/* busy- maybe retry later */
53264087Smjacob#define	CMD_QUEUED	103	/* command has been queued for execution */
53364087Smjacob#define	CMD_RQLATER 	104	/* requeue this command later */
53435388Smjacob
53539235Sgibbs/*
53664087Smjacob * Command Completion Point- Core layers call out from this with completed cmds
53764087Smjacob */
53874229Smjacobvoid isp_done(XS_T *);
53964087Smjacob
54064087Smjacob/*
54143420Smjacob * Platform Dependent to External to Internal Control Function
54239235Sgibbs *
54372355Smjacob * Assumes locks are held on entry. You should note that with many of
54472355Smjacob * these commands and locks may be released while this is occurring.
54539235Sgibbs *
54672355Smjacob * A few notes about some of these functions:
54772355Smjacob *
54872355Smjacob * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
54972355Smjacob * The argument is a pointer to an integer which is the time, in microseconds,
55072355Smjacob * we should wait to see whether we have good link. This test, if successful,
55172355Smjacob * lets us know our connection topology and our Loop ID/AL_PA and so on.
55272355Smjacob * You can't get anywhere without this.
55372355Smjacob *
55472355Smjacob * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
55572355Smjacob * all entities using the FC Generic Services subcommand GET ALL NEXT.
55672355Smjacob * For each found entity, an ISPASYNC_FABRICDEV event is generated (see
55772355Smjacob * below).
55872355Smjacob *
55972355Smjacob * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
56072355Smjacob * topology is NL or FL port (private or public loop). Since the Qlogic f/w
56172355Smjacob * 'automatically' manages local loop connections, this function essentially
56272355Smjacob * notes the arrival, departure, and possible shuffling around of local loop
56372355Smjacob * entities. Thus for each arrival and departure this generates an isp_async
56472355Smjacob * event of ISPASYNC_PROMENADE (see below).
56572355Smjacob *
56672355Smjacob * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
56772355Smjacob * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
56872355Smjacob * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging
56972355Smjacob * and logging out of fabric devices (if one is on a fabric) and then marking
57072355Smjacob * the 'loop state' as being ready to now be used for sending commands to
57172355Smjacob * devices. Originally fabric name server and local loop scanning were
57272355Smjacob * part of this function. It's now been seperated to allow for finer control.
57339235Sgibbs */
57439235Sgibbstypedef enum {
57548484Smjacob	ISPCTL_RESET_BUS,		/* Reset Bus */
57648484Smjacob	ISPCTL_RESET_DEV,		/* Reset Device */
57748484Smjacob	ISPCTL_ABORT_CMD,		/* Abort Command */
57872355Smjacob	ISPCTL_UPDATE_PARAMS,		/* Update Operating Parameters (SCSI) */
57955364Smjacob	ISPCTL_FCLINK_TEST,		/* Test FC Link Status */
58072355Smjacob	ISPCTL_SCAN_FABRIC,		/* (Re)scan Fabric Name Server */
58172355Smjacob	ISPCTL_SCAN_LOOP,		/* (Re)scan Local Loop */
58255364Smjacob	ISPCTL_PDB_SYNC,		/* Synchronize Port Database */
58372355Smjacob	ISPCTL_SEND_LIP,		/* Send a LIP */
58472355Smjacob	ISPCTL_GET_POSMAP,		/* Get FC-AL position map */
58572938Smjacob	ISPCTL_RUN_MBOXCMD,		/* run a mailbox command */
58655364Smjacob	ISPCTL_TOGGLE_TMODE		/* toggle target mode */
58739235Sgibbs} ispctl_t;
58874229Smjacobint isp_control(struct ispsoftc *, ispctl_t, void *);
58939235Sgibbs
59043420Smjacob
59139235Sgibbs/*
59243420Smjacob * Platform Dependent to Internal to External Control Function
59343420Smjacob * (each platform must provide such a function)
59443420Smjacob *
59572355Smjacob * Assumes locks are held.
59672355Smjacob *
59772355Smjacob * A few notes about some of these functions:
59872355Smjacob *
59972355Smjacob * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
60072355Smjacob * occurred that invalidates the list of fabric devices known and/or
60172355Smjacob * the list of known loop devices. The argument passed is a pointer
60272355Smjacob * whose values are defined below  (local loop change, name server
60372355Smjacob * change, other). 'Other' may simply be a LIP, or a change in
60472355Smjacob * connection topology.
60572355Smjacob *
60672355Smjacob * ISPASYNC_FABRIC_DEV announces the next element in a list of
60772355Smjacob * fabric device names we're getting out of the name server. The
60872355Smjacob * argument points to a GET ALL NEXT response structure. The list
60972355Smjacob * is known to terminate with an entry that refers to ourselves.
61072355Smjacob * One of the main purposes of this function is to allow outer
61172355Smjacob * layers, which are OS dependent, to set policy as to which fabric
61272355Smjacob * devices might actually be logged into (and made visible) later
61372355Smjacob * at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric
61472355Smjacob * devices that we can log into (256 less 3 'reserved' for F-port
61572355Smjacob * topologies), and fabrics can grow up to 8 million or so entries
61672355Smjacob * (24 bits of Port Address, less a wad of reserved spaces), clearly
61772355Smjacob * we had better let the OS determine login policy.
61872355Smjacob *
61972355Smjacob * ISPASYNC_PROMENADE has an argument that is a pointer to an integer which
62072355Smjacob * is an index into the portdb in the softc ('target'). Whether that entrie's
62172355Smjacob * valid tag is set or not says whether something has arrived or departed.
62272355Smjacob * The name refers to a favorite pastime of many city dwellers- watching
62372355Smjacob * people come and go, talking of Michaelangelo, and so on..
62472938Smjacob *
62572938Smjacob * ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a
62672938Smjacob * response queue entry not otherwise handled. The outer layer should
62772938Smjacob * return non-zero if it handled it. The 'arg' points to a (possibly only
62872938Smjacob * partially) massaged response queue entry (see the platform's
62972938Smjacob * ISP_UNSWIZZLE_RESPONSE macro).
63043420Smjacob */
63143420Smjacob
63243420Smjacobtypedef enum {
63372355Smjacob	ISPASYNC_NEW_TGT_PARAMS,	/* New Target Parameters Negotiated */
63448484Smjacob	ISPASYNC_BUS_RESET,		/* Bus Was Reset */
63548484Smjacob	ISPASYNC_LOOP_DOWN,		/* FC Loop Down */
63648484Smjacob	ISPASYNC_LOOP_UP,		/* FC Loop Up */
63777365Smjacob	ISPASYNC_LIP,			/* LIP Received */
63877365Smjacob	ISPASYNC_LOOP_RESET,		/* Loop Reset Received */
63972355Smjacob	ISPASYNC_CHANGE_NOTIFY,		/* FC Change Notification */
64072355Smjacob	ISPASYNC_FABRIC_DEV,		/* FC Fabric Device Arrival */
64172355Smjacob	ISPASYNC_PROMENADE,		/* FC Objects coming && going */
64255364Smjacob	ISPASYNC_TARGET_MESSAGE,	/* target message */
64355364Smjacob	ISPASYNC_TARGET_EVENT,		/* target asynchronous event */
64472355Smjacob	ISPASYNC_TARGET_ACTION,		/* other target command action */
64572938Smjacob	ISPASYNC_CONF_CHANGE,		/* Platform Configuration Change */
64672938Smjacob	ISPASYNC_UNHANDLED_RESPONSE	/* Unhandled Response Entry */
64743420Smjacob} ispasync_t;
64874229Smjacobint isp_async(struct ispsoftc *, ispasync_t, void *);
64943420Smjacob
65072355Smjacob#define	ISPASYNC_CHANGE_PDB	((void *) 0)
65172355Smjacob#define	ISPASYNC_CHANGE_SNS	((void *) 1)
65272355Smjacob#define	ISPASYNC_CHANGE_OTHER	((void *) 2)
65372355Smjacob
65443420Smjacob/*
65564087Smjacob * Platform Dependent Error and Debug Printout
65639235Sgibbs */
65770490Smjacob#ifdef	__GNUC__
65874229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...)
65970490Smjacob	__attribute__((__format__(__printf__,3,4)));
66070490Smjacob#else
66174229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...);
66270490Smjacob#endif
66370490Smjacob
66464087Smjacob#define	ISP_LOGALL	0x0	/* log always */
66564087Smjacob#define	ISP_LOGCONFIG	0x1	/* log configuration messages */
66664087Smjacob#define	ISP_LOGINFO	0x2	/* log informational messages */
66764087Smjacob#define	ISP_LOGWARN	0x4	/* log warning messages */
66864087Smjacob#define	ISP_LOGERR	0x8	/* log error messages */
66964087Smjacob#define	ISP_LOGDEBUG0	0x10	/* log simple debug messages */
67064087Smjacob#define	ISP_LOGDEBUG1	0x20	/* log intermediate debug messages */
67164087Smjacob#define	ISP_LOGDEBUG2	0x40	/* log most debug messages */
67264087Smjacob#define	ISP_LOGDEBUG3	0x100	/* log high frequency debug messages */
67364087Smjacob#define	ISP_LOGTDEBUG0	0x200	/* log simple debug messages (target mode) */
67464087Smjacob#define	ISP_LOGTDEBUG1	0x400	/* log intermediate debug messages (target) */
67564087Smjacob#define	ISP_LOGTDEBUG2	0x800	/* log all debug messages (target) */
67639235Sgibbs
67764087Smjacob/*
67864087Smjacob * Each Platform provides it's own isposinfo substructure of the ispsoftc
67964087Smjacob * defined above.
68064087Smjacob *
68164087Smjacob * Each platform must also provide the following macros/defines:
68264087Smjacob *
68364087Smjacob *
68464087Smjacob *	INLINE		-	platform specific define for 'inline' functions
68564087Smjacob *
68664087Smjacob *	ISP2100_SCRLEN	-	length for the Fibre Channel scratch DMA area
68764087Smjacob *
68864087Smjacob *	MEMZERO(dst, src)			platform zeroing function
68964087Smjacob *	MEMCPY(dst, src, count)			platform copying function
69064087Smjacob *	SNPRINTF(buf, bufsize, fmt, ...)	snprintf
69164087Smjacob *	STRNCAT(dstbuf, size, srcbuf)		strncat
69264087Smjacob *	USEC_DELAY(usecs)			microsecond spindelay function
69369522Smjacob *	USEC_SLEEP(isp, usecs)			microsecond sleep function
69464087Smjacob *
69564087Smjacob *	NANOTIME_T				nanosecond time type
69664087Smjacob *
69764087Smjacob *	GET_NANOTIME(NANOTIME_T *)		get current nanotime.
69864087Smjacob *
69964087Smjacob *	GET_NANOSEC(NANOTIME_T *)		get u_int64_t from NANOTIME_T
70064087Smjacob *
70164087Smjacob *	NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
70264087Smjacob *						subtract two NANOTIME_T values
70364087Smjacob *
70464087Smjacob *
70564087Smjacob *	MAXISPREQUEST(struct ispsoftc *)	maximum request queue size
70664087Smjacob *						for this particular board type
70764087Smjacob *
70864087Smjacob *	MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size)
70964087Smjacob *
71064087Smjacob *		Function/Macro the provides memory synchronization on
71164087Smjacob *		various objects so that the ISP's and the system's view
71264087Smjacob *		of the same object is consistent.
71364087Smjacob *
71464087Smjacob *	MBOX_ACQUIRE(struct ispsoftc *)		acquire lock on mailbox regs
71564087Smjacob *	MBOX_WAIT_COMPLETE(struct ispsoftc *)	wait for mailbox cmd to be done
71664087Smjacob *	MBOX_NOTIFY_COMPLETE(struct ispsoftc *)	notification of mbox cmd donee
71764087Smjacob *	MBOX_RELEASE(struct ispsoftc *)		release lock on mailbox regs
71864087Smjacob *
71972355Smjacob *
72064087Smjacob *	SCSI_GOOD	SCSI 'Good' Status
72164087Smjacob *	SCSI_CHECK	SCSI 'Check Condition' Status
72264087Smjacob *	SCSI_BUSY	SCSI 'Busy' Status
72364087Smjacob *	SCSI_QFULL	SCSI 'Queue Full' Status
72464087Smjacob *
72564087Smjacob *	XS_T		Platform SCSI transaction type (i.e., command for HBA)
72664087Smjacob *	XS_ISP(xs)	gets an instance out of an XS_T
72764087Smjacob *	XS_CHANNEL(xs)	gets the channel (bus # for DUALBUS cards) ""
72864087Smjacob *	XS_TGT(xs)	gets the target ""
72964087Smjacob *	XS_LUN(xs)	gets the lun ""
73064087Smjacob *	XS_CDBP(xs)	gets a pointer to the scsi CDB ""
73164087Smjacob *	XS_CDBLEN(xs)	gets the CDB's length ""
73264087Smjacob *	XS_XFRLEN(xs)	gets the associated data transfer length ""
73364087Smjacob *	XS_TIME(xs)	gets the time (in milliseconds) for this command
73464087Smjacob *	XS_RESID(xs)	gets the current residual count
73564087Smjacob *	XS_STSP(xs)	gets a pointer to the SCSI status byte ""
73664087Smjacob *	XS_SNSP(xs)	gets a pointer to the associate sense data
73764087Smjacob *	XS_SNSLEN(xs)	gets the length of sense data storage
73864087Smjacob *	XS_SNSKEY(xs)	dereferences XS_SNSP to get the current stored Sense Key
73964087Smjacob *	XS_TAG_P(xs)	predicate of whether this command should be tagged
74064087Smjacob *	XS_TAG_TYPE(xs)	which type of tag to use
74164087Smjacob *	XS_SETERR(xs)	set error state
74264087Smjacob *
74364087Smjacob *		HBA_NOERROR	command has no erros
74464087Smjacob *		HBA_BOTCH	hba botched something
74564087Smjacob *		HBA_CMDTIMEOUT	command timed out
74664087Smjacob *		HBA_SELTIMEOUT	selection timed out (also port logouts for FC)
74764087Smjacob *		HBA_TGTBSY	target returned a BUSY status
74864087Smjacob *		HBA_BUSRESET	bus reset destroyed command
74964087Smjacob *		HBA_ABORTED	command was aborted (by request)
75064087Smjacob *		HBA_DATAOVR	a data overrun was detected
75164087Smjacob *		HBA_ARQFAIL	Automatic Request Sense failed
75264087Smjacob *
75364087Smjacob *	XS_ERR(xs)	return current error state
75464087Smjacob *	XS_NOERR(xs)	there is no error currently set
75564087Smjacob *	XS_INITERR(xs)	initialize error state
75664087Smjacob *
75764087Smjacob *	XS_SAVE_SENSE(xs, sp)		save sense data
75864087Smjacob *
75964087Smjacob *	XS_SET_STATE_STAT(isp, sp, xs)	platform dependent interpreter of
76064087Smjacob *					response queue entry status bits
76164087Smjacob *
76264087Smjacob *
76364087Smjacob *	DEFAULT_IID(struct ispsoftc *)		Default SCSI initiator ID
76464087Smjacob *	DEFAULT_LOOPID(struct ispsoftc *)	Default FC Loop ID
76567047Smjacob *	DEFAULT_NODEWWN(struct ispsoftc *)	Default Node WWN
76667047Smjacob *	DEFAULT_PORTWWN(struct ispsoftc *)	Default Port WWN
76767047Smjacob *		These establish reasonable defaults for each platform.
76867047Smjacob * 		These must be available independent of card NVRAM and are
76967047Smjacob *		to be used should NVRAM not be readable.
77064087Smjacob *
77167047Smjacob *	ISP_NODEWWN(struct ispsoftc *)	FC Node WWN to use
77267047Smjacob *	ISP_PORTWWN(struct ispsoftc *)	FC Port WWN to use
77364087Smjacob *
77467047Smjacob *		These are to be used after NVRAM is read. The tags
77567047Smjacob *		in fcparam.isp_{node,port}wwn reflect the values
77667047Smjacob *		read from NVRAM (possibly corrected for card botches).
77767047Smjacob *		Each platform can take that information and override
77867047Smjacob *		it or ignore and return the Node and Port WWNs to be
77967047Smjacob * 		used when sending the Qlogic f/w the Initialization Control
78067047Smjacob *		Block.
78164087Smjacob *
78264087Smjacob *	(XXX these do endian specific transformations- in transition XXX)
78364087Smjacob *	ISP_SWIZZLE_ICB
78464087Smjacob *	ISP_UNSWIZZLE_AND_COPY_PDBP
78564087Smjacob *	ISP_SWIZZLE_CONTINUATION
78664087Smjacob *	ISP_SWIZZLE_REQUEST
78764087Smjacob *	ISP_UNSWIZZLE_RESPONSE
78864087Smjacob *	ISP_SWIZZLE_SNS_REQ
78964087Smjacob *	ISP_UNSWIZZLE_SNS_RSP
79064087Smjacob *	ISP_SWIZZLE_NVRAM_WORD
79164087Smjacob */
79277365Smjacob
79335388Smjacob#endif	/* _ISPVAR_H */
794