1c3aac50fSPeter Wemm /* $FreeBSD$ */ 2098ca2bdSWarner Losh /*- 3718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4718cf2ccSPedro F. Giffuni * 51b760be4SAlexander Motin * Copyright (c) 2009-2020 Alexander Motin <mav@FreeBSD.org> 62df76c16SMatt Jacob * Copyright (c) 1997-2009 by Matthew Jacob 76054c3f6SMatt Jacob * All rights reserved. 87e90346eSMatt Jacob * 96054c3f6SMatt Jacob * Redistribution and use in source and binary forms, with or without 106054c3f6SMatt Jacob * modification, are permitted provided that the following conditions 116054c3f6SMatt Jacob * are met: 126054c3f6SMatt Jacob * 13e48b2487SMatt Jacob * 1. Redistributions of source code must retain the above copyright 14e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer. 15e48b2487SMatt Jacob * 2. Redistributions in binary form must reproduce the above copyright 16e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer in the 17e48b2487SMatt Jacob * documentation and/or other materials provided with the distribution. 18e48b2487SMatt Jacob * 19e48b2487SMatt Jacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 206054c3f6SMatt Jacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 216054c3f6SMatt Jacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22e48b2487SMatt Jacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 23e48b2487SMatt Jacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 246054c3f6SMatt Jacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 256054c3f6SMatt Jacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 266054c3f6SMatt Jacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 276054c3f6SMatt Jacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 286054c3f6SMatt Jacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 296054c3f6SMatt Jacob * SUCH DAMAGE. 302df76c16SMatt Jacob * 316054c3f6SMatt Jacob */ 32e48b2487SMatt Jacob /* 33e48b2487SMatt Jacob * Soft Definitions for for Qlogic ISP SCSI adapters. 34e48b2487SMatt Jacob */ 356054c3f6SMatt Jacob 366054c3f6SMatt Jacob #ifndef _ISPVAR_H 376054c3f6SMatt Jacob #define _ISPVAR_H 386054c3f6SMatt Jacob 3957c801f5SMatt Jacob #if defined(__NetBSD__) || defined(__OpenBSD__) 4010365e5aSMatt Jacob #include <dev/ic/isp_stds.h> 416054c3f6SMatt Jacob #include <dev/ic/ispmbox.h> 426054c3f6SMatt Jacob #endif 436054c3f6SMatt Jacob #ifdef __FreeBSD__ 4410365e5aSMatt Jacob #include <dev/isp/isp_stds.h> 456054c3f6SMatt Jacob #include <dev/isp/ispmbox.h> 466054c3f6SMatt Jacob #endif 476054c3f6SMatt Jacob #ifdef __linux__ 4810365e5aSMatt Jacob #include "isp_stds.h" 49c3055363SMatt Jacob #include "ispmbox.h" 5080ae5655SMatt Jacob #endif 511dae40ebSMatt Jacob #ifdef __svr4__ 5210365e5aSMatt Jacob #include "isp_stds.h" 531dae40ebSMatt Jacob #include "ispmbox.h" 546054c3f6SMatt Jacob #endif 556054c3f6SMatt Jacob 56c8b8a2c4SMatt Jacob #define ISP_CORE_VERSION_MAJOR 7 5710365e5aSMatt Jacob #define ISP_CORE_VERSION_MINOR 0 58478f8a96SJustin T. Gibbs 596054c3f6SMatt Jacob /* 60cbf57b47SMatt Jacob * Vector for bus specific code to provide specific services. 616054c3f6SMatt Jacob */ 621dae40ebSMatt Jacob typedef struct ispsoftc ispsoftc_t; 636054c3f6SMatt Jacob struct ispmdvec { 640e6bc811SAlexander Motin void (*dv_run_isr) (ispsoftc_t *); 6510365e5aSMatt Jacob uint32_t (*dv_rd_reg) (ispsoftc_t *, int); 6610365e5aSMatt Jacob void (*dv_wr_reg) (ispsoftc_t *, int, uint32_t); 671dae40ebSMatt Jacob int (*dv_mbxdma) (ispsoftc_t *); 68f6854a0cSAlexander Motin int (*dv_send_cmd) (ispsoftc_t *, void *, void *, uint32_t); 69a1fa0267SAlexander Motin int (*dv_irqsetup) (ispsoftc_t *); 701dae40ebSMatt Jacob void (*dv_dregs) (ispsoftc_t *, const char *); 715f634111SMatt Jacob const void * dv_ispfw; /* ptr to f/w */ 726054c3f6SMatt Jacob }; 736054c3f6SMatt Jacob 7453cff3bbSMatt Jacob /* 7553cff3bbSMatt Jacob * Overall parameters 7653cff3bbSMatt Jacob */ 776054c3f6SMatt Jacob #define MAX_TARGETS 16 782df76c16SMatt Jacob #ifndef MAX_FC_TARG 795d084976SAlexander Motin #define MAX_FC_TARG 1024 802df76c16SMatt Jacob #endif 811b760be4SAlexander Motin #define ISP_MAX_TARGETS(isp) MAX_FC_TARG 8208826086SAlexander Motin #define ISP_MAX_IRQS 3 830f747d72SMatt Jacob 84126ec864SMatt Jacob /* 8553cff3bbSMatt Jacob * Macros to access ISP registers through bus specific layers- 8653cff3bbSMatt Jacob * mostly wrappers to vector through the mdvec structure. 8780ae5655SMatt Jacob */ 880e6bc811SAlexander Motin #define ISP_RUN_ISR(isp) \ 890e6bc811SAlexander Motin (*(isp)->isp_mdvec->dv_run_isr)(isp) 9080ae5655SMatt Jacob 9180ae5655SMatt Jacob #define ISP_READ(isp, reg) \ 9280ae5655SMatt Jacob (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg)) 9380ae5655SMatt Jacob 9480ae5655SMatt Jacob #define ISP_WRITE(isp, reg, val) \ 9580ae5655SMatt Jacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val)) 9680ae5655SMatt Jacob 9780ae5655SMatt Jacob #define ISP_MBOXDMASETUP(isp) \ 9880ae5655SMatt Jacob (*(isp)->isp_mdvec->dv_mbxdma)((isp)) 9980ae5655SMatt Jacob 100f6854a0cSAlexander Motin #define ISP_SEND_CMD(isp, qe, segp, nseg) \ 101f6854a0cSAlexander Motin (*(isp)->isp_mdvec->dv_send_cmd)((isp), (qe), (segp), (nseg)) 10280ae5655SMatt Jacob 103a1fa0267SAlexander Motin #define ISP_IRQSETUP(isp) \ 104a1fa0267SAlexander Motin (((isp)->isp_mdvec->dv_irqsetup) ? (*(isp)->isp_mdvec->dv_irqsetup)(isp) : 0) 10553cff3bbSMatt Jacob #define ISP_DUMPREGS(isp, m) \ 10653cff3bbSMatt Jacob if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp),(m)) 10780ae5655SMatt Jacob 10880ae5655SMatt Jacob #define ISP_SETBITS(isp, reg, val) \ 10980ae5655SMatt Jacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val)) 11080ae5655SMatt Jacob 11180ae5655SMatt Jacob #define ISP_CLRBITS(isp, reg, val) \ 11280ae5655SMatt Jacob (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val)) 11380ae5655SMatt Jacob 11453cff3bbSMatt Jacob /* 11553cff3bbSMatt Jacob * The MEMORYBARRIER macro is defined per platform (to provide synchronization 11653cff3bbSMatt Jacob * on Request and Response Queues, Scratch DMA areas, and Registers) 11753cff3bbSMatt Jacob * 11853cff3bbSMatt Jacob * Defined Memory Barrier Synchronization Types 11953cff3bbSMatt Jacob */ 12053cff3bbSMatt Jacob #define SYNC_REQUEST 0 /* request queue synchronization */ 12153cff3bbSMatt Jacob #define SYNC_RESULT 1 /* result queue synchronization */ 12253cff3bbSMatt Jacob #define SYNC_SFORDEV 2 /* scratch, sync for ISP */ 12353cff3bbSMatt Jacob #define SYNC_SFORCPU 3 /* scratch, sync for CPU */ 12453cff3bbSMatt Jacob #define SYNC_REG 4 /* for registers */ 12510365e5aSMatt Jacob #define SYNC_ATIOQ 5 /* atio result queue (24xx) */ 1264ff970c4SAlexander Motin #define SYNC_IFORDEV 6 /* synchrounous IOCB, sync for ISP */ 1274ff970c4SAlexander Motin #define SYNC_IFORCPU 7 /* synchrounous IOCB, sync for CPU */ 12853cff3bbSMatt Jacob 12953cff3bbSMatt Jacob /* 13053cff3bbSMatt Jacob * Request/Response Queue defines and macros. 13153cff3bbSMatt Jacob */ 13253cff3bbSMatt Jacob /* This is the size of a queue entry (request and response) */ 1336054c3f6SMatt Jacob #define QENTRY_LEN 64 134b8e2395eSAlexander Motin /* Queue lengths must be a power of two and at least 8 elements. */ 135b8e2395eSAlexander Motin #define RQUEST_QUEUE_LEN(x) 8192 136b8e2395eSAlexander Motin #define RESULT_QUEUE_LEN(x) 1024 137b8e2395eSAlexander Motin #define ATIO_QUEUE_LEN(x) 1024 138b8e2395eSAlexander Motin #define ISP_QUEUE_ENTRY(q, idx) (((uint8_t *)q) + ((size_t)(idx) * QENTRY_LEN)) 139b8e2395eSAlexander Motin #define ISP_QUEUE_SIZE(n) ((size_t)(n) * QENTRY_LEN) 140478f8a96SJustin T. Gibbs #define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1)) 141b6b6ad2fSMatt Jacob #define ISP_QFREE(in, out, qlen) \ 142478f8a96SJustin T. Gibbs ((in == out)? (qlen - 1) : ((in > out)? \ 143478f8a96SJustin T. Gibbs ((qlen - 1) - (in - out)) : (out - in - 1))) 144b6b6ad2fSMatt Jacob #define ISP_QAVAIL(isp) \ 145b6b6ad2fSMatt Jacob ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp)) 14680ae5655SMatt Jacob 1474fd13c1bSMatt Jacob #define ISP_ADD_REQUEST(isp, nxti) \ 14837bb79f1SMarius Strobl MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \ 1491b760be4SAlexander Motin ISP_WRITE(isp, BIU2400_REQINP, nxti); \ 1504fd13c1bSMatt Jacob isp->isp_reqidx = nxti 15180ae5655SMatt Jacob 1522df76c16SMatt Jacob #define ISP_SYNC_REQUEST(isp) \ 15337bb79f1SMarius Strobl MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1); \ 1542df76c16SMatt Jacob isp->isp_reqidx = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); \ 1551b760be4SAlexander Motin ISP_WRITE(isp, BIU2400_REQINP, isp->isp_reqidx) 1566054c3f6SMatt Jacob 1576054c3f6SMatt Jacob /* 1586054c3f6SMatt Jacob * Fibre Channel Specifics 1596054c3f6SMatt Jacob */ 16010365e5aSMatt Jacob #define NPH_RESERVED 0x7F0 /* begin of reserved N-port handles */ 16110365e5aSMatt Jacob #define NPH_MGT_ID 0x7FA /* Management Server Special ID */ 16210365e5aSMatt Jacob #define NPH_SNS_ID 0x7FC /* SNS Server Special ID */ 1632df76c16SMatt Jacob #define NPH_FABRIC_CTLR 0x7FD /* Fabric Controller (0xFFFFFD) */ 1642df76c16SMatt Jacob #define NPH_FL_ID 0x7FE /* F Port Special ID (0xFFFFFE) */ 1655b355b12SAlexander Motin #define NPH_IP_BCST 0x7FF /* IP Broadcast Special ID (0xFFFFFF) */ 166dd9fc7c3SMatt Jacob #define NPH_MAX_2K 0x800 167dd9fc7c3SMatt Jacob 168dd9fc7c3SMatt Jacob /* 169dd9fc7c3SMatt Jacob * "Unassigned" handle to be used internally 170dd9fc7c3SMatt Jacob */ 171dd9fc7c3SMatt Jacob #define NIL_HANDLE 0xffff 172029f13c6SMatt Jacob 17310365e5aSMatt Jacob /* 17410365e5aSMatt Jacob * Limit for devices on an arbitrated loop. 17510365e5aSMatt Jacob */ 17610365e5aSMatt Jacob #define LOCAL_LOOP_LIM 126 17710365e5aSMatt Jacob 17810365e5aSMatt Jacob /* 1792df76c16SMatt Jacob * Limit for (2K login) N-port handle amounts 1802df76c16SMatt Jacob */ 1812df76c16SMatt Jacob #define MAX_NPORT_HANDLE 2048 1822df76c16SMatt Jacob 1832df76c16SMatt Jacob /* 1842df76c16SMatt Jacob * Special Constants 1852df76c16SMatt Jacob */ 1862df76c16SMatt Jacob #define INI_NONE ((uint64_t) 0) 1872df76c16SMatt Jacob #define ISP_NOCHAN 0xff 1882df76c16SMatt Jacob 1892df76c16SMatt Jacob /* 19010365e5aSMatt Jacob * Special Port IDs 19110365e5aSMatt Jacob */ 19210365e5aSMatt Jacob #define MANAGEMENT_PORT_ID 0xFFFFFA 19310365e5aSMatt Jacob #define SNS_PORT_ID 0xFFFFFC 19410365e5aSMatt Jacob #define FABRIC_PORT_ID 0xFFFFFE 1952df76c16SMatt Jacob #define PORT_ANY 0xFFFFFF 1962df76c16SMatt Jacob #define PORT_NONE 0 1974187a965SAlexander Motin #define VALID_PORT(port) (port != PORT_NONE && port != PORT_ANY) 1982df76c16SMatt Jacob #define DOMAIN_CONTROLLER_BASE 0xFFFC00 1992df76c16SMatt Jacob #define DOMAIN_CONTROLLER_END 0xFFFCFF 20010365e5aSMatt Jacob 201c8b8a2c4SMatt Jacob /* 202c8b8a2c4SMatt Jacob * Command Handles 203c8b8a2c4SMatt Jacob * 204c8b8a2c4SMatt Jacob * Most QLogic initiator or target have 32 bit handles associated with them. 205c8b8a2c4SMatt Jacob * We want to have a quick way to index back and forth between a local SCSI 206c8b8a2c4SMatt Jacob * command context and what the firmware is passing back to us. We also 207c8b8a2c4SMatt Jacob * want to avoid working on stale information. This structure handles both 208c8b8a2c4SMatt Jacob * at the expense of some local memory. 209c8b8a2c4SMatt Jacob * 210c8b8a2c4SMatt Jacob * The handle is architected thusly: 211c8b8a2c4SMatt Jacob * 212c8b8a2c4SMatt Jacob * 0 means "free handle" 213c8b8a2c4SMatt Jacob * bits 0..12 index commands 214c8b8a2c4SMatt Jacob * bits 13..15 bits index usage 215c8b8a2c4SMatt Jacob * bits 16..31 contain a rolling sequence 216c8b8a2c4SMatt Jacob * 217c8b8a2c4SMatt Jacob * 218c8b8a2c4SMatt Jacob */ 219c8b8a2c4SMatt Jacob typedef struct { 220c8b8a2c4SMatt Jacob void * cmd; /* associated command context */ 221c8b8a2c4SMatt Jacob uint32_t handle; /* handle associated with this command */ 222c8b8a2c4SMatt Jacob } isp_hdl_t; 223c8b8a2c4SMatt Jacob #define ISP_HANDLE_FREE 0x00000000 224*0b19f90aSAlexander Motin #define ISP_HANDLE_CMD_MASK 0x00003fff 225*0b19f90aSAlexander Motin #define ISP_HANDLE_USAGE_MASK 0x0000c000 226*0b19f90aSAlexander Motin #define ISP_HANDLE_USAGE_SHIFT 14 227c8b8a2c4SMatt Jacob #define ISP_H2HT(hdl) ((hdl & ISP_HANDLE_USAGE_MASK) >> ISP_HANDLE_USAGE_SHIFT) 228c8b8a2c4SMatt Jacob # define ISP_HANDLE_NONE 0 229c8b8a2c4SMatt Jacob # define ISP_HANDLE_INITIATOR 1 230c8b8a2c4SMatt Jacob # define ISP_HANDLE_TARGET 2 23166e979f1SAlexander Motin # define ISP_HANDLE_CTRL 3 232c8b8a2c4SMatt Jacob #define ISP_HANDLE_SEQ_MASK 0xffff0000 233c8b8a2c4SMatt Jacob #define ISP_HANDLE_SEQ_SHIFT 16 234c8b8a2c4SMatt Jacob #define ISP_H2SEQ(hdl) ((hdl & ISP_HANDLE_SEQ_MASK) >> ISP_HANDLE_SEQ_SHIFT) 235*0b19f90aSAlexander Motin #define ISP_HANDLE_MAX (ISP_HANDLE_CMD_MASK + 1) 236*0b19f90aSAlexander Motin #define ISP_HANDLE_RESERVE 256 237*0b19f90aSAlexander Motin #define ISP_HANDLE_NUM(isp) ((isp)->isp_maxcmds + ISP_HANDLE_RESERVE) 238*0b19f90aSAlexander Motin #define ISP_VALID_HANDLE(isp, hdl) \ 239970ceb2fSAlexander Motin ((ISP_H2HT(hdl) == ISP_HANDLE_INITIATOR || \ 24066e979f1SAlexander Motin ISP_H2HT(hdl) == ISP_HANDLE_TARGET || \ 24166e979f1SAlexander Motin ISP_H2HT(hdl) == ISP_HANDLE_CTRL) && \ 242*0b19f90aSAlexander Motin ((hdl) & ISP_HANDLE_CMD_MASK) < ISP_HANDLE_NUM(isp) && \ 243*0b19f90aSAlexander Motin (hdl) == ((isp)->isp_xflist[(hdl) & ISP_HANDLE_CMD_MASK].handle)) 244c8b8a2c4SMatt Jacob 24510365e5aSMatt Jacob 24610365e5aSMatt Jacob /* 24710365e5aSMatt Jacob * FC Port Database entry. 24810365e5aSMatt Jacob * 24910365e5aSMatt Jacob * It has a handle that the f/w uses to address commands to a device. 25010365e5aSMatt Jacob * This handle's value may be assigned by the firmware (e.g., for local loop 25110365e5aSMatt Jacob * devices) or by the driver (e.g., for fabric devices). 25210365e5aSMatt Jacob * 25310365e5aSMatt Jacob * It has a state. If the state if VALID, that means that we've logged into 254766a65a5SAlexander Motin * the device. 25510365e5aSMatt Jacob * 25610365e5aSMatt Jacob * Local loop devices the firmware automatically performs PLOGI on for us 25710365e5aSMatt Jacob * (which is why that handle is imposed upon us). Fabric devices we assign 25810365e5aSMatt Jacob * a handle to and perform the PLOGI on. 25910365e5aSMatt Jacob * 26010365e5aSMatt Jacob * When a PORT DATABASE CHANGED asynchronous event occurs, we mark all VALID 26110365e5aSMatt Jacob * entries as PROBATIONAL. This allows us, if policy says to, just keep track 26210365e5aSMatt Jacob * of devices whose handles change but are otherwise the same device (and 26310365e5aSMatt Jacob * thus keep 'target' constant). 26410365e5aSMatt Jacob * 26510365e5aSMatt Jacob * In any case, we search all possible local loop handles. For each one that 26610365e5aSMatt Jacob * has a port database entity returned, we search for any PROBATIONAL entry 26710365e5aSMatt Jacob * that matches it and update as appropriate. Otherwise, as a new entry, we 26810365e5aSMatt Jacob * find room for it in the Port Database. We *try* and use the handle as the 26910365e5aSMatt Jacob * index to put it into the Database, but that's just an optimization. We mark 27010365e5aSMatt Jacob * the entry VALID and make sure that the target index is updated and correct. 27110365e5aSMatt Jacob * 272453130d9SPedro F. Giffuni * When we get done searching the local loop, we then search similarly for 27310365e5aSMatt Jacob * a list of devices we've gotten from the fabric name controller (if we're 274453130d9SPedro F. Giffuni * on a fabric). VALID marking is also done similarly. 27510365e5aSMatt Jacob * 27610365e5aSMatt Jacob * When all of this is done, we can march through the database and clean up 27710365e5aSMatt Jacob * any entry that is still PROBATIONAL (these represent devices which have 27810365e5aSMatt Jacob * departed). Then we're done and can resume normal operations. 27910365e5aSMatt Jacob * 28010365e5aSMatt Jacob * Negative invariants that we try and test for are: 28110365e5aSMatt Jacob * 28210365e5aSMatt Jacob * + There can never be two non-NIL entries with the same { Port, Node } WWN 28310365e5aSMatt Jacob * duples. 28410365e5aSMatt Jacob * 28510365e5aSMatt Jacob * + There can never be two non-NIL entries with the same handle. 28610365e5aSMatt Jacob */ 2876054c3f6SMatt Jacob typedef struct { 288f7c631bcSMatt Jacob /* 289f7c631bcSMatt Jacob * This is the handle that the firmware needs in order for us to 290f7c631bcSMatt Jacob * send commands to the device. For pre-24XX cards, this would be 291f7c631bcSMatt Jacob * the 'loopid'. 292f7c631bcSMatt Jacob */ 29310365e5aSMatt Jacob uint16_t handle; 2942df76c16SMatt Jacob 295f7c631bcSMatt Jacob /* 2966f9dbc0eSKenneth D. Merry * PRLI word 0 contains the Establish Image Pair bit, which is 2976f9dbc0eSKenneth D. Merry * important for knowing when to reset the CRN. 2986f9dbc0eSKenneth D. Merry * 299387d8239SMatt Jacob * PRLI word 3 parameters contains role as well as other things. 300f7c631bcSMatt Jacob * 301387d8239SMatt Jacob * The state is the current state of this entry. 302f7c631bcSMatt Jacob * 303e68eef14SAlexander Motin * The is_target is the current state of target on this port. 304e68eef14SAlexander Motin * 305e68eef14SAlexander Motin * The is_initiator is the current state of initiator on this port. 306e68eef14SAlexander Motin * 3072df76c16SMatt Jacob * Portid is obvious, as are node && port WWNs. The new_role and 308f7c631bcSMatt Jacob * new_portid is for when we are pending a change. 309f7c631bcSMatt Jacob */ 3106f9dbc0eSKenneth D. Merry uint16_t prli_word0; /* PRLI parameters */ 311387d8239SMatt Jacob uint16_t prli_word3; /* PRLI parameters */ 3126f9dbc0eSKenneth D. Merry uint16_t new_prli_word0; /* Incoming new PRLI parameters */ 313387d8239SMatt Jacob uint16_t new_prli_word3; /* Incoming new PRLI parameters */ 3145fa351edSAlexander Motin uint16_t : 12, 315eea52482SAlexander Motin probational : 1, 31610365e5aSMatt Jacob state : 3; 317e68eef14SAlexander Motin uint32_t : 6, 318e68eef14SAlexander Motin is_target : 1, 319e68eef14SAlexander Motin is_initiator : 1, 32010365e5aSMatt Jacob portid : 24; 3212df76c16SMatt Jacob uint32_t 322e68eef14SAlexander Motin : 8, 32310365e5aSMatt Jacob new_portid : 24; 32410365e5aSMatt Jacob uint64_t node_wwn; 32510365e5aSMatt Jacob uint64_t port_wwn; 326427fa8f9SMatt Jacob uint32_t gone_timer; 32710365e5aSMatt Jacob } fcportdb_t; 32810365e5aSMatt Jacob 329eea52482SAlexander Motin #define FC_PORTDB_STATE_NIL 0 /* Empty DB slot */ 330eea52482SAlexander Motin #define FC_PORTDB_STATE_DEAD 1 /* Was valid, but no more. */ 331eea52482SAlexander Motin #define FC_PORTDB_STATE_CHANGED 2 /* Was valid, but changed. */ 332eea52482SAlexander Motin #define FC_PORTDB_STATE_NEW 3 /* Logged in, not announced. */ 333eea52482SAlexander Motin #define FC_PORTDB_STATE_ZOMBIE 4 /* Invalid, but announced. */ 334eea52482SAlexander Motin #define FC_PORTDB_STATE_VALID 5 /* Valid */ 33510365e5aSMatt Jacob 336e68eef14SAlexander Motin #define FC_PORTDB_TGT(isp, bus, pdb) (int)(lp - FCPARAM(isp, bus)->portdb) 337e68eef14SAlexander Motin 33810365e5aSMatt Jacob /* 33910365e5aSMatt Jacob * FC card specific information 3402df76c16SMatt Jacob * 3412df76c16SMatt Jacob * This structure is replicated across multiple channels for multi-id 3422df76c16SMatt Jacob * capapble chipsets, with some entities different on a per-channel basis. 34310365e5aSMatt Jacob */ 3442df76c16SMatt Jacob 34510365e5aSMatt Jacob typedef struct { 346e596ff7aSAlexander Motin int isp_gbspeed; /* Connection speed */ 347e596ff7aSAlexander Motin int isp_linkstate; /* Link state */ 348e596ff7aSAlexander Motin int isp_fwstate; /* ISP F/W state */ 349e596ff7aSAlexander Motin int isp_loopstate; /* Loop State */ 350e596ff7aSAlexander Motin int isp_topo; /* Connection Type */ 351e596ff7aSAlexander Motin 352e561aa79SAlexander Motin uint32_t : 4, 353387d8239SMatt Jacob fctape_enabled : 1, 3542df76c16SMatt Jacob sendmarker : 1, 3552df76c16SMatt Jacob role : 2, 356e5265237SMatt Jacob isp_portid : 24; /* S_ID */ 3572df76c16SMatt Jacob 3581dae40ebSMatt Jacob uint16_t isp_fwoptions; 3598a97c03aSMatt Jacob uint16_t isp_xfwoptions; 3608a97c03aSMatt Jacob uint16_t isp_zfwoptions; 3611dae40ebSMatt Jacob uint16_t isp_loopid; /* hard loop id */ 3622df76c16SMatt Jacob uint16_t isp_sns_hdl; /* N-port handle for SNS */ 3632df76c16SMatt Jacob uint16_t isp_lasthdl; /* only valid for channel 0 */ 364ad0ab753SMatt Jacob uint16_t isp_fabric_params; 365ace7039eSAlexander Motin uint16_t isp_login_hdl; /* Logging in handle */ 3661dae40ebSMatt Jacob uint8_t isp_retry_delay; 3671dae40ebSMatt Jacob uint8_t isp_retry_count; 368a94fab67SAlexander Motin int isp_use_gft_id; /* Use GFT_ID */ 369a94fab67SAlexander Motin int isp_use_gff_id; /* Use GFF_ID */ 3702df76c16SMatt Jacob 3712df76c16SMatt Jacob /* 3722df76c16SMatt Jacob * Current active WWNN/WWPN 3732df76c16SMatt Jacob */ 3742df76c16SMatt Jacob uint64_t isp_wwnn; 3752df76c16SMatt Jacob uint64_t isp_wwpn; 3762df76c16SMatt Jacob 3772df76c16SMatt Jacob /* 3782df76c16SMatt Jacob * NVRAM WWNN/WWPN 3792df76c16SMatt Jacob */ 3806c81a0aeSMatt Jacob uint64_t isp_wwnn_nvram; 3816c81a0aeSMatt Jacob uint64_t isp_wwpn_nvram; 382f7c631bcSMatt Jacob 383f7c631bcSMatt Jacob /* 384f7c631bcSMatt Jacob * Our Port Data Base 385f7c631bcSMatt Jacob */ 38610365e5aSMatt Jacob fcportdb_t portdb[MAX_FC_TARG]; 387f7c631bcSMatt Jacob 38857c801f5SMatt Jacob /* 3896054c3f6SMatt Jacob * Scratch DMA mapped in area to fetch Port Database stuff, etc. 3906054c3f6SMatt Jacob */ 3911dae40ebSMatt Jacob void * isp_scratch; 3921dae40ebSMatt Jacob XS_DMA_ADDR_T isp_scdma; 3935d084976SAlexander Motin 3945d084976SAlexander Motin uint8_t isp_scanscratch[ISP_FC_SCRLEN]; 3956054c3f6SMatt Jacob } fcparam; 3966054c3f6SMatt Jacob 39777d4e836SMatt Jacob #define FW_CONFIG_WAIT 0 398b6bd5f7fSAlexander Motin #define FW_WAIT_LINK 1 39977d4e836SMatt Jacob #define FW_WAIT_LOGIN 2 40077d4e836SMatt Jacob #define FW_READY 3 40177d4e836SMatt Jacob #define FW_LOSS_OF_SYNC 4 40277d4e836SMatt Jacob #define FW_ERROR 5 40377d4e836SMatt Jacob #define FW_REINIT 6 40477d4e836SMatt Jacob #define FW_NON_PART 7 4056054c3f6SMatt Jacob 40677d4e836SMatt Jacob #define LOOP_NIL 0 407e561aa79SAlexander Motin #define LOOP_HAVE_LINK 1 408212fad74SAlexander Motin #define LOOP_HAVE_ADDR 2 409212fad74SAlexander Motin #define LOOP_TESTING_LINK 3 410212fad74SAlexander Motin #define LOOP_LTEST_DONE 4 411212fad74SAlexander Motin #define LOOP_SCANNING_LOOP 5 412212fad74SAlexander Motin #define LOOP_LSCAN_DONE 6 413212fad74SAlexander Motin #define LOOP_SCANNING_FABRIC 7 414212fad74SAlexander Motin #define LOOP_FSCAN_DONE 8 415212fad74SAlexander Motin #define LOOP_SYNCING_PDB 9 416212fad74SAlexander Motin #define LOOP_READY 10 41777d4e836SMatt Jacob 418d465588aSMatt Jacob #define TOPO_NL_PORT 0 419d465588aSMatt Jacob #define TOPO_FL_PORT 1 420d465588aSMatt Jacob #define TOPO_N_PORT 2 421d465588aSMatt Jacob #define TOPO_F_PORT 3 422d465588aSMatt Jacob #define TOPO_PTP_STUB 4 423d465588aSMatt Jacob 424eea52482SAlexander Motin #define TOPO_IS_FABRIC(x) ((x) == TOPO_FL_PORT || (x) == TOPO_F_PORT) 425eea52482SAlexander Motin 42657b6261fSKenneth D. Merry #define FCP_AL_DA_ALL 0xFF 42757b6261fSKenneth D. Merry #define FCP_AL_PA(fcp) ((uint8_t)(fcp->isp_portid)) 42857b6261fSKenneth D. Merry #define FCP_IS_DEST_ALPD(fcp, alpd) (FCP_AL_PA((fcp)) == FCP_AL_DA_ALL || FCP_AL_PA((fcp)) == alpd) 42957b6261fSKenneth D. Merry 4306054c3f6SMatt Jacob /* 4316054c3f6SMatt Jacob * Soft Structure per host adapter 4326054c3f6SMatt Jacob */ 4331dae40ebSMatt Jacob struct ispsoftc { 4346054c3f6SMatt Jacob /* 4356054c3f6SMatt Jacob * Platform (OS) specific data 4366054c3f6SMatt Jacob */ 4376054c3f6SMatt Jacob struct isposinfo isp_osinfo; 4386054c3f6SMatt Jacob 4396054c3f6SMatt Jacob /* 44080ae5655SMatt Jacob * Pointer to bus specific functions and data 4416054c3f6SMatt Jacob */ 4426054c3f6SMatt Jacob struct ispmdvec * isp_mdvec; 4436054c3f6SMatt Jacob 4446054c3f6SMatt Jacob /* 44580ae5655SMatt Jacob * (Mostly) nonvolatile state. Board specific parameters 44680ae5655SMatt Jacob * may contain some volatile state (e.g., current loop state). 4476054c3f6SMatt Jacob */ 4486054c3f6SMatt Jacob 44980ae5655SMatt Jacob void * isp_param; /* type specific */ 450ad0ab753SMatt Jacob uint64_t isp_fwattr; /* firmware attributes */ 4511dae40ebSMatt Jacob uint16_t isp_fwrev[3]; /* Loaded F/W revision */ 4521dae40ebSMatt Jacob uint16_t isp_maxcmds; /* max possible I/O cmds */ 4531dae40ebSMatt Jacob uint8_t isp_type; /* HBA Chip Type */ 4541dae40ebSMatt Jacob uint8_t isp_revision; /* HBA Chip H/W Revision */ 45508826086SAlexander Motin uint8_t isp_nirq; /* number of IRQs */ 456ad0ab753SMatt Jacob uint16_t isp_nchan; /* number of channels */ 4576054c3f6SMatt Jacob 4581dae40ebSMatt Jacob uint32_t isp_clock : 8, /* input clock */ 45998339da1SAlexander Motin : 5, 46010365e5aSMatt Jacob isp_port : 1, /* 23XX/24XX only */ 461b6b6ad2fSMatt Jacob isp_loaded_fw : 1, /* loaded firmware */ 4622df76c16SMatt Jacob isp_dblev : 16; /* debug log mask */ 4632df76c16SMatt Jacob 4647afb656fSMatt Jacob 4651dae40ebSMatt Jacob uint32_t isp_confopts; /* config options */ 4667afb656fSMatt Jacob 4676054c3f6SMatt Jacob /* 468478f8a96SJustin T. Gibbs * Volatile state 4696054c3f6SMatt Jacob */ 470a1fa0267SAlexander Motin volatile u_int isp_mboxbsy; /* mailbox command active */ 471a1fa0267SAlexander Motin volatile u_int isp_state; 472c8b8a2c4SMatt Jacob volatile mbreg_t isp_curmbx; /* currently active mailbox command */ 47310365e5aSMatt Jacob volatile uint32_t isp_reqodx; /* index of last ISP pickup */ 47410365e5aSMatt Jacob volatile uint32_t isp_reqidx; /* index of next request */ 475523ea374SAlexander Motin volatile uint32_t isp_residx; /* index of last ISP write */ 47610365e5aSMatt Jacob volatile uint32_t isp_resodx; /* index of next result */ 477523ea374SAlexander Motin volatile uint32_t isp_atioodx; /* index of next ATIO */ 47810365e5aSMatt Jacob volatile uint32_t isp_obits; /* mailbox command output */ 4792df76c16SMatt Jacob volatile uint32_t isp_serno; /* rolling serial number */ 480ad0ab753SMatt Jacob volatile uint16_t isp_mboxtmp[MAX_MAILBOX]; 4811dae40ebSMatt Jacob volatile uint16_t isp_lastmbxcmd; /* last mbox command sent */ 482c8b8a2c4SMatt Jacob volatile uint16_t isp_seqno; /* running sequence number */ 483478f8a96SJustin T. Gibbs 484478f8a96SJustin T. Gibbs /* 48580ae5655SMatt Jacob * Active commands are stored here, indexed by handle functions. 486478f8a96SJustin T. Gibbs */ 487c8b8a2c4SMatt Jacob isp_hdl_t *isp_xflist; 488c8b8a2c4SMatt Jacob isp_hdl_t *isp_xffree; 4896054c3f6SMatt Jacob 4906054c3f6SMatt Jacob /* 4914ff970c4SAlexander Motin * DMA mapped in area for synchronous IOCB requests. 4924ff970c4SAlexander Motin */ 4934ff970c4SAlexander Motin void * isp_iocb; 4944ff970c4SAlexander Motin XS_DMA_ADDR_T isp_iocb_dma; 4954ff970c4SAlexander Motin 4964ff970c4SAlexander Motin /* 4974b39f27dSMatt Jacob * request/result queue pointers and DMA handles for them. 4986054c3f6SMatt Jacob */ 4991dae40ebSMatt Jacob void * isp_rquest; 5001dae40ebSMatt Jacob void * isp_result; 5011dae40ebSMatt Jacob XS_DMA_ADDR_T isp_rquest_dma; 5021dae40ebSMatt Jacob XS_DMA_ADDR_T isp_result_dma; 50310365e5aSMatt Jacob #ifdef ISP_TARGET_MODE 50410365e5aSMatt Jacob /* for 24XX only */ 50510365e5aSMatt Jacob void * isp_atioq; 50610365e5aSMatt Jacob XS_DMA_ADDR_T isp_atioq_dma; 50710365e5aSMatt Jacob #endif 5081dae40ebSMatt Jacob }; 5096054c3f6SMatt Jacob 5102df76c16SMatt Jacob #define FCPARAM(isp, chan) (&((fcparam *)(isp)->isp_param)[(chan)]) 5112df76c16SMatt Jacob 5122df76c16SMatt Jacob #define ISP_SET_SENDMARKER(isp, chan, val) \ 5131b760be4SAlexander Motin FCPARAM(isp, chan)->sendmarker = val \ 5142df76c16SMatt Jacob 5152df76c16SMatt Jacob #define ISP_TST_SENDMARKER(isp, chan) \ 5161b760be4SAlexander Motin (FCPARAM(isp, chan)->sendmarker != 0) 5170f747d72SMatt Jacob 5186054c3f6SMatt Jacob /* 51953cff3bbSMatt Jacob * ISP Driver Run States 5206054c3f6SMatt Jacob */ 5216054c3f6SMatt Jacob #define ISP_NILSTATE 0 5228a97c03aSMatt Jacob #define ISP_CRASHED 1 5238a97c03aSMatt Jacob #define ISP_RESETSTATE 2 5248a97c03aSMatt Jacob #define ISP_INITSTATE 3 5258a97c03aSMatt Jacob #define ISP_RUNSTATE 4 5266054c3f6SMatt Jacob 5276054c3f6SMatt Jacob /* 5289e7d423dSMatt Jacob * ISP Runtime Configuration Options 5296054c3f6SMatt Jacob */ 53080ae5655SMatt Jacob #define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */ 5315f2638daSAlexander Motin #define ISP_CFG_PORT_PREF 0x0e /* Mask for Port Prefs (all FC except 2100) */ 5325f2638daSAlexander Motin #define ISP_CFG_PORT_DEF 0x00 /* prefer connection type from NVRAM */ 5335f2638daSAlexander Motin #define ISP_CFG_LPORT_ONLY 0x02 /* insist on {N/F}L-Port connection */ 5345f2638daSAlexander Motin #define ISP_CFG_NPORT_ONLY 0x04 /* insist on {N/F}-Port connection */ 5355f2638daSAlexander Motin #define ISP_CFG_LPORT 0x06 /* prefer {N/F}L-Port connection */ 5365f2638daSAlexander Motin #define ISP_CFG_NPORT 0x08 /* prefer {N/F}-Port connection */ 53714e084adSAlexander Motin #define ISP_CFG_1GB 0x10 /* force 1Gb connection (23XX only) */ 53814e084adSAlexander Motin #define ISP_CFG_2GB 0x20 /* force 2Gb connection (23XX only) */ 539387d8239SMatt Jacob #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */ 540387d8239SMatt Jacob #define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */ 541387d8239SMatt Jacob #define ISP_CFG_NOFCTAPE 0x100 /* disable FC-Tape */ 542387d8239SMatt Jacob #define ISP_CFG_FCTAPE 0x200 /* enable FC-Tape */ 5430499ae00SMatt Jacob #define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */ 5440499ae00SMatt Jacob #define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */ 54514e084adSAlexander Motin #define ISP_CFG_4GB 0x2000 /* force 4Gb connection (24XX only) */ 54614e084adSAlexander Motin #define ISP_CFG_8GB 0x4000 /* force 8Gb connection (25XX only) */ 54714e084adSAlexander Motin #define ISP_CFG_16GB 0x8000 /* force 16Gb connection (26XX only) */ 54814e084adSAlexander Motin #define ISP_CFG_32GB 0x10000 /* force 32Gb connection (27XX only) */ 5496054c3f6SMatt Jacob 55053cff3bbSMatt Jacob /* 5512df76c16SMatt Jacob * For each channel, the outer layers should know what role that channel 5522df76c16SMatt Jacob * will take: ISP_ROLE_NONE, ISP_ROLE_INITIATOR, ISP_ROLE_TARGET, 5532df76c16SMatt Jacob * ISP_ROLE_BOTH. 5547afb656fSMatt Jacob * 5557afb656fSMatt Jacob * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded, 5567afb656fSMatt Jacob * NVRAM read, and defaults set, but any further initialization (e.g. 5577afb656fSMatt Jacob * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done. 5587afb656fSMatt Jacob * 5597afb656fSMatt Jacob * If INITIATOR MODE isn't set, attempts to run commands will be stopped 5602df76c16SMatt Jacob * at isp_start and completed with the equivalent of SELECTION TIMEOUT. 5617afb656fSMatt Jacob * 5627afb656fSMatt Jacob * If TARGET MODE is set, it doesn't mean that the rest of target mode support 5637afb656fSMatt Jacob * needs to be enabled, or will even work. What happens with the 2X00 cards 5647afb656fSMatt Jacob * here is that if you have enabled it with TARGET MODE as part of the ICB 5657afb656fSMatt Jacob * options, but you haven't given the f/w any ram resources for ATIOs or 5667afb656fSMatt Jacob * Immediate Notifies, the f/w just handles what it can and you never see 5677afb656fSMatt Jacob * anything. Basically, it sends a single byte of data (the first byte, 5687afb656fSMatt Jacob * which you can set as part of the INITIALIZE CONTROL BLOCK command) for 5697afb656fSMatt Jacob * INQUIRY, and sends back QUEUE FULL status for any other command. 5707afb656fSMatt Jacob * 5717afb656fSMatt Jacob */ 5727afb656fSMatt Jacob #define ISP_ROLE_NONE 0x0 573e0d3cfb7SMatt Jacob #define ISP_ROLE_TARGET 0x1 574e0d3cfb7SMatt Jacob #define ISP_ROLE_INITIATOR 0x2 5757afb656fSMatt Jacob #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR) 5767afb656fSMatt Jacob #define ISP_ROLE_EITHER ISP_ROLE_BOTH 5777afb656fSMatt Jacob #ifndef ISP_DEFAULT_ROLES 578e2873b76SMatt Jacob /* 579e2873b76SMatt Jacob * Counterintuitively, we prefer to default to role 'none' 580e2873b76SMatt Jacob * if we are enable target mode support. This gives us the 581e2873b76SMatt Jacob * maximum flexibility as to which port will do what. 582e2873b76SMatt Jacob */ 583e2873b76SMatt Jacob #ifdef ISP_TARGET_MODE 584e2873b76SMatt Jacob #define ISP_DEFAULT_ROLES ISP_ROLE_NONE 585e2873b76SMatt Jacob #else 5867afb656fSMatt Jacob #define ISP_DEFAULT_ROLES ISP_ROLE_INITIATOR 5877afb656fSMatt Jacob #endif 588e2873b76SMatt Jacob #endif 5897afb656fSMatt Jacob 5907afb656fSMatt Jacob 5917afb656fSMatt Jacob /* 59253cff3bbSMatt Jacob * Firmware related defines 59353cff3bbSMatt Jacob */ 59453cff3bbSMatt Jacob #define ISP_CODE_ORG 0x1000 /* default f/w code start */ 595126ec864SMatt Jacob #define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */ 59610365e5aSMatt Jacob #define ISP_CODE_ORG_2400 0x100000 /* ..and 2400s */ 59712b36e2dSMatt Jacob #define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic) 598f8597b62SMatt Jacob #define ISP_FW_MAJOR(code) ((code >> 24) & 0xff) 599f8597b62SMatt Jacob #define ISP_FW_MINOR(code) ((code >> 16) & 0xff) 600f8597b62SMatt Jacob #define ISP_FW_MICRO(code) ((code >> 8) & 0xff) 60112b36e2dSMatt Jacob #define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2]) 602f8597b62SMatt Jacob #define ISP_FW_MAJORX(xp) (xp[0]) 603f8597b62SMatt Jacob #define ISP_FW_MINORX(xp) (xp[1]) 604f8597b62SMatt Jacob #define ISP_FW_MICROX(xp) (xp[2]) 605e347e2c9SMatt Jacob #define ISP_FW_NEWER_THAN(i, major, minor, micro) \ 606e347e2c9SMatt Jacob (ISP_FW_REVX((i)->isp_fwrev) > ISP_FW_REV(major, minor, micro)) 60710365e5aSMatt Jacob #define ISP_FW_OLDER_THAN(i, major, minor, micro) \ 60810365e5aSMatt Jacob (ISP_FW_REVX((i)->isp_fwrev) < ISP_FW_REV(major, minor, micro)) 60912b36e2dSMatt Jacob 6106054c3f6SMatt Jacob /* 611478f8a96SJustin T. Gibbs * Chip Types 6126054c3f6SMatt Jacob */ 6131b760be4SAlexander Motin #define ISP_HA_FC_2400 0x04 6141b760be4SAlexander Motin #define ISP_HA_FC_2500 0x05 6151b760be4SAlexander Motin #define ISP_HA_FC_2600 0x06 6161b760be4SAlexander Motin #define ISP_HA_FC_2700 0x07 6176054c3f6SMatt Jacob 6182df76c16SMatt Jacob #define IS_25XX(isp) ((isp)->isp_type >= ISP_HA_FC_2500) 619218be0b2SAlexander Motin #define IS_26XX(isp) ((isp)->isp_type >= ISP_HA_FC_2600) 62014e084adSAlexander Motin #define IS_27XX(isp) ((isp)->isp_type >= ISP_HA_FC_2700) 62183fbc566SMatt Jacob 62253cff3bbSMatt Jacob /* 6231dae40ebSMatt Jacob * DMA related macros 62453cff3bbSMatt Jacob */ 62510365e5aSMatt Jacob #define DMA_WD3(x) (((uint16_t)(((uint64_t)x) >> 48)) & 0xffff) 62610365e5aSMatt Jacob #define DMA_WD2(x) (((uint16_t)(((uint64_t)x) >> 32)) & 0xffff) 62710365e5aSMatt Jacob #define DMA_WD1(x) ((uint16_t)((x) >> 16) & 0xffff) 62810365e5aSMatt Jacob #define DMA_WD0(x) ((uint16_t)((x) & 0xffff)) 62957c801f5SMatt Jacob 6301dae40ebSMatt Jacob #define DMA_LO32(x) ((uint32_t) (x)) 6311dae40ebSMatt Jacob #define DMA_HI32(x) ((uint32_t)(((uint64_t)x) >> 32)) 6321dae40ebSMatt Jacob 6336054c3f6SMatt Jacob /* 63453cff3bbSMatt Jacob * Core System Function Prototypes 6356054c3f6SMatt Jacob */ 6366054c3f6SMatt Jacob 6376054c3f6SMatt Jacob /* 6382df76c16SMatt Jacob * Reset Hardware. Totally. Assumes that you'll follow this with a call to isp_init. 6396054c3f6SMatt Jacob */ 6402df76c16SMatt Jacob void isp_reset(ispsoftc_t *, int); 6416054c3f6SMatt Jacob 6426054c3f6SMatt Jacob /* 6436054c3f6SMatt Jacob * Initialize Hardware to known state 6446054c3f6SMatt Jacob */ 6451dae40ebSMatt Jacob void isp_init(ispsoftc_t *); 6466054c3f6SMatt Jacob 6476054c3f6SMatt Jacob /* 648478f8a96SJustin T. Gibbs * Reset the ISP and call completion for any orphaned commands. 649478f8a96SJustin T. Gibbs */ 650e68eef14SAlexander Motin int isp_reinit(ispsoftc_t *, int); 65101ff579dSMatt Jacob 652478f8a96SJustin T. Gibbs /* 653a1fa0267SAlexander Motin * Shutdown hardware after use. 654a1fa0267SAlexander Motin */ 655a1fa0267SAlexander Motin void isp_shutdown(ispsoftc_t *); 656a1fa0267SAlexander Motin 657a1fa0267SAlexander Motin /* 658126ec864SMatt Jacob * Internal Interrupt Service Routine 6596054c3f6SMatt Jacob */ 6600e6bc811SAlexander Motin #ifdef ISP_TARGET_MODE 6610e6bc811SAlexander Motin void isp_intr_atioq(ispsoftc_t *); 6620e6bc811SAlexander Motin #endif 6630e6bc811SAlexander Motin void isp_intr_async(ispsoftc_t *, uint16_t event); 6640e6bc811SAlexander Motin void isp_intr_mbox(ispsoftc_t *, uint16_t mbox0); 6650e6bc811SAlexander Motin void isp_intr_respq(ispsoftc_t *); 666126ec864SMatt Jacob 6676054c3f6SMatt Jacob 6686054c3f6SMatt Jacob /* 66953cff3bbSMatt Jacob * Command Entry Point- Platform Dependent layers call into this 6706054c3f6SMatt Jacob */ 671e2ec5cf0SMatt Jacob int isp_start(XS_T *); 6721dae40ebSMatt Jacob 67353cff3bbSMatt Jacob /* these values are what isp_start returns */ 67453cff3bbSMatt Jacob #define CMD_COMPLETE 101 /* command completed */ 67553cff3bbSMatt Jacob #define CMD_EAGAIN 102 /* busy- maybe retry later */ 676f6854a0cSAlexander Motin #define CMD_RQLATER 103 /* requeue this command later */ 67753cff3bbSMatt Jacob 67853cff3bbSMatt Jacob /* 67953cff3bbSMatt Jacob * Command Completion Point- Core layers call out from this with completed cmds 68053cff3bbSMatt Jacob */ 681e2ec5cf0SMatt Jacob void isp_done(XS_T *); 682478f8a96SJustin T. Gibbs 683478f8a96SJustin T. Gibbs /* 684cbf57b47SMatt Jacob * Platform Dependent to External to Internal Control Function 685478f8a96SJustin T. Gibbs * 686410b5567SMatt Jacob * Assumes locks are held on entry. You should note that with many of 6872df76c16SMatt Jacob * these commands locks may be released while this function is called. 688478f8a96SJustin T. Gibbs * 6892df76c16SMatt Jacob * ... ISPCTL_RESET_BUS, int channel); 6902df76c16SMatt Jacob * Reset BUS on this channel 6912df76c16SMatt Jacob * ... ISPCTL_RESET_DEV, int channel, int target); 6922df76c16SMatt Jacob * Reset Device on this channel at this target. 6932df76c16SMatt Jacob * ... ISPCTL_ABORT_CMD, XS_T *xs); 6942df76c16SMatt Jacob * Abort active transaction described by xs. 6952df76c16SMatt Jacob * ... IPCTL_UPDATE_PARAMS); 6962df76c16SMatt Jacob * Update any operating parameters (speed, etc.) 6972df76c16SMatt Jacob * ... ISPCTL_FCLINK_TEST, int channel); 6982df76c16SMatt Jacob * Test FC link status on this channel 6992df76c16SMatt Jacob * ... ISPCTL_SCAN_LOOP, int channel); 7002df76c16SMatt Jacob * Scan local loop on this channel 701b6bd5f7fSAlexander Motin * ... ISPCTL_SCAN_FABRIC, int channel); 702b6bd5f7fSAlexander Motin * Scan fabric on this channel 7032df76c16SMatt Jacob * ... ISPCTL_PDB_SYNC, int channel); 7042df76c16SMatt Jacob * Synchronize port database on this channel 7052df76c16SMatt Jacob * ... ISPCTL_SEND_LIP, int channel); 7062df76c16SMatt Jacob * Send a LIP on this channel 7072df76c16SMatt Jacob * ... ISPCTL_GET_NAMES, int channel, int np, uint64_t *wwnn, uint64_t *wwpn) 7082df76c16SMatt Jacob * Get a WWNN/WWPN for this N-port handle on this channel 7092df76c16SMatt Jacob * ... ISPCTL_GET_PDB, int channel, int nphandle, isp_pdb_t *pdb) 7102df76c16SMatt Jacob * Get PDB on this channel for this N-port handle 7112df76c16SMatt Jacob * ... ISPCTL_PLOGX, isp_plcmd_t *) 7122df76c16SMatt Jacob * Performa a port login/logout 7136bef0aa0SAlexander Motin * ... ISPCTL_CHANGE_ROLE, int channel, int role); 7146bef0aa0SAlexander Motin * Change role of specified channel 715410b5567SMatt Jacob * 716410b5567SMatt Jacob * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in 717b6bd5f7fSAlexander Motin * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_LOOP, and ISPCTL_SCAN_FABRIC. 718410b5567SMatt Jacob * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging 719410b5567SMatt Jacob * and logging out of fabric devices (if one is on a fabric) and then marking 720410b5567SMatt Jacob * the 'loop state' as being ready to now be used for sending commands to 721b6bd5f7fSAlexander Motin * devices. 722478f8a96SJustin T. Gibbs */ 723478f8a96SJustin T. Gibbs typedef enum { 7242df76c16SMatt Jacob ISPCTL_RESET_BUS, 7252df76c16SMatt Jacob ISPCTL_RESET_DEV, 7262df76c16SMatt Jacob ISPCTL_ABORT_CMD, 7272df76c16SMatt Jacob ISPCTL_UPDATE_PARAMS, 7282df76c16SMatt Jacob ISPCTL_FCLINK_TEST, 7292df76c16SMatt Jacob ISPCTL_SCAN_FABRIC, 7302df76c16SMatt Jacob ISPCTL_SCAN_LOOP, 7312df76c16SMatt Jacob ISPCTL_PDB_SYNC, 7322df76c16SMatt Jacob ISPCTL_SEND_LIP, 7332df76c16SMatt Jacob ISPCTL_GET_NAMES, 7342df76c16SMatt Jacob ISPCTL_GET_PDB, 7356bef0aa0SAlexander Motin ISPCTL_PLOGX, 7366bef0aa0SAlexander Motin ISPCTL_CHANGE_ROLE 737478f8a96SJustin T. Gibbs } ispctl_t; 7382df76c16SMatt Jacob int isp_control(ispsoftc_t *, ispctl_t, ...); 739cbf57b47SMatt Jacob 740cbf57b47SMatt Jacob /* 741cbf57b47SMatt Jacob * Platform Dependent to Internal to External Control Function 742cbf57b47SMatt Jacob */ 743cbf57b47SMatt Jacob 744cbf57b47SMatt Jacob typedef enum { 7452df76c16SMatt Jacob ISPASYNC_BUS_RESET, /* All Bus Was Reset */ 74677d4e836SMatt Jacob ISPASYNC_LOOP_DOWN, /* FC Loop Down */ 74777d4e836SMatt Jacob ISPASYNC_LOOP_UP, /* FC Loop Up */ 7482df76c16SMatt Jacob ISPASYNC_LIP, /* FC LIP Received */ 7492df76c16SMatt Jacob ISPASYNC_LOOP_RESET, /* FC Loop Reset Received */ 750410b5567SMatt Jacob ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */ 7512df76c16SMatt Jacob ISPASYNC_DEV_ARRIVED, /* FC Device Arrived */ 7522df76c16SMatt Jacob ISPASYNC_DEV_CHANGED, /* FC Device Changed */ 7532df76c16SMatt Jacob ISPASYNC_DEV_STAYED, /* FC Device Stayed */ 7542df76c16SMatt Jacob ISPASYNC_DEV_GONE, /* FC Device Departure */ 7552df76c16SMatt Jacob ISPASYNC_TARGET_NOTIFY, /* All target async notification */ 756387d8239SMatt Jacob ISPASYNC_TARGET_NOTIFY_ACK, /* All target notify ack required */ 7572df76c16SMatt Jacob ISPASYNC_TARGET_ACTION, /* All target action requested */ 7582df76c16SMatt Jacob ISPASYNC_FW_CRASH, /* All Firmware has crashed */ 7592df76c16SMatt Jacob ISPASYNC_FW_RESTARTED /* All Firmware has been restarted */ 760cbf57b47SMatt Jacob } ispasync_t; 7612df76c16SMatt Jacob void isp_async(ispsoftc_t *, ispasync_t, ...); 762cbf57b47SMatt Jacob 7632df76c16SMatt Jacob #define ISPASYNC_CHANGE_PDB 0 7642df76c16SMatt Jacob #define ISPASYNC_CHANGE_SNS 1 7652df76c16SMatt Jacob #define ISPASYNC_CHANGE_OTHER 2 766410b5567SMatt Jacob 767478f8a96SJustin T. Gibbs /* 76853cff3bbSMatt Jacob * Platform Dependent Error and Debug Printout 769547725beSMatt Jacob * 770670508b1SMatt Jacob * Two required functions for each platform must be provided: 771547725beSMatt Jacob * 7721dae40ebSMatt Jacob * void isp_prt(ispsoftc_t *, int level, const char *, ...) 773670508b1SMatt Jacob * void isp_xs_prt(ispsoftc_t *, XS_T *, int level, const char *, ...) 774547725beSMatt Jacob * 775547725beSMatt Jacob * but due to compiler differences on different platforms this won't be 776670508b1SMatt Jacob * formally defined here. Instead, they go in each platform definition file. 777478f8a96SJustin T. Gibbs */ 778e9423e21SMatt Jacob 77953cff3bbSMatt Jacob #define ISP_LOGALL 0x0 /* log always */ 78053cff3bbSMatt Jacob #define ISP_LOGCONFIG 0x1 /* log configuration messages */ 78153cff3bbSMatt Jacob #define ISP_LOGINFO 0x2 /* log informational messages */ 78253cff3bbSMatt Jacob #define ISP_LOGWARN 0x4 /* log warning messages */ 78353cff3bbSMatt Jacob #define ISP_LOGERR 0x8 /* log error messages */ 78453cff3bbSMatt Jacob #define ISP_LOGDEBUG0 0x10 /* log simple debug messages */ 78553cff3bbSMatt Jacob #define ISP_LOGDEBUG1 0x20 /* log intermediate debug messages */ 78653cff3bbSMatt Jacob #define ISP_LOGDEBUG2 0x40 /* log most debug messages */ 787b91862efSMatt Jacob #define ISP_LOGDEBUG3 0x80 /* log high frequency debug messages */ 788387d8239SMatt Jacob #define ISP_LOG_SANCFG 0x100 /* log SAN configuration */ 789670508b1SMatt Jacob #define ISP_LOG_CWARN 0x200 /* log SCSI command "warnings" (e.g., check conditions) */ 790387d8239SMatt Jacob #define ISP_LOG_WARN1 0x400 /* log WARNS we might be interested at some time */ 7912df76c16SMatt Jacob #define ISP_LOGTINFO 0x1000 /* log informational messages (target mode) */ 7922df76c16SMatt Jacob #define ISP_LOGTDEBUG0 0x2000 /* log simple debug messages (target mode) */ 7932df76c16SMatt Jacob #define ISP_LOGTDEBUG1 0x4000 /* log intermediate debug messages (target) */ 7942df76c16SMatt Jacob #define ISP_LOGTDEBUG2 0x8000 /* log all debug messages (target) */ 795478f8a96SJustin T. Gibbs 79653cff3bbSMatt Jacob /* 79753cff3bbSMatt Jacob * Each Platform provides it's own isposinfo substructure of the ispsoftc 79853cff3bbSMatt Jacob * defined above. 79953cff3bbSMatt Jacob * 80053cff3bbSMatt Jacob * Each platform must also provide the following macros/defines: 80153cff3bbSMatt Jacob * 80253cff3bbSMatt Jacob * 8032df76c16SMatt Jacob * ISP_FC_SCRLEN FC scratch area DMA length 80453cff3bbSMatt Jacob * 8052df76c16SMatt Jacob * ISP_MEMZERO(dst, src) platform zeroing function 8062df76c16SMatt Jacob * ISP_MEMCPY(dst, src, count) platform copying function 8072df76c16SMatt Jacob * ISP_SNPRINTF(buf, bufsize, fmt, ...) snprintf 8082df76c16SMatt Jacob * ISP_DELAY(usecs) microsecond spindelay function 8092df76c16SMatt Jacob * ISP_SLEEP(isp, usecs) microsecond sleep function 8102df76c16SMatt Jacob * 8112df76c16SMatt Jacob * ISP_INLINE ___inline or not- depending on how 8122df76c16SMatt Jacob * good your debugger is 813898899d9SMatt Jacob * ISP_MIN shorthand for ((a) < (b))? (a) : (b) 81453cff3bbSMatt Jacob * 81553cff3bbSMatt Jacob * NANOTIME_T nanosecond time type 81653cff3bbSMatt Jacob * 81753cff3bbSMatt Jacob * GET_NANOTIME(NANOTIME_T *) get current nanotime. 81853cff3bbSMatt Jacob * 8191dae40ebSMatt Jacob * GET_NANOSEC(NANOTIME_T *) get uint64_t from NANOTIME_T 82053cff3bbSMatt Jacob * 82153cff3bbSMatt Jacob * NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *) 82253cff3bbSMatt Jacob * subtract two NANOTIME_T values 82353cff3bbSMatt Jacob * 8241dae40ebSMatt Jacob * MAXISPREQUEST(ispsoftc_t *) maximum request queue size 82553cff3bbSMatt Jacob * for this particular board type 82653cff3bbSMatt Jacob * 82737bb79f1SMarius Strobl * MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size, chan) 82853cff3bbSMatt Jacob * 82953cff3bbSMatt Jacob * Function/Macro the provides memory synchronization on 83053cff3bbSMatt Jacob * various objects so that the ISP's and the system's view 83153cff3bbSMatt Jacob * of the same object is consistent. 83253cff3bbSMatt Jacob * 8331dae40ebSMatt Jacob * MBOX_ACQUIRE(ispsoftc_t *) acquire lock on mailbox regs 83410365e5aSMatt Jacob * MBOX_WAIT_COMPLETE(ispsoftc_t *, mbreg_t *) wait for cmd to be done 8351dae40ebSMatt Jacob * MBOX_NOTIFY_COMPLETE(ispsoftc_t *) notification of mbox cmd donee 8361dae40ebSMatt Jacob * MBOX_RELEASE(ispsoftc_t *) release lock on mailbox regs 83753cff3bbSMatt Jacob * 8382df76c16SMatt Jacob * FC_SCRATCH_ACQUIRE(ispsoftc_t *, chan) acquire lock on FC scratch area 8392df76c16SMatt Jacob * return -1 if you cannot 8402df76c16SMatt Jacob * FC_SCRATCH_RELEASE(ispsoftc_t *, chan) acquire lock on FC scratch area 84153cff3bbSMatt Jacob * 842ad0ab753SMatt Jacob * FCP_NEXT_CRN(ispsoftc_t *, XS_T *, rslt, channel, target, lun) generate the next command reference number. XS_T * may be null. 843ad0ab753SMatt Jacob * 84453cff3bbSMatt Jacob * SCSI_GOOD SCSI 'Good' Status 84553cff3bbSMatt Jacob * SCSI_CHECK SCSI 'Check Condition' Status 84653cff3bbSMatt Jacob * SCSI_BUSY SCSI 'Busy' Status 84753cff3bbSMatt Jacob * SCSI_QFULL SCSI 'Queue Full' Status 84853cff3bbSMatt Jacob * 84953cff3bbSMatt Jacob * XS_T Platform SCSI transaction type (i.e., command for HBA) 8501dae40ebSMatt Jacob * XS_DMA_ADDR_T Platform PCI DMA Address Type 8512df76c16SMatt Jacob * XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value 85253cff3bbSMatt Jacob * XS_ISP(xs) gets an instance out of an XS_T 85353cff3bbSMatt Jacob * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" 85453cff3bbSMatt Jacob * XS_TGT(xs) gets the target "" 85553cff3bbSMatt Jacob * XS_LUN(xs) gets the lun "" 85653cff3bbSMatt Jacob * XS_CDBP(xs) gets a pointer to the scsi CDB "" 85753cff3bbSMatt Jacob * XS_CDBLEN(xs) gets the CDB's length "" 85853cff3bbSMatt Jacob * XS_XFRLEN(xs) gets the associated data transfer length "" 859f6854a0cSAlexander Motin * XS_XFRIN(xs) gets IN direction 860f6854a0cSAlexander Motin * XS_XFROUT(xs) gets OUT direction 86131c161a6SAlexander Motin * XS_TIME(xs) gets the time (in seconds) for this command 8622df76c16SMatt Jacob * XS_GET_RESID(xs) gets the current residual count 8632df76c16SMatt Jacob * XS_GET_RESID(xs, resid) sets the current residual count 86453cff3bbSMatt Jacob * XS_STSP(xs) gets a pointer to the SCSI status byte "" 86553cff3bbSMatt Jacob * XS_SNSP(xs) gets a pointer to the associate sense data 866387d8239SMatt Jacob * XS_TOT_SNSLEN(xs) gets the total length of sense data storage 867453130d9SPedro F. Giffuni * XS_CUR_SNSLEN(xs) gets the currently used length of sense data storage 86853cff3bbSMatt Jacob * XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key 869670508b1SMatt Jacob * XS_SNSASC(xs) dereferences XS_SNSP to get the current stored Additional Sense Code 870670508b1SMatt Jacob * XS_SNSASCQ(xs) dereferences XS_SNSP to get the current stored Additional Sense Code Qualifier 87153cff3bbSMatt Jacob * XS_TAG_P(xs) predicate of whether this command should be tagged 87253cff3bbSMatt Jacob * XS_TAG_TYPE(xs) which type of tag to use 87388364968SAlexander Motin * XS_PRIORITY(xs) command priority for SIMPLE tag 87453cff3bbSMatt Jacob * XS_SETERR(xs) set error state 87553cff3bbSMatt Jacob * 87653cff3bbSMatt Jacob * HBA_NOERROR command has no erros 87753cff3bbSMatt Jacob * HBA_BOTCH hba botched something 87853cff3bbSMatt Jacob * HBA_CMDTIMEOUT command timed out 87953cff3bbSMatt Jacob * HBA_SELTIMEOUT selection timed out (also port logouts for FC) 88053cff3bbSMatt Jacob * HBA_TGTBSY target returned a BUSY status 88153cff3bbSMatt Jacob * HBA_BUSRESET bus reset destroyed command 88253cff3bbSMatt Jacob * HBA_ABORTED command was aborted (by request) 88353cff3bbSMatt Jacob * HBA_DATAOVR a data overrun was detected 88453cff3bbSMatt Jacob * HBA_ARQFAIL Automatic Request Sense failed 88553cff3bbSMatt Jacob * 88653cff3bbSMatt Jacob * XS_ERR(xs) return current error state 88753cff3bbSMatt Jacob * XS_NOERR(xs) there is no error currently set 88853cff3bbSMatt Jacob * XS_INITERR(xs) initialize error state 88953cff3bbSMatt Jacob * 8902d24b6afSAlexander Motin * XS_SAVE_SENSE(xs, sp, len) save sense data 891387d8239SMatt Jacob * XS_APPEND_SENSE(xs, sp, len) append more sense data 89253cff3bbSMatt Jacob * 893670508b1SMatt Jacob * XS_SENSE_VALID(xs) indicates whether sense is valid 894670508b1SMatt Jacob * 8951dae40ebSMatt Jacob * DEFAULT_FRAMESIZE(ispsoftc_t *) Default Frame Size 8962df76c16SMatt Jacob * 8973e6deb33SAlexander Motin * DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel 8982df76c16SMatt Jacob * DEFAULT_LOOPID(ispsoftc_t *, int) Default FC Loop ID 8992df76c16SMatt Jacob * 9009cf43b97SMatt Jacob * These establish reasonable defaults for each platform. 9019cf43b97SMatt Jacob * These must be available independent of card NVRAM and are 9029cf43b97SMatt Jacob * to be used should NVRAM not be readable. 90353cff3bbSMatt Jacob * 9042df76c16SMatt Jacob * DEFAULT_NODEWWN(ispsoftc_t *, chan) Default FC Node WWN to use 9052df76c16SMatt Jacob * DEFAULT_PORTWWN(ispsoftc_t *, chan) Default FC Port WWN to use 90653cff3bbSMatt Jacob * 9072df76c16SMatt Jacob * These defines are hooks to allow the setting of node and 9082df76c16SMatt Jacob * port WWNs when NVRAM cannot be read or is to be overriden. 90953cff3bbSMatt Jacob * 9102df76c16SMatt Jacob * ACTIVE_NODEWWN(ispsoftc_t *, chan) FC Node WWN to use 9112df76c16SMatt Jacob * ACTIVE_PORTWWN(ispsoftc_t *, chan) FC Port WWN to use 9122df76c16SMatt Jacob * 9132df76c16SMatt Jacob * After NVRAM is read, these will be invoked to get the 9142df76c16SMatt Jacob * node and port WWNs that will actually be used for this 9152df76c16SMatt Jacob * channel. 9162df76c16SMatt Jacob * 9174fd13c1bSMatt Jacob * 9181dae40ebSMatt Jacob * ISP_IOXPUT_8(ispsoftc_t *, uint8_t srcval, uint8_t *dstptr) 9191dae40ebSMatt Jacob * ISP_IOXPUT_16(ispsoftc_t *, uint16_t srcval, uint16_t *dstptr) 9201dae40ebSMatt Jacob * ISP_IOXPUT_32(ispsoftc_t *, uint32_t srcval, uint32_t *dstptr) 9214fd13c1bSMatt Jacob * 9221dae40ebSMatt Jacob * ISP_IOXGET_8(ispsoftc_t *, uint8_t *srcptr, uint8_t dstrval) 9231dae40ebSMatt Jacob * ISP_IOXGET_16(ispsoftc_t *, uint16_t *srcptr, uint16_t dstrval) 9241dae40ebSMatt Jacob * ISP_IOXGET_32(ispsoftc_t *, uint32_t *srcptr, uint32_t dstrval) 9254fd13c1bSMatt Jacob * 9261dae40ebSMatt Jacob * ISP_SWIZZLE_NVRAM_WORD(ispsoftc_t *, uint16_t *) 9274607e8eeSMatt Jacob * ISP_SWIZZLE_NVRAM_LONG(ispsoftc_t *, uint32_t *) 9284607e8eeSMatt Jacob * ISP_SWAP16(ispsoftc_t *, uint16_t srcval) 9294607e8eeSMatt Jacob * ISP_SWAP32(ispsoftc_t *, uint32_t srcval) 93053cff3bbSMatt Jacob */ 9315d571944SMatt Jacob 9322df76c16SMatt Jacob #ifdef ISP_TARGET_MODE 9332df76c16SMatt Jacob /* 9342df76c16SMatt Jacob * The functions below are for the publicly available 9352df76c16SMatt Jacob * target mode functions that are internal to the Qlogic driver. 9362df76c16SMatt Jacob */ 9372df76c16SMatt Jacob 9382df76c16SMatt Jacob /* 9392df76c16SMatt Jacob * This function handles new response queue entry appropriate for target mode. 9402df76c16SMatt Jacob */ 941b8e2395eSAlexander Motin int isp_target_notify(ispsoftc_t *, void *, uint32_t *, uint16_t); 9422df76c16SMatt Jacob 9432df76c16SMatt Jacob /* 9442df76c16SMatt Jacob * This function externalizes the ability to acknowledge an Immediate Notify request. 9452df76c16SMatt Jacob */ 9462df76c16SMatt Jacob int isp_notify_ack(ispsoftc_t *, void *); 9472df76c16SMatt Jacob 9482df76c16SMatt Jacob /* 9492df76c16SMatt Jacob * This function externalized acknowledging (success/fail) an ABTS frame 9502df76c16SMatt Jacob */ 9512df76c16SMatt Jacob int isp_acknak_abts(ispsoftc_t *, void *, int); 9522df76c16SMatt Jacob 9532df76c16SMatt Jacob /* 9542df76c16SMatt Jacob * General request queue 'put' routine for target mode entries. 9552df76c16SMatt Jacob */ 9562df76c16SMatt Jacob int isp_target_put_entry(ispsoftc_t *isp, void *); 9572df76c16SMatt Jacob 9582df76c16SMatt Jacob /* 9592df76c16SMatt Jacob * General routine to send a final CTIO for a command- used mostly for 9602df76c16SMatt Jacob * local responses. 9612df76c16SMatt Jacob */ 9622df76c16SMatt Jacob int isp_endcmd(ispsoftc_t *, ...); 9632df76c16SMatt Jacob #define ECMD_SVALID 0x100 964352427b3SAlexander Motin #define ECMD_RVALID 0x200 965352427b3SAlexander Motin #define ECMD_TERMINATE 0x400 9662df76c16SMatt Jacob 9672df76c16SMatt Jacob /* 9682df76c16SMatt Jacob * Handle an asynchronous event 9692df76c16SMatt Jacob */ 9709c2e9bcfSAlexander Motin void isp_target_async(ispsoftc_t *, int, int); 9712df76c16SMatt Jacob #endif 9726054c3f6SMatt Jacob #endif /* _ISPVAR_H */ 973