bfa_defs_mfg_comm.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Linux network driver for QLogic BR-series 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-2014 Brocade Communications Systems, Inc.
  15. * Copyright (c) 2014-2015 QLogic Corporation
  16. * All rights reserved
  17. * www.qlogic.com
  18. */
  19. #ifndef __BFA_DEFS_MFG_COMM_H__
  20. #define __BFA_DEFS_MFG_COMM_H__
  21. #include "bfa_defs.h"
  22. /* Manufacturing block version */
  23. #define BFA_MFG_VERSION 3
  24. #define BFA_MFG_VERSION_UNINIT 0xFF
  25. /* Manufacturing block encrypted version */
  26. #define BFA_MFG_ENC_VER 2
  27. /* Manufacturing block version 1 length */
  28. #define BFA_MFG_VER1_LEN 128
  29. /* Manufacturing block header length */
  30. #define BFA_MFG_HDR_LEN 4
  31. #define BFA_MFG_SERIALNUM_SIZE 11
  32. #define STRSZ(_n) (((_n) + 4) & ~3)
  33. /* Manufacturing card type */
  34. enum {
  35. BFA_MFG_TYPE_CB_MAX = 825, /*!< Crossbow card type max */
  36. BFA_MFG_TYPE_FC8P2 = 825, /*!< 8G 2port FC card */
  37. BFA_MFG_TYPE_FC8P1 = 815, /*!< 8G 1port FC card */
  38. BFA_MFG_TYPE_FC4P2 = 425, /*!< 4G 2port FC card */
  39. BFA_MFG_TYPE_FC4P1 = 415, /*!< 4G 1port FC card */
  40. BFA_MFG_TYPE_CNA10P2 = 1020, /*!< 10G 2port CNA card */
  41. BFA_MFG_TYPE_CNA10P1 = 1010, /*!< 10G 1port CNA card */
  42. BFA_MFG_TYPE_JAYHAWK = 804, /*!< Jayhawk mezz card */
  43. BFA_MFG_TYPE_WANCHESE = 1007, /*!< Wanchese mezz card */
  44. BFA_MFG_TYPE_ASTRA = 807, /*!< Astra mezz card */
  45. BFA_MFG_TYPE_LIGHTNING_P0 = 902, /*!< Lightning mezz card - old */
  46. BFA_MFG_TYPE_LIGHTNING = 1741, /*!< Lightning mezz card */
  47. BFA_MFG_TYPE_PROWLER_F = 1560, /*!< Prowler FC only cards */
  48. BFA_MFG_TYPE_PROWLER_N = 1410, /*!< Prowler NIC only cards */
  49. BFA_MFG_TYPE_PROWLER_C = 1710, /*!< Prowler CNA only cards */
  50. BFA_MFG_TYPE_PROWLER_D = 1860, /*!< Prowler Dual cards */
  51. BFA_MFG_TYPE_CHINOOK = 1867, /*!< Chinook cards */
  52. BFA_MFG_TYPE_INVALID = 0, /*!< Invalid card type */
  53. };
  54. /* Check if Mezz card */
  55. #define bfa_mfg_is_mezz(type) (( \
  56. (type) == BFA_MFG_TYPE_JAYHAWK || \
  57. (type) == BFA_MFG_TYPE_WANCHESE || \
  58. (type) == BFA_MFG_TYPE_ASTRA || \
  59. (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
  60. (type) == BFA_MFG_TYPE_LIGHTNING || \
  61. (type) == BFA_MFG_TYPE_CHINOOK))
  62. enum {
  63. CB_GPIO_TTV = (1), /*!< TTV debug capable cards */
  64. CB_GPIO_FC8P2 = (2), /*!< 8G 2port FC card */
  65. CB_GPIO_FC8P1 = (3), /*!< 8G 1port FC card */
  66. CB_GPIO_FC4P2 = (4), /*!< 4G 2port FC card */
  67. CB_GPIO_FC4P1 = (5), /*!< 4G 1port FC card */
  68. CB_GPIO_DFLY = (6), /*!< 8G 2port FC mezzanine card */
  69. CB_GPIO_PROTO = BIT(7) /*!< 8G 2port FC prototypes */
  70. };
  71. #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop) \
  72. do { \
  73. if ((gpio) & CB_GPIO_PROTO) { \
  74. (prop) |= BFI_ADAPTER_PROTO; \
  75. (gpio) &= ~CB_GPIO_PROTO; \
  76. } \
  77. switch (gpio) { \
  78. case CB_GPIO_TTV: \
  79. (prop) |= BFI_ADAPTER_TTV; \
  80. case CB_GPIO_DFLY: \
  81. case CB_GPIO_FC8P2: \
  82. (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
  83. (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
  84. (card_type) = BFA_MFG_TYPE_FC8P2; \
  85. break; \
  86. case CB_GPIO_FC8P1: \
  87. (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
  88. (prop) |= BFI_ADAPTER_SETP(SPEED, 8); \
  89. (card_type) = BFA_MFG_TYPE_FC8P1; \
  90. break; \
  91. case CB_GPIO_FC4P2: \
  92. (prop) |= BFI_ADAPTER_SETP(NPORTS, 2); \
  93. (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
  94. (card_type) = BFA_MFG_TYPE_FC4P2; \
  95. break; \
  96. case CB_GPIO_FC4P1: \
  97. (prop) |= BFI_ADAPTER_SETP(NPORTS, 1); \
  98. (prop) |= BFI_ADAPTER_SETP(SPEED, 4); \
  99. (card_type) = BFA_MFG_TYPE_FC4P1; \
  100. break; \
  101. default: \
  102. (prop) |= BFI_ADAPTER_UNSUPP; \
  103. (card_type) = BFA_MFG_TYPE_INVALID; \
  104. } \
  105. } while (0)
  106. /* VPD data length */
  107. #define BFA_MFG_VPD_LEN 512
  108. #define BFA_MFG_VPD_LEN_INVALID 0
  109. #define BFA_MFG_VPD_PCI_HDR_OFF 137
  110. #define BFA_MFG_VPD_PCI_VER_MASK 0x07 /*!< version mask 3 bits */
  111. #define BFA_MFG_VPD_PCI_VDR_MASK 0xf8 /*!< vendor mask 5 bits */
  112. /* VPD vendor tag */
  113. enum {
  114. BFA_MFG_VPD_UNKNOWN = 0, /*!< vendor unknown */
  115. BFA_MFG_VPD_IBM = 1, /*!< vendor IBM */
  116. BFA_MFG_VPD_HP = 2, /*!< vendor HP */
  117. BFA_MFG_VPD_DELL = 3, /*!< vendor DELL */
  118. BFA_MFG_VPD_PCI_IBM = 0x08, /*!< PCI VPD IBM */
  119. BFA_MFG_VPD_PCI_HP = 0x10, /*!< PCI VPD HP */
  120. BFA_MFG_VPD_PCI_DELL = 0x20, /*!< PCI VPD DELL */
  121. BFA_MFG_VPD_PCI_BRCD = 0xf8, /*!< PCI VPD Brocade */
  122. };
  123. /* BFA adapter flash vpd data definition.
  124. *
  125. * All numerical fields are in big-endian format.
  126. */
  127. struct bfa_mfg_vpd {
  128. u8 version; /*!< vpd data version */
  129. u8 vpd_sig[3]; /*!< characters 'V', 'P', 'D' */
  130. u8 chksum; /*!< u8 checksum */
  131. u8 vendor; /*!< vendor */
  132. u8 len; /*!< vpd data length excluding header */
  133. u8 rsv;
  134. u8 data[BFA_MFG_VPD_LEN]; /*!< vpd data */
  135. } __packed;
  136. #endif /* __BFA_DEFS_MFG_H__ */