ispvar.h revision 59454
150477Speter/* $FreeBSD: head/sys/dev/isp/ispvar.h 59454 2000-04-21 02:06:30Z mjacob $ */ 235388Smjacob/* 335388Smjacob * Soft Definitions for for Qlogic ISP SCSI adapters. 435388Smjacob * 548484Smjacob * Copyright (c) 1997, 1998, 1999 by Matthew Jacob 635388Smjacob * NASA/Ames Research Center 735388Smjacob * All rights reserved. 852347Smjacob * 935388Smjacob * Redistribution and use in source and binary forms, with or without 1035388Smjacob * modification, are permitted provided that the following conditions 1135388Smjacob * are met: 1235388Smjacob * 1. Redistributions of source code must retain the above copyright 1335388Smjacob * notice immediately at the beginning of the file, without modification, 1435388Smjacob * this list of conditions, and the following disclaimer. 1535388Smjacob * 2. Redistributions in binary form must reproduce the above copyright 1635388Smjacob * notice, this list of conditions and the following disclaimer in the 1735388Smjacob * documentation and/or other materials provided with the distribution. 1835388Smjacob * 3. The name of the author may not be used to endorse or promote products 1935388Smjacob * derived from this software without specific prior written permission. 2035388Smjacob * 2135388Smjacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2235388Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2335388Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2435388Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 2535388Smjacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2635388Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2735388Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2835388Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2935388Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3035388Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3135388Smjacob * SUCH DAMAGE. 3235388Smjacob * 3335388Smjacob */ 3435388Smjacob 3535388Smjacob#ifndef _ISPVAR_H 3635388Smjacob#define _ISPVAR_H 3735388Smjacob 3844819Smjacob#if defined(__NetBSD__) || defined(__OpenBSD__) 3935388Smjacob#include <dev/ic/ispmbox.h> 4053487Smjacob#ifdef ISP_TARGET_MODE 4153487Smjacob#include <dev/ic/isp_target.h> 4256004Smjacob#include <dev/ic/isp_tpublic.h> 4335388Smjacob#endif 4453487Smjacob#endif 4535388Smjacob#ifdef __FreeBSD__ 4635388Smjacob#include <dev/isp/ispmbox.h> 4753487Smjacob#ifdef ISP_TARGET_MODE 4853487Smjacob#include <dev/isp/isp_target.h> 4956004Smjacob#include <dev/isp/isp_tpublic.h> 5035388Smjacob#endif 5153487Smjacob#endif 5235388Smjacob#ifdef __linux__ 5342131Smjacob#include "ispmbox.h" 5453487Smjacob#ifdef ISP_TARGET_MODE 5553487Smjacob#include "isp_target.h" 5656004Smjacob#include "isp_tpublic.h" 5735388Smjacob#endif 5853487Smjacob#endif 5935388Smjacob 6039235Sgibbs#define ISP_CORE_VERSION_MAJOR 1 6159454Smjacob#define ISP_CORE_VERSION_MINOR 13 6239235Sgibbs 6335388Smjacob/* 6443420Smjacob * Vector for bus specific code to provide specific services. 6535388Smjacob */ 6635388Smjacobstruct ispsoftc; 6735388Smjacobstruct ispmdvec { 6835388Smjacob u_int16_t (*dv_rd_reg) __P((struct ispsoftc *, int)); 6935388Smjacob void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t)); 7035388Smjacob int (*dv_mbxdma) __P((struct ispsoftc *)); 7135388Smjacob int (*dv_dmaset) __P((struct ispsoftc *, 7253487Smjacob ISP_SCSI_XFER_T *, ispreq_t *, u_int16_t *, u_int16_t)); 7335388Smjacob void (*dv_dmaclr) 7435388Smjacob __P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t)); 7535388Smjacob void (*dv_reset0) __P((struct ispsoftc *)); 7635388Smjacob void (*dv_reset1) __P((struct ispsoftc *)); 7735388Smjacob void (*dv_dregs) __P((struct ispsoftc *)); 7835388Smjacob const u_int16_t *dv_ispfw; /* ptr to f/w */ 7935388Smjacob u_int16_t dv_fwlen; /* length of f/w */ 8035388Smjacob u_int16_t dv_codeorg; /* code ORG for f/w */ 8149909Smjacob u_int32_t dv_fwrev; /* f/w revision */ 8235388Smjacob /* 8335388Smjacob * Initial values for conf1 register 8435388Smjacob */ 8535388Smjacob u_int16_t dv_conf1; 8635388Smjacob u_int16_t dv_clock; /* clock frequency */ 8735388Smjacob}; 8835388Smjacob 8935388Smjacob#define MAX_TARGETS 16 9044819Smjacob#ifdef ISP2100_FABRIC 9144819Smjacob#define MAX_FC_TARG 256 9244819Smjacob#else 9335388Smjacob#define MAX_FC_TARG 126 9444819Smjacob#endif 9535388Smjacob 9649909Smjacob#define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS) 9749909Smjacob#ifdef ISP2100_SCCLUN 9849909Smjacob#define _ISP_FC_LUN(isp) 65536 9949909Smjacob#else 10049909Smjacob#define _ISP_FC_LUN(isp) 16 10149909Smjacob#endif 10249909Smjacob#define _ISP_SCSI_LUN(isp) \ 10352347Smjacob ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))? 32 : 8) 10449909Smjacob#define ISP_MAX_LUNS(isp) \ 10549909Smjacob (IS_FC(isp)? _ISP_FC_LUN(isp) : _ISP_SCSI_LUN(isp)) 10649909Smjacob 10753487Smjacob 10853487Smjacob/* 10953487Smjacob * Macros to read, write ISP registers through bus specific code. 11053487Smjacob */ 11153487Smjacob 11253487Smjacob#define ISP_READ(isp, reg) \ 11353487Smjacob (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg)) 11453487Smjacob 11553487Smjacob#define ISP_WRITE(isp, reg, val) \ 11653487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val)) 11753487Smjacob 11853487Smjacob#define ISP_MBOXDMASETUP(isp) \ 11953487Smjacob (*(isp)->isp_mdvec->dv_mbxdma)((isp)) 12053487Smjacob 12153487Smjacob#define ISP_DMASETUP(isp, xs, req, iptrp, optr) \ 12253487Smjacob (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr)) 12353487Smjacob 12453487Smjacob#define ISP_DMAFREE(isp, xs, hndl) \ 12553487Smjacob if ((isp)->isp_mdvec->dv_dmaclr) \ 12653487Smjacob (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl)) 12753487Smjacob 12853487Smjacob#define ISP_RESET0(isp) \ 12953487Smjacob if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp)) 13053487Smjacob#define ISP_RESET1(isp) \ 13153487Smjacob if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp)) 13253487Smjacob#define ISP_DUMPREGS(isp) \ 13353487Smjacob if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp)) 13453487Smjacob 13553487Smjacob#define ISP_SETBITS(isp, reg, val) \ 13653487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val)) 13753487Smjacob 13853487Smjacob#define ISP_CLRBITS(isp, reg, val) \ 13953487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val)) 14053487Smjacob 14152347Smjacob/* this is the size of a queue entry (request and response) */ 14239235Sgibbs#define QENTRY_LEN 64 14352347Smjacob/* both request and result queue length must be a power of two */ 14439235Sgibbs#define RQUEST_QUEUE_LEN MAXISPREQUEST 14552347Smjacob/* I've seen wierdnesses with the result queue < 64 */ 14652347Smjacob#if MAXISPREQUEST > 64 14744819Smjacob#define RESULT_QUEUE_LEN (MAXISPREQUEST/2) 14852347Smjacob#else 14952347Smjacob#define RESULT_QUEUE_LEN MAXISPREQUEST 15052347Smjacob#endif 15139235Sgibbs#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN)) 15239235Sgibbs#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN) 15339235Sgibbs#define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1)) 15452347Smjacob#define ISP_QAVAIL(in, out, qlen) \ 15539235Sgibbs ((in == out)? (qlen - 1) : ((in > out)? \ 15652347Smjacob ((qlen - 1) - (in - out)) : (out - in - 1))) 15753487Smjacob 15853487Smjacob#define ISP_ADD_REQUEST(isp, iptr) \ 15953487Smjacob ISP_WRITE(isp, INMAILBOX4, iptr), isp->isp_reqidx = iptr 16053487Smjacob 16135388Smjacob/* 16246968Smjacob * SCSI Specific Host Adapter Parameters- per bus, per target 16335388Smjacob */ 16435388Smjacob 16535388Smjacobtypedef struct { 16646968Smjacob u_int isp_gotdparms : 1, 16752347Smjacob isp_req_ack_active_neg : 1, 16852347Smjacob isp_data_line_active_neg: 1, 16935388Smjacob isp_cmd_dma_burst_enable: 1, 17035388Smjacob isp_data_dma_burst_enabl: 1, 17142461Smjacob isp_fifo_threshold : 3, 17243420Smjacob isp_ultramode : 1, 17335388Smjacob isp_diffmode : 1, 17445040Smjacob isp_lvdmode : 1, 17546968Smjacob : 1, 17635388Smjacob isp_initiator_id : 4, 17752347Smjacob isp_async_data_setup : 4; 17852347Smjacob u_int16_t isp_selection_timeout; 17952347Smjacob u_int16_t isp_max_queue_depth; 18035388Smjacob u_int8_t isp_tag_aging; 18152347Smjacob u_int8_t isp_bus_reset_delay; 18252347Smjacob u_int8_t isp_retry_count; 18352347Smjacob u_int8_t isp_retry_delay; 18435388Smjacob struct { 18546968Smjacob u_int dev_enable : 1, /* ignored */ 18646968Smjacob : 1, 18743420Smjacob dev_update : 1, 18843420Smjacob dev_refresh : 1, 18945040Smjacob exc_throttle : 8, 19045040Smjacob cur_offset : 4, 19145040Smjacob sync_offset : 4; 19245040Smjacob u_int8_t cur_period; /* current sync period */ 19345040Smjacob u_int8_t sync_period; /* goal sync period */ 19445040Smjacob u_int16_t dev_flags; /* goal device flags */ 19545040Smjacob u_int16_t cur_dflags; /* current device flags */ 19635388Smjacob } isp_devparam[MAX_TARGETS]; 19746968Smjacob} sdparam; 19835388Smjacob 19935388Smjacob/* 20035388Smjacob * Device Flags 20135388Smjacob */ 20239235Sgibbs#define DPARM_DISC 0x8000 20339235Sgibbs#define DPARM_PARITY 0x4000 20439235Sgibbs#define DPARM_WIDE 0x2000 20539235Sgibbs#define DPARM_SYNC 0x1000 20639235Sgibbs#define DPARM_TQING 0x0800 20739235Sgibbs#define DPARM_ARQ 0x0400 20839235Sgibbs#define DPARM_QFRZ 0x0200 20939235Sgibbs#define DPARM_RENEG 0x0100 21039235Sgibbs#define DPARM_NARROW 0x0080 /* Possibly only available with >= 7.55 fw */ 21139235Sgibbs#define DPARM_ASYNC 0x0040 /* Possibly only available with >= 7.55 fw */ 21243793Smjacob#define DPARM_DEFAULT (0xFF00 & ~DPARM_QFRZ) 21339235Sgibbs#define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING)) 21435388Smjacob 21539235Sgibbs 21645040Smjacob/* technically, not really correct, as they need to be rated based upon clock */ 21745040Smjacob#define ISP_40M_SYNCPARMS 0x080a 21852347Smjacob#define ISP_20M_SYNCPARMS 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, 23359454Smjacob : 4, 23448484Smjacob loop_seen_once : 1, 23548484Smjacob isp_loopstate : 3, /* Current Loop State */ 23648484Smjacob isp_fwstate : 3, /* ISP F/W state */ 23748484Smjacob isp_gotdparms : 1, 23859454Smjacob isp_topo : 3, 23948484Smjacob isp_onfabric : 1; 24039235Sgibbs u_int8_t isp_loopid; /* hard loop id */ 24139235Sgibbs u_int8_t isp_alpa; /* ALPA */ 24252347Smjacob volatile u_int16_t isp_lipseq; /* LIP sequence # */ 24348484Smjacob u_int32_t isp_portid; 24439235Sgibbs u_int8_t isp_execthrottle; 24552347Smjacob u_int8_t isp_retry_delay; 24652347Smjacob u_int8_t isp_retry_count; 24752347Smjacob u_int8_t isp_reserved; 24839235Sgibbs u_int16_t isp_maxalloc; 24939235Sgibbs u_int16_t isp_maxfrmlen; 25048484Smjacob u_int64_t isp_nodewwn; 25148484Smjacob u_int64_t isp_portwwn; 25235388Smjacob /* 25348484Smjacob * Port Data Base. This is indexed by 'target', which is invariate. 25448484Smjacob * However, elements within can move around due to loop changes, 25548484Smjacob * so the actual loop ID passed to the F/W is in this structure. 25648484Smjacob * The first time the loop is seen up, loopid will match the index 25748484Smjacob * (except for fabric nodes which are above mapped above FC_SNS_ID 25848484Smjacob * and are completely virtual), but subsequent LIPs can cause things 25948484Smjacob * to move around. 26044819Smjacob */ 26148484Smjacob struct lportdb { 26252347Smjacob u_int 26348484Smjacob loopid : 8, 26448484Smjacob : 4, 26548484Smjacob fabdev : 1, 26648484Smjacob roles : 2, 26748484Smjacob valid : 1; 26852347Smjacob u_int32_t portid; 26948484Smjacob u_int64_t node_wwn; 27048484Smjacob u_int64_t port_wwn; 27152347Smjacob } portdb[MAX_FC_TARG], tport[FL_PORT_ID]; 27244819Smjacob 27344819Smjacob /* 27435388Smjacob * Scratch DMA mapped in area to fetch Port Database stuff, etc. 27535388Smjacob */ 27648195Smjacob caddr_t isp_scratch; 27735388Smjacob u_int32_t isp_scdma; 27835388Smjacob} fcparam; 27935388Smjacob 28048484Smjacob#define FW_CONFIG_WAIT 0 28148484Smjacob#define FW_WAIT_AL_PA 1 28248484Smjacob#define FW_WAIT_LOGIN 2 28348484Smjacob#define FW_READY 3 28448484Smjacob#define FW_LOSS_OF_SYNC 4 28548484Smjacob#define FW_ERROR 5 28648484Smjacob#define FW_REINIT 6 28748484Smjacob#define FW_NON_PART 7 28835388Smjacob 28948484Smjacob#define LOOP_NIL 0 29048484Smjacob#define LOOP_LIP_RCVD 1 29148484Smjacob#define LOOP_PDB_RCVD 2 29248484Smjacob#define LOOP_READY 7 29335388Smjacob 29459454Smjacob#define TOPO_NL_PORT 0 29559454Smjacob#define TOPO_FL_PORT 1 29659454Smjacob#define TOPO_N_PORT 2 29759454Smjacob#define TOPO_F_PORT 3 29859454Smjacob#define TOPO_PTP_STUB 4 29959454Smjacob 30042131Smjacob/* 30135388Smjacob * Soft Structure per host adapter 30235388Smjacob */ 30335388Smjacobstruct ispsoftc { 30435388Smjacob /* 30535388Smjacob * Platform (OS) specific data 30635388Smjacob */ 30735388Smjacob struct isposinfo isp_osinfo; 30835388Smjacob 30935388Smjacob /* 31053487Smjacob * Pointer to bus specific functions and data 31135388Smjacob */ 31235388Smjacob struct ispmdvec * isp_mdvec; 31335388Smjacob 31435388Smjacob /* 31553487Smjacob * (Mostly) nonvolatile state. Board specific parameters 31653487Smjacob * may contain some volatile state (e.g., current loop state). 31735388Smjacob */ 31835388Smjacob 31953487Smjacob void * isp_param; /* type specific */ 32053487Smjacob u_int16_t isp_fwrev[3]; /* Loaded F/W revision */ 32153487Smjacob u_int16_t isp_romfw_rev[3]; /* PROM F/W revision */ 32253487Smjacob u_int16_t isp_maxcmds; /* max possible I/O cmds */ 32353487Smjacob u_int8_t isp_type; /* HBA Chip Type */ 32453487Smjacob u_int8_t isp_revision; /* HBA Chip H/W Revision */ 32535388Smjacob 32653487Smjacob u_int32_t : 4, 32753487Smjacob isp_touched : 1, /* board ever seen? */ 32853487Smjacob isp_fast_mttr : 1, /* fast sram */ 32953487Smjacob isp_bustype : 1, /* SBus or PCI */ 33053487Smjacob isp_dogactive : 1, /* watchdog running */ 33153487Smjacob isp_dblev : 8, /* debug level */ 33253487Smjacob isp_clock : 8, /* input clock */ 33353487Smjacob isp_confopts : 8; /* config options */ 33439235Sgibbs 33535388Smjacob /* 33639235Sgibbs * Volatile state 33735388Smjacob */ 33835388Smjacob 33953487Smjacob volatile u_int32_t : 9, 34039235Sgibbs isp_state : 3, 34146968Smjacob isp_sendmarker : 2, /* send a marker entry */ 34246968Smjacob isp_update : 2, /* update parameters */ 34352347Smjacob isp_nactive : 16; /* how many commands active */ 34439235Sgibbs 34552347Smjacob volatile u_int16_t isp_reqodx; /* index of last ISP pickup */ 34652347Smjacob volatile u_int16_t isp_reqidx; /* index of next request */ 34752347Smjacob volatile u_int16_t isp_residx; /* index of next result */ 34852347Smjacob volatile u_int16_t isp_lasthdls; /* last handle seed */ 34935388Smjacob 35035388Smjacob /* 35153487Smjacob * Active commands are stored here, indexed by handle functions. 35235388Smjacob */ 35352347Smjacob ISP_SCSI_XFER_T **isp_xflist; 35435388Smjacob 35535388Smjacob /* 35652347Smjacob * request/result queue pointers and dma handles for them. 35735388Smjacob */ 35848195Smjacob caddr_t isp_rquest; 35948195Smjacob caddr_t isp_result; 36035388Smjacob u_int32_t isp_rquest_dma; 36135388Smjacob u_int32_t isp_result_dma; 36235388Smjacob}; 36335388Smjacob 36449909Smjacob#define SDPARAM(isp) ((sdparam *) (isp)->isp_param) 36549909Smjacob#define FCPARAM(isp) ((fcparam *) (isp)->isp_param) 36649909Smjacob 36735388Smjacob/* 36835388Smjacob * ISP States 36935388Smjacob */ 37035388Smjacob#define ISP_NILSTATE 0 37135388Smjacob#define ISP_RESETSTATE 1 37235388Smjacob#define ISP_INITSTATE 2 37335388Smjacob#define ISP_RUNSTATE 3 37435388Smjacob 37535388Smjacob/* 37635388Smjacob * ISP Configuration Options 37735388Smjacob */ 37835388Smjacob#define ISP_CFG_NORELOAD 0x80 /* don't download f/w */ 37943793Smjacob#define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */ 38053487Smjacob#define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */ 38153487Smjacob#define ISP_CFG_OWNWWN 0x02 /* override NVRAM wwn */ 38257145Smjacob#define ISP_CFG_NPORT 0x04 /* try to force N- instead of L-Port */ 38335388Smjacob 38445282Smjacob#define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic) 38546968Smjacob#define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2]) 38639235Sgibbs 38735388Smjacob/* 38839235Sgibbs * Bus (implementation) types 38935388Smjacob */ 39039235Sgibbs#define ISP_BT_PCI 0 /* PCI Implementations */ 39139235Sgibbs#define ISP_BT_SBUS 1 /* SBus Implementations */ 39239235Sgibbs 39339235Sgibbs/* 39439235Sgibbs * Chip Types 39539235Sgibbs */ 39635388Smjacob#define ISP_HA_SCSI 0xf 39739235Sgibbs#define ISP_HA_SCSI_UNKNOWN 0x1 39839235Sgibbs#define ISP_HA_SCSI_1020 0x2 39939235Sgibbs#define ISP_HA_SCSI_1020A 0x3 40039235Sgibbs#define ISP_HA_SCSI_1040 0x4 40139235Sgibbs#define ISP_HA_SCSI_1040A 0x5 40239235Sgibbs#define ISP_HA_SCSI_1040B 0x6 40345282Smjacob#define ISP_HA_SCSI_1040C 0x7 40454671Smjacob#define ISP_HA_SCSI_1240 0x8 40554671Smjacob#define ISP_HA_SCSI_1080 0x9 40654671Smjacob#define ISP_HA_SCSI_1280 0xa 40757145Smjacob#define ISP_HA_SCSI_12160 0xb 40835388Smjacob#define ISP_HA_FC 0xf0 40935388Smjacob#define ISP_HA_FC_2100 0x10 41048484Smjacob#define ISP_HA_FC_2200 0x20 41135388Smjacob 41244819Smjacob#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI) 41354671Smjacob#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240) 41444819Smjacob#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080) 41554671Smjacob#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280) 41657145Smjacob#define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160) 41757145Smjacob 41857145Smjacob#define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp)) 41957145Smjacob#define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp)) 42057145Smjacob#define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_12160(isp)) 42157145Smjacob#define IS_ULTRA3(isp) (IS_12160(isp)) 42257145Smjacob 42344819Smjacob#define IS_FC(isp) (isp->isp_type & ISP_HA_FC) 42457145Smjacob#define IS_2100(isp) (isp->isp_type == ISP_HA_FC_2100) 42557145Smjacob#define IS_2200(isp) (isp->isp_type == ISP_HA_FC_2200) 42644819Smjacob 42757145Smjacob 42835388Smjacob/* 42935388Smjacob * Function Prototypes 43035388Smjacob */ 43135388Smjacob 43235388Smjacob/* 43339235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with 43439235Sgibbs * a call to isp_init. 43535388Smjacob */ 43635388Smjacobvoid isp_reset __P((struct ispsoftc *)); 43735388Smjacob 43835388Smjacob/* 43935388Smjacob * Initialize Hardware to known state 44035388Smjacob */ 44135388Smjacobvoid isp_init __P((struct ispsoftc *)); 44235388Smjacob 44335388Smjacob/* 44439235Sgibbs * Reset the ISP and call completion for any orphaned commands. 44539235Sgibbs */ 44639235Sgibbsvoid isp_restart __P((struct ispsoftc *)); 44739235Sgibbs 44839235Sgibbs/* 44935388Smjacob * Interrupt Service Routine 45035388Smjacob */ 45135388Smjacobint isp_intr __P((void *)); 45235388Smjacob 45335388Smjacob/* 45435388Smjacob * Command Entry Point 45535388Smjacob */ 45639235Sgibbsint32_t ispscsicmd __P((ISP_SCSI_XFER_T *)); 45735388Smjacob 45839235Sgibbs/* 45943420Smjacob * Platform Dependent to External to Internal Control Function 46039235Sgibbs * 46148484Smjacob * Assumes all locks are held and that no reentrancy issues need be dealt with. 46239235Sgibbs * 46339235Sgibbs */ 46439235Sgibbstypedef enum { 46548484Smjacob ISPCTL_RESET_BUS, /* Reset Bus */ 46648484Smjacob ISPCTL_RESET_DEV, /* Reset Device */ 46748484Smjacob ISPCTL_ABORT_CMD, /* Abort Command */ 46848484Smjacob ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters */ 46955364Smjacob ISPCTL_FCLINK_TEST, /* Test FC Link Status */ 47055364Smjacob ISPCTL_PDB_SYNC, /* Synchronize Port Database */ 47155364Smjacob ISPCTL_TOGGLE_TMODE /* toggle target mode */ 47239235Sgibbs} ispctl_t; 47339235Sgibbsint isp_control __P((struct ispsoftc *, ispctl_t, void *)); 47439235Sgibbs 47543420Smjacob 47639235Sgibbs/* 47743420Smjacob * Platform Dependent to Internal to External Control Function 47843420Smjacob * (each platform must provide such a function) 47943420Smjacob * 48048484Smjacob * Assumes all locks are held and that no reentrancy issues need be dealt with. 48143420Smjacob * 48243420Smjacob */ 48343420Smjacob 48443420Smjacobtypedef enum { 48543793Smjacob ISPASYNC_NEW_TGT_PARAMS, 48648484Smjacob ISPASYNC_BUS_RESET, /* Bus Was Reset */ 48748484Smjacob ISPASYNC_LOOP_DOWN, /* FC Loop Down */ 48848484Smjacob ISPASYNC_LOOP_UP, /* FC Loop Up */ 48948484Smjacob ISPASYNC_PDB_CHANGED, /* FC Port Data Base Changed */ 49048484Smjacob ISPASYNC_CHANGE_NOTIFY, /* FC SNS Change Notification */ 49148484Smjacob ISPASYNC_FABRIC_DEV, /* FC New Fabric Device */ 49255364Smjacob ISPASYNC_TARGET_MESSAGE, /* target message */ 49355364Smjacob ISPASYNC_TARGET_EVENT, /* target asynchronous event */ 49455364Smjacob ISPASYNC_TARGET_ACTION /* other target command action */ 49543420Smjacob} ispasync_t; 49643420Smjacobint isp_async __P((struct ispsoftc *, ispasync_t, void *)); 49743420Smjacob 49843420Smjacob/* 49939235Sgibbs * lost command routine (XXXX IN TRANSITION XXXX) 50039235Sgibbs */ 50139235Sgibbsvoid isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *)); 50239235Sgibbs 50335388Smjacob#endif /* _ISPVAR_H */ 504