1 1.27 andvar -/* $NetBSD: isp_target.h,v 1.27 2023/06/01 20:15:16 andvar Exp $ */ 2 1.25 mjacob /*- 3 1.25 mjacob * Copyright (c) 1997-2008 by Matthew Jacob 4 1.25 mjacob * All rights reserved. 5 1.25 mjacob * 6 1.25 mjacob * Redistribution and use in source and binary forms, with or without 7 1.25 mjacob * modification, are permitted provided that the following conditions 8 1.25 mjacob * are met: 9 1.25 mjacob * 10 1.25 mjacob * 1. Redistributions of source code must retain the above copyright 11 1.25 mjacob * notice, this list of conditions and the following disclaimer. 12 1.25 mjacob * 2. Redistributions in binary form must reproduce the above copyright 13 1.25 mjacob * notice, this list of conditions and the following disclaimer in the 14 1.25 mjacob * documentation and/or other materials provided with the distribution. 15 1.24 mjacob * 16 1.25 mjacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 1.25 mjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 1.25 mjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 1.25 mjacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20 1.25 mjacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 1.25 mjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 1.25 mjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 1.25 mjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 1.25 mjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 1.25 mjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 1.25 mjacob * SUCH DAMAGE. 27 1.24 mjacob * 28 1.24 mjacob */ 29 1.24 mjacob /* 30 1.24 mjacob * Qlogic Target Mode Structure and Flag Definitions 31 1.1 mjacob */ 32 1.11 mjacob #ifndef _ISP_TARGET_H 33 1.11 mjacob #define _ISP_TARGET_H 34 1.1 mjacob 35 1.1 mjacob /* 36 1.26 mjacob * Notify structure- these are for asynchronous events that need to be sent 37 1.26 mjacob * as notifications to the outer layer. It should be pretty self-explanatory. 38 1.1 mjacob */ 39 1.26 mjacob typedef enum { 40 1.26 mjacob NT_UNKNOWN=0x999, 41 1.26 mjacob NT_ABORT_TASK=0x1000, 42 1.26 mjacob NT_ABORT_TASK_SET, 43 1.26 mjacob NT_CLEAR_ACA, 44 1.26 mjacob NT_CLEAR_TASK_SET, 45 1.26 mjacob NT_LUN_RESET, 46 1.26 mjacob NT_TARGET_RESET, 47 1.26 mjacob NT_BUS_RESET, 48 1.26 mjacob NT_LIP_RESET, 49 1.26 mjacob NT_LINK_UP, 50 1.26 mjacob NT_LINK_DOWN, 51 1.26 mjacob NT_LOGOUT, 52 1.26 mjacob NT_GLOBAL_LOGOUT, 53 1.26 mjacob NT_ARRIVED, 54 1.26 mjacob NT_DEPARTED, 55 1.26 mjacob NT_HBA_RESET 56 1.26 mjacob } isp_ncode_t; 57 1.26 mjacob 58 1.26 mjacob typedef struct isp_notify { 59 1.26 mjacob void * nt_hba; /* HBA tag */ 60 1.26 mjacob void * nt_tmd; 61 1.26 mjacob void * nt_lreserved; 62 1.26 mjacob void * nt_hreserved; 63 1.26 mjacob uint64_t nt_wwn; /* source (wwn) */ 64 1.26 mjacob uint64_t nt_tgt; /* destination (wwn) */ 65 1.26 mjacob uint64_t nt_tagval; /* tag value */ 66 1.26 mjacob uint32_t 67 1.26 mjacob nt_sid : 24; /* source port id */ 68 1.26 mjacob uint32_t 69 1.26 mjacob nt_failed : 1, /* notify operation failed */ 70 1.26 mjacob nt_need_ack : 1, /* this notify needs an ACK */ 71 1.26 mjacob nt_did : 24; /* destination port id */ 72 1.26 mjacob uint32_t 73 1.26 mjacob nt_lun : 16, /* logical unit */ 74 1.26 mjacob nt_nphdl : 16; /* n-port handle */ 75 1.26 mjacob uint8_t nt_channel; /* channel id */ 76 1.26 mjacob isp_ncode_t nt_ncode; /* action */ 77 1.26 mjacob } isp_notify_t; 78 1.26 mjacob #define MATCH_TMD(tmd, iid, lun, tag) \ 79 1.26 mjacob ( \ 80 1.26 mjacob (tmd) && \ 81 1.26 mjacob (iid == INI_ANY || iid == tmd->cd_iid) && \ 82 1.26 mjacob (lun == LUN_ANY || lun == tmd->cd_lun) && \ 83 1.26 mjacob (tag == TAG_ANY || tag == tmd->cd_tagval) \ 84 1.26 mjacob ) 85 1.24 mjacob /* 86 1.1 mjacob * Debug macros 87 1.1 mjacob */ 88 1.1 mjacob 89 1.1 mjacob #define ISP_TDQE(isp, msg, idx, arg) \ 90 1.7 mjacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 91 1.1 mjacob 92 1.1 mjacob /* 93 1.27 andvar * Special Constants 94 1.1 mjacob */ 95 1.26 mjacob #define INI_ANY ((uint64_t) -1) 96 1.26 mjacob #define VALID_INI(ini) (ini != INI_NONE && ini != INI_ANY) 97 1.26 mjacob #define LUN_ANY 0xffff 98 1.26 mjacob #define TGT_ANY ((uint64_t) -1) 99 1.26 mjacob #define TAG_ANY ((uint64_t) 0) 100 1.11 mjacob #endif /* _ISP_TARGET_H */ 101