Home | History | Annotate | Line # | Download | only in ic
isp_target.h revision 1.11
      1  1.11  mjacob /* $NetBSD: isp_target.h,v 1.11 2001/03/14 05:46:50 mjacob Exp $ */
      2   1.8  mjacob /*
      3   1.8  mjacob  * This driver, which is contained in NetBSD in the files:
      4   1.8  mjacob  *
      5   1.8  mjacob  *	sys/dev/ic/isp.c
      6   1.9     wiz  *	sys/dev/ic/isp_inline.h
      7   1.9     wiz  *	sys/dev/ic/isp_netbsd.c
      8   1.9     wiz  *	sys/dev/ic/isp_netbsd.h
      9   1.9     wiz  *	sys/dev/ic/isp_target.c
     10   1.9     wiz  *	sys/dev/ic/isp_target.h
     11   1.9     wiz  *	sys/dev/ic/isp_tpublic.h
     12   1.9     wiz  *	sys/dev/ic/ispmbox.h
     13   1.9     wiz  *	sys/dev/ic/ispreg.h
     14   1.9     wiz  *	sys/dev/ic/ispvar.h
     15   1.8  mjacob  *	sys/microcode/isp/asm_sbus.h
     16   1.8  mjacob  *	sys/microcode/isp/asm_1040.h
     17   1.8  mjacob  *	sys/microcode/isp/asm_1080.h
     18   1.8  mjacob  *	sys/microcode/isp/asm_12160.h
     19   1.8  mjacob  *	sys/microcode/isp/asm_2100.h
     20   1.8  mjacob  *	sys/microcode/isp/asm_2200.h
     21   1.8  mjacob  *	sys/pci/isp_pci.c
     22   1.8  mjacob  *	sys/sbus/isp_sbus.c
     23   1.8  mjacob  *
     24   1.8  mjacob  * Is being actively maintained by Matthew Jacob (mjacob (at) netbsd.org).
     25   1.8  mjacob  * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
     26   1.8  mjacob  * Linux versions. This tends to be an interesting maintenance problem.
     27   1.8  mjacob  *
     28   1.8  mjacob  * Please coordinate with Matthew Jacob on changes you wish to make here.
     29   1.8  mjacob  */
     30   1.1  mjacob /*
     31   1.1  mjacob  * Qlogic Target Mode Structure and Flag Definitions
     32   1.1  mjacob  *
     33   1.1  mjacob  * Copyright (c) 1997, 1998
     34   1.1  mjacob  * Patrick Stirling
     35   1.1  mjacob  * pms (at) psconsult.com
     36   1.1  mjacob  * All rights reserved.
     37   1.1  mjacob  *
     38  1.11  mjacob  * Additional Copyright (c) 1999, 2000, 2001
     39   1.1  mjacob  * Matthew Jacob
     40   1.1  mjacob  * mjacob (at) feral.com
     41   1.1  mjacob  * All rights reserved.
     42   1.1  mjacob  *
     43   1.1  mjacob  *
     44   1.1  mjacob  * Redistribution and use in source and binary forms, with or without
     45   1.1  mjacob  * modification, are permitted provided that the following conditions
     46   1.1  mjacob  * are met:
     47   1.1  mjacob  * 1. Redistributions of source code must retain the above copyright
     48   1.1  mjacob  *    notice immediately at the beginning of the file, without modification,
     49   1.1  mjacob  *    this list of conditions, and the following disclaimer.
     50  1.11  mjacob  * 2. The name of the author may not be used to endorse or promote products
     51   1.1  mjacob  *    derived from this software without specific prior written permission.
     52   1.1  mjacob  *
     53   1.1  mjacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     54   1.1  mjacob  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     55   1.1  mjacob  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     56   1.1  mjacob  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
     57   1.1  mjacob  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     58   1.1  mjacob  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     59   1.1  mjacob  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     60   1.1  mjacob  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     61   1.1  mjacob  * SUCH DAMAGE.
     62   1.1  mjacob  *
     63   1.1  mjacob  */
     64  1.11  mjacob #ifndef	_ISP_TARGET_H
     65  1.11  mjacob #define	_ISP_TARGET_H
     66   1.1  mjacob 
     67   1.1  mjacob /*
     68   1.1  mjacob  * Defines for all entry types
     69   1.1  mjacob  */
     70   1.1  mjacob #define QLTM_SVALID	0x80
     71   1.1  mjacob #define	QLTM_SENSELEN	18
     72   1.1  mjacob 
     73   1.1  mjacob /*
     74   1.1  mjacob  * Structure for Enable Lun and Modify Lun queue entries
     75   1.1  mjacob  */
     76   1.1  mjacob typedef struct {
     77   1.1  mjacob 	isphdr_t	le_header;
     78   1.1  mjacob 	u_int32_t	le_reserved;
     79   1.1  mjacob 	u_int8_t	le_lun;
     80   1.1  mjacob 	u_int8_t	le_rsvd;
     81   1.1  mjacob 	u_int8_t	le_ops;		/* Modify LUN only */
     82   1.1  mjacob 	u_int8_t	le_tgt;		/* Not for FC */
     83   1.1  mjacob 	u_int32_t	le_flags;	/* Not for FC */
     84   1.1  mjacob 	u_int8_t	le_status;
     85   1.1  mjacob 	u_int8_t	le_reserved2;
     86   1.1  mjacob 	u_int8_t	le_cmd_count;
     87   1.1  mjacob 	u_int8_t	le_in_count;
     88   1.1  mjacob 	u_int8_t	le_cdb6len;	/* Not for FC */
     89   1.1  mjacob 	u_int8_t	le_cdb7len;	/* Not for FC */
     90   1.1  mjacob 	u_int16_t	le_timeout;
     91   1.1  mjacob 	u_int16_t	le_reserved3[20];
     92   1.1  mjacob } lun_entry_t;
     93   1.1  mjacob 
     94   1.1  mjacob /*
     95   1.1  mjacob  * le_flags values
     96   1.1  mjacob  */
     97   1.1  mjacob #define LUN_TQAE	0x00000001	/* bit1  Tagged Queue Action Enable */
     98   1.1  mjacob #define LUN_DSSM	0x01000000	/* bit24 Disable Sending SDP Message */
     99   1.5  mjacob #define	LUN_DISAD	0x02000000	/* bit25 Disable autodisconnect */
    100   1.1  mjacob #define LUN_DM		0x40000000	/* bit30 Disconnects Mandatory */
    101   1.1  mjacob 
    102   1.1  mjacob /*
    103   1.1  mjacob  * le_ops values
    104   1.1  mjacob  */
    105   1.1  mjacob #define LUN_CCINCR	0x01	/* increment command count */
    106   1.1  mjacob #define LUN_CCDECR	0x02	/* decrement command count */
    107   1.1  mjacob #define LUN_ININCR	0x40	/* increment immed. notify count */
    108   1.1  mjacob #define LUN_INDECR	0x80	/* decrement immed. notify count */
    109   1.1  mjacob 
    110   1.1  mjacob /*
    111   1.1  mjacob  * le_status values
    112   1.1  mjacob  */
    113   1.1  mjacob #define	LUN_OK		0x01	/* we be rockin' */
    114   1.1  mjacob #define LUN_ERR		0x04	/* request completed with error */
    115   1.1  mjacob #define LUN_INVAL	0x06	/* invalid request */
    116   1.1  mjacob #define LUN_NOCAP	0x16	/* can't provide requested capability */
    117   1.1  mjacob #define LUN_ENABLED	0x3E	/* LUN already enabled */
    118   1.1  mjacob 
    119   1.1  mjacob /*
    120   1.1  mjacob  * Immediate Notify Entry structure
    121   1.1  mjacob  */
    122   1.1  mjacob #define IN_MSGLEN	8	/* 8 bytes */
    123   1.1  mjacob #define IN_RSVDLEN	8	/* 8 words */
    124   1.1  mjacob typedef struct {
    125   1.1  mjacob 	isphdr_t	in_header;
    126   1.1  mjacob 	u_int32_t	in_reserved;
    127   1.1  mjacob 	u_int8_t	in_lun;		/* lun */
    128   1.1  mjacob 	u_int8_t	in_iid;		/* initiator */
    129   1.1  mjacob 	u_int8_t	in_reserved2;
    130   1.1  mjacob 	u_int8_t	in_tgt;		/* target */
    131   1.1  mjacob 	u_int32_t	in_flags;
    132   1.1  mjacob 	u_int8_t	in_status;
    133   1.1  mjacob 	u_int8_t	in_rsvd2;
    134   1.1  mjacob 	u_int8_t	in_tag_val;	/* tag value */
    135   1.1  mjacob 	u_int8_t	in_tag_type;	/* tag type */
    136   1.1  mjacob 	u_int16_t	in_seqid;	/* sequence id */
    137   1.1  mjacob 	u_int8_t	in_msg[IN_MSGLEN];	/* SCSI message bytes */
    138   1.1  mjacob 	u_int16_t	in_reserved3[IN_RSVDLEN];
    139   1.1  mjacob 	u_int8_t	in_sense[QLTM_SENSELEN];/* suggested sense data */
    140   1.1  mjacob } in_entry_t;
    141   1.1  mjacob 
    142   1.1  mjacob typedef struct {
    143   1.1  mjacob 	isphdr_t	in_header;
    144   1.1  mjacob 	u_int32_t	in_reserved;
    145   1.1  mjacob 	u_int8_t	in_lun;		/* lun */
    146   1.1  mjacob 	u_int8_t	in_iid;		/* initiator */
    147   1.1  mjacob 	u_int16_t	in_scclun;
    148   1.1  mjacob 	u_int32_t	in_reserved2;
    149   1.1  mjacob 	u_int16_t	in_status;
    150   1.1  mjacob 	u_int16_t	in_task_flags;
    151   1.1  mjacob 	u_int16_t	in_seqid;	/* sequence id */
    152   1.1  mjacob } in_fcentry_t;
    153   1.1  mjacob 
    154   1.1  mjacob /*
    155   1.1  mjacob  * Values for the in_status field
    156   1.1  mjacob  */
    157   1.6  mjacob #define	IN_REJECT	0x0D	/* Message Reject message received */
    158   1.1  mjacob #define IN_RESET	0x0E	/* Bus Reset occurred */
    159   1.1  mjacob #define IN_NO_RCAP	0x16	/* requested capability not available */
    160   1.1  mjacob #define IN_IDE_RECEIVED	0x33	/* Initiator Detected Error msg received */
    161   1.1  mjacob #define IN_RSRC_UNAVAIL	0x34	/* resource unavailable */
    162   1.1  mjacob #define IN_MSG_RECEIVED	0x36	/* SCSI message received */
    163   1.1  mjacob #define	IN_ABORT_TASK	0x20	/* task named in RX_ID is being aborted (FC) */
    164   1.1  mjacob #define	IN_PORT_LOGOUT	0x29	/* port has logged out (FC) */
    165   1.1  mjacob #define	IN_PORT_CHANGED	0x2A	/* port changed */
    166   1.1  mjacob #define	IN_GLOBAL_LOGO	0x2E	/* all ports logged out */
    167   1.6  mjacob #define	IN_NO_NEXUS	0x3B	/* Nexus not established */
    168   1.1  mjacob 
    169   1.1  mjacob /*
    170   1.1  mjacob  * Values for the in_task_flags field- should only get one at a time!
    171   1.1  mjacob  */
    172   1.1  mjacob #define	TASK_FLAGS_ABORT_TASK		(1<<9)
    173   1.1  mjacob #define	TASK_FLAGS_CLEAR_TASK_SET	(1<<10)
    174   1.1  mjacob #define	TASK_FLAGS_TARGET_RESET		(1<<13)
    175   1.1  mjacob #define	TASK_FLAGS_CLEAR_ACA		(1<<14)
    176   1.1  mjacob #define	TASK_FLAGS_TERMINATE_TASK	(1<<15)
    177   1.1  mjacob 
    178   1.1  mjacob #ifndef	MSG_ABORT_TAG
    179   1.1  mjacob #define	MSG_ABORT_TAG		0x06
    180   1.1  mjacob #endif
    181   1.1  mjacob #ifndef	MSG_CLEAR_QUEUE
    182   1.1  mjacob #define	MSG_CLEAR_QUEUE		0x0e
    183   1.1  mjacob #endif
    184   1.1  mjacob #ifndef	MSG_BUS_DEV_RESET
    185   1.1  mjacob #define	MSG_BUS_DEV_RESET	0x0b
    186   1.1  mjacob #endif
    187   1.1  mjacob #ifndef	MSG_REL_RECOVERY
    188   1.1  mjacob #define	MSG_REL_RECOVERY	0x10
    189   1.1  mjacob #endif
    190   1.1  mjacob #ifndef	MSG_TERM_IO_PROC
    191   1.1  mjacob #define	MSG_TERM_IO_PROC	0x11
    192   1.1  mjacob #endif
    193   1.1  mjacob 
    194   1.1  mjacob 
    195   1.1  mjacob /*
    196   1.1  mjacob  * Notify Acknowledge Entry structure
    197   1.1  mjacob  */
    198   1.1  mjacob #define NA_RSVDLEN	22
    199   1.1  mjacob typedef struct {
    200   1.1  mjacob 	isphdr_t	na_header;
    201   1.1  mjacob 	u_int32_t	na_reserved;
    202   1.1  mjacob 	u_int8_t	na_lun;		/* lun */
    203   1.1  mjacob 	u_int8_t	na_iid;		/* initiator */
    204   1.1  mjacob 	u_int8_t	na_reserved2;
    205   1.1  mjacob 	u_int8_t	na_tgt;		/* target */
    206   1.1  mjacob 	u_int32_t	na_flags;
    207   1.1  mjacob 	u_int8_t	na_status;
    208   1.1  mjacob 	u_int8_t	na_event;
    209   1.1  mjacob 	u_int16_t	na_seqid;	/* sequence id */
    210   1.1  mjacob 	u_int16_t	na_reserved3[NA_RSVDLEN];
    211   1.1  mjacob } na_entry_t;
    212   1.1  mjacob 
    213   1.1  mjacob /*
    214   1.1  mjacob  * Value for the na_event field
    215   1.1  mjacob  */
    216   1.1  mjacob #define NA_RST_CLRD	0x80	/* Clear an async event notification */
    217   1.4      he #define	NA_OK		0x01	/* Notify Acknowledge Succeeded */
    218   1.4      he #define	NA_INVALID	0x06	/* Invalid Notify Acknowledge */
    219   1.1  mjacob 
    220   1.1  mjacob #define	NA2_RSVDLEN	21
    221   1.1  mjacob typedef struct {
    222   1.1  mjacob 	isphdr_t	na_header;
    223   1.1  mjacob 	u_int32_t	na_reserved;
    224   1.1  mjacob 	u_int8_t	na_lun;		/* lun */
    225   1.1  mjacob 	u_int8_t	na_iid;		/* initiator */
    226   1.1  mjacob 	u_int16_t	na_scclun;
    227   1.1  mjacob 	u_int16_t	na_flags;
    228   1.1  mjacob 	u_int16_t	na_reserved2;
    229   1.1  mjacob 	u_int16_t	na_status;
    230   1.1  mjacob 	u_int16_t	na_task_flags;
    231   1.1  mjacob 	u_int16_t	na_seqid;	/* sequence id */
    232   1.1  mjacob 	u_int16_t	na_reserved3[NA2_RSVDLEN];
    233   1.1  mjacob } na_fcentry_t;
    234   1.1  mjacob #define	NAFC_RCOUNT	0x80	/* increment resource count */
    235   1.1  mjacob #define NAFC_RST_CLRD	0x20	/* Clear LIP Reset */
    236   1.1  mjacob /*
    237   1.1  mjacob  * Accept Target I/O Entry structure
    238   1.1  mjacob  */
    239   1.1  mjacob #define ATIO_CDBLEN	26
    240   1.1  mjacob 
    241   1.1  mjacob typedef struct {
    242   1.1  mjacob 	isphdr_t	at_header;
    243  1.11  mjacob 	u_int16_t	at_reserved;
    244  1.11  mjacob 	u_int16_t	at_handle;
    245   1.1  mjacob 	u_int8_t	at_lun;		/* lun */
    246   1.1  mjacob 	u_int8_t	at_iid;		/* initiator */
    247   1.1  mjacob 	u_int8_t	at_cdblen; 	/* cdb length */
    248   1.1  mjacob 	u_int8_t	at_tgt;		/* target */
    249   1.1  mjacob 	u_int32_t	at_flags;
    250   1.1  mjacob 	u_int8_t	at_status;	/* firmware status */
    251   1.1  mjacob 	u_int8_t	at_scsi_status;	/* scsi status */
    252   1.1  mjacob 	u_int8_t	at_tag_val;	/* tag value */
    253   1.1  mjacob 	u_int8_t	at_tag_type;	/* tag type */
    254   1.1  mjacob 	u_int8_t	at_cdb[ATIO_CDBLEN];	/* received CDB */
    255   1.1  mjacob 	u_int8_t	at_sense[QLTM_SENSELEN];/* suggested sense data */
    256   1.1  mjacob } at_entry_t;
    257   1.1  mjacob 
    258   1.1  mjacob /*
    259   1.1  mjacob  * at_flags values
    260   1.1  mjacob  */
    261   1.1  mjacob #define AT_NODISC	0x00008000	/* disconnect disabled */
    262   1.1  mjacob #define AT_TQAE		0x00000001	/* Tagged Queue Action enabled */
    263   1.1  mjacob 
    264   1.1  mjacob /*
    265   1.1  mjacob  * at_status values
    266   1.1  mjacob  */
    267   1.1  mjacob #define AT_PATH_INVALID	0x07	/* ATIO sent to firmware for disabled lun */
    268   1.1  mjacob #define	AT_RESET	0x0E	/* SCSI Bus Reset Occurred */
    269   1.1  mjacob #define AT_PHASE_ERROR	0x14	/* Bus phase sequence error */
    270   1.1  mjacob #define AT_NOCAP	0x16	/* Requested capability not available */
    271   1.1  mjacob #define AT_BDR_MSG	0x17	/* Bus Device Reset msg received */
    272   1.1  mjacob #define AT_CDB		0x3D	/* CDB received */
    273   1.1  mjacob 
    274   1.1  mjacob /*
    275   1.1  mjacob  * Accept Target I/O Entry structure, Type 2
    276   1.1  mjacob  */
    277   1.1  mjacob #define ATIO2_CDBLEN	16
    278   1.1  mjacob 
    279   1.1  mjacob typedef struct {
    280   1.1  mjacob 	isphdr_t	at_header;
    281   1.1  mjacob 	u_int32_t	at_reserved;
    282   1.1  mjacob 	u_int8_t	at_lun;		/* lun or reserved */
    283   1.1  mjacob 	u_int8_t	at_iid;		/* initiator */
    284   1.1  mjacob 	u_int16_t	at_rxid; 	/* response ID */
    285   1.1  mjacob 	u_int16_t	at_flags;
    286   1.1  mjacob 	u_int16_t	at_status;	/* firmware status */
    287   1.1  mjacob 	u_int8_t	at_reserved1;
    288   1.1  mjacob 	u_int8_t	at_taskcodes;
    289   1.1  mjacob 	u_int8_t	at_taskflags;
    290   1.1  mjacob 	u_int8_t	at_execodes;
    291   1.1  mjacob 	u_int8_t	at_cdb[ATIO2_CDBLEN];	/* received CDB */
    292   1.1  mjacob 	u_int32_t	at_datalen;		/* allocated data len */
    293   1.1  mjacob 	u_int16_t	at_scclun;	/* SCC Lun or reserved */
    294  1.11  mjacob 	u_int16_t	at_reserved2[10];
    295  1.11  mjacob 	u_int16_t	at_oxid;
    296   1.1  mjacob } at2_entry_t;
    297  1.10  mjacob 
    298  1.10  mjacob #define	ATIO2_WWPN_OFFSET	0x2A
    299  1.10  mjacob #define	ATIO2_OXID_OFFSET	0x3E
    300   1.1  mjacob 
    301   1.1  mjacob #define	ATIO2_TC_ATTR_MASK	0x7
    302   1.1  mjacob #define	ATIO2_TC_ATTR_SIMPLEQ	0
    303   1.1  mjacob #define	ATIO2_TC_ATTR_HEADOFQ	1
    304   1.1  mjacob #define	ATIO2_TC_ATTR_ORDERED	2
    305   1.1  mjacob #define	ATIO2_TC_ATTR_ACAQ	4
    306   1.1  mjacob #define	ATIO2_TC_ATTR_UNTAGGED	5
    307   1.1  mjacob 
    308   1.1  mjacob /*
    309   1.1  mjacob  * Continue Target I/O Entry structure
    310   1.1  mjacob  * Request from driver. The response from the
    311   1.1  mjacob  * ISP firmware is the same except that the last 18
    312   1.1  mjacob  * bytes are overwritten by suggested sense data if
    313   1.1  mjacob  * the 'autosense valid' bit is set in the status byte.
    314   1.1  mjacob  */
    315   1.1  mjacob typedef struct {
    316   1.1  mjacob 	isphdr_t	ct_header;
    317  1.11  mjacob 	u_int16_t	ct_reserved;
    318  1.11  mjacob #define	ct_syshandle	ct_reserved	/* we use this */
    319  1.11  mjacob 	u_int16_t	ct_fwhandle;	/* required by f/w */
    320   1.1  mjacob 	u_int8_t	ct_lun;	/* lun */
    321   1.1  mjacob 	u_int8_t	ct_iid;	/* initiator id */
    322   1.1  mjacob 	u_int8_t	ct_reserved2;
    323   1.1  mjacob 	u_int8_t	ct_tgt;	/* our target id */
    324   1.1  mjacob 	u_int32_t	ct_flags;
    325   1.1  mjacob 	u_int8_t 	ct_status;	/* isp status */
    326   1.1  mjacob 	u_int8_t 	ct_scsi_status;	/* scsi status */
    327   1.1  mjacob 	u_int8_t 	ct_tag_val;	/* tag value */
    328   1.1  mjacob 	u_int8_t 	ct_tag_type;	/* tag type */
    329   1.1  mjacob 	u_int32_t	ct_xfrlen;	/* transfer length */
    330   1.1  mjacob 	u_int32_t	ct_resid;	/* residual length */
    331   1.1  mjacob 	u_int16_t	ct_timeout;
    332   1.1  mjacob 	u_int16_t	ct_seg_count;
    333   1.1  mjacob 	ispds_t		ct_dataseg[ISP_RQDSEG];
    334   1.1  mjacob } ct_entry_t;
    335   1.1  mjacob 
    336   1.1  mjacob /*
    337   1.2  mjacob  * For some of the dual port SCSI adapters, port (bus #) is reported
    338   1.2  mjacob  * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
    339   1.2  mjacob  *
    340   1.2  mjacob  * Note that this does not apply to FC adapters at all which can and
    341   1.2  mjacob  * do report IIDs between 129 && 255 (these represent devices that have
    342   1.2  mjacob  * logged in across a SCSI fabric).
    343   1.2  mjacob  */
    344   1.2  mjacob #define	GET_IID_VAL(x)		(x & 0x3f)
    345   1.2  mjacob #define	GET_BUS_VAL(x)		((x >> 7) & 0x1)
    346   1.2  mjacob #define	SET_IID_VAL(y, x)	(y | (x & 0x3f))
    347   1.2  mjacob #define	SET_BUS_VAL(y, x)	(y | ((x & 0x1) << 7))
    348   1.2  mjacob 
    349   1.2  mjacob /*
    350   1.1  mjacob  * ct_flags values
    351   1.1  mjacob  */
    352   1.1  mjacob #define CT_TQAE		0x00000001	/* bit  1, Tagged Queue Action enable */
    353   1.1  mjacob #define CT_DATA_IN	0x00000040	/* bits 6&7, Data direction */
    354   1.1  mjacob #define CT_DATA_OUT	0x00000080	/* bits 6&7, Data direction */
    355   1.1  mjacob #define CT_NO_DATA	0x000000C0	/* bits 6&7, Data direction */
    356   1.1  mjacob #define	CT_CCINCR	0x00000100	/* bit 8, autoincrement atio count */
    357   1.1  mjacob #define CT_DATAMASK	0x000000C0	/* bits 6&7, Data direction */
    358   1.6  mjacob #define	CT_INISYNCWIDE	0x00004000	/* bit 14, Do Sync/Wide Negotiation */
    359   1.1  mjacob #define CT_NODISC	0x00008000	/* bit 15, Disconnects disabled */
    360   1.1  mjacob #define CT_DSDP		0x01000000	/* bit 24, Disable Save Data Pointers */
    361   1.1  mjacob #define CT_SENDRDP	0x04000000	/* bit 26, Send Restore Pointers msg */
    362   1.1  mjacob #define CT_SENDSTATUS	0x80000000	/* bit 31, Send SCSI status byte */
    363   1.1  mjacob 
    364   1.1  mjacob /*
    365   1.1  mjacob  * ct_status values
    366   1.1  mjacob  * - set by the firmware when it returns the CTIO
    367   1.1  mjacob  */
    368   1.1  mjacob #define CT_OK		0x01	/* completed without error */
    369   1.1  mjacob #define CT_ABORTED	0x02	/* aborted by host */
    370   1.1  mjacob #define CT_ERR		0x04	/* see sense data for error */
    371   1.1  mjacob #define CT_INVAL	0x06	/* request for disabled lun */
    372   1.1  mjacob #define CT_NOPATH	0x07	/* invalid ITL nexus */
    373   1.1  mjacob #define	CT_INVRXID	0x08	/* (FC only) Invalid RX_ID */
    374   1.1  mjacob #define CT_RSELTMO	0x0A	/* reselection timeout after 2 tries */
    375   1.1  mjacob #define CT_TIMEOUT	0x0B	/* timed out */
    376   1.1  mjacob #define CT_RESET	0x0E	/* SCSI Bus Reset occurred */
    377   1.6  mjacob #define	CT_PARITY	0x0F	/* Uncorrectable Parity Error */
    378   1.6  mjacob #define	CT_PANIC	0x13	/* Unrecoverable Error */
    379   1.1  mjacob #define CT_PHASE_ERROR	0x14	/* Bus phase sequence error */
    380   1.1  mjacob #define CT_BDR_MSG	0x17	/* Bus Device Reset msg received */
    381   1.1  mjacob #define CT_TERMINATED	0x19	/* due to Terminate Transfer mbox cmd */
    382   1.1  mjacob #define	CT_PORTNOTAVAIL	0x28	/* port not available */
    383   1.1  mjacob #define	CT_LOGOUT	0x29	/* port logout */
    384   1.1  mjacob #define	CT_PORTCHANGED	0x2A	/* port changed */
    385   1.6  mjacob #define	CT_IDE		0x33	/* Initiator Detected Error */
    386   1.1  mjacob #define CT_NOACK	0x35	/* Outstanding Immed. Notify. entry */
    387   1.1  mjacob 
    388   1.1  mjacob /*
    389   1.1  mjacob  * When the firmware returns a CTIO entry, it may overwrite the last
    390   1.1  mjacob  * part of the structure with sense data. This starts at offset 0x2E
    391   1.1  mjacob  * into the entry, which is in the middle of ct_dataseg[1]. Rather
    392   1.1  mjacob  * than define a new struct for this, I'm just using the sense data
    393   1.1  mjacob  * offset.
    394   1.1  mjacob  */
    395   1.1  mjacob #define CTIO_SENSE_OFFSET	0x2E
    396   1.1  mjacob 
    397   1.1  mjacob /*
    398   1.1  mjacob  * Entry length in u_longs. All entries are the same size so
    399   1.1  mjacob  * any one will do as the numerator.
    400   1.1  mjacob  */
    401   1.1  mjacob #define UINT32_ENTRY_SIZE	(sizeof(at_entry_t)/sizeof(u_int32_t))
    402   1.1  mjacob 
    403   1.1  mjacob /*
    404   1.1  mjacob  * QLA2100 CTIO (type 2) entry
    405   1.1  mjacob  */
    406   1.1  mjacob #define	MAXRESPLEN	26
    407   1.1  mjacob typedef struct {
    408   1.1  mjacob 	isphdr_t	ct_header;
    409  1.11  mjacob 	u_int16_t	ct_reserved;
    410  1.11  mjacob 	u_int16_t	ct_fwhandle;	/* just to match CTIO */
    411   1.1  mjacob 	u_int8_t	ct_lun;	/* lun */
    412   1.1  mjacob 	u_int8_t	ct_iid;	/* initiator id */
    413   1.1  mjacob 	u_int16_t	ct_rxid; /* response ID */
    414   1.1  mjacob 	u_int16_t	ct_flags;
    415   1.1  mjacob 	u_int16_t 	ct_status;	/* isp status */
    416   1.1  mjacob 	u_int16_t	ct_timeout;
    417   1.1  mjacob 	u_int16_t	ct_seg_count;
    418   1.1  mjacob 	u_int32_t	ct_reloff;	/* relative offset */
    419   1.2  mjacob 	int32_t		ct_resid;	/* residual length */
    420   1.1  mjacob 	union {
    421   1.1  mjacob 		/*
    422   1.1  mjacob 		 * The three different modes that the target driver
    423   1.1  mjacob 		 * can set the CTIO2 up as.
    424   1.1  mjacob 		 *
    425   1.1  mjacob 		 * The first is for sending FCP_DATA_IUs as well as
    426   1.1  mjacob 		 * (optionally) sending a terminal SCSI status FCP_RSP_IU.
    427   1.1  mjacob 		 *
    428   1.1  mjacob 		 * The second is for sending SCSI sense data in an FCP_RSP_IU.
    429   1.1  mjacob 		 * Note that no FCP_DATA_IUs will be sent.
    430   1.1  mjacob 		 *
    431   1.1  mjacob 		 * The third is for sending FCP_RSP_IUs as built specifically
    432   1.1  mjacob 		 * in system memory as located by the isp_dataseg.
    433   1.1  mjacob 		 */
    434   1.1  mjacob 		struct {
    435   1.1  mjacob 			u_int32_t _reserved;
    436   1.1  mjacob 			u_int16_t _reserved2;
    437   1.1  mjacob 			u_int16_t ct_scsi_status;
    438   1.1  mjacob 			u_int32_t ct_xfrlen;
    439   1.1  mjacob 			ispds_t ct_dataseg[ISP_RQDSEG_T2];
    440   1.1  mjacob 		} m0;
    441   1.1  mjacob 		struct {
    442   1.1  mjacob 			u_int16_t _reserved;
    443   1.1  mjacob 			u_int16_t _reserved2;
    444   1.1  mjacob 			u_int16_t ct_senselen;
    445   1.1  mjacob 			u_int16_t ct_scsi_status;
    446   1.1  mjacob 			u_int16_t ct_resplen;
    447   1.1  mjacob 			u_int8_t  ct_resp[MAXRESPLEN];
    448   1.1  mjacob 		} m1;
    449   1.1  mjacob 		struct {
    450   1.1  mjacob 			u_int32_t _reserved;
    451   1.1  mjacob 			u_int16_t _reserved2;
    452   1.1  mjacob 			u_int16_t _reserved3;
    453   1.1  mjacob 			u_int32_t ct_datalen;
    454   1.1  mjacob 			ispds_t ct_fcp_rsp_iudata;
    455   1.1  mjacob 		} m2;
    456   1.1  mjacob 		/*
    457   1.1  mjacob 		 * CTIO2 returned from F/W...
    458   1.1  mjacob 		 */
    459   1.1  mjacob 		struct {
    460   1.1  mjacob 			u_int32_t _reserved[4];
    461   1.1  mjacob 			u_int16_t ct_scsi_status;
    462   1.1  mjacob 			u_int8_t  ct_sense[QLTM_SENSELEN];
    463   1.1  mjacob 		} fw;
    464   1.1  mjacob 	} rsp;
    465   1.1  mjacob } ct2_entry_t;
    466   1.1  mjacob 
    467   1.1  mjacob /*
    468   1.1  mjacob  * ct_flags values for CTIO2
    469   1.1  mjacob  */
    470   1.1  mjacob #define	CT2_FLAG_MMASK	0x0003
    471   1.1  mjacob #define	CT2_FLAG_MODE0	0x0000
    472   1.1  mjacob #define	CT2_FLAG_MODE1	0x0001
    473   1.1  mjacob #define	CT2_FLAG_MODE2	0x0002
    474   1.1  mjacob #define CT2_DATA_IN	CT_DATA_IN
    475   1.1  mjacob #define CT2_DATA_OUT	CT_DATA_OUT
    476   1.1  mjacob #define CT2_NO_DATA	CT_NO_DATA
    477   1.1  mjacob #define CT2_DATAMASK	CT_DATAMASK
    478   1.1  mjacob #define	CT2_CCINCR	0x0100
    479   1.1  mjacob #define	CT2_FASTPOST	0x0200
    480   1.1  mjacob #define CT2_SENDSTATUS	0x8000
    481   1.1  mjacob 
    482   1.1  mjacob /*
    483   1.1  mjacob  * ct_status values are (mostly) the same as that for ct_entry.
    484   1.1  mjacob  */
    485   1.1  mjacob 
    486   1.1  mjacob /*
    487   1.1  mjacob  * ct_scsi_status values- the low 8 bits are the normal SCSI status
    488   1.1  mjacob  * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
    489   1.1  mjacob  * fields.
    490   1.1  mjacob  */
    491   1.1  mjacob #define	CT2_RSPLEN_VALID	0x0100
    492   1.1  mjacob #define	CT2_SNSLEN_VALID	0x0200
    493   1.1  mjacob #define	CT2_DATA_OVER		0x0400
    494   1.1  mjacob #define	CT2_DATA_UNDER		0x0800
    495   1.1  mjacob 
    496   1.1  mjacob /*
    497   1.1  mjacob  * Macros for packing/unpacking the above structures
    498   1.1  mjacob  */
    499   1.1  mjacob 
    500   1.1  mjacob #ifdef	__sparc__
    501  1.11  mjacob #define	ISP_SBUS_SWOZZLE(isp, src, dst, taga, tagb)	\
    502  1.11  mjacob 	if (isp->isp_bustype == ISP_BT_SBUS) {	\
    503  1.11  mjacob 		u_int8_t tmp = src -> taga;	\
    504  1.11  mjacob 		dst -> taga =  dst -> tagb;	\
    505  1.11  mjacob 		src -> tagb =  tmp;		\
    506   1.1  mjacob 	} else { \
    507  1.11  mjacob 		dst -> taga =  src -> taga;	\
    508  1.11  mjacob 		dst -> tagb =  src -> taga;	\
    509   1.1  mjacob 	}
    510   1.1  mjacob #else
    511  1.11  mjacob #define	ISP_SBUS_SWOZZLE(isp, src, dst, taga, tagb)	\
    512  1.11  mjacob 		dst -> taga =  src -> taga;	\
    513  1.11  mjacob 		dst -> tagb =  src -> taga
    514   1.1  mjacob #endif
    515   1.1  mjacob 
    516   1.2  mjacob #define	MCIDF(d, s)	if ((void *) d != (void *)s) MEMCPY(d, s, QENTRY_LEN)
    517   1.2  mjacob 
    518   1.1  mjacob /* This is really only for SBus cards on a sparc */
    519   1.1  mjacob #ifdef	__sparc__
    520  1.11  mjacob #define	ISP_SWIZ_ATIO(isp, vdst, vsrc)					\
    521  1.11  mjacob {									\
    522  1.11  mjacob 	at_entry_t *src = (at_entry_t *) vsrc;				\
    523  1.11  mjacob 	at_entry_t *dst = (at_entry_t *) vdst;				\
    524  1.11  mjacob 	dst->at_header = src->at_header;				\
    525  1.11  mjacob 	dst->at_reserved = src->at_reserved;				\
    526  1.11  mjacob 	dst->at_handle = src->at_handle;				\
    527  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_lun, at_iid);		\
    528  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_cdblen, at_tgt);		\
    529  1.11  mjacob 	dst->at_flags = src->at_flags;					\
    530  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_status, at_scsi_status);	\
    531  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_tag_val, at_tag_type);	\
    532  1.11  mjacob 	MEMCPY(dst->at_cdb, src->at_cdb, ATIO_CDBLEN);			\
    533  1.11  mjacob 	MEMCPY(dst->at_sense, src->at_sense, QLTM_SENSELEN);		\
    534  1.11  mjacob }
    535  1.11  mjacob #define	ISP_SWIZ_ATIO2(isp, vdst, vsrc)					\
    536  1.11  mjacob {									\
    537  1.11  mjacob 	at2_entry_t *src = (at2_entry_t *) vsrc;			\
    538  1.11  mjacob 	at2_entry_t *dst = (at2_entry_t *) vdst;			\
    539  1.11  mjacob 	dst->at_reserved = src->at_reserved;				\
    540  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_lun, at_iid);		\
    541  1.11  mjacob 	dst->at_rxid = src->at_rxid;					\
    542  1.11  mjacob 	dst->at_flags = src->at_flags;					\
    543  1.11  mjacob 	dst->at_status = src->at_status;				\
    544  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_reserved1, at_taskcodes);	\
    545  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, at_taskflags, at_execodes);	\
    546  1.11  mjacob 	MEMCPY(dst->at_cdb, src->at_cdb, ATIO2_CDBLEN);			\
    547  1.11  mjacob 	dst->at_datalen = src->at_datalen;				\
    548  1.11  mjacob 	dst->at_scclun = src->at_scclun;				\
    549  1.11  mjacob 	MEMCPY(dst->at_reserved2, src->at_reserved2, sizeof dst->at_reserved2);\
    550  1.11  mjacob 	dst->at_oxid = src->at_oxid;					\
    551  1.11  mjacob }
    552  1.11  mjacob #define	ISP_SWIZ_CTIO(isp, vdst, vsrc)					\
    553   1.1  mjacob {									\
    554  1.11  mjacob 	ct_entry_t *src = (ct_entry_t *) vsrc;				\
    555  1.11  mjacob 	ct_entry_t *dst = (ct_entry_t *) vdst;				\
    556  1.11  mjacob 	dst->ct_header = src->ct_header;				\
    557  1.11  mjacob 	dst->ct_syshandle = src->ct_syshandle;				\
    558  1.11  mjacob 	dst->ct_fwhandle = src->ct_fwhandle;				\
    559  1.11  mjacob 	dst->ct_fwhandle = src->ct_fwhandle;				\
    560  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, ct_lun, ct_iid);		\
    561  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, ct_reserved2, ct_tgt);		\
    562  1.11  mjacob 	dst->ct_flags = src->ct_flags;					\
    563  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, ct_status, ct_scsi_status);	\
    564  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, ct_tag_val, ct_tag_type);	\
    565  1.11  mjacob 	dst->ct_xfrlen = src->ct_xfrlen;				\
    566  1.11  mjacob 	dst->ct_resid = src->ct_resid;					\
    567  1.11  mjacob 	dst->ct_timeout = src->ct_timeout;				\
    568  1.11  mjacob 	dst->ct_seg_count = src->ct_seg_count;				\
    569  1.11  mjacob 	MEMCPY(dst->ct_dataseg, src->ct_dataseg, sizeof (dst->ct_dataseg)); \
    570   1.1  mjacob }
    571  1.11  mjacob #define	ISP_SWIZ_CTIO2(isp, vdst, vsrc)					\
    572  1.11  mjacob {									\
    573  1.11  mjacob 	ct2_entry_t *src = (ct2_entry_t *) vsrc;			\
    574  1.11  mjacob 	ct2_entry_t *dst = (ct2_entry_t *) vdst;			\
    575  1.11  mjacob 	dst->ct_header = src->ct_header;				\
    576  1.11  mjacob 	dst->ct_syshandle = src->ct_syshandle;				\
    577  1.11  mjacob 	dst->ct_fwhandle = src->ct_fwhandle;				\
    578  1.11  mjacob 	dst->ct_fwhandle = src->ct_fwhandle;				\
    579  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, ct_lun, ct_iid);		\
    580  1.11  mjacob 	dst->ct_rxid = src->ct_rxid;					\
    581  1.11  mjacob 	dst->ct_flags = src->ct_flags;					\
    582  1.11  mjacob 	dst->ct_status = src->ct_status;				\
    583  1.11  mjacob 	dst->ct_timeout = src->ct_timeout;				\
    584  1.11  mjacob 	dst->ct_seg_count = src->ct_seg_count;				\
    585  1.11  mjacob 	dst->ct_reloff = src->ct_reloff;				\
    586  1.11  mjacob 	dst->ct_resid = src->ct_resid;					\
    587  1.11  mjacob 	dst->rsp = src->rsp;						\
    588  1.11  mjacob }
    589  1.11  mjacob #define	ISP_SWIZ_ENABLE_LUN(isp, vdst, vsrc)				\
    590  1.11  mjacob {									\
    591  1.11  mjacob 	lun_entry_t *src = (lun_entry_t *)vsrc;				\
    592  1.11  mjacob 	lun_entry_t *dst = (lun_entry_t *)vdst;				\
    593  1.11  mjacob 	dst->le_header = src->le_header;				\
    594  1.11  mjacob 	dst->le_reserved2 = src->le_reserved2;				\
    595  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, le_lun, le_rsvd);		\
    596  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, le_ops, le_tgt);		\
    597  1.11  mjacob 	dst->le_flags = src->le_flags;					\
    598  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, le_status, le_reserved2);	\
    599  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, le_cmd_count, le_in_count);	\
    600  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, le_cdb6len, le_cdb7len);	\
    601  1.11  mjacob 	dst->le_timeout = src->le_timeout;				\
    602  1.11  mjacob 	dst->le_reserved = src->le_reserved;				\
    603  1.11  mjacob }
    604  1.11  mjacob #define	ISP_SWIZ_NOTIFY(isp, vdst, vsrc)				\
    605   1.1  mjacob {									\
    606  1.11  mjacob 	in_entry_type *src = (in_entry_t *)vsrc;			\
    607  1.11  mjacob 	in_entry_type *dst = (in_entry_t *)vdst;			\
    608  1.11  mjacob 	dst->in_header = src->in_header;				\
    609  1.11  mjacob 	dst->in_reserved2 = src->in_reserved2;				\
    610  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, in_lun, in_iid);		\
    611  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, in_reserved2, in_tgt);		\
    612  1.11  mjacob 	dst->in_flags = src->in_flags;					\
    613  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, in_status, in_rsvd2);		\
    614  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, in_tag_val, in_tag_type);	\
    615  1.11  mjacob 	dst->in_seqid = src->in_seqid;					\
    616  1.11  mjacob 	MEMCPY(dst->in_msg, src->in_msg, IN_MSGLEN);			\
    617  1.11  mjacob 	MEMCPY(dst->in_reserved, src->in_reserved, IN_RESERVED);	\
    618  1.11  mjacob 	MEMCPY(dst->in_sense, src->in_sense, QLTM_SENSELEN);		\
    619   1.1  mjacob }
    620  1.11  mjacob #define	ISP_SWIZ_NOTIFY_FC(isp, vdst, vsrc)				\
    621   1.1  mjacob {									\
    622  1.11  mjacob 	in_fcentry_type *src = (in_fcentry_t *)vsrc;			\
    623  1.11  mjacob 	in_fcentry_type *dst = (in_fcentry_t *)vdst;			\
    624  1.11  mjacob 	dst->in_header = src->in_header;				\
    625  1.11  mjacob 	dst->in_reserved2 = src->in_reserved2;				\
    626  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, in_lun, in_iid);		\
    627  1.11  mjacob 	dst->in_scclun = src->in_scclun;				\
    628  1.11  mjacob 	dst->in_reserved2 = src->in_reserved2;				\
    629  1.11  mjacob 	dst->in_status = src->in_status;				\
    630  1.11  mjacob 	dst->in_task_flags = src->in_task_flags;			\
    631  1.11  mjacob 	dst->in_seqid = src->in_seqid;					\
    632   1.1  mjacob }
    633  1.11  mjacob #define	ISP_SWIZ_NOT_ACK(isp, vdst, vsrc)				\
    634   1.1  mjacob {									\
    635  1.11  mjacob 	na_entry_t *src = (na_entry_t *)vsrc;				\
    636  1.11  mjacob 	na_entry_t *dst = (na_entry_t *)vdst;				\
    637  1.11  mjacob 	dst->na_header = src->na_header;				\
    638  1.11  mjacob 	dst->na_reserved = src->na_reserved;				\
    639  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, na_lun, na_iid);		\
    640  1.11  mjacob 	dst->na_reserved2 = src->na_reserved2;				\
    641  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, na_reserved, na_tgt);		\
    642  1.11  mjacob 	dst->na_flags = src->na_flags;					\
    643  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, na_status, na_event);		\
    644  1.11  mjacob 	dst->na_seqid = src->na_seqid;					\
    645  1.11  mjacob 	MEMCPY(dst->na_reserved3, src->na_reserved3, NA_RSVDLEN);	\
    646   1.1  mjacob }
    647  1.11  mjacob #define	ISP_SWIZ_NOT_ACK_FC(isp, vdst, vsrc)				\
    648   1.1  mjacob {									\
    649  1.11  mjacob 	na_fcentry_t *src = (na_fcentry_t *)vsrc;			\
    650  1.11  mjacob 	na_fcentry_t *dst = (na_fcentry_t *)vdst;			\
    651  1.11  mjacob 	dst->na_header = src->na_header;				\
    652  1.11  mjacob 	dst->na_reserved = src->na_reserved;				\
    653  1.11  mjacob 	ISP_SBUS_SWOZZLE(isp, src, dst, na_lun, na_iid);		\
    654  1.11  mjacob 	dst->na_scclun = src->na_scclun;				\
    655  1.11  mjacob 	dst->na_flags = src->na_flags;					\
    656  1.11  mjacob 	dst->na_reserved2 = src->na_reserved2;				\
    657  1.11  mjacob 	dst->na_status = src->na_status;				\
    658  1.11  mjacob 	dst->na_task_flags = src->na_task_flags;			\
    659  1.11  mjacob 	dst->na_seqid = src->na_seqid;					\
    660  1.11  mjacob 	MEMCPY(dst->na_reserved3, src->na_reserved3, NA2_RSVDLEN);	\
    661   1.1  mjacob }
    662   1.1  mjacob #else
    663   1.2  mjacob #define	ISP_SWIZ_ATIO(isp, d, s)	MCIDF(d, s)
    664  1.11  mjacob #define	ISP_SWIZ_ATIO2(isp, d, s)	MCIDF(d, s)
    665   1.2  mjacob #define	ISP_SWIZ_CTIO(isp, d, s)	MCIDF(d, s)
    666  1.11  mjacob #define	ISP_SWIZ_CTIO2(isp, d, s)	MCIDF(d, s)
    667   1.2  mjacob #define	ISP_SWIZ_ENABLE_LUN(isp, d, s)	MCIDF(d, s)
    668  1.11  mjacob #define	ISP_SWIZ_ATIO2(isp, d, s)	MCIDF(d, s)
    669  1.11  mjacob #define	ISP_SWIZ_CTIO2(isp, d, s)	MCIDF(d, s)
    670   1.2  mjacob #define	ISP_SWIZ_NOTIFY(isp, d, s)	MCIDF(d, s)
    671  1.11  mjacob #define	ISP_SWIZ_NOTIFY_FC(isp, d, s)	MCIDF(d, s)
    672   1.2  mjacob #define	ISP_SWIZ_NOT_ACK(isp, d, s)	MCIDF(d, s)
    673   1.2  mjacob #define	ISP_SWIZ_NOT_ACK_FC(isp, d, s)	MCIDF(d, s)
    674   1.1  mjacob #endif
    675   1.1  mjacob 
    676   1.1  mjacob /*
    677   1.1  mjacob  * Debug macros
    678   1.1  mjacob  */
    679   1.1  mjacob 
    680   1.1  mjacob #define	ISP_TDQE(isp, msg, idx, arg)	\
    681   1.7  mjacob     if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
    682   1.1  mjacob 
    683   1.1  mjacob /*
    684   1.2  mjacob  * The functions below are target mode functions that
    685   1.2  mjacob  * are generally internal to the Qlogic driver.
    686   1.1  mjacob  */
    687   1.1  mjacob 
    688   1.1  mjacob /*
    689   1.1  mjacob  * This function handles new response queue entry appropriate for target mode.
    690   1.1  mjacob  */
    691  1.11  mjacob int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
    692   1.1  mjacob 
    693   1.1  mjacob /*
    694   1.1  mjacob  * Enable/Disable/Modify a logical unit.
    695   1.1  mjacob  */
    696   1.7  mjacob #define	DFLT_CMD_CNT	32	/* XX */
    697   1.1  mjacob #define	DFLT_INOTIFY	(4)
    698  1.11  mjacob int isp_lun_cmd(struct ispsoftc *, int, int, int, int, u_int32_t);
    699   1.1  mjacob 
    700   1.1  mjacob /*
    701   1.1  mjacob  * General request queue 'put' routine for target mode entries.
    702   1.1  mjacob  */
    703   1.1  mjacob int isp_target_put_entry __P((struct ispsoftc *isp, void *));
    704   1.1  mjacob 
    705   1.1  mjacob /*
    706   1.1  mjacob  * General routine to put back an ATIO entry-
    707   1.1  mjacob  * used for replenishing f/w resource counts.
    708   1.1  mjacob  */
    709   1.1  mjacob int
    710  1.11  mjacob isp_target_put_atio(struct ispsoftc *, int, int, int, int, int);
    711   1.1  mjacob 
    712   1.1  mjacob /*
    713   1.1  mjacob  * General routine to send a final CTIO for a command- used mostly for
    714   1.1  mjacob  * local responses.
    715   1.1  mjacob  */
    716   1.1  mjacob int
    717  1.11  mjacob isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
    718   1.2  mjacob #define	ECMD_SVALID	0x100
    719   1.1  mjacob 
    720   1.1  mjacob /*
    721   1.1  mjacob  * Handle an asynchronous event
    722   1.1  mjacob  */
    723   1.1  mjacob 
    724  1.11  mjacob void isp_target_async(struct ispsoftc *, int, int);
    725   1.1  mjacob 
    726  1.11  mjacob #endif	/* _ISP_TARGET_H */
    727