diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 215 |
1 files changed, 133 insertions, 82 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7599f52e15b3..1802c3b48799 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -67,8 +67,8 @@ | |||
67 | 67 | ||
68 | #define DRV_MODULE_NAME "tg3" | 68 | #define DRV_MODULE_NAME "tg3" |
69 | #define PFX DRV_MODULE_NAME ": " | 69 | #define PFX DRV_MODULE_NAME ": " |
70 | #define DRV_MODULE_VERSION "3.39" | 70 | #define DRV_MODULE_VERSION "3.42" |
71 | #define DRV_MODULE_RELDATE "September 5, 2005" | 71 | #define DRV_MODULE_RELDATE "Oct 3, 2005" |
72 | 72 | ||
73 | #define TG3_DEF_MAC_MODE 0 | 73 | #define TG3_DEF_MAC_MODE 0 |
74 | #define TG3_DEF_RX_MODE 0 | 74 | #define TG3_DEF_RX_MODE 0 |
@@ -3389,7 +3389,8 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, | |||
3389 | struct tg3 *tp = netdev_priv(dev); | 3389 | struct tg3 *tp = netdev_priv(dev); |
3390 | struct tg3_hw_status *sblk = tp->hw_status; | 3390 | struct tg3_hw_status *sblk = tp->hw_status; |
3391 | 3391 | ||
3392 | if (sblk->status & SD_STATUS_UPDATED) { | 3392 | if ((sblk->status & SD_STATUS_UPDATED) || |
3393 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | ||
3393 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3394 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3394 | 0x00000001); | 3395 | 0x00000001); |
3395 | return IRQ_RETVAL(1); | 3396 | return IRQ_RETVAL(1); |
@@ -3442,31 +3443,47 @@ static void tg3_tx_timeout(struct net_device *dev) | |||
3442 | schedule_work(&tp->reset_task); | 3443 | schedule_work(&tp->reset_task); |
3443 | } | 3444 | } |
3444 | 3445 | ||
3446 | /* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */ | ||
3447 | static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | ||
3448 | { | ||
3449 | u32 base = (u32) mapping & 0xffffffff; | ||
3450 | |||
3451 | return ((base > 0xffffdcc0) && | ||
3452 | (base + len + 8 < base)); | ||
3453 | } | ||
3454 | |||
3445 | static void tg3_set_txd(struct tg3 *, int, dma_addr_t, int, u32, u32); | 3455 | static void tg3_set_txd(struct tg3 *, int, dma_addr_t, int, u32, u32); |
3446 | 3456 | ||
3447 | static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, | 3457 | static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, |
3448 | u32 guilty_entry, int guilty_len, | 3458 | u32 last_plus_one, u32 *start, |
3449 | u32 last_plus_one, u32 *start, u32 mss) | 3459 | u32 base_flags, u32 mss) |
3450 | { | 3460 | { |
3451 | struct sk_buff *new_skb = skb_copy(skb, GFP_ATOMIC); | 3461 | struct sk_buff *new_skb = skb_copy(skb, GFP_ATOMIC); |
3452 | dma_addr_t new_addr; | 3462 | dma_addr_t new_addr = 0; |
3453 | u32 entry = *start; | 3463 | u32 entry = *start; |
3454 | int i; | 3464 | int i, ret = 0; |
3455 | 3465 | ||
3456 | if (!new_skb) { | 3466 | if (!new_skb) { |
3457 | dev_kfree_skb(skb); | 3467 | ret = -1; |
3458 | return -1; | 3468 | } else { |
3469 | /* New SKB is guaranteed to be linear. */ | ||
3470 | entry = *start; | ||
3471 | new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len, | ||
3472 | PCI_DMA_TODEVICE); | ||
3473 | /* Make sure new skb does not cross any 4G boundaries. | ||
3474 | * Drop the packet if it does. | ||
3475 | */ | ||
3476 | if (tg3_4g_overflow_test(new_addr, new_skb->len)) { | ||
3477 | ret = -1; | ||
3478 | dev_kfree_skb(new_skb); | ||
3479 | new_skb = NULL; | ||
3480 | } else { | ||
3481 | tg3_set_txd(tp, entry, new_addr, new_skb->len, | ||
3482 | base_flags, 1 | (mss << 1)); | ||
3483 | *start = NEXT_TX(entry); | ||
3484 | } | ||
3459 | } | 3485 | } |
3460 | 3486 | ||
3461 | /* New SKB is guaranteed to be linear. */ | ||
3462 | entry = *start; | ||
3463 | new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len, | ||
3464 | PCI_DMA_TODEVICE); | ||
3465 | tg3_set_txd(tp, entry, new_addr, new_skb->len, | ||
3466 | (skb->ip_summed == CHECKSUM_HW) ? | ||
3467 | TXD_FLAG_TCPUDP_CSUM : 0, 1 | (mss << 1)); | ||
3468 | *start = NEXT_TX(entry); | ||
3469 | |||
3470 | /* Now clean up the sw ring entries. */ | 3487 | /* Now clean up the sw ring entries. */ |
3471 | i = 0; | 3488 | i = 0; |
3472 | while (entry != last_plus_one) { | 3489 | while (entry != last_plus_one) { |
@@ -3491,7 +3508,7 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, | |||
3491 | 3508 | ||
3492 | dev_kfree_skb(skb); | 3509 | dev_kfree_skb(skb); |
3493 | 3510 | ||
3494 | return 0; | 3511 | return ret; |
3495 | } | 3512 | } |
3496 | 3513 | ||
3497 | static void tg3_set_txd(struct tg3 *tp, int entry, | 3514 | static void tg3_set_txd(struct tg3 *tp, int entry, |
@@ -3517,19 +3534,10 @@ static void tg3_set_txd(struct tg3 *tp, int entry, | |||
3517 | txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; | 3534 | txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; |
3518 | } | 3535 | } |
3519 | 3536 | ||
3520 | static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | ||
3521 | { | ||
3522 | u32 base = (u32) mapping & 0xffffffff; | ||
3523 | |||
3524 | return ((base > 0xffffdcc0) && | ||
3525 | (base + len + 8 < base)); | ||
3526 | } | ||
3527 | |||
3528 | static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | 3537 | static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) |
3529 | { | 3538 | { |
3530 | struct tg3 *tp = netdev_priv(dev); | 3539 | struct tg3 *tp = netdev_priv(dev); |
3531 | dma_addr_t mapping; | 3540 | dma_addr_t mapping; |
3532 | unsigned int i; | ||
3533 | u32 len, entry, base_flags, mss; | 3541 | u32 len, entry, base_flags, mss; |
3534 | int would_hit_hwbug; | 3542 | int would_hit_hwbug; |
3535 | 3543 | ||
@@ -3624,7 +3632,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3624 | would_hit_hwbug = 0; | 3632 | would_hit_hwbug = 0; |
3625 | 3633 | ||
3626 | if (tg3_4g_overflow_test(mapping, len)) | 3634 | if (tg3_4g_overflow_test(mapping, len)) |
3627 | would_hit_hwbug = entry + 1; | 3635 | would_hit_hwbug = 1; |
3628 | 3636 | ||
3629 | tg3_set_txd(tp, entry, mapping, len, base_flags, | 3637 | tg3_set_txd(tp, entry, mapping, len, base_flags, |
3630 | (skb_shinfo(skb)->nr_frags == 0) | (mss << 1)); | 3638 | (skb_shinfo(skb)->nr_frags == 0) | (mss << 1)); |
@@ -3648,12 +3656,8 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3648 | tp->tx_buffers[entry].skb = NULL; | 3656 | tp->tx_buffers[entry].skb = NULL; |
3649 | pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, mapping); | 3657 | pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, mapping); |
3650 | 3658 | ||
3651 | if (tg3_4g_overflow_test(mapping, len)) { | 3659 | if (tg3_4g_overflow_test(mapping, len)) |
3652 | /* Only one should match. */ | 3660 | would_hit_hwbug = 1; |
3653 | if (would_hit_hwbug) | ||
3654 | BUG(); | ||
3655 | would_hit_hwbug = entry + 1; | ||
3656 | } | ||
3657 | 3661 | ||
3658 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) | 3662 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) |
3659 | tg3_set_txd(tp, entry, mapping, len, | 3663 | tg3_set_txd(tp, entry, mapping, len, |
@@ -3669,34 +3673,15 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3669 | if (would_hit_hwbug) { | 3673 | if (would_hit_hwbug) { |
3670 | u32 last_plus_one = entry; | 3674 | u32 last_plus_one = entry; |
3671 | u32 start; | 3675 | u32 start; |
3672 | unsigned int len = 0; | ||
3673 | |||
3674 | would_hit_hwbug -= 1; | ||
3675 | entry = entry - 1 - skb_shinfo(skb)->nr_frags; | ||
3676 | entry &= (TG3_TX_RING_SIZE - 1); | ||
3677 | start = entry; | ||
3678 | i = 0; | ||
3679 | while (entry != last_plus_one) { | ||
3680 | if (i == 0) | ||
3681 | len = skb_headlen(skb); | ||
3682 | else | ||
3683 | len = skb_shinfo(skb)->frags[i-1].size; | ||
3684 | 3676 | ||
3685 | if (entry == would_hit_hwbug) | 3677 | start = entry - 1 - skb_shinfo(skb)->nr_frags; |
3686 | break; | 3678 | start &= (TG3_TX_RING_SIZE - 1); |
3687 | |||
3688 | i++; | ||
3689 | entry = NEXT_TX(entry); | ||
3690 | |||
3691 | } | ||
3692 | 3679 | ||
3693 | /* If the workaround fails due to memory/mapping | 3680 | /* If the workaround fails due to memory/mapping |
3694 | * failure, silently drop this packet. | 3681 | * failure, silently drop this packet. |
3695 | */ | 3682 | */ |
3696 | if (tigon3_4gb_hwbug_workaround(tp, skb, | 3683 | if (tigon3_4gb_hwbug_workaround(tp, skb, last_plus_one, |
3697 | entry, len, | 3684 | &start, base_flags, mss)) |
3698 | last_plus_one, | ||
3699 | &start, mss)) | ||
3700 | goto out_unlock; | 3685 | goto out_unlock; |
3701 | 3686 | ||
3702 | entry = start; | 3687 | entry = start; |
@@ -5411,6 +5396,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) | |||
5411 | struct tg3 *tp = netdev_priv(dev); | 5396 | struct tg3 *tp = netdev_priv(dev); |
5412 | struct sockaddr *addr = p; | 5397 | struct sockaddr *addr = p; |
5413 | 5398 | ||
5399 | if (!is_valid_ether_addr(addr->sa_data)) | ||
5400 | return -EINVAL; | ||
5401 | |||
5414 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 5402 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
5415 | 5403 | ||
5416 | spin_lock_bh(&tp->lock); | 5404 | spin_lock_bh(&tp->lock); |
@@ -5822,6 +5810,13 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5822 | } | 5810 | } |
5823 | memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); | 5811 | memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE); |
5824 | 5812 | ||
5813 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | ||
5814 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | ||
5815 | /* reset to prevent losing 1st rx packet intermittently */ | ||
5816 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); | ||
5817 | udelay(10); | ||
5818 | } | ||
5819 | |||
5825 | tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | | 5820 | tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | |
5826 | MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; | 5821 | MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; |
5827 | tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); | 5822 | tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR); |
@@ -5953,7 +5948,7 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5953 | tw32(MAC_LED_CTRL, tp->led_ctrl); | 5948 | tw32(MAC_LED_CTRL, tp->led_ctrl); |
5954 | 5949 | ||
5955 | tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); | 5950 | tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB); |
5956 | if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) { | 5951 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { |
5957 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); | 5952 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); |
5958 | udelay(10); | 5953 | udelay(10); |
5959 | } | 5954 | } |
@@ -7376,12 +7371,17 @@ static int tg3_nway_reset(struct net_device *dev) | |||
7376 | if (!netif_running(dev)) | 7371 | if (!netif_running(dev)) |
7377 | return -EAGAIN; | 7372 | return -EAGAIN; |
7378 | 7373 | ||
7374 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) | ||
7375 | return -EINVAL; | ||
7376 | |||
7379 | spin_lock_bh(&tp->lock); | 7377 | spin_lock_bh(&tp->lock); |
7380 | r = -EINVAL; | 7378 | r = -EINVAL; |
7381 | tg3_readphy(tp, MII_BMCR, &bmcr); | 7379 | tg3_readphy(tp, MII_BMCR, &bmcr); |
7382 | if (!tg3_readphy(tp, MII_BMCR, &bmcr) && | 7380 | if (!tg3_readphy(tp, MII_BMCR, &bmcr) && |
7383 | (bmcr & BMCR_ANENABLE)) { | 7381 | ((bmcr & BMCR_ANENABLE) || |
7384 | tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART); | 7382 | (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT))) { |
7383 | tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART | | ||
7384 | BMCR_ANENABLE); | ||
7385 | r = 0; | 7385 | r = 0; |
7386 | } | 7386 | } |
7387 | spin_unlock_bh(&tp->lock); | 7387 | spin_unlock_bh(&tp->lock); |
@@ -7943,19 +7943,32 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
7943 | struct tg3_rx_buffer_desc *desc; | 7943 | struct tg3_rx_buffer_desc *desc; |
7944 | 7944 | ||
7945 | if (loopback_mode == TG3_MAC_LOOPBACK) { | 7945 | if (loopback_mode == TG3_MAC_LOOPBACK) { |
7946 | /* HW errata - mac loopback fails in some cases on 5780. | ||
7947 | * Normal traffic and PHY loopback are not affected by | ||
7948 | * errata. | ||
7949 | */ | ||
7950 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) | ||
7951 | return 0; | ||
7952 | |||
7946 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | 7953 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | |
7947 | MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY | | 7954 | MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY | |
7948 | MAC_MODE_PORT_MODE_GMII; | 7955 | MAC_MODE_PORT_MODE_GMII; |
7949 | tw32(MAC_MODE, mac_mode); | 7956 | tw32(MAC_MODE, mac_mode); |
7950 | } else if (loopback_mode == TG3_PHY_LOOPBACK) { | 7957 | } else if (loopback_mode == TG3_PHY_LOOPBACK) { |
7958 | tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | | ||
7959 | BMCR_SPEED1000); | ||
7960 | udelay(40); | ||
7961 | /* reset to prevent losing 1st rx packet intermittently */ | ||
7962 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | ||
7963 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); | ||
7964 | udelay(10); | ||
7965 | tw32_f(MAC_RX_MODE, tp->rx_mode); | ||
7966 | } | ||
7951 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | 7967 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | |
7952 | MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII; | 7968 | MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII; |
7953 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) | 7969 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) |
7954 | mac_mode &= ~MAC_MODE_LINK_POLARITY; | 7970 | mac_mode &= ~MAC_MODE_LINK_POLARITY; |
7955 | tw32(MAC_MODE, mac_mode); | 7971 | tw32(MAC_MODE, mac_mode); |
7956 | |||
7957 | tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | | ||
7958 | BMCR_SPEED1000); | ||
7959 | } | 7972 | } |
7960 | else | 7973 | else |
7961 | return -EINVAL; | 7974 | return -EINVAL; |
@@ -9271,6 +9284,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9271 | static struct pci_device_id write_reorder_chipsets[] = { | 9284 | static struct pci_device_id write_reorder_chipsets[] = { |
9272 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | 9285 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, |
9273 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, | 9286 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, |
9287 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, | ||
9288 | PCI_DEVICE_ID_VIA_8385_0) }, | ||
9274 | { }, | 9289 | { }, |
9275 | }; | 9290 | }; |
9276 | u32 misc_ctrl_reg; | 9291 | u32 misc_ctrl_reg; |
@@ -9285,15 +9300,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9285 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; | 9300 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; |
9286 | #endif | 9301 | #endif |
9287 | 9302 | ||
9288 | /* If we have an AMD 762 chipset, write | ||
9289 | * reordering to the mailbox registers done by the host | ||
9290 | * controller can cause major troubles. We read back from | ||
9291 | * every mailbox register write to force the writes to be | ||
9292 | * posted to the chip in order. | ||
9293 | */ | ||
9294 | if (pci_dev_present(write_reorder_chipsets)) | ||
9295 | tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER; | ||
9296 | |||
9297 | /* Force memory write invalidate off. If we leave it on, | 9303 | /* Force memory write invalidate off. If we leave it on, |
9298 | * then on 5700_BX chips we have to enable a workaround. | 9304 | * then on 5700_BX chips we have to enable a workaround. |
9299 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary | 9305 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary |
@@ -9424,6 +9430,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9424 | if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) | 9430 | if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) |
9425 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; | 9431 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; |
9426 | 9432 | ||
9433 | /* If we have an AMD 762 or VIA K8T800 chipset, write | ||
9434 | * reordering to the mailbox registers done by the host | ||
9435 | * controller can cause major troubles. We read back from | ||
9436 | * every mailbox register write to force the writes to be | ||
9437 | * posted to the chip in order. | ||
9438 | */ | ||
9439 | if (pci_dev_present(write_reorder_chipsets) && | ||
9440 | !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) | ||
9441 | tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER; | ||
9442 | |||
9427 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && | 9443 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && |
9428 | tp->pci_lat_timer < 64) { | 9444 | tp->pci_lat_timer < 64) { |
9429 | tp->pci_lat_timer = 64; | 9445 | tp->pci_lat_timer = 64; |
@@ -9532,7 +9548,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
9532 | tp->write32_rx_mbox = tg3_write_indirect_mbox; | 9548 | tp->write32_rx_mbox = tg3_write_indirect_mbox; |
9533 | 9549 | ||
9534 | iounmap(tp->regs); | 9550 | iounmap(tp->regs); |
9535 | tp->regs = 0; | 9551 | tp->regs = NULL; |
9536 | 9552 | ||
9537 | pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); | 9553 | pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); |
9538 | pci_cmd &= ~PCI_COMMAND_MEMORY; | 9554 | pci_cmd &= ~PCI_COMMAND_MEMORY; |
@@ -10338,6 +10354,44 @@ static char * __devinit tg3_phy_string(struct tg3 *tp) | |||
10338 | }; | 10354 | }; |
10339 | } | 10355 | } |
10340 | 10356 | ||
10357 | static char * __devinit tg3_bus_string(struct tg3 *tp, char *str) | ||
10358 | { | ||
10359 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { | ||
10360 | strcpy(str, "PCI Express"); | ||
10361 | return str; | ||
10362 | } else if (tp->tg3_flags & TG3_FLAG_PCIX_MODE) { | ||
10363 | u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL) & 0x1f; | ||
10364 | |||
10365 | strcpy(str, "PCIX:"); | ||
10366 | |||
10367 | if ((clock_ctrl == 7) || | ||
10368 | ((tr32(GRC_MISC_CFG) & GRC_MISC_CFG_BOARD_ID_MASK) == | ||
10369 | GRC_MISC_CFG_BOARD_ID_5704CIOBE)) | ||
10370 | strcat(str, "133MHz"); | ||
10371 | else if (clock_ctrl == 0) | ||
10372 | strcat(str, "33MHz"); | ||
10373 | else if (clock_ctrl == 2) | ||
10374 | strcat(str, "50MHz"); | ||
10375 | else if (clock_ctrl == 4) | ||
10376 | strcat(str, "66MHz"); | ||
10377 | else if (clock_ctrl == 6) | ||
10378 | strcat(str, "100MHz"); | ||
10379 | else if (clock_ctrl == 7) | ||
10380 | strcat(str, "133MHz"); | ||
10381 | } else { | ||
10382 | strcpy(str, "PCI:"); | ||
10383 | if (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) | ||
10384 | strcat(str, "66MHz"); | ||
10385 | else | ||
10386 | strcat(str, "33MHz"); | ||
10387 | } | ||
10388 | if (tp->tg3_flags & TG3_FLAG_PCI_32BIT) | ||
10389 | strcat(str, ":32-bit"); | ||
10390 | else | ||
10391 | strcat(str, ":64-bit"); | ||
10392 | return str; | ||
10393 | } | ||
10394 | |||
10341 | static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) | 10395 | static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) |
10342 | { | 10396 | { |
10343 | struct pci_dev *peer; | 10397 | struct pci_dev *peer; |
@@ -10400,6 +10454,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10400 | struct net_device *dev; | 10454 | struct net_device *dev; |
10401 | struct tg3 *tp; | 10455 | struct tg3 *tp; |
10402 | int i, err, pci_using_dac, pm_cap; | 10456 | int i, err, pci_using_dac, pm_cap; |
10457 | char str[40]; | ||
10403 | 10458 | ||
10404 | if (tg3_version_printed++ == 0) | 10459 | if (tg3_version_printed++ == 0) |
10405 | printk(KERN_INFO "%s", version); | 10460 | printk(KERN_INFO "%s", version); |
@@ -10645,16 +10700,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10645 | 10700 | ||
10646 | pci_set_drvdata(pdev, dev); | 10701 | pci_set_drvdata(pdev, dev); |
10647 | 10702 | ||
10648 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", | 10703 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet ", |
10649 | dev->name, | 10704 | dev->name, |
10650 | tp->board_part_number, | 10705 | tp->board_part_number, |
10651 | tp->pci_chip_rev_id, | 10706 | tp->pci_chip_rev_id, |
10652 | tg3_phy_string(tp), | 10707 | tg3_phy_string(tp), |
10653 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""), | 10708 | tg3_bus_string(tp, str), |
10654 | ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ? | ||
10655 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") : | ||
10656 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")), | ||
10657 | ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit"), | ||
10658 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); | 10709 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); |
10659 | 10710 | ||
10660 | for (i = 0; i < 6; i++) | 10711 | for (i = 0; i < 6; i++) |
@@ -10680,7 +10731,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10680 | err_out_iounmap: | 10731 | err_out_iounmap: |
10681 | if (tp->regs) { | 10732 | if (tp->regs) { |
10682 | iounmap(tp->regs); | 10733 | iounmap(tp->regs); |
10683 | tp->regs = 0; | 10734 | tp->regs = NULL; |
10684 | } | 10735 | } |
10685 | 10736 | ||
10686 | err_out_free_dev: | 10737 | err_out_free_dev: |
@@ -10705,7 +10756,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) | |||
10705 | unregister_netdev(dev); | 10756 | unregister_netdev(dev); |
10706 | if (tp->regs) { | 10757 | if (tp->regs) { |
10707 | iounmap(tp->regs); | 10758 | iounmap(tp->regs); |
10708 | tp->regs = 0; | 10759 | tp->regs = NULL; |
10709 | } | 10760 | } |
10710 | free_netdev(dev); | 10761 | free_netdev(dev); |
10711 | pci_release_regions(pdev); | 10762 | pci_release_regions(pdev); |