ssb_sprom.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. Broadcom Sonics Silicon Backplane bus SPROM data modification tool
  3. Copyright (c) 2006-2007 Michael Buesch <m@bues.ch>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #ifndef SSB_SPROMTOOL_H_
  18. #define SSB_SPROMTOOL_H_
  19. #include "utils.h"
  20. #define SPROM_SIZE 128 /* bytes */
  21. #define SPROM4_SIZE 440
  22. enum valuetype {
  23. VAL_RAW,
  24. VAL_ET0PHY,
  25. VAL_ET1PHY,
  26. VAL_ET0MDC,
  27. VAL_ET1MDC,
  28. VAL_BREV,
  29. VAL_ANTBG0,
  30. VAL_ANTBG1,
  31. VAL_ANTBG2,
  32. VAL_ANTBG3,
  33. VAL_ANTA0,
  34. VAL_ANTA1,
  35. VAL_ANTA2,
  36. VAL_ANTA3,
  37. VAL_ANTGBG,
  38. VAL_ANTGA,
  39. VAL_ANTG0,
  40. VAL_ANTG1,
  41. VAL_ANTG2,
  42. VAL_ANTG3,
  43. VAL_TPI2G0,
  44. VAL_TPI2G1,
  45. VAL_TPI5GM0,
  46. VAL_TPI5GM1,
  47. VAL_TPI5GL0,
  48. VAL_TPI5GL1,
  49. VAL_TPI5GH0,
  50. VAL_TPI5GH1,
  51. VAL_2CCKPO,
  52. VAL_2OFDMPO,
  53. VAL_5MPO,
  54. VAL_5LPO,
  55. VAL_5HPO,
  56. VAL_2MCSPO,
  57. VAL_5MMCSPO,
  58. VAL_5LMCSPO,
  59. VAL_5HMCSPO,
  60. VAL_CCDPO,
  61. VAL_STBCPO,
  62. VAL_BW40PO,
  63. VAL_BWDUPPO,
  64. VAL_5HPAM,
  65. VAL_5LPAM,
  66. VAL_PA0B0,
  67. VAL_PA0B1,
  68. VAL_PA0B2,
  69. VAL_PA0B3,
  70. VAL_PA1B0,
  71. VAL_PA1B1,
  72. VAL_PA1B2,
  73. VAL_PA1B3,
  74. VAL_5MPA0,
  75. VAL_5MPA1,
  76. VAL_5MPA2,
  77. VAL_5MPA3,
  78. VAL_5LPA0,
  79. VAL_5LPA1,
  80. VAL_5LPA2,
  81. VAL_5LPA3,
  82. VAL_5HPA0,
  83. VAL_5HPA1,
  84. VAL_5HPA2,
  85. VAL_5HPA3,
  86. VAL_LED0,
  87. VAL_LED1,
  88. VAL_LED2,
  89. VAL_LED3,
  90. VAL_MAXPBG,
  91. VAL_MAXPA,
  92. VAL_ITSSIBG,
  93. VAL_ITSSIA,
  94. VAL_BGMAC,
  95. VAL_ETMAC,
  96. VAL_AMAC,
  97. VAL_SUBP,
  98. VAL_SUBV,
  99. VAL_PPID,
  100. VAL_BFLHI,
  101. VAL_BFL,
  102. VAL_REGREV,
  103. VAL_LOC,
  104. VAL_LAST = VAL_LOC,
  105. };
  106. #define BIT(i) (1U << (i))
  107. #define MASK_1 BIT(1)
  108. #define MASK_2 BIT(2)
  109. #define MASK_3 BIT(3)
  110. #define MASK_4 BIT(4)
  111. #define MASK_5 BIT(5)
  112. #define MASK_8 BIT(8)
  113. #define MASK_1_2 MASK_1 | MASK_2 /* Revs 1 - 2 */
  114. #define MASK_1_3 MASK_1_2 | MASK_3 /* Revs 1 - 3 */
  115. #define MASK_2_3 MASK_2 | MASK_3 /* Revs 2 - 3 */
  116. #define MASK_4_5 MASK_4 | MASK_5 /* Revs 4 - 5 */
  117. #define MASK_1_5 MASK_1_3 | MASK_4_5 /* Revs 1 - 5 */
  118. #define MASK_1_8 MASK_1_5 | MASK_8 /* Revs 1 - 5, 8 */
  119. struct cmdline_vparm {
  120. enum valuetype type;
  121. int set;
  122. int bits;
  123. union {
  124. uint32_t value;
  125. uint8_t mac[6];
  126. char ccode[2];
  127. struct {
  128. uint16_t value;
  129. uint16_t offset;
  130. } raw;
  131. } u;
  132. };
  133. struct cmdline_args {
  134. const char *infile;
  135. const char *outfile;
  136. int verbose;
  137. int force;
  138. int bin_mode;
  139. #define MAX_VPARM 512
  140. struct cmdline_vparm vparm[MAX_VPARM];
  141. int nr_vparm;
  142. };
  143. struct var_entry {
  144. uint16_t rev_mask;
  145. enum valuetype type;
  146. uint16_t length;
  147. uint16_t offset;
  148. uint16_t mask;
  149. uint16_t shift;
  150. const char *desc;
  151. const char *label;
  152. };
  153. extern struct cmdline_args cmdargs;
  154. #endif /* SSB_SPROMTOOL_H_ */