xref: /freebsd/sys/dev/isp/isp_target.h (revision e52652370759dcf5500b7b9828e62f080ec77759)
10615a547SMatt Jacob /* $FreeBSD$ */
2098ca2bdSWarner Losh /*-
30615a547SMatt Jacob  * Qlogic Target Mode Structure and Flag Definitions
40615a547SMatt Jacob  *
50615a547SMatt Jacob  * Copyright (c) 1997, 1998
60615a547SMatt Jacob  * Patrick Stirling
70615a547SMatt Jacob  * pms@psconsult.com
80615a547SMatt Jacob  * All rights reserved.
90615a547SMatt Jacob  *
10e5265237SMatt Jacob  * Additonal Copyright (c) 1997-2006 by Matthew Jacob
110615a547SMatt Jacob  * All rights reserved.
120615a547SMatt Jacob  *
130615a547SMatt Jacob  * Redistribution and use in source and binary forms, with or without
140615a547SMatt Jacob  * modification, are permitted provided that the following conditions
150615a547SMatt Jacob  * are met:
160615a547SMatt Jacob  * 1. Redistributions of source code must retain the above copyright
170615a547SMatt Jacob  *    notice immediately at the beginning of the file, without modification,
180615a547SMatt Jacob  *    this list of conditions, and the following disclaimer.
19aa57fd6fSMatt Jacob  * 2. The name of the author may not be used to endorse or promote products
200615a547SMatt Jacob  *    derived from this software without specific prior written permission.
210615a547SMatt Jacob  *
220615a547SMatt Jacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
230615a547SMatt Jacob  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
240615a547SMatt Jacob  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
250615a547SMatt Jacob  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
260615a547SMatt Jacob  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
270615a547SMatt Jacob  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28e5265237SMatt Jacob  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29e5265237SMatt Jacob  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
300615a547SMatt Jacob  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
310615a547SMatt Jacob  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
320615a547SMatt Jacob  * SUCH DAMAGE.
330615a547SMatt Jacob  *
340615a547SMatt Jacob  */
35f5a44627SMatt Jacob #ifndef	_ISP_TARGET_H
36f5a44627SMatt Jacob #define	_ISP_TARGET_H
370615a547SMatt Jacob 
382f9e7606SMatt Jacob #define	QLTM_SENSELEN	18	/* non-FC cards only */
390615a547SMatt Jacob #define QLTM_SVALID	0x80
400615a547SMatt Jacob 
410615a547SMatt Jacob /*
420615a547SMatt Jacob  * Structure for Enable Lun and Modify Lun queue entries
430615a547SMatt Jacob  */
440615a547SMatt Jacob typedef struct {
450615a547SMatt Jacob 	isphdr_t	le_header;
460615a547SMatt Jacob 	u_int32_t	le_reserved;
470615a547SMatt Jacob 	u_int8_t	le_lun;
480615a547SMatt Jacob 	u_int8_t	le_rsvd;
490615a547SMatt Jacob 	u_int8_t	le_ops;		/* Modify LUN only */
500615a547SMatt Jacob 	u_int8_t	le_tgt;		/* Not for FC */
510615a547SMatt Jacob 	u_int32_t	le_flags;	/* Not for FC */
520615a547SMatt Jacob 	u_int8_t	le_status;
530615a547SMatt Jacob 	u_int8_t	le_reserved2;
540615a547SMatt Jacob 	u_int8_t	le_cmd_count;
550615a547SMatt Jacob 	u_int8_t	le_in_count;
560615a547SMatt Jacob 	u_int8_t	le_cdb6len;	/* Not for FC */
570615a547SMatt Jacob 	u_int8_t	le_cdb7len;	/* Not for FC */
580615a547SMatt Jacob 	u_int16_t	le_timeout;
590615a547SMatt Jacob 	u_int16_t	le_reserved3[20];
600615a547SMatt Jacob } lun_entry_t;
610615a547SMatt Jacob 
620615a547SMatt Jacob /*
630615a547SMatt Jacob  * le_flags values
640615a547SMatt Jacob  */
65b5da7b23SMatt Jacob #define LUN_TQAE	0x00000002	/* bit1  Tagged Queue Action Enable */
660615a547SMatt Jacob #define LUN_DSSM	0x01000000	/* bit24 Disable Sending SDP Message */
67d22fcb6bSMatt Jacob #define	LUN_DISAD	0x02000000	/* bit25 Disable autodisconnect */
680615a547SMatt Jacob #define LUN_DM		0x40000000	/* bit30 Disconnects Mandatory */
690615a547SMatt Jacob 
700615a547SMatt Jacob /*
710615a547SMatt Jacob  * le_ops values
720615a547SMatt Jacob  */
730615a547SMatt Jacob #define LUN_CCINCR	0x01	/* increment command count */
740615a547SMatt Jacob #define LUN_CCDECR	0x02	/* decrement command count */
750615a547SMatt Jacob #define LUN_ININCR	0x40	/* increment immed. notify count */
760615a547SMatt Jacob #define LUN_INDECR	0x80	/* decrement immed. notify count */
770615a547SMatt Jacob 
780615a547SMatt Jacob /*
790615a547SMatt Jacob  * le_status values
800615a547SMatt Jacob  */
810615a547SMatt Jacob #define	LUN_OK		0x01	/* we be rockin' */
820615a547SMatt Jacob #define LUN_ERR		0x04	/* request completed with error */
830615a547SMatt Jacob #define LUN_INVAL	0x06	/* invalid request */
840615a547SMatt Jacob #define LUN_NOCAP	0x16	/* can't provide requested capability */
850615a547SMatt Jacob #define LUN_ENABLED	0x3E	/* LUN already enabled */
860615a547SMatt Jacob 
870615a547SMatt Jacob /*
880615a547SMatt Jacob  * Immediate Notify Entry structure
890615a547SMatt Jacob  */
900615a547SMatt Jacob #define IN_MSGLEN	8	/* 8 bytes */
910615a547SMatt Jacob #define IN_RSVDLEN	8	/* 8 words */
920615a547SMatt Jacob typedef struct {
930615a547SMatt Jacob 	isphdr_t	in_header;
940615a547SMatt Jacob 	u_int32_t	in_reserved;
950615a547SMatt Jacob 	u_int8_t	in_lun;		/* lun */
960615a547SMatt Jacob 	u_int8_t	in_iid;		/* initiator */
970615a547SMatt Jacob 	u_int8_t	in_reserved2;
980615a547SMatt Jacob 	u_int8_t	in_tgt;		/* target */
990615a547SMatt Jacob 	u_int32_t	in_flags;
1000615a547SMatt Jacob 	u_int8_t	in_status;
1010615a547SMatt Jacob 	u_int8_t	in_rsvd2;
1020615a547SMatt Jacob 	u_int8_t	in_tag_val;	/* tag value */
1030615a547SMatt Jacob 	u_int8_t	in_tag_type;	/* tag type */
1040615a547SMatt Jacob 	u_int16_t	in_seqid;	/* sequence id */
1050615a547SMatt Jacob 	u_int8_t	in_msg[IN_MSGLEN];	/* SCSI message bytes */
1060615a547SMatt Jacob 	u_int16_t	in_reserved3[IN_RSVDLEN];
1070615a547SMatt Jacob 	u_int8_t	in_sense[QLTM_SENSELEN];/* suggested sense data */
1080615a547SMatt Jacob } in_entry_t;
1090615a547SMatt Jacob 
1100615a547SMatt Jacob typedef struct {
1110615a547SMatt Jacob 	isphdr_t	in_header;
1120615a547SMatt Jacob 	u_int32_t	in_reserved;
1130615a547SMatt Jacob 	u_int8_t	in_lun;		/* lun */
1140615a547SMatt Jacob 	u_int8_t	in_iid;		/* initiator */
1150615a547SMatt Jacob 	u_int16_t	in_scclun;
1160615a547SMatt Jacob 	u_int32_t	in_reserved2;
1170615a547SMatt Jacob 	u_int16_t	in_status;
1180615a547SMatt Jacob 	u_int16_t	in_task_flags;
1190615a547SMatt Jacob 	u_int16_t	in_seqid;	/* sequence id */
1200615a547SMatt Jacob } in_fcentry_t;
1210615a547SMatt Jacob 
122e5265237SMatt Jacob typedef struct {
123e5265237SMatt Jacob 	isphdr_t	in_header;
124e5265237SMatt Jacob 	u_int32_t	in_reserved;
125e5265237SMatt Jacob 	u_int16_t	in_iid;		/* initiator */
126e5265237SMatt Jacob 	u_int16_t	in_scclun;
127e5265237SMatt Jacob 	u_int32_t	in_reserved2;
128e5265237SMatt Jacob 	u_int16_t	in_status;
129e5265237SMatt Jacob 	u_int16_t	in_task_flags;
130e5265237SMatt Jacob 	u_int16_t	in_seqid;	/* sequence id */
131e5265237SMatt Jacob } in_fcentry_e_t;
132e5265237SMatt Jacob 
1330615a547SMatt Jacob /*
1340615a547SMatt Jacob  * Values for the in_status field
1350615a547SMatt Jacob  */
136482cf5c2SMatt Jacob #define	IN_REJECT	0x0D	/* Message Reject message received */
1370615a547SMatt Jacob #define IN_RESET	0x0E	/* Bus Reset occurred */
1380615a547SMatt Jacob #define IN_NO_RCAP	0x16	/* requested capability not available */
1390615a547SMatt Jacob #define IN_IDE_RECEIVED	0x33	/* Initiator Detected Error msg received */
1400615a547SMatt Jacob #define IN_RSRC_UNAVAIL	0x34	/* resource unavailable */
1410615a547SMatt Jacob #define IN_MSG_RECEIVED	0x36	/* SCSI message received */
1420615a547SMatt Jacob #define	IN_ABORT_TASK	0x20	/* task named in RX_ID is being aborted (FC) */
1430615a547SMatt Jacob #define	IN_PORT_LOGOUT	0x29	/* port has logged out (FC) */
1440615a547SMatt Jacob #define	IN_PORT_CHANGED	0x2A	/* port changed */
1450615a547SMatt Jacob #define	IN_GLOBAL_LOGO	0x2E	/* all ports logged out */
146482cf5c2SMatt Jacob #define	IN_NO_NEXUS	0x3B	/* Nexus not established */
1470615a547SMatt Jacob 
1480615a547SMatt Jacob /*
1490615a547SMatt Jacob  * Values for the in_task_flags field- should only get one at a time!
1500615a547SMatt Jacob  */
1510615a547SMatt Jacob #define	TASK_FLAGS_CLEAR_ACA		(1<<14)
1522f9e7606SMatt Jacob #define	TASK_FLAGS_TARGET_RESET		(1<<13)
1532f9e7606SMatt Jacob #define	TASK_FLAGS_LUN_RESET		(1<<12)
1542f9e7606SMatt Jacob #define	TASK_FLAGS_CLEAR_TASK_SET	(1<<10)
1552f9e7606SMatt Jacob #define	TASK_FLAGS_ABORT_TASK_SET	(1<<9)
1560615a547SMatt Jacob 
1572f9e7606SMatt Jacob #ifndef	MSG_ABORT
1582f9e7606SMatt Jacob #define	MSG_ABORT		0x06
1592f9e7606SMatt Jacob #endif
1602f9e7606SMatt Jacob #ifndef	MSG_BUS_DEV_RESET
1612f9e7606SMatt Jacob #define	MSG_BUS_DEV_RESET	0x0c
1622f9e7606SMatt Jacob #endif
1630615a547SMatt Jacob #ifndef	MSG_ABORT_TAG
1642f9e7606SMatt Jacob #define	MSG_ABORT_TAG		0x0d
1650615a547SMatt Jacob #endif
1660615a547SMatt Jacob #ifndef	MSG_CLEAR_QUEUE
1670615a547SMatt Jacob #define	MSG_CLEAR_QUEUE		0x0e
1680615a547SMatt Jacob #endif
1690615a547SMatt Jacob #ifndef	MSG_REL_RECOVERY
1700615a547SMatt Jacob #define	MSG_REL_RECOVERY	0x10
1710615a547SMatt Jacob #endif
1720615a547SMatt Jacob #ifndef	MSG_TERM_IO_PROC
1730615a547SMatt Jacob #define	MSG_TERM_IO_PROC	0x11
1740615a547SMatt Jacob #endif
1752f9e7606SMatt Jacob #ifndef	MSG_LUN_RESET
1762f9e7606SMatt Jacob #define	MSG_LUN_RESET		0x17
1772f9e7606SMatt Jacob #endif
1780615a547SMatt Jacob 
1790615a547SMatt Jacob /*
1800615a547SMatt Jacob  * Notify Acknowledge Entry structure
1810615a547SMatt Jacob  */
1820615a547SMatt Jacob #define NA_RSVDLEN	22
1830615a547SMatt Jacob typedef struct {
1840615a547SMatt Jacob 	isphdr_t	na_header;
1850615a547SMatt Jacob 	u_int32_t	na_reserved;
1860615a547SMatt Jacob 	u_int8_t	na_lun;		/* lun */
1870615a547SMatt Jacob 	u_int8_t	na_iid;		/* initiator */
1880615a547SMatt Jacob 	u_int8_t	na_reserved2;
1890615a547SMatt Jacob 	u_int8_t	na_tgt;		/* target */
1900615a547SMatt Jacob 	u_int32_t	na_flags;
1910615a547SMatt Jacob 	u_int8_t	na_status;
1920615a547SMatt Jacob 	u_int8_t	na_event;
1930615a547SMatt Jacob 	u_int16_t	na_seqid;	/* sequence id */
1940615a547SMatt Jacob 	u_int16_t	na_reserved3[NA_RSVDLEN];
1950615a547SMatt Jacob } na_entry_t;
1960615a547SMatt Jacob 
1970615a547SMatt Jacob /*
1980615a547SMatt Jacob  * Value for the na_event field
1990615a547SMatt Jacob  */
2000615a547SMatt Jacob #define NA_RST_CLRD	0x80	/* Clear an async event notification */
2019dae8807SMatt Jacob #define	NA_OK		0x01	/* Notify Acknowledge Succeeded */
2029dae8807SMatt Jacob #define	NA_INVALID	0x06	/* Invalid Notify Acknowledge */
2030615a547SMatt Jacob 
2040615a547SMatt Jacob #define	NA2_RSVDLEN	21
2050615a547SMatt Jacob typedef struct {
2060615a547SMatt Jacob 	isphdr_t	na_header;
2070615a547SMatt Jacob 	u_int32_t	na_reserved;
2080615a547SMatt Jacob 	u_int8_t	na_lun;		/* lun */
2090615a547SMatt Jacob 	u_int8_t	na_iid;		/* initiator */
2100615a547SMatt Jacob 	u_int16_t	na_scclun;
2110615a547SMatt Jacob 	u_int16_t	na_flags;
2120615a547SMatt Jacob 	u_int16_t	na_reserved2;
2130615a547SMatt Jacob 	u_int16_t	na_status;
2140615a547SMatt Jacob 	u_int16_t	na_task_flags;
2150615a547SMatt Jacob 	u_int16_t	na_seqid;	/* sequence id */
2160615a547SMatt Jacob 	u_int16_t	na_reserved3[NA2_RSVDLEN];
2170615a547SMatt Jacob } na_fcentry_t;
218e5265237SMatt Jacob 
219e5265237SMatt Jacob typedef struct {
220e5265237SMatt Jacob 	isphdr_t	na_header;
221e5265237SMatt Jacob 	u_int32_t	na_reserved;
222e5265237SMatt Jacob 	u_int16_t	na_iid;		/* initiator */
223e5265237SMatt Jacob 	u_int16_t	na_scclun;
224e5265237SMatt Jacob 	u_int16_t	na_flags;
225e5265237SMatt Jacob 	u_int16_t	na_reserved2;
226e5265237SMatt Jacob 	u_int16_t	na_status;
227e5265237SMatt Jacob 	u_int16_t	na_task_flags;
228e5265237SMatt Jacob 	u_int16_t	na_seqid;	/* sequence id */
229e5265237SMatt Jacob 	u_int16_t	na_reserved3[NA2_RSVDLEN];
230e5265237SMatt Jacob } na_fcentry_e_t;
231e5265237SMatt Jacob 
2320615a547SMatt Jacob #define	NAFC_RCOUNT	0x80	/* increment resource count */
2330615a547SMatt Jacob #define NAFC_RST_CLRD	0x20	/* Clear LIP Reset */
2340615a547SMatt Jacob /*
2350615a547SMatt Jacob  * Accept Target I/O Entry structure
2360615a547SMatt Jacob  */
2370615a547SMatt Jacob #define ATIO_CDBLEN	26
2380615a547SMatt Jacob 
2390615a547SMatt Jacob typedef struct {
2400615a547SMatt Jacob 	isphdr_t	at_header;
2415f5aafe1SMatt Jacob 	u_int16_t	at_reserved;
2425f5aafe1SMatt Jacob 	u_int16_t	at_handle;
2430615a547SMatt Jacob 	u_int8_t	at_lun;		/* lun */
2440615a547SMatt Jacob 	u_int8_t	at_iid;		/* initiator */
2450615a547SMatt Jacob 	u_int8_t	at_cdblen; 	/* cdb length */
2460615a547SMatt Jacob 	u_int8_t	at_tgt;		/* target */
2470615a547SMatt Jacob 	u_int32_t	at_flags;
2480615a547SMatt Jacob 	u_int8_t	at_status;	/* firmware status */
2490615a547SMatt Jacob 	u_int8_t	at_scsi_status;	/* scsi status */
2500615a547SMatt Jacob 	u_int8_t	at_tag_val;	/* tag value */
2510615a547SMatt Jacob 	u_int8_t	at_tag_type;	/* tag type */
2520615a547SMatt Jacob 	u_int8_t	at_cdb[ATIO_CDBLEN];	/* received CDB */
2530615a547SMatt Jacob 	u_int8_t	at_sense[QLTM_SENSELEN];/* suggested sense data */
2540615a547SMatt Jacob } at_entry_t;
2550615a547SMatt Jacob 
2560615a547SMatt Jacob /*
2570615a547SMatt Jacob  * at_flags values
2580615a547SMatt Jacob  */
2590615a547SMatt Jacob #define AT_NODISC	0x00008000	/* disconnect disabled */
260b5da7b23SMatt Jacob #define AT_TQAE		0x00000002	/* Tagged Queue Action enabled */
2610615a547SMatt Jacob 
2620615a547SMatt Jacob /*
2630615a547SMatt Jacob  * at_status values
2640615a547SMatt Jacob  */
2650615a547SMatt Jacob #define AT_PATH_INVALID	0x07	/* ATIO sent to firmware for disabled lun */
2660615a547SMatt Jacob #define	AT_RESET	0x0E	/* SCSI Bus Reset Occurred */
2670615a547SMatt Jacob #define AT_PHASE_ERROR	0x14	/* Bus phase sequence error */
2680615a547SMatt Jacob #define AT_NOCAP	0x16	/* Requested capability not available */
2690615a547SMatt Jacob #define AT_BDR_MSG	0x17	/* Bus Device Reset msg received */
2700615a547SMatt Jacob #define AT_CDB		0x3D	/* CDB received */
2710615a547SMatt Jacob /*
272b5da7b23SMatt Jacob  * Macros to create and fetch and test concatenated handle and tag value macros
273b5da7b23SMatt Jacob  */
274b5da7b23SMatt Jacob 
2751b941416SMatt Jacob #define	AT_MAKE_TAGID(tid, inst, aep)					\
2761b941416SMatt Jacob 	tid = aep->at_handle;						\
2771b941416SMatt Jacob 	if (aep->at_flags & AT_TQAE) {					\
2781b941416SMatt Jacob 		tid |= (aep->at_tag_val << 16);				\
2791b941416SMatt Jacob 		tid |= (1 << 24);					\
2801b941416SMatt Jacob 	}								\
281e5265237SMatt Jacob 	tid |= (GET_BUS_VAL(aep->at_iid) << 25);			\
282e5265237SMatt Jacob 	tid |= (inst << 26)
283b5da7b23SMatt Jacob 
284e5265237SMatt Jacob #define	CT_MAKE_TAGID(tid, bus, inst, ct)				\
2851b941416SMatt Jacob 	tid = ct->ct_fwhandle;						\
2861b941416SMatt Jacob 	if (ct->ct_flags & CT_TQAE) {					\
2871b941416SMatt Jacob 		tid |= (ct->ct_tag_val << 16);				\
2881b941416SMatt Jacob 		tid |= (1 << 24);					\
2891b941416SMatt Jacob 	}								\
290e5265237SMatt Jacob 	tid |= ((bus & 0x1) << 25);					\
291e5265237SMatt Jacob 	tid |= (inst << 26)
292b5da7b23SMatt Jacob 
2931b941416SMatt Jacob #define	AT_HAS_TAG(val)		((val) & (1 << 24))
2941b941416SMatt Jacob #define	AT_GET_TAG(val)		(((val) >> 16) & 0xff)
295e5265237SMatt Jacob #define	AT_GET_INST(val)	(((val) >> 26) & 0x3f)
296e5265237SMatt Jacob #define	AT_GET_BUS(val)		(((val) >> 25) & 0x1)
2971b941416SMatt Jacob #define	AT_GET_HANDLE(val)	((val) & 0xffff)
2981b941416SMatt Jacob 
2991b941416SMatt Jacob #define	IN_MAKE_TAGID(tid, inst, inp)					\
3001b941416SMatt Jacob 	tid = inp->in_seqid;						\
3011b941416SMatt Jacob 	tid |= (inp->in_tag_val << 16);					\
3021b941416SMatt Jacob 	tid |= (1 << 24);						\
303e5265237SMatt Jacob 	tid |= (GET_BUS_VAL(inp->in_iid) << 25);			\
304e5265237SMatt Jacob 	tid |= (inst << 26)
3051b941416SMatt Jacob 
3061b941416SMatt Jacob #define	TAG_INSERT_INST(tid, inst)					\
307e5265237SMatt Jacob 	tid &= ~(0x3ffffff);						\
308e5265237SMatt Jacob 	tid |= (inst << 26)
309e5265237SMatt Jacob 
310e5265237SMatt Jacob #define	TAG_INSERT_BUS(tid, bus)					\
311e5265237SMatt Jacob 	tid &= ~(1 << 25);						\
312e5265237SMatt Jacob 	tid |= (bus << 25)
313b5da7b23SMatt Jacob 
314b5da7b23SMatt Jacob /*
3150615a547SMatt Jacob  * Accept Target I/O Entry structure, Type 2
3160615a547SMatt Jacob  */
3170615a547SMatt Jacob #define ATIO2_CDBLEN	16
3180615a547SMatt Jacob 
3190615a547SMatt Jacob typedef struct {
3200615a547SMatt Jacob 	isphdr_t	at_header;
3210615a547SMatt Jacob 	u_int32_t	at_reserved;
3220615a547SMatt Jacob 	u_int8_t	at_lun;		/* lun or reserved */
3230615a547SMatt Jacob 	u_int8_t	at_iid;		/* initiator */
3240615a547SMatt Jacob 	u_int16_t	at_rxid; 	/* response ID */
3250615a547SMatt Jacob 	u_int16_t	at_flags;
3260615a547SMatt Jacob 	u_int16_t	at_status;	/* firmware status */
3272f9e7606SMatt Jacob 	u_int8_t	at_crn;		/* command reference number */
3280615a547SMatt Jacob 	u_int8_t	at_taskcodes;
3290615a547SMatt Jacob 	u_int8_t	at_taskflags;
3300615a547SMatt Jacob 	u_int8_t	at_execodes;
3310615a547SMatt Jacob 	u_int8_t	at_cdb[ATIO2_CDBLEN];	/* received CDB */
3320615a547SMatt Jacob 	u_int32_t	at_datalen;		/* allocated data len */
3330615a547SMatt Jacob 	u_int16_t	at_scclun;		/* SCC Lun or reserved */
33475c1e828SMatt Jacob 	u_int16_t	at_wwpn[4];		/* WWPN of initiator */
33575c1e828SMatt Jacob 	u_int16_t	at_reserved2[6];
336b0a3ba7eSMatt Jacob 	u_int16_t	at_oxid;
3370615a547SMatt Jacob } at2_entry_t;
3380615a547SMatt Jacob 
339e5265237SMatt Jacob typedef struct {
340e5265237SMatt Jacob 	isphdr_t	at_header;
341e5265237SMatt Jacob 	u_int32_t	at_reserved;
342e5265237SMatt Jacob 	u_int16_t	at_iid;		/* initiator */
343e5265237SMatt Jacob 	u_int16_t	at_rxid; 	/* response ID */
344e5265237SMatt Jacob 	u_int16_t	at_flags;
345e5265237SMatt Jacob 	u_int16_t	at_status;	/* firmware status */
346e5265237SMatt Jacob 	u_int8_t	at_crn;		/* command reference number */
347e5265237SMatt Jacob 	u_int8_t	at_taskcodes;
348e5265237SMatt Jacob 	u_int8_t	at_taskflags;
349e5265237SMatt Jacob 	u_int8_t	at_execodes;
350e5265237SMatt Jacob 	u_int8_t	at_cdb[ATIO2_CDBLEN];	/* received CDB */
351e5265237SMatt Jacob 	u_int32_t	at_datalen;		/* allocated data len */
352e5265237SMatt Jacob 	u_int16_t	at_scclun;		/* SCC Lun or reserved */
353e5265237SMatt Jacob 	u_int16_t	at_wwpn[4];		/* WWPN of initiator */
354e5265237SMatt Jacob 	u_int16_t	at_reserved2[6];
355e5265237SMatt Jacob 	u_int16_t	at_oxid;
356e5265237SMatt Jacob } at2e_entry_t;
357e5265237SMatt Jacob 
35873255608SMatt Jacob #define	ATIO2_WWPN_OFFSET	0x2A
35973255608SMatt Jacob #define	ATIO2_OXID_OFFSET	0x3E
36073255608SMatt Jacob 
3610615a547SMatt Jacob #define	ATIO2_TC_ATTR_MASK	0x7
3620615a547SMatt Jacob #define	ATIO2_TC_ATTR_SIMPLEQ	0
3630615a547SMatt Jacob #define	ATIO2_TC_ATTR_HEADOFQ	1
3640615a547SMatt Jacob #define	ATIO2_TC_ATTR_ORDERED	2
3650615a547SMatt Jacob #define	ATIO2_TC_ATTR_ACAQ	4
3660615a547SMatt Jacob #define	ATIO2_TC_ATTR_UNTAGGED	5
3670615a547SMatt Jacob 
3682f9e7606SMatt Jacob #define	ATIO2_EX_WRITE		0x1
3692f9e7606SMatt Jacob #define	ATIO2_EX_READ		0x2
3701b941416SMatt Jacob /*
3711b941416SMatt Jacob  * Macros to create and fetch and test concatenated handle and tag value macros
3721b941416SMatt Jacob  */
3731b941416SMatt Jacob #define	AT2_MAKE_TAGID(tid, inst, aep)					\
3741b941416SMatt Jacob 	tid = aep->at_rxid;						\
3751b941416SMatt Jacob 	tid |= (inst << 16)
3761b941416SMatt Jacob 
3771b941416SMatt Jacob #define	CT2_MAKE_TAGID(tid, inst, ct)					\
3781b941416SMatt Jacob 	tid = ct->ct_rxid;						\
3791b941416SMatt Jacob 	tid |= (inst << 16)
3801b941416SMatt Jacob 
3811b941416SMatt Jacob #define	AT2_HAS_TAG(val)	1
3821b941416SMatt Jacob #define	AT2_GET_TAG(val)	((val) & 0xffff)
3831b941416SMatt Jacob #define	AT2_GET_INST(val)	((val) >> 16)
3841b941416SMatt Jacob #define	AT2_GET_HANDLE		AT2_GET_TAG
3851b941416SMatt Jacob 
386e5265237SMatt Jacob #define	FC_HAS_TAG	AT2_HAS_TAG
387e5265237SMatt Jacob #define	FC_GET_TAG	AT2_GET_TAG
388e5265237SMatt Jacob #define	FC_GET_INST	AT2_GET_INST
389e5265237SMatt Jacob #define	FC_GET_HANDLE	AT2_GET_HANDLE
390e5265237SMatt Jacob 
3911b941416SMatt Jacob #define	IN_FC_MAKE_TAGID(tid, inst, inp)				\
3921b941416SMatt Jacob 	tid = inp->in_seqid;						\
3931b941416SMatt Jacob 	tid |= (inst << 16)
3941b941416SMatt Jacob 
3951b941416SMatt Jacob #define	FC_TAG_INSERT_INST(tid, inst)					\
3961b941416SMatt Jacob 	tid &= ~0xffff;							\
3971b941416SMatt Jacob 	tid |= (inst << 16)
3981b941416SMatt Jacob 
3992f9e7606SMatt Jacob 
4000615a547SMatt Jacob /*
4010615a547SMatt Jacob  * Continue Target I/O Entry structure
4020615a547SMatt Jacob  * Request from driver. The response from the
4030615a547SMatt Jacob  * ISP firmware is the same except that the last 18
4040615a547SMatt Jacob  * bytes are overwritten by suggested sense data if
4050615a547SMatt Jacob  * the 'autosense valid' bit is set in the status byte.
4060615a547SMatt Jacob  */
4070615a547SMatt Jacob typedef struct {
4080615a547SMatt Jacob 	isphdr_t	ct_header;
4095f5aafe1SMatt Jacob 	u_int16_t	ct_reserved;
4105f5aafe1SMatt Jacob #define	ct_syshandle	ct_reserved	/* we use this */
4115f5aafe1SMatt Jacob 	u_int16_t	ct_fwhandle;	/* required by f/w */
4120615a547SMatt Jacob 	u_int8_t	ct_lun;	/* lun */
4130615a547SMatt Jacob 	u_int8_t	ct_iid;	/* initiator id */
4140615a547SMatt Jacob 	u_int8_t	ct_reserved2;
4150615a547SMatt Jacob 	u_int8_t	ct_tgt;	/* our target id */
4160615a547SMatt Jacob 	u_int32_t	ct_flags;
4170615a547SMatt Jacob 	u_int8_t 	ct_status;	/* isp status */
4180615a547SMatt Jacob 	u_int8_t 	ct_scsi_status;	/* scsi status */
4190615a547SMatt Jacob 	u_int8_t 	ct_tag_val;	/* tag value */
4200615a547SMatt Jacob 	u_int8_t 	ct_tag_type;	/* tag type */
4210615a547SMatt Jacob 	u_int32_t	ct_xfrlen;	/* transfer length */
4220615a547SMatt Jacob 	u_int32_t	ct_resid;	/* residual length */
4230615a547SMatt Jacob 	u_int16_t	ct_timeout;
4240615a547SMatt Jacob 	u_int16_t	ct_seg_count;
4254fd13c1bSMatt Jacob 	/*
4264fd13c1bSMatt Jacob 	 * This is so we can share tag name space with
4274fd13c1bSMatt Jacob 	 * CTIO{2,3,4} with the minimum of pain.
4284fd13c1bSMatt Jacob 	 */
4294fd13c1bSMatt Jacob 	union {
4304fd13c1bSMatt Jacob 		ispds_t		ct_a[ISP_RQDSEG];
4314fd13c1bSMatt Jacob 	} _u;
4324fd13c1bSMatt Jacob #define	ct_dataseg	_u.ct_a
4330615a547SMatt Jacob } ct_entry_t;
4340615a547SMatt Jacob 
4350615a547SMatt Jacob /*
436427469a4SMatt Jacob  * For some of the dual port SCSI adapters, port (bus #) is reported
437427469a4SMatt Jacob  * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
438427469a4SMatt Jacob  *
439427469a4SMatt Jacob  * Note that this does not apply to FC adapters at all which can and
440e5265237SMatt Jacob  * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices
441e5265237SMatt Jacob  * that have logged in across a SCSI fabric.
442427469a4SMatt Jacob  */
443427469a4SMatt Jacob #define	GET_IID_VAL(x)		(x & 0x3f)
444427469a4SMatt Jacob #define	GET_BUS_VAL(x)		((x >> 7) & 0x1)
4452332ac8cSMatt Jacob #define	SET_IID_VAL(y, x)	y = ((y & ~0x3f) | (x & 0x3f))
4462332ac8cSMatt Jacob #define	SET_BUS_VAL(y, x)	y = ((y & 0x3f) | ((x & 0x1) << 7))
447427469a4SMatt Jacob 
448427469a4SMatt Jacob /*
4490615a547SMatt Jacob  * ct_flags values
4500615a547SMatt Jacob  */
451b5da7b23SMatt Jacob #define CT_TQAE		0x00000002	/* bit  1, Tagged Queue Action enable */
4520615a547SMatt Jacob #define CT_DATA_IN	0x00000040	/* bits 6&7, Data direction */
4530615a547SMatt Jacob #define CT_DATA_OUT	0x00000080	/* bits 6&7, Data direction */
4540615a547SMatt Jacob #define CT_NO_DATA	0x000000C0	/* bits 6&7, Data direction */
4550615a547SMatt Jacob #define	CT_CCINCR	0x00000100	/* bit 8, autoincrement atio count */
4560615a547SMatt Jacob #define CT_DATAMASK	0x000000C0	/* bits 6&7, Data direction */
457482cf5c2SMatt Jacob #define	CT_INISYNCWIDE	0x00004000	/* bit 14, Do Sync/Wide Negotiation */
4580615a547SMatt Jacob #define CT_NODISC	0x00008000	/* bit 15, Disconnects disabled */
4590615a547SMatt Jacob #define CT_DSDP		0x01000000	/* bit 24, Disable Save Data Pointers */
4600615a547SMatt Jacob #define CT_SENDRDP	0x04000000	/* bit 26, Send Restore Pointers msg */
4610615a547SMatt Jacob #define CT_SENDSTATUS	0x80000000	/* bit 31, Send SCSI status byte */
4620615a547SMatt Jacob 
4630615a547SMatt Jacob /*
4640615a547SMatt Jacob  * ct_status values
4650615a547SMatt Jacob  * - set by the firmware when it returns the CTIO
4660615a547SMatt Jacob  */
4670615a547SMatt Jacob #define CT_OK		0x01	/* completed without error */
4680615a547SMatt Jacob #define CT_ABORTED	0x02	/* aborted by host */
4690615a547SMatt Jacob #define CT_ERR		0x04	/* see sense data for error */
4700615a547SMatt Jacob #define CT_INVAL	0x06	/* request for disabled lun */
4710615a547SMatt Jacob #define CT_NOPATH	0x07	/* invalid ITL nexus */
4720615a547SMatt Jacob #define	CT_INVRXID	0x08	/* (FC only) Invalid RX_ID */
4735d571944SMatt Jacob #define	CT_DATA_OVER	0x09	/* (FC only) Data Overrun */
4740615a547SMatt Jacob #define CT_RSELTMO	0x0A	/* reselection timeout after 2 tries */
4750615a547SMatt Jacob #define CT_TIMEOUT	0x0B	/* timed out */
4760615a547SMatt Jacob #define CT_RESET	0x0E	/* SCSI Bus Reset occurred */
477482cf5c2SMatt Jacob #define	CT_PARITY	0x0F	/* Uncorrectable Parity Error */
4785d571944SMatt Jacob #define	CT_BUS_ERROR	0x10	/* (FC Only) DMA PCI Error */
479482cf5c2SMatt Jacob #define	CT_PANIC	0x13	/* Unrecoverable Error */
4800615a547SMatt Jacob #define CT_PHASE_ERROR	0x14	/* Bus phase sequence error */
4810615a547SMatt Jacob #define CT_BDR_MSG	0x17	/* Bus Device Reset msg received */
4825d571944SMatt Jacob #define	CT_DATA_UNDER	0x15	/* (FC only) Data Underrun */
4830615a547SMatt Jacob #define CT_TERMINATED	0x19	/* due to Terminate Transfer mbox cmd */
4840615a547SMatt Jacob #define	CT_PORTNOTAVAIL	0x28	/* port not available */
4850615a547SMatt Jacob #define	CT_LOGOUT	0x29	/* port logout */
4860615a547SMatt Jacob #define	CT_PORTCHANGED	0x2A	/* port changed */
487482cf5c2SMatt Jacob #define	CT_IDE		0x33	/* Initiator Detected Error */
4880615a547SMatt Jacob #define CT_NOACK	0x35	/* Outstanding Immed. Notify. entry */
489e5265237SMatt Jacob #define	CT_SRR		0x45	/* SRR Received */
490e5265237SMatt Jacob #define	CT_LUN_RESET	0x48	/* Lun Reset Received */
4910615a547SMatt Jacob 
4920615a547SMatt Jacob /*
4930615a547SMatt Jacob  * When the firmware returns a CTIO entry, it may overwrite the last
4940615a547SMatt Jacob  * part of the structure with sense data. This starts at offset 0x2E
4950615a547SMatt Jacob  * into the entry, which is in the middle of ct_dataseg[1]. Rather
4960615a547SMatt Jacob  * than define a new struct for this, I'm just using the sense data
4970615a547SMatt Jacob  * offset.
4980615a547SMatt Jacob  */
4990615a547SMatt Jacob #define CTIO_SENSE_OFFSET	0x2E
5000615a547SMatt Jacob 
5010615a547SMatt Jacob /*
5020615a547SMatt Jacob  * Entry length in u_longs. All entries are the same size so
5030615a547SMatt Jacob  * any one will do as the numerator.
5040615a547SMatt Jacob  */
5050615a547SMatt Jacob #define UINT32_ENTRY_SIZE	(sizeof(at_entry_t)/sizeof(u_int32_t))
5060615a547SMatt Jacob 
5070615a547SMatt Jacob /*
5080615a547SMatt Jacob  * QLA2100 CTIO (type 2) entry
5090615a547SMatt Jacob  */
5100615a547SMatt Jacob #define	MAXRESPLEN	26
5110615a547SMatt Jacob typedef struct {
5120615a547SMatt Jacob 	isphdr_t	ct_header;
5135f5aafe1SMatt Jacob 	u_int16_t	ct_reserved;
5145f5aafe1SMatt Jacob 	u_int16_t	ct_fwhandle;	/* just to match CTIO */
5150615a547SMatt Jacob 	u_int8_t	ct_lun;		/* lun */
5160615a547SMatt Jacob 	u_int8_t	ct_iid;		/* initiator id */
5170615a547SMatt Jacob 	u_int16_t	ct_rxid;	/* response ID */
5180615a547SMatt Jacob 	u_int16_t	ct_flags;
5190615a547SMatt Jacob 	u_int16_t 	ct_status;	/* isp status */
5200615a547SMatt Jacob 	u_int16_t	ct_timeout;
5210615a547SMatt Jacob 	u_int16_t	ct_seg_count;
5220615a547SMatt Jacob 	u_int32_t	ct_reloff;	/* relative offset */
523427469a4SMatt Jacob 	int32_t		ct_resid;	/* residual length */
5240615a547SMatt Jacob 	union {
5250615a547SMatt Jacob 		/*
5260615a547SMatt Jacob 		 * The three different modes that the target driver
5274fd13c1bSMatt Jacob 		 * can set the CTIO{2,3,4} up as.
5280615a547SMatt Jacob 		 *
5290615a547SMatt Jacob 		 * The first is for sending FCP_DATA_IUs as well as
5300615a547SMatt Jacob 		 * (optionally) sending a terminal SCSI status FCP_RSP_IU.
5310615a547SMatt Jacob 		 *
5320615a547SMatt Jacob 		 * The second is for sending SCSI sense data in an FCP_RSP_IU.
5330615a547SMatt Jacob 		 * Note that no FCP_DATA_IUs will be sent.
5340615a547SMatt Jacob 		 *
5350615a547SMatt Jacob 		 * The third is for sending FCP_RSP_IUs as built specifically
5360615a547SMatt Jacob 		 * in system memory as located by the isp_dataseg.
5370615a547SMatt Jacob 		 */
5380615a547SMatt Jacob 		struct {
5390615a547SMatt Jacob 			u_int32_t _reserved;
5400615a547SMatt Jacob 			u_int16_t _reserved2;
5410615a547SMatt Jacob 			u_int16_t ct_scsi_status;
5420615a547SMatt Jacob 			u_int32_t ct_xfrlen;
5434fd13c1bSMatt Jacob 			union {
5444fd13c1bSMatt Jacob 				ispds_t ct_a[ISP_RQDSEG_T2];	/* CTIO2 */
5454fd13c1bSMatt Jacob 				ispds64_t ct_b[ISP_RQDSEG_T3];	/* CTIO3 */
5464fd13c1bSMatt Jacob 				ispdslist_t ct_c;		/* CTIO4 */
5474fd13c1bSMatt Jacob 			} _u;
5484fd13c1bSMatt Jacob #define	ct_dataseg	_u.ct_a
5494fd13c1bSMatt Jacob #define	ct_dataseg64	_u.ct_b
5504fd13c1bSMatt Jacob #define	ct_dslist	_u.ct_c
5510615a547SMatt Jacob 		} m0;
5520615a547SMatt Jacob 		struct {
5530615a547SMatt Jacob 			u_int16_t _reserved;
5540615a547SMatt Jacob 			u_int16_t _reserved2;
5550615a547SMatt Jacob 			u_int16_t ct_senselen;
5560615a547SMatt Jacob 			u_int16_t ct_scsi_status;
5570615a547SMatt Jacob 			u_int16_t ct_resplen;
5580615a547SMatt Jacob 			u_int8_t  ct_resp[MAXRESPLEN];
5590615a547SMatt Jacob 		} m1;
5600615a547SMatt Jacob 		struct {
5610615a547SMatt Jacob 			u_int32_t _reserved;
5620615a547SMatt Jacob 			u_int16_t _reserved2;
5630615a547SMatt Jacob 			u_int16_t _reserved3;
5640615a547SMatt Jacob 			u_int32_t ct_datalen;
5650615a547SMatt Jacob 			ispds_t ct_fcp_rsp_iudata;
5660615a547SMatt Jacob 		} m2;
5670615a547SMatt Jacob 	} rsp;
5680615a547SMatt Jacob } ct2_entry_t;
5690615a547SMatt Jacob 
570e5265237SMatt Jacob typedef struct {
571e5265237SMatt Jacob 	isphdr_t	ct_header;
572e5265237SMatt Jacob 	u_int16_t	ct_reserved;
573e5265237SMatt Jacob 	u_int16_t	ct_fwhandle;	/* just to match CTIO */
574e5265237SMatt Jacob 	u_int16_t	ct_iid;		/* initiator id */
575e5265237SMatt Jacob 	u_int16_t	ct_rxid;	/* response ID */
576e5265237SMatt Jacob 	u_int16_t	ct_flags;
577e5265237SMatt Jacob 	u_int16_t 	ct_status;	/* isp status */
578e5265237SMatt Jacob 	u_int16_t	ct_timeout;
579e5265237SMatt Jacob 	u_int16_t	ct_seg_count;
580e5265237SMatt Jacob 	u_int32_t	ct_reloff;	/* relative offset */
581e5265237SMatt Jacob 	int32_t		ct_resid;	/* residual length */
582e5265237SMatt Jacob 	union {
583e5265237SMatt Jacob 		struct {
584e5265237SMatt Jacob 			u_int32_t _reserved;
585e5265237SMatt Jacob 			u_int16_t _reserved2;
586e5265237SMatt Jacob 			u_int16_t ct_scsi_status;
587e5265237SMatt Jacob 			u_int32_t ct_xfrlen;
588e5265237SMatt Jacob 			union {
589e5265237SMatt Jacob 				ispds_t ct_a[ISP_RQDSEG_T2];	/* CTIO2 */
590e5265237SMatt Jacob 				ispds64_t ct_b[ISP_RQDSEG_T3];	/* CTIO3 */
591e5265237SMatt Jacob 				ispdslist_t ct_c;		/* CTIO4 */
592e5265237SMatt Jacob 			} _u;
593e5265237SMatt Jacob 		} m0;
594e5265237SMatt Jacob 		struct {
595e5265237SMatt Jacob 			u_int16_t _reserved;
596e5265237SMatt Jacob 			u_int16_t _reserved2;
597e5265237SMatt Jacob 			u_int16_t ct_senselen;
598e5265237SMatt Jacob 			u_int16_t ct_scsi_status;
599e5265237SMatt Jacob 			u_int16_t ct_resplen;
600e5265237SMatt Jacob 			u_int8_t  ct_resp[MAXRESPLEN];
601e5265237SMatt Jacob 		} m1;
602e5265237SMatt Jacob 		struct {
603e5265237SMatt Jacob 			u_int32_t _reserved;
604e5265237SMatt Jacob 			u_int16_t _reserved2;
605e5265237SMatt Jacob 			u_int16_t _reserved3;
606e5265237SMatt Jacob 			u_int32_t ct_datalen;
607e5265237SMatt Jacob 			ispds_t ct_fcp_rsp_iudata;
608e5265237SMatt Jacob 		} m2;
609e5265237SMatt Jacob 	} rsp;
610e5265237SMatt Jacob } ct2e_entry_t;
611e5265237SMatt Jacob 
6120615a547SMatt Jacob /*
6130615a547SMatt Jacob  * ct_flags values for CTIO2
6140615a547SMatt Jacob  */
6150615a547SMatt Jacob #define	CT2_FLAG_MMASK	0x0003
6160615a547SMatt Jacob #define	CT2_FLAG_MODE0	0x0000
6170615a547SMatt Jacob #define	CT2_FLAG_MODE1	0x0001
6180615a547SMatt Jacob #define	CT2_FLAG_MODE2	0x0002
6190615a547SMatt Jacob #define CT2_DATA_IN	CT_DATA_IN
6200615a547SMatt Jacob #define CT2_DATA_OUT	CT_DATA_OUT
6210615a547SMatt Jacob #define CT2_NO_DATA	CT_NO_DATA
6220615a547SMatt Jacob #define CT2_DATAMASK	CT_DATAMASK
6230615a547SMatt Jacob #define	CT2_CCINCR	0x0100
6240615a547SMatt Jacob #define	CT2_FASTPOST	0x0200
6252f9e7606SMatt Jacob #define	CT2_TERMINATE	0x4000
6260615a547SMatt Jacob #define CT2_SENDSTATUS	0x8000
6270615a547SMatt Jacob 
6280615a547SMatt Jacob /*
6290615a547SMatt Jacob  * ct_status values are (mostly) the same as that for ct_entry.
6300615a547SMatt Jacob  */
6310615a547SMatt Jacob 
6320615a547SMatt Jacob /*
6330615a547SMatt Jacob  * ct_scsi_status values- the low 8 bits are the normal SCSI status
6340615a547SMatt Jacob  * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
6350615a547SMatt Jacob  * fields.
6360615a547SMatt Jacob  */
6370615a547SMatt Jacob #define	CT2_RSPLEN_VALID	0x0100
6380615a547SMatt Jacob #define	CT2_SNSLEN_VALID	0x0200
6390615a547SMatt Jacob #define	CT2_DATA_OVER		0x0400
6400615a547SMatt Jacob #define	CT2_DATA_UNDER		0x0800
6410615a547SMatt Jacob 
6420615a547SMatt Jacob /*
6430615a547SMatt Jacob  * Debug macros
6440615a547SMatt Jacob  */
6450615a547SMatt Jacob 
6460615a547SMatt Jacob #define	ISP_TDQE(isp, msg, idx, arg)	\
64769fbe07aSMatt Jacob     if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
6480615a547SMatt Jacob 
6490615a547SMatt Jacob /*
6504fd13c1bSMatt Jacob  * The functions below are for the publicly available
6514fd13c1bSMatt Jacob  * target mode functions that are internal to the Qlogic driver.
6520615a547SMatt Jacob  */
6530615a547SMatt Jacob 
6540615a547SMatt Jacob /*
6550615a547SMatt Jacob  * This function handles new response queue entry appropriate for target mode.
6560615a547SMatt Jacob  */
657b5da7b23SMatt Jacob int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
6580615a547SMatt Jacob 
6590615a547SMatt Jacob /*
660e5265237SMatt Jacob  * This function externalizes the ability to acknowledge an Immediate Notify
661e5265237SMatt Jacob  * request.
662e5265237SMatt Jacob  */
663e5265237SMatt Jacob void isp_notify_ack(struct ispsoftc *, void *);
664e5265237SMatt Jacob 
665e5265237SMatt Jacob /*
6660615a547SMatt Jacob  * Enable/Disable/Modify a logical unit.
6675d571944SMatt Jacob  * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
6680615a547SMatt Jacob  */
6699dba6a4eSMatt Jacob #define	DFLT_CMND_CNT	0xfe	/* unmonitored */
6709dba6a4eSMatt Jacob #define	DFLT_INOT_CNT	16
6715d571944SMatt Jacob int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
6720615a547SMatt Jacob 
6730615a547SMatt Jacob /*
6740615a547SMatt Jacob  * General request queue 'put' routine for target mode entries.
6750615a547SMatt Jacob  */
676b5da7b23SMatt Jacob int isp_target_put_entry(struct ispsoftc *isp, void *);
6770615a547SMatt Jacob 
6780615a547SMatt Jacob /*
6790615a547SMatt Jacob  * General routine to put back an ATIO entry-
6800615a547SMatt Jacob  * used for replenishing f/w resource counts.
681b5da7b23SMatt Jacob  * The argument is a pointer to a source ATIO
682b5da7b23SMatt Jacob  * or ATIO2.
6830615a547SMatt Jacob  */
684b5da7b23SMatt Jacob int isp_target_put_atio(struct ispsoftc *, void *);
6850615a547SMatt Jacob 
6860615a547SMatt Jacob /*
6870615a547SMatt Jacob  * General routine to send a final CTIO for a command- used mostly for
6880615a547SMatt Jacob  * local responses.
6890615a547SMatt Jacob  */
690b5da7b23SMatt Jacob int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
691427469a4SMatt Jacob #define	ECMD_SVALID	0x100
6920615a547SMatt Jacob 
6930615a547SMatt Jacob /*
6940615a547SMatt Jacob  * Handle an asynchronous event
6959dba6a4eSMatt Jacob  *
6969dba6a4eSMatt Jacob  * Return nonzero if the interrupt that generated this event has been dismissed.
6970615a547SMatt Jacob  */
6989dba6a4eSMatt Jacob int isp_target_async(struct ispsoftc *, int, int);
699e5265237SMatt Jacob 
700f5a44627SMatt Jacob #endif	/* _ISP_TARGET_H */
701