bfa_defs.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * Linux network driver for Brocade Converged Network Adapter.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License (GPL) Version 2 as
  6. * published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. */
  13. /*
  14. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  15. * All rights reserved
  16. * www.brocade.com
  17. */
  18. #ifndef __BFA_DEFS_H__
  19. #define __BFA_DEFS_H__
  20. #include "cna.h"
  21. #include "bfa_defs_status.h"
  22. #include "bfa_defs_mfg_comm.h"
  23. #define BFA_STRING_32 32
  24. #define BFA_VERSION_LEN 64
  25. /**
  26. * ---------------------- adapter definitions ------------
  27. */
  28. /**
  29. * BFA adapter level attributes.
  30. */
  31. enum {
  32. BFA_ADAPTER_SERIAL_NUM_LEN = STRSZ(BFA_MFG_SERIALNUM_SIZE),
  33. /*
  34. *!< adapter serial num length
  35. */
  36. BFA_ADAPTER_MODEL_NAME_LEN = 16, /*!< model name length */
  37. BFA_ADAPTER_MODEL_DESCR_LEN = 128, /*!< model description length */
  38. BFA_ADAPTER_MFG_NAME_LEN = 8, /*!< manufacturer name length */
  39. BFA_ADAPTER_SYM_NAME_LEN = 64, /*!< adapter symbolic name length */
  40. BFA_ADAPTER_OS_TYPE_LEN = 64, /*!< adapter os type length */
  41. };
  42. struct bfa_adapter_attr {
  43. char manufacturer[BFA_ADAPTER_MFG_NAME_LEN];
  44. char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
  45. u32 card_type;
  46. char model[BFA_ADAPTER_MODEL_NAME_LEN];
  47. char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN];
  48. u64 pwwn;
  49. char node_symname[FC_SYMNAME_MAX];
  50. char hw_ver[BFA_VERSION_LEN];
  51. char fw_ver[BFA_VERSION_LEN];
  52. char optrom_ver[BFA_VERSION_LEN];
  53. char os_type[BFA_ADAPTER_OS_TYPE_LEN];
  54. struct bfa_mfg_vpd vpd;
  55. struct mac mac;
  56. u8 nports;
  57. u8 max_speed;
  58. u8 prototype;
  59. char asic_rev;
  60. u8 pcie_gen;
  61. u8 pcie_lanes_orig;
  62. u8 pcie_lanes;
  63. u8 cna_capable;
  64. u8 is_mezz;
  65. u8 trunk_capable;
  66. };
  67. /**
  68. * ---------------------- IOC definitions ------------
  69. */
  70. enum {
  71. BFA_IOC_DRIVER_LEN = 16,
  72. BFA_IOC_CHIP_REV_LEN = 8,
  73. };
  74. /**
  75. * Driver and firmware versions.
  76. */
  77. struct bfa_ioc_driver_attr {
  78. char driver[BFA_IOC_DRIVER_LEN]; /*!< driver name */
  79. char driver_ver[BFA_VERSION_LEN]; /*!< driver version */
  80. char fw_ver[BFA_VERSION_LEN]; /*!< firmware version */
  81. char bios_ver[BFA_VERSION_LEN]; /*!< bios version */
  82. char efi_ver[BFA_VERSION_LEN]; /*!< EFI version */
  83. char ob_ver[BFA_VERSION_LEN]; /*!< openboot version */
  84. };
  85. /**
  86. * IOC PCI device attributes
  87. */
  88. struct bfa_ioc_pci_attr {
  89. u16 vendor_id; /*!< PCI vendor ID */
  90. u16 device_id; /*!< PCI device ID */
  91. u16 ssid; /*!< subsystem ID */
  92. u16 ssvid; /*!< subsystem vendor ID */
  93. u32 pcifn; /*!< PCI device function */
  94. u32 rsvd; /* padding */
  95. char chip_rev[BFA_IOC_CHIP_REV_LEN]; /*!< chip revision */
  96. };
  97. /**
  98. * IOC states
  99. */
  100. enum bfa_ioc_state {
  101. BFA_IOC_UNINIT = 1, /*!< IOC is in uninit state */
  102. BFA_IOC_RESET = 2, /*!< IOC is in reset state */
  103. BFA_IOC_SEMWAIT = 3, /*!< Waiting for IOC h/w semaphore */
  104. BFA_IOC_HWINIT = 4, /*!< IOC h/w is being initialized */
  105. BFA_IOC_GETATTR = 5, /*!< IOC is being configured */
  106. BFA_IOC_OPERATIONAL = 6, /*!< IOC is operational */
  107. BFA_IOC_INITFAIL = 7, /*!< IOC hardware failure */
  108. BFA_IOC_FAIL = 8, /*!< IOC heart-beat failure */
  109. BFA_IOC_DISABLING = 9, /*!< IOC is being disabled */
  110. BFA_IOC_DISABLED = 10, /*!< IOC is disabled */
  111. BFA_IOC_FWMISMATCH = 11, /*!< IOC f/w different from drivers */
  112. BFA_IOC_ENABLING = 12, /*!< IOC is being enabled */
  113. };
  114. /**
  115. * IOC firmware stats
  116. */
  117. struct bfa_fw_ioc_stats {
  118. u32 enable_reqs;
  119. u32 disable_reqs;
  120. u32 get_attr_reqs;
  121. u32 dbg_sync;
  122. u32 dbg_dump;
  123. u32 unknown_reqs;
  124. };
  125. /**
  126. * IOC driver stats
  127. */
  128. struct bfa_ioc_drv_stats {
  129. u32 ioc_isrs;
  130. u32 ioc_enables;
  131. u32 ioc_disables;
  132. u32 ioc_hbfails;
  133. u32 ioc_boots;
  134. u32 stats_tmos;
  135. u32 hb_count;
  136. u32 disable_reqs;
  137. u32 enable_reqs;
  138. u32 disable_replies;
  139. u32 enable_replies;
  140. };
  141. /**
  142. * IOC statistics
  143. */
  144. struct bfa_ioc_stats {
  145. struct bfa_ioc_drv_stats drv_stats; /*!< driver IOC stats */
  146. struct bfa_fw_ioc_stats fw_stats; /*!< firmware IOC stats */
  147. };
  148. enum bfa_ioc_type {
  149. BFA_IOC_TYPE_FC = 1,
  150. BFA_IOC_TYPE_FCoE = 2,
  151. BFA_IOC_TYPE_LL = 3,
  152. };
  153. /**
  154. * IOC attributes returned in queries
  155. */
  156. struct bfa_ioc_attr {
  157. enum bfa_ioc_type ioc_type;
  158. enum bfa_ioc_state state; /*!< IOC state */
  159. struct bfa_adapter_attr adapter_attr; /*!< HBA attributes */
  160. struct bfa_ioc_driver_attr driver_attr; /*!< driver attr */
  161. struct bfa_ioc_pci_attr pci_attr;
  162. u8 port_id; /*!< port number */
  163. u8 rsvd[7]; /*!< 64bit align */
  164. };
  165. /**
  166. * ---------------------- mfg definitions ------------
  167. */
  168. /**
  169. * Checksum size
  170. */
  171. #define BFA_MFG_CHKSUM_SIZE 16
  172. #define BFA_MFG_PARTNUM_SIZE 14
  173. #define BFA_MFG_SUPPLIER_ID_SIZE 10
  174. #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20
  175. #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20
  176. #define BFA_MFG_SUPPLIER_REVISION_SIZE 4
  177. #pragma pack(1)
  178. /**
  179. * @brief BFA adapter manufacturing block definition.
  180. *
  181. * All numerical fields are in big-endian format.
  182. */
  183. struct bfa_mfg_block {
  184. u8 version; /*!< manufacturing block version */
  185. u8 mfg_sig[3]; /*!< characters 'M', 'F', 'G' */
  186. u16 mfgsize; /*!< mfg block size */
  187. u16 u16_chksum; /*!< old u16 checksum */
  188. char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
  189. char brcd_partnum[STRSZ(BFA_MFG_PARTNUM_SIZE)];
  190. u8 mfg_day; /*!< manufacturing day */
  191. u8 mfg_month; /*!< manufacturing month */
  192. u16 mfg_year; /*!< manufacturing year */
  193. u64 mfg_wwn; /*!< wwn base for this adapter */
  194. u8 num_wwn; /*!< number of wwns assigned */
  195. u8 mfg_speeds; /*!< speeds allowed for this adapter */
  196. u8 rsv[2];
  197. char supplier_id[STRSZ(BFA_MFG_SUPPLIER_ID_SIZE)];
  198. char supplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)];
  199. char
  200. supplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)];
  201. char
  202. supplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)];
  203. mac_t mfg_mac; /*!< mac address */
  204. u8 num_mac; /*!< number of mac addresses */
  205. u8 rsv2;
  206. u32 mfg_type; /*!< card type */
  207. u8 rsv3[108];
  208. u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /*!< md5 checksum */
  209. };
  210. #pragma pack()
  211. /**
  212. * ---------------------- pci definitions ------------
  213. */
  214. #define bfa_asic_id_ct(devid) \
  215. ((devid) == PCI_DEVICE_ID_BROCADE_CT || \
  216. (devid) == PCI_DEVICE_ID_BROCADE_CT_FC)
  217. #endif /* __BFA_DEFS_H__ */