Commit 3f88ce49 authored by Jeff Garzik's avatar Jeff Garzik

[netdrvr] forcedeth: improved probe info; dev_printk() cleanups

main change:
* greatly improve per-NIC probe diagnostic output.  Similar to other
  net drivers, print out MAC address, PHY info, and various hardware and
  software flags that may be relevant.

other changes:
* similar to other net drivers, only print the initial version message
  when we have found at least one board.

* don't bother to print error message when pci_enable_device() fails,
  it will do so for us.

* use dev_printk() rather than printk() in nv_probe().  This gives
  use a standardized output similar to the rest of the kernel, and
  eliminates the need to manually print out PCI bus id.

* use DRV_NAME constant where appropriate

* clean struct pci_driver indentation
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent bcb5febb
...@@ -3729,7 +3729,7 @@ static void nv_do_stats_poll(unsigned long data) ...@@ -3729,7 +3729,7 @@ static void nv_do_stats_poll(unsigned long data)
static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct fe_priv *np = netdev_priv(dev); struct fe_priv *np = netdev_priv(dev);
strcpy(info->driver, "forcedeth"); strcpy(info->driver, DRV_NAME);
strcpy(info->version, FORCEDETH_VERSION); strcpy(info->version, FORCEDETH_VERSION);
strcpy(info->bus_info, pci_name(np->pci_dev)); strcpy(info->bus_info, pci_name(np->pci_dev));
} }
...@@ -4993,6 +4993,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -4993,6 +4993,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
u32 phystate_orig = 0, phystate; u32 phystate_orig = 0, phystate;
int phyinitialized = 0; int phyinitialized = 0;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
static int printed_version;
if (!printed_version++)
printk(KERN_INFO "%s: Reverse Engineered nForce ethernet"
" driver. Version %s.\n", DRV_NAME, FORCEDETH_VERSION);
dev = alloc_etherdev(sizeof(struct fe_priv)); dev = alloc_etherdev(sizeof(struct fe_priv));
err = -ENOMEM; err = -ENOMEM;
...@@ -5016,11 +5021,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5016,11 +5021,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
np->stats_poll.function = &nv_do_stats_poll; /* timer handler */ np->stats_poll.function = &nv_do_stats_poll; /* timer handler */
err = pci_enable_device(pci_dev); err = pci_enable_device(pci_dev);
if (err) { if (err)
printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n",
err, pci_name(pci_dev));
goto out_free; goto out_free;
}
pci_set_master(pci_dev); pci_set_master(pci_dev);
...@@ -5049,8 +5051,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5049,8 +5051,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
} }
} }
if (i == DEVICE_COUNT_RESOURCE) { if (i == DEVICE_COUNT_RESOURCE) {
printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n", dev_printk(KERN_INFO, &pci_dev->dev,
pci_name(pci_dev)); "Couldn't find register window\n");
goto out_relreg; goto out_relreg;
} }
...@@ -5063,16 +5065,14 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5063,16 +5065,14 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
np->desc_ver = DESC_VER_3; np->desc_ver = DESC_VER_3;
np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; np->txrxctl_bits = NVREG_TXRXCTL_DESC_3;
if (dma_64bit) { if (dma_64bit) {
if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) { if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK))
printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", dev_printk(KERN_INFO, &pci_dev->dev,
pci_name(pci_dev)); "64-bit DMA failed, using 32-bit addressing\n");
} else { else
dev->features |= NETIF_F_HIGHDMA; dev->features |= NETIF_F_HIGHDMA;
printk(KERN_INFO "forcedeth: using HIGHDMA\n");
}
if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) { if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) {
printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed, using 32-bit ring buffers for device %s.\n", dev_printk(KERN_INFO, &pci_dev->dev,
pci_name(pci_dev)); "64-bit DMA (consistent) failed, using 32-bit ring buffers\n");
} }
} }
} else if (id->driver_data & DEV_HAS_LARGEDESC) { } else if (id->driver_data & DEV_HAS_LARGEDESC) {
...@@ -5207,9 +5207,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5207,9 +5207,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
* Bad mac address. At least one bios sets the mac address * Bad mac address. At least one bios sets the mac address
* to 01:23:45:67:89:ab * to 01:23:45:67:89:ab
*/ */
printk(KERN_ERR "%s: Invalid Mac address detected: %s\n", dev_printk(KERN_ERR, &pci_dev->dev,
pci_name(pci_dev), print_mac(mac, dev->dev_addr)); "Invalid Mac address detected: %s\n",
printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n"); print_mac(mac, dev->dev_addr));
dev_printk(KERN_ERR, &pci_dev->dev,
"Please complain to your hardware vendor. Switching to a random MAC.\n");
dev->dev_addr[0] = 0x00; dev->dev_addr[0] = 0x00;
dev->dev_addr[1] = 0x00; dev->dev_addr[1] = 0x00;
dev->dev_addr[2] = 0x6c; dev->dev_addr[2] = 0x6c;
...@@ -5323,8 +5325,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5323,8 +5325,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
break; break;
} }
if (i == 33) { if (i == 33) {
printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", dev_printk(KERN_INFO, &pci_dev->dev,
pci_name(pci_dev)); "open: Could not find a valid PHY.\n");
goto out_error; goto out_error;
} }
...@@ -5346,12 +5348,37 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i ...@@ -5346,12 +5348,37 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err); dev_printk(KERN_INFO, &pci_dev->dev,
"unable to register netdev: %d\n", err);
goto out_error; goto out_error;
} }
printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n",
dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device, dev_printk(KERN_INFO, &pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, "
pci_name(pci_dev)); "addr %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
dev->name,
np->phy_oui,
np->phyaddr,
dev->dev_addr[0],
dev->dev_addr[1],
dev->dev_addr[2],
dev->dev_addr[3],
dev->dev_addr[4],
dev->dev_addr[5]);
dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ?
"csum " : "",
dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
"vlan " : "",
id->driver_data & DEV_HAS_POWER_CNTRL ? "pwrctl " : "",
id->driver_data & DEV_HAS_MGMT_UNIT ? "mgmt " : "",
id->driver_data & DEV_NEED_TIMERIRQ ? "timirq " : "",
np->gigabit == PHY_GIGABIT ? "gbit " : "",
np->need_linktimer ? "lnktim " : "",
np->msi_flags & NV_MSI_CAPABLE ? "msi " : "",
np->msi_flags & NV_MSI_X_CAPABLE ? "msi-x " : "",
np->desc_ver);
return 0; return 0;
...@@ -5569,17 +5596,16 @@ static struct pci_device_id pci_tbl[] = { ...@@ -5569,17 +5596,16 @@ static struct pci_device_id pci_tbl[] = {
}; };
static struct pci_driver driver = { static struct pci_driver driver = {
.name = "forcedeth", .name = DRV_NAME,
.id_table = pci_tbl, .id_table = pci_tbl,
.probe = nv_probe, .probe = nv_probe,
.remove = __devexit_p(nv_remove), .remove = __devexit_p(nv_remove),
.suspend = nv_suspend, .suspend = nv_suspend,
.resume = nv_resume, .resume = nv_resume,
}; };
static int __init init_nic(void) static int __init init_nic(void)
{ {
printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION);
return pci_register_driver(&driver); return pci_register_driver(&driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment