aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-02-26 09:04:41 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-28 03:43:32 -0500
commitb55ac1b22690d2e5b02a61cf6d69c2d66969c79d (patch)
treed336b38719dba482e2734f2091f5a60dfcb134b4 /drivers/net/tg3.c
parent7ad506fa1adc2da3d394c562f09b8e1b3026c402 (diff)
pci: Add helper to find a VPD resource data type
This patch adds the pci_vpd_find_tag() helper function to find VPD resource data types in a buffer. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ed57a62b3ac8..76ad141ab448 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12547,7 +12547,7 @@ skip_phy_reset:
12547static void __devinit tg3_read_partno(struct tg3 *tp) 12547static void __devinit tg3_read_partno(struct tg3 *tp)
12548{ 12548{
12549 unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */ 12549 unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */
12550 unsigned int i; 12550 int i;
12551 u32 magic; 12551 u32 magic;
12552 12552
12553 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || 12553 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
@@ -12586,28 +12586,12 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
12586 12586
12587 /* Now parse and find the part number. */ 12587 /* Now parse and find the part number. */
12588 for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) { 12588 for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) {
12589 unsigned char val = vpd_data[i];
12590 unsigned int block_end; 12589 unsigned int block_end;
12591 12590
12592 if (val & PCI_VPD_LRDT) { 12591 i = pci_vpd_find_tag(vpd_data, i, TG3_NVM_VPD_LEN,
12593 if (i + PCI_VPD_LRDT_TAG_SIZE > TG3_NVM_VPD_LEN) 12592 PCI_VPD_LRDT_RO_DATA);
12594 break; 12593 if (i < 0)
12595 12594 break;
12596 if (val != PCI_VPD_LRDT_RO_DATA) {
12597 i += PCI_VPD_LRDT_TAG_SIZE +
12598 pci_vpd_lrdt_size(&vpd_data[i]);
12599
12600 continue;
12601 }
12602 } else {
12603 if ((val & PCI_VPD_SRDT_TIN_MASK) == PCI_VPD_STIN_END)
12604 break;
12605
12606 i += PCI_VPD_SRDT_TAG_SIZE +
12607 pci_vpd_srdt_size(&vpd_data[i]);
12608
12609 continue;
12610 }
12611 12595
12612 block_end = i + PCI_VPD_LRDT_TAG_SIZE + 12596 block_end = i + PCI_VPD_LRDT_TAG_SIZE +
12613 pci_vpd_lrdt_size(&vpd_data[i]); 12597 pci_vpd_lrdt_size(&vpd_data[i]);