bfa_defs_mfg.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 __BFA_DEFS_MFG_H__
  18. #define __BFA_DEFS_MFG_H__
  19. #include <bfa_os_inc.h>
  20. /**
  21. * Manufacturing block version
  22. */
  23. #define BFA_MFG_VERSION 2
  24. /**
  25. * Manufacturing block encrypted version
  26. */
  27. #define BFA_MFG_ENC_VER 2
  28. /**
  29. * Manufacturing block version 1 length
  30. */
  31. #define BFA_MFG_VER1_LEN 128
  32. /**
  33. * Manufacturing block header length
  34. */
  35. #define BFA_MFG_HDR_LEN 4
  36. /**
  37. * Checksum size
  38. */
  39. #define BFA_MFG_CHKSUM_SIZE 16
  40. /**
  41. * Manufacturing block format
  42. */
  43. #define BFA_MFG_SERIALNUM_SIZE 11
  44. #define BFA_MFG_PARTNUM_SIZE 14
  45. #define BFA_MFG_SUPPLIER_ID_SIZE 10
  46. #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20
  47. #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20
  48. #define BFA_MFG_SUPPLIER_REVISION_SIZE 4
  49. #define STRSZ(_n) (((_n) + 4) & ~3)
  50. /**
  51. * Manufacturing card type
  52. */
  53. enum {
  54. BFA_MFG_TYPE_CB_MAX = 825, /* Crossbow card type max */
  55. BFA_MFG_TYPE_FC8P2 = 825, /* 8G 2port FC card */
  56. BFA_MFG_TYPE_FC8P1 = 815, /* 8G 1port FC card */
  57. BFA_MFG_TYPE_FC4P2 = 425, /* 4G 2port FC card */
  58. BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */
  59. BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */
  60. BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */
  61. BFA_MFG_TYPE_JAYHAWK = 804, /* Jayhawk mezz card */
  62. BFA_MFG_TYPE_WANCHESE = 1007, /* Wanchese mezz card */
  63. BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */
  64. };
  65. #pragma pack(1)
  66. /**
  67. * Card type to port number conversion
  68. */
  69. #define bfa_mfg_type2port_num(card_type) (((card_type) / 10) % 10)
  70. /**
  71. * Check if Mezz card
  72. */
  73. #define bfa_mfg_is_mezz(type) (( \
  74. (type) == BFA_MFG_TYPE_JAYHAWK || \
  75. (type) == BFA_MFG_TYPE_WANCHESE))
  76. /**
  77. * Check if card type valid
  78. */
  79. #define bfa_mfg_is_card_type_valid(type) (( \
  80. (type) == BFA_MFG_TYPE_FC8P2 || \
  81. (type) == BFA_MFG_TYPE_FC8P1 || \
  82. (type) == BFA_MFG_TYPE_FC4P2 || \
  83. (type) == BFA_MFG_TYPE_FC4P1 || \
  84. (type) == BFA_MFG_TYPE_CNA10P2 || \
  85. (type) == BFA_MFG_TYPE_CNA10P1 || \
  86. bfa_mfg_is_mezz(type)))
  87. /**
  88. * All numerical fields are in big-endian format.
  89. */
  90. struct bfa_mfg_block_s {
  91. };
  92. /**
  93. * VPD data length
  94. */
  95. #define BFA_MFG_VPD_LEN 512
  96. #define BFA_MFG_VPD_PCI_HDR_OFF 137
  97. #define BFA_MFG_VPD_PCI_VER_MASK 0x07 /* version mask 3 bits */
  98. #define BFA_MFG_VPD_PCI_VDR_MASK 0xf8 /* vendor mask 5 bits */
  99. /**
  100. * VPD vendor tag
  101. */
  102. enum {
  103. BFA_MFG_VPD_UNKNOWN = 0, /* vendor unknown */
  104. BFA_MFG_VPD_IBM = 1, /* vendor IBM */
  105. BFA_MFG_VPD_HP = 2, /* vendor HP */
  106. BFA_MFG_VPD_DELL = 3, /* vendor DELL */
  107. BFA_MFG_VPD_PCI_IBM = 0x08, /* PCI VPD IBM */
  108. BFA_MFG_VPD_PCI_HP = 0x10, /* PCI VPD HP */
  109. BFA_MFG_VPD_PCI_DELL = 0x20, /* PCI VPD DELL */
  110. BFA_MFG_VPD_PCI_BRCD = 0xf8, /* PCI VPD Brocade */
  111. };
  112. /**
  113. * All numerical fields are in big-endian format.
  114. */
  115. struct bfa_mfg_vpd_s {
  116. u8 version; /* vpd data version */
  117. u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */
  118. u8 chksum; /* u8 checksum */
  119. u8 vendor; /* vendor */
  120. u8 len; /* vpd data length excluding header */
  121. u8 rsv;
  122. u8 data[BFA_MFG_VPD_LEN]; /* vpd data */
  123. };
  124. #pragma pack()
  125. #endif /* __BFA_DEFS_MFG_H__ */