ispvar.h revision 82689
150477Speter/* $FreeBSD: head/sys/dev/isp/ispvar.h 82689 2001-08-31 21:39:04Z 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 5782689Smjacob#define ISP_CORE_VERSION_MINOR 4 5839235Sgibbs 5935388Smjacob/* 6043420Smjacob * Vector for bus specific code to provide specific services. 6135388Smjacob */ 6235388Smjacobstruct ispsoftc; 6335388Smjacobstruct ispmdvec { 6482689Smjacob int (*dv_rd_isr) 6582689Smjacob (struct ispsoftc *, u_int16_t *, u_int16_t *, u_int16_t *); 6674229Smjacob u_int16_t (*dv_rd_reg) (struct ispsoftc *, int); 6774229Smjacob void (*dv_wr_reg) (struct ispsoftc *, int, u_int16_t); 6874229Smjacob int (*dv_mbxdma) (struct ispsoftc *); 6974229Smjacob int (*dv_dmaset) (struct ispsoftc *, 7082689Smjacob XS_T *, ispreq_t *, u_int16_t *, u_int16_t); 7135388Smjacob void (*dv_dmaclr) 7282689Smjacob (struct ispsoftc *, XS_T *, u_int16_t); 7374229Smjacob void (*dv_reset0) (struct ispsoftc *); 7474229Smjacob void (*dv_reset1) (struct ispsoftc *); 7574229Smjacob void (*dv_dregs) (struct ispsoftc *, const char *); 7661772Smjacob const u_int16_t *dv_ispfw; /* ptr to f/w */ 7735388Smjacob u_int16_t dv_conf1; 7835388Smjacob u_int16_t dv_clock; /* clock frequency */ 7935388Smjacob}; 8035388Smjacob 8164087Smjacob/* 8264087Smjacob * Overall parameters 8364087Smjacob */ 8482689Smjacob#define MAX_TARGETS 16 8582689Smjacob#define MAX_FC_TARG 256 8649909Smjacob#define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS) 8761772Smjacob#define ISP_MAX_LUNS(isp) (isp)->isp_maxluns 8849909Smjacob 8982689Smjacob/* 9082689Smjacob * 'Types' 9182689Smjacob */ 9282689Smjacob#ifndef ISP_DMA_ADDR_T 9382689Smjacob#define ISP_DMA_ADDR_T u_int32_t 9482689Smjacob#endif 9553487Smjacob 9653487Smjacob/* 9764087Smjacob * Macros to access ISP registers through bus specific layers- 9864087Smjacob * mostly wrappers to vector through the mdvec structure. 9953487Smjacob */ 10082689Smjacob#define ISP_READ_ISR(isp, isrp, semap, mbox0p) \ 10182689Smjacob (*(isp)->isp_mdvec->dv_rd_isr)(isp, isrp, semap, mbox0p) 10253487Smjacob 10353487Smjacob#define ISP_READ(isp, reg) \ 10453487Smjacob (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg)) 10553487Smjacob 10653487Smjacob#define ISP_WRITE(isp, reg, val) \ 10753487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val)) 10853487Smjacob 10953487Smjacob#define ISP_MBOXDMASETUP(isp) \ 11053487Smjacob (*(isp)->isp_mdvec->dv_mbxdma)((isp)) 11153487Smjacob 11253487Smjacob#define ISP_DMASETUP(isp, xs, req, iptrp, optr) \ 11353487Smjacob (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr)) 11453487Smjacob 11553487Smjacob#define ISP_DMAFREE(isp, xs, hndl) \ 11653487Smjacob if ((isp)->isp_mdvec->dv_dmaclr) \ 11753487Smjacob (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl)) 11853487Smjacob 11953487Smjacob#define ISP_RESET0(isp) \ 12053487Smjacob if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp)) 12153487Smjacob#define ISP_RESET1(isp) \ 12253487Smjacob if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp)) 12364087Smjacob#define ISP_DUMPREGS(isp, m) \ 12464087Smjacob if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp),(m)) 12553487Smjacob 12653487Smjacob#define ISP_SETBITS(isp, reg, val) \ 12753487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val)) 12853487Smjacob 12953487Smjacob#define ISP_CLRBITS(isp, reg, val) \ 13053487Smjacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val)) 13153487Smjacob 13264087Smjacob/* 13364087Smjacob * The MEMORYBARRIER macro is defined per platform (to provide synchronization 13464087Smjacob * on Request and Response Queues, Scratch DMA areas, and Registers) 13564087Smjacob * 13664087Smjacob * Defined Memory Barrier Synchronization Types 13764087Smjacob */ 13864087Smjacob#define SYNC_REQUEST 0 /* request queue synchronization */ 13964087Smjacob#define SYNC_RESULT 1 /* result queue synchronization */ 14064087Smjacob#define SYNC_SFORDEV 2 /* scratch, sync for ISP */ 14164087Smjacob#define SYNC_SFORCPU 3 /* scratch, sync for CPU */ 14264087Smjacob#define SYNC_REG 4 /* for registers */ 14364087Smjacob 14464087Smjacob/* 14564087Smjacob * Request/Response Queue defines and macros. 14664087Smjacob * The maximum is defined per platform (and can be based on board type). 14764087Smjacob */ 14864087Smjacob/* This is the size of a queue entry (request and response) */ 14939235Sgibbs#define QENTRY_LEN 64 15064087Smjacob/* Both request and result queue length must be a power of two */ 15164087Smjacob#define RQUEST_QUEUE_LEN(x) MAXISPREQUEST(x) 15264087Smjacob#define RESULT_QUEUE_LEN(x) \ 15364087Smjacob (((MAXISPREQUEST(x) >> 2) < 64)? 64 : MAXISPREQUEST(x) >> 2) 15439235Sgibbs#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN)) 15539235Sgibbs#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN) 15639235Sgibbs#define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1)) 15765140Smjacob#define ISP_QFREE(in, out, qlen) \ 15839235Sgibbs ((in == out)? (qlen - 1) : ((in > out)? \ 15952347Smjacob ((qlen - 1) - (in - out)) : (out - in - 1))) 16065140Smjacob#define ISP_QAVAIL(isp) \ 16165140Smjacob ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp)) 16253487Smjacob 16353487Smjacob#define ISP_ADD_REQUEST(isp, iptr) \ 16464087Smjacob MEMORYBARRIER(isp, SYNC_REQUEST, iptr, QENTRY_LEN); \ 16582689Smjacob WRITE_REQUEST_QUEUE_IN_POINTER(isp, iptr); \ 16664087Smjacob isp->isp_reqidx = iptr 16753487Smjacob 16835388Smjacob/* 16946968Smjacob * SCSI Specific Host Adapter Parameters- per bus, per target 17035388Smjacob */ 17135388Smjacob 17235388Smjacobtypedef struct { 17346968Smjacob u_int isp_gotdparms : 1, 17452347Smjacob isp_req_ack_active_neg : 1, 17552347Smjacob isp_data_line_active_neg: 1, 17635388Smjacob isp_cmd_dma_burst_enable: 1, 17735388Smjacob isp_data_dma_burst_enabl: 1, 17842461Smjacob isp_fifo_threshold : 3, 17943420Smjacob isp_ultramode : 1, 18035388Smjacob isp_diffmode : 1, 18145040Smjacob isp_lvdmode : 1, 18265140Smjacob isp_fast_mttr : 1, /* fast sram */ 18335388Smjacob isp_initiator_id : 4, 18452347Smjacob isp_async_data_setup : 4; 18552347Smjacob u_int16_t isp_selection_timeout; 18652347Smjacob u_int16_t isp_max_queue_depth; 18735388Smjacob u_int8_t isp_tag_aging; 18852347Smjacob u_int8_t isp_bus_reset_delay; 18952347Smjacob u_int8_t isp_retry_count; 19052347Smjacob u_int8_t isp_retry_delay; 19135388Smjacob struct { 19280582Smjacob u_int32_t 19380582Smjacob exc_throttle : 8, 19446968Smjacob : 1, 19580582Smjacob dev_enable : 1, /* ignored */ 19643420Smjacob dev_update : 1, 19743420Smjacob dev_refresh : 1, 19880582Smjacob actv_offset : 4, 19980582Smjacob goal_offset : 4, 20080582Smjacob nvrm_offset : 4; 20180582Smjacob u_int8_t actv_period; /* current sync period */ 20280582Smjacob u_int8_t goal_period; /* goal sync period */ 20380582Smjacob u_int8_t nvrm_period; /* nvram sync period */ 20480582Smjacob u_int16_t actv_flags; /* current device flags */ 20580582Smjacob u_int16_t goal_flags; /* goal device flags */ 20680582Smjacob u_int16_t nvrm_flags; /* nvram device flags */ 20735388Smjacob } isp_devparam[MAX_TARGETS]; 20846968Smjacob} sdparam; 20935388Smjacob 21035388Smjacob/* 21135388Smjacob * Device Flags 21235388Smjacob */ 21339235Sgibbs#define DPARM_DISC 0x8000 21439235Sgibbs#define DPARM_PARITY 0x4000 21539235Sgibbs#define DPARM_WIDE 0x2000 21639235Sgibbs#define DPARM_SYNC 0x1000 21739235Sgibbs#define DPARM_TQING 0x0800 21839235Sgibbs#define DPARM_ARQ 0x0400 21939235Sgibbs#define DPARM_QFRZ 0x0200 22039235Sgibbs#define DPARM_RENEG 0x0100 22165140Smjacob#define DPARM_NARROW 0x0080 22265140Smjacob#define DPARM_ASYNC 0x0040 22365140Smjacob#define DPARM_PPR 0x0020 22443793Smjacob#define DPARM_DEFAULT (0xFF00 & ~DPARM_QFRZ) 22539235Sgibbs#define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING)) 22635388Smjacob 22739235Sgibbs 22845040Smjacob/* technically, not really correct, as they need to be rated based upon clock */ 22965140Smjacob#define ISP_80M_SYNCPARMS 0x0c09 23065140Smjacob#define ISP_40M_SYNCPARMS 0x0c0a 23165140Smjacob#define ISP_20M_SYNCPARMS 0x0c0c 23265140Smjacob#define ISP_20M_SYNCPARMS_1040 0x080c 23352347Smjacob#define ISP_10M_SYNCPARMS 0x0c19 23452347Smjacob#define ISP_08M_SYNCPARMS 0x0c25 23552347Smjacob#define ISP_05M_SYNCPARMS 0x0c32 23652347Smjacob#define ISP_04M_SYNCPARMS 0x0c41 23735388Smjacob 23835388Smjacob/* 23935388Smjacob * Fibre Channel Specifics 24035388Smjacob */ 24152347Smjacob#define FL_PORT_ID 0x7e /* FL_Port Special ID */ 24252347Smjacob#define FC_PORT_ID 0x7f /* Fabric Controller Special ID */ 24352347Smjacob#define FC_SNS_ID 0x80 /* SNS Server Special ID */ 24452347Smjacob 24535388Smjacobtypedef struct { 24652347Smjacob u_int32_t isp_fwoptions : 16, 24777776Smjacob : 2, 24872355Smjacob isp_iid_set : 1, 24948484Smjacob loop_seen_once : 1, 25077776Smjacob isp_loopstate : 4, /* Current Loop State */ 25148484Smjacob isp_fwstate : 3, /* ISP F/W state */ 25248484Smjacob isp_gotdparms : 1, 25359454Smjacob isp_topo : 3, 25448484Smjacob isp_onfabric : 1; 25572355Smjacob u_int8_t isp_iid; /* 'initiator' id */ 25639235Sgibbs u_int8_t isp_loopid; /* hard loop id */ 25739235Sgibbs u_int8_t isp_alpa; /* ALPA */ 25872355Smjacob u_int32_t isp_portid; 25952347Smjacob volatile u_int16_t isp_lipseq; /* LIP sequence # */ 26072355Smjacob u_int16_t isp_xxxxxx; 26139235Sgibbs u_int8_t isp_execthrottle; 26252347Smjacob u_int8_t isp_retry_delay; 26352347Smjacob u_int8_t isp_retry_count; 26452347Smjacob u_int8_t isp_reserved; 26539235Sgibbs u_int16_t isp_maxalloc; 26639235Sgibbs u_int16_t isp_maxfrmlen; 26748484Smjacob u_int64_t isp_nodewwn; 26848484Smjacob u_int64_t isp_portwwn; 26935388Smjacob /* 27048484Smjacob * Port Data Base. This is indexed by 'target', which is invariate. 27148484Smjacob * However, elements within can move around due to loop changes, 27248484Smjacob * so the actual loop ID passed to the F/W is in this structure. 27348484Smjacob * The first time the loop is seen up, loopid will match the index 27448484Smjacob * (except for fabric nodes which are above mapped above FC_SNS_ID 27548484Smjacob * and are completely virtual), but subsequent LIPs can cause things 27648484Smjacob * to move around. 27744819Smjacob */ 27848484Smjacob struct lportdb { 27952347Smjacob u_int 28060221Smjacob loopid : 8, 28177776Smjacob : 1, 28277776Smjacob force_logout : 1, 28371079Smjacob was_fabric_dev : 1, 28471079Smjacob fabric_dev : 1, 28560221Smjacob loggedin : 1, 28660221Smjacob roles : 2, 28760221Smjacob valid : 1; 28852347Smjacob u_int32_t portid; 28948484Smjacob u_int64_t node_wwn; 29048484Smjacob u_int64_t port_wwn; 29172355Smjacob } portdb[MAX_FC_TARG], tport[FC_PORT_ID]; 29244819Smjacob 29344819Smjacob /* 29435388Smjacob * Scratch DMA mapped in area to fetch Port Database stuff, etc. 29535388Smjacob */ 29648195Smjacob caddr_t isp_scratch; 29782689Smjacob ISP_DMA_ADDR_T isp_scdma; 29835388Smjacob} fcparam; 29935388Smjacob 30048484Smjacob#define FW_CONFIG_WAIT 0 30148484Smjacob#define FW_WAIT_AL_PA 1 30248484Smjacob#define FW_WAIT_LOGIN 2 30348484Smjacob#define FW_READY 3 30448484Smjacob#define FW_LOSS_OF_SYNC 4 30548484Smjacob#define FW_ERROR 5 30648484Smjacob#define FW_REINIT 6 30748484Smjacob#define FW_NON_PART 7 30835388Smjacob 30948484Smjacob#define LOOP_NIL 0 31048484Smjacob#define LOOP_LIP_RCVD 1 31148484Smjacob#define LOOP_PDB_RCVD 2 31272355Smjacob#define LOOP_SCANNING_FABRIC 3 31372355Smjacob#define LOOP_FSCAN_DONE 4 31472355Smjacob#define LOOP_SCANNING_LOOP 5 31577776Smjacob#define LOOP_LSCAN_DONE 6 31677776Smjacob#define LOOP_SYNCING_PDB 7 31777776Smjacob#define LOOP_READY 8 31835388Smjacob 31959454Smjacob#define TOPO_NL_PORT 0 32059454Smjacob#define TOPO_FL_PORT 1 32159454Smjacob#define TOPO_N_PORT 2 32259454Smjacob#define TOPO_F_PORT 3 32359454Smjacob#define TOPO_PTP_STUB 4 32459454Smjacob 32542131Smjacob/* 32635388Smjacob * Soft Structure per host adapter 32735388Smjacob */ 32865140Smjacobtypedef struct ispsoftc { 32935388Smjacob /* 33035388Smjacob * Platform (OS) specific data 33135388Smjacob */ 33235388Smjacob struct isposinfo isp_osinfo; 33335388Smjacob 33435388Smjacob /* 33553487Smjacob * Pointer to bus specific functions and data 33635388Smjacob */ 33735388Smjacob struct ispmdvec * isp_mdvec; 33835388Smjacob 33935388Smjacob /* 34053487Smjacob * (Mostly) nonvolatile state. Board specific parameters 34153487Smjacob * may contain some volatile state (e.g., current loop state). 34235388Smjacob */ 34335388Smjacob 34453487Smjacob void * isp_param; /* type specific */ 34553487Smjacob u_int16_t isp_fwrev[3]; /* Loaded F/W revision */ 34653487Smjacob u_int16_t isp_romfw_rev[3]; /* PROM F/W revision */ 34753487Smjacob u_int16_t isp_maxcmds; /* max possible I/O cmds */ 34853487Smjacob u_int8_t isp_type; /* HBA Chip Type */ 34953487Smjacob u_int8_t isp_revision; /* HBA Chip H/W Revision */ 35061772Smjacob u_int32_t isp_maxluns; /* maximum luns supported */ 35135388Smjacob 35271079Smjacob u_int32_t isp_clock : 8, /* input clock */ 35371079Smjacob : 6, 35471079Smjacob isp_role : 2, 35571079Smjacob : 1, 35653487Smjacob isp_touched : 1, /* board ever seen? */ 35753487Smjacob isp_bustype : 1, /* SBus or PCI */ 35865140Smjacob isp_loaded_fw : 1, /* loaded firmware */ 35971079Smjacob isp_dblev : 12; /* debug log mask */ 36071079Smjacob 36171079Smjacob u_int32_t isp_confopts; /* config options */ 36271079Smjacob 36382689Smjacob u_int16_t isp_rqstinrp; /* register for REQINP */ 36482689Smjacob u_int16_t isp_rqstoutrp; /* register for REQOUTP */ 36582689Smjacob u_int16_t isp_respinrp; /* register for RESINP */ 36682689Smjacob u_int16_t isp_respoutrp; /* register for RESOUTP */ 36782689Smjacob 36869522Smjacob /* 36969522Smjacob * Instrumentation 37069522Smjacob */ 37169522Smjacob u_int64_t isp_intcnt; /* total int count */ 37269522Smjacob u_int64_t isp_intbogus; /* spurious int count */ 37339235Sgibbs 37435388Smjacob /* 37539235Sgibbs * Volatile state 37635388Smjacob */ 37735388Smjacob 37862171Smjacob volatile u_int32_t 37962171Smjacob isp_mboxbsy : 8, /* mailbox command active */ 38062171Smjacob : 1, 38139235Sgibbs isp_state : 3, 38246968Smjacob isp_sendmarker : 2, /* send a marker entry */ 38346968Smjacob isp_update : 2, /* update parameters */ 38452347Smjacob isp_nactive : 16; /* how many commands active */ 38552347Smjacob volatile u_int16_t isp_reqodx; /* index of last ISP pickup */ 38652347Smjacob volatile u_int16_t isp_reqidx; /* index of next request */ 38752347Smjacob volatile u_int16_t isp_residx; /* index of next result */ 38852347Smjacob volatile u_int16_t isp_lasthdls; /* last handle seed */ 38962171Smjacob volatile u_int16_t isp_mboxtmp[MAX_MAILBOX]; 39071079Smjacob volatile u_int16_t isp_lastmbxcmd; /* last mbox command sent */ 39135388Smjacob 39235388Smjacob /* 39353487Smjacob * Active commands are stored here, indexed by handle functions. 39435388Smjacob */ 39564087Smjacob XS_T **isp_xflist; 39635388Smjacob 39735388Smjacob /* 39852347Smjacob * request/result queue pointers and dma handles for them. 39935388Smjacob */ 40048195Smjacob caddr_t isp_rquest; 40148195Smjacob caddr_t isp_result; 40282689Smjacob ISP_DMA_ADDR_T isp_rquest_dma; 40382689Smjacob ISP_DMA_ADDR_T isp_result_dma; 40465140Smjacob} ispsoftc_t; 40535388Smjacob 40649909Smjacob#define SDPARAM(isp) ((sdparam *) (isp)->isp_param) 40749909Smjacob#define FCPARAM(isp) ((fcparam *) (isp)->isp_param) 40849909Smjacob 40935388Smjacob/* 41064087Smjacob * ISP Driver Run States 41135388Smjacob */ 41235388Smjacob#define ISP_NILSTATE 0 41335388Smjacob#define ISP_RESETSTATE 1 41435388Smjacob#define ISP_INITSTATE 2 41535388Smjacob#define ISP_RUNSTATE 3 41635388Smjacob 41735388Smjacob/* 41835388Smjacob * ISP Configuration Options 41935388Smjacob */ 42035388Smjacob#define ISP_CFG_NORELOAD 0x80 /* don't download f/w */ 42143793Smjacob#define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */ 42253487Smjacob#define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */ 42353487Smjacob#define ISP_CFG_OWNWWN 0x02 /* override NVRAM wwn */ 42469522Smjacob#define ISP_CFG_PORT_PREF 0x0C /* Mask for Port Prefs (2200 only) */ 42569522Smjacob#define ISP_CFG_LPORT 0x00 /* prefer {N/F}L-Port connection */ 42669522Smjacob#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */ 42769522Smjacob#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */ 42869522Smjacob#define ISP_CFG_LPORT_ONLY 0x0C /* insist on {N/F}L-Port connection */ 42935388Smjacob 43064087Smjacob/* 43171079Smjacob * Prior to calling isp_reset for the first time, the outer layer 43271079Smjacob * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH. 43371079Smjacob * 43471079Smjacob * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded, 43571079Smjacob * NVRAM read, and defaults set, but any further initialization (e.g. 43671079Smjacob * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done. 43771079Smjacob * 43871079Smjacob * If INITIATOR MODE isn't set, attempts to run commands will be stopped 43971079Smjacob * at isp_start and completed with the moral equivalent of SELECTION TIMEOUT. 44071079Smjacob * 44171079Smjacob * If TARGET MODE is set, it doesn't mean that the rest of target mode support 44271079Smjacob * needs to be enabled, or will even work. What happens with the 2X00 cards 44371079Smjacob * here is that if you have enabled it with TARGET MODE as part of the ICB 44471079Smjacob * options, but you haven't given the f/w any ram resources for ATIOs or 44571079Smjacob * Immediate Notifies, the f/w just handles what it can and you never see 44671079Smjacob * anything. Basically, it sends a single byte of data (the first byte, 44771079Smjacob * which you can set as part of the INITIALIZE CONTROL BLOCK command) for 44871079Smjacob * INQUIRY, and sends back QUEUE FULL status for any other command. 44979235Smjacob * 45071079Smjacob */ 45171079Smjacob#define ISP_ROLE_NONE 0x0 45271079Smjacob#define ISP_ROLE_INITIATOR 0x1 45371079Smjacob#define ISP_ROLE_TARGET 0x2 45471079Smjacob#define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 45571079Smjacob#define ISP_ROLE_EITHER ISP_ROLE_BOTH 45671079Smjacob#ifndef ISP_DEFAULT_ROLES 45771079Smjacob#define ISP_DEFAULT_ROLES ISP_ROLE_INITIATOR 45871079Smjacob#endif 45971079Smjacob 46071079Smjacob 46171079Smjacob/* 46264087Smjacob * Firmware related defines 46364087Smjacob */ 46471079Smjacob#define ISP_CODE_ORG 0x1000 /* default f/w code start */ 46582689Smjacob#define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */ 46645282Smjacob#define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic) 46771079Smjacob#define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2]) 46839235Sgibbs 46935388Smjacob/* 47039235Sgibbs * Bus (implementation) types 47135388Smjacob */ 47239235Sgibbs#define ISP_BT_PCI 0 /* PCI Implementations */ 47339235Sgibbs#define ISP_BT_SBUS 1 /* SBus Implementations */ 47439235Sgibbs 47539235Sgibbs/* 47639235Sgibbs * Chip Types 47739235Sgibbs */ 47835388Smjacob#define ISP_HA_SCSI 0xf 47939235Sgibbs#define ISP_HA_SCSI_UNKNOWN 0x1 48039235Sgibbs#define ISP_HA_SCSI_1020 0x2 48139235Sgibbs#define ISP_HA_SCSI_1020A 0x3 48239235Sgibbs#define ISP_HA_SCSI_1040 0x4 48339235Sgibbs#define ISP_HA_SCSI_1040A 0x5 48439235Sgibbs#define ISP_HA_SCSI_1040B 0x6 48545282Smjacob#define ISP_HA_SCSI_1040C 0x7 48654671Smjacob#define ISP_HA_SCSI_1240 0x8 48754671Smjacob#define ISP_HA_SCSI_1080 0x9 48854671Smjacob#define ISP_HA_SCSI_1280 0xa 48957145Smjacob#define ISP_HA_SCSI_12160 0xb 49035388Smjacob#define ISP_HA_FC 0xf0 49135388Smjacob#define ISP_HA_FC_2100 0x10 49248484Smjacob#define ISP_HA_FC_2200 0x20 49377365Smjacob#define ISP_HA_FC_2300 0x30 49435388Smjacob 49544819Smjacob#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI) 49654671Smjacob#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240) 49744819Smjacob#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080) 49854671Smjacob#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280) 49957145Smjacob#define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160) 50057145Smjacob 50157145Smjacob#define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp)) 50257145Smjacob#define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp)) 50357145Smjacob#define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_12160(isp)) 50457145Smjacob#define IS_ULTRA3(isp) (IS_12160(isp)) 50557145Smjacob 50677365Smjacob#define IS_FC(isp) ((isp)->isp_type & ISP_HA_FC) 50777365Smjacob#define IS_2100(isp) ((isp)->isp_type == ISP_HA_FC_2100) 50877365Smjacob#define IS_2200(isp) ((isp)->isp_type == ISP_HA_FC_2200) 50982689Smjacob#define IS_2300(isp) ((isp)->isp_type >= ISP_HA_FC_2300) 51044819Smjacob 51164087Smjacob/* 51264087Smjacob * DMA cookie macros 51364087Smjacob */ 51482689Smjacob#define DMA_WD3(x) 0 51582689Smjacob#define DMA_WD2(x) 0 51682689Smjacob#define DMA_WD1(x) (((x) >> 16) & 0xffff) 51782689Smjacob#define DMA_WD0(x) (((x) & 0xffff)) 51857145Smjacob 51935388Smjacob/* 52064087Smjacob * Core System Function Prototypes 52135388Smjacob */ 52235388Smjacob 52335388Smjacob/* 52439235Sgibbs * Reset Hardware. Totally. Assumes that you'll follow this with 52539235Sgibbs * a call to isp_init. 52635388Smjacob */ 52774229Smjacobvoid isp_reset(struct ispsoftc *); 52835388Smjacob 52935388Smjacob/* 53035388Smjacob * Initialize Hardware to known state 53135388Smjacob */ 53274229Smjacobvoid isp_init(struct ispsoftc *); 53335388Smjacob 53435388Smjacob/* 53539235Sgibbs * Reset the ISP and call completion for any orphaned commands. 53639235Sgibbs */ 53774229Smjacobvoid isp_reinit(struct ispsoftc *); 53839235Sgibbs 53939235Sgibbs/* 54082689Smjacob * Internal Interrupt Service Routine 54182689Smjacob * 54282689Smjacob * The outer layers do the spade work to get the appropriate status register, 54382689Smjacob * semaphore register and first mailbox register (if appropriate). This also 54482689Smjacob * means that most spurious/bogus interrupts not for us can be filtered first. 54535388Smjacob */ 54682689Smjacobvoid isp_intr(struct ispsoftc *, u_int16_t, u_int16_t, u_int16_t); 54735388Smjacob 54882689Smjacob 54935388Smjacob/* 55064087Smjacob * Command Entry Point- Platform Dependent layers call into this 55135388Smjacob */ 55274229Smjacobint isp_start(XS_T *); 55364087Smjacob/* these values are what isp_start returns */ 55464087Smjacob#define CMD_COMPLETE 101 /* command completed */ 55564087Smjacob#define CMD_EAGAIN 102 /* busy- maybe retry later */ 55664087Smjacob#define CMD_QUEUED 103 /* command has been queued for execution */ 55764087Smjacob#define CMD_RQLATER 104 /* requeue this command later */ 55835388Smjacob 55939235Sgibbs/* 56064087Smjacob * Command Completion Point- Core layers call out from this with completed cmds 56164087Smjacob */ 56274229Smjacobvoid isp_done(XS_T *); 56364087Smjacob 56464087Smjacob/* 56543420Smjacob * Platform Dependent to External to Internal Control Function 56639235Sgibbs * 56772355Smjacob * Assumes locks are held on entry. You should note that with many of 56872355Smjacob * these commands and locks may be released while this is occurring. 56939235Sgibbs * 57072355Smjacob * A few notes about some of these functions: 57172355Smjacob * 57272355Smjacob * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link. 57372355Smjacob * The argument is a pointer to an integer which is the time, in microseconds, 57472355Smjacob * we should wait to see whether we have good link. This test, if successful, 57572355Smjacob * lets us know our connection topology and our Loop ID/AL_PA and so on. 57672355Smjacob * You can't get anywhere without this. 57772355Smjacob * 57872355Smjacob * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for 57972355Smjacob * all entities using the FC Generic Services subcommand GET ALL NEXT. 58072355Smjacob * For each found entity, an ISPASYNC_FABRICDEV event is generated (see 58172355Smjacob * below). 58272355Smjacob * 58372355Smjacob * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection 58472355Smjacob * topology is NL or FL port (private or public loop). Since the Qlogic f/w 58572355Smjacob * 'automatically' manages local loop connections, this function essentially 58672355Smjacob * notes the arrival, departure, and possible shuffling around of local loop 58772355Smjacob * entities. Thus for each arrival and departure this generates an isp_async 58872355Smjacob * event of ISPASYNC_PROMENADE (see below). 58972355Smjacob * 59072355Smjacob * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in 59172355Smjacob * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP. 59272355Smjacob * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging 59372355Smjacob * and logging out of fabric devices (if one is on a fabric) and then marking 59472355Smjacob * the 'loop state' as being ready to now be used for sending commands to 59572355Smjacob * devices. Originally fabric name server and local loop scanning were 59681794Smjacob * part of this function. It's now been separated to allow for finer control. 59739235Sgibbs */ 59839235Sgibbstypedef enum { 59948484Smjacob ISPCTL_RESET_BUS, /* Reset Bus */ 60048484Smjacob ISPCTL_RESET_DEV, /* Reset Device */ 60148484Smjacob ISPCTL_ABORT_CMD, /* Abort Command */ 60272355Smjacob ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */ 60355364Smjacob ISPCTL_FCLINK_TEST, /* Test FC Link Status */ 60472355Smjacob ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */ 60572355Smjacob ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */ 60655364Smjacob ISPCTL_PDB_SYNC, /* Synchronize Port Database */ 60772355Smjacob ISPCTL_SEND_LIP, /* Send a LIP */ 60872355Smjacob ISPCTL_GET_POSMAP, /* Get FC-AL position map */ 60972938Smjacob ISPCTL_RUN_MBOXCMD, /* run a mailbox command */ 61055364Smjacob ISPCTL_TOGGLE_TMODE /* toggle target mode */ 61139235Sgibbs} ispctl_t; 61274229Smjacobint isp_control(struct ispsoftc *, ispctl_t, void *); 61339235Sgibbs 61443420Smjacob 61539235Sgibbs/* 61643420Smjacob * Platform Dependent to Internal to External Control Function 61743420Smjacob * (each platform must provide such a function) 61843420Smjacob * 61972355Smjacob * Assumes locks are held. 62072355Smjacob * 62172355Smjacob * A few notes about some of these functions: 62272355Smjacob * 62372355Smjacob * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has 62472355Smjacob * occurred that invalidates the list of fabric devices known and/or 62572355Smjacob * the list of known loop devices. The argument passed is a pointer 62672355Smjacob * whose values are defined below (local loop change, name server 62772355Smjacob * change, other). 'Other' may simply be a LIP, or a change in 62872355Smjacob * connection topology. 62972355Smjacob * 63072355Smjacob * ISPASYNC_FABRIC_DEV announces the next element in a list of 63172355Smjacob * fabric device names we're getting out of the name server. The 63272355Smjacob * argument points to a GET ALL NEXT response structure. The list 63372355Smjacob * is known to terminate with an entry that refers to ourselves. 63472355Smjacob * One of the main purposes of this function is to allow outer 63572355Smjacob * layers, which are OS dependent, to set policy as to which fabric 63672355Smjacob * devices might actually be logged into (and made visible) later 63772355Smjacob * at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric 63872355Smjacob * devices that we can log into (256 less 3 'reserved' for F-port 63972355Smjacob * topologies), and fabrics can grow up to 8 million or so entries 64072355Smjacob * (24 bits of Port Address, less a wad of reserved spaces), clearly 64172355Smjacob * we had better let the OS determine login policy. 64272355Smjacob * 64372355Smjacob * ISPASYNC_PROMENADE has an argument that is a pointer to an integer which 64472355Smjacob * is an index into the portdb in the softc ('target'). Whether that entrie's 64572355Smjacob * valid tag is set or not says whether something has arrived or departed. 64672355Smjacob * The name refers to a favorite pastime of many city dwellers- watching 64772355Smjacob * people come and go, talking of Michaelangelo, and so on.. 64872938Smjacob * 64972938Smjacob * ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a 65072938Smjacob * response queue entry not otherwise handled. The outer layer should 65172938Smjacob * return non-zero if it handled it. The 'arg' points to a (possibly only 65272938Smjacob * partially) massaged response queue entry (see the platform's 65372938Smjacob * ISP_UNSWIZZLE_RESPONSE macro). 65443420Smjacob */ 65543420Smjacob 65643420Smjacobtypedef enum { 65772355Smjacob ISPASYNC_NEW_TGT_PARAMS, /* New Target Parameters Negotiated */ 65848484Smjacob ISPASYNC_BUS_RESET, /* Bus Was Reset */ 65948484Smjacob ISPASYNC_LOOP_DOWN, /* FC Loop Down */ 66048484Smjacob ISPASYNC_LOOP_UP, /* FC Loop Up */ 66177365Smjacob ISPASYNC_LIP, /* LIP Received */ 66277365Smjacob ISPASYNC_LOOP_RESET, /* Loop Reset Received */ 66372355Smjacob ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */ 66472355Smjacob ISPASYNC_FABRIC_DEV, /* FC Fabric Device Arrival */ 66572355Smjacob ISPASYNC_PROMENADE, /* FC Objects coming && going */ 66655364Smjacob ISPASYNC_TARGET_MESSAGE, /* target message */ 66755364Smjacob ISPASYNC_TARGET_EVENT, /* target asynchronous event */ 66872355Smjacob ISPASYNC_TARGET_ACTION, /* other target command action */ 66972938Smjacob ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */ 67079235Smjacob ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */ 67179235Smjacob ISPASYNC_FW_CRASH /* Firmware has crashed */ 67243420Smjacob} ispasync_t; 67374229Smjacobint isp_async(struct ispsoftc *, ispasync_t, void *); 67443420Smjacob 67572355Smjacob#define ISPASYNC_CHANGE_PDB ((void *) 0) 67672355Smjacob#define ISPASYNC_CHANGE_SNS ((void *) 1) 67772355Smjacob#define ISPASYNC_CHANGE_OTHER ((void *) 2) 67872355Smjacob 67943420Smjacob/* 68064087Smjacob * Platform Dependent Error and Debug Printout 68139235Sgibbs */ 68270490Smjacob#ifdef __GNUC__ 68374229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...) 68470490Smjacob __attribute__((__format__(__printf__,3,4))); 68570490Smjacob#else 68674229Smjacobvoid isp_prt(struct ispsoftc *, int level, const char *, ...); 68770490Smjacob#endif 68870490Smjacob 68964087Smjacob#define ISP_LOGALL 0x0 /* log always */ 69064087Smjacob#define ISP_LOGCONFIG 0x1 /* log configuration messages */ 69164087Smjacob#define ISP_LOGINFO 0x2 /* log informational messages */ 69264087Smjacob#define ISP_LOGWARN 0x4 /* log warning messages */ 69364087Smjacob#define ISP_LOGERR 0x8 /* log error messages */ 69464087Smjacob#define ISP_LOGDEBUG0 0x10 /* log simple debug messages */ 69564087Smjacob#define ISP_LOGDEBUG1 0x20 /* log intermediate debug messages */ 69664087Smjacob#define ISP_LOGDEBUG2 0x40 /* log most debug messages */ 69779235Smjacob#define ISP_LOGDEBUG3 0x80 /* log high frequency debug messages */ 69879235Smjacob#define ISP_LOGDEBUG4 0x100 /* log high frequency debug messages */ 69964087Smjacob#define ISP_LOGTDEBUG0 0x200 /* log simple debug messages (target mode) */ 70064087Smjacob#define ISP_LOGTDEBUG1 0x400 /* log intermediate debug messages (target) */ 70164087Smjacob#define ISP_LOGTDEBUG2 0x800 /* log all debug messages (target) */ 70239235Sgibbs 70364087Smjacob/* 70464087Smjacob * Each Platform provides it's own isposinfo substructure of the ispsoftc 70564087Smjacob * defined above. 70664087Smjacob * 70764087Smjacob * Each platform must also provide the following macros/defines: 70864087Smjacob * 70964087Smjacob * 71064087Smjacob * INLINE - platform specific define for 'inline' functions 71164087Smjacob * 71282689Smjacob * ISP_DMA_ADDR_T - platform specific dma address coookie- basically 71382689Smjacob * the largest integer that can hold the 32 or 71482689Smjacob * 64 bit value appropriate for the QLogic's DMA 71582689Smjacob * addressing. Defaults to u_int32_t. 71682689Smjacob * 71764087Smjacob * ISP2100_SCRLEN - length for the Fibre Channel scratch DMA area 71864087Smjacob * 71964087Smjacob * MEMZERO(dst, src) platform zeroing function 72064087Smjacob * MEMCPY(dst, src, count) platform copying function 72164087Smjacob * SNPRINTF(buf, bufsize, fmt, ...) snprintf 72264087Smjacob * STRNCAT(dstbuf, size, srcbuf) strncat 72364087Smjacob * USEC_DELAY(usecs) microsecond spindelay function 72469522Smjacob * USEC_SLEEP(isp, usecs) microsecond sleep function 72564087Smjacob * 72664087Smjacob * NANOTIME_T nanosecond time type 72764087Smjacob * 72864087Smjacob * GET_NANOTIME(NANOTIME_T *) get current nanotime. 72964087Smjacob * 73064087Smjacob * GET_NANOSEC(NANOTIME_T *) get u_int64_t from NANOTIME_T 73164087Smjacob * 73264087Smjacob * NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *) 73364087Smjacob * subtract two NANOTIME_T values 73464087Smjacob * 73564087Smjacob * 73664087Smjacob * MAXISPREQUEST(struct ispsoftc *) maximum request queue size 73764087Smjacob * for this particular board type 73864087Smjacob * 73964087Smjacob * MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size) 74064087Smjacob * 74164087Smjacob * Function/Macro the provides memory synchronization on 74264087Smjacob * various objects so that the ISP's and the system's view 74364087Smjacob * of the same object is consistent. 74464087Smjacob * 74564087Smjacob * MBOX_ACQUIRE(struct ispsoftc *) acquire lock on mailbox regs 74664087Smjacob * MBOX_WAIT_COMPLETE(struct ispsoftc *) wait for mailbox cmd to be done 74764087Smjacob * MBOX_NOTIFY_COMPLETE(struct ispsoftc *) notification of mbox cmd donee 74864087Smjacob * MBOX_RELEASE(struct ispsoftc *) release lock on mailbox regs 74964087Smjacob * 75072355Smjacob * 75164087Smjacob * SCSI_GOOD SCSI 'Good' Status 75264087Smjacob * SCSI_CHECK SCSI 'Check Condition' Status 75364087Smjacob * SCSI_BUSY SCSI 'Busy' Status 75464087Smjacob * SCSI_QFULL SCSI 'Queue Full' Status 75564087Smjacob * 75664087Smjacob * XS_T Platform SCSI transaction type (i.e., command for HBA) 75764087Smjacob * XS_ISP(xs) gets an instance out of an XS_T 75864087Smjacob * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" 75964087Smjacob * XS_TGT(xs) gets the target "" 76064087Smjacob * XS_LUN(xs) gets the lun "" 76164087Smjacob * XS_CDBP(xs) gets a pointer to the scsi CDB "" 76264087Smjacob * XS_CDBLEN(xs) gets the CDB's length "" 76364087Smjacob * XS_XFRLEN(xs) gets the associated data transfer length "" 76464087Smjacob * XS_TIME(xs) gets the time (in milliseconds) for this command 76564087Smjacob * XS_RESID(xs) gets the current residual count 76664087Smjacob * XS_STSP(xs) gets a pointer to the SCSI status byte "" 76764087Smjacob * XS_SNSP(xs) gets a pointer to the associate sense data 76864087Smjacob * XS_SNSLEN(xs) gets the length of sense data storage 76964087Smjacob * XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key 77064087Smjacob * XS_TAG_P(xs) predicate of whether this command should be tagged 77164087Smjacob * XS_TAG_TYPE(xs) which type of tag to use 77264087Smjacob * XS_SETERR(xs) set error state 77364087Smjacob * 77464087Smjacob * HBA_NOERROR command has no erros 77564087Smjacob * HBA_BOTCH hba botched something 77664087Smjacob * HBA_CMDTIMEOUT command timed out 77764087Smjacob * HBA_SELTIMEOUT selection timed out (also port logouts for FC) 77864087Smjacob * HBA_TGTBSY target returned a BUSY status 77964087Smjacob * HBA_BUSRESET bus reset destroyed command 78064087Smjacob * HBA_ABORTED command was aborted (by request) 78164087Smjacob * HBA_DATAOVR a data overrun was detected 78264087Smjacob * HBA_ARQFAIL Automatic Request Sense failed 78364087Smjacob * 78464087Smjacob * XS_ERR(xs) return current error state 78564087Smjacob * XS_NOERR(xs) there is no error currently set 78664087Smjacob * XS_INITERR(xs) initialize error state 78764087Smjacob * 78864087Smjacob * XS_SAVE_SENSE(xs, sp) save sense data 78964087Smjacob * 79064087Smjacob * XS_SET_STATE_STAT(isp, sp, xs) platform dependent interpreter of 79164087Smjacob * response queue entry status bits 79264087Smjacob * 79364087Smjacob * 79464087Smjacob * DEFAULT_IID(struct ispsoftc *) Default SCSI initiator ID 79564087Smjacob * DEFAULT_LOOPID(struct ispsoftc *) Default FC Loop ID 79667047Smjacob * DEFAULT_NODEWWN(struct ispsoftc *) Default Node WWN 79767047Smjacob * DEFAULT_PORTWWN(struct ispsoftc *) Default Port WWN 79867047Smjacob * These establish reasonable defaults for each platform. 79967047Smjacob * These must be available independent of card NVRAM and are 80067047Smjacob * to be used should NVRAM not be readable. 80164087Smjacob * 80267047Smjacob * ISP_NODEWWN(struct ispsoftc *) FC Node WWN to use 80367047Smjacob * ISP_PORTWWN(struct ispsoftc *) FC Port WWN to use 80464087Smjacob * 80567047Smjacob * These are to be used after NVRAM is read. The tags 80667047Smjacob * in fcparam.isp_{node,port}wwn reflect the values 80767047Smjacob * read from NVRAM (possibly corrected for card botches). 80867047Smjacob * Each platform can take that information and override 80967047Smjacob * it or ignore and return the Node and Port WWNs to be 81067047Smjacob * used when sending the Qlogic f/w the Initialization Control 81167047Smjacob * Block. 81264087Smjacob * 81364087Smjacob * (XXX these do endian specific transformations- in transition XXX) 81464087Smjacob * ISP_SWIZZLE_ICB 81564087Smjacob * ISP_UNSWIZZLE_AND_COPY_PDBP 81664087Smjacob * ISP_SWIZZLE_CONTINUATION 81764087Smjacob * ISP_SWIZZLE_REQUEST 81864087Smjacob * ISP_UNSWIZZLE_RESPONSE 81964087Smjacob * ISP_SWIZZLE_SNS_REQ 82064087Smjacob * ISP_UNSWIZZLE_SNS_RSP 82164087Smjacob * ISP_SWIZZLE_NVRAM_WORD 82264087Smjacob */ 82377365Smjacob 82435388Smjacob#endif /* _ISPVAR_H */ 825