diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-03-27 00:15:52 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-03-27 00:15:52 -0800 |
| commit | 31db45e3bace335d77394eb37f59d5bc9329fe72 (patch) | |
| tree | 4d9233e1a8213014612ff9d80a7caabba1779e36 | |
| parent | 852aaba8fd61f51bb4a37c422e4753d268b83a98 (diff) | |
Tigon3 net driver fixes:
- Make use of pci_unmap_xxx storage optimization.
- In tg3_get_invariants, fix cacheline_sz_reg shifts.
On 5703 chips, if latency timer is less than 64, set
it to 64.
- In tg3_test_dma, only run the actual test on 5700/5701
chips. Aparently 5702/5703 revs have some problems.
| -rw-r--r-- | drivers/net/tg3.c | 50 | ||||
| -rw-r--r-- | drivers/net/tg3.h | 2 |
2 files changed, 38 insertions, 14 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7261252d2401..6fdb54dcfec1 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -1509,7 +1509,8 @@ static void tg3_tx(struct tg3 *tp) if (unlikely(skb == NULL)) BUG(); - pci_unmap_single(tp->pdev, ri->mapping, + pci_unmap_single(tp->pdev, + pci_unmap_addr(ri, mapping), (skb->len - skb->data_len), PCI_DMA_TODEVICE); @@ -1526,7 +1527,7 @@ static void tg3_tx(struct tg3 *tp) BUG(); pci_unmap_page(tp->pdev, - ri->mapping, + pci_unmap_addr(ri, mapping), skb_shinfo(skb)->frags[i].size, PCI_DMA_TODEVICE); @@ -1614,7 +1615,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key, PCI_DMA_FROMDEVICE); map->skb = skb; - map->mapping = mapping; + pci_unmap_addr_set(map, mapping, mapping); if (src_map != NULL) src_map->skb = NULL; @@ -1666,7 +1667,8 @@ static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key, }; dest_map->skb = src_map->skb; - dest_map->mapping = src_map->mapping; + pci_unmap_addr_set(dest_map, mapping, + pci_unmap_addr(src_map, mapping)); dest_desc->addr_hi = src_desc->addr_hi; dest_desc->addr_lo = src_desc->addr_lo; @@ -2497,7 +2499,8 @@ static void tg3_free_rings(struct tg3 *tp) if (rxp->skb == NULL) continue; - pci_unmap_single(tp->pdev, rxp->mapping, + pci_unmap_single(tp->pdev, + pci_unmap_addr(rxp, mapping), RX_PKT_BUF_SZ - tp->rx_offset, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxp->skb); @@ -2509,7 +2512,8 @@ static void tg3_free_rings(struct tg3 *tp) if (rxp->skb == NULL) continue; - pci_unmap_single(tp->pdev, rxp->mapping, + pci_unmap_single(tp->pdev, + pci_unmap_addr(rxp, mapping), RX_MINI_PKT_BUF_SZ - tp->rx_offset, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxp->skb); @@ -2521,7 +2525,8 @@ static void tg3_free_rings(struct tg3 *tp) if (rxp->skb == NULL) continue; - pci_unmap_single(tp->pdev, rxp->mapping, + pci_unmap_single(tp->pdev, + pci_unmap_addr(rxp, mapping), RX_JUMBO_PKT_BUF_SZ - tp->rx_offset, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxp->skb); @@ -2541,7 +2546,8 @@ static void tg3_free_rings(struct tg3 *tp) continue; } - pci_unmap_single(tp->pdev, txp->mapping, + pci_unmap_single(tp->pdev, + pci_unmap_addr(txp, mapping), (skb->len - skb->data_len), PCI_DMA_TODEVICE); txp->skb = NULL; @@ -2550,7 +2556,8 @@ static void tg3_free_rings(struct tg3 *tp) for (j = 0; j < skb_shinfo(skb)->nr_frags; j++) { txp = &tp->tx_buffers[i & (TG3_TX_RING_SIZE - 1)]; - pci_unmap_page(tp->pdev, txp->mapping, + pci_unmap_page(tp->pdev, + pci_unmap_addr(txp, mapping), skb_shinfo(skb)->frags[j].size, PCI_DMA_TODEVICE); i++; @@ -5441,10 +5448,23 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) pci_read_config_dword(tp->pdev, TG3PCI_CACHELINESZ, &cacheline_sz_reg); - tp->pci_cacheline_sz = (cacheline_sz_reg >> 24) & 0xff; - tp->pci_lat_timer = (cacheline_sz_reg >> 16) & 0xff; - tp->pci_hdr_type = (cacheline_sz_reg >> 8) & 0xff; - tp->pci_bist = (cacheline_sz_reg >> 0) & 0xff; + tp->pci_cacheline_sz = (cacheline_sz_reg >> 0) & 0xff; + tp->pci_lat_timer = (cacheline_sz_reg >> 8) & 0xff; + tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff; + tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; + + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && + tp->pci_lat_timer < 64) { + tp->pci_lat_timer = 64; + + cacheline_sz_reg = ((tp->pci_cacheline_sz & 0xff) << 0); + cacheline_sz_reg |= ((tp->pci_lat_timer & 0xff) << 8); + cacheline_sz_reg |= ((tp->pci_hdr_type & 0xff) << 16); + cacheline_sz_reg |= ((tp->pci_bist & 0xff) << 24); + + pci_write_config_dword(tp->pdev, TG3PCI_CACHELINESZ, + cacheline_sz_reg); + } pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, &pci_state_reg); @@ -5924,6 +5944,10 @@ static int __devinit tg3_test_dma(struct tg3 *tp) tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 && + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) + return 0; + ret = 0; while (1) { u32 *p, i; diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 5beda44b61c1..1ad86220d9aa 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -1654,7 +1654,7 @@ enum phy_led_mode { */ struct ring_info { struct sk_buff *skb; - dma_addr_t mapping; + DECLARE_PCI_UNMAP_ADDR(mapping) }; struct tg3_config_info { |
