qla_target.h 32 KB

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