ispvar.h revision 80582
150477Speter/* $FreeBSD: head/sys/dev/isp/ispvar.h 80582 2001-07-30 00:59:32Z 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
5780582Smjacob#define	ISP_CORE_VERSION_MINOR	2
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 {
18280582Smjacob		u_int32_t
18380582Smjacob			exc_throttle	:	8,
18446968Smjacob					:	1,
18580582Smjacob			dev_enable	:	1,	/* ignored */
18643420Smjacob			dev_update	:	1,
18743420Smjacob			dev_refresh	:	1,
18880582Smjacob			actv_offset	:	4,
18980582Smjacob			goal_offset	:	4,
19080582Smjacob			nvrm_offset	:	4;
19180582Smjacob		u_int8_t	actv_period;	/* current sync period */
19280582Smjacob		u_int8_t	goal_period;	/* goal sync period */
19380582Smjacob		u_int8_t	nvrm_period;	/* nvram sync period */
19480582Smjacob		u_int16_t	actv_flags;	/* current device flags */
19580582Smjacob		u_int16_t	goal_flags;	/* goal device flags */
19680582Smjacob		u_int16_t	nvrm_flags;	/* nvram device flags */
19735388Smjacob	} isp_devparam[MAX_TARGETS];
19846968Smjacob} sdparam;
19935388Smjacob
20035388Smjacob/*
20135388Smjacob * Device Flags
20235388Smjacob */
20339235Sgibbs#define	DPARM_DISC	0x8000
20439235Sgibbs#define	DPARM_PARITY	0x4000
20539235Sgibbs#define	DPARM_WIDE	0x2000
20639235Sgibbs#define	DPARM_SYNC	0x1000
20739235Sgibbs#define	DPARM_TQING	0x0800
20839235Sgibbs#define	DPARM_ARQ	0x0400
20939235Sgibbs#define	DPARM_QFRZ	0x0200
21039235Sgibbs#define	DPARM_RENEG	0x0100
21165140Smjacob#define	DPARM_NARROW	0x0080
21265140Smjacob#define	DPARM_ASYNC	0x0040
21365140Smjacob#define	DPARM_PPR	0x0020
21443793Smjacob#define	DPARM_DEFAULT	(0xFF00 & ~DPARM_QFRZ)
21539235Sgibbs#define	DPARM_SAFE_DFLT	(DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
21635388Smjacob
21739235Sgibbs
21845040Smjacob/* technically, not really correct, as they need to be rated based upon clock */
21965140Smjacob#define	ISP_80M_SYNCPARMS	0x0c09
22065140Smjacob#define	ISP_40M_SYNCPARMS	0x0c0a
22165140Smjacob#define	ISP_20M_SYNCPARMS	0x0c0c
22265140Smjacob#define	ISP_20M_SYNCPARMS_1040	0x080c
22352347Smjacob#define	ISP_10M_SYNCPARMS	0x0c19
22452347Smjacob#define	ISP_08M_SYNCPARMS	0x0c25
22552347Smjacob#define	ISP_05M_SYNCPARMS	0x0c32
22652347Smjacob#define	ISP_04M_SYNCPARMS	0x0c41
22735388Smjacob
22835388Smjacob/*
22935388Smjacob * Fibre Channel Specifics
23035388Smjacob */
23152347Smjacob#define	FL_PORT_ID		0x7e	/* FL_Port Special ID */
23252347Smjacob#define	FC_PORT_ID		0x7f	/* Fabric Controller Special ID */
23352347Smjacob#define	FC_SNS_ID		0x80	/* SNS Server Special ID */
23452347Smjacob
23535388Smjacobtypedef struct {
23652347Smjacob	u_int32_t		isp_fwoptions	: 16,
23777776Smjacob						: 2,
23872355Smjacob				isp_iid_set	: 1,
23948484Smjacob				loop_seen_once	: 1,
24077776Smjacob				isp_loopstate	: 4,	/* Current Loop State */
24148484Smjacob				isp_fwstate	: 3,	/* ISP F/W state */
24248484Smjacob				isp_gotdparms	: 1,
24359454Smjacob				isp_topo	: 3,
24448484Smjacob				isp_onfabric	: 1;
24572355Smjacob	u_int8_t		isp_iid;	/* 'initiator' id */
24639235Sgibbs	u_int8_t		isp_loopid;	/* hard loop id */
24739235Sgibbs	u_int8_t		isp_alpa;	/* ALPA */
24872355Smjacob	u_int32_t		isp_portid;
24952347Smjacob	volatile u_int16_t	isp_lipseq;	/* LIP sequence # */
25072355Smjacob	u_int16_t		isp_xxxxxx;
25139235Sgibbs	u_int8_t		isp_execthrottle;
25252347Smjacob	u_int8_t		isp_retry_delay;
25352347Smjacob	u_int8_t		isp_retry_count;
25452347Smjacob	u_int8_t		isp_reserved;
25539235Sgibbs	u_int16_t		isp_maxalloc;
25639235Sgibbs	u_int16_t		isp_maxfrmlen;
25748484Smjacob	u_int64_t		isp_nodewwn;
25848484Smjacob	u_int64_t		isp_portwwn;
25935388Smjacob	/*
26048484Smjacob	 * Port Data Base. This is indexed by 'target', which is invariate.
26148484Smjacob	 * However, elements within can move around due to loop changes,
26248484Smjacob	 * so the actual loop ID passed to the F/W is in this structure.
26348484Smjacob	 * The first time the loop is seen up, loopid will match the index
26448484Smjacob	 * (except for fabric nodes which are above mapped above FC_SNS_ID
26548484Smjacob	 * and are completely virtual), but subsequent LIPs can cause things
26648484Smjacob	 * to move around.
26744819Smjacob	 */
26848484Smjacob	struct lportdb {
26952347Smjacob		u_int
27060221Smjacob					loopid		: 8,
27177776Smjacob							: 1,
27277776Smjacob					force_logout	: 1,
27371079Smjacob					was_fabric_dev	: 1,
27471079Smjacob					fabric_dev	: 1,
27560221Smjacob					loggedin	: 1,
27660221Smjacob					roles		: 2,
27760221Smjacob					valid		: 1;
27852347Smjacob		u_int32_t		portid;
27948484Smjacob		u_int64_t		node_wwn;
28048484Smjacob		u_int64_t		port_wwn;
28172355Smjacob	} portdb[MAX_FC_TARG], tport[FC_PORT_ID];
28244819Smjacob
28344819Smjacob	/*
28435388Smjacob	 * Scratch DMA mapped in area to fetch Port Database stuff, etc.
28535388Smjacob	 */
28648195Smjacob	caddr_t			isp_scratch;
28735388Smjacob	u_int32_t		isp_scdma;
28835388Smjacob} fcparam;
28935388Smjacob
29048484Smjacob#define	FW_CONFIG_WAIT		0
29148484Smjacob#define	FW_WAIT_AL_PA		1
29248484Smjacob#define	FW_WAIT_LOGIN		2
29348484Smjacob#define	FW_READY		3
29448484Smjacob#define	FW_LOSS_OF_SYNC		4
29548484Smjacob#define	FW_ERROR		5
29648484Smjacob#define	FW_REINIT		6
29748484Smjacob#define	FW_NON_PART		7
29835388Smjacob
29948484Smjacob#define	LOOP_NIL		0
30048484Smjacob#define	LOOP_LIP_RCVD		1
30148484Smjacob#define	LOOP_PDB_RCVD		2
30272355Smjacob#define	LOOP_SCANNING_FABRIC	3
30372355Smjacob#define	LOOP_FSCAN_DONE		4
30472355Smjacob#define	LOOP_SCANNING_LOOP	5
30577776Smjacob#define	LOOP_LSCAN_DONE		6
30677776Smjacob#define	LOOP_SYNCING_PDB	7
30777776Smjacob#define	LOOP_READY		8
30835388Smjacob
30959454Smjacob#define	TOPO_NL_PORT		0
31059454Smjacob#define	TOPO_FL_PORT		1
31159454Smjacob#define	TOPO_N_PORT		2
31259454Smjacob#define	TOPO_F_PORT		3
31359454Smjacob#define	TOPO_PTP_STUB		4
31459454Smjacob
31542131Smjacob/*
31635388Smjacob * Soft Structure per host adapter
31735388Smjacob */
31865140Smjacobtypedef struct ispsoftc {
31935388Smjacob	/*
32035388Smjacob	 * Platform (OS) specific data
32135388Smjacob	 */
32235388Smjacob	struct isposinfo	isp_osinfo;
32335388Smjacob
32435388Smjacob	/*
32553487Smjacob	 * Pointer to bus specific functions and data
32635388Smjacob	 */
32735388Smjacob	struct ispmdvec *	isp_mdvec;
32835388Smjacob
32935388Smjacob	/*
33053487Smjacob	 * (Mostly) nonvolatile state. Board specific parameters
33153487Smjacob	 * may contain some volatile state (e.g., current loop state).
33235388Smjacob	 */
33335388Smjacob
33453487Smjacob	void * 			isp_param;	/* type specific */
33553487Smjacob	u_int16_t		isp_fwrev[3];	/* Loaded F/W revision */
33653487Smjacob	u_int16_t		isp_romfw_rev[3]; /* PROM F/W revision */
33753487Smjacob	u_int16_t		isp_maxcmds;	/* max possible I/O cmds */
33853487Smjacob	u_int8_t		isp_type;	/* HBA Chip Type */
33953487Smjacob	u_int8_t		isp_revision;	/* HBA Chip H/W Revision */
34061772Smjacob	u_int32_t		isp_maxluns;	/* maximum luns supported */
34135388Smjacob
34271079Smjacob	u_int32_t		isp_clock	: 8,	/* input clock */
34371079Smjacob						: 6,
34471079Smjacob				isp_role	: 2,
34571079Smjacob						: 1,
34653487Smjacob				isp_touched	: 1,	/* board ever seen? */
34753487Smjacob				isp_bustype	: 1,	/* SBus or PCI */
34865140Smjacob				isp_loaded_fw	: 1,	/* loaded firmware */
34971079Smjacob				isp_dblev	: 12;	/* debug log mask */
35071079Smjacob
35171079Smjacob	u_int32_t		isp_confopts;		/* config options */
35271079Smjacob
35369522Smjacob	/*
35469522Smjacob	 * Instrumentation
35569522Smjacob	 */
35669522Smjacob	u_int64_t		isp_intcnt;		/* total int count */
35769522Smjacob	u_int64_t		isp_intbogus;		/* spurious int count */
35839235Sgibbs
35935388Smjacob	/*
36039235Sgibbs	 * Volatile state
36135388Smjacob	 */
36235388Smjacob
36362171Smjacob	volatile u_int32_t
36462171Smjacob		isp_mboxbsy	:	8,	/* mailbox command active */
36562171Smjacob				:	1,
36639235Sgibbs		isp_state	:	3,
36746968Smjacob		isp_sendmarker	:	2,	/* send a marker entry */
36846968Smjacob		isp_update	:	2,	/* update parameters */
36952347Smjacob		isp_nactive	:	16;	/* how many commands active */
37052347Smjacob	volatile u_int16_t	isp_reqodx;	/* index of last ISP pickup */
37152347Smjacob	volatile u_int16_t	isp_reqidx;	/* index of next request */
37252347Smjacob	volatile u_int16_t	isp_residx;	/* index of next result */
37352347Smjacob	volatile u_int16_t	isp_lasthdls;	/* last handle seed */
37462171Smjacob	volatile u_int16_t	isp_mboxtmp[MAX_MAILBOX];
37571079Smjacob	volatile u_int16_t	isp_lastmbxcmd;	/* last mbox command sent */
37635388Smjacob
37735388Smjacob	/*
37853487Smjacob	 * Active commands are stored here, indexed by handle functions.
37935388Smjacob	 */
38064087Smjacob	XS_T **isp_xflist;
38135388Smjacob
38235388Smjacob	/*
38352347Smjacob	 * request/result queue pointers and dma handles for them.
38435388Smjacob	 */
38548195Smjacob	caddr_t			isp_rquest;
38648195Smjacob	caddr_t			isp_result;
38735388Smjacob	u_int32_t		isp_rquest_dma;
38835388Smjacob	u_int32_t		isp_result_dma;
38965140Smjacob} ispsoftc_t;
39035388Smjacob
39149909Smjacob#define	SDPARAM(isp)	((sdparam *) (isp)->isp_param)
39249909Smjacob#define	FCPARAM(isp)	((fcparam *) (isp)->isp_param)
39349909Smjacob
39435388Smjacob/*
39564087Smjacob * ISP Driver Run States
39635388Smjacob */
39735388Smjacob#define	ISP_NILSTATE	0
39835388Smjacob#define	ISP_RESETSTATE	1
39935388Smjacob#define	ISP_INITSTATE	2
40035388Smjacob#define	ISP_RUNSTATE	3
40135388Smjacob
40235388Smjacob/*
40335388Smjacob * ISP Configuration Options
40435388Smjacob */
40535388Smjacob#define	ISP_CFG_NORELOAD	0x80	/* don't download f/w */
40643793Smjacob#define	ISP_CFG_NONVRAM		0x40	/* ignore NVRAM */
40753487Smjacob#define	ISP_CFG_FULL_DUPLEX	0x01	/* Full Duplex (Fibre Channel only) */
40853487Smjacob#define	ISP_CFG_OWNWWN		0x02	/* override NVRAM wwn */
40969522Smjacob#define	ISP_CFG_PORT_PREF	0x0C	/* Mask for Port Prefs (2200 only) */
41069522Smjacob#define	ISP_CFG_LPORT		0x00	/* prefer {N/F}L-Port connection */
41169522Smjacob#define	ISP_CFG_NPORT		0x04	/* prefer {N/F}-Port connection */
41269522Smjacob#define	ISP_CFG_NPORT_ONLY	0x08	/* insist on {N/F}-Port connection */
41369522Smjacob#define	ISP_CFG_LPORT_ONLY	0x0C	/* insist on {N/F}L-Port connection */
41435388Smjacob
41564087Smjacob/*
41671079Smjacob * Prior to calling isp_reset for the first time, the outer layer
41771079Smjacob * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH.
41871079Smjacob *
41971079Smjacob * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded,
42071079Smjacob * NVRAM read, and defaults set, but any further initialization (e.g.
42171079Smjacob * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done.
42271079Smjacob *
42371079Smjacob * If INITIATOR MODE isn't set, attempts to run commands will be stopped
42471079Smjacob * at isp_start and completed with the moral equivalent of SELECTION TIMEOUT.
42571079Smjacob *
42671079Smjacob * If TARGET MODE is set, it doesn't mean that the rest of target mode support
42771079Smjacob * needs to be enabled, or will even work. What happens with the 2X00 cards
42871079Smjacob * here is that if you have enabled it with TARGET MODE as part of the ICB
42971079Smjacob * options, but you haven't given the f/w any ram resources for ATIOs or
43071079Smjacob * Immediate Notifies, the f/w just handles what it can and you never see
43171079Smjacob * anything. Basically, it sends a single byte of data (the first byte,
43271079Smjacob * which you can set as part of the INITIALIZE CONTROL BLOCK command) for
43371079Smjacob * INQUIRY, and sends back QUEUE FULL status for any other command.
43479235Smjacob *
43571079Smjacob */
43671079Smjacob#define	ISP_ROLE_NONE		0x0
43771079Smjacob#define	ISP_ROLE_INITIATOR	0x1
43871079Smjacob#define	ISP_ROLE_TARGET		0x2
43971079Smjacob#define	ISP_ROLE_BOTH		(ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
44071079Smjacob#define	ISP_ROLE_EITHER		ISP_ROLE_BOTH
44171079Smjacob#ifndef	ISP_DEFAULT_ROLES
44271079Smjacob#define	ISP_DEFAULT_ROLES	ISP_ROLE_INITIATOR
44371079Smjacob#endif
44471079Smjacob
44571079Smjacob
44671079Smjacob/*
44764087Smjacob * Firmware related defines
44864087Smjacob */
44971079Smjacob#define	ISP_CODE_ORG			0x1000	/* default f/w code start */
45045282Smjacob#define	ISP_FW_REV(maj, min, mic)	((maj << 24) | (min << 16) | mic)
45171079Smjacob#define	ISP_FW_REVX(xp)			((xp[0]<<24) | (xp[1] << 16) | xp[2])
45239235Sgibbs
45335388Smjacob/*
45439235Sgibbs * Bus (implementation) types
45535388Smjacob */
45639235Sgibbs#define	ISP_BT_PCI		0	/* PCI Implementations */
45739235Sgibbs#define	ISP_BT_SBUS		1	/* SBus Implementations */
45839235Sgibbs
45939235Sgibbs/*
46039235Sgibbs * Chip Types
46139235Sgibbs */
46235388Smjacob#define	ISP_HA_SCSI		0xf
46339235Sgibbs#define	ISP_HA_SCSI_UNKNOWN	0x1
46439235Sgibbs#define	ISP_HA_SCSI_1020	0x2
46539235Sgibbs#define	ISP_HA_SCSI_1020A	0x3
46639235Sgibbs#define	ISP_HA_SCSI_1040	0x4
46739235Sgibbs#define	ISP_HA_SCSI_1040A	0x5
46839235Sgibbs#define	ISP_HA_SCSI_1040B	0x6
46945282Smjacob#define	ISP_HA_SCSI_1040C	0x7
47054671Smjacob#define	ISP_HA_SCSI_1240	0x8
47154671Smjacob#define	ISP_HA_SCSI_1080	0x9
47254671Smjacob#define	ISP_HA_SCSI_1280	0xa
47357145Smjacob#define	ISP_HA_SCSI_12160	0xb
47435388Smjacob#define	ISP_HA_FC		0xf0
47535388Smjacob#define	ISP_HA_FC_2100		0x10
47648484Smjacob#define	ISP_HA_FC_2200		0x20
47777365Smjacob#define	ISP_HA_FC_2300		0x30
47835388Smjacob
47944819Smjacob#define	IS_SCSI(isp)	(isp->isp_type & ISP_HA_SCSI)
48054671Smjacob#define	IS_1240(isp)	(isp->isp_type == ISP_HA_SCSI_1240)
48144819Smjacob#define	IS_1080(isp)	(isp->isp_type == ISP_HA_SCSI_1080)
48254671Smjacob#define	IS_1280(isp)	(isp->isp_type == ISP_HA_SCSI_1280)
48357145Smjacob#define	IS_12160(isp)	(isp->isp_type == ISP_HA_SCSI_12160)
48457145Smjacob
48557145Smjacob#define	IS_12X0(isp)	(IS_1240(isp) || IS_1280(isp))
48657145Smjacob#define	IS_DUALBUS(isp)	(IS_12X0(isp) || IS_12160(isp))
48757145Smjacob#define	IS_ULTRA2(isp)	(IS_1080(isp) || IS_1280(isp) || IS_12160(isp))
48857145Smjacob#define	IS_ULTRA3(isp)	(IS_12160(isp))
48957145Smjacob
49077365Smjacob#define	IS_FC(isp)	((isp)->isp_type & ISP_HA_FC)
49177365Smjacob#define	IS_2100(isp)	((isp)->isp_type == ISP_HA_FC_2100)
49277365Smjacob#define	IS_2200(isp)	((isp)->isp_type == ISP_HA_FC_2200)
49377365Smjacob#define	IS_2300(isp)	((isp)->isp_type == ISP_HA_FC_2300)
49444819Smjacob
49577365Smjacob/* 2300 Support isn't ready yet */
49677365Smjacob#define	ISP_DISABLE_2300_SUPPORT	1
49777365Smjacob
49864087Smjacob/*
49964087Smjacob * DMA cookie macros
50064087Smjacob */
50164087Smjacob#define	DMA_MSW(x)	(((x) >> 16) & 0xffff)
50264087Smjacob#define	DMA_LSW(x)	(((x) & 0xffff))
50357145Smjacob
50435388Smjacob/*
50564087Smjacob * Core System Function Prototypes
50635388Smjacob */
50735388Smjacob
50835388Smjacob/*
50939235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with
51039235Sgibbs * a call to isp_init.
51135388Smjacob */
51274229Smjacobvoid isp_reset(struct ispsoftc *);
51335388Smjacob
51435388Smjacob/*
51535388Smjacob * Initialize Hardware to known state
51635388Smjacob */
51774229Smjacobvoid isp_init(struct ispsoftc *);
51835388Smjacob
51935388Smjacob/*
52039235Sgibbs * Reset the ISP and call completion for any orphaned commands.
52139235Sgibbs */
52274229Smjacobvoid isp_reinit(struct ispsoftc *);
52339235Sgibbs
52439235Sgibbs/*
52535388Smjacob * Interrupt Service Routine
52635388Smjacob */
52774229Smjacobint isp_intr(void *);
52835388Smjacob
52935388Smjacob/*
53064087Smjacob * Command Entry Point- Platform Dependent layers call into this
53135388Smjacob */
53274229Smjacobint isp_start(XS_T *);
53364087Smjacob/* these values are what isp_start returns */
53464087Smjacob#define	CMD_COMPLETE	101	/* command completed */
53564087Smjacob#define	CMD_EAGAIN	102	/* busy- maybe retry later */
53664087Smjacob#define	CMD_QUEUED	103	/* command has been queued for execution */
53764087Smjacob#define	CMD_RQLATER 	104	/* requeue this command later */
53835388Smjacob
53939235Sgibbs/*
54064087Smjacob * Command Completion Point- Core layers call out from this with completed cmds
54164087Smjacob */
54274229Smjacobvoid isp_done(XS_T *);
54364087Smjacob
54464087Smjacob/*
54543420Smjacob * Platform Dependent to External to Internal Control Function
54639235Sgibbs *
54772355Smjacob * Assumes locks are held on entry. You should note that with many of
54872355Smjacob * these commands and locks may be released while this is occurring.
54939235Sgibbs *
55072355Smjacob * A few notes about some of these functions:
55172355Smjacob *
55272355Smjacob * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
55372355Smjacob * The argument is a pointer to an integer which is the time, in microseconds,
55472355Smjacob * we should wait to see whether we have good link. This test, if successful,
55572355Smjacob * lets us know our connection topology and our Loop ID/AL_PA and so on.
55672355Smjacob * You can't get anywhere without this.
55772355Smjacob *
55872355Smjacob * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
55972355Smjacob * all entities using the FC Generic Services subcommand GET ALL NEXT.
56072355Smjacob * For each found entity, an ISPASYNC_FABRICDEV event is generated (see
56172355Smjacob * below).
56272355Smjacob *
56372355Smjacob * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
56472355Smjacob * topology is NL or FL port (private or public loop). Since the Qlogic f/w
56572355Smjacob * 'automatically' manages local loop connections, this function essentially
56672355Smjacob * notes the arrival, departure, and possible shuffling around of local loop
56772355Smjacob * entities. Thus for each arrival and departure this generates an isp_async
56872355Smjacob * event of ISPASYNC_PROMENADE (see below).
56972355Smjacob *
57072355Smjacob * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
57172355Smjacob * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
57272355Smjacob * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging
57372355Smjacob * and logging out of fabric devices (if one is on a fabric) and then marking
57472355Smjacob * the 'loop state' as being ready to now be used for sending commands to
57572355Smjacob * devices. Originally fabric name server and local loop scanning were
57672355Smjacob * part of this function. It's now been seperated to allow for finer control.
57739235Sgibbs */
57839235Sgibbstypedef enum {
57948484Smjacob	ISPCTL_RESET_BUS,		/* Reset Bus */
58048484Smjacob	ISPCTL_RESET_DEV,		/* Reset Device */
58148484Smjacob	ISPCTL_ABORT_CMD,		/* Abort Command */
58272355Smjacob	ISPCTL_UPDATE_PARAMS,		/* Update Operating Parameters (SCSI) */
58355364Smjacob	ISPCTL_FCLINK_TEST,		/* Test FC Link Status */
58472355Smjacob	ISPCTL_SCAN_FABRIC,		/* (Re)scan Fabric Name Server */
58572355Smjacob	ISPCTL_SCAN_LOOP,		/* (Re)scan Local Loop */
58655364Smjacob	ISPCTL_PDB_SYNC,		/* Synchronize Port Database */
58772355Smjacob	ISPCTL_SEND_LIP,		/* Send a LIP */
58872355Smjacob	ISPCTL_GET_POSMAP,		/* Get FC-AL position map */
58972938Smjacob	ISPCTL_RUN_MBOXCMD,		/* run a mailbox command */
59055364Smjacob	ISPCTL_TOGGLE_TMODE		/* toggle target mode */
59139235Sgibbs} ispctl_t;
59274229Smjacobint isp_control(struct ispsoftc *, ispctl_t, void *);
59339235Sgibbs
59443420Smjacob
59539235Sgibbs/*
59643420Smjacob * Platform Dependent to Internal to External Control Function
59743420Smjacob * (each platform must provide such a function)
59843420Smjacob *
59972355Smjacob * Assumes locks are held.
60072355Smjacob *
60172355Smjacob * A few notes about some of these functions:
60272355Smjacob *
60372355Smjacob * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
60472355Smjacob * occurred that invalidates the list of fabric devices known and/or
60572355Smjacob * the list of known loop devices. The argument passed is a pointer
60672355Smjacob * whose values are defined below  (local loop change, name server
60772355Smjacob * change, other). 'Other' may simply be a LIP, or a change in
60872355Smjacob * connection topology.
60972355Smjacob *
61072355Smjacob * ISPASYNC_FABRIC_DEV announces the next element in a list of
61172355Smjacob * fabric device names we're getting out of the name server. The
61272355Smjacob * argument points to a GET ALL NEXT response structure. The list
61372355Smjacob * is known to terminate with an entry that refers to ourselves.
61472355Smjacob * One of the main purposes of this function is to allow outer
61572355Smjacob * layers, which are OS dependent, to set policy as to which fabric
61672355Smjacob * devices might actually be logged into (and made visible) later
61772355Smjacob * at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric
61872355Smjacob * devices that we can log into (256 less 3 'reserved' for F-port
61972355Smjacob * topologies), and fabrics can grow up to 8 million or so entries
62072355Smjacob * (24 bits of Port Address, less a wad of reserved spaces), clearly
62172355Smjacob * we had better let the OS determine login policy.
62272355Smjacob *
62372355Smjacob * ISPASYNC_PROMENADE has an argument that is a pointer to an integer which
62472355Smjacob * is an index into the portdb in the softc ('target'). Whether that entrie's
62572355Smjacob * valid tag is set or not says whether something has arrived or departed.
62672355Smjacob * The name refers to a favorite pastime of many city dwellers- watching
62772355Smjacob * people come and go, talking of Michaelangelo, and so on..
62872938Smjacob *
62972938Smjacob * ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a
63072938Smjacob * response queue entry not otherwise handled. The outer layer should
63172938Smjacob * return non-zero if it handled it. The 'arg' points to a (possibly only
63272938Smjacob * partially) massaged response queue entry (see the platform's
63372938Smjacob * ISP_UNSWIZZLE_RESPONSE macro).
63443420Smjacob */
63543420Smjacob
63643420Smjacobtypedef enum {
63772355Smjacob	ISPASYNC_NEW_TGT_PARAMS,	/* New Target Parameters Negotiated */
63848484Smjacob	ISPASYNC_BUS_RESET,		/* Bus Was Reset */
63948484Smjacob	ISPASYNC_LOOP_DOWN,		/* FC Loop Down */
64048484Smjacob	ISPASYNC_LOOP_UP,		/* FC Loop Up */
64177365Smjacob	ISPASYNC_LIP,			/* LIP Received */
64277365Smjacob	ISPASYNC_LOOP_RESET,		/* Loop Reset Received */
64372355Smjacob	ISPASYNC_CHANGE_NOTIFY,		/* FC Change Notification */
64472355Smjacob	ISPASYNC_FABRIC_DEV,		/* FC Fabric Device Arrival */
64572355Smjacob	ISPASYNC_PROMENADE,		/* FC Objects coming && going */
64655364Smjacob	ISPASYNC_TARGET_MESSAGE,	/* target message */
64755364Smjacob	ISPASYNC_TARGET_EVENT,		/* target asynchronous event */
64872355Smjacob	ISPASYNC_TARGET_ACTION,		/* other target command action */
64972938Smjacob	ISPASYNC_CONF_CHANGE,		/* Platform Configuration Change */
65079235Smjacob	ISPASYNC_UNHANDLED_RESPONSE,	/* Unhandled Response Entry */
65179235Smjacob	ISPASYNC_FW_CRASH		/* Firmware has crashed */
65243420Smjacob} ispasync_t;
65374229Smjacobint isp_async(struct ispsoftc *, ispasync_t, void *);
65443420Smjacob
65572355Smjacob#define	ISPASYNC_CHANGE_PDB	((void *) 0)
65672355Smjacob#define	ISPASYNC_CHANGE_SNS	((void *) 1)
65772355Smjacob#define	ISPASYNC_CHANGE_OTHER	((void *) 2)
65872355Smjacob
65943420Smjacob/*
66064087Smjacob * Platform Dependent Error and Debug Printout
66139235Sgibbs */
66270490Smjacob#ifdef	__GNUC__
66374229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...)
66470490Smjacob	__attribute__((__format__(__printf__,3,4)));
66570490Smjacob#else
66674229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...);
66770490Smjacob#endif
66870490Smjacob
66964087Smjacob#define	ISP_LOGALL	0x0	/* log always */
67064087Smjacob#define	ISP_LOGCONFIG	0x1	/* log configuration messages */
67164087Smjacob#define	ISP_LOGINFO	0x2	/* log informational messages */
67264087Smjacob#define	ISP_LOGWARN	0x4	/* log warning messages */
67364087Smjacob#define	ISP_LOGERR	0x8	/* log error messages */
67464087Smjacob#define	ISP_LOGDEBUG0	0x10	/* log simple debug messages */
67564087Smjacob#define	ISP_LOGDEBUG1	0x20	/* log intermediate debug messages */
67664087Smjacob#define	ISP_LOGDEBUG2	0x40	/* log most debug messages */
67779235Smjacob#define	ISP_LOGDEBUG3	0x80	/* log high frequency debug messages */
67879235Smjacob#define	ISP_LOGDEBUG4	0x100	/* log high frequency debug messages */
67964087Smjacob#define	ISP_LOGTDEBUG0	0x200	/* log simple debug messages (target mode) */
68064087Smjacob#define	ISP_LOGTDEBUG1	0x400	/* log intermediate debug messages (target) */
68164087Smjacob#define	ISP_LOGTDEBUG2	0x800	/* log all debug messages (target) */
68239235Sgibbs
68364087Smjacob/*
68464087Smjacob * Each Platform provides it's own isposinfo substructure of the ispsoftc
68564087Smjacob * defined above.
68664087Smjacob *
68764087Smjacob * Each platform must also provide the following macros/defines:
68864087Smjacob *
68964087Smjacob *
69064087Smjacob *	INLINE		-	platform specific define for 'inline' functions
69164087Smjacob *
69264087Smjacob *	ISP2100_SCRLEN	-	length for the Fibre Channel scratch DMA area
69364087Smjacob *
69464087Smjacob *	MEMZERO(dst, src)			platform zeroing function
69564087Smjacob *	MEMCPY(dst, src, count)			platform copying function
69664087Smjacob *	SNPRINTF(buf, bufsize, fmt, ...)	snprintf
69764087Smjacob *	STRNCAT(dstbuf, size, srcbuf)		strncat
69864087Smjacob *	USEC_DELAY(usecs)			microsecond spindelay function
69969522Smjacob *	USEC_SLEEP(isp, usecs)			microsecond sleep function
70064087Smjacob *
70164087Smjacob *	NANOTIME_T				nanosecond time type
70264087Smjacob *
70364087Smjacob *	GET_NANOTIME(NANOTIME_T *)		get current nanotime.
70464087Smjacob *
70564087Smjacob *	GET_NANOSEC(NANOTIME_T *)		get u_int64_t from NANOTIME_T
70664087Smjacob *
70764087Smjacob *	NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
70864087Smjacob *						subtract two NANOTIME_T values
70964087Smjacob *
71064087Smjacob *
71164087Smjacob *	MAXISPREQUEST(struct ispsoftc *)	maximum request queue size
71264087Smjacob *						for this particular board type
71364087Smjacob *
71464087Smjacob *	MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size)
71564087Smjacob *
71664087Smjacob *		Function/Macro the provides memory synchronization on
71764087Smjacob *		various objects so that the ISP's and the system's view
71864087Smjacob *		of the same object is consistent.
71964087Smjacob *
72064087Smjacob *	MBOX_ACQUIRE(struct ispsoftc *)		acquire lock on mailbox regs
72164087Smjacob *	MBOX_WAIT_COMPLETE(struct ispsoftc *)	wait for mailbox cmd to be done
72264087Smjacob *	MBOX_NOTIFY_COMPLETE(struct ispsoftc *)	notification of mbox cmd donee
72364087Smjacob *	MBOX_RELEASE(struct ispsoftc *)		release lock on mailbox regs
72464087Smjacob *
72572355Smjacob *
72664087Smjacob *	SCSI_GOOD	SCSI 'Good' Status
72764087Smjacob *	SCSI_CHECK	SCSI 'Check Condition' Status
72864087Smjacob *	SCSI_BUSY	SCSI 'Busy' Status
72964087Smjacob *	SCSI_QFULL	SCSI 'Queue Full' Status
73064087Smjacob *
73164087Smjacob *	XS_T		Platform SCSI transaction type (i.e., command for HBA)
73264087Smjacob *	XS_ISP(xs)	gets an instance out of an XS_T
73364087Smjacob *	XS_CHANNEL(xs)	gets the channel (bus # for DUALBUS cards) ""
73464087Smjacob *	XS_TGT(xs)	gets the target ""
73564087Smjacob *	XS_LUN(xs)	gets the lun ""
73664087Smjacob *	XS_CDBP(xs)	gets a pointer to the scsi CDB ""
73764087Smjacob *	XS_CDBLEN(xs)	gets the CDB's length ""
73864087Smjacob *	XS_XFRLEN(xs)	gets the associated data transfer length ""
73964087Smjacob *	XS_TIME(xs)	gets the time (in milliseconds) for this command
74064087Smjacob *	XS_RESID(xs)	gets the current residual count
74164087Smjacob *	XS_STSP(xs)	gets a pointer to the SCSI status byte ""
74264087Smjacob *	XS_SNSP(xs)	gets a pointer to the associate sense data
74364087Smjacob *	XS_SNSLEN(xs)	gets the length of sense data storage
74464087Smjacob *	XS_SNSKEY(xs)	dereferences XS_SNSP to get the current stored Sense Key
74564087Smjacob *	XS_TAG_P(xs)	predicate of whether this command should be tagged
74664087Smjacob *	XS_TAG_TYPE(xs)	which type of tag to use
74764087Smjacob *	XS_SETERR(xs)	set error state
74864087Smjacob *
74964087Smjacob *		HBA_NOERROR	command has no erros
75064087Smjacob *		HBA_BOTCH	hba botched something
75164087Smjacob *		HBA_CMDTIMEOUT	command timed out
75264087Smjacob *		HBA_SELTIMEOUT	selection timed out (also port logouts for FC)
75364087Smjacob *		HBA_TGTBSY	target returned a BUSY status
75464087Smjacob *		HBA_BUSRESET	bus reset destroyed command
75564087Smjacob *		HBA_ABORTED	command was aborted (by request)
75664087Smjacob *		HBA_DATAOVR	a data overrun was detected
75764087Smjacob *		HBA_ARQFAIL	Automatic Request Sense failed
75864087Smjacob *
75964087Smjacob *	XS_ERR(xs)	return current error state
76064087Smjacob *	XS_NOERR(xs)	there is no error currently set
76164087Smjacob *	XS_INITERR(xs)	initialize error state
76264087Smjacob *
76364087Smjacob *	XS_SAVE_SENSE(xs, sp)		save sense data
76464087Smjacob *
76564087Smjacob *	XS_SET_STATE_STAT(isp, sp, xs)	platform dependent interpreter of
76664087Smjacob *					response queue entry status bits
76764087Smjacob *
76864087Smjacob *
76964087Smjacob *	DEFAULT_IID(struct ispsoftc *)		Default SCSI initiator ID
77064087Smjacob *	DEFAULT_LOOPID(struct ispsoftc *)	Default FC Loop ID
77167047Smjacob *	DEFAULT_NODEWWN(struct ispsoftc *)	Default Node WWN
77267047Smjacob *	DEFAULT_PORTWWN(struct ispsoftc *)	Default Port WWN
77367047Smjacob *		These establish reasonable defaults for each platform.
77467047Smjacob * 		These must be available independent of card NVRAM and are
77567047Smjacob *		to be used should NVRAM not be readable.
77664087Smjacob *
77767047Smjacob *	ISP_NODEWWN(struct ispsoftc *)	FC Node WWN to use
77867047Smjacob *	ISP_PORTWWN(struct ispsoftc *)	FC Port WWN to use
77964087Smjacob *
78067047Smjacob *		These are to be used after NVRAM is read. The tags
78167047Smjacob *		in fcparam.isp_{node,port}wwn reflect the values
78267047Smjacob *		read from NVRAM (possibly corrected for card botches).
78367047Smjacob *		Each platform can take that information and override
78467047Smjacob *		it or ignore and return the Node and Port WWNs to be
78567047Smjacob * 		used when sending the Qlogic f/w the Initialization Control
78667047Smjacob *		Block.
78764087Smjacob *
78864087Smjacob *	(XXX these do endian specific transformations- in transition XXX)
78964087Smjacob *	ISP_SWIZZLE_ICB
79064087Smjacob *	ISP_UNSWIZZLE_AND_COPY_PDBP
79164087Smjacob *	ISP_SWIZZLE_CONTINUATION
79264087Smjacob *	ISP_SWIZZLE_REQUEST
79364087Smjacob *	ISP_UNSWIZZLE_RESPONSE
79464087Smjacob *	ISP_SWIZZLE_SNS_REQ
79564087Smjacob *	ISP_UNSWIZZLE_SNS_RSP
79664087Smjacob *	ISP_SWIZZLE_NVRAM_WORD
79764087Smjacob */
79877365Smjacob
79935388Smjacob#endif	/* _ISPVAR_H */
800