isp_target.h revision 167403
155372Smjacob/* $FreeBSD: head/sys/dev/isp/isp_target.h 167403 2007-03-10 02:39:54Z mjacob $ */ 2139749Simp/*- 3167403Smjacob * Copyright (c) 1997-2007 by Matthew Jacob 4167403Smjacob * All rights reserved. 5167403Smjacob * 6167403Smjacob * Redistribution and use in source and binary forms, with or without 7167403Smjacob * modification, are permitted provided that the following conditions 8167403Smjacob * are met: 9167403Smjacob * 10167403Smjacob * 1. Redistributions of source code must retain the above copyright 11167403Smjacob * notice, this list of conditions and the following disclaimer. 12167403Smjacob * 2. Redistributions in binary form must reproduce the above copyright 13167403Smjacob * notice, this list of conditions and the following disclaimer in the 14167403Smjacob * documentation and/or other materials provided with the distribution. 15167403Smjacob * 16167403Smjacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17167403Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18167403Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19167403Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20167403Smjacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21167403Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22167403Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23167403Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24167403Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25167403Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26167403Smjacob * SUCH DAMAGE. 27167403Smjacob */ 28167403Smjacob/* 2955372Smjacob * Qlogic Target Mode Structure and Flag Definitions 3055372Smjacob */ 3174231Smjacob#ifndef _ISP_TARGET_H 3274231Smjacob#define _ISP_TARGET_H 3355372Smjacob 34120016Smjacob#define QLTM_SENSELEN 18 /* non-FC cards only */ 3555372Smjacob#define QLTM_SVALID 0x80 3655372Smjacob 3755372Smjacob/* 3855372Smjacob * Structure for Enable Lun and Modify Lun queue entries 3955372Smjacob */ 4055372Smjacobtypedef struct { 4155372Smjacob isphdr_t le_header; 42155704Smjacob uint32_t le_reserved; 43155704Smjacob uint8_t le_lun; 44155704Smjacob uint8_t le_rsvd; 45155704Smjacob uint8_t le_ops; /* Modify LUN only */ 46155704Smjacob uint8_t le_tgt; /* Not for FC */ 47155704Smjacob uint32_t le_flags; /* Not for FC */ 48155704Smjacob uint8_t le_status; 49155704Smjacob uint8_t le_reserved2; 50155704Smjacob uint8_t le_cmd_count; 51155704Smjacob uint8_t le_in_count; 52155704Smjacob uint8_t le_cdb6len; /* Not for FC */ 53155704Smjacob uint8_t le_cdb7len; /* Not for FC */ 54155704Smjacob uint16_t le_timeout; 55155704Smjacob uint16_t le_reserved3[20]; 5655372Smjacob} lun_entry_t; 5755372Smjacob 5855372Smjacob/* 5955372Smjacob * le_flags values 6055372Smjacob */ 6175195Smjacob#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */ 6255372Smjacob#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */ 6361771Smjacob#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */ 6455372Smjacob#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */ 6555372Smjacob 6655372Smjacob/* 6755372Smjacob * le_ops values 6855372Smjacob */ 6955372Smjacob#define LUN_CCINCR 0x01 /* increment command count */ 7055372Smjacob#define LUN_CCDECR 0x02 /* decrement command count */ 7155372Smjacob#define LUN_ININCR 0x40 /* increment immed. notify count */ 7255372Smjacob#define LUN_INDECR 0x80 /* decrement immed. notify count */ 7355372Smjacob 7455372Smjacob/* 7555372Smjacob * le_status values 7655372Smjacob */ 7755372Smjacob#define LUN_OK 0x01 /* we be rockin' */ 7855372Smjacob#define LUN_ERR 0x04 /* request completed with error */ 7955372Smjacob#define LUN_INVAL 0x06 /* invalid request */ 8055372Smjacob#define LUN_NOCAP 0x16 /* can't provide requested capability */ 8155372Smjacob#define LUN_ENABLED 0x3E /* LUN already enabled */ 8255372Smjacob 8355372Smjacob/* 8455372Smjacob * Immediate Notify Entry structure 8555372Smjacob */ 8655372Smjacob#define IN_MSGLEN 8 /* 8 bytes */ 8755372Smjacob#define IN_RSVDLEN 8 /* 8 words */ 8855372Smjacobtypedef struct { 8955372Smjacob isphdr_t in_header; 90155704Smjacob uint32_t in_reserved; 91155704Smjacob uint8_t in_lun; /* lun */ 92155704Smjacob uint8_t in_iid; /* initiator */ 93155704Smjacob uint8_t in_reserved2; 94155704Smjacob uint8_t in_tgt; /* target */ 95155704Smjacob uint32_t in_flags; 96155704Smjacob uint8_t in_status; 97155704Smjacob uint8_t in_rsvd2; 98155704Smjacob uint8_t in_tag_val; /* tag value */ 99155704Smjacob uint8_t in_tag_type; /* tag type */ 100155704Smjacob uint16_t in_seqid; /* sequence id */ 101155704Smjacob uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */ 102155704Smjacob uint16_t in_reserved3[IN_RSVDLEN]; 103155704Smjacob uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */ 10455372Smjacob} in_entry_t; 10555372Smjacob 10655372Smjacobtypedef struct { 10755372Smjacob isphdr_t in_header; 108155704Smjacob uint32_t in_reserved; 109155704Smjacob uint8_t in_lun; /* lun */ 110155704Smjacob uint8_t in_iid; /* initiator */ 111155704Smjacob uint16_t in_scclun; 112155704Smjacob uint32_t in_reserved2; 113155704Smjacob uint16_t in_status; 114155704Smjacob uint16_t in_task_flags; 115155704Smjacob uint16_t in_seqid; /* sequence id */ 11655372Smjacob} in_fcentry_t; 11755372Smjacob 118154704Smjacobtypedef struct { 119154704Smjacob isphdr_t in_header; 120155704Smjacob uint32_t in_reserved; 121155704Smjacob uint16_t in_iid; /* initiator */ 122155704Smjacob uint16_t in_scclun; 123155704Smjacob uint32_t in_reserved2; 124155704Smjacob uint16_t in_status; 125155704Smjacob uint16_t in_task_flags; 126155704Smjacob uint16_t in_seqid; /* sequence id */ 127154704Smjacob} in_fcentry_e_t; 128154704Smjacob 12955372Smjacob/* 13055372Smjacob * Values for the in_status field 13155372Smjacob */ 13263390Smjacob#define IN_REJECT 0x0D /* Message Reject message received */ 13355372Smjacob#define IN_RESET 0x0E /* Bus Reset occurred */ 13455372Smjacob#define IN_NO_RCAP 0x16 /* requested capability not available */ 13555372Smjacob#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */ 13655372Smjacob#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */ 13755372Smjacob#define IN_MSG_RECEIVED 0x36 /* SCSI message received */ 13855372Smjacob#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */ 13955372Smjacob#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */ 14055372Smjacob#define IN_PORT_CHANGED 0x2A /* port changed */ 14155372Smjacob#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */ 14263390Smjacob#define IN_NO_NEXUS 0x3B /* Nexus not established */ 14355372Smjacob 14455372Smjacob/* 14555372Smjacob * Values for the in_task_flags field- should only get one at a time! 14655372Smjacob */ 147160978Smjacob#define TASK_FLAGS_RESERVED_MASK (0xe700) 148120016Smjacob#define TASK_FLAGS_CLEAR_ACA (1<<14) 149120016Smjacob#define TASK_FLAGS_TARGET_RESET (1<<13) 150120016Smjacob#define TASK_FLAGS_LUN_RESET (1<<12) 15155372Smjacob#define TASK_FLAGS_CLEAR_TASK_SET (1<<10) 152120016Smjacob#define TASK_FLAGS_ABORT_TASK_SET (1<<9) 15355372Smjacob 154163899Smjacob/* 155163899Smjacob * ISP24XX Immediate Notify 156163899Smjacob */ 157163899Smjacobtypedef struct { 158163899Smjacob isphdr_t in_header; 159163899Smjacob uint32_t in_reserved; 160163899Smjacob uint16_t in_nphdl; 161163899Smjacob uint16_t in_reserved1; 162163899Smjacob uint16_t in_flags; 163163899Smjacob uint16_t in_srr_rxid; 164163899Smjacob uint16_t in_status; 165163899Smjacob uint8_t in_status_subcode; 166163899Smjacob uint8_t in_reserved2; 167163899Smjacob uint32_t in_rxid; 168163899Smjacob uint16_t in_srr_reloff_lo; 169163899Smjacob uint16_t in_srr_reloff_hi; 170163899Smjacob uint16_t in_srr_iu; 171163899Smjacob uint16_t in_srr_oxid; 172163899Smjacob uint8_t in_reserved3[18]; 173163899Smjacob uint8_t in_reserved4; 174163899Smjacob uint8_t in_vpindex; 175163899Smjacob uint32_t in_reserved5; 176163899Smjacob uint16_t in_portid_lo; 177163899Smjacob uint8_t in_portid_hi; 178163899Smjacob uint8_t in_reserved6; 179163899Smjacob uint16_t in_reserved7; 180163899Smjacob uint16_t in_oxid; 181163899Smjacob} in_fcentry_24xx_t; 18255372Smjacob 183163899Smjacob#define IN24XX_FLAG_PUREX_IOCB 0x1 184163899Smjacob#define IN24XX_FLAG_GLOBAL_LOGOUT 0x2 185163899Smjacob 186163899Smjacob#define IN24XX_LIP_RESET 0x0E 187163899Smjacob#define IN24XX_LINK_RESET 0x0F 188163899Smjacob#define IN24XX_PORT_LOGOUT 0x29 189163899Smjacob#define IN24XX_PORT_CHANGED 0x2A 190163899Smjacob#define IN24XX_LINK_FAILED 0x2E 191163899Smjacob#define IN24XX_SRR_RCVD 0x45 192163899Smjacob#define IN24XX_ELS_RCVD 0x46 /* 193163899Smjacob * login-affectin ELS received- check 194163899Smjacob * subcode for specific opcode 195163899Smjacob */ 19655372Smjacob/* 19755372Smjacob * Notify Acknowledge Entry structure 19855372Smjacob */ 19955372Smjacob#define NA_RSVDLEN 22 20055372Smjacobtypedef struct { 20155372Smjacob isphdr_t na_header; 202155704Smjacob uint32_t na_reserved; 203155704Smjacob uint8_t na_lun; /* lun */ 204155704Smjacob uint8_t na_iid; /* initiator */ 205155704Smjacob uint8_t na_reserved2; 206155704Smjacob uint8_t na_tgt; /* target */ 207155704Smjacob uint32_t na_flags; 208155704Smjacob uint8_t na_status; 209155704Smjacob uint8_t na_event; 210155704Smjacob uint16_t na_seqid; /* sequence id */ 211155704Smjacob uint16_t na_reserved3[NA_RSVDLEN]; 21255372Smjacob} na_entry_t; 21355372Smjacob 21455372Smjacob/* 21555372Smjacob * Value for the na_event field 21655372Smjacob */ 21755372Smjacob#define NA_RST_CLRD 0x80 /* Clear an async event notification */ 21859453Smjacob#define NA_OK 0x01 /* Notify Acknowledge Succeeded */ 21959453Smjacob#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ 22055372Smjacob 22155372Smjacob#define NA2_RSVDLEN 21 22255372Smjacobtypedef struct { 22355372Smjacob isphdr_t na_header; 224155704Smjacob uint32_t na_reserved; 225160978Smjacob uint8_t na_reserved1; 226160978Smjacob uint8_t na_iid; /* initiator loop id */ 227160978Smjacob uint16_t na_response; 228155704Smjacob uint16_t na_flags; 229155704Smjacob uint16_t na_reserved2; 230155704Smjacob uint16_t na_status; 231155704Smjacob uint16_t na_task_flags; 232155704Smjacob uint16_t na_seqid; /* sequence id */ 233155704Smjacob uint16_t na_reserved3[NA2_RSVDLEN]; 23455372Smjacob} na_fcentry_t; 235154704Smjacob 236154704Smjacobtypedef struct { 237154704Smjacob isphdr_t na_header; 238155704Smjacob uint32_t na_reserved; 239160978Smjacob uint16_t na_iid; /* initiator loop id */ 240160978Smjacob uint16_t na_response; /* response code */ 241155704Smjacob uint16_t na_flags; 242155704Smjacob uint16_t na_reserved2; 243155704Smjacob uint16_t na_status; 244155704Smjacob uint16_t na_task_flags; 245155704Smjacob uint16_t na_seqid; /* sequence id */ 246155704Smjacob uint16_t na_reserved3[NA2_RSVDLEN]; 247154704Smjacob} na_fcentry_e_t; 248154704Smjacob 24955372Smjacob#define NAFC_RCOUNT 0x80 /* increment resource count */ 25055372Smjacob#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */ 251160978Smjacob#define NAFC_TVALID 0x10 /* task mangement response code is valid */ 252160978Smjacob 25355372Smjacob/* 254163899Smjacob * ISP24XX Notify Acknowledge 255163899Smjacob */ 256163899Smjacob 257163899Smjacobtypedef struct { 258163899Smjacob isphdr_t na_header; 259163899Smjacob uint32_t na_handle; 260163899Smjacob uint16_t na_nphdl; 261163899Smjacob uint16_t na_reserved1; 262163899Smjacob uint16_t na_flags; 263163899Smjacob uint16_t na_srr_rxid; 264163899Smjacob uint16_t na_status; 265163899Smjacob uint8_t na_status_subcode; 266163899Smjacob uint8_t na_reserved2; 267163899Smjacob uint32_t na_rxid; 268163899Smjacob uint16_t na_srr_reloff_lo; 269163899Smjacob uint16_t na_srr_reloff_hi; 270163899Smjacob uint16_t na_srr_iu; 271163899Smjacob uint16_t na_srr_flags; 272163899Smjacob uint8_t na_reserved3[18]; 273163899Smjacob uint8_t na_reserved4; 274163899Smjacob uint8_t na_vpindex; 275163899Smjacob uint8_t na_srr_reject_vunique; 276163899Smjacob uint8_t na_srr_reject_explanation; 277163899Smjacob uint8_t na_srr_reject_code; 278163899Smjacob uint8_t na_reserved5; 279163899Smjacob uint8_t na_reserved6[6]; 280163899Smjacob uint16_t na_oxid; 281163899Smjacob} na_fcentry_24xx_t; 282163899Smjacob 283163899Smjacob/* 28455372Smjacob * Accept Target I/O Entry structure 28555372Smjacob */ 28655372Smjacob#define ATIO_CDBLEN 26 28755372Smjacob 28855372Smjacobtypedef struct { 28955372Smjacob isphdr_t at_header; 290155704Smjacob uint16_t at_reserved; 291155704Smjacob uint16_t at_handle; 292155704Smjacob uint8_t at_lun; /* lun */ 293155704Smjacob uint8_t at_iid; /* initiator */ 294155704Smjacob uint8_t at_cdblen; /* cdb length */ 295155704Smjacob uint8_t at_tgt; /* target */ 296155704Smjacob uint32_t at_flags; 297155704Smjacob uint8_t at_status; /* firmware status */ 298155704Smjacob uint8_t at_scsi_status; /* scsi status */ 299155704Smjacob uint8_t at_tag_val; /* tag value */ 300155704Smjacob uint8_t at_tag_type; /* tag type */ 301155704Smjacob uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */ 302155704Smjacob uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */ 30355372Smjacob} at_entry_t; 30455372Smjacob 30555372Smjacob/* 30655372Smjacob * at_flags values 30755372Smjacob */ 30855372Smjacob#define AT_NODISC 0x00008000 /* disconnect disabled */ 30975195Smjacob#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */ 31055372Smjacob 31155372Smjacob/* 31255372Smjacob * at_status values 31355372Smjacob */ 31455372Smjacob#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */ 31555372Smjacob#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */ 31655372Smjacob#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 31755372Smjacob#define AT_NOCAP 0x16 /* Requested capability not available */ 31855372Smjacob#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 31955372Smjacob#define AT_CDB 0x3D /* CDB received */ 32055372Smjacob/* 32175195Smjacob * Macros to create and fetch and test concatenated handle and tag value macros 32275195Smjacob */ 32375195Smjacob 324166120Smjacob#define AT_MAKE_TAGID(tid, bus, inst, aep) \ 325140652Smjacob tid = aep->at_handle; \ 326140652Smjacob if (aep->at_flags & AT_TQAE) { \ 327140652Smjacob tid |= (aep->at_tag_val << 16); \ 328140652Smjacob tid |= (1 << 24); \ 329140652Smjacob } \ 330166120Smjacob tid |= (bus << 25); \ 331154704Smjacob tid |= (inst << 26) 33275195Smjacob 333154704Smjacob#define CT_MAKE_TAGID(tid, bus, inst, ct) \ 334140652Smjacob tid = ct->ct_fwhandle; \ 335140652Smjacob if (ct->ct_flags & CT_TQAE) { \ 336140652Smjacob tid |= (ct->ct_tag_val << 16); \ 337140652Smjacob tid |= (1 << 24); \ 338140652Smjacob } \ 339154704Smjacob tid |= ((bus & 0x1) << 25); \ 340154704Smjacob tid |= (inst << 26) 34175195Smjacob 342140652Smjacob#define AT_HAS_TAG(val) ((val) & (1 << 24)) 343140652Smjacob#define AT_GET_TAG(val) (((val) >> 16) & 0xff) 344154704Smjacob#define AT_GET_INST(val) (((val) >> 26) & 0x3f) 345154704Smjacob#define AT_GET_BUS(val) (((val) >> 25) & 0x1) 346140652Smjacob#define AT_GET_HANDLE(val) ((val) & 0xffff) 34775195Smjacob 348166120Smjacob#define IN_MAKE_TAGID(tid, bus, inst, inp) \ 349140652Smjacob tid = inp->in_seqid; \ 350140652Smjacob tid |= (inp->in_tag_val << 16); \ 351140652Smjacob tid |= (1 << 24); \ 352166120Smjacob tid |= (bus << 25); \ 353154704Smjacob tid |= (inst << 26) 354140652Smjacob 355140652Smjacob#define TAG_INSERT_INST(tid, inst) \ 356154704Smjacob tid &= ~(0x3ffffff); \ 357154704Smjacob tid |= (inst << 26) 358140652Smjacob 359154704Smjacob#define TAG_INSERT_BUS(tid, bus) \ 360154704Smjacob tid &= ~(1 << 25); \ 361154704Smjacob tid |= (bus << 25) 362154704Smjacob 36375195Smjacob/* 36455372Smjacob * Accept Target I/O Entry structure, Type 2 36555372Smjacob */ 36655372Smjacob#define ATIO2_CDBLEN 16 36755372Smjacob 36855372Smjacobtypedef struct { 36955372Smjacob isphdr_t at_header; 370155704Smjacob uint32_t at_reserved; 371155704Smjacob uint8_t at_lun; /* lun or reserved */ 372155704Smjacob uint8_t at_iid; /* initiator */ 373155704Smjacob uint16_t at_rxid; /* response ID */ 374155704Smjacob uint16_t at_flags; 375155704Smjacob uint16_t at_status; /* firmware status */ 376155704Smjacob uint8_t at_crn; /* command reference number */ 377155704Smjacob uint8_t at_taskcodes; 378155704Smjacob uint8_t at_taskflags; 379155704Smjacob uint8_t at_execodes; 380155704Smjacob uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 381155704Smjacob uint32_t at_datalen; /* allocated data len */ 382155704Smjacob uint16_t at_scclun; /* SCC Lun or reserved */ 383155704Smjacob uint16_t at_wwpn[4]; /* WWPN of initiator */ 384155704Smjacob uint16_t at_reserved2[6]; 385155704Smjacob uint16_t at_oxid; 38655372Smjacob} at2_entry_t; 38755372Smjacob 388154704Smjacobtypedef struct { 389154704Smjacob isphdr_t at_header; 390155704Smjacob uint32_t at_reserved; 391155704Smjacob uint16_t at_iid; /* initiator */ 392155704Smjacob uint16_t at_rxid; /* response ID */ 393155704Smjacob uint16_t at_flags; 394155704Smjacob uint16_t at_status; /* firmware status */ 395155704Smjacob uint8_t at_crn; /* command reference number */ 396155704Smjacob uint8_t at_taskcodes; 397155704Smjacob uint8_t at_taskflags; 398155704Smjacob uint8_t at_execodes; 399155704Smjacob uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 400155704Smjacob uint32_t at_datalen; /* allocated data len */ 401155704Smjacob uint16_t at_scclun; /* SCC Lun or reserved */ 402155704Smjacob uint16_t at_wwpn[4]; /* WWPN of initiator */ 403155704Smjacob uint16_t at_reserved2[6]; 404155704Smjacob uint16_t at_oxid; 405154704Smjacob} at2e_entry_t; 406154704Smjacob 40770457Smjacob#define ATIO2_WWPN_OFFSET 0x2A 40870457Smjacob#define ATIO2_OXID_OFFSET 0x3E 40970457Smjacob 41055372Smjacob#define ATIO2_TC_ATTR_MASK 0x7 41155372Smjacob#define ATIO2_TC_ATTR_SIMPLEQ 0 41255372Smjacob#define ATIO2_TC_ATTR_HEADOFQ 1 41355372Smjacob#define ATIO2_TC_ATTR_ORDERED 2 41455372Smjacob#define ATIO2_TC_ATTR_ACAQ 4 41555372Smjacob#define ATIO2_TC_ATTR_UNTAGGED 5 41655372Smjacob 417120016Smjacob#define ATIO2_EX_WRITE 0x1 418120016Smjacob#define ATIO2_EX_READ 0x2 419140652Smjacob/* 420140652Smjacob * Macros to create and fetch and test concatenated handle and tag value macros 421140652Smjacob */ 422166120Smjacob#define AT2_MAKE_TAGID(tid, bus, inst, aep) \ 423140652Smjacob tid = aep->at_rxid; \ 424166120Smjacob tid |= (((uint64_t)inst) << 32); \ 425166120Smjacob tid |= (((uint64_t)bus) << 48) 426120016Smjacob 427166120Smjacob#define CT2_MAKE_TAGID(tid, bus, inst, ct) \ 428140652Smjacob tid = ct->ct_rxid; \ 429166120Smjacob tid |= (((uint64_t)inst) << 32); \ 430166120Smjacob tid |= (((uint64_t)(bus & 0xff)) << 48) 431140652Smjacob 432140652Smjacob#define AT2_HAS_TAG(val) 1 433166120Smjacob#define AT2_GET_TAG(val) ((val) & 0xffffffff) 434166120Smjacob#define AT2_GET_INST(val) ((val) >> 32) 435140652Smjacob#define AT2_GET_HANDLE AT2_GET_TAG 436166120Smjacob#define AT2_GET_BUS(val) (((val) >> 48) & 0xff) 437140652Smjacob 438154704Smjacob#define FC_HAS_TAG AT2_HAS_TAG 439154704Smjacob#define FC_GET_TAG AT2_GET_TAG 440154704Smjacob#define FC_GET_INST AT2_GET_INST 441154704Smjacob#define FC_GET_HANDLE AT2_GET_HANDLE 442154704Smjacob 443166120Smjacob#define IN_FC_MAKE_TAGID(tid, bus, inst, seqid) \ 444157943Smjacob tid = seqid; \ 445166120Smjacob tid |= (((uint64_t)inst) << 32); \ 446166120Smjacob tid |= (((uint64_t)(bus & 0xff)) << 48) 447140652Smjacob 448140652Smjacob#define FC_TAG_INSERT_INST(tid, inst) \ 449166120Smjacob tid &= ~0xffff00000000ull; \ 450166120Smjacob tid |= (((uint64_t)inst) << 32) 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