aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6972fe5ccbf6..2b70b0f6f60b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11951,6 +11951,51 @@ static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset)
11951 return 1; 11951 return 1;
11952} 11952}
11953 11953
11954static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val)
11955{
11956 u32 offset, major, minor, build;
11957
11958 tp->fw_ver[0] = 's';
11959 tp->fw_ver[1] = 'b';
11960 tp->fw_ver[2] = '\0';
11961
11962 if ((val & TG3_EEPROM_SB_FORMAT_MASK) != TG3_EEPROM_SB_FORMAT_1)
11963 return;
11964
11965 switch (val & TG3_EEPROM_SB_REVISION_MASK) {
11966 case TG3_EEPROM_SB_REVISION_0:
11967 offset = TG3_EEPROM_SB_F1R0_EDH_OFF;
11968 break;
11969 case TG3_EEPROM_SB_REVISION_2:
11970 offset = TG3_EEPROM_SB_F1R2_EDH_OFF;
11971 break;
11972 case TG3_EEPROM_SB_REVISION_3:
11973 offset = TG3_EEPROM_SB_F1R3_EDH_OFF;
11974 break;
11975 default:
11976 return;
11977 }
11978
11979 if (tg3_nvram_read_swab(tp, offset, &val))
11980 return;
11981
11982 build = (val & TG3_EEPROM_SB_EDH_BLD_MASK) >>
11983 TG3_EEPROM_SB_EDH_BLD_SHFT;
11984 major = (val & TG3_EEPROM_SB_EDH_MAJ_MASK) >>
11985 TG3_EEPROM_SB_EDH_MAJ_SHFT;
11986 minor = val & TG3_EEPROM_SB_EDH_MIN_MASK;
11987
11988 if (minor > 99 || build > 26)
11989 return;
11990
11991 snprintf(&tp->fw_ver[2], 30, " v%d.%02d", major, minor);
11992
11993 if (build > 0) {
11994 tp->fw_ver[8] = 'a' + build - 1;
11995 tp->fw_ver[9] = '\0';
11996 }
11997}
11998
11954static void __devinit tg3_read_fw_ver(struct tg3 *tp) 11999static void __devinit tg3_read_fw_ver(struct tg3 *tp)
11955{ 12000{
11956 u32 val, offset, start; 12001 u32 val, offset, start;
@@ -11960,8 +12005,12 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
11960 if (tg3_nvram_read_swab(tp, 0, &val)) 12005 if (tg3_nvram_read_swab(tp, 0, &val))
11961 return; 12006 return;
11962 12007
11963 if (val != TG3_EEPROM_MAGIC) 12008 if (val != TG3_EEPROM_MAGIC) {
12009 if ((val & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW)
12010 tg3_read_sb_ver(tp, val);
12011
11964 return; 12012 return;
12013 }
11965 12014
11966 if (tg3_nvram_read_swab(tp, 0xc, &offset) || 12015 if (tg3_nvram_read_swab(tp, 0xc, &offset) ||
11967 tg3_nvram_read_swab(tp, 0x4, &start)) 12016 tg3_nvram_read_swab(tp, 0x4, &start))