3 * Qlogic Target Mode Structure and Flag Definitions
5 * Copyright (c) 1997, 1998
10 * Additonal Copyright (c) 1997-2006 by Matthew Jacob
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice immediately at the beginning of the file, without modification,
18 * this list of conditions, and the following disclaimer.
19 * 2. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 #define QLTM_SENSELEN 18 /* non-FC cards only */
39 #define QLTM_SVALID 0x80
42 * Structure for Enable Lun and Modify Lun queue entries
49 uint8_t le_ops; /* Modify LUN only */
50 uint8_t le_tgt; /* Not for FC */
51 uint32_t le_flags; /* Not for FC */
56 uint8_t le_cdb6len; /* Not for FC */
57 uint8_t le_cdb7len; /* Not for FC */
59 uint16_t le_reserved3[20];
65 #define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */
66 #define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */
67 #define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */
68 #define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */
73 #define LUN_CCINCR 0x01 /* increment command count */
74 #define LUN_CCDECR 0x02 /* decrement command count */
75 #define LUN_ININCR 0x40 /* increment immed. notify count */
76 #define LUN_INDECR 0x80 /* decrement immed. notify count */
81 #define LUN_OK 0x01 /* we be rockin' */
82 #define LUN_ERR 0x04 /* request completed with error */
83 #define LUN_INVAL 0x06 /* invalid request */
84 #define LUN_NOCAP 0x16 /* can't provide requested capability */
85 #define LUN_ENABLED 0x3E /* LUN already enabled */
88 * Immediate Notify Entry structure
90 #define IN_MSGLEN 8 /* 8 bytes */
91 #define IN_RSVDLEN 8 /* 8 words */
95 uint8_t in_lun; /* lun */
96 uint8_t in_iid; /* initiator */
98 uint8_t in_tgt; /* target */
102 uint8_t in_tag_val; /* tag value */
103 uint8_t in_tag_type; /* tag type */
104 uint16_t in_seqid; /* sequence id */
105 uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
106 uint16_t in_reserved3[IN_RSVDLEN];
107 uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
112 uint32_t in_reserved;
113 uint8_t in_lun; /* lun */
114 uint8_t in_iid; /* initiator */
116 uint32_t in_reserved2;
118 uint16_t in_task_flags;
119 uint16_t in_seqid; /* sequence id */
124 uint32_t in_reserved;
125 uint16_t in_iid; /* initiator */
127 uint32_t in_reserved2;
129 uint16_t in_task_flags;
130 uint16_t in_seqid; /* sequence id */
134 * Values for the in_status field
136 #define IN_REJECT 0x0D /* Message Reject message received */
137 #define IN_RESET 0x0E /* Bus Reset occurred */
138 #define IN_NO_RCAP 0x16 /* requested capability not available */
139 #define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
140 #define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */
141 #define IN_MSG_RECEIVED 0x36 /* SCSI message received */
142 #define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */
143 #define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */
144 #define IN_PORT_CHANGED 0x2A /* port changed */
145 #define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
146 #define IN_NO_NEXUS 0x3B /* Nexus not established */
149 * Values for the in_task_flags field- should only get one at a time!
151 #define TASK_FLAGS_RESERVED_MASK (0xe700)
152 #define TASK_FLAGS_CLEAR_ACA (1<<14)
153 #define TASK_FLAGS_TARGET_RESET (1<<13)
154 #define TASK_FLAGS_LUN_RESET (1<<12)
155 #define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
156 #define TASK_FLAGS_ABORT_TASK_SET (1<<9)
159 * ISP24XX Immediate Notify
163 uint32_t in_reserved;
165 uint16_t in_reserved1;
167 uint16_t in_srr_rxid;
169 uint8_t in_status_subcode;
170 uint8_t in_reserved2;
172 uint16_t in_srr_reloff_lo;
173 uint16_t in_srr_reloff_hi;
175 uint16_t in_srr_oxid;
176 uint8_t in_reserved3[18];
177 uint8_t in_reserved4;
179 uint32_t in_reserved5;
180 uint16_t in_portid_lo;
181 uint8_t in_portid_hi;
182 uint8_t in_reserved6;
183 uint16_t in_reserved7;
187 #define IN24XX_FLAG_PUREX_IOCB 0x1
188 #define IN24XX_FLAG_GLOBAL_LOGOUT 0x2
190 #define IN24XX_LIP_RESET 0x0E
191 #define IN24XX_LINK_RESET 0x0F
192 #define IN24XX_PORT_LOGOUT 0x29
193 #define IN24XX_PORT_CHANGED 0x2A
194 #define IN24XX_LINK_FAILED 0x2E
195 #define IN24XX_SRR_RCVD 0x45
196 #define IN24XX_ELS_RCVD 0x46 /*
197 * login-affectin ELS received- check
198 * subcode for specific opcode
201 * Notify Acknowledge Entry structure
203 #define NA_RSVDLEN 22
206 uint32_t na_reserved;
207 uint8_t na_lun; /* lun */
208 uint8_t na_iid; /* initiator */
209 uint8_t na_reserved2;
210 uint8_t na_tgt; /* target */
214 uint16_t na_seqid; /* sequence id */
215 uint16_t na_reserved3[NA_RSVDLEN];
219 * Value for the na_event field
221 #define NA_RST_CLRD 0x80 /* Clear an async event notification */
222 #define NA_OK 0x01 /* Notify Acknowledge Succeeded */
223 #define NA_INVALID 0x06 /* Invalid Notify Acknowledge */
225 #define NA2_RSVDLEN 21
228 uint32_t na_reserved;
229 uint8_t na_reserved1;
230 uint8_t na_iid; /* initiator loop id */
231 uint16_t na_response;
233 uint16_t na_reserved2;
235 uint16_t na_task_flags;
236 uint16_t na_seqid; /* sequence id */
237 uint16_t na_reserved3[NA2_RSVDLEN];
242 uint32_t na_reserved;
243 uint16_t na_iid; /* initiator loop id */
244 uint16_t na_response; /* response code */
246 uint16_t na_reserved2;
248 uint16_t na_task_flags;
249 uint16_t na_seqid; /* sequence id */
250 uint16_t na_reserved3[NA2_RSVDLEN];
253 #define NAFC_RCOUNT 0x80 /* increment resource count */
254 #define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
255 #define NAFC_TVALID 0x10 /* task mangement response code is valid */
258 * ISP24XX Notify Acknowledge
265 uint16_t na_reserved1;
267 uint16_t na_srr_rxid;
269 uint8_t na_status_subcode;
270 uint8_t na_reserved2;
272 uint16_t na_srr_reloff_lo;
273 uint16_t na_srr_reloff_hi;
275 uint16_t na_srr_flags;
276 uint8_t na_reserved3[18];
277 uint8_t na_reserved4;
279 uint8_t na_srr_reject_vunique;
280 uint8_t na_srr_reject_explanation;
281 uint8_t na_srr_reject_code;
282 uint8_t na_reserved5;
283 uint8_t na_reserved6[6];
288 * Accept Target I/O Entry structure
290 #define ATIO_CDBLEN 26
294 uint16_t at_reserved;
296 uint8_t at_lun; /* lun */
297 uint8_t at_iid; /* initiator */
298 uint8_t at_cdblen; /* cdb length */
299 uint8_t at_tgt; /* target */
301 uint8_t at_status; /* firmware status */
302 uint8_t at_scsi_status; /* scsi status */
303 uint8_t at_tag_val; /* tag value */
304 uint8_t at_tag_type; /* tag type */
305 uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */
306 uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
312 #define AT_NODISC 0x00008000 /* disconnect disabled */
313 #define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */
318 #define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */
319 #define AT_RESET 0x0E /* SCSI Bus Reset Occurred */
320 #define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */
321 #define AT_NOCAP 0x16 /* Requested capability not available */
322 #define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */
323 #define AT_CDB 0x3D /* CDB received */
325 * Macros to create and fetch and test concatenated handle and tag value macros
328 #define AT_MAKE_TAGID(tid, inst, aep) \
329 tid = aep->at_handle; \
330 if (aep->at_flags & AT_TQAE) { \
331 tid |= (aep->at_tag_val << 16); \
334 tid |= (GET_BUS_VAL(aep->at_iid) << 25); \
337 #define CT_MAKE_TAGID(tid, bus, inst, ct) \
338 tid = ct->ct_fwhandle; \
339 if (ct->ct_flags & CT_TQAE) { \
340 tid |= (ct->ct_tag_val << 16); \
343 tid |= ((bus & 0x1) << 25); \
346 #define AT_HAS_TAG(val) ((val) & (1 << 24))
347 #define AT_GET_TAG(val) (((val) >> 16) & 0xff)
348 #define AT_GET_INST(val) (((val) >> 26) & 0x3f)
349 #define AT_GET_BUS(val) (((val) >> 25) & 0x1)
350 #define AT_GET_HANDLE(val) ((val) & 0xffff)
352 #define IN_MAKE_TAGID(tid, inst, inp) \
353 tid = inp->in_seqid; \
354 tid |= (inp->in_tag_val << 16); \
356 tid |= (GET_BUS_VAL(inp->in_iid) << 25); \
359 #define TAG_INSERT_INST(tid, inst) \
360 tid &= ~(0x3ffffff); \
363 #define TAG_INSERT_BUS(tid, bus) \
368 * Accept Target I/O Entry structure, Type 2
370 #define ATIO2_CDBLEN 16
374 uint32_t at_reserved;
375 uint8_t at_lun; /* lun or reserved */
376 uint8_t at_iid; /* initiator */
377 uint16_t at_rxid; /* response ID */
379 uint16_t at_status; /* firmware status */
380 uint8_t at_crn; /* command reference number */
381 uint8_t at_taskcodes;
382 uint8_t at_taskflags;
384 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
385 uint32_t at_datalen; /* allocated data len */
386 uint16_t at_scclun; /* SCC Lun or reserved */
387 uint16_t at_wwpn[4]; /* WWPN of initiator */
388 uint16_t at_reserved2[6];
394 uint32_t at_reserved;
395 uint16_t at_iid; /* initiator */
396 uint16_t at_rxid; /* response ID */
398 uint16_t at_status; /* firmware status */
399 uint8_t at_crn; /* command reference number */
400 uint8_t at_taskcodes;
401 uint8_t at_taskflags;
403 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
404 uint32_t at_datalen; /* allocated data len */
405 uint16_t at_scclun; /* SCC Lun or reserved */
406 uint16_t at_wwpn[4]; /* WWPN of initiator */
407 uint16_t at_reserved2[6];
411 #define ATIO2_WWPN_OFFSET 0x2A
412 #define ATIO2_OXID_OFFSET 0x3E
414 #define ATIO2_TC_ATTR_MASK 0x7
415 #define ATIO2_TC_ATTR_SIMPLEQ 0
416 #define ATIO2_TC_ATTR_HEADOFQ 1
417 #define ATIO2_TC_ATTR_ORDERED 2
418 #define ATIO2_TC_ATTR_ACAQ 4
419 #define ATIO2_TC_ATTR_UNTAGGED 5
421 #define ATIO2_EX_WRITE 0x1
422 #define ATIO2_EX_READ 0x2
424 * Macros to create and fetch and test concatenated handle and tag value macros
426 #define AT2_MAKE_TAGID(tid, inst, aep) \
427 tid = aep->at_rxid; \
430 #define CT2_MAKE_TAGID(tid, inst, ct) \
434 #define AT2_HAS_TAG(val) 1
435 #define AT2_GET_TAG(val) ((val) & 0xffff)
436 #define AT2_GET_INST(val) ((val) >> 16)
437 #define AT2_GET_HANDLE AT2_GET_TAG
439 #define FC_HAS_TAG AT2_HAS_TAG
440 #define FC_GET_TAG AT2_GET_TAG
441 #define FC_GET_INST AT2_GET_INST
442 #define FC_GET_HANDLE AT2_GET_HANDLE
444 #define IN_FC_MAKE_TAGID(tid, inst, seqid) \
448 #define FC_TAG_INSERT_INST(tid, inst) \
453 * 24XX ATIO Definition
455 * This is *quite* different from other entry types.
456 * First of all, it has its own queue it comes in on.
458 * Secondly, it doesn't have a normal header.
460 * Thirdly, it's just a passthru of the FCP CMND IU
461 * which is recorded in big endian mode.
467 * Task attribute in high four bits,
468 * the rest is the FCP CMND IU Length.
469 * NB: the command can extend past the
470 * length for a single queue entry.
475 fcp_cmnd_iu_t at_cmnd;
480 * Continue Target I/O Entry structure
481 * Request from driver. The response from the
482 * ISP firmware is the same except that the last 18
483 * bytes are overwritten by suggested sense data if
484 * the 'autosense valid' bit is set in the status byte.
488 uint16_t ct_syshandle;
489 uint16_t ct_fwhandle; /* required by f/w */
490 uint8_t ct_lun; /* lun */
491 uint8_t ct_iid; /* initiator id */
492 uint8_t ct_reserved2;
493 uint8_t ct_tgt; /* our target id */
495 uint8_t ct_status; /* isp status */
496 uint8_t ct_scsi_status; /* scsi status */
497 uint8_t ct_tag_val; /* tag value */
498 uint8_t ct_tag_type; /* tag type */
499 uint32_t ct_xfrlen; /* transfer length */
500 uint32_t ct_resid; /* residual length */
502 uint16_t ct_seg_count;
503 ispds_t ct_dataseg[ISP_RQDSEG];
507 * For some of the dual port SCSI adapters, port (bus #) is reported
508 * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
510 * Note that this does not apply to FC adapters at all which can and
511 * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices
512 * that have logged in across a SCSI fabric.
514 #define GET_IID_VAL(x) (x & 0x3f)
515 #define GET_BUS_VAL(x) ((x >> 7) & 0x1)
516 #define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
517 #define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
522 #define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */
523 #define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */
524 #define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */
525 #define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */
526 #define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */
527 #define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */
528 #define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */
529 #define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */
530 #define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */
531 #define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */
532 #define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */
536 * - set by the firmware when it returns the CTIO
538 #define CT_OK 0x01 /* completed without error */
539 #define CT_ABORTED 0x02 /* aborted by host */
540 #define CT_ERR 0x04 /* see sense data for error */
541 #define CT_INVAL 0x06 /* request for disabled lun */
542 #define CT_NOPATH 0x07 /* invalid ITL nexus */
543 #define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */
544 #define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */
545 #define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */
546 #define CT_TIMEOUT 0x0B /* timed out */
547 #define CT_RESET 0x0E /* SCSI Bus Reset occurred */
548 #define CT_PARITY 0x0F /* Uncorrectable Parity Error */
549 #define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */
550 #define CT_PANIC 0x13 /* Unrecoverable Error */
551 #define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */
552 #define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
553 #define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
554 #define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
555 #define CT_PORTUNAVAIL 0x28 /* port not available */
556 #define CT_LOGOUT 0x29 /* port logout */
557 #define CT_PORTCHANGED 0x2A /* port changed */
558 #define CT_IDE 0x33 /* Initiator Detected Error */
559 #define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */
560 #define CT_SRR 0x45 /* SRR Received */
561 #define CT_LUN_RESET 0x48 /* Lun Reset Received */
564 * When the firmware returns a CTIO entry, it may overwrite the last
565 * part of the structure with sense data. This starts at offset 0x2E
566 * into the entry, which is in the middle of ct_dataseg[1]. Rather
567 * than define a new struct for this, I'm just using the sense data
570 #define CTIO_SENSE_OFFSET 0x2E
573 * Entry length in u_longs. All entries are the same size so
574 * any one will do as the numerator.
576 #define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(uint32_t))
579 * QLA2100 CTIO (type 2) entry
581 #define MAXRESPLEN 26
584 uint32_t ct_syshandle;
585 uint8_t ct_lun; /* lun */
586 uint8_t ct_iid; /* initiator id */
587 uint16_t ct_rxid; /* response ID */
589 uint16_t ct_status; /* isp status */
591 uint16_t ct_seg_count;
592 uint32_t ct_reloff; /* relative offset */
593 int32_t ct_resid; /* residual length */
596 * The three different modes that the target driver
597 * can set the CTIO{2,3,4} up as.
599 * The first is for sending FCP_DATA_IUs as well as
600 * (optionally) sending a terminal SCSI status FCP_RSP_IU.
602 * The second is for sending SCSI sense data in an FCP_RSP_IU.
603 * Note that no FCP_DATA_IUs will be sent.
605 * The third is for sending FCP_RSP_IUs as built specifically
606 * in system memory as located by the isp_dataseg.
611 uint16_t ct_scsi_status;
614 ispds_t ct_dataseg[ISP_RQDSEG_T2];
615 ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
616 ispdslist_t ct_dslist;
622 uint16_t ct_senselen;
623 uint16_t ct_scsi_status;
625 uint8_t ct_resp[MAXRESPLEN];
632 ispds_t ct_fcp_rsp_iudata;
639 uint32_t ct_syshandle;
640 uint16_t ct_iid; /* initiator id */
641 uint16_t ct_rxid; /* response ID */
643 uint16_t ct_status; /* isp status */
645 uint16_t ct_seg_count;
646 uint32_t ct_reloff; /* relative offset */
647 int32_t ct_resid; /* residual length */
652 uint16_t ct_scsi_status;
655 ispds_t ct_dataseg[ISP_RQDSEG_T2];
656 ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
657 ispdslist_t ct_dslist;
663 uint16_t ct_senselen;
664 uint16_t ct_scsi_status;
666 uint8_t ct_resp[MAXRESPLEN];
673 ispds_t ct_fcp_rsp_iudata;
679 * ct_flags values for CTIO2
681 #define CT2_FLAG_MODE0 0x0000
682 #define CT2_FLAG_MODE1 0x0001
683 #define CT2_FLAG_MODE2 0x0002
684 #define CT2_FLAG_MMASK 0x0003
685 #define CT2_DATA_IN 0x0040
686 #define CT2_DATA_OUT 0x0080
687 #define CT2_NO_DATA 0x00C0
688 #define CT2_DATAMASK 0x00C0
689 #define CT2_CCINCR 0x0100
690 #define CT2_FASTPOST 0x0200
691 #define CT2_CONFIRM 0x2000
692 #define CT2_TERMINATE 0x4000
693 #define CT2_SENDSTATUS 0x8000
696 * ct_status values are (mostly) the same as that for ct_entry.
700 * ct_scsi_status values- the low 8 bits are the normal SCSI status
701 * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
704 #define CT2_RSPLEN_VALID 0x0100
705 #define CT2_SNSLEN_VALID 0x0200
706 #define CT2_DATA_OVER 0x0400
707 #define CT2_DATA_UNDER 0x0800
712 #define MAXRESPLEN_24XX 24
715 uint32_t ct_syshandle;
716 uint16_t ct_nphdl; /* status on returned CTIOs */
718 uint16_t ct_seg_count;
721 uint16_t ct_iid_lo; /* low 16 bits of portid */
722 uint8_t ct_iid_hi; /* hi 8 bits of portid */
725 uint16_t ct_senselen; /* mode 0 only */
727 int32_t ct_resid; /* residual length */
729 uint16_t ct_scsi_status; /* modes 0 && 1 only */
741 uint8_t ct_resp[MAXRESPLEN_24XX];
747 ispds64_t ct_fcp_rsp_iudata;
753 * ct_flags values for CTIO7
755 #define CT7_DATA_IN 0x0002
756 #define CT7_DATA_OUT 0x0001
757 #define CT7_NO_DATA 0x0000
758 #define CT7_DATAMASK 0x003
759 #define CT7_DSD_ENABLE 0x0004
760 #define CT7_CONF_STSFD 0x0010
761 #define CT7_EXPLCT_CONF 0x0020
762 #define CT7_FLAG_MODE0 0x0000
763 #define CT7_FLAG_MODE1 0x0040
764 #define CT7_FLAG_MODE7 0x0080
765 #define CT7_FLAG_MMASK 0x00C0
766 #define CT7_FASTPOST 0x0100
767 #define CT7_ATTR_MASK 0x1e00 /* task attributes from atio7 */
768 #define CT7_CONFIRM 0x2000
769 #define CT7_TERMINATE 0x4000
770 #define CT7_SENDSTATUS 0x8000
773 * Type 7 CTIO status codes
775 #define CT7_OK 0x01 /* completed without error */
776 #define CT7_ABORTED 0x02 /* aborted by host */
777 #define CT7_ERR 0x04 /* see sense data for error */
778 #define CT7_INVAL 0x06 /* request for disabled lun */
779 #define CT7_INVRXID 0x08 /* (FC only) Invalid RX_ID */
780 #define CT7_DATA_OVER 0x09 /* (FC only) Data Overrun */
781 #define CT7_TIMEOUT 0x0B /* timed out */
782 #define CT7_RESET 0x0E /* LIP Rset Received */
783 #define CT7_BUS_ERROR 0x10 /* DMA PCI Error */
784 #define CT7_REASSY_ERR 0x11 /* DMA reassembly error */
785 #define CT7_DATA_UNDER 0x15 /* (FC only) Data Underrun */
786 #define CT7_PORTUNAVAIL 0x28 /* port not available */
787 #define CT7_LOGOUT 0x29 /* port logout */
788 #define CT7_PORTCHANGED 0x2A /* port changed */
789 #define CT7_SRR 0x45 /* SRR Received */
792 * Other 24XX related target IOCBs
799 isphdr_t abts_header;
800 uint8_t abts_reserved0[6];
802 uint16_t abts_reserved1;
804 uint32_t abts_rxid_abts;
805 uint16_t abts_did_lo;
808 uint16_t abts_sid_lo;
811 uint16_t abts_fs_ctl;
814 uint16_t abts_seq_cnt;
820 uint8_t abts_reserved2[16];
821 uint32_t abts_rxid_task;
825 isphdr_t abts_rsp_header;
826 uint32_t abts_rsp_handle;
827 uint16_t abts_rsp_status;
828 uint16_t abts_rsp_nphdl;
829 uint16_t abts_rsp_ctl_flags;
830 uint16_t abts_rsp_sof;
831 uint32_t abts_rsp_rxid_abts;
832 uint16_t abts_rsp_did_lo;
833 uint8_t abts_rsp_did_hi;
834 uint8_t abts_rsp_r_ctl;
835 uint16_t abts_rsp_sid_lo;
836 uint8_t abts_rsp_sid_hi;
837 uint8_t abts_rsp_cs_ctl;
838 uint16_t abts_rsp_f_ctl_lo;
839 uint8_t abts_rsp_f_ctl_hi;
840 uint8_t abts_rsp_type;
841 uint16_t abts_rsp_seq_cnt;
842 uint8_t abts_rsp_df_ctl;
843 uint8_t abts_rsp_seq_id;
844 uint16_t abts_rsp_rx_id;
845 uint16_t abts_rsp_ox_id;
846 uint32_t abts_rsp_param;
851 uint8_t seq_id_valid;
852 uint16_t aborted_rx_id;
853 uint16_t aborted_ox_id;
854 uint16_t high_seq_cnt;
855 uint16_t low_seq_cnt;
856 uint8_t reserved2[4];
859 uint8_t vendor_unique;
863 uint8_t reserved2[12];
870 uint8_t reserved[16];
872 uint32_t abts_rsp_rxid_task;
875 /* terminate this ABTS exchange */
876 #define ISP24XX_ABTS_RSP_TERMINATE 0x01
878 #define ISP24XX_ABTS_RSP_COMPLETE 0x00
879 #define ISP24XX_ABTS_RSP_RESET 0x04
880 #define ISP24XX_ABTS_RSP_ABORTED 0x05
881 #define ISP24XX_ABTS_RSP_TIMEOUT 0x06
882 #define ISP24XX_ABTS_RSP_INVXID 0x08
883 #define ISP24XX_ABTS_RSP_LOGOUT 0x29
884 #define ISP24XX_ABTS_RSP_SUBCODE 0x31
890 #define ISP_TDQE(isp, msg, idx, arg) \
891 if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
895 * The functions below are for the publicly available
896 * target mode functions that are internal to the Qlogic driver.
900 * This function handles new response queue entry appropriate for target mode.
902 int isp_target_notify(ispsoftc_t *, void *, uint32_t *);
905 * This function externalizes the ability to acknowledge an Immediate Notify
908 void isp_notify_ack(ispsoftc_t *, void *);
911 * Enable/Disable/Modify a logical unit.
912 * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
914 #define DFLT_CMND_CNT 0xfe /* unmonitored */
915 #define DFLT_INOT_CNT 0xfe /* unmonitored */
916 int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int, uint32_t);
919 * General request queue 'put' routine for target mode entries.
921 int isp_target_put_entry(ispsoftc_t *isp, void *);
924 * General routine to put back an ATIO entry-
925 * used for replenishing f/w resource counts.
926 * The argument is a pointer to a source ATIO
929 int isp_target_put_atio(ispsoftc_t *, void *);
932 * General routine to send a final CTIO for a command- used mostly for
935 int isp_endcmd(ispsoftc_t *, void *, uint32_t, uint32_t);
936 #define ECMD_SVALID 0x100
939 * Handle an asynchronous event
941 * Return nonzero if the interrupt that generated this event has been dismissed.
943 int isp_target_async(ispsoftc_t *, int, int);
945 #endif /* _ISP_TARGET_H */