isp_target.h revision 163899
155372Smjacob/* $FreeBSD: head/sys/dev/isp/isp_target.h 163899 2006-11-02 03:21:32Z mjacob $ */ 2139749Simp/*- 355372Smjacob * Qlogic Target Mode Structure and Flag Definitions 455372Smjacob * 555372Smjacob * Copyright (c) 1997, 1998 655372Smjacob * Patrick Stirling 755372Smjacob * pms@psconsult.com 855372Smjacob * All rights reserved. 955372Smjacob * 10154704Smjacob * Additonal Copyright (c) 1997-2006 by Matthew Jacob 1155372Smjacob * All rights reserved. 1255372Smjacob * 1355372Smjacob * Redistribution and use in source and binary forms, with or without 1455372Smjacob * modification, are permitted provided that the following conditions 1555372Smjacob * are met: 1655372Smjacob * 1. Redistributions of source code must retain the above copyright 1755372Smjacob * notice immediately at the beginning of the file, without modification, 1855372Smjacob * this list of conditions, and the following disclaimer. 1966189Smjacob * 2. The name of the author may not be used to endorse or promote products 2055372Smjacob * derived from this software without specific prior written permission. 2155372Smjacob * 2255372Smjacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2355372Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2455372Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2555372Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 2655372Smjacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2755372Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28154704Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29154704Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3055372Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3155372Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3255372Smjacob * SUCH DAMAGE. 3355372Smjacob * 3455372Smjacob */ 3574231Smjacob#ifndef _ISP_TARGET_H 3674231Smjacob#define _ISP_TARGET_H 3755372Smjacob 38120016Smjacob#define QLTM_SENSELEN 18 /* non-FC cards only */ 3955372Smjacob#define QLTM_SVALID 0x80 4055372Smjacob 4155372Smjacob/* 4255372Smjacob * Structure for Enable Lun and Modify Lun queue entries 4355372Smjacob */ 4455372Smjacobtypedef struct { 4555372Smjacob isphdr_t le_header; 46155704Smjacob uint32_t le_reserved; 47155704Smjacob uint8_t le_lun; 48155704Smjacob uint8_t le_rsvd; 49155704Smjacob uint8_t le_ops; /* Modify LUN only */ 50155704Smjacob uint8_t le_tgt; /* Not for FC */ 51155704Smjacob uint32_t le_flags; /* Not for FC */ 52155704Smjacob uint8_t le_status; 53155704Smjacob uint8_t le_reserved2; 54155704Smjacob uint8_t le_cmd_count; 55155704Smjacob uint8_t le_in_count; 56155704Smjacob uint8_t le_cdb6len; /* Not for FC */ 57155704Smjacob uint8_t le_cdb7len; /* Not for FC */ 58155704Smjacob uint16_t le_timeout; 59155704Smjacob uint16_t le_reserved3[20]; 6055372Smjacob} lun_entry_t; 6155372Smjacob 6255372Smjacob/* 6355372Smjacob * le_flags values 6455372Smjacob */ 6575195Smjacob#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */ 6655372Smjacob#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */ 6761771Smjacob#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */ 6855372Smjacob#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */ 6955372Smjacob 7055372Smjacob/* 7155372Smjacob * le_ops values 7255372Smjacob */ 7355372Smjacob#define LUN_CCINCR 0x01 /* increment command count */ 7455372Smjacob#define LUN_CCDECR 0x02 /* decrement command count */ 7555372Smjacob#define LUN_ININCR 0x40 /* increment immed. notify count */ 7655372Smjacob#define LUN_INDECR 0x80 /* decrement immed. notify count */ 7755372Smjacob 7855372Smjacob/* 7955372Smjacob * le_status values 8055372Smjacob */ 8155372Smjacob#define LUN_OK 0x01 /* we be rockin' */ 8255372Smjacob#define LUN_ERR 0x04 /* request completed with error */ 8355372Smjacob#define LUN_INVAL 0x06 /* invalid request */ 8455372Smjacob#define LUN_NOCAP 0x16 /* can't provide requested capability */ 8555372Smjacob#define LUN_ENABLED 0x3E /* LUN already enabled */ 8655372Smjacob 8755372Smjacob/* 8855372Smjacob * Immediate Notify Entry structure 8955372Smjacob */ 9055372Smjacob#define IN_MSGLEN 8 /* 8 bytes */ 9155372Smjacob#define IN_RSVDLEN 8 /* 8 words */ 9255372Smjacobtypedef struct { 9355372Smjacob isphdr_t in_header; 94155704Smjacob uint32_t in_reserved; 95155704Smjacob uint8_t in_lun; /* lun */ 96155704Smjacob uint8_t in_iid; /* initiator */ 97155704Smjacob uint8_t in_reserved2; 98155704Smjacob uint8_t in_tgt; /* target */ 99155704Smjacob uint32_t in_flags; 100155704Smjacob uint8_t in_status; 101155704Smjacob uint8_t in_rsvd2; 102155704Smjacob uint8_t in_tag_val; /* tag value */ 103155704Smjacob uint8_t in_tag_type; /* tag type */ 104155704Smjacob uint16_t in_seqid; /* sequence id */ 105155704Smjacob uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */ 106155704Smjacob uint16_t in_reserved3[IN_RSVDLEN]; 107155704Smjacob uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */ 10855372Smjacob} in_entry_t; 10955372Smjacob 11055372Smjacobtypedef struct { 11155372Smjacob isphdr_t in_header; 112155704Smjacob uint32_t in_reserved; 113155704Smjacob uint8_t in_lun; /* lun */ 114155704Smjacob uint8_t in_iid; /* initiator */ 115155704Smjacob uint16_t in_scclun; 116155704Smjacob uint32_t in_reserved2; 117155704Smjacob uint16_t in_status; 118155704Smjacob uint16_t in_task_flags; 119155704Smjacob uint16_t in_seqid; /* sequence id */ 12055372Smjacob} in_fcentry_t; 12155372Smjacob 122154704Smjacobtypedef struct { 123154704Smjacob isphdr_t in_header; 124155704Smjacob uint32_t in_reserved; 125155704Smjacob uint16_t in_iid; /* initiator */ 126155704Smjacob uint16_t in_scclun; 127155704Smjacob uint32_t in_reserved2; 128155704Smjacob uint16_t in_status; 129155704Smjacob uint16_t in_task_flags; 130155704Smjacob uint16_t in_seqid; /* sequence id */ 131154704Smjacob} in_fcentry_e_t; 132154704Smjacob 13355372Smjacob/* 13455372Smjacob * Values for the in_status field 13555372Smjacob */ 13663390Smjacob#define IN_REJECT 0x0D /* Message Reject message received */ 13755372Smjacob#define IN_RESET 0x0E /* Bus Reset occurred */ 13855372Smjacob#define IN_NO_RCAP 0x16 /* requested capability not available */ 13955372Smjacob#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */ 14055372Smjacob#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */ 14155372Smjacob#define IN_MSG_RECEIVED 0x36 /* SCSI message received */ 14255372Smjacob#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */ 14355372Smjacob#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */ 14455372Smjacob#define IN_PORT_CHANGED 0x2A /* port changed */ 14555372Smjacob#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */ 14663390Smjacob#define IN_NO_NEXUS 0x3B /* Nexus not established */ 14755372Smjacob 14855372Smjacob/* 14955372Smjacob * Values for the in_task_flags field- should only get one at a time! 15055372Smjacob */ 151160978Smjacob#define TASK_FLAGS_RESERVED_MASK (0xe700) 152120016Smjacob#define TASK_FLAGS_CLEAR_ACA (1<<14) 153120016Smjacob#define TASK_FLAGS_TARGET_RESET (1<<13) 154120016Smjacob#define TASK_FLAGS_LUN_RESET (1<<12) 15555372Smjacob#define TASK_FLAGS_CLEAR_TASK_SET (1<<10) 156120016Smjacob#define TASK_FLAGS_ABORT_TASK_SET (1<<9) 15755372Smjacob 158163899Smjacob/* 159163899Smjacob * ISP24XX Immediate Notify 160163899Smjacob */ 161163899Smjacobtypedef struct { 162163899Smjacob isphdr_t in_header; 163163899Smjacob uint32_t in_reserved; 164163899Smjacob uint16_t in_nphdl; 165163899Smjacob uint16_t in_reserved1; 166163899Smjacob uint16_t in_flags; 167163899Smjacob uint16_t in_srr_rxid; 168163899Smjacob uint16_t in_status; 169163899Smjacob uint8_t in_status_subcode; 170163899Smjacob uint8_t in_reserved2; 171163899Smjacob uint32_t in_rxid; 172163899Smjacob uint16_t in_srr_reloff_lo; 173163899Smjacob uint16_t in_srr_reloff_hi; 174163899Smjacob uint16_t in_srr_iu; 175163899Smjacob uint16_t in_srr_oxid; 176163899Smjacob uint8_t in_reserved3[18]; 177163899Smjacob uint8_t in_reserved4; 178163899Smjacob uint8_t in_vpindex; 179163899Smjacob uint32_t in_reserved5; 180163899Smjacob uint16_t in_portid_lo; 181163899Smjacob uint8_t in_portid_hi; 182163899Smjacob uint8_t in_reserved6; 183163899Smjacob uint16_t in_reserved7; 184163899Smjacob uint16_t in_oxid; 185163899Smjacob} in_fcentry_24xx_t; 18655372Smjacob 187163899Smjacob#define IN24XX_FLAG_PUREX_IOCB 0x1 188163899Smjacob#define IN24XX_FLAG_GLOBAL_LOGOUT 0x2 189163899Smjacob 190163899Smjacob#define IN24XX_LIP_RESET 0x0E 191163899Smjacob#define IN24XX_LINK_RESET 0x0F 192163899Smjacob#define IN24XX_PORT_LOGOUT 0x29 193163899Smjacob#define IN24XX_PORT_CHANGED 0x2A 194163899Smjacob#define IN24XX_LINK_FAILED 0x2E 195163899Smjacob#define IN24XX_SRR_RCVD 0x45 196163899Smjacob#define IN24XX_ELS_RCVD 0x46 /* 197163899Smjacob * login-affectin ELS received- check 198163899Smjacob * subcode for specific opcode 199163899Smjacob */ 20055372Smjacob/* 20155372Smjacob * Notify Acknowledge Entry structure 20255372Smjacob */ 20355372Smjacob#define NA_RSVDLEN 22 20455372Smjacobtypedef struct { 20555372Smjacob isphdr_t na_header; 206155704Smjacob uint32_t na_reserved; 207155704Smjacob uint8_t na_lun; /* lun */ 208155704Smjacob uint8_t na_iid; /* initiator */ 209155704Smjacob uint8_t na_reserved2; 210155704Smjacob uint8_t na_tgt; /* target */ 211155704Smjacob uint32_t na_flags; 212155704Smjacob uint8_t na_status; 213155704Smjacob uint8_t na_event; 214155704Smjacob uint16_t na_seqid; /* sequence id */ 215155704Smjacob uint16_t na_reserved3[NA_RSVDLEN]; 21655372Smjacob} na_entry_t; 21755372Smjacob 21855372Smjacob/* 21955372Smjacob * Value for the na_event field 22055372Smjacob */ 22155372Smjacob#define NA_RST_CLRD 0x80 /* Clear an async event notification */ 22259453Smjacob#define NA_OK 0x01 /* Notify Acknowledge Succeeded */ 22359453Smjacob#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ 22455372Smjacob 22555372Smjacob#define NA2_RSVDLEN 21 22655372Smjacobtypedef struct { 22755372Smjacob isphdr_t na_header; 228155704Smjacob uint32_t na_reserved; 229160978Smjacob uint8_t na_reserved1; 230160978Smjacob uint8_t na_iid; /* initiator loop id */ 231160978Smjacob uint16_t na_response; 232155704Smjacob uint16_t na_flags; 233155704Smjacob uint16_t na_reserved2; 234155704Smjacob uint16_t na_status; 235155704Smjacob uint16_t na_task_flags; 236155704Smjacob uint16_t na_seqid; /* sequence id */ 237155704Smjacob uint16_t na_reserved3[NA2_RSVDLEN]; 23855372Smjacob} na_fcentry_t; 239154704Smjacob 240154704Smjacobtypedef struct { 241154704Smjacob isphdr_t na_header; 242155704Smjacob uint32_t na_reserved; 243160978Smjacob uint16_t na_iid; /* initiator loop id */ 244160978Smjacob uint16_t na_response; /* response code */ 245155704Smjacob uint16_t na_flags; 246155704Smjacob uint16_t na_reserved2; 247155704Smjacob uint16_t na_status; 248155704Smjacob uint16_t na_task_flags; 249155704Smjacob uint16_t na_seqid; /* sequence id */ 250155704Smjacob uint16_t na_reserved3[NA2_RSVDLEN]; 251154704Smjacob} na_fcentry_e_t; 252154704Smjacob 25355372Smjacob#define NAFC_RCOUNT 0x80 /* increment resource count */ 25455372Smjacob#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */ 255160978Smjacob#define NAFC_TVALID 0x10 /* task mangement response code is valid */ 256160978Smjacob 25755372Smjacob/* 258163899Smjacob * ISP24XX Notify Acknowledge 259163899Smjacob */ 260163899Smjacob 261163899Smjacobtypedef struct { 262163899Smjacob isphdr_t na_header; 263163899Smjacob uint32_t na_handle; 264163899Smjacob uint16_t na_nphdl; 265163899Smjacob uint16_t na_reserved1; 266163899Smjacob uint16_t na_flags; 267163899Smjacob uint16_t na_srr_rxid; 268163899Smjacob uint16_t na_status; 269163899Smjacob uint8_t na_status_subcode; 270163899Smjacob uint8_t na_reserved2; 271163899Smjacob uint32_t na_rxid; 272163899Smjacob uint16_t na_srr_reloff_lo; 273163899Smjacob uint16_t na_srr_reloff_hi; 274163899Smjacob uint16_t na_srr_iu; 275163899Smjacob uint16_t na_srr_flags; 276163899Smjacob uint8_t na_reserved3[18]; 277163899Smjacob uint8_t na_reserved4; 278163899Smjacob uint8_t na_vpindex; 279163899Smjacob uint8_t na_srr_reject_vunique; 280163899Smjacob uint8_t na_srr_reject_explanation; 281163899Smjacob uint8_t na_srr_reject_code; 282163899Smjacob uint8_t na_reserved5; 283163899Smjacob uint8_t na_reserved6[6]; 284163899Smjacob uint16_t na_oxid; 285163899Smjacob} na_fcentry_24xx_t; 286163899Smjacob 287163899Smjacob/* 28855372Smjacob * Accept Target I/O Entry structure 28955372Smjacob */ 29055372Smjacob#define ATIO_CDBLEN 26 29155372Smjacob 29255372Smjacobtypedef struct { 29355372Smjacob isphdr_t at_header; 294155704Smjacob uint16_t at_reserved; 295155704Smjacob uint16_t at_handle; 296155704Smjacob uint8_t at_lun; /* lun */ 297155704Smjacob uint8_t at_iid; /* initiator */ 298155704Smjacob uint8_t at_cdblen; /* cdb length */ 299155704Smjacob uint8_t at_tgt; /* target */ 300155704Smjacob uint32_t at_flags; 301155704Smjacob uint8_t at_status; /* firmware status */ 302155704Smjacob uint8_t at_scsi_status; /* scsi status */ 303155704Smjacob uint8_t at_tag_val; /* tag value */ 304155704Smjacob uint8_t at_tag_type; /* tag type */ 305155704Smjacob uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */ 306155704Smjacob uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */ 30755372Smjacob} at_entry_t; 30855372Smjacob 30955372Smjacob/* 31055372Smjacob * at_flags values 31155372Smjacob */ 31255372Smjacob#define AT_NODISC 0x00008000 /* disconnect disabled */ 31375195Smjacob#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */ 31455372Smjacob 31555372Smjacob/* 31655372Smjacob * at_status values 31755372Smjacob */ 31855372Smjacob#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */ 31955372Smjacob#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */ 32055372Smjacob#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 32155372Smjacob#define AT_NOCAP 0x16 /* Requested capability not available */ 32255372Smjacob#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 32355372Smjacob#define AT_CDB 0x3D /* CDB received */ 32455372Smjacob/* 32575195Smjacob * Macros to create and fetch and test concatenated handle and tag value macros 32675195Smjacob */ 32775195Smjacob 328140652Smjacob#define AT_MAKE_TAGID(tid, inst, aep) \ 329140652Smjacob tid = aep->at_handle; \ 330140652Smjacob if (aep->at_flags & AT_TQAE) { \ 331140652Smjacob tid |= (aep->at_tag_val << 16); \ 332140652Smjacob tid |= (1 << 24); \ 333140652Smjacob } \ 334154704Smjacob tid |= (GET_BUS_VAL(aep->at_iid) << 25); \ 335154704Smjacob tid |= (inst << 26) 33675195Smjacob 337154704Smjacob#define CT_MAKE_TAGID(tid, bus, inst, ct) \ 338140652Smjacob tid = ct->ct_fwhandle; \ 339140652Smjacob if (ct->ct_flags & CT_TQAE) { \ 340140652Smjacob tid |= (ct->ct_tag_val << 16); \ 341140652Smjacob tid |= (1 << 24); \ 342140652Smjacob } \ 343154704Smjacob tid |= ((bus & 0x1) << 25); \ 344154704Smjacob tid |= (inst << 26) 34575195Smjacob 346140652Smjacob#define AT_HAS_TAG(val) ((val) & (1 << 24)) 347140652Smjacob#define AT_GET_TAG(val) (((val) >> 16) & 0xff) 348154704Smjacob#define AT_GET_INST(val) (((val) >> 26) & 0x3f) 349154704Smjacob#define AT_GET_BUS(val) (((val) >> 25) & 0x1) 350140652Smjacob#define AT_GET_HANDLE(val) ((val) & 0xffff) 35175195Smjacob 352140652Smjacob#define IN_MAKE_TAGID(tid, inst, inp) \ 353140652Smjacob tid = inp->in_seqid; \ 354140652Smjacob tid |= (inp->in_tag_val << 16); \ 355140652Smjacob tid |= (1 << 24); \ 356154704Smjacob tid |= (GET_BUS_VAL(inp->in_iid) << 25); \ 357154704Smjacob tid |= (inst << 26) 358140652Smjacob 359140652Smjacob#define TAG_INSERT_INST(tid, inst) \ 360154704Smjacob tid &= ~(0x3ffffff); \ 361154704Smjacob tid |= (inst << 26) 362140652Smjacob 363154704Smjacob#define TAG_INSERT_BUS(tid, bus) \ 364154704Smjacob tid &= ~(1 << 25); \ 365154704Smjacob tid |= (bus << 25) 366154704Smjacob 36775195Smjacob/* 36855372Smjacob * Accept Target I/O Entry structure, Type 2 36955372Smjacob */ 37055372Smjacob#define ATIO2_CDBLEN 16 37155372Smjacob 37255372Smjacobtypedef struct { 37355372Smjacob isphdr_t at_header; 374155704Smjacob uint32_t at_reserved; 375155704Smjacob uint8_t at_lun; /* lun or reserved */ 376155704Smjacob uint8_t at_iid; /* initiator */ 377155704Smjacob uint16_t at_rxid; /* response ID */ 378155704Smjacob uint16_t at_flags; 379155704Smjacob uint16_t at_status; /* firmware status */ 380155704Smjacob uint8_t at_crn; /* command reference number */ 381155704Smjacob uint8_t at_taskcodes; 382155704Smjacob uint8_t at_taskflags; 383155704Smjacob uint8_t at_execodes; 384155704Smjacob uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 385155704Smjacob uint32_t at_datalen; /* allocated data len */ 386155704Smjacob uint16_t at_scclun; /* SCC Lun or reserved */ 387155704Smjacob uint16_t at_wwpn[4]; /* WWPN of initiator */ 388155704Smjacob uint16_t at_reserved2[6]; 389155704Smjacob uint16_t at_oxid; 39055372Smjacob} at2_entry_t; 39155372Smjacob 392154704Smjacobtypedef struct { 393154704Smjacob isphdr_t at_header; 394155704Smjacob uint32_t at_reserved; 395155704Smjacob uint16_t at_iid; /* initiator */ 396155704Smjacob uint16_t at_rxid; /* response ID */ 397155704Smjacob uint16_t at_flags; 398155704Smjacob uint16_t at_status; /* firmware status */ 399155704Smjacob uint8_t at_crn; /* command reference number */ 400155704Smjacob uint8_t at_taskcodes; 401155704Smjacob uint8_t at_taskflags; 402155704Smjacob uint8_t at_execodes; 403155704Smjacob uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 404155704Smjacob uint32_t at_datalen; /* allocated data len */ 405155704Smjacob uint16_t at_scclun; /* SCC Lun or reserved */ 406155704Smjacob uint16_t at_wwpn[4]; /* WWPN of initiator */ 407155704Smjacob uint16_t at_reserved2[6]; 408155704Smjacob uint16_t at_oxid; 409154704Smjacob} at2e_entry_t; 410154704Smjacob 41170457Smjacob#define ATIO2_WWPN_OFFSET 0x2A 41270457Smjacob#define ATIO2_OXID_OFFSET 0x3E 41370457Smjacob 41455372Smjacob#define ATIO2_TC_ATTR_MASK 0x7 41555372Smjacob#define ATIO2_TC_ATTR_SIMPLEQ 0 41655372Smjacob#define ATIO2_TC_ATTR_HEADOFQ 1 41755372Smjacob#define ATIO2_TC_ATTR_ORDERED 2 41855372Smjacob#define ATIO2_TC_ATTR_ACAQ 4 41955372Smjacob#define ATIO2_TC_ATTR_UNTAGGED 5 42055372Smjacob 421120016Smjacob#define ATIO2_EX_WRITE 0x1 422120016Smjacob#define ATIO2_EX_READ 0x2 423140652Smjacob/* 424140652Smjacob * Macros to create and fetch and test concatenated handle and tag value macros 425140652Smjacob */ 426140652Smjacob#define AT2_MAKE_TAGID(tid, inst, aep) \ 427140652Smjacob tid = aep->at_rxid; \ 428140652Smjacob tid |= (inst << 16) 429120016Smjacob 430140652Smjacob#define CT2_MAKE_TAGID(tid, inst, ct) \ 431140652Smjacob tid = ct->ct_rxid; \ 432140652Smjacob tid |= (inst << 16) 433140652Smjacob 434140652Smjacob#define AT2_HAS_TAG(val) 1 435140652Smjacob#define AT2_GET_TAG(val) ((val) & 0xffff) 436140652Smjacob#define AT2_GET_INST(val) ((val) >> 16) 437140652Smjacob#define AT2_GET_HANDLE AT2_GET_TAG 438140652Smjacob 439154704Smjacob#define FC_HAS_TAG AT2_HAS_TAG 440154704Smjacob#define FC_GET_TAG AT2_GET_TAG 441154704Smjacob#define FC_GET_INST AT2_GET_INST 442154704Smjacob#define FC_GET_HANDLE AT2_GET_HANDLE 443154704Smjacob 444157943Smjacob#define IN_FC_MAKE_TAGID(tid, inst, seqid) \ 445157943Smjacob tid = seqid; \ 446140652Smjacob tid |= (inst << 16) 447140652Smjacob 448140652Smjacob#define FC_TAG_INSERT_INST(tid, inst) \ 449140652Smjacob tid &= ~0xffff; \ 450140652Smjacob tid |= (inst << 16) 451140652Smjacob 452163899Smjacob/* 453163899Smjacob * 24XX ATIO Definition 454163899Smjacob * 455163899Smjacob * This is *quite* different from other entry types. 456163899Smjacob * First of all, it has its own queue it comes in on. 457163899Smjacob * 458163899Smjacob * Secondly, it doesn't have a normal header. 459163899Smjacob * 460163899Smjacob * Thirdly, it's just a passthru of the FCP CMND IU 461163899Smjacob * which is recorded in big endian mode. 462163899Smjacob */ 463163899Smjacobtypedef struct { 464163899Smjacob uint8_t at_type; 465163899Smjacob uint8_t at_count; 466163899Smjacob /* 467163899Smjacob * Task attribute in high four bits, 468163899Smjacob * the rest is the FCP CMND IU Length. 469163899Smjacob * NB: the command can extend past the 470163899Smjacob * length for a single queue entry. 471163899Smjacob */ 472163899Smjacob uint16_t at_ta_len; 473163899Smjacob uint32_t at_rxid; 474163899Smjacob fc_hdr_t at_hdr; 475163899Smjacob fcp_cmnd_iu_t at_cmnd; 476163899Smjacob} at7_entry_t; 477140652Smjacob 478163899Smjacob 47955372Smjacob/* 48055372Smjacob * Continue Target I/O Entry structure 48155372Smjacob * Request from driver. The response from the 48255372Smjacob * ISP firmware is the same except that the last 18 48355372Smjacob * bytes are overwritten by suggested sense data if 48455372Smjacob * the 'autosense valid' bit is set in the status byte. 48555372Smjacob */ 48655372Smjacobtypedef struct { 48755372Smjacob isphdr_t ct_header; 488163899Smjacob uint16_t ct_syshandle; 489155704Smjacob uint16_t ct_fwhandle; /* required by f/w */ 490155704Smjacob uint8_t ct_lun; /* lun */ 491155704Smjacob uint8_t ct_iid; /* initiator id */ 492155704Smjacob uint8_t ct_reserved2; 493155704Smjacob uint8_t ct_tgt; /* our target id */ 494155704Smjacob uint32_t ct_flags; 495155704Smjacob uint8_t ct_status; /* isp status */ 496155704Smjacob uint8_t ct_scsi_status; /* scsi status */ 497155704Smjacob uint8_t ct_tag_val; /* tag value */ 498155704Smjacob uint8_t ct_tag_type; /* tag type */ 499155704Smjacob uint32_t ct_xfrlen; /* transfer length */ 500155704Smjacob uint32_t ct_resid; /* residual length */ 501155704Smjacob uint16_t ct_timeout; 502155704Smjacob uint16_t ct_seg_count; 503163899Smjacob ispds_t ct_dataseg[ISP_RQDSEG]; 50455372Smjacob} ct_entry_t; 50555372Smjacob 50655372Smjacob/* 50756005Smjacob * For some of the dual port SCSI adapters, port (bus #) is reported 50856005Smjacob * in the MSbit of ct_iid. Bit fields are a bit too awkward here. 50956005Smjacob * 51056005Smjacob * Note that this does not apply to FC adapters at all which can and 511154704Smjacob * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices 512154704Smjacob * that have logged in across a SCSI fabric. 51356005Smjacob */ 51456005Smjacob#define GET_IID_VAL(x) (x & 0x3f) 51556005Smjacob#define GET_BUS_VAL(x) ((x >> 7) & 0x1) 51683005Smjacob#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f)) 51783005Smjacob#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7)) 51856005Smjacob 51956005Smjacob/* 52055372Smjacob * ct_flags values 52155372Smjacob */ 52275195Smjacob#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */ 52355372Smjacob#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */ 52455372Smjacob#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */ 52555372Smjacob#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */ 52655372Smjacob#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */ 52755372Smjacob#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */ 52863390Smjacob#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */ 52955372Smjacob#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */ 53055372Smjacob#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */ 53155372Smjacob#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */ 53255372Smjacob#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */ 53355372Smjacob 53455372Smjacob/* 53555372Smjacob * ct_status values 53655372Smjacob * - set by the firmware when it returns the CTIO 53755372Smjacob */ 53855372Smjacob#define CT_OK 0x01 /* completed without error */ 53955372Smjacob#define CT_ABORTED 0x02 /* aborted by host */ 54055372Smjacob#define CT_ERR 0x04 /* see sense data for error */ 54155372Smjacob#define CT_INVAL 0x06 /* request for disabled lun */ 54255372Smjacob#define CT_NOPATH 0x07 /* invalid ITL nexus */ 54355372Smjacob#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */ 54477365Smjacob#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */ 54555372Smjacob#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */ 54655372Smjacob#define CT_TIMEOUT 0x0B /* timed out */ 54755372Smjacob#define CT_RESET 0x0E /* SCSI Bus Reset occurred */ 54863390Smjacob#define CT_PARITY 0x0F /* Uncorrectable Parity Error */ 54977365Smjacob#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */ 55063390Smjacob#define CT_PANIC 0x13 /* Unrecoverable Error */ 55155372Smjacob#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 552163899Smjacob#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */ 55355372Smjacob#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 55455372Smjacob#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */ 555163899Smjacob#define CT_PORTUNAVAIL 0x28 /* port not available */ 55655372Smjacob#define CT_LOGOUT 0x29 /* port logout */ 55755372Smjacob#define CT_PORTCHANGED 0x2A /* port changed */ 55863390Smjacob#define CT_IDE 0x33 /* Initiator Detected Error */ 55955372Smjacob#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */ 560154704Smjacob#define CT_SRR 0x45 /* SRR Received */ 561154704Smjacob#define CT_LUN_RESET 0x48 /* Lun Reset Received */ 56255372Smjacob 56355372Smjacob/* 56455372Smjacob * When the firmware returns a CTIO entry, it may overwrite the last 56555372Smjacob * part of the structure with sense data. This starts at offset 0x2E 56655372Smjacob * into the entry, which is in the middle of ct_dataseg[1]. Rather 56755372Smjacob * than define a new struct for this, I'm just using the sense data 56855372Smjacob * offset. 56955372Smjacob */ 57055372Smjacob#define CTIO_SENSE_OFFSET 0x2E 57155372Smjacob 57255372Smjacob/* 57355372Smjacob * Entry length in u_longs. All entries are the same size so 57455372Smjacob * any one will do as the numerator. 57555372Smjacob */ 576155704Smjacob#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(uint32_t)) 57755372Smjacob 57855372Smjacob/* 57955372Smjacob * QLA2100 CTIO (type 2) entry 58055372Smjacob */ 58155372Smjacob#define MAXRESPLEN 26 58255372Smjacobtypedef struct { 58355372Smjacob isphdr_t ct_header; 584163899Smjacob uint32_t ct_syshandle; 585155704Smjacob uint8_t ct_lun; /* lun */ 586155704Smjacob uint8_t ct_iid; /* initiator id */ 587155704Smjacob uint16_t ct_rxid; /* response ID */ 588155704Smjacob uint16_t ct_flags; 589155704Smjacob uint16_t ct_status; /* isp status */ 590155704Smjacob uint16_t ct_timeout; 591155704Smjacob uint16_t ct_seg_count; 592155704Smjacob uint32_t ct_reloff; /* relative offset */ 59356005Smjacob int32_t ct_resid; /* residual length */ 59455372Smjacob union { 59555372Smjacob /* 59655372Smjacob * The three different modes that the target driver 59787635Smjacob * can set the CTIO{2,3,4} up as. 59855372Smjacob * 59955372Smjacob * The first is for sending FCP_DATA_IUs as well as 60055372Smjacob * (optionally) sending a terminal SCSI status FCP_RSP_IU. 60155372Smjacob * 60255372Smjacob * The second is for sending SCSI sense data in an FCP_RSP_IU. 60355372Smjacob * Note that no FCP_DATA_IUs will be sent. 60455372Smjacob * 60555372Smjacob * The third is for sending FCP_RSP_IUs as built specifically 60655372Smjacob * in system memory as located by the isp_dataseg. 60755372Smjacob */ 60855372Smjacob struct { 609155704Smjacob uint32_t _reserved; 610155704Smjacob uint16_t _reserved2; 611155704Smjacob uint16_t ct_scsi_status; 612155704Smjacob uint32_t ct_xfrlen; 61387635Smjacob union { 614163899Smjacob ispds_t ct_dataseg[ISP_RQDSEG_T2]; 615163899Smjacob ispds64_t ct_dataseg64[ISP_RQDSEG_T3]; 616163899Smjacob ispdslist_t ct_dslist; 617163899Smjacob } u; 61855372Smjacob } m0; 61955372Smjacob struct { 620155704Smjacob uint16_t _reserved; 621155704Smjacob uint16_t _reserved2; 622155704Smjacob uint16_t ct_senselen; 623155704Smjacob uint16_t ct_scsi_status; 624155704Smjacob uint16_t ct_resplen; 625155704Smjacob uint8_t ct_resp[MAXRESPLEN]; 62655372Smjacob } m1; 62755372Smjacob struct { 628155704Smjacob uint32_t _reserved; 629155704Smjacob uint16_t _reserved2; 630155704Smjacob uint16_t _reserved3; 631155704Smjacob uint32_t ct_datalen; 63255372Smjacob ispds_t ct_fcp_rsp_iudata; 63355372Smjacob } m2; 63455372Smjacob } rsp; 63555372Smjacob} ct2_entry_t; 63655372Smjacob 637154704Smjacobtypedef struct { 638154704Smjacob isphdr_t ct_header; 639163899Smjacob uint32_t ct_syshandle; 640155704Smjacob uint16_t ct_iid; /* initiator id */ 641155704Smjacob uint16_t ct_rxid; /* response ID */ 642155704Smjacob uint16_t ct_flags; 643155704Smjacob uint16_t ct_status; /* isp status */ 644155704Smjacob uint16_t ct_timeout; 645155704Smjacob uint16_t ct_seg_count; 646155704Smjacob uint32_t ct_reloff; /* relative offset */ 647154704Smjacob int32_t ct_resid; /* residual length */ 648154704Smjacob union { 649154704Smjacob struct { 650155704Smjacob uint32_t _reserved; 651155704Smjacob uint16_t _reserved2; 652155704Smjacob uint16_t ct_scsi_status; 653155704Smjacob uint32_t ct_xfrlen; 654154704Smjacob union { 655163899Smjacob ispds_t ct_dataseg[ISP_RQDSEG_T2]; 656163899Smjacob ispds64_t ct_dataseg64[ISP_RQDSEG_T3]; 657163899Smjacob ispdslist_t ct_dslist; 658163899Smjacob } u; 659154704Smjacob } m0; 660154704Smjacob struct { 661155704Smjacob uint16_t _reserved; 662155704Smjacob uint16_t _reserved2; 663155704Smjacob uint16_t ct_senselen; 664155704Smjacob uint16_t ct_scsi_status; 665155704Smjacob uint16_t ct_resplen; 666155704Smjacob uint8_t ct_resp[MAXRESPLEN]; 667154704Smjacob } m1; 668154704Smjacob struct { 669155704Smjacob uint32_t _reserved; 670155704Smjacob uint16_t _reserved2; 671155704Smjacob uint16_t _reserved3; 672155704Smjacob uint32_t ct_datalen; 673154704Smjacob ispds_t ct_fcp_rsp_iudata; 674154704Smjacob } m2; 675154704Smjacob } rsp; 676154704Smjacob} ct2e_entry_t; 677154704Smjacob 67855372Smjacob/* 67955372Smjacob * ct_flags values for CTIO2 68055372Smjacob */ 68155372Smjacob#define CT2_FLAG_MODE0 0x0000 68255372Smjacob#define CT2_FLAG_MODE1 0x0001 68355372Smjacob#define CT2_FLAG_MODE2 0x0002 684163899Smjacob#define CT2_FLAG_MMASK 0x0003 685163899Smjacob#define CT2_DATA_IN 0x0040 686163899Smjacob#define CT2_DATA_OUT 0x0080 687163899Smjacob#define CT2_NO_DATA 0x00C0 688163899Smjacob#define CT2_DATAMASK 0x00C0 68955372Smjacob#define CT2_CCINCR 0x0100 69055372Smjacob#define CT2_FASTPOST 0x0200 691163899Smjacob#define CT2_CONFIRM 0x2000 692120016Smjacob#define CT2_TERMINATE 0x4000 69355372Smjacob#define CT2_SENDSTATUS 0x8000 69455372Smjacob 69555372Smjacob/* 69655372Smjacob * ct_status values are (mostly) the same as that for ct_entry. 69755372Smjacob */ 69855372Smjacob 69955372Smjacob/* 70055372Smjacob * ct_scsi_status values- the low 8 bits are the normal SCSI status 70155372Smjacob * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU 70255372Smjacob * fields. 70355372Smjacob */ 70455372Smjacob#define CT2_RSPLEN_VALID 0x0100 70555372Smjacob#define CT2_SNSLEN_VALID 0x0200 70655372Smjacob#define CT2_DATA_OVER 0x0400 70755372Smjacob#define CT2_DATA_UNDER 0x0800 70855372Smjacob 70955372Smjacob/* 710163899Smjacob * ISP24XX CTIO 711163899Smjacob */ 712163899Smjacob#define MAXRESPLEN_24XX 24 713163899Smjacobtypedef struct { 714163899Smjacob isphdr_t ct_header; 715163899Smjacob uint32_t ct_syshandle; 716163899Smjacob uint16_t ct_nphdl; /* status on returned CTIOs */ 717163899Smjacob uint16_t ct_timeout; 718163899Smjacob uint16_t ct_seg_count; 719163899Smjacob uint8_t ct_vpindex; 720163899Smjacob uint8_t ct_xflags; 721163899Smjacob uint16_t ct_iid_lo; /* low 16 bits of portid */ 722163899Smjacob uint8_t ct_iid_hi; /* hi 8 bits of portid */ 723163899Smjacob uint8_t ct_reserved; 724163899Smjacob uint32_t ct_rxid; 725163899Smjacob uint16_t ct_senselen; /* mode 0 only */ 726163899Smjacob uint16_t ct_flags; 727163899Smjacob int32_t ct_resid; /* residual length */ 728163899Smjacob uint16_t ct_oxid; 729163899Smjacob uint16_t ct_scsi_status; /* modes 0 && 1 only */ 730163899Smjacob union { 731163899Smjacob struct { 732163899Smjacob uint32_t reloff; 733163899Smjacob uint32_t reserved0; 734163899Smjacob uint32_t ct_xfrlen; 735163899Smjacob uint32_t reserved1; 736163899Smjacob ispds64_t ds; 737163899Smjacob } m0; 738163899Smjacob struct { 739163899Smjacob uint16_t ct_resplen; 740163899Smjacob uint16_t reserved; 741163899Smjacob uint8_t ct_resp[MAXRESPLEN_24XX]; 742163899Smjacob } m1; 743163899Smjacob struct { 744163899Smjacob uint32_t reserved0; 745163899Smjacob uint32_t ct_datalen; 746163899Smjacob uint32_t reserved1; 747163899Smjacob ispds64_t ct_fcp_rsp_iudata; 748163899Smjacob } m2; 749163899Smjacob } rsp; 750163899Smjacob} ct7_entry_t; 751163899Smjacob 752163899Smjacob/* 753163899Smjacob * ct_flags values for CTIO7 754163899Smjacob */ 755163899Smjacob#define CT7_DATA_IN 0x0002 756163899Smjacob#define CT7_DATA_OUT 0x0001 757163899Smjacob#define CT7_NO_DATA 0x0000 758163899Smjacob#define CT7_DATAMASK 0x003 759163899Smjacob#define CT7_DSD_ENABLE 0x0004 760163899Smjacob#define CT7_CONF_STSFD 0x0010 761163899Smjacob#define CT7_EXPLCT_CONF 0x0020 762163899Smjacob#define CT7_FLAG_MODE0 0x0000 763163899Smjacob#define CT7_FLAG_MODE1 0x0040 764163899Smjacob#define CT7_FLAG_MODE7 0x0080 765163899Smjacob#define CT7_FLAG_MMASK 0x00C0 766163899Smjacob#define CT7_FASTPOST 0x0100 767163899Smjacob#define CT7_ATTR_MASK 0x1e00 /* task attributes from atio7 */ 768163899Smjacob#define CT7_CONFIRM 0x2000 769163899Smjacob#define CT7_TERMINATE 0x4000 770163899Smjacob#define CT7_SENDSTATUS 0x8000 771163899Smjacob 772163899Smjacob/* 773163899Smjacob * Type 7 CTIO status codes 774163899Smjacob */ 775163899Smjacob#define CT7_OK 0x01 /* completed without error */ 776163899Smjacob#define CT7_ABORTED 0x02 /* aborted by host */ 777163899Smjacob#define CT7_ERR 0x04 /* see sense data for error */ 778163899Smjacob#define CT7_INVAL 0x06 /* request for disabled lun */ 779163899Smjacob#define CT7_INVRXID 0x08 /* (FC only) Invalid RX_ID */ 780163899Smjacob#define CT7_DATA_OVER 0x09 /* (FC only) Data Overrun */ 781163899Smjacob#define CT7_TIMEOUT 0x0B /* timed out */ 782163899Smjacob#define CT7_RESET 0x0E /* LIP Rset Received */ 783163899Smjacob#define CT7_BUS_ERROR 0x10 /* DMA PCI Error */ 784163899Smjacob#define CT7_REASSY_ERR 0x11 /* DMA reassembly error */ 785163899Smjacob#define CT7_DATA_UNDER 0x15 /* (FC only) Data Underrun */ 786163899Smjacob#define CT7_PORTUNAVAIL 0x28 /* port not available */ 787163899Smjacob#define CT7_LOGOUT 0x29 /* port logout */ 788163899Smjacob#define CT7_PORTCHANGED 0x2A /* port changed */ 789163899Smjacob#define CT7_SRR 0x45 /* SRR Received */ 790163899Smjacob 791163899Smjacob/* 792163899Smjacob * Other 24XX related target IOCBs 793163899Smjacob */ 794163899Smjacob 795163899Smjacob/* 796163899Smjacob * ABTS Received 797163899Smjacob */ 798163899Smjacobtypedef struct { 799163899Smjacob isphdr_t abts_header; 800163899Smjacob uint8_t abts_reserved0[6]; 801163899Smjacob uint16_t abts_nphdl; 802163899Smjacob uint16_t abts_reserved1; 803163899Smjacob uint16_t abts_sof; 804163899Smjacob uint32_t abts_rxid_abts; 805163899Smjacob uint16_t abts_did_lo; 806163899Smjacob uint8_t abts_did_hi; 807163899Smjacob uint8_t abts_r_ctl; 808163899Smjacob uint16_t abts_sid_lo; 809163899Smjacob uint8_t abts_sid_hi; 810163899Smjacob uint8_t abts_cs_ctl; 811163899Smjacob uint16_t abts_fs_ctl; 812163899Smjacob uint8_t abts_f_ctl; 813163899Smjacob uint8_t abts_type; 814163899Smjacob uint16_t abts_seq_cnt; 815163899Smjacob uint8_t abts_df_ctl; 816163899Smjacob uint8_t abts_seq_id; 817163899Smjacob uint16_t abts_rx_id; 818163899Smjacob uint16_t abts_ox_id; 819163899Smjacob uint32_t abts_param; 820163899Smjacob uint8_t abts_reserved2[16]; 821163899Smjacob uint32_t abts_rxid_task; 822163899Smjacob} abts_t; 823163899Smjacob 824163899Smjacobtypedef struct { 825163899Smjacob isphdr_t abts_rsp_header; 826163899Smjacob uint32_t abts_rsp_handle; 827163899Smjacob uint16_t abts_rsp_status; 828163899Smjacob uint16_t abts_rsp_nphdl; 829163899Smjacob uint16_t abts_rsp_ctl_flags; 830163899Smjacob uint16_t abts_rsp_sof; 831163899Smjacob uint32_t abts_rsp_rxid_abts; 832163899Smjacob uint16_t abts_rsp_did_lo; 833163899Smjacob uint8_t abts_rsp_did_hi; 834163899Smjacob uint8_t abts_rsp_r_ctl; 835163899Smjacob uint16_t abts_rsp_sid_lo; 836163899Smjacob uint8_t abts_rsp_sid_hi; 837163899Smjacob uint8_t abts_rsp_cs_ctl; 838163899Smjacob uint16_t abts_rsp_f_ctl_lo; 839163899Smjacob uint8_t abts_rsp_f_ctl_hi; 840163899Smjacob uint8_t abts_rsp_type; 841163899Smjacob uint16_t abts_rsp_seq_cnt; 842163899Smjacob uint8_t abts_rsp_df_ctl; 843163899Smjacob uint8_t abts_rsp_seq_id; 844163899Smjacob uint16_t abts_rsp_rx_id; 845163899Smjacob uint16_t abts_rsp_ox_id; 846163899Smjacob uint32_t abts_rsp_param; 847163899Smjacob union { 848163899Smjacob struct { 849163899Smjacob uint16_t reserved; 850163899Smjacob uint8_t last_seq_id; 851163899Smjacob uint8_t seq_id_valid; 852163899Smjacob uint16_t aborted_rx_id; 853163899Smjacob uint16_t aborted_ox_id; 854163899Smjacob uint16_t high_seq_cnt; 855163899Smjacob uint16_t low_seq_cnt; 856163899Smjacob uint8_t reserved2[4]; 857163899Smjacob } ba_acc; 858163899Smjacob struct { 859163899Smjacob uint8_t vendor_unique; 860163899Smjacob uint8_t explanation; 861163899Smjacob uint8_t reason; 862163899Smjacob uint8_t reserved; 863163899Smjacob uint8_t reserved2[12]; 864163899Smjacob } ba_rjt; 865163899Smjacob struct { 866163899Smjacob uint8_t reserved[8]; 867163899Smjacob uint32_t subcode1; 868163899Smjacob uint32_t subcode2; 869163899Smjacob } rsp; 870163899Smjacob uint8_t reserved[16]; 871163899Smjacob } abts_rsp_payload; 872163899Smjacob uint32_t abts_rsp_rxid_task; 873163899Smjacob} abts_rsp_t; 874163899Smjacob 875163899Smjacob/* terminate this ABTS exchange */ 876163899Smjacob#define ISP24XX_ABTS_RSP_TERMINATE 0x01 877163899Smjacob 878163899Smjacob#define ISP24XX_ABTS_RSP_COMPLETE 0x00 879163899Smjacob#define ISP24XX_ABTS_RSP_RESET 0x04 880163899Smjacob#define ISP24XX_ABTS_RSP_ABORTED 0x05 881163899Smjacob#define ISP24XX_ABTS_RSP_TIMEOUT 0x06 882163899Smjacob#define ISP24XX_ABTS_RSP_INVXID 0x08 883163899Smjacob#define ISP24XX_ABTS_RSP_LOGOUT 0x29 884163899Smjacob#define ISP24XX_ABTS_RSP_SUBCODE 0x31 885163899Smjacob 886163899Smjacob/* 88755372Smjacob * Debug macros 88855372Smjacob */ 88955372Smjacob 89055372Smjacob#define ISP_TDQE(isp, msg, idx, arg) \ 89164089Smjacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 89255372Smjacob 893163899Smjacob#ifndef ISP_TOOLS 89455372Smjacob/* 89587635Smjacob * The functions below are for the publicly available 89687635Smjacob * target mode functions that are internal to the Qlogic driver. 89755372Smjacob */ 89855372Smjacob 89955372Smjacob/* 90055372Smjacob * This function handles new response queue entry appropriate for target mode. 90155372Smjacob */ 902163899Smjacobint isp_target_notify(ispsoftc_t *, void *, uint32_t *); 90355372Smjacob 90455372Smjacob/* 905154704Smjacob * This function externalizes the ability to acknowledge an Immediate Notify 906154704Smjacob * request. 907154704Smjacob */ 908155704Smjacobvoid isp_notify_ack(ispsoftc_t *, void *); 909154704Smjacob 910154704Smjacob/* 91155372Smjacob * Enable/Disable/Modify a logical unit. 91277365Smjacob * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque) 91355372Smjacob */ 91498283Smjacob#define DFLT_CMND_CNT 0xfe /* unmonitored */ 915157943Smjacob#define DFLT_INOT_CNT 0xfe /* unmonitored */ 916155704Smjacobint isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int, uint32_t); 91755372Smjacob 91855372Smjacob/* 91955372Smjacob * General request queue 'put' routine for target mode entries. 92055372Smjacob */ 921155704Smjacobint isp_target_put_entry(ispsoftc_t *isp, void *); 92255372Smjacob 92355372Smjacob/* 92455372Smjacob * General routine to put back an ATIO entry- 92555372Smjacob * used for replenishing f/w resource counts. 92675195Smjacob * The argument is a pointer to a source ATIO 92775195Smjacob * or ATIO2. 92855372Smjacob */ 929155704Smjacobint isp_target_put_atio(ispsoftc_t *, void *); 93055372Smjacob 93155372Smjacob/* 93255372Smjacob * General routine to send a final CTIO for a command- used mostly for 93355372Smjacob * local responses. 93455372Smjacob */ 935163899Smjacobint isp_endcmd(ispsoftc_t *, void *, uint32_t, uint32_t); 93656005Smjacob#define ECMD_SVALID 0x100 93755372Smjacob 93855372Smjacob/* 93955372Smjacob * Handle an asynchronous event 94098283Smjacob * 94198283Smjacob * Return nonzero if the interrupt that generated this event has been dismissed. 94255372Smjacob */ 943155704Smjacobint isp_target_async(ispsoftc_t *, int, int); 944163899Smjacob#endif 94574231Smjacob#endif /* _ISP_TARGET_H */ 946