diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-16 04:09:09 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-16 20:50:10 -0400 |
commit | 3f88ce495b11bb4a68e4f291e8dc3057a1cf9daf (patch) | |
tree | 55f17b62c1dd0227a3d64c133e42abff1e21a09d /drivers | |
parent | bcb5febb248f7cc1e4a39ff61507f6343ba1c594 (diff) |
[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: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/forcedeth.c | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 2e708150b014..16f7a07d89d9 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3729,7 +3729,7 @@ static void nv_do_stats_poll(unsigned long data) | |||
3729 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 3729 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
3730 | { | 3730 | { |
3731 | struct fe_priv *np = netdev_priv(dev); | 3731 | struct fe_priv *np = netdev_priv(dev); |
3732 | strcpy(info->driver, "forcedeth"); | 3732 | strcpy(info->driver, DRV_NAME); |
3733 | strcpy(info->version, FORCEDETH_VERSION); | 3733 | strcpy(info->version, FORCEDETH_VERSION); |
3734 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 3734 | strcpy(info->bus_info, pci_name(np->pci_dev)); |
3735 | } | 3735 | } |
@@ -4993,6 +4993,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4993 | u32 phystate_orig = 0, phystate; | 4993 | u32 phystate_orig = 0, phystate; |
4994 | int phyinitialized = 0; | 4994 | int phyinitialized = 0; |
4995 | DECLARE_MAC_BUF(mac); | 4995 | DECLARE_MAC_BUF(mac); |
4996 | static int printed_version; | ||
4997 | |||
4998 | if (!printed_version++) | ||
4999 | printk(KERN_INFO "%s: Reverse Engineered nForce ethernet" | ||
5000 | " driver. Version %s.\n", DRV_NAME, FORCEDETH_VERSION); | ||
4996 | 5001 | ||
4997 | dev = alloc_etherdev(sizeof(struct fe_priv)); | 5002 | dev = alloc_etherdev(sizeof(struct fe_priv)); |
4998 | err = -ENOMEM; | 5003 | err = -ENOMEM; |
@@ -5016,11 +5021,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5016 | np->stats_poll.function = &nv_do_stats_poll; /* timer handler */ | 5021 | np->stats_poll.function = &nv_do_stats_poll; /* timer handler */ |
5017 | 5022 | ||
5018 | err = pci_enable_device(pci_dev); | 5023 | err = pci_enable_device(pci_dev); |
5019 | if (err) { | 5024 | if (err) |
5020 | printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n", | ||
5021 | err, pci_name(pci_dev)); | ||
5022 | goto out_free; | 5025 | goto out_free; |
5023 | } | ||
5024 | 5026 | ||
5025 | pci_set_master(pci_dev); | 5027 | pci_set_master(pci_dev); |
5026 | 5028 | ||
@@ -5049,8 +5051,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5049 | } | 5051 | } |
5050 | } | 5052 | } |
5051 | if (i == DEVICE_COUNT_RESOURCE) { | 5053 | if (i == DEVICE_COUNT_RESOURCE) { |
5052 | printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n", | 5054 | dev_printk(KERN_INFO, &pci_dev->dev, |
5053 | pci_name(pci_dev)); | 5055 | "Couldn't find register window\n"); |
5054 | goto out_relreg; | 5056 | goto out_relreg; |
5055 | } | 5057 | } |
5056 | 5058 | ||
@@ -5063,16 +5065,14 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5063 | np->desc_ver = DESC_VER_3; | 5065 | np->desc_ver = DESC_VER_3; |
5064 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; | 5066 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; |
5065 | if (dma_64bit) { | 5067 | if (dma_64bit) { |
5066 | if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) { | 5068 | if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) |
5067 | printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", | 5069 | dev_printk(KERN_INFO, &pci_dev->dev, |
5068 | pci_name(pci_dev)); | 5070 | "64-bit DMA failed, using 32-bit addressing\n"); |
5069 | } else { | 5071 | else |
5070 | dev->features |= NETIF_F_HIGHDMA; | 5072 | dev->features |= NETIF_F_HIGHDMA; |
5071 | printk(KERN_INFO "forcedeth: using HIGHDMA\n"); | ||
5072 | } | ||
5073 | if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) { | 5073 | if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) { |
5074 | printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed, using 32-bit ring buffers for device %s.\n", | 5074 | dev_printk(KERN_INFO, &pci_dev->dev, |
5075 | pci_name(pci_dev)); | 5075 | "64-bit DMA (consistent) failed, using 32-bit ring buffers\n"); |
5076 | } | 5076 | } |
5077 | } | 5077 | } |
5078 | } else if (id->driver_data & DEV_HAS_LARGEDESC) { | 5078 | } 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 | * Bad mac address. At least one bios sets the mac address | 5207 | * Bad mac address. At least one bios sets the mac address |
5208 | * to 01:23:45:67:89:ab | 5208 | * to 01:23:45:67:89:ab |
5209 | */ | 5209 | */ |
5210 | printk(KERN_ERR "%s: Invalid Mac address detected: %s\n", | 5210 | dev_printk(KERN_ERR, &pci_dev->dev, |
5211 | pci_name(pci_dev), print_mac(mac, dev->dev_addr)); | 5211 | "Invalid Mac address detected: %s\n", |
5212 | printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n"); | 5212 | print_mac(mac, dev->dev_addr)); |
5213 | dev_printk(KERN_ERR, &pci_dev->dev, | ||
5214 | "Please complain to your hardware vendor. Switching to a random MAC.\n"); | ||
5213 | dev->dev_addr[0] = 0x00; | 5215 | dev->dev_addr[0] = 0x00; |
5214 | dev->dev_addr[1] = 0x00; | 5216 | dev->dev_addr[1] = 0x00; |
5215 | dev->dev_addr[2] = 0x6c; | 5217 | 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 | break; | 5325 | break; |
5324 | } | 5326 | } |
5325 | if (i == 33) { | 5327 | if (i == 33) { |
5326 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", | 5328 | dev_printk(KERN_INFO, &pci_dev->dev, |
5327 | pci_name(pci_dev)); | 5329 | "open: Could not find a valid PHY.\n"); |
5328 | goto out_error; | 5330 | goto out_error; |
5329 | } | 5331 | } |
5330 | 5332 | ||
@@ -5346,12 +5348,37 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5346 | 5348 | ||
5347 | err = register_netdev(dev); | 5349 | err = register_netdev(dev); |
5348 | if (err) { | 5350 | if (err) { |
5349 | printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err); | 5351 | dev_printk(KERN_INFO, &pci_dev->dev, |
5352 | "unable to register netdev: %d\n", err); | ||
5350 | goto out_error; | 5353 | goto out_error; |
5351 | } | 5354 | } |
5352 | printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n", | 5355 | |
5353 | dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device, | 5356 | dev_printk(KERN_INFO, &pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, " |
5354 | pci_name(pci_dev)); | 5357 | "addr %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", |
5358 | dev->name, | ||
5359 | np->phy_oui, | ||
5360 | np->phyaddr, | ||
5361 | dev->dev_addr[0], | ||
5362 | dev->dev_addr[1], | ||
5363 | dev->dev_addr[2], | ||
5364 | dev->dev_addr[3], | ||
5365 | dev->dev_addr[4], | ||
5366 | dev->dev_addr[5]); | ||
5367 | |||
5368 | dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n", | ||
5369 | dev->features & NETIF_F_HIGHDMA ? "highdma " : "", | ||
5370 | dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ? | ||
5371 | "csum " : "", | ||
5372 | dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ? | ||
5373 | "vlan " : "", | ||
5374 | id->driver_data & DEV_HAS_POWER_CNTRL ? "pwrctl " : "", | ||
5375 | id->driver_data & DEV_HAS_MGMT_UNIT ? "mgmt " : "", | ||
5376 | id->driver_data & DEV_NEED_TIMERIRQ ? "timirq " : "", | ||
5377 | np->gigabit == PHY_GIGABIT ? "gbit " : "", | ||
5378 | np->need_linktimer ? "lnktim " : "", | ||
5379 | np->msi_flags & NV_MSI_CAPABLE ? "msi " : "", | ||
5380 | np->msi_flags & NV_MSI_X_CAPABLE ? "msi-x " : "", | ||
5381 | np->desc_ver); | ||
5355 | 5382 | ||
5356 | return 0; | 5383 | return 0; |
5357 | 5384 | ||
@@ -5569,17 +5596,16 @@ static struct pci_device_id pci_tbl[] = { | |||
5569 | }; | 5596 | }; |
5570 | 5597 | ||
5571 | static struct pci_driver driver = { | 5598 | static struct pci_driver driver = { |
5572 | .name = "forcedeth", | 5599 | .name = DRV_NAME, |
5573 | .id_table = pci_tbl, | 5600 | .id_table = pci_tbl, |
5574 | .probe = nv_probe, | 5601 | .probe = nv_probe, |
5575 | .remove = __devexit_p(nv_remove), | 5602 | .remove = __devexit_p(nv_remove), |
5576 | .suspend = nv_suspend, | 5603 | .suspend = nv_suspend, |
5577 | .resume = nv_resume, | 5604 | .resume = nv_resume, |
5578 | }; | 5605 | }; |
5579 | 5606 | ||
5580 | static int __init init_nic(void) | 5607 | static int __init init_nic(void) |
5581 | { | 5608 | { |
5582 | printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION); | ||
5583 | return pci_register_driver(&driver); | 5609 | return pci_register_driver(&driver); |
5584 | } | 5610 | } |
5585 | 5611 | ||