bfi.h 31 KB

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