1/* $FreeBSD: head/sys/dev/isp/isp_target.h 154704 2006-01-23 06:23:37Z mjacob $ */
| 1/* $FreeBSD: head/sys/dev/isp/isp_target.h 155704 2006-02-15 00:31:48Z mjacob $ */
|
2/*- 3 * Qlogic Target Mode Structure and Flag Definitions 4 * 5 * Copyright (c) 1997, 1998 6 * Patrick Stirling 7 * pms@psconsult.com 8 * All rights reserved. 9 * 10 * Additonal Copyright (c) 1997-2006 by Matthew Jacob 11 * All rights reserved. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice immediately at the beginning of the file, without modification, 18 * this list of conditions, and the following disclaimer. 19 * 2. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 */ 35#ifndef _ISP_TARGET_H 36#define _ISP_TARGET_H 37 38#define QLTM_SENSELEN 18 /* non-FC cards only */ 39#define QLTM_SVALID 0x80 40 41/* 42 * Structure for Enable Lun and Modify Lun queue entries 43 */ 44typedef struct { 45 isphdr_t le_header;
| 2/*- 3 * Qlogic Target Mode Structure and Flag Definitions 4 * 5 * Copyright (c) 1997, 1998 6 * Patrick Stirling 7 * pms@psconsult.com 8 * All rights reserved. 9 * 10 * Additonal Copyright (c) 1997-2006 by Matthew Jacob 11 * All rights reserved. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice immediately at the beginning of the file, without modification, 18 * this list of conditions, and the following disclaimer. 19 * 2. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 */ 35#ifndef _ISP_TARGET_H 36#define _ISP_TARGET_H 37 38#define QLTM_SENSELEN 18 /* non-FC cards only */ 39#define QLTM_SVALID 0x80 40 41/* 42 * Structure for Enable Lun and Modify Lun queue entries 43 */ 44typedef struct { 45 isphdr_t le_header;
|
46 u_int32_t le_reserved; 47 u_int8_t le_lun; 48 u_int8_t le_rsvd; 49 u_int8_t le_ops; /* Modify LUN only */ 50 u_int8_t le_tgt; /* Not for FC */ 51 u_int32_t le_flags; /* Not for FC */ 52 u_int8_t le_status; 53 u_int8_t le_reserved2; 54 u_int8_t le_cmd_count; 55 u_int8_t le_in_count; 56 u_int8_t le_cdb6len; /* Not for FC */ 57 u_int8_t le_cdb7len; /* Not for FC */ 58 u_int16_t le_timeout; 59 u_int16_t le_reserved3[20];
| 46 uint32_t le_reserved; 47 uint8_t le_lun; 48 uint8_t le_rsvd; 49 uint8_t le_ops; /* Modify LUN only */ 50 uint8_t le_tgt; /* Not for FC */ 51 uint32_t le_flags; /* Not for FC */ 52 uint8_t le_status; 53 uint8_t le_reserved2; 54 uint8_t le_cmd_count; 55 uint8_t le_in_count; 56 uint8_t le_cdb6len; /* Not for FC */ 57 uint8_t le_cdb7len; /* Not for FC */ 58 uint16_t le_timeout; 59 uint16_t le_reserved3[20];
|
60} lun_entry_t; 61 62/* 63 * le_flags values 64 */ 65#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */ 66#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */ 67#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */ 68#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */ 69 70/* 71 * le_ops values 72 */ 73#define LUN_CCINCR 0x01 /* increment command count */ 74#define LUN_CCDECR 0x02 /* decrement command count */ 75#define LUN_ININCR 0x40 /* increment immed. notify count */ 76#define LUN_INDECR 0x80 /* decrement immed. notify count */ 77 78/* 79 * le_status values 80 */ 81#define LUN_OK 0x01 /* we be rockin' */ 82#define LUN_ERR 0x04 /* request completed with error */ 83#define LUN_INVAL 0x06 /* invalid request */ 84#define LUN_NOCAP 0x16 /* can't provide requested capability */ 85#define LUN_ENABLED 0x3E /* LUN already enabled */ 86 87/* 88 * Immediate Notify Entry structure 89 */ 90#define IN_MSGLEN 8 /* 8 bytes */ 91#define IN_RSVDLEN 8 /* 8 words */ 92typedef struct { 93 isphdr_t in_header;
| 60} lun_entry_t; 61 62/* 63 * le_flags values 64 */ 65#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */ 66#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */ 67#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */ 68#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */ 69 70/* 71 * le_ops values 72 */ 73#define LUN_CCINCR 0x01 /* increment command count */ 74#define LUN_CCDECR 0x02 /* decrement command count */ 75#define LUN_ININCR 0x40 /* increment immed. notify count */ 76#define LUN_INDECR 0x80 /* decrement immed. notify count */ 77 78/* 79 * le_status values 80 */ 81#define LUN_OK 0x01 /* we be rockin' */ 82#define LUN_ERR 0x04 /* request completed with error */ 83#define LUN_INVAL 0x06 /* invalid request */ 84#define LUN_NOCAP 0x16 /* can't provide requested capability */ 85#define LUN_ENABLED 0x3E /* LUN already enabled */ 86 87/* 88 * Immediate Notify Entry structure 89 */ 90#define IN_MSGLEN 8 /* 8 bytes */ 91#define IN_RSVDLEN 8 /* 8 words */ 92typedef struct { 93 isphdr_t in_header;
|
94 u_int32_t in_reserved; 95 u_int8_t in_lun; /* lun */ 96 u_int8_t in_iid; /* initiator */ 97 u_int8_t in_reserved2; 98 u_int8_t in_tgt; /* target */ 99 u_int32_t in_flags; 100 u_int8_t in_status; 101 u_int8_t in_rsvd2; 102 u_int8_t in_tag_val; /* tag value */ 103 u_int8_t in_tag_type; /* tag type */ 104 u_int16_t in_seqid; /* sequence id */ 105 u_int8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */ 106 u_int16_t in_reserved3[IN_RSVDLEN]; 107 u_int8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
| 94 uint32_t in_reserved; 95 uint8_t in_lun; /* lun */ 96 uint8_t in_iid; /* initiator */ 97 uint8_t in_reserved2; 98 uint8_t in_tgt; /* target */ 99 uint32_t in_flags; 100 uint8_t in_status; 101 uint8_t in_rsvd2; 102 uint8_t in_tag_val; /* tag value */ 103 uint8_t in_tag_type; /* tag type */ 104 uint16_t in_seqid; /* sequence id */ 105 uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */ 106 uint16_t in_reserved3[IN_RSVDLEN]; 107 uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
|
108} in_entry_t; 109 110typedef struct { 111 isphdr_t in_header;
| 108} in_entry_t; 109 110typedef struct { 111 isphdr_t in_header;
|
112 u_int32_t in_reserved; 113 u_int8_t in_lun; /* lun */ 114 u_int8_t in_iid; /* initiator */ 115 u_int16_t in_scclun; 116 u_int32_t in_reserved2; 117 u_int16_t in_status; 118 u_int16_t in_task_flags; 119 u_int16_t in_seqid; /* sequence id */
| 112 uint32_t in_reserved; 113 uint8_t in_lun; /* lun */ 114 uint8_t in_iid; /* initiator */ 115 uint16_t in_scclun; 116 uint32_t in_reserved2; 117 uint16_t in_status; 118 uint16_t in_task_flags; 119 uint16_t in_seqid; /* sequence id */
|
120} in_fcentry_t; 121 122typedef struct { 123 isphdr_t in_header;
| 120} in_fcentry_t; 121 122typedef struct { 123 isphdr_t in_header;
|
124 u_int32_t in_reserved; 125 u_int16_t in_iid; /* initiator */ 126 u_int16_t in_scclun; 127 u_int32_t in_reserved2; 128 u_int16_t in_status; 129 u_int16_t in_task_flags; 130 u_int16_t in_seqid; /* sequence id */
| 124 uint32_t in_reserved; 125 uint16_t in_iid; /* initiator */ 126 uint16_t in_scclun; 127 uint32_t in_reserved2; 128 uint16_t in_status; 129 uint16_t in_task_flags; 130 uint16_t in_seqid; /* sequence id */
|
131} in_fcentry_e_t; 132 133/* 134 * Values for the in_status field 135 */ 136#define IN_REJECT 0x0D /* Message Reject message received */ 137#define IN_RESET 0x0E /* Bus Reset occurred */ 138#define IN_NO_RCAP 0x16 /* requested capability not available */ 139#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */ 140#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */ 141#define IN_MSG_RECEIVED 0x36 /* SCSI message received */ 142#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */ 143#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */ 144#define IN_PORT_CHANGED 0x2A /* port changed */ 145#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */ 146#define IN_NO_NEXUS 0x3B /* Nexus not established */ 147 148/* 149 * Values for the in_task_flags field- should only get one at a time! 150 */ 151#define TASK_FLAGS_CLEAR_ACA (1<<14) 152#define TASK_FLAGS_TARGET_RESET (1<<13) 153#define TASK_FLAGS_LUN_RESET (1<<12) 154#define TASK_FLAGS_CLEAR_TASK_SET (1<<10) 155#define TASK_FLAGS_ABORT_TASK_SET (1<<9) 156 157#ifndef MSG_ABORT 158#define MSG_ABORT 0x06 159#endif 160#ifndef MSG_BUS_DEV_RESET 161#define MSG_BUS_DEV_RESET 0x0c 162#endif 163#ifndef MSG_ABORT_TAG 164#define MSG_ABORT_TAG 0x0d 165#endif 166#ifndef MSG_CLEAR_QUEUE 167#define MSG_CLEAR_QUEUE 0x0e 168#endif 169#ifndef MSG_REL_RECOVERY 170#define MSG_REL_RECOVERY 0x10 171#endif 172#ifndef MSG_TERM_IO_PROC 173#define MSG_TERM_IO_PROC 0x11 174#endif 175#ifndef MSG_LUN_RESET 176#define MSG_LUN_RESET 0x17 177#endif 178 179/* 180 * Notify Acknowledge Entry structure 181 */ 182#define NA_RSVDLEN 22 183typedef struct { 184 isphdr_t na_header;
| 131} in_fcentry_e_t; 132 133/* 134 * Values for the in_status field 135 */ 136#define IN_REJECT 0x0D /* Message Reject message received */ 137#define IN_RESET 0x0E /* Bus Reset occurred */ 138#define IN_NO_RCAP 0x16 /* requested capability not available */ 139#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */ 140#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */ 141#define IN_MSG_RECEIVED 0x36 /* SCSI message received */ 142#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */ 143#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */ 144#define IN_PORT_CHANGED 0x2A /* port changed */ 145#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */ 146#define IN_NO_NEXUS 0x3B /* Nexus not established */ 147 148/* 149 * Values for the in_task_flags field- should only get one at a time! 150 */ 151#define TASK_FLAGS_CLEAR_ACA (1<<14) 152#define TASK_FLAGS_TARGET_RESET (1<<13) 153#define TASK_FLAGS_LUN_RESET (1<<12) 154#define TASK_FLAGS_CLEAR_TASK_SET (1<<10) 155#define TASK_FLAGS_ABORT_TASK_SET (1<<9) 156 157#ifndef MSG_ABORT 158#define MSG_ABORT 0x06 159#endif 160#ifndef MSG_BUS_DEV_RESET 161#define MSG_BUS_DEV_RESET 0x0c 162#endif 163#ifndef MSG_ABORT_TAG 164#define MSG_ABORT_TAG 0x0d 165#endif 166#ifndef MSG_CLEAR_QUEUE 167#define MSG_CLEAR_QUEUE 0x0e 168#endif 169#ifndef MSG_REL_RECOVERY 170#define MSG_REL_RECOVERY 0x10 171#endif 172#ifndef MSG_TERM_IO_PROC 173#define MSG_TERM_IO_PROC 0x11 174#endif 175#ifndef MSG_LUN_RESET 176#define MSG_LUN_RESET 0x17 177#endif 178 179/* 180 * Notify Acknowledge Entry structure 181 */ 182#define NA_RSVDLEN 22 183typedef struct { 184 isphdr_t na_header;
|
185 u_int32_t na_reserved; 186 u_int8_t na_lun; /* lun */ 187 u_int8_t na_iid; /* initiator */ 188 u_int8_t na_reserved2; 189 u_int8_t na_tgt; /* target */ 190 u_int32_t na_flags; 191 u_int8_t na_status; 192 u_int8_t na_event; 193 u_int16_t na_seqid; /* sequence id */ 194 u_int16_t na_reserved3[NA_RSVDLEN];
| 185 uint32_t na_reserved; 186 uint8_t na_lun; /* lun */ 187 uint8_t na_iid; /* initiator */ 188 uint8_t na_reserved2; 189 uint8_t na_tgt; /* target */ 190 uint32_t na_flags; 191 uint8_t na_status; 192 uint8_t na_event; 193 uint16_t na_seqid; /* sequence id */ 194 uint16_t na_reserved3[NA_RSVDLEN];
|
195} na_entry_t; 196 197/* 198 * Value for the na_event field 199 */ 200#define NA_RST_CLRD 0x80 /* Clear an async event notification */ 201#define NA_OK 0x01 /* Notify Acknowledge Succeeded */ 202#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ 203 204#define NA2_RSVDLEN 21 205typedef struct { 206 isphdr_t na_header;
| 195} na_entry_t; 196 197/* 198 * Value for the na_event field 199 */ 200#define NA_RST_CLRD 0x80 /* Clear an async event notification */ 201#define NA_OK 0x01 /* Notify Acknowledge Succeeded */ 202#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ 203 204#define NA2_RSVDLEN 21 205typedef struct { 206 isphdr_t na_header;
|
207 u_int32_t na_reserved; 208 u_int8_t na_lun; /* lun */ 209 u_int8_t na_iid; /* initiator */ 210 u_int16_t na_scclun; 211 u_int16_t na_flags; 212 u_int16_t na_reserved2; 213 u_int16_t na_status; 214 u_int16_t na_task_flags; 215 u_int16_t na_seqid; /* sequence id */ 216 u_int16_t na_reserved3[NA2_RSVDLEN];
| 207 uint32_t na_reserved; 208 uint8_t na_lun; /* lun */ 209 uint8_t na_iid; /* initiator */ 210 uint16_t na_scclun; 211 uint16_t na_flags; 212 uint16_t na_reserved2; 213 uint16_t na_status; 214 uint16_t na_task_flags; 215 uint16_t na_seqid; /* sequence id */ 216 uint16_t na_reserved3[NA2_RSVDLEN];
|
217} na_fcentry_t; 218 219typedef struct { 220 isphdr_t na_header;
| 217} na_fcentry_t; 218 219typedef struct { 220 isphdr_t na_header;
|
221 u_int32_t na_reserved; 222 u_int16_t na_iid; /* initiator */ 223 u_int16_t na_scclun; 224 u_int16_t na_flags; 225 u_int16_t na_reserved2; 226 u_int16_t na_status; 227 u_int16_t na_task_flags; 228 u_int16_t na_seqid; /* sequence id */ 229 u_int16_t na_reserved3[NA2_RSVDLEN];
| 221 uint32_t na_reserved; 222 uint16_t na_iid; /* initiator */ 223 uint16_t na_scclun; 224 uint16_t na_flags; 225 uint16_t na_reserved2; 226 uint16_t na_status; 227 uint16_t na_task_flags; 228 uint16_t na_seqid; /* sequence id */ 229 uint16_t na_reserved3[NA2_RSVDLEN];
|
230} na_fcentry_e_t; 231 232#define NAFC_RCOUNT 0x80 /* increment resource count */ 233#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */ 234/* 235 * Accept Target I/O Entry structure 236 */ 237#define ATIO_CDBLEN 26 238 239typedef struct { 240 isphdr_t at_header;
| 230} na_fcentry_e_t; 231 232#define NAFC_RCOUNT 0x80 /* increment resource count */ 233#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */ 234/* 235 * Accept Target I/O Entry structure 236 */ 237#define ATIO_CDBLEN 26 238 239typedef struct { 240 isphdr_t at_header;
|
241 u_int16_t at_reserved; 242 u_int16_t at_handle; 243 u_int8_t at_lun; /* lun */ 244 u_int8_t at_iid; /* initiator */ 245 u_int8_t at_cdblen; /* cdb length */ 246 u_int8_t at_tgt; /* target */ 247 u_int32_t at_flags; 248 u_int8_t at_status; /* firmware status */ 249 u_int8_t at_scsi_status; /* scsi status */ 250 u_int8_t at_tag_val; /* tag value */ 251 u_int8_t at_tag_type; /* tag type */ 252 u_int8_t at_cdb[ATIO_CDBLEN]; /* received CDB */ 253 u_int8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
| 241 uint16_t at_reserved; 242 uint16_t at_handle; 243 uint8_t at_lun; /* lun */ 244 uint8_t at_iid; /* initiator */ 245 uint8_t at_cdblen; /* cdb length */ 246 uint8_t at_tgt; /* target */ 247 uint32_t at_flags; 248 uint8_t at_status; /* firmware status */ 249 uint8_t at_scsi_status; /* scsi status */ 250 uint8_t at_tag_val; /* tag value */ 251 uint8_t at_tag_type; /* tag type */ 252 uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */ 253 uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
|
254} at_entry_t; 255 256/* 257 * at_flags values 258 */ 259#define AT_NODISC 0x00008000 /* disconnect disabled */ 260#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */ 261 262/* 263 * at_status values 264 */ 265#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */ 266#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */ 267#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 268#define AT_NOCAP 0x16 /* Requested capability not available */ 269#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 270#define AT_CDB 0x3D /* CDB received */ 271/* 272 * Macros to create and fetch and test concatenated handle and tag value macros 273 */ 274 275#define AT_MAKE_TAGID(tid, inst, aep) \ 276 tid = aep->at_handle; \ 277 if (aep->at_flags & AT_TQAE) { \ 278 tid |= (aep->at_tag_val << 16); \ 279 tid |= (1 << 24); \ 280 } \ 281 tid |= (GET_BUS_VAL(aep->at_iid) << 25); \ 282 tid |= (inst << 26) 283 284#define CT_MAKE_TAGID(tid, bus, inst, ct) \ 285 tid = ct->ct_fwhandle; \ 286 if (ct->ct_flags & CT_TQAE) { \ 287 tid |= (ct->ct_tag_val << 16); \ 288 tid |= (1 << 24); \ 289 } \ 290 tid |= ((bus & 0x1) << 25); \ 291 tid |= (inst << 26) 292 293#define AT_HAS_TAG(val) ((val) & (1 << 24)) 294#define AT_GET_TAG(val) (((val) >> 16) & 0xff) 295#define AT_GET_INST(val) (((val) >> 26) & 0x3f) 296#define AT_GET_BUS(val) (((val) >> 25) & 0x1) 297#define AT_GET_HANDLE(val) ((val) & 0xffff) 298 299#define IN_MAKE_TAGID(tid, inst, inp) \ 300 tid = inp->in_seqid; \ 301 tid |= (inp->in_tag_val << 16); \ 302 tid |= (1 << 24); \ 303 tid |= (GET_BUS_VAL(inp->in_iid) << 25); \ 304 tid |= (inst << 26) 305 306#define TAG_INSERT_INST(tid, inst) \ 307 tid &= ~(0x3ffffff); \ 308 tid |= (inst << 26) 309 310#define TAG_INSERT_BUS(tid, bus) \ 311 tid &= ~(1 << 25); \ 312 tid |= (bus << 25) 313 314/* 315 * Accept Target I/O Entry structure, Type 2 316 */ 317#define ATIO2_CDBLEN 16 318 319typedef struct { 320 isphdr_t at_header;
| 254} at_entry_t; 255 256/* 257 * at_flags values 258 */ 259#define AT_NODISC 0x00008000 /* disconnect disabled */ 260#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */ 261 262/* 263 * at_status values 264 */ 265#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */ 266#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */ 267#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 268#define AT_NOCAP 0x16 /* Requested capability not available */ 269#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 270#define AT_CDB 0x3D /* CDB received */ 271/* 272 * Macros to create and fetch and test concatenated handle and tag value macros 273 */ 274 275#define AT_MAKE_TAGID(tid, inst, aep) \ 276 tid = aep->at_handle; \ 277 if (aep->at_flags & AT_TQAE) { \ 278 tid |= (aep->at_tag_val << 16); \ 279 tid |= (1 << 24); \ 280 } \ 281 tid |= (GET_BUS_VAL(aep->at_iid) << 25); \ 282 tid |= (inst << 26) 283 284#define CT_MAKE_TAGID(tid, bus, inst, ct) \ 285 tid = ct->ct_fwhandle; \ 286 if (ct->ct_flags & CT_TQAE) { \ 287 tid |= (ct->ct_tag_val << 16); \ 288 tid |= (1 << 24); \ 289 } \ 290 tid |= ((bus & 0x1) << 25); \ 291 tid |= (inst << 26) 292 293#define AT_HAS_TAG(val) ((val) & (1 << 24)) 294#define AT_GET_TAG(val) (((val) >> 16) & 0xff) 295#define AT_GET_INST(val) (((val) >> 26) & 0x3f) 296#define AT_GET_BUS(val) (((val) >> 25) & 0x1) 297#define AT_GET_HANDLE(val) ((val) & 0xffff) 298 299#define IN_MAKE_TAGID(tid, inst, inp) \ 300 tid = inp->in_seqid; \ 301 tid |= (inp->in_tag_val << 16); \ 302 tid |= (1 << 24); \ 303 tid |= (GET_BUS_VAL(inp->in_iid) << 25); \ 304 tid |= (inst << 26) 305 306#define TAG_INSERT_INST(tid, inst) \ 307 tid &= ~(0x3ffffff); \ 308 tid |= (inst << 26) 309 310#define TAG_INSERT_BUS(tid, bus) \ 311 tid &= ~(1 << 25); \ 312 tid |= (bus << 25) 313 314/* 315 * Accept Target I/O Entry structure, Type 2 316 */ 317#define ATIO2_CDBLEN 16 318 319typedef struct { 320 isphdr_t at_header;
|
321 u_int32_t at_reserved; 322 u_int8_t at_lun; /* lun or reserved */ 323 u_int8_t at_iid; /* initiator */ 324 u_int16_t at_rxid; /* response ID */ 325 u_int16_t at_flags; 326 u_int16_t at_status; /* firmware status */ 327 u_int8_t at_crn; /* command reference number */ 328 u_int8_t at_taskcodes; 329 u_int8_t at_taskflags; 330 u_int8_t at_execodes; 331 u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 332 u_int32_t at_datalen; /* allocated data len */ 333 u_int16_t at_scclun; /* SCC Lun or reserved */ 334 u_int16_t at_wwpn[4]; /* WWPN of initiator */ 335 u_int16_t at_reserved2[6]; 336 u_int16_t at_oxid;
| 321 uint32_t at_reserved; 322 uint8_t at_lun; /* lun or reserved */ 323 uint8_t at_iid; /* initiator */ 324 uint16_t at_rxid; /* response ID */ 325 uint16_t at_flags; 326 uint16_t at_status; /* firmware status */ 327 uint8_t at_crn; /* command reference number */ 328 uint8_t at_taskcodes; 329 uint8_t at_taskflags; 330 uint8_t at_execodes; 331 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 332 uint32_t at_datalen; /* allocated data len */ 333 uint16_t at_scclun; /* SCC Lun or reserved */ 334 uint16_t at_wwpn[4]; /* WWPN of initiator */ 335 uint16_t at_reserved2[6]; 336 uint16_t at_oxid;
|
337} at2_entry_t; 338 339typedef struct { 340 isphdr_t at_header;
| 337} at2_entry_t; 338 339typedef struct { 340 isphdr_t at_header;
|
341 u_int32_t at_reserved; 342 u_int16_t at_iid; /* initiator */ 343 u_int16_t at_rxid; /* response ID */ 344 u_int16_t at_flags; 345 u_int16_t at_status; /* firmware status */ 346 u_int8_t at_crn; /* command reference number */ 347 u_int8_t at_taskcodes; 348 u_int8_t at_taskflags; 349 u_int8_t at_execodes; 350 u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 351 u_int32_t at_datalen; /* allocated data len */ 352 u_int16_t at_scclun; /* SCC Lun or reserved */ 353 u_int16_t at_wwpn[4]; /* WWPN of initiator */ 354 u_int16_t at_reserved2[6]; 355 u_int16_t at_oxid;
| 341 uint32_t at_reserved; 342 uint16_t at_iid; /* initiator */ 343 uint16_t at_rxid; /* response ID */ 344 uint16_t at_flags; 345 uint16_t at_status; /* firmware status */ 346 uint8_t at_crn; /* command reference number */ 347 uint8_t at_taskcodes; 348 uint8_t at_taskflags; 349 uint8_t at_execodes; 350 uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */ 351 uint32_t at_datalen; /* allocated data len */ 352 uint16_t at_scclun; /* SCC Lun or reserved */ 353 uint16_t at_wwpn[4]; /* WWPN of initiator */ 354 uint16_t at_reserved2[6]; 355 uint16_t at_oxid;
|
356} at2e_entry_t; 357 358#define ATIO2_WWPN_OFFSET 0x2A 359#define ATIO2_OXID_OFFSET 0x3E 360 361#define ATIO2_TC_ATTR_MASK 0x7 362#define ATIO2_TC_ATTR_SIMPLEQ 0 363#define ATIO2_TC_ATTR_HEADOFQ 1 364#define ATIO2_TC_ATTR_ORDERED 2 365#define ATIO2_TC_ATTR_ACAQ 4 366#define ATIO2_TC_ATTR_UNTAGGED 5 367 368#define ATIO2_EX_WRITE 0x1 369#define ATIO2_EX_READ 0x2 370/* 371 * Macros to create and fetch and test concatenated handle and tag value macros 372 */ 373#define AT2_MAKE_TAGID(tid, inst, aep) \ 374 tid = aep->at_rxid; \ 375 tid |= (inst << 16) 376 377#define CT2_MAKE_TAGID(tid, inst, ct) \ 378 tid = ct->ct_rxid; \ 379 tid |= (inst << 16) 380 381#define AT2_HAS_TAG(val) 1 382#define AT2_GET_TAG(val) ((val) & 0xffff) 383#define AT2_GET_INST(val) ((val) >> 16) 384#define AT2_GET_HANDLE AT2_GET_TAG 385 386#define FC_HAS_TAG AT2_HAS_TAG 387#define FC_GET_TAG AT2_GET_TAG 388#define FC_GET_INST AT2_GET_INST 389#define FC_GET_HANDLE AT2_GET_HANDLE 390 391#define IN_FC_MAKE_TAGID(tid, inst, inp) \ 392 tid = inp->in_seqid; \ 393 tid |= (inst << 16) 394 395#define FC_TAG_INSERT_INST(tid, inst) \ 396 tid &= ~0xffff; \ 397 tid |= (inst << 16) 398 399 400/* 401 * Continue Target I/O Entry structure 402 * Request from driver. The response from the 403 * ISP firmware is the same except that the last 18 404 * bytes are overwritten by suggested sense data if 405 * the 'autosense valid' bit is set in the status byte. 406 */ 407typedef struct { 408 isphdr_t ct_header;
| 356} at2e_entry_t; 357 358#define ATIO2_WWPN_OFFSET 0x2A 359#define ATIO2_OXID_OFFSET 0x3E 360 361#define ATIO2_TC_ATTR_MASK 0x7 362#define ATIO2_TC_ATTR_SIMPLEQ 0 363#define ATIO2_TC_ATTR_HEADOFQ 1 364#define ATIO2_TC_ATTR_ORDERED 2 365#define ATIO2_TC_ATTR_ACAQ 4 366#define ATIO2_TC_ATTR_UNTAGGED 5 367 368#define ATIO2_EX_WRITE 0x1 369#define ATIO2_EX_READ 0x2 370/* 371 * Macros to create and fetch and test concatenated handle and tag value macros 372 */ 373#define AT2_MAKE_TAGID(tid, inst, aep) \ 374 tid = aep->at_rxid; \ 375 tid |= (inst << 16) 376 377#define CT2_MAKE_TAGID(tid, inst, ct) \ 378 tid = ct->ct_rxid; \ 379 tid |= (inst << 16) 380 381#define AT2_HAS_TAG(val) 1 382#define AT2_GET_TAG(val) ((val) & 0xffff) 383#define AT2_GET_INST(val) ((val) >> 16) 384#define AT2_GET_HANDLE AT2_GET_TAG 385 386#define FC_HAS_TAG AT2_HAS_TAG 387#define FC_GET_TAG AT2_GET_TAG 388#define FC_GET_INST AT2_GET_INST 389#define FC_GET_HANDLE AT2_GET_HANDLE 390 391#define IN_FC_MAKE_TAGID(tid, inst, inp) \ 392 tid = inp->in_seqid; \ 393 tid |= (inst << 16) 394 395#define FC_TAG_INSERT_INST(tid, inst) \ 396 tid &= ~0xffff; \ 397 tid |= (inst << 16) 398 399 400/* 401 * Continue Target I/O Entry structure 402 * Request from driver. The response from the 403 * ISP firmware is the same except that the last 18 404 * bytes are overwritten by suggested sense data if 405 * the 'autosense valid' bit is set in the status byte. 406 */ 407typedef struct { 408 isphdr_t ct_header;
|
409 u_int16_t ct_reserved;
| 409 uint16_t ct_reserved;
|
410#define ct_syshandle ct_reserved /* we use this */
| 410#define ct_syshandle ct_reserved /* we use this */
|
411 u_int16_t ct_fwhandle; /* required by f/w */ 412 u_int8_t ct_lun; /* lun */ 413 u_int8_t ct_iid; /* initiator id */ 414 u_int8_t ct_reserved2; 415 u_int8_t ct_tgt; /* our target id */ 416 u_int32_t ct_flags; 417 u_int8_t ct_status; /* isp status */ 418 u_int8_t ct_scsi_status; /* scsi status */ 419 u_int8_t ct_tag_val; /* tag value */ 420 u_int8_t ct_tag_type; /* tag type */ 421 u_int32_t ct_xfrlen; /* transfer length */ 422 u_int32_t ct_resid; /* residual length */ 423 u_int16_t ct_timeout; 424 u_int16_t ct_seg_count;
| 411 uint16_t ct_fwhandle; /* required by f/w */ 412 uint8_t ct_lun; /* lun */ 413 uint8_t ct_iid; /* initiator id */ 414 uint8_t ct_reserved2; 415 uint8_t ct_tgt; /* our target id */ 416 uint32_t ct_flags; 417 uint8_t ct_status; /* isp status */ 418 uint8_t ct_scsi_status; /* scsi status */ 419 uint8_t ct_tag_val; /* tag value */ 420 uint8_t ct_tag_type; /* tag type */ 421 uint32_t ct_xfrlen; /* transfer length */ 422 uint32_t ct_resid; /* residual length */ 423 uint16_t ct_timeout; 424 uint16_t ct_seg_count;
|
425 /* 426 * This is so we can share tag name space with 427 * CTIO{2,3,4} with the minimum of pain. 428 */ 429 union { 430 ispds_t ct_a[ISP_RQDSEG]; 431 } _u; 432#define ct_dataseg _u.ct_a 433} ct_entry_t; 434 435/* 436 * For some of the dual port SCSI adapters, port (bus #) is reported 437 * in the MSbit of ct_iid. Bit fields are a bit too awkward here. 438 * 439 * Note that this does not apply to FC adapters at all which can and 440 * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices 441 * that have logged in across a SCSI fabric. 442 */ 443#define GET_IID_VAL(x) (x & 0x3f) 444#define GET_BUS_VAL(x) ((x >> 7) & 0x1) 445#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f)) 446#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7)) 447 448/* 449 * ct_flags values 450 */ 451#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */ 452#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */ 453#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */ 454#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */ 455#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */ 456#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */ 457#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */ 458#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */ 459#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */ 460#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */ 461#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */ 462 463/* 464 * ct_status values 465 * - set by the firmware when it returns the CTIO 466 */ 467#define CT_OK 0x01 /* completed without error */ 468#define CT_ABORTED 0x02 /* aborted by host */ 469#define CT_ERR 0x04 /* see sense data for error */ 470#define CT_INVAL 0x06 /* request for disabled lun */ 471#define CT_NOPATH 0x07 /* invalid ITL nexus */ 472#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */ 473#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */ 474#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */ 475#define CT_TIMEOUT 0x0B /* timed out */ 476#define CT_RESET 0x0E /* SCSI Bus Reset occurred */ 477#define CT_PARITY 0x0F /* Uncorrectable Parity Error */ 478#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */ 479#define CT_PANIC 0x13 /* Unrecoverable Error */ 480#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 481#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 482#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */ 483#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */ 484#define CT_PORTNOTAVAIL 0x28 /* port not available */ 485#define CT_LOGOUT 0x29 /* port logout */ 486#define CT_PORTCHANGED 0x2A /* port changed */ 487#define CT_IDE 0x33 /* Initiator Detected Error */ 488#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */ 489#define CT_SRR 0x45 /* SRR Received */ 490#define CT_LUN_RESET 0x48 /* Lun Reset Received */ 491 492/* 493 * When the firmware returns a CTIO entry, it may overwrite the last 494 * part of the structure with sense data. This starts at offset 0x2E 495 * into the entry, which is in the middle of ct_dataseg[1]. Rather 496 * than define a new struct for this, I'm just using the sense data 497 * offset. 498 */ 499#define CTIO_SENSE_OFFSET 0x2E 500 501/* 502 * Entry length in u_longs. All entries are the same size so 503 * any one will do as the numerator. 504 */
| 425 /* 426 * This is so we can share tag name space with 427 * CTIO{2,3,4} with the minimum of pain. 428 */ 429 union { 430 ispds_t ct_a[ISP_RQDSEG]; 431 } _u; 432#define ct_dataseg _u.ct_a 433} ct_entry_t; 434 435/* 436 * For some of the dual port SCSI adapters, port (bus #) is reported 437 * in the MSbit of ct_iid. Bit fields are a bit too awkward here. 438 * 439 * Note that this does not apply to FC adapters at all which can and 440 * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices 441 * that have logged in across a SCSI fabric. 442 */ 443#define GET_IID_VAL(x) (x & 0x3f) 444#define GET_BUS_VAL(x) ((x >> 7) & 0x1) 445#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f)) 446#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7)) 447 448/* 449 * ct_flags values 450 */ 451#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */ 452#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */ 453#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */ 454#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */ 455#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */ 456#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */ 457#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */ 458#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */ 459#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */ 460#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */ 461#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */ 462 463/* 464 * ct_status values 465 * - set by the firmware when it returns the CTIO 466 */ 467#define CT_OK 0x01 /* completed without error */ 468#define CT_ABORTED 0x02 /* aborted by host */ 469#define CT_ERR 0x04 /* see sense data for error */ 470#define CT_INVAL 0x06 /* request for disabled lun */ 471#define CT_NOPATH 0x07 /* invalid ITL nexus */ 472#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */ 473#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */ 474#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */ 475#define CT_TIMEOUT 0x0B /* timed out */ 476#define CT_RESET 0x0E /* SCSI Bus Reset occurred */ 477#define CT_PARITY 0x0F /* Uncorrectable Parity Error */ 478#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */ 479#define CT_PANIC 0x13 /* Unrecoverable Error */ 480#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */ 481#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */ 482#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */ 483#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */ 484#define CT_PORTNOTAVAIL 0x28 /* port not available */ 485#define CT_LOGOUT 0x29 /* port logout */ 486#define CT_PORTCHANGED 0x2A /* port changed */ 487#define CT_IDE 0x33 /* Initiator Detected Error */ 488#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */ 489#define CT_SRR 0x45 /* SRR Received */ 490#define CT_LUN_RESET 0x48 /* Lun Reset Received */ 491 492/* 493 * When the firmware returns a CTIO entry, it may overwrite the last 494 * part of the structure with sense data. This starts at offset 0x2E 495 * into the entry, which is in the middle of ct_dataseg[1]. Rather 496 * than define a new struct for this, I'm just using the sense data 497 * offset. 498 */ 499#define CTIO_SENSE_OFFSET 0x2E 500 501/* 502 * Entry length in u_longs. All entries are the same size so 503 * any one will do as the numerator. 504 */
|
505#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(u_int32_t))
| 505#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(uint32_t))
|
506 507/* 508 * QLA2100 CTIO (type 2) entry 509 */ 510#define MAXRESPLEN 26 511typedef struct { 512 isphdr_t ct_header;
| 506 507/* 508 * QLA2100 CTIO (type 2) entry 509 */ 510#define MAXRESPLEN 26 511typedef struct { 512 isphdr_t ct_header;
|
513 u_int16_t ct_reserved; 514 u_int16_t ct_fwhandle; /* just to match CTIO */ 515 u_int8_t ct_lun; /* lun */ 516 u_int8_t ct_iid; /* initiator id */ 517 u_int16_t ct_rxid; /* response ID */ 518 u_int16_t ct_flags; 519 u_int16_t ct_status; /* isp status */ 520 u_int16_t ct_timeout; 521 u_int16_t ct_seg_count; 522 u_int32_t ct_reloff; /* relative offset */
| 513 uint16_t ct_reserved; 514 uint16_t ct_fwhandle; /* just to match CTIO */ 515 uint8_t ct_lun; /* lun */ 516 uint8_t ct_iid; /* initiator id */ 517 uint16_t ct_rxid; /* response ID */ 518 uint16_t ct_flags; 519 uint16_t ct_status; /* isp status */ 520 uint16_t ct_timeout; 521 uint16_t ct_seg_count; 522 uint32_t ct_reloff; /* relative offset */
|
523 int32_t ct_resid; /* residual length */ 524 union { 525 /* 526 * The three different modes that the target driver 527 * can set the CTIO{2,3,4} up as. 528 * 529 * The first is for sending FCP_DATA_IUs as well as 530 * (optionally) sending a terminal SCSI status FCP_RSP_IU. 531 * 532 * The second is for sending SCSI sense data in an FCP_RSP_IU. 533 * Note that no FCP_DATA_IUs will be sent. 534 * 535 * The third is for sending FCP_RSP_IUs as built specifically 536 * in system memory as located by the isp_dataseg. 537 */ 538 struct {
| 523 int32_t ct_resid; /* residual length */ 524 union { 525 /* 526 * The three different modes that the target driver 527 * can set the CTIO{2,3,4} up as. 528 * 529 * The first is for sending FCP_DATA_IUs as well as 530 * (optionally) sending a terminal SCSI status FCP_RSP_IU. 531 * 532 * The second is for sending SCSI sense data in an FCP_RSP_IU. 533 * Note that no FCP_DATA_IUs will be sent. 534 * 535 * The third is for sending FCP_RSP_IUs as built specifically 536 * in system memory as located by the isp_dataseg. 537 */ 538 struct {
|
539 u_int32_t _reserved; 540 u_int16_t _reserved2; 541 u_int16_t ct_scsi_status; 542 u_int32_t ct_xfrlen;
| 539 uint32_t _reserved; 540 uint16_t _reserved2; 541 uint16_t ct_scsi_status; 542 uint32_t ct_xfrlen;
|
543 union { 544 ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */ 545 ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */ 546 ispdslist_t ct_c; /* CTIO4 */ 547 } _u; 548#define ct_dataseg _u.ct_a 549#define ct_dataseg64 _u.ct_b 550#define ct_dslist _u.ct_c 551 } m0; 552 struct {
| 543 union { 544 ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */ 545 ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */ 546 ispdslist_t ct_c; /* CTIO4 */ 547 } _u; 548#define ct_dataseg _u.ct_a 549#define ct_dataseg64 _u.ct_b 550#define ct_dslist _u.ct_c 551 } m0; 552 struct {
|
553 u_int16_t _reserved; 554 u_int16_t _reserved2; 555 u_int16_t ct_senselen; 556 u_int16_t ct_scsi_status; 557 u_int16_t ct_resplen; 558 u_int8_t ct_resp[MAXRESPLEN];
| 553 uint16_t _reserved; 554 uint16_t _reserved2; 555 uint16_t ct_senselen; 556 uint16_t ct_scsi_status; 557 uint16_t ct_resplen; 558 uint8_t ct_resp[MAXRESPLEN];
|
559 } m1; 560 struct {
| 559 } m1; 560 struct {
|
561 u_int32_t _reserved; 562 u_int16_t _reserved2; 563 u_int16_t _reserved3; 564 u_int32_t ct_datalen;
| 561 uint32_t _reserved; 562 uint16_t _reserved2; 563 uint16_t _reserved3; 564 uint32_t ct_datalen;
|
565 ispds_t ct_fcp_rsp_iudata; 566 } m2; 567 } rsp; 568} ct2_entry_t; 569 570typedef struct { 571 isphdr_t ct_header;
| 565 ispds_t ct_fcp_rsp_iudata; 566 } m2; 567 } rsp; 568} ct2_entry_t; 569 570typedef struct { 571 isphdr_t ct_header;
|
572 u_int16_t ct_reserved; 573 u_int16_t ct_fwhandle; /* just to match CTIO */ 574 u_int16_t ct_iid; /* initiator id */ 575 u_int16_t ct_rxid; /* response ID */ 576 u_int16_t ct_flags; 577 u_int16_t ct_status; /* isp status */ 578 u_int16_t ct_timeout; 579 u_int16_t ct_seg_count; 580 u_int32_t ct_reloff; /* relative offset */
| 572 uint16_t ct_reserved; 573 uint16_t ct_fwhandle; /* just to match CTIO */ 574 uint16_t ct_iid; /* initiator id */ 575 uint16_t ct_rxid; /* response ID */ 576 uint16_t ct_flags; 577 uint16_t ct_status; /* isp status */ 578 uint16_t ct_timeout; 579 uint16_t ct_seg_count; 580 uint32_t ct_reloff; /* relative offset */
|
581 int32_t ct_resid; /* residual length */ 582 union { 583 struct {
| 581 int32_t ct_resid; /* residual length */ 582 union { 583 struct {
|
584 u_int32_t _reserved; 585 u_int16_t _reserved2; 586 u_int16_t ct_scsi_status; 587 u_int32_t ct_xfrlen;
| 584 uint32_t _reserved; 585 uint16_t _reserved2; 586 uint16_t ct_scsi_status; 587 uint32_t ct_xfrlen;
|
588 union { 589 ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */ 590 ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */ 591 ispdslist_t ct_c; /* CTIO4 */ 592 } _u; 593 } m0; 594 struct {
| 588 union { 589 ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */ 590 ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */ 591 ispdslist_t ct_c; /* CTIO4 */ 592 } _u; 593 } m0; 594 struct {
|
595 u_int16_t _reserved; 596 u_int16_t _reserved2; 597 u_int16_t ct_senselen; 598 u_int16_t ct_scsi_status; 599 u_int16_t ct_resplen; 600 u_int8_t ct_resp[MAXRESPLEN];
| 595 uint16_t _reserved; 596 uint16_t _reserved2; 597 uint16_t ct_senselen; 598 uint16_t ct_scsi_status; 599 uint16_t ct_resplen; 600 uint8_t ct_resp[MAXRESPLEN];
|
601 } m1; 602 struct {
| 601 } m1; 602 struct {
|
603 u_int32_t _reserved; 604 u_int16_t _reserved2; 605 u_int16_t _reserved3; 606 u_int32_t ct_datalen;
| 603 uint32_t _reserved; 604 uint16_t _reserved2; 605 uint16_t _reserved3; 606 uint32_t ct_datalen;
|
607 ispds_t ct_fcp_rsp_iudata; 608 } m2; 609 } rsp; 610} ct2e_entry_t; 611 612/* 613 * ct_flags values for CTIO2 614 */ 615#define CT2_FLAG_MMASK 0x0003 616#define CT2_FLAG_MODE0 0x0000 617#define CT2_FLAG_MODE1 0x0001 618#define CT2_FLAG_MODE2 0x0002 619#define CT2_DATA_IN CT_DATA_IN 620#define CT2_DATA_OUT CT_DATA_OUT 621#define CT2_NO_DATA CT_NO_DATA 622#define CT2_DATAMASK CT_DATAMASK 623#define CT2_CCINCR 0x0100 624#define CT2_FASTPOST 0x0200 625#define CT2_TERMINATE 0x4000 626#define CT2_SENDSTATUS 0x8000 627 628/* 629 * ct_status values are (mostly) the same as that for ct_entry. 630 */ 631 632/* 633 * ct_scsi_status values- the low 8 bits are the normal SCSI status 634 * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU 635 * fields. 636 */ 637#define CT2_RSPLEN_VALID 0x0100 638#define CT2_SNSLEN_VALID 0x0200 639#define CT2_DATA_OVER 0x0400 640#define CT2_DATA_UNDER 0x0800 641 642/* 643 * Debug macros 644 */ 645 646#define ISP_TDQE(isp, msg, idx, arg) \ 647 if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 648 649/* 650 * The functions below are for the publicly available 651 * target mode functions that are internal to the Qlogic driver. 652 */ 653 654/* 655 * This function handles new response queue entry appropriate for target mode. 656 */
| 607 ispds_t ct_fcp_rsp_iudata; 608 } m2; 609 } rsp; 610} ct2e_entry_t; 611 612/* 613 * ct_flags values for CTIO2 614 */ 615#define CT2_FLAG_MMASK 0x0003 616#define CT2_FLAG_MODE0 0x0000 617#define CT2_FLAG_MODE1 0x0001 618#define CT2_FLAG_MODE2 0x0002 619#define CT2_DATA_IN CT_DATA_IN 620#define CT2_DATA_OUT CT_DATA_OUT 621#define CT2_NO_DATA CT_NO_DATA 622#define CT2_DATAMASK CT_DATAMASK 623#define CT2_CCINCR 0x0100 624#define CT2_FASTPOST 0x0200 625#define CT2_TERMINATE 0x4000 626#define CT2_SENDSTATUS 0x8000 627 628/* 629 * ct_status values are (mostly) the same as that for ct_entry. 630 */ 631 632/* 633 * ct_scsi_status values- the low 8 bits are the normal SCSI status 634 * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU 635 * fields. 636 */ 637#define CT2_RSPLEN_VALID 0x0100 638#define CT2_SNSLEN_VALID 0x0200 639#define CT2_DATA_OVER 0x0400 640#define CT2_DATA_UNDER 0x0800 641 642/* 643 * Debug macros 644 */ 645 646#define ISP_TDQE(isp, msg, idx, arg) \ 647 if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) 648 649/* 650 * The functions below are for the publicly available 651 * target mode functions that are internal to the Qlogic driver. 652 */ 653 654/* 655 * This function handles new response queue entry appropriate for target mode. 656 */
|
657int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
| 657int isp_target_notify(ispsoftc_t *, void *, uint16_t *);
|
658 659/* 660 * This function externalizes the ability to acknowledge an Immediate Notify 661 * request. 662 */
| 658 659/* 660 * This function externalizes the ability to acknowledge an Immediate Notify 661 * request. 662 */
|
663void isp_notify_ack(struct ispsoftc *, void *);
| 663void isp_notify_ack(ispsoftc_t *, void *);
|
664 665/* 666 * Enable/Disable/Modify a logical unit. 667 * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque) 668 */ 669#define DFLT_CMND_CNT 0xfe /* unmonitored */ 670#define DFLT_INOT_CNT 16
| 664 665/* 666 * Enable/Disable/Modify a logical unit. 667 * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque) 668 */ 669#define DFLT_CMND_CNT 0xfe /* unmonitored */ 670#define DFLT_INOT_CNT 16
|
671int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
| 671int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int, uint32_t);
|
672 673/* 674 * General request queue 'put' routine for target mode entries. 675 */
| 672 673/* 674 * General request queue 'put' routine for target mode entries. 675 */
|
676int isp_target_put_entry(struct ispsoftc *isp, void *);
| 676int isp_target_put_entry(ispsoftc_t *isp, void *);
|
677 678/* 679 * General routine to put back an ATIO entry- 680 * used for replenishing f/w resource counts. 681 * The argument is a pointer to a source ATIO 682 * or ATIO2. 683 */
| 677 678/* 679 * General routine to put back an ATIO entry- 680 * used for replenishing f/w resource counts. 681 * The argument is a pointer to a source ATIO 682 * or ATIO2. 683 */
|
684int isp_target_put_atio(struct ispsoftc *, void *);
| 684int isp_target_put_atio(ispsoftc_t *, void *);
|
685 686/* 687 * General routine to send a final CTIO for a command- used mostly for 688 * local responses. 689 */
| 685 686/* 687 * General routine to send a final CTIO for a command- used mostly for 688 * local responses. 689 */
|
690int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
| 690int isp_endcmd(ispsoftc_t *, void *, uint32_t, uint16_t);
|
691#define ECMD_SVALID 0x100 692 693/* 694 * Handle an asynchronous event 695 * 696 * Return nonzero if the interrupt that generated this event has been dismissed. 697 */
| 691#define ECMD_SVALID 0x100 692 693/* 694 * Handle an asynchronous event 695 * 696 * Return nonzero if the interrupt that generated this event has been dismissed. 697 */
|
698int isp_target_async(struct ispsoftc *, int, int);
| 698int isp_target_async(ispsoftc_t *, int, int);
|
699 700#endif /* _ISP_TARGET_H */
| 699 700#endif /* _ISP_TARGET_H */
|