bfi_ms.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFI_MS_H__
  18. #define __BFI_MS_H__
  19. #include "bfi.h"
  20. #include "bfa_fc.h"
  21. #include "bfa_defs_svc.h"
  22. #pragma pack(1)
  23. enum bfi_iocfc_h2i_msgs {
  24. BFI_IOCFC_H2I_CFG_REQ = 1,
  25. BFI_IOCFC_H2I_SET_INTR_REQ = 2,
  26. BFI_IOCFC_H2I_UPDATEQ_REQ = 3,
  27. };
  28. enum bfi_iocfc_i2h_msgs {
  29. BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1),
  30. BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3),
  31. };
  32. struct bfi_iocfc_cfg_s {
  33. u8 num_cqs; /* Number of CQs to be used */
  34. u8 sense_buf_len; /* SCSI sense length */
  35. u16 rsvd_1;
  36. u32 endian_sig; /* endian signature of host */
  37. /*
  38. * Request and response circular queue base addresses, size and
  39. * shadow index pointers.
  40. */
  41. union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS];
  42. union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS];
  43. __be16 req_cq_elems[BFI_IOC_MAX_CQS];
  44. union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS];
  45. union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS];
  46. __be16 rsp_cq_elems[BFI_IOC_MAX_CQS];
  47. union bfi_addr_u stats_addr; /* DMA-able address for stats */
  48. union bfi_addr_u cfgrsp_addr; /* config response dma address */
  49. union bfi_addr_u ioim_snsbase; /* IO sense buffer base address */
  50. struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */
  51. };
  52. /*
  53. * Boot target wwn information for this port. This contains either the stored
  54. * or discovered boot target port wwns for the port.
  55. */
  56. struct bfi_iocfc_bootwwns {
  57. wwn_t wwn[BFA_BOOT_BOOTLUN_MAX];
  58. u8 nwwns;
  59. u8 rsvd[7];
  60. };
  61. /**
  62. * Queue configuration response from firmware
  63. */
  64. struct bfi_iocfc_qreg_s {
  65. u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
  66. u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
  67. u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
  68. u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
  69. u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
  70. u32 rme_qctl_off[BFI_IOC_MAX_CQS];
  71. };
  72. struct bfi_iocfc_cfgrsp_s {
  73. struct bfa_iocfc_fwcfg_s fwcfg;
  74. struct bfa_iocfc_intr_attr_s intr_attr;
  75. struct bfi_iocfc_bootwwns bootwwns;
  76. struct bfi_pbc_s pbc_cfg;
  77. struct bfi_iocfc_qreg_s qreg;
  78. };
  79. /*
  80. * BFI_IOCFC_H2I_CFG_REQ message
  81. */
  82. struct bfi_iocfc_cfg_req_s {
  83. struct bfi_mhdr_s mh;
  84. union bfi_addr_u ioc_cfg_dma_addr;
  85. };
  86. /*
  87. * BFI_IOCFC_I2H_CFG_REPLY message
  88. */
  89. struct bfi_iocfc_cfg_reply_s {
  90. struct bfi_mhdr_s mh; /* Common msg header */
  91. u8 cfg_success; /* cfg reply status */
  92. u8 lpu_bm; /* LPUs assigned for this IOC */
  93. u8 rsvd[2];
  94. };
  95. /*
  96. * BFI_IOCFC_H2I_SET_INTR_REQ message
  97. */
  98. struct bfi_iocfc_set_intr_req_s {
  99. struct bfi_mhdr_s mh; /* common msg header */
  100. u8 coalesce; /* enable intr coalescing */
  101. u8 rsvd[3];
  102. __be16 delay; /* delay timer 0..1125us */
  103. __be16 latency; /* latency timer 0..225us */
  104. };
  105. /*
  106. * BFI_IOCFC_H2I_UPDATEQ_REQ message
  107. */
  108. struct bfi_iocfc_updateq_req_s {
  109. struct bfi_mhdr_s mh; /* common msg header */
  110. u32 reqq_ba; /* reqq base addr */
  111. u32 rspq_ba; /* rspq base addr */
  112. u32 reqq_sci; /* reqq shadow ci */
  113. u32 rspq_spi; /* rspq shadow pi */
  114. };
  115. /*
  116. * BFI_IOCFC_I2H_UPDATEQ_RSP message
  117. */
  118. struct bfi_iocfc_updateq_rsp_s {
  119. struct bfi_mhdr_s mh; /* common msg header */
  120. u8 status; /* updateq status */
  121. u8 rsvd[3];
  122. };
  123. /*
  124. * H2I Messages
  125. */
  126. union bfi_iocfc_h2i_msg_u {
  127. struct bfi_mhdr_s mh;
  128. struct bfi_iocfc_cfg_req_s cfg_req;
  129. struct bfi_iocfc_updateq_req_s updateq_req;
  130. u32 mboxmsg[BFI_IOC_MSGSZ];
  131. };
  132. /*
  133. * I2H Messages
  134. */
  135. union bfi_iocfc_i2h_msg_u {
  136. struct bfi_mhdr_s mh;
  137. struct bfi_iocfc_cfg_reply_s cfg_reply;
  138. struct bfi_iocfc_updateq_rsp_s updateq_rsp;
  139. u32 mboxmsg[BFI_IOC_MSGSZ];
  140. };
  141. enum bfi_fcport_h2i {
  142. BFI_FCPORT_H2I_ENABLE_REQ = (1),
  143. BFI_FCPORT_H2I_DISABLE_REQ = (2),
  144. BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
  145. BFI_FCPORT_H2I_STATS_GET_REQ = (4),
  146. BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
  147. };
  148. enum bfi_fcport_i2h {
  149. BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
  150. BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
  151. BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
  152. BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
  153. BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
  154. BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
  155. BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7),
  156. BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8),
  157. BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9),
  158. };
  159. /*
  160. * Generic REQ type
  161. */
  162. struct bfi_fcport_req_s {
  163. struct bfi_mhdr_s mh; /* msg header */
  164. u32 msgtag; /* msgtag for reply */
  165. };
  166. /*
  167. * Generic RSP type
  168. */
  169. struct bfi_fcport_rsp_s {
  170. struct bfi_mhdr_s mh; /* common msg header */
  171. u8 status; /* port enable status */
  172. u8 rsvd[3];
  173. struct bfa_port_cfg_s port_cfg;/* port configuration */
  174. u32 msgtag; /* msgtag for reply */
  175. };
  176. /*
  177. * BFI_FCPORT_H2I_ENABLE_REQ
  178. */
  179. struct bfi_fcport_enable_req_s {
  180. struct bfi_mhdr_s mh; /* msg header */
  181. u32 rsvd1;
  182. wwn_t nwwn; /* node wwn of physical port */
  183. wwn_t pwwn; /* port wwn of physical port */
  184. struct bfa_port_cfg_s port_cfg; /* port configuration */
  185. union bfi_addr_u stats_dma_addr; /* DMA address for stats */
  186. u32 msgtag; /* msgtag for reply */
  187. u8 use_flash_cfg; /* get prot cfg from flash */
  188. u8 rsvd2[3];
  189. };
  190. /*
  191. * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
  192. */
  193. struct bfi_fcport_set_svc_params_req_s {
  194. struct bfi_mhdr_s mh; /* msg header */
  195. __be16 tx_bbcredit; /* Tx credits */
  196. u8 bb_scn; /* BB_SC FC credit recovery */
  197. u8 rsvd;
  198. };
  199. /*
  200. * BFI_FCPORT_I2H_EVENT
  201. */
  202. struct bfi_fcport_event_s {
  203. struct bfi_mhdr_s mh; /* common msg header */
  204. struct bfa_port_link_s link_state;
  205. };
  206. /*
  207. * BFI_FCPORT_I2H_TRUNK_SCN
  208. */
  209. struct bfi_fcport_trunk_link_s {
  210. wwn_t trunk_wwn;
  211. u8 fctl; /* bfa_trunk_link_fctl_t */
  212. u8 state; /* bfa_trunk_link_state_t */
  213. u8 speed; /* bfa_port_speed_t */
  214. u8 rsvd;
  215. __be32 deskew;
  216. };
  217. #define BFI_FCPORT_MAX_LINKS 2
  218. struct bfi_fcport_trunk_scn_s {
  219. struct bfi_mhdr_s mh;
  220. u8 trunk_state; /* bfa_trunk_state_t */
  221. u8 trunk_speed; /* bfa_port_speed_t */
  222. u8 rsvd_a[2];
  223. struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
  224. };
  225. /*
  226. * fcport H2I message
  227. */
  228. union bfi_fcport_h2i_msg_u {
  229. struct bfi_mhdr_s *mhdr;
  230. struct bfi_fcport_enable_req_s *penable;
  231. struct bfi_fcport_req_s *pdisable;
  232. struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
  233. struct bfi_fcport_req_s *pstatsget;
  234. struct bfi_fcport_req_s *pstatsclear;
  235. };
  236. /*
  237. * fcport I2H message
  238. */
  239. union bfi_fcport_i2h_msg_u {
  240. struct bfi_msg_s *msg;
  241. struct bfi_fcport_rsp_s *penable_rsp;
  242. struct bfi_fcport_rsp_s *pdisable_rsp;
  243. struct bfi_fcport_rsp_s *psetsvcparams_rsp;
  244. struct bfi_fcport_rsp_s *pstatsget_rsp;
  245. struct bfi_fcport_rsp_s *pstatsclear_rsp;
  246. struct bfi_fcport_event_s *event;
  247. struct bfi_fcport_trunk_scn_s *trunk_scn;
  248. };
  249. enum bfi_fcxp_h2i {
  250. BFI_FCXP_H2I_SEND_REQ = 1,
  251. };
  252. enum bfi_fcxp_i2h {
  253. BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
  254. };
  255. #define BFA_FCXP_MAX_SGES 2
  256. /*
  257. * FCXP send request structure
  258. */
  259. struct bfi_fcxp_send_req_s {
  260. struct bfi_mhdr_s mh; /* Common msg header */
  261. __be16 fcxp_tag; /* driver request tag */
  262. __be16 max_frmsz; /* max send frame size */
  263. __be16 vf_id; /* vsan tag if applicable */
  264. u16 rport_fw_hndl; /* FW Handle for the remote port */
  265. u8 class; /* FC class used for req/rsp */
  266. u8 rsp_timeout; /* timeout in secs, 0-no response */
  267. u8 cts; /* continue sequence */
  268. u8 lp_tag; /* lport tag */
  269. struct fchs_s fchs; /* request FC header structure */
  270. __be32 req_len; /* request payload length */
  271. __be32 rsp_maxlen; /* max response length expected */
  272. struct bfi_alen_s req_alen; /* request buffer */
  273. struct bfi_alen_s rsp_alen; /* response buffer */
  274. };
  275. /*
  276. * FCXP send response structure
  277. */
  278. struct bfi_fcxp_send_rsp_s {
  279. struct bfi_mhdr_s mh; /* Common msg header */
  280. __be16 fcxp_tag; /* send request tag */
  281. u8 req_status; /* request status */
  282. u8 rsvd;
  283. __be32 rsp_len; /* actual response length */
  284. __be32 residue_len; /* residual response length */
  285. struct fchs_s fchs; /* response FC header structure */
  286. };
  287. enum bfi_uf_h2i {
  288. BFI_UF_H2I_BUF_POST = 1,
  289. };
  290. enum bfi_uf_i2h {
  291. BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
  292. };
  293. #define BFA_UF_MAX_SGES 2
  294. struct bfi_uf_buf_post_s {
  295. struct bfi_mhdr_s mh; /* Common msg header */
  296. u16 buf_tag; /* buffer tag */
  297. __be16 buf_len; /* total buffer length */
  298. struct bfi_alen_s alen; /* buffer address/len pair */
  299. };
  300. struct bfi_uf_frm_rcvd_s {
  301. struct bfi_mhdr_s mh; /* Common msg header */
  302. u16 buf_tag; /* buffer tag */
  303. u16 rsvd;
  304. u16 frm_len; /* received frame length */
  305. u16 xfr_len; /* tranferred length */
  306. };
  307. enum bfi_lps_h2i_msgs {
  308. BFI_LPS_H2I_LOGIN_REQ = 1,
  309. BFI_LPS_H2I_LOGOUT_REQ = 2,
  310. BFI_LPS_H2I_N2N_PID_REQ = 3,
  311. };
  312. enum bfi_lps_i2h_msgs {
  313. BFI_LPS_I2H_LOGIN_RSP = BFA_I2HM(1),
  314. BFI_LPS_I2H_LOGOUT_RSP = BFA_I2HM(2),
  315. BFI_LPS_I2H_CVL_EVENT = BFA_I2HM(3),
  316. };
  317. struct bfi_lps_login_req_s {
  318. struct bfi_mhdr_s mh; /* common msg header */
  319. u8 lp_tag;
  320. u8 alpa;
  321. __be16 pdu_size;
  322. wwn_t pwwn;
  323. wwn_t nwwn;
  324. u8 fdisc;
  325. u8 auth_en;
  326. u8 lps_role;
  327. u8 bb_scn;
  328. };
  329. struct bfi_lps_login_rsp_s {
  330. struct bfi_mhdr_s mh; /* common msg header */
  331. u8 lp_tag;
  332. u8 status;
  333. u8 lsrjt_rsn;
  334. u8 lsrjt_expl;
  335. wwn_t port_name;
  336. wwn_t node_name;
  337. __be16 bb_credit;
  338. u8 f_port;
  339. u8 npiv_en;
  340. u32 lp_pid:24;
  341. u32 auth_req:8;
  342. mac_t lp_mac;
  343. mac_t fcf_mac;
  344. u8 ext_status;
  345. u8 brcd_switch; /* attached peer is brcd switch */
  346. u8 bb_scn; /* atatched port's bb_scn */
  347. u8 resvd;
  348. };
  349. struct bfi_lps_logout_req_s {
  350. struct bfi_mhdr_s mh; /* common msg header */
  351. u8 lp_tag;
  352. u8 rsvd[3];
  353. wwn_t port_name;
  354. };
  355. struct bfi_lps_logout_rsp_s {
  356. struct bfi_mhdr_s mh; /* common msg header */
  357. u8 lp_tag;
  358. u8 status;
  359. u8 rsvd[2];
  360. };
  361. struct bfi_lps_cvl_event_s {
  362. struct bfi_mhdr_s mh; /* common msg header */
  363. u8 lp_tag;
  364. u8 rsvd[3];
  365. };
  366. struct bfi_lps_n2n_pid_req_s {
  367. struct bfi_mhdr_s mh; /* common msg header */
  368. u8 lp_tag;
  369. u32 lp_pid:24;
  370. };
  371. union bfi_lps_h2i_msg_u {
  372. struct bfi_mhdr_s *msg;
  373. struct bfi_lps_login_req_s *login_req;
  374. struct bfi_lps_logout_req_s *logout_req;
  375. struct bfi_lps_n2n_pid_req_s *n2n_pid_req;
  376. };
  377. union bfi_lps_i2h_msg_u {
  378. struct bfi_msg_s *msg;
  379. struct bfi_lps_login_rsp_s *login_rsp;
  380. struct bfi_lps_logout_rsp_s *logout_rsp;
  381. struct bfi_lps_cvl_event_s *cvl_event;
  382. };
  383. enum bfi_rport_h2i_msgs {
  384. BFI_RPORT_H2I_CREATE_REQ = 1,
  385. BFI_RPORT_H2I_DELETE_REQ = 2,
  386. BFI_RPORT_H2I_SET_SPEED_REQ = 3,
  387. };
  388. enum bfi_rport_i2h_msgs {
  389. BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
  390. BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
  391. BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3),
  392. };
  393. struct bfi_rport_create_req_s {
  394. struct bfi_mhdr_s mh; /* common msg header */
  395. u16 bfa_handle; /* host rport handle */
  396. __be16 max_frmsz; /* max rcv pdu size */
  397. u32 pid:24, /* remote port ID */
  398. lp_tag:8; /* local port tag */
  399. u32 local_pid:24, /* local port ID */
  400. cisc:8;
  401. u8 fc_class; /* supported FC classes */
  402. u8 vf_en; /* virtual fabric enable */
  403. u16 vf_id; /* virtual fabric ID */
  404. };
  405. struct bfi_rport_create_rsp_s {
  406. struct bfi_mhdr_s mh; /* common msg header */
  407. u8 status; /* rport creation status */
  408. u8 rsvd[3];
  409. u16 bfa_handle; /* host rport handle */
  410. u16 fw_handle; /* firmware rport handle */
  411. struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */
  412. };
  413. struct bfa_rport_speed_req_s {
  414. struct bfi_mhdr_s mh; /* common msg header */
  415. u16 fw_handle; /* firmware rport handle */
  416. u8 speed; /* rport's speed via RPSC */
  417. u8 rsvd;
  418. };
  419. struct bfi_rport_delete_req_s {
  420. struct bfi_mhdr_s mh; /* common msg header */
  421. u16 fw_handle; /* firmware rport handle */
  422. u16 rsvd;
  423. };
  424. struct bfi_rport_delete_rsp_s {
  425. struct bfi_mhdr_s mh; /* common msg header */
  426. u16 bfa_handle; /* host rport handle */
  427. u8 status; /* rport deletion status */
  428. u8 rsvd;
  429. };
  430. struct bfi_rport_qos_scn_s {
  431. struct bfi_mhdr_s mh; /* common msg header */
  432. u16 bfa_handle; /* host rport handle */
  433. u16 rsvd;
  434. struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */
  435. struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */
  436. };
  437. union bfi_rport_h2i_msg_u {
  438. struct bfi_msg_s *msg;
  439. struct bfi_rport_create_req_s *create_req;
  440. struct bfi_rport_delete_req_s *delete_req;
  441. struct bfi_rport_speed_req_s *speed_req;
  442. };
  443. union bfi_rport_i2h_msg_u {
  444. struct bfi_msg_s *msg;
  445. struct bfi_rport_create_rsp_s *create_rsp;
  446. struct bfi_rport_delete_rsp_s *delete_rsp;
  447. struct bfi_rport_qos_scn_s *qos_scn_evt;
  448. };
  449. /*
  450. * Initiator mode I-T nexus interface defines.
  451. */
  452. enum bfi_itn_h2i {
  453. BFI_ITN_H2I_CREATE_REQ = 1, /* i-t nexus creation */
  454. BFI_ITN_H2I_DELETE_REQ = 2, /* i-t nexus deletion */
  455. };
  456. enum bfi_itn_i2h {
  457. BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
  458. BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
  459. BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
  460. };
  461. struct bfi_itn_create_req_s {
  462. struct bfi_mhdr_s mh; /* common msg header */
  463. u16 fw_handle; /* f/w handle for itnim */
  464. u8 class; /* FC class for IO */
  465. u8 seq_rec; /* sequence recovery support */
  466. u8 msg_no; /* seq id of the msg */
  467. u8 role;
  468. };
  469. struct bfi_itn_create_rsp_s {
  470. struct bfi_mhdr_s mh; /* common msg header */
  471. u16 bfa_handle; /* bfa handle for itnim */
  472. u8 status; /* fcp request status */
  473. u8 seq_id; /* seq id of the msg */
  474. };
  475. struct bfi_itn_delete_req_s {
  476. struct bfi_mhdr_s mh; /* common msg header */
  477. u16 fw_handle; /* f/w itnim handle */
  478. u8 seq_id; /* seq id of the msg */
  479. u8 rsvd;
  480. };
  481. struct bfi_itn_delete_rsp_s {
  482. struct bfi_mhdr_s mh; /* common msg header */
  483. u16 bfa_handle; /* bfa handle for itnim */
  484. u8 status; /* fcp request status */
  485. u8 seq_id; /* seq id of the msg */
  486. };
  487. struct bfi_itn_sler_event_s {
  488. struct bfi_mhdr_s mh; /* common msg header */
  489. u16 bfa_handle; /* bfa handle for itnim */
  490. u16 rsvd;
  491. };
  492. union bfi_itn_h2i_msg_u {
  493. struct bfi_itn_create_req_s *create_req;
  494. struct bfi_itn_delete_req_s *delete_req;
  495. struct bfi_msg_s *msg;
  496. };
  497. union bfi_itn_i2h_msg_u {
  498. struct bfi_itn_create_rsp_s *create_rsp;
  499. struct bfi_itn_delete_rsp_s *delete_rsp;
  500. struct bfi_itn_sler_event_s *sler_event;
  501. struct bfi_msg_s *msg;
  502. };
  503. /*
  504. * Initiator mode IO interface defines.
  505. */
  506. enum bfi_ioim_h2i {
  507. BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */
  508. BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */
  509. };
  510. enum bfi_ioim_i2h {
  511. BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */
  512. BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */
  513. };
  514. /*
  515. * IO command DIF info
  516. */
  517. struct bfi_ioim_dif_s {
  518. u32 dif_info[4];
  519. };
  520. /*
  521. * FCP IO messages overview
  522. *
  523. * @note
  524. * - Max CDB length supported is 64 bytes.
  525. * - SCSI Linked commands and SCSI bi-directional Commands not
  526. * supported.
  527. *
  528. */
  529. struct bfi_ioim_req_s {
  530. struct bfi_mhdr_s mh; /* Common msg header */
  531. __be16 io_tag; /* I/O tag */
  532. u16 rport_hdl; /* itnim/rport firmware handle */
  533. struct fcp_cmnd_s cmnd; /* IO request info */
  534. /*
  535. * SG elements array within the IO request must be double word
  536. * aligned. This aligment is required to optimize SGM setup for the IO.
  537. */
  538. struct bfi_sge_s sges[BFI_SGE_INLINE_MAX];
  539. u8 io_timeout;
  540. u8 dif_en;
  541. u8 rsvd_a[2];
  542. struct bfi_ioim_dif_s dif;
  543. };
  544. /*
  545. * This table shows various IO status codes from firmware and their
  546. * meaning. Host driver can use these status codes to further process
  547. * IO completions.
  548. *
  549. * BFI_IOIM_STS_OK : IO completed with error free SCSI &
  550. * transport status.
  551. * io-tag can be reused.
  552. *
  553. * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error.
  554. * - io-tag can be reused.
  555. *
  556. * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to
  557. * host request.
  558. * - io-tag cannot be reused yet.
  559. *
  560. * BFI_IOIM_STS_ABORTED : IO was aborted successfully
  561. * internally by f/w.
  562. * - io-tag cannot be reused yet.
  563. *
  564. * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening
  565. * in the firmware and
  566. * - io-tag cannot be reused yet.
  567. *
  568. * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO
  569. * with sequence level error
  570. * logic and hence host needs to retry
  571. * this IO with a different IO tag
  572. * - io-tag cannot be used yet.
  573. *
  574. * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host
  575. * is required because 2 consecutive ABTS
  576. * timedout and host needs logout and
  577. * re-login with the target
  578. * - io-tag cannot be used yet.
  579. *
  580. * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good,
  581. * but the data tranferred is less than
  582. * the fcp data length in the command.
  583. * ex. SCSI INQUIRY where transferred
  584. * data length and residue count in FCP
  585. * response accounts for total fcp-dl
  586. * - io-tag can be reused.
  587. *
  588. * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good,
  589. * but the data transerred is more than
  590. * fcp data length in the command. ex.
  591. * TAPE IOs where blocks can of unequal
  592. * lengths.
  593. * - io-tag can be reused.
  594. *
  595. * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag
  596. * during abort process
  597. * - io-tag can be reused.
  598. *
  599. * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error.
  600. * ex target sent more data than
  601. * requested, or there was data frame
  602. * loss and other reasons
  603. * - io-tag cannot be used yet.
  604. *
  605. * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF
  606. * CRC err or Ref Tag err or App tag err.
  607. * - io-tag can be reused.
  608. *
  609. * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task
  610. * Management command from the host
  611. * - io-tag can be reused.
  612. *
  613. * BFI_IOIM_STS_UTAG : Firmware does not know about this
  614. * io_tag.
  615. * - io-tag can be reused.
  616. */
  617. enum bfi_ioim_status {
  618. BFI_IOIM_STS_OK = 0,
  619. BFI_IOIM_STS_HOST_ABORTED = 1,
  620. BFI_IOIM_STS_ABORTED = 2,
  621. BFI_IOIM_STS_TIMEDOUT = 3,
  622. BFI_IOIM_STS_RES_FREE = 4,
  623. BFI_IOIM_STS_SQER_NEEDED = 5,
  624. BFI_IOIM_STS_PROTO_ERR = 6,
  625. BFI_IOIM_STS_UTAG = 7,
  626. BFI_IOIM_STS_PATHTOV = 8,
  627. };
  628. #define BFI_IOIM_SNSLEN (256)
  629. /*
  630. * I/O response message
  631. */
  632. struct bfi_ioim_rsp_s {
  633. struct bfi_mhdr_s mh; /* common msg header */
  634. __be16 io_tag; /* completed IO tag */
  635. u16 bfa_rport_hndl; /* releated rport handle */
  636. u8 io_status; /* IO completion status */
  637. u8 reuse_io_tag; /* IO tag can be reused */
  638. u16 abort_tag; /* host abort request tag */
  639. u8 scsi_status; /* scsi status from target */
  640. u8 sns_len; /* scsi sense length */
  641. u8 resid_flags; /* IO residue flags */
  642. u8 rsvd_a;
  643. __be32 residue; /* IO residual length in bytes */
  644. u32 rsvd_b[3];
  645. };
  646. struct bfi_ioim_abort_req_s {
  647. struct bfi_mhdr_s mh; /* Common msg header */
  648. __be16 io_tag; /* I/O tag */
  649. u16 abort_tag; /* unique request tag */
  650. };
  651. /*
  652. * Initiator mode task management command interface defines.
  653. */
  654. enum bfi_tskim_h2i {
  655. BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */
  656. BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */
  657. };
  658. enum bfi_tskim_i2h {
  659. BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
  660. };
  661. struct bfi_tskim_req_s {
  662. struct bfi_mhdr_s mh; /* Common msg header */
  663. __be16 tsk_tag; /* task management tag */
  664. u16 itn_fhdl; /* itn firmware handle */
  665. struct scsi_lun lun; /* LU number */
  666. u8 tm_flags; /* see enum fcp_tm_cmnd */
  667. u8 t_secs; /* Timeout value in seconds */
  668. u8 rsvd[2];
  669. };
  670. struct bfi_tskim_abortreq_s {
  671. struct bfi_mhdr_s mh; /* Common msg header */
  672. __be16 tsk_tag; /* task management tag */
  673. u16 rsvd;
  674. };
  675. enum bfi_tskim_status {
  676. /*
  677. * Following are FCP-4 spec defined status codes,
  678. * **DO NOT CHANGE THEM **
  679. */
  680. BFI_TSKIM_STS_OK = 0,
  681. BFI_TSKIM_STS_NOT_SUPP = 4,
  682. BFI_TSKIM_STS_FAILED = 5,
  683. /*
  684. * Defined by BFA
  685. */
  686. BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */
  687. BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */
  688. };
  689. struct bfi_tskim_rsp_s {
  690. struct bfi_mhdr_s mh; /* Common msg header */
  691. __be16 tsk_tag; /* task mgmt cmnd tag */
  692. u8 tsk_status; /* @ref bfi_tskim_status */
  693. u8 rsvd;
  694. };
  695. #pragma pack()
  696. /*
  697. * Crossbow PCI MSI-X vector defines
  698. */
  699. enum {
  700. BFI_MSIX_CPE_QMIN_CB = 0,
  701. BFI_MSIX_CPE_QMAX_CB = 7,
  702. BFI_MSIX_RME_QMIN_CB = 8,
  703. BFI_MSIX_RME_QMAX_CB = 15,
  704. BFI_MSIX_CB_MAX = 22,
  705. };
  706. /*
  707. * Catapult FC PCI MSI-X vector defines
  708. */
  709. enum {
  710. BFI_MSIX_LPU_ERR_CT = 0,
  711. BFI_MSIX_CPE_QMIN_CT = 1,
  712. BFI_MSIX_CPE_QMAX_CT = 4,
  713. BFI_MSIX_RME_QMIN_CT = 5,
  714. BFI_MSIX_RME_QMAX_CT = 8,
  715. BFI_MSIX_CT_MAX = 9,
  716. };
  717. #endif /* __BFI_MS_H__ */