diff options
Diffstat (limited to 'drivers/net/tulip/winbond-840.c')
-rw-r--r-- | drivers/net/tulip/winbond-840.c | 195 |
1 files changed, 98 insertions, 97 deletions
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index b38d3b7f6e35..98dbf6cc1d68 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -114,7 +114,6 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
114 | #include <linux/timer.h> | 114 | #include <linux/timer.h> |
115 | #include <linux/errno.h> | 115 | #include <linux/errno.h> |
116 | #include <linux/ioport.h> | 116 | #include <linux/ioport.h> |
117 | #include <linux/slab.h> | ||
118 | #include <linux/interrupt.h> | 117 | #include <linux/interrupt.h> |
119 | #include <linux/pci.h> | 118 | #include <linux/pci.h> |
120 | #include <linux/dma-mapping.h> | 119 | #include <linux/dma-mapping.h> |
@@ -218,7 +217,7 @@ enum chip_capability_flags { | |||
218 | CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8, | 217 | CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8, |
219 | }; | 218 | }; |
220 | 219 | ||
221 | static const struct pci_device_id w840_pci_tbl[] = { | 220 | static DEFINE_PCI_DEVICE_TABLE(w840_pci_tbl) = { |
222 | { 0x1050, 0x0840, PCI_ANY_ID, 0x8153, 0, 0, 0 }, | 221 | { 0x1050, 0x0840, PCI_ANY_ID, 0x8153, 0, 0, 0 }, |
223 | { 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, | 222 | { 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, |
224 | { 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, | 223 | { 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, |
@@ -376,8 +375,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
376 | irq = pdev->irq; | 375 | irq = pdev->irq; |
377 | 376 | ||
378 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 377 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
379 | printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n", | 378 | pr_warning("Winbond-840: Device %s disabled due to DMA limitations\n", |
380 | pci_name(pdev)); | 379 | pci_name(pdev)); |
381 | return -EIO; | 380 | return -EIO; |
382 | } | 381 | } |
383 | dev = alloc_etherdev(sizeof(*np)); | 382 | dev = alloc_etherdev(sizeof(*np)); |
@@ -422,8 +421,9 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
422 | if (option & 0x200) | 421 | if (option & 0x200) |
423 | np->mii_if.full_duplex = 1; | 422 | np->mii_if.full_duplex = 1; |
424 | if (option & 15) | 423 | if (option & 15) |
425 | printk(KERN_INFO "%s: ignoring user supplied media type %d", | 424 | dev_info(&dev->dev, |
426 | dev->name, option & 15); | 425 | "ignoring user supplied media type %d", |
426 | option & 15); | ||
427 | } | 427 | } |
428 | if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0) | 428 | if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0) |
429 | np->mii_if.full_duplex = 1; | 429 | np->mii_if.full_duplex = 1; |
@@ -440,9 +440,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
440 | if (i) | 440 | if (i) |
441 | goto err_out_cleardev; | 441 | goto err_out_cleardev; |
442 | 442 | ||
443 | printk(KERN_INFO "%s: %s at %p, %pM, IRQ %d.\n", | 443 | dev_info(&dev->dev, "%s at %p, %pM, IRQ %d\n", |
444 | dev->name, pci_id_tbl[chip_idx].name, ioaddr, | 444 | pci_id_tbl[chip_idx].name, ioaddr, dev->dev_addr, irq); |
445 | dev->dev_addr, irq); | ||
446 | 445 | ||
447 | if (np->drv_flags & CanHaveMII) { | 446 | if (np->drv_flags & CanHaveMII) { |
448 | int phy, phy_idx = 0; | 447 | int phy, phy_idx = 0; |
@@ -453,16 +452,17 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
453 | np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); | 452 | np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); |
454 | np->mii = (mdio_read(dev, phy, MII_PHYSID1) << 16)+ | 453 | np->mii = (mdio_read(dev, phy, MII_PHYSID1) << 16)+ |
455 | mdio_read(dev, phy, MII_PHYSID2); | 454 | mdio_read(dev, phy, MII_PHYSID2); |
456 | printk(KERN_INFO "%s: MII PHY %8.8xh found at address %d, status " | 455 | dev_info(&dev->dev, |
457 | "0x%4.4x advertising %4.4x.\n", | 456 | "MII PHY %08xh found at address %d, status 0x%04x advertising %04x\n", |
458 | dev->name, np->mii, phy, mii_status, np->mii_if.advertising); | 457 | np->mii, phy, mii_status, |
458 | np->mii_if.advertising); | ||
459 | } | 459 | } |
460 | } | 460 | } |
461 | np->mii_cnt = phy_idx; | 461 | np->mii_cnt = phy_idx; |
462 | np->mii_if.phy_id = np->phys[0]; | 462 | np->mii_if.phy_id = np->phys[0]; |
463 | if (phy_idx == 0) { | 463 | if (phy_idx == 0) { |
464 | printk(KERN_WARNING "%s: MII PHY not found -- this device may " | 464 | dev_warn(&dev->dev, |
465 | "not operate correctly.\n", dev->name); | 465 | "MII PHY not found -- this device may not operate correctly\n"); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
@@ -639,13 +639,13 @@ static int netdev_open(struct net_device *dev) | |||
639 | iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */ | 639 | iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */ |
640 | 640 | ||
641 | netif_device_detach(dev); | 641 | netif_device_detach(dev); |
642 | i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); | 642 | i = request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev); |
643 | if (i) | 643 | if (i) |
644 | goto out_err; | 644 | goto out_err; |
645 | 645 | ||
646 | if (debug > 1) | 646 | if (debug > 1) |
647 | printk(KERN_DEBUG "%s: w89c840_open() irq %d.\n", | 647 | printk(KERN_DEBUG "%s: w89c840_open() irq %d\n", |
648 | dev->name, dev->irq); | 648 | dev->name, dev->irq); |
649 | 649 | ||
650 | if((i=alloc_ringdesc(dev))) | 650 | if((i=alloc_ringdesc(dev))) |
651 | goto out_err; | 651 | goto out_err; |
@@ -657,7 +657,7 @@ static int netdev_open(struct net_device *dev) | |||
657 | 657 | ||
658 | netif_start_queue(dev); | 658 | netif_start_queue(dev); |
659 | if (debug > 2) | 659 | if (debug > 2) |
660 | printk(KERN_DEBUG "%s: Done netdev_open().\n", dev->name); | 660 | printk(KERN_DEBUG "%s: Done netdev_open()\n", dev->name); |
661 | 661 | ||
662 | /* Set the timer to check for link beat. */ | 662 | /* Set the timer to check for link beat. */ |
663 | init_timer(&np->timer); | 663 | init_timer(&np->timer); |
@@ -688,16 +688,18 @@ static int update_link(struct net_device *dev) | |||
688 | if (!(mii_reg & 0x4)) { | 688 | if (!(mii_reg & 0x4)) { |
689 | if (netif_carrier_ok(dev)) { | 689 | if (netif_carrier_ok(dev)) { |
690 | if (debug) | 690 | if (debug) |
691 | printk(KERN_INFO "%s: MII #%d reports no link. Disabling watchdog.\n", | 691 | dev_info(&dev->dev, |
692 | dev->name, np->phys[0]); | 692 | "MII #%d reports no link. Disabling watchdog\n", |
693 | np->phys[0]); | ||
693 | netif_carrier_off(dev); | 694 | netif_carrier_off(dev); |
694 | } | 695 | } |
695 | return np->csr6; | 696 | return np->csr6; |
696 | } | 697 | } |
697 | if (!netif_carrier_ok(dev)) { | 698 | if (!netif_carrier_ok(dev)) { |
698 | if (debug) | 699 | if (debug) |
699 | printk(KERN_INFO "%s: MII #%d link is back. Enabling watchdog.\n", | 700 | dev_info(&dev->dev, |
700 | dev->name, np->phys[0]); | 701 | "MII #%d link is back. Enabling watchdog\n", |
702 | np->phys[0]); | ||
701 | netif_carrier_on(dev); | 703 | netif_carrier_on(dev); |
702 | } | 704 | } |
703 | 705 | ||
@@ -729,9 +731,10 @@ static int update_link(struct net_device *dev) | |||
729 | if (fasteth) | 731 | if (fasteth) |
730 | result |= 0x20000000; | 732 | result |= 0x20000000; |
731 | if (result != np->csr6 && debug) | 733 | if (result != np->csr6 && debug) |
732 | printk(KERN_INFO "%s: Setting %dMBit-%s-duplex based on MII#%d\n", | 734 | dev_info(&dev->dev, |
733 | dev->name, fasteth ? 100 : 10, | 735 | "Setting %dMBit-%s-duplex based on MII#%d\n", |
734 | duplex ? "full" : "half", np->phys[0]); | 736 | fasteth ? 100 : 10, duplex ? "full" : "half", |
737 | np->phys[0]); | ||
735 | return result; | 738 | return result; |
736 | } | 739 | } |
737 | 740 | ||
@@ -763,8 +766,8 @@ static inline void update_csr6(struct net_device *dev, int new) | |||
763 | 766 | ||
764 | limit--; | 767 | limit--; |
765 | if(!limit) { | 768 | if(!limit) { |
766 | printk(KERN_INFO "%s: couldn't stop rxtx, IntrStatus %xh.\n", | 769 | dev_info(&dev->dev, |
767 | dev->name, csr5); | 770 | "couldn't stop rxtx, IntrStatus %xh\n", csr5); |
768 | break; | 771 | break; |
769 | } | 772 | } |
770 | udelay(1); | 773 | udelay(1); |
@@ -783,10 +786,9 @@ static void netdev_timer(unsigned long data) | |||
783 | void __iomem *ioaddr = np->base_addr; | 786 | void __iomem *ioaddr = np->base_addr; |
784 | 787 | ||
785 | if (debug > 2) | 788 | if (debug > 2) |
786 | printk(KERN_DEBUG "%s: Media selection timer tick, status %8.8x " | 789 | printk(KERN_DEBUG "%s: Media selection timer tick, status %08x config %08x\n", |
787 | "config %8.8x.\n", | 790 | dev->name, ioread32(ioaddr + IntrStatus), |
788 | dev->name, ioread32(ioaddr + IntrStatus), | 791 | ioread32(ioaddr + NetworkConfig)); |
789 | ioread32(ioaddr + NetworkConfig)); | ||
790 | spin_lock_irq(&np->lock); | 792 | spin_lock_irq(&np->lock); |
791 | update_csr6(dev, update_link(dev)); | 793 | update_csr6(dev, update_link(dev)); |
792 | spin_unlock_irq(&np->lock); | 794 | spin_unlock_irq(&np->lock); |
@@ -899,8 +901,8 @@ static void init_registers(struct net_device *dev) | |||
899 | /* When not a module we can work around broken '486 PCI boards. */ | 901 | /* When not a module we can work around broken '486 PCI boards. */ |
900 | if (boot_cpu_data.x86 <= 4) { | 902 | if (boot_cpu_data.x86 <= 4) { |
901 | i |= 0x4800; | 903 | i |= 0x4800; |
902 | printk(KERN_INFO "%s: This is a 386/486 PCI system, setting cache " | 904 | dev_info(&dev->dev, |
903 | "alignment to 8 longwords.\n", dev->name); | 905 | "This is a 386/486 PCI system, setting cache alignment to 8 longwords\n"); |
904 | } else { | 906 | } else { |
905 | i |= 0xE000; | 907 | i |= 0xE000; |
906 | } | 908 | } |
@@ -931,22 +933,23 @@ static void tx_timeout(struct net_device *dev) | |||
931 | struct netdev_private *np = netdev_priv(dev); | 933 | struct netdev_private *np = netdev_priv(dev); |
932 | void __iomem *ioaddr = np->base_addr; | 934 | void __iomem *ioaddr = np->base_addr; |
933 | 935 | ||
934 | printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," | 936 | dev_warn(&dev->dev, "Transmit timed out, status %08x, resetting...\n", |
935 | " resetting...\n", dev->name, ioread32(ioaddr + IntrStatus)); | 937 | ioread32(ioaddr + IntrStatus)); |
936 | 938 | ||
937 | { | 939 | { |
938 | int i; | 940 | int i; |
939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 941 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
940 | for (i = 0; i < RX_RING_SIZE; i++) | 942 | for (i = 0; i < RX_RING_SIZE; i++) |
941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); | 943 | printk(KERN_CONT " %08x", (unsigned int)np->rx_ring[i].status); |
942 | printk(KERN_DEBUG" Tx ring %p: ", np->tx_ring); | 944 | printk(KERN_CONT "\n"); |
945 | printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); | ||
943 | for (i = 0; i < TX_RING_SIZE; i++) | 946 | for (i = 0; i < TX_RING_SIZE; i++) |
944 | printk(" %8.8x", np->tx_ring[i].status); | 947 | printk(KERN_CONT " %08x", np->tx_ring[i].status); |
945 | printk("\n"); | 948 | printk(KERN_CONT "\n"); |
946 | } | 949 | } |
947 | printk(KERN_DEBUG "Tx cur %d Tx dirty %d Tx Full %d, q bytes %d.\n", | 950 | printk(KERN_DEBUG "Tx cur %d Tx dirty %d Tx Full %d, q bytes %d\n", |
948 | np->cur_tx, np->dirty_tx, np->tx_full, np->tx_q_bytes); | 951 | np->cur_tx, np->dirty_tx, np->tx_full, np->tx_q_bytes); |
949 | printk(KERN_DEBUG "Tx Descriptor addr %xh.\n",ioread32(ioaddr+0x4C)); | 952 | printk(KERN_DEBUG "Tx Descriptor addr %xh\n", ioread32(ioaddr+0x4C)); |
950 | 953 | ||
951 | disable_irq(dev->irq); | 954 | disable_irq(dev->irq); |
952 | spin_lock_irq(&np->lock); | 955 | spin_lock_irq(&np->lock); |
@@ -1055,8 +1058,8 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1055 | dev->trans_start = jiffies; | 1058 | dev->trans_start = jiffies; |
1056 | 1059 | ||
1057 | if (debug > 4) { | 1060 | if (debug > 4) { |
1058 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", | 1061 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n", |
1059 | dev->name, np->cur_tx, entry); | 1062 | dev->name, np->cur_tx, entry); |
1060 | } | 1063 | } |
1061 | return NETDEV_TX_OK; | 1064 | return NETDEV_TX_OK; |
1062 | } | 1065 | } |
@@ -1073,8 +1076,8 @@ static void netdev_tx_done(struct net_device *dev) | |||
1073 | if (tx_status & 0x8000) { /* There was an error, log it. */ | 1076 | if (tx_status & 0x8000) { /* There was an error, log it. */ |
1074 | #ifndef final_version | 1077 | #ifndef final_version |
1075 | if (debug > 1) | 1078 | if (debug > 1) |
1076 | printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", | 1079 | printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", |
1077 | dev->name, tx_status); | 1080 | dev->name, tx_status); |
1078 | #endif | 1081 | #endif |
1079 | np->stats.tx_errors++; | 1082 | np->stats.tx_errors++; |
1080 | if (tx_status & 0x0104) np->stats.tx_aborted_errors++; | 1083 | if (tx_status & 0x0104) np->stats.tx_aborted_errors++; |
@@ -1086,8 +1089,8 @@ static void netdev_tx_done(struct net_device *dev) | |||
1086 | } else { | 1089 | } else { |
1087 | #ifndef final_version | 1090 | #ifndef final_version |
1088 | if (debug > 3) | 1091 | if (debug > 3) |
1089 | printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %8.8x.\n", | 1092 | printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %08x\n", |
1090 | dev->name, entry, tx_status); | 1093 | dev->name, entry, tx_status); |
1091 | #endif | 1094 | #endif |
1092 | np->stats.tx_bytes += np->tx_skbuff[entry]->len; | 1095 | np->stats.tx_bytes += np->tx_skbuff[entry]->len; |
1093 | np->stats.collisions += (tx_status >> 3) & 15; | 1096 | np->stats.collisions += (tx_status >> 3) & 15; |
@@ -1130,8 +1133,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1130 | iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); | 1133 | iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); |
1131 | 1134 | ||
1132 | if (debug > 4) | 1135 | if (debug > 4) |
1133 | printk(KERN_DEBUG "%s: Interrupt, status %4.4x.\n", | 1136 | printk(KERN_DEBUG "%s: Interrupt, status %04x\n", |
1134 | dev->name, intr_status); | 1137 | dev->name, intr_status); |
1135 | 1138 | ||
1136 | if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) | 1139 | if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) |
1137 | break; | 1140 | break; |
@@ -1156,8 +1159,9 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1156 | netdev_error(dev, intr_status); | 1159 | netdev_error(dev, intr_status); |
1157 | 1160 | ||
1158 | if (--work_limit < 0) { | 1161 | if (--work_limit < 0) { |
1159 | printk(KERN_WARNING "%s: Too much work at interrupt, " | 1162 | dev_warn(&dev->dev, |
1160 | "status=0x%4.4x.\n", dev->name, intr_status); | 1163 | "Too much work at interrupt, status=0x%04x\n", |
1164 | intr_status); | ||
1161 | /* Set the timer to re-enable the other interrupts after | 1165 | /* Set the timer to re-enable the other interrupts after |
1162 | 10*82usec ticks. */ | 1166 | 10*82usec ticks. */ |
1163 | spin_lock(&np->lock); | 1167 | spin_lock(&np->lock); |
@@ -1171,8 +1175,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1171 | } while (1); | 1175 | } while (1); |
1172 | 1176 | ||
1173 | if (debug > 3) | 1177 | if (debug > 3) |
1174 | printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", | 1178 | printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x\n", |
1175 | dev->name, ioread32(ioaddr + IntrStatus)); | 1179 | dev->name, ioread32(ioaddr + IntrStatus)); |
1176 | return IRQ_RETVAL(handled); | 1180 | return IRQ_RETVAL(handled); |
1177 | } | 1181 | } |
1178 | 1182 | ||
@@ -1185,8 +1189,8 @@ static int netdev_rx(struct net_device *dev) | |||
1185 | int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; | 1189 | int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; |
1186 | 1190 | ||
1187 | if (debug > 4) { | 1191 | if (debug > 4) { |
1188 | printk(KERN_DEBUG " In netdev_rx(), entry %d status %4.4x.\n", | 1192 | printk(KERN_DEBUG " In netdev_rx(), entry %d status %04x\n", |
1189 | entry, np->rx_ring[entry].status); | 1193 | entry, np->rx_ring[entry].status); |
1190 | } | 1194 | } |
1191 | 1195 | ||
1192 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ | 1196 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ |
@@ -1195,24 +1199,24 @@ static int netdev_rx(struct net_device *dev) | |||
1195 | s32 status = desc->status; | 1199 | s32 status = desc->status; |
1196 | 1200 | ||
1197 | if (debug > 4) | 1201 | if (debug > 4) |
1198 | printk(KERN_DEBUG " netdev_rx() status was %8.8x.\n", | 1202 | printk(KERN_DEBUG " netdev_rx() status was %08x\n", |
1199 | status); | 1203 | status); |
1200 | if (status < 0) | 1204 | if (status < 0) |
1201 | break; | 1205 | break; |
1202 | if ((status & 0x38008300) != 0x0300) { | 1206 | if ((status & 0x38008300) != 0x0300) { |
1203 | if ((status & 0x38000300) != 0x0300) { | 1207 | if ((status & 0x38000300) != 0x0300) { |
1204 | /* Ingore earlier buffers. */ | 1208 | /* Ingore earlier buffers. */ |
1205 | if ((status & 0xffff) != 0x7fff) { | 1209 | if ((status & 0xffff) != 0x7fff) { |
1206 | printk(KERN_WARNING "%s: Oversized Ethernet frame spanned " | 1210 | dev_warn(&dev->dev, |
1207 | "multiple buffers, entry %#x status %4.4x!\n", | 1211 | "Oversized Ethernet frame spanned multiple buffers, entry %#x status %04x!\n", |
1208 | dev->name, np->cur_rx, status); | 1212 | np->cur_rx, status); |
1209 | np->stats.rx_length_errors++; | 1213 | np->stats.rx_length_errors++; |
1210 | } | 1214 | } |
1211 | } else if (status & 0x8000) { | 1215 | } else if (status & 0x8000) { |
1212 | /* There was a fatal error. */ | 1216 | /* There was a fatal error. */ |
1213 | if (debug > 2) | 1217 | if (debug > 2) |
1214 | printk(KERN_DEBUG "%s: Receive error, Rx status %8.8x.\n", | 1218 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", |
1215 | dev->name, status); | 1219 | dev->name, status); |
1216 | np->stats.rx_errors++; /* end of a packet.*/ | 1220 | np->stats.rx_errors++; /* end of a packet.*/ |
1217 | if (status & 0x0890) np->stats.rx_length_errors++; | 1221 | if (status & 0x0890) np->stats.rx_length_errors++; |
1218 | if (status & 0x004C) np->stats.rx_frame_errors++; | 1222 | if (status & 0x004C) np->stats.rx_frame_errors++; |
@@ -1225,13 +1229,13 @@ static int netdev_rx(struct net_device *dev) | |||
1225 | 1229 | ||
1226 | #ifndef final_version | 1230 | #ifndef final_version |
1227 | if (debug > 4) | 1231 | if (debug > 4) |
1228 | printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d" | 1232 | printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d status %x\n", |
1229 | " status %x.\n", pkt_len, status); | 1233 | pkt_len, status); |
1230 | #endif | 1234 | #endif |
1231 | /* Check if the packet is long enough to accept without copying | 1235 | /* Check if the packet is long enough to accept without copying |
1232 | to a minimally-sized skbuff. */ | 1236 | to a minimally-sized skbuff. */ |
1233 | if (pkt_len < rx_copybreak | 1237 | if (pkt_len < rx_copybreak && |
1234 | && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { | 1238 | (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { |
1235 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1239 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1236 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], | 1240 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], |
1237 | np->rx_skbuff[entry]->len, | 1241 | np->rx_skbuff[entry]->len, |
@@ -1251,11 +1255,10 @@ static int netdev_rx(struct net_device *dev) | |||
1251 | #ifndef final_version /* Remove after testing. */ | 1255 | #ifndef final_version /* Remove after testing. */ |
1252 | /* You will want this info for the initial debug. */ | 1256 | /* You will want this info for the initial debug. */ |
1253 | if (debug > 5) | 1257 | if (debug > 5) |
1254 | printk(KERN_DEBUG " Rx data %pM %pM" | 1258 | printk(KERN_DEBUG " Rx data %pM %pM %02x%02x %pI4\n", |
1255 | " %2.2x%2.2x %d.%d.%d.%d.\n", | ||
1256 | &skb->data[0], &skb->data[6], | 1259 | &skb->data[0], &skb->data[6], |
1257 | skb->data[12], skb->data[13], | 1260 | skb->data[12], skb->data[13], |
1258 | skb->data[14], skb->data[15], skb->data[16], skb->data[17]); | 1261 | &skb->data[14]); |
1259 | #endif | 1262 | #endif |
1260 | skb->protocol = eth_type_trans(skb, dev); | 1263 | skb->protocol = eth_type_trans(skb, dev); |
1261 | netif_rx(skb); | 1264 | netif_rx(skb); |
@@ -1293,8 +1296,8 @@ static void netdev_error(struct net_device *dev, int intr_status) | |||
1293 | void __iomem *ioaddr = np->base_addr; | 1296 | void __iomem *ioaddr = np->base_addr; |
1294 | 1297 | ||
1295 | if (debug > 2) | 1298 | if (debug > 2) |
1296 | printk(KERN_DEBUG "%s: Abnormal event, %8.8x.\n", | 1299 | printk(KERN_DEBUG "%s: Abnormal event, %08x\n", |
1297 | dev->name, intr_status); | 1300 | dev->name, intr_status); |
1298 | if (intr_status == 0xffffffff) | 1301 | if (intr_status == 0xffffffff) |
1299 | return; | 1302 | return; |
1300 | spin_lock(&np->lock); | 1303 | spin_lock(&np->lock); |
@@ -1314,8 +1317,8 @@ static void netdev_error(struct net_device *dev, int intr_status) | |||
1314 | new = 127; /* load full packet before starting */ | 1317 | new = 127; /* load full packet before starting */ |
1315 | new = (np->csr6 & ~(0x7F << 14)) | (new<<14); | 1318 | new = (np->csr6 & ~(0x7F << 14)) | (new<<14); |
1316 | #endif | 1319 | #endif |
1317 | printk(KERN_DEBUG "%s: Tx underflow, new csr6 %8.8x.\n", | 1320 | printk(KERN_DEBUG "%s: Tx underflow, new csr6 %08x\n", |
1318 | dev->name, new); | 1321 | dev->name, new); |
1319 | update_csr6(dev, new); | 1322 | update_csr6(dev, new); |
1320 | } | 1323 | } |
1321 | if (intr_status & RxDied) { /* Missed a Rx frame. */ | 1324 | if (intr_status & RxDied) { /* Missed a Rx frame. */ |
@@ -1357,17 +1360,16 @@ static u32 __set_rx_mode(struct net_device *dev) | |||
1357 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1360 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
1358 | rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys | 1361 | rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys |
1359 | | AcceptMyPhys; | 1362 | | AcceptMyPhys; |
1360 | } else if ((dev->mc_count > multicast_filter_limit) | 1363 | } else if ((netdev_mc_count(dev) > multicast_filter_limit) || |
1361 | || (dev->flags & IFF_ALLMULTI)) { | 1364 | (dev->flags & IFF_ALLMULTI)) { |
1362 | /* Too many to match, or accept all multicasts. */ | 1365 | /* Too many to match, or accept all multicasts. */ |
1363 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1366 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
1364 | rx_mode = RxAcceptBroadcast | AcceptMulticast | AcceptMyPhys; | 1367 | rx_mode = RxAcceptBroadcast | AcceptMulticast | AcceptMyPhys; |
1365 | } else { | 1368 | } else { |
1366 | struct dev_mc_list *mclist; | 1369 | struct dev_mc_list *mclist; |
1367 | int i; | 1370 | |
1368 | memset(mc_filter, 0, sizeof(mc_filter)); | 1371 | memset(mc_filter, 0, sizeof(mc_filter)); |
1369 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 1372 | netdev_for_each_mc_addr(mclist, dev) { |
1370 | i++, mclist = mclist->next) { | ||
1371 | int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; | 1373 | int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; |
1372 | filterbit &= 0x3f; | 1374 | filterbit &= 0x3f; |
1373 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); | 1375 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); |
@@ -1487,11 +1489,13 @@ static int netdev_close(struct net_device *dev) | |||
1487 | netif_stop_queue(dev); | 1489 | netif_stop_queue(dev); |
1488 | 1490 | ||
1489 | if (debug > 1) { | 1491 | if (debug > 1) { |
1490 | printk(KERN_DEBUG "%s: Shutting down ethercard, status was %8.8x " | 1492 | printk(KERN_DEBUG "%s: Shutting down ethercard, status was %08x Config %08x\n", |
1491 | "Config %8.8x.\n", dev->name, ioread32(ioaddr + IntrStatus), | 1493 | dev->name, ioread32(ioaddr + IntrStatus), |
1492 | ioread32(ioaddr + NetworkConfig)); | 1494 | ioread32(ioaddr + NetworkConfig)); |
1493 | printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", | 1495 | printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d\n", |
1494 | dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx); | 1496 | dev->name, |
1497 | np->cur_tx, np->dirty_tx, | ||
1498 | np->cur_rx, np->dirty_rx); | ||
1495 | } | 1499 | } |
1496 | 1500 | ||
1497 | /* Stop the chip's Tx and Rx processes. */ | 1501 | /* Stop the chip's Tx and Rx processes. */ |
@@ -1512,18 +1516,16 @@ static int netdev_close(struct net_device *dev) | |||
1512 | if (debug > 2) { | 1516 | if (debug > 2) { |
1513 | int i; | 1517 | int i; |
1514 | 1518 | ||
1515 | printk(KERN_DEBUG" Tx ring at %8.8x:\n", | 1519 | printk(KERN_DEBUG" Tx ring at %08x:\n", (int)np->tx_ring); |
1516 | (int)np->tx_ring); | ||
1517 | for (i = 0; i < TX_RING_SIZE; i++) | 1520 | for (i = 0; i < TX_RING_SIZE; i++) |
1518 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", | 1521 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", |
1519 | i, np->tx_ring[i].length, | 1522 | i, np->tx_ring[i].length, |
1520 | np->tx_ring[i].status, np->tx_ring[i].buffer1); | 1523 | np->tx_ring[i].status, np->tx_ring[i].buffer1); |
1521 | printk(KERN_DEBUG " Rx ring %8.8x:\n", | 1524 | printk(KERN_DEBUG " Rx ring %08x:\n", (int)np->rx_ring); |
1522 | (int)np->rx_ring); | ||
1523 | for (i = 0; i < RX_RING_SIZE; i++) { | 1525 | for (i = 0; i < RX_RING_SIZE; i++) { |
1524 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1526 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", |
1525 | i, np->rx_ring[i].length, | 1527 | i, np->rx_ring[i].length, |
1526 | np->rx_ring[i].status, np->rx_ring[i].buffer1); | 1528 | np->rx_ring[i].status, np->rx_ring[i].buffer1); |
1527 | } | 1529 | } |
1528 | } | 1530 | } |
1529 | #endif /* __i386__ debugging only */ | 1531 | #endif /* __i386__ debugging only */ |
@@ -1622,9 +1624,8 @@ static int w840_resume (struct pci_dev *pdev) | |||
1622 | goto out; /* device not suspended */ | 1624 | goto out; /* device not suspended */ |
1623 | if (netif_running(dev)) { | 1625 | if (netif_running(dev)) { |
1624 | if ((retval = pci_enable_device(pdev))) { | 1626 | if ((retval = pci_enable_device(pdev))) { |
1625 | printk (KERN_ERR | 1627 | dev_err(&dev->dev, |
1626 | "%s: pci_enable_device failed in resume\n", | 1628 | "pci_enable_device failed in resume\n"); |
1627 | dev->name); | ||
1628 | goto out; | 1629 | goto out; |
1629 | } | 1630 | } |
1630 | spin_lock_irq(&np->lock); | 1631 | spin_lock_irq(&np->lock); |