aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliezer Tamir <eliezert@broadcom.com>2008-02-28 14:50:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 14:50:16 -0500
commit250479504ff7d7e8c7d5cf85bedd40fb8d725429 (patch)
tree0bbcae29bc8aeed97e1050c4b5b7939830633198
parentc14423fe585a5937db6e2eece4b79486521103be (diff)
[BNX2X]: Correct init_one()
Correct PCI-E info printed by init_one() In one case it failed to free the netdev. Signed-off-by: Eliezer Tamir <eliezert@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x.c41
-rw-r--r--drivers/net/bnx2x.h5
2 files changed, 31 insertions, 15 deletions
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index 7b2d7898f06d..77867161968b 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -8873,14 +8873,32 @@ err_out:
8873 return rc; 8873 return rc;
8874} 8874}
8875 8875
8876static int __devinit bnx2x_get_pcie_width(struct bnx2x *bp)
8877{
8878 u32 val = REG_RD(bp, PCICFG_OFFSET + PCICFG_LINK_CONTROL);
8879
8880 val = (val & PCICFG_LINK_WIDTH) >> PCICFG_LINK_WIDTH_SHIFT;
8881 return val;
8882}
8883
8884/* return value of 1=2.5GHz 2=5GHz */
8885static int __devinit bnx2x_get_pcie_speed(struct bnx2x *bp)
8886{
8887 u32 val = REG_RD(bp, PCICFG_OFFSET + PCICFG_LINK_CONTROL);
8888
8889 val = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT;
8890 return val;
8891}
8892
8876static int __devinit bnx2x_init_one(struct pci_dev *pdev, 8893static int __devinit bnx2x_init_one(struct pci_dev *pdev,
8877 const struct pci_device_id *ent) 8894 const struct pci_device_id *ent)
8878{ 8895{
8879 static int version_printed; 8896 static int version_printed;
8880 struct net_device *dev = NULL; 8897 struct net_device *dev = NULL;
8881 struct bnx2x *bp; 8898 struct bnx2x *bp;
8882 int rc, i; 8899 int rc;
8883 int port = PCI_FUNC(pdev->devfn); 8900 int port = PCI_FUNC(pdev->devfn);
8901 DECLARE_MAC_BUF(mac);
8884 8902
8885 if (version_printed++ == 0) 8903 if (version_printed++ == 0)
8886 printk(KERN_INFO "%s", version); 8904 printk(KERN_INFO "%s", version);
@@ -8897,6 +8915,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
8897 8915
8898 if (port && onefunc) { 8916 if (port && onefunc) {
8899 printk(KERN_ERR PFX "second function disabled. exiting\n"); 8917 printk(KERN_ERR PFX "second function disabled. exiting\n");
8918 free_netdev(dev);
8900 return 0; 8919 return 0;
8901 } 8920 }
8902 8921
@@ -8950,22 +8969,14 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
8950 pci_set_drvdata(pdev, dev); 8969 pci_set_drvdata(pdev, dev);
8951 8970
8952 bp->name = board_info[ent->driver_data].name; 8971 bp->name = board_info[ent->driver_data].name;
8953 printk(KERN_INFO "%s: %s (%c%d) PCI%s %s %dMHz " 8972 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
8954 "found at mem %lx, IRQ %d, ", 8973 " IRQ %d, ", dev->name, bp->name,
8955 dev->name, bp->name,
8956 ((CHIP_ID(bp) & 0xf000) >> 12) + 'A', 8974 ((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
8957 ((CHIP_ID(bp) & 0x0ff0) >> 4), 8975 ((CHIP_ID(bp) & 0x0ff0) >> 4),
8958 ((bp->flags & PCIX_FLAG) ? "-X" : ""), 8976 bnx2x_get_pcie_width(bp),
8959 ((bp->flags & PCI_32BIT_FLAG) ? "32-bit" : "64-bit"), 8977 (bnx2x_get_pcie_speed(bp) == 2) ? "5GHz (Gen2)" : "2.5GHz",
8960 bp->bus_speed_mhz, 8978 dev->base_addr, bp->pdev->irq);
8961 dev->base_addr, 8979 printk(KERN_CONT "node addr %s\n", print_mac(mac, dev->dev_addr));
8962 bp->pdev->irq);
8963
8964 printk("node addr ");
8965 for (i = 0; i < 6; i++)
8966 printk("%2.2x", dev->dev_addr[i]);
8967 printk("\n");
8968
8969 return 0; 8980 return 0;
8970} 8981}
8971 8982
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 7a01668e3978..ea9100855c5c 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -867,6 +867,11 @@ struct bnx2x {
867 DPM_TRIGER_TYPE); \ 867 DPM_TRIGER_TYPE); \
868 } while (0) 868 } while (0)
869 869
870/* PCIE link and speed */
871#define PCICFG_LINK_WIDTH 0x1f00000
872#define PCICFG_LINK_WIDTH_SHIFT 20
873#define PCICFG_LINK_SPEED 0xf0000
874#define PCICFG_LINK_SPEED_SHIFT 16
870 875
871/* stuff added to make the code fit 80Col */ 876/* stuff added to make the code fit 80Col */
872 877