10615a547SMatt Jacob /* $FreeBSD$ */ 20615a547SMatt Jacob /* 30615a547SMatt Jacob * Qlogic Target Mode Structure and Flag Definitions 40615a547SMatt Jacob * 50615a547SMatt Jacob * Copyright (c) 1997, 1998 60615a547SMatt Jacob * Patrick Stirling 70615a547SMatt Jacob * pms@psconsult.com 80615a547SMatt Jacob * All rights reserved. 90615a547SMatt Jacob * 105f5aafe1SMatt Jacob * Additional Copyright (c) 1999, 2000, 2001 110615a547SMatt Jacob * Matthew Jacob 120615a547SMatt Jacob * mjacob@feral.com 130615a547SMatt Jacob * All rights reserved. 140615a547SMatt Jacob * 150615a547SMatt Jacob * 160615a547SMatt Jacob * Redistribution and use in source and binary forms, with or without 170615a547SMatt Jacob * modification, are permitted provided that the following conditions 180615a547SMatt Jacob * are met: 190615a547SMatt Jacob * 1. Redistributions of source code must retain the above copyright 200615a547SMatt Jacob * notice immediately at the beginning of the file, without modification, 210615a547SMatt Jacob * this list of conditions, and the following disclaimer. 22aa57fd6fSMatt Jacob * 2. The name of the author may not be used to endorse or promote products 230615a547SMatt Jacob * derived from this software without specific prior written permission. 240615a547SMatt Jacob * 250615a547SMatt Jacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 260615a547SMatt Jacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 270615a547SMatt Jacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 280615a547SMatt Jacob * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 290615a547SMatt Jacob * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 300615a547SMatt Jacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 310615a547SMatt Jacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 320615a547SMatt Jacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 330615a547SMatt Jacob * SUCH DAMAGE. 340615a547SMatt Jacob * 350615a547SMatt Jacob */ 36f5a44627SMatt Jacob #ifndef _ISP_TARGET_H 37f5a44627SMatt Jacob #define _ISP_TARGET_H 380615a547SMatt Jacob 390615a547SMatt Jacob /* 400615a547SMatt Jacob * Defines for all entry types 410615a547SMatt Jacob */ 420615a547SMatt Jacob #define QLTM_SVALID 0x80 430615a547SMatt Jacob #define QLTM_SENSELEN 18 440615a547SMatt Jacob 450615a547SMatt Jacob /* 460615a547SMatt Jacob * Structure for Enable Lun and Modify Lun queue entries 470615a547SMatt Jacob */ 480615a547SMatt Jacob typedef struct { 490615a547SMatt Jacob isphdr_t le_header; 500615a547SMatt Jacob u_int32_t le_reserved; 510615a547SMatt Jacob u_int8_t le_lun; 520615a547SMatt Jacob u_int8_t le_rsvd; 530615a547SMatt Jacob u_int8_t le_ops; /* Modify LUN only */ 540615a547SMatt Jacob u_int8_t le_tgt; /* Not for FC */ 550615a547SMatt Jacob u_int32_t le_flags; /* Not for FC */ 560615a547SMatt Jacob u_int8_t le_status; 570615a547SMatt Jacob u_int8_t le_reserved2; 580615a547SMatt Jacob u_int8_t le_cmd_count; 590615a547SMatt Jacob u_int8_t le_in_count; 600615a547SMatt Jacob u_int8_t le_cdb6len; /* Not for FC */ 610615a547SMatt Jacob u_int8_t le_cdb7len; /* Not for FC */ 620615a547SMatt Jacob u_int16_t le_timeout; 630615a547SMatt Jacob u_int16_t le_reserved3[20]; 640615a547SMatt Jacob } lun_entry_t; 650615a547SMatt Jacob 660615a547SMatt Jacob /* 670615a547SMatt Jacob * le_flags values 680615a547SMatt Jacob */ 690615a547SMatt Jacob #define LUN_TQAE 0x00000001 /* bit1 Tagged Queue Action Enable */ 700615a547SMatt Jacob #define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */ 71d22fcb6bSMatt Jacob #define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */ 720615a547SMatt Jacob #define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */ 730615a547SMatt Jacob 740615a547SMatt Jacob /* 750615a547SMatt Jacob * le_ops values 760615a547SMatt Jacob */ 770615a547SMatt Jacob #define LUN_CCINCR 0x01 /* increment command count */ 780615a547SMatt Jacob #define LUN_CCDECR 0x02 /* decrement command count */ 790615a547SMatt Jacob #define LUN_ININCR 0x40 /* increment immed. notify count */ 800615a547SMatt Jacob #define LUN_INDECR 0x80 /* decrement immed. notify count */ 810615a547SMatt Jacob 820615a547SMatt Jacob /* 830615a547SMatt Jacob * le_status values 840615a547SMatt Jacob */ 850615a547SMatt Jacob #define LUN_OK 0x01 /* we be rockin' */ 860615a547SMatt Jacob #define LUN_ERR 0x04 /* request completed with error */ 870615a547SMatt Jacob #define LUN_INVAL 0x06 /* invalid request */ 880615a547SMatt Jacob #define LUN_NOCAP 0x16 /* can't provide requested capability */ 890615a547SMatt Jacob #define LUN_ENABLED 0x3E /* LUN already enabled */ 900615a547SMatt Jacob 910615a547SMatt Jacob /* 920615a547SMatt Jacob * Immediate Notify Entry structure 930615a547SMatt Jacob */ 940615a547SMatt Jacob #define IN_MSGLEN 8 /* 8 bytes */ 950615a547SMatt Jacob #define IN_RSVDLEN 8 /* 8 words */ 960615a547SMatt Jacob typedef struct { 970615a547SMatt Jacob isphdr_t in_header; 980615a547SMatt Jacob u_int32_t in_reserved; 990615a547SMatt Jacob u_int8_t in_lun; /* lun */ 1000615a547SMatt Jacob u_int8_t in_iid; /* initiator */ 1010615a547SMatt Jacob u_int8_t in_reserved2; 1020615a547SMatt Jacob u_int8_t in_tgt; /* target */ 1030615a547SMatt Jacob u_int32_t in_flags; 1040615a547SMatt Jacob u_int8_t in_status; 1050615a547SMatt Jacob u_int8_t in_rsvd2; 1060615a547SMatt Jacob u_int8_t in_tag_val; /* tag value */ 1070615a547SMatt Jacob u_int8_t in_tag_type; /* tag type */ 1080615a547SMatt Jacob u_int16_t in_seqid; /* sequence id */ 1090615a547SMatt Jacob u_int8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */ 1100615a547SMatt Jacob u_int16_t in_reserved3[IN_RSVDLEN]; 1110615a547SMatt Jacob u_int8_t in_sense[QLTM_SENSELEN];/* suggested sense data */ 1120615a547SMatt Jacob } in_entry_t; 1130615a547SMatt Jacob 1140615a547SMatt Jacob typedef struct { 1150615a547SMatt Jacob isphdr_t in_header; 1160615a547SMatt Jacob u_int32_t in_reserved; 1170615a547SMatt Jacob u_int8_t in_lun; /* lun */ 1180615a547SMatt Jacob u_int8_t in_iid; /* initiator */ 1190615a547SMatt Jacob u_int16_t in_scclun; 1200615a547SMatt Jacob u_int32_t in_reserved2; 1210615a547SMatt Jacob u_int16_t in_status; 1220615a547SMatt Jacob u_int16_t in_task_flags; 1230615a547SMatt Jacob u_int16_t in_seqid; /* sequence id */ 1240615a547SMatt Jacob } in_fcentry_t; 1250615a547SMatt Jacob 1260615a547SMatt Jacob /* 1270615a547SMatt Jacob * Values for the in_status field 1280615a547SMatt Jacob */ 129482cf5c2SMatt Jacob #define IN_REJECT 0x0D /* Message Reject message received */ 1300615a547SMatt Jacob #define IN_RESET 0x0E /* Bus Reset occurred */ 1310615a547SMatt Jacob #define IN_NO_RCAP 0x16 /* requested capability not available */ 1320615a547SMatt Jacob #define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */ 1330615a547SMatt Jacob #define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */ 1340615a547SMatt Jacob #define IN_MSG_RECEIVED 0x36 /* SCSI message received */ 1350615a547SMatt Jacob #define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */ 1360615a547SMatt Jacob #define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */ 1370615a547SMatt Jacob #define IN_PORT_CHANGED 0x2A /* port changed */ 1380615a547SMatt Jacob #define IN_GLOBAL_LOGO 0x2E /* all ports logged out */ 139482cf5c2SMatt Jacob #define IN_NO_NEXUS 0x3B /* Nexus not established */ 1400615a547SMatt Jacob 1410615a547SMatt Jacob /* 1420615a547SMatt Jacob * Values for the in_task_flags field- should only get one at a time! 1430615a547SMatt Jacob */ 1440615a547SMatt Jacob #define TASK_FLAGS_ABORT_TASK (1<<9) 1450615a547SMatt Jacob #define TASK_FLAGS_CLEAR_TASK_SET (1<<10) 1460615a547SMatt Jacob #define TASK_FLAGS_TARGET_RESET (1<<13) 1470615a547SMatt Jacob #define TASK_FLAGS_CLEAR_ACA (1<<14) 1480615a547SMatt Jacob #define TASK_FLAGS_TERMINATE_TASK (1<<15) 1490615a547SMatt Jacob 1500615a547SMatt Jacob #ifndef MSG_ABORT_TAG 1510615a547SMatt Jacob #define MSG_ABORT_TAG 0x06 1520615a547SMatt Jacob #endif 1530615a547SMatt Jacob #ifndef MSG_CLEAR_QUEUE 1540615a547SMatt Jacob #define MSG_CLEAR_QUEUE 0x0e 1550615a547SMatt Jacob #endif 1560615a547SMatt Jacob #ifndef MSG_BUS_DEV_RESET 1570615a547SMatt Jacob #define MSG_BUS_DEV_RESET 0x0b 1580615a547SMatt Jacob #endif 1590615a547SMatt Jacob #ifndef MSG_REL_RECOVERY 1600615a547SMatt Jacob #define MSG_REL_RECOVERY 0x10 1610615a547SMatt Jacob #endif 1620615a547SMatt Jacob #ifndef MSG_TERM_IO_PROC 1630615a547SMatt Jacob #define MSG_TERM_IO_PROC 0x11 1640615a547SMatt Jacob #endif 1650615a547SMatt Jacob 1660615a547SMatt Jacob 1670615a547SMatt Jacob /* 1680615a547SMatt Jacob * Notify Acknowledge Entry structure 1690615a547SMatt Jacob */ 1700615a547SMatt Jacob #define NA_RSVDLEN 22 1710615a547SMatt Jacob typedef struct { 1720615a547SMatt Jacob isphdr_t na_header; 1730615a547SMatt Jacob u_int32_t na_reserved; 1740615a547SMatt Jacob u_int8_t na_lun; /* lun */ 1750615a547SMatt Jacob u_int8_t na_iid; /* initiator */ 1760615a547SMatt Jacob u_int8_t na_reserved2; 1770615a547SMatt Jacob u_int8_t na_tgt; /* target */ 1780615a547SMatt Jacob u_int32_t na_flags; 1790615a547SMatt Jacob u_int8_t na_status; 1800615a547SMatt Jacob u_int8_t na_event; 1810615a547SMatt Jacob u_int16_t na_seqid; /* sequence id */ 1820615a547SMatt Jacob u_int16_t na_reserved3[NA_RSVDLEN]; 1830615a547SMatt Jacob } na_entry_t; 1840615a547SMatt Jacob 1850615a547SMatt Jacob /* 1860615a547SMatt Jacob * Value for the na_event field 1870615a547SMatt Jacob */ 1880615a547SMatt Jacob #define NA_RST_CLRD 0x80 /* Clear an async event notification */ 1899dae8807SMatt Jacob #define NA_OK 0x01 /* Notify Acknowledge Succeeded */ 1909dae8807SMatt Jacob #define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ 1910615a547SMatt Jacob 1920615a547SMatt Jacob #define NA2_RSVDLEN 21 1930615a547SMatt Jacob typedef struct { 1940615a547SMatt Jacob isphdr_t na_header; 1950615a547SMatt Jacob u_int32_t na_reserved; 1960615a547SMatt Jacob u_int8_t na_lun; /* lun */ 1970615a547SMatt Jacob u_int8_t na_iid; /* initiator */ 1980615a547SMatt Jacob u_int16_t na_scclun; 1990615a547SMatt Jacob u_int16_t na_flags; 2000615a547SMatt Jacob u_int16_t na_reserved2; 2010615a547SMatt Jacob u_int16_t na_status; 2020615a547SMatt Jacob u_int16_t na_task_flags; 2030615a547SMatt Jacob u_int16_t na_seqid; /* sequence id */ 2040615a547SMatt Jacob u_int16_t na_reserved3[NA2_RSVDLEN]; 2050615a547SMatt Jacob } na_fcentry_t; 2060615a547SMatt Jacob #define NAFC_RCOUNT 0x80 /* increment resource count */ 2070615a547SMatt Jacob #define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */ 2080615a547SMatt Jacob /* 2090615a547SMatt Jacob * Accept Target I/O Entry structure 2100615a547SMatt Jacob */ 2110615a547SMatt Jacob #define ATIO_CDBLEN 26 2120615a547SMatt Jacob 2130615a547SMatt Jacob typedef struct { 2140615a547SMatt Jacob isphdr_t at_header; 2155f5aafe1SMatt Jacob u_int16_t at_reserved; 2165f5aafe1SMatt Jacob u_int16_t at_handle; 2170615a547SMatt Jacob u_int8_t at_lun; /* lun */ 2180615a547SMatt Jacob u_int8_t at_iid; /* initiator */ 2190615a547SMatt Jacob u_int8_t at_cdblen; /* cdb length */ 2200615a547SMatt Jacob u_int8_t at_tgt; /* target */ 2210615a547SMatt Jacob u_int32_t at_flags; 2220615a547SMatt Jacob u_int8_t at_status; /* firmware status */ 2230615a547SMatt Jacob u_int8_t at_scsi_status; /* scsi status */ 2240615a547SMatt Jacob u_int8_t at_tag_val; /* tag value */ 2250615a547SMatt Jacob u_int8_t at_tag_type; /* tag type */ 2260615a547SMatt Jacob u_int8_t at_cdb[ATIO_CDBLEN]; /* received CDB */ 2270615a547SMatt Jacob u_int8_t at_sense[QLTM_SENSELEN];/* suggested sense data */ 2280615a547SMatt Jacob } at_entry_t; 2290615a547SMatt Jacob 2300615a547SMatt Jacob /* 2310615a547SMatt Jacob * at_flags values 2320615a547SMatt Jacob */ 2330615a547SMatt Jacob #define AT_NODISC 0x00008000 /* disconnect disabled */ 2340615a547SMatt Jacob #define AT_TQAE 0x00000001 /* Tagged Queue Action enabled */ 2350615a547SMatt Jacob 2360615a547SMatt Jacob /* 2370615a547SMatt Jacob * at_status values 2380615a547SMatt Jacob */ 2390615a547SMatt Jacob #define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */ 2400615a547SMatt Jacob #define AT_RESET 0x0E /* SCSI Bus Reset Occurred */ 2410615a547SMatt Jacob #define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 2420615a547SMatt Jacob #define AT_NOCAP 0x16 /* Requested capability not available */ 2430615a547SMatt Jacob #define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 2440615a547SMatt Jacob #define AT_CDB 0x3D /* CDB received */ 2450615a547SMatt Jacob 2460615a547SMatt Jacob /* 2470615a547SMatt Jacob * Accept Target I/O Entry structure, Type 2 2480615a547SMatt Jacob */ 2490615a547SMatt Jacob #define ATIO2_CDBLEN 16 2500615a547SMatt Jacob 2510615a547SMatt Jacob typedef struct { 2520615a547SMatt Jacob isphdr_t at_header; 2530615a547SMatt Jacob u_int32_t at_reserved; 2540615a547SMatt Jacob u_int8_t at_lun; /* lun or reserved */ 2550615a547SMatt Jacob u_int8_t at_iid; /* initiator */ 2560615a547SMatt Jacob u_int16_t at_rxid; /* response ID */ 2570615a547SMatt Jacob u_int16_t at_flags; 2580615a547SMatt Jacob u_int16_t at_status; /* firmware status */ 2590615a547SMatt Jacob u_int8_t at_reserved1; 2600615a547SMatt Jacob u_int8_t at_taskcodes; 2610615a547SMatt Jacob u_int8_t at_taskflags; 2620615a547SMatt Jacob u_int8_t at_execodes; 2630615a547SMatt Jacob u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 2640615a547SMatt Jacob u_int32_t at_datalen; /* allocated data len */ 2650615a547SMatt Jacob u_int16_t at_scclun; /* SCC Lun or reserved */ 266b0a3ba7eSMatt Jacob u_int16_t at_reserved2[10]; 267b0a3ba7eSMatt Jacob u_int16_t at_oxid; 2680615a547SMatt Jacob } at2_entry_t; 2690615a547SMatt Jacob 27073255608SMatt Jacob #define ATIO2_WWPN_OFFSET 0x2A 27173255608SMatt Jacob #define ATIO2_OXID_OFFSET 0x3E 27273255608SMatt Jacob 2730615a547SMatt Jacob #define ATIO2_TC_ATTR_MASK 0x7 2740615a547SMatt Jacob #define ATIO2_TC_ATTR_SIMPLEQ 0 2750615a547SMatt Jacob #define ATIO2_TC_ATTR_HEADOFQ 1 2760615a547SMatt Jacob #define ATIO2_TC_ATTR_ORDERED 2 2770615a547SMatt Jacob #define ATIO2_TC_ATTR_ACAQ 4 2780615a547SMatt Jacob #define ATIO2_TC_ATTR_UNTAGGED 5 2790615a547SMatt Jacob 2800615a547SMatt Jacob /* 2810615a547SMatt Jacob * Continue Target I/O Entry structure 2820615a547SMatt Jacob * Request from driver. The response from the 2830615a547SMatt Jacob * ISP firmware is the same except that the last 18 2840615a547SMatt Jacob * bytes are overwritten by suggested sense data if 2850615a547SMatt Jacob * the 'autosense valid' bit is set in the status byte. 2860615a547SMatt Jacob */ 2870615a547SMatt Jacob typedef struct { 2880615a547SMatt Jacob isphdr_t ct_header; 2895f5aafe1SMatt Jacob u_int16_t ct_reserved; 2905f5aafe1SMatt Jacob #define ct_syshandle ct_reserved /* we use this */ 2915f5aafe1SMatt Jacob u_int16_t ct_fwhandle; /* required by f/w */ 2920615a547SMatt Jacob u_int8_t ct_lun; /* lun */ 2930615a547SMatt Jacob u_int8_t ct_iid; /* initiator id */ 2940615a547SMatt Jacob u_int8_t ct_reserved2; 2950615a547SMatt Jacob u_int8_t ct_tgt; /* our target id */ 2960615a547SMatt Jacob u_int32_t ct_flags; 2970615a547SMatt Jacob u_int8_t ct_status; /* isp status */ 2980615a547SMatt Jacob u_int8_t ct_scsi_status; /* scsi status */ 2990615a547SMatt Jacob u_int8_t ct_tag_val; /* tag value */ 3000615a547SMatt Jacob u_int8_t ct_tag_type; /* tag type */ 3010615a547SMatt Jacob u_int32_t ct_xfrlen; /* transfer length */ 3020615a547SMatt Jacob u_int32_t ct_resid; /* residual length */ 3030615a547SMatt Jacob u_int16_t ct_timeout; 3040615a547SMatt Jacob u_int16_t ct_seg_count; 3050615a547SMatt Jacob ispds_t ct_dataseg[ISP_RQDSEG]; 3060615a547SMatt Jacob } ct_entry_t; 3070615a547SMatt Jacob 3080615a547SMatt Jacob /* 309427469a4SMatt Jacob * For some of the dual port SCSI adapters, port (bus #) is reported 310427469a4SMatt Jacob * in the MSbit of ct_iid. Bit fields are a bit too awkward here. 311427469a4SMatt Jacob * 312427469a4SMatt Jacob * Note that this does not apply to FC adapters at all which can and 313427469a4SMatt Jacob * do report IIDs between 129 && 255 (these represent devices that have 314427469a4SMatt Jacob * logged in across a SCSI fabric). 315427469a4SMatt Jacob */ 316427469a4SMatt Jacob #define GET_IID_VAL(x) (x & 0x3f) 317427469a4SMatt Jacob #define GET_BUS_VAL(x) ((x >> 7) & 0x1) 318427469a4SMatt Jacob #define SET_IID_VAL(y, x) (y | (x & 0x3f)) 319427469a4SMatt Jacob #define SET_BUS_VAL(y, x) (y | ((x & 0x1) << 7)) 320427469a4SMatt Jacob 321427469a4SMatt Jacob /* 3220615a547SMatt Jacob * ct_flags values 3230615a547SMatt Jacob */ 3240615a547SMatt Jacob #define CT_TQAE 0x00000001 /* bit 1, Tagged Queue Action enable */ 3250615a547SMatt Jacob #define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */ 3260615a547SMatt Jacob #define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */ 3270615a547SMatt Jacob #define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */ 3280615a547SMatt Jacob #define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */ 3290615a547SMatt Jacob #define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */ 330482cf5c2SMatt Jacob #define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */ 3310615a547SMatt Jacob #define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */ 3320615a547SMatt Jacob #define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */ 3330615a547SMatt Jacob #define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */ 3340615a547SMatt Jacob #define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */ 3350615a547SMatt Jacob 3360615a547SMatt Jacob /* 3370615a547SMatt Jacob * ct_status values 3380615a547SMatt Jacob * - set by the firmware when it returns the CTIO 3390615a547SMatt Jacob */ 3400615a547SMatt Jacob #define CT_OK 0x01 /* completed without error */ 3410615a547SMatt Jacob #define CT_ABORTED 0x02 /* aborted by host */ 3420615a547SMatt Jacob #define CT_ERR 0x04 /* see sense data for error */ 3430615a547SMatt Jacob #define CT_INVAL 0x06 /* request for disabled lun */ 3440615a547SMatt Jacob #define CT_NOPATH 0x07 /* invalid ITL nexus */ 3450615a547SMatt Jacob #define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */ 3460615a547SMatt Jacob #define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */ 3470615a547SMatt Jacob #define CT_TIMEOUT 0x0B /* timed out */ 3480615a547SMatt Jacob #define CT_RESET 0x0E /* SCSI Bus Reset occurred */ 349482cf5c2SMatt Jacob #define CT_PARITY 0x0F /* Uncorrectable Parity Error */ 350482cf5c2SMatt Jacob #define CT_PANIC 0x13 /* Unrecoverable Error */ 3510615a547SMatt Jacob #define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 3520615a547SMatt Jacob #define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 3530615a547SMatt Jacob #define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */ 3540615a547SMatt Jacob #define CT_PORTNOTAVAIL 0x28 /* port not available */ 3550615a547SMatt Jacob #define CT_LOGOUT 0x29 /* port logout */ 3560615a547SMatt Jacob #define CT_PORTCHANGED 0x2A /* port changed */ 357482cf5c2SMatt Jacob #define CT_IDE 0x33 /* Initiator Detected Error */ 3580615a547SMatt Jacob #define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */ 3590615a547SMatt Jacob 3600615a547SMatt Jacob /* 3610615a547SMatt Jacob * When the firmware returns a CTIO entry, it may overwrite the last 3620615a547SMatt Jacob * part of the structure with sense data. This starts at offset 0x2E 3630615a547SMatt Jacob * into the entry, which is in the middle of ct_dataseg[1]. Rather 3640615a547SMatt Jacob * than define a new struct for this, I'm just using the sense data 3650615a547SMatt Jacob * offset. 3660615a547SMatt Jacob */ 3670615a547SMatt Jacob #define CTIO_SENSE_OFFSET 0x2E 3680615a547SMatt Jacob 3690615a547SMatt Jacob /* 3700615a547SMatt Jacob * Entry length in u_longs. All entries are the same size so 3710615a547SMatt Jacob * any one will do as the numerator. 3720615a547SMatt Jacob */ 3730615a547SMatt Jacob #define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(u_int32_t)) 3740615a547SMatt Jacob 3750615a547SMatt Jacob /* 3760615a547SMatt Jacob * QLA2100 CTIO (type 2) entry 3770615a547SMatt Jacob */ 3780615a547SMatt Jacob #define MAXRESPLEN 26 3790615a547SMatt Jacob typedef struct { 3800615a547SMatt Jacob isphdr_t ct_header; 3815f5aafe1SMatt Jacob u_int16_t ct_reserved; 3825f5aafe1SMatt Jacob u_int16_t ct_fwhandle; /* just to match CTIO */ 3830615a547SMatt Jacob u_int8_t ct_lun; /* lun */ 3840615a547SMatt Jacob u_int8_t ct_iid; /* initiator id */ 3850615a547SMatt Jacob u_int16_t ct_rxid; /* response ID */ 3860615a547SMatt Jacob u_int16_t ct_flags; 3870615a547SMatt Jacob u_int16_t ct_status; /* isp status */ 3880615a547SMatt Jacob u_int16_t ct_timeout; 3890615a547SMatt Jacob u_int16_t ct_seg_count; 3900615a547SMatt Jacob u_int32_t ct_reloff; /* relative offset */ 391427469a4SMatt Jacob int32_t ct_resid; /* residual length */ 3920615a547SMatt Jacob union { 3930615a547SMatt Jacob /* 3940615a547SMatt Jacob * The three different modes that the target driver 3950615a547SMatt Jacob * can set the CTIO2 up as. 3960615a547SMatt Jacob * 3970615a547SMatt Jacob * The first is for sending FCP_DATA_IUs as well as 3980615a547SMatt Jacob * (optionally) sending a terminal SCSI status FCP_RSP_IU. 3990615a547SMatt Jacob * 4000615a547SMatt Jacob * The second is for sending SCSI sense data in an FCP_RSP_IU. 4010615a547SMatt Jacob * Note that no FCP_DATA_IUs will be sent. 4020615a547SMatt Jacob * 4030615a547SMatt Jacob * The third is for sending FCP_RSP_IUs as built specifically 4040615a547SMatt Jacob * in system memory as located by the isp_dataseg. 4050615a547SMatt Jacob */ 4060615a547SMatt Jacob struct { 4070615a547SMatt Jacob u_int32_t _reserved; 4080615a547SMatt Jacob u_int16_t _reserved2; 4090615a547SMatt Jacob u_int16_t ct_scsi_status; 4100615a547SMatt Jacob u_int32_t ct_xfrlen; 4110615a547SMatt Jacob ispds_t ct_dataseg[ISP_RQDSEG_T2]; 4120615a547SMatt Jacob } m0; 4130615a547SMatt Jacob struct { 4140615a547SMatt Jacob u_int16_t _reserved; 4150615a547SMatt Jacob u_int16_t _reserved2; 4160615a547SMatt Jacob u_int16_t ct_senselen; 4170615a547SMatt Jacob u_int16_t ct_scsi_status; 4180615a547SMatt Jacob u_int16_t ct_resplen; 4190615a547SMatt Jacob u_int8_t ct_resp[MAXRESPLEN]; 4200615a547SMatt Jacob } m1; 4210615a547SMatt Jacob struct { 4220615a547SMatt Jacob u_int32_t _reserved; 4230615a547SMatt Jacob u_int16_t _reserved2; 4240615a547SMatt Jacob u_int16_t _reserved3; 4250615a547SMatt Jacob u_int32_t ct_datalen; 4260615a547SMatt Jacob ispds_t ct_fcp_rsp_iudata; 4270615a547SMatt Jacob } m2; 4280615a547SMatt Jacob /* 4290615a547SMatt Jacob * CTIO2 returned from F/W... 4300615a547SMatt Jacob */ 4310615a547SMatt Jacob struct { 4320615a547SMatt Jacob u_int32_t _reserved[4]; 4330615a547SMatt Jacob u_int16_t ct_scsi_status; 4340615a547SMatt Jacob u_int8_t ct_sense[QLTM_SENSELEN]; 4350615a547SMatt Jacob } fw; 4360615a547SMatt Jacob } rsp; 4370615a547SMatt Jacob } ct2_entry_t; 4380615a547SMatt Jacob 4390615a547SMatt Jacob /* 4400615a547SMatt Jacob * ct_flags values for CTIO2 4410615a547SMatt Jacob */ 4420615a547SMatt Jacob #define CT2_FLAG_MMASK 0x0003 4430615a547SMatt Jacob #define CT2_FLAG_MODE0 0x0000 4440615a547SMatt Jacob #define CT2_FLAG_MODE1 0x0001 4450615a547SMatt Jacob #define CT2_FLAG_MODE2 0x0002 4460615a547SMatt Jacob #define CT2_DATA_IN CT_DATA_IN 4470615a547SMatt Jacob #define CT2_DATA_OUT CT_DATA_OUT 4480615a547SMatt Jacob #define CT2_NO_DATA CT_NO_DATA 4490615a547SMatt Jacob #define CT2_DATAMASK CT_DATAMASK 4500615a547SMatt Jacob #define CT2_CCINCR 0x0100 4510615a547SMatt Jacob #define CT2_FASTPOST 0x0200 4520615a547SMatt Jacob #define CT2_SENDSTATUS 0x8000 4530615a547SMatt Jacob 4540615a547SMatt Jacob /* 4550615a547SMatt Jacob * ct_status values are (mostly) the same as that for ct_entry. 4560615a547SMatt Jacob */ 4570615a547SMatt Jacob 4580615a547SMatt Jacob /* 4590615a547SMatt Jacob * ct_scsi_status values- the low 8 bits are the normal SCSI status 4600615a547SMatt Jacob * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU 4610615a547SMatt Jacob * fields. 4620615a547SMatt Jacob */ 4630615a547SMatt Jacob #define CT2_RSPLEN_VALID 0x0100 4640615a547SMatt Jacob #define CT2_SNSLEN_VALID 0x0200 4650615a547SMatt Jacob #define CT2_DATA_OVER 0x0400 4660615a547SMatt Jacob #define CT2_DATA_UNDER 0x0800 4670615a547SMatt Jacob 4680615a547SMatt Jacob /* 4690615a547SMatt Jacob * Macros for packing/unpacking the above structures 4700615a547SMatt Jacob */ 4710615a547SMatt Jacob 4720615a547SMatt Jacob #ifdef __sparc__ 473f5a44627SMatt Jacob #define ISP_SBUS_SWOZZLE(isp, src, dst, taga, tagb) \ 474f5a44627SMatt Jacob if (isp->isp_bustype == ISP_BT_SBUS) { \ 475f5a44627SMatt Jacob u_int8_t tmp = src -> taga; \ 476f5a44627SMatt Jacob dst -> taga = dst -> tagb; \ 477f5a44627SMatt Jacob src -> tagb = tmp; \ 4780615a547SMatt Jacob } else { \ 479f5a44627SMatt Jacob dst -> taga = src -> taga; \ 480f5a44627SMatt Jacob dst -> tagb = src -> taga; \ 4810615a547SMatt Jacob } 4820615a547SMatt Jacob #else 483f5a44627SMatt Jacob #define ISP_SBUS_SWOZZLE(isp, src, dst, taga, tagb) \ 484f5a44627SMatt Jacob dst -> taga = src -> taga; \ 485f5a44627SMatt Jacob dst -> tagb = src -> taga 4860615a547SMatt Jacob #endif 4870615a547SMatt Jacob 488427469a4SMatt Jacob #define MCIDF(d, s) if ((void *) d != (void *)s) MEMCPY(d, s, QENTRY_LEN) 489427469a4SMatt Jacob 4900615a547SMatt Jacob /* This is really only for SBus cards on a sparc */ 4910615a547SMatt Jacob #ifdef __sparc__ 492f5a44627SMatt Jacob #define ISP_SWIZ_ATIO(isp, vdst, vsrc) \ 4930615a547SMatt Jacob { \ 494f5a44627SMatt Jacob at_entry_t *src = (at_entry_t *) vsrc; \ 495f5a44627SMatt Jacob at_entry_t *dst = (at_entry_t *) vdst; \ 496f5a44627SMatt Jacob dst->at_header = src->at_header; \ 497f5a44627SMatt Jacob dst->at_reserved = src->at_reserved; \ 498f5a44627SMatt Jacob dst->at_handle = src->at_handle; \ 499f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_lun, at_iid); \ 500f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_cdblen, at_tgt); \ 501f5a44627SMatt Jacob dst->at_flags = src->at_flags; \ 502f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_status, at_scsi_status); \ 503f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_tag_val, at_tag_type); \ 504f5a44627SMatt Jacob MEMCPY(dst->at_cdb, src->at_cdb, ATIO_CDBLEN); \ 505f5a44627SMatt Jacob MEMCPY(dst->at_sense, src->at_sense, QLTM_SENSELEN); \ 5060615a547SMatt Jacob } 507f5a44627SMatt Jacob #define ISP_SWIZ_ATIO2(isp, vdst, vsrc) \ 5080615a547SMatt Jacob { \ 509f5a44627SMatt Jacob at2_entry_t *src = (at2_entry_t *) vsrc; \ 510f5a44627SMatt Jacob at2_entry_t *dst = (at2_entry_t *) vdst; \ 511f5a44627SMatt Jacob dst->at_reserved = src->at_reserved; \ 512f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_lun, at_iid); \ 513f5a44627SMatt Jacob dst->at_rxid = src->at_rxid; \ 514f5a44627SMatt Jacob dst->at_flags = src->at_flags; \ 515f5a44627SMatt Jacob dst->at_status = src->at_status; \ 516f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_reserved1, at_taskcodes); \ 517f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, at_taskflags, at_execodes); \ 518f5a44627SMatt Jacob MEMCPY(dst->at_cdb, src->at_cdb, ATIO2_CDBLEN); \ 519f5a44627SMatt Jacob dst->at_datalen = src->at_datalen; \ 520f5a44627SMatt Jacob dst->at_scclun = src->at_scclun; \ 521f5a44627SMatt Jacob MEMCPY(dst->at_reserved2, src->at_reserved2, sizeof dst->at_reserved2);\ 522f5a44627SMatt Jacob dst->at_oxid = src->at_oxid; \ 5230615a547SMatt Jacob } 524f5a44627SMatt Jacob #define ISP_SWIZ_CTIO(isp, vdst, vsrc) \ 5250615a547SMatt Jacob { \ 526f5a44627SMatt Jacob ct_entry_t *src = (ct_entry_t *) vsrc; \ 527f5a44627SMatt Jacob ct_entry_t *dst = (ct_entry_t *) vdst; \ 528f5a44627SMatt Jacob dst->ct_header = src->ct_header; \ 529f5a44627SMatt Jacob dst->ct_syshandle = src->ct_syshandle; \ 530f5a44627SMatt Jacob dst->ct_fwhandle = src->ct_fwhandle; \ 531f5a44627SMatt Jacob dst->ct_fwhandle = src->ct_fwhandle; \ 532f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, ct_lun, ct_iid); \ 533f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, ct_reserved2, ct_tgt); \ 534f5a44627SMatt Jacob dst->ct_flags = src->ct_flags; \ 535f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, ct_status, ct_scsi_status); \ 536f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, ct_tag_val, ct_tag_type); \ 537f5a44627SMatt Jacob dst->ct_xfrlen = src->ct_xfrlen; \ 538f5a44627SMatt Jacob dst->ct_resid = src->ct_resid; \ 539f5a44627SMatt Jacob dst->ct_timeout = src->ct_timeout; \ 540f5a44627SMatt Jacob dst->ct_seg_count = src->ct_seg_count; \ 541f5a44627SMatt Jacob MEMCPY(dst->ct_dataseg, src->ct_dataseg, sizeof (dst->ct_dataseg)); \ 5420615a547SMatt Jacob } 543f5a44627SMatt Jacob #define ISP_SWIZ_CTIO2(isp, vdst, vsrc) \ 5440615a547SMatt Jacob { \ 545f5a44627SMatt Jacob ct2_entry_t *src = (ct2_entry_t *) vsrc; \ 546f5a44627SMatt Jacob ct2_entry_t *dst = (ct2_entry_t *) vdst; \ 547f5a44627SMatt Jacob dst->ct_header = src->ct_header; \ 548f5a44627SMatt Jacob dst->ct_syshandle = src->ct_syshandle; \ 549f5a44627SMatt Jacob dst->ct_fwhandle = src->ct_fwhandle; \ 550f5a44627SMatt Jacob dst->ct_fwhandle = src->ct_fwhandle; \ 551f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, ct_lun, ct_iid); \ 552f5a44627SMatt Jacob dst->ct_rxid = src->ct_rxid; \ 553f5a44627SMatt Jacob dst->ct_flags = src->ct_flags; \ 554f5a44627SMatt Jacob dst->ct_status = src->ct_status; \ 555f5a44627SMatt Jacob dst->ct_timeout = src->ct_timeout; \ 556f5a44627SMatt Jacob dst->ct_seg_count = src->ct_seg_count; \ 557f5a44627SMatt Jacob dst->ct_reloff = src->ct_reloff; \ 558f5a44627SMatt Jacob dst->ct_resid = src->ct_resid; \ 559f5a44627SMatt Jacob dst->rsp = src->rsp; \ 5600615a547SMatt Jacob } 561f5a44627SMatt Jacob #define ISP_SWIZ_ENABLE_LUN(isp, vdst, vsrc) \ 5620615a547SMatt Jacob { \ 563f5a44627SMatt Jacob lun_entry_t *src = (lun_entry_t *)vsrc; \ 564f5a44627SMatt Jacob lun_entry_t *dst = (lun_entry_t *)vdst; \ 565f5a44627SMatt Jacob dst->le_header = src->le_header; \ 566f5a44627SMatt Jacob dst->le_reserved2 = src->le_reserved2; \ 567f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, le_lun, le_rsvd); \ 568f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, le_ops, le_tgt); \ 569f5a44627SMatt Jacob dst->le_flags = src->le_flags; \ 570f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, le_status, le_reserved2); \ 571f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, le_cmd_count, le_in_count); \ 572f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, le_cdb6len, le_cdb7len); \ 573f5a44627SMatt Jacob dst->le_timeout = src->le_timeout; \ 574f5a44627SMatt Jacob dst->le_reserved = src->le_reserved; \ 5750615a547SMatt Jacob } 576f5a44627SMatt Jacob #define ISP_SWIZ_NOTIFY(isp, vdst, vsrc) \ 577f5a44627SMatt Jacob { \ 578f5a44627SMatt Jacob in_entry_type *src = (in_entry_t *)vsrc; \ 579f5a44627SMatt Jacob in_entry_type *dst = (in_entry_t *)vdst; \ 580f5a44627SMatt Jacob dst->in_header = src->in_header; \ 581f5a44627SMatt Jacob dst->in_reserved2 = src->in_reserved2; \ 582f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, in_lun, in_iid); \ 583f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, in_reserved2, in_tgt); \ 584f5a44627SMatt Jacob dst->in_flags = src->in_flags; \ 585f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, in_status, in_rsvd2); \ 586f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, in_tag_val, in_tag_type); \ 587f5a44627SMatt Jacob dst->in_seqid = src->in_seqid; \ 588f5a44627SMatt Jacob MEMCPY(dst->in_msg, src->in_msg, IN_MSGLEN); \ 589f5a44627SMatt Jacob MEMCPY(dst->in_reserved, src->in_reserved, IN_RESERVED); \ 590f5a44627SMatt Jacob MEMCPY(dst->in_sense, src->in_sense, QLTM_SENSELEN); \ 591f5a44627SMatt Jacob } 592f5a44627SMatt Jacob #define ISP_SWIZ_NOTIFY_FC(isp, vdst, vsrc) \ 593f5a44627SMatt Jacob { \ 594f5a44627SMatt Jacob in_fcentry_type *src = (in_fcentry_t *)vsrc; \ 595f5a44627SMatt Jacob in_fcentry_type *dst = (in_fcentry_t *)vdst; \ 596f5a44627SMatt Jacob dst->in_header = src->in_header; \ 597f5a44627SMatt Jacob dst->in_reserved2 = src->in_reserved2; \ 598f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, in_lun, in_iid); \ 599f5a44627SMatt Jacob dst->in_scclun = src->in_scclun; \ 600f5a44627SMatt Jacob dst->in_reserved2 = src->in_reserved2; \ 601f5a44627SMatt Jacob dst->in_status = src->in_status; \ 602f5a44627SMatt Jacob dst->in_task_flags = src->in_task_flags; \ 603f5a44627SMatt Jacob dst->in_seqid = src->in_seqid; \ 604f5a44627SMatt Jacob } 605f5a44627SMatt Jacob #define ISP_SWIZ_NOT_ACK(isp, vdst, vsrc) \ 606f5a44627SMatt Jacob { \ 607f5a44627SMatt Jacob na_entry_t *src = (na_entry_t *)vsrc; \ 608f5a44627SMatt Jacob na_entry_t *dst = (na_entry_t *)vdst; \ 609f5a44627SMatt Jacob dst->na_header = src->na_header; \ 610f5a44627SMatt Jacob dst->na_reserved = src->na_reserved; \ 611f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, na_lun, na_iid); \ 612f5a44627SMatt Jacob dst->na_reserved2 = src->na_reserved2; \ 613f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, na_reserved, na_tgt); \ 614f5a44627SMatt Jacob dst->na_flags = src->na_flags; \ 615f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, na_status, na_event); \ 616f5a44627SMatt Jacob dst->na_seqid = src->na_seqid; \ 617f5a44627SMatt Jacob MEMCPY(dst->na_reserved3, src->na_reserved3, NA_RSVDLEN); \ 618f5a44627SMatt Jacob } 619f5a44627SMatt Jacob #define ISP_SWIZ_NOT_ACK_FC(isp, vdst, vsrc) \ 620f5a44627SMatt Jacob { \ 621f5a44627SMatt Jacob na_fcentry_t *src = (na_fcentry_t *)vsrc; \ 622f5a44627SMatt Jacob na_fcentry_t *dst = (na_fcentry_t *)vdst; \ 623f5a44627SMatt Jacob dst->na_header = src->na_header; \ 624f5a44627SMatt Jacob dst->na_reserved = src->na_reserved; \ 625f5a44627SMatt Jacob ISP_SBUS_SWOZZLE(isp, src, dst, na_lun, na_iid); \ 626f5a44627SMatt Jacob dst->na_scclun = src->na_scclun; \ 627f5a44627SMatt Jacob dst->na_flags = src->na_flags; \ 628f5a44627SMatt Jacob dst->na_reserved2 = src->na_reserved2; \ 629f5a44627SMatt Jacob dst->na_status = src->na_status; \ 630f5a44627SMatt Jacob dst->na_task_flags = src->na_task_flags; \ 631f5a44627SMatt Jacob dst->na_seqid = src->na_seqid; \ 632f5a44627SMatt Jacob MEMCPY(dst->na_reserved3, src->na_reserved3, NA2_RSVDLEN); \ 633f5a44627SMatt Jacob } 6340615a547SMatt Jacob #else 635427469a4SMatt Jacob #define ISP_SWIZ_ATIO(isp, d, s) MCIDF(d, s) 636f5a44627SMatt Jacob #define ISP_SWIZ_ATIO2(isp, d, s) MCIDF(d, s) 637427469a4SMatt Jacob #define ISP_SWIZ_CTIO(isp, d, s) MCIDF(d, s) 638f5a44627SMatt Jacob #define ISP_SWIZ_CTIO2(isp, d, s) MCIDF(d, s) 639427469a4SMatt Jacob #define ISP_SWIZ_ENABLE_LUN(isp, d, s) MCIDF(d, s) 640427469a4SMatt Jacob #define ISP_SWIZ_ATIO2(isp, d, s) MCIDF(d, s) 641427469a4SMatt Jacob #define ISP_SWIZ_CTIO2(isp, d, s) MCIDF(d, s) 642f5a44627SMatt Jacob #define ISP_SWIZ_NOTIFY(isp, d, s) MCIDF(d, s) 643f5a44627SMatt Jacob #define ISP_SWIZ_NOTIFY_FC(isp, d, s) MCIDF(d, s) 644f5a44627SMatt Jacob #define ISP_SWIZ_NOT_ACK(isp, d, s) MCIDF(d, s) 645f5a44627SMatt Jacob #define ISP_SWIZ_NOT_ACK_FC(isp, d, s) MCIDF(d, s) 6460615a547SMatt Jacob #endif 6470615a547SMatt Jacob 6480615a547SMatt Jacob /* 6490615a547SMatt Jacob * Debug macros 6500615a547SMatt Jacob */ 6510615a547SMatt Jacob 6520615a547SMatt Jacob #define ISP_TDQE(isp, msg, idx, arg) \ 65369fbe07aSMatt Jacob if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 6540615a547SMatt Jacob 6550615a547SMatt Jacob /* 656427469a4SMatt Jacob * The functions below are target mode functions that 657427469a4SMatt Jacob * are generally internal to the Qlogic driver. 6580615a547SMatt Jacob */ 6590615a547SMatt Jacob 6600615a547SMatt Jacob /* 6610615a547SMatt Jacob * This function handles new response queue entry appropriate for target mode. 6620615a547SMatt Jacob */ 6630615a547SMatt Jacob int isp_target_notify __P((struct ispsoftc *, void *, u_int16_t *)); 6640615a547SMatt Jacob 6650615a547SMatt Jacob /* 6660615a547SMatt Jacob * Enable/Disable/Modify a logical unit. 6670615a547SMatt Jacob */ 66869fbe07aSMatt Jacob #define DFLT_CMD_CNT 32 /* XX */ 6690615a547SMatt Jacob #define DFLT_INOTIFY (4) 6709dae8807SMatt Jacob int isp_lun_cmd __P((struct ispsoftc *, int, int, int, int, u_int32_t)); 6710615a547SMatt Jacob 6720615a547SMatt Jacob /* 6730615a547SMatt Jacob * General request queue 'put' routine for target mode entries. 6740615a547SMatt Jacob */ 6750615a547SMatt Jacob int isp_target_put_entry __P((struct ispsoftc *isp, void *)); 6760615a547SMatt Jacob 6770615a547SMatt Jacob /* 6780615a547SMatt Jacob * General routine to put back an ATIO entry- 6790615a547SMatt Jacob * used for replenishing f/w resource counts. 6800615a547SMatt Jacob */ 6810615a547SMatt Jacob int 6829dae8807SMatt Jacob isp_target_put_atio __P((struct ispsoftc *, int, int, int, int, int)); 6830615a547SMatt Jacob 6840615a547SMatt Jacob /* 6850615a547SMatt Jacob * General routine to send a final CTIO for a command- used mostly for 6860615a547SMatt Jacob * local responses. 6870615a547SMatt Jacob */ 6880615a547SMatt Jacob int 6895f5aafe1SMatt Jacob isp_endcmd __P((struct ispsoftc *, void *, u_int32_t, u_int16_t)); 690427469a4SMatt Jacob #define ECMD_SVALID 0x100 6910615a547SMatt Jacob 6920615a547SMatt Jacob /* 6930615a547SMatt Jacob * Handle an asynchronous event 6940615a547SMatt Jacob */ 6950615a547SMatt Jacob 6960615a547SMatt Jacob void isp_target_async __P((struct ispsoftc *, int, int)); 6970615a547SMatt Jacob 698f5a44627SMatt Jacob #endif /* _ISP_TARGET_H */ 699