ispvar.h revision 48195
148195Smjacob/* $Id: ispvar.h,v 1.14 1999/05/11 05:02:23 mjacob Exp $ */
248195Smjacob/* release_5_11_99+ */
335388Smjacob/*
435388Smjacob * Soft Definitions for for Qlogic ISP SCSI adapters.
535388Smjacob *
635388Smjacob *---------------------------------------
735388Smjacob * Copyright (c) 1997, 1998 by Matthew Jacob
835388Smjacob * NASA/Ames Research Center
935388Smjacob * All rights reserved.
1035388Smjacob *---------------------------------------
1135388Smjacob * Redistribution and use in source and binary forms, with or without
1235388Smjacob * modification, are permitted provided that the following conditions
1335388Smjacob * are met:
1435388Smjacob * 1. Redistributions of source code must retain the above copyright
1535388Smjacob *    notice immediately at the beginning of the file, without modification,
1635388Smjacob *    this list of conditions, and the following disclaimer.
1735388Smjacob * 2. Redistributions in binary form must reproduce the above copyright
1835388Smjacob *    notice, this list of conditions and the following disclaimer in the
1935388Smjacob *    documentation and/or other materials provided with the distribution.
2035388Smjacob * 3. The name of the author may not be used to endorse or promote products
2135388Smjacob *    derived from this software without specific prior written permission.
2235388Smjacob *
2335388Smjacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2435388Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2535388Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2635388Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
2735388Smjacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2835388Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2935388Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3035388Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3135388Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3235388Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3335388Smjacob * SUCH DAMAGE.
3435388Smjacob *
3535388Smjacob */
3635388Smjacob
3735388Smjacob#ifndef	_ISPVAR_H
3835388Smjacob#define	_ISPVAR_H
3935388Smjacob
4044819Smjacob#if defined(__NetBSD__) || defined(__OpenBSD__)
4135388Smjacob#include <dev/ic/ispmbox.h>
4235388Smjacob#endif
4335388Smjacob#ifdef	__FreeBSD__
4435388Smjacob#include <dev/isp/ispmbox.h>
4535388Smjacob#endif
4635388Smjacob#ifdef	__linux__
4742131Smjacob#include "ispmbox.h"
4835388Smjacob#endif
4935388Smjacob
5039235Sgibbs#define	ISP_CORE_VERSION_MAJOR	1
5146968Smjacob#define	ISP_CORE_VERSION_MINOR	8
5239235Sgibbs
5335388Smjacob/*
5443420Smjacob * Vector for bus specific code to provide specific services.
5535388Smjacob */
5635388Smjacobstruct ispsoftc;
5735388Smjacobstruct ispmdvec {
5835388Smjacob	u_int16_t	(*dv_rd_reg) __P((struct ispsoftc *, int));
5935388Smjacob	void		(*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
6035388Smjacob	int		(*dv_mbxdma) __P((struct ispsoftc *));
6135388Smjacob	int		(*dv_dmaset) __P((struct ispsoftc *,
6235388Smjacob		ISP_SCSI_XFER_T *, ispreq_t *, u_int8_t *, u_int8_t));
6335388Smjacob	void		(*dv_dmaclr)
6435388Smjacob		__P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t));
6535388Smjacob	void		(*dv_reset0) __P((struct ispsoftc *));
6635388Smjacob	void		(*dv_reset1) __P((struct ispsoftc *));
6735388Smjacob	void		(*dv_dregs) __P((struct ispsoftc *));
6835388Smjacob	const u_int16_t *dv_ispfw;	/* ptr to f/w */
6935388Smjacob	u_int16_t 	dv_fwlen;	/* length of f/w */
7035388Smjacob	u_int16_t	dv_codeorg;	/* code ORG for f/w */
7135388Smjacob	u_int16_t	dv_fwrev;	/* f/w revision */
7235388Smjacob	/*
7335388Smjacob	 * Initial values for conf1 register
7435388Smjacob	 */
7535388Smjacob	u_int16_t	dv_conf1;
7635388Smjacob	u_int16_t	dv_clock;	/* clock frequency */
7735388Smjacob};
7835388Smjacob
7935388Smjacob#define	MAX_TARGETS	16
8044819Smjacob#ifdef	ISP2100_FABRIC
8144819Smjacob#define	MAX_FC_TARG	256
8244819Smjacob#else
8335388Smjacob#define	MAX_FC_TARG	126
8444819Smjacob#endif
8541519Smjacob#define	DEFAULT_LOOPID	113
8635388Smjacob
8739235Sgibbs/* queue length must be a power of two */
8839235Sgibbs#define	QENTRY_LEN			64
8939235Sgibbs#define	RQUEST_QUEUE_LEN		MAXISPREQUEST
9044819Smjacob#define	RESULT_QUEUE_LEN		(MAXISPREQUEST/2)
9139235Sgibbs#define	ISP_QUEUE_ENTRY(q, idx)		((q) + ((idx) * QENTRY_LEN))
9239235Sgibbs#define	ISP_QUEUE_SIZE(n)		((n) * QENTRY_LEN)
9339235Sgibbs#define	ISP_NXT_QENTRY(idx, qlen)	(((idx) + 1) & ((qlen)-1))
9439235Sgibbs#define ISP_QAVAIL(in, out, qlen)	\
9539235Sgibbs	((in == out)? (qlen - 1) : ((in > out)? \
9639235Sgibbs		((qlen - 1) - (in - out)) : (out - in - 1)))
9735388Smjacob/*
9846968Smjacob * SCSI Specific Host Adapter Parameters- per bus, per target
9935388Smjacob */
10035388Smjacob
10135388Smjacobtypedef struct {
10246968Smjacob	u_int		isp_gotdparms		: 1,
10346968Smjacob        		isp_req_ack_active_neg	: 1,
10435388Smjacob	        	isp_data_line_active_neg: 1,
10535388Smjacob			isp_cmd_dma_burst_enable: 1,
10635388Smjacob			isp_data_dma_burst_enabl: 1,
10742461Smjacob			isp_fifo_threshold	: 3,
10843420Smjacob			isp_ultramode		: 1,
10935388Smjacob			isp_diffmode		: 1,
11045040Smjacob			isp_lvdmode		: 1,
11146968Smjacob						: 1,
11235388Smjacob			isp_initiator_id	: 4,
11335388Smjacob        		isp_async_data_setup	: 4;
11435388Smjacob        u_int16_t	isp_selection_timeout;
11535388Smjacob        u_int16_t	isp_max_queue_depth;
11635388Smjacob	u_int8_t	isp_tag_aging;
11735388Smjacob       	u_int8_t	isp_bus_reset_delay;
11835388Smjacob        u_int8_t	isp_retry_count;
11935388Smjacob        u_int8_t	isp_retry_delay;
12035388Smjacob	struct {
12146968Smjacob		u_int	dev_enable	:	1,	/* ignored */
12246968Smjacob					:	1,
12343420Smjacob			dev_update	:	1,
12443420Smjacob			dev_refresh	:	1,
12545040Smjacob			exc_throttle	:	8,
12645040Smjacob			cur_offset	:	4,
12745040Smjacob			sync_offset	:	4;
12845040Smjacob		u_int8_t	cur_period;	/* current sync period */
12945040Smjacob		u_int8_t	sync_period;	/* goal sync period */
13045040Smjacob		u_int16_t	dev_flags;	/* goal device flags */
13145040Smjacob		u_int16_t	cur_dflags;	/* current device flags */
13235388Smjacob	} isp_devparam[MAX_TARGETS];
13346968Smjacob} sdparam;
13435388Smjacob
13535388Smjacob/*
13635388Smjacob * Device Flags
13735388Smjacob */
13839235Sgibbs#define	DPARM_DISC	0x8000
13939235Sgibbs#define	DPARM_PARITY	0x4000
14039235Sgibbs#define	DPARM_WIDE	0x2000
14139235Sgibbs#define	DPARM_SYNC	0x1000
14239235Sgibbs#define	DPARM_TQING	0x0800
14339235Sgibbs#define	DPARM_ARQ	0x0400
14439235Sgibbs#define	DPARM_QFRZ	0x0200
14539235Sgibbs#define	DPARM_RENEG	0x0100
14639235Sgibbs#define	DPARM_NARROW	0x0080	/* Possibly only available with >= 7.55 fw */
14739235Sgibbs#define	DPARM_ASYNC	0x0040	/* Possibly only available with >= 7.55 fw */
14843793Smjacob#define	DPARM_DEFAULT	(0xFF00 & ~DPARM_QFRZ)
14939235Sgibbs#define	DPARM_SAFE_DFLT	(DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
15035388Smjacob
15139235Sgibbs
15245040Smjacob/* technically, not really correct, as they need to be rated based upon clock */
15345040Smjacob#define	ISP_40M_SYNCPARMS	0x080a
15435388Smjacob#define ISP_20M_SYNCPARMS	0x080c
15535388Smjacob#define ISP_10M_SYNCPARMS	0x0c19
15635388Smjacob#define ISP_08M_SYNCPARMS	0x0c25
15735388Smjacob#define ISP_05M_SYNCPARMS	0x0c32
15835388Smjacob#define ISP_04M_SYNCPARMS	0x0c41
15935388Smjacob
16035388Smjacob/*
16135388Smjacob * Fibre Channel Specifics
16235388Smjacob */
16335388Smjacobtypedef struct {
16446968Smjacob	u_int8_t		isp_gotdparms;
16546968Smjacob	u_int8_t		isp_reserved;
16639235Sgibbs	u_int8_t		isp_loopid;	/* hard loop id */
16739235Sgibbs	u_int8_t		isp_alpa;	/* ALPA */
16839235Sgibbs	u_int8_t		isp_execthrottle;
16939235Sgibbs        u_int8_t		isp_retry_delay;
17035388Smjacob        u_int8_t		isp_retry_count;
17135388Smjacob	u_int8_t		isp_fwstate;	/* ISP F/W state */
17246968Smjacob	u_int64_t		isp_wwn;	/* WWN of adapter */
17339235Sgibbs	u_int16_t		isp_maxalloc;
17439235Sgibbs	u_int16_t		isp_maxfrmlen;
17539235Sgibbs	u_int16_t		isp_fwoptions;
17635388Smjacob	/*
17744819Smjacob	 * Port Data Base
17844819Smjacob	 */
17944819Smjacob	isp_pdb_t		isp_pdb[MAX_FC_TARG];
18044819Smjacob
18144819Smjacob	/*
18235388Smjacob	 * Scratch DMA mapped in area to fetch Port Database stuff, etc.
18335388Smjacob	 */
18448195Smjacob	caddr_t			isp_scratch;
18535388Smjacob	u_int32_t		isp_scdma;
18635388Smjacob} fcparam;
18735388Smjacob
18835388Smjacob#define	ISP2100_SCRLEN		0x100
18935388Smjacob
19035388Smjacob#define	FW_CONFIG_WAIT		0x0000
19135388Smjacob#define	FW_WAIT_AL_PA		0x0001
19235388Smjacob#define	FW_WAIT_LOGIN		0x0002
19335388Smjacob#define	FW_READY		0x0003
19435388Smjacob#define	FW_LOSS_OF_SYNC		0x0004
19535388Smjacob#define	FW_ERROR		0x0005
19635388Smjacob#define	FW_REINIT		0x0006
19735388Smjacob#define	FW_NON_PART		0x0007
19835388Smjacob
19942131Smjacob#ifdef	ISP_TARGET_MODE
20042131Smjacob/*
20142131Smjacob * Some temporary Target Mode definitions
20242131Smjacob */
20342131Smjacobtypedef struct tmd_cmd {
20442131Smjacob	u_int8_t	cd_iid;		/* initiator */
20542131Smjacob	u_int8_t	cd_tgt;		/* target */
20642131Smjacob	u_int8_t	cd_lun;		/* LUN for this command */
20742131Smjacob	u_int8_t	cd_state;
20842131Smjacob	u_int8_t	cd_cdb[16];	/* command bytes */
20942131Smjacob	u_int8_t	cd_sensedata[20];
21042131Smjacob	u_int16_t	cd_rxid;
21142131Smjacob	u_int32_t	cd_datalen;
21242131Smjacob	u_int32_t	cd_totbytes;
21342131Smjacob	void *		cd_hba;
21442131Smjacob} tmd_cmd_t;
21541519Smjacob
21635388Smjacob/*
21742131Smjacob * Async Target Mode Event Definitions
21842131Smjacob */
21942131Smjacob#define	TMD_BUS_RESET	0
22042131Smjacob#define	TMD_BDR		1
22142131Smjacob
22242131Smjacob/*
22342131Smjacob * Immediate Notify data structure.
22442131Smjacob */
22542131Smjacob#define NOTIFY_MSGLEN	5
22642131Smjacobtypedef struct {
22742131Smjacob	u_int8_t	nt_iid;			/* initiator */
22842131Smjacob	u_int8_t	nt_tgt;			/* target */
22942131Smjacob	u_int8_t	nt_lun;			/* LUN for this command */
23042131Smjacob	u_int8_t	nt_msg[NOTIFY_MSGLEN];	/* SCSI message byte(s) */
23142131Smjacob} tmd_notify_t;
23242131Smjacob
23342131Smjacob#endif
23442131Smjacob
23542131Smjacob/*
23635388Smjacob * Soft Structure per host adapter
23735388Smjacob */
23835388Smjacobstruct ispsoftc {
23935388Smjacob	/*
24035388Smjacob	 * Platform (OS) specific data
24135388Smjacob	 */
24235388Smjacob	struct isposinfo	isp_osinfo;
24335388Smjacob
24435388Smjacob	/*
24535388Smjacob	 * Pointer to bus specific data
24635388Smjacob	 */
24735388Smjacob	struct ispmdvec *	isp_mdvec;
24835388Smjacob
24935388Smjacob	/*
25046968Smjacob	 * Mostly nonvolatile state.
25135388Smjacob	 */
25235388Smjacob
25346968Smjacob	u_int		isp_clock	: 8,
25439235Sgibbs			isp_confopts	: 8,
25546968Smjacob			isp_fast_mttr	: 1,
25646968Smjacob					: 1,
25744819Smjacob			isp_used	: 1,
25839235Sgibbs			isp_dblev	: 3,
25935388Smjacob			isp_dogactive	: 1,
26039235Sgibbs			isp_bustype	: 1,	/* BUS Implementation */
26139235Sgibbs			isp_type	: 8;	/* HBA Type and Revision */
26235388Smjacob
26345282Smjacob	u_int16_t		isp_fwrev[3];	/* Running F/W revision */
26445282Smjacob	u_int16_t		isp_romfw_rev[3]; /* 'ROM' F/W revision */
26539235Sgibbs	void * 			isp_param;
26639235Sgibbs
26735388Smjacob	/*
26839235Sgibbs	 * Volatile state
26935388Smjacob	 */
27035388Smjacob
27139235Sgibbs	volatile u_int
27246968Smjacob				:	13,
27339235Sgibbs		isp_state	:	3,
27446968Smjacob				:	2,
27546968Smjacob		isp_sendmarker	:	2,	/* send a marker entry */
27646968Smjacob		isp_update	:	2,	/* update parameters */
27746968Smjacob		isp_nactive	:	10;	/* how many commands active */
27839235Sgibbs
27935388Smjacob	/*
28039235Sgibbs	 * Result and Request Queue indices.
28135388Smjacob	 */
28239235Sgibbs	volatile u_int8_t	isp_reqodx;	/* index of last ISP pickup */
28335388Smjacob	volatile u_int8_t	isp_reqidx;	/* index of next request */
28435388Smjacob	volatile u_int8_t	isp_residx;	/* index of next result */
28539235Sgibbs	volatile u_int8_t	isp_seqno;	/* rolling sequence # */
28635388Smjacob
28735388Smjacob	/*
28835388Smjacob	 * Sheer laziness, but it gets us around the problem
28935388Smjacob	 * where we don't have a clean way of remembering
29035388Smjacob	 * which transaction is bound to which ISP queue entry.
29135388Smjacob	 *
29235388Smjacob	 * There are other more clever ways to do this, but,
29335388Smjacob	 * jeez, so I blow a couple of KB per host adapter...
29435388Smjacob	 * and it *is* faster.
29535388Smjacob	 */
29643420Smjacob	ISP_SCSI_XFER_T *isp_xflist[RQUEST_QUEUE_LEN];
29735388Smjacob
29835388Smjacob	/*
29939235Sgibbs	 * request/result queues and dma handles for them.
30035388Smjacob	 */
30148195Smjacob	caddr_t			isp_rquest;
30248195Smjacob	caddr_t			isp_result;
30335388Smjacob	u_int32_t		isp_rquest_dma;
30435388Smjacob	u_int32_t		isp_result_dma;
30541519Smjacob
30642131Smjacob#ifdef	ISP_TARGET_MODE
30742131Smjacob	/*
30842131Smjacob	 * Vectors for handling target mode support.
30942131Smjacob	 *
31042131Smjacob	 * isp_tmd_newcmd is for feeding a newly arrived command to some
31142131Smjacob	 * upper layer.
31242131Smjacob	 *
31342131Smjacob	 * isp_tmd_event is for notifying some upper layer that an event has
31442131Smjacob	 * occurred that is not necessarily tied to any target (e.g., a SCSI
31542131Smjacob	 * Bus Reset).
31642131Smjacob	 *
31742131Smjacob	 * isp_tmd_notify is for notifying some upper layer that some
31842131Smjacob	 * event is now occurring that is either pertinent for a specific
31942131Smjacob	 * device or for a specific command (e.g., BDR or ABORT TAG).
32042131Smjacob	 *
32142131Smjacob	 * It is left undefined (for now) how pools of commands are managed.
32242131Smjacob	 */
32342131Smjacob	void		(*isp_tmd_newcmd) __P((void *, tmd_cmd_t *));
32442131Smjacob	void		(*isp_tmd_event) __P((void *, int));
32542131Smjacob	void		(*isp_tmd_notify) __P((void *, tmd_notify_t *));
32642131Smjacob#endif
32735388Smjacob};
32835388Smjacob
32935388Smjacob/*
33035388Smjacob * ISP States
33135388Smjacob */
33235388Smjacob#define	ISP_NILSTATE	0
33335388Smjacob#define	ISP_RESETSTATE	1
33435388Smjacob#define	ISP_INITSTATE	2
33535388Smjacob#define	ISP_RUNSTATE	3
33635388Smjacob
33735388Smjacob/*
33835388Smjacob * ISP Configuration Options
33935388Smjacob */
34035388Smjacob#define	ISP_CFG_NORELOAD	0x80	/* don't download f/w */
34143793Smjacob#define	ISP_CFG_NONVRAM		0x40	/* ignore NVRAM */
34235388Smjacob
34345282Smjacob#define	ISP_FW_REV(maj, min, mic)	((maj << 24) | (min << 16) | mic)
34446968Smjacob#define	ISP_FW_REVX(xp)	((xp[0]<<24) | (xp[1] << 16) | xp[2])
34539235Sgibbs
34645282Smjacob
34735388Smjacob/*
34839235Sgibbs * Bus (implementation) types
34935388Smjacob */
35039235Sgibbs#define	ISP_BT_PCI		0	/* PCI Implementations */
35139235Sgibbs#define	ISP_BT_SBUS		1	/* SBus Implementations */
35239235Sgibbs
35339235Sgibbs/*
35439235Sgibbs * Chip Types
35539235Sgibbs */
35635388Smjacob#define	ISP_HA_SCSI		0xf
35739235Sgibbs#define	ISP_HA_SCSI_UNKNOWN	0x1
35839235Sgibbs#define	ISP_HA_SCSI_1020	0x2
35939235Sgibbs#define	ISP_HA_SCSI_1020A	0x3
36039235Sgibbs#define	ISP_HA_SCSI_1040	0x4
36139235Sgibbs#define	ISP_HA_SCSI_1040A	0x5
36239235Sgibbs#define	ISP_HA_SCSI_1040B	0x6
36345282Smjacob#define	ISP_HA_SCSI_1040C	0x7
36445040Smjacob#define	ISP_HA_SCSI_1080	0xd
36545040Smjacob#define	ISP_HA_SCSI_12X0	0xe
36635388Smjacob#define	ISP_HA_FC		0xf0
36735388Smjacob#define	ISP_HA_FC_2100		0x10
36835388Smjacob
36944819Smjacob#define	IS_SCSI(isp)	(isp->isp_type & ISP_HA_SCSI)
37044819Smjacob#define	IS_1080(isp)	(isp->isp_type == ISP_HA_SCSI_1080)
37145040Smjacob#define	IS_12X0(isp)	(isp->isp_type == ISP_HA_SCSI_12X0)
37244819Smjacob#define	IS_FC(isp)	(isp->isp_type & ISP_HA_FC)
37344819Smjacob
37435388Smjacob/*
37543420Smjacob * Macros to read, write ISP registers through bus specific code.
37635388Smjacob */
37735388Smjacob
37835388Smjacob#define	ISP_READ(isp, reg)	\
37935388Smjacob	(*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
38035388Smjacob
38135388Smjacob#define	ISP_WRITE(isp, reg, val)	\
38235388Smjacob	(*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
38335388Smjacob
38435388Smjacob#define	ISP_MBOXDMASETUP(isp)	\
38535388Smjacob	(*(isp)->isp_mdvec->dv_mbxdma)((isp))
38635388Smjacob
38735388Smjacob#define	ISP_DMASETUP(isp, xs, req, iptrp, optr)	\
38835388Smjacob	(*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
38935388Smjacob
39035388Smjacob#define	ISP_DMAFREE(isp, xs, seqno)	\
39135388Smjacob	if ((isp)->isp_mdvec->dv_dmaclr) \
39235388Smjacob		 (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (seqno))
39335388Smjacob
39435388Smjacob#define	ISP_RESET0(isp)	\
39535388Smjacob	if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp))
39635388Smjacob#define	ISP_RESET1(isp)	\
39735388Smjacob	if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp))
39835388Smjacob#define	ISP_DUMPREGS(isp)	\
39935388Smjacob	if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp))
40035388Smjacob
40135388Smjacob#define	ISP_SETBITS(isp, reg, val)	\
40235388Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val))
40335388Smjacob
40435388Smjacob#define	ISP_CLRBITS(isp, reg, val)	\
40535388Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val))
40635388Smjacob
40735388Smjacob/*
40835388Smjacob * Function Prototypes
40935388Smjacob */
41035388Smjacob
41135388Smjacob/*
41239235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with
41339235Sgibbs * a call to isp_init.
41435388Smjacob */
41535388Smjacobvoid isp_reset __P((struct ispsoftc *));
41635388Smjacob
41735388Smjacob/*
41835388Smjacob * Initialize Hardware to known state
41935388Smjacob */
42035388Smjacobvoid isp_init __P((struct ispsoftc *));
42135388Smjacob
42235388Smjacob/*
42339235Sgibbs * Reset the ISP and call completion for any orphaned commands.
42439235Sgibbs */
42539235Sgibbsvoid isp_restart __P((struct ispsoftc *));
42639235Sgibbs
42739235Sgibbs/*
42835388Smjacob * Interrupt Service Routine
42935388Smjacob */
43035388Smjacobint isp_intr __P((void *));
43135388Smjacob
43235388Smjacob/*
43335388Smjacob * Command Entry Point
43435388Smjacob */
43539235Sgibbsint32_t ispscsicmd __P((ISP_SCSI_XFER_T *));
43635388Smjacob
43739235Sgibbs/*
43843420Smjacob * Platform Dependent to External to Internal Control Function
43939235Sgibbs *
44039235Sgibbs * For: 	Aborting a running command	- arg is an ISP_SCSI_XFER_T *
44139235Sgibbs *		Resetting a Device		- arg is target to reset
44239235Sgibbs *		Resetting a BUS			- arg is ignored
44339235Sgibbs *		Updating parameters		- arg is ignored
44439235Sgibbs *
44543420Smjacob * First argument is this instance's softc pointer.
44639235Sgibbs * Second argument is an index into xflist array.
44739235Sgibbs * Assumes all locks must be held already.
44839235Sgibbs */
44939235Sgibbstypedef enum {
45039235Sgibbs	ISPCTL_RESET_BUS,
45139235Sgibbs	ISPCTL_RESET_DEV,
45239235Sgibbs	ISPCTL_ABORT_CMD,
45339235Sgibbs	ISPCTL_UPDATE_PARAMS,
45444819Smjacob	ISPCTL_FCLINK_TEST
45539235Sgibbs} ispctl_t;
45639235Sgibbsint isp_control __P((struct ispsoftc *, ispctl_t, void *));
45739235Sgibbs
45843420Smjacob
45939235Sgibbs/*
46043420Smjacob * Platform Dependent to Internal to External Control Function
46143420Smjacob * (each platform must provide such a function)
46243420Smjacob *
46343420Smjacob * For: 	Announcing Target Paramter Changes (arg is target)
46443420Smjacob *
46543420Smjacob * Assumes all locks are held.
46643420Smjacob */
46743420Smjacob
46843420Smjacobtypedef enum {
46943793Smjacob	ISPASYNC_NEW_TGT_PARAMS,
47044819Smjacob	ISPASYNC_BUS_RESET,		/* Bus Reset */
47143793Smjacob	ISPASYNC_LOOP_DOWN,		/* Obvious FC only */
47244819Smjacob	ISPASYNC_LOOP_UP,		/* "" */
47344819Smjacob	ISPASYNC_PDB_CHANGE_COMPLETE,	/* "" */
47444819Smjacob	ISPASYNC_CHANGE_NOTIFY		/* "" */
47543420Smjacob} ispasync_t;
47643420Smjacobint isp_async __P((struct ispsoftc *, ispasync_t, void *));
47743420Smjacob
47843420Smjacob/*
47939235Sgibbs * lost command routine (XXXX IN TRANSITION XXXX)
48039235Sgibbs */
48139235Sgibbsvoid isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
48239235Sgibbs
48339235Sgibbs
48435388Smjacob#endif	/* _ISPVAR_H */
485