bfi_ioc.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * Copyright (c) 2005-2009 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_IOC_H__
  18. #define __BFI_IOC_H__
  19. #include "bfi.h"
  20. #include <defs/bfa_defs_ioc.h>
  21. #pragma pack(1)
  22. enum bfi_ioc_h2i_msgs {
  23. BFI_IOC_H2I_ENABLE_REQ = 1,
  24. BFI_IOC_H2I_DISABLE_REQ = 2,
  25. BFI_IOC_H2I_GETATTR_REQ = 3,
  26. BFI_IOC_H2I_DBG_SYNC = 4,
  27. BFI_IOC_H2I_DBG_DUMP = 5,
  28. };
  29. enum bfi_ioc_i2h_msgs {
  30. BFI_IOC_I2H_ENABLE_REPLY = BFA_I2HM(1),
  31. BFI_IOC_I2H_DISABLE_REPLY = BFA_I2HM(2),
  32. BFI_IOC_I2H_GETATTR_REPLY = BFA_I2HM(3),
  33. BFI_IOC_I2H_READY_EVENT = BFA_I2HM(4),
  34. BFI_IOC_I2H_HBEAT = BFA_I2HM(5),
  35. };
  36. /**
  37. * BFI_IOC_H2I_GETATTR_REQ message
  38. */
  39. struct bfi_ioc_getattr_req_s {
  40. struct bfi_mhdr_s mh;
  41. union bfi_addr_u attr_addr;
  42. };
  43. struct bfi_ioc_attr_s {
  44. wwn_t mfg_pwwn; /* Mfg port wwn */
  45. wwn_t mfg_nwwn; /* Mfg node wwn */
  46. mac_t mfg_mac; /* Mfg mac */
  47. u16 rsvd_a;
  48. wwn_t pwwn;
  49. wwn_t nwwn;
  50. mac_t mac; /* PBC or Mfg mac */
  51. u16 rsvd_b;
  52. char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
  53. u8 pcie_gen;
  54. u8 pcie_lanes_orig;
  55. u8 pcie_lanes;
  56. u8 rx_bbcredit; /* receive buffer credits */
  57. u32 adapter_prop; /* adapter properties */
  58. u16 maxfrsize; /* max receive frame size */
  59. char asic_rev;
  60. u8 rsvd_c;
  61. char fw_version[BFA_VERSION_LEN];
  62. char optrom_version[BFA_VERSION_LEN];
  63. struct bfa_mfg_vpd_s vpd;
  64. u32 card_type; /* card type */
  65. };
  66. /**
  67. * BFI_IOC_I2H_GETATTR_REPLY message
  68. */
  69. struct bfi_ioc_getattr_reply_s {
  70. struct bfi_mhdr_s mh; /* Common msg header */
  71. u8 status; /* cfg reply status */
  72. u8 rsvd[3];
  73. };
  74. /**
  75. * Firmware memory page offsets
  76. */
  77. #define BFI_IOC_SMEM_PG0_CB (0x40)
  78. #define BFI_IOC_SMEM_PG0_CT (0x180)
  79. /**
  80. * Firmware trace offset
  81. */
  82. #define BFI_IOC_TRC_OFF (0x4b00)
  83. #define BFI_IOC_TRC_ENTS 256
  84. #define BFI_IOC_FW_SIGNATURE (0xbfadbfad)
  85. #define BFI_IOC_MD5SUM_SZ 4
  86. struct bfi_ioc_image_hdr_s {
  87. u32 signature; /* constant signature */
  88. u32 rsvd_a;
  89. u32 exec; /* exec vector */
  90. u32 param; /* parameters */
  91. u32 rsvd_b[4];
  92. u32 md5sum[BFI_IOC_MD5SUM_SZ];
  93. };
  94. /**
  95. * BFI_IOC_I2H_READY_EVENT message
  96. */
  97. struct bfi_ioc_rdy_event_s {
  98. struct bfi_mhdr_s mh; /* common msg header */
  99. u8 init_status; /* init event status */
  100. u8 rsvd[3];
  101. };
  102. struct bfi_ioc_hbeat_s {
  103. struct bfi_mhdr_s mh; /* common msg header */
  104. u32 hb_count; /* current heart beat count */
  105. };
  106. /**
  107. * IOC hardware/firmware state
  108. */
  109. enum bfi_ioc_state {
  110. BFI_IOC_UNINIT = 0, /* not initialized */
  111. BFI_IOC_INITING = 1, /* h/w is being initialized */
  112. BFI_IOC_HWINIT = 2, /* h/w is initialized */
  113. BFI_IOC_CFG = 3, /* IOC configuration in progress */
  114. BFI_IOC_OP = 4, /* IOC is operational */
  115. BFI_IOC_DISABLING = 5, /* IOC is being disabled */
  116. BFI_IOC_DISABLED = 6, /* IOC is disabled */
  117. BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */
  118. BFI_IOC_FAIL = 8, /* IOC heart-beat failure */
  119. BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */
  120. };
  121. #define BFI_IOC_ENDIAN_SIG 0x12345678
  122. enum {
  123. BFI_ADAPTER_TYPE_FC = 0x01, /* FC adapters */
  124. BFI_ADAPTER_TYPE_MK = 0x0f0000, /* adapter type mask */
  125. BFI_ADAPTER_TYPE_SH = 16, /* adapter type shift */
  126. BFI_ADAPTER_NPORTS_MK = 0xff00, /* number of ports mask */
  127. BFI_ADAPTER_NPORTS_SH = 8, /* number of ports shift */
  128. BFI_ADAPTER_SPEED_MK = 0xff, /* adapter speed mask */
  129. BFI_ADAPTER_SPEED_SH = 0, /* adapter speed shift */
  130. BFI_ADAPTER_PROTO = 0x100000, /* prototype adapaters */
  131. BFI_ADAPTER_TTV = 0x200000, /* TTV debug capable */
  132. BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
  133. };
  134. #define BFI_ADAPTER_GETP(__prop, __adap_prop) \
  135. (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
  136. BFI_ADAPTER_ ## __prop ## _SH)
  137. #define BFI_ADAPTER_SETP(__prop, __val) \
  138. ((__val) << BFI_ADAPTER_ ## __prop ## _SH)
  139. #define BFI_ADAPTER_IS_PROTO(__adap_type) \
  140. ((__adap_type) & BFI_ADAPTER_PROTO)
  141. #define BFI_ADAPTER_IS_TTV(__adap_type) \
  142. ((__adap_type) & BFI_ADAPTER_TTV)
  143. #define BFI_ADAPTER_IS_UNSUPP(__adap_type) \
  144. ((__adap_type) & BFI_ADAPTER_UNSUPP)
  145. #define BFI_ADAPTER_IS_SPECIAL(__adap_type) \
  146. ((__adap_type) & (BFI_ADAPTER_TTV | BFI_ADAPTER_PROTO | \
  147. BFI_ADAPTER_UNSUPP))
  148. /**
  149. * BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages
  150. */
  151. struct bfi_ioc_ctrl_req_s {
  152. struct bfi_mhdr_s mh;
  153. u8 ioc_class;
  154. u8 rsvd[3];
  155. };
  156. /**
  157. * BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages
  158. */
  159. struct bfi_ioc_ctrl_reply_s {
  160. struct bfi_mhdr_s mh; /* Common msg header */
  161. u8 status; /* enable/disable status */
  162. u8 rsvd[3];
  163. };
  164. #define BFI_IOC_MSGSZ 8
  165. /**
  166. * H2I Messages
  167. */
  168. union bfi_ioc_h2i_msg_u {
  169. struct bfi_mhdr_s mh;
  170. struct bfi_ioc_ctrl_req_s enable_req;
  171. struct bfi_ioc_ctrl_req_s disable_req;
  172. struct bfi_ioc_getattr_req_s getattr_req;
  173. u32 mboxmsg[BFI_IOC_MSGSZ];
  174. };
  175. /**
  176. * I2H Messages
  177. */
  178. union bfi_ioc_i2h_msg_u {
  179. struct bfi_mhdr_s mh;
  180. struct bfi_ioc_rdy_event_s rdy_event;
  181. u32 mboxmsg[BFI_IOC_MSGSZ];
  182. };
  183. #pragma pack()
  184. #endif /* __BFI_IOC_H__ */