bfi.h 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  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. };
  859. #define BFI_DIAG_MAX_SGES 2
  860. #define BFI_DIAG_DMA_BUF_SZ (2 * 1024)
  861. #define BFI_BOOT_MEMTEST_RES_ADDR 0x900
  862. #define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
  863. struct bfi_diag_lb_req_s {
  864. struct bfi_mhdr_s mh;
  865. u32 loopcnt;
  866. u32 pattern;
  867. u8 lb_mode; /*!< bfa_port_opmode_t */
  868. u8 speed; /*!< bfa_port_speed_t */
  869. u8 rsvd[2];
  870. };
  871. struct bfi_diag_lb_rsp_s {
  872. struct bfi_mhdr_s mh; /* 4 bytes */
  873. struct bfa_diag_loopback_result_s res; /* 16 bytes */
  874. };
  875. struct bfi_diag_fwping_req_s {
  876. struct bfi_mhdr_s mh; /* 4 bytes */
  877. struct bfi_alen_s alen; /* 12 bytes */
  878. u32 data; /* user input data pattern */
  879. u32 count; /* user input dma count */
  880. u8 qtag; /* track CPE vc */
  881. u8 rsv[3];
  882. };
  883. struct bfi_diag_fwping_rsp_s {
  884. struct bfi_mhdr_s mh; /* 4 bytes */
  885. u32 data; /* user input data pattern */
  886. u8 qtag; /* track CPE vc */
  887. u8 dma_status; /* dma status */
  888. u8 rsv[2];
  889. };
  890. /*
  891. * Temperature Sensor
  892. */
  893. struct bfi_diag_ts_req_s {
  894. struct bfi_mhdr_s mh; /* 4 bytes */
  895. u16 temp; /* 10-bit A/D value */
  896. u16 brd_temp; /* 9-bit board temp */
  897. u8 status;
  898. u8 ts_junc; /* show junction tempsensor */
  899. u8 ts_brd; /* show board tempsensor */
  900. u8 rsv;
  901. };
  902. #define bfi_diag_ts_rsp_t struct bfi_diag_ts_req_s
  903. struct bfi_diag_ledtest_req_s {
  904. struct bfi_mhdr_s mh; /* 4 bytes */
  905. u8 cmd;
  906. u8 color;
  907. u8 portid;
  908. u8 led; /* bitmap of LEDs to be tested */
  909. u16 freq; /* no. of blinks every 10 secs */
  910. u8 rsv[2];
  911. };
  912. /* notify host led operation is done */
  913. struct bfi_diag_ledtest_rsp_s {
  914. struct bfi_mhdr_s mh; /* 4 bytes */
  915. };
  916. struct bfi_diag_portbeacon_req_s {
  917. struct bfi_mhdr_s mh; /* 4 bytes */
  918. u32 period; /* beaconing period */
  919. u8 beacon; /* 1: beacon on */
  920. u8 rsvd[3];
  921. };
  922. /* notify host the beacon is off */
  923. struct bfi_diag_portbeacon_rsp_s {
  924. struct bfi_mhdr_s mh; /* 4 bytes */
  925. };
  926. struct bfi_diag_qtest_req_s {
  927. struct bfi_mhdr_s mh; /* 4 bytes */
  928. u32 data[BFI_LMSG_PL_WSZ]; /* fill up tcm prefetch area */
  929. };
  930. #define bfi_diag_qtest_rsp_t struct bfi_diag_qtest_req_s
  931. /*
  932. * D-port test
  933. */
  934. enum bfi_dport_req {
  935. BFI_DPORT_DISABLE = 0, /* disable dport request */
  936. BFI_DPORT_ENABLE = 1, /* enable dport request */
  937. };
  938. struct bfi_diag_dport_req_s {
  939. struct bfi_mhdr_s mh; /* 4 bytes */
  940. u8 req; /* request 1: enable 0: disable */
  941. u8 status; /* reply status */
  942. u8 rsvd[2];
  943. u32 msgtag; /* msgtag for reply */
  944. };
  945. #define bfi_diag_dport_rsp_t struct bfi_diag_dport_req_s
  946. /*
  947. * PHY module specific
  948. */
  949. enum bfi_phy_h2i_msgs_e {
  950. BFI_PHY_H2I_QUERY_REQ = 1,
  951. BFI_PHY_H2I_STATS_REQ = 2,
  952. BFI_PHY_H2I_WRITE_REQ = 3,
  953. BFI_PHY_H2I_READ_REQ = 4,
  954. };
  955. enum bfi_phy_i2h_msgs_e {
  956. BFI_PHY_I2H_QUERY_RSP = BFA_I2HM(1),
  957. BFI_PHY_I2H_STATS_RSP = BFA_I2HM(2),
  958. BFI_PHY_I2H_WRITE_RSP = BFA_I2HM(3),
  959. BFI_PHY_I2H_READ_RSP = BFA_I2HM(4),
  960. };
  961. /*
  962. * External PHY query request
  963. */
  964. struct bfi_phy_query_req_s {
  965. struct bfi_mhdr_s mh; /* Common msg header */
  966. u8 instance;
  967. u8 rsv[3];
  968. struct bfi_alen_s alen;
  969. };
  970. /*
  971. * External PHY stats request
  972. */
  973. struct bfi_phy_stats_req_s {
  974. struct bfi_mhdr_s mh; /* Common msg header */
  975. u8 instance;
  976. u8 rsv[3];
  977. struct bfi_alen_s alen;
  978. };
  979. /*
  980. * External PHY write request
  981. */
  982. struct bfi_phy_write_req_s {
  983. struct bfi_mhdr_s mh; /* Common msg header */
  984. u8 instance;
  985. u8 last;
  986. u8 rsv[2];
  987. u32 offset;
  988. u32 length;
  989. struct bfi_alen_s alen;
  990. };
  991. /*
  992. * External PHY read request
  993. */
  994. struct bfi_phy_read_req_s {
  995. struct bfi_mhdr_s mh; /* Common msg header */
  996. u8 instance;
  997. u8 rsv[3];
  998. u32 offset;
  999. u32 length;
  1000. struct bfi_alen_s alen;
  1001. };
  1002. /*
  1003. * External PHY query response
  1004. */
  1005. struct bfi_phy_query_rsp_s {
  1006. struct bfi_mhdr_s mh; /* Common msg header */
  1007. u32 status;
  1008. };
  1009. /*
  1010. * External PHY stats response
  1011. */
  1012. struct bfi_phy_stats_rsp_s {
  1013. struct bfi_mhdr_s mh; /* Common msg header */
  1014. u32 status;
  1015. };
  1016. /*
  1017. * External PHY read response
  1018. */
  1019. struct bfi_phy_read_rsp_s {
  1020. struct bfi_mhdr_s mh; /* Common msg header */
  1021. u32 status;
  1022. u32 length;
  1023. };
  1024. /*
  1025. * External PHY write response
  1026. */
  1027. struct bfi_phy_write_rsp_s {
  1028. struct bfi_mhdr_s mh; /* Common msg header */
  1029. u32 status;
  1030. u32 length;
  1031. };
  1032. enum bfi_fru_h2i_msgs {
  1033. BFI_FRUVPD_H2I_WRITE_REQ = 1,
  1034. BFI_FRUVPD_H2I_READ_REQ = 2,
  1035. BFI_TFRU_H2I_WRITE_REQ = 3,
  1036. BFI_TFRU_H2I_READ_REQ = 4,
  1037. };
  1038. enum bfi_fru_i2h_msgs {
  1039. BFI_FRUVPD_I2H_WRITE_RSP = BFA_I2HM(1),
  1040. BFI_FRUVPD_I2H_READ_RSP = BFA_I2HM(2),
  1041. BFI_TFRU_I2H_WRITE_RSP = BFA_I2HM(3),
  1042. BFI_TFRU_I2H_READ_RSP = BFA_I2HM(4),
  1043. };
  1044. /*
  1045. * FRU write request
  1046. */
  1047. struct bfi_fru_write_req_s {
  1048. struct bfi_mhdr_s mh; /* Common msg header */
  1049. u8 last;
  1050. u8 rsv[3];
  1051. u32 offset;
  1052. u32 length;
  1053. struct bfi_alen_s alen;
  1054. };
  1055. /*
  1056. * FRU read request
  1057. */
  1058. struct bfi_fru_read_req_s {
  1059. struct bfi_mhdr_s mh; /* Common msg header */
  1060. u32 offset;
  1061. u32 length;
  1062. struct bfi_alen_s alen;
  1063. };
  1064. /*
  1065. * FRU response
  1066. */
  1067. struct bfi_fru_rsp_s {
  1068. struct bfi_mhdr_s mh; /* Common msg header */
  1069. u32 status;
  1070. u32 length;
  1071. };
  1072. #pragma pack()
  1073. #endif /* __BFI_H__ */