aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-17 14:44:19 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-18 18:43:11 -0500
commit05dbe005386e7521153dce6c5ad95c98b73b80c7 (patch)
treed992eccdd74bc0e549efaa4ae8194a91f4a698eb
parentf546444d0b4f46d812a374a6eb2c46b7d24541f4 (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c270
1 files changed, 109 insertions, 161 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ddf66155f5e2..f204f73c4f99 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -67,7 +67,6 @@
67#include "tg3.h" 67#include "tg3.h"
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.108" 70#define DRV_MODULE_VERSION "3.108"
72#define DRV_MODULE_RELDATE "February 17, 2010" 71#define DRV_MODULE_RELDATE "February 17, 2010"
73 72
@@ -158,7 +157,7 @@
158#define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin" 157#define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin"
159 158
160static char version[] __devinitdata = 159static char version[] __devinitdata =
161 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 160 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")";
162 161
163MODULE_AUTHOR("David S. Miller (davem@redhat.com) and Jeff Garzik (jgarzik@pobox.com)"); 162MODULE_AUTHOR("David S. Miller (davem@redhat.com) and Jeff Garzik (jgarzik@pobox.com)");
164MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver"); 163MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver");
@@ -1099,8 +1098,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1099 1098
1100 i = mdiobus_register(tp->mdio_bus); 1099 i = mdiobus_register(tp->mdio_bus);
1101 if (i) { 1100 if (i) {
1102 printk(KERN_WARNING "%s: mdiobus_reg failed (0x%x)\n", 1101 netdev_warn(tp->dev, "mdiobus_reg failed (0x%x)\n", i);
1103 tp->dev->name, i);
1104 mdiobus_free(tp->mdio_bus); 1102 mdiobus_free(tp->mdio_bus);
1105 return i; 1103 return i;
1106 } 1104 }
@@ -1108,7 +1106,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1108 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 1106 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
1109 1107
1110 if (!phydev || !phydev->drv) { 1108 if (!phydev || !phydev->drv) {
1111 printk(KERN_WARNING "%s: No PHY devices\n", tp->dev->name); 1109 netdev_warn(tp->dev, "No PHY devices\n");
1112 mdiobus_unregister(tp->mdio_bus); 1110 mdiobus_unregister(tp->mdio_bus);
1113 mdiobus_free(tp->mdio_bus); 1111 mdiobus_free(tp->mdio_bus);
1114 return -ENODEV; 1112 return -ENODEV;
@@ -1252,27 +1250,22 @@ static void tg3_ump_link_report(struct tg3 *tp)
1252static void tg3_link_report(struct tg3 *tp) 1250static void tg3_link_report(struct tg3 *tp)
1253{ 1251{
1254 if (!netif_carrier_ok(tp->dev)) { 1252 if (!netif_carrier_ok(tp->dev)) {
1255 if (netif_msg_link(tp)) 1253 netif_info(tp, link, tp->dev, "Link is down\n");
1256 printk(KERN_INFO PFX "%s: Link is down.\n",
1257 tp->dev->name);
1258 tg3_ump_link_report(tp); 1254 tg3_ump_link_report(tp);
1259 } else if (netif_msg_link(tp)) { 1255 } else if (netif_msg_link(tp)) {
1260 printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", 1256 netdev_info(tp->dev, "Link is up at %d Mbps, %s duplex\n",
1261 tp->dev->name, 1257 (tp->link_config.active_speed == SPEED_1000 ?
1262 (tp->link_config.active_speed == SPEED_1000 ? 1258 1000 :
1263 1000 : 1259 (tp->link_config.active_speed == SPEED_100 ?
1264 (tp->link_config.active_speed == SPEED_100 ? 1260 100 : 10)),
1265 100 : 10)), 1261 (tp->link_config.active_duplex == DUPLEX_FULL ?
1266 (tp->link_config.active_duplex == DUPLEX_FULL ? 1262 "full" : "half"));
1267 "full" : "half")); 1263
1268 1264 netdev_info(tp->dev, "Flow control is %s for TX and %s for RX\n",
1269 printk(KERN_INFO PFX 1265 (tp->link_config.active_flowctrl & FLOW_CTRL_TX) ?
1270 "%s: Flow control is %s for TX and %s for RX.\n", 1266 "on" : "off",
1271 tp->dev->name, 1267 (tp->link_config.active_flowctrl & FLOW_CTRL_RX) ?
1272 (tp->link_config.active_flowctrl & FLOW_CTRL_TX) ? 1268 "on" : "off");
1273 "on" : "off",
1274 (tp->link_config.active_flowctrl & FLOW_CTRL_RX) ?
1275 "on" : "off");
1276 tg3_ump_link_report(tp); 1269 tg3_ump_link_report(tp);
1277 } 1270 }
1278} 1271}
@@ -1471,7 +1464,7 @@ static int tg3_phy_init(struct tg3 *tp)
1471 phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link, 1464 phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
1472 phydev->dev_flags, phydev->interface); 1465 phydev->dev_flags, phydev->interface);
1473 if (IS_ERR(phydev)) { 1466 if (IS_ERR(phydev)) {
1474 printk(KERN_ERR "%s: Could not attach to PHY\n", tp->dev->name); 1467 netdev_err(tp->dev, "Could not attach to PHY\n");
1475 return PTR_ERR(phydev); 1468 return PTR_ERR(phydev);
1476 } 1469 }
1477 1470
@@ -2500,8 +2493,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2500 break; 2493 break;
2501 2494
2502 default: 2495 default:
2503 printk(KERN_ERR PFX "%s: Invalid power state (D%d) requested\n", 2496 netdev_err(tp->dev, "Invalid power state (D%d) requested\n",
2504 tp->dev->name, state); 2497 state);
2505 return -EINVAL; 2498 return -EINVAL;
2506 } 2499 }
2507 2500
@@ -4342,10 +4335,8 @@ static void tg3_tx_recover(struct tg3 *tp)
4342 BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) || 4335 BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) ||
4343 tp->write32_tx_mbox == tg3_write_indirect_mbox); 4336 tp->write32_tx_mbox == tg3_write_indirect_mbox);
4344 4337
4345 printk(KERN_WARNING PFX "%s: The system may be re-ordering memory-" 4338 netdev_warn(tp->dev, "The system may be re-ordering memory-mapped I/O cycles to the network device, attempting to recover\n"
4346 "mapped I/O cycles to the network device, attempting to " 4339 "Please report the problem to the driver maintainer and include system chipset information.\n");
4347 "recover. Please report the problem to the driver maintainer "
4348 "and include system chipset information.\n", tp->dev->name);
4349 4340
4350 spin_lock(&tp->lock); 4341 spin_lock(&tp->lock);
4351 tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING; 4342 tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
@@ -5269,8 +5260,7 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
5269 5260
5270 err = tg3_init_hw(tp, reset_phy); 5261 err = tg3_init_hw(tp, reset_phy);
5271 if (err) { 5262 if (err) {
5272 printk(KERN_ERR PFX "%s: Failed to re-initialize device, " 5263 netdev_err(tp->dev, "Failed to re-initialize device, aborting\n");
5273 "aborting.\n", tp->dev->name);
5274 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 5264 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
5275 tg3_full_unlock(tp); 5265 tg3_full_unlock(tp);
5276 del_timer_sync(&tp->timer); 5266 del_timer_sync(&tp->timer);
@@ -5343,10 +5333,10 @@ out:
5343 5333
5344static void tg3_dump_short_state(struct tg3 *tp) 5334static void tg3_dump_short_state(struct tg3 *tp)
5345{ 5335{
5346 printk(KERN_ERR PFX "DEBUG: MAC_TX_STATUS[%08x] MAC_RX_STATUS[%08x]\n", 5336 netdev_err(tp->dev, "DEBUG: MAC_TX_STATUS[%08x] MAC_RX_STATUS[%08x]\n",
5347 tr32(MAC_TX_STATUS), tr32(MAC_RX_STATUS)); 5337 tr32(MAC_TX_STATUS), tr32(MAC_RX_STATUS));
5348 printk(KERN_ERR PFX "DEBUG: RDMAC_STATUS[%08x] WDMAC_STATUS[%08x]\n", 5338 netdev_err(tp->dev, "DEBUG: RDMAC_STATUS[%08x] WDMAC_STATUS[%08x]\n",
5349 tr32(RDMAC_STATUS), tr32(WDMAC_STATUS)); 5339 tr32(RDMAC_STATUS), tr32(WDMAC_STATUS));
5350} 5340}
5351 5341
5352static void tg3_tx_timeout(struct net_device *dev) 5342static void tg3_tx_timeout(struct net_device *dev)
@@ -5354,8 +5344,7 @@ static void tg3_tx_timeout(struct net_device *dev)
5354 struct tg3 *tp = netdev_priv(dev); 5344 struct tg3 *tp = netdev_priv(dev);
5355 5345
5356 if (netif_msg_tx_err(tp)) { 5346 if (netif_msg_tx_err(tp)) {
5357 printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", 5347 netdev_err(dev, "transmit timed out, resetting\n");
5358 dev->name);
5359 tg3_dump_short_state(tp); 5348 tg3_dump_short_state(tp);
5360 } 5349 }
5361 5350
@@ -5519,8 +5508,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
5519 netif_tx_stop_queue(txq); 5508 netif_tx_stop_queue(txq);
5520 5509
5521 /* This is a hard error, log it. */ 5510 /* This is a hard error, log it. */
5522 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " 5511 netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
5523 "queue awake!\n", dev->name);
5524 } 5512 }
5525 return NETDEV_TX_BUSY; 5513 return NETDEV_TX_BUSY;
5526 } 5514 }
@@ -5723,8 +5711,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
5723 netif_tx_stop_queue(txq); 5711 netif_tx_stop_queue(txq);
5724 5712
5725 /* This is a hard error, log it. */ 5713 /* This is a hard error, log it. */
5726 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " 5714 netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
5727 "queue awake!\n", dev->name);
5728 } 5715 }
5729 return NETDEV_TX_BUSY; 5716 return NETDEV_TX_BUSY;
5730 } 5717 }
@@ -6071,11 +6058,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
6071 /* Now allocate fresh SKBs for each rx ring. */ 6058 /* Now allocate fresh SKBs for each rx ring. */
6072 for (i = 0; i < tp->rx_pending; i++) { 6059 for (i = 0; i < tp->rx_pending; i++) {
6073 if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_STD, i) < 0) { 6060 if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_STD, i) < 0) {
6074 printk(KERN_WARNING PFX 6061 netdev_warn(tp->dev, "Using a smaller RX standard ring, only %d out of %d buffers were allocated successfully\n",
6075 "%s: Using a smaller RX standard ring, " 6062 i, tp->rx_pending);
6076 "only %d out of %d buffers were allocated "
6077 "successfully.\n",
6078 tp->dev->name, i, tp->rx_pending);
6079 if (i == 0) 6063 if (i == 0)
6080 goto initfail; 6064 goto initfail;
6081 tp->rx_pending = i; 6065 tp->rx_pending = i;
@@ -6104,11 +6088,8 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
6104 6088
6105 for (i = 0; i < tp->rx_jumbo_pending; i++) { 6089 for (i = 0; i < tp->rx_jumbo_pending; i++) {
6106 if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_JUMBO, i) < 0) { 6090 if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_JUMBO, i) < 0) {
6107 printk(KERN_WARNING PFX 6091 netdev_warn(tp->dev, "Using a smaller RX jumbo ring, only %d out of %d buffers were allocated successfully\n",
6108 "%s: Using a smaller RX jumbo ring, " 6092 i, tp->rx_jumbo_pending);
6109 "only %d out of %d buffers were "
6110 "allocated successfully.\n",
6111 tp->dev->name, i, tp->rx_jumbo_pending);
6112 if (i == 0) 6093 if (i == 0)
6113 goto initfail; 6094 goto initfail;
6114 tp->rx_jumbo_pending = i; 6095 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 } 6433 }
6453 6434
6454 if (i == MAX_WAIT_CNT && !silent) { 6435 if (i == MAX_WAIT_CNT && !silent) {
6455 printk(KERN_ERR PFX "tg3_stop_block timed out, " 6436 pr_err("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
6456 "ofs=%lx enable_bit=%x\n",
6457 ofs, enable_bit); 6437 ofs, enable_bit);
6458 return -ENODEV; 6438 return -ENODEV;
6459 } 6439 }
@@ -6500,9 +6480,8 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
6500 break; 6480 break;
6501 } 6481 }
6502 if (i >= MAX_WAIT_CNT) { 6482 if (i >= MAX_WAIT_CNT) {
6503 printk(KERN_ERR PFX "tg3_abort_hw timed out for %s, " 6483 netdev_err(tp->dev, "%s timed out, TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n",
6504 "TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n", 6484 __func__, tr32(MAC_TX_MODE));
6505 tp->dev->name, tr32(MAC_TX_MODE));
6506 err |= -ENODEV; 6485 err |= -ENODEV;
6507 } 6486 }
6508 6487
@@ -6723,8 +6702,7 @@ static int tg3_poll_fw(struct tg3 *tp)
6723 !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { 6702 !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
6724 tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; 6703 tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
6725 6704
6726 printk(KERN_INFO PFX "%s: No firmware running.\n", 6705 netdev_info(tp->dev, "No firmware running\n");
6727 tp->dev->name);
6728 } 6706 }
6729 6707
6730 if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0) { 6708 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 } 7130 }
7153 7131
7154 if (i >= 10000) { 7132 if (i >= 10000) {
7155 printk(KERN_ERR PFX "tg3_reset_cpu timed out for %s, " 7133 netdev_err(tp->dev, "%s timed out, %s CPU\n",
7156 "and %s CPU\n", 7134 __func__, offset == RX_CPU_BASE ? "RX" : "TX");
7157 tp->dev->name,
7158 (offset == RX_CPU_BASE ? "RX" : "TX"));
7159 return -ENODEV; 7135 return -ENODEV;
7160 } 7136 }
7161 7137
@@ -7180,9 +7156,8 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b
7180 7156
7181 if (cpu_base == TX_CPU_BASE && 7157 if (cpu_base == TX_CPU_BASE &&
7182 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 7158 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7183 printk(KERN_ERR PFX "tg3_load_firmware_cpu: Trying to load " 7159 netdev_err(tp->dev, "%s: Trying to load TX cpu firmware which is 5705\n",
7184 "TX cpu firmware on %s which is 5705.\n", 7160 __func__);
7185 tp->dev->name);
7186 return -EINVAL; 7161 return -EINVAL;
7187 } 7162 }
7188 7163
@@ -7261,10 +7236,8 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
7261 udelay(1000); 7236 udelay(1000);
7262 } 7237 }
7263 if (i >= 5) { 7238 if (i >= 5) {
7264 printk(KERN_ERR PFX "tg3_load_firmware fails for %s " 7239 netdev_err(tp->dev, "tg3_load_firmware fails to set RX CPU PC, is %08x should be %08x\n",
7265 "to set RX CPU PC, is %08x should be %08x\n", 7240 tr32(RX_CPU_BASE + CPU_PC), info.fw_base);
7266 tp->dev->name, tr32(RX_CPU_BASE + CPU_PC),
7267 info.fw_base);
7268 return -ENODEV; 7241 return -ENODEV;
7269 } 7242 }
7270 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff); 7243 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff);
@@ -7327,10 +7300,8 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
7327 udelay(1000); 7300 udelay(1000);
7328 } 7301 }
7329 if (i >= 5) { 7302 if (i >= 5) {
7330 printk(KERN_ERR PFX "tg3_load_tso_firmware fails for %s " 7303 netdev_err(tp->dev, "%s fails to set CPU PC, is %08x should be %08x\n",
7331 "to set CPU PC, is %08x should be %08x\n", 7304 __func__, tr32(cpu_base + CPU_PC), info.fw_base);
7332 tp->dev->name, tr32(cpu_base + CPU_PC),
7333 info.fw_base);
7334 return -ENODEV; 7305 return -ENODEV;
7335 } 7306 }
7336 tw32(cpu_base + CPU_STATE, 0xffffffff); 7307 tw32(cpu_base + CPU_STATE, 0xffffffff);
@@ -7791,8 +7762,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7791 udelay(10); 7762 udelay(10);
7792 } 7763 }
7793 if (i >= 2000) { 7764 if (i >= 2000) {
7794 printk(KERN_ERR PFX "tg3_reset_hw cannot enable BUFMGR for %s.\n", 7765 netdev_err(tp->dev, "%s cannot enable BUFMGR\n", __func__);
7795 tp->dev->name);
7796 return -ENODEV; 7766 return -ENODEV;
7797 } 7767 }
7798 7768
@@ -8655,10 +8625,8 @@ static int tg3_test_msi(struct tg3 *tp)
8655 return err; 8625 return err;
8656 8626
8657 /* MSI test failed, go back to INTx mode */ 8627 /* MSI test failed, go back to INTx mode */
8658 printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, " 8628 netdev_warn(tp->dev, "No interrupt was generated using MSI, switching to INTx mode\n"
8659 "switching to INTx mode. Please report this failure to " 8629 "Please report this failure to the PCI maintainer and include system chipset information\n");
8660 "the PCI maintainer and include system chipset information.\n",
8661 tp->dev->name);
8662 8630
8663 free_irq(tp->napi[0].irq_vec, &tp->napi[0]); 8631 free_irq(tp->napi[0].irq_vec, &tp->napi[0]);
8664 8632
@@ -8691,8 +8659,8 @@ static int tg3_request_firmware(struct tg3 *tp)
8691 const __be32 *fw_data; 8659 const __be32 *fw_data;
8692 8660
8693 if (request_firmware(&tp->fw, tp->fw_needed, &tp->pdev->dev)) { 8661 if (request_firmware(&tp->fw, tp->fw_needed, &tp->pdev->dev)) {
8694 printk(KERN_ERR "%s: Failed to load firmware \"%s\"\n", 8662 netdev_err(tp->dev, "Failed to load firmware \"%s\"\n",
8695 tp->dev->name, tp->fw_needed); 8663 tp->fw_needed);
8696 return -ENOENT; 8664 return -ENOENT;
8697 } 8665 }
8698 8666
@@ -8705,8 +8673,8 @@ static int tg3_request_firmware(struct tg3 *tp)
8705 8673
8706 tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */ 8674 tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */
8707 if (tp->fw_len < (tp->fw->size - 12)) { 8675 if (tp->fw_len < (tp->fw->size - 12)) {
8708 printk(KERN_ERR "%s: bogus length %d in \"%s\"\n", 8676 netdev_err(tp->dev, "bogus length %d in \"%s\"\n",
8709 tp->dev->name, tp->fw_len, tp->fw_needed); 8677 tp->fw_len, tp->fw_needed);
8710 release_firmware(tp->fw); 8678 release_firmware(tp->fw);
8711 tp->fw = NULL; 8679 tp->fw = NULL;
8712 return -EINVAL; 8680 return -EINVAL;
@@ -8744,9 +8712,8 @@ static bool tg3_enable_msix(struct tg3 *tp)
8744 return false; 8712 return false;
8745 if (pci_enable_msix(tp->pdev, msix_ent, rc)) 8713 if (pci_enable_msix(tp->pdev, msix_ent, rc))
8746 return false; 8714 return false;
8747 printk(KERN_NOTICE 8715 netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
8748 "%s: Requested %d MSI-X vectors, received %d\n", 8716 tp->irq_cnt, rc);
8749 tp->dev->name, tp->irq_cnt, rc);
8750 tp->irq_cnt = rc; 8717 tp->irq_cnt = rc;
8751 } 8718 }
8752 8719
@@ -8771,8 +8738,7 @@ static void tg3_ints_init(struct tg3 *tp)
8771 /* All MSI supporting chips should support tagged 8738 /* All MSI supporting chips should support tagged
8772 * status. Assert that this is the case. 8739 * status. Assert that this is the case.
8773 */ 8740 */
8774 printk(KERN_WARNING PFX "%s: MSI without TAGGED? " 8741 netdev_warn(tp->dev, "MSI without TAGGED? Not using MSI\n");
8775 "Not using MSI.\n", tp->dev->name);
8776 goto defcfg; 8742 goto defcfg;
8777 } 8743 }
8778 8744
@@ -8817,12 +8783,10 @@ static int tg3_open(struct net_device *dev)
8817 if (err) 8783 if (err)
8818 return err; 8784 return err;
8819 } else if (err) { 8785 } else if (err) {
8820 printk(KERN_WARNING "%s: TSO capability disabled.\n", 8786 netdev_warn(tp->dev, "TSO capability disabled\n");
8821 tp->dev->name);
8822 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE; 8787 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
8823 } else if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { 8788 } else if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
8824 printk(KERN_NOTICE "%s: TSO capability restored.\n", 8789 netdev_notice(tp->dev, "TSO capability restored\n");
8825 tp->dev->name);
8826 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 8790 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
8827 } 8791 }
8828 } 8792 }
@@ -10687,8 +10651,7 @@ static int tg3_test_registers(struct tg3 *tp)
10687 10651
10688out: 10652out:
10689 if (netif_msg_hw(tp)) 10653 if (netif_msg_hw(tp))
10690 printk(KERN_ERR PFX "Register test failed at offset %x\n", 10654 pr_err("Register test failed at offset %x\n", offset);
10691 offset);
10692 tw32(offset, save_val); 10655 tw32(offset, save_val);
10693 return -EIO; 10656 return -EIO;
10694} 10657}
@@ -11815,8 +11778,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
11815 tp->tg3_flags |= TG3_FLAG_NVRAM; 11778 tp->tg3_flags |= TG3_FLAG_NVRAM;
11816 11779
11817 if (tg3_nvram_lock(tp)) { 11780 if (tg3_nvram_lock(tp)) {
11818 printk(KERN_WARNING PFX "%s: Cannot get nvarm lock, " 11781 netdev_warn(tp->dev, "Cannot get nvram lock, %s failed\n",
11819 "tg3_nvram_init failed.\n", tp->dev->name); 11782 __func__);
11820 return; 11783 return;
11821 } 11784 }
11822 tg3_enable_nvram_access(tp); 11785 tg3_enable_nvram_access(tp);
@@ -13280,8 +13243,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13280 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { 13243 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
13281 tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX); 13244 tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX);
13282 if (!tp->pcix_cap) { 13245 if (!tp->pcix_cap) {
13283 printk(KERN_ERR PFX "Cannot find PCI-X " 13246 pr_err("Cannot find PCI-X capability, aborting\n");
13284 "capability, aborting.\n");
13285 return -EIO; 13247 return -EIO;
13286 } 13248 }
13287 13249
@@ -13478,8 +13440,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13478 /* Force the chip into D0. */ 13440 /* Force the chip into D0. */
13479 err = tg3_set_power_state(tp, PCI_D0); 13441 err = tg3_set_power_state(tp, PCI_D0);
13480 if (err) { 13442 if (err) {
13481 printk(KERN_ERR PFX "(%s) transition to D0 failed\n", 13443 pr_err("(%s) transition to D0 failed\n", pci_name(tp->pdev));
13482 pci_name(tp->pdev));
13483 return err; 13444 return err;
13484 } 13445 }
13485 13446
@@ -13653,7 +13614,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13653 13614
13654 err = tg3_phy_probe(tp); 13615 err = tg3_phy_probe(tp);
13655 if (err) { 13616 if (err) {
13656 printk(KERN_ERR PFX "(%s) phy probe failed, err %d\n", 13617 pr_err("(%s) phy probe failed, err %d\n",
13657 pci_name(tp->pdev), err); 13618 pci_name(tp->pdev), err);
13658 /* ... but do not return immediately ... */ 13619 /* ... but do not return immediately ... */
13659 tg3_mdio_fini(tp); 13620 tg3_mdio_fini(tp);
@@ -14163,7 +14124,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
14163 /* Send the buffer to the chip. */ 14124 /* Send the buffer to the chip. */
14164 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1); 14125 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
14165 if (ret) { 14126 if (ret) {
14166 printk(KERN_ERR "tg3_test_dma() Write the buffer failed %d\n", ret); 14127 pr_err("tg3_test_dma() Write the buffer failed %d\n",
14128 ret);
14167 break; 14129 break;
14168 } 14130 }
14169 14131
@@ -14173,7 +14135,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
14173 u32 val; 14135 u32 val;
14174 tg3_read_mem(tp, 0x2100 + (i*4), &val); 14136 tg3_read_mem(tp, 0x2100 + (i*4), &val);
14175 if (le32_to_cpu(val) != p[i]) { 14137 if (le32_to_cpu(val) != p[i]) {
14176 printk(KERN_ERR " tg3_test_dma() Card buffer corrupted on write! (%d != %d)\n", val, i); 14138 pr_err(" tg3_test_dma() Card buffer corrupted on write! (%d != %d)\n",
14139 val, i);
14177 /* ret = -ENODEV here? */ 14140 /* ret = -ENODEV here? */
14178 } 14141 }
14179 p[i] = 0; 14142 p[i] = 0;
@@ -14182,7 +14145,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
14182 /* Now read it back. */ 14145 /* Now read it back. */
14183 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0); 14146 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
14184 if (ret) { 14147 if (ret) {
14185 printk(KERN_ERR "tg3_test_dma() Read the buffer failed %d\n", ret); 14148 pr_err("tg3_test_dma() Read the buffer failed %d\n",
14149 ret);
14186 14150
14187 break; 14151 break;
14188 } 14152 }
@@ -14199,7 +14163,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
14199 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); 14163 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
14200 break; 14164 break;
14201 } else { 14165 } else {
14202 printk(KERN_ERR "tg3_test_dma() buffer corrupted on read back! (%d != %d)\n", p[i], i); 14166 pr_err("tg3_test_dma() buffer corrupted on read back! (%d != %d)\n",
14167 p[i], i);
14203 ret = -ENODEV; 14168 ret = -ENODEV;
14204 goto out; 14169 goto out;
14205 } 14170 }
@@ -14480,7 +14445,6 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = {
14480static int __devinit tg3_init_one(struct pci_dev *pdev, 14445static int __devinit tg3_init_one(struct pci_dev *pdev,
14481 const struct pci_device_id *ent) 14446 const struct pci_device_id *ent)
14482{ 14447{
14483 static int tg3_version_printed = 0;
14484 struct net_device *dev; 14448 struct net_device *dev;
14485 struct tg3 *tp; 14449 struct tg3 *tp;
14486 int i, err, pm_cap; 14450 int i, err, pm_cap;
@@ -14488,20 +14452,17 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14488 char str[40]; 14452 char str[40];
14489 u64 dma_mask, persist_dma_mask; 14453 u64 dma_mask, persist_dma_mask;
14490 14454
14491 if (tg3_version_printed++ == 0) 14455 printk_once(KERN_INFO "%s\n", version);
14492 printk(KERN_INFO "%s", version);
14493 14456
14494 err = pci_enable_device(pdev); 14457 err = pci_enable_device(pdev);
14495 if (err) { 14458 if (err) {
14496 printk(KERN_ERR PFX "Cannot enable PCI device, " 14459 pr_err("Cannot enable PCI device, aborting\n");
14497 "aborting.\n");
14498 return err; 14460 return err;
14499 } 14461 }
14500 14462
14501 err = pci_request_regions(pdev, DRV_MODULE_NAME); 14463 err = pci_request_regions(pdev, DRV_MODULE_NAME);
14502 if (err) { 14464 if (err) {
14503 printk(KERN_ERR PFX "Cannot obtain PCI resources, " 14465 pr_err("Cannot obtain PCI resources, aborting\n");
14504 "aborting.\n");
14505 goto err_out_disable_pdev; 14466 goto err_out_disable_pdev;
14506 } 14467 }
14507 14468
@@ -14510,15 +14471,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14510 /* Find power-management capability. */ 14471 /* Find power-management capability. */
14511 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); 14472 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
14512 if (pm_cap == 0) { 14473 if (pm_cap == 0) {
14513 printk(KERN_ERR PFX "Cannot find PowerManagement capability, " 14474 pr_err("Cannot find PowerManagement capability, aborting\n");
14514 "aborting.\n");
14515 err = -EIO; 14475 err = -EIO;
14516 goto err_out_free_res; 14476 goto err_out_free_res;
14517 } 14477 }
14518 14478
14519 dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS); 14479 dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
14520 if (!dev) { 14480 if (!dev) {
14521 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 14481 pr_err("Etherdev alloc failed, aborting\n");
14522 err = -ENOMEM; 14482 err = -ENOMEM;
14523 goto err_out_free_res; 14483 goto err_out_free_res;
14524 } 14484 }
@@ -14568,8 +14528,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14568 14528
14569 tp->regs = pci_ioremap_bar(pdev, BAR_0); 14529 tp->regs = pci_ioremap_bar(pdev, BAR_0);
14570 if (!tp->regs) { 14530 if (!tp->regs) {
14571 printk(KERN_ERR PFX "Cannot map device registers, " 14531 netdev_err(dev, "Cannot map device registers, aborting\n");
14572 "aborting.\n");
14573 err = -ENOMEM; 14532 err = -ENOMEM;
14574 goto err_out_free_dev; 14533 goto err_out_free_dev;
14575 } 14534 }
@@ -14585,8 +14544,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14585 14544
14586 err = tg3_get_invariants(tp); 14545 err = tg3_get_invariants(tp);
14587 if (err) { 14546 if (err) {
14588 printk(KERN_ERR PFX "Problem fetching invariants of chip, " 14547 netdev_err(dev, "Problem fetching invariants of chip, aborting\n");
14589 "aborting.\n");
14590 goto err_out_iounmap; 14548 goto err_out_iounmap;
14591 } 14549 }
14592 14550
@@ -14621,8 +14579,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14621 err = pci_set_consistent_dma_mask(pdev, 14579 err = pci_set_consistent_dma_mask(pdev,
14622 persist_dma_mask); 14580 persist_dma_mask);
14623 if (err < 0) { 14581 if (err < 0) {
14624 printk(KERN_ERR PFX "Unable to obtain 64 bit " 14582 netdev_err(dev, "Unable to obtain 64 bit DMA for consistent allocations\n");
14625 "DMA for consistent allocations\n");
14626 goto err_out_iounmap; 14583 goto err_out_iounmap;
14627 } 14584 }
14628 } 14585 }
@@ -14630,8 +14587,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14630 if (err || dma_mask == DMA_BIT_MASK(32)) { 14587 if (err || dma_mask == DMA_BIT_MASK(32)) {
14631 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 14588 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
14632 if (err) { 14589 if (err) {
14633 printk(KERN_ERR PFX "No usable DMA configuration, " 14590 netdev_err(dev, "No usable DMA configuration, aborting\n");
14634 "aborting.\n");
14635 goto err_out_iounmap; 14591 goto err_out_iounmap;
14636 } 14592 }
14637 } 14593 }
@@ -14680,16 +14636,14 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14680 14636
14681 err = tg3_get_device_address(tp); 14637 err = tg3_get_device_address(tp);
14682 if (err) { 14638 if (err) {
14683 printk(KERN_ERR PFX "Could not obtain valid ethernet address, " 14639 netdev_err(dev, "Could not obtain valid ethernet address, aborting\n");
14684 "aborting.\n");
14685 goto err_out_iounmap; 14640 goto err_out_iounmap;
14686 } 14641 }
14687 14642
14688 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { 14643 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
14689 tp->aperegs = pci_ioremap_bar(pdev, BAR_2); 14644 tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
14690 if (!tp->aperegs) { 14645 if (!tp->aperegs) {
14691 printk(KERN_ERR PFX "Cannot map APE registers, " 14646 netdev_err(dev, "Cannot map APE registers, aborting\n");
14692 "aborting.\n");
14693 err = -ENOMEM; 14647 err = -ENOMEM;
14694 goto err_out_iounmap; 14648 goto err_out_iounmap;
14695 } 14649 }
@@ -14713,7 +14667,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14713 14667
14714 err = tg3_test_dma(tp); 14668 err = tg3_test_dma(tp);
14715 if (err) { 14669 if (err) {
14716 printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); 14670 netdev_err(dev, "DMA engine test failed, aborting\n");
14717 goto err_out_apeunmap; 14671 goto err_out_apeunmap;
14718 } 14672 }
14719 14673
@@ -14774,45 +14728,39 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14774 14728
14775 err = register_netdev(dev); 14729 err = register_netdev(dev);
14776 if (err) { 14730 if (err) {
14777 printk(KERN_ERR PFX "Cannot register net device, " 14731 netdev_err(dev, "Cannot register net device, aborting\n");
14778 "aborting.\n");
14779 goto err_out_apeunmap; 14732 goto err_out_apeunmap;
14780 } 14733 }
14781 14734
14782 printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n", 14735 netdev_info(dev, "Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n",
14783 dev->name, 14736 tp->board_part_number,
14784 tp->board_part_number, 14737 tp->pci_chip_rev_id,
14785 tp->pci_chip_rev_id, 14738 tg3_bus_string(tp, str),
14786 tg3_bus_string(tp, str), 14739 dev->dev_addr);
14787 dev->dev_addr);
14788 14740
14789 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) { 14741 if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) {
14790 struct phy_device *phydev; 14742 struct phy_device *phydev;
14791 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 14743 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
14792 printk(KERN_INFO 14744 netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
14793 "%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", 14745 phydev->drv->name, dev_name(&phydev->dev));
14794 tp->dev->name, phydev->drv->name,
14795 dev_name(&phydev->dev));
14796 } else 14746 } else
14797 printk(KERN_INFO 14747 netdev_info(dev, "attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n",
14798 "%s: attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n", 14748 tg3_phy_string(tp),
14799 tp->dev->name, tg3_phy_string(tp), 14749 ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" :
14800 ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" : 14750 ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" :
14801 ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" : 14751 "10/100/1000Base-T")),
14802 "10/100/1000Base-T")), 14752 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0);
14803 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0); 14753
14804 14754 netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n",
14805 printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n", 14755 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
14806 dev->name, 14756 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
14807 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, 14757 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0,
14808 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, 14758 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
14809 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, 14759 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
14810 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, 14760 netdev_info(dev, "dma_rwctrl[%08x] dma_mask[%d-bit]\n",
14811 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); 14761 tp->dma_rwctrl,
14812 printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", 14762 pdev->dma_mask == DMA_BIT_MASK(32) ? 32 :
14813 dev->name, tp->dma_rwctrl, 14763 ((u64)pdev->dma_mask) == DMA_BIT_MASK(40) ? 40 : 64);
14814 (pdev->dma_mask == DMA_BIT_MASK(32)) ? 32 :
14815 (((u64) pdev->dma_mask == DMA_BIT_MASK(40)) ? 40 : 64));
14816 14764
14817 return 0; 14765 return 0;
14818 14766