bfi.h 30 KB

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