Lines Matching +full:isp +full:- +full:0
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org>
5 * Copyright (c) 1997-2009 by Matthew Jacob
32 * Soft Definitions for Qlogic ISP SCSI adapters.
43 #include <dev/isp/isp_stds.h>
44 #include <dev/isp/ispmbox.h>
56 #define ISP_CORE_VERSION_MINOR 0
80 #define ISP_MAX_TARGETS(isp) MAX_FC_TARG argument
84 * Macros to access ISP registers through bus specific layers-
87 #define ISP_RUN_ISR(isp) \ argument
88 (*(isp)->isp_mdvec->dv_run_isr)(isp)
90 #define ISP_READ(isp, reg) \ argument
91 (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
93 #define ISP_WRITE(isp, reg, val) \ argument
94 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
96 #define ISP_MBOXDMASETUP(isp) \ argument
97 (*(isp)->isp_mdvec->dv_mbxdma)((isp))
99 #define ISP_SEND_CMD(isp, qe, segp, nseg) \ argument
100 (*(isp)->isp_mdvec->dv_send_cmd)((isp), (qe), (segp), (nseg))
102 #define ISP_IRQSETUP(isp) \ argument
103 (((isp)->isp_mdvec->dv_irqsetup) ? (*(isp)->isp_mdvec->dv_irqsetup)(isp) : 0)
104 #define ISP_DUMPREGS(isp, m) \ argument
105 if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp),(m))
107 #define ISP_SETBITS(isp, reg, val) \ argument
108 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val))
110 #define ISP_CLRBITS(isp, reg, val) \ argument
111 (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val))
119 #define SYNC_REQUEST 0 /* request queue synchronization */
121 #define SYNC_SFORDEV 2 /* scratch, sync for ISP */
125 #define SYNC_IFORDEV 6 /* synchrounous IOCB, sync for ISP */
142 #define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1))
143 #define ISP_QFREE(in, out, qlen) ((out - in - 1) & ((qlen) - 1))
144 #define ISP_QAVAIL(isp) \ argument
145 ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp))
147 #define ISP_ADD_REQUEST(isp, nxti) \ argument
148 MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \
149 ISP_WRITE(isp, BIU2400_REQINP, nxti); \
150 isp->isp_reqidx = nxti
152 #define ISP_SYNC_REQUEST(isp) \ argument
153 MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \
154 isp->isp_reqidx = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); \
155 ISP_WRITE(isp, BIU2400_REQINP, isp->isp_reqidx)
160 #define NPH_RESERVED 0x7F0 /* begin of reserved N-port handles */
161 #define NPH_MGT_ID 0x7FA /* Management Server Special ID */
162 #define NPH_SNS_ID 0x7FC /* SNS Server Special ID */
163 #define NPH_FABRIC_CTLR 0x7FD /* Fabric Controller (0xFFFFFD) */
164 #define NPH_FL_ID 0x7FE /* F Port Special ID (0xFFFFFE) */
165 #define NPH_IP_BCST 0x7FF /* IP Broadcast Special ID (0xFFFFFF) */
166 #define NPH_MAX_2K 0x800
171 #define NIL_HANDLE 0xffff
179 * Limit for (2K login) N-port handle amounts
186 #define INI_NONE ((uint64_t) 0)
187 #define ISP_NOCHAN 0xff
192 #define MANAGEMENT_PORT_ID 0xFFFFFA
193 #define SNS_PORT_ID 0xFFFFFC
194 #define FABRIC_PORT_ID 0xFFFFFE
195 #define PORT_ANY 0xFFFFFF
196 #define PORT_NONE 0
198 #define DOMAIN_CONTROLLER_BASE 0xFFFC00
199 #define DOMAIN_CONTROLLER_END 0xFFFCFF
212 * 0 means "free handle"
213 * bits 0..12 index commands
223 #define ISP_HANDLE_FREE 0x00000000
224 #define ISP_HANDLE_CMD_MASK 0x00003fff
225 #define ISP_HANDLE_USAGE_MASK 0x0000c000
228 # define ISP_HANDLE_NONE 0
232 #define ISP_HANDLE_SEQ_MASK 0xffff0000
237 #define ISP_HANDLE_NUM(isp) ((isp)->isp_maxcmds + ISP_HANDLE_RESERVE) argument
238 #define ISP_VALID_HANDLE(isp, hdl) \ argument
242 ((hdl) & ISP_HANDLE_CMD_MASK) < ISP_HANDLE_NUM(isp) && \
243 (hdl) == ((isp)->isp_xflist[(hdl) & ISP_HANDLE_CMD_MASK].handle))
282 * + There can never be two non-NIL entries with the same { Port, Node } WWN
285 * + There can never be two non-NIL entries with the same handle.
290 * send commands to the device. For pre-24XX cards, this would be
296 * PRLI word 0 contains the Establish Image Pair bit, which is
329 #define FC_PORTDB_STATE_NIL 0 /* Empty DB slot */
336 #define FC_PORTDB_TGT(isp, bus, pdb) (int)(lp - FCPARAM(isp, bus)->portdb) argument
341 * This structure is replicated across multiple channels for multi-id
342 * capapble chipsets, with some entities different on a per-channel basis.
348 int isp_fwstate; /* ISP F/W state */
362 uint16_t isp_sns_hdl; /* N-port handle for SNS */
363 uint16_t isp_lasthdl; /* only valid for channel 0 */
447 #define ISP28XX_AUX_IMG_BOARD_CONFIG 0x1
448 #define ISP28XX_AUX_IMG_VPD_NVRAM 0x2
449 #define ISP28XX_AUX_IMG_NPIV_CONFIG_0_1 0x4
450 #define ISP28XX_AUX_IMG_NPIV_CONFIG_2_3 0x8
451 #define ISP28XX_AUX_IMG_NVME_PARAMS 0x10
467 #define FW_CONFIG_WAIT 0
476 #define LOOP_NIL 0
488 #define TOPO_NL_PORT 0
496 #define FCP_AL_DA_ALL 0xFF
497 #define FCP_AL_PA(fcp) ((uint8_t)(fcp->isp_portid))
519 fcparam *isp_param; /* Per-channel storage. */
539 volatile uint32_t isp_reqodx; /* index of last ISP pickup */
575 #define FCPARAM(isp, chan) (&(isp)->isp_param[(chan)]) argument
577 #define ISP_SET_SENDMARKER(isp, chan, val) \ argument
578 FCPARAM(isp, chan)->sendmarker = val \
580 #define ISP_TST_SENDMARKER(isp, chan) \ argument
581 (FCPARAM(isp, chan)->sendmarker != 0)
584 * ISP Driver Run States
586 #define ISP_NILSTATE 0
593 * ISP Runtime Configuration Options
595 #define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */
596 #define ISP_CFG_PORT_PREF 0x0e /* Mask for Port Prefs (all FC except 2100) */
597 #define ISP_CFG_PORT_DEF 0x00 /* prefer connection type from NVRAM */
598 #define ISP_CFG_LPORT_ONLY 0x02 /* insist on {N/F}L-Port connection */
599 #define ISP_CFG_NPORT_ONLY 0x04 /* insist on {N/F}-Port connection */
600 #define ISP_CFG_LPORT 0x06 /* prefer {N/F}L-Port connection */
601 #define ISP_CFG_NPORT 0x08 /* prefer {N/F}-Port connection */
602 #define ISP_CFG_1GB 0x10 /* force 1Gb connection (23XX only) */
603 #define ISP_CFG_2GB 0x20 /* force 2Gb connection (23XX only) */
604 #define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */
605 #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */
606 #define ISP_CFG_NOFCTAPE 0x100 /* disable FC-Tape */
607 #define ISP_CFG_FCTAPE 0x200 /* enable FC-Tape */
608 #define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */
609 #define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */
610 #define ISP_CFG_4GB 0x2000 /* force 4Gb connection (24XX only) */
611 #define ISP_CFG_8GB 0x4000 /* force 8Gb connection (25XX only) */
612 #define ISP_CFG_16GB 0x8000 /* force 16Gb connection (26XX only) */
613 #define ISP_CFG_32GB 0x10000 /* force 32Gb connection (27XX only) */
614 #define ISP_CFG_64GB 0x20000 /* force 64Gb connection (28XX only) */
615 #define ISP_CFG_FWLOAD_FORCE 0x40000 /* Prefer ispfw(4) even if older */
639 #define ISP_ROLE_NONE 0x0
640 #define ISP_ROLE_TARGET 0x1
641 #define ISP_ROLE_INITIATOR 0x2
661 #define ISP_CODE_ORG 0x1000 /* default f/w code start */
662 #define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */
663 #define ISP_CODE_ORG_2400 0x100000 /* ..and 2400s */
665 #define ISP_FW_MAJOR(code) (((code) >> 16) & 0xff)
666 #define ISP_FW_MINOR(code) (((code) >> 8) & 0xff)
667 #define ISP_FW_MICRO(code) ((code) & 0xff)
668 #define ISP_FW_REVX(xp) (((xp)[0] << 16) | ((xp)[1] << 8) | (xp)[2])
669 #define ISP_FW_MAJORX(xp) (xp[0])
684 #define ISP_HA_FC_2400 0x04
685 #define ISP_HA_FC_2500 0x05
686 #define ISP_HA_FC_2600 0x06
687 #define ISP_HA_FC_2700 0x07
688 #define ISP_HA_FC_2800 0x08
690 #define IS_25XX(isp) ((isp)->isp_type >= ISP_HA_FC_2500) argument
691 #define IS_26XX(isp) ((isp)->isp_type >= ISP_HA_FC_2600) argument
692 #define IS_27XX(isp) ((isp)->isp_type >= ISP_HA_FC_2700) argument
693 #define IS_28XX(isp) ((isp)->isp_type >= ISP_HA_FC_2800) argument
698 #define DMA_WD3(x) (((uint16_t)(((uint64_t)x) >> 48)) & 0xffff)
699 #define DMA_WD2(x) (((uint16_t)(((uint64_t)x) >> 32)) & 0xffff)
700 #define DMA_WD1(x) ((uint16_t)((x) >> 16) & 0xffff)
701 #define DMA_WD0(x) ((uint16_t)((x) & 0xffff))
709 #define MBS_MASK 0x3fff
722 #define ISP_FUNCTION_TIMEOUT 0x100
723 #define ISP_FUNCTION_PARAMETER_ERROR 0x101
724 #define ISP_FUNCTION_FAILED 0x102
725 #define ISP_MEMORY_ALLOC_FAILED 0x103
726 #define ISP_LOCK_TIMEOUT 0x104
727 #define ISP_ABORTED 0x105
728 #define ISP_SUSPENDED 0x106
729 #define ISP_BUSY 0x107
730 #define ISP_ALREADY_REGISTERED 0x109
731 #define ISP_OS_TIMER_EXPIRED 0x10a
732 #define ISP_ERR_NO_QPAIR 0x10b
733 #define ISP_ERR_NOT_FOUND 0x10c
734 #define ISP_ERR_FROM_FW 0x10d
751 * Reset the ISP and call completion for any orphaned commands.
772 * Command Entry Point- Platform Dependent layers call into this
778 #define CMD_EAGAIN 102 /* busy- maybe retry later */
782 * Command Completion Point- Core layers call out from this with completed cmds
811 * Get a WWNN/WWPN for this N-port handle on this channel
815 * Get PDB on this channel for this N-port handle
868 #define ISPASYNC_CHANGE_PDB 0
884 #define ISP_LOGALL 0x0 /* log always */
885 #define ISP_LOGCONFIG 0x1 /* log configuration messages */
886 #define ISP_LOGINFO 0x2 /* log informational messages */
887 #define ISP_LOGWARN 0x4 /* log warning messages */
888 #define ISP_LOGERR 0x8 /* log error messages */
889 #define ISP_LOGDEBUG0 0x10 /* log simple debug messages */
890 #define ISP_LOGDEBUG1 0x20 /* log intermediate debug messages */
891 #define ISP_LOGDEBUG2 0x40 /* log most debug messages */
892 #define ISP_LOGDEBUG3 0x80 /* log high frequency debug messages */
893 #define ISP_LOG_SANCFG 0x100 /* log SAN configuration */
894 #define ISP_LOG_CWARN 0x200 /* log SCSI command "warnings" (e.g., check conditions) */
895 #define ISP_LOG_WARN1 0x400 /* log WARNS we might be interested at some time */
896 #define ISP_LOGTINFO 0x1000 /* log informational messages (target mode) */
897 #define ISP_LOGTDEBUG0 0x2000 /* log simple debug messages (target mode) */
898 #define ISP_LOGTDEBUG1 0x4000 /* log intermediate debug messages (target) */
899 #define ISP_LOGTDEBUG2 0x8000 /* log all debug messages (target) */
914 * ISP_SLEEP(isp, usecs) microsecond sleep function
916 * ISP_INLINE ___inline or not- depending on how
935 * various objects so that the ISP's and the system's view
939 * return -1 if you cannot
1054 * General routine to send a final CTIO for a command- used mostly for
1058 #define ECMD_SVALID 0x100
1059 #define ECMD_RVALID 0x200
1060 #define ECMD_TERMINATE 0x400