bfi.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  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 BFI_IOC_ENDIAN_SIG 0x12345678
  332. enum {
  333. BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
  334. BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
  335. BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
  336. BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
  337. BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
  338. BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
  339. BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
  340. BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
  341. BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
  342. BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
  343. };
  344. #define BFI_ADAPTER_GETP(__prop, __adap_prop) \
  345. (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
  346. BFI_ADAPTER_ ## __prop ## _SH)
  347. #define BFI_ADAPTER_SETP(__prop, __val) \
  348. ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
  349. #define BFI_ADAPTER_IS_PROTO(__adap_type) \
  350. ((__adap_type) & BFI_ADAPTER_PROTO)
  351. #define BFI_ADAPTER_IS_TTV(__adap_type) \
  352. ((__adap_type) & BFI_ADAPTER_TTV)
  353. #define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
  354. ((__adap_type) & BFI_ADAPTER_UNSUPP)
  355. #define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
  356. ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
  357. BFI_ADAPTER_UNSUPP))
  358. /*
  359. * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
  360. */
  361. struct bfi_ioc_ctrl_req_s {
  362. struct bfi_mhdr_s mh;
  363. u16 clscode;
  364. u16 rsvd;
  365. u32 tv_sec;
  366. };
  367. #define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
  368. #define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
  369. /*
  370. * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
  371. */
  372. struct bfi_ioc_ctrl_reply_s {
  373. struct bfi_mhdr_s mh; /* Common msg header */
  374. u8 status; /* enable/disable status */
  375. u8 port_mode; /* bfa_mode_s */
  376. u8 cap_bm; /* capability bit mask */
  377. u8 rsvd;
  378. };
  379. #define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s;
  380. #define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s;
  381. #define BFI_IOC_MSGSZ 8
  382. /*
  383. * H2I Messages
  384. */
  385. union bfi_ioc_h2i_msg_u {
  386. struct bfi_mhdr_s mh;
  387. struct bfi_ioc_ctrl_req_s enable_req;
  388. struct bfi_ioc_ctrl_req_s disable_req;
  389. struct bfi_ioc_getattr_req_s getattr_req;
  390. u32 mboxmsg[BFI_IOC_MSGSZ];
  391. };
  392. /*
  393. * I2H Messages
  394. */
  395. union bfi_ioc_i2h_msg_u {
  396. struct bfi_mhdr_s mh;
  397. struct bfi_ioc_ctrl_reply_s fw_event;
  398. u32 mboxmsg[BFI_IOC_MSGSZ];
  399. };
  400. /*
  401. *----------------------------------------------------------------------
  402. * PBC
  403. *----------------------------------------------------------------------
  404. */
  405. #define BFI_PBC_MAX_BLUNS 8
  406. #define BFI_PBC_MAX_VPORTS 16
  407. #define BFI_PBC_PORT_DISABLED 2
  408. /*
  409. * PBC boot lun configuration
  410. */
  411. struct bfi_pbc_blun_s {
  412. wwn_t tgt_pwwn;
  413. struct scsi_lun tgt_lun;
  414. };
  415. /*
  416. * PBC virtual port configuration
  417. */
  418. struct bfi_pbc_vport_s {
  419. wwn_t vp_pwwn;
  420. wwn_t vp_nwwn;
  421. };
  422. /*
  423. * BFI pre-boot configuration information
  424. */
  425. struct bfi_pbc_s {
  426. u8 port_enabled;
  427. u8 boot_enabled;
  428. u8 nbluns;
  429. u8 nvports;
  430. u8 port_speed;
  431. u8 rsvd_a;
  432. u16 hss;
  433. wwn_t pbc_pwwn;
  434. wwn_t pbc_nwwn;
  435. struct bfi_pbc_blun_s blun[BFI_PBC_MAX_BLUNS];
  436. struct bfi_pbc_vport_s vport[BFI_PBC_MAX_VPORTS];
  437. };
  438. /*
  439. *----------------------------------------------------------------------
  440. * MSGQ
  441. *----------------------------------------------------------------------
  442. */
  443. #define BFI_MSGQ_FULL(_q) (((_q->pi + 1) % _q->q_depth) == _q->ci)
  444. #define BFI_MSGQ_EMPTY(_q) (_q->pi == _q->ci)
  445. #define BFI_MSGQ_UPDATE_CI(_q) (_q->ci = (_q->ci + 1) % _q->q_depth)
  446. #define BFI_MSGQ_UPDATE_PI(_q) (_q->pi = (_q->pi + 1) % _q->q_depth)
  447. /* q_depth must be power of 2 */
  448. #define BFI_MSGQ_FREE_CNT(_q) ((_q->ci - _q->pi - 1) & (_q->q_depth - 1))
  449. enum bfi_msgq_h2i_msgs_e {
  450. BFI_MSGQ_H2I_INIT_REQ = 1,
  451. BFI_MSGQ_H2I_DOORBELL = 2,
  452. BFI_MSGQ_H2I_SHUTDOWN = 3,
  453. };
  454. enum bfi_msgq_i2h_msgs_e {
  455. BFI_MSGQ_I2H_INIT_RSP = 1,
  456. BFI_MSGQ_I2H_DOORBELL = 2,
  457. };
  458. /* Messages(commands/responsed/AENS will have the following header */
  459. struct bfi_msgq_mhdr_s {
  460. u8 msg_class;
  461. u8 msg_id;
  462. u16 msg_token;
  463. u16 num_entries;
  464. u8 enet_id;
  465. u8 rsvd[1];
  466. };
  467. #define bfi_msgq_mhdr_set(_mh, _mc, _mid, _tok, _enet_id) do { \
  468. (_mh).msg_class = (_mc); \
  469. (_mh).msg_id = (_mid); \
  470. (_mh).msg_token = (_tok); \
  471. (_mh).enet_id = (_enet_id); \
  472. } while (0)
  473. /*
  474. * Mailbox for messaging interface
  475. *
  476. */
  477. #define BFI_MSGQ_CMD_ENTRY_SIZE (64) /* TBD */
  478. #define BFI_MSGQ_RSP_ENTRY_SIZE (64) /* TBD */
  479. #define BFI_MSGQ_MSG_SIZE_MAX (2048) /* TBD */
  480. struct bfi_msgq_s {
  481. union bfi_addr_u addr;
  482. u16 q_depth; /* Total num of entries in the queue */
  483. u8 rsvd[2];
  484. };
  485. /* BFI_ENET_MSGQ_CFG_REQ TBD init or cfg? */
  486. struct bfi_msgq_cfg_req_s {
  487. struct bfi_mhdr_s mh;
  488. struct bfi_msgq_s cmdq;
  489. struct bfi_msgq_s rspq;
  490. };
  491. /* BFI_ENET_MSGQ_CFG_RSP */
  492. struct bfi_msgq_cfg_rsp_s {
  493. struct bfi_mhdr_s mh;
  494. u8 cmd_status;
  495. u8 rsvd[3];
  496. };
  497. /* BFI_MSGQ_H2I_DOORBELL */
  498. struct bfi_msgq_h2i_db_s {
  499. struct bfi_mhdr_s mh;
  500. u16 cmdq_pi;
  501. u16 rspq_ci;
  502. };
  503. /* BFI_MSGQ_I2H_DOORBELL */
  504. struct bfi_msgq_i2h_db_s {
  505. struct bfi_mhdr_s mh;
  506. u16 rspq_pi;
  507. u16 cmdq_ci;
  508. };
  509. #pragma pack()
  510. /* BFI port specific */
  511. #pragma pack(1)
  512. enum bfi_port_h2i {
  513. BFI_PORT_H2I_ENABLE_REQ = (1),
  514. BFI_PORT_H2I_DISABLE_REQ = (2),
  515. BFI_PORT_H2I_GET_STATS_REQ = (3),
  516. BFI_PORT_H2I_CLEAR_STATS_REQ = (4),
  517. };
  518. enum bfi_port_i2h {
  519. BFI_PORT_I2H_ENABLE_RSP = BFA_I2HM(1),
  520. BFI_PORT_I2H_DISABLE_RSP = BFA_I2HM(2),
  521. BFI_PORT_I2H_GET_STATS_RSP = BFA_I2HM(3),
  522. BFI_PORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4),
  523. };
  524. /*
  525. * Generic REQ type
  526. */
  527. struct bfi_port_generic_req_s {
  528. struct bfi_mhdr_s mh; /* msg header */
  529. u32 msgtag; /* msgtag for reply */
  530. u32 rsvd;
  531. };
  532. /*
  533. * Generic RSP type
  534. */
  535. struct bfi_port_generic_rsp_s {
  536. struct bfi_mhdr_s mh; /* common msg header */
  537. u8 status; /* port enable status */
  538. u8 rsvd[3];
  539. u32 msgtag; /* msgtag for reply */
  540. };
  541. /*
  542. * BFI_PORT_H2I_GET_STATS_REQ
  543. */
  544. struct bfi_port_get_stats_req_s {
  545. struct bfi_mhdr_s mh; /* common msg header */
  546. union bfi_addr_u dma_addr;
  547. };
  548. union bfi_port_h2i_msg_u {
  549. struct bfi_mhdr_s mh;
  550. struct bfi_port_generic_req_s enable_req;
  551. struct bfi_port_generic_req_s disable_req;
  552. struct bfi_port_get_stats_req_s getstats_req;
  553. struct bfi_port_generic_req_s clearstats_req;
  554. };
  555. union bfi_port_i2h_msg_u {
  556. struct bfi_mhdr_s mh;
  557. struct bfi_port_generic_rsp_s enable_rsp;
  558. struct bfi_port_generic_rsp_s disable_rsp;
  559. struct bfi_port_generic_rsp_s getstats_rsp;
  560. struct bfi_port_generic_rsp_s clearstats_rsp;
  561. };
  562. /*
  563. *----------------------------------------------------------------------
  564. * ABLK
  565. *----------------------------------------------------------------------
  566. */
  567. enum bfi_ablk_h2i_msgs_e {
  568. BFI_ABLK_H2I_QUERY = 1,
  569. BFI_ABLK_H2I_ADPT_CONFIG = 2,
  570. BFI_ABLK_H2I_PORT_CONFIG = 3,
  571. BFI_ABLK_H2I_PF_CREATE = 4,
  572. BFI_ABLK_H2I_PF_DELETE = 5,
  573. BFI_ABLK_H2I_PF_UPDATE = 6,
  574. BFI_ABLK_H2I_OPTROM_ENABLE = 7,
  575. BFI_ABLK_H2I_OPTROM_DISABLE = 8,
  576. };
  577. enum bfi_ablk_i2h_msgs_e {
  578. BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY),
  579. BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG),
  580. BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG),
  581. BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE),
  582. BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE),
  583. BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE),
  584. BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE),
  585. BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE),
  586. };
  587. /* BFI_ABLK_H2I_QUERY */
  588. struct bfi_ablk_h2i_query_s {
  589. struct bfi_mhdr_s mh;
  590. union bfi_addr_u addr;
  591. };
  592. /* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */
  593. struct bfi_ablk_h2i_cfg_req_s {
  594. struct bfi_mhdr_s mh;
  595. u8 mode;
  596. u8 port;
  597. u8 max_pf;
  598. u8 max_vf;
  599. };
  600. /*
  601. * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE,
  602. */
  603. struct bfi_ablk_h2i_pf_req_s {
  604. struct bfi_mhdr_s mh;
  605. u8 pcifn;
  606. u8 port;
  607. u16 pers;
  608. u16 bw_min; /* percent BW @ max speed */
  609. u16 bw_max; /* percent BW @ max speed */
  610. };
  611. /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */
  612. struct bfi_ablk_h2i_optrom_s {
  613. struct bfi_mhdr_s mh;
  614. };
  615. /*
  616. * BFI_ABLK_I2H_QUERY
  617. * BFI_ABLK_I2H_PORT_CONFIG
  618. * BFI_ABLK_I2H_PF_CREATE
  619. * BFI_ABLK_I2H_PF_DELETE
  620. * BFI_ABLK_I2H_PF_UPDATE
  621. * BFI_ABLK_I2H_OPTROM_ENABLE
  622. * BFI_ABLK_I2H_OPTROM_DISABLE
  623. */
  624. struct bfi_ablk_i2h_rsp_s {
  625. struct bfi_mhdr_s mh;
  626. u8 status;
  627. u8 pcifn;
  628. u8 port_mode;
  629. };
  630. /*
  631. * CEE module specific messages
  632. */
  633. /* Mailbox commands from host to firmware */
  634. enum bfi_cee_h2i_msgs_e {
  635. BFI_CEE_H2I_GET_CFG_REQ = 1,
  636. BFI_CEE_H2I_RESET_STATS = 2,
  637. BFI_CEE_H2I_GET_STATS_REQ = 3,
  638. };
  639. enum bfi_cee_i2h_msgs_e {
  640. BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
  641. BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
  642. BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
  643. };
  644. /*
  645. * H2I command structure for resetting the stats
  646. */
  647. struct bfi_cee_reset_stats_s {
  648. struct bfi_mhdr_s mh;
  649. };
  650. /*
  651. * Get configuration command from host
  652. */
  653. struct bfi_cee_get_req_s {
  654. struct bfi_mhdr_s mh;
  655. union bfi_addr_u dma_addr;
  656. };
  657. /*
  658. * Reply message from firmware
  659. */
  660. struct bfi_cee_get_rsp_s {
  661. struct bfi_mhdr_s mh;
  662. u8 cmd_status;
  663. u8 rsvd[3];
  664. };
  665. /*
  666. * Reply message from firmware
  667. */
  668. struct bfi_cee_stats_rsp_s {
  669. struct bfi_mhdr_s mh;
  670. u8 cmd_status;
  671. u8 rsvd[3];
  672. };
  673. /* Mailbox message structures from firmware to host */
  674. union bfi_cee_i2h_msg_u {
  675. struct bfi_mhdr_s mh;
  676. struct bfi_cee_get_rsp_s get_rsp;
  677. struct bfi_cee_stats_rsp_s stats_rsp;
  678. };
  679. /*
  680. * SFP related
  681. */
  682. enum bfi_sfp_h2i_e {
  683. BFI_SFP_H2I_SHOW = 1,
  684. BFI_SFP_H2I_SCN = 2,
  685. };
  686. enum bfi_sfp_i2h_e {
  687. BFI_SFP_I2H_SHOW = BFA_I2HM(BFI_SFP_H2I_SHOW),
  688. BFI_SFP_I2H_SCN = BFA_I2HM(BFI_SFP_H2I_SCN),
  689. };
  690. /*
  691. * SFP state change notification
  692. */
  693. struct bfi_sfp_scn_s {
  694. struct bfi_mhdr_s mhr; /* host msg header */
  695. u8 event;
  696. u8 sfpid;
  697. u8 pomlvl; /* pom level: normal/warning/alarm */
  698. u8 is_elb; /* e-loopback */
  699. };
  700. /*
  701. * SFP state
  702. */
  703. enum bfa_sfp_stat_e {
  704. BFA_SFP_STATE_INIT = 0, /* SFP state is uninit */
  705. BFA_SFP_STATE_REMOVED = 1, /* SFP is removed */
  706. BFA_SFP_STATE_INSERTED = 2, /* SFP is inserted */
  707. BFA_SFP_STATE_VALID = 3, /* SFP is valid */
  708. BFA_SFP_STATE_UNSUPPORT = 4, /* SFP is unsupport */
  709. BFA_SFP_STATE_FAILED = 5, /* SFP i2c read fail */
  710. };
  711. /*
  712. * SFP memory access type
  713. */
  714. enum bfi_sfp_mem_e {
  715. BFI_SFP_MEM_ALL = 0x1, /* access all data field */
  716. BFI_SFP_MEM_DIAGEXT = 0x2, /* access diag ext data field only */
  717. };
  718. struct bfi_sfp_req_s {
  719. struct bfi_mhdr_s mh;
  720. u8 memtype;
  721. u8 rsvd[3];
  722. struct bfi_alen_s alen;
  723. };
  724. struct bfi_sfp_rsp_s {
  725. struct bfi_mhdr_s mh;
  726. u8 status;
  727. u8 state;
  728. u8 rsvd[2];
  729. };
  730. /*
  731. * FLASH module specific
  732. */
  733. enum bfi_flash_h2i_msgs {
  734. BFI_FLASH_H2I_QUERY_REQ = 1,
  735. BFI_FLASH_H2I_ERASE_REQ = 2,
  736. BFI_FLASH_H2I_WRITE_REQ = 3,
  737. BFI_FLASH_H2I_READ_REQ = 4,
  738. BFI_FLASH_H2I_BOOT_VER_REQ = 5,
  739. };
  740. enum bfi_flash_i2h_msgs {
  741. BFI_FLASH_I2H_QUERY_RSP = BFA_I2HM(1),
  742. BFI_FLASH_I2H_ERASE_RSP = BFA_I2HM(2),
  743. BFI_FLASH_I2H_WRITE_RSP = BFA_I2HM(3),
  744. BFI_FLASH_I2H_READ_RSP = BFA_I2HM(4),
  745. BFI_FLASH_I2H_BOOT_VER_RSP = BFA_I2HM(5),
  746. BFI_FLASH_I2H_EVENT = BFA_I2HM(127),
  747. };
  748. /*
  749. * Flash query request
  750. */
  751. struct bfi_flash_query_req_s {
  752. struct bfi_mhdr_s mh; /* Common msg header */
  753. struct bfi_alen_s alen;
  754. };
  755. /*
  756. * Flash erase request
  757. */
  758. struct bfi_flash_erase_req_s {
  759. struct bfi_mhdr_s mh; /* Common msg header */
  760. u32 type; /* partition type */
  761. u8 instance; /* partition instance */
  762. u8 rsv[3];
  763. };
  764. /*
  765. * Flash write request
  766. */
  767. struct bfi_flash_write_req_s {
  768. struct bfi_mhdr_s mh; /* Common msg header */
  769. struct bfi_alen_s alen;
  770. u32 type; /* partition type */
  771. u8 instance; /* partition instance */
  772. u8 last;
  773. u8 rsv[2];
  774. u32 offset;
  775. u32 length;
  776. };
  777. /*
  778. * Flash read request
  779. */
  780. struct bfi_flash_read_req_s {
  781. struct bfi_mhdr_s mh; /* Common msg header */
  782. u32 type; /* partition type */
  783. u8 instance; /* partition instance */
  784. u8 rsv[3];
  785. u32 offset;
  786. u32 length;
  787. struct bfi_alen_s alen;
  788. };
  789. /*
  790. * Flash query response
  791. */
  792. struct bfi_flash_query_rsp_s {
  793. struct bfi_mhdr_s mh; /* Common msg header */
  794. u32 status;
  795. };
  796. /*
  797. * Flash read response
  798. */
  799. struct bfi_flash_read_rsp_s {
  800. struct bfi_mhdr_s mh; /* Common msg header */
  801. u32 type; /* partition type */
  802. u8 instance; /* partition instance */
  803. u8 rsv[3];
  804. u32 status;
  805. u32 length;
  806. };
  807. /*
  808. * Flash write response
  809. */
  810. struct bfi_flash_write_rsp_s {
  811. struct bfi_mhdr_s mh; /* Common msg header */
  812. u32 type; /* partition type */
  813. u8 instance; /* partition instance */
  814. u8 rsv[3];
  815. u32 status;
  816. u32 length;
  817. };
  818. /*
  819. * Flash erase response
  820. */
  821. struct bfi_flash_erase_rsp_s {
  822. struct bfi_mhdr_s mh; /* Common msg header */
  823. u32 type; /* partition type */
  824. u8 instance; /* partition instance */
  825. u8 rsv[3];
  826. u32 status;
  827. };
  828. /*
  829. * Flash event notification
  830. */
  831. struct bfi_flash_event_s {
  832. struct bfi_mhdr_s mh; /* Common msg header */
  833. bfa_status_t status;
  834. u32 param;
  835. };
  836. /*
  837. *----------------------------------------------------------------------
  838. * DIAG
  839. *----------------------------------------------------------------------
  840. */
  841. enum bfi_diag_h2i {
  842. BFI_DIAG_H2I_PORTBEACON = 1,
  843. BFI_DIAG_H2I_LOOPBACK = 2,
  844. BFI_DIAG_H2I_FWPING = 3,
  845. BFI_DIAG_H2I_TEMPSENSOR = 4,
  846. BFI_DIAG_H2I_LEDTEST = 5,
  847. BFI_DIAG_H2I_QTEST = 6,
  848. BFI_DIAG_H2I_DPORT = 7,
  849. };
  850. enum bfi_diag_i2h {
  851. BFI_DIAG_I2H_PORTBEACON = BFA_I2HM(BFI_DIAG_H2I_PORTBEACON),
  852. BFI_DIAG_I2H_LOOPBACK = BFA_I2HM(BFI_DIAG_H2I_LOOPBACK),
  853. BFI_DIAG_I2H_FWPING = BFA_I2HM(BFI_DIAG_H2I_FWPING),
  854. BFI_DIAG_I2H_TEMPSENSOR = BFA_I2HM(BFI_DIAG_H2I_TEMPSENSOR),
  855. BFI_DIAG_I2H_LEDTEST = BFA_I2HM(BFI_DIAG_H2I_LEDTEST),
  856. BFI_DIAG_I2H_QTEST = BFA_I2HM(BFI_DIAG_H2I_QTEST),
  857. BFI_DIAG_I2H_DPORT = BFA_I2HM(BFI_DIAG_H2I_DPORT),
  858. BFI_DIAG_I2H_DPORT_SCN = BFA_I2HM(8),
  859. };
  860. #define BFI_DIAG_MAX_SGES 2
  861. #define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
  862. #define BFI_BOOT_MEMTEST_RES_ADDR 0x900
  863. #define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
  864. struct bfi_diag_lb_req_s {
  865. struct bfi_mhdr_s mh;
  866. u32 loopcnt;
  867. u32 pattern;
  868. u8 lb_mode; /*!< bfa_port_opmode_t */
  869. u8 speed; /*!< bfa_port_speed_t */
  870. u8 rsvd[2];
  871. };
  872. struct bfi_diag_lb_rsp_s {
  873. struct bfi_mhdr_s mh; /* 4 bytes */
  874. struct bfa_diag_loopback_result_s res; /* 16 bytes */
  875. };
  876. struct bfi_diag_fwping_req_s {
  877. struct bfi_mhdr_s mh; /* 4 bytes */
  878. struct bfi_alen_s alen; /* 12 bytes */
  879. u32 data; /* user input data pattern */
  880. u32 count; /* user input dma count */
  881. u8 qtag; /* track CPE vc */
  882. u8 rsv[3];
  883. };
  884. struct bfi_diag_fwping_rsp_s {
  885. struct bfi_mhdr_s mh; /* 4 bytes */
  886. u32 data; /* user input data pattern */
  887. u8 qtag; /* track CPE vc */
  888. u8 dma_status; /* dma status */
  889. u8 rsv[2];
  890. };
  891. /*
  892. * Temperature Sensor
  893. */
  894. struct bfi_diag_ts_req_s {
  895. struct bfi_mhdr_s mh; /* 4 bytes */
  896. u16 temp; /* 10-bit A/D value */
  897. u16 brd_temp; /* 9-bit board temp */
  898. u8 status;
  899. u8 ts_junc; /* show junction tempsensor */
  900. u8 ts_brd; /* show board tempsensor */
  901. u8 rsv;
  902. };
  903. #define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
  904. struct bfi_diag_ledtest_req_s {
  905. struct bfi_mhdr_s mh; /* 4 bytes */
  906. u8 cmd;
  907. u8 color;
  908. u8 portid;
  909. u8 led; /* bitmap of LEDs to be tested */
  910. u16 freq; /* no. of blinks every 10 secs */
  911. u8 rsv[2];
  912. };
  913. /* notify host led operation is done */
  914. struct bfi_diag_ledtest_rsp_s {
  915. struct bfi_mhdr_s mh; /* 4 bytes */
  916. };
  917. struct bfi_diag_portbeacon_req_s {
  918. struct bfi_mhdr_s mh; /* 4 bytes */
  919. u32 period; /* beaconing period */
  920. u8 beacon; /* 1: beacon on */
  921. u8 rsvd[3];
  922. };
  923. /* notify host the beacon is off */
  924. struct bfi_diag_portbeacon_rsp_s {
  925. struct bfi_mhdr_s mh; /* 4 bytes */
  926. };
  927. struct bfi_diag_qtest_req_s {
  928. struct bfi_mhdr_s mh; /* 4 bytes */
  929. u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
  930. };
  931. #define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
  932. /*
  933. * D-port test
  934. */
  935. enum bfi_dport_req {
  936. BFI_DPORT_DISABLE = 0, /* disable dport request */
  937. BFI_DPORT_ENABLE = 1, /* enable dport request */
  938. BFI_DPORT_START = 2, /* start dport request */
  939. BFI_DPORT_SHOW = 3, /* show dport request */
  940. BFI_DPORT_DYN_DISABLE = 4, /* disable dynamic dport request */
  941. };
  942. enum bfi_dport_scn {
  943. BFI_DPORT_SCN_TESTSTART = 1,
  944. BFI_DPORT_SCN_TESTCOMP = 2,
  945. BFI_DPORT_SCN_SFP_REMOVED = 3,
  946. BFI_DPORT_SCN_DDPORT_ENABLE = 4,
  947. BFI_DPORT_SCN_DDPORT_DISABLE = 5,
  948. BFI_DPORT_SCN_FCPORT_DISABLE = 6,
  949. BFI_DPORT_SCN_SUBTESTSTART = 7,
  950. BFI_DPORT_SCN_TESTSKIP = 8,
  951. BFI_DPORT_SCN_DDPORT_DISABLED = 9,
  952. };
  953. struct bfi_diag_dport_req_s {
  954. struct bfi_mhdr_s mh; /* 4 bytes */
  955. u8 req; /* request 1: enable 0: disable */
  956. u8 rsvd[3];
  957. u32 lpcnt;
  958. u32 payload;
  959. };
  960. struct bfi_diag_dport_rsp_s {
  961. struct bfi_mhdr_s mh; /* header 4 bytes */
  962. bfa_status_t status; /* reply status */
  963. wwn_t pwwn; /* switch port wwn. 8 bytes */
  964. wwn_t nwwn; /* switch node wwn. 8 bytes */
  965. };
  966. struct bfi_diag_dport_scn_teststart_s {
  967. wwn_t pwwn; /* switch port wwn. 8 bytes */
  968. wwn_t nwwn; /* switch node wwn. 8 bytes */
  969. u8 type; /* bfa_diag_dport_test_type_e */
  970. u8 rsvd[3];
  971. u32 numfrm; /* from switch uint in 1M */
  972. };
  973. struct bfi_diag_dport_scn_testcomp_s {
  974. u8 status; /* bfa_diag_dport_test_status_e */
  975. u8 speed; /* bfa_port_speed_t */
  976. u16 numbuffer; /* from switch */
  977. u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */
  978. u32 latency; /* from switch */
  979. u32 distance; /* from swtich unit in meters */
  980. /* Buffers required to saturate the link */
  981. u16 frm_sz; /* from switch for buf_reqd */
  982. u8 rsvd[2];
  983. };
  984. struct bfi_diag_dport_scn_s { /* max size == RDS_RMESZ */
  985. struct bfi_mhdr_s mh; /* header 4 bytes */
  986. u8 state; /* new state */
  987. u8 rsvd[3];
  988. union {
  989. struct bfi_diag_dport_scn_teststart_s teststart;
  990. struct bfi_diag_dport_scn_testcomp_s testcomp;
  991. } info;
  992. };
  993. union bfi_diag_dport_msg_u {
  994. struct bfi_diag_dport_req_s req;
  995. struct bfi_diag_dport_rsp_s rsp;
  996. struct bfi_diag_dport_scn_s scn;
  997. };
  998. /*
  999. * PHY module specific
  1000. */
  1001. enum bfi_phy_h2i_msgs_e {
  1002. BFI_PHY_H2I_QUERY_REQ = 1,
  1003. BFI_PHY_H2I_STATS_REQ = 2,
  1004. BFI_PHY_H2I_WRITE_REQ = 3,
  1005. BFI_PHY_H2I_READ_REQ = 4,
  1006. };
  1007. enum bfi_phy_i2h_msgs_e {
  1008. BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
  1009. BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
  1010. BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
  1011. BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
  1012. };
  1013. /*
  1014. * External PHY query request
  1015. */
  1016. struct bfi_phy_query_req_s {
  1017. struct bfi_mhdr_s mh; /* Common msg header */
  1018. u8 instance;
  1019. u8 rsv[3];
  1020. struct bfi_alen_s alen;
  1021. };
  1022. /*
  1023. * External PHY stats request
  1024. */
  1025. struct bfi_phy_stats_req_s {
  1026. struct bfi_mhdr_s mh; /* Common msg header */
  1027. u8 instance;
  1028. u8 rsv[3];
  1029. struct bfi_alen_s alen;
  1030. };
  1031. /*
  1032. * External PHY write request
  1033. */
  1034. struct bfi_phy_write_req_s {
  1035. struct bfi_mhdr_s mh; /* Common msg header */
  1036. u8 instance;
  1037. u8 last;
  1038. u8 rsv[2];
  1039. u32 offset;
  1040. u32 length;
  1041. struct bfi_alen_s alen;
  1042. };
  1043. /*
  1044. * External PHY read request
  1045. */
  1046. struct bfi_phy_read_req_s {
  1047. struct bfi_mhdr_s mh; /* Common msg header */
  1048. u8 instance;
  1049. u8 rsv[3];
  1050. u32 offset;
  1051. u32 length;
  1052. struct bfi_alen_s alen;
  1053. };
  1054. /*
  1055. * External PHY query response
  1056. */
  1057. struct bfi_phy_query_rsp_s {
  1058. struct bfi_mhdr_s mh; /* Common msg header */
  1059. u32 status;
  1060. };
  1061. /*
  1062. * External PHY stats response
  1063. */
  1064. struct bfi_phy_stats_rsp_s {
  1065. struct bfi_mhdr_s mh; /* Common msg header */
  1066. u32 status;
  1067. };
  1068. /*
  1069. * External PHY read response
  1070. */
  1071. struct bfi_phy_read_rsp_s {
  1072. struct bfi_mhdr_s mh; /* Common msg header */
  1073. u32 status;
  1074. u32 length;
  1075. };
  1076. /*
  1077. * External PHY write response
  1078. */
  1079. struct bfi_phy_write_rsp_s {
  1080. struct bfi_mhdr_s mh; /* Common msg header */
  1081. u32 status;
  1082. u32 length;
  1083. };
  1084. enum bfi_fru_h2i_msgs {
  1085. BFI_FRUVPD_H2I_WRITE_REQ = 1,
  1086. BFI_FRUVPD_H2I_READ_REQ = 2,
  1087. BFI_TFRU_H2I_WRITE_REQ = 3,
  1088. BFI_TFRU_H2I_READ_REQ = 4,
  1089. };
  1090. enum bfi_fru_i2h_msgs {
  1091. BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
  1092. BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
  1093. BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
  1094. BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
  1095. };
  1096. /*
  1097. * FRU write request
  1098. */
  1099. struct bfi_fru_write_req_s {
  1100. struct bfi_mhdr_s mh; /* Common msg header */
  1101. u8 last;
  1102. u8 rsv[3];
  1103. u32 offset;
  1104. u32 length;
  1105. struct bfi_alen_s alen;
  1106. };
  1107. /*
  1108. * FRU read request
  1109. */
  1110. struct bfi_fru_read_req_s {
  1111. struct bfi_mhdr_s mh; /* Common msg header */
  1112. u32 offset;
  1113. u32 length;
  1114. struct bfi_alen_s alen;
  1115. };
  1116. /*
  1117. * FRU response
  1118. */
  1119. struct bfi_fru_rsp_s {
  1120. struct bfi_mhdr_s mh; /* Common msg header */
  1121. u32 status;
  1122. u32 length;
  1123. };
  1124. #pragma pack()
  1125. #endif /* __BFI_H__ */