bfi.h 31 KB

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