aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-04-05 06:19:25 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-06 06:58:01 -0400
commit184b89044fb6e2a74611dafa69b1dce0d98612c6 (patch)
tree8fc70a87ed431b3631ae328d3be1c68971c280c2
parent75f9936e1150be739a9f6577a9d34de120ea35f1 (diff)
tg3: Use VPD fw version when present
This patch extracts the firmware version from the VPD area and changes the code to prefer that version version over the manually extracted version. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4e7f3de7013f..c002b9f97cdf 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12563,11 +12563,11 @@ skip_phy_reset:
12563 return err; 12563 return err;
12564} 12564}
12565 12565
12566static void __devinit tg3_read_partno(struct tg3 *tp) 12566static void __devinit tg3_read_vpd(struct tg3 *tp)
12567{ 12567{
12568 unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */ 12568 u8 vpd_data[TG3_NVM_VPD_LEN];
12569 unsigned int block_end, rosize, len; 12569 unsigned int block_end, rosize, len;
12570 int i = 0; 12570 int j, i = 0;
12571 u32 magic; 12571 u32 magic;
12572 12572
12573 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || 12573 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
@@ -12616,6 +12616,32 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
12616 if (block_end > TG3_NVM_VPD_LEN) 12616 if (block_end > TG3_NVM_VPD_LEN)
12617 goto out_not_found; 12617 goto out_not_found;
12618 12618
12619 j = pci_vpd_find_info_keyword(vpd_data, i, rosize,
12620 PCI_VPD_RO_KEYWORD_MFR_ID);
12621 if (j > 0) {
12622 len = pci_vpd_info_field_size(&vpd_data[j]);
12623
12624 j += PCI_VPD_INFO_FLD_HDR_SIZE;
12625 if (j + len > block_end || len != 4 ||
12626 memcmp(&vpd_data[j], "1028", 4))
12627 goto partno;
12628
12629 j = pci_vpd_find_info_keyword(vpd_data, i, rosize,
12630 PCI_VPD_RO_KEYWORD_VENDOR0);
12631 if (j < 0)
12632 goto partno;
12633
12634 len = pci_vpd_info_field_size(&vpd_data[j]);
12635
12636 j += PCI_VPD_INFO_FLD_HDR_SIZE;
12637 if (j + len > block_end)
12638 goto partno;
12639
12640 memcpy(tp->fw_ver, &vpd_data[j], len);
12641 strncat(tp->fw_ver, " bc ", TG3_NVM_VPD_LEN - len - 1);
12642 }
12643
12644partno:
12619 i = pci_vpd_find_info_keyword(vpd_data, i, rosize, 12645 i = pci_vpd_find_info_keyword(vpd_data, i, rosize,
12620 PCI_VPD_RO_KEYWORD_PARTNO); 12646 PCI_VPD_RO_KEYWORD_PARTNO);
12621 if (i < 0) 12647 if (i < 0)
@@ -13626,7 +13652,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13626 tg3_mdio_fini(tp); 13652 tg3_mdio_fini(tp);
13627 } 13653 }
13628 13654
13629 tg3_read_partno(tp); 13655 tg3_read_vpd(tp);
13630 tg3_read_fw_ver(tp); 13656 tg3_read_fw_ver(tp);
13631 13657
13632 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 13658 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {