Broadcom Sonics Silicon Backplane bus SPROM data modification tool
- Copyright (c) 2006-2007 Michael Buesch <mb@bu3sch.de>
+ Copyright (c) 2006-2007 Michael Buesch <m@bues.ch>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define SPROM_SIZE 128 /* bytes */
#define SPROM4_SIZE 440
-/* byte offsets */
-#define SPROM_SUBP (0x02 * 2)
-#define SPROM4_SUBP (0x02 * 2)
-#define SPROM_SUBV (0x03 * 2)
-#define SPROM_PPID (0x04 * 2)
-#define SPROM4_PPID (0x04 * 2)
-#define SPROM_BFLHI (0x1C * 2)
-#define SPROM_IL0MACADDR (0x24 * 2)
-#define SPROM_ET0MACADDR (0x27 * 2)
-#define SPROM_ET1MACADDR (0x2a * 2)
-#define SPROM3_IL0MACADDR (0x25 * 2)
-#define SPROM3_ET0MACADDR (0x28 * 2)
-#define SPROM3_ET1MACADDR (0x28 * 2)
-#define SPROM4_IL0MACADDR (0x26 * 2)
-#define SPROM4_ET0MACADDR (0x18 * 2)
-#define SPROM4_ET1MACADDR (0x26 * 2)
-#define SPROM_ETHPHY (0x2d * 2)
-#define SPROM_BOARDREV (0x2e * 2)
-#define SPROM4_BOARDREV (0x21 * 2)
-#define SPROM4_ANTAVAIL (0x2e * 2)
-#define SPROM4_COUNTRY (0x29 * 2)
-#define SPROM_PA0B0 (0x2f * 2)
-#define SPROM_PA0B1 (0x30 * 2)
-#define SPROM_PA0B2 (0x31 * 2)
-#define SPROM_WL0GPIO0 (0x32 * 2)
-#define SPROM_WL0GPIO2 (0x33 * 2)
-#define SPROM4_WL0GPIO0 (0x2b * 2)
-#define SPROM4_WL0GPIO2 (0x2c * 2)
-#define SPROM_MAXPWR (0x34 * 2)
-#define SPROM4_MAXPWR (0x45 * 2)
-#define SPROM_PA1B0 (0x35 * 2)
-#define SPROM_PA1B1 (0x36 * 2)
-#define SPROM_PA1B2 (0x37 * 2)
-#define SPROM_IDL_TSSI_TGT (0x38 * 2)
-#define SPROM4_IDL_TSSI_TGT (0x40 * 2)
-#define SPROM_BOARDFLAGS (0x39 * 2)
-#define SPROM4_BOARDFLAGS (0x22 * 2)
-#define SPROM_ANTENNA_GAIN (0x3a * 2)
-#define SPROM4_ANTENNA_GAIN (0x2f * 2)
-#define SPROM_VERSION (0x3f * 2)
-#define SPROM4_VERSION (0xdb * 2)
-
enum valuetype {
- VALUE_RAW,
-
- VALUE_SUBP,
- VALUE_FIRST = VALUE_SUBP,
- VALUE_SUBV,
- VALUE_PPID,
- VALUE_BFLHI,
- VALUE_BFL,
- VALUE_BGMAC,
- VALUE_ETMAC,
- VALUE_AMAC,
- VALUE_ET0PHY,
- VALUE_ET1PHY,
- VALUE_ET0MDC,
- VALUE_ET1MDC,
- VALUE_BREV,
- VALUE_LOC,
- VALUE_ANTBG0,
- VALUE_ANTBG1,
- VALUE_ANTA0,
- VALUE_ANTA1,
- VALUE_ANTGBG,
- VALUE_ANTGA,
- VALUE_PA0B0,
- VALUE_PA0B1,
- VALUE_PA0B2,
- VALUE_PA1B0,
- VALUE_PA1B1,
- VALUE_PA1B2,
- VALUE_WL0GPIO0,
- VALUE_WL0GPIO1,
- VALUE_WL0GPIO2,
- VALUE_WL0GPIO3,
- VALUE_MAXPBG,
- VALUE_MAXPA,
- VALUE_ITSSIBG,
- VALUE_ITSSIA,
- VALUE_SVER,
- VALUE_LAST = VALUE_SVER,
+ VAL_RAW,
+
+ VAL_ET0PHY,
+ VAL_ET1PHY,
+ VAL_ET0MDC,
+ VAL_ET1MDC,
+ VAL_BREV,
+ VAL_ANTBG0,
+ VAL_ANTBG1,
+ VAL_ANTBG2,
+ VAL_ANTBG3,
+ VAL_ANTA0,
+ VAL_ANTA1,
+ VAL_ANTA2,
+ VAL_ANTA3,
+ VAL_ANTGBG,
+ VAL_ANTGA,
+ VAL_ANTG0,
+ VAL_ANTG1,
+ VAL_ANTG2,
+ VAL_ANTG3,
+ VAL_TPI2G0,
+ VAL_TPI2G1,
+ VAL_TPI5GM0,
+ VAL_TPI5GM1,
+ VAL_TPI5GL0,
+ VAL_TPI5GL1,
+ VAL_TPI5GH0,
+ VAL_TPI5GH1,
+ VAL_2CCKPO,
+ VAL_2OFDMPO,
+ VAL_5MPO,
+ VAL_5LPO,
+ VAL_5HPO,
+ VAL_2MCSPO,
+ VAL_5MMCSPO,
+ VAL_5LMCSPO,
+ VAL_5HMCSPO,
+ VAL_CCDPO,
+ VAL_STBCPO,
+ VAL_BW40PO,
+ VAL_BWDUPPO,
+ VAL_5HPAM,
+ VAL_5LPAM,
+ VAL_PA0B0,
+ VAL_PA0B1,
+ VAL_PA0B2,
+ VAL_PA0B3,
+ VAL_PA1B0,
+ VAL_PA1B1,
+ VAL_PA1B2,
+ VAL_PA1B3,
+ VAL_5MPA0,
+ VAL_5MPA1,
+ VAL_5MPA2,
+ VAL_5MPA3,
+ VAL_5LPA0,
+ VAL_5LPA1,
+ VAL_5LPA2,
+ VAL_5LPA3,
+ VAL_5HPA0,
+ VAL_5HPA1,
+ VAL_5HPA2,
+ VAL_5HPA3,
+ VAL_LED0,
+ VAL_LED1,
+ VAL_LED2,
+ VAL_LED3,
+ VAL_MAXPBG,
+ VAL_MAXPA,
+ VAL_ITSSIBG,
+ VAL_ITSSIA,
+ VAL_BGMAC,
+ VAL_ETMAC,
+ VAL_AMAC,
+ VAL_SUBP,
+ VAL_SUBV,
+ VAL_PPID,
+ VAL_BFLHI,
+ VAL_BFL,
+ VAL_REGREV,
+ VAL_LOC,
+ VAL_LAST = VAL_LOC,
};
+#define BIT(i) (1U << (i))
+
+#define MASK_1 BIT(1)
+#define MASK_2 BIT(2)
+#define MASK_3 BIT(3)
+#define MASK_4 BIT(4)
+#define MASK_5 BIT(5)
+#define MASK_8 BIT(8)
+
+#define MASK_1_2 MASK_1 | MASK_2 /* Revs 1 - 2 */
+#define MASK_1_3 MASK_1_2 | MASK_3 /* Revs 1 - 3 */
+#define MASK_2_3 MASK_2 | MASK_3 /* Revs 2 - 3 */
+#define MASK_4_5 MASK_4 | MASK_5 /* Revs 4 - 5 */
+#define MASK_1_5 MASK_1_3 | MASK_4_5 /* Revs 1 - 5 */
+#define MASK_1_8 MASK_1_5 | MASK_8 /* Revs 1 - 5, 8 */
+
struct cmdline_vparm {
enum valuetype type;
int set;
int bits;
union {
- uint16_t value;
+ uint32_t value;
uint8_t mac[6];
+ char ccode[2];
struct {
uint16_t value;
uint16_t offset;
struct cmdline_vparm vparm[MAX_VPARM];
int nr_vparm;
};
+
+struct var_entry {
+ uint16_t rev_mask;
+ enum valuetype type;
+ uint16_t length;
+ uint16_t offset;
+ uint16_t mask;
+ uint16_t shift;
+ const char *desc;
+ const char *label;
+};
+
extern struct cmdline_args cmdargs;
#endif /* SSB_SPROMTOOL_H_ */