xref: /freebsd/sys/dev/isp/isp_target.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1098ca2bdSWarner Losh /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
42df76c16SMatt Jacob  *  Copyright (c) 1997-2009 by Matthew Jacob
50615a547SMatt Jacob  *  All rights reserved.
60615a547SMatt Jacob  *
70615a547SMatt Jacob  *  Redistribution and use in source and binary forms, with or without
80615a547SMatt Jacob  *  modification, are permitted provided that the following conditions
90615a547SMatt Jacob  *  are met:
100615a547SMatt Jacob  *
11e48b2487SMatt Jacob  *  1. Redistributions of source code must retain the above copyright
12e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer.
13e48b2487SMatt Jacob  *  2. Redistributions in binary form must reproduce the above copyright
14e48b2487SMatt Jacob  *     notice, this list of conditions and the following disclaimer in the
15e48b2487SMatt Jacob  *     documentation and/or other materials provided with the distribution.
16e48b2487SMatt Jacob  *
17e48b2487SMatt Jacob  *  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
180615a547SMatt Jacob  *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
190615a547SMatt Jacob  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20e48b2487SMatt Jacob  *  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21e48b2487SMatt Jacob  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
220615a547SMatt Jacob  *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23e5265237SMatt Jacob  *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24e5265237SMatt Jacob  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
250615a547SMatt Jacob  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
260615a547SMatt Jacob  *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
270615a547SMatt Jacob  *  SUCH DAMAGE.
282df76c16SMatt Jacob  *
29e48b2487SMatt Jacob  */
30e48b2487SMatt Jacob /*
31e48b2487SMatt Jacob  * Qlogic Target Mode Structure and Flag Definitions
320615a547SMatt Jacob  */
33f5a44627SMatt Jacob #ifndef	_ISP_TARGET_H
34f5a44627SMatt Jacob #define	_ISP_TARGET_H
350615a547SMatt Jacob 
360615a547SMatt Jacob /*
372df76c16SMatt Jacob  * Notify structure- these are for asynchronous events that need to be sent
382df76c16SMatt Jacob  * as notifications to the outer layer. It should be pretty self-explanatory.
390615a547SMatt Jacob  */
402df76c16SMatt Jacob typedef enum {
412df76c16SMatt Jacob 	NT_UNKNOWN=0x999,
422df76c16SMatt Jacob 	NT_ABORT_TASK=0x1000,
432df76c16SMatt Jacob 	NT_ABORT_TASK_SET,
442df76c16SMatt Jacob 	NT_CLEAR_ACA,
452df76c16SMatt Jacob 	NT_CLEAR_TASK_SET,
462df76c16SMatt Jacob 	NT_LUN_RESET,
472df76c16SMatt Jacob 	NT_TARGET_RESET,
482df76c16SMatt Jacob 	NT_LIP_RESET,
492df76c16SMatt Jacob 	NT_LINK_UP,
502df76c16SMatt Jacob 	NT_LINK_DOWN,
51c98d2b1fSAlexander Motin 	NT_HBA_RESET,
52c98d2b1fSAlexander Motin 	NT_QUERY_TASK_SET,
535a5632c2SAlexander Motin 	NT_QUERY_ASYNC_EVENT,
545a5632c2SAlexander Motin 	NT_SRR			/* Sequence Retransmission Request */
552df76c16SMatt Jacob } isp_ncode_t;
560615a547SMatt Jacob 
572df76c16SMatt Jacob typedef struct isp_notify {
582df76c16SMatt Jacob 	void *		nt_hba;		/* HBA tag */
59a41dd87fSAlexander Motin 	void *		nt_lreserved;	/* original IOCB pointer */
602df76c16SMatt Jacob 	uint64_t	nt_wwn;		/* source (wwn) */
612df76c16SMatt Jacob 	uint64_t	nt_tgt;		/* destination (wwn) */
622df76c16SMatt Jacob 	uint64_t	nt_tagval;	/* tag value */
6315c62456SAlexander Motin 	lun_id_t	nt_lun;		/* logical unit */
64a41dd87fSAlexander Motin 	uint32_t	nt_sid : 24;	/* source port id */
65a41dd87fSAlexander Motin 	uint32_t	nt_did : 24;	/* destination port id */
6615c62456SAlexander Motin 	uint16_t	nt_nphdl;	/* n-port handle */
672df76c16SMatt Jacob 	uint8_t		nt_channel;	/* channel id */
68a41dd87fSAlexander Motin 	uint8_t		nt_need_ack;	/* this notify needs an ACK */
692df76c16SMatt Jacob 	isp_ncode_t	nt_ncode;	/* action */
702df76c16SMatt Jacob } isp_notify_t;
71a41dd87fSAlexander Motin 
7210365e5aSMatt Jacob /*
73*d3367c35SGordon Bergling  * Special Constants
740615a547SMatt Jacob  */
752df76c16SMatt Jacob #define INI_ANY			((uint64_t) -1)
762df76c16SMatt Jacob #define VALID_INI(ini)		(ini != INI_NONE && ini != INI_ANY)
772df76c16SMatt Jacob #define LUN_ANY     		0xffff
782df76c16SMatt Jacob #define TGT_ANY     		((uint64_t) -1)
792df76c16SMatt Jacob #define TAG_ANY     		((uint64_t) 0)
80f5a44627SMatt Jacob #endif	/* _ISP_TARGET_H */
81