3 * Copyright (c) 1997-2007 by Matthew Jacob
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Qlogic Target Mode Structure and Flag Definitions
34 #define QLTM_SENSELEN 18 /* non-FC cards only */
35 #define QLTM_SVALID 0x80
38 * Structure for Enable Lun and Modify Lun queue entries
45 uint8_t le_ops; /* Modify LUN only */
46 uint8_t le_tgt; /* Not for FC */
47 uint32_t le_flags; /* Not for FC */
52 uint8_t le_cdb6len; /* Not for FC */
53 uint8_t le_cdb7len; /* Not for FC */
55 uint16_t le_reserved3[20];
61 #define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */
62 #define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */
63 #define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */
64 #define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */
69 #define LUN_CCINCR 0x01 /* increment command count */
70 #define LUN_CCDECR 0x02 /* decrement command count */
71 #define LUN_ININCR 0x40 /* increment immed. notify count */
72 #define LUN_INDECR 0x80 /* decrement immed. notify count */
77 #define LUN_OK 0x01 /* we be rockin' */
78 #define LUN_ERR 0x04 /* request completed with error */
79 #define LUN_INVAL 0x06 /* invalid request */
80 #define LUN_NOCAP 0x16 /* can't provide requested capability */
81 #define LUN_ENABLED 0x3E /* LUN already enabled */
84 * Immediate Notify Entry structure
86 #define IN_MSGLEN 8 /* 8 bytes */
87 #define IN_RSVDLEN 8 /* 8 words */
91 uint8_t in_lun; /* lun */
92 uint8_t in_iid; /* initiator */
94 uint8_t in_tgt; /* target */
98 uint8_t in_tag_val; /* tag value */
99 uint8_t in_tag_type; /* tag type */
100 uint16_t in_seqid; /* sequence id */
101 uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
102 uint16_t in_reserved3[IN_RSVDLEN];
103 uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
108 uint32_t in_reserved;
109 uint8_t in_lun; /* lun */
110 uint8_t in_iid; /* initiator */
112 uint32_t in_reserved2;
114 uint16_t in_task_flags;
115 uint16_t in_seqid; /* sequence id */
120 uint32_t in_reserved;
121 uint16_t in_iid; /* initiator */
123 uint32_t in_reserved2;
125 uint16_t in_task_flags;
126 uint16_t in_seqid; /* sequence id */
130 * Values for the in_status field
132 #define IN_REJECT 0x0D /* Message Reject message received */
133 #define IN_RESET 0x0E /* Bus Reset occurred */
134 #define IN_NO_RCAP 0x16 /* requested capability not available */
135 #define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
136 #define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */
137 #define IN_MSG_RECEIVED 0x36 /* SCSI message received */
138 #define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */
139 #define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */
140 #define IN_PORT_CHANGED 0x2A /* port changed */
141 #define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
142 #define IN_NO_NEXUS 0x3B /* Nexus not established */
145 * Values for the in_task_flags field- should only get one at a time!
147 #define TASK_FLAGS_RESERVED_MASK (0xe700)
148 #define TASK_FLAGS_CLEAR_ACA (1<<14)
149 #define TASK_FLAGS_TARGET_RESET (1<<13)
150 #define TASK_FLAGS_LUN_RESET (1<<12)
151 #define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
152 #define TASK_FLAGS_ABORT_TASK_SET (1<<9)
155 * ISP24XX Immediate Notify
159 uint32_t in_reserved;
161 uint16_t in_reserved1;
163 uint16_t in_srr_rxid;
165 uint8_t in_status_subcode;
166 uint8_t in_reserved2;
168 uint16_t in_srr_reloff_lo;
169 uint16_t in_srr_reloff_hi;
171 uint16_t in_srr_oxid;
172 uint8_t in_reserved3[18];
173 uint8_t in_reserved4;
175 uint32_t in_reserved5;
176 uint16_t in_portid_lo;
177 uint8_t in_portid_hi;
178 uint8_t in_reserved6;
179 uint16_t in_reserved7;
183 #define IN24XX_FLAG_PUREX_IOCB 0x1
184 #define IN24XX_FLAG_GLOBAL_LOGOUT 0x2
186 #define IN24XX_LIP_RESET 0x0E
187 #define IN24XX_LINK_RESET 0x0F
188 #define IN24XX_PORT_LOGOUT 0x29
189 #define IN24XX_PORT_CHANGED 0x2A
190 #define IN24XX_LINK_FAILED 0x2E
191 #define IN24XX_SRR_RCVD 0x45
192 #define IN24XX_ELS_RCVD 0x46 /*
193 * login-affectin ELS received- check
194 * subcode for specific opcode
197 * Notify Acknowledge Entry structure
199 #define NA_RSVDLEN 22
202 uint32_t na_reserved;
203 uint8_t na_lun; /* lun */
204 uint8_t na_iid; /* initiator */
205 uint8_t na_reserved2;
206 uint8_t na_tgt; /* target */
210 uint16_t na_seqid; /* sequence id */
211 uint16_t na_reserved3[NA_RSVDLEN];
215 * Value for the na_event field
217 #define NA_RST_CLRD 0x80 /* Clear an async event notification */
218 #define NA_OK 0x01 /* Notify Acknowledge Succeeded */
219 #define NA_INVALID 0x06 /* Invalid Notify Acknowledge */
221 #define NA2_RSVDLEN 21
224 uint32_t na_reserved;
225 uint8_t na_reserved1;
226 uint8_t na_iid; /* initiator loop id */
227 uint16_t na_response;
229 uint16_t na_reserved2;
231 uint16_t na_task_flags;
232 uint16_t na_seqid; /* sequence id */
233 uint16_t na_reserved3[NA2_RSVDLEN];
238 uint32_t na_reserved;
239 uint16_t na_iid; /* initiator loop id */
240 uint16_t na_response; /* response code */
242 uint16_t na_reserved2;
244 uint16_t na_task_flags;
245 uint16_t na_seqid; /* sequence id */
246 uint16_t na_reserved3[NA2_RSVDLEN];
249 #define NAFC_RCOUNT 0x80 /* increment resource count */
250 #define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
251 #define NAFC_TVALID 0x10 /* task mangement response code is valid */
254 * ISP24XX Notify Acknowledge
261 uint16_t na_reserved1;
263 uint16_t na_srr_rxid;
265 uint8_t na_status_subcode;
266 uint8_t na_reserved2;
268 uint16_t na_srr_reloff_lo;
269 uint16_t na_srr_reloff_hi;
271 uint16_t na_srr_flags;
272 uint8_t na_reserved3[18];
273 uint8_t na_reserved4;
275 uint8_t na_srr_reject_vunique;
276 uint8_t na_srr_reject_explanation;
277 uint8_t na_srr_reject_code;
278 uint8_t na_reserved5;
279 uint8_t na_reserved6[6];
284 * Accept Target I/O Entry structure
286 #define ATIO_CDBLEN 26
290 uint16_t at_reserved;
292 uint8_t at_lun; /* lun */
293 uint8_t at_iid; /* initiator */
294 uint8_t at_cdblen; /* cdb length */
295 uint8_t at_tgt; /* target */
297 uint8_t at_status; /* firmware status */
298 uint8_t at_scsi_status; /* scsi status */
299 uint8_t at_tag_val; /* tag value */
300 uint8_t at_tag_type; /* tag type */
301 uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */
302 uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
308 #define AT_NODISC 0x00008000 /* disconnect disabled */
309 #define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */
314 #define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */
315 #define AT_RESET 0x0E /* SCSI Bus Reset Occurred */
316 #define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */
317 #define AT_NOCAP 0x16 /* Requested capability not available */
318 #define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */
319 #define AT_CDB 0x3D /* CDB received */
321 * Macros to create and fetch and test concatenated handle and tag value macros
324 #define AT_MAKE_TAGID(tid, bus, inst, aep) \
325 tid = aep->at_handle; \
326 if (aep->at_flags & AT_TQAE) { \
327 tid |= (aep->at_tag_val << 16); \
330 tid |= (bus << 25); \
333 #define CT_MAKE_TAGID(tid, bus, inst, ct) \
334 tid = ct->ct_fwhandle; \
335 if (ct->ct_flags & CT_TQAE) { \
336 tid |= (ct->ct_tag_val << 16); \
339 tid |= ((bus & 0x1) << 25); \
342 #define AT_HAS_TAG(val) ((val) & (1 << 24))
343 #define AT_GET_TAG(val) (((val) >> 16) & 0xff)
344 #define AT_GET_INST(val) (((val) >> 26) & 0x3f)
345 #define AT_GET_BUS(val) (((val) >> 25) & 0x1)
346 #define AT_GET_HANDLE(val) ((val) & 0xffff)
348 #define IN_MAKE_TAGID(tid, bus, inst, inp) \
349 tid = inp->in_seqid; \
350 tid |= (inp->in_tag_val << 16); \
352 tid |= (bus << 25); \
355 #define TAG_INSERT_INST(tid, inst) \
356 tid &= ~(0x3ffffff); \
359 #define TAG_INSERT_BUS(tid, bus) \
364 * Accept Target I/O Entry structure, Type 2
366 #define ATIO2_CDBLEN 16
370 uint32_t at_reserved;
371 uint8_t at_lun; /* lun or reserved */
372 uint8_t at_iid; /* initiator */
373 uint16_t at_rxid; /* response ID */
375 uint16_t at_status; /* firmware status */
376 uint8_t at_crn; /* command reference number */
377 uint8_t at_taskcodes;
378 uint8_t at_taskflags;
380 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
381 uint32_t at_datalen; /* allocated data len */
382 uint16_t at_scclun; /* SCC Lun or reserved */
383 uint16_t at_wwpn[4]; /* WWPN of initiator */
384 uint16_t at_reserved2[6];
390 uint32_t at_reserved;
391 uint16_t at_iid; /* initiator */
392 uint16_t at_rxid; /* response ID */
394 uint16_t at_status; /* firmware status */
395 uint8_t at_crn; /* command reference number */
396 uint8_t at_taskcodes;
397 uint8_t at_taskflags;
399 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
400 uint32_t at_datalen; /* allocated data len */
401 uint16_t at_scclun; /* SCC Lun or reserved */
402 uint16_t at_wwpn[4]; /* WWPN of initiator */
403 uint16_t at_reserved2[6];
407 #define ATIO2_WWPN_OFFSET 0x2A
408 #define ATIO2_OXID_OFFSET 0x3E
410 #define ATIO2_TC_ATTR_MASK 0x7
411 #define ATIO2_TC_ATTR_SIMPLEQ 0
412 #define ATIO2_TC_ATTR_HEADOFQ 1
413 #define ATIO2_TC_ATTR_ORDERED 2
414 #define ATIO2_TC_ATTR_ACAQ 4
415 #define ATIO2_TC_ATTR_UNTAGGED 5
417 #define ATIO2_EX_WRITE 0x1
418 #define ATIO2_EX_READ 0x2
420 * Macros to create and fetch and test concatenated handle and tag value macros
422 #define AT2_MAKE_TAGID(tid, bus, inst, aep) \
423 tid = aep->at_rxid; \
424 tid |= (((uint64_t)inst) << 32); \
425 tid |= (((uint64_t)bus) << 48)
427 #define CT2_MAKE_TAGID(tid, bus, inst, ct) \
429 tid |= (((uint64_t)inst) << 32); \
430 tid |= (((uint64_t)(bus & 0xff)) << 48)
432 #define AT2_HAS_TAG(val) 1
433 #define AT2_GET_TAG(val) ((val) & 0xffffffff)
434 #define AT2_GET_INST(val) ((val) >> 32)
435 #define AT2_GET_HANDLE AT2_GET_TAG
436 #define AT2_GET_BUS(val) (((val) >> 48) & 0xff)
438 #define FC_HAS_TAG AT2_HAS_TAG
439 #define FC_GET_TAG AT2_GET_TAG
440 #define FC_GET_INST AT2_GET_INST
441 #define FC_GET_HANDLE AT2_GET_HANDLE
443 #define IN_FC_MAKE_TAGID(tid, bus, inst, seqid) \
445 tid |= (((uint64_t)inst) << 32); \
446 tid |= (((uint64_t)(bus & 0xff)) << 48)
448 #define FC_TAG_INSERT_INST(tid, inst) \
449 tid &= ~0xffff00000000ull; \
450 tid |= (((uint64_t)inst) << 32)
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 */