10615a547SMatt Jacob /* $FreeBSD$ */ 2098ca2bdSWarner Losh /*- 32df76c16SMatt Jacob * Copyright (c) 1997-2009 by Matthew Jacob 40615a547SMatt Jacob * All rights reserved. 50615a547SMatt Jacob * 60615a547SMatt Jacob * Redistribution and use in source and binary forms, with or without 70615a547SMatt Jacob * modification, are permitted provided that the following conditions 80615a547SMatt Jacob * are met: 90615a547SMatt Jacob * 10e48b2487SMatt Jacob * 1. Redistributions of source code must retain the above copyright 11e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer. 12e48b2487SMatt Jacob * 2. Redistributions in binary form must reproduce the above copyright 13e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer in the 14e48b2487SMatt Jacob * documentation and/or other materials provided with the distribution. 15e48b2487SMatt Jacob * 16e48b2487SMatt Jacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 170615a547SMatt Jacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 180615a547SMatt Jacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19e48b2487SMatt Jacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20e48b2487SMatt Jacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 210615a547SMatt Jacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22e5265237SMatt Jacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23e5265237SMatt Jacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 240615a547SMatt Jacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 250615a547SMatt Jacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 260615a547SMatt Jacob * SUCH DAMAGE. 272df76c16SMatt Jacob * 28e48b2487SMatt Jacob */ 29e48b2487SMatt Jacob /* 30e48b2487SMatt Jacob * Qlogic Target Mode Structure and Flag Definitions 310615a547SMatt Jacob */ 32f5a44627SMatt Jacob #ifndef _ISP_TARGET_H 33f5a44627SMatt Jacob #define _ISP_TARGET_H 340615a547SMatt Jacob 350615a547SMatt Jacob /* 362df76c16SMatt Jacob * Notify structure- these are for asynchronous events that need to be sent 372df76c16SMatt Jacob * as notifications to the outer layer. It should be pretty self-explanatory. 380615a547SMatt Jacob */ 392df76c16SMatt Jacob typedef enum { 402df76c16SMatt Jacob NT_UNKNOWN=0x999, 412df76c16SMatt Jacob NT_ABORT_TASK=0x1000, 422df76c16SMatt Jacob NT_ABORT_TASK_SET, 432df76c16SMatt Jacob NT_CLEAR_ACA, 442df76c16SMatt Jacob NT_CLEAR_TASK_SET, 452df76c16SMatt Jacob NT_LUN_RESET, 462df76c16SMatt Jacob NT_TARGET_RESET, 472df76c16SMatt Jacob NT_BUS_RESET, 482df76c16SMatt Jacob NT_LIP_RESET, 492df76c16SMatt Jacob NT_LINK_UP, 502df76c16SMatt Jacob NT_LINK_DOWN, 512df76c16SMatt Jacob NT_LOGOUT, 522df76c16SMatt Jacob NT_GLOBAL_LOGOUT, 53387d8239SMatt Jacob NT_CHANGED, 54c98d2b1fSAlexander Motin NT_HBA_RESET, 55c98d2b1fSAlexander Motin NT_QUERY_TASK_SET, 565a5632c2SAlexander Motin NT_QUERY_ASYNC_EVENT, 575a5632c2SAlexander Motin NT_SRR /* Sequence Retransmission Request */ 582df76c16SMatt Jacob } isp_ncode_t; 590615a547SMatt Jacob 602df76c16SMatt Jacob typedef struct isp_notify { 612df76c16SMatt Jacob void * nt_hba; /* HBA tag */ 62*a41dd87fSAlexander Motin void * nt_lreserved; /* original IOCB pointer */ 632df76c16SMatt Jacob uint64_t nt_wwn; /* source (wwn) */ 642df76c16SMatt Jacob uint64_t nt_tgt; /* destination (wwn) */ 652df76c16SMatt Jacob uint64_t nt_tagval; /* tag value */ 6615c62456SAlexander Motin lun_id_t nt_lun; /* logical unit */ 67*a41dd87fSAlexander Motin uint32_t nt_sid : 24; /* source port id */ 68*a41dd87fSAlexander Motin uint32_t nt_did : 24; /* destination port id */ 6915c62456SAlexander Motin uint16_t nt_nphdl; /* n-port handle */ 702df76c16SMatt Jacob uint8_t nt_channel; /* channel id */ 71*a41dd87fSAlexander Motin uint8_t nt_need_ack; /* this notify needs an ACK */ 722df76c16SMatt Jacob isp_ncode_t nt_ncode; /* action */ 732df76c16SMatt Jacob } isp_notify_t; 74*a41dd87fSAlexander Motin 7510365e5aSMatt Jacob /* 760615a547SMatt Jacob * Debug macros 770615a547SMatt Jacob */ 780615a547SMatt Jacob 790615a547SMatt Jacob #define ISP_TDQE(isp, msg, idx, arg) \ 8069fbe07aSMatt Jacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 810615a547SMatt Jacob 820615a547SMatt Jacob /* 832df76c16SMatt Jacob * Special Constatns 840615a547SMatt Jacob */ 852df76c16SMatt Jacob #define INI_ANY ((uint64_t) -1) 862df76c16SMatt Jacob #define VALID_INI(ini) (ini != INI_NONE && ini != INI_ANY) 872df76c16SMatt Jacob #define LUN_ANY 0xffff 882df76c16SMatt Jacob #define TGT_ANY ((uint64_t) -1) 892df76c16SMatt Jacob #define TAG_ANY ((uint64_t) 0) 90f5a44627SMatt Jacob #endif /* _ISP_TARGET_H */ 91