Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004 - 2010 Vladislav Bolkhovitin <vst@vlnb.net> |
| 3 | * Copyright (C) 2004 - 2005 Leonid Stoljar |
| 4 | * Copyright (C) 2006 Nathaniel Clark <nate@misrule.us> |
| 5 | * Copyright (C) 2007 - 2010 ID7 Ltd. |
| 6 | * |
| 7 | * Forward port and refactoring to modern qla2xxx and target/configfs |
| 8 | * |
| 9 | * Copyright (C) 2010-2011 Nicholas A. Bellinger <nab@kernel.org> |
| 10 | * |
| 11 | * Additional file for the target driver support. |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU General Public License |
| 15 | * as published by the Free Software Foundation; either version 2 |
| 16 | * of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | */ |
| 23 | /* |
| 24 | * This is the global def file that is useful for including from the |
| 25 | * target portion. |
| 26 | */ |
| 27 | |
| 28 | #ifndef __QLA_TARGET_H |
| 29 | #define __QLA_TARGET_H |
| 30 | |
| 31 | #include "qla_def.h" |
| 32 | |
| 33 | /* |
| 34 | * Must be changed on any change in any initiator visible interfaces or |
| 35 | * data in the target add-on |
| 36 | */ |
| 37 | #define QLA2XXX_TARGET_MAGIC 269 |
| 38 | |
| 39 | /* |
| 40 | * Must be changed on any change in any target visible interfaces or |
| 41 | * data in the initiator |
| 42 | */ |
| 43 | #define QLA2XXX_INITIATOR_MAGIC 57222 |
| 44 | |
| 45 | #define QLA2XXX_INI_MODE_STR_EXCLUSIVE "exclusive" |
| 46 | #define QLA2XXX_INI_MODE_STR_DISABLED "disabled" |
| 47 | #define QLA2XXX_INI_MODE_STR_ENABLED "enabled" |
| 48 | |
| 49 | #define QLA2XXX_INI_MODE_EXCLUSIVE 0 |
| 50 | #define QLA2XXX_INI_MODE_DISABLED 1 |
| 51 | #define QLA2XXX_INI_MODE_ENABLED 2 |
| 52 | |
| 53 | #define QLA2XXX_COMMAND_COUNT_INIT 250 |
| 54 | #define QLA2XXX_IMMED_NOTIFY_COUNT_INIT 250 |
| 55 | |
| 56 | /* |
| 57 | * Used to mark which completion handles (for RIO Status's) are for CTIO's |
| 58 | * vs. regular (non-target) info. This is checked for in |
| 59 | * qla2x00_process_response_queue() to see if a handle coming back in a |
| 60 | * multi-complete should come to the tgt driver or be handled there by qla2xxx |
| 61 | */ |
| 62 | #define CTIO_COMPLETION_HANDLE_MARK BIT_29 |
Chad Dupuis | 8d93f55 | 2013-01-30 03:34:37 -0500 | [diff] [blame^] | 63 | #if (CTIO_COMPLETION_HANDLE_MARK <= DEFAULT_OUTSTANDING_COMMANDS) |
| 64 | #error "CTIO_COMPLETION_HANDLE_MARK not larger than " |
| 65 | "DEFAULT_OUTSTANDING_COMMANDS" |
Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 66 | #endif |
| 67 | #define HANDLE_IS_CTIO_COMP(h) (h & CTIO_COMPLETION_HANDLE_MARK) |
| 68 | |
| 69 | /* Used to mark CTIO as intermediate */ |
| 70 | #define CTIO_INTERMEDIATE_HANDLE_MARK BIT_30 |
| 71 | |
| 72 | #ifndef OF_SS_MODE_0 |
| 73 | /* |
| 74 | * ISP target entries - Flags bit definitions. |
| 75 | */ |
| 76 | #define OF_SS_MODE_0 0 |
| 77 | #define OF_SS_MODE_1 1 |
| 78 | #define OF_SS_MODE_2 2 |
| 79 | #define OF_SS_MODE_3 3 |
| 80 | |
| 81 | #define OF_EXPL_CONF BIT_5 /* Explicit Confirmation Requested */ |
| 82 | #define OF_DATA_IN BIT_6 /* Data in to initiator */ |
| 83 | /* (data from target to initiator) */ |
| 84 | #define OF_DATA_OUT BIT_7 /* Data out from initiator */ |
| 85 | /* (data from initiator to target) */ |
| 86 | #define OF_NO_DATA (BIT_7 | BIT_6) |
| 87 | #define OF_INC_RC BIT_8 /* Increment command resource count */ |
| 88 | #define OF_FAST_POST BIT_9 /* Enable mailbox fast posting. */ |
| 89 | #define OF_CONF_REQ BIT_13 /* Confirmation Requested */ |
| 90 | #define OF_TERM_EXCH BIT_14 /* Terminate exchange */ |
| 91 | #define OF_SSTS BIT_15 /* Send SCSI status */ |
| 92 | #endif |
| 93 | |
| 94 | #ifndef QLA_TGT_DATASEGS_PER_CMD32 |
| 95 | #define QLA_TGT_DATASEGS_PER_CMD32 3 |
| 96 | #define QLA_TGT_DATASEGS_PER_CONT32 7 |
| 97 | #define QLA_TGT_MAX_SG32(ql) \ |
| 98 | (((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD32 + \ |
| 99 | QLA_TGT_DATASEGS_PER_CONT32*((ql) - 1)) : 0) |
| 100 | |
| 101 | #define QLA_TGT_DATASEGS_PER_CMD64 2 |
| 102 | #define QLA_TGT_DATASEGS_PER_CONT64 5 |
| 103 | #define QLA_TGT_MAX_SG64(ql) \ |
| 104 | (((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD64 + \ |
| 105 | QLA_TGT_DATASEGS_PER_CONT64*((ql) - 1)) : 0) |
| 106 | #endif |
| 107 | |
| 108 | #ifndef QLA_TGT_DATASEGS_PER_CMD_24XX |
| 109 | #define QLA_TGT_DATASEGS_PER_CMD_24XX 1 |
| 110 | #define QLA_TGT_DATASEGS_PER_CONT_24XX 5 |
| 111 | #define QLA_TGT_MAX_SG_24XX(ql) \ |
| 112 | (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ |
| 113 | QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) |
| 114 | #endif |
| 115 | #endif |
| 116 | |
| 117 | #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ |
| 118 | ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ |
| 119 | : (uint16_t)(iocb)->u.isp2x.target.id.standard) |
| 120 | |
| 121 | #ifndef IMMED_NOTIFY_TYPE |
| 122 | #define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */ |
| 123 | /* |
| 124 | * ISP queue - immediate notify entry structure definition. |
| 125 | * This is sent by the ISP to the Target driver. |
| 126 | * This IOCB would have report of events sent by the |
| 127 | * initiator, that needs to be handled by the target |
| 128 | * driver immediately. |
| 129 | */ |
| 130 | struct imm_ntfy_from_isp { |
| 131 | uint8_t entry_type; /* Entry type. */ |
| 132 | uint8_t entry_count; /* Entry count. */ |
| 133 | uint8_t sys_define; /* System defined. */ |
| 134 | uint8_t entry_status; /* Entry Status. */ |
| 135 | union { |
| 136 | struct { |
| 137 | uint32_t sys_define_2; /* System defined. */ |
| 138 | target_id_t target; |
| 139 | uint16_t lun; |
| 140 | uint8_t target_id; |
| 141 | uint8_t reserved_1; |
| 142 | uint16_t status_modifier; |
| 143 | uint16_t status; |
| 144 | uint16_t task_flags; |
| 145 | uint16_t seq_id; |
| 146 | uint16_t srr_rx_id; |
| 147 | uint32_t srr_rel_offs; |
| 148 | uint16_t srr_ui; |
| 149 | #define SRR_IU_DATA_IN 0x1 |
| 150 | #define SRR_IU_DATA_OUT 0x5 |
| 151 | #define SRR_IU_STATUS 0x7 |
| 152 | uint16_t srr_ox_id; |
| 153 | uint8_t reserved_2[28]; |
| 154 | } isp2x; |
| 155 | struct { |
| 156 | uint32_t reserved; |
| 157 | uint16_t nport_handle; |
| 158 | uint16_t reserved_2; |
| 159 | uint16_t flags; |
| 160 | #define NOTIFY24XX_FLAGS_GLOBAL_TPRLO BIT_1 |
| 161 | #define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0 |
| 162 | uint16_t srr_rx_id; |
| 163 | uint16_t status; |
| 164 | uint8_t status_subcode; |
| 165 | uint8_t reserved_3; |
| 166 | uint32_t exchange_address; |
| 167 | uint32_t srr_rel_offs; |
| 168 | uint16_t srr_ui; |
| 169 | uint16_t srr_ox_id; |
| 170 | uint8_t reserved_4[19]; |
| 171 | uint8_t vp_index; |
| 172 | uint32_t reserved_5; |
| 173 | uint8_t port_id[3]; |
| 174 | uint8_t reserved_6; |
| 175 | } isp24; |
| 176 | } u; |
| 177 | uint16_t reserved_7; |
| 178 | uint16_t ox_id; |
| 179 | } __packed; |
| 180 | #endif |
| 181 | |
| 182 | #ifndef NOTIFY_ACK_TYPE |
| 183 | #define NOTIFY_ACK_TYPE 0x0E /* Notify acknowledge entry. */ |
| 184 | /* |
| 185 | * ISP queue - notify acknowledge entry structure definition. |
| 186 | * This is sent to the ISP from the target driver. |
| 187 | */ |
| 188 | struct nack_to_isp { |
| 189 | uint8_t entry_type; /* Entry type. */ |
| 190 | uint8_t entry_count; /* Entry count. */ |
| 191 | uint8_t sys_define; /* System defined. */ |
| 192 | uint8_t entry_status; /* Entry Status. */ |
| 193 | union { |
| 194 | struct { |
| 195 | uint32_t sys_define_2; /* System defined. */ |
| 196 | target_id_t target; |
| 197 | uint8_t target_id; |
| 198 | uint8_t reserved_1; |
| 199 | uint16_t flags; |
| 200 | uint16_t resp_code; |
| 201 | uint16_t status; |
| 202 | uint16_t task_flags; |
| 203 | uint16_t seq_id; |
| 204 | uint16_t srr_rx_id; |
| 205 | uint32_t srr_rel_offs; |
| 206 | uint16_t srr_ui; |
| 207 | uint16_t srr_flags; |
| 208 | uint16_t srr_reject_code; |
| 209 | uint8_t srr_reject_vendor_uniq; |
| 210 | uint8_t srr_reject_code_expl; |
| 211 | uint8_t reserved_2[24]; |
| 212 | } isp2x; |
| 213 | struct { |
| 214 | uint32_t handle; |
| 215 | uint16_t nport_handle; |
| 216 | uint16_t reserved_1; |
| 217 | uint16_t flags; |
| 218 | uint16_t srr_rx_id; |
| 219 | uint16_t status; |
| 220 | uint8_t status_subcode; |
| 221 | uint8_t reserved_3; |
| 222 | uint32_t exchange_address; |
| 223 | uint32_t srr_rel_offs; |
| 224 | uint16_t srr_ui; |
| 225 | uint16_t srr_flags; |
| 226 | uint8_t reserved_4[19]; |
| 227 | uint8_t vp_index; |
| 228 | uint8_t srr_reject_vendor_uniq; |
| 229 | uint8_t srr_reject_code_expl; |
| 230 | uint8_t srr_reject_code; |
| 231 | uint8_t reserved_5[5]; |
| 232 | } isp24; |
| 233 | } u; |
| 234 | uint8_t reserved[2]; |
| 235 | uint16_t ox_id; |
| 236 | } __packed; |
| 237 | #define NOTIFY_ACK_SRR_FLAGS_ACCEPT 0 |
| 238 | #define NOTIFY_ACK_SRR_FLAGS_REJECT 1 |
| 239 | |
| 240 | #define NOTIFY_ACK_SRR_REJECT_REASON_UNABLE_TO_PERFORM 0x9 |
| 241 | |
| 242 | #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_NO_EXPL 0 |
| 243 | #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_UNABLE_TO_SUPPLY_DATA 0x2a |
| 244 | |
| 245 | #define NOTIFY_ACK_SUCCESS 0x01 |
| 246 | #endif |
| 247 | |
| 248 | #ifndef ACCEPT_TGT_IO_TYPE |
| 249 | #define ACCEPT_TGT_IO_TYPE 0x16 /* Accept target I/O entry. */ |
| 250 | #endif |
| 251 | |
| 252 | #ifndef CONTINUE_TGT_IO_TYPE |
| 253 | #define CONTINUE_TGT_IO_TYPE 0x17 |
| 254 | /* |
| 255 | * ISP queue - Continue Target I/O (CTIO) entry for status mode 0 structure. |
| 256 | * This structure is sent to the ISP 2xxx from target driver. |
| 257 | */ |
| 258 | struct ctio_to_2xxx { |
| 259 | uint8_t entry_type; /* Entry type. */ |
| 260 | uint8_t entry_count; /* Entry count. */ |
| 261 | uint8_t sys_define; /* System defined. */ |
| 262 | uint8_t entry_status; /* Entry Status. */ |
| 263 | uint32_t handle; /* System defined handle */ |
| 264 | target_id_t target; |
| 265 | uint16_t rx_id; |
| 266 | uint16_t flags; |
| 267 | uint16_t status; |
| 268 | uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */ |
| 269 | uint16_t dseg_count; /* Data segment count. */ |
| 270 | uint32_t relative_offset; |
| 271 | uint32_t residual; |
| 272 | uint16_t reserved_1[3]; |
| 273 | uint16_t scsi_status; |
| 274 | uint32_t transfer_length; |
| 275 | uint32_t dseg_0_address; /* Data segment 0 address. */ |
| 276 | uint32_t dseg_0_length; /* Data segment 0 length. */ |
| 277 | uint32_t dseg_1_address; /* Data segment 1 address. */ |
| 278 | uint32_t dseg_1_length; /* Data segment 1 length. */ |
| 279 | uint32_t dseg_2_address; /* Data segment 2 address. */ |
| 280 | uint32_t dseg_2_length; /* Data segment 2 length. */ |
| 281 | } __packed; |
| 282 | #define ATIO_PATH_INVALID 0x07 |
| 283 | #define ATIO_CANT_PROV_CAP 0x16 |
| 284 | #define ATIO_CDB_VALID 0x3D |
| 285 | |
| 286 | #define ATIO_EXEC_READ BIT_1 |
| 287 | #define ATIO_EXEC_WRITE BIT_0 |
| 288 | #endif |
| 289 | |
| 290 | #ifndef CTIO_A64_TYPE |
| 291 | #define CTIO_A64_TYPE 0x1F |
| 292 | #define CTIO_SUCCESS 0x01 |
| 293 | #define CTIO_ABORTED 0x02 |
| 294 | #define CTIO_INVALID_RX_ID 0x08 |
| 295 | #define CTIO_TIMEOUT 0x0B |
| 296 | #define CTIO_LIP_RESET 0x0E |
| 297 | #define CTIO_TARGET_RESET 0x17 |
| 298 | #define CTIO_PORT_UNAVAILABLE 0x28 |
| 299 | #define CTIO_PORT_LOGGED_OUT 0x29 |
| 300 | #define CTIO_PORT_CONF_CHANGED 0x2A |
| 301 | #define CTIO_SRR_RECEIVED 0x45 |
| 302 | #endif |
| 303 | |
| 304 | #ifndef CTIO_RET_TYPE |
| 305 | #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ |
| 306 | #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ |
| 307 | |
| 308 | struct fcp_hdr { |
| 309 | uint8_t r_ctl; |
| 310 | uint8_t d_id[3]; |
| 311 | uint8_t cs_ctl; |
| 312 | uint8_t s_id[3]; |
| 313 | uint8_t type; |
| 314 | uint8_t f_ctl[3]; |
| 315 | uint8_t seq_id; |
| 316 | uint8_t df_ctl; |
| 317 | uint16_t seq_cnt; |
| 318 | uint16_t ox_id; |
| 319 | uint16_t rx_id; |
| 320 | uint32_t parameter; |
| 321 | } __packed; |
| 322 | |
| 323 | struct fcp_hdr_le { |
| 324 | uint8_t d_id[3]; |
| 325 | uint8_t r_ctl; |
| 326 | uint8_t s_id[3]; |
| 327 | uint8_t cs_ctl; |
| 328 | uint8_t f_ctl[3]; |
| 329 | uint8_t type; |
| 330 | uint16_t seq_cnt; |
| 331 | uint8_t df_ctl; |
| 332 | uint8_t seq_id; |
| 333 | uint16_t rx_id; |
| 334 | uint16_t ox_id; |
| 335 | uint32_t parameter; |
| 336 | } __packed; |
| 337 | |
| 338 | #define F_CTL_EXCH_CONTEXT_RESP BIT_23 |
| 339 | #define F_CTL_SEQ_CONTEXT_RESIP BIT_22 |
| 340 | #define F_CTL_LAST_SEQ BIT_20 |
| 341 | #define F_CTL_END_SEQ BIT_19 |
| 342 | #define F_CTL_SEQ_INITIATIVE BIT_16 |
| 343 | |
| 344 | #define R_CTL_BASIC_LINK_SERV 0x80 |
| 345 | #define R_CTL_B_ACC 0x4 |
| 346 | #define R_CTL_B_RJT 0x5 |
| 347 | |
| 348 | struct atio7_fcp_cmnd { |
| 349 | uint64_t lun; |
| 350 | uint8_t cmnd_ref; |
| 351 | uint8_t task_attr:3; |
| 352 | uint8_t reserved:5; |
| 353 | uint8_t task_mgmt_flags; |
| 354 | #define FCP_CMND_TASK_MGMT_CLEAR_ACA 6 |
| 355 | #define FCP_CMND_TASK_MGMT_TARGET_RESET 5 |
| 356 | #define FCP_CMND_TASK_MGMT_LU_RESET 4 |
| 357 | #define FCP_CMND_TASK_MGMT_CLEAR_TASK_SET 2 |
| 358 | #define FCP_CMND_TASK_MGMT_ABORT_TASK_SET 1 |
| 359 | uint8_t wrdata:1; |
| 360 | uint8_t rddata:1; |
| 361 | uint8_t add_cdb_len:6; |
| 362 | uint8_t cdb[16]; |
| 363 | /* |
| 364 | * add_cdb is optional and can absent from struct atio7_fcp_cmnd. Size 4 |
| 365 | * only to make sizeof(struct atio7_fcp_cmnd) be as expected by |
| 366 | * BUILD_BUG_ON in qlt_init(). |
| 367 | */ |
| 368 | uint8_t add_cdb[4]; |
| 369 | /* uint32_t data_length; */ |
| 370 | } __packed; |
| 371 | |
| 372 | /* |
| 373 | * ISP queue - Accept Target I/O (ATIO) type entry IOCB structure. |
| 374 | * This is sent from the ISP to the target driver. |
| 375 | */ |
| 376 | struct atio_from_isp { |
| 377 | union { |
| 378 | struct { |
| 379 | uint16_t entry_hdr; |
| 380 | uint8_t sys_define; /* System defined. */ |
| 381 | uint8_t entry_status; /* Entry Status. */ |
| 382 | uint32_t sys_define_2; /* System defined. */ |
| 383 | target_id_t target; |
| 384 | uint16_t rx_id; |
| 385 | uint16_t flags; |
| 386 | uint16_t status; |
| 387 | uint8_t command_ref; |
| 388 | uint8_t task_codes; |
| 389 | uint8_t task_flags; |
| 390 | uint8_t execution_codes; |
| 391 | uint8_t cdb[MAX_CMDSZ]; |
| 392 | uint32_t data_length; |
| 393 | uint16_t lun; |
| 394 | uint8_t initiator_port_name[WWN_SIZE]; /* on qla23xx */ |
| 395 | uint16_t reserved_32[6]; |
| 396 | uint16_t ox_id; |
| 397 | } isp2x; |
| 398 | struct { |
| 399 | uint16_t entry_hdr; |
| 400 | uint8_t fcp_cmnd_len_low; |
| 401 | uint8_t fcp_cmnd_len_high:4; |
| 402 | uint8_t attr:4; |
| 403 | uint32_t exchange_addr; |
| 404 | #define ATIO_EXCHANGE_ADDRESS_UNKNOWN 0xFFFFFFFF |
| 405 | struct fcp_hdr fcp_hdr; |
| 406 | struct atio7_fcp_cmnd fcp_cmnd; |
| 407 | } isp24; |
| 408 | struct { |
| 409 | uint8_t entry_type; /* Entry type. */ |
| 410 | uint8_t entry_count; /* Entry count. */ |
| 411 | uint8_t data[58]; |
| 412 | uint32_t signature; |
| 413 | #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ |
| 414 | } raw; |
| 415 | } u; |
| 416 | } __packed; |
| 417 | |
| 418 | #define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */ |
| 419 | |
| 420 | /* |
| 421 | * ISP queue - Continue Target I/O (ATIO) type 7 entry (for 24xx) structure. |
| 422 | * This structure is sent to the ISP 24xx from the target driver. |
| 423 | */ |
| 424 | |
| 425 | struct ctio7_to_24xx { |
| 426 | uint8_t entry_type; /* Entry type. */ |
| 427 | uint8_t entry_count; /* Entry count. */ |
| 428 | uint8_t sys_define; /* System defined. */ |
| 429 | uint8_t entry_status; /* Entry Status. */ |
| 430 | uint32_t handle; /* System defined handle */ |
| 431 | uint16_t nport_handle; |
| 432 | #define CTIO7_NHANDLE_UNRECOGNIZED 0xFFFF |
| 433 | uint16_t timeout; |
| 434 | uint16_t dseg_count; /* Data segment count. */ |
| 435 | uint8_t vp_index; |
| 436 | uint8_t add_flags; |
| 437 | uint8_t initiator_id[3]; |
| 438 | uint8_t reserved; |
| 439 | uint32_t exchange_addr; |
| 440 | union { |
| 441 | struct { |
| 442 | uint16_t reserved1; |
| 443 | uint16_t flags; |
| 444 | uint32_t residual; |
| 445 | uint16_t ox_id; |
| 446 | uint16_t scsi_status; |
| 447 | uint32_t relative_offset; |
| 448 | uint32_t reserved2; |
| 449 | uint32_t transfer_length; |
| 450 | uint32_t reserved3; |
| 451 | /* Data segment 0 address. */ |
| 452 | uint32_t dseg_0_address[2]; |
| 453 | /* Data segment 0 length. */ |
| 454 | uint32_t dseg_0_length; |
| 455 | } status0; |
| 456 | struct { |
| 457 | uint16_t sense_length; |
| 458 | uint16_t flags; |
| 459 | uint32_t residual; |
| 460 | uint16_t ox_id; |
| 461 | uint16_t scsi_status; |
| 462 | uint16_t response_len; |
| 463 | uint16_t reserved; |
| 464 | uint8_t sense_data[24]; |
| 465 | } status1; |
| 466 | } u; |
| 467 | } __packed; |
| 468 | |
| 469 | /* |
| 470 | * ISP queue - CTIO type 7 from ISP 24xx to target driver |
| 471 | * returned entry structure. |
| 472 | */ |
| 473 | struct ctio7_from_24xx { |
| 474 | uint8_t entry_type; /* Entry type. */ |
| 475 | uint8_t entry_count; /* Entry count. */ |
| 476 | uint8_t sys_define; /* System defined. */ |
| 477 | uint8_t entry_status; /* Entry Status. */ |
| 478 | uint32_t handle; /* System defined handle */ |
| 479 | uint16_t status; |
| 480 | uint16_t timeout; |
| 481 | uint16_t dseg_count; /* Data segment count. */ |
| 482 | uint8_t vp_index; |
| 483 | uint8_t reserved1[5]; |
| 484 | uint32_t exchange_address; |
| 485 | uint16_t reserved2; |
| 486 | uint16_t flags; |
| 487 | uint32_t residual; |
| 488 | uint16_t ox_id; |
| 489 | uint16_t reserved3; |
| 490 | uint32_t relative_offset; |
| 491 | uint8_t reserved4[24]; |
| 492 | } __packed; |
| 493 | |
| 494 | /* CTIO7 flags values */ |
| 495 | #define CTIO7_FLAGS_SEND_STATUS BIT_15 |
| 496 | #define CTIO7_FLAGS_TERMINATE BIT_14 |
| 497 | #define CTIO7_FLAGS_CONFORM_REQ BIT_13 |
| 498 | #define CTIO7_FLAGS_DONT_RET_CTIO BIT_8 |
| 499 | #define CTIO7_FLAGS_STATUS_MODE_0 0 |
| 500 | #define CTIO7_FLAGS_STATUS_MODE_1 BIT_6 |
| 501 | #define CTIO7_FLAGS_EXPLICIT_CONFORM BIT_5 |
| 502 | #define CTIO7_FLAGS_CONFIRM_SATISF BIT_4 |
| 503 | #define CTIO7_FLAGS_DSD_PTR BIT_2 |
| 504 | #define CTIO7_FLAGS_DATA_IN BIT_1 |
| 505 | #define CTIO7_FLAGS_DATA_OUT BIT_0 |
| 506 | |
| 507 | #define ELS_PLOGI 0x3 |
| 508 | #define ELS_FLOGI 0x4 |
| 509 | #define ELS_LOGO 0x5 |
| 510 | #define ELS_PRLI 0x20 |
| 511 | #define ELS_PRLO 0x21 |
| 512 | #define ELS_TPRLO 0x24 |
| 513 | #define ELS_PDISC 0x50 |
| 514 | #define ELS_ADISC 0x52 |
| 515 | |
| 516 | /* |
| 517 | * ISP queue - ABTS received/response entries structure definition for 24xx. |
| 518 | */ |
| 519 | #define ABTS_RECV_24XX 0x54 /* ABTS received (for 24xx) */ |
| 520 | #define ABTS_RESP_24XX 0x55 /* ABTS responce (for 24xx) */ |
| 521 | |
| 522 | /* |
| 523 | * ISP queue - ABTS received IOCB entry structure definition for 24xx. |
| 524 | * The ABTS BLS received from the wire is sent to the |
| 525 | * target driver by the ISP 24xx. |
| 526 | * The IOCB is placed on the response queue. |
| 527 | */ |
| 528 | struct abts_recv_from_24xx { |
| 529 | uint8_t entry_type; /* Entry type. */ |
| 530 | uint8_t entry_count; /* Entry count. */ |
| 531 | uint8_t sys_define; /* System defined. */ |
| 532 | uint8_t entry_status; /* Entry Status. */ |
| 533 | uint8_t reserved_1[6]; |
| 534 | uint16_t nport_handle; |
| 535 | uint8_t reserved_2[2]; |
| 536 | uint8_t vp_index; |
| 537 | uint8_t reserved_3:4; |
| 538 | uint8_t sof_type:4; |
| 539 | uint32_t exchange_address; |
| 540 | struct fcp_hdr_le fcp_hdr_le; |
| 541 | uint8_t reserved_4[16]; |
| 542 | uint32_t exchange_addr_to_abort; |
| 543 | } __packed; |
| 544 | |
| 545 | #define ABTS_PARAM_ABORT_SEQ BIT_0 |
| 546 | |
| 547 | struct ba_acc_le { |
| 548 | uint16_t reserved; |
| 549 | uint8_t seq_id_last; |
| 550 | uint8_t seq_id_valid; |
| 551 | #define SEQ_ID_VALID 0x80 |
| 552 | #define SEQ_ID_INVALID 0x00 |
| 553 | uint16_t rx_id; |
| 554 | uint16_t ox_id; |
| 555 | uint16_t high_seq_cnt; |
| 556 | uint16_t low_seq_cnt; |
| 557 | } __packed; |
| 558 | |
| 559 | struct ba_rjt_le { |
| 560 | uint8_t vendor_uniq; |
| 561 | uint8_t reason_expl; |
| 562 | uint8_t reason_code; |
| 563 | #define BA_RJT_REASON_CODE_INVALID_COMMAND 0x1 |
| 564 | #define BA_RJT_REASON_CODE_UNABLE_TO_PERFORM 0x9 |
| 565 | uint8_t reserved; |
| 566 | } __packed; |
| 567 | |
| 568 | /* |
| 569 | * ISP queue - ABTS Response IOCB entry structure definition for 24xx. |
| 570 | * The ABTS response to the ABTS received is sent by the |
| 571 | * target driver to the ISP 24xx. |
| 572 | * The IOCB is placed on the request queue. |
| 573 | */ |
| 574 | struct abts_resp_to_24xx { |
| 575 | uint8_t entry_type; /* Entry type. */ |
| 576 | uint8_t entry_count; /* Entry count. */ |
| 577 | uint8_t sys_define; /* System defined. */ |
| 578 | uint8_t entry_status; /* Entry Status. */ |
| 579 | uint32_t handle; |
| 580 | uint16_t reserved_1; |
| 581 | uint16_t nport_handle; |
| 582 | uint16_t control_flags; |
| 583 | #define ABTS_CONTR_FLG_TERM_EXCHG BIT_0 |
| 584 | uint8_t vp_index; |
| 585 | uint8_t reserved_3:4; |
| 586 | uint8_t sof_type:4; |
| 587 | uint32_t exchange_address; |
| 588 | struct fcp_hdr_le fcp_hdr_le; |
| 589 | union { |
| 590 | struct ba_acc_le ba_acct; |
| 591 | struct ba_rjt_le ba_rjt; |
| 592 | } __packed payload; |
| 593 | uint32_t reserved_4; |
| 594 | uint32_t exchange_addr_to_abort; |
| 595 | } __packed; |
| 596 | |
| 597 | /* |
| 598 | * ISP queue - ABTS Response IOCB from ISP24xx Firmware entry structure. |
| 599 | * The ABTS response with completion status to the ABTS response |
| 600 | * (sent by the target driver to the ISP 24xx) is sent by the |
| 601 | * ISP24xx firmware to the target driver. |
| 602 | * The IOCB is placed on the response queue. |
| 603 | */ |
| 604 | struct abts_resp_from_24xx_fw { |
| 605 | uint8_t entry_type; /* Entry type. */ |
| 606 | uint8_t entry_count; /* Entry count. */ |
| 607 | uint8_t sys_define; /* System defined. */ |
| 608 | uint8_t entry_status; /* Entry Status. */ |
| 609 | uint32_t handle; |
| 610 | uint16_t compl_status; |
| 611 | #define ABTS_RESP_COMPL_SUCCESS 0 |
| 612 | #define ABTS_RESP_COMPL_SUBCODE_ERROR 0x31 |
| 613 | uint16_t nport_handle; |
| 614 | uint16_t reserved_1; |
| 615 | uint8_t reserved_2; |
| 616 | uint8_t reserved_3:4; |
| 617 | uint8_t sof_type:4; |
| 618 | uint32_t exchange_address; |
| 619 | struct fcp_hdr_le fcp_hdr_le; |
| 620 | uint8_t reserved_4[8]; |
| 621 | uint32_t error_subcode1; |
| 622 | #define ABTS_RESP_SUBCODE_ERR_ABORTED_EXCH_NOT_TERM 0x1E |
| 623 | uint32_t error_subcode2; |
| 624 | uint32_t exchange_addr_to_abort; |
| 625 | } __packed; |
| 626 | |
| 627 | /********************************************************************\ |
| 628 | * Type Definitions used by initiator & target halves |
| 629 | \********************************************************************/ |
| 630 | |
| 631 | struct qla_tgt_mgmt_cmd; |
| 632 | struct qla_tgt_sess; |
| 633 | |
| 634 | /* |
| 635 | * This structure provides a template of function calls that the |
| 636 | * target driver (from within qla_target.c) can issue to the |
| 637 | * target module (tcm_qla2xxx). |
| 638 | */ |
| 639 | struct qla_tgt_func_tmpl { |
| 640 | |
| 641 | int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *, |
| 642 | unsigned char *, uint32_t, int, int, int); |
Christoph Hellwig | 43381ce | 2012-07-08 15:58:44 -0400 | [diff] [blame] | 643 | void (*handle_data)(struct qla_tgt_cmd *); |
Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 644 | int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint8_t, |
| 645 | uint32_t); |
| 646 | void (*free_cmd)(struct qla_tgt_cmd *); |
| 647 | void (*free_mcmd)(struct qla_tgt_mgmt_cmd *); |
| 648 | void (*free_session)(struct qla_tgt_sess *); |
| 649 | |
| 650 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, |
| 651 | void *, uint8_t *, uint16_t); |
Roland Dreier | c8292d1 | 2012-10-11 13:41:32 -0700 | [diff] [blame] | 652 | void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); |
Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 653 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, |
| 654 | const uint16_t); |
| 655 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, |
| 656 | const uint8_t *); |
| 657 | void (*clear_nacl_from_fcport_map)(struct qla_tgt_sess *); |
| 658 | void (*put_sess)(struct qla_tgt_sess *); |
| 659 | void (*shutdown_sess)(struct qla_tgt_sess *); |
| 660 | }; |
| 661 | |
| 662 | int qla2x00_wait_for_hba_online(struct scsi_qla_host *); |
| 663 | |
| 664 | #include <target/target_core_base.h> |
| 665 | |
| 666 | #define QLA_TGT_TIMEOUT 10 /* in seconds */ |
| 667 | |
| 668 | #define QLA_TGT_MAX_HW_PENDING_TIME 60 /* in seconds */ |
| 669 | |
| 670 | /* Immediate notify status constants */ |
| 671 | #define IMM_NTFY_LIP_RESET 0x000E |
| 672 | #define IMM_NTFY_LIP_LINK_REINIT 0x000F |
| 673 | #define IMM_NTFY_IOCB_OVERFLOW 0x0016 |
| 674 | #define IMM_NTFY_ABORT_TASK 0x0020 |
| 675 | #define IMM_NTFY_PORT_LOGOUT 0x0029 |
| 676 | #define IMM_NTFY_PORT_CONFIG 0x002A |
| 677 | #define IMM_NTFY_GLBL_TPRLO 0x002D |
| 678 | #define IMM_NTFY_GLBL_LOGO 0x002E |
| 679 | #define IMM_NTFY_RESOURCE 0x0034 |
| 680 | #define IMM_NTFY_MSG_RX 0x0036 |
| 681 | #define IMM_NTFY_SRR 0x0045 |
| 682 | #define IMM_NTFY_ELS 0x0046 |
| 683 | |
| 684 | /* Immediate notify task flags */ |
| 685 | #define IMM_NTFY_TASK_MGMT_SHIFT 8 |
| 686 | |
| 687 | #define QLA_TGT_CLEAR_ACA 0x40 |
| 688 | #define QLA_TGT_TARGET_RESET 0x20 |
| 689 | #define QLA_TGT_LUN_RESET 0x10 |
| 690 | #define QLA_TGT_CLEAR_TS 0x04 |
| 691 | #define QLA_TGT_ABORT_TS 0x02 |
| 692 | #define QLA_TGT_ABORT_ALL_SESS 0xFFFF |
| 693 | #define QLA_TGT_ABORT_ALL 0xFFFE |
| 694 | #define QLA_TGT_NEXUS_LOSS_SESS 0xFFFD |
| 695 | #define QLA_TGT_NEXUS_LOSS 0xFFFC |
| 696 | |
| 697 | /* Notify Acknowledge flags */ |
| 698 | #define NOTIFY_ACK_RES_COUNT BIT_8 |
| 699 | #define NOTIFY_ACK_CLEAR_LIP_RESET BIT_5 |
| 700 | #define NOTIFY_ACK_TM_RESP_CODE_VALID BIT_4 |
| 701 | |
| 702 | /* Command's states */ |
| 703 | #define QLA_TGT_STATE_NEW 0 /* New command + target processing */ |
| 704 | #define QLA_TGT_STATE_NEED_DATA 1 /* target needs data to continue */ |
| 705 | #define QLA_TGT_STATE_DATA_IN 2 /* Data arrived + target processing */ |
| 706 | #define QLA_TGT_STATE_PROCESSED 3 /* target done processing */ |
| 707 | #define QLA_TGT_STATE_ABORTED 4 /* Command aborted */ |
| 708 | |
| 709 | /* Special handles */ |
| 710 | #define QLA_TGT_NULL_HANDLE 0 |
| 711 | #define QLA_TGT_SKIP_HANDLE (0xFFFFFFFF & ~CTIO_COMPLETION_HANDLE_MARK) |
| 712 | |
| 713 | /* ATIO task_codes field */ |
| 714 | #define ATIO_SIMPLE_QUEUE 0 |
| 715 | #define ATIO_HEAD_OF_QUEUE 1 |
| 716 | #define ATIO_ORDERED_QUEUE 2 |
| 717 | #define ATIO_ACA_QUEUE 4 |
| 718 | #define ATIO_UNTAGGED 5 |
| 719 | |
| 720 | /* TM failed response codes, see FCP (9.4.11 FCP_RSP_INFO) */ |
| 721 | #define FC_TM_SUCCESS 0 |
| 722 | #define FC_TM_BAD_FCP_DATA 1 |
| 723 | #define FC_TM_BAD_CMD 2 |
| 724 | #define FC_TM_FCP_DATA_MISMATCH 3 |
| 725 | #define FC_TM_REJECT 4 |
| 726 | #define FC_TM_FAILED 5 |
| 727 | |
| 728 | /* |
| 729 | * Error code of qlt_pre_xmit_response() meaning that cmd's exchange was |
| 730 | * terminated, so no more actions is needed and success should be returned |
| 731 | * to target. |
| 732 | */ |
| 733 | #define QLA_TGT_PRE_XMIT_RESP_CMD_ABORTED 0x1717 |
| 734 | |
| 735 | #if (BITS_PER_LONG > 32) || defined(CONFIG_HIGHMEM64G) |
| 736 | #define pci_dma_lo32(a) (a & 0xffffffff) |
| 737 | #define pci_dma_hi32(a) ((((a) >> 16)>>16) & 0xffffffff) |
| 738 | #else |
| 739 | #define pci_dma_lo32(a) (a & 0xffffffff) |
| 740 | #define pci_dma_hi32(a) 0 |
| 741 | #endif |
| 742 | |
| 743 | #define QLA_TGT_SENSE_VALID(sense) ((sense != NULL) && \ |
| 744 | (((const uint8_t *)(sense))[0] & 0x70) == 0x70) |
| 745 | |
| 746 | struct qla_port_24xx_data { |
| 747 | uint8_t port_name[WWN_SIZE]; |
| 748 | uint16_t loop_id; |
| 749 | uint16_t reserved; |
| 750 | }; |
| 751 | |
| 752 | struct qla_tgt { |
| 753 | struct scsi_qla_host *vha; |
| 754 | struct qla_hw_data *ha; |
| 755 | |
| 756 | /* |
| 757 | * To sync between IRQ handlers and qlt_target_release(). Needed, |
| 758 | * because req_pkt() can drop/reaquire HW lock inside. Protected by |
| 759 | * HW lock. |
| 760 | */ |
| 761 | int irq_cmd_count; |
| 762 | |
| 763 | int datasegs_per_cmd, datasegs_per_cont, sg_tablesize; |
| 764 | |
| 765 | /* Target's flags, serialized by pha->hardware_lock */ |
| 766 | unsigned int tgt_enable_64bit_addr:1; /* 64-bits PCI addr enabled */ |
| 767 | unsigned int link_reinit_iocb_pending:1; |
| 768 | |
| 769 | /* |
| 770 | * Protected by tgt_mutex AND hardware_lock for writing and tgt_mutex |
| 771 | * OR hardware_lock for reading. |
| 772 | */ |
| 773 | int tgt_stop; /* the target mode driver is being stopped */ |
| 774 | int tgt_stopped; /* the target mode driver has been stopped */ |
| 775 | |
| 776 | /* Count of sessions refering qla_tgt. Protected by hardware_lock. */ |
| 777 | int sess_count; |
| 778 | |
| 779 | /* Protected by hardware_lock. Addition also protected by tgt_mutex. */ |
| 780 | struct list_head sess_list; |
| 781 | |
| 782 | /* Protected by hardware_lock */ |
| 783 | struct list_head del_sess_list; |
| 784 | struct delayed_work sess_del_work; |
| 785 | |
| 786 | spinlock_t sess_work_lock; |
| 787 | struct list_head sess_works_list; |
| 788 | struct work_struct sess_work; |
| 789 | |
| 790 | struct imm_ntfy_from_isp link_reinit_iocb; |
| 791 | wait_queue_head_t waitQ; |
| 792 | int notify_ack_expected; |
| 793 | int abts_resp_expected; |
| 794 | int modify_lun_expected; |
| 795 | |
| 796 | int ctio_srr_id; |
| 797 | int imm_srr_id; |
| 798 | spinlock_t srr_lock; |
| 799 | struct list_head srr_ctio_list; |
| 800 | struct list_head srr_imm_list; |
| 801 | struct work_struct srr_work; |
| 802 | |
| 803 | atomic_t tgt_global_resets_count; |
| 804 | |
| 805 | struct list_head tgt_list_entry; |
| 806 | }; |
| 807 | |
| 808 | /* |
| 809 | * Equivilant to IT Nexus (Initiator-Target) |
| 810 | */ |
| 811 | struct qla_tgt_sess { |
| 812 | uint16_t loop_id; |
| 813 | port_id_t s_id; |
| 814 | |
| 815 | unsigned int conf_compl_supported:1; |
| 816 | unsigned int deleted:1; |
| 817 | unsigned int local:1; |
Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 818 | |
| 819 | struct se_session *se_sess; |
| 820 | struct scsi_qla_host *vha; |
| 821 | struct qla_tgt *tgt; |
| 822 | |
| 823 | struct list_head sess_list_entry; |
| 824 | unsigned long expires; |
| 825 | struct list_head del_list_entry; |
| 826 | |
| 827 | uint8_t port_name[WWN_SIZE]; |
| 828 | struct work_struct free_work; |
| 829 | }; |
| 830 | |
| 831 | struct qla_tgt_cmd { |
| 832 | struct qla_tgt_sess *sess; |
| 833 | int state; |
| 834 | struct se_cmd se_cmd; |
| 835 | struct work_struct free_work; |
| 836 | struct work_struct work; |
| 837 | /* Sense buffer that will be mapped into outgoing status */ |
| 838 | unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; |
| 839 | |
| 840 | /* to save extra sess dereferences */ |
| 841 | unsigned int conf_compl_supported:1; |
| 842 | unsigned int sg_mapped:1; |
| 843 | unsigned int free_sg:1; |
| 844 | unsigned int aborted:1; /* Needed in case of SRR */ |
| 845 | unsigned int write_data_transferred:1; |
| 846 | |
| 847 | struct scatterlist *sg; /* cmd data buffer SG vector */ |
| 848 | int sg_cnt; /* SG segments count */ |
| 849 | int bufflen; /* cmd buffer length */ |
| 850 | int offset; |
| 851 | uint32_t tag; |
| 852 | uint32_t unpacked_lun; |
| 853 | enum dma_data_direction dma_data_direction; |
| 854 | |
| 855 | uint16_t loop_id; /* to save extra sess dereferences */ |
| 856 | struct qla_tgt *tgt; /* to save extra sess dereferences */ |
| 857 | struct scsi_qla_host *vha; |
| 858 | struct list_head cmd_list; |
| 859 | |
| 860 | struct atio_from_isp atio; |
| 861 | }; |
| 862 | |
| 863 | struct qla_tgt_sess_work_param { |
| 864 | struct list_head sess_works_list_entry; |
| 865 | |
| 866 | #define QLA_TGT_SESS_WORK_ABORT 1 |
| 867 | #define QLA_TGT_SESS_WORK_TM 2 |
| 868 | int type; |
| 869 | |
| 870 | union { |
| 871 | struct abts_recv_from_24xx abts; |
| 872 | struct imm_ntfy_from_isp tm_iocb; |
| 873 | struct atio_from_isp tm_iocb2; |
| 874 | }; |
| 875 | }; |
| 876 | |
| 877 | struct qla_tgt_mgmt_cmd { |
| 878 | uint8_t tmr_func; |
| 879 | uint8_t fc_tm_rsp; |
| 880 | struct qla_tgt_sess *sess; |
| 881 | struct se_cmd se_cmd; |
| 882 | struct work_struct free_work; |
| 883 | unsigned int flags; |
| 884 | #define QLA24XX_MGMT_SEND_NACK 1 |
| 885 | union { |
| 886 | struct atio_from_isp atio; |
| 887 | struct imm_ntfy_from_isp imm_ntfy; |
| 888 | struct abts_recv_from_24xx abts; |
| 889 | } __packed orig_iocb; |
| 890 | }; |
| 891 | |
| 892 | struct qla_tgt_prm { |
| 893 | struct qla_tgt_cmd *cmd; |
| 894 | struct qla_tgt *tgt; |
| 895 | void *pkt; |
| 896 | struct scatterlist *sg; /* cmd data buffer SG vector */ |
| 897 | int seg_cnt; |
| 898 | int req_cnt; |
| 899 | uint16_t rq_result; |
| 900 | uint16_t scsi_status; |
| 901 | unsigned char *sense_buffer; |
| 902 | int sense_buffer_len; |
| 903 | int residual; |
| 904 | int add_status_pkt; |
| 905 | }; |
| 906 | |
| 907 | struct qla_tgt_srr_imm { |
| 908 | struct list_head srr_list_entry; |
| 909 | int srr_id; |
| 910 | struct imm_ntfy_from_isp imm_ntfy; |
| 911 | }; |
| 912 | |
| 913 | struct qla_tgt_srr_ctio { |
| 914 | struct list_head srr_list_entry; |
| 915 | int srr_id; |
| 916 | struct qla_tgt_cmd *cmd; |
| 917 | }; |
| 918 | |
| 919 | #define QLA_TGT_XMIT_DATA 1 |
| 920 | #define QLA_TGT_XMIT_STATUS 2 |
| 921 | #define QLA_TGT_XMIT_ALL (QLA_TGT_XMIT_STATUS|QLA_TGT_XMIT_DATA) |
| 922 | |
Nicholas Bellinger | 2d70c10 | 2012-05-15 14:34:28 -0400 | [diff] [blame] | 923 | |
| 924 | extern struct qla_tgt_data qla_target; |
| 925 | /* |
| 926 | * Internal function prototypes |
| 927 | */ |
| 928 | void qlt_disable_vha(struct scsi_qla_host *); |
| 929 | |
| 930 | /* |
| 931 | * Function prototypes for qla_target.c logic used by qla2xxx LLD code. |
| 932 | */ |
| 933 | extern int qlt_add_target(struct qla_hw_data *, struct scsi_qla_host *); |
| 934 | extern int qlt_remove_target(struct qla_hw_data *, struct scsi_qla_host *); |
| 935 | extern int qlt_lport_register(struct qla_tgt_func_tmpl *, u64, |
| 936 | int (*callback)(struct scsi_qla_host *), void *); |
| 937 | extern void qlt_lport_deregister(struct scsi_qla_host *); |
| 938 | extern void qlt_unreg_sess(struct qla_tgt_sess *); |
| 939 | extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *); |
| 940 | extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *); |
| 941 | extern void qlt_set_mode(struct scsi_qla_host *ha); |
| 942 | extern void qlt_clear_mode(struct scsi_qla_host *ha); |
| 943 | extern int __init qlt_init(void); |
| 944 | extern void qlt_exit(void); |
| 945 | extern void qlt_update_vp_map(struct scsi_qla_host *, int); |
| 946 | |
| 947 | /* |
| 948 | * This macro is used during early initializations when host->active_mode |
| 949 | * is not set. Right now, ha value is ignored. |
| 950 | */ |
| 951 | #define QLA_TGT_MODE_ENABLED() (ql2x_ini_mode != QLA2XXX_INI_MODE_ENABLED) |
| 952 | |
| 953 | static inline bool qla_tgt_mode_enabled(struct scsi_qla_host *ha) |
| 954 | { |
| 955 | return ha->host->active_mode & MODE_TARGET; |
| 956 | } |
| 957 | |
| 958 | static inline bool qla_ini_mode_enabled(struct scsi_qla_host *ha) |
| 959 | { |
| 960 | return ha->host->active_mode & MODE_INITIATOR; |
| 961 | } |
| 962 | |
| 963 | static inline void qla_reverse_ini_mode(struct scsi_qla_host *ha) |
| 964 | { |
| 965 | if (ha->host->active_mode & MODE_INITIATOR) |
| 966 | ha->host->active_mode &= ~MODE_INITIATOR; |
| 967 | else |
| 968 | ha->host->active_mode |= MODE_INITIATOR; |
| 969 | } |
| 970 | |
| 971 | /* |
| 972 | * Exported symbols from qla_target.c LLD logic used by qla2xxx code.. |
| 973 | */ |
| 974 | extern void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *, |
| 975 | struct atio_from_isp *); |
| 976 | extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); |
| 977 | extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); |
| 978 | extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); |
| 979 | extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); |
| 980 | extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); |
| 981 | extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); |
| 982 | extern void qlt_ctio_completion(struct scsi_qla_host *, uint32_t); |
| 983 | extern void qlt_async_event(uint16_t, struct scsi_qla_host *, uint16_t *); |
| 984 | extern void qlt_enable_vha(struct scsi_qla_host *); |
| 985 | extern void qlt_vport_create(struct scsi_qla_host *, struct qla_hw_data *); |
| 986 | extern void qlt_rff_id(struct scsi_qla_host *, struct ct_sns_req *); |
| 987 | extern void qlt_init_atio_q_entries(struct scsi_qla_host *); |
| 988 | extern void qlt_24xx_process_atio_queue(struct scsi_qla_host *); |
| 989 | extern void qlt_24xx_config_rings(struct scsi_qla_host *, |
| 990 | device_reg_t __iomem *); |
| 991 | extern void qlt_24xx_config_nvram_stage1(struct scsi_qla_host *, |
| 992 | struct nvram_24xx *); |
| 993 | extern void qlt_24xx_config_nvram_stage2(struct scsi_qla_host *, |
| 994 | struct init_cb_24xx *); |
| 995 | extern int qlt_24xx_process_response_error(struct scsi_qla_host *, |
| 996 | struct sts_entry_24xx *); |
| 997 | extern void qlt_modify_vp_config(struct scsi_qla_host *, |
| 998 | struct vp_config_entry_24xx *); |
| 999 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); |
| 1000 | extern int qlt_mem_alloc(struct qla_hw_data *); |
| 1001 | extern void qlt_mem_free(struct qla_hw_data *); |
| 1002 | extern void qlt_stop_phase1(struct qla_tgt *); |
| 1003 | extern void qlt_stop_phase2(struct qla_tgt *); |
| 1004 | |
| 1005 | #endif /* __QLA_TARGET_H */ |