qla_target.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  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. #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \
  111. ? le16_to_cpu((iocb)->u.isp2x.target.extended) \
  112. : (uint16_t)(iocb)->u.isp2x.target.id.standard)
  113. #ifndef NOTIFY_ACK_TYPE
  114. #define NOTIFY_ACK_TYPE 0x0E /* Notify acknowledge entry. */
  115. /*
  116. * ISP queue - notify acknowledge entry structure definition.
  117. * This is sent to the ISP from the target driver.
  118. */
  119. struct nack_to_isp {
  120. uint8_t entry_type; /* Entry type. */
  121. uint8_t entry_count; /* Entry count. */
  122. uint8_t sys_define; /* System defined. */
  123. uint8_t entry_status; /* Entry Status. */
  124. union {
  125. struct {
  126. uint32_t sys_define_2; /* System defined. */
  127. target_id_t target;
  128. uint8_t target_id;
  129. uint8_t reserved_1;
  130. uint16_t flags;
  131. uint16_t resp_code;
  132. uint16_t status;
  133. uint16_t task_flags;
  134. uint16_t seq_id;
  135. uint16_t srr_rx_id;
  136. uint32_t srr_rel_offs;
  137. uint16_t srr_ui;
  138. uint16_t srr_flags;
  139. uint16_t srr_reject_code;
  140. uint8_t srr_reject_vendor_uniq;
  141. uint8_t srr_reject_code_expl;
  142. uint8_t reserved_2[24];
  143. } isp2x;
  144. struct {
  145. uint32_t handle;
  146. uint16_t nport_handle;
  147. uint16_t reserved_1;
  148. uint16_t flags;
  149. uint16_t srr_rx_id;
  150. uint16_t status;
  151. uint8_t status_subcode;
  152. uint8_t fw_handle;
  153. uint32_t exchange_address;
  154. uint32_t srr_rel_offs;
  155. uint16_t srr_ui;
  156. uint16_t srr_flags;
  157. uint8_t reserved_4[19];
  158. uint8_t vp_index;
  159. uint8_t srr_reject_vendor_uniq;
  160. uint8_t srr_reject_code_expl;
  161. uint8_t srr_reject_code;
  162. uint8_t reserved_5[5];
  163. } isp24;
  164. } u;
  165. uint8_t reserved[2];
  166. uint16_t ox_id;
  167. } __packed;
  168. #define NOTIFY_ACK_FLAGS_TERMINATE BIT_3
  169. #define NOTIFY_ACK_SRR_FLAGS_ACCEPT 0
  170. #define NOTIFY_ACK_SRR_FLAGS_REJECT 1
  171. #define NOTIFY_ACK_SRR_REJECT_REASON_UNABLE_TO_PERFORM 0x9
  172. #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_NO_EXPL 0
  173. #define NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_UNABLE_TO_SUPPLY_DATA 0x2a
  174. #define NOTIFY_ACK_SUCCESS 0x01
  175. #endif
  176. #ifndef ACCEPT_TGT_IO_TYPE
  177. #define ACCEPT_TGT_IO_TYPE 0x16 /* Accept target I/O entry. */
  178. #endif
  179. #ifndef CONTINUE_TGT_IO_TYPE
  180. #define CONTINUE_TGT_IO_TYPE 0x17
  181. /*
  182. * ISP queue - Continue Target I/O (CTIO) entry for status mode 0 structure.
  183. * This structure is sent to the ISP 2xxx from target driver.
  184. */
  185. struct ctio_to_2xxx {
  186. uint8_t entry_type; /* Entry type. */
  187. uint8_t entry_count; /* Entry count. */
  188. uint8_t sys_define; /* System defined. */
  189. uint8_t entry_status; /* Entry Status. */
  190. uint32_t handle; /* System defined handle */
  191. target_id_t target;
  192. uint16_t rx_id;
  193. uint16_t flags;
  194. uint16_t status;
  195. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  196. uint16_t dseg_count; /* Data segment count. */
  197. uint32_t relative_offset;
  198. uint32_t residual;
  199. uint16_t reserved_1[3];
  200. uint16_t scsi_status;
  201. uint32_t transfer_length;
  202. uint32_t dseg_0_address; /* Data segment 0 address. */
  203. uint32_t dseg_0_length; /* Data segment 0 length. */
  204. uint32_t dseg_1_address; /* Data segment 1 address. */
  205. uint32_t dseg_1_length; /* Data segment 1 length. */
  206. uint32_t dseg_2_address; /* Data segment 2 address. */
  207. uint32_t dseg_2_length; /* Data segment 2 length. */
  208. } __packed;
  209. #define ATIO_PATH_INVALID 0x07
  210. #define ATIO_CANT_PROV_CAP 0x16
  211. #define ATIO_CDB_VALID 0x3D
  212. #define ATIO_EXEC_READ BIT_1
  213. #define ATIO_EXEC_WRITE BIT_0
  214. #endif
  215. #ifndef CTIO_A64_TYPE
  216. #define CTIO_A64_TYPE 0x1F
  217. #define CTIO_SUCCESS 0x01
  218. #define CTIO_ABORTED 0x02
  219. #define CTIO_INVALID_RX_ID 0x08
  220. #define CTIO_TIMEOUT 0x0B
  221. #define CTIO_DIF_ERROR 0x0C /* DIF error detected */
  222. #define CTIO_LIP_RESET 0x0E
  223. #define CTIO_TARGET_RESET 0x17
  224. #define CTIO_PORT_UNAVAILABLE 0x28
  225. #define CTIO_PORT_LOGGED_OUT 0x29
  226. #define CTIO_PORT_CONF_CHANGED 0x2A
  227. #define CTIO_SRR_RECEIVED 0x45
  228. #endif
  229. #ifndef CTIO_RET_TYPE
  230. #define CTIO_RET_TYPE 0x17 /* CTIO return entry */
  231. #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */
  232. #endif
  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. int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *,
  626. unsigned char *, uint32_t, int, int, int);
  627. void (*handle_data)(struct qla_tgt_cmd *);
  628. int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, u64, uint16_t,
  629. uint32_t);
  630. void (*free_cmd)(struct qla_tgt_cmd *);
  631. void (*free_mcmd)(struct qla_tgt_mgmt_cmd *);
  632. void (*free_session)(struct fc_port *);
  633. int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
  634. struct fc_port *);
  635. void (*update_sess)(struct fc_port *, port_id_t, uint16_t, bool);
  636. struct fc_port *(*find_sess_by_loop_id)(struct scsi_qla_host *,
  637. const uint16_t);
  638. struct fc_port *(*find_sess_by_s_id)(struct scsi_qla_host *,
  639. const uint8_t *);
  640. void (*clear_nacl_from_fcport_map)(struct fc_port *);
  641. void (*put_sess)(struct fc_port *);
  642. void (*shutdown_sess)(struct fc_port *);
  643. int (*get_dif_tags)(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts);
  644. int (*chk_dif_tags)(uint32_t tag);
  645. void (*add_target)(struct scsi_qla_host *);
  646. void (*remove_target)(struct scsi_qla_host *);
  647. };
  648. int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
  649. #include <target/target_core_base.h>
  650. #define QLA_TGT_TIMEOUT 10 /* in seconds */
  651. #define QLA_TGT_MAX_HW_PENDING_TIME 60 /* in seconds */
  652. /* Immediate notify status constants */
  653. #define IMM_NTFY_LIP_RESET 0x000E
  654. #define IMM_NTFY_LIP_LINK_REINIT 0x000F
  655. #define IMM_NTFY_IOCB_OVERFLOW 0x0016
  656. #define IMM_NTFY_ABORT_TASK 0x0020
  657. #define IMM_NTFY_PORT_LOGOUT 0x0029
  658. #define IMM_NTFY_PORT_CONFIG 0x002A
  659. #define IMM_NTFY_GLBL_TPRLO 0x002D
  660. #define IMM_NTFY_GLBL_LOGO 0x002E
  661. #define IMM_NTFY_RESOURCE 0x0034
  662. #define IMM_NTFY_MSG_RX 0x0036
  663. #define IMM_NTFY_SRR 0x0045
  664. #define IMM_NTFY_ELS 0x0046
  665. /* Immediate notify task flags */
  666. #define IMM_NTFY_TASK_MGMT_SHIFT 8
  667. #define QLA_TGT_CLEAR_ACA 0x40
  668. #define QLA_TGT_TARGET_RESET 0x20
  669. #define QLA_TGT_LUN_RESET 0x10
  670. #define QLA_TGT_CLEAR_TS 0x04
  671. #define QLA_TGT_ABORT_TS 0x02
  672. #define QLA_TGT_ABORT_ALL_SESS 0xFFFF
  673. #define QLA_TGT_ABORT_ALL 0xFFFE
  674. #define QLA_TGT_NEXUS_LOSS_SESS 0xFFFD
  675. #define QLA_TGT_NEXUS_LOSS 0xFFFC
  676. #define QLA_TGT_ABTS 0xFFFB
  677. #define QLA_TGT_2G_ABORT_TASK 0xFFFA
  678. /* Notify Acknowledge flags */
  679. #define NOTIFY_ACK_RES_COUNT BIT_8
  680. #define NOTIFY_ACK_CLEAR_LIP_RESET BIT_5
  681. #define NOTIFY_ACK_TM_RESP_CODE_VALID BIT_4
  682. /* Command's states */
  683. #define QLA_TGT_STATE_NEW 0 /* New command + target processing */
  684. #define QLA_TGT_STATE_NEED_DATA 1 /* target needs data to continue */
  685. #define QLA_TGT_STATE_DATA_IN 2 /* Data arrived + target processing */
  686. #define QLA_TGT_STATE_PROCESSED 3 /* target done processing */
  687. /* ATIO task_codes field */
  688. #define ATIO_SIMPLE_QUEUE 0
  689. #define ATIO_HEAD_OF_QUEUE 1
  690. #define ATIO_ORDERED_QUEUE 2
  691. #define ATIO_ACA_QUEUE 4
  692. #define ATIO_UNTAGGED 5
  693. /* TM failed response codes, see FCP (9.4.11 FCP_RSP_INFO) */
  694. #define FC_TM_SUCCESS 0
  695. #define FC_TM_BAD_FCP_DATA 1
  696. #define FC_TM_BAD_CMD 2
  697. #define FC_TM_FCP_DATA_MISMATCH 3
  698. #define FC_TM_REJECT 4
  699. #define FC_TM_FAILED 5
  700. #if (BITS_PER_LONG > 32) || defined(CONFIG_HIGHMEM64G)
  701. #define pci_dma_lo32(a) (a & 0xffffffff)
  702. #define pci_dma_hi32(a) ((((a) >> 16)>>16) & 0xffffffff)
  703. #else
  704. #define pci_dma_lo32(a) (a & 0xffffffff)
  705. #define pci_dma_hi32(a) 0
  706. #endif
  707. #define QLA_TGT_SENSE_VALID(sense) ((sense != NULL) && \
  708. (((const uint8_t *)(sense))[0] & 0x70) == 0x70)
  709. struct qla_port_24xx_data {
  710. uint8_t port_name[WWN_SIZE];
  711. uint16_t loop_id;
  712. uint16_t reserved;
  713. };
  714. struct qla_qpair_hint {
  715. struct list_head hint_elem;
  716. struct qla_qpair *qpair;
  717. u16 cpuid;
  718. uint8_t cmd_cnt;
  719. };
  720. struct qla_tgt {
  721. struct scsi_qla_host *vha;
  722. struct qla_hw_data *ha;
  723. struct btree_head64 lun_qpair_map;
  724. struct qla_qpair_hint *qphints;
  725. /*
  726. * To sync between IRQ handlers and qlt_target_release(). Needed,
  727. * because req_pkt() can drop/reaquire HW lock inside. Protected by
  728. * HW lock.
  729. */
  730. int atio_irq_cmd_count;
  731. int sg_tablesize;
  732. /* Target's flags, serialized by pha->hardware_lock */
  733. unsigned int link_reinit_iocb_pending:1;
  734. /*
  735. * Protected by tgt_mutex AND hardware_lock for writing and tgt_mutex
  736. * OR hardware_lock for reading.
  737. */
  738. int tgt_stop; /* the target mode driver is being stopped */
  739. int tgt_stopped; /* the target mode driver has been stopped */
  740. /* Count of sessions refering qla_tgt. Protected by hardware_lock. */
  741. int sess_count;
  742. /* Protected by hardware_lock */
  743. struct list_head del_sess_list;
  744. spinlock_t sess_work_lock;
  745. struct list_head sess_works_list;
  746. struct work_struct sess_work;
  747. struct imm_ntfy_from_isp link_reinit_iocb;
  748. wait_queue_head_t waitQ;
  749. int notify_ack_expected;
  750. int abts_resp_expected;
  751. int modify_lun_expected;
  752. atomic_t tgt_global_resets_count;
  753. struct list_head tgt_list_entry;
  754. };
  755. struct qla_tgt_sess_op {
  756. struct scsi_qla_host *vha;
  757. uint32_t chip_reset;
  758. struct atio_from_isp atio;
  759. struct work_struct work;
  760. struct list_head cmd_list;
  761. bool aborted;
  762. struct rsp_que *rsp;
  763. };
  764. enum trace_flags {
  765. TRC_NEW_CMD = BIT_0,
  766. TRC_DO_WORK = BIT_1,
  767. TRC_DO_WORK_ERR = BIT_2,
  768. TRC_XFR_RDY = BIT_3,
  769. TRC_XMIT_DATA = BIT_4,
  770. TRC_XMIT_STATUS = BIT_5,
  771. TRC_SRR_RSP = BIT_6,
  772. TRC_SRR_XRDY = BIT_7,
  773. TRC_SRR_TERM = BIT_8,
  774. TRC_SRR_CTIO = BIT_9,
  775. TRC_FLUSH = BIT_10,
  776. TRC_CTIO_ERR = BIT_11,
  777. TRC_CTIO_DONE = BIT_12,
  778. TRC_CTIO_ABORTED = BIT_13,
  779. TRC_CTIO_STRANGE= BIT_14,
  780. TRC_CMD_DONE = BIT_15,
  781. TRC_CMD_CHK_STOP = BIT_16,
  782. TRC_CMD_FREE = BIT_17,
  783. TRC_DATA_IN = BIT_18,
  784. TRC_ABORT = BIT_19,
  785. TRC_DIF_ERR = BIT_20,
  786. };
  787. struct qla_tgt_cmd {
  788. /*
  789. * Do not move cmd_type field. it needs to line up with srb->cmd_type
  790. */
  791. uint8_t cmd_type;
  792. uint8_t pad[7];
  793. struct se_cmd se_cmd;
  794. struct fc_port *sess;
  795. struct qla_qpair *qpair;
  796. uint32_t reset_count;
  797. int state;
  798. struct work_struct work;
  799. /* Sense buffer that will be mapped into outgoing status */
  800. unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER];
  801. spinlock_t cmd_lock;
  802. /* to save extra sess dereferences */
  803. unsigned int conf_compl_supported:1;
  804. unsigned int sg_mapped:1;
  805. unsigned int free_sg:1;
  806. unsigned int write_data_transferred:1;
  807. unsigned int q_full:1;
  808. unsigned int term_exchg:1;
  809. unsigned int cmd_sent_to_fw:1;
  810. unsigned int cmd_in_wq:1;
  811. unsigned int aborted:1;
  812. unsigned int data_work:1;
  813. unsigned int data_work_free:1;
  814. struct scatterlist *sg; /* cmd data buffer SG vector */
  815. int sg_cnt; /* SG segments count */
  816. int bufflen; /* cmd buffer length */
  817. int offset;
  818. u64 unpacked_lun;
  819. enum dma_data_direction dma_data_direction;
  820. uint16_t vp_idx;
  821. uint16_t loop_id; /* to save extra sess dereferences */
  822. struct qla_tgt *tgt; /* to save extra sess dereferences */
  823. struct scsi_qla_host *vha;
  824. struct list_head cmd_list;
  825. struct atio_from_isp atio;
  826. uint8_t ctx_dsd_alloced;
  827. /* T10-DIF */
  828. #define DIF_ERR_NONE 0
  829. #define DIF_ERR_GRD 1
  830. #define DIF_ERR_REF 2
  831. #define DIF_ERR_APP 3
  832. int8_t dif_err_code;
  833. struct scatterlist *prot_sg;
  834. uint32_t prot_sg_cnt;
  835. uint32_t blk_sz, num_blks;
  836. uint8_t scsi_status, sense_key, asc, ascq;
  837. struct crc_context *ctx;
  838. uint8_t *cdb;
  839. uint64_t lba;
  840. uint16_t a_guard, e_guard, a_app_tag, e_app_tag;
  841. uint32_t a_ref_tag, e_ref_tag;
  842. uint64_t jiffies_at_alloc;
  843. uint64_t jiffies_at_free;
  844. enum trace_flags trc_flags;
  845. };
  846. struct qla_tgt_sess_work_param {
  847. struct list_head sess_works_list_entry;
  848. #define QLA_TGT_SESS_WORK_ABORT 1
  849. #define QLA_TGT_SESS_WORK_TM 2
  850. int type;
  851. union {
  852. struct abts_recv_from_24xx abts;
  853. struct imm_ntfy_from_isp tm_iocb;
  854. struct atio_from_isp tm_iocb2;
  855. };
  856. };
  857. struct qla_tgt_mgmt_cmd {
  858. uint16_t tmr_func;
  859. uint8_t fc_tm_rsp;
  860. struct fc_port *sess;
  861. struct qla_qpair *qpair;
  862. struct scsi_qla_host *vha;
  863. struct se_cmd se_cmd;
  864. struct work_struct free_work;
  865. unsigned int flags;
  866. uint32_t reset_count;
  867. #define QLA24XX_MGMT_SEND_NACK 1
  868. union {
  869. struct atio_from_isp atio;
  870. struct imm_ntfy_from_isp imm_ntfy;
  871. struct abts_recv_from_24xx abts;
  872. } __packed orig_iocb;
  873. };
  874. struct qla_tgt_prm {
  875. struct qla_tgt_cmd *cmd;
  876. struct qla_tgt *tgt;
  877. void *pkt;
  878. struct scatterlist *sg; /* cmd data buffer SG vector */
  879. unsigned char *sense_buffer;
  880. int seg_cnt;
  881. int req_cnt;
  882. uint16_t rq_result;
  883. int sense_buffer_len;
  884. int residual;
  885. int add_status_pkt;
  886. /* dif */
  887. struct scatterlist *prot_sg;
  888. uint16_t prot_seg_cnt;
  889. uint16_t tot_dsds;
  890. };
  891. /* Check for Switch reserved address */
  892. #define IS_SW_RESV_ADDR(_s_id) \
  893. ((_s_id.b.domain == 0xff) && (_s_id.b.area == 0xfc))
  894. #define QLA_TGT_XMIT_DATA 1
  895. #define QLA_TGT_XMIT_STATUS 2
  896. #define QLA_TGT_XMIT_ALL (QLA_TGT_XMIT_STATUS|QLA_TGT_XMIT_DATA)
  897. extern struct qla_tgt_data qla_target;
  898. /*
  899. * Function prototypes for qla_target.c logic used by qla2xxx LLD code.
  900. */
  901. extern int qlt_add_target(struct qla_hw_data *, struct scsi_qla_host *);
  902. extern int qlt_remove_target(struct qla_hw_data *, struct scsi_qla_host *);
  903. extern int qlt_lport_register(void *, u64, u64, u64,
  904. int (*callback)(struct scsi_qla_host *, void *, u64, u64));
  905. extern void qlt_lport_deregister(struct scsi_qla_host *);
  906. extern void qlt_unreg_sess(struct fc_port *);
  907. extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *);
  908. extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int);
  909. extern int __init qlt_init(void);
  910. extern void qlt_exit(void);
  911. extern void qlt_update_vp_map(struct scsi_qla_host *, int);
  912. /*
  913. * This macro is used during early initializations when host->active_mode
  914. * is not set. Right now, ha value is ignored.
  915. */
  916. #define QLA_TGT_MODE_ENABLED() (ql2x_ini_mode != QLA2XXX_INI_MODE_ENABLED)
  917. extern int ql2x_ini_mode;
  918. static inline bool qla_tgt_mode_enabled(struct scsi_qla_host *ha)
  919. {
  920. return ha->host->active_mode == MODE_TARGET;
  921. }
  922. static inline bool qla_ini_mode_enabled(struct scsi_qla_host *ha)
  923. {
  924. return ha->host->active_mode == MODE_INITIATOR;
  925. }
  926. static inline bool qla_dual_mode_enabled(struct scsi_qla_host *ha)
  927. {
  928. return (ha->host->active_mode == MODE_DUAL);
  929. }
  930. static inline uint32_t sid_to_key(const uint8_t *s_id)
  931. {
  932. uint32_t key;
  933. key = (((unsigned long)s_id[0] << 16) |
  934. ((unsigned long)s_id[1] << 8) |
  935. (unsigned long)s_id[2]);
  936. return key;
  937. }
  938. static inline void sid_to_portid(const uint8_t *s_id, port_id_t *p)
  939. {
  940. memset(p, 0, sizeof(*p));
  941. p->b.domain = s_id[0];
  942. p->b.area = s_id[1];
  943. p->b.al_pa = s_id[2];
  944. }
  945. /*
  946. * Exported symbols from qla_target.c LLD logic used by qla2xxx code..
  947. */
  948. extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, struct rsp_que *,
  949. response_t *);
  950. extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *);
  951. extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t);
  952. extern int qlt_abort_cmd(struct qla_tgt_cmd *);
  953. extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
  954. extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
  955. extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);
  956. extern void qlt_async_event(uint16_t, struct scsi_qla_host *, uint16_t *);
  957. extern void qlt_enable_vha(struct scsi_qla_host *);
  958. extern void qlt_vport_create(struct scsi_qla_host *, struct qla_hw_data *);
  959. extern void qlt_rff_id(struct scsi_qla_host *, struct ct_sns_req *);
  960. extern void qlt_init_atio_q_entries(struct scsi_qla_host *);
  961. extern void qlt_24xx_process_atio_queue(struct scsi_qla_host *, uint8_t);
  962. extern void qlt_24xx_config_rings(struct scsi_qla_host *);
  963. extern void qlt_24xx_config_nvram_stage1(struct scsi_qla_host *,
  964. struct nvram_24xx *);
  965. extern void qlt_24xx_config_nvram_stage2(struct scsi_qla_host *,
  966. struct init_cb_24xx *);
  967. extern void qlt_81xx_config_nvram_stage2(struct scsi_qla_host *,
  968. struct init_cb_81xx *);
  969. extern void qlt_81xx_config_nvram_stage1(struct scsi_qla_host *,
  970. struct nvram_81xx *);
  971. extern int qlt_24xx_process_response_error(struct scsi_qla_host *,
  972. struct sts_entry_24xx *);
  973. extern void qlt_modify_vp_config(struct scsi_qla_host *,
  974. struct vp_config_entry_24xx *);
  975. extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *);
  976. extern int qlt_mem_alloc(struct qla_hw_data *);
  977. extern void qlt_mem_free(struct qla_hw_data *);
  978. extern int qlt_stop_phase1(struct qla_tgt *);
  979. extern void qlt_stop_phase2(struct qla_tgt *);
  980. extern irqreturn_t qla83xx_msix_atio_q(int, void *);
  981. extern void qlt_83xx_iospace_config(struct qla_hw_data *);
  982. extern int qlt_free_qfull_cmds(struct qla_qpair *);
  983. extern void qlt_logo_completion_handler(fc_port_t *, int);
  984. extern void qlt_do_generation_tick(struct scsi_qla_host *, int *);
  985. void qlt_send_resp_ctio(struct qla_qpair *, struct qla_tgt_cmd *, uint8_t,
  986. uint8_t, uint8_t, uint8_t);
  987. extern void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *,
  988. struct qla_tgt_cmd *);
  989. #endif /* __QLA_TARGET_H */