提交 ff3a7cb2 编写于 作者: M Matt Carlson 提交者: David S. Miller

tg3: Add legacy bootcode version decoding

This patch adds code to obtain the bootcode version for versions
of bootcode that do not use the new method.
Signed-off-by: NMatt Carlson <mcarlson@broadcom.com>
Signed-off-by: NBenjamin Li <benli@broadcom.com>
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 acd9c119
...@@ -11463,8 +11463,9 @@ static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset) ...@@ -11463,8 +11463,9 @@ static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset)
static void __devinit tg3_read_bc_ver(struct tg3 *tp) static void __devinit tg3_read_bc_ver(struct tg3 *tp)
{ {
u32 offset, start, ver_offset; u32 val, offset, start, ver_offset;
int i; int i;
bool newver = false;
if (tg3_nvram_read(tp, 0xc, &offset) || if (tg3_nvram_read(tp, 0xc, &offset) ||
tg3_nvram_read(tp, 0x4, &start)) tg3_nvram_read(tp, 0x4, &start))
...@@ -11472,8 +11473,19 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp) ...@@ -11472,8 +11473,19 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp)
offset = tg3_nvram_logical_addr(tp, offset); offset = tg3_nvram_logical_addr(tp, offset);
if (!tg3_fw_img_is_valid(tp, offset) || if (tg3_nvram_read(tp, offset, &val))
tg3_nvram_read(tp, offset + 8, &ver_offset)) return;
if ((val & 0xfc000000) == 0x0c000000) {
if (tg3_nvram_read(tp, offset + 4, &val))
return;
if (val == 0)
newver = true;
}
if (newver) {
if (tg3_nvram_read(tp, offset + 8, &ver_offset))
return; return;
offset = offset + ver_offset - start; offset = offset + ver_offset - start;
...@@ -11484,6 +11496,17 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp) ...@@ -11484,6 +11496,17 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp)
memcpy(tp->fw_ver + i, &v, sizeof(v)); memcpy(tp->fw_ver + i, &v, sizeof(v));
} }
} else {
u32 major, minor;
if (tg3_nvram_read(tp, TG3_NVM_PTREV_BCVER, &ver_offset))
return;
major = (ver_offset & TG3_NVM_BCVER_MAJMSK) >>
TG3_NVM_BCVER_MAJSFT;
minor = ver_offset & TG3_NVM_BCVER_MINMSK;
snprintf(&tp->fw_ver[0], 32, "v%d.%02d", major, minor);
}
} }
static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val) static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val)
......
...@@ -1737,6 +1737,10 @@ ...@@ -1737,6 +1737,10 @@
#define TG3_NVM_DIRENT_SIZE 0xc #define TG3_NVM_DIRENT_SIZE 0xc
#define TG3_NVM_DIRTYPE_SHIFT 24 #define TG3_NVM_DIRTYPE_SHIFT 24
#define TG3_NVM_DIRTYPE_ASFINI 1 #define TG3_NVM_DIRTYPE_ASFINI 1
#define TG3_NVM_PTREV_BCVER 0x94
#define TG3_NVM_BCVER_MAJMSK 0x0000ff00
#define TG3_NVM_BCVER_MAJSFT 8
#define TG3_NVM_BCVER_MINMSK 0x000000ff
#define TG3_EEPROM_SB_F1R0_EDH_OFF 0x10 #define TG3_EEPROM_SB_F1R0_EDH_OFF 0x10
#define TG3_EEPROM_SB_F1R2_EDH_OFF 0x14 #define TG3_EEPROM_SB_F1R2_EDH_OFF 0x14
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册