isp_target.h revision 196008
155372Smjacob/* $FreeBSD: head/sys/dev/isp/isp_target.h 196008 2009-08-01 01:04:26Z mjacob $ */ 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, 53196008Smjacob NT_ARRIVED, 54196008Smjacob NT_DEPARTED, 55196008Smjacob NT_HBA_RESET 56196008Smjacob} isp_ncode_t; 5755372Smjacob 58196008Smjacobtypedef struct isp_notify { 59196008Smjacob void * nt_hba; /* HBA tag */ 60196008Smjacob void * nt_tmd; 61196008Smjacob void * nt_lreserved; 62196008Smjacob void * nt_hreserved; 63196008Smjacob uint64_t nt_wwn; /* source (wwn) */ 64196008Smjacob uint64_t nt_tgt; /* destination (wwn) */ 65196008Smjacob uint64_t nt_tagval; /* tag value */ 66196008Smjacob uint32_t 67196008Smjacob nt_sid : 24; /* source port id */ 68196008Smjacob uint32_t 69196008Smjacob nt_failed : 1, /* notify operation failed */ 70196008Smjacob nt_need_ack : 1, /* this notify needs an ACK */ 71196008Smjacob nt_did : 24; /* destination port id */ 72196008Smjacob uint32_t 73196008Smjacob nt_lun : 16, /* logical unit */ 74196008Smjacob nt_nphdl : 16; /* n-port handle */ 75196008Smjacob uint8_t nt_channel; /* channel id */ 76196008Smjacob isp_ncode_t nt_ncode; /* action */ 77196008Smjacob} isp_notify_t; 78196008Smjacob#define MATCH_TMD(tmd, iid, lun, tag) \ 79196008Smjacob ( \ 80196008Smjacob (tmd) && \ 81196008Smjacob (iid == INI_ANY || iid == tmd->cd_iid) && \ 82196008Smjacob (lun == LUN_ANY || lun == tmd->cd_lun) && \ 83196008Smjacob (tag == TAG_ANY || tag == tmd->cd_tagval) \ 84196008Smjacob ) 8555372Smjacob/* 8655372Smjacob * Debug macros 8755372Smjacob */ 8855372Smjacob 8955372Smjacob#define ISP_TDQE(isp, msg, idx, arg) \ 9064089Smjacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 9155372Smjacob 9255372Smjacob/* 93196008Smjacob * Special Constatns 9455372Smjacob */ 95196008Smjacob#define INI_ANY ((uint64_t) -1) 96196008Smjacob#define VALID_INI(ini) (ini != INI_NONE && ini != INI_ANY) 97196008Smjacob#define LUN_ANY 0xffff 98196008Smjacob#define TGT_ANY ((uint64_t) -1) 99196008Smjacob#define TAG_ANY ((uint64_t) 0) 10074231Smjacob#endif /* _ISP_TARGET_H */ 101