diff options
-rw-r--r-- | drivers/net/tg3.c | 34 |
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 | ||
12566 | static void __devinit tg3_read_partno(struct tg3 *tp) | 12566 | static 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 | |||
12644 | partno: | ||
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) { |