Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  Copyright (C) 2004 - 2010 Vladislav Bolkhovitin <vst@vlnb.net>
0004  *  Copyright (C) 2004 - 2005 Leonid Stoljar
0005  *  Copyright (C) 2006 Nathaniel Clark <nate@misrule.us>
0006  *  Copyright (C) 2007 - 2010 ID7 Ltd.
0007  *
0008  *  Forward port and refactoring to modern qla2xxx and target/configfs
0009  *
0010  *  Copyright (C) 2010-2011 Nicholas A. Bellinger <nab@kernel.org>
0011  *
0012  *  Additional file for the target driver support.
0013  */
0014 /*
0015  * This is the global def file that is useful for including from the
0016  * target portion.
0017  */
0018 
0019 #ifndef __QLA_TARGET_H
0020 #define __QLA_TARGET_H
0021 
0022 #include "qla_def.h"
0023 #include "qla_dsd.h"
0024 
0025 /*
0026  * Must be changed on any change in any initiator visible interfaces or
0027  * data in the target add-on
0028  */
0029 #define QLA2XXX_TARGET_MAGIC    269
0030 
0031 /*
0032  * Must be changed on any change in any target visible interfaces or
0033  * data in the initiator
0034  */
0035 #define QLA2XXX_INITIATOR_MAGIC   57222
0036 
0037 #define QLA2XXX_INI_MODE_STR_EXCLUSIVE  "exclusive"
0038 #define QLA2XXX_INI_MODE_STR_DISABLED   "disabled"
0039 #define QLA2XXX_INI_MODE_STR_ENABLED    "enabled"
0040 #define QLA2XXX_INI_MODE_STR_DUAL       "dual"
0041 
0042 #define QLA2XXX_INI_MODE_EXCLUSIVE  0
0043 #define QLA2XXX_INI_MODE_DISABLED   1
0044 #define QLA2XXX_INI_MODE_ENABLED    2
0045 #define QLA2XXX_INI_MODE_DUAL   3
0046 
0047 #define QLA2XXX_COMMAND_COUNT_INIT  250
0048 #define QLA2XXX_IMMED_NOTIFY_COUNT_INIT 250
0049 
0050 /*
0051  * Used to mark which completion handles (for RIO Status's) are for CTIO's
0052  * vs. regular (non-target) info. This is checked for in
0053  * qla2x00_process_response_queue() to see if a handle coming back in a
0054  * multi-complete should come to the tgt driver or be handled there by qla2xxx
0055  */
0056 #define CTIO_COMPLETION_HANDLE_MARK BIT_29
0057 #if (CTIO_COMPLETION_HANDLE_MARK <= DEFAULT_OUTSTANDING_COMMANDS)
0058 #error "CTIO_COMPLETION_HANDLE_MARK not larger than "
0059     "DEFAULT_OUTSTANDING_COMMANDS"
0060 #endif
0061 #define HANDLE_IS_CTIO_COMP(h) (h & CTIO_COMPLETION_HANDLE_MARK)
0062 
0063 /* Used to mark CTIO as intermediate */
0064 #define CTIO_INTERMEDIATE_HANDLE_MARK   BIT_30
0065 #define QLA_TGT_NULL_HANDLE 0
0066 
0067 #define QLA_TGT_HANDLE_MASK  0xF0000000
0068 #define QLA_QPID_HANDLE_MASK 0x00FF0000 /* qpair id mask */
0069 #define QLA_CMD_HANDLE_MASK  0x0000FFFF
0070 #define QLA_TGT_SKIP_HANDLE (0xFFFFFFFF & ~QLA_TGT_HANDLE_MASK)
0071 
0072 #define QLA_QPID_HANDLE_SHIFT 16
0073 #define GET_QID(_h) ((_h & QLA_QPID_HANDLE_MASK) >> QLA_QPID_HANDLE_SHIFT)
0074 
0075 
0076 #ifndef OF_SS_MODE_0
0077 /*
0078  * ISP target entries - Flags bit definitions.
0079  */
0080 #define OF_SS_MODE_0        0
0081 #define OF_SS_MODE_1        1
0082 #define OF_SS_MODE_2        2
0083 #define OF_SS_MODE_3        3
0084 
0085 #define OF_EXPL_CONF        BIT_5       /* Explicit Confirmation Requested */
0086 #define OF_DATA_IN          BIT_6       /* Data in to initiator */
0087                     /*  (data from target to initiator) */
0088 #define OF_DATA_OUT         BIT_7       /* Data out from initiator */
0089                     /*  (data from initiator to target) */
0090 #define OF_NO_DATA          (BIT_7 | BIT_6)
0091 #define OF_INC_RC           BIT_8       /* Increment command resource count */
0092 #define OF_FAST_POST        BIT_9       /* Enable mailbox fast posting. */
0093 #define OF_CONF_REQ         BIT_13      /* Confirmation Requested */
0094 #define OF_TERM_EXCH        BIT_14      /* Terminate exchange */
0095 #define OF_SSTS             BIT_15      /* Send SCSI status */
0096 #endif
0097 
0098 #ifndef QLA_TGT_DATASEGS_PER_CMD32
0099 #define QLA_TGT_DATASEGS_PER_CMD32  3
0100 #define QLA_TGT_DATASEGS_PER_CONT32 7
0101 #define QLA_TGT_MAX_SG32(ql) \
0102     (((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD32 + \
0103         QLA_TGT_DATASEGS_PER_CONT32*((ql) - 1)) : 0)
0104 
0105 #define QLA_TGT_DATASEGS_PER_CMD64  2
0106 #define QLA_TGT_DATASEGS_PER_CONT64 5
0107 #define QLA_TGT_MAX_SG64(ql) \
0108     (((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD64 + \
0109         QLA_TGT_DATASEGS_PER_CONT64*((ql) - 1)) : 0)
0110 #endif
0111 
0112 #ifndef QLA_TGT_DATASEGS_PER_CMD_24XX
0113 #define QLA_TGT_DATASEGS_PER_CMD_24XX   1
0114 #define QLA_TGT_DATASEGS_PER_CONT_24XX  5
0115 #define QLA_TGT_MAX_SG_24XX(ql) \
0116     (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \
0117         QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0))
0118 #endif
0119 
0120 #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha))         \
0121              ? le16_to_cpu((iocb)->u.isp2x.target.extended) \
0122              : (uint16_t)(iocb)->u.isp2x.target.id.standard)
0123 
0124 #ifndef NOTIFY_ACK_TYPE
0125 #define NOTIFY_ACK_TYPE 0x0E      /* Notify acknowledge entry. */
0126 /*
0127  * ISP queue -  notify acknowledge entry structure definition.
0128  *      This is sent to the ISP from the target driver.
0129  */
0130 struct nack_to_isp {
0131     uint8_t  entry_type;            /* Entry type. */
0132     uint8_t  entry_count;           /* Entry count. */
0133     uint8_t  sys_define;            /* System defined. */
0134     uint8_t  entry_status;          /* Entry Status. */
0135     union {
0136         struct {
0137             __le32  sys_define_2; /* System defined. */
0138             target_id_t target;
0139             uint8_t  target_id;
0140             uint8_t  reserved_1;
0141             __le16  flags;
0142             __le16  resp_code;
0143             __le16  status;
0144             __le16  task_flags;
0145             __le16  seq_id;
0146             __le16  srr_rx_id;
0147             __le32  srr_rel_offs;
0148             __le16  srr_ui;
0149             __le16  srr_flags;
0150             __le16  srr_reject_code;
0151             uint8_t  srr_reject_vendor_uniq;
0152             uint8_t  srr_reject_code_expl;
0153             uint8_t  reserved_2[24];
0154         } isp2x;
0155         struct {
0156             uint32_t handle;
0157             __le16  nport_handle;
0158             uint16_t reserved_1;
0159             __le16  flags;
0160             __le16  srr_rx_id;
0161             __le16  status;
0162             uint8_t  status_subcode;
0163             uint8_t  fw_handle;
0164             __le32  exchange_address;
0165             __le32  srr_rel_offs;
0166             __le16  srr_ui;
0167             __le16  srr_flags;
0168             uint8_t  reserved_4[19];
0169             uint8_t  vp_index;
0170             uint8_t  srr_reject_vendor_uniq;
0171             uint8_t  srr_reject_code_expl;
0172             uint8_t  srr_reject_code;
0173             uint8_t  reserved_5[5];
0174         } isp24;
0175     } u;
0176     uint8_t  reserved[2];
0177     __le16  ox_id;
0178 } __packed;
0179 #define NOTIFY_ACK_FLAGS_FCSP       BIT_5
0180 #define NOTIFY_ACK_FLAGS_TERMINATE  BIT_3
0181 #define NOTIFY_ACK_SRR_FLAGS_ACCEPT 0
0182 #define NOTIFY_ACK_SRR_FLAGS_REJECT 1
0183 
0184 #define NOTIFY_ACK_SRR_REJECT_REASON_UNABLE_TO_PERFORM  0x9
0185 
0186 #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_NO_EXPL        0
0187 #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_UNABLE_TO_SUPPLY_DATA  0x2a
0188 
0189 #define NOTIFY_ACK_SUCCESS      0x01
0190 #endif
0191 
0192 #ifndef ACCEPT_TGT_IO_TYPE
0193 #define ACCEPT_TGT_IO_TYPE 0x16 /* Accept target I/O entry. */
0194 #endif
0195 
0196 #ifndef CONTINUE_TGT_IO_TYPE
0197 #define CONTINUE_TGT_IO_TYPE 0x17
0198 /*
0199  * ISP queue -  Continue Target I/O (CTIO) entry for status mode 0 structure.
0200  *      This structure is sent to the ISP 2xxx from target driver.
0201  */
0202 struct ctio_to_2xxx {
0203     uint8_t  entry_type;        /* Entry type. */
0204     uint8_t  entry_count;       /* Entry count. */
0205     uint8_t  sys_define;        /* System defined. */
0206     uint8_t  entry_status;      /* Entry Status. */
0207     uint32_t handle;        /* System defined handle */
0208     target_id_t target;
0209     __le16  rx_id;
0210     __le16  flags;
0211     __le16  status;
0212     __le16  timeout;        /* 0 = 30 seconds, 0xFFFF = disable */
0213     __le16  dseg_count;     /* Data segment count. */
0214     __le32  relative_offset;
0215     __le32  residual;
0216     __le16  reserved_1[3];
0217     __le16  scsi_status;
0218     __le32  transfer_length;
0219     struct dsd32 dsd[3];
0220 } __packed;
0221 #define ATIO_PATH_INVALID       0x07
0222 #define ATIO_CANT_PROV_CAP      0x16
0223 #define ATIO_CDB_VALID          0x3D
0224 
0225 #define ATIO_EXEC_READ          BIT_1
0226 #define ATIO_EXEC_WRITE         BIT_0
0227 #endif
0228 
0229 #ifndef CTIO_A64_TYPE
0230 #define CTIO_A64_TYPE 0x1F
0231 #define CTIO_SUCCESS            0x01
0232 #define CTIO_ABORTED            0x02
0233 #define CTIO_INVALID_RX_ID      0x08
0234 #define CTIO_TIMEOUT            0x0B
0235 #define CTIO_DIF_ERROR          0x0C     /* DIF error detected  */
0236 #define CTIO_LIP_RESET          0x0E
0237 #define CTIO_TARGET_RESET       0x17
0238 #define CTIO_PORT_UNAVAILABLE       0x28
0239 #define CTIO_PORT_LOGGED_OUT        0x29
0240 #define CTIO_PORT_CONF_CHANGED      0x2A
0241 #define CTIO_SRR_RECEIVED       0x45
0242 #define CTIO_FAST_AUTH_ERR      0x63
0243 #define CTIO_FAST_INCOMP_PAD_LEN    0x65
0244 #define CTIO_FAST_INVALID_REQ       0x66
0245 #define CTIO_FAST_SPI_ERR       0x67
0246 #endif
0247 
0248 #ifndef CTIO_RET_TYPE
0249 #define CTIO_RET_TYPE   0x17        /* CTIO return entry */
0250 #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */
0251 #endif
0252 
0253 struct fcp_hdr {
0254     uint8_t  r_ctl;
0255     be_id_t  d_id;
0256     uint8_t  cs_ctl;
0257     be_id_t  s_id;
0258     uint8_t  type;
0259     uint8_t  f_ctl[3];
0260     uint8_t  seq_id;
0261     uint8_t  df_ctl;
0262     uint16_t seq_cnt;
0263     __be16   ox_id;
0264     uint16_t rx_id;
0265     __le32  parameter;
0266 };
0267 
0268 struct fcp_hdr_le {
0269     le_id_t  d_id;
0270     uint8_t  r_ctl;
0271     le_id_t  s_id;
0272     uint8_t  cs_ctl;
0273     uint8_t  f_ctl[3];
0274     uint8_t  type;
0275     __le16  seq_cnt;
0276     uint8_t  df_ctl;
0277     uint8_t  seq_id;
0278     __le16  rx_id;
0279     __le16  ox_id;
0280     __le32  parameter;
0281 };
0282 
0283 #define F_CTL_EXCH_CONTEXT_RESP BIT_23
0284 #define F_CTL_SEQ_CONTEXT_RESIP BIT_22
0285 #define F_CTL_LAST_SEQ      BIT_20
0286 #define F_CTL_END_SEQ       BIT_19
0287 #define F_CTL_SEQ_INITIATIVE    BIT_16
0288 
0289 #define R_CTL_BASIC_LINK_SERV   0x80
0290 #define R_CTL_B_ACC     0x4
0291 #define R_CTL_B_RJT     0x5
0292 
0293 struct atio7_fcp_cmnd {
0294     uint64_t lun;
0295     uint8_t  cmnd_ref;
0296     uint8_t  task_attr:3;
0297     uint8_t  reserved:5;
0298     uint8_t  task_mgmt_flags;
0299 #define FCP_CMND_TASK_MGMT_CLEAR_ACA        6
0300 #define FCP_CMND_TASK_MGMT_TARGET_RESET     5
0301 #define FCP_CMND_TASK_MGMT_LU_RESET     4
0302 #define FCP_CMND_TASK_MGMT_CLEAR_TASK_SET   2
0303 #define FCP_CMND_TASK_MGMT_ABORT_TASK_SET   1
0304     uint8_t  wrdata:1;
0305     uint8_t  rddata:1;
0306     uint8_t  add_cdb_len:6;
0307     uint8_t  cdb[16];
0308     /*
0309      * add_cdb is optional and can absent from struct atio7_fcp_cmnd. Size 4
0310      * only to make sizeof(struct atio7_fcp_cmnd) be as expected by
0311      * BUILD_BUG_ON in qlt_init().
0312      */
0313     uint8_t  add_cdb[4];
0314     /* __le32   data_length; */
0315 } __packed;
0316 
0317 /*
0318  * ISP queue -  Accept Target I/O (ATIO) type entry IOCB structure.
0319  *      This is sent from the ISP to the target driver.
0320  */
0321 struct atio_from_isp {
0322     union {
0323         struct {
0324             __le16  entry_hdr;
0325             uint8_t  sys_define;   /* System defined. */
0326             uint8_t  entry_status; /* Entry Status.   */
0327             __le32  sys_define_2; /* System defined. */
0328             target_id_t target;
0329             __le16  rx_id;
0330             __le16  flags;
0331             __le16  status;
0332             uint8_t  command_ref;
0333             uint8_t  task_codes;
0334             uint8_t  task_flags;
0335             uint8_t  execution_codes;
0336             uint8_t  cdb[MAX_CMDSZ];
0337             __le32  data_length;
0338             __le16  lun;
0339             uint8_t  initiator_port_name[WWN_SIZE]; /* on qla23xx */
0340             __le16  reserved_32[6];
0341             __le16  ox_id;
0342         } isp2x;
0343         struct {
0344             __le16  entry_hdr;
0345             uint8_t  fcp_cmnd_len_low;
0346             uint8_t  fcp_cmnd_len_high:4;
0347             uint8_t  attr:4;
0348             __le32  exchange_addr;
0349 #define ATIO_EXCHANGE_ADDRESS_UNKNOWN   0xFFFFFFFF
0350             struct fcp_hdr fcp_hdr;
0351             struct atio7_fcp_cmnd fcp_cmnd;
0352         } isp24;
0353         struct {
0354             uint8_t  entry_type;    /* Entry type. */
0355             uint8_t  entry_count;   /* Entry count. */
0356             __le16   attr_n_length;
0357 #define FCP_CMD_LENGTH_MASK 0x0fff
0358 #define FCP_CMD_LENGTH_MIN  0x38
0359             uint8_t  data[56];
0360             __le32  signature;
0361 #define ATIO_PROCESSED 0xDEADDEAD       /* Signature */
0362         } raw;
0363     } u;
0364 } __packed;
0365 
0366 static inline int fcpcmd_is_corrupted(struct atio *atio)
0367 {
0368     if (atio->entry_type == ATIO_TYPE7 &&
0369         ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
0370          FCP_CMD_LENGTH_MIN))
0371         return 1;
0372     else
0373         return 0;
0374 }
0375 
0376 /* adjust corrupted atio so we won't trip over the same entry again. */
0377 static inline void adjust_corrupted_atio(struct atio_from_isp *atio)
0378 {
0379     atio->u.raw.attr_n_length = cpu_to_le16(FCP_CMD_LENGTH_MIN);
0380     atio->u.isp24.fcp_cmnd.add_cdb_len = 0;
0381 }
0382 
0383 static inline int get_datalen_for_atio(struct atio_from_isp *atio)
0384 {
0385     int len = atio->u.isp24.fcp_cmnd.add_cdb_len;
0386 
0387     return get_unaligned_be32(&atio->u.isp24.fcp_cmnd.add_cdb[len * 4]);
0388 }
0389 
0390 #define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */
0391 
0392 /*
0393  * ISP queue -  Continue Target I/O (ATIO) type 7 entry (for 24xx) structure.
0394  *      This structure is sent to the ISP 24xx from the target driver.
0395  */
0396 
0397 struct ctio7_to_24xx {
0398     uint8_t  entry_type;            /* Entry type. */
0399     uint8_t  entry_count;           /* Entry count. */
0400     uint8_t  sys_define;            /* System defined. */
0401     uint8_t  entry_status;          /* Entry Status. */
0402     uint32_t handle;            /* System defined handle */
0403     __le16  nport_handle;
0404 #define CTIO7_NHANDLE_UNRECOGNIZED  0xFFFF
0405     __le16  timeout;
0406     __le16  dseg_count;         /* Data segment count. */
0407     uint8_t  vp_index;
0408     uint8_t  add_flags;
0409     le_id_t  initiator_id;
0410     uint8_t  reserved;
0411     __le32  exchange_addr;
0412     union {
0413         struct {
0414             __le16  reserved1;
0415             __le16 flags;
0416             union {
0417                 __le32  residual;
0418                 struct {
0419                     uint8_t rsvd1;
0420                     uint8_t edif_flags;
0421 #define EF_EN_EDIF  BIT_0
0422 #define EF_NEW_SA   BIT_1
0423                     uint16_t rsvd2;
0424                 };
0425             };
0426             __le16 ox_id;
0427             __le16  scsi_status;
0428             __le32  relative_offset;
0429             __le32  reserved2;
0430             __le32  transfer_length;
0431             __le32  reserved3;
0432             struct dsd64 dsd;
0433         } status0;
0434         struct {
0435             __le16  sense_length;
0436             __le16 flags;
0437             __le32  residual;
0438             __le16 ox_id;
0439             __le16  scsi_status;
0440             __le16  response_len;
0441             __le16  reserved;
0442             uint8_t sense_data[24];
0443         } status1;
0444     } u;
0445 } __packed;
0446 
0447 /*
0448  * ISP queue - CTIO type 7 from ISP 24xx to target driver
0449  * returned entry structure.
0450  */
0451 struct ctio7_from_24xx {
0452     uint8_t  entry_type;            /* Entry type. */
0453     uint8_t  entry_count;           /* Entry count. */
0454     uint8_t  sys_define;            /* System defined. */
0455     uint8_t  entry_status;          /* Entry Status. */
0456     uint32_t handle;            /* System defined handle */
0457     __le16  status;
0458     __le16  timeout;
0459     __le16  dseg_count;         /* Data segment count. */
0460     uint8_t  vp_index;
0461     uint8_t  reserved1[5];
0462     __le32  exchange_address;
0463     __le16  edif_sa_index;
0464     __le16  flags;
0465     __le32  residual;
0466     __le16  ox_id;
0467     __le16  reserved3;
0468     __le32  relative_offset;
0469     uint8_t  reserved4[24];
0470 } __packed;
0471 
0472 /* CTIO7 flags values */
0473 #define CTIO7_FLAGS_SEND_STATUS     BIT_15
0474 #define CTIO7_FLAGS_TERMINATE       BIT_14
0475 #define CTIO7_FLAGS_CONFORM_REQ     BIT_13
0476 #define CTIO7_FLAGS_DONT_RET_CTIO   BIT_8
0477 #define CTIO7_FLAGS_STATUS_MODE_0   0
0478 #define CTIO7_FLAGS_STATUS_MODE_1   BIT_6
0479 #define CTIO7_FLAGS_STATUS_MODE_2   BIT_7
0480 #define CTIO7_FLAGS_EXPLICIT_CONFORM    BIT_5
0481 #define CTIO7_FLAGS_CONFIRM_SATISF  BIT_4
0482 #define CTIO7_FLAGS_DSD_PTR     BIT_2
0483 #define CTIO7_FLAGS_DATA_IN     BIT_1 /* data to initiator */
0484 #define CTIO7_FLAGS_DATA_OUT        BIT_0 /* data from initiator */
0485 
0486 #define ELS_PLOGI           0x3
0487 #define ELS_FLOGI           0x4
0488 #define ELS_LOGO            0x5
0489 #define ELS_PRLI            0x20
0490 #define ELS_PRLO            0x21
0491 #define ELS_TPRLO           0x24
0492 #define ELS_PDISC           0x50
0493 #define ELS_ADISC           0x52
0494 
0495 /*
0496  *CTIO Type CRC_2 IOCB
0497  */
0498 struct ctio_crc2_to_fw {
0499     uint8_t entry_type;     /* Entry type. */
0500 #define CTIO_CRC2 0x7A
0501     uint8_t entry_count;        /* Entry count. */
0502     uint8_t sys_define;     /* System defined. */
0503     uint8_t entry_status;       /* Entry Status. */
0504 
0505     uint32_t handle;        /* System handle. */
0506     __le16  nport_handle;       /* N_PORT handle. */
0507     __le16 timeout;     /* Command timeout. */
0508 
0509     __le16  dseg_count;     /* Data segment count. */
0510     uint8_t  vp_index;
0511     uint8_t  add_flags;     /* additional flags */
0512 #define CTIO_CRC2_AF_DIF_DSD_ENA BIT_3
0513 
0514     le_id_t  initiator_id;      /* initiator ID */
0515     uint8_t  reserved1;
0516     __le32  exchange_addr;      /* rcv exchange address */
0517     __le16  reserved2;
0518     __le16 flags;           /* refer to CTIO7 flags values */
0519     __le32  residual;
0520     __le16 ox_id;
0521     __le16  scsi_status;
0522     __le32 relative_offset;
0523     __le32  reserved5;
0524     __le32 transfer_length;     /* total fc transfer length */
0525     __le32  reserved6;
0526     __le64   crc_context_address __packed; /* Data segment address. */
0527     __le16  crc_context_len;    /* Data segment length. */
0528     __le16  reserved_1;     /* MUST be set to 0. */
0529 };
0530 
0531 /* CTIO Type CRC_x Status IOCB */
0532 struct ctio_crc_from_fw {
0533     uint8_t entry_type;     /* Entry type. */
0534     uint8_t entry_count;        /* Entry count. */
0535     uint8_t sys_define;     /* System defined. */
0536     uint8_t entry_status;       /* Entry Status. */
0537 
0538     uint32_t handle;        /* System handle. */
0539     __le16  status;
0540     __le16  timeout;        /* Command timeout. */
0541     __le16  dseg_count;     /* Data segment count. */
0542     __le32  reserved1;
0543     __le16  state_flags;
0544 #define CTIO_CRC_SF_DIF_CHOPPED BIT_4
0545 
0546     __le32  exchange_address;   /* rcv exchange address */
0547     __le16  reserved2;
0548     __le16  flags;
0549     __le32  resid_xfer_length;
0550     __le16  ox_id;
0551     uint8_t  reserved3[12];
0552     __le16  runt_guard;     /* reported runt blk guard */
0553     uint8_t  actual_dif[8];
0554     uint8_t  expected_dif[8];
0555 } __packed;
0556 
0557 /*
0558  * ISP queue - ABTS received/response entries structure definition for 24xx.
0559  */
0560 #define ABTS_RECV_24XX      0x54 /* ABTS received (for 24xx) */
0561 #define ABTS_RESP_24XX      0x55 /* ABTS responce (for 24xx) */
0562 
0563 /*
0564  * ISP queue -  ABTS received IOCB entry structure definition for 24xx.
0565  *      The ABTS BLS received from the wire is sent to the
0566  *      target driver by the ISP 24xx.
0567  *      The IOCB is placed on the response queue.
0568  */
0569 struct abts_recv_from_24xx {
0570     uint8_t  entry_type;            /* Entry type. */
0571     uint8_t  entry_count;           /* Entry count. */
0572     uint8_t  sys_define;            /* System defined. */
0573     uint8_t  entry_status;          /* Entry Status. */
0574     uint8_t  reserved_1[6];
0575     __le16  nport_handle;
0576     uint8_t  reserved_2[2];
0577     uint8_t  vp_index;
0578     uint8_t  reserved_3:4;
0579     uint8_t  sof_type:4;
0580     __le32  exchange_address;
0581     struct fcp_hdr_le fcp_hdr_le;
0582     uint8_t  reserved_4[16];
0583     __le32  exchange_addr_to_abort;
0584 } __packed;
0585 
0586 #define ABTS_PARAM_ABORT_SEQ        BIT_0
0587 
0588 struct ba_acc_le {
0589     __le16  reserved;
0590     uint8_t  seq_id_last;
0591     uint8_t  seq_id_valid;
0592 #define SEQ_ID_VALID    0x80
0593 #define SEQ_ID_INVALID  0x00
0594     __le16  rx_id;
0595     __le16  ox_id;
0596     __le16  high_seq_cnt;
0597     __le16  low_seq_cnt;
0598 } __packed;
0599 
0600 struct ba_rjt_le {
0601     uint8_t vendor_uniq;
0602     uint8_t reason_expl;
0603     uint8_t reason_code;
0604 #define BA_RJT_REASON_CODE_INVALID_COMMAND  0x1
0605 #define BA_RJT_REASON_CODE_UNABLE_TO_PERFORM    0x9
0606     uint8_t reserved;
0607 } __packed;
0608 
0609 /*
0610  * ISP queue -  ABTS Response IOCB entry structure definition for 24xx.
0611  *      The ABTS response to the ABTS received is sent by the
0612  *      target driver to the ISP 24xx.
0613  *      The IOCB is placed on the request queue.
0614  */
0615 struct abts_resp_to_24xx {
0616     uint8_t  entry_type;            /* Entry type. */
0617     uint8_t  entry_count;           /* Entry count. */
0618     uint8_t  sys_define;            /* System defined. */
0619     uint8_t  entry_status;          /* Entry Status. */
0620     uint32_t handle;
0621     __le16  reserved_1;
0622     __le16  nport_handle;
0623     __le16  control_flags;
0624 #define ABTS_CONTR_FLG_TERM_EXCHG   BIT_0
0625     uint8_t  vp_index;
0626     uint8_t  reserved_3:4;
0627     uint8_t  sof_type:4;
0628     __le32  exchange_address;
0629     struct fcp_hdr_le fcp_hdr_le;
0630     union {
0631         struct ba_acc_le ba_acct;
0632         struct ba_rjt_le ba_rjt;
0633     } __packed payload;
0634     __le32  reserved_4;
0635     __le32  exchange_addr_to_abort;
0636 } __packed;
0637 
0638 /*
0639  * ISP queue -  ABTS Response IOCB from ISP24xx Firmware entry structure.
0640  *      The ABTS response with completion status to the ABTS response
0641  *      (sent by the target driver to the ISP 24xx) is sent by the
0642  *      ISP24xx firmware to the target driver.
0643  *      The IOCB is placed on the response queue.
0644  */
0645 struct abts_resp_from_24xx_fw {
0646     uint8_t  entry_type;            /* Entry type. */
0647     uint8_t  entry_count;           /* Entry count. */
0648     uint8_t  sys_define;            /* System defined. */
0649     uint8_t  entry_status;          /* Entry Status. */
0650     uint32_t handle;
0651     __le16  compl_status;
0652 #define ABTS_RESP_COMPL_SUCCESS     0
0653 #define ABTS_RESP_COMPL_SUBCODE_ERROR   0x31
0654     __le16  nport_handle;
0655     __le16  reserved_1;
0656     uint8_t  reserved_2;
0657     uint8_t  reserved_3:4;
0658     uint8_t  sof_type:4;
0659     __le32  exchange_address;
0660     struct fcp_hdr_le fcp_hdr_le;
0661     uint8_t reserved_4[8];
0662     __le32  error_subcode1;
0663 #define ABTS_RESP_SUBCODE_ERR_ABORTED_EXCH_NOT_TERM 0x1E
0664     __le32  error_subcode2;
0665     __le32  exchange_addr_to_abort;
0666 } __packed;
0667 
0668 /********************************************************************\
0669  * Type Definitions used by initiator & target halves
0670 \********************************************************************/
0671 
0672 struct qla_tgt_mgmt_cmd;
0673 struct fc_port;
0674 struct qla_tgt_cmd;
0675 
0676 /*
0677  * This structure provides a template of function calls that the
0678  * target driver (from within qla_target.c) can issue to the
0679  * target module (tcm_qla2xxx).
0680  */
0681 struct qla_tgt_func_tmpl {
0682     struct qla_tgt_cmd *(*find_cmd_by_tag)(struct fc_port *, uint64_t);
0683     int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *,
0684             unsigned char *, uint32_t, int, int, int);
0685     void (*handle_data)(struct qla_tgt_cmd *);
0686     int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, u64, uint16_t,
0687             uint32_t);
0688     struct qla_tgt_cmd *(*get_cmd)(struct fc_port *);
0689     void (*rel_cmd)(struct qla_tgt_cmd *);
0690     void (*free_cmd)(struct qla_tgt_cmd *);
0691     void (*free_mcmd)(struct qla_tgt_mgmt_cmd *);
0692     void (*free_session)(struct fc_port *);
0693 
0694     int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
0695                     struct fc_port *);
0696     void (*update_sess)(struct fc_port *, port_id_t, uint16_t, bool);
0697     struct fc_port *(*find_sess_by_loop_id)(struct scsi_qla_host *,
0698                         const uint16_t);
0699     struct fc_port *(*find_sess_by_s_id)(struct scsi_qla_host *,
0700                          const be_id_t);
0701     void (*clear_nacl_from_fcport_map)(struct fc_port *);
0702     void (*put_sess)(struct fc_port *);
0703     void (*shutdown_sess)(struct fc_port *);
0704     int (*get_dif_tags)(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts);
0705     int (*chk_dif_tags)(uint32_t tag);
0706     void (*add_target)(struct scsi_qla_host *);
0707     void (*remove_target)(struct scsi_qla_host *);
0708 };
0709 
0710 int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
0711 
0712 #include <target/target_core_base.h>
0713 
0714 #define QLA_TGT_TIMEOUT         10  /* in seconds */
0715 
0716 #define QLA_TGT_MAX_HW_PENDING_TIME 60 /* in seconds */
0717 
0718 /* Immediate notify status constants */
0719 #define IMM_NTFY_LIP_RESET          0x000E
0720 #define IMM_NTFY_LIP_LINK_REINIT    0x000F
0721 #define IMM_NTFY_IOCB_OVERFLOW      0x0016
0722 #define IMM_NTFY_ABORT_TASK         0x0020
0723 #define IMM_NTFY_PORT_LOGOUT        0x0029
0724 #define IMM_NTFY_PORT_CONFIG        0x002A
0725 #define IMM_NTFY_GLBL_TPRLO         0x002D
0726 #define IMM_NTFY_GLBL_LOGO          0x002E
0727 #define IMM_NTFY_RESOURCE           0x0034
0728 #define IMM_NTFY_MSG_RX             0x0036
0729 #define IMM_NTFY_SRR                0x0045
0730 #define IMM_NTFY_ELS                0x0046
0731 
0732 /* Immediate notify task flags */
0733 #define IMM_NTFY_TASK_MGMT_SHIFT    8
0734 
0735 #define QLA_TGT_CLEAR_ACA               0x40
0736 #define QLA_TGT_TARGET_RESET            0x20
0737 #define QLA_TGT_LUN_RESET               0x10
0738 #define QLA_TGT_CLEAR_TS                0x04
0739 #define QLA_TGT_ABORT_TS                0x02
0740 #define QLA_TGT_ABORT_ALL_SESS          0xFFFF
0741 #define QLA_TGT_ABORT_ALL               0xFFFE
0742 #define QLA_TGT_NEXUS_LOSS_SESS         0xFFFD
0743 #define QLA_TGT_NEXUS_LOSS              0xFFFC
0744 #define QLA_TGT_ABTS            0xFFFB
0745 #define QLA_TGT_2G_ABORT_TASK       0xFFFA
0746 
0747 /* Notify Acknowledge flags */
0748 #define NOTIFY_ACK_RES_COUNT        BIT_8
0749 #define NOTIFY_ACK_CLEAR_LIP_RESET  BIT_5
0750 #define NOTIFY_ACK_TM_RESP_CODE_VALID BIT_4
0751 
0752 /* Command's states */
0753 #define QLA_TGT_STATE_NEW       0 /* New command + target processing */
0754 #define QLA_TGT_STATE_NEED_DATA     1 /* target needs data to continue */
0755 #define QLA_TGT_STATE_DATA_IN       2 /* Data arrived + target processing */
0756 #define QLA_TGT_STATE_PROCESSED     3 /* target done processing */
0757 
0758 /* ATIO task_codes field */
0759 #define ATIO_SIMPLE_QUEUE           0
0760 #define ATIO_HEAD_OF_QUEUE          1
0761 #define ATIO_ORDERED_QUEUE          2
0762 #define ATIO_ACA_QUEUE              4
0763 #define ATIO_UNTAGGED               5
0764 
0765 /* TM failed response codes, see FCP (9.4.11 FCP_RSP_INFO) */
0766 #define FC_TM_SUCCESS               0
0767 #define FC_TM_BAD_FCP_DATA          1
0768 #define FC_TM_BAD_CMD               2
0769 #define FC_TM_FCP_DATA_MISMATCH     3
0770 #define FC_TM_REJECT                4
0771 #define FC_TM_FAILED                5
0772 
0773 #define QLA_TGT_SENSE_VALID(sense)  ((sense != NULL) && \
0774                 (((const uint8_t *)(sense))[0] & 0x70) == 0x70)
0775 
0776 struct qla_port_24xx_data {
0777     uint8_t port_name[WWN_SIZE];
0778     uint16_t loop_id;
0779     uint16_t reserved;
0780 };
0781 
0782 struct qla_qpair_hint {
0783     struct list_head hint_elem;
0784     struct qla_qpair *qpair;
0785     u16 cpuid;
0786     uint8_t cmd_cnt;
0787 };
0788 
0789 struct qla_tgt {
0790     struct scsi_qla_host *vha;
0791     struct qla_hw_data *ha;
0792     struct btree_head64 lun_qpair_map;
0793     struct qla_qpair_hint *qphints;
0794     /*
0795      * To sync between IRQ handlers and qlt_target_release(). Needed,
0796      * because req_pkt() can drop/reaquire HW lock inside. Protected by
0797      * HW lock.
0798      */
0799     int atio_irq_cmd_count;
0800 
0801     int sg_tablesize;
0802 
0803     /* Target's flags, serialized by pha->hardware_lock */
0804     unsigned int link_reinit_iocb_pending:1;
0805 
0806     /*
0807      * Protected by tgt_mutex AND hardware_lock for writing and tgt_mutex
0808      * OR hardware_lock for reading.
0809      */
0810     int tgt_stop; /* the target mode driver is being stopped */
0811     int tgt_stopped; /* the target mode driver has been stopped */
0812 
0813     /* Count of sessions refering qla_tgt. Protected by hardware_lock. */
0814     int sess_count;
0815 
0816     /* Protected by hardware_lock */
0817     struct list_head del_sess_list;
0818 
0819     spinlock_t sess_work_lock;
0820     struct list_head sess_works_list;
0821     struct work_struct sess_work;
0822 
0823     struct imm_ntfy_from_isp link_reinit_iocb;
0824     wait_queue_head_t waitQ;
0825     int notify_ack_expected;
0826     int abts_resp_expected;
0827     int modify_lun_expected;
0828     atomic_t tgt_global_resets_count;
0829     struct list_head tgt_list_entry;
0830 };
0831 
0832 struct qla_tgt_sess_op {
0833     struct scsi_qla_host *vha;
0834     uint32_t chip_reset;
0835     struct atio_from_isp atio;
0836     struct work_struct work;
0837     struct list_head cmd_list;
0838     bool aborted;
0839     struct rsp_que *rsp;
0840 };
0841 
0842 enum trace_flags {
0843     TRC_NEW_CMD = BIT_0,
0844     TRC_DO_WORK = BIT_1,
0845     TRC_DO_WORK_ERR = BIT_2,
0846     TRC_XFR_RDY = BIT_3,
0847     TRC_XMIT_DATA = BIT_4,
0848     TRC_XMIT_STATUS = BIT_5,
0849     TRC_SRR_RSP =  BIT_6,
0850     TRC_SRR_XRDY = BIT_7,
0851     TRC_SRR_TERM = BIT_8,
0852     TRC_SRR_CTIO = BIT_9,
0853     TRC_FLUSH = BIT_10,
0854     TRC_CTIO_ERR = BIT_11,
0855     TRC_CTIO_DONE = BIT_12,
0856     TRC_CTIO_ABORTED =  BIT_13,
0857     TRC_CTIO_STRANGE = BIT_14,
0858     TRC_CMD_DONE = BIT_15,
0859     TRC_CMD_CHK_STOP = BIT_16,
0860     TRC_CMD_FREE = BIT_17,
0861     TRC_DATA_IN = BIT_18,
0862     TRC_ABORT = BIT_19,
0863     TRC_DIF_ERR = BIT_20,
0864 };
0865 
0866 struct qla_tgt_cmd {
0867     /*
0868      * Do not move cmd_type field. it needs to line up with srb->cmd_type
0869      */
0870     uint8_t cmd_type;
0871     uint8_t pad[7];
0872     struct se_cmd se_cmd;
0873     struct list_head sess_cmd_list;
0874     struct fc_port *sess;
0875     struct qla_qpair *qpair;
0876     uint32_t reset_count;
0877     int state;
0878     struct work_struct work;
0879     /* Sense buffer that will be mapped into outgoing status */
0880     unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER];
0881 
0882     spinlock_t cmd_lock;
0883     /* to save extra sess dereferences */
0884     unsigned int conf_compl_supported:1;
0885     unsigned int sg_mapped:1;
0886     unsigned int write_data_transferred:1;
0887     unsigned int q_full:1;
0888     unsigned int term_exchg:1;
0889     unsigned int cmd_sent_to_fw:1;
0890     unsigned int cmd_in_wq:1;
0891     unsigned int edif:1;
0892 
0893     /*
0894      * This variable may be set from outside the LIO and I/O completion
0895      * callback functions. Do not declare this member variable as a
0896      * bitfield to avoid a read-modify-write operation when this variable
0897      * is set.
0898      */
0899     unsigned int aborted;
0900 
0901     struct scatterlist *sg; /* cmd data buffer SG vector */
0902     int sg_cnt;     /* SG segments count */
0903     int bufflen;        /* cmd buffer length */
0904     int offset;
0905     u64 unpacked_lun;
0906     enum dma_data_direction dma_data_direction;
0907 
0908     uint16_t ctio_flags;
0909     uint16_t vp_idx;
0910     uint16_t loop_id;   /* to save extra sess dereferences */
0911     struct qla_tgt *tgt;    /* to save extra sess dereferences */
0912     struct scsi_qla_host *vha;
0913     struct list_head cmd_list;
0914 
0915     struct atio_from_isp atio;
0916 
0917     uint8_t ctx_dsd_alloced;
0918 
0919     /* T10-DIF */
0920 #define DIF_ERR_NONE 0
0921 #define DIF_ERR_GRD 1
0922 #define DIF_ERR_REF 2
0923 #define DIF_ERR_APP 3
0924     int8_t dif_err_code;
0925     struct scatterlist *prot_sg;
0926     uint32_t prot_sg_cnt;
0927     uint32_t blk_sz, num_blks;
0928     uint8_t scsi_status, sense_key, asc, ascq;
0929 
0930     struct crc_context *ctx;
0931     const uint8_t   *cdb;
0932     uint64_t    lba;
0933     uint16_t    a_guard, e_guard, a_app_tag, e_app_tag;
0934     uint32_t    a_ref_tag, e_ref_tag;
0935 #define DIF_BUNDL_DMA_VALID 1
0936     uint16_t prot_flags;
0937 
0938     uint64_t jiffies_at_alloc;
0939     uint64_t jiffies_at_free;
0940 
0941     enum trace_flags trc_flags;
0942 };
0943 
0944 struct qla_tgt_sess_work_param {
0945     struct list_head sess_works_list_entry;
0946 
0947 #define QLA_TGT_SESS_WORK_ABORT 1
0948 #define QLA_TGT_SESS_WORK_TM    2
0949     int type;
0950 
0951     union {
0952         struct abts_recv_from_24xx abts;
0953         struct imm_ntfy_from_isp tm_iocb;
0954         struct atio_from_isp tm_iocb2;
0955     };
0956 };
0957 
0958 struct qla_tgt_mgmt_cmd {
0959     uint8_t cmd_type;
0960     uint8_t pad[3];
0961     uint16_t tmr_func;
0962     uint8_t fc_tm_rsp;
0963     uint8_t abort_io_attr;
0964     struct fc_port *sess;
0965     struct qla_qpair *qpair;
0966     struct scsi_qla_host *vha;
0967     struct se_cmd se_cmd;
0968     struct work_struct free_work;
0969     unsigned int flags;
0970 #define QLA24XX_MGMT_SEND_NACK  BIT_0
0971 #define QLA24XX_MGMT_ABORT_IO_ATTR_VALID BIT_1
0972     uint32_t reset_count;
0973     struct work_struct work;
0974     uint64_t unpacked_lun;
0975     union {
0976         struct atio_from_isp atio;
0977         struct imm_ntfy_from_isp imm_ntfy;
0978         struct abts_recv_from_24xx abts;
0979     } __packed orig_iocb;
0980 };
0981 
0982 struct qla_tgt_prm {
0983     struct qla_tgt_cmd *cmd;
0984     struct qla_tgt *tgt;
0985     void *pkt;
0986     struct scatterlist *sg; /* cmd data buffer SG vector */
0987     unsigned char *sense_buffer;
0988     int seg_cnt;
0989     int req_cnt;
0990     uint16_t rq_result;
0991     int sense_buffer_len;
0992     int residual;
0993     int add_status_pkt;
0994     /* dif */
0995     struct scatterlist *prot_sg;
0996     uint16_t prot_seg_cnt;
0997     uint16_t tot_dsds;
0998 };
0999 
1000 /* Check for Switch reserved address */
1001 #define IS_SW_RESV_ADDR(_s_id) \
1002     ((_s_id.b.domain == 0xff) && ((_s_id.b.area & 0xf0) == 0xf0))
1003 
1004 #define QLA_TGT_XMIT_DATA       1
1005 #define QLA_TGT_XMIT_STATUS     2
1006 #define QLA_TGT_XMIT_ALL        (QLA_TGT_XMIT_STATUS|QLA_TGT_XMIT_DATA)
1007 
1008 
1009 extern struct qla_tgt_data qla_target;
1010 
1011 /*
1012  * Function prototypes for qla_target.c logic used by qla2xxx LLD code.
1013  */
1014 extern int qlt_add_target(struct qla_hw_data *, struct scsi_qla_host *);
1015 extern int qlt_remove_target(struct qla_hw_data *, struct scsi_qla_host *);
1016 extern int qlt_lport_register(void *, u64, u64, u64,
1017             int (*callback)(struct scsi_qla_host *, void *, u64, u64));
1018 extern void qlt_lport_deregister(struct scsi_qla_host *);
1019 extern void qlt_unreg_sess(struct fc_port *);
1020 extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *);
1021 extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int);
1022 extern int __init qlt_init(void);
1023 extern void qlt_exit(void);
1024 extern void qlt_update_vp_map(struct scsi_qla_host *, int);
1025 extern void qlt_free_session_done(struct work_struct *);
1026 /*
1027  * This macro is used during early initializations when host->active_mode
1028  * is not set. Right now, ha value is ignored.
1029  */
1030 #define QLA_TGT_MODE_ENABLED() (ql2x_ini_mode != QLA2XXX_INI_MODE_ENABLED)
1031 
1032 extern int ql2x_ini_mode;
1033 
1034 static inline bool qla_tgt_mode_enabled(struct scsi_qla_host *ha)
1035 {
1036     return ha->host->active_mode == MODE_TARGET;
1037 }
1038 
1039 static inline bool qla_ini_mode_enabled(struct scsi_qla_host *ha)
1040 {
1041     return ha->host->active_mode == MODE_INITIATOR;
1042 }
1043 
1044 static inline bool qla_dual_mode_enabled(struct scsi_qla_host *ha)
1045 {
1046     return (ha->host->active_mode == MODE_DUAL);
1047 }
1048 
1049 static inline uint32_t sid_to_key(const be_id_t s_id)
1050 {
1051     return s_id.domain << 16 |
1052         s_id.area << 8 |
1053         s_id.al_pa;
1054 }
1055 
1056 /*
1057  * Exported symbols from qla_target.c LLD logic used by qla2xxx code..
1058  */
1059 extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, struct rsp_que *,
1060     response_t *);
1061 extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *);
1062 extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t);
1063 extern int qlt_abort_cmd(struct qla_tgt_cmd *);
1064 extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
1065 extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
1066 extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);
1067 extern void qlt_async_event(uint16_t, struct scsi_qla_host *, uint16_t *);
1068 extern void qlt_enable_vha(struct scsi_qla_host *);
1069 extern void qlt_vport_create(struct scsi_qla_host *, struct qla_hw_data *);
1070 extern u8 qlt_rff_id(struct scsi_qla_host *);
1071 extern void qlt_init_atio_q_entries(struct scsi_qla_host *);
1072 extern void qlt_24xx_process_atio_queue(struct scsi_qla_host *, uint8_t);
1073 extern void qlt_24xx_config_rings(struct scsi_qla_host *);
1074 extern void qlt_24xx_config_nvram_stage1(struct scsi_qla_host *,
1075     struct nvram_24xx *);
1076 extern void qlt_24xx_config_nvram_stage2(struct scsi_qla_host *,
1077     struct init_cb_24xx *);
1078 extern void qlt_81xx_config_nvram_stage2(struct scsi_qla_host *,
1079     struct init_cb_81xx *);
1080 extern void qlt_81xx_config_nvram_stage1(struct scsi_qla_host *,
1081     struct nvram_81xx *);
1082 extern int qlt_24xx_process_response_error(struct scsi_qla_host *,
1083     struct sts_entry_24xx *);
1084 extern void qlt_modify_vp_config(struct scsi_qla_host *,
1085     struct vp_config_entry_24xx *);
1086 extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *);
1087 extern int qlt_mem_alloc(struct qla_hw_data *);
1088 extern void qlt_mem_free(struct qla_hw_data *);
1089 extern int qlt_stop_phase1(struct qla_tgt *);
1090 extern void qlt_stop_phase2(struct qla_tgt *);
1091 extern irqreturn_t qla83xx_msix_atio_q(int, void *);
1092 extern void qlt_83xx_iospace_config(struct qla_hw_data *);
1093 extern int qlt_free_qfull_cmds(struct qla_qpair *);
1094 extern void qlt_logo_completion_handler(fc_port_t *, int);
1095 extern void qlt_do_generation_tick(struct scsi_qla_host *, int *);
1096 
1097 void qlt_send_resp_ctio(struct qla_qpair *, struct qla_tgt_cmd *, uint8_t,
1098     uint8_t, uint8_t, uint8_t);
1099 
1100 #endif /* __QLA_TARGET_H */