Commit 05dbe005 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/tg3.c: Use (pr|netdev)_<level> macro helpers

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove #define PFX
Use pr_<level>
Use netdev_<level>
Remove periods from most formats
Coalesce long formats
Use printk_once
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f546444d
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "tg3.h" #include "tg3.h"
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.108" #define DRV_MODULE_VERSION "3.108"
#define DRV_MODULE_RELDATE "February 17, 2010" #define DRV_MODULE_RELDATE "February 17, 2010"
...@@ -158,7 +157,7 @@ ...@@ -158,7 +157,7 @@
#define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin" #define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin"
static char version[] __devinitdata = static char version[] __devinitdata =
DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")";
MODULE_AUTHOR("David S. Miller (davem@redhat.com) and Jeff Garzik (jgarzik@pobox.com)"); MODULE_AUTHOR("David S. Miller (davem@redhat.com) and Jeff Garzik (jgarzik@pobox.com)");
MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver"); MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver");
...@@ -1099,8 +1098,7 @@ static int tg3_mdio_init(struct tg3 *tp) ...@@ -1099,8 +1098,7 @@ static int tg3_mdio_init(struct tg3 *tp)
i = mdiobus_register(tp->mdio_bus); i = mdiobus_register(tp->mdio_bus);
if (i) { if (i) {
printk(KERN_WARNING "%s: mdiobus_reg failed (0x%x)\n", netdev_warn(tp->dev, "mdiobus_reg failed (0x%x)\n", i);
tp->dev->name, i);
mdiobus_free(tp->mdio_bus); mdiobus_free(tp->mdio_bus);
return i; return i;
} }
...@@ -1108,7 +1106,7 @@ static int tg3_mdio_init(struct tg3 *tp) ...@@ -1108,7 +1106,7 @@ static int tg3_mdio_init(struct tg3 *tp)
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
if (!phydev || !phydev->drv) { if (!phydev || !phydev->drv) {
printk(KERN_WARNING "%s: No PHY devices\n", tp->dev->name); netdev_warn(tp->dev, "No PHY devices\n");
mdiobus_unregister(tp->mdio_bus); mdiobus_unregister(tp->mdio_bus);
mdiobus_free(tp->mdio_bus); mdiobus_free(tp->mdio_bus);
return -ENODEV; return -ENODEV;
...@@ -1252,27 +1250,22 @@ static void tg3_ump_link_report(struct tg3 *tp) ...@@ -1252,27 +1250,22 @@ static void tg3_ump_link_report(struct tg3 *tp)
static void tg3_link_report(struct tg3 *tp) static void tg3_link_report(struct tg3 *tp)
{ {
if (!netif_carrier_ok(tp->dev)) { if (!netif_carrier_ok(tp->dev)) {
if (netif_msg_link(tp)) netif_info(tp, link, tp->dev, "Link is down\n");
printk(KERN_INFO PFX "%s: Link is down.\n",
tp->dev->name);
tg3_ump_link_report(tp); tg3_ump_link_report(tp);
} else if (netif_msg_link(tp)) { } else if (netif_msg_link(tp)) {
printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", netdev_info(tp->dev, "Link is up at %d Mbps, %s duplex\n",
tp->dev->name, (tp->link_config.active_speed == SPEED_1000 ?
(tp->link_config.active_speed == SPEED_1000 ? 1000 :
1000 : (tp->link_config.active_speed == SPEED_100 ?
(tp->link_config.active_speed == SPEED_100 ? 100 : 10)),
100 : 10)), (tp->link_config.active_duplex == DUPLEX_FULL ?
(tp->link_config.active_duplex == DUPLEX_FULL ? "full" : "half"));
"full" : "half"));
netdev_info(tp->dev, "Flow control is %s for TX and %s for RX\n",
printk(KERN_INFO PFX (tp->link_config.active_flowctrl & FLOW_CTRL_TX) ?
"%s: Flow control is %s for TX and %s for RX.\n", "on" : "off",
tp->dev->name, (tp->link_config.active_flowctrl & FLOW_CTRL_RX) ?
(tp->link_config.active_flowctrl & FLOW_CTRL_TX) ? "on" : "off");
"on" : "off",
(tp->link_config.active_flowctrl & FLOW_CTRL_RX) ?
"on" : "off");
tg3_ump_link_report(tp); tg3_ump_link_report(tp);
} }
} }
...@@ -1471,7 +1464,7 @@ static int tg3_phy_init(struct tg3 *tp) ...@@ -1471,7 +1464,7 @@ static int tg3_phy_init(struct tg3 *tp)
phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link, phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
phydev->dev_flags, phydev->interface); phydev->dev_flags, phydev->interface);
if (IS_ERR(phydev)) { if (IS_ERR(phydev)) {
printk(KERN_ERR "%s: Could not attach to PHY\n", tp->dev->name); netdev_err(tp->dev, "Could not attach to PHY\n");
return PTR_ERR(phydev); return PTR_ERR(phydev);
} }
...@@ -2500,8 +2493,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) ...@@ -2500,8 +2493,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
break; break;
default: default:
printk(KERN_ERR PFX "%s: Invalid power state (D%d) requested\n", netdev_err(tp->dev, "Invalid power state (D%d) requested\n",
tp->dev->name, state); state);
return -EINVAL; return -EINVAL;
} }
...@@ -4342,10 +4335,8 @@ static void tg3_tx_recover(struct tg3 *tp) ...@@ -4342,10 +4335,8 @@ static void tg3_tx_recover(struct tg3 *tp)
BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) || BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) ||
tp->write32_tx_mbox == tg3_write_indirect_mbox); tp->write32_tx_mbox == tg3_write_indirect_mbox);
printk(KERN_WARNING PFX "%s: The system may be re-ordering memory-" netdev_warn(tp->dev, "The system may be re-ordering memory-mapped I/O cycles to the network device, attempting to recover\n"
"mapped I/O cycles to the network device, attempting to " "Please report the problem to the driver maintainer and include system chipset information.\n");
"recover. Please report the problem to the driver maintainer "
"and include system chipset information.\n", tp->dev->name);
spin_lock(&tp->lock); spin_lock(&tp->lock);
tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING; tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
...@@ -5269,8 +5260,7 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy) ...@@ -5269,8 +5260,7 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
err = tg3_init_hw(tp, reset_phy); err = tg3_init_hw(tp, reset_phy);
if (err) { if (err) {
printk(KERN_ERR PFX "%s: Failed to re-initialize device, " netdev_err(tp->dev, "Failed to re-initialize device, aborting\n");
"aborting.\n", tp->dev->name);
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
tg3_full_unlock(tp); tg3_full_unlock(tp);
del_timer_sync(&tp->timer); del_timer_sync(&tp->timer);
...@@ -5343,10 +5333,10 @@ static void tg3_reset_task(struct work_struct *work) ...@@ -5343,10 +5333,10 @@ static void tg3_reset_task(struct work_struct *work)
static void tg3_dump_short_state(struct tg3 *tp) static void tg3_dump_short_state(struct tg3 *tp)
{ {
printk(KERN_ERR PFX "DEBUG: MAC_TX_STATUS[%08x] MAC_RX_STATUS[%08x]\n", netdev_err(tp->dev, "DEBUG: MAC_TX_STATUS[%08x] MAC_RX_STATUS[%08x]\n",
tr32(MAC_TX_STATUS), tr32(MAC_RX_STATUS)); tr32(MAC_TX_STATUS), tr32(MAC_RX_STATUS));
printk(KERN_ERR PFX "DEBUG: RDMAC_STATUS[%08x] WDMAC_STATUS[%08x]\n", netdev_err(tp->dev, "DEBUG: RDMAC_STATUS[%08x] WDMAC_STATUS[%08x]\n",
tr32(RDMAC_STATUS), tr32(WDMAC_STATUS)); tr32(RDMAC_STATUS), tr32(WDMAC_STATUS));
} }
static void tg3_tx_timeout(struct net_device *dev) static void tg3_tx_timeout(struct net_device *dev)
...@@ -5354,8 +5344,7 @@ static void tg3_tx_timeout(struct net_device *dev) ...@@ -5354,8 +5344,7 @@ static void tg3_tx_timeout(struct net_device *dev)
struct tg3 *tp = netdev_priv(dev); struct tg3 *tp = netdev_priv(dev);
if (netif_msg_tx_err(tp)) { if (netif_msg_tx_err(tp)) {
printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", netdev_err(dev, "transmit timed out, resetting\n");
dev->name);
tg3_dump_short_state(tp); tg3_dump_short_state(tp);
} }
...@@ -5519,8 +5508,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, ...@@ -5519,8 +5508,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
netif_tx_stop_queue(txq); netif_tx_stop_queue(txq);
/* This is a hard error, log it. */ /* This is a hard error, log it. */
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
"queue awake!\n", dev->name);
} }
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -5723,8 +5711,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb, ...@@ -5723,8 +5711,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
netif_tx_stop_queue(txq); netif_tx_stop_queue(txq);
/* This is a hard error, log it. */ /* This is a hard error, log it. */
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
"queue awake!\n", dev->name);
} }
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -6071,11 +6058,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp, ...@@ -6071,11 +6058,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
/* Now allocate fresh SKBs for each rx ring. */ /* Now allocate fresh SKBs for each rx ring. */
for (i = 0; i < tp->rx_pending; i++) { for (i = 0; i < tp->rx_pending; i++) {
if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_STD, i) < 0) { if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_STD, i) < 0) {
printk(KERN_WARNING PFX netdev_warn(tp->dev, "Using a smaller RX standard ring, only %d out of %d buffers were allocated successfully\n",
"%s: Using a smaller RX standard ring, " i, tp->rx_pending);
"only %d out of %d buffers were allocated "
"successfully.\n",
tp->dev->name, i, tp->rx_pending);
if (i == 0) if (i == 0)
goto initfail; goto initfail;
tp->rx_pending = i; tp->rx_pending = i;
...@@ -6104,11 +6088,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp, ...@@ -6104,11 +6088,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
for (i = 0; i < tp->rx_jumbo_pending; i++) { for (i = 0; i < tp->rx_jumbo_pending; i++) {
if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_JUMBO, i) < 0) { if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_JUMBO, i) < 0) {
printk(KERN_WARNING PFX netdev_warn(tp->dev, "Using a smaller RX jumbo ring, only %d out of %d buffers were allocated successfully\n",
"%s: Using a smaller RX jumbo ring, " i, tp->rx_jumbo_pending);
"only %d out of %d buffers were "
"allocated successfully.\n",
tp->dev->name, i, tp->rx_jumbo_pending);
if (i == 0) if (i == 0)
goto initfail; goto initfail;
tp->rx_jumbo_pending = i; tp->rx_jumbo_pending = i;
...@@ -6452,8 +6433,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int ...@@ -6452,8 +6433,7 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int
} }
if (i == MAX_WAIT_CNT && !silent) { if (i == MAX_WAIT_CNT && !silent) {
printk(KERN_ERR PFX "tg3_stop_block timed out, " pr_err("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
"ofs=%lx enable_bit=%x\n",
ofs, enable_bit); ofs, enable_bit);
return -ENODEV; return -ENODEV;
} }
...@@ -6500,9 +6480,8 @@ static int tg3_abort_hw(struct tg3 *tp, int silent) ...@@ -6500,9 +6480,8 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
break; break;
} }
if (i >= MAX_WAIT_CNT) { if (i >= MAX_WAIT_CNT) {
printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, " netdev_err(tp->dev, "%s timed out, TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n",
"TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n", __func__, tr32(MAC_TX_MODE));
tp->dev->name, tr32(MAC_TX_MODE));
err |= -ENODEV; err |= -ENODEV;
} }
...@@ -6723,8 +6702,7 @@ static int tg3_poll_fw(struct tg3 *tp) ...@@ -6723,8 +6702,7 @@ static int tg3_poll_fw(struct tg3 *tp)
!(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
printk(KERN_INFO PFX "%s: No firmware running.\n", netdev_info(tp->dev, "No firmware running\n");
tp->dev->name);
} }
if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0) { if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0) {
...@@ -7152,10 +7130,8 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset) ...@@ -7152,10 +7130,8 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
} }
if (i >= 10000) { if (i >= 10000) {
printk(KERN_ERR PFX "tg3_reset_cpu timed out for %s, " netdev_err(tp->dev, "%s timed out, %s CPU\n",
"and %s CPU\n", __func__, offset == RX_CPU_BASE ? "RX" : "TX");
tp->dev->name,
(offset == RX_CPU_BASE ? "RX" : "TX"));
return -ENODEV; return -ENODEV;
} }
...@@ -7180,9 +7156,8 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b ...@@ -7180,9 +7156,8 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b
if (cpu_base == TX_CPU_BASE && if (cpu_base == TX_CPU_BASE &&
(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
printk(KERN_ERR PFX "tg3_load_firmware_cpu: Trying to load " netdev_err(tp->dev, "%s: Trying to load TX cpu firmware which is 5705\n",
"TX cpu firmware on %s which is 5705.\n", __func__);
tp->dev->name);
return -EINVAL; return -EINVAL;
} }
...@@ -7261,10 +7236,8 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp) ...@@ -7261,10 +7236,8 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
udelay(1000); udelay(1000);
} }
if (i >= 5) { if (i >= 5) {
printk(KERN_ERR PFX "tg3_load_firmware fails for %s " netdev_err(tp->dev, "tg3_load_firmware fails to set RX CPU PC, is %08x should be %08x\n",
"to set RX CPU PC, is %08x should be %08x\n", tr32(RX_CPU_BASE + CPU_PC), info.fw_base);
tp->dev->name, tr32(RX_CPU_BASE + CPU_PC),
info.fw_base);
return -ENODEV; return -ENODEV;
} }
tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff); tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff);
...@@ -7327,10 +7300,8 @@ static int tg3_load_tso_firmware(struct tg3 *tp) ...@@ -7327,10 +7300,8 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
udelay(1000); udelay(1000);
} }
if (i >= 5) { if (i >= 5) {
printk(KERN_ERR PFX "tg3_load_tso_firmware fails for %s " netdev_err(tp->dev, "%s fails to set CPU PC, is %08x should be %08x\n",
"to set CPU PC, is %08x should be %08x\n", __func__, tr32(cpu_base + CPU_PC), info.fw_base);
tp->dev->name, tr32(cpu_base + CPU_PC),
info.fw_base);
return -ENODEV; return -ENODEV;
} }
tw32(cpu_base + CPU_STATE, 0xffffffff); tw32(cpu_base + CPU_STATE, 0xffffffff);
...@@ -7791,8 +7762,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) ...@@ -7791,8 +7762,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
udelay(10); udelay(10);
} }
if (i >= 2000) { if (i >= 2000) {
printk(KERN_ERR PFX "tg3_reset_hw cannot enable BUFMGR for %s.\n", netdev_err(tp->dev, "%s cannot enable BUFMGR\n", __func__);
tp->dev->name);
return -ENODEV; return -ENODEV;
} }
...@@ -8655,10 +8625,8 @@ static int tg3_test_msi(struct tg3 *tp) ...@@ -8655,10 +8625,8 @@ static int tg3_test_msi(struct tg3 *tp)
return err; return err;
/* MSI test failed, go back to INTx mode */ /* MSI test failed, go back to INTx mode */
printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, " netdev_warn(tp->dev, "No interrupt was generated using MSI, switching to INTx mode\n"
"switching to INTx mode. Please report this failure to " "Please report this failure to the PCI maintainer and include system chipset information\n");
"the PCI maintainer and include system chipset information.\n",
tp->dev->name);
free_irq(tp->napi[0].irq_vec, &tp->napi[0]); free_irq(tp->napi[0].irq_vec, &tp->napi[0]);
...@@ -8691,8 +8659,8 @@ static int tg3_request_firmware(struct tg3 *tp) ...@@ -8691,8 +8659,8 @@ static int tg3_request_firmware(struct tg3 *tp)
const __be32 *fw_data; const __be32 *fw_data;
if (request_firmware(&tp->fw, tp->fw_needed, &tp->pdev->dev)) { if (request_firmware(&tp->fw, tp->fw_needed, &tp->pdev->dev)) {
printk(KERN_ERR "%s: Failed to load firmware \"%s\"\n", netdev_err(tp->dev, "Failed to load firmware \"%s\"\n",
tp->dev->name, tp->fw_needed); tp->fw_needed);
return -ENOENT; return -ENOENT;
} }
...@@ -8705,8 +8673,8 @@ static int tg3_request_firmware(struct tg3 *tp) ...@@ -8705,8 +8673,8 @@ static int tg3_request_firmware(struct tg3 *tp)
tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */ tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */
if (tp->fw_len < (tp->fw->size - 12)) { if (tp->fw_len < (tp->fw->size - 12)) {
printk(KERN_ERR "%s: bogus length %d in \"%s\"\n", netdev_err(tp->dev, "bogus length %d in \"%s\"\n",
tp->dev->name, tp->fw_len, tp->fw_needed); tp->fw_len, tp->fw_needed);
release_firmware(tp->fw); release_firmware(tp->fw);
tp->fw = NULL; tp->fw = NULL;
return -EINVAL; return -EINVAL;
...@@ -8744,9 +8712,8 @@ static bool tg3_enable_msix(struct tg3 *tp) ...@@ -8744,9 +8712,8 @@ static bool tg3_enable_msix(struct tg3 *tp)
return false; return false;
if (pci_enable_msix(tp->pdev, msix_ent, rc)) if (pci_enable_msix(tp->pdev, msix_ent, rc))
return false; return false;
printk(KERN_NOTICE netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
"%s: Requested %d MSI-X vectors, received %d\n", tp->irq_cnt, rc);
tp->dev->name, tp->irq_cnt, rc);
tp->irq_cnt = rc; tp->irq_cnt = rc;
} }
...@@ -8771,8 +8738,7 @@ static void tg3_ints_init(struct tg3 *tp) ...@@ -8771,8 +8738,7 @@ static void tg3_ints_init(struct tg3 *tp)
/* All MSI supporting chips should support tagged /* All MSI supporting chips should support tagged
* status. Assert that this is the case. * status. Assert that this is the case.
*/ */
printk(KERN_WARNING PFX "%s: MSI without TAGGED? " netdev_warn(tp->dev, "MSI without TAGGED? Not using MSI\n");
"Not using MSI.\n", tp->dev->name);
goto defcfg; goto defcfg;
} }
...@@ -8817,12 +8783,10 @@ static int tg3_open(struct net_device *dev) ...@@ -8817,12 +8783,10 @@ static int tg3_open(struct net_device *dev)
if (err) if (err)
return err; return err;
} else if (err) { } else if (err) {
printk(KERN_WARNING "%s: TSO capability disabled.\n", netdev_warn(tp->dev, "TSO capability disabled\n");
tp->dev->name);
tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE; tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
} else if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { } else if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
printk(KERN_NOTICE "%s: TSO capability restored.\n", netdev_notice(tp->dev, "TSO capability restored\n");
tp->dev->name);
tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
} }
} }
...@@ -10687,8 +10651,7 @@ static int tg3_test_registers(struct tg3 *tp) ...@@ -10687,8 +10651,7 @@ static int tg3_test_registers(struct tg3 *tp)
out: out:
if (netif_msg_hw(tp)) if (netif_msg_hw(tp))
printk(KERN_ERR PFX "Register test failed at offset %x\n", pr_err("Register test failed at offset %x\n", offset);
offset);
tw32(offset, save_val); tw32(offset, save_val);
return -EIO; return -EIO;
} }
...@@ -11815,8 +11778,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) ...@@ -11815,8 +11778,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
tp->tg3_flags |= TG3_FLAG_NVRAM; tp->tg3_flags |= TG3_FLAG_NVRAM;
if (tg3_nvram_lock(tp)) { if (tg3_nvram_lock(tp)) {
printk(KERN_WARNING PFX "%s: Cannot get nvarm lock, " netdev_warn(tp->dev, "Cannot get nvram lock, %s failed\n",
"tg3_nvram_init failed.\n", tp->dev->name); __func__);
return; return;
} }
tg3_enable_nvram_access(tp); tg3_enable_nvram_access(tp);
...@@ -13280,8 +13243,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -13280,8 +13243,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX); tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX);
if (!tp->pcix_cap) { if (!tp->pcix_cap) {
printk(KERN_ERR PFX "Cannot find PCI-X " pr_err("Cannot find PCI-X capability, aborting\n");
"capability, aborting.\n");
return -EIO; return -EIO;
} }
...@@ -13478,8 +13440,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -13478,8 +13440,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
/* Force the chip into D0. */ /* Force the chip into D0. */
err = tg3_set_power_state(tp, PCI_D0); err = tg3_set_power_state(tp, PCI_D0);
if (err) { if (err) {
printk(KERN_ERR PFX "(%s) transition to D0 failed\n", pr_err("(%s) transition to D0 failed\n", pci_name(tp->pdev));
pci_name(tp->pdev));
return err; return err;
} }
...@@ -13653,7 +13614,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -13653,7 +13614,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
err = tg3_phy_probe(tp); err = tg3_phy_probe(tp);
if (err) { if (err) {
printk(KERN_ERR PFX "(%s) phy probe failed, err %d\n", pr_err("(%s) phy probe failed, err %d\n",
pci_name(tp->pdev), err); pci_name(tp->pdev), err);
/* ... but do not return immediately ... */ /* ... but do not return immediately ... */
tg3_mdio_fini(tp); tg3_mdio_fini(tp);
...@@ -14163,7 +14124,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp) ...@@ -14163,7 +14124,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
/* Send the buffer to the chip. */ /* Send the buffer to the chip. */
ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1); ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
if (ret) { if (ret) {
printk(KERN_ERR "tg3_test_dma() Write the buffer failed %d\n", ret); pr_err("tg3_test_dma() Write the buffer failed %d\n",
ret);
break; break;
} }
...@@ -14173,7 +14135,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp) ...@@ -14173,7 +14135,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
u32 val; u32 val;
tg3_read_mem(tp, 0x2100 + (i*4), &val); tg3_read_mem(tp, 0x2100 + (i*4), &val);
if (le32_to_cpu(val) != p[i]) { if (le32_to_cpu(val) != p[i]) {
printk(KERN_ERR " tg3_test_dma() Card buffer corrupted on write! (%d != %d)\n", val, i); pr_err(" tg3_test_dma() Card buffer corrupted on write! (%d != %d)\n",
val, i);
/* ret = -ENODEV here? */ /* ret = -ENODEV here? */
} }
p[i] = 0; p[i] = 0;
...@@ -14182,7 +14145,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp) ...@@ -14182,7 +14145,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
/* Now read it back. */ /* Now read it back. */
ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0); ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
if (ret) { if (ret) {
printk(KERN_ERR "tg3_test_dma() Read the buffer failed %d\n", ret); pr_err("tg3_test_dma() Read the buffer failed %d\n",
ret);
break; break;
} }
...@@ -14199,7 +14163,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp) ...@@ -14199,7 +14163,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
break; break;
} else { } else {
printk(KERN_ERR "tg3_test_dma() buffer corrupted on read back! (%d != %d)\n", p[i], i); pr_err("tg3_test_dma() buffer corrupted on read back! (%d != %d)\n",
p[i], i);
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
...@@ -14480,7 +14445,6 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = { ...@@ -14480,7 +14445,6 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = {
static int __devinit tg3_init_one(struct pci_dev *pdev, static int __devinit tg3_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
static int tg3_version_printed = 0;
struct net_device *dev; struct net_device *dev;
struct tg3 *tp; struct tg3 *tp;
int i, err, pm_cap; int i, err, pm_cap;
...@@ -14488,20 +14452,17 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14488,20 +14452,17 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
char str[40]; char str[40];
u64 dma_mask, persist_dma_mask; u64 dma_mask, persist_dma_mask;
if (tg3_version_printed++ == 0) printk_once(KERN_INFO "%s\n", version);
printk(KERN_INFO "%s", version);
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) { if (err) {
printk(KERN_ERR PFX "Cannot enable PCI device, " pr_err("Cannot enable PCI device, aborting\n");
"aborting.\n");
return err; return err;
} }
err = pci_request_regions(pdev, DRV_MODULE_NAME); err = pci_request_regions(pdev, DRV_MODULE_NAME);
if (err) { if (err) {
printk(KERN_ERR PFX "Cannot obtain PCI resources, " pr_err("Cannot obtain PCI resources, aborting\n");
"aborting.\n");
goto err_out_disable_pdev; goto err_out_disable_pdev;
} }
...@@ -14510,15 +14471,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14510,15 +14471,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
/* Find power-management capability. */ /* Find power-management capability. */
pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
if (pm_cap == 0) { if (pm_cap == 0) {
printk(KERN_ERR PFX "Cannot find PowerManagement capability, " pr_err("Cannot find PowerManagement capability, aborting\n");
"aborting.\n");
err = -EIO; err = -EIO;
goto err_out_free_res; goto err_out_free_res;
} }
dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS); dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
if (!dev) { if (!dev) {
printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); pr_err("Etherdev alloc failed, aborting\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out_free_res; goto err_out_free_res;
} }
...@@ -14568,8 +14528,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14568,8 +14528,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
tp->regs = pci_ioremap_bar(pdev, BAR_0); tp->regs = pci_ioremap_bar(pdev, BAR_0);
if (!tp->regs) { if (!tp->regs) {
printk(KERN_ERR PFX "Cannot map device registers, " netdev_err(dev, "Cannot map device registers, aborting\n");
"aborting.\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out_free_dev; goto err_out_free_dev;
} }
...@@ -14585,8 +14544,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14585,8 +14544,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = tg3_get_invariants(tp); err = tg3_get_invariants(tp);
if (err) { if (err) {
printk(KERN_ERR PFX "Problem fetching invariants of chip, " netdev_err(dev, "Problem fetching invariants of chip, aborting\n");
"aborting.\n");
goto err_out_iounmap; goto err_out_iounmap;
} }
...@@ -14621,8 +14579,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14621,8 +14579,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = pci_set_consistent_dma_mask(pdev, err = pci_set_consistent_dma_mask(pdev,
persist_dma_mask); persist_dma_mask);
if (err < 0) { if (err < 0) {
printk(KERN_ERR PFX "Unable to obtain 64 bit " netdev_err(dev, "Unable to obtain 64 bit DMA for consistent allocations\n");
"DMA for consistent allocations\n");
goto err_out_iounmap; goto err_out_iounmap;
} }
} }
...@@ -14630,8 +14587,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14630,8 +14587,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
if (err || dma_mask == DMA_BIT_MASK(32)) { if (err || dma_mask == DMA_BIT_MASK(32)) {
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) { if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, " netdev_err(dev, "No usable DMA configuration, aborting\n");
"aborting.\n");
goto err_out_iounmap; goto err_out_iounmap;
} }
} }
...@@ -14680,16 +14636,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14680,16 +14636,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = tg3_get_device_address(tp); err = tg3_get_device_address(tp);
if (err) { if (err) {
printk(KERN_ERR PFX "Could not obtain valid ethernet address, " netdev_err(dev, "Could not obtain valid ethernet address, aborting\n");
"aborting.\n");
goto err_out_iounmap; goto err_out_iounmap;
} }
if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
tp->aperegs = pci_ioremap_bar(pdev, BAR_2); tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
if (!tp->aperegs) { if (!tp->aperegs) {
printk(KERN_ERR PFX "Cannot map APE registers, " netdev_err(dev, "Cannot map APE registers, aborting\n");
"aborting.\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out_iounmap; goto err_out_iounmap;
} }
...@@ -14713,7 +14667,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14713,7 +14667,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = tg3_test_dma(tp); err = tg3_test_dma(tp);
if (err) { if (err) {
printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); netdev_err(dev, "DMA engine test failed, aborting\n");
goto err_out_apeunmap; goto err_out_apeunmap;
} }
...@@ -14774,45 +14728,39 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -14774,45 +14728,39 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
printk(KERN_ERR PFX "Cannot register net device, " netdev_err(dev, "Cannot register net device, aborting\n");
"aborting.\n");
goto err_out_apeunmap; goto err_out_apeunmap;
} }
printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n", netdev_info(dev, "Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n",
dev->name, tp->board_part_number,
tp->board_part_number, tp->pci_chip_rev_id,
tp->pci_chip_rev_id, tg3_bus_string(tp, str),
tg3_bus_string(tp, str), dev->dev_addr);
dev->dev_addr);
if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) { if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) {
struct phy_device *phydev; struct phy_device *phydev;
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
printk(KERN_INFO netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
"%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", phydev->drv->name, dev_name(&phydev->dev));
tp->dev->name, phydev->drv->name,
dev_name(&phydev->dev));
} else } else
printk(KERN_INFO netdev_info(dev, "attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n",
"%s: attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n", tg3_phy_string(tp),
tp->dev->name, tg3_phy_string(tp), ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" :
((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" : ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" :
((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" : "10/100/1000Base-T")),
"10/100/1000Base-T")), (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0);
(tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0);
netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n",
printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n", (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
dev->name, (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
(tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0,
(tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
(tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, netdev_info(dev, "dma_rwctrl[%08x] dma_mask[%d-bit]\n",
(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); tp->dma_rwctrl,
printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", pdev->dma_mask == DMA_BIT_MASK(32) ? 32 :
dev->name, tp->dma_rwctrl, ((u64)pdev->dma_mask) == DMA_BIT_MASK(40) ? 40 : 64);
(pdev->dma_mask == DMA_BIT_MASK(32)) ? 32 :
(((u64) pdev->dma_mask == DMA_BIT_MASK(40)) ? 40 : 64));
return 0; return 0;
......
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