Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184555
b: refs/heads/master
c: a2ce766
h: refs/heads/master
i:
  184553: 8a2150f
  184551: 74d6672
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Feb 28, 2010
1 parent ff8e25a commit cfa728f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ea186ae533c7b4f4c56811b69d3e40a6209a9c0
refs/heads/master: a2ce766238f72ff7337606c0bc96803c30c9e05c
8 changes: 5 additions & 3 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7773,15 +7773,17 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
unsigned int block_end;

if (val == 0x82 || val == 0x91) {
i = (i + 3 + (data[i + 1] + (data[i + 2] << 8)));
i += PCI_VPD_LRDT_TAG_SIZE +
pci_vpd_lrdt_size(&data[i]);
continue;
}

if (val != 0x90)
goto vpd_done;

block_end = (i + 3 + (data[i + 1] + (data[i + 2] << 8)));
i += 3;
block_end = (i + PCI_VPD_LRDT_TAG_SIZE +
pci_vpd_lrdt_size(&data[i]));
i += PCI_VPD_LRDT_TAG_SIZE;

if (block_end > BNX2_VPD_LEN)
goto vpd_done;
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -12590,19 +12590,18 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
unsigned int block_end;

if (val == 0x82 || val == 0x91) {
i = (i + 3 +
(vpd_data[i + 1] +
(vpd_data[i + 2] << 8)));
i += PCI_VPD_LRDT_TAG_SIZE +
pci_vpd_lrdt_size(&vpd_data[i]);
continue;
}

if (val != 0x90)
goto out_not_found;

block_end = (i + 3 +
(vpd_data[i + 1] +
(vpd_data[i + 2] << 8)));
i += 3;
block_end = i + PCI_VPD_LRDT_TAG_SIZE +
pci_vpd_lrdt_size(&vpd_data[i]);

i += PCI_VPD_LRDT_TAG_SIZE;

if (block_end > TG3_NVM_VPD_LEN)
goto out_not_found;
Expand Down
14 changes: 14 additions & 0 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1349,5 +1349,19 @@ static inline bool pci_is_pcie(struct pci_dev *dev)

void pci_request_acs(void);


#define PCI_VPD_LRDT_TAG_SIZE 3

/**
* pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
* @lrdt: Pointer to the beginning of the Large Resource Data Type tag
*
* Returns the extracted Large Resource Data Type length.
*/
static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
{
return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
}

#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */

0 comments on commit cfa728f

Please sign in to comment.