bfi.h 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  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_H__
  18. #define __BFI_H__
  19. #include "bfa_defs.h"
  20. #include "bfa_defs_svc.h"
  21. #pragma pack(1)
  22. /* Per dma segment max size */
  23. #define BFI_MEM_DMA_SEG_SZ (131072)
  24. /* Get number of dma segments required */
  25. #define BFI_MEM_DMA_NSEGS(_num_reqs, _req_sz) \
  26. ((u16)(((((_num_reqs) * (_req_sz)) + BFI_MEM_DMA_SEG_SZ - 1) & \
  27. ~(BFI_MEM_DMA_SEG_SZ - 1)) / BFI_MEM_DMA_SEG_SZ))
  28. /* Get num dma reqs - that fit in a segment */
  29. #define BFI_MEM_NREQS_SEG(_rqsz) (BFI_MEM_DMA_SEG_SZ / (_rqsz))
  30. /* Get segment num from tag */
  31. #define BFI_MEM_SEG_FROM_TAG(_tag, _rqsz) ((_tag) / BFI_MEM_NREQS_SEG(_rqsz))
  32. /* Get dma req offset in a segment */
  33. #define BFI_MEM_SEG_REQ_OFFSET(_tag, _sz) \
  34. ((_tag) - (BFI_MEM_SEG_FROM_TAG(_tag, _sz) * BFI_MEM_NREQS_SEG(_sz)))
  35. /*
  36. * BFI FW image type
  37. */
  38. #define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */
  39. #define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32))
  40. /*
  41. * Msg header common to all msgs
  42. */
  43. struct bfi_mhdr_s {
  44. u8 msg_class; /* @ref bfi_mclass_t */
  45. u8 msg_id; /* msg opcode with in the class */
  46. union {
  47. struct {
  48. u8 qid;
  49. u8 fn_lpu; /* msg destination */
  50. } h2i;
  51. u16 i2htok; /* token in msgs to host */
  52. } mtag;
  53. };
  54. #define bfi_fn_lpu(__fn, __lpu) ((__fn) << 1 | (__lpu))
  55. #define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
  56. #define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do { \
  57. (_mh).msg_class = (_mc); \
  58. (_mh).msg_id = (_op); \
  59. (_mh).mtag.h2i.fn_lpu = (_fn_lpu); \
  60. } while (0)
  61. #define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
  62. (_mh).msg_class = (_mc); \
  63. (_mh).msg_id = (_op); \
  64. (_mh).mtag.i2htok = (_i2htok); \
  65. } while (0)
  66. /*
  67. * Message opcodes: 0-127 to firmware, 128-255 to host
  68. */
  69. #define BFI_I2H_OPCODE_BASE 128
  70. #define BFA_I2HM(_x) ((_x) + BFI_I2H_OPCODE_BASE)
  71. /*
  72. ****************************************************************************
  73. *
  74. * Scatter Gather Element and Page definition
  75. *
  76. ****************************************************************************
  77. */
  78. #define BFI_SGE_INLINE 1
  79. #define BFI_SGE_INLINE_MAX (BFI_SGE_INLINE + 1)
  80. /*
  81. * SG Flags
  82. */
  83. enum {
  84. BFI_SGE_DATA = 0, /* data address, not last */
  85. BFI_SGE_DATA_CPL = 1, /* data addr, last in current page */
  86. BFI_SGE_DATA_LAST = 3, /* data address, last */
  87. BFI_SGE_LINK = 2, /* link address */
  88. BFI_SGE_PGDLEN = 2, /* cumulative data length for page */
  89. };
  90. /*
  91. * DMA addresses
  92. */
  93. union bfi_addr_u {
  94. struct {
  95. __be32 addr_lo;
  96. __be32 addr_hi;
  97. } a32;
  98. };
  99. /*
  100. * Scatter Gather Element used for fast-path IO requests
  101. */
  102. struct bfi_sge_s {
  103. #ifdef __BIG_ENDIAN
  104. u32 flags:2,
  105. rsvd:2,
  106. sg_len:28;
  107. #else
  108. u32 sg_len:28,
  109. rsvd:2,
  110. flags:2;
  111. #endif
  112. union bfi_addr_u sga;
  113. };
  114. /**
  115. * Generic DMA addr-len pair.
  116. */
  117. struct bfi_alen_s {
  118. union bfi_addr_u al_addr; /* DMA addr of buffer */
  119. u32 al_len; /* length of buffer */
  120. };
  121. /*
  122. * Scatter Gather Page
  123. */
  124. #define BFI_SGPG_DATA_SGES 7
  125. #define BFI_SGPG_SGES_MAX (BFI_SGPG_DATA_SGES + 1)
  126. #define BFI_SGPG_RSVD_WD_LEN 8
  127. struct bfi_sgpg_s {
  128. struct bfi_sge_s sges[BFI_SGPG_SGES_MAX];
  129. u32 rsvd[BFI_SGPG_RSVD_WD_LEN];
  130. };
  131. /* FCP module definitions */
  132. #define BFI_IO_MAX (2000)
  133. #define BFI_IOIM_SNSLEN (256)
  134. #define BFI_IOIM_SNSBUF_SEGS \
  135. BFI_MEM_DMA_NSEGS(BFI_IO_MAX, BFI_IOIM_SNSLEN)
  136. /*
  137. * Large Message structure - 128 Bytes size Msgs
  138. */
  139. #define BFI_LMSG_SZ 128
  140. #define BFI_LMSG_PL_WSZ \
  141. ((BFI_LMSG_SZ - sizeof(struct bfi_mhdr_s)) / 4)
  142. struct bfi_msg_s {
  143. struct bfi_mhdr_s mhdr;
  144. u32 pl[BFI_LMSG_PL_WSZ];
  145. };
  146. /*
  147. * Mailbox message structure
  148. */
  149. #define BFI_MBMSG_SZ 7
  150. struct bfi_mbmsg_s {
  151. struct bfi_mhdr_s mh;
  152. u32 pl[BFI_MBMSG_SZ];
  153. };
  154. /*
  155. * Supported PCI function class codes (personality)
  156. */
  157. enum bfi_pcifn_class {
  158. BFI_PCIFN_CLASS_FC = 0x0c04,
  159. BFI_PCIFN_CLASS_ETH = 0x0200,
  160. };
  161. /*
  162. * Message Classes
  163. */
  164. enum bfi_mclass {
  165. BFI_MC_IOC = 1, /* IO Controller (IOC) */
  166. BFI_MC_DIAG = 2, /* Diagnostic Msgs */
  167. BFI_MC_FLASH = 3, /* Flash message class */
  168. BFI_MC_CEE = 4, /* CEE */
  169. BFI_MC_FCPORT = 5, /* FC port */
  170. BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
  171. BFI_MC_ABLK = 7, /* ASIC block configuration */
  172. BFI_MC_UF = 8, /* Unsolicited frame receive */
  173. BFI_MC_FCXP = 9, /* FC Transport */
  174. BFI_MC_LPS = 10, /* lport fc login services */
  175. BFI_MC_RPORT = 11, /* Remote port */
  176. BFI_MC_ITN = 12, /* I-T nexus (Initiator mode) */
  177. BFI_MC_IOIM_READ = 13, /* read IO (Initiator mode) */
  178. BFI_MC_IOIM_WRITE = 14, /* write IO (Initiator mode) */
  179. BFI_MC_IOIM_IO = 15, /* IO (Initiator mode) */
  180. BFI_MC_IOIM = 16, /* IO (Initiator mode) */
  181. BFI_MC_IOIM_IOCOM = 17, /* good IO completion */
  182. BFI_MC_TSKIM = 18, /* Initiator Task management */
  183. BFI_MC_PORT = 21, /* Physical port */
  184. BFI_MC_SFP = 22, /* SFP module */
  185. BFI_MC_PHY = 25, /* External PHY message class */
  186. BFI_MC_FRU = 34,
  187. BFI_MC_MAX = 35
  188. };
  189. #define BFI_IOC_MAX_CQS 4
  190. #define BFI_IOC_MAX_CQS_ASIC 8
  191. #define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
  192. /*
  193. *----------------------------------------------------------------------
  194. * IOC
  195. *----------------------------------------------------------------------
  196. */
  197. /*
  198. * Different asic generations
  199. */
  200. enum bfi_asic_gen {
  201. BFI_ASIC_GEN_CB = 1, /* crossbow 8G FC */
  202. BFI_ASIC_GEN_CT = 2, /* catapult 8G FC or 10G CNA */
  203. BFI_ASIC_GEN_CT2 = 3, /* catapult-2 16G FC or 10G CNA */
  204. };
  205. enum bfi_asic_mode {
  206. BFI_ASIC_MODE_FC = 1, /* FC upto 8G speed */
  207. BFI_ASIC_MODE_FC16 = 2, /* FC upto 16G speed */
  208. BFI_ASIC_MODE_ETH = 3, /* Ethernet ports */
  209. BFI_ASIC_MODE_COMBO = 4, /* FC 16G and Ethernet 10G port */
  210. };
  211. enum bfi_ioc_h2i_msgs {
  212. BFI_IOC_H2I_ENABLE_REQ = 1,
  213. BFI_IOC_H2I_DISABLE_REQ = 2,
  214. BFI_IOC_H2I_GETATTR_REQ = 3,
  215. BFI_IOC_H2I_DBG_SYNC = 4,
  216. BFI_IOC_H2I_DBG_DUMP = 5,
  217. };
  218. enum bfi_ioc_i2h_msgs {
  219. BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
  220. BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
  221. BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
  222. BFI_IOC_I2H_HBEAT = BFA_I2HM(4),
  223. BFI_IOC_I2H_ACQ_ADDR_REPLY = BFA_I2HM(5),
  224. };
  225. /*
  226. * BFI_IOC_H2I_GETATTR_REQ message
  227. */
  228. struct bfi_ioc_getattr_req_s {
  229. struct bfi_mhdr_s mh;
  230. union bfi_addr_u attr_addr;
  231. };
  232. struct bfi_ioc_attr_s {
  233. wwn_t mfg_pwwn; /* Mfg port wwn */
  234. wwn_t mfg_nwwn; /* Mfg node wwn */
  235. mac_t mfg_mac; /* Mfg mac */
  236. u8 port_mode; /* bfi_port_mode */
  237. u8 rsvd_a;
  238. wwn_t pwwn;
  239. wwn_t nwwn;
  240. mac_t mac; /* PBC or Mfg mac */
  241. u16 rsvd_b;
  242. mac_t fcoe_mac;
  243. u16 rsvd_c;
  244. char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
  245. u8 pcie_gen;
  246. u8 pcie_lanes_orig;
  247. u8 pcie_lanes;
  248. u8 rx_bbcredit; /* receive buffer credits */
  249. u32 adapter_prop; /* adapter properties */
  250. u16 maxfrsize; /* max receive frame size */
  251. char asic_rev;
  252. u8 rsvd_d;
  253. char fw_version[BFA_VERSION_LEN];
  254. char optrom_version[BFA_VERSION_LEN];
  255. struct bfa_mfg_vpd_s vpd;
  256. u32 card_type; /* card type */
  257. u8 mfg_day; /* manufacturing day */
  258. u8 mfg_month; /* manufacturing month */
  259. u16 mfg_year; /* manufacturing year */
  260. };
  261. /*
  262. * BFI_IOC_I2H_GETATTR_REPLY message
  263. */
  264. struct bfi_ioc_getattr_reply_s {
  265. struct bfi_mhdr_s mh; /* Common msg header */
  266. u8 status; /* cfg reply status */
  267. u8 rsvd[3];
  268. };
  269. /*
  270. * Firmware memory page offsets
  271. */
  272. #define BFI_IOC_SMEM_PG0_CB (0x40)
  273. #define BFI_IOC_SMEM_PG0_CT (0x180)
  274. /*
  275. * Firmware statistic offset
  276. */
  277. #define BFI_IOC_FWSTATS_OFF (0x6B40)
  278. #define BFI_IOC_FWSTATS_SZ (4096)
  279. /*
  280. * Firmware trace offset
  281. */
  282. #define BFI_IOC_TRC_OFF (0x4b00)
  283. #define BFI_IOC_TRC_ENTS 256
  284. #define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
  285. #define BFI_IOC_MD5SUM_SZ 4
  286. struct bfi_ioc_image_hdr_s {
  287. u32 signature; /* constant signature */
  288. u8 asic_gen; /* asic generation */
  289. u8 asic_mode;
  290. u8 port0_mode; /* device mode for port 0 */
  291. u8 port1_mode; /* device mode for port 1 */
  292. u32 exec; /* exec vector */
  293. u32 bootenv; /* fimware boot env */
  294. u32 rsvd_b[4];
  295. u32 md5sum[BFI_IOC_MD5SUM_SZ];
  296. };
  297. #define BFI_FWBOOT_DEVMODE_OFF 4
  298. #define BFI_FWBOOT_TYPE_OFF 8
  299. #define BFI_FWBOOT_ENV_OFF 12
  300. #define BFI_FWBOOT_DEVMODE(__asic_gen, __asic_mode, __p0_mode, __p1_mode) \
  301. (((u32)(__asic_gen)) << 24 | \
  302. ((u32)(__asic_mode)) << 16 | \
  303. ((u32)(__p0_mode)) << 8 | \
  304. ((u32)(__p1_mode)))
  305. #define BFI_FWBOOT_TYPE_NORMAL 0
  306. #define BFI_FWBOOT_TYPE_MEMTEST 2
  307. #define BFI_FWBOOT_ENV_OS 0
  308. enum bfi_port_mode {
  309. BFI_PORT_MODE_FC = 1,
  310. BFI_PORT_MODE_ETH = 2,
  311. };
  312. struct bfi_ioc_hbeat_s {
  313. struct bfi_mhdr_s mh; /* common msg header */
  314. u32 hb_count; /* current heart beat count */
  315. };
  316. /*
  317. * IOC hardware/firmware state
  318. */
  319. enum bfi_ioc_state {
  320. BFI_IOC_UNINIT = 0, /* not initialized */
  321. BFI_IOC_INITING = 1, /* h/w is being initialized */
  322. BFI_IOC_HWINIT = 2, /* h/w is initialized */
  323. BFI_IOC_CFG = 3, /* IOC configuration in progress */
  324. BFI_IOC_OP = 4, /* IOC is operational */
  325. BFI_IOC_DISABLING = 5, /* IOC is being disabled */
  326. BFI_IOC_DISABLED = 6, /* IOC is disabled */
  327. BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
  328. BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
  329. BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
  330. };
  331. #define BFA_IOC_CB_JOIN_SH 16
  332. #define BFA_IOC_CB_FWSTATE_MASK 0x0000ffff
  333. #define BFA_IOC_CB_JOIN_MASK 0xffff0000
  334. #define BFI_IOC_ENDIAN_SIG 0x12345678
  335. enum {
  336. BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
  337. BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
  338. BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
  339. BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
  340. BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
  341. BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
  342. BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
  343. BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
  344. BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
  345. BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
  346. };
  347. #define BFI_ADAPTER_GETP(__prop, __adap_prop) \
  348. (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
  349. BFI_ADAPTER_ ## __prop ## _SH)
  350. #define BFI_ADAPTER_SETP(__prop, __val) \
  351. ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
  352. #define BFI_ADAPTER_IS_PROTO(__adap_type) \
  353. ((__adap_type) & BFI_ADAPTER_PROTO)
  354. #define BFI_ADAPTER_IS_TTV(__adap_type) \
  355. ((__adap_type) & BFI_ADAPTER_TTV)
  356. #define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
  357. ((__adap_type) & BFI_ADAPTER_UNSUPP)
  358. #define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
  359. ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
  360. BFI_ADAPTER_UNSUPP))
  361. /*
  362. * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
  363. */
  364. struct bfi_ioc_ctrl_req_s {
  365. struct bfi_mhdr_s mh;
  366. u16 clscode;
  367. u16 rsvd;
  368. u32 tv_sec;
  369. };
  370. #define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
  371. #define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
  372. /*
  373. * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
  374. */
  375. struct bfi_ioc_ctrl_reply_s {
  376. struct bfi_mhdr_s mh; /* Common msg header */
  377. u8 status; /* enable/disable status */
  378. u8 port_mode; /* bfa_mode_s */
  379. u8 cap_bm; /* capability bit mask */
  380. u8 rsvd;
  381. };
  382. #define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
  383. #define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
  384. #define BFI_IOC_MSGSZ 8
  385. /*
  386. * H2I Messages
  387. */
  388. union bfi_ioc_h2i_msg_u {
  389. struct bfi_mhdr_s mh;
  390. struct bfi_ioc_ctrl_req_s enable_req;
  391. struct bfi_ioc_ctrl_req_s disable_req;
  392. struct bfi_ioc_getattr_req_s getattr_req;
  393. u32 mboxmsg[BFI_IOC_MSGSZ];
  394. };
  395. /*
  396. * I2H Messages
  397. */
  398. union bfi_ioc_i2h_msg_u {
  399. struct bfi_mhdr_s mh;
  400. struct bfi_ioc_ctrl_reply_s fw_event;
  401. u32 mboxmsg[BFI_IOC_MSGSZ];
  402. };
  403. /*
  404. *----------------------------------------------------------------------
  405. * PBC
  406. *----------------------------------------------------------------------
  407. */
  408. #define BFI_PBC_MAX_BLUNS 8
  409. #define BFI_PBC_MAX_VPORTS 16
  410. #define BFI_PBC_PORT_DISABLED 2
  411. /*
  412. * PBC boot lun configuration
  413. */
  414. struct bfi_pbc_blun_s {
  415. wwn_t tgt_pwwn;
  416. struct scsi_lun tgt_lun;
  417. };
  418. /*
  419. * PBC virtual port configuration
  420. */
  421. struct bfi_pbc_vport_s {
  422. wwn_t vp_pwwn;
  423. wwn_t vp_nwwn;
  424. };
  425. /*
  426. * BFI pre-boot configuration information
  427. */
  428. struct bfi_pbc_s {
  429. u8 port_enabled;
  430. u8 boot_enabled;
  431. u8 nbluns;
  432. u8 nvports;
  433. u8 port_speed;
  434. u8 rsvd_a;
  435. u16 hss;
  436. wwn_t pbc_pwwn;
  437. wwn_t pbc_nwwn;
  438. struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
  439. struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
  440. };
  441. /*
  442. *----------------------------------------------------------------------
  443. * MSGQ
  444. *----------------------------------------------------------------------
  445. */
  446. #define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
  447. #define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
  448. #define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
  449. #define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
  450. /* q_depth must be power of 2 */
  451. #define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
  452. enum bfi_msgq_h2i_msgs_e {
  453. BFI_MSGQ_H2I_INIT_REQ = 1,
  454. BFI_MSGQ_H2I_DOORBELL = 2,
  455. BFI_MSGQ_H2I_SHUTDOWN = 3,
  456. };
  457. enum bfi_msgq_i2h_msgs_e {
  458. BFI_MSGQ_I2H_INIT_RSP = 1,
  459. BFI_MSGQ_I2H_DOORBELL = 2,
  460. };
  461. /* Messages(commands/responsed/AENS will have the following header */
  462. struct bfi_msgq_mhdr_s {
  463. u8 msg_class;
  464. u8 msg_id;
  465. u16 msg_token;
  466. u16 num_entries;
  467. u8 enet_id;
  468. u8 rsvd[1];
  469. };
  470. #define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
  471. (_mh).msg_class = (_mc); \
  472. (_mh).msg_id = (_mid); \
  473. (_mh).msg_token = (_tok); \
  474. (_mh).enet_id = (_enet_id); \
  475. } while (0)
  476. /*
  477. * Mailbox for messaging interface
  478. *
  479. */
  480. #define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
  481. #define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
  482. #define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
  483. struct bfi_msgq_s {
  484. union bfi_addr_u addr;
  485. u16 q_depth; /* Total num of entries in the queue */
  486. u8 rsvd[2];
  487. };
  488. /* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
  489. struct bfi_msgq_cfg_req_s {
  490. struct bfi_mhdr_s mh;
  491. struct bfi_msgq_s cmdq;
  492. struct bfi_msgq_s rspq;
  493. };
  494. /* BFI_ENET_MSGQ_CFG_RSP */
  495. struct bfi_msgq_cfg_rsp_s {
  496. struct bfi_mhdr_s mh;
  497. u8 cmd_status;
  498. u8 rsvd[3];
  499. };
  500. /* BFI_MSGQ_H2I_DOORBELL */
  501. struct bfi_msgq_h2i_db_s {
  502. struct bfi_mhdr_s mh;
  503. u16 cmdq_pi;
  504. u16 rspq_ci;
  505. };
  506. /* BFI_MSGQ_I2H_DOORBELL */
  507. struct bfi_msgq_i2h_db_s {
  508. struct bfi_mhdr_s mh;
  509. u16 rspq_pi;
  510. u16 cmdq_ci;
  511. };
  512. #pragma pack()
  513. /* BFI port specific */
  514. #pragma pack(1)
  515. enum bfi_port_h2i {
  516. BFI_PORT_H2I_ENABLE_REQ = (1),
  517. BFI_PORT_H2I_DISABLE_REQ = (2),
  518. BFI_PORT_H2I_GET_STATS_REQ = (3),
  519. BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
  520. };
  521. enum bfi_port_i2h {
  522. BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
  523. BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
  524. BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
  525. BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
  526. };
  527. /*
  528. * Generic REQ type
  529. */
  530. struct bfi_port_generic_req_s {
  531. struct bfi_mhdr_s mh; /* msg header */
  532. u32 msgtag; /* msgtag for reply */
  533. u32 rsvd;
  534. };
  535. /*
  536. * Generic RSP type
  537. */
  538. struct bfi_port_generic_rsp_s {
  539. struct bfi_mhdr_s mh; /* common msg header */
  540. u8 status; /* port enable status */
  541. u8 rsvd[3];
  542. u32 msgtag; /* msgtag for reply */
  543. };
  544. /*
  545. * BFI_PORT_H2I_GET_STATS_REQ
  546. */
  547. struct bfi_port_get_stats_req_s {
  548. struct bfi_mhdr_s mh; /* common msg header */
  549. union bfi_addr_u dma_addr;
  550. };
  551. union bfi_port_h2i_msg_u {
  552. struct bfi_mhdr_s mh;
  553. struct bfi_port_generic_req_s enable_req;
  554. struct bfi_port_generic_req_s disable_req;
  555. struct bfi_port_get_stats_req_s getstats_req;
  556. struct bfi_port_generic_req_s clearstats_req;
  557. };
  558. union bfi_port_i2h_msg_u {
  559. struct bfi_mhdr_s mh;
  560. struct bfi_port_generic_rsp_s enable_rsp;
  561. struct bfi_port_generic_rsp_s disable_rsp;
  562. struct bfi_port_generic_rsp_s getstats_rsp;
  563. struct bfi_port_generic_rsp_s clearstats_rsp;
  564. };
  565. /*
  566. *----------------------------------------------------------------------
  567. * ABLK
  568. *----------------------------------------------------------------------
  569. */
  570. enum bfi_ablk_h2i_msgs_e {
  571. BFI_ABLK_H2I_QUERY = 1,
  572. BFI_ABLK_H2I_ADPT_CONFIG = 2,
  573. BFI_ABLK_H2I_PORT_CONFIG = 3,
  574. BFI_ABLK_H2I_PF_CREATE = 4,
  575. BFI_ABLK_H2I_PF_DELETE = 5,
  576. BFI_ABLK_H2I_PF_UPDATE = 6,
  577. BFI_ABLK_H2I_OPTROM_ENABLE = 7,
  578. BFI_ABLK_H2I_OPTROM_DISABLE = 8,
  579. };
  580. enum bfi_ablk_i2h_msgs_e {
  581. BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
  582. BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
  583. BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
  584. BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
  585. BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
  586. BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
  587. BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
  588. BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
  589. };
  590. /* BFI_ABLK_H2I_QUERY */
  591. struct bfi_ablk_h2i_query_s {
  592. struct bfi_mhdr_s mh;
  593. union bfi_addr_u addr;
  594. };
  595. /* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
  596. struct bfi_ablk_h2i_cfg_req_s {
  597. struct bfi_mhdr_s mh;
  598. u8 mode;
  599. u8 port;
  600. u8 max_pf;
  601. u8 max_vf;
  602. };
  603. /*
  604. * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
  605. */
  606. struct bfi_ablk_h2i_pf_req_s {
  607. struct bfi_mhdr_s mh;
  608. u8 pcifn;
  609. u8 port;
  610. u16 pers;
  611. u16 bw_min; /* percent BW @ max speed */
  612. u16 bw_max; /* percent BW @ max speed */
  613. };
  614. /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
  615. struct bfi_ablk_h2i_optrom_s {
  616. struct bfi_mhdr_s mh;
  617. };
  618. /*
  619. * BFI_ABLK_I2H_QUERY
  620. * BFI_ABLK_I2H_PORT_CONFIG
  621. * BFI_ABLK_I2H_PF_CREATE
  622. * BFI_ABLK_I2H_PF_DELETE
  623. * BFI_ABLK_I2H_PF_UPDATE
  624. * BFI_ABLK_I2H_OPTROM_ENABLE
  625. * BFI_ABLK_I2H_OPTROM_DISABLE
  626. */
  627. struct bfi_ablk_i2h_rsp_s {
  628. struct bfi_mhdr_s mh;
  629. u8 status;
  630. u8 pcifn;
  631. u8 port_mode;
  632. };
  633. /*
  634. * CEE module specific messages
  635. */
  636. /* Mailbox commands from host to firmware */
  637. enum bfi_cee_h2i_msgs_e {
  638. BFI_CEE_H2I_GET_CFG_REQ = 1,
  639. BFI_CEE_H2I_RESET_STATS = 2,
  640. BFI_CEE_H2I_GET_STATS_REQ = 3,
  641. };
  642. enum bfi_cee_i2h_msgs_e {
  643. BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
  644. BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
  645. BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
  646. };
  647. /*
  648. * H2I command structure for resetting the stats
  649. */
  650. struct bfi_cee_reset_stats_s {
  651. struct bfi_mhdr_s mh;
  652. };
  653. /*
  654. * Get configuration command from host
  655. */
  656. struct bfi_cee_get_req_s {
  657. struct bfi_mhdr_s mh;
  658. union bfi_addr_u dma_addr;
  659. };
  660. /*
  661. * Reply message from firmware
  662. */
  663. struct bfi_cee_get_rsp_s {
  664. struct bfi_mhdr_s mh;
  665. u8 cmd_status;
  666. u8 rsvd[3];
  667. };
  668. /*
  669. * Reply message from firmware
  670. */
  671. struct bfi_cee_stats_rsp_s {
  672. struct bfi_mhdr_s mh;
  673. u8 cmd_status;
  674. u8 rsvd[3];
  675. };
  676. /* Mailbox message structures from firmware to host */
  677. union bfi_cee_i2h_msg_u {
  678. struct bfi_mhdr_s mh;
  679. struct bfi_cee_get_rsp_s get_rsp;
  680. struct bfi_cee_stats_rsp_s stats_rsp;
  681. };
  682. /*
  683. * SFP related
  684. */
  685. enum bfi_sfp_h2i_e {
  686. BFI_SFP_H2I_SHOW = 1,
  687. BFI_SFP_H2I_SCN = 2,
  688. };
  689. enum bfi_sfp_i2h_e {
  690. BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
  691. BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
  692. };
  693. /*
  694. * SFP state change notification
  695. */
  696. struct bfi_sfp_scn_s {
  697. struct bfi_mhdr_s mhr; /* host msg header */
  698. u8 event;
  699. u8 sfpid;
  700. u8 pomlvl; /* pom level: normal/warning/alarm */
  701. u8 is_elb; /* e-loopback */
  702. };
  703. /*
  704. * SFP state
  705. */
  706. enum bfa_sfp_stat_e {
  707. BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
  708. BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
  709. BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
  710. BFA_SFP_STATE_VALID = 3, /* SFP is valid */
  711. BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
  712. BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
  713. };
  714. /*
  715. * SFP memory access type
  716. */
  717. enum bfi_sfp_mem_e {
  718. BFI_SFP_MEM_ALL = 0x1, /* access all data field */
  719. BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
  720. };
  721. struct bfi_sfp_req_s {
  722. struct bfi_mhdr_s mh;
  723. u8 memtype;
  724. u8 rsvd[3];
  725. struct bfi_alen_s alen;
  726. };
  727. struct bfi_sfp_rsp_s {
  728. struct bfi_mhdr_s mh;
  729. u8 status;
  730. u8 state;
  731. u8 rsvd[2];
  732. };
  733. /*
  734. * FLASH module specific
  735. */
  736. enum bfi_flash_h2i_msgs {
  737. BFI_FLASH_H2I_QUERY_REQ = 1,
  738. BFI_FLASH_H2I_ERASE_REQ = 2,
  739. BFI_FLASH_H2I_WRITE_REQ = 3,
  740. BFI_FLASH_H2I_READ_REQ = 4,
  741. BFI_FLASH_H2I_BOOT_VER_REQ = 5,
  742. };
  743. enum bfi_flash_i2h_msgs {
  744. BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
  745. BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
  746. BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
  747. BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
  748. BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
  749. BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
  750. };
  751. /*
  752. * Flash query request
  753. */
  754. struct bfi_flash_query_req_s {
  755. struct bfi_mhdr_s mh; /* Common msg header */
  756. struct bfi_alen_s alen;
  757. };
  758. /*
  759. * Flash erase request
  760. */
  761. struct bfi_flash_erase_req_s {
  762. struct bfi_mhdr_s mh; /* Common msg header */
  763. u32 type; /* partition type */
  764. u8 instance; /* partition instance */
  765. u8 rsv[3];
  766. };
  767. /*
  768. * Flash write request
  769. */
  770. struct bfi_flash_write_req_s {
  771. struct bfi_mhdr_s mh; /* Common msg header */
  772. struct bfi_alen_s alen;
  773. u32 type; /* partition type */
  774. u8 instance; /* partition instance */
  775. u8 last;
  776. u8 rsv[2];
  777. u32 offset;
  778. u32 length;
  779. };
  780. /*
  781. * Flash read request
  782. */
  783. struct bfi_flash_read_req_s {
  784. struct bfi_mhdr_s mh; /* Common msg header */
  785. u32 type; /* partition type */
  786. u8 instance; /* partition instance */
  787. u8 rsv[3];
  788. u32 offset;
  789. u32 length;
  790. struct bfi_alen_s alen;
  791. };
  792. /*
  793. * Flash query response
  794. */
  795. struct bfi_flash_query_rsp_s {
  796. struct bfi_mhdr_s mh; /* Common msg header */
  797. u32 status;
  798. };
  799. /*
  800. * Flash read response
  801. */
  802. struct bfi_flash_read_rsp_s {
  803. struct bfi_mhdr_s mh; /* Common msg header */
  804. u32 type; /* partition type */
  805. u8 instance; /* partition instance */
  806. u8 rsv[3];
  807. u32 status;
  808. u32 length;
  809. };
  810. /*
  811. * Flash write response
  812. */
  813. struct bfi_flash_write_rsp_s {
  814. struct bfi_mhdr_s mh; /* Common msg header */
  815. u32 type; /* partition type */
  816. u8 instance; /* partition instance */
  817. u8 rsv[3];
  818. u32 status;
  819. u32 length;
  820. };
  821. /*
  822. * Flash erase response
  823. */
  824. struct bfi_flash_erase_rsp_s {
  825. struct bfi_mhdr_s mh; /* Common msg header */
  826. u32 type; /* partition type */
  827. u8 instance; /* partition instance */
  828. u8 rsv[3];
  829. u32 status;
  830. };
  831. /*
  832. * Flash event notification
  833. */
  834. struct bfi_flash_event_s {
  835. struct bfi_mhdr_s mh; /* Common msg header */
  836. bfa_status_t status;
  837. u32 param;
  838. };
  839. /*
  840. *----------------------------------------------------------------------
  841. * DIAG
  842. *----------------------------------------------------------------------
  843. */
  844. enum bfi_diag_h2i {
  845. BFI_DIAG_H2I_PORTBEACON = 1,
  846. BFI_DIAG_H2I_LOOPBACK = 2,
  847. BFI_DIAG_H2I_FWPING = 3,
  848. BFI_DIAG_H2I_TEMPSENSOR = 4,
  849. BFI_DIAG_H2I_LEDTEST = 5,
  850. BFI_DIAG_H2I_QTEST = 6,
  851. BFI_DIAG_H2I_DPORT = 7,
  852. };
  853. enum bfi_diag_i2h {
  854. BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
  855. BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
  856. BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
  857. BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
  858. BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
  859. BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
  860. BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT),
  861. BFI_DIAG_I2H_DPORT_SCN = BFA_I2HM(8),
  862. };
  863. #define BFI_DIAG_MAX_SGES 2
  864. #define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
  865. #define BFI_BOOT_MEMTEST_RES_ADDR 0x900
  866. #define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
  867. struct bfi_diag_lb_req_s {
  868. struct bfi_mhdr_s mh;
  869. u32 loopcnt;
  870. u32 pattern;
  871. u8 lb_mode; /*!< bfa_port_opmode_t */
  872. u8 speed; /*!< bfa_port_speed_t */
  873. u8 rsvd[2];
  874. };
  875. struct bfi_diag_lb_rsp_s {
  876. struct bfi_mhdr_s mh; /* 4 bytes */
  877. struct bfa_diag_loopback_result_s res; /* 16 bytes */
  878. };
  879. struct bfi_diag_fwping_req_s {
  880. struct bfi_mhdr_s mh; /* 4 bytes */
  881. struct bfi_alen_s alen; /* 12 bytes */
  882. u32 data; /* user input data pattern */
  883. u32 count; /* user input dma count */
  884. u8 qtag; /* track CPE vc */
  885. u8 rsv[3];
  886. };
  887. struct bfi_diag_fwping_rsp_s {
  888. struct bfi_mhdr_s mh; /* 4 bytes */
  889. u32 data; /* user input data pattern */
  890. u8 qtag; /* track CPE vc */
  891. u8 dma_status; /* dma status */
  892. u8 rsv[2];
  893. };
  894. /*
  895. * Temperature Sensor
  896. */
  897. struct bfi_diag_ts_req_s {
  898. struct bfi_mhdr_s mh; /* 4 bytes */
  899. u16 temp; /* 10-bit A/D value */
  900. u16 brd_temp; /* 9-bit board temp */
  901. u8 status;
  902. u8 ts_junc; /* show junction tempsensor */
  903. u8 ts_brd; /* show board tempsensor */
  904. u8 rsv;
  905. };
  906. #define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
  907. struct bfi_diag_ledtest_req_s {
  908. struct bfi_mhdr_s mh; /* 4 bytes */
  909. u8 cmd;
  910. u8 color;
  911. u8 portid;
  912. u8 led; /* bitmap of LEDs to be tested */
  913. u16 freq; /* no. of blinks every 10 secs */
  914. u8 rsv[2];
  915. };
  916. /* notify host led operation is done */
  917. struct bfi_diag_ledtest_rsp_s {
  918. struct bfi_mhdr_s mh; /* 4 bytes */
  919. };
  920. struct bfi_diag_portbeacon_req_s {
  921. struct bfi_mhdr_s mh; /* 4 bytes */
  922. u32 period; /* beaconing period */
  923. u8 beacon; /* 1: beacon on */
  924. u8 rsvd[3];
  925. };
  926. /* notify host the beacon is off */
  927. struct bfi_diag_portbeacon_rsp_s {
  928. struct bfi_mhdr_s mh; /* 4 bytes */
  929. };
  930. struct bfi_diag_qtest_req_s {
  931. struct bfi_mhdr_s mh; /* 4 bytes */
  932. u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
  933. };
  934. #define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
  935. /*
  936. * D-port test
  937. */
  938. enum bfi_dport_req {
  939. BFI_DPORT_DISABLE = 0, /* disable dport request */
  940. BFI_DPORT_ENABLE = 1, /* enable dport request */
  941. BFI_DPORT_START = 2, /* start dport request */
  942. BFI_DPORT_SHOW = 3, /* show dport request */
  943. BFI_DPORT_DYN_DISABLE = 4, /* disable dynamic dport request */
  944. };
  945. enum bfi_dport_scn {
  946. BFI_DPORT_SCN_TESTSTART = 1,
  947. BFI_DPORT_SCN_TESTCOMP = 2,
  948. BFI_DPORT_SCN_SFP_REMOVED = 3,
  949. BFI_DPORT_SCN_DDPORT_ENABLE = 4,
  950. BFI_DPORT_SCN_DDPORT_DISABLE = 5,
  951. BFI_DPORT_SCN_FCPORT_DISABLE = 6,
  952. BFI_DPORT_SCN_SUBTESTSTART = 7,
  953. BFI_DPORT_SCN_TESTSKIP = 8,
  954. BFI_DPORT_SCN_DDPORT_DISABLED = 9,
  955. };
  956. struct bfi_diag_dport_req_s {
  957. struct bfi_mhdr_s mh; /* 4 bytes */
  958. u8 req; /* request 1: enable 0: disable */
  959. u8 rsvd[3];
  960. u32 lpcnt;
  961. u32 payload;
  962. };
  963. struct bfi_diag_dport_rsp_s {
  964. struct bfi_mhdr_s mh; /* header 4 bytes */
  965. bfa_status_t status; /* reply status */
  966. wwn_t pwwn; /* switch port wwn. 8 bytes */
  967. wwn_t nwwn; /* switch node wwn. 8 bytes */
  968. };
  969. struct bfi_diag_dport_scn_teststart_s {
  970. wwn_t pwwn; /* switch port wwn. 8 bytes */
  971. wwn_t nwwn; /* switch node wwn. 8 bytes */
  972. u8 type; /* bfa_diag_dport_test_type_e */
  973. u8 rsvd[3];
  974. u32 numfrm; /* from switch uint in 1M */
  975. };
  976. struct bfi_diag_dport_scn_testcomp_s {
  977. u8 status; /* bfa_diag_dport_test_status_e */
  978. u8 speed; /* bfa_port_speed_t */
  979. u16 numbuffer; /* from switch */
  980. u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */
  981. u32 latency; /* from switch */
  982. u32 distance; /* from swtich unit in meters */
  983. /* Buffers required to saturate the link */
  984. u16 frm_sz; /* from switch for buf_reqd */
  985. u8 rsvd[2];
  986. };
  987. struct bfi_diag_dport_scn_s { /* max size == RDS_RMESZ */
  988. struct bfi_mhdr_s mh; /* header 4 bytes */
  989. u8 state; /* new state */
  990. u8 rsvd[3];
  991. union {
  992. struct bfi_diag_dport_scn_teststart_s teststart;
  993. struct bfi_diag_dport_scn_testcomp_s testcomp;
  994. } info;
  995. };
  996. union bfi_diag_dport_msg_u {
  997. struct bfi_diag_dport_req_s req;
  998. struct bfi_diag_dport_rsp_s rsp;
  999. struct bfi_diag_dport_scn_s scn;
  1000. };
  1001. /*
  1002. * PHY module specific
  1003. */
  1004. enum bfi_phy_h2i_msgs_e {
  1005. BFI_PHY_H2I_QUERY_REQ = 1,
  1006. BFI_PHY_H2I_STATS_REQ = 2,
  1007. BFI_PHY_H2I_WRITE_REQ = 3,
  1008. BFI_PHY_H2I_READ_REQ = 4,
  1009. };
  1010. enum bfi_phy_i2h_msgs_e {
  1011. BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
  1012. BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
  1013. BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
  1014. BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
  1015. };
  1016. /*
  1017. * External PHY query request
  1018. */
  1019. struct bfi_phy_query_req_s {
  1020. struct bfi_mhdr_s mh; /* Common msg header */
  1021. u8 instance;
  1022. u8 rsv[3];
  1023. struct bfi_alen_s alen;
  1024. };
  1025. /*
  1026. * External PHY stats request
  1027. */
  1028. struct bfi_phy_stats_req_s {
  1029. struct bfi_mhdr_s mh; /* Common msg header */
  1030. u8 instance;
  1031. u8 rsv[3];
  1032. struct bfi_alen_s alen;
  1033. };
  1034. /*
  1035. * External PHY write request
  1036. */
  1037. struct bfi_phy_write_req_s {
  1038. struct bfi_mhdr_s mh; /* Common msg header */
  1039. u8 instance;
  1040. u8 last;
  1041. u8 rsv[2];
  1042. u32 offset;
  1043. u32 length;
  1044. struct bfi_alen_s alen;
  1045. };
  1046. /*
  1047. * External PHY read request
  1048. */
  1049. struct bfi_phy_read_req_s {
  1050. struct bfi_mhdr_s mh; /* Common msg header */
  1051. u8 instance;
  1052. u8 rsv[3];
  1053. u32 offset;
  1054. u32 length;
  1055. struct bfi_alen_s alen;
  1056. };
  1057. /*
  1058. * External PHY query response
  1059. */
  1060. struct bfi_phy_query_rsp_s {
  1061. struct bfi_mhdr_s mh; /* Common msg header */
  1062. u32 status;
  1063. };
  1064. /*
  1065. * External PHY stats response
  1066. */
  1067. struct bfi_phy_stats_rsp_s {
  1068. struct bfi_mhdr_s mh; /* Common msg header */
  1069. u32 status;
  1070. };
  1071. /*
  1072. * External PHY read response
  1073. */
  1074. struct bfi_phy_read_rsp_s {
  1075. struct bfi_mhdr_s mh; /* Common msg header */
  1076. u32 status;
  1077. u32 length;
  1078. };
  1079. /*
  1080. * External PHY write response
  1081. */
  1082. struct bfi_phy_write_rsp_s {
  1083. struct bfi_mhdr_s mh; /* Common msg header */
  1084. u32 status;
  1085. u32 length;
  1086. };
  1087. enum bfi_fru_h2i_msgs {
  1088. BFI_FRUVPD_H2I_WRITE_REQ = 1,
  1089. BFI_FRUVPD_H2I_READ_REQ = 2,
  1090. BFI_TFRU_H2I_WRITE_REQ = 3,
  1091. BFI_TFRU_H2I_READ_REQ = 4,
  1092. };
  1093. enum bfi_fru_i2h_msgs {
  1094. BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
  1095. BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
  1096. BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
  1097. BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
  1098. };
  1099. /*
  1100. * FRU write request
  1101. */
  1102. struct bfi_fru_write_req_s {
  1103. struct bfi_mhdr_s mh; /* Common msg header */
  1104. u8 last;
  1105. u8 rsv[3];
  1106. u32 offset;
  1107. u32 length;
  1108. struct bfi_alen_s alen;
  1109. };
  1110. /*
  1111. * FRU read request
  1112. */
  1113. struct bfi_fru_read_req_s {
  1114. struct bfi_mhdr_s mh; /* Common msg header */
  1115. u32 offset;
  1116. u32 length;
  1117. struct bfi_alen_s alen;
  1118. };
  1119. /*
  1120. * FRU response
  1121. */
  1122. struct bfi_fru_rsp_s {
  1123. struct bfi_mhdr_s mh; /* Common msg header */
  1124. u32 status;
  1125. u32 length;
  1126. };
  1127. #pragma pack()
  1128. #endif /* __BFI_H__ */