xref: /freebsd/sys/dev/isp/isp_target.h (revision 718cf2ccb9956613756ab15d7a0e28f2c8e91cab)
10615a547SMatt Jacob /* $FreeBSD$ */
2098ca2bdSWarner Losh /*-
3*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4*718cf2ccSPedro F. Giffuni  *
52df76c16SMatt Jacob  *  Copyright (c) 1997-2009 by Matthew Jacob
60615a547SMatt Jacob  *  All rights reserved.
70615a547SMatt Jacob  *
80615a547SMatt Jacob  *  Redistribution and use in source and binary forms, with or without
90615a547SMatt Jacob  *  modification, are permitted provided that the following conditions
100615a547SMatt Jacob  *  are met:
110615a547SMatt Jacob  *
12e48b2487SMatt Jacob  *  1. Redistributions of source code must retain the above copyright
13e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer.
14e48b2487SMatt Jacob  *  2. Redistributions in binary form must reproduce the above copyright
15e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer in the
16e48b2487SMatt Jacob  *     documentation and/or other materials provided with the distribution.
17e48b2487SMatt Jacob  *
18e48b2487SMatt Jacob  *  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
190615a547SMatt Jacob  *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
200615a547SMatt Jacob  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21e48b2487SMatt Jacob  *  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
22e48b2487SMatt Jacob  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
230615a547SMatt Jacob  *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24e5265237SMatt Jacob  *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25e5265237SMatt Jacob  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
260615a547SMatt Jacob  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
270615a547SMatt Jacob  *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
280615a547SMatt Jacob  *  SUCH DAMAGE.
292df76c16SMatt Jacob  *
30e48b2487SMatt Jacob  */
31e48b2487SMatt Jacob /*
32e48b2487SMatt Jacob  * Qlogic Target Mode Structure and Flag Definitions
330615a547SMatt Jacob  */
34f5a44627SMatt Jacob #ifndef	_ISP_TARGET_H
35f5a44627SMatt Jacob #define	_ISP_TARGET_H
360615a547SMatt Jacob 
370615a547SMatt Jacob /*
382df76c16SMatt Jacob  * Notify structure- these are for asynchronous events that need to be sent
392df76c16SMatt Jacob  * as notifications to the outer layer. It should be pretty self-explanatory.
400615a547SMatt Jacob  */
412df76c16SMatt Jacob typedef enum {
422df76c16SMatt Jacob 	NT_UNKNOWN=0x999,
432df76c16SMatt Jacob 	NT_ABORT_TASK=0x1000,
442df76c16SMatt Jacob 	NT_ABORT_TASK_SET,
452df76c16SMatt Jacob 	NT_CLEAR_ACA,
462df76c16SMatt Jacob 	NT_CLEAR_TASK_SET,
472df76c16SMatt Jacob 	NT_LUN_RESET,
482df76c16SMatt Jacob 	NT_TARGET_RESET,
492df76c16SMatt Jacob 	NT_BUS_RESET,
502df76c16SMatt Jacob 	NT_LIP_RESET,
512df76c16SMatt Jacob 	NT_LINK_UP,
522df76c16SMatt Jacob 	NT_LINK_DOWN,
532df76c16SMatt Jacob 	NT_LOGOUT,
542df76c16SMatt Jacob 	NT_GLOBAL_LOGOUT,
55387d8239SMatt Jacob 	NT_CHANGED,
56c98d2b1fSAlexander Motin 	NT_HBA_RESET,
57c98d2b1fSAlexander Motin 	NT_QUERY_TASK_SET,
585a5632c2SAlexander Motin 	NT_QUERY_ASYNC_EVENT,
595a5632c2SAlexander Motin 	NT_SRR			/* Sequence Retransmission Request */
602df76c16SMatt Jacob } isp_ncode_t;
610615a547SMatt Jacob 
622df76c16SMatt Jacob typedef struct isp_notify {
632df76c16SMatt Jacob 	void *		nt_hba;		/* HBA tag */
64a41dd87fSAlexander Motin 	void *		nt_lreserved;	/* original IOCB pointer */
652df76c16SMatt Jacob 	uint64_t	nt_wwn;		/* source (wwn) */
662df76c16SMatt Jacob 	uint64_t	nt_tgt;		/* destination (wwn) */
672df76c16SMatt Jacob 	uint64_t	nt_tagval;	/* tag value */
6815c62456SAlexander Motin 	lun_id_t	nt_lun;		/* logical unit */
69a41dd87fSAlexander Motin 	uint32_t	nt_sid : 24;	/* source port id */
70a41dd87fSAlexander Motin 	uint32_t	nt_did : 24;	/* destination port id */
7115c62456SAlexander Motin 	uint16_t	nt_nphdl;	/* n-port handle */
722df76c16SMatt Jacob 	uint8_t		nt_channel;	/* channel id */
73a41dd87fSAlexander Motin 	uint8_t		nt_need_ack;	/* this notify needs an ACK */
742df76c16SMatt Jacob 	isp_ncode_t	nt_ncode;	/* action */
752df76c16SMatt Jacob } isp_notify_t;
76a41dd87fSAlexander Motin 
7710365e5aSMatt Jacob /*
780615a547SMatt Jacob  * Debug macros
790615a547SMatt Jacob  */
800615a547SMatt Jacob 
810615a547SMatt Jacob #define	ISP_TDQE(isp, msg, idx, arg)	\
8269fbe07aSMatt Jacob     if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
830615a547SMatt Jacob 
840615a547SMatt Jacob /*
852df76c16SMatt Jacob  * Special Constatns
860615a547SMatt Jacob  */
872df76c16SMatt Jacob #define INI_ANY			((uint64_t) -1)
882df76c16SMatt Jacob #define VALID_INI(ini)		(ini != INI_NONE && ini != INI_ANY)
892df76c16SMatt Jacob #define LUN_ANY     		0xffff
902df76c16SMatt Jacob #define TGT_ANY     		((uint64_t) -1)
912df76c16SMatt Jacob #define TAG_ANY     		((uint64_t) 0)
92f5a44627SMatt Jacob #endif	/* _ISP_TARGET_H */
93