bfi.h 30 KB

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