155372Smjacob/* $FreeBSD: releng/10.3/sys/dev/isp/isp_target.h 290775 2015-11-13 19:23:22Z mav $ */ 2139749Simp/*- 3196008Smjacob * Copyright (c) 1997-2009 by Matthew Jacob 4167403Smjacob * All rights reserved. 5167403Smjacob * 6167403Smjacob * Redistribution and use in source and binary forms, with or without 7167403Smjacob * modification, are permitted provided that the following conditions 8167403Smjacob * are met: 9167403Smjacob * 10167403Smjacob * 1. Redistributions of source code must retain the above copyright 11167403Smjacob * notice, this list of conditions and the following disclaimer. 12167403Smjacob * 2. Redistributions in binary form must reproduce the above copyright 13167403Smjacob * notice, this list of conditions and the following disclaimer in the 14167403Smjacob * documentation and/or other materials provided with the distribution. 15167403Smjacob * 16167403Smjacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17167403Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18167403Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19167403Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20167403Smjacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21167403Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22167403Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23167403Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24167403Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25167403Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26167403Smjacob * SUCH DAMAGE. 27196008Smjacob * 28167403Smjacob */ 29167403Smjacob/* 3055372Smjacob * Qlogic Target Mode Structure and Flag Definitions 3155372Smjacob */ 3274231Smjacob#ifndef _ISP_TARGET_H 3374231Smjacob#define _ISP_TARGET_H 3455372Smjacob 3555372Smjacob/* 36196008Smjacob * Notify structure- these are for asynchronous events that need to be sent 37196008Smjacob * as notifications to the outer layer. It should be pretty self-explanatory. 3855372Smjacob */ 39196008Smjacobtypedef enum { 40196008Smjacob NT_UNKNOWN=0x999, 41196008Smjacob NT_ABORT_TASK=0x1000, 42196008Smjacob NT_ABORT_TASK_SET, 43196008Smjacob NT_CLEAR_ACA, 44196008Smjacob NT_CLEAR_TASK_SET, 45196008Smjacob NT_LUN_RESET, 46196008Smjacob NT_TARGET_RESET, 47196008Smjacob NT_BUS_RESET, 48196008Smjacob NT_LIP_RESET, 49196008Smjacob NT_LINK_UP, 50196008Smjacob NT_LINK_DOWN, 51196008Smjacob NT_LOGOUT, 52196008Smjacob NT_GLOBAL_LOGOUT, 53238869Smjacob NT_CHANGED, 54290775Smav NT_HBA_RESET, 55290775Smav NT_QUERY_TASK_SET, 56290775Smav NT_QUERY_ASYNC_EVENT 57196008Smjacob} isp_ncode_t; 5855372Smjacob 59196008Smjacobtypedef struct isp_notify { 60196008Smjacob void * nt_hba; /* HBA tag */ 61196008Smjacob void * nt_tmd; 62196008Smjacob void * nt_lreserved; 63196008Smjacob void * nt_hreserved; 64196008Smjacob uint64_t nt_wwn; /* source (wwn) */ 65196008Smjacob uint64_t nt_tgt; /* destination (wwn) */ 66196008Smjacob uint64_t nt_tagval; /* tag value */ 67196008Smjacob uint32_t 68196008Smjacob nt_sid : 24; /* source port id */ 69196008Smjacob uint32_t 70196008Smjacob nt_failed : 1, /* notify operation failed */ 71196008Smjacob nt_need_ack : 1, /* this notify needs an ACK */ 72196008Smjacob nt_did : 24; /* destination port id */ 73196008Smjacob uint32_t 74196008Smjacob nt_lun : 16, /* logical unit */ 75196008Smjacob nt_nphdl : 16; /* n-port handle */ 76196008Smjacob uint8_t nt_channel; /* channel id */ 77196008Smjacob isp_ncode_t nt_ncode; /* action */ 78196008Smjacob} isp_notify_t; 79196008Smjacob#define MATCH_TMD(tmd, iid, lun, tag) \ 80196008Smjacob ( \ 81196008Smjacob (tmd) && \ 82196008Smjacob (iid == INI_ANY || iid == tmd->cd_iid) && \ 83196008Smjacob (lun == LUN_ANY || lun == tmd->cd_lun) && \ 84196008Smjacob (tag == TAG_ANY || tag == tmd->cd_tagval) \ 85196008Smjacob ) 8655372Smjacob/* 8755372Smjacob * Debug macros 8855372Smjacob */ 8955372Smjacob 9055372Smjacob#define ISP_TDQE(isp, msg, idx, arg) \ 9164089Smjacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 9255372Smjacob 9355372Smjacob/* 94196008Smjacob * Special Constatns 9555372Smjacob */ 96196008Smjacob#define INI_ANY ((uint64_t) -1) 97196008Smjacob#define VALID_INI(ini) (ini != INI_NONE && ini != INI_ANY) 98196008Smjacob#define LUN_ANY 0xffff 99196008Smjacob#define TGT_ANY ((uint64_t) -1) 100196008Smjacob#define TAG_ANY ((uint64_t) 0) 10174231Smjacob#endif /* _ISP_TARGET_H */ 102