aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c503.c16
-rw-r--r--drivers/net/3c505.c8
-rw-r--r--drivers/net/3c509.c1
-rw-r--r--drivers/net/3c515.c16
-rw-r--r--drivers/net/3c523.c19
-rw-r--r--drivers/net/3c59x.c6
-rw-r--r--drivers/net/8139cp.c32
-rw-r--r--drivers/net/8139too.c8
-rw-r--r--drivers/net/82596.c14
-rw-r--r--drivers/net/Kconfig69
-rw-r--r--drivers/net/ac3200.c19
-rw-r--r--drivers/net/acenic.c5
-rwxr-xr-xdrivers/net/amd8111e.c10
-rw-r--r--drivers/net/appletalk/Kconfig27
-rw-r--r--drivers/net/appletalk/ltpc.c6
-rw-r--r--drivers/net/arm/etherh.c16
-rw-r--r--drivers/net/at1700.c4
-rw-r--r--drivers/net/b44.c6
-rw-r--r--drivers/net/bmac.c7
-rw-r--r--drivers/net/bonding/bond_3ad.c3
-rw-r--r--drivers/net/bonding/bond_main.c390
-rw-r--r--drivers/net/bonding/bonding.h12
-rw-r--r--drivers/net/cs89x0.c72
-rw-r--r--drivers/net/cs89x0.h3
-rw-r--r--drivers/net/defxx.c88
-rw-r--r--drivers/net/dl2k.c8
-rw-r--r--drivers/net/dm9000.c56
-rw-r--r--drivers/net/e100.c37
-rw-r--r--drivers/net/e1000/e1000.h4
-rw-r--r--drivers/net/e1000/e1000_ethtool.c131
-rw-r--r--drivers/net/e1000/e1000_hw.c23
-rw-r--r--drivers/net/e1000/e1000_hw.h1
-rw-r--r--drivers/net/e1000/e1000_main.c142
-rw-r--r--drivers/net/e2100.c15
-rw-r--r--drivers/net/eepro.c21
-rw-r--r--drivers/net/eepro100.c8
-rw-r--r--drivers/net/eexpress.c12
-rw-r--r--drivers/net/epic100.c6
-rw-r--r--drivers/net/eql.c16
-rw-r--r--drivers/net/es3210.c16
-rw-r--r--drivers/net/eth16i.c20
-rw-r--r--drivers/net/ewrk3.c12
-rw-r--r--drivers/net/fealnx.c11
-rw-r--r--drivers/net/forcedeth.c53
-rw-r--r--drivers/net/gianfar.c652
-rw-r--r--drivers/net/gianfar.h363
-rw-r--r--drivers/net/gianfar_ethtool.c277
-rw-r--r--drivers/net/gianfar_phy.c2
-rw-r--r--drivers/net/hamachi.c12
-rw-r--r--drivers/net/hamradio/6pack.c31
-rw-r--r--drivers/net/hamradio/Kconfig2
-rw-r--r--drivers/net/hamradio/mkiss.c2
-rw-r--r--drivers/net/hamradio/scc.c5
-rw-r--r--drivers/net/hp-plus.c15
-rw-r--r--drivers/net/hp.c17
-rw-r--r--drivers/net/hp100.c44
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c5
-rw-r--r--drivers/net/ioc3-eth.c8
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/irda/sir_kthread.c3
-rw-r--r--drivers/net/irda/stir4200.c4
-rw-r--r--drivers/net/isa-skeleton.c20
-rw-r--r--drivers/net/ixgb/ixgb_main.c5
-rw-r--r--drivers/net/lance.c17
-rw-r--r--drivers/net/lasi_82596.c8
-rw-r--r--drivers/net/lne390.c19
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/mace.c6
-rw-r--r--drivers/net/myri_code.h1283
-rw-r--r--drivers/net/myri_sbus.c2
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/ne-h8300.c19
-rw-r--r--drivers/net/ne.c22
-rw-r--r--drivers/net/ne2.c19
-rw-r--r--drivers/net/ne2k-pci.c3
-rw-r--r--drivers/net/ns83820.c5
-rw-r--r--drivers/net/pcmcia/3c574_cs.c15
-rw-r--r--drivers/net/pcmcia/3c589_cs.c19
-rw-r--r--drivers/net/pcmcia/axnet_cs.c36
-rw-r--r--drivers/net/pcmcia/com20020_cs.c14
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c37
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c18
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c15
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c221
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c329
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c35
-rw-r--r--drivers/net/pcnet32.c8
-rw-r--r--drivers/net/plip.c31
-rw-r--r--drivers/net/ppp_async.c4
-rw-r--r--drivers/net/ppp_generic.c12
-rw-r--r--drivers/net/ppp_synctty.c4
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/s2io.c15
-rw-r--r--drivers/net/sb1000.c14
-rw-r--r--drivers/net/sb1250-mac.c4
-rw-r--r--drivers/net/shaper.c42
-rw-r--r--drivers/net/sis900.c11
-rw-r--r--drivers/net/sk98lin/skge.c85
-rw-r--r--drivers/net/sk98lin/skgeinit.c2
-rw-r--r--drivers/net/sk98lin/skxmac2.c8
-rw-r--r--drivers/net/skfp/Makefile4
-rw-r--r--drivers/net/skfp/drvfbi.c222
-rw-r--r--drivers/net/skfp/ess.c4
-rw-r--r--drivers/net/skfp/fplustm.c70
-rw-r--r--drivers/net/skfp/h/cmtdef.h7
-rw-r--r--drivers/net/skfp/h/hwmtm.h25
-rw-r--r--drivers/net/skfp/h/osdef1st.h2
-rw-r--r--drivers/net/skfp/hwmtm.c34
-rw-r--r--drivers/net/skfp/lnkstat.c204
-rw-r--r--drivers/net/skfp/pcmplc.c7
-rw-r--r--drivers/net/skfp/pmf.c11
-rw-r--r--drivers/net/skfp/skfddi.c1
-rw-r--r--drivers/net/skfp/smt.c48
-rw-r--r--drivers/net/skfp/smtdef.c5
-rw-r--r--drivers/net/skfp/smtparse.c467
-rw-r--r--drivers/net/skge.c1849
-rw-r--r--drivers/net/skge.h618
-rw-r--r--drivers/net/slip.c23
-rw-r--r--drivers/net/smc-mca.c60
-rw-r--r--drivers/net/smc-mca.h61
-rw-r--r--drivers/net/smc-ultra.c15
-rw-r--r--drivers/net/smc91x.c45
-rw-r--r--drivers/net/smc91x.h13
-rw-r--r--drivers/net/starfire.c6
-rw-r--r--drivers/net/sundance.c6
-rw-r--r--drivers/net/sungem.c9
-rw-r--r--drivers/net/sungem_phy.c69
-rw-r--r--drivers/net/sungem_phy.h3
-rw-r--r--drivers/net/tg3.c831
-rw-r--r--drivers/net/tg3.h49
-rw-r--r--drivers/net/tlan.c3
-rw-r--r--drivers/net/tokenring/3c359.c3
-rw-r--r--drivers/net/tokenring/3c359_microcode.h2
-rw-r--r--drivers/net/tokenring/Kconfig2
-rw-r--r--drivers/net/tokenring/abyss.c11
-rw-r--r--drivers/net/tokenring/ibmtr.c28
-rw-r--r--drivers/net/tokenring/lanstreamer.c9
-rw-r--r--drivers/net/tokenring/madgemc.c14
-rw-r--r--drivers/net/tokenring/proteon.c11
-rw-r--r--drivers/net/tokenring/skisa.c11
-rw-r--r--drivers/net/tokenring/smctr.c2
-rw-r--r--drivers/net/tokenring/smctr_firmware.h2
-rw-r--r--drivers/net/tokenring/tms380tr.c13
-rw-r--r--drivers/net/tokenring/tmspci.c11
-rw-r--r--drivers/net/tulip/de2104x.c6
-rw-r--r--drivers/net/tulip/dmfe.c23
-rw-r--r--drivers/net/tulip/eeprom.c16
-rw-r--r--drivers/net/tulip/interrupt.c10
-rw-r--r--drivers/net/tulip/media.c3
-rw-r--r--drivers/net/tulip/tulip_core.c50
-rw-r--r--drivers/net/tulip/winbond-840.c9
-rw-r--r--drivers/net/tulip/xircom_tulip_cb.c4
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/net/typhoon.c10
-rw-r--r--drivers/net/via-rhine.c26
-rw-r--r--drivers/net/via-velocity.c6
-rw-r--r--drivers/net/via-velocity.h4
-rw-r--r--drivers/net/wan/Kconfig2
-rw-r--r--drivers/net/wan/farsync.c4
-rw-r--r--drivers/net/wan/hdlc_cisco.c5
-rw-r--r--drivers/net/wan/hdlc_ppp.c3
-rw-r--r--drivers/net/wan/hdlc_raw.c3
-rw-r--r--drivers/net/wan/sdla_fr.c7
-rw-r--r--drivers/net/wan/sdla_ft1.c3
-rw-r--r--drivers/net/wan/sdla_ppp.c3
-rw-r--r--drivers/net/wan/sdla_x25.c3
-rw-r--r--drivers/net/wan/wanpipe_multppp.c9
-rw-r--r--drivers/net/wan/wanxl.c5
-rw-r--r--drivers/net/wan/x25_asy.c2
-rw-r--r--drivers/net/wd.c18
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/airo.c20
-rw-r--r--drivers/net/wireless/airo_cs.c17
-rw-r--r--drivers/net/wireless/airport.c8
-rw-r--r--drivers/net/wireless/arlan-main.c26
-rw-r--r--drivers/net/wireless/atmel_cs.c39
-rw-r--r--drivers/net/wireless/netwave_cs.c14
-rw-r--r--drivers/net/wireless/orinoco.c2465
-rw-r--r--drivers/net/wireless/orinoco.h30
-rw-r--r--drivers/net/wireless/orinoco_cs.c56
-rw-r--r--drivers/net/wireless/prism54/isl_38xx.c6
-rw-r--r--drivers/net/wireless/ray_cs.c14
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--drivers/net/wireless/wavelan_cs.c17
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h1
-rw-r--r--drivers/net/wireless/wl3501_cs.c26
-rw-r--r--drivers/net/yellowfin.c8
187 files changed, 6356 insertions, 6831 deletions
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index 29dfd47f41d2..5c5eebdb6914 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -171,12 +171,7 @@ struct net_device * __init el2_probe(int unit)
171 err = do_el2_probe(dev); 171 err = do_el2_probe(dev);
172 if (err) 172 if (err)
173 goto out; 173 goto out;
174 err = register_netdev(dev);
175 if (err)
176 goto out1;
177 return dev; 174 return dev;
178out1:
179 cleanup_card(dev);
180out: 175out:
181 free_netdev(dev); 176 free_netdev(dev);
182 return ERR_PTR(err); 177 return ERR_PTR(err);
@@ -356,6 +351,10 @@ el2_probe1(struct net_device *dev, int ioaddr)
356 dev->poll_controller = ei_poll; 351 dev->poll_controller = ei_poll;
357#endif 352#endif
358 353
354 retval = register_netdev(dev);
355 if (retval)
356 goto out1;
357
359 if (dev->mem_start) 358 if (dev->mem_start)
360 printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n", 359 printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n",
361 dev->name, ei_status.name, (wordlength+1)<<3, 360 dev->name, ei_status.name, (wordlength+1)<<3,
@@ -715,11 +714,8 @@ init_module(void)
715 dev->base_addr = io[this_dev]; 714 dev->base_addr = io[this_dev];
716 dev->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */ 715 dev->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */
717 if (do_el2_probe(dev) == 0) { 716 if (do_el2_probe(dev) == 0) {
718 if (register_netdev(dev) == 0) { 717 dev_el2[found++] = dev;
719 dev_el2[found++] = dev; 718 continue;
720 continue;
721 }
722 cleanup_card(dev);
723 } 719 }
724 free_netdev(dev); 720 free_netdev(dev);
725 printk(KERN_WARNING "3c503.c: No 3c503 card found (i/o = 0x%x).\n", io[this_dev]); 721 printk(KERN_WARNING "3c503.c: No 3c503 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 76fa8cc24085..111601ca4ca3 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -272,7 +272,7 @@ static inline void set_hsf(struct net_device *dev, int hsf)
272 272
273static int start_receive(struct net_device *, pcb_struct *); 273static int start_receive(struct net_device *, pcb_struct *);
274 274
275inline static void adapter_reset(struct net_device *dev) 275static inline void adapter_reset(struct net_device *dev)
276{ 276{
277 unsigned long timeout; 277 unsigned long timeout;
278 elp_device *adapter = dev->priv; 278 elp_device *adapter = dev->priv;
@@ -1317,8 +1317,7 @@ static int __init elp_sense(struct net_device *dev)
1317 if (orig_HSR & DIR) { 1317 if (orig_HSR & DIR) {
1318 /* If HCR.DIR is up, we pull it down. HSR.DIR should follow. */ 1318 /* If HCR.DIR is up, we pull it down. HSR.DIR should follow. */
1319 outb(0, dev->base_addr + PORT_CONTROL); 1319 outb(0, dev->base_addr + PORT_CONTROL);
1320 set_current_state(TASK_UNINTERRUPTIBLE); 1320 msleep(300);
1321 schedule_timeout(30*HZ/100);
1322 if (inb_status(addr) & DIR) { 1321 if (inb_status(addr) & DIR) {
1323 if (elp_debug > 0) 1322 if (elp_debug > 0)
1324 printk(notfound_msg, 2); 1323 printk(notfound_msg, 2);
@@ -1327,8 +1326,7 @@ static int __init elp_sense(struct net_device *dev)
1327 } else { 1326 } else {
1328 /* If HCR.DIR is down, we pull it up. HSR.DIR should follow. */ 1327 /* If HCR.DIR is down, we pull it up. HSR.DIR should follow. */
1329 outb(DIR, dev->base_addr + PORT_CONTROL); 1328 outb(DIR, dev->base_addr + PORT_CONTROL);
1330 set_current_state(TASK_UNINTERRUPTIBLE); 1329 msleep(300);
1331 schedule_timeout(30*HZ/100);
1332 if (!(inb_status(addr) & DIR)) { 1330 if (!(inb_status(addr) & DIR)) {
1333 if (elp_debug > 0) 1331 if (elp_debug > 0)
1334 printk(notfound_msg, 3); 1332 printk(notfound_msg, 3);
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index e843109d4f62..977935a3d898 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -217,6 +217,7 @@ static void el3_poll_controller(struct net_device *dev);
217static struct eisa_device_id el3_eisa_ids[] = { 217static struct eisa_device_id el3_eisa_ids[] = {
218 { "TCM5092" }, 218 { "TCM5092" },
219 { "TCM5093" }, 219 { "TCM5093" },
220 { "TCM5095" },
220 { "" } 221 { "" }
221}; 222};
222 223
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index c4cf4fcd1344..91d1c4c24d9b 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -365,7 +365,7 @@ static int nopnp;
365#endif /* __ISAPNP__ */ 365#endif /* __ISAPNP__ */
366 366
367static struct net_device *corkscrew_scan(int unit); 367static struct net_device *corkscrew_scan(int unit);
368static void corkscrew_setup(struct net_device *dev, int ioaddr, 368static int corkscrew_setup(struct net_device *dev, int ioaddr,
369 struct pnp_dev *idev, int card_number); 369 struct pnp_dev *idev, int card_number);
370static int corkscrew_open(struct net_device *dev); 370static int corkscrew_open(struct net_device *dev);
371static void corkscrew_timer(unsigned long arg); 371static void corkscrew_timer(unsigned long arg);
@@ -539,10 +539,9 @@ static struct net_device *corkscrew_scan(int unit)
539 printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", 539 printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n",
540 inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); 540 inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
541 /* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */ 541 /* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */
542 corkscrew_setup(dev, ioaddr, idev, cards_found++);
543 SET_NETDEV_DEV(dev, &idev->dev); 542 SET_NETDEV_DEV(dev, &idev->dev);
544 pnp_cards++; 543 pnp_cards++;
545 err = register_netdev(dev); 544 err = corkscrew_setup(dev, ioaddr, idev, cards_found++);
546 if (!err) 545 if (!err)
547 return dev; 546 return dev;
548 cleanup_card(dev); 547 cleanup_card(dev);
@@ -558,8 +557,7 @@ no_pnp:
558 557
559 printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n", 558 printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n",
560 inl(ioaddr + 0x2002), inw(ioaddr + 0x2000)); 559 inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
561 corkscrew_setup(dev, ioaddr, NULL, cards_found++); 560 err = corkscrew_setup(dev, ioaddr, NULL, cards_found++);
562 err = register_netdev(dev);
563 if (!err) 561 if (!err)
564 return dev; 562 return dev;
565 cleanup_card(dev); 563 cleanup_card(dev);
@@ -568,7 +566,7 @@ no_pnp:
568 return NULL; 566 return NULL;
569} 567}
570 568
571static void corkscrew_setup(struct net_device *dev, int ioaddr, 569static int corkscrew_setup(struct net_device *dev, int ioaddr,
572 struct pnp_dev *idev, int card_number) 570 struct pnp_dev *idev, int card_number)
573{ 571{
574 struct corkscrew_private *vp = netdev_priv(dev); 572 struct corkscrew_private *vp = netdev_priv(dev);
@@ -691,6 +689,8 @@ static void corkscrew_setup(struct net_device *dev, int ioaddr,
691 dev->get_stats = &corkscrew_get_stats; 689 dev->get_stats = &corkscrew_get_stats;
692 dev->set_multicast_list = &set_rx_mode; 690 dev->set_multicast_list = &set_rx_mode;
693 dev->ethtool_ops = &netdev_ethtool_ops; 691 dev->ethtool_ops = &netdev_ethtool_ops;
692
693 return register_netdev(dev);
694} 694}
695 695
696 696
@@ -822,7 +822,7 @@ static int corkscrew_open(struct net_device *dev)
822 break; /* Bad news! */ 822 break; /* Bad news! */
823 skb->dev = dev; /* Mark as being used by this device. */ 823 skb->dev = dev; /* Mark as being used by this device. */
824 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 824 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
825 vp->rx_ring[i].addr = isa_virt_to_bus(skb->tail); 825 vp->rx_ring[i].addr = isa_virt_to_bus(skb->data);
826 } 826 }
827 vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ 827 vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */
828 outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); 828 outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr);
@@ -1406,7 +1406,7 @@ static int boomerang_rx(struct net_device *dev)
1406 break; /* Bad news! */ 1406 break; /* Bad news! */
1407 skb->dev = dev; /* Mark as being used by this device. */ 1407 skb->dev = dev; /* Mark as being used by this device. */
1408 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1408 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1409 vp->rx_ring[entry].addr = isa_virt_to_bus(skb->tail); 1409 vp->rx_ring[entry].addr = isa_virt_to_bus(skb->data);
1410 vp->rx_skbuff[entry] = skb; 1410 vp->rx_skbuff[entry] = skb;
1411 } 1411 }
1412 vp->rx_ring[entry].status = 0; /* Clear complete bit. */ 1412 vp->rx_ring[entry].status = 0; /* Clear complete bit. */
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 8f6b2fa13e28..9e1fe2e0478c 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -572,6 +572,10 @@ static int __init do_elmc_probe(struct net_device *dev)
572 dev->flags&=~IFF_MULTICAST; /* Multicast doesn't work */ 572 dev->flags&=~IFF_MULTICAST; /* Multicast doesn't work */
573#endif 573#endif
574 574
575 retval = register_netdev(dev);
576 if (retval)
577 goto err_out;
578
575 return 0; 579 return 0;
576err_out: 580err_out:
577 mca_set_adapter_procfn(slot, NULL, NULL); 581 mca_set_adapter_procfn(slot, NULL, NULL);
@@ -600,12 +604,7 @@ struct net_device * __init elmc_probe(int unit)
600 err = do_elmc_probe(dev); 604 err = do_elmc_probe(dev);
601 if (err) 605 if (err)
602 goto out; 606 goto out;
603 err = register_netdev(dev);
604 if (err)
605 goto out1;
606 return dev; 607 return dev;
607out1:
608 cleanup_card(dev);
609out: 608out:
610 free_netdev(dev); 609 free_netdev(dev);
611 return ERR_PTR(err); 610 return ERR_PTR(err);
@@ -1275,6 +1274,7 @@ module_param_array(irq, int, NULL, 0);
1275module_param_array(io, int, NULL, 0); 1274module_param_array(io, int, NULL, 0);
1276MODULE_PARM_DESC(io, "EtherLink/MC I/O base address(es)"); 1275MODULE_PARM_DESC(io, "EtherLink/MC I/O base address(es)");
1277MODULE_PARM_DESC(irq, "EtherLink/MC IRQ number(s)"); 1276MODULE_PARM_DESC(irq, "EtherLink/MC IRQ number(s)");
1277MODULE_LICENSE("GPL");
1278 1278
1279int init_module(void) 1279int init_module(void)
1280{ 1280{
@@ -1288,12 +1288,9 @@ int init_module(void)
1288 dev->irq=irq[this_dev]; 1288 dev->irq=irq[this_dev];
1289 dev->base_addr=io[this_dev]; 1289 dev->base_addr=io[this_dev];
1290 if (do_elmc_probe(dev) == 0) { 1290 if (do_elmc_probe(dev) == 0) {
1291 if (register_netdev(dev) == 0) { 1291 dev_elmc[this_dev] = dev;
1292 dev_elmc[this_dev] = dev; 1292 found++;
1293 found++; 1293 continue;
1294 continue;
1295 }
1296 cleanup_card(dev);
1297 } 1294 }
1298 free_netdev(dev); 1295 free_netdev(dev);
1299 if (io[this_dev]==0) 1296 if (io[this_dev]==0)
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 80ec9aa575bb..07746b95fd83 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1802,7 +1802,7 @@ vortex_open(struct net_device *dev)
1802 break; /* Bad news! */ 1802 break; /* Bad news! */
1803 skb->dev = dev; /* Mark as being used by this device. */ 1803 skb->dev = dev; /* Mark as being used by this device. */
1804 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1804 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1805 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->tail, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); 1805 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
1806 } 1806 }
1807 if (i != RX_RING_SIZE) { 1807 if (i != RX_RING_SIZE) {
1808 int j; 1808 int j;
@@ -2632,7 +2632,7 @@ boomerang_rx(struct net_device *dev)
2632 pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); 2632 pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
2633 /* 'skb_put()' points to the start of sk_buff data area. */ 2633 /* 'skb_put()' points to the start of sk_buff data area. */
2634 memcpy(skb_put(skb, pkt_len), 2634 memcpy(skb_put(skb, pkt_len),
2635 vp->rx_skbuff[entry]->tail, 2635 vp->rx_skbuff[entry]->data,
2636 pkt_len); 2636 pkt_len);
2637 pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); 2637 pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
2638 vp->rx_copy++; 2638 vp->rx_copy++;
@@ -2678,7 +2678,7 @@ boomerang_rx(struct net_device *dev)
2678 } 2678 }
2679 skb->dev = dev; /* Mark as being used by this device. */ 2679 skb->dev = dev; /* Mark as being used by this device. */
2680 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 2680 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
2681 vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->tail, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); 2681 vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
2682 vp->rx_skbuff[entry] = skb; 2682 vp->rx_skbuff[entry] = skb;
2683 } 2683 }
2684 vp->rx_ring[entry].status = 0; /* Clear complete bit. */ 2684 vp->rx_ring[entry].status = 0; /* Clear complete bit. */
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 72cdf19e1be1..34b80de34fae 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -61,6 +61,7 @@
61#include <linux/etherdevice.h> 61#include <linux/etherdevice.h>
62#include <linux/init.h> 62#include <linux/init.h>
63#include <linux/pci.h> 63#include <linux/pci.h>
64#include <linux/dma-mapping.h>
64#include <linux/delay.h> 65#include <linux/delay.h>
65#include <linux/ethtool.h> 66#include <linux/ethtool.h>
66#include <linux/mii.h> 67#include <linux/mii.h>
@@ -595,7 +596,7 @@ rx_status_loop:
595 596
596 mapping = 597 mapping =
597 cp->rx_skb[rx_tail].mapping = 598 cp->rx_skb[rx_tail].mapping =
598 pci_map_single(cp->pdev, new_skb->tail, 599 pci_map_single(cp->pdev, new_skb->data,
599 buflen, PCI_DMA_FROMDEVICE); 600 buflen, PCI_DMA_FROMDEVICE);
600 cp->rx_skb[rx_tail].skb = new_skb; 601 cp->rx_skb[rx_tail].skb = new_skb;
601 602
@@ -1100,7 +1101,7 @@ static int cp_refill_rx (struct cp_private *cp)
1100 skb_reserve(skb, RX_OFFSET); 1101 skb_reserve(skb, RX_OFFSET);
1101 1102
1102 cp->rx_skb[i].mapping = pci_map_single(cp->pdev, 1103 cp->rx_skb[i].mapping = pci_map_single(cp->pdev,
1103 skb->tail, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1104 skb->data, cp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1104 cp->rx_skb[i].skb = skb; 1105 cp->rx_skb[i].skb = skb;
1105 1106
1106 cp->rx_ring[i].opts2 = 0; 1107 cp->rx_ring[i].opts2 = 0;
@@ -1515,22 +1516,22 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1515 struct ethtool_stats *estats, u64 *tmp_stats) 1516 struct ethtool_stats *estats, u64 *tmp_stats)
1516{ 1517{
1517 struct cp_private *cp = netdev_priv(dev); 1518 struct cp_private *cp = netdev_priv(dev);
1518 unsigned int work = 100;
1519 int i; 1519 int i;
1520 1520
1521 memset(cp->nic_stats, 0, sizeof(struct cp_dma_stats));
1522
1521 /* begin NIC statistics dump */ 1523 /* begin NIC statistics dump */
1522 cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16); 1524 cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16);
1523 cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats); 1525 cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats);
1524 cpr32(StatsAddr); 1526 cpr32(StatsAddr);
1525 1527
1526 while (work-- > 0) { 1528 for (i = 0; i < 1000; i++) {
1527 if ((cpr32(StatsAddr) & DumpStats) == 0) 1529 if ((cpr32(StatsAddr) & DumpStats) == 0)
1528 break; 1530 break;
1529 cpu_relax(); 1531 udelay(10);
1530 } 1532 }
1531 1533 cpw32(StatsAddr, 0);
1532 if (cpr32(StatsAddr) & DumpStats) 1534 cpw32(StatsAddr + 4, 0);
1533 return /* -EIO */;
1534 1535
1535 i = 0; 1536 i = 0;
1536 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok); 1537 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok);
@@ -1732,19 +1733,19 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1732 1733
1733 /* Configure DMA attributes. */ 1734 /* Configure DMA attributes. */
1734 if ((sizeof(dma_addr_t) > 4) && 1735 if ((sizeof(dma_addr_t) > 4) &&
1735 !pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL) && 1736 !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) &&
1736 !pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { 1737 !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
1737 pci_using_dac = 1; 1738 pci_using_dac = 1;
1738 } else { 1739 } else {
1739 pci_using_dac = 0; 1740 pci_using_dac = 0;
1740 1741
1741 rc = pci_set_dma_mask(pdev, 0xffffffffULL); 1742 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
1742 if (rc) { 1743 if (rc) {
1743 printk(KERN_ERR PFX "No usable DMA configuration, " 1744 printk(KERN_ERR PFX "No usable DMA configuration, "
1744 "aborting.\n"); 1745 "aborting.\n");
1745 goto err_out_res; 1746 goto err_out_res;
1746 } 1747 }
1747 rc = pci_set_consistent_dma_mask(pdev, 0xffffffffULL); 1748 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
1748 if (rc) { 1749 if (rc) {
1749 printk(KERN_ERR PFX "No usable consistent DMA configuration, " 1750 printk(KERN_ERR PFX "No usable consistent DMA configuration, "
1750 "aborting.\n"); 1751 "aborting.\n");
@@ -1896,6 +1897,7 @@ static int cp_resume (struct pci_dev *pdev)
1896{ 1897{
1897 struct net_device *dev; 1898 struct net_device *dev;
1898 struct cp_private *cp; 1899 struct cp_private *cp;
1900 unsigned long flags;
1899 1901
1900 dev = pci_get_drvdata (pdev); 1902 dev = pci_get_drvdata (pdev);
1901 cp = netdev_priv(dev); 1903 cp = netdev_priv(dev);
@@ -1909,6 +1911,12 @@ static int cp_resume (struct pci_dev *pdev)
1909 1911
1910 cp_init_hw (cp); 1912 cp_init_hw (cp);
1911 netif_start_queue (dev); 1913 netif_start_queue (dev);
1914
1915 spin_lock_irqsave (&cp->lock, flags);
1916
1917 mii_check_media(&cp->mii_if, netif_msg_link(cp), FALSE);
1918
1919 spin_unlock_irqrestore (&cp->lock, flags);
1912 1920
1913 return 0; 1921 return 0;
1914} 1922}
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 047202c4d9a8..4c2cf7bbd252 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -126,14 +126,14 @@
126#define USE_IO_OPS 1 126#define USE_IO_OPS 1
127#endif 127#endif
128 128
129/* define to 1 to enable copious debugging info */ 129/* define to 1, 2 or 3 to enable copious debugging info */
130#undef RTL8139_DEBUG 130#define RTL8139_DEBUG 0
131 131
132/* define to 1 to disable lightweight runtime debugging checks */ 132/* define to 1 to disable lightweight runtime debugging checks */
133#undef RTL8139_NDEBUG 133#undef RTL8139_NDEBUG
134 134
135 135
136#ifdef RTL8139_DEBUG 136#if RTL8139_DEBUG
137/* note: prints function name for you */ 137/* note: prints function name for you */
138# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) 138# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
139#else 139#else
@@ -1606,7 +1606,7 @@ static int rtl8139_thread (void *data)
1606 do { 1606 do {
1607 timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout); 1607 timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
1608 /* make swsusp happy with our thread */ 1608 /* make swsusp happy with our thread */
1609 try_to_freeze(PF_FREEZE); 1609 try_to_freeze();
1610 } while (!signal_pending (current) && (timeout > 0)); 1610 } while (!signal_pending (current) && (timeout > 0));
1611 1611
1612 if (signal_pending (current)) { 1612 if (signal_pending (current)) {
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 65f97b1dc581..13b745b39667 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -546,11 +546,11 @@ static inline void init_rx_bufs(struct net_device *dev)
546 rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1)); 546 rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1));
547 rbd->b_addr = WSWAPrbd(virt_to_bus(rbd)); 547 rbd->b_addr = WSWAPrbd(virt_to_bus(rbd));
548 rbd->skb = skb; 548 rbd->skb = skb;
549 rbd->v_data = skb->tail; 549 rbd->v_data = skb->data;
550 rbd->b_data = WSWAPchar(virt_to_bus(skb->tail)); 550 rbd->b_data = WSWAPchar(virt_to_bus(skb->data));
551 rbd->size = PKT_BUF_SZ; 551 rbd->size = PKT_BUF_SZ;
552#ifdef __mc68000__ 552#ifdef __mc68000__
553 cache_clear(virt_to_phys(skb->tail), PKT_BUF_SZ); 553 cache_clear(virt_to_phys(skb->data), PKT_BUF_SZ);
554#endif 554#endif
555 } 555 }
556 lp->rbd_head = lp->rbds; 556 lp->rbd_head = lp->rbds;
@@ -816,10 +816,10 @@ static inline int i596_rx(struct net_device *dev)
816 rx_in_place = 1; 816 rx_in_place = 1;
817 rbd->skb = newskb; 817 rbd->skb = newskb;
818 newskb->dev = dev; 818 newskb->dev = dev;
819 rbd->v_data = newskb->tail; 819 rbd->v_data = newskb->data;
820 rbd->b_data = WSWAPchar(virt_to_bus(newskb->tail)); 820 rbd->b_data = WSWAPchar(virt_to_bus(newskb->data));
821#ifdef __mc68000__ 821#ifdef __mc68000__
822 cache_clear(virt_to_phys(newskb->tail), PKT_BUF_SZ); 822 cache_clear(virt_to_phys(newskb->data), PKT_BUF_SZ);
823#endif 823#endif
824 } 824 }
825 else 825 else
@@ -840,7 +840,7 @@ memory_squeeze:
840 skb->protocol=eth_type_trans(skb,dev); 840 skb->protocol=eth_type_trans(skb,dev);
841 skb->len = pkt_len; 841 skb->len = pkt_len;
842#ifdef __mc68000__ 842#ifdef __mc68000__
843 cache_clear(virt_to_phys(rbd->skb->tail), 843 cache_clear(virt_to_phys(rbd->skb->data),
844 pkt_len); 844 pkt_len);
845#endif 845#endif
846 netif_rx(skb); 846 netif_rx(skb);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fa9f76c953dd..8edb6936fb9b 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -3,6 +3,8 @@
3# Network device configuration 3# Network device configuration
4# 4#
5 5
6menu "Network device support"
7
6config NETDEVICES 8config NETDEVICES
7 depends on NET 9 depends on NET
8 bool "Network device support" 10 bool "Network device support"
@@ -21,9 +23,12 @@ config NETDEVICES
21 23
22 If unsure, say Y. 24 If unsure, say Y.
23 25
26# All the following symbols are dependent on NETDEVICES - do not repeat
27# that for each of the symbols.
28if NETDEVICES
29
24config DUMMY 30config DUMMY
25 tristate "Dummy net driver support" 31 tristate "Dummy net driver support"
26 depends on NETDEVICES
27 ---help--- 32 ---help---
28 This is essentially a bit-bucket device (i.e. traffic you send to 33 This is essentially a bit-bucket device (i.e. traffic you send to
29 this device is consigned into oblivion) with a configurable IP 34 this device is consigned into oblivion) with a configurable IP
@@ -43,7 +48,6 @@ config DUMMY
43 48
44config BONDING 49config BONDING
45 tristate "Bonding driver support" 50 tristate "Bonding driver support"
46 depends on NETDEVICES
47 depends on INET 51 depends on INET
48 ---help--- 52 ---help---
49 Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet 53 Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
@@ -61,7 +65,6 @@ config BONDING
61 65
62config EQUALIZER 66config EQUALIZER
63 tristate "EQL (serial line load balancing) support" 67 tristate "EQL (serial line load balancing) support"
64 depends on NETDEVICES
65 ---help--- 68 ---help---
66 If you have two serial connections to some other computer (this 69 If you have two serial connections to some other computer (this
67 usually requires two modems and two telephone lines) and you use 70 usually requires two modems and two telephone lines) and you use
@@ -81,7 +84,6 @@ config EQUALIZER
81 84
82config TUN 85config TUN
83 tristate "Universal TUN/TAP device driver support" 86 tristate "Universal TUN/TAP device driver support"
84 depends on NETDEVICES
85 select CRC32 87 select CRC32
86 ---help--- 88 ---help---
87 TUN/TAP provides packet reception and transmission for user space 89 TUN/TAP provides packet reception and transmission for user space
@@ -105,7 +107,7 @@ config TUN
105 107
106config NET_SB1000 108config NET_SB1000
107 tristate "General Instruments Surfboard 1000" 109 tristate "General Instruments Surfboard 1000"
108 depends on NETDEVICES && PNP 110 depends on PNP
109 ---help--- 111 ---help---
110 This is a driver for the General Instrument (also known as 112 This is a driver for the General Instrument (also known as
111 NextLevel) SURFboard 1000 internal 113 NextLevel) SURFboard 1000 internal
@@ -127,16 +129,14 @@ config NET_SB1000
127 129
128 If you don't have this card, of course say N. 130 If you don't have this card, of course say N.
129 131
130if NETDEVICES
131 source "drivers/net/arcnet/Kconfig" 132 source "drivers/net/arcnet/Kconfig"
132endif
133 133
134# 134#
135# Ethernet 135# Ethernet
136# 136#
137 137
138menu "Ethernet (10 or 100Mbit)" 138menu "Ethernet (10 or 100Mbit)"
139 depends on NETDEVICES && !UML 139 depends on !UML
140 140
141config NET_ETHERNET 141config NET_ETHERNET
142 bool "Ethernet (10 or 100Mbit)" 142 bool "Ethernet (10 or 100Mbit)"
@@ -1135,7 +1135,7 @@ config IBMLANA
1135 1135
1136config IBMVETH 1136config IBMVETH
1137 tristate "IBM LAN Virtual Ethernet support" 1137 tristate "IBM LAN Virtual Ethernet support"
1138 depends on NETDEVICES && NET_ETHERNET && PPC_PSERIES 1138 depends on NET_ETHERNET && PPC_PSERIES
1139 ---help--- 1139 ---help---
1140 This driver supports virtual ethernet adapters on newer IBM iSeries 1140 This driver supports virtual ethernet adapters on newer IBM iSeries
1141 and pSeries systems. 1141 and pSeries systems.
@@ -1145,7 +1145,7 @@ config IBMVETH
1145 be called ibmveth. 1145 be called ibmveth.
1146 1146
1147config IBM_EMAC 1147config IBM_EMAC
1148 tristate "IBM PPC4xx EMAC driver support" 1148 bool "IBM PPC4xx EMAC driver support"
1149 depends on 4xx 1149 depends on 4xx
1150 select CRC32 1150 select CRC32
1151 ---help--- 1151 ---help---
@@ -1154,7 +1154,7 @@ config IBM_EMAC
1154 1154
1155config IBM_EMAC_ERRMSG 1155config IBM_EMAC_ERRMSG
1156 bool "Verbose error messages" 1156 bool "Verbose error messages"
1157 depends on IBM_EMAC 1157 depends on IBM_EMAC && BROKEN
1158 1158
1159config IBM_EMAC_RXB 1159config IBM_EMAC_RXB
1160 int "Number of receive buffers" 1160 int "Number of receive buffers"
@@ -1320,7 +1320,7 @@ config FORCEDETH
1320 1320
1321config CS89x0 1321config CS89x0
1322 tristate "CS89x0 support" 1322 tristate "CS89x0 support"
1323 depends on NET_PCI && (ISA || ARCH_IXDP2X01) 1323 depends on (NET_PCI && (ISA || ARCH_IXDP2X01)) || ARCH_PNX0105
1324 ---help--- 1324 ---help---
1325 Support for CS89x0 chipset based Ethernet cards. If you have a 1325 Support for CS89x0 chipset based Ethernet cards. If you have a
1326 network (Ethernet) card of this type, say Y and read the 1326 network (Ethernet) card of this type, say Y and read the
@@ -1488,14 +1488,14 @@ config 8139CP
1488 will be called 8139cp. This is recommended. 1488 will be called 8139cp. This is recommended.
1489 1489
1490config 8139TOO 1490config 8139TOO
1491 tristate "RealTek RTL-8139 PCI Fast Ethernet Adapter support" 1491 tristate "RealTek RTL-8129/8130/8139 PCI Fast Ethernet Adapter support"
1492 depends on NET_PCI && PCI 1492 depends on NET_PCI && PCI
1493 select CRC32 1493 select CRC32
1494 select MII 1494 select MII
1495 ---help--- 1495 ---help---
1496 This is a driver for the Fast Ethernet PCI network cards based on 1496 This is a driver for the Fast Ethernet PCI network cards based on
1497 the RTL8139 chips. If you have one of those, say Y and read 1497 the RTL 8129/8130/8139 chips. If you have one of those, say Y and
1498 the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. 1498 read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>.
1499 1499
1500 To compile this driver as a module, choose M here: the module 1500 To compile this driver as a module, choose M here: the module
1501 will be called 8139too. This is recommended. 1501 will be called 8139too. This is recommended.
@@ -1758,7 +1758,7 @@ endmenu
1758# 1758#
1759 1759
1760menu "Ethernet (1000 Mbit)" 1760menu "Ethernet (1000 Mbit)"
1761 depends on NETDEVICES && !UML 1761 depends on !UML
1762 1762
1763config ACENIC 1763config ACENIC
1764 tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support" 1764 tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support"
@@ -2089,7 +2089,7 @@ endmenu
2089# 2089#
2090 2090
2091menu "Ethernet (10000 Mbit)" 2091menu "Ethernet (10000 Mbit)"
2092 depends on NETDEVICES && !UML 2092 depends on !UML
2093 2093
2094config IXGB 2094config IXGB
2095 tristate "Intel(R) PRO/10GbE support" 2095 tristate "Intel(R) PRO/10GbE support"
@@ -2184,11 +2184,11 @@ source "drivers/s390/net/Kconfig"
2184 2184
2185config ISERIES_VETH 2185config ISERIES_VETH
2186 tristate "iSeries Virtual Ethernet driver support" 2186 tristate "iSeries Virtual Ethernet driver support"
2187 depends on NETDEVICES && PPC_ISERIES 2187 depends on PPC_ISERIES
2188 2188
2189config FDDI 2189config FDDI
2190 bool "FDDI driver support" 2190 bool "FDDI driver support"
2191 depends on NETDEVICES && (PCI || EISA) 2191 depends on (PCI || EISA)
2192 help 2192 help
2193 Fiber Distributed Data Interface is a high speed local area network 2193 Fiber Distributed Data Interface is a high speed local area network
2194 design; essentially a replacement for high speed Ethernet. FDDI can 2194 design; essentially a replacement for high speed Ethernet. FDDI can
@@ -2237,7 +2237,7 @@ config SKFP
2237 2237
2238config HIPPI 2238config HIPPI
2239 bool "HIPPI driver support (EXPERIMENTAL)" 2239 bool "HIPPI driver support (EXPERIMENTAL)"
2240 depends on NETDEVICES && EXPERIMENTAL && INET && PCI 2240 depends on EXPERIMENTAL && INET && PCI
2241 help 2241 help
2242 HIgh Performance Parallel Interface (HIPPI) is a 800Mbit/sec and 2242 HIgh Performance Parallel Interface (HIPPI) is a 800Mbit/sec and
2243 1600Mbit/sec dual-simplex switched or point-to-point network. HIPPI 2243 1600Mbit/sec dual-simplex switched or point-to-point network. HIPPI
@@ -2269,7 +2269,7 @@ config ROADRUNNER_LARGE_RINGS
2269 2269
2270config PLIP 2270config PLIP
2271 tristate "PLIP (parallel port) support" 2271 tristate "PLIP (parallel port) support"
2272 depends on NETDEVICES && PARPORT 2272 depends on PARPORT
2273 ---help--- 2273 ---help---
2274 PLIP (Parallel Line Internet Protocol) is used to create a 2274 PLIP (Parallel Line Internet Protocol) is used to create a
2275 reasonably fast mini network consisting of two (or, rarely, more) 2275 reasonably fast mini network consisting of two (or, rarely, more)
@@ -2305,7 +2305,6 @@ config PLIP
2305 2305
2306config PPP 2306config PPP
2307 tristate "PPP (point-to-point protocol) support" 2307 tristate "PPP (point-to-point protocol) support"
2308 depends on NETDEVICES
2309 ---help--- 2308 ---help---
2310 PPP (Point to Point Protocol) is a newer and better SLIP. It serves 2309 PPP (Point to Point Protocol) is a newer and better SLIP. It serves
2311 the same purpose: sending Internet traffic over telephone (and other 2310 the same purpose: sending Internet traffic over telephone (and other
@@ -2441,7 +2440,6 @@ config PPPOATM
2441 2440
2442config SLIP 2441config SLIP
2443 tristate "SLIP (serial line) support" 2442 tristate "SLIP (serial line) support"
2444 depends on NETDEVICES
2445 ---help--- 2443 ---help---
2446 Say Y if you intend to use SLIP or CSLIP (compressed SLIP) to 2444 Say Y if you intend to use SLIP or CSLIP (compressed SLIP) to
2447 connect to your Internet service provider or to connect to some 2445 connect to your Internet service provider or to connect to some
@@ -2508,7 +2506,7 @@ config SLIP_MODE_SLIP6
2508 2506
2509config NET_FC 2507config NET_FC
2510 bool "Fibre Channel driver support" 2508 bool "Fibre Channel driver support"
2511 depends on NETDEVICES && SCSI && PCI 2509 depends on SCSI && PCI
2512 help 2510 help
2513 Fibre Channel is a high speed serial protocol mainly used to connect 2511 Fibre Channel is a high speed serial protocol mainly used to connect
2514 large storage devices to the computer; it is compatible with and 2512 large storage devices to the computer; it is compatible with and
@@ -2521,7 +2519,7 @@ config NET_FC
2521 2519
2522config SHAPER 2520config SHAPER
2523 tristate "Traffic Shaper (EXPERIMENTAL)" 2521 tristate "Traffic Shaper (EXPERIMENTAL)"
2524 depends on NETDEVICES && EXPERIMENTAL 2522 depends on EXPERIMENTAL
2525 ---help--- 2523 ---help---
2526 The traffic shaper is a virtual network device that allows you to 2524 The traffic shaper is a virtual network device that allows you to
2527 limit the rate of outgoing data flow over some other network device. 2525 limit the rate of outgoing data flow over some other network device.
@@ -2542,8 +2540,27 @@ config SHAPER
2542 2540
2543config NETCONSOLE 2541config NETCONSOLE
2544 tristate "Network console logging support (EXPERIMENTAL)" 2542 tristate "Network console logging support (EXPERIMENTAL)"
2545 depends on NETDEVICES && EXPERIMENTAL 2543 depends on EXPERIMENTAL
2546 ---help--- 2544 ---help---
2547 If you want to log kernel messages over the network, enable this. 2545 If you want to log kernel messages over the network, enable this.
2548 See <file:Documentation/networking/netconsole.txt> for details. 2546 See <file:Documentation/networking/netconsole.txt> for details.
2549 2547
2548endif #NETDEVICES
2549
2550config NETPOLL
2551 def_bool NETCONSOLE
2552
2553config NETPOLL_RX
2554 bool "Netpoll support for trapping incoming packets"
2555 default n
2556 depends on NETPOLL
2557
2558config NETPOLL_TRAP
2559 bool "Netpoll traffic trapping"
2560 default n
2561 depends on NETPOLL
2562
2563config NET_POLL_CONTROLLER
2564 def_bool NETPOLL
2565
2566endmenu
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index 24fba36b5c1d..91791ba37769 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -146,12 +146,7 @@ struct net_device * __init ac3200_probe(int unit)
146 err = do_ac3200_probe(dev); 146 err = do_ac3200_probe(dev);
147 if (err) 147 if (err)
148 goto out; 148 goto out;
149 err = register_netdev(dev);
150 if (err)
151 goto out1;
152 return dev; 149 return dev;
153out1:
154 cleanup_card(dev);
155out: 150out:
156 free_netdev(dev); 151 free_netdev(dev);
157 return ERR_PTR(err); 152 return ERR_PTR(err);
@@ -273,7 +268,14 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
273 dev->poll_controller = ei_poll; 268 dev->poll_controller = ei_poll;
274#endif 269#endif
275 NS8390_init(dev, 0); 270 NS8390_init(dev, 0);
271
272 retval = register_netdev(dev);
273 if (retval)
274 goto out2;
276 return 0; 275 return 0;
276out2:
277 if (ei_status.reg0)
278 iounmap((void *)dev->mem_start);
277out1: 279out1:
278 free_irq(dev->irq, dev); 280 free_irq(dev->irq, dev);
279out: 281out:
@@ -392,11 +394,8 @@ init_module(void)
392 dev->base_addr = io[this_dev]; 394 dev->base_addr = io[this_dev];
393 dev->mem_start = mem[this_dev]; /* Currently ignored by driver */ 395 dev->mem_start = mem[this_dev]; /* Currently ignored by driver */
394 if (do_ac3200_probe(dev) == 0) { 396 if (do_ac3200_probe(dev) == 0) {
395 if (register_netdev(dev) == 0) { 397 dev_ac32[found++] = dev;
396 dev_ac32[found++] = dev; 398 continue;
397 continue;
398 }
399 cleanup_card(dev);
400 } 399 }
401 free_netdev(dev); 400 free_netdev(dev);
402 printk(KERN_WARNING "ac3200.c: No ac3200 card found (i/o = 0x%x).\n", io[this_dev]); 401 printk(KERN_WARNING "ac3200.c: No ac3200 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 6eea3a8accb7..dbecc6bf7851 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -58,6 +58,7 @@
58#include <linux/errno.h> 58#include <linux/errno.h>
59#include <linux/ioport.h> 59#include <linux/ioport.h>
60#include <linux/pci.h> 60#include <linux/pci.h>
61#include <linux/dma-mapping.h>
61#include <linux/kernel.h> 62#include <linux/kernel.h>
62#include <linux/netdevice.h> 63#include <linux/netdevice.h>
63#include <linux/etherdevice.h> 64#include <linux/etherdevice.h>
@@ -1167,9 +1168,9 @@ static int __devinit ace_init(struct net_device *dev)
1167 /* 1168 /*
1168 * Configure DMA attributes. 1169 * Configure DMA attributes.
1169 */ 1170 */
1170 if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { 1171 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
1171 ap->pci_using_dac = 1; 1172 ap->pci_using_dac = 1;
1172 } else if (!pci_set_dma_mask(pdev, 0xffffffffULL)) { 1173 } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
1173 ap->pci_using_dac = 0; 1174 ap->pci_using_dac = 0;
1174 } else { 1175 } else {
1175 ecode = -ENODEV; 1176 ecode = -ENODEV;
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index b7dd7260cafb..d9ba8be72af8 100755
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -87,6 +87,7 @@ Revision History:
87#include <linux/if_vlan.h> 87#include <linux/if_vlan.h>
88#include <linux/ctype.h> 88#include <linux/ctype.h>
89#include <linux/crc32.h> 89#include <linux/crc32.h>
90#include <linux/dma-mapping.h>
90 91
91#include <asm/system.h> 92#include <asm/system.h>
92#include <asm/io.h> 93#include <asm/io.h>
@@ -1289,7 +1290,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *reg
1289 writel(intr0, mmio + INT0); 1290 writel(intr0, mmio + INT0);
1290 1291
1291 /* Check if Receive Interrupt has occurred. */ 1292 /* Check if Receive Interrupt has occurred. */
1292#if CONFIG_AMD8111E_NAPI 1293#ifdef CONFIG_AMD8111E_NAPI
1293 if(intr0 & RINT0){ 1294 if(intr0 & RINT0){
1294 if(netif_rx_schedule_prep(dev)){ 1295 if(netif_rx_schedule_prep(dev)){
1295 /* Disable receive interupts */ 1296 /* Disable receive interupts */
@@ -2006,12 +2007,11 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
2006 } 2007 }
2007 2008
2008 /* Initialize DMA */ 2009 /* Initialize DMA */
2009 if(!pci_dma_supported(pdev, 0xffffffff)){ 2010 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) < 0) {
2010 printk(KERN_ERR "amd8111e: DMA not supported," 2011 printk(KERN_ERR "amd8111e: DMA not supported,"
2011 "exiting.\n"); 2012 "exiting.\n");
2012 goto err_free_reg; 2013 goto err_free_reg;
2013 } else 2014 }
2014 pdev->dma_mask = 0xffffffff;
2015 2015
2016 reg_addr = pci_resource_start(pdev, 0); 2016 reg_addr = pci_resource_start(pdev, 0);
2017 reg_len = pci_resource_len(pdev, 0); 2017 reg_len = pci_resource_len(pdev, 0);
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig
index 69c488d933a2..b14e89004c3a 100644
--- a/drivers/net/appletalk/Kconfig
+++ b/drivers/net/appletalk/Kconfig
@@ -1,6 +1,33 @@
1# 1#
2# Appletalk driver configuration 2# Appletalk driver configuration
3# 3#
4config ATALK
5 tristate "Appletalk protocol support"
6 select LLC
7 ---help---
8 AppleTalk is the protocol that Apple computers can use to communicate
9 on a network. If your Linux box is connected to such a network and you
10 wish to connect to it, say Y. You will need to use the netatalk package
11 so that your Linux box can act as a print and file server for Macs as
12 well as access AppleTalk printers. Check out
13 <http://www.zettabyte.net/netatalk/> on the WWW for details.
14 EtherTalk is the name used for AppleTalk over Ethernet and the
15 cheaper and slower LocalTalk is AppleTalk over a proprietary Apple
16 network using serial links. EtherTalk and LocalTalk are fully
17 supported by Linux.
18
19 General information about how to connect Linux, Windows machines and
20 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>. The
21 NET-3-HOWTO, available from
22 <http://www.tldp.org/docs.html#howto>, contains valuable
23 information as well.
24
25 To compile this driver as a module, choose M here: the module will be
26 called appletalk. You almost certainly want to compile it as a
27 module so you can restart your AppleTalk stack without rebooting
28 your machine. I hear that the GNU boycott of Apple is over, so
29 even politically correct people are allowed to say Y here.
30
4config DEV_APPLETALK 31config DEV_APPLETALK
5 bool "Appletalk interfaces support" 32 bool "Appletalk interfaces support"
6 depends on ATALK 33 depends on ATALK
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index db4f369637b6..d5666c37cb0d 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1109,8 +1109,7 @@ struct net_device * __init ltpc_probe(void)
1109 inb_p(io+1); 1109 inb_p(io+1);
1110 inb_p(io+3); 1110 inb_p(io+3);
1111 1111
1112 set_current_state(TASK_UNINTERRUPTIBLE); 1112 msleep(20);
1113 schedule_timeout(2*HZ/100);
1114 1113
1115 inb_p(io+0); 1114 inb_p(io+0);
1116 inb_p(io+2); 1115 inb_p(io+2);
@@ -1120,8 +1119,7 @@ struct net_device * __init ltpc_probe(void)
1120 inb_p(io+5); /* enable dma */ 1119 inb_p(io+5); /* enable dma */
1121 inb_p(io+6); /* tri-state interrupt line */ 1120 inb_p(io+6); /* tri-state interrupt line */
1122 1121
1123 set_current_state(TASK_UNINTERRUPTIBLE); 1122 ssleep(1);
1124 schedule_timeout(HZ);
1125 1123
1126 /* now, figure out which dma channel we're using, unless it's 1124 /* now, figure out which dma channel we're using, unless it's
1127 already been specified */ 1125 already been specified */
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 2e28c201dcc0..942a2819576c 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -68,7 +68,6 @@ struct etherh_priv {
68 void __iomem *dma_base; 68 void __iomem *dma_base;
69 unsigned int id; 69 unsigned int id;
70 void __iomem *ctrl_port; 70 void __iomem *ctrl_port;
71 void __iomem *base;
72 unsigned char ctrl; 71 unsigned char ctrl;
73 u32 supported; 72 u32 supported;
74}; 73};
@@ -178,7 +177,7 @@ etherh_setif(struct net_device *dev)
178 switch (etherh_priv(dev)->id) { 177 switch (etherh_priv(dev)->id) {
179 case PROD_I3_ETHERLAN600: 178 case PROD_I3_ETHERLAN600:
180 case PROD_I3_ETHERLAN600A: 179 case PROD_I3_ETHERLAN600A:
181 addr = etherh_priv(dev)->base + EN0_RCNTHI; 180 addr = (void *)dev->base_addr + EN0_RCNTHI;
182 181
183 switch (dev->if_port) { 182 switch (dev->if_port) {
184 case IF_PORT_10BASE2: 183 case IF_PORT_10BASE2:
@@ -219,7 +218,7 @@ etherh_getifstat(struct net_device *dev)
219 switch (etherh_priv(dev)->id) { 218 switch (etherh_priv(dev)->id) {
220 case PROD_I3_ETHERLAN600: 219 case PROD_I3_ETHERLAN600:
221 case PROD_I3_ETHERLAN600A: 220 case PROD_I3_ETHERLAN600A:
222 addr = etherh_priv(dev)->base + EN0_RCNTHI; 221 addr = (void *)dev->base_addr + EN0_RCNTHI;
223 switch (dev->if_port) { 222 switch (dev->if_port) {
224 case IF_PORT_10BASE2: 223 case IF_PORT_10BASE2:
225 stat = 1; 224 stat = 1;
@@ -282,7 +281,7 @@ static void
282etherh_reset(struct net_device *dev) 281etherh_reset(struct net_device *dev)
283{ 282{
284 struct ei_device *ei_local = netdev_priv(dev); 283 struct ei_device *ei_local = netdev_priv(dev);
285 void __iomem *addr = etherh_priv(dev)->base; 284 void __iomem *addr = (void *)dev->base_addr;
286 285
287 writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr); 286 writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr);
288 287
@@ -328,7 +327,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
328 327
329 ei_local->dmaing = 1; 328 ei_local->dmaing = 1;
330 329
331 addr = etherh_priv(dev)->base; 330 addr = (void *)dev->base_addr;
332 dma_base = etherh_priv(dev)->dma_base; 331 dma_base = etherh_priv(dev)->dma_base;
333 332
334 count = (count + 1) & ~1; 333 count = (count + 1) & ~1;
@@ -388,7 +387,7 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int
388 387
389 ei_local->dmaing = 1; 388 ei_local->dmaing = 1;
390 389
391 addr = etherh_priv(dev)->base; 390 addr = (void *)dev->base_addr;
392 dma_base = etherh_priv(dev)->dma_base; 391 dma_base = etherh_priv(dev)->dma_base;
393 392
394 buf = skb->data; 393 buf = skb->data;
@@ -428,7 +427,7 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p
428 427
429 ei_local->dmaing = 1; 428 ei_local->dmaing = 1;
430 429
431 addr = etherh_priv(dev)->base; 430 addr = (void *)dev->base_addr;
432 dma_base = etherh_priv(dev)->dma_base; 431 dma_base = etherh_priv(dev)->dma_base;
433 432
434 writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); 433 writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
@@ -697,8 +696,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
697 eh->ctrl_port = eh->ioc_fast; 696 eh->ctrl_port = eh->ioc_fast;
698 } 697 }
699 698
700 eh->base = eh->memc + data->ns8390_offset; 699 dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset;
701 dev->base_addr = (unsigned long)eh->base;
702 eh->dma_base = eh->memc + data->dataport_offset; 700 eh->dma_base = eh->memc + data->dataport_offset;
703 eh->ctrl_port += data->ctrlport_offset; 701 eh->ctrl_port += data->ctrlport_offset;
704 702
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index b8ab2b6355eb..e613cc289749 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -34,10 +34,6 @@
34 only is it difficult to detect, it also moves around in I/O space in 34 only is it difficult to detect, it also moves around in I/O space in
35 response to inb()s from other device probes! 35 response to inb()s from other device probes!
36*/ 36*/
37/*
38 99/03/03 Allied Telesis RE1000 Plus support by T.Hagawa
39 99/12/30 port to 2.3.35 by K.Takai
40*/
41 37
42#include <linux/config.h> 38#include <linux/config.h>
43#include <linux/errno.h> 39#include <linux/errno.h>
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 3fe8ba992c38..94939f570f78 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1285,6 +1285,9 @@ static int b44_open(struct net_device *dev)
1285 b44_init_hw(bp); 1285 b44_init_hw(bp);
1286 bp->flags |= B44_FLAG_INIT_COMPLETE; 1286 bp->flags |= B44_FLAG_INIT_COMPLETE;
1287 1287
1288 netif_carrier_off(dev);
1289 b44_check_phy(bp);
1290
1288 spin_unlock_irq(&bp->lock); 1291 spin_unlock_irq(&bp->lock);
1289 1292
1290 init_timer(&bp->timer); 1293 init_timer(&bp->timer);
@@ -1927,6 +1930,7 @@ static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
1927 b44_free_rings(bp); 1930 b44_free_rings(bp);
1928 1931
1929 spin_unlock_irq(&bp->lock); 1932 spin_unlock_irq(&bp->lock);
1933 pci_disable_device(pdev);
1930 return 0; 1934 return 0;
1931} 1935}
1932 1936
@@ -1936,6 +1940,8 @@ static int b44_resume(struct pci_dev *pdev)
1936 struct b44 *bp = netdev_priv(dev); 1940 struct b44 *bp = netdev_priv(dev);
1937 1941
1938 pci_restore_state(pdev); 1942 pci_restore_state(pdev);
1943 pci_enable_device(pdev);
1944 pci_set_master(pdev);
1939 1945
1940 if (!netif_running(dev)) 1946 if (!netif_running(dev))
1941 return 0; 1947 return 0;
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 00e5257b176f..8dc657fc8afb 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1261,7 +1261,7 @@ static void bmac_reset_and_enable(struct net_device *dev)
1261 spin_unlock_irqrestore(&bp->lock, flags); 1261 spin_unlock_irqrestore(&bp->lock, flags);
1262} 1262}
1263 1263
1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *match) 1264static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
1265{ 1265{
1266 int j, rev, ret; 1266 int j, rev, ret;
1267 struct bmac_data *bp; 1267 struct bmac_data *bp;
@@ -1645,16 +1645,13 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
1645 return 0; 1645 return 0;
1646} 1646}
1647 1647
1648static struct of_match bmac_match[] = 1648static struct of_device_id bmac_match[] =
1649{ 1649{
1650 { 1650 {
1651 .name = "bmac", 1651 .name = "bmac",
1652 .type = OF_ANY_MATCH,
1653 .compatible = OF_ANY_MATCH,
1654 .data = (void *)0, 1652 .data = (void *)0,
1655 }, 1653 },
1656 { 1654 {
1657 .name = OF_ANY_MATCH,
1658 .type = "network", 1655 .type = "network",
1659 .compatible = "bmac+", 1656 .compatible = "bmac+",
1660 .data = (void *)1, 1657 .data = (void *)1,
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 6233c4ffb805..a2e8dda5afac 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2346,7 +2346,6 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2346{ 2346{
2347 struct slave *slave, *start_at; 2347 struct slave *slave, *start_at;
2348 struct bonding *bond = dev->priv; 2348 struct bonding *bond = dev->priv;
2349 struct ethhdr *data = (struct ethhdr *)skb->data;
2350 int slave_agg_no; 2349 int slave_agg_no;
2351 int slaves_in_agg; 2350 int slaves_in_agg;
2352 int agg_id; 2351 int agg_id;
@@ -2377,7 +2376,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2377 goto out; 2376 goto out;
2378 } 2377 }
2379 2378
2380 slave_agg_no = (data->h_dest[5]^bond->dev->dev_addr[5]) % slaves_in_agg; 2379 slave_agg_no = bond->xmit_hash_policy(skb, dev, slaves_in_agg);
2381 2380
2382 bond_for_each_slave(bond, slave, i) { 2381 bond_for_each_slave(bond, slave, i) {
2383 struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; 2382 struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 269a5e407349..2c930da90a85 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -475,7 +475,18 @@
475 * Solution is to move call to dev_remove_pack outside of the 475 * Solution is to move call to dev_remove_pack outside of the
476 * spinlock. 476 * spinlock.
477 * Set version to 2.6.1. 477 * Set version to 2.6.1.
478 * 478 * 2005/06/05 - Jay Vosburgh <fubar@us.ibm.com>
479 * - Support for generating gratuitous ARPs in active-backup mode.
480 * Includes support for VLAN tagging all bonding-generated ARPs
481 * as needed. Set version to 2.6.2.
482 * 2005/06/08 - Jason Gabler <jygabler at lbl dot gov>
483 * - alternate hashing policy support for mode 2
484 * * Added kernel parameter "xmit_hash_policy" to allow the selection
485 * of different hashing policies for mode 2. The original mode 2
486 * policy is the default, now found in xmit_hash_policy_layer2().
487 * * Added xmit_hash_policy_layer34()
488 * - Modified by Jay Vosburgh <fubar@us.ibm.com> to also support mode 4.
489 * Set version to 2.6.3.
479 */ 490 */
480 491
481//#define BONDING_DEBUG 1 492//#define BONDING_DEBUG 1
@@ -490,7 +501,10 @@
490#include <linux/ptrace.h> 501#include <linux/ptrace.h>
491#include <linux/ioport.h> 502#include <linux/ioport.h>
492#include <linux/in.h> 503#include <linux/in.h>
504#include <net/ip.h>
493#include <linux/ip.h> 505#include <linux/ip.h>
506#include <linux/tcp.h>
507#include <linux/udp.h>
494#include <linux/slab.h> 508#include <linux/slab.h>
495#include <linux/string.h> 509#include <linux/string.h>
496#include <linux/init.h> 510#include <linux/init.h>
@@ -519,6 +533,7 @@
519#include <linux/ethtool.h> 533#include <linux/ethtool.h>
520#include <linux/if_vlan.h> 534#include <linux/if_vlan.h>
521#include <linux/if_bonding.h> 535#include <linux/if_bonding.h>
536#include <net/route.h>
522#include "bonding.h" 537#include "bonding.h"
523#include "bond_3ad.h" 538#include "bond_3ad.h"
524#include "bond_alb.h" 539#include "bond_alb.h"
@@ -537,6 +552,7 @@ static int use_carrier = 1;
537static char *mode = NULL; 552static char *mode = NULL;
538static char *primary = NULL; 553static char *primary = NULL;
539static char *lacp_rate = NULL; 554static char *lacp_rate = NULL;
555static char *xmit_hash_policy = NULL;
540static int arp_interval = BOND_LINK_ARP_INTERV; 556static int arp_interval = BOND_LINK_ARP_INTERV;
541static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; 557static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, };
542 558
@@ -556,6 +572,8 @@ module_param(primary, charp, 0);
556MODULE_PARM_DESC(primary, "Primary network device to use"); 572MODULE_PARM_DESC(primary, "Primary network device to use");
557module_param(lacp_rate, charp, 0); 573module_param(lacp_rate, charp, 0);
558MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)"); 574MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)");
575module_param(xmit_hash_policy, charp, 0);
576MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method : 0 for layer 2 (default), 1 for layer 3+4");
559module_param(arp_interval, int, 0); 577module_param(arp_interval, int, 0);
560MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); 578MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
561module_param_array(arp_ip_target, charp, NULL, 0); 579module_param_array(arp_ip_target, charp, NULL, 0);
@@ -574,8 +592,8 @@ static struct proc_dir_entry *bond_proc_dir = NULL;
574 592
575static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; 593static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ;
576static int arp_ip_count = 0; 594static int arp_ip_count = 0;
577static u32 my_ip = 0;
578static int bond_mode = BOND_MODE_ROUNDROBIN; 595static int bond_mode = BOND_MODE_ROUNDROBIN;
596static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2;
579static int lacp_fast = 0; 597static int lacp_fast = 0;
580static int app_abi_ver = 0; 598static int app_abi_ver = 0;
581static int orig_app_abi_ver = -1; /* This is used to save the first ABI version 599static int orig_app_abi_ver = -1; /* This is used to save the first ABI version
@@ -585,7 +603,6 @@ static int orig_app_abi_ver = -1; /* This is used to save the first ABI version
585 * command comes from an application using 603 * command comes from an application using
586 * another ABI version. 604 * another ABI version.
587 */ 605 */
588
589struct bond_parm_tbl { 606struct bond_parm_tbl {
590 char *modename; 607 char *modename;
591 int mode; 608 int mode;
@@ -608,9 +625,16 @@ static struct bond_parm_tbl bond_mode_tbl[] = {
608{ NULL, -1}, 625{ NULL, -1},
609}; 626};
610 627
628static struct bond_parm_tbl xmit_hashtype_tbl[] = {
629{ "layer2", BOND_XMIT_POLICY_LAYER2},
630{ "layer3+4", BOND_XMIT_POLICY_LAYER34},
631{ NULL, -1},
632};
633
611/*-------------------------- Forward declarations ---------------------------*/ 634/*-------------------------- Forward declarations ---------------------------*/
612 635
613static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode); 636static inline void bond_set_mode_ops(struct bonding *bond, int mode);
637static void bond_send_gratuitous_arp(struct bonding *bond);
614 638
615/*---------------------------- General routines -----------------------------*/ 639/*---------------------------- General routines -----------------------------*/
616 640
@@ -659,6 +683,7 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id)
659 683
660 INIT_LIST_HEAD(&vlan->vlan_list); 684 INIT_LIST_HEAD(&vlan->vlan_list);
661 vlan->vlan_id = vlan_id; 685 vlan->vlan_id = vlan_id;
686 vlan->vlan_ip = 0;
662 687
663 write_lock_bh(&bond->lock); 688 write_lock_bh(&bond->lock);
664 689
@@ -1468,16 +1493,6 @@ static void bond_change_active_slave(struct bonding *bond, struct slave *new_act
1468 } 1493 }
1469 } 1494 }
1470 1495
1471 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) {
1472 if (old_active) {
1473 bond_set_slave_inactive_flags(old_active);
1474 }
1475
1476 if (new_active) {
1477 bond_set_slave_active_flags(new_active);
1478 }
1479 }
1480
1481 if (USES_PRIMARY(bond->params.mode)) { 1496 if (USES_PRIMARY(bond->params.mode)) {
1482 bond_mc_swap(bond, new_active, old_active); 1497 bond_mc_swap(bond, new_active, old_active);
1483 } 1498 }
@@ -1488,6 +1503,17 @@ static void bond_change_active_slave(struct bonding *bond, struct slave *new_act
1488 } else { 1503 } else {
1489 bond->curr_active_slave = new_active; 1504 bond->curr_active_slave = new_active;
1490 } 1505 }
1506
1507 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) {
1508 if (old_active) {
1509 bond_set_slave_inactive_flags(old_active);
1510 }
1511
1512 if (new_active) {
1513 bond_set_slave_active_flags(new_active);
1514 }
1515 bond_send_gratuitous_arp(bond);
1516 }
1491} 1517}
1492 1518
1493/** 1519/**
@@ -2694,15 +2720,180 @@ out:
2694 read_unlock(&bond->lock); 2720 read_unlock(&bond->lock);
2695} 2721}
2696 2722
2723
2724static u32 bond_glean_dev_ip(struct net_device *dev)
2725{
2726 struct in_device *idev;
2727 struct in_ifaddr *ifa;
2728 u32 addr = 0;
2729
2730 if (!dev)
2731 return 0;
2732
2733 rcu_read_lock();
2734 idev = __in_dev_get(dev);
2735 if (!idev)
2736 goto out;
2737
2738 ifa = idev->ifa_list;
2739 if (!ifa)
2740 goto out;
2741
2742 addr = ifa->ifa_local;
2743out:
2744 rcu_read_unlock();
2745 return addr;
2746}
2747
2748static int bond_has_ip(struct bonding *bond)
2749{
2750 struct vlan_entry *vlan, *vlan_next;
2751
2752 if (bond->master_ip)
2753 return 1;
2754
2755 if (list_empty(&bond->vlan_list))
2756 return 0;
2757
2758 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
2759 vlan_list) {
2760 if (vlan->vlan_ip)
2761 return 1;
2762 }
2763
2764 return 0;
2765}
2766
2767/*
2768 * We go to the (large) trouble of VLAN tagging ARP frames because
2769 * switches in VLAN mode (especially if ports are configured as
2770 * "native" to a VLAN) might not pass non-tagged frames.
2771 */
2772static void bond_arp_send(struct net_device *slave_dev, int arp_op, u32 dest_ip, u32 src_ip, unsigned short vlan_id)
2773{
2774 struct sk_buff *skb;
2775
2776 dprintk("arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
2777 slave_dev->name, dest_ip, src_ip, vlan_id);
2778
2779 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
2780 NULL, slave_dev->dev_addr, NULL);
2781
2782 if (!skb) {
2783 printk(KERN_ERR DRV_NAME ": ARP packet allocation failed\n");
2784 return;
2785 }
2786 if (vlan_id) {
2787 skb = vlan_put_tag(skb, vlan_id);
2788 if (!skb) {
2789 printk(KERN_ERR DRV_NAME ": failed to insert VLAN tag\n");
2790 return;
2791 }
2792 }
2793 arp_xmit(skb);
2794}
2795
2796
2697static void bond_arp_send_all(struct bonding *bond, struct slave *slave) 2797static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2698{ 2798{
2699 int i; 2799 int i, vlan_id, rv;
2700 u32 *targets = bond->params.arp_targets; 2800 u32 *targets = bond->params.arp_targets;
2801 struct vlan_entry *vlan, *vlan_next;
2802 struct net_device *vlan_dev;
2803 struct flowi fl;
2804 struct rtable *rt;
2701 2805
2702 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { 2806 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2703 arp_send(ARPOP_REQUEST, ETH_P_ARP, targets[i], slave->dev, 2807 dprintk("basa: target %x\n", targets[i]);
2704 my_ip, NULL, slave->dev->dev_addr, 2808 if (list_empty(&bond->vlan_list)) {
2705 NULL); 2809 dprintk("basa: empty vlan: arp_send\n");
2810 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2811 bond->master_ip, 0);
2812 continue;
2813 }
2814
2815 /*
2816 * If VLANs are configured, we do a route lookup to
2817 * determine which VLAN interface would be used, so we
2818 * can tag the ARP with the proper VLAN tag.
2819 */
2820 memset(&fl, 0, sizeof(fl));
2821 fl.fl4_dst = targets[i];
2822 fl.fl4_tos = RTO_ONLINK;
2823
2824 rv = ip_route_output_key(&rt, &fl);
2825 if (rv) {
2826 if (net_ratelimit()) {
2827 printk(KERN_WARNING DRV_NAME
2828 ": %s: no route to arp_ip_target %u.%u.%u.%u\n",
2829 bond->dev->name, NIPQUAD(fl.fl4_dst));
2830 }
2831 continue;
2832 }
2833
2834 /*
2835 * This target is not on a VLAN
2836 */
2837 if (rt->u.dst.dev == bond->dev) {
2838 dprintk("basa: rtdev == bond->dev: arp_send\n");
2839 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2840 bond->master_ip, 0);
2841 continue;
2842 }
2843
2844 vlan_id = 0;
2845 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
2846 vlan_list) {
2847 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
2848 if (vlan_dev == rt->u.dst.dev) {
2849 vlan_id = vlan->vlan_id;
2850 dprintk("basa: vlan match on %s %d\n",
2851 vlan_dev->name, vlan_id);
2852 break;
2853 }
2854 }
2855
2856 if (vlan_id) {
2857 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2858 vlan->vlan_ip, vlan_id);
2859 continue;
2860 }
2861
2862 if (net_ratelimit()) {
2863 printk(KERN_WARNING DRV_NAME
2864 ": %s: no path to arp_ip_target %u.%u.%u.%u via rt.dev %s\n",
2865 bond->dev->name, NIPQUAD(fl.fl4_dst),
2866 rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
2867 }
2868 }
2869}
2870
2871/*
2872 * Kick out a gratuitous ARP for an IP on the bonding master plus one
2873 * for each VLAN above us.
2874 */
2875static void bond_send_gratuitous_arp(struct bonding *bond)
2876{
2877 struct slave *slave = bond->curr_active_slave;
2878 struct vlan_entry *vlan;
2879 struct net_device *vlan_dev;
2880
2881 dprintk("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
2882 slave ? slave->dev->name : "NULL");
2883 if (!slave)
2884 return;
2885
2886 if (bond->master_ip) {
2887 bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
2888 bond->master_ip, 0);
2889 }
2890
2891 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
2892 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
2893 if (vlan->vlan_ip) {
2894 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
2895 vlan->vlan_ip, vlan->vlan_id);
2896 }
2706 } 2897 }
2707} 2898}
2708 2899
@@ -2781,7 +2972,7 @@ static void bond_loadbalance_arp_mon(struct net_device *bond_dev)
2781 */ 2972 */
2782 if (((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || 2973 if (((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) ||
2783 (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && 2974 (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) &&
2784 my_ip)) { 2975 bond_has_ip(bond))) {
2785 2976
2786 slave->link = BOND_LINK_DOWN; 2977 slave->link = BOND_LINK_DOWN;
2787 slave->state = BOND_STATE_BACKUP; 2978 slave->state = BOND_STATE_BACKUP;
@@ -2920,7 +3111,7 @@ static void bond_activebackup_arp_mon(struct net_device *bond_dev)
2920 if ((slave != bond->curr_active_slave) && 3111 if ((slave != bond->curr_active_slave) &&
2921 (!bond->current_arp_slave) && 3112 (!bond->current_arp_slave) &&
2922 (((jiffies - slave->dev->last_rx) >= 3*delta_in_ticks) && 3113 (((jiffies - slave->dev->last_rx) >= 3*delta_in_ticks) &&
2923 my_ip)) { 3114 bond_has_ip(bond))) {
2924 /* a backup slave has gone down; three times 3115 /* a backup slave has gone down; three times
2925 * the delta allows the current slave to be 3116 * the delta allows the current slave to be
2926 * taken out before the backup slave. 3117 * taken out before the backup slave.
@@ -2966,8 +3157,8 @@ static void bond_activebackup_arp_mon(struct net_device *bond_dev)
2966 * if it is up and needs to take over as the curr_active_slave 3157 * if it is up and needs to take over as the curr_active_slave
2967 */ 3158 */
2968 if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || 3159 if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) ||
2969 (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && 3160 (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) &&
2970 my_ip)) && 3161 bond_has_ip(bond))) &&
2971 ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) { 3162 ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) {
2972 3163
2973 slave->link = BOND_LINK_DOWN; 3164 slave->link = BOND_LINK_DOWN;
@@ -3019,7 +3210,7 @@ static void bond_activebackup_arp_mon(struct net_device *bond_dev)
3019 /* the current slave must tx an arp to ensure backup slaves 3210 /* the current slave must tx an arp to ensure backup slaves
3020 * rx traffic 3211 * rx traffic
3021 */ 3212 */
3022 if (slave && my_ip) { 3213 if (slave && bond_has_ip(bond)) {
3023 bond_arp_send_all(bond, slave); 3214 bond_arp_send_all(bond, slave);
3024 } 3215 }
3025 } 3216 }
@@ -3471,10 +3662,67 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
3471 return NOTIFY_DONE; 3662 return NOTIFY_DONE;
3472} 3663}
3473 3664
3665/*
3666 * bond_inetaddr_event: handle inetaddr notifier chain events.
3667 *
3668 * We keep track of device IPs primarily to use as source addresses in
3669 * ARP monitor probes (rather than spewing out broadcasts all the time).
3670 *
3671 * We track one IP for the main device (if it has one), plus one per VLAN.
3672 */
3673static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
3674{
3675 struct in_ifaddr *ifa = ptr;
3676 struct net_device *vlan_dev, *event_dev = ifa->ifa_dev->dev;
3677 struct bonding *bond, *bond_next;
3678 struct vlan_entry *vlan, *vlan_next;
3679
3680 list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) {
3681 if (bond->dev == event_dev) {
3682 switch (event) {
3683 case NETDEV_UP:
3684 bond->master_ip = ifa->ifa_local;
3685 return NOTIFY_OK;
3686 case NETDEV_DOWN:
3687 bond->master_ip = bond_glean_dev_ip(bond->dev);
3688 return NOTIFY_OK;
3689 default:
3690 return NOTIFY_DONE;
3691 }
3692 }
3693
3694 if (list_empty(&bond->vlan_list))
3695 continue;
3696
3697 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
3698 vlan_list) {
3699 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
3700 if (vlan_dev == event_dev) {
3701 switch (event) {
3702 case NETDEV_UP:
3703 vlan->vlan_ip = ifa->ifa_local;
3704 return NOTIFY_OK;
3705 case NETDEV_DOWN:
3706 vlan->vlan_ip =
3707 bond_glean_dev_ip(vlan_dev);
3708 return NOTIFY_OK;
3709 default:
3710 return NOTIFY_DONE;
3711 }
3712 }
3713 }
3714 }
3715 return NOTIFY_DONE;
3716}
3717
3474static struct notifier_block bond_netdev_notifier = { 3718static struct notifier_block bond_netdev_notifier = {
3475 .notifier_call = bond_netdev_event, 3719 .notifier_call = bond_netdev_event,
3476}; 3720};
3477 3721
3722static struct notifier_block bond_inetaddr_notifier = {
3723 .notifier_call = bond_inetaddr_event,
3724};
3725
3478/*-------------------------- Packet type handling ---------------------------*/ 3726/*-------------------------- Packet type handling ---------------------------*/
3479 3727
3480/* register to receive lacpdus on a bond */ 3728/* register to receive lacpdus on a bond */
@@ -3496,6 +3744,46 @@ static void bond_unregister_lacpdu(struct bonding *bond)
3496 dev_remove_pack(&(BOND_AD_INFO(bond).ad_pkt_type)); 3744 dev_remove_pack(&(BOND_AD_INFO(bond).ad_pkt_type));
3497} 3745}
3498 3746
3747/*---------------------------- Hashing Policies -----------------------------*/
3748
3749/*
3750 * Hash for the the output device based upon layer 3 and layer 4 data. If
3751 * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is
3752 * altogether not IP, mimic bond_xmit_hash_policy_l2()
3753 */
3754static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
3755 struct net_device *bond_dev, int count)
3756{
3757 struct ethhdr *data = (struct ethhdr *)skb->data;
3758 struct iphdr *iph = skb->nh.iph;
3759 u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl);
3760 int layer4_xor = 0;
3761
3762 if (skb->protocol == __constant_htons(ETH_P_IP)) {
3763 if (!(iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) &&
3764 (iph->protocol == IPPROTO_TCP ||
3765 iph->protocol == IPPROTO_UDP)) {
3766 layer4_xor = htons((*layer4hdr ^ *(layer4hdr + 1)));
3767 }
3768 return (layer4_xor ^
3769 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;
3770
3771 }
3772
3773 return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
3774}
3775
3776/*
3777 * Hash for the output device based upon layer 2 data
3778 */
3779static int bond_xmit_hash_policy_l2(struct sk_buff *skb,
3780 struct net_device *bond_dev, int count)
3781{
3782 struct ethhdr *data = (struct ethhdr *)skb->data;
3783
3784 return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
3785}
3786
3499/*-------------------------- Device entry points ----------------------------*/ 3787/*-------------------------- Device entry points ----------------------------*/
3500 3788
3501static int bond_open(struct net_device *bond_dev) 3789static int bond_open(struct net_device *bond_dev)
@@ -4060,17 +4348,6 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
4060 struct bonding *bond = bond_dev->priv; 4348 struct bonding *bond = bond_dev->priv;
4061 int res = 1; 4349 int res = 1;
4062 4350
4063 /* if we are sending arp packets, try to at least
4064 identify our own ip address */
4065 if (bond->params.arp_interval && !my_ip &&
4066 (skb->protocol == __constant_htons(ETH_P_ARP))) {
4067 char *the_ip = (char *)skb->data +
4068 sizeof(struct ethhdr) +
4069 sizeof(struct arphdr) +
4070 ETH_ALEN;
4071 memcpy(&my_ip, the_ip, 4);
4072 }
4073
4074 read_lock(&bond->lock); 4351 read_lock(&bond->lock);
4075 read_lock(&bond->curr_slave_lock); 4352 read_lock(&bond->curr_slave_lock);
4076 4353
@@ -4093,14 +4370,13 @@ out:
4093} 4370}
4094 4371
4095/* 4372/*
4096 * in XOR mode, we determine the output device by performing xor on 4373 * In bond_xmit_xor() , we determine the output device by using a pre-
4097 * the source and destination hw adresses. If this device is not 4374 * determined xmit_hash_policy(), If the selected device is not enabled,
4098 * enabled, find the next slave following this xor slave. 4375 * find the next active slave.
4099 */ 4376 */
4100static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) 4377static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
4101{ 4378{
4102 struct bonding *bond = bond_dev->priv; 4379 struct bonding *bond = bond_dev->priv;
4103 struct ethhdr *data = (struct ethhdr *)skb->data;
4104 struct slave *slave, *start_at; 4380 struct slave *slave, *start_at;
4105 int slave_no; 4381 int slave_no;
4106 int i; 4382 int i;
@@ -4112,7 +4388,7 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
4112 goto out; 4388 goto out;
4113 } 4389 }
4114 4390
4115 slave_no = (data->h_dest[5]^bond_dev->dev_addr[5]) % bond->slave_cnt; 4391 slave_no = bond->xmit_hash_policy(skb, bond_dev, bond->slave_cnt);
4116 4392
4117 bond_for_each_slave(bond, slave, i) { 4393 bond_for_each_slave(bond, slave, i) {
4118 slave_no--; 4394 slave_no--;
@@ -4208,8 +4484,10 @@ out:
4208/* 4484/*
4209 * set bond mode specific net device operations 4485 * set bond mode specific net device operations
4210 */ 4486 */
4211static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode) 4487static inline void bond_set_mode_ops(struct bonding *bond, int mode)
4212{ 4488{
4489 struct net_device *bond_dev = bond->dev;
4490
4213 switch (mode) { 4491 switch (mode) {
4214 case BOND_MODE_ROUNDROBIN: 4492 case BOND_MODE_ROUNDROBIN:
4215 bond_dev->hard_start_xmit = bond_xmit_roundrobin; 4493 bond_dev->hard_start_xmit = bond_xmit_roundrobin;
@@ -4219,12 +4497,20 @@ static inline void bond_set_mode_ops(struct net_device *bond_dev, int mode)
4219 break; 4497 break;
4220 case BOND_MODE_XOR: 4498 case BOND_MODE_XOR:
4221 bond_dev->hard_start_xmit = bond_xmit_xor; 4499 bond_dev->hard_start_xmit = bond_xmit_xor;
4500 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34)
4501 bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
4502 else
4503 bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
4222 break; 4504 break;
4223 case BOND_MODE_BROADCAST: 4505 case BOND_MODE_BROADCAST:
4224 bond_dev->hard_start_xmit = bond_xmit_broadcast; 4506 bond_dev->hard_start_xmit = bond_xmit_broadcast;
4225 break; 4507 break;
4226 case BOND_MODE_8023AD: 4508 case BOND_MODE_8023AD:
4227 bond_dev->hard_start_xmit = bond_3ad_xmit_xor; 4509 bond_dev->hard_start_xmit = bond_3ad_xmit_xor;
4510 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34)
4511 bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
4512 else
4513 bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
4228 break; 4514 break;
4229 case BOND_MODE_TLB: 4515 case BOND_MODE_TLB:
4230 case BOND_MODE_ALB: 4516 case BOND_MODE_ALB:
@@ -4273,7 +4559,7 @@ static int __init bond_init(struct net_device *bond_dev, struct bond_params *par
4273 bond_dev->change_mtu = bond_change_mtu; 4559 bond_dev->change_mtu = bond_change_mtu;
4274 bond_dev->set_mac_address = bond_set_mac_address; 4560 bond_dev->set_mac_address = bond_set_mac_address;
4275 4561
4276 bond_set_mode_ops(bond_dev, bond->params.mode); 4562 bond_set_mode_ops(bond, bond->params.mode);
4277 4563
4278 bond_dev->destructor = free_netdev; 4564 bond_dev->destructor = free_netdev;
4279 4565
@@ -4384,6 +4670,25 @@ static int bond_check_params(struct bond_params *params)
4384 } 4670 }
4385 } 4671 }
4386 4672
4673 if (xmit_hash_policy) {
4674 if ((bond_mode != BOND_MODE_XOR) &&
4675 (bond_mode != BOND_MODE_8023AD)) {
4676 printk(KERN_INFO DRV_NAME
4677 ": xor_mode param is irrelevant in mode %s\n",
4678 bond_mode_name(bond_mode));
4679 } else {
4680 xmit_hashtype = bond_parse_parm(xmit_hash_policy,
4681 xmit_hashtype_tbl);
4682 if (xmit_hashtype == -1) {
4683 printk(KERN_ERR DRV_NAME
4684 ": Error: Invalid xmit_hash_policy \"%s\"\n",
4685 xmit_hash_policy == NULL ? "NULL" :
4686 xmit_hash_policy);
4687 return -EINVAL;
4688 }
4689 }
4690 }
4691
4387 if (lacp_rate) { 4692 if (lacp_rate) {
4388 if (bond_mode != BOND_MODE_8023AD) { 4693 if (bond_mode != BOND_MODE_8023AD) {
4389 printk(KERN_INFO DRV_NAME 4694 printk(KERN_INFO DRV_NAME
@@ -4595,6 +4900,7 @@ static int bond_check_params(struct bond_params *params)
4595 4900
4596 /* fill params struct with the proper values */ 4901 /* fill params struct with the proper values */
4597 params->mode = bond_mode; 4902 params->mode = bond_mode;
4903 params->xmit_policy = xmit_hashtype;
4598 params->miimon = miimon; 4904 params->miimon = miimon;
4599 params->arp_interval = arp_interval; 4905 params->arp_interval = arp_interval;
4600 params->updelay = updelay; 4906 params->updelay = updelay;
@@ -4669,6 +4975,7 @@ static int __init bonding_init(void)
4669 4975
4670 rtnl_unlock(); 4976 rtnl_unlock();
4671 register_netdevice_notifier(&bond_netdev_notifier); 4977 register_netdevice_notifier(&bond_netdev_notifier);
4978 register_inetaddr_notifier(&bond_inetaddr_notifier);
4672 4979
4673 return 0; 4980 return 0;
4674 4981
@@ -4684,6 +4991,7 @@ out_err:
4684static void __exit bonding_exit(void) 4991static void __exit bonding_exit(void)
4685{ 4992{
4686 unregister_netdevice_notifier(&bond_netdev_notifier); 4993 unregister_netdevice_notifier(&bond_netdev_notifier);
4994 unregister_inetaddr_notifier(&bond_inetaddr_notifier);
4687 4995
4688 rtnl_lock(); 4996 rtnl_lock();
4689 bond_free_all(); 4997 bond_free_all();
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 8c325308489d..d27f377b3eeb 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -25,6 +25,10 @@
25 * 25 *
26 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> 26 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
27 * - Code cleanup and style changes 27 * - Code cleanup and style changes
28 *
29 * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov>
30 * - added "xmit_policy" kernel parameter for alternate hashing policy
31 * support for mode 2
28 */ 32 */
29 33
30#ifndef _LINUX_BONDING_H 34#ifndef _LINUX_BONDING_H
@@ -36,8 +40,8 @@
36#include "bond_3ad.h" 40#include "bond_3ad.h"
37#include "bond_alb.h" 41#include "bond_alb.h"
38 42
39#define DRV_VERSION "2.6.1" 43#define DRV_VERSION "2.6.3"
40#define DRV_RELDATE "October 29, 2004" 44#define DRV_RELDATE "June 8, 2005"
41#define DRV_NAME "bonding" 45#define DRV_NAME "bonding"
42#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" 46#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
43 47
@@ -137,6 +141,7 @@
137 141
138struct bond_params { 142struct bond_params {
139 int mode; 143 int mode;
144 int xmit_policy;
140 int miimon; 145 int miimon;
141 int arp_interval; 146 int arp_interval;
142 int use_carrier; 147 int use_carrier;
@@ -149,6 +154,7 @@ struct bond_params {
149 154
150struct vlan_entry { 155struct vlan_entry {
151 struct list_head vlan_list; 156 struct list_head vlan_list;
157 u32 vlan_ip;
152 unsigned short vlan_id; 158 unsigned short vlan_id;
153}; 159};
154 160
@@ -197,6 +203,8 @@ struct bonding {
197#endif /* CONFIG_PROC_FS */ 203#endif /* CONFIG_PROC_FS */
198 struct list_head bond_list; 204 struct list_head bond_list;
199 struct dev_mc_list *mc_list; 205 struct dev_mc_list *mc_list;
206 int (*xmit_hash_policy)(struct sk_buff *, struct net_device *, int);
207 u32 master_ip;
200 u16 flags; 208 u16 flags;
201 struct ad_bond_info ad_info; 209 struct ad_bond_info ad_info;
202 struct alb_bond_info alb_info; 210 struct alb_bond_info alb_info;
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 5c5f540da26a..b780307093eb 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -174,6 +174,13 @@ static unsigned int cs8900_irq_map[] = {1,0,0,0};
174#include <asm/irq.h> 174#include <asm/irq.h>
175static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; 175static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0};
176static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; 176static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0};
177#elif defined(CONFIG_ARCH_PNX0105)
178#include <asm/irq.h>
179#include <asm/arch/gpio.h>
180#define CIRRUS_DEFAULT_BASE IO_ADDRESS(EXT_STATIC2_s0_BASE + 0x200000) /* = Physical address 0x48200000 */
181#define CIRRUS_DEFAULT_IRQ VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */
182static unsigned int netcard_portlist[] __initdata = {CIRRUS_DEFAULT_BASE, 0};
183static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0};
177#else 184#else
178static unsigned int netcard_portlist[] __initdata = 185static unsigned int netcard_portlist[] __initdata =
179 { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; 186 { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
@@ -319,13 +326,7 @@ struct net_device * __init cs89x0_probe(int unit)
319 } 326 }
320 if (err) 327 if (err)
321 goto out; 328 goto out;
322 err = register_netdev(dev);
323 if (err)
324 goto out1;
325 return dev; 329 return dev;
326out1:
327 outw(PP_ChipID, dev->base_addr + ADD_PORT);
328 release_region(dev->base_addr, NETCARD_IO_EXTENT);
329out: 330out:
330 free_netdev(dev); 331 free_netdev(dev);
331 printk(KERN_WARNING "cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP\n"); 332 printk(KERN_WARNING "cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP\n");
@@ -416,6 +417,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
416 struct net_local *lp = netdev_priv(dev); 417 struct net_local *lp = netdev_priv(dev);
417 static unsigned version_printed; 418 static unsigned version_printed;
418 int i; 419 int i;
420 int tmp;
419 unsigned rev_type = 0; 421 unsigned rev_type = 0;
420 int eeprom_buff[CHKSUM_LEN]; 422 int eeprom_buff[CHKSUM_LEN];
421 int retval; 423 int retval;
@@ -437,6 +439,30 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
437#endif 439#endif
438 } 440 }
439 441
442#ifdef CONFIG_ARCH_PNX0105
443 initialize_ebi();
444
445 /* Map GPIO registers for the pins connected to the CS8900a. */
446 if (map_cirrus_gpio() < 0)
447 return -ENODEV;
448
449 reset_cirrus();
450
451 /* Map event-router registers. */
452 if (map_event_router() < 0)
453 return -ENODEV;
454
455 enable_cirrus_irq();
456
457 unmap_cirrus_gpio();
458 unmap_event_router();
459
460 dev->base_addr = ioaddr;
461
462 for (i = 0 ; i < 3 ; i++)
463 readreg(dev, 0);
464#endif
465
440 /* Grab the region so we can find another board if autoIRQ fails. */ 466 /* Grab the region so we can find another board if autoIRQ fails. */
441 /* WTF is going on here? */ 467 /* WTF is going on here? */
442 if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { 468 if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) {
@@ -467,14 +493,17 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
467 goto out2; 493 goto out2;
468 } 494 }
469 } 495 }
470printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT)); 496 printk(KERN_DEBUG "PP_addr at %x: 0x%x\n",
497 ioaddr + ADD_PORT, inw(ioaddr + ADD_PORT));
471 498
472 ioaddr &= ~3; 499 ioaddr &= ~3;
473 outw(PP_ChipID, ioaddr + ADD_PORT); 500 outw(PP_ChipID, ioaddr + ADD_PORT);
474 501
475 if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) { 502 tmp = inw(ioaddr + DATA_PORT);
476 printk(KERN_ERR "%s: incorrect signature 0x%x\n", 503 if (tmp != CHIP_EISA_ID_SIG) {
477 dev->name, inw(ioaddr + DATA_PORT)); 504 printk(KERN_DEBUG "%s: incorrect signature at %x: 0x%x!="
505 CHIP_EISA_ID_SIG_STR "\n",
506 dev->name, ioaddr + DATA_PORT, tmp);
478 retval = -ENODEV; 507 retval = -ENODEV;
479 goto out2; 508 goto out2;
480 } 509 }
@@ -678,7 +707,7 @@ printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
678 } else { 707 } else {
679 i = lp->isa_config & INT_NO_MASK; 708 i = lp->isa_config & INT_NO_MASK;
680 if (lp->chip_type == CS8900) { 709 if (lp->chip_type == CS8900) {
681#ifdef CONFIG_ARCH_IXDP2X01 710#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105)
682 i = cs8900_irq_map[0]; 711 i = cs8900_irq_map[0];
683#else 712#else
684 /* Translate the IRQ using the IRQ mapping table. */ 713 /* Translate the IRQ using the IRQ mapping table. */
@@ -735,7 +764,13 @@ printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
735 printk("\n"); 764 printk("\n");
736 if (net_debug) 765 if (net_debug)
737 printk("cs89x0_probe1() successful\n"); 766 printk("cs89x0_probe1() successful\n");
767
768 retval = register_netdev(dev);
769 if (retval)
770 goto out3;
738 return 0; 771 return 0;
772out3:
773 outw(PP_ChipID, dev->base_addr + ADD_PORT);
739out2: 774out2:
740 release_region(ioaddr & ~3, NETCARD_IO_EXTENT); 775 release_region(ioaddr & ~3, NETCARD_IO_EXTENT);
741out1: 776out1:
@@ -1145,7 +1180,7 @@ net_open(struct net_device *dev)
1145 int i; 1180 int i;
1146 int ret; 1181 int ret;
1147 1182
1148#ifndef CONFIG_SH_HICOSH4 /* uses irq#1, so this won't work */ 1183#if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX0105) /* uses irq#1, so this won't work */
1149 if (dev->irq < 2) { 1184 if (dev->irq < 2) {
1150 /* Allow interrupts to be generated by the chip */ 1185 /* Allow interrupts to be generated by the chip */
1151/* Cirrus' release had this: */ 1186/* Cirrus' release had this: */
@@ -1176,7 +1211,7 @@ net_open(struct net_device *dev)
1176 else 1211 else
1177#endif 1212#endif
1178 { 1213 {
1179#ifndef CONFIG_ARCH_IXDP2X01 1214#if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX0105)
1180 if (((1 << dev->irq) & lp->irq_map) == 0) { 1215 if (((1 << dev->irq) & lp->irq_map) == 0) {
1181 printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", 1216 printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n",
1182 dev->name, dev->irq, lp->irq_map); 1217 dev->name, dev->irq, lp->irq_map);
@@ -1261,6 +1296,9 @@ net_open(struct net_device *dev)
1261 case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break; 1296 case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break;
1262 default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2); 1297 default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2);
1263 } 1298 }
1299#ifdef CONFIG_ARCH_PNX0105
1300 result = A_CNF_10B_T;
1301#endif
1264 if (!result) { 1302 if (!result) {
1265 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name); 1303 printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name);
1266 release_irq: 1304 release_irq:
@@ -1416,6 +1454,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1416 /* Write the contents of the packet */ 1454 /* Write the contents of the packet */
1417 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1455 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1418 spin_unlock_irq(&lp->lock); 1456 spin_unlock_irq(&lp->lock);
1457 lp->stats.tx_bytes += skb->len;
1419 dev->trans_start = jiffies; 1458 dev->trans_start = jiffies;
1420 dev_kfree_skb (skb); 1459 dev_kfree_skb (skb);
1421 1460
@@ -1831,13 +1870,6 @@ init_module(void)
1831 if (ret) 1870 if (ret)
1832 goto out; 1871 goto out;
1833 1872
1834 if (register_netdev(dev) != 0) {
1835 printk(KERN_ERR "cs89x0.c: No card found at 0x%x\n", io);
1836 ret = -ENXIO;
1837 outw(PP_ChipID, dev->base_addr + ADD_PORT);
1838 release_region(dev->base_addr, NETCARD_IO_EXTENT);
1839 goto out;
1840 }
1841 dev_cs89x0 = dev; 1873 dev_cs89x0 = dev;
1842 return 0; 1874 return 0;
1843out: 1875out:
diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h
index b0ef7ad2baad..decea264f121 100644
--- a/drivers/net/cs89x0.h
+++ b/drivers/net/cs89x0.h
@@ -16,7 +16,7 @@
16 16
17#include <linux/config.h> 17#include <linux/config.h>
18 18
19#ifdef CONFIG_ARCH_IXDP2X01 19#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105)
20/* IXDP2401/IXDP2801 uses dword-aligned register addressing */ 20/* IXDP2401/IXDP2801 uses dword-aligned register addressing */
21#define CS89x0_PORT(reg) ((reg) * 2) 21#define CS89x0_PORT(reg) ((reg) * 2)
22#else 22#else
@@ -93,6 +93,7 @@
93#endif 93#endif
94 94
95#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */ 95#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */
96#define CHIP_EISA_ID_SIG_STR "0x630E"
96 97
97#ifdef IBMEIPKT 98#ifdef IBMEIPKT
98#define EISA_ID_SIG 0x4D24 /* IBM */ 99#define EISA_ID_SIG 0x4D24 /* IBM */
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index a6aa56598f27..5acd35c312ac 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -191,6 +191,7 @@
191 * Feb 2001 davej PCI enable cleanups. 191 * Feb 2001 davej PCI enable cleanups.
192 * 04 Aug 2003 macro Converted to the DMA API. 192 * 04 Aug 2003 macro Converted to the DMA API.
193 * 14 Aug 2004 macro Fix device names reported. 193 * 14 Aug 2004 macro Fix device names reported.
194 * 14 Jun 2005 macro Use irqreturn_t.
194 */ 195 */
195 196
196/* Include files */ 197/* Include files */
@@ -217,8 +218,8 @@
217 218
218/* Version information string should be updated prior to each new release! */ 219/* Version information string should be updated prior to each new release! */
219#define DRV_NAME "defxx" 220#define DRV_NAME "defxx"
220#define DRV_VERSION "v1.07" 221#define DRV_VERSION "v1.08"
221#define DRV_RELDATE "2004/08/14" 222#define DRV_RELDATE "2005/06/14"
222 223
223static char version[] __devinitdata = 224static char version[] __devinitdata =
224 DRV_NAME ": " DRV_VERSION " " DRV_RELDATE 225 DRV_NAME ": " DRV_VERSION " " DRV_RELDATE
@@ -247,7 +248,8 @@ static int dfx_close(struct net_device *dev);
247static void dfx_int_pr_halt_id(DFX_board_t *bp); 248static void dfx_int_pr_halt_id(DFX_board_t *bp);
248static void dfx_int_type_0_process(DFX_board_t *bp); 249static void dfx_int_type_0_process(DFX_board_t *bp);
249static void dfx_int_common(struct net_device *dev); 250static void dfx_int_common(struct net_device *dev);
250static void dfx_interrupt(int irq, void *dev_id, struct pt_regs *regs); 251static irqreturn_t dfx_interrupt(int irq, void *dev_id,
252 struct pt_regs *regs);
251 253
252static struct net_device_stats *dfx_ctl_get_stats(struct net_device *dev); 254static struct net_device_stats *dfx_ctl_get_stats(struct net_device *dev);
253static void dfx_ctl_set_multicast_list(struct net_device *dev); 255static void dfx_ctl_set_multicast_list(struct net_device *dev);
@@ -437,7 +439,8 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
437 } 439 }
438 440
439 SET_MODULE_OWNER(dev); 441 SET_MODULE_OWNER(dev);
440 SET_NETDEV_DEV(dev, &pdev->dev); 442 if (pdev != NULL)
443 SET_NETDEV_DEV(dev, &pdev->dev);
441 444
442 bp = dev->priv; 445 bp = dev->priv;
443 446
@@ -1225,7 +1228,7 @@ static int dfx_open(struct net_device *dev)
1225 1228
1226 /* Register IRQ - support shared interrupts by passing device ptr */ 1229 /* Register IRQ - support shared interrupts by passing device ptr */
1227 1230
1228 ret = request_irq(dev->irq, (void *)dfx_interrupt, SA_SHIRQ, dev->name, dev); 1231 ret = request_irq(dev->irq, dfx_interrupt, SA_SHIRQ, dev->name, dev);
1229 if (ret) { 1232 if (ret) {
1230 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); 1233 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq);
1231 return ret; 1234 return ret;
@@ -1680,13 +1683,13 @@ static void dfx_int_common(struct net_device *dev)
1680 * ================= 1683 * =================
1681 * = dfx_interrupt = 1684 * = dfx_interrupt =
1682 * ================= 1685 * =================
1683 * 1686 *
1684 * Overview: 1687 * Overview:
1685 * Interrupt processing routine 1688 * Interrupt processing routine
1686 * 1689 *
1687 * Returns: 1690 * Returns:
1688 * None 1691 * Whether a valid interrupt was seen.
1689 * 1692 *
1690 * Arguments: 1693 * Arguments:
1691 * irq - interrupt vector 1694 * irq - interrupt vector
1692 * dev_id - pointer to device information 1695 * dev_id - pointer to device information
@@ -1699,7 +1702,8 @@ static void dfx_int_common(struct net_device *dev)
1699 * structure context. 1702 * structure context.
1700 * 1703 *
1701 * Return Codes: 1704 * Return Codes:
1702 * None 1705 * IRQ_HANDLED - an IRQ was handled.
1706 * IRQ_NONE - no IRQ was handled.
1703 * 1707 *
1704 * Assumptions: 1708 * Assumptions:
1705 * The interrupt acknowledgement at the hardware level (eg. ACKing the PIC 1709 * The interrupt acknowledgement at the hardware level (eg. ACKing the PIC
@@ -1712,60 +1716,70 @@ static void dfx_int_common(struct net_device *dev)
1712 * Interrupts are disabled, then reenabled at the adapter. 1716 * Interrupts are disabled, then reenabled at the adapter.
1713 */ 1717 */
1714 1718
1715static void dfx_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1719static irqreturn_t dfx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1716 { 1720{
1717 struct net_device *dev = dev_id; 1721 struct net_device *dev = dev_id;
1718 DFX_board_t *bp; /* private board structure pointer */ 1722 DFX_board_t *bp; /* private board structure pointer */
1719 u8 tmp; /* used for disabling/enabling ints */
1720 1723
1721 /* Get board pointer only if device structure is valid */ 1724 /* Get board pointer only if device structure is valid */
1722 1725
1723 bp = dev->priv; 1726 bp = dev->priv;
1724 1727
1725 spin_lock(&bp->lock);
1726
1727 /* See if we're already servicing an interrupt */ 1728 /* See if we're already servicing an interrupt */
1728 1729
1729 /* Service adapter interrupts */ 1730 /* Service adapter interrupts */
1730 1731
1731 if (bp->bus_type == DFX_BUS_TYPE_PCI) 1732 if (bp->bus_type == DFX_BUS_TYPE_PCI) {
1732 { 1733 u32 status;
1733 /* Disable PDQ-PFI interrupts at PFI */
1734 1734
1735 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, PFI_MODE_M_DMA_ENB); 1735 dfx_port_read_long(bp, PFI_K_REG_STATUS, &status);
1736 if (!(status & PFI_STATUS_M_PDQ_INT))
1737 return IRQ_NONE;
1736 1738
1737 /* Call interrupt service routine for this adapter */ 1739 spin_lock(&bp->lock);
1740
1741 /* Disable PDQ-PFI interrupts at PFI */
1742 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL,
1743 PFI_MODE_M_DMA_ENB);
1738 1744
1745 /* Call interrupt service routine for this adapter */
1739 dfx_int_common(dev); 1746 dfx_int_common(dev);
1740 1747
1741 /* Clear PDQ interrupt status bit and reenable interrupts */ 1748 /* Clear PDQ interrupt status bit and reenable interrupts */
1742 1749 dfx_port_write_long(bp, PFI_K_REG_STATUS,
1743 dfx_port_write_long(bp, PFI_K_REG_STATUS, PFI_STATUS_M_PDQ_INT); 1750 PFI_STATUS_M_PDQ_INT);
1744 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, 1751 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL,
1745 (PFI_MODE_M_PDQ_INT_ENB + PFI_MODE_M_DMA_ENB)); 1752 (PFI_MODE_M_PDQ_INT_ENB |
1746 } 1753 PFI_MODE_M_DMA_ENB));
1747 else
1748 {
1749 /* Disable interrupts at the ESIC */
1750 1754
1751 dfx_port_read_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, &tmp); 1755 spin_unlock(&bp->lock);
1752 tmp &= ~PI_CONFIG_STAT_0_M_INT_ENB; 1756 } else {
1753 dfx_port_write_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, tmp); 1757 u8 status;
1754 1758
1755 /* Call interrupt service routine for this adapter */ 1759 dfx_port_read_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, &status);
1760 if (!(status & PI_CONFIG_STAT_0_M_PEND))
1761 return IRQ_NONE;
1756 1762
1763 spin_lock(&bp->lock);
1764
1765 /* Disable interrupts at the ESIC */
1766 status &= ~PI_CONFIG_STAT_0_M_INT_ENB;
1767 dfx_port_write_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, status);
1768
1769 /* Call interrupt service routine for this adapter */
1757 dfx_int_common(dev); 1770 dfx_int_common(dev);
1758 1771
1759 /* Reenable interrupts at the ESIC */ 1772 /* Reenable interrupts at the ESIC */
1773 dfx_port_read_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, &status);
1774 status |= PI_CONFIG_STAT_0_M_INT_ENB;
1775 dfx_port_write_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, status);
1760 1776
1761 dfx_port_read_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, &tmp); 1777 spin_unlock(&bp->lock);
1762 tmp |= PI_CONFIG_STAT_0_M_INT_ENB;
1763 dfx_port_write_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, tmp);
1764 }
1765
1766 spin_unlock(&bp->lock);
1767 } 1778 }
1768 1779
1780 return IRQ_HANDLED;
1781}
1782
1769 1783
1770/* 1784/*
1771 * ===================== 1785 * =====================
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index aa42b7a27735..430c628279b3 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -547,7 +547,7 @@ rio_timer (unsigned long data)
547 skb_reserve (skb, 2); 547 skb_reserve (skb, 2);
548 np->rx_ring[entry].fraginfo = 548 np->rx_ring[entry].fraginfo =
549 cpu_to_le64 (pci_map_single 549 cpu_to_le64 (pci_map_single
550 (np->pdev, skb->tail, np->rx_buf_sz, 550 (np->pdev, skb->data, np->rx_buf_sz,
551 PCI_DMA_FROMDEVICE)); 551 PCI_DMA_FROMDEVICE));
552 } 552 }
553 np->rx_ring[entry].fraginfo |= 553 np->rx_ring[entry].fraginfo |=
@@ -618,7 +618,7 @@ alloc_list (struct net_device *dev)
618 /* Rubicon now supports 40 bits of addressing space. */ 618 /* Rubicon now supports 40 bits of addressing space. */
619 np->rx_ring[i].fraginfo = 619 np->rx_ring[i].fraginfo =
620 cpu_to_le64 ( pci_map_single ( 620 cpu_to_le64 ( pci_map_single (
621 np->pdev, skb->tail, np->rx_buf_sz, 621 np->pdev, skb->data, np->rx_buf_sz,
622 PCI_DMA_FROMDEVICE)); 622 PCI_DMA_FROMDEVICE));
623 np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; 623 np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48;
624 } 624 }
@@ -906,7 +906,7 @@ receive_packet (struct net_device *dev)
906 /* 16 byte align the IP header */ 906 /* 16 byte align the IP header */
907 skb_reserve (skb, 2); 907 skb_reserve (skb, 2);
908 eth_copy_and_sum (skb, 908 eth_copy_and_sum (skb,
909 np->rx_skbuff[entry]->tail, 909 np->rx_skbuff[entry]->data,
910 pkt_len, 0); 910 pkt_len, 0);
911 skb_put (skb, pkt_len); 911 skb_put (skb, pkt_len);
912 pci_dma_sync_single_for_device(np->pdev, 912 pci_dma_sync_single_for_device(np->pdev,
@@ -950,7 +950,7 @@ receive_packet (struct net_device *dev)
950 skb_reserve (skb, 2); 950 skb_reserve (skb, 2);
951 np->rx_ring[entry].fraginfo = 951 np->rx_ring[entry].fraginfo =
952 cpu_to_le64 (pci_map_single 952 cpu_to_le64 (pci_map_single
953 (np->pdev, skb->tail, np->rx_buf_sz, 953 (np->pdev, skb->data, np->rx_buf_sz,
954 PCI_DMA_FROMDEVICE)); 954 PCI_DMA_FROMDEVICE));
955 } 955 }
956 np->rx_ring[entry].fraginfo |= 956 np->rx_ring[entry].fraginfo |=
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index f4ba0ffb8637..6440a892bb81 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -48,6 +48,10 @@
48 * net_device_stats 48 * net_device_stats
49 * * introduced tx_timeout function 49 * * introduced tx_timeout function
50 * * reworked locking 50 * * reworked locking
51 *
52 * 01-Jul-2005 Ben Dooks <ben@simtec.co.uk>
53 * * fixed spinlock call without pointer
54 * * ensure spinlock is initialised
51 */ 55 */
52 56
53#include <linux/module.h> 57#include <linux/module.h>
@@ -148,7 +152,6 @@ static int dm9000_probe(struct device *);
148static int dm9000_open(struct net_device *); 152static int dm9000_open(struct net_device *);
149static int dm9000_start_xmit(struct sk_buff *, struct net_device *); 153static int dm9000_start_xmit(struct sk_buff *, struct net_device *);
150static int dm9000_stop(struct net_device *); 154static int dm9000_stop(struct net_device *);
151static int dm9000_do_ioctl(struct net_device *, struct ifreq *, int);
152 155
153 156
154static void dm9000_timer(unsigned long); 157static void dm9000_timer(unsigned long);
@@ -224,7 +227,7 @@ static void dm9000_outblk_32bit(void __iomem *reg, void *data, int count)
224 227
225static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count) 228static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count)
226{ 229{
227 readsb(reg, data, count+1); 230 readsb(reg, data, count);
228} 231}
229 232
230 233
@@ -322,7 +325,7 @@ static void dm9000_timeout(struct net_device *dev)
322 325
323 /* Save previous register address */ 326 /* Save previous register address */
324 reg_save = readb(db->io_addr); 327 reg_save = readb(db->io_addr);
325 spin_lock_irqsave(db->lock,flags); 328 spin_lock_irqsave(&db->lock,flags);
326 329
327 netif_stop_queue(dev); 330 netif_stop_queue(dev);
328 dm9000_reset(db); 331 dm9000_reset(db);
@@ -333,7 +336,7 @@ static void dm9000_timeout(struct net_device *dev)
333 336
334 /* Restore previous register address */ 337 /* Restore previous register address */
335 writeb(reg_save, db->io_addr); 338 writeb(reg_save, db->io_addr);
336 spin_unlock_irqrestore(db->lock,flags); 339 spin_unlock_irqrestore(&db->lock,flags);
337} 340}
338 341
339 342
@@ -364,7 +367,7 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
364 } 367 }
365 368
366 if (db->addr_res != NULL) { 369 if (db->addr_res != NULL) {
367 release_resource(db->data_req); 370 release_resource(db->addr_res);
368 kfree(db->addr_req); 371 kfree(db->addr_req);
369 } 372 }
370} 373}
@@ -387,8 +390,6 @@ dm9000_probe(struct device *dev)
387 int i; 390 int i;
388 u32 id_val; 391 u32 id_val;
389 392
390 printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME);
391
392 /* Init network device */ 393 /* Init network device */
393 ndev = alloc_etherdev(sizeof (struct board_info)); 394 ndev = alloc_etherdev(sizeof (struct board_info));
394 if (!ndev) { 395 if (!ndev) {
@@ -405,6 +406,8 @@ dm9000_probe(struct device *dev)
405 db = (struct board_info *) ndev->priv; 406 db = (struct board_info *) ndev->priv;
406 memset(db, 0, sizeof (*db)); 407 memset(db, 0, sizeof (*db));
407 408
409 spin_lock_init(&db->lock);
410
408 if (pdev->num_resources < 2) { 411 if (pdev->num_resources < 2) {
409 ret = -ENODEV; 412 ret = -ENODEV;
410 goto out; 413 goto out;
@@ -541,7 +544,6 @@ dm9000_probe(struct device *dev)
541 ndev->stop = &dm9000_stop; 544 ndev->stop = &dm9000_stop;
542 ndev->get_stats = &dm9000_get_stats; 545 ndev->get_stats = &dm9000_get_stats;
543 ndev->set_multicast_list = &dm9000_hash_table; 546 ndev->set_multicast_list = &dm9000_hash_table;
544 ndev->do_ioctl = &dm9000_do_ioctl;
545 547
546#ifdef DM9000_PROGRAM_EEPROM 548#ifdef DM9000_PROGRAM_EEPROM
547 program_eeprom(db); 549 program_eeprom(db);
@@ -612,7 +614,7 @@ dm9000_open(struct net_device *dev)
612 614
613 /* set and active a timer process */ 615 /* set and active a timer process */
614 init_timer(&db->timer); 616 init_timer(&db->timer);
615 db->timer.expires = DM9000_TIMER_WUT * 2; 617 db->timer.expires = DM9000_TIMER_WUT;
616 db->timer.data = (unsigned long) dev; 618 db->timer.data = (unsigned long) dev;
617 db->timer.function = &dm9000_timer; 619 db->timer.function = &dm9000_timer;
618 add_timer(&db->timer); 620 add_timer(&db->timer);
@@ -845,15 +847,6 @@ dm9000_get_stats(struct net_device *dev)
845 return &db->stats; 847 return &db->stats;
846} 848}
847 849
848/*
849 * Process the upper socket ioctl command
850 */
851static int
852dm9000_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
853{
854 PRINTK1("entering %s\n",__FUNCTION__);
855 return 0;
856}
857 850
858/* 851/*
859 * A periodic timer routine 852 * A periodic timer routine
@@ -864,21 +857,11 @@ dm9000_timer(unsigned long data)
864{ 857{
865 struct net_device *dev = (struct net_device *) data; 858 struct net_device *dev = (struct net_device *) data;
866 board_info_t *db = (board_info_t *) dev->priv; 859 board_info_t *db = (board_info_t *) dev->priv;
867 u8 reg_save;
868 unsigned long flags;
869 860
870 PRINTK3("dm9000_timer()\n"); 861 PRINTK3("dm9000_timer()\n");
871 862
872 spin_lock_irqsave(db->lock,flags);
873 /* Save previous register address */
874 reg_save = readb(db->io_addr);
875
876 mii_check_media(&db->mii, netif_msg_link(db), 0); 863 mii_check_media(&db->mii, netif_msg_link(db), 0);
877 864
878 /* Restore previous register address */
879 writeb(reg_save, db->io_addr);
880 spin_unlock_irqrestore(db->lock,flags);
881
882 /* Set timer again */ 865 /* Set timer again */
883 db->timer.expires = DM9000_TIMER_WUT; 866 db->timer.expires = DM9000_TIMER_WUT;
884 add_timer(&db->timer); 867 add_timer(&db->timer);
@@ -1098,9 +1081,14 @@ dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1098{ 1081{
1099 board_info_t *db = (board_info_t *) dev->priv; 1082 board_info_t *db = (board_info_t *) dev->priv;
1100 unsigned long flags; 1083 unsigned long flags;
1084 unsigned int reg_save;
1101 int ret; 1085 int ret;
1102 1086
1103 spin_lock_irqsave(&db->lock,flags); 1087 spin_lock_irqsave(&db->lock,flags);
1088
1089 /* Save previous register address */
1090 reg_save = readb(db->io_addr);
1091
1104 /* Fill the phyxcer register into REG_0C */ 1092 /* Fill the phyxcer register into REG_0C */
1105 iow(db, DM9000_EPAR, DM9000_PHY | reg); 1093 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1106 1094
@@ -1111,6 +1099,9 @@ dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1111 /* The read data keeps on REG_0D & REG_0E */ 1099 /* The read data keeps on REG_0D & REG_0E */
1112 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); 1100 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
1113 1101
1102 /* restore the previous address */
1103 writeb(reg_save, db->io_addr);
1104
1114 spin_unlock_irqrestore(&db->lock,flags); 1105 spin_unlock_irqrestore(&db->lock,flags);
1115 1106
1116 return ret; 1107 return ret;
@@ -1124,9 +1115,13 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
1124{ 1115{
1125 board_info_t *db = (board_info_t *) dev->priv; 1116 board_info_t *db = (board_info_t *) dev->priv;
1126 unsigned long flags; 1117 unsigned long flags;
1118 unsigned long reg_save;
1127 1119
1128 spin_lock_irqsave(&db->lock,flags); 1120 spin_lock_irqsave(&db->lock,flags);
1129 1121
1122 /* Save previous register address */
1123 reg_save = readb(db->io_addr);
1124
1130 /* Fill the phyxcer register into REG_0C */ 1125 /* Fill the phyxcer register into REG_0C */
1131 iow(db, DM9000_EPAR, DM9000_PHY | reg); 1126 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1132 1127
@@ -1138,6 +1133,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
1138 udelay(500); /* Wait write complete */ 1133 udelay(500); /* Wait write complete */
1139 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ 1134 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
1140 1135
1136 /* restore the previous address */
1137 writeb(reg_save, db->io_addr);
1138
1141 spin_unlock_irqrestore(&db->lock,flags); 1139 spin_unlock_irqrestore(&db->lock,flags);
1142} 1140}
1143 1141
@@ -1202,6 +1200,8 @@ static struct device_driver dm9000_driver = {
1202static int __init 1200static int __init
1203dm9000_init(void) 1201dm9000_init(void)
1204{ 1202{
1203 printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME);
1204
1205 return driver_register(&dm9000_driver); /* search board and register */ 1205 return driver_register(&dm9000_driver); /* search board and register */
1206} 1206}
1207 1207
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 4a47df5a9ff9..d0fa2448761d 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -143,6 +143,7 @@
143#include <linux/delay.h> 143#include <linux/delay.h>
144#include <linux/init.h> 144#include <linux/init.h>
145#include <linux/pci.h> 145#include <linux/pci.h>
146#include <linux/dma-mapping.h>
146#include <linux/netdevice.h> 147#include <linux/netdevice.h>
147#include <linux/etherdevice.h> 148#include <linux/etherdevice.h>
148#include <linux/mii.h> 149#include <linux/mii.h>
@@ -1092,11 +1093,16 @@ static int e100_phy_init(struct nic *nic)
1092 } 1093 }
1093 1094
1094 if((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 1095 if((nic->mac >= mac_82550_D102) || ((nic->flags & ich) &&
1095 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 1096 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000))) {
1096 (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) 1097 /* enable/disable MDI/MDI-X auto-switching.
1097 /* enable/disable MDI/MDI-X auto-switching */ 1098 MDI/MDI-X auto-switching is disabled for 82551ER/QM chips */
1098 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, 1099 if((nic->mac == mac_82551_E) || (nic->mac == mac_82551_F) ||
1099 nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); 1100 (nic->mac == mac_82551_10) || (nic->mii.force_media) ||
1101 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))
1102 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, 0);
1103 else
1104 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, NCONFIG_AUTO_SWITCH);
1105 }
1100 1106
1101 return 0; 1107 return 0;
1102} 1108}
@@ -1665,8 +1671,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id, struct pt_regs *regs)
1665 if(stat_ack & stat_ack_rnr) 1671 if(stat_ack & stat_ack_rnr)
1666 nic->ru_running = RU_SUSPENDED; 1672 nic->ru_running = RU_SUSPENDED;
1667 1673
1668 e100_disable_irq(nic); 1674 if(likely(netif_rx_schedule_prep(netdev))) {
1669 netif_rx_schedule(netdev); 1675 e100_disable_irq(nic);
1676 __netif_rx_schedule(netdev);
1677 }
1670 1678
1671 return IRQ_HANDLED; 1679 return IRQ_HANDLED;
1672} 1680}
@@ -2286,7 +2294,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2286 goto err_out_disable_pdev; 2294 goto err_out_disable_pdev;
2287 } 2295 }
2288 2296
2289 if((err = pci_set_dma_mask(pdev, 0xFFFFFFFFULL))) { 2297 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
2290 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); 2298 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n");
2291 goto err_out_free_res; 2299 goto err_out_free_res;
2292 } 2300 }
@@ -2334,11 +2342,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2334 goto err_out_iounmap; 2342 goto err_out_iounmap;
2335 } 2343 }
2336 2344
2337 e100_phy_init(nic);
2338
2339 if((err = e100_eeprom_load(nic))) 2345 if((err = e100_eeprom_load(nic)))
2340 goto err_out_free; 2346 goto err_out_free;
2341 2347
2348 e100_phy_init(nic);
2349
2342 memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN); 2350 memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
2343 if(!is_valid_ether_addr(netdev->dev_addr)) { 2351 if(!is_valid_ether_addr(netdev->dev_addr)) {
2344 DPRINTK(PROBE, ERR, "Invalid MAC address from " 2352 DPRINTK(PROBE, ERR, "Invalid MAC address from "
@@ -2439,9 +2447,8 @@ static int e100_resume(struct pci_dev *pdev)
2439#endif 2447#endif
2440 2448
2441 2449
2442static void e100_shutdown(struct device *dev) 2450static void e100_shutdown(struct pci_dev *pdev)
2443{ 2451{
2444 struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
2445 struct net_device *netdev = pci_get_drvdata(pdev); 2452 struct net_device *netdev = pci_get_drvdata(pdev);
2446 struct nic *nic = netdev_priv(netdev); 2453 struct nic *nic = netdev_priv(netdev);
2447 2454
@@ -2462,11 +2469,7 @@ static struct pci_driver e100_driver = {
2462 .suspend = e100_suspend, 2469 .suspend = e100_suspend,
2463 .resume = e100_resume, 2470 .resume = e100_resume,
2464#endif 2471#endif
2465 2472 .shutdown = e100_shutdown,
2466 .driver = {
2467 .shutdown = e100_shutdown,
2468 }
2469
2470}; 2473};
2471 2474
2472static int __init e100_init_module(void) 2475static int __init e100_init_module(void)
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index af1e82c5b808..092757bc721f 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -140,7 +140,7 @@ struct e1000_adapter;
140#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */ 140#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
141 141
142#define AUTO_ALL_MODES 0 142#define AUTO_ALL_MODES 0
143#define E1000_EEPROM_82544_APM 0x0400 143#define E1000_EEPROM_82544_APM 0x0004
144#define E1000_EEPROM_APME 0x0400 144#define E1000_EEPROM_APME 0x0400
145 145
146#ifndef E1000_MASTER_SLAVE 146#ifndef E1000_MASTER_SLAVE
@@ -159,7 +159,7 @@ struct e1000_adapter;
159 * so a DMA handle can be stored along with the buffer */ 159 * so a DMA handle can be stored along with the buffer */
160struct e1000_buffer { 160struct e1000_buffer {
161 struct sk_buff *skb; 161 struct sk_buff *skb;
162 uint64_t dma; 162 dma_addr_t dma;
163 unsigned long time_stamp; 163 unsigned long time_stamp;
164 uint16_t length; 164 uint16_t length;
165 uint16_t next_to_watch; 165 uint16_t next_to_watch;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 237247f74df4..f133ff0b0b94 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -105,7 +105,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
105static int 105static int
106e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) 106e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
107{ 107{
108 struct e1000_adapter *adapter = netdev->priv; 108 struct e1000_adapter *adapter = netdev_priv(netdev);
109 struct e1000_hw *hw = &adapter->hw; 109 struct e1000_hw *hw = &adapter->hw;
110 110
111 if(hw->media_type == e1000_media_type_copper) { 111 if(hw->media_type == e1000_media_type_copper) {
@@ -141,9 +141,9 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
141 SUPPORTED_FIBRE | 141 SUPPORTED_FIBRE |
142 SUPPORTED_Autoneg); 142 SUPPORTED_Autoneg);
143 143
144 ecmd->advertising = (SUPPORTED_1000baseT_Full | 144 ecmd->advertising = (ADVERTISED_1000baseT_Full |
145 SUPPORTED_FIBRE | 145 ADVERTISED_FIBRE |
146 SUPPORTED_Autoneg); 146 ADVERTISED_Autoneg);
147 147
148 ecmd->port = PORT_FIBRE; 148 ecmd->port = PORT_FIBRE;
149 149
@@ -179,13 +179,24 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
179static int 179static int
180e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) 180e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
181{ 181{
182 struct e1000_adapter *adapter = netdev->priv; 182 struct e1000_adapter *adapter = netdev_priv(netdev);
183 struct e1000_hw *hw = &adapter->hw; 183 struct e1000_hw *hw = &adapter->hw;
184 184
185 if(ecmd->autoneg == AUTONEG_ENABLE) { 185 if(ecmd->autoneg == AUTONEG_ENABLE) {
186 hw->autoneg = 1; 186 hw->autoneg = 1;
187 hw->autoneg_advertised = 0x002F; 187 if(hw->media_type == e1000_media_type_fiber)
188 ecmd->advertising = 0x002F; 188 hw->autoneg_advertised = ADVERTISED_1000baseT_Full |
189 ADVERTISED_FIBRE |
190 ADVERTISED_Autoneg;
191 else
192 hw->autoneg_advertised = ADVERTISED_10baseT_Half |
193 ADVERTISED_10baseT_Full |
194 ADVERTISED_100baseT_Half |
195 ADVERTISED_100baseT_Full |
196 ADVERTISED_1000baseT_Full|
197 ADVERTISED_Autoneg |
198 ADVERTISED_TP;
199 ecmd->advertising = hw->autoneg_advertised;
189 } else 200 } else
190 if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) 201 if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex))
191 return -EINVAL; 202 return -EINVAL;
@@ -206,7 +217,7 @@ static void
206e1000_get_pauseparam(struct net_device *netdev, 217e1000_get_pauseparam(struct net_device *netdev,
207 struct ethtool_pauseparam *pause) 218 struct ethtool_pauseparam *pause)
208{ 219{
209 struct e1000_adapter *adapter = netdev->priv; 220 struct e1000_adapter *adapter = netdev_priv(netdev);
210 struct e1000_hw *hw = &adapter->hw; 221 struct e1000_hw *hw = &adapter->hw;
211 222
212 pause->autoneg = 223 pause->autoneg =
@@ -226,7 +237,7 @@ static int
226e1000_set_pauseparam(struct net_device *netdev, 237e1000_set_pauseparam(struct net_device *netdev,
227 struct ethtool_pauseparam *pause) 238 struct ethtool_pauseparam *pause)
228{ 239{
229 struct e1000_adapter *adapter = netdev->priv; 240 struct e1000_adapter *adapter = netdev_priv(netdev);
230 struct e1000_hw *hw = &adapter->hw; 241 struct e1000_hw *hw = &adapter->hw;
231 242
232 adapter->fc_autoneg = pause->autoneg; 243 adapter->fc_autoneg = pause->autoneg;
@@ -259,14 +270,14 @@ e1000_set_pauseparam(struct net_device *netdev,
259static uint32_t 270static uint32_t
260e1000_get_rx_csum(struct net_device *netdev) 271e1000_get_rx_csum(struct net_device *netdev)
261{ 272{
262 struct e1000_adapter *adapter = netdev->priv; 273 struct e1000_adapter *adapter = netdev_priv(netdev);
263 return adapter->rx_csum; 274 return adapter->rx_csum;
264} 275}
265 276
266static int 277static int
267e1000_set_rx_csum(struct net_device *netdev, uint32_t data) 278e1000_set_rx_csum(struct net_device *netdev, uint32_t data)
268{ 279{
269 struct e1000_adapter *adapter = netdev->priv; 280 struct e1000_adapter *adapter = netdev_priv(netdev);
270 adapter->rx_csum = data; 281 adapter->rx_csum = data;
271 282
272 if(netif_running(netdev)) { 283 if(netif_running(netdev)) {
@@ -286,7 +297,7 @@ e1000_get_tx_csum(struct net_device *netdev)
286static int 297static int
287e1000_set_tx_csum(struct net_device *netdev, uint32_t data) 298e1000_set_tx_csum(struct net_device *netdev, uint32_t data)
288{ 299{
289 struct e1000_adapter *adapter = netdev->priv; 300 struct e1000_adapter *adapter = netdev_priv(netdev);
290 301
291 if(adapter->hw.mac_type < e1000_82543) { 302 if(adapter->hw.mac_type < e1000_82543) {
292 if (!data) 303 if (!data)
@@ -306,8 +317,8 @@ e1000_set_tx_csum(struct net_device *netdev, uint32_t data)
306static int 317static int
307e1000_set_tso(struct net_device *netdev, uint32_t data) 318e1000_set_tso(struct net_device *netdev, uint32_t data)
308{ 319{
309 struct e1000_adapter *adapter = netdev->priv; 320 struct e1000_adapter *adapter = netdev_priv(netdev);
310 if ((adapter->hw.mac_type < e1000_82544) || 321 if((adapter->hw.mac_type < e1000_82544) ||
311 (adapter->hw.mac_type == e1000_82547)) 322 (adapter->hw.mac_type == e1000_82547))
312 return data ? -EINVAL : 0; 323 return data ? -EINVAL : 0;
313 324
@@ -322,14 +333,14 @@ e1000_set_tso(struct net_device *netdev, uint32_t data)
322static uint32_t 333static uint32_t
323e1000_get_msglevel(struct net_device *netdev) 334e1000_get_msglevel(struct net_device *netdev)
324{ 335{
325 struct e1000_adapter *adapter = netdev->priv; 336 struct e1000_adapter *adapter = netdev_priv(netdev);
326 return adapter->msg_enable; 337 return adapter->msg_enable;
327} 338}
328 339
329static void 340static void
330e1000_set_msglevel(struct net_device *netdev, uint32_t data) 341e1000_set_msglevel(struct net_device *netdev, uint32_t data)
331{ 342{
332 struct e1000_adapter *adapter = netdev->priv; 343 struct e1000_adapter *adapter = netdev_priv(netdev);
333 adapter->msg_enable = data; 344 adapter->msg_enable = data;
334} 345}
335 346
@@ -344,7 +355,7 @@ static void
344e1000_get_regs(struct net_device *netdev, 355e1000_get_regs(struct net_device *netdev,
345 struct ethtool_regs *regs, void *p) 356 struct ethtool_regs *regs, void *p)
346{ 357{
347 struct e1000_adapter *adapter = netdev->priv; 358 struct e1000_adapter *adapter = netdev_priv(netdev);
348 struct e1000_hw *hw = &adapter->hw; 359 struct e1000_hw *hw = &adapter->hw;
349 uint32_t *regs_buff = p; 360 uint32_t *regs_buff = p;
350 uint16_t phy_data; 361 uint16_t phy_data;
@@ -432,7 +443,7 @@ e1000_get_regs(struct net_device *netdev,
432static int 443static int
433e1000_get_eeprom_len(struct net_device *netdev) 444e1000_get_eeprom_len(struct net_device *netdev)
434{ 445{
435 struct e1000_adapter *adapter = netdev->priv; 446 struct e1000_adapter *adapter = netdev_priv(netdev);
436 return adapter->hw.eeprom.word_size * 2; 447 return adapter->hw.eeprom.word_size * 2;
437} 448}
438 449
@@ -440,7 +451,7 @@ static int
440e1000_get_eeprom(struct net_device *netdev, 451e1000_get_eeprom(struct net_device *netdev,
441 struct ethtool_eeprom *eeprom, uint8_t *bytes) 452 struct ethtool_eeprom *eeprom, uint8_t *bytes)
442{ 453{
443 struct e1000_adapter *adapter = netdev->priv; 454 struct e1000_adapter *adapter = netdev_priv(netdev);
444 struct e1000_hw *hw = &adapter->hw; 455 struct e1000_hw *hw = &adapter->hw;
445 uint16_t *eeprom_buff; 456 uint16_t *eeprom_buff;
446 int first_word, last_word; 457 int first_word, last_word;
@@ -486,7 +497,7 @@ static int
486e1000_set_eeprom(struct net_device *netdev, 497e1000_set_eeprom(struct net_device *netdev,
487 struct ethtool_eeprom *eeprom, uint8_t *bytes) 498 struct ethtool_eeprom *eeprom, uint8_t *bytes)
488{ 499{
489 struct e1000_adapter *adapter = netdev->priv; 500 struct e1000_adapter *adapter = netdev_priv(netdev);
490 struct e1000_hw *hw = &adapter->hw; 501 struct e1000_hw *hw = &adapter->hw;
491 uint16_t *eeprom_buff; 502 uint16_t *eeprom_buff;
492 void *ptr; 503 void *ptr;
@@ -547,7 +558,7 @@ static void
547e1000_get_drvinfo(struct net_device *netdev, 558e1000_get_drvinfo(struct net_device *netdev,
548 struct ethtool_drvinfo *drvinfo) 559 struct ethtool_drvinfo *drvinfo)
549{ 560{
550 struct e1000_adapter *adapter = netdev->priv; 561 struct e1000_adapter *adapter = netdev_priv(netdev);
551 562
552 strncpy(drvinfo->driver, e1000_driver_name, 32); 563 strncpy(drvinfo->driver, e1000_driver_name, 32);
553 strncpy(drvinfo->version, e1000_driver_version, 32); 564 strncpy(drvinfo->version, e1000_driver_version, 32);
@@ -563,7 +574,7 @@ static void
563e1000_get_ringparam(struct net_device *netdev, 574e1000_get_ringparam(struct net_device *netdev,
564 struct ethtool_ringparam *ring) 575 struct ethtool_ringparam *ring)
565{ 576{
566 struct e1000_adapter *adapter = netdev->priv; 577 struct e1000_adapter *adapter = netdev_priv(netdev);
567 e1000_mac_type mac_type = adapter->hw.mac_type; 578 e1000_mac_type mac_type = adapter->hw.mac_type;
568 struct e1000_desc_ring *txdr = &adapter->tx_ring; 579 struct e1000_desc_ring *txdr = &adapter->tx_ring;
569 struct e1000_desc_ring *rxdr = &adapter->rx_ring; 580 struct e1000_desc_ring *rxdr = &adapter->rx_ring;
@@ -584,7 +595,7 @@ static int
584e1000_set_ringparam(struct net_device *netdev, 595e1000_set_ringparam(struct net_device *netdev,
585 struct ethtool_ringparam *ring) 596 struct ethtool_ringparam *ring)
586{ 597{
587 struct e1000_adapter *adapter = netdev->priv; 598 struct e1000_adapter *adapter = netdev_priv(netdev);
588 e1000_mac_type mac_type = adapter->hw.mac_type; 599 e1000_mac_type mac_type = adapter->hw.mac_type;
589 struct e1000_desc_ring *txdr = &adapter->tx_ring; 600 struct e1000_desc_ring *txdr = &adapter->tx_ring;
590 struct e1000_desc_ring *rxdr = &adapter->rx_ring; 601 struct e1000_desc_ring *rxdr = &adapter->rx_ring;
@@ -651,6 +662,9 @@ err_setup_rx:
651 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ 662 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \
652 value = E1000_READ_REG(&adapter->hw, R); \ 663 value = E1000_READ_REG(&adapter->hw, R); \
653 if(value != (test[pat] & W & M)) { \ 664 if(value != (test[pat] & W & M)) { \
665 DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \
666 "0x%08X expected 0x%08X\n", \
667 E1000_##R, value, (test[pat] & W & M)); \
654 *data = (adapter->hw.mac_type < e1000_82543) ? \ 668 *data = (adapter->hw.mac_type < e1000_82543) ? \
655 E1000_82542_##R : E1000_##R; \ 669 E1000_82542_##R : E1000_##R; \
656 return 1; \ 670 return 1; \
@@ -663,7 +677,9 @@ err_setup_rx:
663 uint32_t value; \ 677 uint32_t value; \
664 E1000_WRITE_REG(&adapter->hw, R, W & M); \ 678 E1000_WRITE_REG(&adapter->hw, R, W & M); \
665 value = E1000_READ_REG(&adapter->hw, R); \ 679 value = E1000_READ_REG(&adapter->hw, R); \
666 if ((W & M) != (value & M)) { \ 680 if((W & M) != (value & M)) { \
681 DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
682 "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \
667 *data = (adapter->hw.mac_type < e1000_82543) ? \ 683 *data = (adapter->hw.mac_type < e1000_82543) ? \
668 E1000_82542_##R : E1000_##R; \ 684 E1000_82542_##R : E1000_##R; \
669 return 1; \ 685 return 1; \
@@ -673,18 +689,33 @@ err_setup_rx:
673static int 689static int
674e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) 690e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
675{ 691{
676 uint32_t value; 692 uint32_t value, before, after;
677 uint32_t i; 693 uint32_t i, toggle;
678 694
679 /* The status register is Read Only, so a write should fail. 695 /* The status register is Read Only, so a write should fail.
680 * Some bits that get toggled are ignored. 696 * Some bits that get toggled are ignored.
681 */ 697 */
682 value = (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833)); 698 switch (adapter->hw.mac_type) {
683 E1000_WRITE_REG(&adapter->hw, STATUS, (0xFFFFFFFF)); 699 case e1000_82573:
684 if(value != (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833))) { 700 toggle = 0x7FFFF033;
701 break;
702 default:
703 toggle = 0xFFFFF833;
704 break;
705 }
706
707 before = E1000_READ_REG(&adapter->hw, STATUS);
708 value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle);
709 E1000_WRITE_REG(&adapter->hw, STATUS, toggle);
710 after = E1000_READ_REG(&adapter->hw, STATUS) & toggle;
711 if(value != after) {
712 DPRINTK(DRV, ERR, "failed STATUS register test got: "
713 "0x%08X expected: 0x%08X\n", after, value);
685 *data = 1; 714 *data = 1;
686 return 1; 715 return 1;
687 } 716 }
717 /* restore previous status */
718 E1000_WRITE_REG(&adapter->hw, STATUS, before);
688 719
689 REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); 720 REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF);
690 REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); 721 REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF);
@@ -766,7 +797,7 @@ e1000_test_intr(int irq,
766 struct pt_regs *regs) 797 struct pt_regs *regs)
767{ 798{
768 struct net_device *netdev = (struct net_device *) data; 799 struct net_device *netdev = (struct net_device *) data;
769 struct e1000_adapter *adapter = netdev->priv; 800 struct e1000_adapter *adapter = netdev_priv(netdev);
770 801
771 adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR); 802 adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR);
772 803
@@ -1214,6 +1245,7 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter)
1214 case e1000_82541_rev_2: 1245 case e1000_82541_rev_2:
1215 case e1000_82547: 1246 case e1000_82547:
1216 case e1000_82547_rev_2: 1247 case e1000_82547_rev_2:
1248 case e1000_82573:
1217 return e1000_integrated_phy_loopback(adapter); 1249 return e1000_integrated_phy_loopback(adapter);
1218 break; 1250 break;
1219 1251
@@ -1422,7 +1454,7 @@ static void
1422e1000_diag_test(struct net_device *netdev, 1454e1000_diag_test(struct net_device *netdev,
1423 struct ethtool_test *eth_test, uint64_t *data) 1455 struct ethtool_test *eth_test, uint64_t *data)
1424{ 1456{
1425 struct e1000_adapter *adapter = netdev->priv; 1457 struct e1000_adapter *adapter = netdev_priv(netdev);
1426 boolean_t if_running = netif_running(netdev); 1458 boolean_t if_running = netif_running(netdev);
1427 1459
1428 if(eth_test->flags == ETH_TEST_FL_OFFLINE) { 1460 if(eth_test->flags == ETH_TEST_FL_OFFLINE) {
@@ -1482,7 +1514,7 @@ e1000_diag_test(struct net_device *netdev,
1482static void 1514static void
1483e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1515e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1484{ 1516{
1485 struct e1000_adapter *adapter = netdev->priv; 1517 struct e1000_adapter *adapter = netdev_priv(netdev);
1486 struct e1000_hw *hw = &adapter->hw; 1518 struct e1000_hw *hw = &adapter->hw;
1487 1519
1488 switch(adapter->hw.device_id) { 1520 switch(adapter->hw.device_id) {
@@ -1527,7 +1559,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1527static int 1559static int
1528e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1560e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1529{ 1561{
1530 struct e1000_adapter *adapter = netdev->priv; 1562 struct e1000_adapter *adapter = netdev_priv(netdev);
1531 struct e1000_hw *hw = &adapter->hw; 1563 struct e1000_hw *hw = &adapter->hw;
1532 1564
1533 switch(adapter->hw.device_id) { 1565 switch(adapter->hw.device_id) {
@@ -1588,22 +1620,31 @@ e1000_led_blink_callback(unsigned long data)
1588static int 1620static int
1589e1000_phys_id(struct net_device *netdev, uint32_t data) 1621e1000_phys_id(struct net_device *netdev, uint32_t data)
1590{ 1622{
1591 struct e1000_adapter *adapter = netdev->priv; 1623 struct e1000_adapter *adapter = netdev_priv(netdev);
1592 1624
1593 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 1625 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
1594 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 1626 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
1595 1627
1596 if(!adapter->blink_timer.function) { 1628 if(adapter->hw.mac_type < e1000_82573) {
1597 init_timer(&adapter->blink_timer); 1629 if(!adapter->blink_timer.function) {
1598 adapter->blink_timer.function = e1000_led_blink_callback; 1630 init_timer(&adapter->blink_timer);
1599 adapter->blink_timer.data = (unsigned long) adapter; 1631 adapter->blink_timer.function = e1000_led_blink_callback;
1632 adapter->blink_timer.data = (unsigned long) adapter;
1633 }
1634 e1000_setup_led(&adapter->hw);
1635 mod_timer(&adapter->blink_timer, jiffies);
1636 msleep_interruptible(data * 1000);
1637 del_timer_sync(&adapter->blink_timer);
1638 }
1639 else {
1640 E1000_WRITE_REG(&adapter->hw, LEDCTL, (E1000_LEDCTL_LED2_BLINK_RATE |
1641 E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK |
1642 (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) |
1643 (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) |
1644 (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT)));
1645 msleep_interruptible(data * 1000);
1600 } 1646 }
1601 1647
1602 e1000_setup_led(&adapter->hw);
1603 mod_timer(&adapter->blink_timer, jiffies);
1604
1605 msleep_interruptible(data * 1000);
1606 del_timer_sync(&adapter->blink_timer);
1607 e1000_led_off(&adapter->hw); 1648 e1000_led_off(&adapter->hw);
1608 clear_bit(E1000_LED_ON, &adapter->led_status); 1649 clear_bit(E1000_LED_ON, &adapter->led_status);
1609 e1000_cleanup_led(&adapter->hw); 1650 e1000_cleanup_led(&adapter->hw);
@@ -1614,7 +1655,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
1614static int 1655static int
1615e1000_nway_reset(struct net_device *netdev) 1656e1000_nway_reset(struct net_device *netdev)
1616{ 1657{
1617 struct e1000_adapter *adapter = netdev->priv; 1658 struct e1000_adapter *adapter = netdev_priv(netdev);
1618 if(netif_running(netdev)) { 1659 if(netif_running(netdev)) {
1619 e1000_down(adapter); 1660 e1000_down(adapter);
1620 e1000_up(adapter); 1661 e1000_up(adapter);
@@ -1632,7 +1673,7 @@ static void
1632e1000_get_ethtool_stats(struct net_device *netdev, 1673e1000_get_ethtool_stats(struct net_device *netdev,
1633 struct ethtool_stats *stats, uint64_t *data) 1674 struct ethtool_stats *stats, uint64_t *data)
1634{ 1675{
1635 struct e1000_adapter *adapter = netdev->priv; 1676 struct e1000_adapter *adapter = netdev_priv(netdev);
1636 int i; 1677 int i;
1637 1678
1638 e1000_update_stats(adapter); 1679 e1000_update_stats(adapter);
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 723589b28be5..045f5426ab9a 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -354,18 +354,27 @@ e1000_set_media_type(struct e1000_hw *hw)
354 hw->media_type = e1000_media_type_internal_serdes; 354 hw->media_type = e1000_media_type_internal_serdes;
355 break; 355 break;
356 default: 356 default:
357 if(hw->mac_type >= e1000_82543) { 357 switch (hw->mac_type) {
358 case e1000_82542_rev2_0:
359 case e1000_82542_rev2_1:
360 hw->media_type = e1000_media_type_fiber;
361 break;
362 case e1000_82573:
363 /* The STATUS_TBIMODE bit is reserved or reused for the this
364 * device.
365 */
366 hw->media_type = e1000_media_type_copper;
367 break;
368 default:
358 status = E1000_READ_REG(hw, STATUS); 369 status = E1000_READ_REG(hw, STATUS);
359 if(status & E1000_STATUS_TBIMODE) { 370 if (status & E1000_STATUS_TBIMODE) {
360 hw->media_type = e1000_media_type_fiber; 371 hw->media_type = e1000_media_type_fiber;
361 /* tbi_compatibility not valid on fiber */ 372 /* tbi_compatibility not valid on fiber */
362 hw->tbi_compatibility_en = FALSE; 373 hw->tbi_compatibility_en = FALSE;
363 } else { 374 } else {
364 hw->media_type = e1000_media_type_copper; 375 hw->media_type = e1000_media_type_copper;
365 } 376 }
366 } else { 377 break;
367 /* This is an 82542 (fiber only) */
368 hw->media_type = e1000_media_type_fiber;
369 } 378 }
370 } 379 }
371} 380}
@@ -1189,9 +1198,9 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw)
1189 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); 1198 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data);
1190 if(ret_val) 1199 if(ret_val)
1191 return ret_val; 1200 return ret_val;
1192 } 1201 }
1193 1202
1194 return E1000_SUCCESS; 1203 return E1000_SUCCESS;
1195} 1204}
1196 1205
1197 1206
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a0263ee96c6b..93e9f8788751 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -66,6 +66,7 @@ typedef enum {
66 e1000_eeprom_spi, 66 e1000_eeprom_spi,
67 e1000_eeprom_microwire, 67 e1000_eeprom_microwire,
68 e1000_eeprom_flash, 68 e1000_eeprom_flash,
69 e1000_eeprom_none, /* No NVM support */
69 e1000_num_eeprom_types 70 e1000_num_eeprom_types
70} e1000_eeprom_type; 71} e1000_eeprom_type;
71 72
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 325495b8b60c..b82fd15d0891 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -29,6 +29,8 @@
29#include "e1000.h" 29#include "e1000.h"
30 30
31/* Change Log 31/* Change Log
32 * 6.0.58 4/20/05
33 * o Accepted ethtool cleanup patch from Stephen Hemminger
32 * 6.0.44+ 2/15/05 34 * 6.0.44+ 2/15/05
33 * o applied Anton's patch to resolve tx hang in hardware 35 * o applied Anton's patch to resolve tx hang in hardware
34 * o Applied Andrew Mortons patch - e1000 stops working after resume 36 * o Applied Andrew Mortons patch - e1000 stops working after resume
@@ -41,9 +43,9 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
41#else 43#else
42#define DRIVERNAPI "-NAPI" 44#define DRIVERNAPI "-NAPI"
43#endif 45#endif
44#define DRV_VERSION "6.0.54-k2"DRIVERNAPI 46#define DRV_VERSION "6.0.60-k2"DRIVERNAPI
45char e1000_driver_version[] = DRV_VERSION; 47char e1000_driver_version[] = DRV_VERSION;
46char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; 48char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
47 49
48/* e1000_pci_tbl - PCI Device ID Table 50/* e1000_pci_tbl - PCI Device ID Table
49 * 51 *
@@ -160,7 +162,6 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
160static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
161static void e1000_restore_vlan(struct e1000_adapter *adapter); 163static void e1000_restore_vlan(struct e1000_adapter *adapter);
162 164
163static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
164static int e1000_suspend(struct pci_dev *pdev, uint32_t state); 165static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
165#ifdef CONFIG_PM 166#ifdef CONFIG_PM
166static int e1000_resume(struct pci_dev *pdev); 167static int e1000_resume(struct pci_dev *pdev);
@@ -171,12 +172,6 @@ static int e1000_resume(struct pci_dev *pdev);
171static void e1000_netpoll (struct net_device *netdev); 172static void e1000_netpoll (struct net_device *netdev);
172#endif 173#endif
173 174
174struct notifier_block e1000_notifier_reboot = {
175 .notifier_call = e1000_notify_reboot,
176 .next = NULL,
177 .priority = 0
178};
179
180/* Exported from other modules */ 175/* Exported from other modules */
181 176
182extern void e1000_check_options(struct e1000_adapter *adapter); 177extern void e1000_check_options(struct e1000_adapter *adapter);
@@ -219,9 +214,7 @@ e1000_init_module(void)
219 printk(KERN_INFO "%s\n", e1000_copyright); 214 printk(KERN_INFO "%s\n", e1000_copyright);
220 215
221 ret = pci_module_init(&e1000_driver); 216 ret = pci_module_init(&e1000_driver);
222 if(ret >= 0) { 217
223 register_reboot_notifier(&e1000_notifier_reboot);
224 }
225 return ret; 218 return ret;
226} 219}
227 220
@@ -237,7 +230,6 @@ module_init(e1000_init_module);
237static void __exit 230static void __exit
238e1000_exit_module(void) 231e1000_exit_module(void)
239{ 232{
240 unregister_reboot_notifier(&e1000_notifier_reboot);
241 pci_unregister_driver(&e1000_driver); 233 pci_unregister_driver(&e1000_driver);
242} 234}
243 235
@@ -517,7 +509,7 @@ e1000_probe(struct pci_dev *pdev,
517 SET_NETDEV_DEV(netdev, &pdev->dev); 509 SET_NETDEV_DEV(netdev, &pdev->dev);
518 510
519 pci_set_drvdata(pdev, netdev); 511 pci_set_drvdata(pdev, netdev);
520 adapter = netdev->priv; 512 adapter = netdev_priv(netdev);
521 adapter->netdev = netdev; 513 adapter->netdev = netdev;
522 adapter->pdev = pdev; 514 adapter->pdev = pdev;
523 adapter->hw.back = adapter; 515 adapter->hw.back = adapter;
@@ -738,7 +730,7 @@ static void __devexit
738e1000_remove(struct pci_dev *pdev) 730e1000_remove(struct pci_dev *pdev)
739{ 731{
740 struct net_device *netdev = pci_get_drvdata(pdev); 732 struct net_device *netdev = pci_get_drvdata(pdev);
741 struct e1000_adapter *adapter = netdev->priv; 733 struct e1000_adapter *adapter = netdev_priv(netdev);
742 uint32_t manc, swsm; 734 uint32_t manc, swsm;
743 735
744 flush_scheduled_work(); 736 flush_scheduled_work();
@@ -871,7 +863,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
871static int 863static int
872e1000_open(struct net_device *netdev) 864e1000_open(struct net_device *netdev)
873{ 865{
874 struct e1000_adapter *adapter = netdev->priv; 866 struct e1000_adapter *adapter = netdev_priv(netdev);
875 int err; 867 int err;
876 868
877 /* allocate transmit descriptors */ 869 /* allocate transmit descriptors */
@@ -919,7 +911,7 @@ err_setup_tx:
919static int 911static int
920e1000_close(struct net_device *netdev) 912e1000_close(struct net_device *netdev)
921{ 913{
922 struct e1000_adapter *adapter = netdev->priv; 914 struct e1000_adapter *adapter = netdev_priv(netdev);
923 915
924 e1000_down(adapter); 916 e1000_down(adapter);
925 917
@@ -1599,7 +1591,7 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter)
1599static int 1591static int
1600e1000_set_mac(struct net_device *netdev, void *p) 1592e1000_set_mac(struct net_device *netdev, void *p)
1601{ 1593{
1602 struct e1000_adapter *adapter = netdev->priv; 1594 struct e1000_adapter *adapter = netdev_priv(netdev);
1603 struct sockaddr *addr = p; 1595 struct sockaddr *addr = p;
1604 1596
1605 if(!is_valid_ether_addr(addr->sa_data)) 1597 if(!is_valid_ether_addr(addr->sa_data))
@@ -1634,7 +1626,7 @@ e1000_set_mac(struct net_device *netdev, void *p)
1634static void 1626static void
1635e1000_set_multi(struct net_device *netdev) 1627e1000_set_multi(struct net_device *netdev)
1636{ 1628{
1637 struct e1000_adapter *adapter = netdev->priv; 1629 struct e1000_adapter *adapter = netdev_priv(netdev);
1638 struct e1000_hw *hw = &adapter->hw; 1630 struct e1000_hw *hw = &adapter->hw;
1639 struct dev_mc_list *mc_ptr; 1631 struct dev_mc_list *mc_ptr;
1640 unsigned long flags; 1632 unsigned long flags;
@@ -2213,7 +2205,7 @@ e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb)
2213static int 2205static int
2214e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 2206e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2215{ 2207{
2216 struct e1000_adapter *adapter = netdev->priv; 2208 struct e1000_adapter *adapter = netdev_priv(netdev);
2217 unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; 2209 unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD;
2218 unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; 2210 unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
2219 unsigned int tx_flags = 0; 2211 unsigned int tx_flags = 0;
@@ -2307,6 +2299,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2307 tso = e1000_tso(adapter, skb); 2299 tso = e1000_tso(adapter, skb);
2308 if (tso < 0) { 2300 if (tso < 0) {
2309 dev_kfree_skb_any(skb); 2301 dev_kfree_skb_any(skb);
2302 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2310 return NETDEV_TX_OK; 2303 return NETDEV_TX_OK;
2311 } 2304 }
2312 2305
@@ -2343,7 +2336,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2343static void 2336static void
2344e1000_tx_timeout(struct net_device *netdev) 2337e1000_tx_timeout(struct net_device *netdev)
2345{ 2338{
2346 struct e1000_adapter *adapter = netdev->priv; 2339 struct e1000_adapter *adapter = netdev_priv(netdev);
2347 2340
2348 /* Do the reset outside of interrupt context */ 2341 /* Do the reset outside of interrupt context */
2349 schedule_work(&adapter->tx_timeout_task); 2342 schedule_work(&adapter->tx_timeout_task);
@@ -2352,7 +2345,7 @@ e1000_tx_timeout(struct net_device *netdev)
2352static void 2345static void
2353e1000_tx_timeout_task(struct net_device *netdev) 2346e1000_tx_timeout_task(struct net_device *netdev)
2354{ 2347{
2355 struct e1000_adapter *adapter = netdev->priv; 2348 struct e1000_adapter *adapter = netdev_priv(netdev);
2356 2349
2357 e1000_down(adapter); 2350 e1000_down(adapter);
2358 e1000_up(adapter); 2351 e1000_up(adapter);
@@ -2369,7 +2362,7 @@ e1000_tx_timeout_task(struct net_device *netdev)
2369static struct net_device_stats * 2362static struct net_device_stats *
2370e1000_get_stats(struct net_device *netdev) 2363e1000_get_stats(struct net_device *netdev)
2371{ 2364{
2372 struct e1000_adapter *adapter = netdev->priv; 2365 struct e1000_adapter *adapter = netdev_priv(netdev);
2373 2366
2374 e1000_update_stats(adapter); 2367 e1000_update_stats(adapter);
2375 return &adapter->net_stats; 2368 return &adapter->net_stats;
@@ -2386,7 +2379,7 @@ e1000_get_stats(struct net_device *netdev)
2386static int 2379static int
2387e1000_change_mtu(struct net_device *netdev, int new_mtu) 2380e1000_change_mtu(struct net_device *netdev, int new_mtu)
2388{ 2381{
2389 struct e1000_adapter *adapter = netdev->priv; 2382 struct e1000_adapter *adapter = netdev_priv(netdev);
2390 int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; 2383 int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
2391 2384
2392 if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || 2385 if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
@@ -2597,7 +2590,7 @@ static irqreturn_t
2597e1000_intr(int irq, void *data, struct pt_regs *regs) 2590e1000_intr(int irq, void *data, struct pt_regs *regs)
2598{ 2591{
2599 struct net_device *netdev = data; 2592 struct net_device *netdev = data;
2600 struct e1000_adapter *adapter = netdev->priv; 2593 struct e1000_adapter *adapter = netdev_priv(netdev);
2601 struct e1000_hw *hw = &adapter->hw; 2594 struct e1000_hw *hw = &adapter->hw;
2602 uint32_t icr = E1000_READ_REG(hw, ICR); 2595 uint32_t icr = E1000_READ_REG(hw, ICR);
2603#ifndef CONFIG_E1000_NAPI 2596#ifndef CONFIG_E1000_NAPI
@@ -2660,7 +2653,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
2660static int 2653static int
2661e1000_clean(struct net_device *netdev, int *budget) 2654e1000_clean(struct net_device *netdev, int *budget)
2662{ 2655{
2663 struct e1000_adapter *adapter = netdev->priv; 2656 struct e1000_adapter *adapter = netdev_priv(netdev);
2664 int work_to_do = min(*budget, netdev->quota); 2657 int work_to_do = min(*budget, netdev->quota);
2665 int tx_cleaned; 2658 int tx_cleaned;
2666 int work_done = 0; 2659 int work_done = 0;
@@ -2671,8 +2664,8 @@ e1000_clean(struct net_device *netdev, int *budget)
2671 *budget -= work_done; 2664 *budget -= work_done;
2672 netdev->quota -= work_done; 2665 netdev->quota -= work_done;
2673 2666
2674 /* If no Tx and no Rx work done, exit the polling mode */
2675 if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 2667 if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) {
2668 /* If no Tx and not enough Rx work done, exit the polling mode */
2676 netif_rx_complete(netdev); 2669 netif_rx_complete(netdev);
2677 e1000_irq_enable(adapter); 2670 e1000_irq_enable(adapter);
2678 return 0; 2671 return 0;
@@ -2768,13 +2761,13 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
2768 i = tx_ring->next_to_clean; 2761 i = tx_ring->next_to_clean;
2769 eop = tx_ring->buffer_info[i].next_to_watch; 2762 eop = tx_ring->buffer_info[i].next_to_watch;
2770 eop_desc = E1000_TX_DESC(*tx_ring, eop); 2763 eop_desc = E1000_TX_DESC(*tx_ring, eop);
2771 DPRINTK(TX_ERR, ERR, "Detected Tx Unit Hang\n" 2764 DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
2772 " TDH <%x>\n" 2765 " TDH <%x>\n"
2773 " TDT <%x>\n" 2766 " TDT <%x>\n"
2774 " next_to_use <%x>\n" 2767 " next_to_use <%x>\n"
2775 " next_to_clean <%x>\n" 2768 " next_to_clean <%x>\n"
2776 "buffer_info[next_to_clean]\n" 2769 "buffer_info[next_to_clean]\n"
2777 " dma <%llx>\n" 2770 " dma <%zx>\n"
2778 " time_stamp <%lx>\n" 2771 " time_stamp <%lx>\n"
2779 " next_to_watch <%x>\n" 2772 " next_to_watch <%x>\n"
2780 " jiffies <%lx>\n" 2773 " jiffies <%lx>\n"
@@ -2993,7 +2986,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter)
2993 2986
2994 i = rx_ring->next_to_clean; 2987 i = rx_ring->next_to_clean;
2995 rx_desc = E1000_RX_DESC_PS(*rx_ring, i); 2988 rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
2996 staterr = rx_desc->wb.middle.status_error; 2989 staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
2997 2990
2998 while(staterr & E1000_RXD_STAT_DD) { 2991 while(staterr & E1000_RXD_STAT_DD) {
2999 buffer_info = &rx_ring->buffer_info[i]; 2992 buffer_info = &rx_ring->buffer_info[i];
@@ -3064,16 +3057,16 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter)
3064#ifdef CONFIG_E1000_NAPI 3057#ifdef CONFIG_E1000_NAPI
3065 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { 3058 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
3066 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 3059 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
3067 le16_to_cpu(rx_desc->wb.middle.vlan & 3060 le16_to_cpu(rx_desc->wb.middle.vlan) &
3068 E1000_RXD_SPC_VLAN_MASK)); 3061 E1000_RXD_SPC_VLAN_MASK);
3069 } else { 3062 } else {
3070 netif_receive_skb(skb); 3063 netif_receive_skb(skb);
3071 } 3064 }
3072#else /* CONFIG_E1000_NAPI */ 3065#else /* CONFIG_E1000_NAPI */
3073 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { 3066 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
3074 vlan_hwaccel_rx(skb, adapter->vlgrp, 3067 vlan_hwaccel_rx(skb, adapter->vlgrp,
3075 le16_to_cpu(rx_desc->wb.middle.vlan & 3068 le16_to_cpu(rx_desc->wb.middle.vlan) &
3076 E1000_RXD_SPC_VLAN_MASK)); 3069 E1000_RXD_SPC_VLAN_MASK);
3077 } else { 3070 } else {
3078 netif_rx(skb); 3071 netif_rx(skb);
3079 } 3072 }
@@ -3086,7 +3079,7 @@ next_desc:
3086 if(unlikely(++i == rx_ring->count)) i = 0; 3079 if(unlikely(++i == rx_ring->count)) i = 0;
3087 3080
3088 rx_desc = E1000_RX_DESC_PS(*rx_ring, i); 3081 rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
3089 staterr = rx_desc->wb.middle.status_error; 3082 staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
3090 } 3083 }
3091 rx_ring->next_to_clean = i; 3084 rx_ring->next_to_clean = i;
3092 adapter->alloc_rx_buf(adapter); 3085 adapter->alloc_rx_buf(adapter);
@@ -3370,11 +3363,12 @@ e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3370static int 3363static int
3371e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 3364e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3372{ 3365{
3373 struct e1000_adapter *adapter = netdev->priv; 3366 struct e1000_adapter *adapter = netdev_priv(netdev);
3374 struct mii_ioctl_data *data = if_mii(ifr); 3367 struct mii_ioctl_data *data = if_mii(ifr);
3375 int retval; 3368 int retval;
3376 uint16_t mii_reg; 3369 uint16_t mii_reg;
3377 uint16_t spddplx; 3370 uint16_t spddplx;
3371 unsigned long flags;
3378 3372
3379 if(adapter->hw.media_type != e1000_media_type_copper) 3373 if(adapter->hw.media_type != e1000_media_type_copper)
3380 return -EOPNOTSUPP; 3374 return -EOPNOTSUPP;
@@ -3384,22 +3378,29 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3384 data->phy_id = adapter->hw.phy_addr; 3378 data->phy_id = adapter->hw.phy_addr;
3385 break; 3379 break;
3386 case SIOCGMIIREG: 3380 case SIOCGMIIREG:
3387 if (!capable(CAP_NET_ADMIN)) 3381 if(!capable(CAP_NET_ADMIN))
3388 return -EPERM; 3382 return -EPERM;
3389 if (e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, 3383 spin_lock_irqsave(&adapter->stats_lock, flags);
3390 &data->val_out)) 3384 if(e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
3385 &data->val_out)) {
3386 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3391 return -EIO; 3387 return -EIO;
3388 }
3389 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3392 break; 3390 break;
3393 case SIOCSMIIREG: 3391 case SIOCSMIIREG:
3394 if (!capable(CAP_NET_ADMIN)) 3392 if(!capable(CAP_NET_ADMIN))
3395 return -EPERM; 3393 return -EPERM;
3396 if (data->reg_num & ~(0x1F)) 3394 if(data->reg_num & ~(0x1F))
3397 return -EFAULT; 3395 return -EFAULT;
3398 mii_reg = data->val_in; 3396 mii_reg = data->val_in;
3399 if (e1000_write_phy_reg(&adapter->hw, data->reg_num, 3397 spin_lock_irqsave(&adapter->stats_lock, flags);
3400 mii_reg)) 3398 if(e1000_write_phy_reg(&adapter->hw, data->reg_num,
3399 mii_reg)) {
3400 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3401 return -EIO; 3401 return -EIO;
3402 if (adapter->hw.phy_type == e1000_phy_m88) { 3402 }
3403 if(adapter->hw.phy_type == e1000_phy_m88) {
3403 switch (data->reg_num) { 3404 switch (data->reg_num) {
3404 case PHY_CTRL: 3405 case PHY_CTRL:
3405 if(mii_reg & MII_CR_POWER_DOWN) 3406 if(mii_reg & MII_CR_POWER_DOWN)
@@ -3419,8 +3420,12 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3419 HALF_DUPLEX; 3420 HALF_DUPLEX;
3420 retval = e1000_set_spd_dplx(adapter, 3421 retval = e1000_set_spd_dplx(adapter,
3421 spddplx); 3422 spddplx);
3422 if(retval) 3423 if(retval) {
3424 spin_unlock_irqrestore(
3425 &adapter->stats_lock,
3426 flags);
3423 return retval; 3427 return retval;
3428 }
3424 } 3429 }
3425 if(netif_running(adapter->netdev)) { 3430 if(netif_running(adapter->netdev)) {
3426 e1000_down(adapter); 3431 e1000_down(adapter);
@@ -3430,8 +3435,11 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3430 break; 3435 break;
3431 case M88E1000_PHY_SPEC_CTRL: 3436 case M88E1000_PHY_SPEC_CTRL:
3432 case M88E1000_EXT_PHY_SPEC_CTRL: 3437 case M88E1000_EXT_PHY_SPEC_CTRL:
3433 if (e1000_phy_reset(&adapter->hw)) 3438 if(e1000_phy_reset(&adapter->hw)) {
3439 spin_unlock_irqrestore(
3440 &adapter->stats_lock, flags);
3434 return -EIO; 3441 return -EIO;
3442 }
3435 break; 3443 break;
3436 } 3444 }
3437 } else { 3445 } else {
@@ -3447,6 +3455,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
3447 break; 3455 break;
3448 } 3456 }
3449 } 3457 }
3458 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3450 break; 3459 break;
3451 default: 3460 default:
3452 return -EOPNOTSUPP; 3461 return -EOPNOTSUPP;
@@ -3503,7 +3512,7 @@ e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value)
3503static void 3512static void
3504e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) 3513e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
3505{ 3514{
3506 struct e1000_adapter *adapter = netdev->priv; 3515 struct e1000_adapter *adapter = netdev_priv(netdev);
3507 uint32_t ctrl, rctl; 3516 uint32_t ctrl, rctl;
3508 3517
3509 e1000_irq_disable(adapter); 3518 e1000_irq_disable(adapter);
@@ -3543,7 +3552,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
3543static void 3552static void
3544e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) 3553e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
3545{ 3554{
3546 struct e1000_adapter *adapter = netdev->priv; 3555 struct e1000_adapter *adapter = netdev_priv(netdev);
3547 uint32_t vfta, index; 3556 uint32_t vfta, index;
3548 if((adapter->hw.mng_cookie.status & 3557 if((adapter->hw.mng_cookie.status &
3549 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 3558 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
@@ -3559,7 +3568,7 @@ e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
3559static void 3568static void
3560e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) 3569e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
3561{ 3570{
3562 struct e1000_adapter *adapter = netdev->priv; 3571 struct e1000_adapter *adapter = netdev_priv(netdev);
3563 uint32_t vfta, index; 3572 uint32_t vfta, index;
3564 3573
3565 e1000_irq_disable(adapter); 3574 e1000_irq_disable(adapter);
@@ -3600,6 +3609,13 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
3600{ 3609{
3601 adapter->hw.autoneg = 0; 3610 adapter->hw.autoneg = 0;
3602 3611
3612 /* Fiber NICs only allow 1000 gbps Full duplex */
3613 if((adapter->hw.media_type == e1000_media_type_fiber) &&
3614 spddplx != (SPEED_1000 + DUPLEX_FULL)) {
3615 DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
3616 return -EINVAL;
3617 }
3618
3603 switch(spddplx) { 3619 switch(spddplx) {
3604 case SPEED_10 + DUPLEX_HALF: 3620 case SPEED_10 + DUPLEX_HALF:
3605 adapter->hw.forced_speed_duplex = e1000_10_half; 3621 adapter->hw.forced_speed_duplex = e1000_10_half;
@@ -3626,27 +3642,10 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
3626} 3642}
3627 3643
3628static int 3644static int
3629e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
3630{
3631 struct pci_dev *pdev = NULL;
3632
3633 switch(event) {
3634 case SYS_DOWN:
3635 case SYS_HALT:
3636 case SYS_POWER_OFF:
3637 while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
3638 if(pci_dev_driver(pdev) == &e1000_driver)
3639 e1000_suspend(pdev, 3);
3640 }
3641 }
3642 return NOTIFY_DONE;
3643}
3644
3645static int
3646e1000_suspend(struct pci_dev *pdev, uint32_t state) 3645e1000_suspend(struct pci_dev *pdev, uint32_t state)
3647{ 3646{
3648 struct net_device *netdev = pci_get_drvdata(pdev); 3647 struct net_device *netdev = pci_get_drvdata(pdev);
3649 struct e1000_adapter *adapter = netdev->priv; 3648 struct e1000_adapter *adapter = netdev_priv(netdev);
3650 uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm; 3649 uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm;
3651 uint32_t wufc = adapter->wol; 3650 uint32_t wufc = adapter->wol;
3652 3651
@@ -3739,12 +3738,12 @@ static int
3739e1000_resume(struct pci_dev *pdev) 3738e1000_resume(struct pci_dev *pdev)
3740{ 3739{
3741 struct net_device *netdev = pci_get_drvdata(pdev); 3740 struct net_device *netdev = pci_get_drvdata(pdev);
3742 struct e1000_adapter *adapter = netdev->priv; 3741 struct e1000_adapter *adapter = netdev_priv(netdev);
3743 uint32_t manc, ret, swsm; 3742 uint32_t manc, ret_val, swsm;
3744 3743
3745 pci_set_power_state(pdev, 0); 3744 pci_set_power_state(pdev, 0);
3746 pci_restore_state(pdev); 3745 pci_restore_state(pdev);
3747 ret = pci_enable_device(pdev); 3746 ret_val = pci_enable_device(pdev);
3748 pci_set_master(pdev); 3747 pci_set_master(pdev);
3749 3748
3750 pci_enable_wake(pdev, 3, 0); 3749 pci_enable_wake(pdev, 3, 0);
@@ -3787,9 +3786,10 @@ e1000_resume(struct pci_dev *pdev)
3787static void 3786static void
3788e1000_netpoll(struct net_device *netdev) 3787e1000_netpoll(struct net_device *netdev)
3789{ 3788{
3790 struct e1000_adapter *adapter = netdev->priv; 3789 struct e1000_adapter *adapter = netdev_priv(netdev);
3791 disable_irq(adapter->pdev->irq); 3790 disable_irq(adapter->pdev->irq);
3792 e1000_intr(adapter->pdev->irq, netdev, NULL); 3791 e1000_intr(adapter->pdev->irq, netdev, NULL);
3792 e1000_clean_tx_irq(adapter);
3793 enable_irq(adapter->pdev->irq); 3793 enable_irq(adapter->pdev->irq);
3794} 3794}
3795#endif 3795#endif
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c
index 51c9fa260830..f5a4dd7d8564 100644
--- a/drivers/net/e2100.c
+++ b/drivers/net/e2100.c
@@ -162,12 +162,7 @@ struct net_device * __init e2100_probe(int unit)
162 err = do_e2100_probe(dev); 162 err = do_e2100_probe(dev);
163 if (err) 163 if (err)
164 goto out; 164 goto out;
165 err = register_netdev(dev);
166 if (err)
167 goto out1;
168 return dev; 165 return dev;
169out1:
170 cleanup_card(dev);
171out: 166out:
172 free_netdev(dev); 167 free_netdev(dev);
173 return ERR_PTR(err); 168 return ERR_PTR(err);
@@ -286,6 +281,9 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
286#endif 281#endif
287 NS8390_init(dev, 0); 282 NS8390_init(dev, 0);
288 283
284 retval = register_netdev(dev);
285 if (retval)
286 goto out;
289 return 0; 287 return 0;
290out: 288out:
291 release_region(ioaddr, E21_IO_EXTENT); 289 release_region(ioaddr, E21_IO_EXTENT);
@@ -453,11 +451,8 @@ init_module(void)
453 dev->mem_start = mem[this_dev]; 451 dev->mem_start = mem[this_dev];
454 dev->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */ 452 dev->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */
455 if (do_e2100_probe(dev) == 0) { 453 if (do_e2100_probe(dev) == 0) {
456 if (register_netdev(dev) == 0) { 454 dev_e21[found++] = dev;
457 dev_e21[found++] = dev; 455 continue;
458 continue;
459 }
460 cleanup_card(dev);
461 } 456 }
462 free_netdev(dev); 457 free_netdev(dev);
463 printk(KERN_WARNING "e2100.c: No E2100 card found (i/o = 0x%x).\n", io[this_dev]); 458 printk(KERN_WARNING "e2100.c: No E2100 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index cd2475683027..dcb3028bb60f 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -600,12 +600,7 @@ struct net_device * __init eepro_probe(int unit)
600 err = do_eepro_probe(dev); 600 err = do_eepro_probe(dev);
601 if (err) 601 if (err)
602 goto out; 602 goto out;
603 err = register_netdev(dev);
604 if (err)
605 goto out1;
606 return dev; 603 return dev;
607out1:
608 release_region(dev->base_addr, EEPRO_IO_EXTENT);
609out: 604out:
610 free_netdev(dev); 605 free_netdev(dev);
611 return ERR_PTR(err); 606 return ERR_PTR(err);
@@ -758,6 +753,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe)
758 int i; 753 int i;
759 struct eepro_local *lp; 754 struct eepro_local *lp;
760 int ioaddr = dev->base_addr; 755 int ioaddr = dev->base_addr;
756 int err;
761 757
762 /* Grab the region so we can find another board if autoIRQ fails. */ 758 /* Grab the region so we can find another board if autoIRQ fails. */
763 if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { 759 if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) {
@@ -873,10 +869,16 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe)
873 869
874 /* reset 82595 */ 870 /* reset 82595 */
875 eepro_reset(ioaddr); 871 eepro_reset(ioaddr);
872
873 err = register_netdev(dev);
874 if (err)
875 goto err;
876 return 0; 876 return 0;
877exit: 877exit:
878 err = -ENODEV;
879err:
878 release_region(dev->base_addr, EEPRO_IO_EXTENT); 880 release_region(dev->base_addr, EEPRO_IO_EXTENT);
879 return -ENODEV; 881 return err;
880} 882}
881 883
882/* Open/initialize the board. This is called (in the current kernel) 884/* Open/initialize the board. This is called (in the current kernel)
@@ -1834,11 +1836,8 @@ init_module(void)
1834 dev->irq = irq[i]; 1836 dev->irq = irq[i];
1835 1837
1836 if (do_eepro_probe(dev) == 0) { 1838 if (do_eepro_probe(dev) == 0) {
1837 if (register_netdev(dev) == 0) { 1839 dev_eepro[n_eepro++] = dev;
1838 dev_eepro[n_eepro++] = dev; 1840 continue;
1839 continue;
1840 }
1841 release_region(dev->base_addr, EEPRO_IO_EXTENT);
1842 } 1841 }
1843 free_netdev(dev); 1842 free_netdev(dev);
1844 break; 1843 break;
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 98b3a2fdce90..1795425f512e 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -1269,7 +1269,7 @@ speedo_init_rx_ring(struct net_device *dev)
1269 if (skb == NULL) 1269 if (skb == NULL)
1270 break; /* OK. Just initially short of Rx bufs. */ 1270 break; /* OK. Just initially short of Rx bufs. */
1271 skb->dev = dev; /* Mark as being used by this device. */ 1271 skb->dev = dev; /* Mark as being used by this device. */
1272 rxf = (struct RxFD *)skb->tail; 1272 rxf = (struct RxFD *)skb->data;
1273 sp->rx_ringp[i] = rxf; 1273 sp->rx_ringp[i] = rxf;
1274 sp->rx_ring_dma[i] = 1274 sp->rx_ring_dma[i] =
1275 pci_map_single(sp->pdev, rxf, 1275 pci_map_single(sp->pdev, rxf,
@@ -1661,7 +1661,7 @@ static inline struct RxFD *speedo_rx_alloc(struct net_device *dev, int entry)
1661 sp->rx_ringp[entry] = NULL; 1661 sp->rx_ringp[entry] = NULL;
1662 return NULL; 1662 return NULL;
1663 } 1663 }
1664 rxf = sp->rx_ringp[entry] = (struct RxFD *)skb->tail; 1664 rxf = sp->rx_ringp[entry] = (struct RxFD *)skb->data;
1665 sp->rx_ring_dma[entry] = 1665 sp->rx_ring_dma[entry] =
1666 pci_map_single(sp->pdev, rxf, 1666 pci_map_single(sp->pdev, rxf,
1667 PKT_BUF_SZ + sizeof(struct RxFD), PCI_DMA_FROMDEVICE); 1667 PKT_BUF_SZ + sizeof(struct RxFD), PCI_DMA_FROMDEVICE);
@@ -1808,10 +1808,10 @@ speedo_rx(struct net_device *dev)
1808 1808
1809#if 1 || USE_IP_CSUM 1809#if 1 || USE_IP_CSUM
1810 /* Packet is in one chunk -- we can copy + cksum. */ 1810 /* Packet is in one chunk -- we can copy + cksum. */
1811 eth_copy_and_sum(skb, sp->rx_skbuff[entry]->tail, pkt_len, 0); 1811 eth_copy_and_sum(skb, sp->rx_skbuff[entry]->data, pkt_len, 0);
1812 skb_put(skb, pkt_len); 1812 skb_put(skb, pkt_len);
1813#else 1813#else
1814 memcpy(skb_put(skb, pkt_len), sp->rx_skbuff[entry]->tail, 1814 memcpy(skb_put(skb, pkt_len), sp->rx_skbuff[entry]->data,
1815 pkt_len); 1815 pkt_len);
1816#endif 1816#endif
1817 pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry], 1817 pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry],
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index fc8e7947b334..82bd356e4f3a 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -436,11 +436,8 @@ struct net_device * __init express_probe(int unit)
436 netdev_boot_setup_check(dev); 436 netdev_boot_setup_check(dev);
437 437
438 err = do_express_probe(dev); 438 err = do_express_probe(dev);
439 if (!err) { 439 if (!err)
440 err = register_netdev(dev); 440 return dev;
441 if (!err)
442 return dev;
443 }
444 free_netdev(dev); 441 free_netdev(dev);
445 return ERR_PTR(err); 442 return ERR_PTR(err);
446} 443}
@@ -1205,7 +1202,8 @@ static int __init eexp_hw_probe(struct net_device *dev, unsigned short ioaddr)
1205 dev->set_multicast_list = &eexp_set_multicast; 1202 dev->set_multicast_list = &eexp_set_multicast;
1206 dev->tx_timeout = eexp_timeout; 1203 dev->tx_timeout = eexp_timeout;
1207 dev->watchdog_timeo = 2*HZ; 1204 dev->watchdog_timeo = 2*HZ;
1208 return 0; 1205
1206 return register_netdev(dev);
1209} 1207}
1210 1208
1211/* 1209/*
@@ -1716,7 +1714,7 @@ int init_module(void)
1716 break; 1714 break;
1717 printk(KERN_NOTICE "eexpress.c: Module autoprobe not recommended, give io=xx.\n"); 1715 printk(KERN_NOTICE "eexpress.c: Module autoprobe not recommended, give io=xx.\n");
1718 } 1716 }
1719 if (do_express_probe(dev) == 0 && register_netdev(dev) == 0) { 1717 if (do_express_probe(dev) == 0) {
1720 dev_eexp[this_dev] = dev; 1718 dev_eexp[this_dev] = dev;
1721 found++; 1719 found++;
1722 continue; 1720 continue;
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 81ebaedaa240..87f522738bfc 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1003,7 +1003,7 @@ static void epic_init_ring(struct net_device *dev)
1003 skb->dev = dev; /* Mark as being used by this device. */ 1003 skb->dev = dev; /* Mark as being used by this device. */
1004 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1004 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1005 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, 1005 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev,
1006 skb->tail, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 1006 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
1007 ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); 1007 ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn);
1008 } 1008 }
1009 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 1009 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1274,7 +1274,7 @@ static int epic_rx(struct net_device *dev, int budget)
1274 ep->rx_ring[entry].bufaddr, 1274 ep->rx_ring[entry].bufaddr,
1275 ep->rx_buf_sz, 1275 ep->rx_buf_sz,
1276 PCI_DMA_FROMDEVICE); 1276 PCI_DMA_FROMDEVICE);
1277 eth_copy_and_sum(skb, ep->rx_skbuff[entry]->tail, pkt_len, 0); 1277 eth_copy_and_sum(skb, ep->rx_skbuff[entry]->data, pkt_len, 0);
1278 skb_put(skb, pkt_len); 1278 skb_put(skb, pkt_len);
1279 pci_dma_sync_single_for_device(ep->pci_dev, 1279 pci_dma_sync_single_for_device(ep->pci_dev,
1280 ep->rx_ring[entry].bufaddr, 1280 ep->rx_ring[entry].bufaddr,
@@ -1308,7 +1308,7 @@ static int epic_rx(struct net_device *dev, int budget)
1308 skb->dev = dev; /* Mark as being used by this device. */ 1308 skb->dev = dev; /* Mark as being used by this device. */
1309 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1309 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1310 ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, 1310 ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev,
1311 skb->tail, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 1311 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
1312 work_done++; 1312 work_done++;
1313 } 1313 }
1314 ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); 1314 ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn);
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index dd6865820372..aa1569182fd6 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -132,7 +132,7 @@ static struct net_device_stats *eql_get_stats(struct net_device *dev);
132#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) 132#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE)
133#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) 133#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER)
134 134
135static void eql_kill_one_slave(slave_t *slave); 135static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave);
136 136
137static void eql_timer(unsigned long param) 137static void eql_timer(unsigned long param)
138{ 138{
@@ -149,7 +149,7 @@ static void eql_timer(unsigned long param)
149 if (slave->bytes_queued < 0) 149 if (slave->bytes_queued < 0)
150 slave->bytes_queued = 0; 150 slave->bytes_queued = 0;
151 } else { 151 } else {
152 eql_kill_one_slave(slave); 152 eql_kill_one_slave(&eql->queue, slave);
153 } 153 }
154 154
155 } 155 }
@@ -214,9 +214,10 @@ static int eql_open(struct net_device *dev)
214 return 0; 214 return 0;
215} 215}
216 216
217static void eql_kill_one_slave(slave_t *slave) 217static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave)
218{ 218{
219 list_del(&slave->list); 219 list_del(&slave->list);
220 queue->num_slaves--;
220 slave->dev->flags &= ~IFF_SLAVE; 221 slave->dev->flags &= ~IFF_SLAVE;
221 dev_put(slave->dev); 222 dev_put(slave->dev);
222 kfree(slave); 223 kfree(slave);
@@ -232,8 +233,7 @@ static void eql_kill_slave_queue(slave_queue_t *queue)
232 list_for_each_safe(this, tmp, head) { 233 list_for_each_safe(this, tmp, head) {
233 slave_t *s = list_entry(this, slave_t, list); 234 slave_t *s = list_entry(this, slave_t, list);
234 235
235 eql_kill_one_slave(s); 236 eql_kill_one_slave(queue, s);
236 queue->num_slaves--;
237 } 237 }
238 238
239 spin_unlock_bh(&queue->lock); 239 spin_unlock_bh(&queue->lock);
@@ -318,7 +318,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue)
318 } 318 }
319 } else { 319 } else {
320 /* We found a dead slave, kill it. */ 320 /* We found a dead slave, kill it. */
321 eql_kill_one_slave(slave); 321 eql_kill_one_slave(queue, slave);
322 } 322 }
323 } 323 }
324 return best_slave; 324 return best_slave;
@@ -393,7 +393,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
393 393
394 duplicate_slave = __eql_find_slave_dev(queue, slave->dev); 394 duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
395 if (duplicate_slave != 0) 395 if (duplicate_slave != 0)
396 eql_kill_one_slave(duplicate_slave); 396 eql_kill_one_slave(queue, duplicate_slave);
397 397
398 list_add(&slave->list, &queue->all_slaves); 398 list_add(&slave->list, &queue->all_slaves);
399 queue->num_slaves++; 399 queue->num_slaves++;
@@ -471,7 +471,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use
471 slave_dev); 471 slave_dev);
472 472
473 if (slave) { 473 if (slave) {
474 eql_kill_one_slave(slave); 474 eql_kill_one_slave(&eql->queue, slave);
475 ret = 0; 475 ret = 0;
476 } 476 }
477 } 477 }
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c
index f1e8150ed2a0..50f8e23bb9e5 100644
--- a/drivers/net/es3210.c
+++ b/drivers/net/es3210.c
@@ -177,12 +177,7 @@ struct net_device * __init es_probe(int unit)
177 err = do_es_probe(dev); 177 err = do_es_probe(dev);
178 if (err) 178 if (err)
179 goto out; 179 goto out;
180 err = register_netdev(dev);
181 if (err)
182 goto out1;
183 return dev; 180 return dev;
184out1:
185 cleanup_card(dev);
186out: 181out:
187 free_netdev(dev); 182 free_netdev(dev);
188 return ERR_PTR(err); 183 return ERR_PTR(err);
@@ -310,6 +305,10 @@ static int __init es_probe1(struct net_device *dev, int ioaddr)
310 dev->poll_controller = ei_poll; 305 dev->poll_controller = ei_poll;
311#endif 306#endif
312 NS8390_init(dev, 0); 307 NS8390_init(dev, 0);
308
309 retval = register_netdev(dev);
310 if (retval)
311 goto out1;
313 return 0; 312 return 0;
314out1: 313out1:
315 free_irq(dev->irq, dev); 314 free_irq(dev->irq, dev);
@@ -445,11 +444,8 @@ init_module(void)
445 dev->base_addr = io[this_dev]; 444 dev->base_addr = io[this_dev];
446 dev->mem_start = mem[this_dev]; 445 dev->mem_start = mem[this_dev];
447 if (do_es_probe(dev) == 0) { 446 if (do_es_probe(dev) == 0) {
448 if (register_netdev(dev) == 0) { 447 dev_es3210[found++] = dev;
449 dev_es3210[found++] = dev; 448 continue;
450 continue;
451 }
452 cleanup_card(dev);
453 } 449 }
454 free_netdev(dev); 450 free_netdev(dev);
455 printk(KERN_WARNING "es3210.c: No es3210 card found (i/o = 0x%x).\n", io[this_dev]); 451 printk(KERN_WARNING "es3210.c: No es3210 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index ccae6ba5f7c5..f32a6b3acb2a 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -473,13 +473,7 @@ struct net_device * __init eth16i_probe(int unit)
473 err = do_eth16i_probe(dev); 473 err = do_eth16i_probe(dev);
474 if (err) 474 if (err)
475 goto out; 475 goto out;
476 err = register_netdev(dev);
477 if (err)
478 goto out1;
479 return dev; 476 return dev;
480out1:
481 free_irq(dev->irq, dev);
482 release_region(dev->base_addr, ETH16I_IO_EXTENT);
483out: 477out:
484 free_netdev(dev); 478 free_netdev(dev);
485 return ERR_PTR(err); 479 return ERR_PTR(err);
@@ -569,7 +563,13 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
569 dev->tx_timeout = eth16i_timeout; 563 dev->tx_timeout = eth16i_timeout;
570 dev->watchdog_timeo = TX_TIMEOUT; 564 dev->watchdog_timeo = TX_TIMEOUT;
571 spin_lock_init(&lp->lock); 565 spin_lock_init(&lp->lock);
566
567 retval = register_netdev(dev);
568 if (retval)
569 goto out1;
572 return 0; 570 return 0;
571out1:
572 free_irq(dev->irq, dev);
573out: 573out:
574 release_region(ioaddr, ETH16I_IO_EXTENT); 574 release_region(ioaddr, ETH16I_IO_EXTENT);
575 return retval; 575 return retval;
@@ -1462,12 +1462,8 @@ int init_module(void)
1462 } 1462 }
1463 1463
1464 if (do_eth16i_probe(dev) == 0) { 1464 if (do_eth16i_probe(dev) == 0) {
1465 if (register_netdev(dev) == 0) { 1465 dev_eth16i[found++] = dev;
1466 dev_eth16i[found++] = dev; 1466 continue;
1467 continue;
1468 }
1469 free_irq(dev->irq, dev);
1470 release_region(dev->base_addr, ETH16I_IO_EXTENT);
1471 } 1467 }
1472 printk(KERN_WARNING "eth16i.c No Eth16i card found (i/o = 0x%x).\n", 1468 printk(KERN_WARNING "eth16i.c No Eth16i card found (i/o = 0x%x).\n",
1473 io[this_dev]); 1469 io[this_dev]);
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index dcf969b20be9..b987f9474730 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -1308,15 +1308,9 @@ static int __init eisa_probe(struct net_device *dev, u_long ioaddr)
1308 if (ioaddr < 0x1000) 1308 if (ioaddr < 0x1000)
1309 goto out; 1309 goto out;
1310 1310
1311 if (ioaddr == 0) { /* Autoprobing */ 1311 iobase = ioaddr;
1312 iobase = EISA_SLOT_INC; /* Get the first slot address */ 1312 i = (ioaddr >> 12);
1313 i = 1; 1313 maxSlots = i + 1;
1314 maxSlots = MAX_EISA_SLOTS;
1315 } else { /* Probe a specific location */
1316 iobase = ioaddr;
1317 i = (ioaddr >> 12);
1318 maxSlots = i + 1;
1319 }
1320 1314
1321 for (i = 1; (i < maxSlots) && (dev != NULL); i++, iobase += EISA_SLOT_INC) { 1315 for (i = 1; (i < maxSlots) && (dev != NULL); i++, iobase += EISA_SLOT_INC) {
1322 if (EISA_signature(name, EISA_ID) == 0) { 1316 if (EISA_signature(name, EISA_ID) == 0) {
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index d05e9dd1e140..55dbe9a3fd56 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -1107,7 +1107,7 @@ static void allocate_rx_buffers(struct net_device *dev)
1107 1107
1108 skb->dev = dev; /* Mark as being used by this device. */ 1108 skb->dev = dev; /* Mark as being used by this device. */
1109 np->lack_rxbuf->skbuff = skb; 1109 np->lack_rxbuf->skbuff = skb;
1110 np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->tail, 1110 np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->data,
1111 np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1111 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1112 np->lack_rxbuf->status = RXOWN; 1112 np->lack_rxbuf->status = RXOWN;
1113 ++np->really_rx_count; 1113 ++np->really_rx_count;
@@ -1300,7 +1300,7 @@ static void init_ring(struct net_device *dev)
1300 ++np->really_rx_count; 1300 ++np->really_rx_count;
1301 np->rx_ring[i].skbuff = skb; 1301 np->rx_ring[i].skbuff = skb;
1302 skb->dev = dev; /* Mark as being used by this device. */ 1302 skb->dev = dev; /* Mark as being used by this device. */
1303 np->rx_ring[i].buffer = pci_map_single(np->pci_dev, skb->tail, 1303 np->rx_ring[i].buffer = pci_map_single(np->pci_dev, skb->data,
1304 np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1304 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1305 np->rx_ring[i].status = RXOWN; 1305 np->rx_ring[i].status = RXOWN;
1306 np->rx_ring[i].control |= RXIC; 1306 np->rx_ring[i].control |= RXIC;
@@ -1423,8 +1423,7 @@ static void reset_tx_descriptors(struct net_device *dev)
1423 if (cur->skbuff) { 1423 if (cur->skbuff) {
1424 pci_unmap_single(np->pci_dev, cur->buffer, 1424 pci_unmap_single(np->pci_dev, cur->buffer,
1425 cur->skbuff->len, PCI_DMA_TODEVICE); 1425 cur->skbuff->len, PCI_DMA_TODEVICE);
1426 dev_kfree_skb(cur->skbuff); 1426 dev_kfree_skb_any(cur->skbuff);
1427 /* or dev_kfree_skb_irq(cur->skbuff); ? */
1428 cur->skbuff = NULL; 1427 cur->skbuff = NULL;
1429 } 1428 }
1430 cur->status = 0; 1429 cur->status = 0;
@@ -1738,11 +1737,11 @@ static int netdev_rx(struct net_device *dev)
1738 1737
1739#if ! defined(__alpha__) 1738#if ! defined(__alpha__)
1740 eth_copy_and_sum(skb, 1739 eth_copy_and_sum(skb,
1741 np->cur_rx->skbuff->tail, pkt_len, 0); 1740 np->cur_rx->skbuff->data, pkt_len, 0);
1742 skb_put(skb, pkt_len); 1741 skb_put(skb, pkt_len);
1743#else 1742#else
1744 memcpy(skb_put(skb, pkt_len), 1743 memcpy(skb_put(skb, pkt_len),
1745 np->cur_rx->skbuff->tail, pkt_len); 1744 np->cur_rx->skbuff->data, pkt_len);
1746#endif 1745#endif
1747 pci_dma_sync_single_for_device(np->pci_dev, 1746 pci_dma_sync_single_for_device(np->pci_dev,
1748 np->cur_rx->buffer, 1747 np->cur_rx->buffer,
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 4ebcd052e150..64f0f697c958 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -82,6 +82,9 @@
82 * 0.31: 14 Nov 2004: ethtool support for getting/setting link 82 * 0.31: 14 Nov 2004: ethtool support for getting/setting link
83 * capabilities. 83 * capabilities.
84 * 0.32: 16 Apr 2005: RX_ERROR4 handling added. 84 * 0.32: 16 Apr 2005: RX_ERROR4 handling added.
85 * 0.33: 16 May 2005: Support for MCP51 added.
86 * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics.
87 * 0.35: 26 Jun 2005: Support for MCP55 added.
85 * 88 *
86 * Known bugs: 89 * Known bugs:
87 * We suspect that on some hardware no TX done interrupts are generated. 90 * We suspect that on some hardware no TX done interrupts are generated.
@@ -93,7 +96,7 @@
93 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few 96 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
94 * superfluous timer interrupts from the nic. 97 * superfluous timer interrupts from the nic.
95 */ 98 */
96#define FORCEDETH_VERSION "0.32" 99#define FORCEDETH_VERSION "0.35"
97#define DRV_NAME "forcedeth" 100#define DRV_NAME "forcedeth"
98 101
99#include <linux/module.h> 102#include <linux/module.h>
@@ -2005,7 +2008,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
2005 /* handle different descriptor versions */ 2008 /* handle different descriptor versions */
2006 if (pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_1 || 2009 if (pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_1 ||
2007 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_2 || 2010 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_2 ||
2008 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_3) 2011 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_3 ||
2012 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 ||
2013 pci_dev->device == PCI_DEVICE_ID_NVIDIA_NVENET_13)
2009 np->desc_ver = DESC_VER_1; 2014 np->desc_ver = DESC_VER_1;
2010 else 2015 else
2011 np->desc_ver = DESC_VER_2; 2016 np->desc_ver = DESC_VER_2;
@@ -2215,56 +2220,84 @@ static struct pci_device_id pci_tbl[] = {
2215 .device = PCI_DEVICE_ID_NVIDIA_NVENET_4, 2220 .device = PCI_DEVICE_ID_NVIDIA_NVENET_4,
2216 .subvendor = PCI_ANY_ID, 2221 .subvendor = PCI_ANY_ID,
2217 .subdevice = PCI_ANY_ID, 2222 .subdevice = PCI_ANY_ID,
2218 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2223 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2219 }, 2224 },
2220 { /* nForce3 Ethernet Controller */ 2225 { /* nForce3 Ethernet Controller */
2221 .vendor = PCI_VENDOR_ID_NVIDIA, 2226 .vendor = PCI_VENDOR_ID_NVIDIA,
2222 .device = PCI_DEVICE_ID_NVIDIA_NVENET_5, 2227 .device = PCI_DEVICE_ID_NVIDIA_NVENET_5,
2223 .subvendor = PCI_ANY_ID, 2228 .subvendor = PCI_ANY_ID,
2224 .subdevice = PCI_ANY_ID, 2229 .subdevice = PCI_ANY_ID,
2225 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2230 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2226 }, 2231 },
2227 { /* nForce3 Ethernet Controller */ 2232 { /* nForce3 Ethernet Controller */
2228 .vendor = PCI_VENDOR_ID_NVIDIA, 2233 .vendor = PCI_VENDOR_ID_NVIDIA,
2229 .device = PCI_DEVICE_ID_NVIDIA_NVENET_6, 2234 .device = PCI_DEVICE_ID_NVIDIA_NVENET_6,
2230 .subvendor = PCI_ANY_ID, 2235 .subvendor = PCI_ANY_ID,
2231 .subdevice = PCI_ANY_ID, 2236 .subdevice = PCI_ANY_ID,
2232 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2237 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2233 }, 2238 },
2234 { /* nForce3 Ethernet Controller */ 2239 { /* nForce3 Ethernet Controller */
2235 .vendor = PCI_VENDOR_ID_NVIDIA, 2240 .vendor = PCI_VENDOR_ID_NVIDIA,
2236 .device = PCI_DEVICE_ID_NVIDIA_NVENET_7, 2241 .device = PCI_DEVICE_ID_NVIDIA_NVENET_7,
2237 .subvendor = PCI_ANY_ID, 2242 .subvendor = PCI_ANY_ID,
2238 .subdevice = PCI_ANY_ID, 2243 .subdevice = PCI_ANY_ID,
2239 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2244 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2240 }, 2245 },
2241 { /* CK804 Ethernet Controller */ 2246 { /* CK804 Ethernet Controller */
2242 .vendor = PCI_VENDOR_ID_NVIDIA, 2247 .vendor = PCI_VENDOR_ID_NVIDIA,
2243 .device = PCI_DEVICE_ID_NVIDIA_NVENET_8, 2248 .device = PCI_DEVICE_ID_NVIDIA_NVENET_8,
2244 .subvendor = PCI_ANY_ID, 2249 .subvendor = PCI_ANY_ID,
2245 .subdevice = PCI_ANY_ID, 2250 .subdevice = PCI_ANY_ID,
2246 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2251 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2247 }, 2252 },
2248 { /* CK804 Ethernet Controller */ 2253 { /* CK804 Ethernet Controller */
2249 .vendor = PCI_VENDOR_ID_NVIDIA, 2254 .vendor = PCI_VENDOR_ID_NVIDIA,
2250 .device = PCI_DEVICE_ID_NVIDIA_NVENET_9, 2255 .device = PCI_DEVICE_ID_NVIDIA_NVENET_9,
2251 .subvendor = PCI_ANY_ID, 2256 .subvendor = PCI_ANY_ID,
2252 .subdevice = PCI_ANY_ID, 2257 .subdevice = PCI_ANY_ID,
2253 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2258 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2254 }, 2259 },
2255 { /* MCP04 Ethernet Controller */ 2260 { /* MCP04 Ethernet Controller */
2256 .vendor = PCI_VENDOR_ID_NVIDIA, 2261 .vendor = PCI_VENDOR_ID_NVIDIA,
2257 .device = PCI_DEVICE_ID_NVIDIA_NVENET_10, 2262 .device = PCI_DEVICE_ID_NVIDIA_NVENET_10,
2258 .subvendor = PCI_ANY_ID, 2263 .subvendor = PCI_ANY_ID,
2259 .subdevice = PCI_ANY_ID, 2264 .subdevice = PCI_ANY_ID,
2260 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2265 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2261 }, 2266 },
2262 { /* MCP04 Ethernet Controller */ 2267 { /* MCP04 Ethernet Controller */
2263 .vendor = PCI_VENDOR_ID_NVIDIA, 2268 .vendor = PCI_VENDOR_ID_NVIDIA,
2264 .device = PCI_DEVICE_ID_NVIDIA_NVENET_11, 2269 .device = PCI_DEVICE_ID_NVIDIA_NVENET_11,
2265 .subvendor = PCI_ANY_ID, 2270 .subvendor = PCI_ANY_ID,
2266 .subdevice = PCI_ANY_ID, 2271 .subdevice = PCI_ANY_ID,
2267 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ, 2272 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2273 },
2274 { /* MCP51 Ethernet Controller */
2275 .vendor = PCI_VENDOR_ID_NVIDIA,
2276 .device = PCI_DEVICE_ID_NVIDIA_NVENET_12,
2277 .subvendor = PCI_ANY_ID,
2278 .subdevice = PCI_ANY_ID,
2279 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2280 },
2281 { /* MCP51 Ethernet Controller */
2282 .vendor = PCI_VENDOR_ID_NVIDIA,
2283 .device = PCI_DEVICE_ID_NVIDIA_NVENET_13,
2284 .subvendor = PCI_ANY_ID,
2285 .subdevice = PCI_ANY_ID,
2286 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2287 },
2288 { /* MCP55 Ethernet Controller */
2289 .vendor = PCI_VENDOR_ID_NVIDIA,
2290 .device = PCI_DEVICE_ID_NVIDIA_NVENET_14,
2291 .subvendor = PCI_ANY_ID,
2292 .subdevice = PCI_ANY_ID,
2293 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2294 },
2295 { /* MCP55 Ethernet Controller */
2296 .vendor = PCI_VENDOR_ID_NVIDIA,
2297 .device = PCI_DEVICE_ID_NVIDIA_NVENET_15,
2298 .subvendor = PCI_ANY_ID,
2299 .subdevice = PCI_ANY_ID,
2300 .driver_data = DEV_NEED_LASTPACKET1|DEV_IRQMASK_2|DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER,
2268 }, 2301 },
2269 {0,}, 2302 {0,},
2270}; 2303};
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index b43b2b11aacd..6518334b9280 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * drivers/net/gianfar.c 2 * drivers/net/gianfar.c
3 * 3 *
4 * Gianfar Ethernet Driver 4 * Gianfar Ethernet Driver
@@ -22,10 +22,9 @@
22 * B-V +1.62 22 * B-V +1.62
23 * 23 *
24 * Theory of operation 24 * Theory of operation
25 * This driver is designed for the Triple-speed Ethernet 25 * This driver is designed for the non-CPM ethernet controllers
26 * controllers on the Freescale 8540/8560 integrated processors, 26 * on the 85xx and 83xx family of integrated processors
27 * as well as the Fast Ethernet Controller on the 8540. 27 *
28 *
29 * The driver is initialized through platform_device. Structures which 28 * The driver is initialized through platform_device. Structures which
30 * define the configuration needed by the board are defined in a 29 * define the configuration needed by the board are defined in a
31 * board structure in arch/ppc/platforms (though I do not 30 * board structure in arch/ppc/platforms (though I do not
@@ -39,12 +38,12 @@
39 * 38 *
40 * The Gianfar Ethernet Controller uses a ring of buffer 39 * The Gianfar Ethernet Controller uses a ring of buffer
41 * descriptors. The beginning is indicated by a register 40 * descriptors. The beginning is indicated by a register
42 * pointing to the physical address of the start of the ring. 41 * pointing to the physical address of the start of the ring.
43 * The end is determined by a "wrap" bit being set in the 42 * The end is determined by a "wrap" bit being set in the
44 * last descriptor of the ring. 43 * last descriptor of the ring.
45 * 44 *
46 * When a packet is received, the RXF bit in the 45 * When a packet is received, the RXF bit in the
47 * IEVENT register is set, triggering an interrupt when the 46 * IEVENT register is set, triggering an interrupt when the
48 * corresponding bit in the IMASK register is also set (if 47 * corresponding bit in the IMASK register is also set (if
49 * interrupt coalescing is active, then the interrupt may not 48 * interrupt coalescing is active, then the interrupt may not
50 * happen immediately, but will wait until either a set number 49 * happen immediately, but will wait until either a set number
@@ -52,7 +51,7 @@
52 * interrupt handler will signal there is work to be done, and 51 * interrupt handler will signal there is work to be done, and
53 * exit. Without NAPI, the packet(s) will be handled 52 * exit. Without NAPI, the packet(s) will be handled
54 * immediately. Both methods will start at the last known empty 53 * immediately. Both methods will start at the last known empty
55 * descriptor, and process every subsequent descriptor until there 54 * descriptor, and process every subsequent descriptor until there
56 * are none left with data (NAPI will stop after a set number of 55 * are none left with data (NAPI will stop after a set number of
57 * packets to give time to other tasks, but will eventually 56 * packets to give time to other tasks, but will eventually
58 * process all the packets). The data arrives inside a 57 * process all the packets). The data arrives inside a
@@ -83,9 +82,13 @@
83#include <linux/netdevice.h> 82#include <linux/netdevice.h>
84#include <linux/etherdevice.h> 83#include <linux/etherdevice.h>
85#include <linux/skbuff.h> 84#include <linux/skbuff.h>
85#include <linux/if_vlan.h>
86#include <linux/spinlock.h> 86#include <linux/spinlock.h>
87#include <linux/mm.h> 87#include <linux/mm.h>
88#include <linux/device.h> 88#include <linux/device.h>
89#include <linux/ip.h>
90#include <linux/tcp.h>
91#include <linux/udp.h>
89 92
90#include <asm/io.h> 93#include <asm/io.h>
91#include <asm/irq.h> 94#include <asm/irq.h>
@@ -123,7 +126,7 @@ static int gfar_set_mac_address(struct net_device *dev);
123static int gfar_change_mtu(struct net_device *dev, int new_mtu); 126static int gfar_change_mtu(struct net_device *dev, int new_mtu);
124static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs); 127static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs);
125static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs); 128static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs);
126irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs); 129static irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs);
127static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); 130static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs);
128static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs); 131static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
129static void gfar_phy_change(void *data); 132static void gfar_phy_change(void *data);
@@ -139,9 +142,12 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
139#ifdef CONFIG_GFAR_NAPI 142#ifdef CONFIG_GFAR_NAPI
140static int gfar_poll(struct net_device *dev, int *budget); 143static int gfar_poll(struct net_device *dev, int *budget);
141#endif 144#endif
142static int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); 145int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
143static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); 146static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length);
144static void gfar_phy_startup_timer(unsigned long data); 147static void gfar_phy_startup_timer(unsigned long data);
148static void gfar_vlan_rx_register(struct net_device *netdev,
149 struct vlan_group *grp);
150static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
145 151
146extern struct ethtool_ops gfar_ethtool_ops; 152extern struct ethtool_ops gfar_ethtool_ops;
147 153
@@ -149,6 +155,13 @@ MODULE_AUTHOR("Freescale Semiconductor, Inc");
149MODULE_DESCRIPTION("Gianfar Ethernet Driver"); 155MODULE_DESCRIPTION("Gianfar Ethernet Driver");
150MODULE_LICENSE("GPL"); 156MODULE_LICENSE("GPL");
151 157
158int gfar_uses_fcb(struct gfar_private *priv)
159{
160 if (priv->vlan_enable || priv->rx_csum_enable)
161 return 1;
162 else
163 return 0;
164}
152static int gfar_probe(struct device *device) 165static int gfar_probe(struct device *device)
153{ 166{
154 u32 tempval; 167 u32 tempval;
@@ -159,7 +172,6 @@ static int gfar_probe(struct device *device)
159 struct resource *r; 172 struct resource *r;
160 int idx; 173 int idx;
161 int err = 0; 174 int err = 0;
162 int dev_ethtool_ops = 0;
163 175
164 einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; 176 einfo = (struct gianfar_platform_data *) pdev->dev.platform_data;
165 177
@@ -265,15 +277,69 @@ static int gfar_probe(struct device *device)
265 dev->mtu = 1500; 277 dev->mtu = 1500;
266 dev->set_multicast_list = gfar_set_multi; 278 dev->set_multicast_list = gfar_set_multi;
267 279
268 /* Index into the array of possible ethtool 280 dev->ethtool_ops = &gfar_ethtool_ops;
269 * ops to catch all 4 possibilities */ 281
270 if((priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) == 0) 282 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
271 dev_ethtool_ops += 1; 283 priv->rx_csum_enable = 1;
284 dev->features |= NETIF_F_IP_CSUM;
285 } else
286 priv->rx_csum_enable = 0;
287
288 priv->vlgrp = NULL;
272 289
273 if((priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE) == 0) 290 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
274 dev_ethtool_ops += 2; 291 dev->vlan_rx_register = gfar_vlan_rx_register;
292 dev->vlan_rx_kill_vid = gfar_vlan_rx_kill_vid;
275 293
276 dev->ethtool_ops = gfar_op_array[dev_ethtool_ops]; 294 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
295
296 priv->vlan_enable = 1;
297 }
298
299 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) {
300 priv->extended_hash = 1;
301 priv->hash_width = 9;
302
303 priv->hash_regs[0] = &priv->regs->igaddr0;
304 priv->hash_regs[1] = &priv->regs->igaddr1;
305 priv->hash_regs[2] = &priv->regs->igaddr2;
306 priv->hash_regs[3] = &priv->regs->igaddr3;
307 priv->hash_regs[4] = &priv->regs->igaddr4;
308 priv->hash_regs[5] = &priv->regs->igaddr5;
309 priv->hash_regs[6] = &priv->regs->igaddr6;
310 priv->hash_regs[7] = &priv->regs->igaddr7;
311 priv->hash_regs[8] = &priv->regs->gaddr0;
312 priv->hash_regs[9] = &priv->regs->gaddr1;
313 priv->hash_regs[10] = &priv->regs->gaddr2;
314 priv->hash_regs[11] = &priv->regs->gaddr3;
315 priv->hash_regs[12] = &priv->regs->gaddr4;
316 priv->hash_regs[13] = &priv->regs->gaddr5;
317 priv->hash_regs[14] = &priv->regs->gaddr6;
318 priv->hash_regs[15] = &priv->regs->gaddr7;
319
320 } else {
321 priv->extended_hash = 0;
322 priv->hash_width = 8;
323
324 priv->hash_regs[0] = &priv->regs->gaddr0;
325 priv->hash_regs[1] = &priv->regs->gaddr1;
326 priv->hash_regs[2] = &priv->regs->gaddr2;
327 priv->hash_regs[3] = &priv->regs->gaddr3;
328 priv->hash_regs[4] = &priv->regs->gaddr4;
329 priv->hash_regs[5] = &priv->regs->gaddr5;
330 priv->hash_regs[6] = &priv->regs->gaddr6;
331 priv->hash_regs[7] = &priv->regs->gaddr7;
332 }
333
334 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_PADDING)
335 priv->padding = DEFAULT_PADDING;
336 else
337 priv->padding = 0;
338
339 dev->hard_header_len += priv->padding;
340
341 if (dev->features & NETIF_F_IP_CSUM)
342 dev->hard_header_len += GMAC_FCB_LEN;
277 343
278 priv->rx_buffer_size = DEFAULT_RX_BUFFER_SIZE; 344 priv->rx_buffer_size = DEFAULT_RX_BUFFER_SIZE;
279#ifdef CONFIG_GFAR_BUFSTASH 345#ifdef CONFIG_GFAR_BUFSTASH
@@ -289,6 +355,9 @@ static int gfar_probe(struct device *device)
289 priv->rxcount = DEFAULT_RXCOUNT; 355 priv->rxcount = DEFAULT_RXCOUNT;
290 priv->rxtime = DEFAULT_RXTIME; 356 priv->rxtime = DEFAULT_RXTIME;
291 357
358 /* Enable most messages by default */
359 priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
360
292 err = register_netdev(dev); 361 err = register_netdev(dev);
293 362
294 if (err) { 363 if (err) {
@@ -360,8 +429,9 @@ static int init_phy(struct net_device *dev)
360 GFP_KERNEL); 429 GFP_KERNEL);
361 430
362 if(NULL == mii_info) { 431 if(NULL == mii_info) {
363 printk(KERN_ERR "%s: Could not allocate mii_info\n", 432 if (netif_msg_ifup(priv))
364 dev->name); 433 printk(KERN_ERR "%s: Could not allocate mii_info\n",
434 dev->name);
365 return -ENOMEM; 435 return -ENOMEM;
366 } 436 }
367 437
@@ -410,7 +480,8 @@ static int init_phy(struct net_device *dev)
410 curphy = get_phy_info(priv->mii_info); 480 curphy = get_phy_info(priv->mii_info);
411 481
412 if (curphy == NULL) { 482 if (curphy == NULL) {
413 printk(KERN_ERR "%s: No PHY found\n", dev->name); 483 if (netif_msg_ifup(priv))
484 printk(KERN_ERR "%s: No PHY found\n", dev->name);
414 err = -1; 485 err = -1;
415 goto no_phy; 486 goto no_phy;
416 } 487 }
@@ -421,7 +492,7 @@ static int init_phy(struct net_device *dev)
421 if(curphy->init) { 492 if(curphy->init) {
422 err = curphy->init(priv->mii_info); 493 err = curphy->init(priv->mii_info);
423 494
424 if (err) 495 if (err)
425 goto phy_init_fail; 496 goto phy_init_fail;
426 } 497 }
427 498
@@ -446,14 +517,14 @@ static void init_registers(struct net_device *dev)
446 gfar_write(&priv->regs->imask, IMASK_INIT_CLEAR); 517 gfar_write(&priv->regs->imask, IMASK_INIT_CLEAR);
447 518
448 /* Init hash registers to zero */ 519 /* Init hash registers to zero */
449 gfar_write(&priv->regs->iaddr0, 0); 520 gfar_write(&priv->regs->igaddr0, 0);
450 gfar_write(&priv->regs->iaddr1, 0); 521 gfar_write(&priv->regs->igaddr1, 0);
451 gfar_write(&priv->regs->iaddr2, 0); 522 gfar_write(&priv->regs->igaddr2, 0);
452 gfar_write(&priv->regs->iaddr3, 0); 523 gfar_write(&priv->regs->igaddr3, 0);
453 gfar_write(&priv->regs->iaddr4, 0); 524 gfar_write(&priv->regs->igaddr4, 0);
454 gfar_write(&priv->regs->iaddr5, 0); 525 gfar_write(&priv->regs->igaddr5, 0);
455 gfar_write(&priv->regs->iaddr6, 0); 526 gfar_write(&priv->regs->igaddr6, 0);
456 gfar_write(&priv->regs->iaddr7, 0); 527 gfar_write(&priv->regs->igaddr7, 0);
457 528
458 gfar_write(&priv->regs->gaddr0, 0); 529 gfar_write(&priv->regs->gaddr0, 0);
459 gfar_write(&priv->regs->gaddr1, 0); 530 gfar_write(&priv->regs->gaddr1, 0);
@@ -464,9 +535,6 @@ static void init_registers(struct net_device *dev)
464 gfar_write(&priv->regs->gaddr6, 0); 535 gfar_write(&priv->regs->gaddr6, 0);
465 gfar_write(&priv->regs->gaddr7, 0); 536 gfar_write(&priv->regs->gaddr7, 0);
466 537
467 /* Zero out rctrl */
468 gfar_write(&priv->regs->rctrl, 0x00000000);
469
470 /* Zero out the rmon mib registers if it has them */ 538 /* Zero out the rmon mib registers if it has them */
471 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 539 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
472 memset((void *) &(priv->regs->rmon), 0, 540 memset((void *) &(priv->regs->rmon), 0,
@@ -497,20 +565,14 @@ static void init_registers(struct net_device *dev)
497 gfar_write(&priv->regs->tbipa, TBIPA_VALUE); 565 gfar_write(&priv->regs->tbipa, TBIPA_VALUE);
498} 566}
499 567
500void stop_gfar(struct net_device *dev) 568
569/* Halt the receive and transmit queues */
570void gfar_halt(struct net_device *dev)
501{ 571{
502 struct gfar_private *priv = netdev_priv(dev); 572 struct gfar_private *priv = netdev_priv(dev);
503 struct gfar *regs = priv->regs; 573 struct gfar *regs = priv->regs;
504 unsigned long flags;
505 u32 tempval; 574 u32 tempval;
506 575
507 /* Lock it down */
508 spin_lock_irqsave(&priv->lock, flags);
509
510 /* Tell the kernel the link is down */
511 priv->mii_info->link = 0;
512 adjust_link(dev);
513
514 /* Mask all interrupts */ 576 /* Mask all interrupts */
515 gfar_write(&regs->imask, IMASK_INIT_CLEAR); 577 gfar_write(&regs->imask, IMASK_INIT_CLEAR);
516 578
@@ -533,13 +595,29 @@ void stop_gfar(struct net_device *dev)
533 tempval = gfar_read(&regs->maccfg1); 595 tempval = gfar_read(&regs->maccfg1);
534 tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); 596 tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
535 gfar_write(&regs->maccfg1, tempval); 597 gfar_write(&regs->maccfg1, tempval);
598}
599
600void stop_gfar(struct net_device *dev)
601{
602 struct gfar_private *priv = netdev_priv(dev);
603 struct gfar *regs = priv->regs;
604 unsigned long flags;
605
606 /* Lock it down */
607 spin_lock_irqsave(&priv->lock, flags);
608
609 /* Tell the kernel the link is down */
610 priv->mii_info->link = 0;
611 adjust_link(dev);
612
613 gfar_halt(dev);
536 614
537 if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { 615 if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) {
538 /* Clear any pending interrupts */ 616 /* Clear any pending interrupts */
539 mii_clear_phy_interrupt(priv->mii_info); 617 mii_clear_phy_interrupt(priv->mii_info);
540 618
541 /* Disable PHY Interrupts */ 619 /* Disable PHY Interrupts */
542 mii_configure_phy_interrupt(priv->mii_info, 620 mii_configure_phy_interrupt(priv->mii_info,
543 MII_INTERRUPT_DISABLED); 621 MII_INTERRUPT_DISABLED);
544 } 622 }
545 623
@@ -566,7 +644,7 @@ void stop_gfar(struct net_device *dev)
566 sizeof(struct txbd8)*priv->tx_ring_size 644 sizeof(struct txbd8)*priv->tx_ring_size
567 + sizeof(struct rxbd8)*priv->rx_ring_size, 645 + sizeof(struct rxbd8)*priv->rx_ring_size,
568 priv->tx_bd_base, 646 priv->tx_bd_base,
569 gfar_read(&regs->tbase)); 647 gfar_read(&regs->tbase0));
570} 648}
571 649
572/* If there are any tx skbs or rx skbs still around, free them. 650/* If there are any tx skbs or rx skbs still around, free them.
@@ -620,6 +698,34 @@ void free_skb_resources(struct gfar_private *priv)
620 } 698 }
621} 699}
622 700
701void gfar_start(struct net_device *dev)
702{
703 struct gfar_private *priv = netdev_priv(dev);
704 struct gfar *regs = priv->regs;
705 u32 tempval;
706
707 /* Enable Rx and Tx in MACCFG1 */
708 tempval = gfar_read(&regs->maccfg1);
709 tempval |= (MACCFG1_RX_EN | MACCFG1_TX_EN);
710 gfar_write(&regs->maccfg1, tempval);
711
712 /* Initialize DMACTRL to have WWR and WOP */
713 tempval = gfar_read(&priv->regs->dmactrl);
714 tempval |= DMACTRL_INIT_SETTINGS;
715 gfar_write(&priv->regs->dmactrl, tempval);
716
717 /* Clear THLT, so that the DMA starts polling now */
718 gfar_write(&regs->tstat, TSTAT_CLEAR_THALT);
719
720 /* Make sure we aren't stopped */
721 tempval = gfar_read(&priv->regs->dmactrl);
722 tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
723 gfar_write(&priv->regs->dmactrl, tempval);
724
725 /* Unmask the interrupts we look for */
726 gfar_write(&regs->imask, IMASK_DEFAULT);
727}
728
623/* Bring the controller up and running */ 729/* Bring the controller up and running */
624int startup_gfar(struct net_device *dev) 730int startup_gfar(struct net_device *dev)
625{ 731{
@@ -630,33 +736,34 @@ int startup_gfar(struct net_device *dev)
630 int i; 736 int i;
631 struct gfar_private *priv = netdev_priv(dev); 737 struct gfar_private *priv = netdev_priv(dev);
632 struct gfar *regs = priv->regs; 738 struct gfar *regs = priv->regs;
633 u32 tempval;
634 int err = 0; 739 int err = 0;
740 u32 rctrl = 0;
635 741
636 gfar_write(&regs->imask, IMASK_INIT_CLEAR); 742 gfar_write(&regs->imask, IMASK_INIT_CLEAR);
637 743
638 /* Allocate memory for the buffer descriptors */ 744 /* Allocate memory for the buffer descriptors */
639 vaddr = (unsigned long) dma_alloc_coherent(NULL, 745 vaddr = (unsigned long) dma_alloc_coherent(NULL,
640 sizeof (struct txbd8) * priv->tx_ring_size + 746 sizeof (struct txbd8) * priv->tx_ring_size +
641 sizeof (struct rxbd8) * priv->rx_ring_size, 747 sizeof (struct rxbd8) * priv->rx_ring_size,
642 &addr, GFP_KERNEL); 748 &addr, GFP_KERNEL);
643 749
644 if (vaddr == 0) { 750 if (vaddr == 0) {
645 printk(KERN_ERR "%s: Could not allocate buffer descriptors!\n", 751 if (netif_msg_ifup(priv))
646 dev->name); 752 printk(KERN_ERR "%s: Could not allocate buffer descriptors!\n",
753 dev->name);
647 return -ENOMEM; 754 return -ENOMEM;
648 } 755 }
649 756
650 priv->tx_bd_base = (struct txbd8 *) vaddr; 757 priv->tx_bd_base = (struct txbd8 *) vaddr;
651 758
652 /* enet DMA only understands physical addresses */ 759 /* enet DMA only understands physical addresses */
653 gfar_write(&regs->tbase, addr); 760 gfar_write(&regs->tbase0, addr);
654 761
655 /* Start the rx descriptor ring where the tx ring leaves off */ 762 /* Start the rx descriptor ring where the tx ring leaves off */
656 addr = addr + sizeof (struct txbd8) * priv->tx_ring_size; 763 addr = addr + sizeof (struct txbd8) * priv->tx_ring_size;
657 vaddr = vaddr + sizeof (struct txbd8) * priv->tx_ring_size; 764 vaddr = vaddr + sizeof (struct txbd8) * priv->tx_ring_size;
658 priv->rx_bd_base = (struct rxbd8 *) vaddr; 765 priv->rx_bd_base = (struct rxbd8 *) vaddr;
659 gfar_write(&regs->rbase, addr); 766 gfar_write(&regs->rbase0, addr);
660 767
661 /* Setup the skbuff rings */ 768 /* Setup the skbuff rings */
662 priv->tx_skbuff = 769 priv->tx_skbuff =
@@ -664,8 +771,9 @@ int startup_gfar(struct net_device *dev)
664 priv->tx_ring_size, GFP_KERNEL); 771 priv->tx_ring_size, GFP_KERNEL);
665 772
666 if (priv->tx_skbuff == NULL) { 773 if (priv->tx_skbuff == NULL) {
667 printk(KERN_ERR "%s: Could not allocate tx_skbuff\n", 774 if (netif_msg_ifup(priv))
668 dev->name); 775 printk(KERN_ERR "%s: Could not allocate tx_skbuff\n",
776 dev->name);
669 err = -ENOMEM; 777 err = -ENOMEM;
670 goto tx_skb_fail; 778 goto tx_skb_fail;
671 } 779 }
@@ -678,8 +786,9 @@ int startup_gfar(struct net_device *dev)
678 priv->rx_ring_size, GFP_KERNEL); 786 priv->rx_ring_size, GFP_KERNEL);
679 787
680 if (priv->rx_skbuff == NULL) { 788 if (priv->rx_skbuff == NULL) {
681 printk(KERN_ERR "%s: Could not allocate rx_skbuff\n", 789 if (netif_msg_ifup(priv))
682 dev->name); 790 printk(KERN_ERR "%s: Could not allocate rx_skbuff\n",
791 dev->name);
683 err = -ENOMEM; 792 err = -ENOMEM;
684 goto rx_skb_fail; 793 goto rx_skb_fail;
685 } 794 }
@@ -726,12 +835,13 @@ int startup_gfar(struct net_device *dev)
726 /* If the device has multiple interrupts, register for 835 /* If the device has multiple interrupts, register for
727 * them. Otherwise, only register for the one */ 836 * them. Otherwise, only register for the one */
728 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { 837 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
729 /* Install our interrupt handlers for Error, 838 /* Install our interrupt handlers for Error,
730 * Transmit, and Receive */ 839 * Transmit, and Receive */
731 if (request_irq(priv->interruptError, gfar_error, 840 if (request_irq(priv->interruptError, gfar_error,
732 0, "enet_error", dev) < 0) { 841 0, "enet_error", dev) < 0) {
733 printk(KERN_ERR "%s: Can't get IRQ %d\n", 842 if (netif_msg_intr(priv))
734 dev->name, priv->interruptError); 843 printk(KERN_ERR "%s: Can't get IRQ %d\n",
844 dev->name, priv->interruptError);
735 845
736 err = -1; 846 err = -1;
737 goto err_irq_fail; 847 goto err_irq_fail;
@@ -739,8 +849,9 @@ int startup_gfar(struct net_device *dev)
739 849
740 if (request_irq(priv->interruptTransmit, gfar_transmit, 850 if (request_irq(priv->interruptTransmit, gfar_transmit,
741 0, "enet_tx", dev) < 0) { 851 0, "enet_tx", dev) < 0) {
742 printk(KERN_ERR "%s: Can't get IRQ %d\n", 852 if (netif_msg_intr(priv))
743 dev->name, priv->interruptTransmit); 853 printk(KERN_ERR "%s: Can't get IRQ %d\n",
854 dev->name, priv->interruptTransmit);
744 855
745 err = -1; 856 err = -1;
746 857
@@ -749,8 +860,9 @@ int startup_gfar(struct net_device *dev)
749 860
750 if (request_irq(priv->interruptReceive, gfar_receive, 861 if (request_irq(priv->interruptReceive, gfar_receive,
751 0, "enet_rx", dev) < 0) { 862 0, "enet_rx", dev) < 0) {
752 printk(KERN_ERR "%s: Can't get IRQ %d (receive0)\n", 863 if (netif_msg_intr(priv))
753 dev->name, priv->interruptReceive); 864 printk(KERN_ERR "%s: Can't get IRQ %d (receive0)\n",
865 dev->name, priv->interruptReceive);
754 866
755 err = -1; 867 err = -1;
756 goto rx_irq_fail; 868 goto rx_irq_fail;
@@ -758,8 +870,9 @@ int startup_gfar(struct net_device *dev)
758 } else { 870 } else {
759 if (request_irq(priv->interruptTransmit, gfar_interrupt, 871 if (request_irq(priv->interruptTransmit, gfar_interrupt,
760 0, "gfar_interrupt", dev) < 0) { 872 0, "gfar_interrupt", dev) < 0) {
761 printk(KERN_ERR "%s: Can't get IRQ %d\n", 873 if (netif_msg_intr(priv))
762 dev->name, priv->interruptError); 874 printk(KERN_ERR "%s: Can't get IRQ %d\n",
875 dev->name, priv->interruptError);
763 876
764 err = -1; 877 err = -1;
765 goto err_irq_fail; 878 goto err_irq_fail;
@@ -787,28 +900,22 @@ int startup_gfar(struct net_device *dev)
787 else 900 else
788 gfar_write(&regs->rxic, 0); 901 gfar_write(&regs->rxic, 0);
789 902
790 init_waitqueue_head(&priv->rxcleanupq); 903 if (priv->rx_csum_enable)
904 rctrl |= RCTRL_CHECKSUMMING;
791 905
792 /* Enable Rx and Tx in MACCFG1 */ 906 if (priv->extended_hash)
793 tempval = gfar_read(&regs->maccfg1); 907 rctrl |= RCTRL_EXTHASH;
794 tempval |= (MACCFG1_RX_EN | MACCFG1_TX_EN);
795 gfar_write(&regs->maccfg1, tempval);
796 908
797 /* Initialize DMACTRL to have WWR and WOP */ 909 if (priv->vlan_enable)
798 tempval = gfar_read(&priv->regs->dmactrl); 910 rctrl |= RCTRL_VLAN;
799 tempval |= DMACTRL_INIT_SETTINGS;
800 gfar_write(&priv->regs->dmactrl, tempval);
801 911
802 /* Clear THLT, so that the DMA starts polling now */ 912 /* Init rctrl based on our settings */
803 gfar_write(&regs->tstat, TSTAT_CLEAR_THALT); 913 gfar_write(&priv->regs->rctrl, rctrl);
804 914
805 /* Make sure we aren't stopped */ 915 if (dev->features & NETIF_F_IP_CSUM)
806 tempval = gfar_read(&priv->regs->dmactrl); 916 gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM);
807 tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
808 gfar_write(&priv->regs->dmactrl, tempval);
809 917
810 /* Unmask the interrupts we look for */ 918 gfar_start(dev);
811 gfar_write(&regs->imask, IMASK_DEFAULT);
812 919
813 return 0; 920 return 0;
814 921
@@ -824,7 +931,7 @@ tx_skb_fail:
824 sizeof(struct txbd8)*priv->tx_ring_size 931 sizeof(struct txbd8)*priv->tx_ring_size
825 + sizeof(struct rxbd8)*priv->rx_ring_size, 932 + sizeof(struct rxbd8)*priv->rx_ring_size,
826 priv->tx_bd_base, 933 priv->tx_bd_base,
827 gfar_read(&regs->tbase)); 934 gfar_read(&regs->tbase0));
828 935
829 if (priv->mii_info->phyinfo->close) 936 if (priv->mii_info->phyinfo->close)
830 priv->mii_info->phyinfo->close(priv->mii_info); 937 priv->mii_info->phyinfo->close(priv->mii_info);
@@ -857,11 +964,62 @@ static int gfar_enet_open(struct net_device *dev)
857 return err; 964 return err;
858} 965}
859 966
967static struct txfcb *gfar_add_fcb(struct sk_buff *skb, struct txbd8 *bdp)
968{
969 struct txfcb *fcb = (struct txfcb *)skb_push (skb, GMAC_FCB_LEN);
970
971 memset(fcb, 0, GMAC_FCB_LEN);
972
973 /* Flag the bd so the controller looks for the FCB */
974 bdp->status |= TXBD_TOE;
975
976 return fcb;
977}
978
979static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
980{
981 int len;
982
983 /* If we're here, it's a IP packet with a TCP or UDP
984 * payload. We set it to checksum, using a pseudo-header
985 * we provide
986 */
987 fcb->ip = 1;
988 fcb->tup = 1;
989 fcb->ctu = 1;
990 fcb->nph = 1;
991
992 /* Notify the controller what the protocol is */
993 if (skb->nh.iph->protocol == IPPROTO_UDP)
994 fcb->udp = 1;
995
996 /* l3os is the distance between the start of the
997 * frame (skb->data) and the start of the IP hdr.
998 * l4os is the distance between the start of the
999 * l3 hdr and the l4 hdr */
1000 fcb->l3os = (u16)(skb->nh.raw - skb->data - GMAC_FCB_LEN);
1001 fcb->l4os = (u16)(skb->h.raw - skb->nh.raw);
1002
1003 len = skb->nh.iph->tot_len - fcb->l4os;
1004
1005 /* Provide the pseudoheader csum */
1006 fcb->phcs = ~csum_tcpudp_magic(skb->nh.iph->saddr,
1007 skb->nh.iph->daddr, len,
1008 skb->nh.iph->protocol, 0);
1009}
1010
1011void gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
1012{
1013 fcb->vln = 1;
1014 fcb->vlctl = vlan_tx_tag_get(skb);
1015}
1016
860/* This is called by the kernel when a frame is ready for transmission. */ 1017/* This is called by the kernel when a frame is ready for transmission. */
861/* It is pointed to by the dev->hard_start_xmit function pointer */ 1018/* It is pointed to by the dev->hard_start_xmit function pointer */
862static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) 1019static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
863{ 1020{
864 struct gfar_private *priv = netdev_priv(dev); 1021 struct gfar_private *priv = netdev_priv(dev);
1022 struct txfcb *fcb = NULL;
865 struct txbd8 *txbdp; 1023 struct txbd8 *txbdp;
866 1024
867 /* Update transmit stats */ 1025 /* Update transmit stats */
@@ -876,9 +1034,24 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
876 /* Clear all but the WRAP status flags */ 1034 /* Clear all but the WRAP status flags */
877 txbdp->status &= TXBD_WRAP; 1035 txbdp->status &= TXBD_WRAP;
878 1036
1037 /* Set up checksumming */
1038 if ((dev->features & NETIF_F_IP_CSUM)
1039 && (CHECKSUM_HW == skb->ip_summed)) {
1040 fcb = gfar_add_fcb(skb, txbdp);
1041 gfar_tx_checksum(skb, fcb);
1042 }
1043
1044 if (priv->vlan_enable &&
1045 unlikely(priv->vlgrp && vlan_tx_tag_present(skb))) {
1046 if (NULL == fcb)
1047 fcb = gfar_add_fcb(skb, txbdp);
1048
1049 gfar_tx_vlan(skb, fcb);
1050 }
1051
879 /* Set buffer length and pointer */ 1052 /* Set buffer length and pointer */
880 txbdp->length = skb->len; 1053 txbdp->length = skb->len;
881 txbdp->bufPtr = dma_map_single(NULL, skb->data, 1054 txbdp->bufPtr = dma_map_single(NULL, skb->data,
882 skb->len, DMA_TO_DEVICE); 1055 skb->len, DMA_TO_DEVICE);
883 1056
884 /* Save the skb pointer so we can free it later */ 1057 /* Save the skb pointer so we can free it later */
@@ -972,15 +1145,78 @@ int gfar_set_mac_address(struct net_device *dev)
972} 1145}
973 1146
974 1147
1148/* Enables and disables VLAN insertion/extraction */
1149static void gfar_vlan_rx_register(struct net_device *dev,
1150 struct vlan_group *grp)
1151{
1152 struct gfar_private *priv = netdev_priv(dev);
1153 unsigned long flags;
1154 u32 tempval;
1155
1156 spin_lock_irqsave(&priv->lock, flags);
1157
1158 priv->vlgrp = grp;
1159
1160 if (grp) {
1161 /* Enable VLAN tag insertion */
1162 tempval = gfar_read(&priv->regs->tctrl);
1163 tempval |= TCTRL_VLINS;
1164
1165 gfar_write(&priv->regs->tctrl, tempval);
1166
1167 /* Enable VLAN tag extraction */
1168 tempval = gfar_read(&priv->regs->rctrl);
1169 tempval |= RCTRL_VLEX;
1170 gfar_write(&priv->regs->rctrl, tempval);
1171 } else {
1172 /* Disable VLAN tag insertion */
1173 tempval = gfar_read(&priv->regs->tctrl);
1174 tempval &= ~TCTRL_VLINS;
1175 gfar_write(&priv->regs->tctrl, tempval);
1176
1177 /* Disable VLAN tag extraction */
1178 tempval = gfar_read(&priv->regs->rctrl);
1179 tempval &= ~RCTRL_VLEX;
1180 gfar_write(&priv->regs->rctrl, tempval);
1181 }
1182
1183 spin_unlock_irqrestore(&priv->lock, flags);
1184}
1185
1186
1187static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
1188{
1189 struct gfar_private *priv = netdev_priv(dev);
1190 unsigned long flags;
1191
1192 spin_lock_irqsave(&priv->lock, flags);
1193
1194 if (priv->vlgrp)
1195 priv->vlgrp->vlan_devices[vid] = NULL;
1196
1197 spin_unlock_irqrestore(&priv->lock, flags);
1198}
1199
1200
975static int gfar_change_mtu(struct net_device *dev, int new_mtu) 1201static int gfar_change_mtu(struct net_device *dev, int new_mtu)
976{ 1202{
977 int tempsize, tempval; 1203 int tempsize, tempval;
978 struct gfar_private *priv = netdev_priv(dev); 1204 struct gfar_private *priv = netdev_priv(dev);
979 int oldsize = priv->rx_buffer_size; 1205 int oldsize = priv->rx_buffer_size;
980 int frame_size = new_mtu + 18; 1206 int frame_size = new_mtu + ETH_HLEN;
1207
1208 if (priv->vlan_enable)
1209 frame_size += VLAN_ETH_HLEN;
1210
1211 if (gfar_uses_fcb(priv))
1212 frame_size += GMAC_FCB_LEN;
1213
1214 frame_size += priv->padding;
981 1215
982 if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) { 1216 if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) {
983 printk(KERN_ERR "%s: Invalid MTU setting\n", dev->name); 1217 if (netif_msg_drv(priv))
1218 printk(KERN_ERR "%s: Invalid MTU setting\n",
1219 dev->name);
984 return -EINVAL; 1220 return -EINVAL;
985 } 1221 }
986 1222
@@ -1120,7 +1356,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)
1120 skb->dev = dev; 1356 skb->dev = dev;
1121 1357
1122 bdp->bufPtr = dma_map_single(NULL, skb->data, 1358 bdp->bufPtr = dma_map_single(NULL, skb->data,
1123 priv->rx_buffer_size + RXBUF_ALIGNMENT, 1359 priv->rx_buffer_size + RXBUF_ALIGNMENT,
1124 DMA_FROM_DEVICE); 1360 DMA_FROM_DEVICE);
1125 1361
1126 bdp->length = 0; 1362 bdp->length = 0;
@@ -1190,11 +1426,10 @@ irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs)
1190 1426
1191 __netif_rx_schedule(dev); 1427 __netif_rx_schedule(dev);
1192 } else { 1428 } else {
1193#ifdef VERBOSE_GFAR_ERRORS 1429 if (netif_msg_rx_err(priv))
1194 printk(KERN_DEBUG "%s: receive called twice (%x)[%x]\n", 1430 printk(KERN_DEBUG "%s: receive called twice (%x)[%x]\n",
1195 dev->name, gfar_read(&priv->regs->ievent), 1431 dev->name, gfar_read(&priv->regs->ievent),
1196 gfar_read(&priv->regs->imask)); 1432 gfar_read(&priv->regs->imask));
1197#endif
1198 } 1433 }
1199#else 1434#else
1200 1435
@@ -1209,15 +1444,43 @@ irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs)
1209 else 1444 else
1210 gfar_write(&priv->regs->rxic, 0); 1445 gfar_write(&priv->regs->rxic, 0);
1211 1446
1212 /* Just in case we need to wake the ring param changer */
1213 priv->rxclean = 1;
1214
1215 spin_unlock(&priv->lock); 1447 spin_unlock(&priv->lock);
1216#endif 1448#endif
1217 1449
1218 return IRQ_HANDLED; 1450 return IRQ_HANDLED;
1219} 1451}
1220 1452
1453static inline int gfar_rx_vlan(struct sk_buff *skb,
1454 struct vlan_group *vlgrp, unsigned short vlctl)
1455{
1456#ifdef CONFIG_GFAR_NAPI
1457 return vlan_hwaccel_receive_skb(skb, vlgrp, vlctl);
1458#else
1459 return vlan_hwaccel_rx(skb, vlgrp, vlctl);
1460#endif
1461}
1462
1463static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb)
1464{
1465 /* If valid headers were found, and valid sums
1466 * were verified, then we tell the kernel that no
1467 * checksumming is necessary. Otherwise, it is */
1468 if (fcb->cip && !fcb->eip && fcb->ctu && !fcb->etu)
1469 skb->ip_summed = CHECKSUM_UNNECESSARY;
1470 else
1471 skb->ip_summed = CHECKSUM_NONE;
1472}
1473
1474
1475static inline struct rxfcb *gfar_get_fcb(struct sk_buff *skb)
1476{
1477 struct rxfcb *fcb = (struct rxfcb *)skb->data;
1478
1479 /* Remove the FCB from the skb */
1480 skb_pull(skb, GMAC_FCB_LEN);
1481
1482 return fcb;
1483}
1221 1484
1222/* gfar_process_frame() -- handle one incoming packet if skb 1485/* gfar_process_frame() -- handle one incoming packet if skb
1223 * isn't NULL. */ 1486 * isn't NULL. */
@@ -1225,35 +1488,51 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
1225 int length) 1488 int length)
1226{ 1489{
1227 struct gfar_private *priv = netdev_priv(dev); 1490 struct gfar_private *priv = netdev_priv(dev);
1491 struct rxfcb *fcb = NULL;
1228 1492
1229 if (skb == NULL) { 1493 if (skb == NULL) {
1230#ifdef BRIEF_GFAR_ERRORS 1494 if (netif_msg_rx_err(priv))
1231 printk(KERN_WARNING "%s: Missing skb!!.\n", 1495 printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name);
1232 dev->name);
1233#endif
1234 priv->stats.rx_dropped++; 1496 priv->stats.rx_dropped++;
1235 priv->extra_stats.rx_skbmissing++; 1497 priv->extra_stats.rx_skbmissing++;
1236 } else { 1498 } else {
1499 int ret;
1500
1237 /* Prep the skb for the packet */ 1501 /* Prep the skb for the packet */
1238 skb_put(skb, length); 1502 skb_put(skb, length);
1239 1503
1504 /* Grab the FCB if there is one */
1505 if (gfar_uses_fcb(priv))
1506 fcb = gfar_get_fcb(skb);
1507
1508 /* Remove the padded bytes, if there are any */
1509 if (priv->padding)
1510 skb_pull(skb, priv->padding);
1511
1512 if (priv->rx_csum_enable)
1513 gfar_rx_checksum(skb, fcb);
1514
1240 /* Tell the skb what kind of packet this is */ 1515 /* Tell the skb what kind of packet this is */
1241 skb->protocol = eth_type_trans(skb, dev); 1516 skb->protocol = eth_type_trans(skb, dev);
1242 1517
1243 /* Send the packet up the stack */ 1518 /* Send the packet up the stack */
1244 if (RECEIVE(skb) == NET_RX_DROP) { 1519 if (unlikely(priv->vlgrp && fcb->vln))
1520 ret = gfar_rx_vlan(skb, priv->vlgrp, fcb->vlctl);
1521 else
1522 ret = RECEIVE(skb);
1523
1524 if (NET_RX_DROP == ret)
1245 priv->extra_stats.kernel_dropped++; 1525 priv->extra_stats.kernel_dropped++;
1246 }
1247 } 1526 }
1248 1527
1249 return 0; 1528 return 0;
1250} 1529}
1251 1530
1252/* gfar_clean_rx_ring() -- Processes each frame in the rx ring 1531/* gfar_clean_rx_ring() -- Processes each frame in the rx ring
1253 * until the budget/quota has been reached. Returns the number 1532 * until the budget/quota has been reached. Returns the number
1254 * of frames handled 1533 * of frames handled
1255 */ 1534 */
1256static int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) 1535int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
1257{ 1536{
1258 struct rxbd8 *bdp; 1537 struct rxbd8 *bdp;
1259 struct sk_buff *skb; 1538 struct sk_buff *skb;
@@ -1355,9 +1634,6 @@ static int gfar_poll(struct net_device *dev, int *budget)
1355 mk_ic_value(priv->rxcount, priv->rxtime)); 1634 mk_ic_value(priv->rxcount, priv->rxtime));
1356 else 1635 else
1357 gfar_write(&priv->regs->rxic, 0); 1636 gfar_write(&priv->regs->rxic, 0);
1358
1359 /* Signal to the ring size changer that it's safe to go */
1360 priv->rxclean = 1;
1361 } 1637 }
1362 1638
1363 return (rx_work_limit < 0) ? 1 : 0; 1639 return (rx_work_limit < 0) ? 1 : 0;
@@ -1393,10 +1669,8 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1393 if (events & IEVENT_CRL) 1669 if (events & IEVENT_CRL)
1394 priv->stats.tx_aborted_errors++; 1670 priv->stats.tx_aborted_errors++;
1395 if (events & IEVENT_XFUN) { 1671 if (events & IEVENT_XFUN) {
1396#ifdef VERBOSE_GFAR_ERRORS 1672 if (netif_msg_tx_err(priv))
1397 printk(KERN_WARNING "%s: tx underrun. dropped packet\n", 1673 printk(KERN_WARNING "%s: tx underrun. dropped packet\n", dev->name);
1398 dev->name);
1399#endif
1400 priv->stats.tx_dropped++; 1674 priv->stats.tx_dropped++;
1401 priv->extra_stats.tx_underrun++; 1675 priv->extra_stats.tx_underrun++;
1402 1676
@@ -1415,36 +1689,30 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1415 gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT); 1689 gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
1416#endif 1690#endif
1417 1691
1418#ifdef VERBOSE_GFAR_ERRORS 1692 if (netif_msg_rx_err(priv))
1419 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", dev->name, 1693 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n",
1420 gfar_read(&priv->regs->rstat)); 1694 dev->name,
1421#endif 1695 gfar_read(&priv->regs->rstat));
1422 } 1696 }
1423 if (events & IEVENT_BABR) { 1697 if (events & IEVENT_BABR) {
1424 priv->stats.rx_errors++; 1698 priv->stats.rx_errors++;
1425 priv->extra_stats.rx_babr++; 1699 priv->extra_stats.rx_babr++;
1426 1700
1427#ifdef VERBOSE_GFAR_ERRORS 1701 if (netif_msg_rx_err(priv))
1428 printk(KERN_DEBUG "%s: babbling error\n", dev->name); 1702 printk(KERN_DEBUG "%s: babbling error\n", dev->name);
1429#endif
1430 } 1703 }
1431 if (events & IEVENT_EBERR) { 1704 if (events & IEVENT_EBERR) {
1432 priv->extra_stats.eberr++; 1705 priv->extra_stats.eberr++;
1433#ifdef VERBOSE_GFAR_ERRORS 1706 if (netif_msg_rx_err(priv))
1434 printk(KERN_DEBUG "%s: EBERR\n", dev->name); 1707 printk(KERN_DEBUG "%s: EBERR\n", dev->name);
1435#endif
1436 }
1437 if (events & IEVENT_RXC) {
1438#ifdef VERBOSE_GFAR_ERRORS
1439 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1440#endif
1441 } 1708 }
1709 if ((events & IEVENT_RXC) && (netif_msg_rx_err(priv)))
1710 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1442 1711
1443 if (events & IEVENT_BABT) { 1712 if (events & IEVENT_BABT) {
1444 priv->extra_stats.tx_babt++; 1713 priv->extra_stats.tx_babt++;
1445#ifdef VERBOSE_GFAR_ERRORS 1714 if (netif_msg_rx_err(priv))
1446 printk(KERN_DEBUG "%s: babt error\n", dev->name); 1715 printk(KERN_DEBUG "%s: babt error\n", dev->name);
1447#endif
1448 } 1716 }
1449 1717
1450 return IRQ_HANDLED; 1718 return IRQ_HANDLED;
@@ -1510,7 +1778,7 @@ static void gfar_phy_timer(unsigned long data)
1510 * If, after GFAR_AN_TIMEOUT seconds, it has not 1778 * If, after GFAR_AN_TIMEOUT seconds, it has not
1511 * finished, we switch to forced. 1779 * finished, we switch to forced.
1512 * Either way, once the process has completed, we either 1780 * Either way, once the process has completed, we either
1513 * request the interrupt, or switch the timer over to 1781 * request the interrupt, or switch the timer over to
1514 * using gfar_phy_timer to check status */ 1782 * using gfar_phy_timer to check status */
1515static void gfar_phy_startup_timer(unsigned long data) 1783static void gfar_phy_startup_timer(unsigned long data)
1516{ 1784{
@@ -1535,8 +1803,9 @@ static void gfar_phy_startup_timer(unsigned long data)
1535 1803
1536 /* Forcing failed! Give up */ 1804 /* Forcing failed! Give up */
1537 if(result) { 1805 if(result) {
1538 printk(KERN_ERR "%s: Forcing failed!\n", 1806 if (netif_msg_link(priv))
1539 mii_info->dev->name); 1807 printk(KERN_ERR "%s: Forcing failed!\n",
1808 mii_info->dev->name);
1540 return; 1809 return;
1541 } 1810 }
1542 } 1811 }
@@ -1546,16 +1815,17 @@ static void gfar_phy_startup_timer(unsigned long data)
1546 1815
1547 /* Grab the PHY interrupt, if necessary/possible */ 1816 /* Grab the PHY interrupt, if necessary/possible */
1548 if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { 1817 if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) {
1549 if (request_irq(priv->einfo->interruptPHY, 1818 if (request_irq(priv->einfo->interruptPHY,
1550 phy_interrupt, 1819 phy_interrupt,
1551 SA_SHIRQ, 1820 SA_SHIRQ,
1552 "phy_interrupt", 1821 "phy_interrupt",
1553 mii_info->dev) < 0) { 1822 mii_info->dev) < 0) {
1554 printk(KERN_ERR "%s: Can't get IRQ %d (PHY)\n", 1823 if (netif_msg_intr(priv))
1555 mii_info->dev->name, 1824 printk(KERN_ERR "%s: Can't get IRQ %d (PHY)\n",
1825 mii_info->dev->name,
1556 priv->einfo->interruptPHY); 1826 priv->einfo->interruptPHY);
1557 } else { 1827 } else {
1558 mii_configure_phy_interrupt(priv->mii_info, 1828 mii_configure_phy_interrupt(priv->mii_info,
1559 MII_INTERRUPT_ENABLED); 1829 MII_INTERRUPT_ENABLED);
1560 return; 1830 return;
1561 } 1831 }
@@ -1592,15 +1862,17 @@ static void adjust_link(struct net_device *dev)
1592 tempval &= ~(MACCFG2_FULL_DUPLEX); 1862 tempval &= ~(MACCFG2_FULL_DUPLEX);
1593 gfar_write(&regs->maccfg2, tempval); 1863 gfar_write(&regs->maccfg2, tempval);
1594 1864
1595 printk(KERN_INFO "%s: Half Duplex\n", 1865 if (netif_msg_link(priv))
1596 dev->name); 1866 printk(KERN_INFO "%s: Half Duplex\n",
1867 dev->name);
1597 } else { 1868 } else {
1598 tempval = gfar_read(&regs->maccfg2); 1869 tempval = gfar_read(&regs->maccfg2);
1599 tempval |= MACCFG2_FULL_DUPLEX; 1870 tempval |= MACCFG2_FULL_DUPLEX;
1600 gfar_write(&regs->maccfg2, tempval); 1871 gfar_write(&regs->maccfg2, tempval);
1601 1872
1602 printk(KERN_INFO "%s: Full Duplex\n", 1873 if (netif_msg_link(priv))
1603 dev->name); 1874 printk(KERN_INFO "%s: Full Duplex\n",
1875 dev->name);
1604 } 1876 }
1605 1877
1606 priv->oldduplex = mii_info->duplex; 1878 priv->oldduplex = mii_info->duplex;
@@ -1622,27 +1894,32 @@ static void adjust_link(struct net_device *dev)
1622 gfar_write(&regs->maccfg2, tempval); 1894 gfar_write(&regs->maccfg2, tempval);
1623 break; 1895 break;
1624 default: 1896 default:
1625 printk(KERN_WARNING 1897 if (netif_msg_link(priv))
1626 "%s: Ack! Speed (%d) is not 10/100/1000!\n", 1898 printk(KERN_WARNING
1627 dev->name, mii_info->speed); 1899 "%s: Ack! Speed (%d) is not 10/100/1000!\n",
1900 dev->name, mii_info->speed);
1628 break; 1901 break;
1629 } 1902 }
1630 1903
1631 printk(KERN_INFO "%s: Speed %dBT\n", dev->name, 1904 if (netif_msg_link(priv))
1632 mii_info->speed); 1905 printk(KERN_INFO "%s: Speed %dBT\n", dev->name,
1906 mii_info->speed);
1633 1907
1634 priv->oldspeed = mii_info->speed; 1908 priv->oldspeed = mii_info->speed;
1635 } 1909 }
1636 1910
1637 if (!priv->oldlink) { 1911 if (!priv->oldlink) {
1638 printk(KERN_INFO "%s: Link is up\n", dev->name); 1912 if (netif_msg_link(priv))
1913 printk(KERN_INFO "%s: Link is up\n", dev->name);
1639 priv->oldlink = 1; 1914 priv->oldlink = 1;
1640 netif_carrier_on(dev); 1915 netif_carrier_on(dev);
1641 netif_schedule(dev); 1916 netif_schedule(dev);
1642 } 1917 }
1643 } else { 1918 } else {
1644 if (priv->oldlink) { 1919 if (priv->oldlink) {
1645 printk(KERN_INFO "%s: Link is down\n", dev->name); 1920 if (netif_msg_link(priv))
1921 printk(KERN_INFO "%s: Link is down\n",
1922 dev->name);
1646 priv->oldlink = 0; 1923 priv->oldlink = 0;
1647 priv->oldspeed = 0; 1924 priv->oldspeed = 0;
1648 priv->oldduplex = -1; 1925 priv->oldduplex = -1;
@@ -1664,8 +1941,9 @@ static void gfar_set_multi(struct net_device *dev)
1664 u32 tempval; 1941 u32 tempval;
1665 1942
1666 if(dev->flags & IFF_PROMISC) { 1943 if(dev->flags & IFF_PROMISC) {
1667 printk(KERN_INFO "%s: Entering promiscuous mode.\n", 1944 if (netif_msg_drv(priv))
1668 dev->name); 1945 printk(KERN_INFO "%s: Entering promiscuous mode.\n",
1946 dev->name);
1669 /* Set RCTRL to PROM */ 1947 /* Set RCTRL to PROM */
1670 tempval = gfar_read(&regs->rctrl); 1948 tempval = gfar_read(&regs->rctrl);
1671 tempval |= RCTRL_PROM; 1949 tempval |= RCTRL_PROM;
@@ -1679,6 +1957,14 @@ static void gfar_set_multi(struct net_device *dev)
1679 1957
1680 if(dev->flags & IFF_ALLMULTI) { 1958 if(dev->flags & IFF_ALLMULTI) {
1681 /* Set the hash to rx all multicast frames */ 1959 /* Set the hash to rx all multicast frames */
1960 gfar_write(&regs->igaddr0, 0xffffffff);
1961 gfar_write(&regs->igaddr1, 0xffffffff);
1962 gfar_write(&regs->igaddr2, 0xffffffff);
1963 gfar_write(&regs->igaddr3, 0xffffffff);
1964 gfar_write(&regs->igaddr4, 0xffffffff);
1965 gfar_write(&regs->igaddr5, 0xffffffff);
1966 gfar_write(&regs->igaddr6, 0xffffffff);
1967 gfar_write(&regs->igaddr7, 0xffffffff);
1682 gfar_write(&regs->gaddr0, 0xffffffff); 1968 gfar_write(&regs->gaddr0, 0xffffffff);
1683 gfar_write(&regs->gaddr1, 0xffffffff); 1969 gfar_write(&regs->gaddr1, 0xffffffff);
1684 gfar_write(&regs->gaddr2, 0xffffffff); 1970 gfar_write(&regs->gaddr2, 0xffffffff);
@@ -1689,6 +1975,14 @@ static void gfar_set_multi(struct net_device *dev)
1689 gfar_write(&regs->gaddr7, 0xffffffff); 1975 gfar_write(&regs->gaddr7, 0xffffffff);
1690 } else { 1976 } else {
1691 /* zero out the hash */ 1977 /* zero out the hash */
1978 gfar_write(&regs->igaddr0, 0x0);
1979 gfar_write(&regs->igaddr1, 0x0);
1980 gfar_write(&regs->igaddr2, 0x0);
1981 gfar_write(&regs->igaddr3, 0x0);
1982 gfar_write(&regs->igaddr4, 0x0);
1983 gfar_write(&regs->igaddr5, 0x0);
1984 gfar_write(&regs->igaddr6, 0x0);
1985 gfar_write(&regs->igaddr7, 0x0);
1692 gfar_write(&regs->gaddr0, 0x0); 1986 gfar_write(&regs->gaddr0, 0x0);
1693 gfar_write(&regs->gaddr1, 0x0); 1987 gfar_write(&regs->gaddr1, 0x0);
1694 gfar_write(&regs->gaddr2, 0x0); 1988 gfar_write(&regs->gaddr2, 0x0);
@@ -1727,16 +2021,15 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr)
1727{ 2021{
1728 u32 tempval; 2022 u32 tempval;
1729 struct gfar_private *priv = netdev_priv(dev); 2023 struct gfar_private *priv = netdev_priv(dev);
1730 struct gfar *regs = priv->regs;
1731 u32 *hash = &regs->gaddr0;
1732 u32 result = ether_crc(MAC_ADDR_LEN, addr); 2024 u32 result = ether_crc(MAC_ADDR_LEN, addr);
1733 u8 whichreg = ((result >> 29) & 0x7); 2025 int width = priv->hash_width;
1734 u8 whichbit = ((result >> 24) & 0x1f); 2026 u8 whichbit = (result >> (32 - width)) & 0x1f;
2027 u8 whichreg = result >> (32 - width + 5);
1735 u32 value = (1 << (31-whichbit)); 2028 u32 value = (1 << (31-whichbit));
1736 2029
1737 tempval = gfar_read(&hash[whichreg]); 2030 tempval = gfar_read(priv->hash_regs[whichreg]);
1738 tempval |= value; 2031 tempval |= value;
1739 gfar_write(&hash[whichreg], tempval); 2032 gfar_write(priv->hash_regs[whichreg], tempval);
1740 2033
1741 return; 2034 return;
1742} 2035}
@@ -1754,10 +2047,9 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
1754 gfar_write(&priv->regs->ievent, IEVENT_ERR_MASK); 2047 gfar_write(&priv->regs->ievent, IEVENT_ERR_MASK);
1755 2048
1756 /* Hmm... */ 2049 /* Hmm... */
1757#if defined (BRIEF_GFAR_ERRORS) || defined (VERBOSE_GFAR_ERRORS) 2050 if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv))
1758 printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n", 2051 printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n",
1759 dev->name, events, gfar_read(&priv->regs->imask)); 2052 dev->name, events, gfar_read(&priv->regs->imask));
1760#endif
1761 2053
1762 /* Update the error counters */ 2054 /* Update the error counters */
1763 if (events & IEVENT_TXE) { 2055 if (events & IEVENT_TXE) {
@@ -1768,19 +2060,17 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
1768 if (events & IEVENT_CRL) 2060 if (events & IEVENT_CRL)
1769 priv->stats.tx_aborted_errors++; 2061 priv->stats.tx_aborted_errors++;
1770 if (events & IEVENT_XFUN) { 2062 if (events & IEVENT_XFUN) {
1771#ifdef VERBOSE_GFAR_ERRORS 2063 if (netif_msg_tx_err(priv))
1772 printk(KERN_DEBUG "%s: underrun. packet dropped.\n", 2064 printk(KERN_DEBUG "%s: underrun. packet dropped.\n",
1773 dev->name); 2065 dev->name);
1774#endif
1775 priv->stats.tx_dropped++; 2066 priv->stats.tx_dropped++;
1776 priv->extra_stats.tx_underrun++; 2067 priv->extra_stats.tx_underrun++;
1777 2068
1778 /* Reactivate the Tx Queues */ 2069 /* Reactivate the Tx Queues */
1779 gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT); 2070 gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
1780 } 2071 }
1781#ifdef VERBOSE_GFAR_ERRORS 2072 if (netif_msg_tx_err(priv))
1782 printk(KERN_DEBUG "%s: Transmit Error\n", dev->name); 2073 printk(KERN_DEBUG "%s: Transmit Error\n", dev->name);
1783#endif
1784 } 2074 }
1785 if (events & IEVENT_BSY) { 2075 if (events & IEVENT_BSY) {
1786 priv->stats.rx_errors++; 2076 priv->stats.rx_errors++;
@@ -1793,35 +2083,31 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
1793 gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT); 2083 gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
1794#endif 2084#endif
1795 2085
1796#ifdef VERBOSE_GFAR_ERRORS 2086 if (netif_msg_rx_err(priv))
1797 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", dev->name, 2087 printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n",
1798 gfar_read(&priv->regs->rstat)); 2088 dev->name,
1799#endif 2089 gfar_read(&priv->regs->rstat));
1800 } 2090 }
1801 if (events & IEVENT_BABR) { 2091 if (events & IEVENT_BABR) {
1802 priv->stats.rx_errors++; 2092 priv->stats.rx_errors++;
1803 priv->extra_stats.rx_babr++; 2093 priv->extra_stats.rx_babr++;
1804 2094
1805#ifdef VERBOSE_GFAR_ERRORS 2095 if (netif_msg_rx_err(priv))
1806 printk(KERN_DEBUG "%s: babbling error\n", dev->name); 2096 printk(KERN_DEBUG "%s: babbling error\n", dev->name);
1807#endif
1808 } 2097 }
1809 if (events & IEVENT_EBERR) { 2098 if (events & IEVENT_EBERR) {
1810 priv->extra_stats.eberr++; 2099 priv->extra_stats.eberr++;
1811#ifdef VERBOSE_GFAR_ERRORS 2100 if (netif_msg_rx_err(priv))
1812 printk(KERN_DEBUG "%s: EBERR\n", dev->name); 2101 printk(KERN_DEBUG "%s: EBERR\n", dev->name);
1813#endif
1814 } 2102 }
1815 if (events & IEVENT_RXC) 2103 if ((events & IEVENT_RXC) && netif_msg_rx_status(priv))
1816#ifdef VERBOSE_GFAR_ERRORS 2104 if (netif_msg_rx_status(priv))
1817 printk(KERN_DEBUG "%s: control frame\n", dev->name); 2105 printk(KERN_DEBUG "%s: control frame\n", dev->name);
1818#endif
1819 2106
1820 if (events & IEVENT_BABT) { 2107 if (events & IEVENT_BABT) {
1821 priv->extra_stats.tx_babt++; 2108 priv->extra_stats.tx_babt++;
1822#ifdef VERBOSE_GFAR_ERRORS 2109 if (netif_msg_tx_err(priv))
1823 printk(KERN_DEBUG "%s: babt error\n", dev->name); 2110 printk(KERN_DEBUG "%s: babt error\n", dev->name);
1824#endif
1825 } 2111 }
1826 return IRQ_HANDLED; 2112 return IRQ_HANDLED;
1827} 2113}
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index c2f783a6a9fa..28af087d9fbb 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * drivers/net/gianfar.h 2 * drivers/net/gianfar.h
3 * 3 *
4 * Gianfar Ethernet Driver 4 * Gianfar Ethernet Driver
@@ -53,6 +53,12 @@
53/* The maximum number of packets to be handled in one call of gfar_poll */ 53/* The maximum number of packets to be handled in one call of gfar_poll */
54#define GFAR_DEV_WEIGHT 64 54#define GFAR_DEV_WEIGHT 64
55 55
56/* Length for FCB */
57#define GMAC_FCB_LEN 8
58
59/* Default padding amount */
60#define DEFAULT_PADDING 2
61
56/* Number of bytes to align the rx bufs to */ 62/* Number of bytes to align the rx bufs to */
57#define RXBUF_ALIGNMENT 64 63#define RXBUF_ALIGNMENT 64
58 64
@@ -91,7 +97,7 @@ extern const char gfar_driver_version[];
91#define JUMBO_FRAME_SIZE 9600 97#define JUMBO_FRAME_SIZE 9600
92 98
93/* Latency of interface clock in nanoseconds */ 99/* Latency of interface clock in nanoseconds */
94/* Interface clock latency , in this case, means the 100/* Interface clock latency , in this case, means the
95 * time described by a value of 1 in the interrupt 101 * time described by a value of 1 in the interrupt
96 * coalescing registers' time fields. Since those fields 102 * coalescing registers' time fields. Since those fields
97 * refer to the time it takes for 64 clocks to pass, the 103 * refer to the time it takes for 64 clocks to pass, the
@@ -166,9 +172,28 @@ extern const char gfar_driver_version[];
166 mk_ic_icft(count) | \ 172 mk_ic_icft(count) | \
167 mk_ic_ictt(time)) 173 mk_ic_ictt(time))
168 174
175#define RCTRL_PAL_MASK 0x001f0000
176#define RCTRL_VLEX 0x00002000
177#define RCTRL_FILREN 0x00001000
178#define RCTRL_GHTX 0x00000400
179#define RCTRL_IPCSEN 0x00000200
180#define RCTRL_TUCSEN 0x00000100
181#define RCTRL_PRSDEP_MASK 0x000000c0
182#define RCTRL_PRSDEP_INIT 0x000000c0
169#define RCTRL_PROM 0x00000008 183#define RCTRL_PROM 0x00000008
184#define RCTRL_CHECKSUMMING (RCTRL_IPCSEN \
185 | RCTRL_TUCSEN | RCTRL_PRSDEP_INIT)
186#define RCTRL_EXTHASH (RCTRL_GHTX)
187#define RCTRL_VLAN (RCTRL_PRSDEP_INIT)
188
189
170#define RSTAT_CLEAR_RHALT 0x00800000 190#define RSTAT_CLEAR_RHALT 0x00800000
171 191
192#define TCTRL_IPCSEN 0x00004000
193#define TCTRL_TUCSEN 0x00002000
194#define TCTRL_VLINS 0x00001000
195#define TCTRL_INIT_CSUM (TCTRL_TUCSEN | TCTRL_IPCSEN)
196
172#define IEVENT_INIT_CLEAR 0xffffffff 197#define IEVENT_INIT_CLEAR 0xffffffff
173#define IEVENT_BABR 0x80000000 198#define IEVENT_BABR 0x80000000
174#define IEVENT_RXC 0x40000000 199#define IEVENT_RXC 0x40000000
@@ -187,12 +212,16 @@ extern const char gfar_driver_version[];
187#define IEVENT_RXB0 0x00008000 212#define IEVENT_RXB0 0x00008000
188#define IEVENT_GRSC 0x00000100 213#define IEVENT_GRSC 0x00000100
189#define IEVENT_RXF0 0x00000080 214#define IEVENT_RXF0 0x00000080
215#define IEVENT_FIR 0x00000008
216#define IEVENT_FIQ 0x00000004
217#define IEVENT_DPE 0x00000002
218#define IEVENT_PERR 0x00000001
190#define IEVENT_RX_MASK (IEVENT_RXB0 | IEVENT_RXF0) 219#define IEVENT_RX_MASK (IEVENT_RXB0 | IEVENT_RXF0)
191#define IEVENT_TX_MASK (IEVENT_TXB | IEVENT_TXF) 220#define IEVENT_TX_MASK (IEVENT_TXB | IEVENT_TXF)
192#define IEVENT_ERR_MASK \ 221#define IEVENT_ERR_MASK \
193(IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \ 222(IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \
194 IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \ 223 IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \
195 | IEVENT_CRL | IEVENT_XFUN) 224 | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR)
196 225
197#define IMASK_INIT_CLEAR 0x00000000 226#define IMASK_INIT_CLEAR 0x00000000
198#define IMASK_BABR 0x80000000 227#define IMASK_BABR 0x80000000
@@ -212,10 +241,15 @@ extern const char gfar_driver_version[];
212#define IMASK_RXB0 0x00008000 241#define IMASK_RXB0 0x00008000
213#define IMASK_GTSC 0x00000100 242#define IMASK_GTSC 0x00000100
214#define IMASK_RXFEN0 0x00000080 243#define IMASK_RXFEN0 0x00000080
244#define IMASK_FIR 0x00000008
245#define IMASK_FIQ 0x00000004
246#define IMASK_DPE 0x00000002
247#define IMASK_PERR 0x00000001
215#define IMASK_RX_DISABLED ~(IMASK_RXFEN0 | IMASK_BSY) 248#define IMASK_RX_DISABLED ~(IMASK_RXFEN0 | IMASK_BSY)
216#define IMASK_DEFAULT (IMASK_TXEEN | IMASK_TXFEN | IMASK_TXBEN | \ 249#define IMASK_DEFAULT (IMASK_TXEEN | IMASK_TXFEN | IMASK_TXBEN | \
217 IMASK_RXFEN0 | IMASK_BSY | IMASK_EBERR | IMASK_BABR | \ 250 IMASK_RXFEN0 | IMASK_BSY | IMASK_EBERR | IMASK_BABR | \
218 IMASK_XFUN | IMASK_RXC | IMASK_BABT) 251 IMASK_XFUN | IMASK_RXC | IMASK_BABT | IMASK_DPE \
252 | IMASK_PERR)
219 253
220 254
221/* Attribute fields */ 255/* Attribute fields */
@@ -254,6 +288,18 @@ extern const char gfar_driver_version[];
254#define TXBD_RETRYLIMIT 0x0040 288#define TXBD_RETRYLIMIT 0x0040
255#define TXBD_RETRYCOUNTMASK 0x003c 289#define TXBD_RETRYCOUNTMASK 0x003c
256#define TXBD_UNDERRUN 0x0002 290#define TXBD_UNDERRUN 0x0002
291#define TXBD_TOE 0x0002
292
293/* Tx FCB param bits */
294#define TXFCB_VLN 0x80
295#define TXFCB_IP 0x40
296#define TXFCB_IP6 0x20
297#define TXFCB_TUP 0x10
298#define TXFCB_UDP 0x08
299#define TXFCB_CIP 0x04
300#define TXFCB_CTU 0x02
301#define TXFCB_NPH 0x01
302#define TXFCB_DEFAULT (TXFCB_IP|TXFCB_TUP|TXFCB_CTU|TXFCB_NPH)
257 303
258/* RxBD status field bits */ 304/* RxBD status field bits */
259#define RXBD_EMPTY 0x8000 305#define RXBD_EMPTY 0x8000
@@ -273,6 +319,18 @@ extern const char gfar_driver_version[];
273#define RXBD_TRUNCATED 0x0001 319#define RXBD_TRUNCATED 0x0001
274#define RXBD_STATS 0x01ff 320#define RXBD_STATS 0x01ff
275 321
322/* Rx FCB status field bits */
323#define RXFCB_VLN 0x8000
324#define RXFCB_IP 0x4000
325#define RXFCB_IP6 0x2000
326#define RXFCB_TUP 0x1000
327#define RXFCB_CIP 0x0800
328#define RXFCB_CTU 0x0400
329#define RXFCB_EIP 0x0200
330#define RXFCB_ETU 0x0100
331#define RXFCB_PERR_MASK 0x000c
332#define RXFCB_PERR_BADL3 0x0008
333
276struct txbd8 334struct txbd8
277{ 335{
278 u16 status; /* Status Fields */ 336 u16 status; /* Status Fields */
@@ -280,6 +338,22 @@ struct txbd8
280 u32 bufPtr; /* Buffer Pointer */ 338 u32 bufPtr; /* Buffer Pointer */
281}; 339};
282 340
341struct txfcb {
342 u8 vln:1,
343 ip:1,
344 ip6:1,
345 tup:1,
346 udp:1,
347 cip:1,
348 ctu:1,
349 nph:1;
350 u8 reserved;
351 u8 l4os; /* Level 4 Header Offset */
352 u8 l3os; /* Level 3 Header Offset */
353 u16 phcs; /* Pseudo-header Checksum */
354 u16 vlctl; /* VLAN control word */
355};
356
283struct rxbd8 357struct rxbd8
284{ 358{
285 u16 status; /* Status Fields */ 359 u16 status; /* Status Fields */
@@ -287,6 +361,21 @@ struct rxbd8
287 u32 bufPtr; /* Buffer Pointer */ 361 u32 bufPtr; /* Buffer Pointer */
288}; 362};
289 363
364struct rxfcb {
365 u16 vln:1,
366 ip:1,
367 ip6:1,
368 tup:1,
369 cip:1,
370 ctu:1,
371 eip:1,
372 etu:1;
373 u8 rq; /* Receive Queue index */
374 u8 pro; /* Layer 4 Protocol */
375 u16 reserved;
376 u16 vlctl; /* VLAN control word */
377};
378
290struct rmon_mib 379struct rmon_mib
291{ 380{
292 u32 tr64; /* 0x.680 - Transmit and Receive 64-byte Frame Counter */ 381 u32 tr64; /* 0x.680 - Transmit and Receive 64-byte Frame Counter */
@@ -371,90 +460,191 @@ struct gfar_stats {
371 460
372 461
373struct gfar { 462struct gfar {
374 u8 res1[16]; 463 u32 tsec_id; /* 0x.000 - Controller ID register */
375 u32 ievent; /* 0x.010 - Interrupt Event Register */ 464 u8 res1[12];
376 u32 imask; /* 0x.014 - Interrupt Mask Register */ 465 u32 ievent; /* 0x.010 - Interrupt Event Register */
377 u32 edis; /* 0x.018 - Error Disabled Register */ 466 u32 imask; /* 0x.014 - Interrupt Mask Register */
467 u32 edis; /* 0x.018 - Error Disabled Register */
378 u8 res2[4]; 468 u8 res2[4];
379 u32 ecntrl; /* 0x.020 - Ethernet Control Register */ 469 u32 ecntrl; /* 0x.020 - Ethernet Control Register */
380 u32 minflr; /* 0x.024 - Minimum Frame Length Register */ 470 u32 minflr; /* 0x.024 - Minimum Frame Length Register */
381 u32 ptv; /* 0x.028 - Pause Time Value Register */ 471 u32 ptv; /* 0x.028 - Pause Time Value Register */
382 u32 dmactrl; /* 0x.02c - DMA Control Register */ 472 u32 dmactrl; /* 0x.02c - DMA Control Register */
383 u32 tbipa; /* 0x.030 - TBI PHY Address Register */ 473 u32 tbipa; /* 0x.030 - TBI PHY Address Register */
384 u8 res3[88]; 474 u8 res3[88];
385 u32 fifo_tx_thr; /* 0x.08c - FIFO transmit threshold register */ 475 u32 fifo_tx_thr; /* 0x.08c - FIFO transmit threshold register */
386 u8 res4[8]; 476 u8 res4[8];
387 u32 fifo_tx_starve; /* 0x.098 - FIFO transmit starve register */ 477 u32 fifo_tx_starve; /* 0x.098 - FIFO transmit starve register */
388 u32 fifo_tx_starve_shutoff; /* 0x.09c - FIFO transmit starve shutoff register */ 478 u32 fifo_tx_starve_shutoff; /* 0x.09c - FIFO transmit starve shutoff register */
389 u8 res5[96]; 479 u8 res5[4];
390 u32 tctrl; /* 0x.100 - Transmit Control Register */ 480 u32 fifo_rx_pause; /* 0x.0a4 - FIFO receive pause threshold register */
391 u32 tstat; /* 0x.104 - Transmit Status Register */ 481 u32 fifo_rx_alarm; /* 0x.0a8 - FIFO receive alarm threshold register */
392 u8 res6[4]; 482 u8 res6[84];
393 u32 tbdlen; /* 0x.10c - Transmit Buffer Descriptor Data Length Register */ 483 u32 tctrl; /* 0x.100 - Transmit Control Register */
394 u32 txic; /* 0x.110 - Transmit Interrupt Coalescing Configuration Register */ 484 u32 tstat; /* 0x.104 - Transmit Status Register */
395 u8 res7[16]; 485 u32 dfvlan; /* 0x.108 - Default VLAN Control word */
396 u32 ctbptr; /* 0x.124 - Current Transmit Buffer Descriptor Pointer Register */ 486 u32 tbdlen; /* 0x.10c - Transmit Buffer Descriptor Data Length Register */
397 u8 res8[92]; 487 u32 txic; /* 0x.110 - Transmit Interrupt Coalescing Configuration Register */
398 u32 tbptr; /* 0x.184 - Transmit Buffer Descriptor Pointer Low Register */ 488 u32 tqueue; /* 0x.114 - Transmit queue control register */
399 u8 res9[124]; 489 u8 res7[40];
400 u32 tbase; /* 0x.204 - Transmit Descriptor Base Address Register */ 490 u32 tr03wt; /* 0x.140 - TxBD Rings 0-3 round-robin weightings */
401 u8 res10[168]; 491 u32 tr47wt; /* 0x.144 - TxBD Rings 4-7 round-robin weightings */
402 u32 ostbd; /* 0x.2b0 - Out-of-Sequence Transmit Buffer Descriptor Register */ 492 u8 res8[52];
403 u32 ostbdp; /* 0x.2b4 - Out-of-Sequence Transmit Data Buffer Pointer Register */ 493 u32 tbdbph; /* 0x.17c - Tx data buffer pointer high */
404 u8 res11[72]; 494 u8 res9a[4];
405 u32 rctrl; /* 0x.300 - Receive Control Register */ 495 u32 tbptr0; /* 0x.184 - TxBD Pointer for ring 0 */
406 u32 rstat; /* 0x.304 - Receive Status Register */ 496 u8 res9b[4];
407 u8 res12[4]; 497 u32 tbptr1; /* 0x.18c - TxBD Pointer for ring 1 */
408 u32 rbdlen; /* 0x.30c - RxBD Data Length Register */ 498 u8 res9c[4];
409 u32 rxic; /* 0x.310 - Receive Interrupt Coalescing Configuration Register */ 499 u32 tbptr2; /* 0x.194 - TxBD Pointer for ring 2 */
410 u8 res13[16]; 500 u8 res9d[4];
411 u32 crbptr; /* 0x.324 - Current Receive Buffer Descriptor Pointer */ 501 u32 tbptr3; /* 0x.19c - TxBD Pointer for ring 3 */
412 u8 res14[24]; 502 u8 res9e[4];
413 u32 mrblr; /* 0x.340 - Maximum Receive Buffer Length Register */ 503 u32 tbptr4; /* 0x.1a4 - TxBD Pointer for ring 4 */
414 u8 res15[64]; 504 u8 res9f[4];
415 u32 rbptr; /* 0x.384 - Receive Buffer Descriptor Pointer */ 505 u32 tbptr5; /* 0x.1ac - TxBD Pointer for ring 5 */
416 u8 res16[124]; 506 u8 res9g[4];
417 u32 rbase; /* 0x.404 - Receive Descriptor Base Address */ 507 u32 tbptr6; /* 0x.1b4 - TxBD Pointer for ring 6 */
418 u8 res17[248]; 508 u8 res9h[4];
419 u32 maccfg1; /* 0x.500 - MAC Configuration 1 Register */ 509 u32 tbptr7; /* 0x.1bc - TxBD Pointer for ring 7 */
420 u32 maccfg2; /* 0x.504 - MAC Configuration 2 Register */ 510 u8 res9[64];
421 u32 ipgifg; /* 0x.508 - Inter Packet Gap/Inter Frame Gap Register */ 511 u32 tbaseh; /* 0x.200 - TxBD base address high */
422 u32 hafdup; /* 0x.50c - Half Duplex Register */ 512 u32 tbase0; /* 0x.204 - TxBD Base Address of ring 0 */
423 u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */ 513 u8 res10a[4];
514 u32 tbase1; /* 0x.20c - TxBD Base Address of ring 1 */
515 u8 res10b[4];
516 u32 tbase2; /* 0x.214 - TxBD Base Address of ring 2 */
517 u8 res10c[4];
518 u32 tbase3; /* 0x.21c - TxBD Base Address of ring 3 */
519 u8 res10d[4];
520 u32 tbase4; /* 0x.224 - TxBD Base Address of ring 4 */
521 u8 res10e[4];
522 u32 tbase5; /* 0x.22c - TxBD Base Address of ring 5 */
523 u8 res10f[4];
524 u32 tbase6; /* 0x.234 - TxBD Base Address of ring 6 */
525 u8 res10g[4];
526 u32 tbase7; /* 0x.23c - TxBD Base Address of ring 7 */
527 u8 res10[192];
528 u32 rctrl; /* 0x.300 - Receive Control Register */
529 u32 rstat; /* 0x.304 - Receive Status Register */
530 u8 res12[8];
531 u32 rxic; /* 0x.310 - Receive Interrupt Coalescing Configuration Register */
532 u32 rqueue; /* 0x.314 - Receive queue control register */
533 u8 res13[24];
534 u32 rbifx; /* 0x.330 - Receive bit field extract control register */
535 u32 rqfar; /* 0x.334 - Receive queue filing table address register */
536 u32 rqfcr; /* 0x.338 - Receive queue filing table control register */
537 u32 rqfpr; /* 0x.33c - Receive queue filing table property register */
538 u32 mrblr; /* 0x.340 - Maximum Receive Buffer Length Register */
539 u8 res14[56];
540 u32 rbdbph; /* 0x.37c - Rx data buffer pointer high */
541 u8 res15a[4];
542 u32 rbptr0; /* 0x.384 - RxBD pointer for ring 0 */
543 u8 res15b[4];
544 u32 rbptr1; /* 0x.38c - RxBD pointer for ring 1 */
545 u8 res15c[4];
546 u32 rbptr2; /* 0x.394 - RxBD pointer for ring 2 */
547 u8 res15d[4];
548 u32 rbptr3; /* 0x.39c - RxBD pointer for ring 3 */
549 u8 res15e[4];
550 u32 rbptr4; /* 0x.3a4 - RxBD pointer for ring 4 */
551 u8 res15f[4];
552 u32 rbptr5; /* 0x.3ac - RxBD pointer for ring 5 */
553 u8 res15g[4];
554 u32 rbptr6; /* 0x.3b4 - RxBD pointer for ring 6 */
555 u8 res15h[4];
556 u32 rbptr7; /* 0x.3bc - RxBD pointer for ring 7 */
557 u8 res16[64];
558 u32 rbaseh; /* 0x.400 - RxBD base address high */
559 u32 rbase0; /* 0x.404 - RxBD base address of ring 0 */
560 u8 res17a[4];
561 u32 rbase1; /* 0x.40c - RxBD base address of ring 1 */
562 u8 res17b[4];
563 u32 rbase2; /* 0x.414 - RxBD base address of ring 2 */
564 u8 res17c[4];
565 u32 rbase3; /* 0x.41c - RxBD base address of ring 3 */
566 u8 res17d[4];
567 u32 rbase4; /* 0x.424 - RxBD base address of ring 4 */
568 u8 res17e[4];
569 u32 rbase5; /* 0x.42c - RxBD base address of ring 5 */
570 u8 res17f[4];
571 u32 rbase6; /* 0x.434 - RxBD base address of ring 6 */
572 u8 res17g[4];
573 u32 rbase7; /* 0x.43c - RxBD base address of ring 7 */
574 u8 res17[192];
575 u32 maccfg1; /* 0x.500 - MAC Configuration 1 Register */
576 u32 maccfg2; /* 0x.504 - MAC Configuration 2 Register */
577 u32 ipgifg; /* 0x.508 - Inter Packet Gap/Inter Frame Gap Register */
578 u32 hafdup; /* 0x.50c - Half Duplex Register */
579 u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */
424 u8 res18[12]; 580 u8 res18[12];
425 u32 miimcfg; /* 0x.520 - MII Management Configuration Register */ 581 u32 miimcfg; /* 0x.520 - MII Management Configuration Register */
426 u32 miimcom; /* 0x.524 - MII Management Command Register */ 582 u32 miimcom; /* 0x.524 - MII Management Command Register */
427 u32 miimadd; /* 0x.528 - MII Management Address Register */ 583 u32 miimadd; /* 0x.528 - MII Management Address Register */
428 u32 miimcon; /* 0x.52c - MII Management Control Register */ 584 u32 miimcon; /* 0x.52c - MII Management Control Register */
429 u32 miimstat; /* 0x.530 - MII Management Status Register */ 585 u32 miimstat; /* 0x.530 - MII Management Status Register */
430 u32 miimind; /* 0x.534 - MII Management Indicator Register */ 586 u32 miimind; /* 0x.534 - MII Management Indicator Register */
431 u8 res19[4]; 587 u8 res19[4];
432 u32 ifstat; /* 0x.53c - Interface Status Register */ 588 u32 ifstat; /* 0x.53c - Interface Status Register */
433 u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */ 589 u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */
434 u32 macstnaddr2; /* 0x.544 - Station Address Part 2 Register */ 590 u32 macstnaddr2; /* 0x.544 - Station Address Part 2 Register */
435 u8 res20[312]; 591 u32 mac01addr1; /* 0x.548 - MAC exact match address 1, part 1 */
436 struct rmon_mib rmon; 592 u32 mac01addr2; /* 0x.54c - MAC exact match address 1, part 2 */
437 u8 res21[192]; 593 u32 mac02addr1; /* 0x.550 - MAC exact match address 2, part 1 */
438 u32 iaddr0; /* 0x.800 - Indivdual address register 0 */ 594 u32 mac02addr2; /* 0x.554 - MAC exact match address 2, part 2 */
439 u32 iaddr1; /* 0x.804 - Indivdual address register 1 */ 595 u32 mac03addr1; /* 0x.558 - MAC exact match address 3, part 1 */
440 u32 iaddr2; /* 0x.808 - Indivdual address register 2 */ 596 u32 mac03addr2; /* 0x.55c - MAC exact match address 3, part 2 */
441 u32 iaddr3; /* 0x.80c - Indivdual address register 3 */ 597 u32 mac04addr1; /* 0x.560 - MAC exact match address 4, part 1 */
442 u32 iaddr4; /* 0x.810 - Indivdual address register 4 */ 598 u32 mac04addr2; /* 0x.564 - MAC exact match address 4, part 2 */
443 u32 iaddr5; /* 0x.814 - Indivdual address register 5 */ 599 u32 mac05addr1; /* 0x.568 - MAC exact match address 5, part 1 */
444 u32 iaddr6; /* 0x.818 - Indivdual address register 6 */ 600 u32 mac05addr2; /* 0x.56c - MAC exact match address 5, part 2 */
445 u32 iaddr7; /* 0x.81c - Indivdual address register 7 */ 601 u32 mac06addr1; /* 0x.570 - MAC exact match address 6, part 1 */
602 u32 mac06addr2; /* 0x.574 - MAC exact match address 6, part 2 */
603 u32 mac07addr1; /* 0x.578 - MAC exact match address 7, part 1 */
604 u32 mac07addr2; /* 0x.57c - MAC exact match address 7, part 2 */
605 u32 mac08addr1; /* 0x.580 - MAC exact match address 8, part 1 */
606 u32 mac08addr2; /* 0x.584 - MAC exact match address 8, part 2 */
607 u32 mac09addr1; /* 0x.588 - MAC exact match address 9, part 1 */
608 u32 mac09addr2; /* 0x.58c - MAC exact match address 9, part 2 */
609 u32 mac10addr1; /* 0x.590 - MAC exact match address 10, part 1*/
610 u32 mac10addr2; /* 0x.594 - MAC exact match address 10, part 2*/
611 u32 mac11addr1; /* 0x.598 - MAC exact match address 11, part 1*/
612 u32 mac11addr2; /* 0x.59c - MAC exact match address 11, part 2*/
613 u32 mac12addr1; /* 0x.5a0 - MAC exact match address 12, part 1*/
614 u32 mac12addr2; /* 0x.5a4 - MAC exact match address 12, part 2*/
615 u32 mac13addr1; /* 0x.5a8 - MAC exact match address 13, part 1*/
616 u32 mac13addr2; /* 0x.5ac - MAC exact match address 13, part 2*/
617 u32 mac14addr1; /* 0x.5b0 - MAC exact match address 14, part 1*/
618 u32 mac14addr2; /* 0x.5b4 - MAC exact match address 14, part 2*/
619 u32 mac15addr1; /* 0x.5b8 - MAC exact match address 15, part 1*/
620 u32 mac15addr2; /* 0x.5bc - MAC exact match address 15, part 2*/
621 u8 res20[192];
622 struct rmon_mib rmon; /* 0x.680-0x.73c */
623 u32 rrej; /* 0x.740 - Receive filer rejected packet counter */
624 u8 res21[188];
625 u32 igaddr0; /* 0x.800 - Indivdual/Group address register 0*/
626 u32 igaddr1; /* 0x.804 - Indivdual/Group address register 1*/
627 u32 igaddr2; /* 0x.808 - Indivdual/Group address register 2*/
628 u32 igaddr3; /* 0x.80c - Indivdual/Group address register 3*/
629 u32 igaddr4; /* 0x.810 - Indivdual/Group address register 4*/
630 u32 igaddr5; /* 0x.814 - Indivdual/Group address register 5*/
631 u32 igaddr6; /* 0x.818 - Indivdual/Group address register 6*/
632 u32 igaddr7; /* 0x.81c - Indivdual/Group address register 7*/
446 u8 res22[96]; 633 u8 res22[96];
447 u32 gaddr0; /* 0x.880 - Global address register 0 */ 634 u32 gaddr0; /* 0x.880 - Group address register 0 */
448 u32 gaddr1; /* 0x.884 - Global address register 1 */ 635 u32 gaddr1; /* 0x.884 - Group address register 1 */
449 u32 gaddr2; /* 0x.888 - Global address register 2 */ 636 u32 gaddr2; /* 0x.888 - Group address register 2 */
450 u32 gaddr3; /* 0x.88c - Global address register 3 */ 637 u32 gaddr3; /* 0x.88c - Group address register 3 */
451 u32 gaddr4; /* 0x.890 - Global address register 4 */ 638 u32 gaddr4; /* 0x.890 - Group address register 4 */
452 u32 gaddr5; /* 0x.894 - Global address register 5 */ 639 u32 gaddr5; /* 0x.894 - Group address register 5 */
453 u32 gaddr6; /* 0x.898 - Global address register 6 */ 640 u32 gaddr6; /* 0x.898 - Group address register 6 */
454 u32 gaddr7; /* 0x.89c - Global address register 7 */ 641 u32 gaddr7; /* 0x.89c - Group address register 7 */
455 u8 res23[856]; 642 u8 res23a[352];
456 u32 attr; /* 0x.bf8 - Attributes Register */ 643 u32 fifocfg; /* 0x.a00 - FIFO interface config register */
457 u32 attreli; /* 0x.bfc - Attributes Extract Length and Extract Index Register */ 644 u8 res23b[252];
645 u8 res23c[248];
646 u32 attr; /* 0x.bf8 - Attributes Register */
647 u32 attreli; /* 0x.bfc - Attributes Extract Length and Extract Index Register */
458 u8 res24[1024]; 648 u8 res24[1024];
459 649
460}; 650};
@@ -496,6 +686,8 @@ struct gfar_private {
496 struct txbd8 *cur_tx; /* Next free ring entry */ 686 struct txbd8 *cur_tx; /* Next free ring entry */
497 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ 687 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */
498 struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ 688 struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */
689 u32 *hash_regs[16];
690 int hash_width;
499 struct gfar *phyregs; 691 struct gfar *phyregs;
500 struct work_struct tq; 692 struct work_struct tq;
501 struct timer_list phy_info_timer; 693 struct timer_list phy_info_timer;
@@ -506,9 +698,12 @@ struct gfar_private {
506 unsigned int rx_stash_size; 698 unsigned int rx_stash_size;
507 unsigned int tx_ring_size; 699 unsigned int tx_ring_size;
508 unsigned int rx_ring_size; 700 unsigned int rx_ring_size;
509 wait_queue_head_t rxcleanupq;
510 unsigned int rxclean;
511 701
702 unsigned char vlan_enable:1,
703 rx_csum_enable:1,
704 extended_hash:1;
705 unsigned short padding;
706 struct vlan_group *vlgrp;
512 /* Info structure initialized by board setup code */ 707 /* Info structure initialized by board setup code */
513 unsigned int interruptTransmit; 708 unsigned int interruptTransmit;
514 unsigned int interruptReceive; 709 unsigned int interruptReceive;
@@ -519,6 +714,8 @@ struct gfar_private {
519 int oldspeed; 714 int oldspeed;
520 int oldduplex; 715 int oldduplex;
521 int oldlink; 716 int oldlink;
717
718 uint32_t msg_enable;
522}; 719};
523 720
524extern inline u32 gfar_read(volatile unsigned *addr) 721extern inline u32 gfar_read(volatile unsigned *addr)
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 28046e9e88ba..a451de629197 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -46,16 +46,18 @@
46 46
47extern int startup_gfar(struct net_device *dev); 47extern int startup_gfar(struct net_device *dev);
48extern void stop_gfar(struct net_device *dev); 48extern void stop_gfar(struct net_device *dev);
49extern void gfar_receive(int irq, void *dev_id, struct pt_regs *regs); 49extern void gfar_halt(struct net_device *dev);
50extern void gfar_start(struct net_device *dev);
51extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
50 52
51void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, 53static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
52 u64 * buf); 54 u64 * buf);
53void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf); 55static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf);
54int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals); 56static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
55int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals); 57static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
56void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals); 58static void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
57int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals); 59static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
58void gfar_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo); 60static void gfar_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo);
59 61
60static char stat_gstrings[][ETH_GSTRING_LEN] = { 62static char stat_gstrings[][ETH_GSTRING_LEN] = {
61 "rx-dropped-by-kernel", 63 "rx-dropped-by-kernel",
@@ -118,57 +120,56 @@ static char stat_gstrings[][ETH_GSTRING_LEN] = {
118 "tx-fragmented-frames", 120 "tx-fragmented-frames",
119}; 121};
120 122
123/* Fill in a buffer with the strings which correspond to the
124 * stats */
125static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
126{
127 struct gfar_private *priv = netdev_priv(dev);
128
129 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
130 memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
131 else
132 memcpy(buf, stat_gstrings,
133 GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
134}
135
121/* Fill in an array of 64-bit statistics from various sources. 136/* Fill in an array of 64-bit statistics from various sources.
122 * This array will be appended to the end of the ethtool_stats 137 * This array will be appended to the end of the ethtool_stats
123 * structure, and returned to user space 138 * structure, and returned to user space
124 */ 139 */
125void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 * buf) 140static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 * buf)
126{ 141{
127 int i; 142 int i;
128 struct gfar_private *priv = netdev_priv(dev); 143 struct gfar_private *priv = netdev_priv(dev);
129 u32 *rmon = (u32 *) & priv->regs->rmon;
130 u64 *extra = (u64 *) & priv->extra_stats; 144 u64 *extra = (u64 *) & priv->extra_stats;
131 struct gfar_stats *stats = (struct gfar_stats *) buf;
132 145
133 for (i = 0; i < GFAR_RMON_LEN; i++) { 146 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
134 stats->rmon[i] = (u64) (rmon[i]); 147 u32 *rmon = (u32 *) & priv->regs->rmon;
135 } 148 struct gfar_stats *stats = (struct gfar_stats *) buf;
136
137 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) {
138 stats->extra[i] = extra[i];
139 }
140}
141 149
142/* Returns the number of stats (and their corresponding strings) */ 150 for (i = 0; i < GFAR_RMON_LEN; i++)
143int gfar_stats_count(struct net_device *dev) 151 stats->rmon[i] = (u64) (rmon[i]);
144{
145 return GFAR_STATS_LEN;
146}
147 152
148void gfar_gstrings_normon(struct net_device *dev, u32 stringset, u8 * buf) 153 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
149{ 154 stats->extra[i] = extra[i];
150 memcpy(buf, stat_gstrings, GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN); 155 } else
156 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
157 buf[i] = extra[i];
151} 158}
152 159
153void gfar_fill_stats_normon(struct net_device *dev, 160/* Returns the number of stats (and their corresponding strings) */
154 struct ethtool_stats *dummy, u64 * buf) 161static int gfar_stats_count(struct net_device *dev)
155{ 162{
156 int i;
157 struct gfar_private *priv = netdev_priv(dev); 163 struct gfar_private *priv = netdev_priv(dev);
158 u64 *extra = (u64 *) & priv->extra_stats;
159 164
160 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) { 165 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
161 buf[i] = extra[i]; 166 return GFAR_STATS_LEN;
162 } 167 else
168 return GFAR_EXTRA_STATS_LEN;
163} 169}
164 170
165
166int gfar_stats_count_normon(struct net_device *dev)
167{
168 return GFAR_EXTRA_STATS_LEN;
169}
170/* Fills in the drvinfo structure with some basic info */ 171/* Fills in the drvinfo structure with some basic info */
171void gfar_gdrvinfo(struct net_device *dev, struct 172static void gfar_gdrvinfo(struct net_device *dev, struct
172 ethtool_drvinfo *drvinfo) 173 ethtool_drvinfo *drvinfo)
173{ 174{
174 strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN); 175 strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN);
@@ -182,7 +183,7 @@ void gfar_gdrvinfo(struct net_device *dev, struct
182} 183}
183 184
184/* Return the current settings in the ethtool_cmd structure */ 185/* Return the current settings in the ethtool_cmd structure */
185int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) 186static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
186{ 187{
187 struct gfar_private *priv = netdev_priv(dev); 188 struct gfar_private *priv = netdev_priv(dev);
188 uint gigabit_support = 189 uint gigabit_support =
@@ -216,13 +217,13 @@ int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
216} 217}
217 218
218/* Return the length of the register structure */ 219/* Return the length of the register structure */
219int gfar_reglen(struct net_device *dev) 220static int gfar_reglen(struct net_device *dev)
220{ 221{
221 return sizeof (struct gfar); 222 return sizeof (struct gfar);
222} 223}
223 224
224/* Return a dump of the GFAR register space */ 225/* Return a dump of the GFAR register space */
225void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf) 226static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf)
226{ 227{
227 int i; 228 int i;
228 struct gfar_private *priv = netdev_priv(dev); 229 struct gfar_private *priv = netdev_priv(dev);
@@ -233,13 +234,6 @@ void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regb
233 buf[i] = theregs[i]; 234 buf[i] = theregs[i];
234} 235}
235 236
236/* Fill in a buffer with the strings which correspond to the
237 * stats */
238void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
239{
240 memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
241}
242
243/* Convert microseconds to ethernet clock ticks, which changes 237/* Convert microseconds to ethernet clock ticks, which changes
244 * depending on what speed the controller is running at */ 238 * depending on what speed the controller is running at */
245static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int usecs) 239static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int usecs)
@@ -291,9 +285,12 @@ static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int tic
291 285
292/* Get the coalescing parameters, and put them in the cvals 286/* Get the coalescing parameters, and put them in the cvals
293 * structure. */ 287 * structure. */
294int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals) 288static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
295{ 289{
296 struct gfar_private *priv = netdev_priv(dev); 290 struct gfar_private *priv = netdev_priv(dev);
291
292 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
293 return -EOPNOTSUPP;
297 294
298 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); 295 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime);
299 cvals->rx_max_coalesced_frames = priv->rxcount; 296 cvals->rx_max_coalesced_frames = priv->rxcount;
@@ -337,10 +334,13 @@ int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
337 * Both cvals->*_usecs and cvals->*_frames have to be > 0 334 * Both cvals->*_usecs and cvals->*_frames have to be > 0
338 * in order for coalescing to be active 335 * in order for coalescing to be active
339 */ 336 */
340int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals) 337static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
341{ 338{
342 struct gfar_private *priv = netdev_priv(dev); 339 struct gfar_private *priv = netdev_priv(dev);
343 340
341 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
342 return -EOPNOTSUPP;
343
344 /* Set up rx coalescing */ 344 /* Set up rx coalescing */
345 if ((cvals->rx_coalesce_usecs == 0) || 345 if ((cvals->rx_coalesce_usecs == 0) ||
346 (cvals->rx_max_coalesced_frames == 0)) 346 (cvals->rx_max_coalesced_frames == 0))
@@ -379,7 +379,7 @@ int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
379/* Fills in rvals with the current ring parameters. Currently, 379/* Fills in rvals with the current ring parameters. Currently,
380 * rx, rx_mini, and rx_jumbo rings are the same size, as mini and 380 * rx, rx_mini, and rx_jumbo rings are the same size, as mini and
381 * jumbo are ignored by the driver */ 381 * jumbo are ignored by the driver */
382void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals) 382static void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
383{ 383{
384 struct gfar_private *priv = netdev_priv(dev); 384 struct gfar_private *priv = netdev_priv(dev);
385 385
@@ -401,9 +401,8 @@ void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
401 * necessary so that we don't mess things up while we're in 401 * necessary so that we don't mess things up while we're in
402 * motion. We wait for the ring to be clean before reallocating 402 * motion. We wait for the ring to be clean before reallocating
403 * the rings. */ 403 * the rings. */
404int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals) 404static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
405{ 405{
406 u32 tempval;
407 struct gfar_private *priv = netdev_priv(dev); 406 struct gfar_private *priv = netdev_priv(dev);
408 int err = 0; 407 int err = 0;
409 408
@@ -425,37 +424,54 @@ int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
425 return -EINVAL; 424 return -EINVAL;
426 } 425 }
427 426
428 /* Stop the controller so we don't rx any more frames */ 427 if (dev->flags & IFF_UP) {
429 /* But first, make sure we clear the bits */ 428 unsigned long flags;
430 tempval = gfar_read(&priv->regs->dmactrl);
431 tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
432 gfar_write(&priv->regs->dmactrl, tempval);
433 429
434 tempval = gfar_read(&priv->regs->dmactrl); 430 /* Halt TX and RX, and process the frames which
435 tempval |= (DMACTRL_GRS | DMACTRL_GTS); 431 * have already been received */
436 gfar_write(&priv->regs->dmactrl, tempval); 432 spin_lock_irqsave(&priv->lock, flags);
433 gfar_halt(dev);
434 gfar_clean_rx_ring(dev, priv->rx_ring_size);
435 spin_unlock_irqrestore(&priv->lock, flags);
437 436
438 while (!(gfar_read(&priv->regs->ievent) & (IEVENT_GRSC | IEVENT_GTSC))) 437 /* Now we take down the rings to rebuild them */
439 cpu_relax(); 438 stop_gfar(dev);
439 }
440 440
441 /* Note that rx is not clean right now */ 441 /* Change the size */
442 priv->rxclean = 0; 442 priv->rx_ring_size = rvals->rx_pending;
443 priv->tx_ring_size = rvals->tx_pending;
443 444
444 if (dev->flags & IFF_UP) { 445 /* Rebuild the rings with the new size */
445 /* Tell the driver to process the rest of the frames */ 446 if (dev->flags & IFF_UP)
446 gfar_receive(0, (void *) dev, NULL); 447 err = startup_gfar(dev);
447 448
448 /* Now wait for it to be done */ 449 return err;
449 wait_event_interruptible(priv->rxcleanupq, priv->rxclean); 450}
450 451
451 /* Ok, all packets have been handled. Now we bring it down, 452static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
452 * change the ring size, and bring it up */ 453{
454 struct gfar_private *priv = netdev_priv(dev);
455 int err = 0;
453 456
457 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
458 return -EOPNOTSUPP;
459
460 if (dev->flags & IFF_UP) {
461 unsigned long flags;
462
463 /* Halt TX and RX, and process the frames which
464 * have already been received */
465 spin_lock_irqsave(&priv->lock, flags);
466 gfar_halt(dev);
467 gfar_clean_rx_ring(dev, priv->rx_ring_size);
468 spin_unlock_irqrestore(&priv->lock, flags);
469
470 /* Now we take down the rings to rebuild them */
454 stop_gfar(dev); 471 stop_gfar(dev);
455 } 472 }
456 473
457 priv->rx_ring_size = rvals->rx_pending; 474 priv->rx_csum_enable = data;
458 priv->tx_ring_size = rvals->tx_pending;
459 475
460 if (dev->flags & IFF_UP) 476 if (dev->flags & IFF_UP)
461 err = startup_gfar(dev); 477 err = startup_gfar(dev);
@@ -463,6 +479,61 @@ int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
463 return err; 479 return err;
464} 480}
465 481
482static uint32_t gfar_get_rx_csum(struct net_device *dev)
483{
484 struct gfar_private *priv = netdev_priv(dev);
485
486 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
487 return 0;
488
489 return priv->rx_csum_enable;
490}
491
492static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
493{
494 unsigned long flags;
495 struct gfar_private *priv = netdev_priv(dev);
496
497 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
498 return -EOPNOTSUPP;
499
500 spin_lock_irqsave(&priv->lock, flags);
501 gfar_halt(dev);
502
503 if (data)
504 dev->features |= NETIF_F_IP_CSUM;
505 else
506 dev->features &= ~NETIF_F_IP_CSUM;
507
508 gfar_start(dev);
509 spin_unlock_irqrestore(&priv->lock, flags);
510
511 return 0;
512}
513
514static uint32_t gfar_get_tx_csum(struct net_device *dev)
515{
516 struct gfar_private *priv = netdev_priv(dev);
517
518 if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
519 return 0;
520
521 return (dev->features & NETIF_F_IP_CSUM) != 0;
522}
523
524static uint32_t gfar_get_msglevel(struct net_device *dev)
525{
526 struct gfar_private *priv = netdev_priv(dev);
527 return priv->msg_enable;
528}
529
530static void gfar_set_msglevel(struct net_device *dev, uint32_t data)
531{
532 struct gfar_private *priv = netdev_priv(dev);
533 priv->msg_enable = data;
534}
535
536
466struct ethtool_ops gfar_ethtool_ops = { 537struct ethtool_ops gfar_ethtool_ops = {
467 .get_settings = gfar_gsettings, 538 .get_settings = gfar_gsettings,
468 .get_drvinfo = gfar_gdrvinfo, 539 .get_drvinfo = gfar_gdrvinfo,
@@ -476,52 +547,10 @@ struct ethtool_ops gfar_ethtool_ops = {
476 .get_strings = gfar_gstrings, 547 .get_strings = gfar_gstrings,
477 .get_stats_count = gfar_stats_count, 548 .get_stats_count = gfar_stats_count,
478 .get_ethtool_stats = gfar_fill_stats, 549 .get_ethtool_stats = gfar_fill_stats,
479}; 550 .get_rx_csum = gfar_get_rx_csum,
480 551 .get_tx_csum = gfar_get_tx_csum,
481struct ethtool_ops gfar_normon_nocoalesce_ethtool_ops = { 552 .set_rx_csum = gfar_set_rx_csum,
482 .get_settings = gfar_gsettings, 553 .set_tx_csum = gfar_set_tx_csum,
483 .get_drvinfo = gfar_gdrvinfo, 554 .get_msglevel = gfar_get_msglevel,
484 .get_regs_len = gfar_reglen, 555 .set_msglevel = gfar_set_msglevel,
485 .get_regs = gfar_get_regs,
486 .get_link = ethtool_op_get_link,
487 .get_ringparam = gfar_gringparam,
488 .set_ringparam = gfar_sringparam,
489 .get_strings = gfar_gstrings_normon,
490 .get_stats_count = gfar_stats_count_normon,
491 .get_ethtool_stats = gfar_fill_stats_normon,
492};
493
494struct ethtool_ops gfar_nocoalesce_ethtool_ops = {
495 .get_settings = gfar_gsettings,
496 .get_drvinfo = gfar_gdrvinfo,
497 .get_regs_len = gfar_reglen,
498 .get_regs = gfar_get_regs,
499 .get_link = ethtool_op_get_link,
500 .get_ringparam = gfar_gringparam,
501 .set_ringparam = gfar_sringparam,
502 .get_strings = gfar_gstrings,
503 .get_stats_count = gfar_stats_count,
504 .get_ethtool_stats = gfar_fill_stats,
505};
506
507struct ethtool_ops gfar_normon_ethtool_ops = {
508 .get_settings = gfar_gsettings,
509 .get_drvinfo = gfar_gdrvinfo,
510 .get_regs_len = gfar_reglen,
511 .get_regs = gfar_get_regs,
512 .get_link = ethtool_op_get_link,
513 .get_coalesce = gfar_gcoalesce,
514 .set_coalesce = gfar_scoalesce,
515 .get_ringparam = gfar_gringparam,
516 .set_ringparam = gfar_sringparam,
517 .get_strings = gfar_gstrings_normon,
518 .get_stats_count = gfar_stats_count_normon,
519 .get_ethtool_stats = gfar_fill_stats_normon,
520};
521
522struct ethtool_ops *gfar_op_array[] = {
523 &gfar_ethtool_ops,
524 &gfar_normon_ethtool_ops,
525 &gfar_nocoalesce_ethtool_ops,
526 &gfar_normon_nocoalesce_ethtool_ops
527}; 556};
diff --git a/drivers/net/gianfar_phy.c b/drivers/net/gianfar_phy.c
index 02b16abc89bd..7c965f268a82 100644
--- a/drivers/net/gianfar_phy.c
+++ b/drivers/net/gianfar_phy.c
@@ -572,7 +572,7 @@ static struct phy_info phy_info_dm9161 = {
572static struct phy_info phy_info_marvell = { 572static struct phy_info phy_info_marvell = {
573 .phy_id = 0x01410c00, 573 .phy_id = 0x01410c00,
574 .phy_id_mask = 0xffffff00, 574 .phy_id_mask = 0xffffff00,
575 .name = "Marvell 88E1101", 575 .name = "Marvell 88E1101/88E1111",
576 .features = MII_GBIT_FEATURES, 576 .features = MII_GBIT_FEATURES,
577 .config_aneg = &marvell_config_aneg, 577 .config_aneg = &marvell_config_aneg,
578 .read_status = &marvell_read_status, 578 .read_status = &marvell_read_status,
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 3d96714ed3cf..d9df1d9a5739 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -1149,7 +1149,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
1149 skb->dev = dev; /* Mark as being used by this device. */ 1149 skb->dev = dev; /* Mark as being used by this device. */
1150 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1150 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1151 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1151 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1152 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1152 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1153 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | 1153 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn |
1154 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); 1154 DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2));
1155 } 1155 }
@@ -1210,7 +1210,7 @@ static void hamachi_init_ring(struct net_device *dev)
1210 skb->dev = dev; /* Mark as being used by this device. */ 1210 skb->dev = dev; /* Mark as being used by this device. */
1211 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1211 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1212 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1212 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1213 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1213 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1214 /* -2 because it doesn't REALLY have that first 2 bytes -KDU */ 1214 /* -2 because it doesn't REALLY have that first 2 bytes -KDU */
1215 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | 1215 hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn |
1216 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); 1216 DescEndPacket | DescIntr | (hmp->rx_buf_sz -2));
@@ -1509,7 +1509,7 @@ static int hamachi_rx(struct net_device *dev)
1509 desc->addr, 1509 desc->addr,
1510 hmp->rx_buf_sz, 1510 hmp->rx_buf_sz,
1511 PCI_DMA_FROMDEVICE); 1511 PCI_DMA_FROMDEVICE);
1512 buf_addr = (u8 *) hmp->rx_skbuff[entry]->tail; 1512 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
1513 frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); 1513 frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12])));
1514 if (hamachi_debug > 4) 1514 if (hamachi_debug > 4)
1515 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", 1515 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n",
@@ -1678,7 +1678,7 @@ static int hamachi_rx(struct net_device *dev)
1678 skb->dev = dev; /* Mark as being used by this device. */ 1678 skb->dev = dev; /* Mark as being used by this device. */
1679 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1679 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1680 desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, 1680 desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
1681 skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1681 skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1682 } 1682 }
1683 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); 1683 desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz);
1684 if (entry >= RX_RING_SIZE-1) 1684 if (entry >= RX_RING_SIZE-1)
@@ -1772,9 +1772,9 @@ static int hamachi_close(struct net_device *dev)
1772 readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', 1772 readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ',
1773 i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); 1773 i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr);
1774 if (hamachi_debug > 6) { 1774 if (hamachi_debug > 6) {
1775 if (*(u8*)hmp->rx_skbuff[i]->tail != 0x69) { 1775 if (*(u8*)hmp->rx_skbuff[i]->data != 0x69) {
1776 u16 *addr = (u16 *) 1776 u16 *addr = (u16 *)
1777 hmp->rx_skbuff[i]->tail; 1777 hmp->rx_skbuff[i]->data;
1778 int j; 1778 int j;
1779 1779
1780 for (j = 0; j < 0x50; j++) 1780 for (j = 0; j < 0x50; j++)
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 89454915b857..0b230222bfea 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -130,12 +130,11 @@ struct sixpack {
130 130
131#define AX25_6PACK_HEADER_LEN 0 131#define AX25_6PACK_HEADER_LEN 0
132 132
133static void sp_start_tx_timer(struct sixpack *);
134static void sixpack_decode(struct sixpack *, unsigned char[], int); 133static void sixpack_decode(struct sixpack *, unsigned char[], int);
135static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); 134static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
136 135
137/* 136/*
138 * perform the persistence/slottime algorithm for CSMA access. If the 137 * Perform the persistence/slottime algorithm for CSMA access. If the
139 * persistence check was successful, write the data to the serial driver. 138 * persistence check was successful, write the data to the serial driver.
140 * Note that in case of DAMA operation, the data is not sent here. 139 * Note that in case of DAMA operation, the data is not sent here.
141 */ 140 */
@@ -143,7 +142,7 @@ static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
143static void sp_xmit_on_air(unsigned long channel) 142static void sp_xmit_on_air(unsigned long channel)
144{ 143{
145 struct sixpack *sp = (struct sixpack *) channel; 144 struct sixpack *sp = (struct sixpack *) channel;
146 int actual; 145 int actual, when = sp->slottime;
147 static unsigned char random; 146 static unsigned char random;
148 147
149 random = random * 17 + 41; 148 random = random * 17 + 41;
@@ -159,20 +158,10 @@ static void sp_xmit_on_air(unsigned long channel)
159 sp->tty->driver->write(sp->tty, &sp->led_state, 1); 158 sp->tty->driver->write(sp->tty, &sp->led_state, 1);
160 sp->status2 = 0; 159 sp->status2 = 0;
161 } else 160 } else
162 sp_start_tx_timer(sp); 161 mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);
163} 162}
164 163
165/* ----> 6pack timer interrupt handler and friends. <---- */ 164/* ----> 6pack timer interrupt handler and friends. <---- */
166static void sp_start_tx_timer(struct sixpack *sp)
167{
168 int when = sp->slottime;
169
170 del_timer(&sp->tx_t);
171 sp->tx_t.data = (unsigned long) sp;
172 sp->tx_t.function = sp_xmit_on_air;
173 sp->tx_t.expires = jiffies + ((when + 1) * HZ) / 100;
174 add_timer(&sp->tx_t);
175}
176 165
177/* Encapsulate one AX.25 frame and stuff into a TTY queue. */ 166/* Encapsulate one AX.25 frame and stuff into a TTY queue. */
178static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) 167static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
@@ -243,8 +232,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
243 sp->xleft = count; 232 sp->xleft = count;
244 sp->xhead = sp->xbuff; 233 sp->xhead = sp->xbuff;
245 sp->status2 = count; 234 sp->status2 = count;
246 if (sp->duplex == 0) 235 sp_xmit_on_air((unsigned long)sp);
247 sp_start_tx_timer(sp);
248 } 236 }
249 237
250 return; 238 return;
@@ -320,12 +308,6 @@ static int sp_set_mac_address(struct net_device *dev, void *addr)
320{ 308{
321 struct sockaddr_ax25 *sa = addr; 309 struct sockaddr_ax25 *sa = addr;
322 310
323 if (sa->sax25_family != AF_AX25)
324 return -EINVAL;
325
326 if (!sa->sax25_ndigis)
327 return -EINVAL;
328
329 spin_lock_irq(&dev->xmit_lock); 311 spin_lock_irq(&dev->xmit_lock);
330 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); 312 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
331 spin_unlock_irq(&dev->xmit_lock); 313 spin_unlock_irq(&dev->xmit_lock);
@@ -680,6 +662,9 @@ static int sixpack_open(struct tty_struct *tty)
680 netif_start_queue(dev); 662 netif_start_queue(dev);
681 663
682 init_timer(&sp->tx_t); 664 init_timer(&sp->tx_t);
665 sp->tx_t.function = sp_xmit_on_air;
666 sp->tx_t.data = (unsigned long) sp;
667
683 init_timer(&sp->resync_t); 668 init_timer(&sp->resync_t);
684 669
685 spin_unlock_bh(&sp->lock); 670 spin_unlock_bh(&sp->lock);
@@ -848,7 +833,7 @@ static void __exit sixpack_exit_driver(void)
848{ 833{
849 int ret; 834 int ret;
850 835
851 if ((ret = tty_register_ldisc(N_6PACK, NULL))) 836 if ((ret = tty_unregister_ldisc(N_6PACK)))
852 printk(msg_unregfail, ret); 837 printk(msg_unregfail, ret);
853} 838}
854 839
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index 7cdebe1a0b61..0cd54306e636 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -17,7 +17,7 @@ config MKISS
17 17
18config 6PACK 18config 6PACK
19 tristate "Serial port 6PACK driver" 19 tristate "Serial port 6PACK driver"
20 depends on AX25 && BROKEN_ON_SMP 20 depends on AX25
21 ---help--- 21 ---help---
22 6pack is a transmission protocol for the data exchange between your 22 6pack is a transmission protocol for the data exchange between your
23 PC and your TNC (the Terminal Node Controller acts as a kind of 23 PC and your TNC (the Terminal Node Controller acts as a kind of
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 62790511098f..3035422f5ad8 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -934,7 +934,7 @@ static void __exit mkiss_exit_driver(void)
934 kfree(ax25_ctrls); 934 kfree(ax25_ctrls);
935 ax25_ctrls = NULL; 935 ax25_ctrls = NULL;
936 936
937 if ((i = tty_register_ldisc(N_AX25, NULL))) 937 if ((i = tty_unregister_ldisc(N_AX25)))
938 printk(KERN_ERR "mkiss: can't unregister line discipline (err = %d)\n", i); 938 printk(KERN_ERR "mkiss: can't unregister line discipline (err = %d)\n", i);
939} 939}
940 940
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index ece1b1a13186..c27e417f32bf 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -304,7 +304,7 @@ static inline void scc_discard_buffers(struct scc_channel *scc)
304 scc->tx_buff = NULL; 304 scc->tx_buff = NULL;
305 } 305 }
306 306
307 while (skb_queue_len(&scc->tx_queue)) 307 while (!skb_queue_empty(&scc->tx_queue))
308 dev_kfree_skb(skb_dequeue(&scc->tx_queue)); 308 dev_kfree_skb(skb_dequeue(&scc->tx_queue));
309 309
310 spin_unlock_irqrestore(&scc->lock, flags); 310 spin_unlock_irqrestore(&scc->lock, flags);
@@ -1126,8 +1126,7 @@ static void t_dwait(unsigned long channel)
1126 1126
1127 if (scc->stat.tx_state == TXS_WAIT) /* maxkeyup or idle timeout */ 1127 if (scc->stat.tx_state == TXS_WAIT) /* maxkeyup or idle timeout */
1128 { 1128 {
1129 if (skb_queue_len(&scc->tx_queue) == 0) /* nothing to send */ 1129 if (skb_queue_empty(&scc->tx_queue)) { /* nothing to send */
1130 {
1131 scc->stat.tx_state = TXS_IDLE; 1130 scc->stat.tx_state = TXS_IDLE;
1132 netif_wake_queue(scc->dev); /* t_maxkeyup locked it. */ 1131 netif_wake_queue(scc->dev); /* t_maxkeyup locked it. */
1133 return; 1132 return;
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 4834314b676d..0abf5dd08b4c 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -159,12 +159,7 @@ struct net_device * __init hp_plus_probe(int unit)
159 err = do_hpp_probe(dev); 159 err = do_hpp_probe(dev);
160 if (err) 160 if (err)
161 goto out; 161 goto out;
162 err = register_netdev(dev);
163 if (err)
164 goto out1;
165 return dev; 162 return dev;
166out1:
167 cleanup_card(dev);
168out: 163out:
169 free_netdev(dev); 164 free_netdev(dev);
170 return ERR_PTR(err); 165 return ERR_PTR(err);
@@ -271,6 +266,9 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
271 /* Leave the 8390 and HP chip reset. */ 266 /* Leave the 8390 and HP chip reset. */
272 outw(inw(ioaddr + HPP_OPTION) & ~EnableIRQ, ioaddr + HPP_OPTION); 267 outw(inw(ioaddr + HPP_OPTION) & ~EnableIRQ, ioaddr + HPP_OPTION);
273 268
269 retval = register_netdev(dev);
270 if (retval)
271 goto out;
274 return 0; 272 return 0;
275out: 273out:
276 release_region(ioaddr, HP_IO_EXTENT); 274 release_region(ioaddr, HP_IO_EXTENT);
@@ -463,11 +461,8 @@ init_module(void)
463 dev->irq = irq[this_dev]; 461 dev->irq = irq[this_dev];
464 dev->base_addr = io[this_dev]; 462 dev->base_addr = io[this_dev];
465 if (do_hpp_probe(dev) == 0) { 463 if (do_hpp_probe(dev) == 0) {
466 if (register_netdev(dev) == 0) { 464 dev_hpp[found++] = dev;
467 dev_hpp[found++] = dev; 465 continue;
468 continue;
469 }
470 cleanup_card(dev);
471 } 466 }
472 free_netdev(dev); 467 free_netdev(dev);
473 printk(KERN_WARNING "hp-plus.c: No HP-Plus card found (i/o = 0x%x).\n", io[this_dev]); 468 printk(KERN_WARNING "hp-plus.c: No HP-Plus card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index 026888611d6f..59cf841b14ab 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -123,12 +123,7 @@ struct net_device * __init hp_probe(int unit)
123 err = do_hp_probe(dev); 123 err = do_hp_probe(dev);
124 if (err) 124 if (err)
125 goto out; 125 goto out;
126 err = register_netdev(dev);
127 if (err)
128 goto out1;
129 return dev; 126 return dev;
130out1:
131 cleanup_card(dev);
132out: 127out:
133 free_netdev(dev); 128 free_netdev(dev);
134 return ERR_PTR(err); 129 return ERR_PTR(err);
@@ -227,7 +222,12 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
227 ei_status.block_output = &hp_block_output; 222 ei_status.block_output = &hp_block_output;
228 hp_init_card(dev); 223 hp_init_card(dev);
229 224
225 retval = register_netdev(dev);
226 if (retval)
227 goto out1;
230 return 0; 228 return 0;
229out1:
230 free_irq(dev->irq, dev);
231out: 231out:
232 release_region(ioaddr, HP_IO_EXTENT); 232 release_region(ioaddr, HP_IO_EXTENT);
233 return retval; 233 return retval;
@@ -432,11 +432,8 @@ init_module(void)
432 dev->irq = irq[this_dev]; 432 dev->irq = irq[this_dev];
433 dev->base_addr = io[this_dev]; 433 dev->base_addr = io[this_dev];
434 if (do_hp_probe(dev) == 0) { 434 if (do_hp_probe(dev) == 0) {
435 if (register_netdev(dev) == 0) { 435 dev_hp[found++] = dev;
436 dev_hp[found++] = dev; 436 continue;
437 continue;
438 }
439 cleanup_card(dev);
440 } 437 }
441 free_netdev(dev); 438 free_netdev(dev);
442 printk(KERN_WARNING "hp.c: No HP card found (i/o = 0x%x).\n", io[this_dev]); 439 printk(KERN_WARNING "hp.c: No HP card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index b3a898c5a585..cf0ac6fda1a1 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -106,6 +106,7 @@
106#include <linux/interrupt.h> 106#include <linux/interrupt.h>
107#include <linux/eisa.h> 107#include <linux/eisa.h>
108#include <linux/pci.h> 108#include <linux/pci.h>
109#include <linux/dma-mapping.h>
109#include <linux/spinlock.h> 110#include <linux/spinlock.h>
110#include <linux/netdevice.h> 111#include <linux/netdevice.h>
111#include <linux/etherdevice.h> 112#include <linux/etherdevice.h>
@@ -417,12 +418,7 @@ struct net_device * __init hp100_probe(int unit)
417 if (err) 418 if (err)
418 goto out; 419 goto out;
419 420
420 err = register_netdev(dev);
421 if (err)
422 goto out1;
423 return dev; 421 return dev;
424 out1:
425 release_region(dev->base_addr, HP100_REGION_SIZE);
426 out: 422 out:
427 free_netdev(dev); 423 free_netdev(dev);
428 return ERR_PTR(err); 424 return ERR_PTR(err);
@@ -562,7 +558,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
562 * Also, we can have EISA Busmaster cards (not tested), 558 * Also, we can have EISA Busmaster cards (not tested),
563 * so beware !!! - Jean II */ 559 * so beware !!! - Jean II */
564 if((bus == HP100_BUS_PCI) && 560 if((bus == HP100_BUS_PCI) &&
565 (pci_set_dma_mask(pci_dev, 0xffffffff))) { 561 (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK))) {
566 /* Gracefully fallback to shared memory */ 562 /* Gracefully fallback to shared memory */
567 goto busmasterfail; 563 goto busmasterfail;
568 } 564 }
@@ -776,11 +772,22 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
776 printk("Warning! Link down.\n"); 772 printk("Warning! Link down.\n");
777 } 773 }
778 774
775 err = register_netdev(dev);
776 if (err)
777 goto out3;
778
779 return 0; 779 return 0;
780out3:
781 if (local_mode == 1)
782 pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f,
783 lp->page_vaddr_algn,
784 virt_to_whatever(dev, lp->page_vaddr_algn));
785 if (mem_ptr_virt)
786 iounmap(mem_ptr_virt);
780out2: 787out2:
781 release_region(ioaddr, HP100_REGION_SIZE); 788 release_region(ioaddr, HP100_REGION_SIZE);
782out1: 789out1:
783 return -ENODEV; 790 return err;
784} 791}
785 792
786/* This procedure puts the card into a stable init state */ 793/* This procedure puts the card into a stable init state */
@@ -2875,18 +2882,12 @@ static int __init hp100_eisa_probe (struct device *gendev)
2875 if (err) 2882 if (err)
2876 goto out1; 2883 goto out1;
2877 2884
2878 err = register_netdev(dev);
2879 if (err)
2880 goto out2;
2881
2882#ifdef HP100_DEBUG 2885#ifdef HP100_DEBUG
2883 printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, 2886 printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name,
2884 dev->base_addr); 2887 dev->base_addr);
2885#endif 2888#endif
2886 gendev->driver_data = dev; 2889 gendev->driver_data = dev;
2887 return 0; 2890 return 0;
2888 out2:
2889 release_region(dev->base_addr, HP100_REGION_SIZE);
2890 out1: 2891 out1:
2891 free_netdev(dev); 2892 free_netdev(dev);
2892 return err; 2893 return err;
@@ -2951,17 +2952,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev,
2951 err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); 2952 err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev);
2952 if (err) 2953 if (err)
2953 goto out1; 2954 goto out1;
2954 err = register_netdev(dev);
2955 if (err)
2956 goto out2;
2957 2955
2958#ifdef HP100_DEBUG 2956#ifdef HP100_DEBUG
2959 printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); 2957 printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr);
2960#endif 2958#endif
2961 pci_set_drvdata(pdev, dev); 2959 pci_set_drvdata(pdev, dev);
2962 return 0; 2960 return 0;
2963 out2:
2964 release_region(dev->base_addr, HP100_REGION_SIZE);
2965 out1: 2961 out1:
2966 free_netdev(dev); 2962 free_netdev(dev);
2967 out0: 2963 out0:
@@ -3032,15 +3028,9 @@ static int __init hp100_isa_init(void)
3032 SET_MODULE_OWNER(dev); 3028 SET_MODULE_OWNER(dev);
3033 3029
3034 err = hp100_isa_probe(dev, hp100_port[i]); 3030 err = hp100_isa_probe(dev, hp100_port[i]);
3035 if (!err) { 3031 if (!err)
3036 err = register_netdev(dev); 3032 hp100_devlist[cards++] = dev;
3037 if (!err) 3033 else
3038 hp100_devlist[cards++] = dev;
3039 else
3040 release_region(dev->base_addr, HP100_REGION_SIZE);
3041 }
3042
3043 if (err)
3044 free_netdev(dev); 3034 free_netdev(dev);
3045 } 3035 }
3046 3036
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 6482d994d489..0de3bb906174 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -1253,7 +1253,7 @@ static int emac_init_tah(struct ocp_enet_private *fep)
1253 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP | 1253 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP |
1254 TAH_MR_DIG); 1254 TAH_MR_DIG);
1255 1255
1256 iounmap(&tahp); 1256 iounmap(tahp);
1257 1257
1258 return 0; 1258 return 0;
1259} 1259}
@@ -1712,11 +1712,10 @@ struct mal_commac_ops emac_commac_ops = {
1712}; 1712};
1713 1713
1714#ifdef CONFIG_NET_POLL_CONTROLLER 1714#ifdef CONFIG_NET_POLL_CONTROLLER
1715static int emac_netpoll(struct net_device *ndev) 1715static void emac_netpoll(struct net_device *ndev)
1716{ 1716{
1717 emac_rxeob_dev((void *)ndev, 0); 1717 emac_rxeob_dev((void *)ndev, 0);
1718 emac_txeob_dev((void *)ndev, 0); 1718 emac_txeob_dev((void *)ndev, 0);
1719 return 0;
1720} 1719}
1721#endif 1720#endif
1722 1721
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index d520b5920d6c..49e5467bdd73 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -499,7 +499,7 @@ static int ioc3_mdio_read(struct net_device *dev, int phy, int reg)
499 ioc3_w_micr((phy << MICR_PHYADDR_SHIFT) | reg | MICR_READTRIG); 499 ioc3_w_micr((phy << MICR_PHYADDR_SHIFT) | reg | MICR_READTRIG);
500 while (ioc3_r_micr() & MICR_BUSY); 500 while (ioc3_r_micr() & MICR_BUSY);
501 501
502 return ioc3_r_micr() & MIDR_DATA_MASK; 502 return ioc3_r_midr_r() & MIDR_DATA_MASK;
503} 503}
504 504
505static void ioc3_mdio_write(struct net_device *dev, int phy, int reg, int data) 505static void ioc3_mdio_write(struct net_device *dev, int phy, int reg, int data)
@@ -1291,7 +1291,6 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1291 dev->features = NETIF_F_IP_CSUM; 1291 dev->features = NETIF_F_IP_CSUM;
1292#endif 1292#endif
1293 1293
1294 ioc3_setup_duplex(ip);
1295 sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1); 1294 sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1);
1296 sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2); 1295 sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2);
1297 1296
@@ -1300,6 +1299,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1300 goto out_stop; 1299 goto out_stop;
1301 1300
1302 mii_check_media(&ip->mii, 1, 1); 1301 mii_check_media(&ip->mii, 1, 1);
1302 ioc3_setup_duplex(ip);
1303 1303
1304 vendor = (sw_physid1 << 12) | (sw_physid2 >> 4); 1304 vendor = (sw_physid1 << 12) | (sw_physid2 >> 4);
1305 model = (sw_physid2 >> 4) & 0x3f; 1305 model = (sw_physid2 >> 4) & 0x3f;
@@ -1524,7 +1524,7 @@ static void ioc3_get_drvinfo (struct net_device *dev,
1524 struct ethtool_drvinfo *info) 1524 struct ethtool_drvinfo *info)
1525{ 1525{
1526 struct ioc3_private *ip = netdev_priv(dev); 1526 struct ioc3_private *ip = netdev_priv(dev);
1527 1527
1528 strcpy (info->driver, IOC3_NAME); 1528 strcpy (info->driver, IOC3_NAME);
1529 strcpy (info->version, IOC3_VERSION); 1529 strcpy (info->version, IOC3_VERSION);
1530 strcpy (info->bus_info, pci_name(ip->pdev)); 1530 strcpy (info->bus_info, pci_name(ip->pdev));
@@ -1550,7 +1550,7 @@ static int ioc3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1550 spin_lock_irq(&ip->ioc3_lock); 1550 spin_lock_irq(&ip->ioc3_lock);
1551 rc = mii_ethtool_sset(&ip->mii, cmd); 1551 rc = mii_ethtool_sset(&ip->mii, cmd);
1552 spin_unlock_irq(&ip->ioc3_lock); 1552 spin_unlock_irq(&ip->ioc3_lock);
1553 1553
1554 return rc; 1554 return rc;
1555} 1555}
1556 1556
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 7d23aa375908..b8d112348ba4 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -626,7 +626,7 @@ static void __exit irtty_sir_cleanup(void)
626{ 626{
627 int err; 627 int err;
628 628
629 if ((err = tty_register_ldisc(N_IRDA, NULL))) { 629 if ((err = tty_unregister_ldisc(N_IRDA))) {
630 IRDA_ERROR("%s(), can't unregister line discipline (err = %d)\n", 630 IRDA_ERROR("%s(), can't unregister line discipline (err = %d)\n",
631 __FUNCTION__, err); 631 __FUNCTION__, err);
632 } 632 }
diff --git a/drivers/net/irda/sir_kthread.c b/drivers/net/irda/sir_kthread.c
index 18cea1099530..c65054364bca 100644
--- a/drivers/net/irda/sir_kthread.c
+++ b/drivers/net/irda/sir_kthread.c
@@ -135,8 +135,7 @@ static int irda_thread(void *startup)
135 remove_wait_queue(&irda_rq_queue.kick, &wait); 135 remove_wait_queue(&irda_rq_queue.kick, &wait);
136 136
137 /* make swsusp happy with our thread */ 137 /* make swsusp happy with our thread */
138 if (current->flags & PF_FREEZE) 138 try_to_freeze();
139 refrigerator(PF_FREEZE);
140 139
141 run_irda_queue(); 140 run_irda_queue();
142 } 141 }
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 66f488c13717..15f207323d97 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -763,7 +763,7 @@ static int stir_transmit_thread(void *arg)
763 { 763 {
764#ifdef CONFIG_PM 764#ifdef CONFIG_PM
765 /* if suspending, then power off and wait */ 765 /* if suspending, then power off and wait */
766 if (unlikely(current->flags & PF_FREEZE)) { 766 if (unlikely(freezing(current))) {
767 if (stir->receiving) 767 if (stir->receiving)
768 receive_stop(stir); 768 receive_stop(stir);
769 else 769 else
@@ -771,7 +771,7 @@ static int stir_transmit_thread(void *arg)
771 771
772 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD); 772 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
773 773
774 refrigerator(PF_FREEZE); 774 refrigerator();
775 775
776 if (change_speed(stir, stir->speed)) 776 if (change_speed(stir, stir->speed))
777 break; 777 break;
diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c
index 50bebb55e9ee..88ae8a04fabc 100644
--- a/drivers/net/isa-skeleton.c
+++ b/drivers/net/isa-skeleton.c
@@ -176,12 +176,7 @@ struct net_device * __init netcard_probe(int unit)
176 err = do_netcard_probe(dev); 176 err = do_netcard_probe(dev);
177 if (err) 177 if (err)
178 goto out; 178 goto out;
179 err = register_netdev(dev);
180 if (err)
181 goto out1;
182 return dev; 179 return dev;
183out1:
184 cleanup_card(dev);
185out: 180out:
186 free_netdev(dev); 181 free_netdev(dev);
187 return ERR_PTR(err); 182 return ERR_PTR(err);
@@ -316,7 +311,15 @@ static int __init netcard_probe1(struct net_device *dev, int ioaddr)
316 311
317 dev->tx_timeout = &net_tx_timeout; 312 dev->tx_timeout = &net_tx_timeout;
318 dev->watchdog_timeo = MY_TX_TIMEOUT; 313 dev->watchdog_timeo = MY_TX_TIMEOUT;
314
315 err = register_netdev(dev);
316 if (err)
317 goto out2;
319 return 0; 318 return 0;
319out2:
320#ifdef jumpered_dma
321 free_dma(dev->dma);
322#endif
320out1: 323out1:
321#ifdef jumpered_interrupts 324#ifdef jumpered_interrupts
322 free_irq(dev->irq, dev); 325 free_irq(dev->irq, dev);
@@ -691,11 +694,8 @@ int init_module(void)
691 dev->dma = dma; 694 dev->dma = dma;
692 dev->mem_start = mem; 695 dev->mem_start = mem;
693 if (do_netcard_probe(dev) == 0) { 696 if (do_netcard_probe(dev) == 0) {
694 if (register_netdev(dev) == 0) 697 this_device = dev;
695 this_device = dev; 698 return 0;
696 return 0;
697 }
698 cleanup_card(dev);
699 } 699 }
700 free_netdev(dev); 700 free_netdev(dev);
701 return -ENXIO; 701 return -ENXIO;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 35f6a7c271a2..097b90ccf575 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -47,7 +47,9 @@ char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
47#else 47#else
48#define DRIVERNAPI "-NAPI" 48#define DRIVERNAPI "-NAPI"
49#endif 49#endif
50char ixgb_driver_version[] = "1.0.95-k2"DRIVERNAPI; 50
51#define DRV_VERSION "1.0.95-k2"DRIVERNAPI
52char ixgb_driver_version[] = DRV_VERSION;
51char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; 53char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
52 54
53/* ixgb_pci_tbl - PCI Device ID Table 55/* ixgb_pci_tbl - PCI Device ID Table
@@ -140,6 +142,7 @@ static struct pci_driver ixgb_driver = {
140MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); 142MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
141MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver"); 143MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver");
142MODULE_LICENSE("GPL"); 144MODULE_LICENSE("GPL");
145MODULE_VERSION(DRV_VERSION);
143 146
144/* some defines for controlling descriptor fetches in h/w */ 147/* some defines for controlling descriptor fetches in h/w */
145#define RXDCTL_PTHRESH_DEFAULT 128 /* chip considers prefech below this */ 148#define RXDCTL_PTHRESH_DEFAULT 128 /* chip considers prefech below this */
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index dec557fb6a99..b4929beb33b2 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -356,11 +356,8 @@ int init_module(void)
356 dev->base_addr = io[this_dev]; 356 dev->base_addr = io[this_dev];
357 dev->dma = dma[this_dev]; 357 dev->dma = dma[this_dev];
358 if (do_lance_probe(dev) == 0) { 358 if (do_lance_probe(dev) == 0) {
359 if (register_netdev(dev) == 0) { 359 dev_lance[found++] = dev;
360 dev_lance[found++] = dev; 360 continue;
361 continue;
362 }
363 cleanup_card(dev);
364 } 361 }
365 free_netdev(dev); 362 free_netdev(dev);
366 break; 363 break;
@@ -448,12 +445,7 @@ struct net_device * __init lance_probe(int unit)
448 err = do_lance_probe(dev); 445 err = do_lance_probe(dev);
449 if (err) 446 if (err)
450 goto out; 447 goto out;
451 err = register_netdev(dev);
452 if (err)
453 goto out1;
454 return dev; 448 return dev;
455out1:
456 cleanup_card(dev);
457out: 449out:
458 free_netdev(dev); 450 free_netdev(dev);
459 return ERR_PTR(err); 451 return ERR_PTR(err);
@@ -724,6 +716,9 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
724 dev->tx_timeout = lance_tx_timeout; 716 dev->tx_timeout = lance_tx_timeout;
725 dev->watchdog_timeo = TX_TIMEOUT; 717 dev->watchdog_timeo = TX_TIMEOUT;
726 718
719 err = register_netdev(dev);
720 if (err)
721 goto out_dma;
727 return 0; 722 return 0;
728out_dma: 723out_dma:
729 if (dev->dma != 4) 724 if (dev->dma != 4)
@@ -867,7 +862,7 @@ lance_init_ring(struct net_device *dev, int gfp)
867 lp->rx_skbuff[i] = skb; 862 lp->rx_skbuff[i] = skb;
868 if (skb) { 863 if (skb) {
869 skb->dev = dev; 864 skb->dev = dev;
870 rx_buff = skb->tail; 865 rx_buff = skb->data;
871 } else 866 } else
872 rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp); 867 rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp);
873 if (rx_buff == NULL) 868 if (rx_buff == NULL)
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index 5e263fcba669..41bad07ac1ac 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -553,14 +553,14 @@ static inline void init_rx_bufs(struct net_device *dev)
553 if (skb == NULL) 553 if (skb == NULL)
554 panic("%s: alloc_skb() failed", __FILE__); 554 panic("%s: alloc_skb() failed", __FILE__);
555 skb_reserve(skb, 2); 555 skb_reserve(skb, 2);
556 dma_addr = dma_map_single(lp->dev, skb->tail,PKT_BUF_SZ, 556 dma_addr = dma_map_single(lp->dev, skb->data,PKT_BUF_SZ,
557 DMA_FROM_DEVICE); 557 DMA_FROM_DEVICE);
558 skb->dev = dev; 558 skb->dev = dev;
559 rbd->v_next = rbd+1; 559 rbd->v_next = rbd+1;
560 rbd->b_next = WSWAPrbd(virt_to_dma(lp,rbd+1)); 560 rbd->b_next = WSWAPrbd(virt_to_dma(lp,rbd+1));
561 rbd->b_addr = WSWAPrbd(virt_to_dma(lp,rbd)); 561 rbd->b_addr = WSWAPrbd(virt_to_dma(lp,rbd));
562 rbd->skb = skb; 562 rbd->skb = skb;
563 rbd->v_data = skb->tail; 563 rbd->v_data = skb->data;
564 rbd->b_data = WSWAPchar(dma_addr); 564 rbd->b_data = WSWAPchar(dma_addr);
565 rbd->size = PKT_BUF_SZ; 565 rbd->size = PKT_BUF_SZ;
566 } 566 }
@@ -783,8 +783,8 @@ static inline int i596_rx(struct net_device *dev)
783 rx_in_place = 1; 783 rx_in_place = 1;
784 rbd->skb = newskb; 784 rbd->skb = newskb;
785 newskb->dev = dev; 785 newskb->dev = dev;
786 dma_addr = dma_map_single(lp->dev, newskb->tail, PKT_BUF_SZ, DMA_FROM_DEVICE); 786 dma_addr = dma_map_single(lp->dev, newskb->data, PKT_BUF_SZ, DMA_FROM_DEVICE);
787 rbd->v_data = newskb->tail; 787 rbd->v_data = newskb->data;
788 rbd->b_data = WSWAPchar(dma_addr); 788 rbd->b_data = WSWAPchar(dma_addr);
789 CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd)); 789 CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd));
790 } 790 }
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c
index 179a97c0af69..27f0d8ac4c40 100644
--- a/drivers/net/lne390.c
+++ b/drivers/net/lne390.c
@@ -167,12 +167,7 @@ struct net_device * __init lne390_probe(int unit)
167 err = do_lne390_probe(dev); 167 err = do_lne390_probe(dev);
168 if (err) 168 if (err)
169 goto out; 169 goto out;
170 err = register_netdev(dev);
171 if (err)
172 goto out1;
173 return dev; 170 return dev;
174out1:
175 cleanup_card(dev);
176out: 171out:
177 free_netdev(dev); 172 free_netdev(dev);
178 return ERR_PTR(err); 173 return ERR_PTR(err);
@@ -296,7 +291,14 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
296 dev->poll_controller = ei_poll; 291 dev->poll_controller = ei_poll;
297#endif 292#endif
298 NS8390_init(dev, 0); 293 NS8390_init(dev, 0);
294
295 ret = register_netdev(dev);
296 if (ret)
297 goto unmap;
299 return 0; 298 return 0;
299unmap:
300 if (ei_status.reg0)
301 iounmap((void *)dev->mem_start);
300cleanup: 302cleanup:
301 free_irq(dev->irq, dev); 303 free_irq(dev->irq, dev);
302 return ret; 304 return ret;
@@ -426,11 +428,8 @@ int init_module(void)
426 dev->base_addr = io[this_dev]; 428 dev->base_addr = io[this_dev];
427 dev->mem_start = mem[this_dev]; 429 dev->mem_start = mem[this_dev];
428 if (do_lne390_probe(dev) == 0) { 430 if (do_lne390_probe(dev) == 0) {
429 if (register_netdev(dev) == 0) { 431 dev_lne[found++] = dev;
430 dev_lne[found++] = dev; 432 continue;
431 continue;
432 }
433 cleanup_card(dev);
434 } 433 }
435 free_netdev(dev); 434 free_netdev(dev);
436 printk(KERN_WARNING "lne390.c: No LNE390 card found (i/o = 0x%x).\n", io[this_dev]); 435 printk(KERN_WARNING "lne390.c: No LNE390 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index b33111e21313..1f61f0cc95d8 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -214,7 +214,7 @@ struct net_device loopback_dev = {
214 .ethtool_ops = &loopback_ethtool_ops, 214 .ethtool_ops = &loopback_ethtool_ops,
215}; 215};
216 216
217/* Setup and register the of the LOOPBACK device. */ 217/* Setup and register the loopback device. */
218int __init loopback_init(void) 218int __init loopback_init(void)
219{ 219{
220 struct net_device_stats *stats; 220 struct net_device_stats *stats;
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 6ed2d7dbd44c..81d0a26e4f41 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -109,7 +109,7 @@ bitrev(int b)
109} 109}
110 110
111 111
112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *match) 112static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_id *match)
113{ 113{
114 struct device_node *mace = macio_get_of_node(mdev); 114 struct device_node *mace = macio_get_of_node(mdev);
115 struct net_device *dev; 115 struct net_device *dev;
@@ -1009,12 +1009,10 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs)
1009 return IRQ_HANDLED; 1009 return IRQ_HANDLED;
1010} 1010}
1011 1011
1012static struct of_match mace_match[] = 1012static struct of_device_id mace_match[] =
1013{ 1013{
1014 { 1014 {
1015 .name = "mace", 1015 .name = "mace",
1016 .type = OF_ANY_MATCH,
1017 .compatible = OF_ANY_MATCH
1018 }, 1016 },
1019 {}, 1017 {},
1020}; 1018};
diff --git a/drivers/net/myri_code.h b/drivers/net/myri_code.h
index 851eba8a3e00..e9c6e569d1f4 100644
--- a/drivers/net/myri_code.h
+++ b/drivers/net/myri_code.h
@@ -4775,1288 +4775,7 @@ static unsigned char lanai4_code[76256] __initdata = {
4775/* This is the LANai data */ 4775/* This is the LANai data */
4776 4776
4777static unsigned int lanai4_data_off = 0x94F0; /* half-word offset */ 4777static unsigned int lanai4_data_off = 0x94F0; /* half-word offset */
4778static unsigned char lanai4_data[20472] __initdata = { 4778static unsigned char lanai4_data[20472] __initdata;
47790x00,0x00,
47800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
47990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
48990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
49990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
50990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
51990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
52990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
53990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
54990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
55990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
56990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
57990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x01,
58900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
58990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59590x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59600x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59610x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59620x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59630x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59640x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59650x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59660x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59670x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59680x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59690x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59700x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59710x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59720x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59730x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59740x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59750x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59760x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59770x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59780x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59790x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59800x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59810x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59820x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59830x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59840x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59850x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59860x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59870x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59880x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59890x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59900x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59910x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59920x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59930x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59940x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59950x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59960x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59970x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59980x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
59990x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60000x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60010x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60020x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60030x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60040x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60050x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60060x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60070x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60080x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60090x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60100x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60110x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60120x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60130x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60140x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60150x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60160x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60170x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60180x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60190x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60200x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60210x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60220x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60230x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60240x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60250x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60260x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60270x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60280x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60290x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60300x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60310x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60320x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60330x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60340x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60350x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60360x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60370x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60380x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60390x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60400x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60410x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60420x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60430x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60440x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60450x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60460x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60470x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60480x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60490x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60500x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60510x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60520x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60530x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60540x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60550x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60560x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60570x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60580x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
60590x00,0x00, 0x00,0x00, 0x00,0x00, } ;
6060 4779
6061 4780
6062#ifdef SYMBOL_DEFINES_COMPILED 4781#ifdef SYMBOL_DEFINES_COMPILED
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index aad5494c83cf..f0996ce5c268 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -369,7 +369,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev)
369 * assume 802.3 if the type field is short enough to be a length. 369 * assume 802.3 if the type field is short enough to be a length.
370 * This is normal practice and works for any 'now in use' protocol. 370 * This is normal practice and works for any 'now in use' protocol.
371 */ 371 */
372static unsigned short myri_type_trans(struct sk_buff *skb, struct net_device *dev) 372static __be16 myri_type_trans(struct sk_buff *skb, struct net_device *dev)
373{ 373{
374 struct ethhdr *eth; 374 struct ethhdr *eth;
375 unsigned char *rawp; 375 unsigned char *rawp;
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index babb59e146ea..9d6d2548c2d3 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1926,7 +1926,7 @@ static void refill_rx(struct net_device *dev)
1926 break; /* Better luck next round. */ 1926 break; /* Better luck next round. */
1927 skb->dev = dev; /* Mark as being used by this device. */ 1927 skb->dev = dev; /* Mark as being used by this device. */
1928 np->rx_dma[entry] = pci_map_single(np->pci_dev, 1928 np->rx_dma[entry] = pci_map_single(np->pci_dev,
1929 skb->tail, buflen, PCI_DMA_FROMDEVICE); 1929 skb->data, buflen, PCI_DMA_FROMDEVICE);
1930 np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); 1930 np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]);
1931 } 1931 }
1932 np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); 1932 np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz);
@@ -2280,7 +2280,7 @@ static void netdev_rx(struct net_device *dev)
2280 buflen, 2280 buflen,
2281 PCI_DMA_FROMDEVICE); 2281 PCI_DMA_FROMDEVICE);
2282 eth_copy_and_sum(skb, 2282 eth_copy_and_sum(skb,
2283 np->rx_skbuff[entry]->tail, pkt_len, 0); 2283 np->rx_skbuff[entry]->data, pkt_len, 0);
2284 skb_put(skb, pkt_len); 2284 skb_put(skb, pkt_len);
2285 pci_dma_sync_single_for_device(np->pci_dev, 2285 pci_dma_sync_single_for_device(np->pci_dev,
2286 np->rx_dma[entry], 2286 np->rx_dma[entry],
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index 84e291e24935..8f40368cf2e9 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -180,12 +180,7 @@ struct net_device * __init ne_probe(int unit)
180 err = do_ne_probe(dev); 180 err = do_ne_probe(dev);
181 if (err) 181 if (err)
182 goto out; 182 goto out;
183 err = register_netdev(dev);
184 if (err)
185 goto out1;
186 return dev; 183 return dev;
187out1:
188 cleanup_card(dev);
189out: 184out:
190 free_netdev(dev); 185 free_netdev(dev);
191 return ERR_PTR(err); 186 return ERR_PTR(err);
@@ -325,8 +320,13 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
325 dev->poll_controller = ei_poll; 320 dev->poll_controller = ei_poll;
326#endif 321#endif
327 NS8390_init(dev, 0); 322 NS8390_init(dev, 0);
328 return 0;
329 323
324 ret = register_netdev(dev);
325 if (ret)
326 goto out_irq;
327 return 0;
328out_irq:
329 free_irq(dev->irq, dev);
330err_out: 330err_out:
331 release_region(ioaddr, NE_IO_EXTENT); 331 release_region(ioaddr, NE_IO_EXTENT);
332 return ret; 332 return ret;
@@ -633,11 +633,8 @@ int init_module(void)
633 err = init_reg_offset(dev, dev->base_addr); 633 err = init_reg_offset(dev, dev->base_addr);
634 if (!err) { 634 if (!err) {
635 if (do_ne_probe(dev) == 0) { 635 if (do_ne_probe(dev) == 0) {
636 if (register_netdev(dev) == 0) { 636 dev_ne[found++] = dev;
637 dev_ne[found++] = dev; 637 continue;
638 continue;
639 }
640 cleanup_card(dev);
641 } 638 }
642 } 639 }
643 free_netdev(dev); 640 free_netdev(dev);
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 496433902ade..d209a1556b2e 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -129,9 +129,9 @@ bad_clone_list[] __initdata = {
129#define NESM_START_PG 0x40 /* First page of TX buffer */ 129#define NESM_START_PG 0x40 /* First page of TX buffer */
130#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ 130#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */
131 131
132#ifdef CONFIG_PLAT_MAPPI 132#if defined(CONFIG_PLAT_MAPPI)
133# define DCR_VAL 0x4b 133# define DCR_VAL 0x4b
134#elif CONFIG_PLAT_OAKS32R 134#elif defined(CONFIG_PLAT_OAKS32R)
135# define DCR_VAL 0x48 135# define DCR_VAL 0x48
136#else 136#else
137# define DCR_VAL 0x49 137# define DCR_VAL 0x49
@@ -229,12 +229,7 @@ struct net_device * __init ne_probe(int unit)
229 err = do_ne_probe(dev); 229 err = do_ne_probe(dev);
230 if (err) 230 if (err)
231 goto out; 231 goto out;
232 err = register_netdev(dev);
233 if (err)
234 goto out1;
235 return dev; 232 return dev;
236out1:
237 cleanup_card(dev);
238out: 233out:
239 free_netdev(dev); 234 free_netdev(dev);
240 return ERR_PTR(err); 235 return ERR_PTR(err);
@@ -534,8 +529,14 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
534 dev->poll_controller = ei_poll; 529 dev->poll_controller = ei_poll;
535#endif 530#endif
536 NS8390_init(dev, 0); 531 NS8390_init(dev, 0);
532
533 ret = register_netdev(dev);
534 if (ret)
535 goto out_irq;
537 return 0; 536 return 0;
538 537
538out_irq:
539 free_irq(dev->irq, dev);
539err_out: 540err_out:
540 release_region(ioaddr, NE_IO_EXTENT); 541 release_region(ioaddr, NE_IO_EXTENT);
541 return ret; 542 return ret;
@@ -826,11 +827,8 @@ int init_module(void)
826 dev->mem_end = bad[this_dev]; 827 dev->mem_end = bad[this_dev];
827 dev->base_addr = io[this_dev]; 828 dev->base_addr = io[this_dev];
828 if (do_ne_probe(dev) == 0) { 829 if (do_ne_probe(dev) == 0) {
829 if (register_netdev(dev) == 0) { 830 dev_ne[found++] = dev;
830 dev_ne[found++] = dev; 831 continue;
831 continue;
832 }
833 cleanup_card(dev);
834 } 832 }
835 free_netdev(dev); 833 free_netdev(dev);
836 if (found) 834 if (found)
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index 6ebef27dbfae..6d62ada85de6 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -301,12 +301,7 @@ struct net_device * __init ne2_probe(int unit)
301 err = do_ne2_probe(dev); 301 err = do_ne2_probe(dev);
302 if (err) 302 if (err)
303 goto out; 303 goto out;
304 err = register_netdev(dev);
305 if (err)
306 goto out1;
307 return dev; 304 return dev;
308out1:
309 cleanup_card(dev);
310out: 305out:
311 free_netdev(dev); 306 free_netdev(dev);
312 return ERR_PTR(err); 307 return ERR_PTR(err);
@@ -517,7 +512,14 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
517 dev->poll_controller = ei_poll; 512 dev->poll_controller = ei_poll;
518#endif 513#endif
519 NS8390_init(dev, 0); 514 NS8390_init(dev, 0);
515
516 retval = register_netdev(dev);
517 if (retval)
518 goto out1;
520 return 0; 519 return 0;
520out1:
521 mca_set_adapter_procfn( ei_status.priv, NULL, NULL);
522 free_irq(dev->irq, dev);
521out: 523out:
522 release_region(base_addr, NE_IO_EXTENT); 524 release_region(base_addr, NE_IO_EXTENT);
523 return retval; 525 return retval;
@@ -798,11 +800,8 @@ int init_module(void)
798 dev->mem_end = bad[this_dev]; 800 dev->mem_end = bad[this_dev];
799 dev->base_addr = io[this_dev]; 801 dev->base_addr = io[this_dev];
800 if (do_ne2_probe(dev) == 0) { 802 if (do_ne2_probe(dev) == 0) {
801 if (register_netdev(dev) == 0) { 803 dev_ne[found++] = dev;
802 dev_ne[found++] = dev; 804 continue;
803 continue;
804 }
805 cleanup_card(dev);
806 } 805 }
807 free_netdev(dev); 806 free_netdev(dev);
808 break; 807 break;
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index a1a6c08e7dcf..f1c01ac29102 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -660,6 +660,7 @@ static int ne2k_pci_suspend (struct pci_dev *pdev, pm_message_t state)
660 660
661 netif_device_detach(dev); 661 netif_device_detach(dev);
662 pci_save_state(pdev); 662 pci_save_state(pdev);
663 pci_disable_device(pdev);
663 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 664 pci_set_power_state(pdev, pci_choose_state(pdev, state));
664 665
665 return 0; 666 return 0;
@@ -671,6 +672,8 @@ static int ne2k_pci_resume (struct pci_dev *pdev)
671 672
672 pci_set_power_state(pdev, 0); 673 pci_set_power_state(pdev, 0);
673 pci_restore_state(pdev); 674 pci_restore_state(pdev);
675 pci_enable_device(pdev);
676 pci_set_master(pdev);
674 NS8390_init(dev, 1); 677 NS8390_init(dev, 1);
675 netif_device_attach(dev); 678 netif_device_attach(dev);
676 679
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index c336b46bd332..e64df4d0800b 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -101,6 +101,7 @@
101#include <linux/moduleparam.h> 101#include <linux/moduleparam.h>
102#include <linux/types.h> 102#include <linux/types.h>
103#include <linux/pci.h> 103#include <linux/pci.h>
104#include <linux/dma-mapping.h>
104#include <linux/netdevice.h> 105#include <linux/netdevice.h>
105#include <linux/etherdevice.h> 106#include <linux/etherdevice.h>
106#include <linux/delay.h> 107#include <linux/delay.h>
@@ -573,7 +574,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb)
573 574
574 dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC; 575 dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
575 cmdsts = REAL_RX_BUF_SIZE | CMDSTS_INTR; 576 cmdsts = REAL_RX_BUF_SIZE | CMDSTS_INTR;
576 buf = pci_map_single(dev->pci_dev, skb->tail, 577 buf = pci_map_single(dev->pci_dev, skb->data,
577 REAL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 578 REAL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
578 build_rx_desc(dev, sg, 0, buf, cmdsts, 0); 579 build_rx_desc(dev, sg, 0, buf, cmdsts, 0);
579 /* update link of previous rx */ 580 /* update link of previous rx */
@@ -603,7 +604,7 @@ static inline int rx_refill(struct net_device *ndev, int gfp)
603 if (unlikely(!skb)) 604 if (unlikely(!skb))
604 break; 605 break;
605 606
606 res = (long)skb->tail & 0xf; 607 res = (long)skb->data & 0xf;
607 res = 0x10 - res; 608 res = 0x10 - res;
608 res &= 0xf; 609 res &= 0xf;
609 skb_reserve(skb, res); 610 skb_reserve(skb, res);
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index c6e8b25f9685..71fd41122c91 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -86,7 +86,6 @@ earlier 3Com products.
86#include <linux/ethtool.h> 86#include <linux/ethtool.h>
87#include <linux/bitops.h> 87#include <linux/bitops.h>
88 88
89#include <pcmcia/version.h>
90#include <pcmcia/cs_types.h> 89#include <pcmcia/cs_types.h>
91#include <pcmcia/cs.h> 90#include <pcmcia/cs.h>
92#include <pcmcia/cistpl.h> 91#include <pcmcia/cistpl.h>
@@ -312,11 +311,6 @@ static dev_link_t *tc574_attach(void)
312 link->next = dev_list; 311 link->next = dev_list;
313 dev_list = link; 312 dev_list = link;
314 client_reg.dev_info = &dev_info; 313 client_reg.dev_info = &dev_info;
315 client_reg.EventMask =
316 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
317 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
318 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
319 client_reg.event_handler = &tc574_event;
320 client_reg.Version = 0x0210; 314 client_reg.Version = 0x0210;
321 client_reg.event_callback_args.client_data = link; 315 client_reg.event_callback_args.client_data = link;
322 ret = pcmcia_register_client(&link->handle, &client_reg); 316 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -1286,13 +1280,22 @@ static int el3_close(struct net_device *dev)
1286 return 0; 1280 return 0;
1287} 1281}
1288 1282
1283static struct pcmcia_device_id tc574_ids[] = {
1284 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0574),
1285 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0556, "3CCFEM556.cis"),
1286 PCMCIA_DEVICE_NULL,
1287};
1288MODULE_DEVICE_TABLE(pcmcia, tc574_ids);
1289
1289static struct pcmcia_driver tc574_driver = { 1290static struct pcmcia_driver tc574_driver = {
1290 .owner = THIS_MODULE, 1291 .owner = THIS_MODULE,
1291 .drv = { 1292 .drv = {
1292 .name = "3c574_cs", 1293 .name = "3c574_cs",
1293 }, 1294 },
1294 .attach = tc574_attach, 1295 .attach = tc574_attach,
1296 .event = tc574_event,
1295 .detach = tc574_detach, 1297 .detach = tc574_detach,
1298 .id_table = tc574_ids,
1296}; 1299};
1297 1300
1298static int __init init_tc574(void) 1301static int __init init_tc574(void)
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 89abdda1d343..d83fdd8c1943 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -40,7 +40,6 @@
40#include <linux/ioport.h> 40#include <linux/ioport.h>
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42 42
43#include <pcmcia/version.h>
44#include <pcmcia/cs_types.h> 43#include <pcmcia/cs_types.h>
45#include <pcmcia/cs.h> 44#include <pcmcia/cs.h>
46#include <pcmcia/cistpl.h> 45#include <pcmcia/cistpl.h>
@@ -226,11 +225,6 @@ static dev_link_t *tc589_attach(void)
226 link->next = dev_list; 225 link->next = dev_list;
227 dev_list = link; 226 dev_list = link;
228 client_reg.dev_info = &dev_info; 227 client_reg.dev_info = &dev_info;
229 client_reg.EventMask =
230 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
231 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
232 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
233 client_reg.event_handler = &tc589_event;
234 client_reg.Version = 0x0210; 228 client_reg.Version = 0x0210;
235 client_reg.event_callback_args.client_data = link; 229 client_reg.event_callback_args.client_data = link;
236 ret = pcmcia_register_client(&link->handle, &client_reg); 230 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -1057,13 +1051,26 @@ static int el3_close(struct net_device *dev)
1057 return 0; 1051 return 0;
1058} 1052}
1059 1053
1054static struct pcmcia_device_id tc589_ids[] = {
1055 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562),
1056 PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77),
1057 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589),
1058 PCMCIA_DEVICE_PROD_ID12("Farallon", "ENet", 0x58d93fc4, 0x992c2202),
1059 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0035, "3CXEM556.cis"),
1060 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x003d, "3CXEM556.cis"),
1061 PCMCIA_DEVICE_NULL,
1062};
1063MODULE_DEVICE_TABLE(pcmcia, tc589_ids);
1064
1060static struct pcmcia_driver tc589_driver = { 1065static struct pcmcia_driver tc589_driver = {
1061 .owner = THIS_MODULE, 1066 .owner = THIS_MODULE,
1062 .drv = { 1067 .drv = {
1063 .name = "3c589_cs", 1068 .name = "3c589_cs",
1064 }, 1069 },
1065 .attach = tc589_attach, 1070 .attach = tc589_attach,
1071 .event = tc589_event,
1066 .detach = tc589_detach, 1072 .detach = tc589_detach,
1073 .id_table = tc589_ids,
1067}; 1074};
1068 1075
1069static int __init init_tc589(void) 1076static int __init init_tc589(void)
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 853b586e481a..8bb4e85689ea 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -37,7 +37,6 @@
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include "../8390.h" 38#include "../8390.h"
39 39
40#include <pcmcia/version.h>
41#include <pcmcia/cs_types.h> 40#include <pcmcia/cs_types.h>
42#include <pcmcia/cs.h> 41#include <pcmcia/cs.h>
43#include <pcmcia/cistpl.h> 42#include <pcmcia/cistpl.h>
@@ -181,11 +180,6 @@ static dev_link_t *axnet_attach(void)
181 link->next = dev_list; 180 link->next = dev_list;
182 dev_list = link; 181 dev_list = link;
183 client_reg.dev_info = &dev_info; 182 client_reg.dev_info = &dev_info;
184 client_reg.EventMask =
185 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
186 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
187 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
188 client_reg.event_handler = &axnet_event;
189 client_reg.Version = 0x0210; 183 client_reg.Version = 0x0210;
190 client_reg.event_callback_args.client_data = link; 184 client_reg.event_callback_args.client_data = link;
191 ret = pcmcia_register_client(&link->handle, &client_reg); 185 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -850,13 +844,43 @@ static void block_output(struct net_device *dev, int count,
850 outsw(nic_base + AXNET_DATAPORT, buf, count>>1); 844 outsw(nic_base + AXNET_DATAPORT, buf, count>>1);
851} 845}
852 846
847static struct pcmcia_device_id axnet_ids[] = {
848 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081),
849 PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301),
850 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301),
851 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303),
852 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
853 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106),
854 PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab),
855 PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef),
856 PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef),
857 PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1),
858 PCMCIA_DEVICE_PROD_ID12("CHEETAH ETHERCARD", "EN2228", 0x00fa7bc8, 0x00e990cc),
859 PCMCIA_DEVICE_PROD_ID12("CNet", "CNF301", 0xbc477dde, 0x78c5f40b),
860 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5),
861 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e),
862 PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90),
863 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8),
864 PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609),
865 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04),
866 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEtherCard", 0x281f1c5d, 0x7ef26116),
867 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FEP501", 0x281f1c5d, 0x2e272058),
868 PCMCIA_DEVICE_PROD_ID14("Network Everywhere", "AX88190", 0x820a67b6, 0xab9be5ef),
869 /* this is not specific enough */
870 /* PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), */
871 PCMCIA_DEVICE_NULL,
872};
873MODULE_DEVICE_TABLE(pcmcia, axnet_ids);
874
853static struct pcmcia_driver axnet_cs_driver = { 875static struct pcmcia_driver axnet_cs_driver = {
854 .owner = THIS_MODULE, 876 .owner = THIS_MODULE,
855 .drv = { 877 .drv = {
856 .name = "axnet_cs", 878 .name = "axnet_cs",
857 }, 879 },
858 .attach = axnet_attach, 880 .attach = axnet_attach,
881 .event = axnet_event,
859 .detach = axnet_detach, 882 .detach = axnet_detach,
883 .id_table = axnet_ids,
860}; 884};
861 885
862static int __init init_axnet_cs(void) 886static int __init init_axnet_cs(void)
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 4294e1e3f156..b9355d9498a3 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -43,7 +43,6 @@
43#include <linux/arcdevice.h> 43#include <linux/arcdevice.h>
44#include <linux/com20020.h> 44#include <linux/com20020.h>
45 45
46#include <pcmcia/version.h>
47#include <pcmcia/cs_types.h> 46#include <pcmcia/cs_types.h>
48#include <pcmcia/cs.h> 47#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
@@ -200,11 +199,6 @@ static dev_link_t *com20020_attach(void)
200 link->next = dev_list; 199 link->next = dev_list;
201 dev_list = link; 200 dev_list = link;
202 client_reg.dev_info = &dev_info; 201 client_reg.dev_info = &dev_info;
203 client_reg.EventMask =
204 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
205 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
206 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
207 client_reg.event_handler = &com20020_event;
208 client_reg.Version = 0x0210; 202 client_reg.Version = 0x0210;
209 client_reg.event_callback_args.client_data = link; 203 client_reg.event_callback_args.client_data = link;
210 ret = pcmcia_register_client(&link->handle, &client_reg); 204 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -483,7 +477,11 @@ static int com20020_event(event_t event, int priority,
483 return 0; 477 return 0;
484} /* com20020_event */ 478} /* com20020_event */
485 479
486 480static struct pcmcia_device_id com20020_ids[] = {
481 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
482 PCMCIA_DEVICE_NULL
483};
484MODULE_DEVICE_TABLE(pcmcia, com20020_ids);
487 485
488static struct pcmcia_driver com20020_cs_driver = { 486static struct pcmcia_driver com20020_cs_driver = {
489 .owner = THIS_MODULE, 487 .owner = THIS_MODULE,
@@ -491,7 +489,9 @@ static struct pcmcia_driver com20020_cs_driver = {
491 .name = "com20020_cs", 489 .name = "com20020_cs",
492 }, 490 },
493 .attach = com20020_attach, 491 .attach = com20020_attach,
492 .event = com20020_event,
494 .detach = com20020_detach, 493 .detach = com20020_detach,
494 .id_table = com20020_ids,
495}; 495};
496 496
497static int __init init_com20020_cs(void) 497static int __init init_com20020_cs(void)
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 0424865e8094..9d8197bb293a 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -49,7 +49,6 @@
49#include <linux/ioport.h> 49#include <linux/ioport.h>
50#include <linux/crc32.h> 50#include <linux/crc32.h>
51 51
52#include <pcmcia/version.h>
53#include <pcmcia/cs_types.h> 52#include <pcmcia/cs_types.h>
54#include <pcmcia/cs.h> 53#include <pcmcia/cs.h>
55#include <pcmcia/cistpl.h> 54#include <pcmcia/cistpl.h>
@@ -288,11 +287,6 @@ static dev_link_t *fmvj18x_attach(void)
288 link->next = dev_list; 287 link->next = dev_list;
289 dev_list = link; 288 dev_list = link;
290 client_reg.dev_info = &dev_info; 289 client_reg.dev_info = &dev_info;
291 client_reg.EventMask =
292 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
293 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
294 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
295 client_reg.event_handler = &fmvj18x_event;
296 client_reg.Version = 0x0210; 290 client_reg.Version = 0x0210;
297 client_reg.event_callback_args.client_data = link; 291 client_reg.event_callback_args.client_data = link;
298 ret = pcmcia_register_client(&link->handle, &client_reg); 292 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -435,7 +429,9 @@ static void fmvj18x_config(dev_link_t *link)
435 pcmcia_get_status(handle, &status); 429 pcmcia_get_status(handle, &status);
436 if (status.CardState & CS_EVENT_3VCARD) 430 if (status.CardState & CS_EVENT_3VCARD)
437 link->conf.Vcc = 33; /* inserted in 3.3V slot */ 431 link->conf.Vcc = 33; /* inserted in 3.3V slot */
438 } else if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410) { 432 } else if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410
433 || le16_to_cpu(buf[1]) == PRODID_TDK_NP9610
434 || le16_to_cpu(buf[1]) == PRODID_TDK_MN3200) {
439 /* MultiFunction Card */ 435 /* MultiFunction Card */
440 link->conf.ConfigBase = 0x800; 436 link->conf.ConfigBase = 0x800;
441 link->conf.ConfigIndex = 0x47; 437 link->conf.ConfigIndex = 0x47;
@@ -764,13 +760,40 @@ static int fmvj18x_event(event_t event, int priority,
764 return 0; 760 return 0;
765} /* fmvj18x_event */ 761} /* fmvj18x_event */
766 762
763static struct pcmcia_device_id fmvj18x_ids[] = {
764 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004),
765 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59),
766 PCMCIA_DEVICE_PROD_ID12("Eiger Labs,Inc", "EPX-10BT PC Card Ethernet 10BT", 0x53af556e, 0x877f9922),
767 PCMCIA_DEVICE_PROD_ID12("Eiger labs,Inc.", "EPX-10BT PC Card Ethernet 10BT", 0xf47e6c66, 0x877f9922),
768 PCMCIA_DEVICE_PROD_ID12("FUJITSU", "LAN Card(FMV-J182)", 0x6ee5a3d8, 0x5baf31db),
769 PCMCIA_DEVICE_PROD_ID12("FUJITSU", "MBH10308", 0x6ee5a3d8, 0x3f04875e),
770 PCMCIA_DEVICE_PROD_ID12("FUJITSU TOWA", "LA501", 0xb8451188, 0x12939ba2),
771 PCMCIA_DEVICE_PROD_ID12("HITACHI", "HT-4840-11", 0xf4f43949, 0x773910f4),
772 PCMCIA_DEVICE_PROD_ID12("NextComK.K.", "NC5310B Ver1.0 ", 0x8cef4d3a, 0x075fc7b6),
773 PCMCIA_DEVICE_PROD_ID12("NextComK.K.", "NC5310 Ver1.0 ", 0x8cef4d3a, 0xbccf43e6),
774 PCMCIA_DEVICE_PROD_ID12("RATOC System Inc.", "10BASE_T CARD R280", 0x85c10e17, 0xd9413666),
775 PCMCIA_DEVICE_PROD_ID12("TDK", "LAC-CD02x", 0x1eae9475, 0x8fa0ee70),
776 PCMCIA_DEVICE_PROD_ID12("TDK", "LAC-CF010", 0x1eae9475, 0x7683bc9a),
777 PCMCIA_DEVICE_PROD_ID1("CONTEC Co.,Ltd.", 0x58d8fee2),
778 PCMCIA_DEVICE_PROD_ID1("PCMCIA LAN MBH10304 ES", 0x2599f454),
779 PCMCIA_DEVICE_PROD_ID1("PCMCIA MBH10302", 0x8f4005da),
780 PCMCIA_DEVICE_PROD_ID1("UBKK,V2.0", 0x90888080),
781 PCMCIA_PFC_DEVICE_PROD_ID12(0, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
782 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0d0a),
783 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a),
784 PCMCIA_DEVICE_NULL,
785};
786MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids);
787
767static struct pcmcia_driver fmvj18x_cs_driver = { 788static struct pcmcia_driver fmvj18x_cs_driver = {
768 .owner = THIS_MODULE, 789 .owner = THIS_MODULE,
769 .drv = { 790 .drv = {
770 .name = "fmvj18x_cs", 791 .name = "fmvj18x_cs",
771 }, 792 },
772 .attach = fmvj18x_attach, 793 .attach = fmvj18x_attach,
794 .event = fmvj18x_event,
773 .detach = fmvj18x_detach, 795 .detach = fmvj18x_detach,
796 .id_table = fmvj18x_ids,
774}; 797};
775 798
776static int __init init_fmvj18x_cs(void) 799static int __init init_fmvj18x_cs(void)
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 3107ccfe8f3d..b6c140eb9799 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -57,7 +57,6 @@
57#include <linux/trdevice.h> 57#include <linux/trdevice.h>
58#include <linux/ibmtr.h> 58#include <linux/ibmtr.h>
59 59
60#include <pcmcia/version.h>
61#include <pcmcia/cs_types.h> 60#include <pcmcia/cs_types.h>
62#include <pcmcia/cs.h> 61#include <pcmcia/cs.h>
63#include <pcmcia/cistpl.h> 62#include <pcmcia/cistpl.h>
@@ -119,9 +118,6 @@ static void ibmtr_detach(dev_link_t *);
119 118
120static dev_link_t *dev_list; 119static dev_link_t *dev_list;
121 120
122extern int ibmtr_probe_card(struct net_device *dev);
123extern irqreturn_t tok_interrupt (int irq, void *dev_id, struct pt_regs *regs);
124
125/*====================================================================*/ 121/*====================================================================*/
126 122
127typedef struct ibmtr_dev_t { 123typedef struct ibmtr_dev_t {
@@ -193,11 +189,6 @@ static dev_link_t *ibmtr_attach(void)
193 link->next = dev_list; 189 link->next = dev_list;
194 dev_list = link; 190 dev_list = link;
195 client_reg.dev_info = &dev_info; 191 client_reg.dev_info = &dev_info;
196 client_reg.EventMask =
197 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
198 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
199 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
200 client_reg.event_handler = &ibmtr_event;
201 client_reg.Version = 0x0210; 192 client_reg.Version = 0x0210;
202 client_reg.event_callback_args.client_data = link; 193 client_reg.event_callback_args.client_data = link;
203 ret = pcmcia_register_client(&link->handle, &client_reg); 194 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -511,13 +502,22 @@ static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase)
511 return; 502 return;
512} 503}
513 504
505static struct pcmcia_device_id ibmtr_ids[] = {
506 PCMCIA_DEVICE_PROD_ID12("3Com", "TokenLink Velocity PC Card", 0x41240e5b, 0x82c3734e),
507 PCMCIA_DEVICE_PROD_ID12("IBM", "TOKEN RING", 0xb569a6e5, 0xbf8eed47),
508 PCMCIA_DEVICE_NULL,
509};
510MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
511
514static struct pcmcia_driver ibmtr_cs_driver = { 512static struct pcmcia_driver ibmtr_cs_driver = {
515 .owner = THIS_MODULE, 513 .owner = THIS_MODULE,
516 .drv = { 514 .drv = {
517 .name = "ibmtr_cs", 515 .name = "ibmtr_cs",
518 }, 516 },
519 .attach = ibmtr_attach, 517 .attach = ibmtr_attach,
518 .event = ibmtr_event,
520 .detach = ibmtr_detach, 519 .detach = ibmtr_detach,
520 .id_table = ibmtr_ids,
521}; 521};
522 522
523static int __init init_ibmtr_cs(void) 523static int __init init_ibmtr_cs(void)
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 4603807fcafb..980d7e5d66cb 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -146,7 +146,6 @@ Include Files
146#include <linux/ioport.h> 146#include <linux/ioport.h>
147#include <linux/bitops.h> 147#include <linux/bitops.h>
148 148
149#include <pcmcia/version.h>
150#include <pcmcia/cs_types.h> 149#include <pcmcia/cs_types.h>
151#include <pcmcia/cs.h> 150#include <pcmcia/cs.h>
152#include <pcmcia/cisreg.h> 151#include <pcmcia/cisreg.h>
@@ -502,11 +501,6 @@ static dev_link_t *nmclan_attach(void)
502 link->next = dev_list; 501 link->next = dev_list;
503 dev_list = link; 502 dev_list = link;
504 client_reg.dev_info = &dev_info; 503 client_reg.dev_info = &dev_info;
505 client_reg.EventMask =
506 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
507 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
508 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
509 client_reg.event_handler = &nmclan_event;
510 client_reg.Version = 0x0210; 504 client_reg.Version = 0x0210;
511 client_reg.event_callback_args.client_data = link; 505 client_reg.event_callback_args.client_data = link;
512 ret = pcmcia_register_client(&link->handle, &client_reg); 506 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -1675,13 +1669,22 @@ static void set_multicast_list(struct net_device *dev)
1675 1669
1676} /* set_multicast_list */ 1670} /* set_multicast_list */
1677 1671
1672static struct pcmcia_device_id nmclan_ids[] = {
1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941),
1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),
1675 PCMCIA_DEVICE_NULL,
1676};
1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
1678
1678static struct pcmcia_driver nmclan_cs_driver = { 1679static struct pcmcia_driver nmclan_cs_driver = {
1679 .owner = THIS_MODULE, 1680 .owner = THIS_MODULE,
1680 .drv = { 1681 .drv = {
1681 .name = "nmclan_cs", 1682 .name = "nmclan_cs",
1682 }, 1683 },
1683 .attach = nmclan_attach, 1684 .attach = nmclan_attach,
1685 .event = nmclan_event,
1684 .detach = nmclan_detach, 1686 .detach = nmclan_detach,
1687 .id_table = nmclan_ids,
1685}; 1688};
1686 1689
1687static int __init init_nmclan_cs(void) 1690static int __init init_nmclan_cs(void)
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 181b6ed55003..9f22d138e3ad 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -40,7 +40,6 @@
40#include <linux/netdevice.h> 40#include <linux/netdevice.h>
41#include <../drivers/net/8390.h> 41#include <../drivers/net/8390.h>
42 42
43#include <pcmcia/version.h>
44#include <pcmcia/cs_types.h> 43#include <pcmcia/cs_types.h>
45#include <pcmcia/cs.h> 44#include <pcmcia/cs.h>
46#include <pcmcia/cistpl.h> 45#include <pcmcia/cistpl.h>
@@ -276,11 +275,6 @@ static dev_link_t *pcnet_attach(void)
276 link->next = dev_list; 275 link->next = dev_list;
277 dev_list = link; 276 dev_list = link;
278 client_reg.dev_info = &dev_info; 277 client_reg.dev_info = &dev_info;
279 client_reg.EventMask =
280 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
281 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
282 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
283 client_reg.event_handler = &pcnet_event;
284 client_reg.Version = 0x0210; 278 client_reg.Version = 0x0210;
285 client_reg.event_callback_args.client_data = link; 279 client_reg.event_callback_args.client_data = link;
286 ret = pcmcia_register_client(&link->handle, &client_reg); 280 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -1155,11 +1149,13 @@ static int set_config(struct net_device *dev, struct ifmap *map)
1155static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs) 1149static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs)
1156{ 1150{
1157 struct net_device *dev = dev_id; 1151 struct net_device *dev = dev_id;
1158 pcnet_dev_t *info = PRIV(dev); 1152 pcnet_dev_t *info;
1159 irqreturn_t ret = ei_interrupt(irq, dev_id, regs); 1153 irqreturn_t ret = ei_interrupt(irq, dev_id, regs);
1160 1154
1161 if (ret == IRQ_HANDLED) 1155 if (ret == IRQ_HANDLED) {
1156 info = PRIV(dev);
1162 info->stale = 0; 1157 info->stale = 0;
1158 }
1163 return ret; 1159 return ret;
1164} 1160}
1165 1161
@@ -1350,7 +1346,7 @@ static void dma_block_input(struct net_device *dev, int count,
1350 if (count & 0x01) 1346 if (count & 0x01)
1351 buf[count-1] = inb(nic_base + PCNET_DATAPORT), xfer_count++; 1347 buf[count-1] = inb(nic_base + PCNET_DATAPORT), xfer_count++;
1352 1348
1353 /* This was for the ALPHA version only, but enough people have 1349 /* This was for the ALPHA version only, but enough people have been
1354 encountering problems that it is still here. */ 1350 encountering problems that it is still here. */
1355#ifdef PCMCIA_DEBUG 1351#ifdef PCMCIA_DEBUG
1356 if (ei_debug > 4) { /* DMA termination address check... */ 1352 if (ei_debug > 4) { /* DMA termination address check... */
@@ -1424,7 +1420,7 @@ static void dma_block_output(struct net_device *dev, int count,
1424 dma_start = jiffies; 1420 dma_start = jiffies;
1425 1421
1426#ifdef PCMCIA_DEBUG 1422#ifdef PCMCIA_DEBUG
1427 /* This was for the ALPHA version only, but enough people have 1423 /* This was for the ALPHA version only, but enough people have been
1428 encountering problems that it is still here. */ 1424 encountering problems that it is still here. */
1429 if (ei_debug > 4) { /* DMA termination address check... */ 1425 if (ei_debug > 4) { /* DMA termination address check... */
1430 int addr, tries = 20; 1426 int addr, tries = 20;
@@ -1635,13 +1631,218 @@ failed:
1635 1631
1636/*====================================================================*/ 1632/*====================================================================*/
1637 1633
1634static struct pcmcia_device_id pcnet_ids[] = {
1635 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0057, 0x0021),
1636 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0104, 0x000a),
1637 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0xea15),
1638 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0x3341),
1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab),
1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101),
1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab),
1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
1646 PCMCIA_PFC_DEVICE_PROD_ID12(0, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58),
1647 PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
1648 PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
1649 PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "Home and Away 28.8 PC Card ", 0xb569a6e5, 0x5bd4ff2c),
1650 PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "Home and Away Credit Card Adapter", 0xb569a6e5, 0x4bdf15c3),
1651 PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "w95 Home and Away Credit Card ", 0xb569a6e5, 0xae911c15),
1652 PCMCIA_MFC_DEVICE_PROD_ID123(0, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f),
1653 PCMCIA_MFC_DEVICE_PROD_ID2(0, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302),
1654 PCMCIA_DEVICE_MANF_CARD(0x0057, 0x1004),
1655 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x000d),
1656 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0075),
1657 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0145),
1658 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x0230),
1659 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530),
1660/* PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), conflict with axnet_cs */
1661 PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110),
1662 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
1663 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041),
1664 PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452),
1665/* PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), conflict with axnet_cs */
1666 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300),
1667 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0307),
1668 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030a),
1669 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1103),
1670 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1121),
1671 PCMCIA_DEVICE_PROD_ID12("2408LAN", "Ethernet", 0x352fff7f, 0x00b2e941),
1672 PCMCIA_DEVICE_PROD_ID123("Cardwell", "PCMCIA", "ETHERNET", 0x9533672e, 0x281f1c5d, 0x3ff7175b),
1673 PCMCIA_DEVICE_PROD_ID123("CNet ", "CN30BC", "ETHERNET", 0x9fe55d3d, 0x85601198, 0x3ff7175b),
1674 PCMCIA_DEVICE_PROD_ID123("Digital", "Ethernet", "Adapter", 0x9999ab35, 0x00b2e941, 0x4b0d829e),
1675 PCMCIA_DEVICE_PROD_ID123("Edimax Technology Inc.", "PCMCIA", "Ethernet Card", 0x738a0019, 0x281f1c5d, 0x5e9d92c0),
1676 PCMCIA_DEVICE_PROD_ID123("EFA ", "EFA207", "ETHERNET", 0x3d294be4, 0xeb9aab6c, 0x3ff7175b),
1677 PCMCIA_DEVICE_PROD_ID123("I-O DATA", "PCLA", "ETHERNET", 0x1d55d7ec, 0xe4c64d34, 0x3ff7175b),
1678 PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCLATE", "ETHERNET", 0x547e66dc, 0x6b260753, 0x3ff7175b),
1679 PCMCIA_DEVICE_PROD_ID123("KingMax Technology Inc.", "EN10-T2", "PCMCIA Ethernet Card", 0x932b7189, 0x699e4436, 0x6f6652e0),
1680 PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2216", 0x281f1c5d, 0xd4cd2f20, 0xb87add82),
1681 PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2620", 0x281f1c5d, 0xd4cd2f20, 0x7d3d83a8),
1682 PCMCIA_DEVICE_PROD_ID1("2412LAN", 0x67f236ab),
1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11),
1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff),
1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68),
1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997),
1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8),
1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96),
1689 PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8010", 0x5070a7f9, 0x82f96e96),
1690 PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8610", 0x5070a7f9, 0x86741224),
1691 PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002", 0x93b15570, 0x75ec3efb),
1692 PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002T", 0x93b15570, 0x461c5247),
1693 PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8010", 0x93b15570, 0x82f96e96),
1694 PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet", 0x578ba6e7, 0x0a9888c1),
1695 PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet 10/100", 0x578ba6e7, 0x939fedbd),
1696 PCMCIA_DEVICE_PROD_ID12("AROWANA", "PCMCIA Ethernet LAN Card", 0x313adbc8, 0x08d9f190),
1697 PCMCIA_DEVICE_PROD_ID12("ASANTE", "FriendlyNet PC Card", 0x3a7ade0f, 0x41c64504),
1698 PCMCIA_DEVICE_PROD_ID12("Billionton", "LNT-10TB", 0x552ab682, 0xeeb1ba6a),
1699 PCMCIA_DEVICE_PROD_ID12("CF", "10Base-Ethernet", 0x44ebf863, 0x93ae4d79),
1700 PCMCIA_DEVICE_PROD_ID12("CNet", "CN40BC Ethernet", 0xbc477dde, 0xfba775a7),
1701 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "BASEline PCMCIA 10 MBit Ethernetadapter", 0xfa2e424d, 0xe9190d8a),
1702 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9),
1703 PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722),
1704 PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2),
1705 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd),
1706 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
1707 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa),
1708 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9),
1709 PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2),
1710 PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2),
1711 PCMCIA_DEVICE_PROD_ID12("CouplerlessPCMCIA", "100BASE", 0xee5af0ad, 0x7c2add04),
1712 PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-010", 0x77008979, 0x9d8d445d),
1713 PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-110E 10/100M LAN Card", 0x77008979, 0xfd184814),
1714 PCMCIA_DEVICE_PROD_ID12("DataTrek.", "NetCard ", 0x5cd66d9d, 0x84697ce0),
1715 PCMCIA_DEVICE_PROD_ID12("Dayna Communications, Inc.", "CommuniCard E", 0x0c629325, 0xb4e7dbaf),
1716 PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100", 0x697403d8, 0xe160b995),
1717 PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100 Dongless", 0x697403d8, 0xa6d3b233),
1718 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e),
1719 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398),
1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660+", 0x1a424a1c, 0x50dcd0ec),
1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9),
1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84),
1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9),
1725 PCMCIA_DEVICE_PROD_ID12("Dynalink", "L10BC", 0x55632fd5, 0xdc65f2b1),
1726 PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10BC", 0x6a26d1cf, 0xdc65f2b1),
1727 PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10C", 0x6a26d1cf, 0xc4f84efb),
1728 PCMCIA_DEVICE_PROD_ID12("E-CARD", "E-CARD", 0x6701da11, 0x6701da11),
1729 PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet 10BaseT card", 0x53c864c6, 0xedd059f6),
1730 PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet Combo card", 0x53c864c6, 0x929c486c),
1731 PCMCIA_DEVICE_PROD_ID12("Ethernet", "Adapter", 0x00b2e941, 0x4b0d829e),
1732 PCMCIA_DEVICE_PROD_ID12("Ethernet Adapter", "E2000 PCMCIA Ethernet", 0x96767301, 0x71fbbc61),
1733 PCMCIA_DEVICE_PROD_ID12("Ethernet PCMCIA adapter", "EP-210", 0x8dd86181, 0xf2b52517),
1734 PCMCIA_DEVICE_PROD_ID12("Fast Ethernet", "Adapter", 0xb4be14e3, 0x4b0d829e),
1735 PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2000", 0x2a151fac, 0xf00555cb),
1736 PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2220", 0x2a151fac, 0xc1b7e327),
1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947),
1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941),
1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6),
1740 PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494),
1741 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b),
1742 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0),
1743 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956),
1744 PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64),
1745 PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5),
1746 PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3),
1747 PCMCIA_DEVICE_PROD_ID12("Kingston Technology Corp.", "EtheRx PC Card Ethernet Adapter", 0x313c7be3, 0x0afb54a2),
1748 PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-10/100CD", 0x1b7827b2, 0xcda71d1c),
1749 PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDF", 0x1b7827b2, 0xfec71e40),
1750 PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDL/T", 0x1b7827b2, 0x79fba4f7),
1751 PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDS", 0x1b7827b2, 0x931afaab),
1752 PCMCIA_DEVICE_PROD_ID12("Linksys", "Combo PCMCIA EthernetCard (EC2T)", 0x0733cc81, 0x32ee8c78),
1753 PCMCIA_DEVICE_PROD_ID12("LINKSYS", "E-CARD", 0xf7cb0b07, 0x6701da11),
1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d),
1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389),
1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9),
1757 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a),
1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737),
1759 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922),
1760 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0),
1761 PCMCIA_DEVICE_PROD_ID12("MACNICA", "ME1-JEIDA", 0x20841b68, 0xaf8a3578),
1762 PCMCIA_DEVICE_PROD_ID12("Macsense", "MPC-10", 0xd830297f, 0xd265c307),
1763 PCMCIA_DEVICE_PROD_ID12("Matsushita Electric Industrial Co.,LTD.", "CF-VEL211", 0x44445376, 0x8ded41d4),
1764 PCMCIA_DEVICE_PROD_ID12("MAXTECH", "PCN2000", 0x78d64bc0, 0xca0ca4b8),
1765 PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-T", 0x481e0094, 0xa2eb0cf3),
1766 PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-TX", 0x481e0094, 0x41a6916c),
1767 PCMCIA_DEVICE_PROD_ID12("Microcom C.E.", "Travel Card LAN 10/100", 0x4b91cec7, 0xe70220d6),
1768 PCMCIA_DEVICE_PROD_ID12("Microdyne", "NE4200", 0x2e6da59b, 0x0478e472),
1769 PCMCIA_DEVICE_PROD_ID12("MIDORI ELEC.", "LT-PCMT", 0x648d55c1, 0xbde526c7),
1770 PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover 4100", 0x36e1191f, 0x60c229b9),
1771 PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover NE4100", 0x36e1191f, 0xa6617ec8),
1772 PCMCIA_DEVICE_PROD_ID12("NEC", "PC-9801N-J12", 0x18df0ba0, 0xbc912d76),
1773 PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA410TX", 0x9aa79dc3, 0x60e5bc0e),
1774 PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA411", 0x9aa79dc3, 0x40fad875),
1775 PCMCIA_DEVICE_PROD_ID12("Network Everywhere", "Fast Ethernet 10/100 PC Card", 0x820a67b6, 0x31ed1a5f),
1776 PCMCIA_DEVICE_PROD_ID12("NextCom K.K.", "Next Hawk", 0xaedaec74, 0xad050ef1),
1777 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100Mbps Ethernet Card", 0x281f1c5d, 0x6e41773b),
1778 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet", 0x281f1c5d, 0x00b2e941),
1779 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET", 0x281f1c5d, 0x3ff7175b),
1780 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet 10BaseT Card", 0x281f1c5d, 0x4de2f6c8),
1781 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Card", 0x281f1c5d, 0x5e9d92c0),
1782 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Combo card", 0x281f1c5d, 0x929c486c),
1783 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET V1.0", 0x281f1c5d, 0x4d8817c8),
1784 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEthernet", 0x281f1c5d, 0xfe871eeb),
1785 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast-Ethernet", 0x281f1c5d, 0x45f1f3b4),
1786 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FAST ETHERNET CARD", 0x281f1c5d, 0xec5dbca7),
1787 PCMCIA_DEVICE_PROD_ID12("PCMCIA LAN", "Ethernet", 0x7500e246, 0x00b2e941),
1788 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "LNT-10TN", 0x281f1c5d, 0xe707f641),
1789 PCMCIA_DEVICE_PROD_ID12("PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
1790 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "UE2212", 0x281f1c5d, 0xbf17199b),
1791 PCMCIA_DEVICE_PROD_ID12("PCMCIA", " Ethernet NE2000 Compatible", 0x281f1c5d, 0x42d5d7e1),
1792 PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10baseT 3.3V", 0xebf91155, 0x30074c80),
1793 PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50),
1794 PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110),
1795 PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941),
1796 PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df),
1797 PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0),
1798 PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd),
1799 PCMCIA_DEVICE_PROD_ID12("RPTI LTD.", "EP400", 0xc53ac515, 0x81e39388),
1800 PCMCIA_DEVICE_PROD_ID12("SCM", "Ethernet Combo card", 0xbdc3b102, 0x929c486c),
1801 PCMCIA_DEVICE_PROD_ID12("Seiko Epson Corp.", "Ethernet", 0x09928730, 0x00b2e941),
1802 PCMCIA_DEVICE_PROD_ID12("SMC", "EZCard-10-PCMCIA", 0xc4f8b18b, 0xfb21d265),
1803 PCMCIA_DEVICE_PROD_ID12("Socket Communications Inc", "Socket EA PCMCIA LAN Adapter Revision D", 0xc70a4760, 0x2ade483e),
1804 PCMCIA_DEVICE_PROD_ID12("Socket Communications Inc", "Socket EA PCMCIA LAN Adapter Revision E", 0xc70a4760, 0x5dd978a8),
1805 PCMCIA_DEVICE_PROD_ID12("TDK", "LAK-CD031 for PCMCIA", 0x1eae9475, 0x0ed386fa),
1806 PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE450T", 0x466b05f0, 0x8b74bc4f),
1807 PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE550T", 0x466b05f0, 0x33c8db2a),
1808 PCMCIA_DEVICE_PROD_ID13("Hypertec", "EP401", 0x8787bec7, 0xf6e4a31e),
1809 PCMCIA_DEVICE_PROD_ID13("KingMax Technology Inc.", "Ethernet Card", 0x932b7189, 0x5e9d92c0),
1810 PCMCIA_DEVICE_PROD_ID13("LONGSHINE", "EP401", 0xf866b0b0, 0xf6e4a31e),
1811 PCMCIA_DEVICE_PROD_ID13("Xircom", "CFE-10", 0x2e3ee845, 0x22a49f89),
1812 PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360),
1813 PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de),
1814 PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f),
1815 PCMCIA_DEVICE_PROD_ID1("IC-CARD", 0x60cb09a6),
1816 PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a),
1817 PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078),
1818 /* too generic! */
1819 /* PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100 Ethernet Card", 0x281f1c5d, 0x11b0ffc0), */
1820 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "PCMLM28.cis"),
1821 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "PCMLM28.cis"),
1822 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "PCMLM28.cis"),
1823 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "PCMLM28.cis"),
1824 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "PCMLM28.cis"),
1825 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"),
1826 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"),
1827 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"),
1828 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "LA-PCM.cis"),
1829 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"),
1830 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
1831 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
1832 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"),
1833 PCMCIA_DEVICE_NULL
1834};
1835MODULE_DEVICE_TABLE(pcmcia, pcnet_ids);
1836
1638static struct pcmcia_driver pcnet_driver = { 1837static struct pcmcia_driver pcnet_driver = {
1639 .drv = { 1838 .drv = {
1640 .name = "pcnet_cs", 1839 .name = "pcnet_cs",
1641 }, 1840 },
1642 .attach = pcnet_attach, 1841 .attach = pcnet_attach,
1842 .event = pcnet_event,
1643 .detach = pcnet_detach, 1843 .detach = pcnet_detach,
1644 .owner = THIS_MODULE, 1844 .owner = THIS_MODULE,
1845 .id_table = pcnet_ids,
1645}; 1846};
1646 1847
1647static int __init init_pcnet_cs(void) 1848static int __init init_pcnet_cs(void)
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 85a152173148..d652e1eddb45 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -41,8 +41,8 @@
41#include <linux/ioport.h> 41#include <linux/ioport.h>
42#include <linux/ethtool.h> 42#include <linux/ethtool.h>
43#include <linux/mii.h> 43#include <linux/mii.h>
44#include <linux/jiffies.h>
44 45
45#include <pcmcia/version.h>
46#include <pcmcia/cs_types.h> 46#include <pcmcia/cs_types.h>
47#include <pcmcia/cs.h> 47#include <pcmcia/cs.h>
48#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
@@ -127,6 +127,12 @@ struct smc_private {
127 int rx_ovrn; 127 int rx_ovrn;
128}; 128};
129 129
130struct smc_cfg_mem {
131 tuple_t tuple;
132 cisparse_t parse;
133 u_char buf[255];
134};
135
130/* Special definitions for Megahertz multifunction cards */ 136/* Special definitions for Megahertz multifunction cards */
131#define MEGAHERTZ_ISR 0x0380 137#define MEGAHERTZ_ISR 0x0380
132 138
@@ -364,10 +370,6 @@ static dev_link_t *smc91c92_attach(void)
364 link->next = dev_list; 370 link->next = dev_list;
365 dev_list = link; 371 dev_list = link;
366 client_reg.dev_info = &dev_info; 372 client_reg.dev_info = &dev_info;
367 client_reg.EventMask = CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
368 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
369 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
370 client_reg.event_handler = &smc91c92_event;
371 client_reg.Version = 0x0210; 373 client_reg.Version = 0x0210;
372 client_reg.event_callback_args.client_data = link; 374 client_reg.event_callback_args.client_data = link;
373 ret = pcmcia_register_client(&link->handle, &client_reg); 375 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -498,14 +500,24 @@ static int mhz_mfc_config(dev_link_t *link)
498{ 500{
499 struct net_device *dev = link->priv; 501 struct net_device *dev = link->priv;
500 struct smc_private *smc = netdev_priv(dev); 502 struct smc_private *smc = netdev_priv(dev);
501 tuple_t tuple; 503 struct smc_cfg_mem *cfg_mem;
502 cisparse_t parse; 504 tuple_t *tuple;
503 u_char buf[255]; 505 cisparse_t *parse;
504 cistpl_cftable_entry_t *cf = &parse.cftable_entry; 506 cistpl_cftable_entry_t *cf;
507 u_char *buf;
505 win_req_t req; 508 win_req_t req;
506 memreq_t mem; 509 memreq_t mem;
507 int i, k; 510 int i, k;
508 511
512 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
513 if (!cfg_mem)
514 return CS_OUT_OF_RESOURCE;
515
516 tuple = &cfg_mem->tuple;
517 parse = &cfg_mem->parse;
518 cf = &parse->cftable_entry;
519 buf = cfg_mem->buf;
520
509 link->conf.Attributes |= CONF_ENABLE_SPKR; 521 link->conf.Attributes |= CONF_ENABLE_SPKR;
510 link->conf.Status = CCSR_AUDIO_ENA; 522 link->conf.Status = CCSR_AUDIO_ENA;
511 link->irq.Attributes = 523 link->irq.Attributes =
@@ -514,12 +526,12 @@ static int mhz_mfc_config(dev_link_t *link)
514 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 526 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
515 link->io.NumPorts2 = 8; 527 link->io.NumPorts2 = 8;
516 528
517 tuple.Attributes = tuple.TupleOffset = 0; 529 tuple->Attributes = tuple->TupleOffset = 0;
518 tuple.TupleData = (cisdata_t *)buf; 530 tuple->TupleData = (cisdata_t *)buf;
519 tuple.TupleDataMax = sizeof(buf); 531 tuple->TupleDataMax = 255;
520 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 532 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
521 533
522 i = first_tuple(link->handle, &tuple, &parse); 534 i = first_tuple(link->handle, tuple, parse);
523 /* The Megahertz combo cards have modem-like CIS entries, so 535 /* The Megahertz combo cards have modem-like CIS entries, so
524 we have to explicitly try a bunch of port combinations. */ 536 we have to explicitly try a bunch of port combinations. */
525 while (i == CS_SUCCESS) { 537 while (i == CS_SUCCESS) {
@@ -532,10 +544,10 @@ static int mhz_mfc_config(dev_link_t *link)
532 if (i == CS_SUCCESS) break; 544 if (i == CS_SUCCESS) break;
533 } 545 }
534 if (i == CS_SUCCESS) break; 546 if (i == CS_SUCCESS) break;
535 i = next_tuple(link->handle, &tuple, &parse); 547 i = next_tuple(link->handle, tuple, parse);
536 } 548 }
537 if (i != CS_SUCCESS) 549 if (i != CS_SUCCESS)
538 return i; 550 goto free_cfg_mem;
539 dev->base_addr = link->io.BasePort1; 551 dev->base_addr = link->io.BasePort1;
540 552
541 /* Allocate a memory window, for accessing the ISR */ 553 /* Allocate a memory window, for accessing the ISR */
@@ -544,7 +556,7 @@ static int mhz_mfc_config(dev_link_t *link)
544 req.AccessSpeed = 0; 556 req.AccessSpeed = 0;
545 i = pcmcia_request_window(&link->handle, &req, &link->win); 557 i = pcmcia_request_window(&link->handle, &req, &link->win);
546 if (i != CS_SUCCESS) 558 if (i != CS_SUCCESS)
547 return i; 559 goto free_cfg_mem;
548 smc->base = ioremap(req.Base, req.Size); 560 smc->base = ioremap(req.Base, req.Size);
549 mem.CardOffset = mem.Page = 0; 561 mem.CardOffset = mem.Page = 0;
550 if (smc->manfid == MANFID_MOTOROLA) 562 if (smc->manfid == MANFID_MOTOROLA)
@@ -556,6 +568,8 @@ static int mhz_mfc_config(dev_link_t *link)
556 && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 568 && (smc->cardid == PRODID_MEGAHERTZ_EM3288))
557 mhz_3288_power(link); 569 mhz_3288_power(link);
558 570
571free_cfg_mem:
572 kfree(cfg_mem);
559 return i; 573 return i;
560} 574}
561 575
@@ -563,39 +577,61 @@ static int mhz_setup(dev_link_t *link)
563{ 577{
564 client_handle_t handle = link->handle; 578 client_handle_t handle = link->handle;
565 struct net_device *dev = link->priv; 579 struct net_device *dev = link->priv;
566 tuple_t tuple; 580 struct smc_cfg_mem *cfg_mem;
567 cisparse_t parse; 581 tuple_t *tuple;
568 u_char buf[255], *station_addr; 582 cisparse_t *parse;
583 u_char *buf, *station_addr;
584 int rc;
585
586 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
587 if (!cfg_mem)
588 return -1;
589
590 tuple = &cfg_mem->tuple;
591 parse = &cfg_mem->parse;
592 buf = cfg_mem->buf;
569 593
570 tuple.Attributes = tuple.TupleOffset = 0; 594 tuple->Attributes = tuple->TupleOffset = 0;
571 tuple.TupleData = buf; 595 tuple->TupleData = (cisdata_t *)buf;
572 tuple.TupleDataMax = sizeof(buf); 596 tuple->TupleDataMax = 255;
573 597
574 /* Read the station address from the CIS. It is stored as the last 598 /* Read the station address from the CIS. It is stored as the last
575 (fourth) string in the Version 1 Version/ID tuple. */ 599 (fourth) string in the Version 1 Version/ID tuple. */
576 tuple.DesiredTuple = CISTPL_VERS_1; 600 tuple->DesiredTuple = CISTPL_VERS_1;
577 if (first_tuple(handle, &tuple, &parse) != CS_SUCCESS) 601 if (first_tuple(handle, tuple, parse) != CS_SUCCESS) {
578 return -1; 602 rc = -1;
603 goto free_cfg_mem;
604 }
579 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ 605 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
580 if (next_tuple(handle, &tuple, &parse) != CS_SUCCESS) 606 if (next_tuple(handle, tuple, parse) != CS_SUCCESS)
581 first_tuple(handle, &tuple, &parse); 607 first_tuple(handle, tuple, parse);
582 if (parse.version_1.ns > 3) { 608 if (parse->version_1.ns > 3) {
583 station_addr = parse.version_1.str + parse.version_1.ofs[3]; 609 station_addr = parse->version_1.str + parse->version_1.ofs[3];
584 if (cvt_ascii_address(dev, station_addr) == 0) 610 if (cvt_ascii_address(dev, station_addr) == 0) {
585 return 0; 611 rc = 0;
612 goto free_cfg_mem;
613 }
586 } 614 }
587 615
588 /* Another possibility: for the EM3288, in a special tuple */ 616 /* Another possibility: for the EM3288, in a special tuple */
589 tuple.DesiredTuple = 0x81; 617 tuple->DesiredTuple = 0x81;
590 if (pcmcia_get_first_tuple(handle, &tuple) != CS_SUCCESS) 618 if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) {
591 return -1; 619 rc = -1;
592 if (pcmcia_get_tuple_data(handle, &tuple) != CS_SUCCESS) 620 goto free_cfg_mem;
593 return -1; 621 }
622 if (pcmcia_get_tuple_data(handle, tuple) != CS_SUCCESS) {
623 rc = -1;
624 goto free_cfg_mem;
625 }
594 buf[12] = '\0'; 626 buf[12] = '\0';
595 if (cvt_ascii_address(dev, buf) == 0) 627 if (cvt_ascii_address(dev, buf) == 0) {
596 return 0; 628 rc = 0;
597 629 goto free_cfg_mem;
598 return -1; 630 }
631 rc = -1;
632free_cfg_mem:
633 kfree(cfg_mem);
634 return rc;
599} 635}
600 636
601/*====================================================================== 637/*======================================================================
@@ -665,19 +701,29 @@ static int mot_setup(dev_link_t *link)
665static int smc_config(dev_link_t *link) 701static int smc_config(dev_link_t *link)
666{ 702{
667 struct net_device *dev = link->priv; 703 struct net_device *dev = link->priv;
668 tuple_t tuple; 704 struct smc_cfg_mem *cfg_mem;
669 cisparse_t parse; 705 tuple_t *tuple;
670 u_char buf[255]; 706 cisparse_t *parse;
671 cistpl_cftable_entry_t *cf = &parse.cftable_entry; 707 cistpl_cftable_entry_t *cf;
708 u_char *buf;
672 int i; 709 int i;
673 710
674 tuple.Attributes = tuple.TupleOffset = 0; 711 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
675 tuple.TupleData = (cisdata_t *)buf; 712 if (!cfg_mem)
676 tuple.TupleDataMax = sizeof(buf); 713 return CS_OUT_OF_RESOURCE;
677 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 714
715 tuple = &cfg_mem->tuple;
716 parse = &cfg_mem->parse;
717 cf = &parse->cftable_entry;
718 buf = cfg_mem->buf;
719
720 tuple->Attributes = tuple->TupleOffset = 0;
721 tuple->TupleData = (cisdata_t *)buf;
722 tuple->TupleDataMax = 255;
723 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
678 724
679 link->io.NumPorts1 = 16; 725 link->io.NumPorts1 = 16;
680 i = first_tuple(link->handle, &tuple, &parse); 726 i = first_tuple(link->handle, tuple, parse);
681 while (i != CS_NO_MORE_ITEMS) { 727 while (i != CS_NO_MORE_ITEMS) {
682 if (i == CS_SUCCESS) { 728 if (i == CS_SUCCESS) {
683 link->conf.ConfigIndex = cf->index; 729 link->conf.ConfigIndex = cf->index;
@@ -686,10 +732,12 @@ static int smc_config(dev_link_t *link)
686 i = pcmcia_request_io(link->handle, &link->io); 732 i = pcmcia_request_io(link->handle, &link->io);
687 if (i == CS_SUCCESS) break; 733 if (i == CS_SUCCESS) break;
688 } 734 }
689 i = next_tuple(link->handle, &tuple, &parse); 735 i = next_tuple(link->handle, tuple, parse);
690 } 736 }
691 if (i == CS_SUCCESS) 737 if (i == CS_SUCCESS)
692 dev->base_addr = link->io.BasePort1; 738 dev->base_addr = link->io.BasePort1;
739
740 kfree(cfg_mem);
693 return i; 741 return i;
694} 742}
695 743
@@ -697,41 +745,58 @@ static int smc_setup(dev_link_t *link)
697{ 745{
698 client_handle_t handle = link->handle; 746 client_handle_t handle = link->handle;
699 struct net_device *dev = link->priv; 747 struct net_device *dev = link->priv;
700 tuple_t tuple; 748 struct smc_cfg_mem *cfg_mem;
701 cisparse_t parse; 749 tuple_t *tuple;
750 cisparse_t *parse;
702 cistpl_lan_node_id_t *node_id; 751 cistpl_lan_node_id_t *node_id;
703 u_char buf[255], *station_addr; 752 u_char *buf, *station_addr;
704 int i; 753 int i, rc;
754
755 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
756 if (!cfg_mem)
757 return CS_OUT_OF_RESOURCE;
705 758
706 tuple.Attributes = tuple.TupleOffset = 0; 759 tuple = &cfg_mem->tuple;
707 tuple.TupleData = buf; 760 parse = &cfg_mem->parse;
708 tuple.TupleDataMax = sizeof(buf); 761 buf = cfg_mem->buf;
762
763 tuple->Attributes = tuple->TupleOffset = 0;
764 tuple->TupleData = (cisdata_t *)buf;
765 tuple->TupleDataMax = 255;
709 766
710 /* Check for a LAN function extension tuple */ 767 /* Check for a LAN function extension tuple */
711 tuple.DesiredTuple = CISTPL_FUNCE; 768 tuple->DesiredTuple = CISTPL_FUNCE;
712 i = first_tuple(handle, &tuple, &parse); 769 i = first_tuple(handle, tuple, parse);
713 while (i == CS_SUCCESS) { 770 while (i == CS_SUCCESS) {
714 if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID) 771 if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID)
715 break; 772 break;
716 i = next_tuple(handle, &tuple, &parse); 773 i = next_tuple(handle, tuple, parse);
717 } 774 }
718 if (i == CS_SUCCESS) { 775 if (i == CS_SUCCESS) {
719 node_id = (cistpl_lan_node_id_t *)parse.funce.data; 776 node_id = (cistpl_lan_node_id_t *)parse->funce.data;
720 if (node_id->nb == 6) { 777 if (node_id->nb == 6) {
721 for (i = 0; i < 6; i++) 778 for (i = 0; i < 6; i++)
722 dev->dev_addr[i] = node_id->id[i]; 779 dev->dev_addr[i] = node_id->id[i];
723 return 0; 780 rc = 0;
781 goto free_cfg_mem;
724 } 782 }
725 } 783 }
726 /* Try the third string in the Version 1 Version/ID tuple. */ 784 /* Try the third string in the Version 1 Version/ID tuple. */
727 tuple.DesiredTuple = CISTPL_VERS_1; 785 tuple->DesiredTuple = CISTPL_VERS_1;
728 if (first_tuple(handle, &tuple, &parse) != CS_SUCCESS) 786 if (first_tuple(handle, tuple, parse) != CS_SUCCESS) {
729 return -1; 787 rc = -1;
730 station_addr = parse.version_1.str + parse.version_1.ofs[2]; 788 goto free_cfg_mem;
731 if (cvt_ascii_address(dev, station_addr) == 0) 789 }
732 return 0; 790 station_addr = parse->version_1.str + parse->version_1.ofs[2];
791 if (cvt_ascii_address(dev, station_addr) == 0) {
792 rc = 0;
793 goto free_cfg_mem;
794 }
733 795
734 return -1; 796 rc = -1;
797free_cfg_mem:
798 kfree(cfg_mem);
799 return rc;
735} 800}
736 801
737/*====================================================================*/ 802/*====================================================================*/
@@ -773,26 +838,36 @@ static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid)
773{ 838{
774 client_handle_t handle = link->handle; 839 client_handle_t handle = link->handle;
775 struct net_device *dev = link->priv; 840 struct net_device *dev = link->priv;
776 tuple_t tuple; 841 struct smc_cfg_mem *cfg_mem;
777 u_char buf[255]; 842 tuple_t *tuple;
778 int i; 843 u_char *buf;
844 int i, rc;
845
846 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
847 if (!cfg_mem)
848 return -1;
849
850 tuple = &cfg_mem->tuple;
851 buf = cfg_mem->buf;
779 852
780 tuple.Attributes = TUPLE_RETURN_COMMON; 853 tuple->Attributes = TUPLE_RETURN_COMMON;
781 tuple.TupleData = buf; 854 tuple->TupleData = (cisdata_t *)buf;
782 tuple.TupleDataMax = sizeof(buf); 855 tuple->TupleDataMax = 255;
783 tuple.TupleOffset = 0; 856 tuple->TupleOffset = 0;
784 857
785 /* Read the station address from tuple 0x90, subtuple 0x04 */ 858 /* Read the station address from tuple 0x90, subtuple 0x04 */
786 tuple.DesiredTuple = 0x90; 859 tuple->DesiredTuple = 0x90;
787 i = pcmcia_get_first_tuple(handle, &tuple); 860 i = pcmcia_get_first_tuple(handle, tuple);
788 while (i == CS_SUCCESS) { 861 while (i == CS_SUCCESS) {
789 i = pcmcia_get_tuple_data(handle, &tuple); 862 i = pcmcia_get_tuple_data(handle, tuple);
790 if ((i != CS_SUCCESS) || (buf[0] == 0x04)) 863 if ((i != CS_SUCCESS) || (buf[0] == 0x04))
791 break; 864 break;
792 i = pcmcia_get_next_tuple(handle, &tuple); 865 i = pcmcia_get_next_tuple(handle, tuple);
866 }
867 if (i != CS_SUCCESS) {
868 rc = -1;
869 goto free_cfg_mem;
793 } 870 }
794 if (i != CS_SUCCESS)
795 return -1;
796 for (i = 0; i < 6; i++) 871 for (i = 0; i < 6; i++)
797 dev->dev_addr[i] = buf[i+2]; 872 dev->dev_addr[i] = buf[i+2];
798 873
@@ -814,8 +889,10 @@ static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid)
814 inw(link->io.BasePort1 + OSITECH_AUI_PWR), 889 inw(link->io.BasePort1 + OSITECH_AUI_PWR),
815 inw(link->io.BasePort1 + OSITECH_RESET_ISR)); 890 inw(link->io.BasePort1 + OSITECH_RESET_ISR));
816 } 891 }
817 892 rc = 0;
818 return 0; 893free_cfg_mem:
894 kfree(cfg_mem);
895 return rc;
819} 896}
820 897
821/*====================================================================== 898/*======================================================================
@@ -887,9 +964,10 @@ static void smc91c92_config(dev_link_t *link)
887 client_handle_t handle = link->handle; 964 client_handle_t handle = link->handle;
888 struct net_device *dev = link->priv; 965 struct net_device *dev = link->priv;
889 struct smc_private *smc = netdev_priv(dev); 966 struct smc_private *smc = netdev_priv(dev);
890 tuple_t tuple; 967 struct smc_cfg_mem *cfg_mem;
891 cisparse_t parse; 968 tuple_t *tuple;
892 u_short buf[32]; 969 cisparse_t *parse;
970 u_char *buf;
893 char *name; 971 char *name;
894 int i, j, rev; 972 int i, j, rev;
895 kio_addr_t ioaddr; 973 kio_addr_t ioaddr;
@@ -897,21 +975,29 @@ static void smc91c92_config(dev_link_t *link)
897 975
898 DEBUG(0, "smc91c92_config(0x%p)\n", link); 976 DEBUG(0, "smc91c92_config(0x%p)\n", link);
899 977
900 tuple.Attributes = tuple.TupleOffset = 0; 978 cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
901 tuple.TupleData = (cisdata_t *)buf; 979 if (!cfg_mem)
902 tuple.TupleDataMax = sizeof(buf); 980 goto config_failed;
903 981
904 tuple.DesiredTuple = CISTPL_CONFIG; 982 tuple = &cfg_mem->tuple;
905 i = first_tuple(handle, &tuple, &parse); 983 parse = &cfg_mem->parse;
906 CS_EXIT_TEST(i, ParseTuple, config_failed); 984 buf = cfg_mem->buf;
907 link->conf.ConfigBase = parse.config.base;
908 link->conf.Present = parse.config.rmask[0];
909 985
910 tuple.DesiredTuple = CISTPL_MANFID; 986 tuple->Attributes = tuple->TupleOffset = 0;
911 tuple.Attributes = TUPLE_RETURN_COMMON; 987 tuple->TupleData = (cisdata_t *)buf;
912 if (first_tuple(handle, &tuple, &parse) == CS_SUCCESS) { 988 tuple->TupleDataMax = 64;
913 smc->manfid = parse.manfid.manf; 989
914 smc->cardid = parse.manfid.card; 990 tuple->DesiredTuple = CISTPL_CONFIG;
991 i = first_tuple(handle, tuple, parse);
992 CS_EXIT_TEST(i, ParseTuple, config_failed);
993 link->conf.ConfigBase = parse->config.base;
994 link->conf.Present = parse->config.rmask[0];
995
996 tuple->DesiredTuple = CISTPL_MANFID;
997 tuple->Attributes = TUPLE_RETURN_COMMON;
998 if (first_tuple(handle, tuple, parse) == CS_SUCCESS) {
999 smc->manfid = parse->manfid.manf;
1000 smc->cardid = parse->manfid.card;
915 } 1001 }
916 1002
917 /* Configure card */ 1003 /* Configure card */
@@ -1046,7 +1132,7 @@ static void smc91c92_config(dev_link_t *link)
1046 printk(KERN_NOTICE " No MII transceivers found!\n"); 1132 printk(KERN_NOTICE " No MII transceivers found!\n");
1047 } 1133 }
1048 } 1134 }
1049 1135 kfree(cfg_mem);
1050 return; 1136 return;
1051 1137
1052config_undo: 1138config_undo:
@@ -1054,6 +1140,7 @@ config_undo:
1054config_failed: /* CS_EXIT_TEST() calls jump to here... */ 1140config_failed: /* CS_EXIT_TEST() calls jump to here... */
1055 smc91c92_release(link); 1141 smc91c92_release(link);
1056 link->state &= ~DEV_CONFIG_PENDING; 1142 link->state &= ~DEV_CONFIG_PENDING;
1143 kfree(cfg_mem);
1057 1144
1058} /* smc91c92_config */ 1145} /* smc91c92_config */
1059 1146
@@ -2006,7 +2093,7 @@ static void media_check(u_long arg)
2006 } 2093 }
2007 2094
2008 /* Ignore collisions unless we've had no rx's recently */ 2095 /* Ignore collisions unless we've had no rx's recently */
2009 if (jiffies - dev->last_rx > HZ) { 2096 if (time_after(jiffies, dev->last_rx + HZ)) {
2010 if (smc->tx_err || (smc->media_status & EPH_16COL)) 2097 if (smc->tx_err || (smc->media_status & EPH_16COL))
2011 media |= EPH_16COL; 2098 media |= EPH_16COL;
2012 } 2099 }
@@ -2236,13 +2323,47 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
2236 return rc; 2323 return rc;
2237} 2324}
2238 2325
2326static struct pcmcia_device_id smc91c92_ids[] = {
2327 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0109, 0x0501),
2328 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0140, 0x000a),
2329 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63),
2330 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63),
2331 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef),
2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020),
2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023),
2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb),
2340 PCMCIA_DEVICE_PROD_ID12("ARGOSY", "Fast Ethernet PCCard", 0x78f308dc, 0xdcea68bc),
2341 PCMCIA_DEVICE_PROD_ID12("dit Co., Ltd.", "PC Card-10/100BTX", 0xe59365c8, 0x6a2161d1),
2342 PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L100C", 0x6a26d1cf, 0xc16ce9c5),
2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9),
2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953),
2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),
2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314),
2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a),
2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc),
2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9),
2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d),
2351 /* These conflict with other cards! */
2352 /* PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0100), */
2353 /* PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), */
2354 PCMCIA_DEVICE_NULL,
2355};
2356MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids);
2357
2239static struct pcmcia_driver smc91c92_cs_driver = { 2358static struct pcmcia_driver smc91c92_cs_driver = {
2240 .owner = THIS_MODULE, 2359 .owner = THIS_MODULE,
2241 .drv = { 2360 .drv = {
2242 .name = "smc91c92_cs", 2361 .name = "smc91c92_cs",
2243 }, 2362 },
2244 .attach = smc91c92_attach, 2363 .attach = smc91c92_attach,
2364 .event = smc91c92_event,
2245 .detach = smc91c92_detach, 2365 .detach = smc91c92_detach,
2366 .id_table = smc91c92_ids,
2246}; 2367};
2247 2368
2248static int __init init_smc91c92_cs(void) 2369static int __init init_smc91c92_cs(void)
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 58177d67ea12..ce143f08638a 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -81,7 +81,6 @@
81#include <linux/ioport.h> 81#include <linux/ioport.h>
82#include <linux/bitops.h> 82#include <linux/bitops.h>
83 83
84#include <pcmcia/version.h>
85#include <pcmcia/cs_types.h> 84#include <pcmcia/cs_types.h>
86#include <pcmcia/cs.h> 85#include <pcmcia/cs.h>
87#include <pcmcia/cistpl.h> 86#include <pcmcia/cistpl.h>
@@ -619,11 +618,6 @@ xirc2ps_attach(void)
619 link->next = dev_list; 618 link->next = dev_list;
620 dev_list = link; 619 dev_list = link;
621 client_reg.dev_info = &dev_info; 620 client_reg.dev_info = &dev_info;
622 client_reg.EventMask =
623 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
624 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
625 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
626 client_reg.event_handler = &xirc2ps_event;
627 client_reg.Version = 0x0210; 621 client_reg.Version = 0x0210;
628 client_reg.event_callback_args.client_data = link; 622 client_reg.event_callback_args.client_data = link;
629 if ((err = pcmcia_register_client(&link->handle, &client_reg))) { 623 if ((err = pcmcia_register_client(&link->handle, &client_reg))) {
@@ -1983,13 +1977,42 @@ do_stop(struct net_device *dev)
1983 return 0; 1977 return 0;
1984} 1978}
1985 1979
1980static struct pcmcia_device_id xirc2ps_ids[] = {
1981 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0089, 0x110a),
1982 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0138, 0x110a),
1983 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea),
1984 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM33", 0x2e3ee845, 0x80609023),
1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a),
1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2),
1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37),
1992 PCMCIA_DEVICE_PROD_ID13("Xircom", "PS-CE2-10", 0x2e3ee845, 0x947d9073),
1993 PCMCIA_DEVICE_PROD_ID13("Xircom", "R2E-100BTX", 0x2e3ee845, 0x2464a6e3),
1994 PCMCIA_DEVICE_PROD_ID13("Xircom", "RE-10", 0x2e3ee845, 0x3e08d609),
1995 PCMCIA_DEVICE_PROD_ID13("Xircom", "XE2000", 0x2e3ee845, 0xf7188e46),
1996 PCMCIA_DEVICE_PROD_ID12("Compaq", "Ethernet LAN Card", 0x54f7c49c, 0x9fd2f0a2),
1997 PCMCIA_DEVICE_PROD_ID12("Compaq", "Netelligent 10/100 PC Card", 0x54f7c49c, 0xefe96769),
1998 PCMCIA_DEVICE_PROD_ID12("Intel", "EtherExpress(TM) PRO/100 PC Card Mobile Adapter16", 0x816cc815, 0x174397db),
1999 PCMCIA_DEVICE_PROD_ID12("Toshiba", "10/100 Ethernet PC Card", 0x44a09d9c, 0xb44deecf),
2000 /* also matches CFE-10 cards! */
2001 /* PCMCIA_DEVICE_MANF_CARD(0x0105, 0x010a), */
2002 PCMCIA_DEVICE_NULL,
2003};
2004MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids);
2005
2006
1986static struct pcmcia_driver xirc2ps_cs_driver = { 2007static struct pcmcia_driver xirc2ps_cs_driver = {
1987 .owner = THIS_MODULE, 2008 .owner = THIS_MODULE,
1988 .drv = { 2009 .drv = {
1989 .name = "xirc2ps_cs", 2010 .name = "xirc2ps_cs",
1990 }, 2011 },
1991 .attach = xirc2ps_attach, 2012 .attach = xirc2ps_attach,
2013 .event = xirc2ps_event,
1992 .detach = xirc2ps_detach, 2014 .detach = xirc2ps_detach,
2015 .id_table = xirc2ps_ids,
1993}; 2016};
1994 2017
1995static int __init 2018static int __init
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 13f114876965..113b68099216 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -850,7 +850,7 @@ static int pcnet32_phys_id(struct net_device *dev, u32 data)
850 if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))) 850 if ((!data) || (data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)))
851 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 851 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
852 852
853 schedule_timeout(data * HZ); 853 msleep_interruptible(data * 1000);
854 del_timer_sync(&lp->blink_timer); 854 del_timer_sync(&lp->blink_timer);
855 855
856 /* Restore the original value of the bcrs */ 856 /* Restore the original value of the bcrs */
@@ -1602,7 +1602,7 @@ pcnet32_init_ring(struct net_device *dev)
1602 1602
1603 rmb(); 1603 rmb();
1604 if (lp->rx_dma_addr[i] == 0) 1604 if (lp->rx_dma_addr[i] == 0)
1605 lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->tail, 1605 lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->data,
1606 PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); 1606 PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE);
1607 lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]); 1607 lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]);
1608 lp->rx_ring[i].buf_length = le16_to_cpu(2-PKT_BUF_SZ); 1608 lp->rx_ring[i].buf_length = le16_to_cpu(2-PKT_BUF_SZ);
@@ -1983,7 +1983,7 @@ pcnet32_rx(struct net_device *dev)
1983 lp->rx_skbuff[entry] = newskb; 1983 lp->rx_skbuff[entry] = newskb;
1984 newskb->dev = dev; 1984 newskb->dev = dev;
1985 lp->rx_dma_addr[entry] = 1985 lp->rx_dma_addr[entry] =
1986 pci_map_single(lp->pci_dev, newskb->tail, 1986 pci_map_single(lp->pci_dev, newskb->data,
1987 PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); 1987 PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE);
1988 lp->rx_ring[entry].base = le32_to_cpu(lp->rx_dma_addr[entry]); 1988 lp->rx_ring[entry].base = le32_to_cpu(lp->rx_dma_addr[entry]);
1989 rx_in_place = 1; 1989 rx_in_place = 1;
@@ -2020,7 +2020,7 @@ pcnet32_rx(struct net_device *dev)
2020 PKT_BUF_SZ-2, 2020 PKT_BUF_SZ-2,
2021 PCI_DMA_FROMDEVICE); 2021 PCI_DMA_FROMDEVICE);
2022 eth_copy_and_sum(skb, 2022 eth_copy_and_sum(skb,
2023 (unsigned char *)(lp->rx_skbuff[entry]->tail), 2023 (unsigned char *)(lp->rx_skbuff[entry]->data),
2024 pkt_len,0); 2024 pkt_len,0);
2025 pci_dma_sync_single_for_device(lp->pci_dev, 2025 pci_dma_sync_single_for_device(lp->pci_dev,
2026 lp->rx_dma_addr[entry], 2026 lp->rx_dma_addr[entry],
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index f4b62405d2e5..1bd22cd40c75 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -160,7 +160,7 @@ static struct net_device_stats *plip_get_stats(struct net_device *dev);
160static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 160static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
161static int plip_preempt(void *handle); 161static int plip_preempt(void *handle);
162static void plip_wakeup(void *handle); 162static void plip_wakeup(void *handle);
163 163
164enum plip_connection_state { 164enum plip_connection_state {
165 PLIP_CN_NONE=0, 165 PLIP_CN_NONE=0,
166 PLIP_CN_RECEIVE, 166 PLIP_CN_RECEIVE,
@@ -231,8 +231,8 @@ struct net_local {
231 atomic_t kill_timer; 231 atomic_t kill_timer;
232 struct semaphore killed_timer_sem; 232 struct semaphore killed_timer_sem;
233}; 233};
234 234
235inline static void enable_parport_interrupts (struct net_device *dev) 235static inline void enable_parport_interrupts (struct net_device *dev)
236{ 236{
237 if (dev->irq != -1) 237 if (dev->irq != -1)
238 { 238 {
@@ -242,7 +242,7 @@ inline static void enable_parport_interrupts (struct net_device *dev)
242 } 242 }
243} 243}
244 244
245inline static void disable_parport_interrupts (struct net_device *dev) 245static inline void disable_parport_interrupts (struct net_device *dev)
246{ 246{
247 if (dev->irq != -1) 247 if (dev->irq != -1)
248 { 248 {
@@ -252,7 +252,7 @@ inline static void disable_parport_interrupts (struct net_device *dev)
252 } 252 }
253} 253}
254 254
255inline static void write_data (struct net_device *dev, unsigned char data) 255static inline void write_data (struct net_device *dev, unsigned char data)
256{ 256{
257 struct parport *port = 257 struct parport *port =
258 ((struct net_local *)dev->priv)->pardev->port; 258 ((struct net_local *)dev->priv)->pardev->port;
@@ -260,14 +260,14 @@ inline static void write_data (struct net_device *dev, unsigned char data)
260 port->ops->write_data (port, data); 260 port->ops->write_data (port, data);
261} 261}
262 262
263inline static unsigned char read_status (struct net_device *dev) 263static inline unsigned char read_status (struct net_device *dev)
264{ 264{
265 struct parport *port = 265 struct parport *port =
266 ((struct net_local *)dev->priv)->pardev->port; 266 ((struct net_local *)dev->priv)->pardev->port;
267 267
268 return port->ops->read_status (port); 268 return port->ops->read_status (port);
269} 269}
270 270
271/* Entry point of PLIP driver. 271/* Entry point of PLIP driver.
272 Probe the hardware, and register/initialize the driver. 272 Probe the hardware, and register/initialize the driver.
273 273
@@ -316,7 +316,7 @@ plip_init_netdev(struct net_device *dev)
316 316
317 spin_lock_init(&nl->lock); 317 spin_lock_init(&nl->lock);
318} 318}
319 319
320/* Bottom half handler for the delayed request. 320/* Bottom half handler for the delayed request.
321 This routine is kicked by do_timer(). 321 This routine is kicked by do_timer().
322 Request `plip_bh' to be invoked. */ 322 Request `plip_bh' to be invoked. */
@@ -471,7 +471,7 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
471 471
472 return TIMEOUT; 472 return TIMEOUT;
473} 473}
474 474
475static int 475static int
476plip_none(struct net_device *dev, struct net_local *nl, 476plip_none(struct net_device *dev, struct net_local *nl,
477 struct plip_local *snd, struct plip_local *rcv) 477 struct plip_local *snd, struct plip_local *rcv)
@@ -481,7 +481,7 @@ plip_none(struct net_device *dev, struct net_local *nl,
481 481
482/* PLIP_RECEIVE --- receive a byte(two nibbles) 482/* PLIP_RECEIVE --- receive a byte(two nibbles)
483 Returns OK on success, TIMEOUT on timeout */ 483 Returns OK on success, TIMEOUT on timeout */
484inline static int 484static inline int
485plip_receive(unsigned short nibble_timeout, struct net_device *dev, 485plip_receive(unsigned short nibble_timeout, struct net_device *dev,
486 enum plip_nibble_state *ns_p, unsigned char *data_p) 486 enum plip_nibble_state *ns_p, unsigned char *data_p)
487{ 487{
@@ -540,7 +540,7 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev,
540 * in far too many old systems not all even running Linux. 540 * in far too many old systems not all even running Linux.
541 */ 541 */
542 542
543static unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *dev) 543static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)
544{ 544{
545 struct ethhdr *eth; 545 struct ethhdr *eth;
546 unsigned char *rawp; 546 unsigned char *rawp;
@@ -582,7 +582,6 @@ static unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *de
582 return htons(ETH_P_802_2); 582 return htons(ETH_P_802_2);
583} 583}
584 584
585
586/* PLIP_RECEIVE_PACKET --- receive a packet */ 585/* PLIP_RECEIVE_PACKET --- receive a packet */
587static int 586static int
588plip_receive_packet(struct net_device *dev, struct net_local *nl, 587plip_receive_packet(struct net_device *dev, struct net_local *nl,
@@ -702,7 +701,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
702 701
703/* PLIP_SEND --- send a byte (two nibbles) 702/* PLIP_SEND --- send a byte (two nibbles)
704 Returns OK on success, TIMEOUT when timeout */ 703 Returns OK on success, TIMEOUT when timeout */
705inline static int 704static inline int
706plip_send(unsigned short nibble_timeout, struct net_device *dev, 705plip_send(unsigned short nibble_timeout, struct net_device *dev,
707 enum plip_nibble_state *ns_p, unsigned char data) 706 enum plip_nibble_state *ns_p, unsigned char data)
708{ 707{
@@ -902,7 +901,7 @@ plip_error(struct net_device *dev, struct net_local *nl,
902 901
903 return OK; 902 return OK;
904} 903}
905 904
906/* Handle the parallel port interrupts. */ 905/* Handle the parallel port interrupts. */
907static void 906static void
908plip_interrupt(int irq, void *dev_id, struct pt_regs * regs) 907plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -957,7 +956,7 @@ plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
957 956
958 spin_unlock_irq(&nl->lock); 957 spin_unlock_irq(&nl->lock);
959} 958}
960 959
961static int 960static int
962plip_tx_packet(struct sk_buff *skb, struct net_device *dev) 961plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
963{ 962{
@@ -1238,7 +1237,7 @@ plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1238 } 1237 }
1239 return 0; 1238 return 0;
1240} 1239}
1241 1240
1242static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 }; 1241static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 };
1243static int timid; 1242static int timid;
1244 1243
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 33b9d79b1aad..59e8183c639e 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -364,7 +364,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
364 spin_lock_irqsave(&ap->recv_lock, flags); 364 spin_lock_irqsave(&ap->recv_lock, flags);
365 ppp_async_input(ap, buf, cflags, count); 365 ppp_async_input(ap, buf, cflags, count);
366 spin_unlock_irqrestore(&ap->recv_lock, flags); 366 spin_unlock_irqrestore(&ap->recv_lock, flags);
367 if (skb_queue_len(&ap->rqueue)) 367 if (!skb_queue_empty(&ap->rqueue))
368 tasklet_schedule(&ap->tsk); 368 tasklet_schedule(&ap->tsk);
369 ap_put(ap); 369 ap_put(ap);
370 if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) 370 if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)
@@ -1025,7 +1025,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
1025 1025
1026static void __exit ppp_async_cleanup(void) 1026static void __exit ppp_async_cleanup(void)
1027{ 1027{
1028 if (tty_register_ldisc(N_PPP, NULL) != 0) 1028 if (tty_unregister_ldisc(N_PPP) != 0)
1029 printk(KERN_ERR "failed to unregister PPP line discipline\n"); 1029 printk(KERN_ERR "failed to unregister PPP line discipline\n");
1030} 1030}
1031 1031
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index ab726ab43798..a32668e88e09 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1237,8 +1237,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1237 pch = list_entry(list, struct channel, clist); 1237 pch = list_entry(list, struct channel, clist);
1238 navail += pch->avail = (pch->chan != NULL); 1238 navail += pch->avail = (pch->chan != NULL);
1239 if (pch->avail) { 1239 if (pch->avail) {
1240 if (skb_queue_len(&pch->file.xq) == 0 1240 if (skb_queue_empty(&pch->file.xq) ||
1241 || !pch->had_frag) { 1241 !pch->had_frag) {
1242 pch->avail = 2; 1242 pch->avail = 2;
1243 ++nfree; 1243 ++nfree;
1244 } 1244 }
@@ -1374,8 +1374,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1374 1374
1375 /* try to send it down the channel */ 1375 /* try to send it down the channel */
1376 chan = pch->chan; 1376 chan = pch->chan;
1377 if (skb_queue_len(&pch->file.xq) 1377 if (!skb_queue_empty(&pch->file.xq) ||
1378 || !chan->ops->start_xmit(chan, frag)) 1378 !chan->ops->start_xmit(chan, frag))
1379 skb_queue_tail(&pch->file.xq, frag); 1379 skb_queue_tail(&pch->file.xq, frag);
1380 pch->had_frag = 1; 1380 pch->had_frag = 1;
1381 p += flen; 1381 p += flen;
@@ -1412,7 +1412,7 @@ ppp_channel_push(struct channel *pch)
1412 1412
1413 spin_lock_bh(&pch->downl); 1413 spin_lock_bh(&pch->downl);
1414 if (pch->chan != 0) { 1414 if (pch->chan != 0) {
1415 while (skb_queue_len(&pch->file.xq) > 0) { 1415 while (!skb_queue_empty(&pch->file.xq)) {
1416 skb = skb_dequeue(&pch->file.xq); 1416 skb = skb_dequeue(&pch->file.xq);
1417 if (!pch->chan->ops->start_xmit(pch->chan, skb)) { 1417 if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
1418 /* put the packet back and try again later */ 1418 /* put the packet back and try again later */
@@ -1426,7 +1426,7 @@ ppp_channel_push(struct channel *pch)
1426 } 1426 }
1427 spin_unlock_bh(&pch->downl); 1427 spin_unlock_bh(&pch->downl);
1428 /* see if there is anything from the attached unit to be sent */ 1428 /* see if there is anything from the attached unit to be sent */
1429 if (skb_queue_len(&pch->file.xq) == 0) { 1429 if (skb_queue_empty(&pch->file.xq)) {
1430 read_lock_bh(&pch->upl); 1430 read_lock_bh(&pch->upl);
1431 ppp = pch->ppp; 1431 ppp = pch->ppp;
1432 if (ppp != 0) 1432 if (ppp != 0)
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index 7d0150b4c629..4d51c0c8023d 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -406,7 +406,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
406 spin_lock_irqsave(&ap->recv_lock, flags); 406 spin_lock_irqsave(&ap->recv_lock, flags);
407 ppp_sync_input(ap, buf, cflags, count); 407 ppp_sync_input(ap, buf, cflags, count);
408 spin_unlock_irqrestore(&ap->recv_lock, flags); 408 spin_unlock_irqrestore(&ap->recv_lock, flags);
409 if (skb_queue_len(&ap->rqueue)) 409 if (!skb_queue_empty(&ap->rqueue))
410 tasklet_schedule(&ap->tsk); 410 tasklet_schedule(&ap->tsk);
411 sp_put(ap); 411 sp_put(ap);
412 if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) 412 if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)
@@ -793,7 +793,7 @@ err:
793static void __exit 793static void __exit
794ppp_sync_cleanup(void) 794ppp_sync_cleanup(void)
795{ 795{
796 if (tty_register_ldisc(N_SYNC_PPP, NULL) != 0) 796 if (tty_unregister_ldisc(N_SYNC_PPP) != 0)
797 printk(KERN_ERR "failed to unregister Sync PPP line discipline\n"); 797 printk(KERN_ERR "failed to unregister Sync PPP line discipline\n");
798} 798}
799 799
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index ce449fe90e6d..d5afe05cd826 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1876,7 +1876,7 @@ static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
1876 skb_reserve(skb, NET_IP_ALIGN); 1876 skb_reserve(skb, NET_IP_ALIGN);
1877 *sk_buff = skb; 1877 *sk_buff = skb;
1878 1878
1879 mapping = pci_map_single(pdev, skb->tail, rx_buf_sz, 1879 mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
1880 PCI_DMA_FROMDEVICE); 1880 PCI_DMA_FROMDEVICE);
1881 1881
1882 rtl8169_map_to_asic(desc, mapping, rx_buf_sz); 1882 rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
@@ -2336,7 +2336,7 @@ static inline int rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
2336 skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN); 2336 skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN);
2337 if (skb) { 2337 if (skb) {
2338 skb_reserve(skb, NET_IP_ALIGN); 2338 skb_reserve(skb, NET_IP_ALIGN);
2339 eth_copy_and_sum(skb, sk_buff[0]->tail, pkt_size, 0); 2339 eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0);
2340 *sk_buff = skb; 2340 *sk_buff = skb;
2341 rtl8169_mark_to_asic(desc, rx_buf_sz); 2341 rtl8169_mark_to_asic(desc, rx_buf_sz);
2342 ret = 0; 2342 ret = 0;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 9c224eba057d..ea638b162d3f 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -42,6 +42,7 @@
42#include <linux/errno.h> 42#include <linux/errno.h>
43#include <linux/ioport.h> 43#include <linux/ioport.h>
44#include <linux/pci.h> 44#include <linux/pci.h>
45#include <linux/dma-mapping.h>
45#include <linux/kernel.h> 46#include <linux/kernel.h>
46#include <linux/netdevice.h> 47#include <linux/netdevice.h>
47#include <linux/etherdevice.h> 48#include <linux/etherdevice.h>
@@ -1698,11 +1699,9 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
1698#else 1699#else
1699 ba = &nic->ba[ring_no][block_no][off]; 1700 ba = &nic->ba[ring_no][block_no][off];
1700 skb_reserve(skb, BUF0_LEN); 1701 skb_reserve(skb, BUF0_LEN);
1701 tmp = (unsigned long) skb->data; 1702 tmp = ((unsigned long) skb->data & ALIGN_SIZE);
1702 tmp += ALIGN_SIZE; 1703 if (tmp)
1703 tmp &= ~ALIGN_SIZE; 1704 skb_reserve(skb, (ALIGN_SIZE + 1) - tmp);
1704 skb->data = (void *) tmp;
1705 skb->tail = (void *) tmp;
1706 1705
1707 memset(rxdp, 0, sizeof(RxD_t)); 1706 memset(rxdp, 0, sizeof(RxD_t));
1708 rxdp->Buffer2_ptr = pci_map_single 1707 rxdp->Buffer2_ptr = pci_map_single
@@ -4593,19 +4592,19 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
4593 return ret; 4592 return ret;
4594 } 4593 }
4595 4594
4596 if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { 4595 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
4597 DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 64bit DMA\n"); 4596 DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 64bit DMA\n");
4598 dma_flag = TRUE; 4597 dma_flag = TRUE;
4599 4598
4600 if (pci_set_consistent_dma_mask 4599 if (pci_set_consistent_dma_mask
4601 (pdev, 0xffffffffffffffffULL)) { 4600 (pdev, DMA_64BIT_MASK)) {
4602 DBG_PRINT(ERR_DBG, 4601 DBG_PRINT(ERR_DBG,
4603 "Unable to obtain 64bit DMA for \ 4602 "Unable to obtain 64bit DMA for \
4604 consistent allocations\n"); 4603 consistent allocations\n");
4605 pci_disable_device(pdev); 4604 pci_disable_device(pdev);
4606 return -ENOMEM; 4605 return -ENOMEM;
4607 } 4606 }
4608 } else if (!pci_set_dma_mask(pdev, 0xffffffffUL)) { 4607 } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
4609 DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n"); 4608 DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n");
4610 } else { 4609 } else {
4611 pci_disable_device(pdev); 4610 pci_disable_device(pdev);
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index e15369c8d165..d6388e1533f0 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -90,7 +90,6 @@ static int sb1000_close(struct net_device *dev);
90 90
91 91
92/* SB1000 hardware routines to be used during open/configuration phases */ 92/* SB1000 hardware routines to be used during open/configuration phases */
93static inline void nicedelay(unsigned long usecs);
94static inline int card_wait_for_busy_clear(const int ioaddr[], 93static inline int card_wait_for_busy_clear(const int ioaddr[],
95 const char* name); 94 const char* name);
96static inline int card_wait_for_ready(const int ioaddr[], const char* name, 95static inline int card_wait_for_ready(const int ioaddr[], const char* name,
@@ -254,13 +253,6 @@ static struct pnp_driver sb1000_driver = {
254 253
255static const int TimeOutJiffies = (875 * HZ) / 100; 254static const int TimeOutJiffies = (875 * HZ) / 100;
256 255
257static inline void nicedelay(unsigned long usecs)
258{
259 current->state = TASK_INTERRUPTIBLE;
260 schedule_timeout(HZ);
261 return;
262}
263
264/* Card Wait For Busy Clear (cannot be used during an interrupt) */ 256/* Card Wait For Busy Clear (cannot be used during an interrupt) */
265static inline int 257static inline int
266card_wait_for_busy_clear(const int ioaddr[], const char* name) 258card_wait_for_busy_clear(const int ioaddr[], const char* name)
@@ -475,7 +467,7 @@ sb1000_reset(const int ioaddr[], const char* name)
475 udelay(1000); 467 udelay(1000);
476 outb(0x0, port); 468 outb(0x0, port);
477 inb(port); 469 inb(port);
478 nicedelay(60000); 470 ssleep(1);
479 outb(0x4, port); 471 outb(0x4, port);
480 inb(port); 472 inb(port);
481 udelay(1000); 473 udelay(1000);
@@ -537,7 +529,7 @@ sb1000_activate(const int ioaddr[], const char* name)
537 const unsigned char Command0[6] = {0x80, 0x11, 0x00, 0x00, 0x00, 0x00}; 529 const unsigned char Command0[6] = {0x80, 0x11, 0x00, 0x00, 0x00, 0x00};
538 const unsigned char Command1[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 530 const unsigned char Command1[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00};
539 531
540 nicedelay(50000); 532 ssleep(1);
541 if ((status = card_send_command(ioaddr, name, Command0, st))) 533 if ((status = card_send_command(ioaddr, name, Command0, st)))
542 return status; 534 return status;
543 if ((status = card_send_command(ioaddr, name, Command1, st))) 535 if ((status = card_send_command(ioaddr, name, Command1, st)))
@@ -944,7 +936,7 @@ sb1000_open(struct net_device *dev)
944 /* initialize sb1000 */ 936 /* initialize sb1000 */
945 if ((status = sb1000_reset(ioaddr, name))) 937 if ((status = sb1000_reset(ioaddr, name)))
946 return status; 938 return status;
947 nicedelay(200000); 939 ssleep(1);
948 if ((status = sb1000_check_CRC(ioaddr, name))) 940 if ((status = sb1000_check_CRC(ioaddr, name)))
949 return status; 941 return status;
950 942
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index fd2e7c374906..7abd55a4fb21 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -963,11 +963,11 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
963 /* 963 /*
964 * Do not interrupt per DMA transfer. 964 * Do not interrupt per DMA transfer.
965 */ 965 */
966 dsc->dscr_a = virt_to_phys(sb_new->tail) | 966 dsc->dscr_a = virt_to_phys(sb_new->data) |
967 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 967 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) |
968 0; 968 0;
969#else 969#else
970 dsc->dscr_a = virt_to_phys(sb_new->tail) | 970 dsc->dscr_a = virt_to_phys(sb_new->data) |
971 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 971 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) |
972 M_DMA_DSCRA_INTERRUPT; 972 M_DMA_DSCRA_INTERRUPT;
973#endif 973#endif
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index 20edeb345792..3ad0b6751f6f 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -135,10 +135,8 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
135{ 135{
136 struct shaper *shaper = dev->priv; 136 struct shaper *shaper = dev->priv;
137 struct sk_buff *ptr; 137 struct sk_buff *ptr;
138 138
139 if (down_trylock(&shaper->sem)) 139 spin_lock(&shaper->lock);
140 return -1;
141
142 ptr=shaper->sendq.prev; 140 ptr=shaper->sendq.prev;
143 141
144 /* 142 /*
@@ -232,7 +230,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
232 shaper->stats.collisions++; 230 shaper->stats.collisions++;
233 } 231 }
234 shaper_kick(shaper); 232 shaper_kick(shaper);
235 up(&shaper->sem); 233 spin_unlock(&shaper->lock);
236 return 0; 234 return 0;
237} 235}
238 236
@@ -271,11 +269,9 @@ static void shaper_timer(unsigned long data)
271{ 269{
272 struct shaper *shaper = (struct shaper *)data; 270 struct shaper *shaper = (struct shaper *)data;
273 271
274 if (!down_trylock(&shaper->sem)) { 272 spin_lock(&shaper->lock);
275 shaper_kick(shaper); 273 shaper_kick(shaper);
276 up(&shaper->sem); 274 spin_unlock(&shaper->lock);
277 } else
278 mod_timer(&shaper->timer, jiffies);
279} 275}
280 276
281/* 277/*
@@ -332,21 +328,6 @@ static void shaper_kick(struct shaper *shaper)
332 328
333 329
334/* 330/*
335 * Flush the shaper queues on a closedown
336 */
337
338static void shaper_flush(struct shaper *shaper)
339{
340 struct sk_buff *skb;
341
342 down(&shaper->sem);
343 while((skb=skb_dequeue(&shaper->sendq))!=NULL)
344 dev_kfree_skb(skb);
345 shaper_kick(shaper);
346 up(&shaper->sem);
347}
348
349/*
350 * Bring the interface up. We just disallow this until a 331 * Bring the interface up. We just disallow this until a
351 * bind. 332 * bind.
352 */ 333 */
@@ -375,7 +356,15 @@ static int shaper_open(struct net_device *dev)
375static int shaper_close(struct net_device *dev) 356static int shaper_close(struct net_device *dev)
376{ 357{
377 struct shaper *shaper=dev->priv; 358 struct shaper *shaper=dev->priv;
378 shaper_flush(shaper); 359 struct sk_buff *skb;
360
361 while ((skb = skb_dequeue(&shaper->sendq)) != NULL)
362 dev_kfree_skb(skb);
363
364 spin_lock_bh(&shaper->lock);
365 shaper_kick(shaper);
366 spin_unlock_bh(&shaper->lock);
367
379 del_timer_sync(&shaper->timer); 368 del_timer_sync(&shaper->timer);
380 return 0; 369 return 0;
381} 370}
@@ -576,6 +565,7 @@ static void shaper_init_priv(struct net_device *dev)
576 init_timer(&sh->timer); 565 init_timer(&sh->timer);
577 sh->timer.function=shaper_timer; 566 sh->timer.function=shaper_timer;
578 sh->timer.data=(unsigned long)sh; 567 sh->timer.data=(unsigned long)sh;
568 spin_lock_init(&sh->lock);
579} 569}
580 570
581/* 571/*
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 3107aed0fb51..23b713c700b3 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -66,6 +66,7 @@
66#include <linux/ethtool.h> 66#include <linux/ethtool.h>
67#include <linux/crc32.h> 67#include <linux/crc32.h>
68#include <linux/bitops.h> 68#include <linux/bitops.h>
69#include <linux/dma-mapping.h>
69 70
70#include <asm/processor.h> /* Processor type for cache alignment. */ 71#include <asm/processor.h> /* Processor type for cache alignment. */
71#include <asm/io.h> 72#include <asm/io.h>
@@ -93,8 +94,6 @@ static int sis900_debug = -1; /* Use SIS900_DEF_MSG as value */
93 94
94/* Time in jiffies before concluding the transmitter is hung. */ 95/* Time in jiffies before concluding the transmitter is hung. */
95#define TX_TIMEOUT (4*HZ) 96#define TX_TIMEOUT (4*HZ)
96/* SiS 900 is capable of 32 bits BM DMA */
97#define SIS900_DMA_MASK 0xffffffff
98 97
99enum { 98enum {
100 SIS_900 = 0, 99 SIS_900 = 0,
@@ -414,7 +413,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
414 ret = pci_enable_device(pci_dev); 413 ret = pci_enable_device(pci_dev);
415 if(ret) return ret; 414 if(ret) return ret;
416 415
417 i = pci_set_dma_mask(pci_dev, SIS900_DMA_MASK); 416 i = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK);
418 if(i){ 417 if(i){
419 printk(KERN_ERR "sis900.c: architecture does not support" 418 printk(KERN_ERR "sis900.c: architecture does not support"
420 "32bit PCI busmaster DMA\n"); 419 "32bit PCI busmaster DMA\n");
@@ -1155,7 +1154,7 @@ sis900_init_rx_ring(struct net_device *net_dev)
1155 sis_priv->rx_skbuff[i] = skb; 1154 sis_priv->rx_skbuff[i] = skb;
1156 sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; 1155 sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE;
1157 sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev, 1156 sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev,
1158 skb->tail, RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1157 skb->data, RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1159 } 1158 }
1160 sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC); 1159 sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC);
1161 1160
@@ -1777,7 +1776,7 @@ static int sis900_rx(struct net_device *net_dev)
1777 sis_priv->rx_skbuff[entry] = skb; 1776 sis_priv->rx_skbuff[entry] = skb;
1778 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1777 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
1779 sis_priv->rx_ring[entry].bufptr = 1778 sis_priv->rx_ring[entry].bufptr =
1780 pci_map_single(sis_priv->pci_dev, skb->tail, 1779 pci_map_single(sis_priv->pci_dev, skb->data,
1781 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1780 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1782 sis_priv->dirty_rx++; 1781 sis_priv->dirty_rx++;
1783 } 1782 }
@@ -1810,7 +1809,7 @@ static int sis900_rx(struct net_device *net_dev)
1810 sis_priv->rx_skbuff[entry] = skb; 1809 sis_priv->rx_skbuff[entry] = skb;
1811 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1810 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
1812 sis_priv->rx_ring[entry].bufptr = 1811 sis_priv->rx_ring[entry].bufptr =
1813 pci_map_single(sis_priv->pci_dev, skb->tail, 1812 pci_map_single(sis_priv->pci_dev, skb->data,
1814 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1813 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1815 } 1814 }
1816 } 1815 }
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 1ccb2989001c..6ee4771addf1 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -112,6 +112,7 @@
112#include <linux/moduleparam.h> 112#include <linux/moduleparam.h>
113#include <linux/init.h> 113#include <linux/init.h>
114#include <linux/proc_fs.h> 114#include <linux/proc_fs.h>
115#include <linux/dma-mapping.h>
115 116
116#include "h/skdrv1st.h" 117#include "h/skdrv1st.h"
117#include "h/skdrv2nd.h" 118#include "h/skdrv2nd.h"
@@ -4912,8 +4913,8 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4912 goto out; 4913 goto out;
4913 4914
4914 /* Configure DMA attributes. */ 4915 /* Configure DMA attributes. */
4915 if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL) && 4916 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
4916 pci_set_dma_mask(pdev, (u64) 0xffffffff)) 4917 pci_set_dma_mask(pdev, DMA_32BIT_MASK))
4917 goto out_disable_device; 4918 goto out_disable_device;
4918 4919
4919 4920
@@ -5132,6 +5133,84 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
5132 kfree(pAC); 5133 kfree(pAC);
5133} 5134}
5134 5135
5136#ifdef CONFIG_PM
5137static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
5138{
5139 struct net_device *dev = pci_get_drvdata(pdev);
5140 DEV_NET *pNet = netdev_priv(dev);
5141 SK_AC *pAC = pNet->pAC;
5142 struct net_device *otherdev = pAC->dev[1];
5143
5144 if (netif_running(dev)) {
5145 netif_carrier_off(dev);
5146 DoPrintInterfaceChange = SK_FALSE;
5147 SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */
5148 netif_device_detach(dev);
5149 }
5150 if (otherdev != dev) {
5151 if (netif_running(otherdev)) {
5152 netif_carrier_off(otherdev);
5153 DoPrintInterfaceChange = SK_FALSE;
5154 SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */
5155 netif_device_detach(otherdev);
5156 }
5157 }
5158
5159 pci_save_state(pdev);
5160 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
5161 if (pAC->AllocFlag & SK_ALLOC_IRQ) {
5162 free_irq(dev->irq, dev);
5163 }
5164 pci_disable_device(pdev);
5165 pci_set_power_state(pdev, pci_choose_state(pdev, state));
5166
5167 return 0;
5168}
5169
5170static int skge_resume(struct pci_dev *pdev)
5171{
5172 struct net_device *dev = pci_get_drvdata(pdev);
5173 DEV_NET *pNet = netdev_priv(dev);
5174 SK_AC *pAC = pNet->pAC;
5175 struct net_device *otherdev = pAC->dev[1];
5176 int ret;
5177
5178 pci_set_power_state(pdev, PCI_D0);
5179 pci_restore_state(pdev);
5180 pci_enable_device(pdev);
5181 pci_set_master(pdev);
5182 if (pAC->GIni.GIMacsFound == 2)
5183 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
5184 else
5185 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev);
5186 if (ret) {
5187 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5188 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
5189 dev->irq = 0;
5190 pci_disable_device(pdev);
5191 return -EBUSY;
5192 }
5193
5194 netif_device_attach(dev);
5195 if (netif_running(dev)) {
5196 DoPrintInterfaceChange = SK_FALSE;
5197 SkDrvInitAdapter(pAC, 0); /* first device */
5198 }
5199 if (otherdev != dev) {
5200 netif_device_attach(otherdev);
5201 if (netif_running(otherdev)) {
5202 DoPrintInterfaceChange = SK_FALSE;
5203 SkDrvInitAdapter(pAC, 1); /* second device */
5204 }
5205 }
5206
5207 return 0;
5208}
5209#else
5210#define skge_suspend NULL
5211#define skge_resume NULL
5212#endif
5213
5135static struct pci_device_id skge_pci_tbl[] = { 5214static struct pci_device_id skge_pci_tbl[] = {
5136 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5215 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5137 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5216 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -5157,6 +5236,8 @@ static struct pci_driver skge_driver = {
5157 .id_table = skge_pci_tbl, 5236 .id_table = skge_pci_tbl,
5158 .probe = skge_probe_one, 5237 .probe = skge_probe_one,
5159 .remove = __devexit_p(skge_remove_one), 5238 .remove = __devexit_p(skge_remove_one),
5239 .suspend = skge_suspend,
5240 .resume = skge_resume,
5160}; 5241};
5161 5242
5162static int __init skge_init(void) 5243static int __init skge_init(void)
diff --git a/drivers/net/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c
index df4483429a77..6cb49dd02251 100644
--- a/drivers/net/sk98lin/skgeinit.c
+++ b/drivers/net/sk98lin/skgeinit.c
@@ -2016,7 +2016,7 @@ SK_IOC IoC) /* IO context */
2016 * we set the PHY to coma mode and switch to D3 power state. 2016 * we set the PHY to coma mode and switch to D3 power state.
2017 */ 2017 */
2018 if (pAC->GIni.GIYukonLite && 2018 if (pAC->GIni.GIYukonLite &&
2019 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2019 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2020 2020
2021 /* for all ports switch PHY to coma mode */ 2021 /* for all ports switch PHY to coma mode */
2022 for (i = 0; i < pAC->GIni.GIMacsFound; i++) { 2022 for (i = 0; i < pAC->GIni.GIMacsFound; i++) {
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index 94a09deecb32..42d2d963150a 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -1065,7 +1065,7 @@ int Port) /* Port Index (MAC_1 + n) */
1065 1065
1066 /* WA code for COMA mode */ 1066 /* WA code for COMA mode */
1067 if (pAC->GIni.GIYukonLite && 1067 if (pAC->GIni.GIYukonLite &&
1068 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 1068 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
1069 1069
1070 SK_IN32(IoC, B2_GP_IO, &DWord); 1070 SK_IN32(IoC, B2_GP_IO, &DWord);
1071 1071
@@ -1110,7 +1110,7 @@ int Port) /* Port Index (MAC_1 + n) */
1110 1110
1111 /* WA code for COMA mode */ 1111 /* WA code for COMA mode */
1112 if (pAC->GIni.GIYukonLite && 1112 if (pAC->GIni.GIYukonLite &&
1113 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 1113 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
1114 1114
1115 SK_IN32(IoC, B2_GP_IO, &DWord); 1115 SK_IN32(IoC, B2_GP_IO, &DWord);
1116 1116
@@ -2126,7 +2126,7 @@ SK_U8 Mode) /* low power mode */
2126 int Ret = 0; 2126 int Ret = 0;
2127 2127
2128 if (pAC->GIni.GIYukonLite && 2128 if (pAC->GIni.GIYukonLite &&
2129 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2129 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2130 2130
2131 /* save current power mode */ 2131 /* save current power mode */
2132 LastMode = pAC->GIni.GP[Port].PPhyPowerState; 2132 LastMode = pAC->GIni.GP[Port].PPhyPowerState;
@@ -2253,7 +2253,7 @@ int Port) /* Port Index (e.g. MAC_1) */
2253 int Ret = 0; 2253 int Ret = 0;
2254 2254
2255 if (pAC->GIni.GIYukonLite && 2255 if (pAC->GIni.GIYukonLite &&
2256 pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { 2256 pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) {
2257 2257
2258 /* save current power mode */ 2258 /* save current power mode */
2259 LastMode = pAC->GIni.GP[Port].PPhyPowerState; 2259 LastMode = pAC->GIni.GP[Port].PPhyPowerState;
diff --git a/drivers/net/skfp/Makefile b/drivers/net/skfp/Makefile
index 6cfccfb7889f..cb23580fcffa 100644
--- a/drivers/net/skfp/Makefile
+++ b/drivers/net/skfp/Makefile
@@ -6,8 +6,8 @@ obj-$(CONFIG_SKFP) += skfp.o
6 6
7skfp-objs := skfddi.o hwmtm.o fplustm.o smt.o cfm.o \ 7skfp-objs := skfddi.o hwmtm.o fplustm.o smt.o cfm.o \
8 ecm.o pcmplc.o pmf.o queue.o rmt.o \ 8 ecm.o pcmplc.o pmf.o queue.o rmt.o \
9 smtdef.o smtinit.o smttimer.o srf.o lnkstat.o \ 9 smtdef.o smtinit.o smttimer.o srf.o hwt.o \
10 smtparse.o hwt.o drvfbi.o ess.o 10 drvfbi.o ess.o
11 11
12# NOTE: 12# NOTE:
13# Compiling this driver produces some warnings (and some more are 13# Compiling this driver produces some warnings (and some more are
diff --git a/drivers/net/skfp/drvfbi.c b/drivers/net/skfp/drvfbi.c
index 052e841ba187..5b475833f645 100644
--- a/drivers/net/skfp/drvfbi.c
+++ b/drivers/net/skfp/drvfbi.c
@@ -105,8 +105,8 @@ extern int AIX_vpdReadByte() ;
105#endif 105#endif
106 106
107 107
108/* Prototypes of local functions. */ 108/* Prototype of a local function. */
109void smt_stop_watchdog(struct s_smc *smc); 109static void smt_stop_watchdog(struct s_smc *smc);
110 110
111#ifdef MCA 111#ifdef MCA
112static int read_card_id() ; 112static int read_card_id() ;
@@ -631,7 +631,7 @@ void plc_clear_irq(struct s_smc *smc, int p)
631 * LED_Y_OFF just switch yellow LED off 631 * LED_Y_OFF just switch yellow LED off
632 * LED_Y_ON just switch yello LED on 632 * LED_Y_ON just switch yello LED on
633 */ 633 */
634void led_indication(struct s_smc *smc, int led_event) 634static void led_indication(struct s_smc *smc, int led_event)
635{ 635{
636 /* use smc->hw.mac_ring_is_up == TRUE 636 /* use smc->hw.mac_ring_is_up == TRUE
637 * as indication for Ring Operational 637 * as indication for Ring Operational
@@ -764,122 +764,6 @@ void llc_recover_tx(struct s_smc *smc)
764#endif 764#endif
765} 765}
766 766
767/*--------------------------- DMA init ----------------------------*/
768#ifdef ISA
769
770/*
771 * init DMA
772 */
773void init_dma(struct s_smc *smc, int dma)
774{
775 SK_UNUSED(smc) ;
776
777 /*
778 * set cascade mode,
779 * clear mask bit (enable DMA cannal)
780 */
781 if (dma > 3) {
782 outp(0xd6,(dma & 0x03) | 0xc0) ;
783 outp(0xd4, dma & 0x03) ;
784 }
785 else {
786 outp(0x0b,(dma & 0x03) | 0xc0) ;
787 outp(0x0a,dma & 0x03) ;
788 }
789}
790
791/*
792 * disable DMA
793 */
794void dis_dma(struct s_smc *smc, int dma)
795{
796 SK_UNUSED(smc) ;
797
798 /*
799 * set mask bit (disable DMA cannal)
800 */
801 if (dma > 3) {
802 outp(0xd4,(dma & 0x03) | 0x04) ;
803 }
804 else {
805 outp(0x0a,(dma & 0x03) | 0x04) ;
806 }
807}
808
809#endif /* ISA */
810
811#ifdef EISA
812
813/*arrays with io addresses of dma controller length and address registers*/
814static const int cntr[8] = { 0x001,0x003,0x005,0x007,0,0x0c6,0x0ca,0x0ce } ;
815static const int base[8] = { 0x000,0x002,0x004,0x006,0,0x0c4,0x0c8,0x0cc } ;
816static const int page[8] = { 0x087,0x083,0x081,0x082,0,0x08b,0x089,0x08a } ;
817
818void init_dma(struct s_smc *smc, int dma)
819{
820 /*
821 * extended mode register
822 * 32 bit IO
823 * type c
824 * TC output
825 * disable stop
826 */
827
828 /* mode read (write) demand */
829 smc->hw.dma_rmode = (dma & 3) | 0x08 | 0x0 ;
830 smc->hw.dma_wmode = (dma & 3) | 0x04 | 0x0 ;
831
832 /* 32 bit IO's, burst DMA mode (type "C") */
833 smc->hw.dma_emode = (dma & 3) | 0x08 | 0x30 ;
834
835 outp((dma < 4) ? 0x40b : 0x4d6,smc->hw.dma_emode) ;
836
837 /* disable chaining */
838 outp((dma < 4) ? 0x40a : 0x4d4,(dma&3)) ;
839
840 /*load dma controller addresses for fast access during set dma*/
841 smc->hw.dma_base_word_count = cntr[smc->hw.dma];
842 smc->hw.dma_base_address = base[smc->hw.dma];
843 smc->hw.dma_base_address_page = page[smc->hw.dma];
844
845}
846
847void dis_dma(struct s_smc *smc, int dma)
848{
849 SK_UNUSED(smc) ;
850
851 outp((dma < 4) ? 0x0a : 0xd4,(dma&3)|4) ;/* mask bit */
852}
853#endif /* EISA */
854
855#ifdef MCA
856void init_dma(struct s_smc *smc, int dma)
857{
858 SK_UNUSED(smc) ;
859 SK_UNUSED(dma) ;
860}
861
862void dis_dma(struct s_smc *smc, int dma)
863{
864 SK_UNUSED(smc) ;
865 SK_UNUSED(dma) ;
866}
867#endif
868
869#ifdef PCI
870void init_dma(struct s_smc *smc, int dma)
871{
872 SK_UNUSED(smc) ;
873 SK_UNUSED(dma) ;
874}
875
876void dis_dma(struct s_smc *smc, int dma)
877{
878 SK_UNUSED(smc) ;
879 SK_UNUSED(dma) ;
880}
881#endif
882
883#ifdef MULT_OEM 767#ifdef MULT_OEM
884static int is_equal_num(char comp1[], char comp2[], int num) 768static int is_equal_num(char comp1[], char comp2[], int num)
885{ 769{
@@ -1407,7 +1291,7 @@ void smt_start_watchdog(struct s_smc *smc)
1407#endif /* DEBUG */ 1291#endif /* DEBUG */
1408} 1292}
1409 1293
1410void smt_stop_watchdog(struct s_smc *smc) 1294static void smt_stop_watchdog(struct s_smc *smc)
1411{ 1295{
1412 SK_UNUSED(smc) ; /* Make LINT happy. */ 1296 SK_UNUSED(smc) ; /* Make LINT happy. */
1413#ifndef DEBUG 1297#ifndef DEBUG
@@ -1422,104 +1306,6 @@ void smt_stop_watchdog(struct s_smc *smc)
1422} 1306}
1423 1307
1424#ifdef PCI 1308#ifdef PCI
1425static char get_rom_byte(struct s_smc *smc, u_short addr)
1426{
1427 GET_PAGE(addr) ;
1428 return (READ_PROM(ADDR(B2_FDP))) ;
1429}
1430
1431/*
1432 * ROM image defines
1433 */
1434#define ROM_SIG_1 0
1435#define ROM_SIG_2 1
1436#define PCI_DATA_1 0x18
1437#define PCI_DATA_2 0x19
1438
1439/*
1440 * PCI data structure defines
1441 */
1442#define VPD_DATA_1 0x08
1443#define VPD_DATA_2 0x09
1444#define IMAGE_LEN_1 0x10
1445#define IMAGE_LEN_2 0x11
1446#define CODE_TYPE 0x14
1447#define INDICATOR 0x15
1448
1449/*
1450 * BEGIN_MANUAL_ENTRY(mac_drv_vpd_read)
1451 * mac_drv_vpd_read(smc,buf,size,image)
1452 *
1453 * function DOWNCALL (FDDIWARE)
1454 * reads the VPD data of the FPROM and writes it into the
1455 * buffer
1456 *
1457 * para buf points to the buffer for the VPD data
1458 * size size of the VPD data buffer
1459 * image boot image; code type of the boot image
1460 * image = 0 Intel x86, PC-AT compatible
1461 * 1 OPENBOOT standard for PCI
1462 * 2-FF reserved
1463 *
1464 * returns len number of VPD data bytes read form the FPROM
1465 * <0 number of read bytes
1466 * >0 error: data invalid
1467 *
1468 * END_MANUAL_ENTRY
1469 */
1470int mac_drv_vpd_read(struct s_smc *smc, char *buf, int size, char image)
1471{
1472 u_short ibase ;
1473 u_short pci_base ;
1474 u_short vpd ;
1475 int len ;
1476
1477 len = 0 ;
1478 ibase = 0 ;
1479 /*
1480 * as long images defined
1481 */
1482 while (get_rom_byte(smc,ibase+ROM_SIG_1) == 0x55 &&
1483 (u_char) get_rom_byte(smc,ibase+ROM_SIG_2) == 0xaa) {
1484 /*
1485 * get the pointer to the PCI data structure
1486 */
1487 pci_base = ibase + get_rom_byte(smc,ibase+PCI_DATA_1) +
1488 (get_rom_byte(smc,ibase+PCI_DATA_2) << 8) ;
1489
1490 if (image == get_rom_byte(smc,pci_base+CODE_TYPE)) {
1491 /*
1492 * we have the right image, read the VPD data
1493 */
1494 vpd = ibase + get_rom_byte(smc,pci_base+VPD_DATA_1) +
1495 (get_rom_byte(smc,pci_base+VPD_DATA_2) << 8) ;
1496 if (vpd == ibase) {
1497 break ; /* no VPD data */
1498 }
1499 for (len = 0; len < size; len++,buf++,vpd++) {
1500 *buf = get_rom_byte(smc,vpd) ;
1501 }
1502 break ;
1503 }
1504 else {
1505 /*
1506 * try the next image
1507 */
1508 if (get_rom_byte(smc,pci_base+INDICATOR) & 0x80) {
1509 break ; /* this was the last image */
1510 }
1511 ibase = ibase + get_rom_byte(smc,ibase+IMAGE_LEN_1) +
1512 (get_rom_byte(smc,ibase+IMAGE_LEN_2) << 8) ;
1513 }
1514 }
1515
1516 return(len) ;
1517}
1518
1519void mac_drv_pci_fix(struct s_smc *smc, u_long fix_value)
1520{
1521 smc->hw.pci_fix_value = fix_value ;
1522}
1523 1309
1524void mac_do_pci_fix(struct s_smc *smc) 1310void mac_do_pci_fix(struct s_smc *smc)
1525{ 1311{
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index fd39b4b2ef7d..62b01328c496 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -102,7 +102,7 @@ void ess_timer_poll(struct s_smc *smc);
102void ess_para_change(struct s_smc *smc); 102void ess_para_change(struct s_smc *smc);
103int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm, 103int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
104 int fs); 104 int fs);
105int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead); 105static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead);
106 106
107 107
108/* 108/*
@@ -375,7 +375,7 @@ int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
375 * determines the synchronous bandwidth, set the TSYNC register and the 375 * determines the synchronous bandwidth, set the TSYNC register and the
376 * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG. 376 * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG.
377 */ 377 */
378int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead) 378static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead)
379{ 379{
380 /* 380 /*
381 * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG, 381 * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index 76e78442fc24..a2ed47f1cc70 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -1117,30 +1117,6 @@ void mac_clear_multicast(struct s_smc *smc)
1117/* 1117/*
1118 BEGIN_MANUAL_ENTRY(if,func;others;2) 1118 BEGIN_MANUAL_ENTRY(if,func;others;2)
1119 1119
1120 int mac_set_func_addr(smc,f_addr)
1121 struct s_smc *smc ;
1122 u_long f_addr ;
1123
1124Function DOWNCALL (SMT, fplustm.c)
1125 Set a Token-Ring functional address, the address will
1126 be activated after calling mac_update_multicast()
1127
1128Para f_addr functional bits in non-canonical format
1129
1130Returns 0: always success
1131
1132 END_MANUAL_ENTRY()
1133 */
1134int mac_set_func_addr(struct s_smc *smc, u_long f_addr)
1135{
1136 smc->hw.fp.func_addr = f_addr ;
1137 return(0) ;
1138}
1139
1140
1141/*
1142 BEGIN_MANUAL_ENTRY(if,func;others;2)
1143
1144 int mac_add_multicast(smc,addr,can) 1120 int mac_add_multicast(smc,addr,can)
1145 struct s_smc *smc ; 1121 struct s_smc *smc ;
1146 struct fddi_addr *addr ; 1122 struct fddi_addr *addr ;
@@ -1203,52 +1179,6 @@ int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can)
1203} 1179}
1204 1180
1205/* 1181/*
1206 BEGIN_MANUAL_ENTRY(if,func;others;2)
1207
1208 void mac_del_multicast(smc,addr,can)
1209 struct s_smc *smc ;
1210 struct fddi_addr *addr ;
1211 int can ;
1212
1213Function DOWNCALL (SMT, fplustm.c)
1214 Delete an entry from the multicast table
1215
1216Para addr pointer to a multicast address
1217 can = 0: the multicast address has the physical format
1218 = 1: the multicast address has the canonical format
1219 | 0x80 permanent
1220
1221 END_MANUAL_ENTRY()
1222 */
1223void mac_del_multicast(struct s_smc *smc, struct fddi_addr *addr, int can)
1224{
1225 SK_LOC_DECL(struct fddi_addr,own) ;
1226 struct s_fpmc *tb ;
1227
1228 if (!(tb = mac_get_mc_table(smc,addr,&own,1,can & ~0x80)))
1229 return ;
1230 /*
1231 * permanent addresses must be deleted with perm bit
1232 * and vice versa
1233 */
1234 if (( tb->perm && (can & 0x80)) ||
1235 (!tb->perm && !(can & 0x80))) {
1236 /*
1237 * delete it
1238 */
1239 if (tb->n) {
1240 tb->n-- ;
1241 if (tb->perm) {
1242 smc->hw.fp.smt_slots_used-- ;
1243 }
1244 else {
1245 smc->hw.fp.os_slots_used-- ;
1246 }
1247 }
1248 }
1249}
1250
1251/*
1252 * mode 1182 * mode
1253 */ 1183 */
1254 1184
diff --git a/drivers/net/skfp/h/cmtdef.h b/drivers/net/skfp/h/cmtdef.h
index 603982debc71..f2f771d8be76 100644
--- a/drivers/net/skfp/h/cmtdef.h
+++ b/drivers/net/skfp/h/cmtdef.h
@@ -507,7 +507,6 @@ void pcm_status_state(struct s_smc *smc, int np, int *type, int *state,
507 int *remote, int *mac); 507 int *remote, int *mac);
508void plc_config_mux(struct s_smc *smc, int mux); 508void plc_config_mux(struct s_smc *smc, int mux);
509void sm_lem_evaluate(struct s_smc *smc); 509void sm_lem_evaluate(struct s_smc *smc);
510void smt_clear_una_dna(struct s_smc *smc);
511void mac_update_counter(struct s_smc *smc); 510void mac_update_counter(struct s_smc *smc);
512void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off); 511void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off);
513void sm_ma_control(struct s_smc *smc, int mode); 512void sm_ma_control(struct s_smc *smc, int mode);
@@ -541,11 +540,9 @@ void smt_timer_poll(struct s_smc *smc);
541u_long smt_get_time(void); 540u_long smt_get_time(void);
542u_long smt_get_tid(struct s_smc *smc); 541u_long smt_get_tid(struct s_smc *smc);
543void smt_timer_done(struct s_smc *smc); 542void smt_timer_done(struct s_smc *smc);
544void smt_set_defaults(struct s_smc *smc);
545void smt_fixup_mib(struct s_smc *smc); 543void smt_fixup_mib(struct s_smc *smc);
546void smt_reset_defaults(struct s_smc *smc, int level); 544void smt_reset_defaults(struct s_smc *smc, int level);
547void smt_agent_task(struct s_smc *smc); 545void smt_agent_task(struct s_smc *smc);
548void smt_please_reconnect(struct s_smc *smc, int reconn_time);
549int smt_check_para(struct s_smc *smc, struct smt_header *sm, 546int smt_check_para(struct s_smc *smc, struct smt_header *sm,
550 const u_short list[]); 547 const u_short list[]);
551void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr); 548void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr);
@@ -568,7 +565,6 @@ int pcm_get_s_port(struct s_smc *smc);
568int pcm_rooted_station(struct s_smc *smc); 565int pcm_rooted_station(struct s_smc *smc);
569int cfm_get_mac_input(struct s_smc *smc); 566int cfm_get_mac_input(struct s_smc *smc);
570int cfm_get_mac_output(struct s_smc *smc); 567int cfm_get_mac_output(struct s_smc *smc);
571int port_to_mib(struct s_smc *smc, int p);
572int cem_build_path(struct s_smc *smc, char *to, int path_index); 568int cem_build_path(struct s_smc *smc, char *to, int path_index);
573int sm_mac_get_tx_state(struct s_smc *smc); 569int sm_mac_get_tx_state(struct s_smc *smc);
574char *get_pcmstate(struct s_smc *smc, int np); 570char *get_pcmstate(struct s_smc *smc, int np);
@@ -580,8 +576,6 @@ void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local);
580void smt_set_timestamp(struct s_smc *smc, u_char *p); 576void smt_set_timestamp(struct s_smc *smc, u_char *p);
581void mac_set_rx_mode(struct s_smc *smc, int mode); 577void mac_set_rx_mode(struct s_smc *smc, int mode);
582int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can); 578int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can);
583int mac_set_func_addr(struct s_smc *smc, u_long f_addr);
584void mac_del_multicast(struct s_smc *smc, struct fddi_addr *addr, int can);
585void mac_update_multicast(struct s_smc *smc); 579void mac_update_multicast(struct s_smc *smc);
586void mac_clear_multicast(struct s_smc *smc); 580void mac_clear_multicast(struct s_smc *smc);
587void set_formac_tsync(struct s_smc *smc, long sync_bw); 581void set_formac_tsync(struct s_smc *smc, long sync_bw);
@@ -599,7 +593,6 @@ void plc_irq(struct s_smc *smc, int np, unsigned int cmd);
599int smt_set_mac_opvalues(struct s_smc *smc); 593int smt_set_mac_opvalues(struct s_smc *smc);
600 594
601#ifdef TAG_MODE 595#ifdef TAG_MODE
602void mac_drv_pci_fix(struct s_smc *smc, u_long fix_value);
603void mac_do_pci_fix(struct s_smc *smc); 596void mac_do_pci_fix(struct s_smc *smc);
604void mac_drv_clear_tx_queue(struct s_smc *smc); 597void mac_drv_clear_tx_queue(struct s_smc *smc);
605void mac_drv_repair_descr(struct s_smc *smc); 598void mac_drv_repair_descr(struct s_smc *smc);
diff --git a/drivers/net/skfp/h/hwmtm.h b/drivers/net/skfp/h/hwmtm.h
index 4e360af07d77..1a606d4bfe5e 100644
--- a/drivers/net/skfp/h/hwmtm.h
+++ b/drivers/net/skfp/h/hwmtm.h
@@ -262,31 +262,6 @@ struct os_debug {
262 (smc)->hw.fp.tx_q[queue].tx_curr_put 262 (smc)->hw.fp.tx_q[queue].tx_curr_put
263 263
264/* 264/*
265 * BEGIN_MANUAL_ENTRY(HWM_TX_CHECK)
266 * void HWM_TX_CHECK(smc,frame_status,low_water)
267 *
268 * function MACRO (hardware module, hwmtm.h)
269 * This macro is invoked by the OS-specific before it left it's
270 * driver_send function. This macro calls mac_drv_clear_txd
271 * if the free TxDs of the current transmit queue is equal or
272 * lower than the given low water mark.
273 *
274 * para frame_status status of the frame, see design description
275 * low_water low water mark of free TxD's
276 *
277 * END_MANUAL_ENTRY
278 */
279#ifndef HWM_NO_FLOW_CTL
280#define HWM_TX_CHECK(smc,frame_status,low_water) {\
281 if ((low_water)>=(smc)->hw.fp.tx_q[(frame_status)&QUEUE_A0].tx_free) {\
282 mac_drv_clear_txd(smc) ;\
283 }\
284}
285#else
286#define HWM_TX_CHECK(smc,frame_status,low_water) mac_drv_clear_txd(smc)
287#endif
288
289/*
290 * BEGIN_MANUAL_ENTRY(HWM_GET_RX_FRAG_LEN) 265 * BEGIN_MANUAL_ENTRY(HWM_GET_RX_FRAG_LEN)
291 * int HWM_GET_RX_FRAG_LEN(rxd) 266 * int HWM_GET_RX_FRAG_LEN(rxd)
292 * 267 *
diff --git a/drivers/net/skfp/h/osdef1st.h b/drivers/net/skfp/h/osdef1st.h
index 5359eb53008d..763ca18cbea8 100644
--- a/drivers/net/skfp/h/osdef1st.h
+++ b/drivers/net/skfp/h/osdef1st.h
@@ -20,6 +20,8 @@
20// HWM (HardWare Module) Definitions 20// HWM (HardWare Module) Definitions
21// ----------------------- 21// -----------------------
22 22
23#include <asm/byteorder.h>
24
23#ifdef __LITTLE_ENDIAN 25#ifdef __LITTLE_ENDIAN
24#define LITTLE_ENDIAN 26#define LITTLE_ENDIAN
25#else 27#else
diff --git a/drivers/net/skfp/hwmtm.c b/drivers/net/skfp/hwmtm.c
index 18d429021edb..438f424e6361 100644
--- a/drivers/net/skfp/hwmtm.c
+++ b/drivers/net/skfp/hwmtm.c
@@ -86,6 +86,7 @@ static u_long repair_txd_ring(struct s_smc *smc, struct s_smt_tx_queue *queue);
86static u_long repair_rxd_ring(struct s_smc *smc, struct s_smt_rx_queue *queue); 86static u_long repair_rxd_ring(struct s_smc *smc, struct s_smt_rx_queue *queue);
87static SMbuf* get_llc_rx(struct s_smc *smc); 87static SMbuf* get_llc_rx(struct s_smc *smc);
88static SMbuf* get_txd_mb(struct s_smc *smc); 88static SMbuf* get_txd_mb(struct s_smc *smc);
89static void mac_drv_clear_txd(struct s_smc *smc);
89 90
90/* 91/*
91 ------------------------------------------------------------- 92 -------------------------------------------------------------
@@ -146,7 +147,6 @@ extern int mac_drv_rx_init(struct s_smc *smc, int len, int fc, char *look_ahead,
146*/ 147*/
147void process_receive(struct s_smc *smc); 148void process_receive(struct s_smc *smc);
148void fddi_isr(struct s_smc *smc); 149void fddi_isr(struct s_smc *smc);
149void mac_drv_clear_txd(struct s_smc *smc);
150void smt_free_mbuf(struct s_smc *smc, SMbuf *mb); 150void smt_free_mbuf(struct s_smc *smc, SMbuf *mb);
151void init_driver_fplus(struct s_smc *smc); 151void init_driver_fplus(struct s_smc *smc);
152void mac_drv_rx_mode(struct s_smc *smc, int mode); 152void mac_drv_rx_mode(struct s_smc *smc, int mode);
@@ -158,7 +158,6 @@ void hwm_tx_frag(struct s_smc *smc, char far *virt, u_long phys, int len,
158void hwm_rx_frag(struct s_smc *smc, char far *virt, u_long phys, int len, 158void hwm_rx_frag(struct s_smc *smc, char far *virt, u_long phys, int len,
159 int frame_status); 159 int frame_status);
160 160
161int mac_drv_rx_frag(struct s_smc *smc, void far *virt, int len);
162int mac_drv_init(struct s_smc *smc); 161int mac_drv_init(struct s_smc *smc);
163int hwm_tx_init(struct s_smc *smc, u_char fc, int frag_count, int frame_len, 162int hwm_tx_init(struct s_smc *smc, u_char fc, int frag_count, int frame_len,
164 int frame_status); 163 int frame_status);
@@ -1448,35 +1447,6 @@ void hwm_rx_frag(struct s_smc *smc, char far *virt, u_long phys, int len,
1448 NDD_TRACE("RHfE",r,AIX_REVERSE(r->rxd_rbadr),0) ; 1447 NDD_TRACE("RHfE",r,AIX_REVERSE(r->rxd_rbadr),0) ;
1449} 1448}
1450 1449
1451#ifndef NDIS_OS2
1452/*
1453 * BEGIN_MANUAL_ENTRY(mac_drv_rx_frag)
1454 * int mac_drv_rx_frag(smc,virt,len)
1455 *
1456 * function DOWNCALL (hwmtm.c)
1457 * mac_drv_rx_frag fills the fragment with a part of the frame.
1458 *
1459 * para virt the virtual address of the fragment
1460 * len the length in bytes of the fragment
1461 *
1462 * return 0: success code, no errors possible
1463 *
1464 * END_MANUAL_ENTRY
1465 */
1466int mac_drv_rx_frag(struct s_smc *smc, void far *virt, int len)
1467{
1468 NDD_TRACE("RHSB",virt,len,smc->os.hwm.r.mb_pos) ;
1469
1470 DB_RX("receive from queue: len/virt: = %d/%x",len,virt,4) ;
1471 memcpy((char far *)virt,smc->os.hwm.r.mb_pos,len) ;
1472 smc->os.hwm.r.mb_pos += len ;
1473
1474 NDD_TRACE("RHSE",smc->os.hwm.r.mb_pos,0,0) ;
1475 return(0) ;
1476}
1477#endif
1478
1479
1480/* 1450/*
1481 * BEGINN_MANUAL_ENTRY(mac_drv_clear_rx_queue) 1451 * BEGINN_MANUAL_ENTRY(mac_drv_clear_rx_queue)
1482 * 1452 *
@@ -1978,7 +1948,7 @@ void smt_send_mbuf(struct s_smc *smc, SMbuf *mb, int fc)
1978 * 1948 *
1979 * END_MANUAL_ENTRY 1949 * END_MANUAL_ENTRY
1980 */ 1950 */
1981void mac_drv_clear_txd(struct s_smc *smc) 1951static void mac_drv_clear_txd(struct s_smc *smc)
1982{ 1952{
1983 struct s_smt_tx_queue *queue ; 1953 struct s_smt_tx_queue *queue ;
1984 struct s_smt_fp_txd volatile *t1 ; 1954 struct s_smt_fp_txd volatile *t1 ;
diff --git a/drivers/net/skfp/lnkstat.c b/drivers/net/skfp/lnkstat.c
deleted file mode 100644
index 00a248044f86..000000000000
--- a/drivers/net/skfp/lnkstat.c
+++ /dev/null
@@ -1,204 +0,0 @@
1/******************************************************************************
2 *
3 * (C)Copyright 1998,1999 SysKonnect,
4 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
5 *
6 * See the file "skfddi.c" for further information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The information in this file is provided "AS IS" without warranty.
14 *
15 ******************************************************************************/
16
17/*
18 IBM FDDI read error log function
19*/
20
21#include "h/types.h"
22#include "h/fddi.h"
23#include "h/smc.h"
24#include "h/lnkstat.h"
25
26#ifndef lint
27static const char ID_sccs[] = "@(#)lnkstat.c 1.8 97/04/11 (C) SK " ;
28#endif
29
30#ifdef sun
31#define _far
32#endif
33
34#define EL_IS_OK(x,l) ((((int)&(((struct s_error_log *)0)->x)) + \
35 sizeof(er->x)) <= l)
36
37/*
38 BEGIN_MANUAL_ENTRY(if,func;others;11)
39
40 u_long smt_get_error_word(smc)
41 struct s_smc *smc ;
42
43Function DOWNCALL (SMT, lnkstat.c)
44 This functions returns the SMT error work for AIX events.
45
46Return smt_error_word These bits are supported:
47
48 SMT_ERL_ALC == [PS/PA].fddiPORTLerFlag
49 SMT_ERL_BLC == [PB].fddiPORTLerFlag
50 SMT_ERL_NCC == fddiMACNotCopiedFlag
51 SMT_ERL_FEC == fddiMACFrameErrorFlag
52
53 END_MANUAL_ENTRY()
54 */
55u_long smt_get_error_word(struct s_smc *smc)
56{
57 u_long st;
58
59 /*
60 * smt error word low
61 */
62 st = 0 ;
63 if (smc->s.sas == SMT_SAS) {
64 if (smc->mib.p[PS].fddiPORTLerFlag)
65 st |= SMT_ERL_ALC ;
66 }
67 else {
68 if (smc->mib.p[PA].fddiPORTLerFlag)
69 st |= SMT_ERL_ALC ;
70 if (smc->mib.p[PB].fddiPORTLerFlag)
71 st |= SMT_ERL_BLC ;
72 }
73 if (smc->mib.m[MAC0].fddiMACNotCopiedFlag)
74 st |= SMT_ERL_NCC ; /* not copied condition */
75 if (smc->mib.m[MAC0].fddiMACFrameErrorFlag)
76 st |= SMT_ERL_FEC ; /* frame error condition */
77
78 return st;
79}
80
81/*
82 BEGIN_MANUAL_ENTRY(if,func;others;11)
83
84 u_long smt_get_event_word(smc)
85 struct s_smc *smc ;
86
87Function DOWNCALL (SMT, lnkstat.c)
88 This functions returns the SMT event work for AIX events.
89
90Return smt_event_word always 0
91
92 END_MANUAL_ENTRY()
93 */
94u_long smt_get_event_word(struct s_smc *smc)
95{
96 return (u_long) 0;
97}
98
99/*
100 BEGIN_MANUAL_ENTRY(if,func;others;11)
101
102 u_long smt_get_port_event_word(smc)
103 struct s_smc *smc ;
104
105Function DOWNCALL (SMT, lnkstat.c)
106 This functions returns the SMT port event work for AIX events.
107
108Return smt_port_event_word always 0
109
110 END_MANUAL_ENTRY()
111 */
112u_long smt_get_port_event_word(struct s_smc *smc)
113{
114 return (u_long) 0;
115}
116
117/*
118 BEGIN_MANUAL_ENTRY(if,func;others;11)
119
120 u_long smt_read_errorlog(smc,p,len)
121 struct s_smc *smc ;
122 char _far *p ;
123 int len ;
124
125Function DOWNCALL (SMT, lnkstat.c)
126 This functions returns the SMT error log field for AIX events.
127
128Para p pointer to the error log field
129 len len of the error log field
130
131Return len used len of the error log field
132
133 END_MANUAL_ENTRY()
134 */
135int smt_read_errorlog(struct s_smc *smc, char _far *p, int len)
136{
137 int i ;
138 int st ;
139 struct s_error_log _far *er ;
140
141 er = (struct s_error_log _far *) p ;
142 if (len > sizeof(struct s_error_log))
143 len = sizeof(struct s_error_log) ;
144 for (i = 0 ; i < len ; i++)
145 *p++ = 0 ;
146 /*
147 * set count
148 */
149 if (EL_IS_OK(set_count_high,len)) {
150 er->set_count_low = (u_short)smc->mib.fddiSMTSetCount.count ;
151 er->set_count_high =
152 (u_short)(smc->mib.fddiSMTSetCount.count >> 16L) ;
153 }
154 /*
155 * aci
156 */
157 if (EL_IS_OK(aci_id_code,len)) {
158 er->aci_id_code = 0 ;
159 }
160 /*
161 * purge counter is missed frames; 16 bits only
162 */
163 if (EL_IS_OK(purge_frame_counter,len)) {
164 if (smc->mib.m[MAC0].fddiMACCopied_Ct > 0xffff)
165 er->purge_frame_counter = 0xffff ;
166 else
167 er->purge_frame_counter =
168 (u_short)smc->mib.m[MAC0].fddiMACCopied_Ct ;
169 }
170 /*
171 * CMT and RMT state machines
172 */
173 if (EL_IS_OK(ecm_state,len))
174 er->ecm_state = smc->mib.fddiSMTECMState ;
175
176 if (EL_IS_OK(pcm_b_state,len)) {
177 if (smc->s.sas == SMT_SAS) {
178 er->pcm_a_state = smc->y[PS].mib->fddiPORTPCMState ;
179 er->pcm_b_state = 0 ;
180 }
181 else {
182 er->pcm_a_state = smc->y[PA].mib->fddiPORTPCMState ;
183 er->pcm_b_state = smc->y[PB].mib->fddiPORTPCMState ;
184 }
185 }
186 if (EL_IS_OK(cfm_state,len))
187 er->cfm_state = smc->mib.fddiSMTCF_State ;
188 if (EL_IS_OK(rmt_state,len))
189 er->rmt_state = smc->mib.m[MAC0].fddiMACRMTState ;
190
191 /*
192 * smt error word low (we only need the low order 16 bits.)
193 */
194
195 st = smt_get_error_word(smc) & 0xffff ;
196
197 if (EL_IS_OK(smt_error_low,len))
198 er->smt_error_low = st ;
199
200 if (EL_IS_OK(ucode_version_level,len))
201 er->ucode_version_level = 0x0101 ;
202 return(len) ;
203}
204
diff --git a/drivers/net/skfp/pcmplc.c b/drivers/net/skfp/pcmplc.c
index 571f055c096b..cd0aa4c151b0 100644
--- a/drivers/net/skfp/pcmplc.c
+++ b/drivers/net/skfp/pcmplc.c
@@ -1861,13 +1861,6 @@ void plc_irq(struct s_smc *smc, int np, unsigned int cmd)
1861#endif 1861#endif
1862} 1862}
1863 1863
1864void pcm_set_lct_short(struct s_smc *smc, int n)
1865{
1866 if (n <= 0 || n > 1000)
1867 return ;
1868 smc->s.lct_short = n ;
1869}
1870
1871#ifdef DEBUG 1864#ifdef DEBUG
1872/* 1865/*
1873 * fill state struct 1866 * fill state struct
diff --git a/drivers/net/skfp/pmf.c b/drivers/net/skfp/pmf.c
index f2b446d8b0bf..efc639c013fd 100644
--- a/drivers/net/skfp/pmf.c
+++ b/drivers/net/skfp/pmf.c
@@ -36,12 +36,13 @@ static int smt_authorize(struct s_smc *smc, struct smt_header *sm);
36static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm); 36static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm);
37static const struct s_p_tab* smt_get_ptab(u_short para); 37static const struct s_p_tab* smt_get_ptab(u_short para);
38static int smt_mib_phys(struct s_smc *smc); 38static int smt_mib_phys(struct s_smc *smc);
39int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local, 39static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
40 int set); 40 int local, int set);
41void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, 41void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
42 int index, int local); 42 int index, int local);
43static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req, 43static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req,
44 int set, int local); 44 int set, int local);
45static int port_to_mib(struct s_smc *smc, int p);
45 46
46#define MOFFSS(e) ((int)&(((struct fddi_mib *)0)->e)) 47#define MOFFSS(e) ((int)&(((struct fddi_mib *)0)->e))
47#define MOFFSA(e) ((int) (((struct fddi_mib *)0)->e)) 48#define MOFFSA(e) ((int) (((struct fddi_mib *)0)->e))
@@ -1078,8 +1079,8 @@ wrong_error:
1078/* 1079/*
1079 * set parameter 1080 * set parameter
1080 */ 1081 */
1081int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local, 1082static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
1082 int set) 1083 int local, int set)
1083{ 1084{
1084#define IFSET(x) if (set) (x) 1085#define IFSET(x) if (set) (x)
1085 1086
@@ -1549,7 +1550,7 @@ static int smt_mib_phys(struct s_smc *smc)
1549#endif 1550#endif
1550} 1551}
1551 1552
1552int port_to_mib(struct s_smc *smc, int p) 1553static int port_to_mib(struct s_smc *smc, int p)
1553{ 1554{
1554#ifdef CONCENTRATOR 1555#ifdef CONCENTRATOR
1555 SK_UNUSED(smc) ; 1556 SK_UNUSED(smc) ;
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index c88aad6edd74..4b5ed2c63177 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -149,7 +149,6 @@ extern void hwm_rx_frag(struct s_smc *smc, char far * virt, u_long phys,
149extern void mac_drv_rx_mode(struct s_smc *smc, int mode); 149extern void mac_drv_rx_mode(struct s_smc *smc, int mode);
150extern void mac_drv_clear_rx_queue(struct s_smc *smc); 150extern void mac_drv_clear_rx_queue(struct s_smc *smc);
151extern void enable_tx_irq(struct s_smc *smc, u_short queue); 151extern void enable_tx_irq(struct s_smc *smc, u_short queue);
152extern void mac_drv_clear_txd(struct s_smc *smc);
153 152
154static struct pci_device_id skfddi_pci_tbl[] = { 153static struct pci_device_id skfddi_pci_tbl[] = {
155 { PCI_VENDOR_ID_SK, PCI_DEVICE_ID_SK_FP, PCI_ANY_ID, PCI_ANY_ID, }, 154 { PCI_VENDOR_ID_SK, PCI_DEVICE_ID_SK_FP, PCI_ANY_ID, PCI_ANY_ID, },
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c
index 71935eaf9d4e..f17c05cbe44b 100644
--- a/drivers/net/skfp/smt.c
+++ b/drivers/net/skfp/smt.c
@@ -86,7 +86,7 @@ static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
86static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest, 86static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
87 u_long tid, int local); 87 u_long tid, int local);
88#ifdef LITTLE_ENDIAN 88#ifdef LITTLE_ENDIAN
89static void smt_string_swap(void); 89static void smt_string_swap(char *data, const char *format, int len);
90#endif 90#endif
91static void smt_add_frame_len(SMbuf *mb, int len); 91static void smt_add_frame_len(SMbuf *mb, int len);
92static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una); 92static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una);
@@ -110,7 +110,7 @@ static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount
110static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed, 110static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
111 int len); 111 int len);
112 112
113void smt_clear_una_dna(struct s_smc *smc); 113static void smt_clear_una_dna(struct s_smc *smc);
114static void smt_clear_old_una_dna(struct s_smc *smc); 114static void smt_clear_old_una_dna(struct s_smc *smc);
115#ifdef CONCENTRATOR 115#ifdef CONCENTRATOR
116static int entity_to_index(void); 116static int entity_to_index(void);
@@ -118,7 +118,7 @@ static int entity_to_index(void);
118static void update_dac(struct s_smc *smc, int report); 118static void update_dac(struct s_smc *smc, int report);
119static int div_ratio(u_long upper, u_long lower); 119static int div_ratio(u_long upper, u_long lower);
120#ifdef USE_CAN_ADDR 120#ifdef USE_CAN_ADDR
121void hwm_conv_can(struct s_smc *smc, char *data, int len); 121static void hwm_conv_can(struct s_smc *smc, char *data, int len);
122#else 122#else
123#define hwm_conv_can(smc,data,len) 123#define hwm_conv_can(smc,data,len)
124#endif 124#endif
@@ -216,24 +216,6 @@ void smt_agent_task(struct s_smc *smc)
216 DB_SMT("SMT agent task\n",0,0) ; 216 DB_SMT("SMT agent task\n",0,0) ;
217} 217}
218 218
219void smt_please_reconnect(struct s_smc *smc, int reconn_time)
220/* struct s_smc *smc; Pointer to SMT context */
221/* int reconn_time; Wait for reconnect time in seconds */
222{
223 /*
224 * The please reconnect variable is used as a timer.
225 * It is decremented each time smt_event is called.
226 * This happens every second or when smt_force_irq is called.
227 * Note: smt_force_irq () is called on some packet receives and
228 * when a multicast address is changed. Since nothing
229 * is received during the disconnect and the multicast
230 * address changes can be viewed as not very often and
231 * the timer runs out close to its given value
232 * (reconn_time).
233 */
234 smc->sm.please_reconnect = reconn_time ;
235}
236
237#ifndef SMT_REAL_TOKEN_CT 219#ifndef SMT_REAL_TOKEN_CT
238void smt_emulate_token_ct(struct s_smc *smc, int mac_index) 220void smt_emulate_token_ct(struct s_smc *smc, int mac_index)
239{ 221{
@@ -1574,7 +1556,7 @@ static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long see
1574 * clear DNA and UNA 1556 * clear DNA and UNA
1575 * called from CFM if configuration changes 1557 * called from CFM if configuration changes
1576 */ 1558 */
1577void smt_clear_una_dna(struct s_smc *smc) 1559static void smt_clear_una_dna(struct s_smc *smc)
1578{ 1560{
1579 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; 1561 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ;
1580 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; 1562 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ;
@@ -2058,30 +2040,10 @@ int smt_action(struct s_smc *smc, int class, int code, int index)
2058} 2040}
2059 2041
2060/* 2042/*
2061 * change tneg
2062 * set T_Req in MIB (Path Attribute)
2063 * calculate new values for MAC
2064 * if change required
2065 * disconnect
2066 * set reconnect
2067 * end
2068 */
2069void smt_change_t_neg(struct s_smc *smc, u_long tneg)
2070{
2071 smc->mib.a[PATH0].fddiPATHMaxT_Req = tneg ;
2072
2073 if (smt_set_mac_opvalues(smc)) {
2074 RS_SET(smc,RS_EVENT) ;
2075 smc->sm.please_reconnect = 1 ;
2076 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ;
2077 }
2078}
2079
2080/*
2081 * canonical conversion of <len> bytes beginning form *data 2043 * canonical conversion of <len> bytes beginning form *data
2082 */ 2044 */
2083#ifdef USE_CAN_ADDR 2045#ifdef USE_CAN_ADDR
2084void hwm_conv_can(struct s_smc *smc, char *data, int len) 2046static void hwm_conv_can(struct s_smc *smc, char *data, int len)
2085{ 2047{
2086 int i ; 2048 int i ;
2087 2049
diff --git a/drivers/net/skfp/smtdef.c b/drivers/net/skfp/smtdef.c
index 5a0c8db816d8..4e07ff7073f1 100644
--- a/drivers/net/skfp/smtdef.c
+++ b/drivers/net/skfp/smtdef.c
@@ -76,11 +76,6 @@ void smt_reset_defaults(struct s_smc *smc, int level);
76static void smt_init_mib(struct s_smc *smc, int level); 76static void smt_init_mib(struct s_smc *smc, int level);
77static int set_min_max(int maxflag, u_long mib, u_long limit, u_long *oper); 77static int set_min_max(int maxflag, u_long mib, u_long limit, u_long *oper);
78 78
79void smt_set_defaults(struct s_smc *smc)
80{
81 smt_reset_defaults(smc,0) ;
82}
83
84#define MS2BCLK(x) ((x)*12500L) 79#define MS2BCLK(x) ((x)*12500L)
85#define US2BCLK(x) ((x)*1250L) 80#define US2BCLK(x) ((x)*1250L)
86 81
diff --git a/drivers/net/skfp/smtparse.c b/drivers/net/skfp/smtparse.c
deleted file mode 100644
index d5779e414dbe..000000000000
--- a/drivers/net/skfp/smtparse.c
+++ /dev/null
@@ -1,467 +0,0 @@
1/******************************************************************************
2 *
3 * (C)Copyright 1998,1999 SysKonnect,
4 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
5 *
6 * See the file "skfddi.c" for further information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The information in this file is provided "AS IS" without warranty.
14 *
15 ******************************************************************************/
16
17
18/*
19 parser for SMT parameters
20*/
21
22#include "h/types.h"
23#include "h/fddi.h"
24#include "h/smc.h"
25#include "h/smt_p.h"
26
27#define KERNEL
28#include "h/smtstate.h"
29
30#ifndef lint
31static const char ID_sccs[] = "@(#)smtparse.c 1.12 98/10/06 (C) SK " ;
32#endif
33
34#ifdef sun
35#define _far
36#endif
37
38/*
39 * convert to BCLK units
40 */
41#define MS2BCLK(x) ((x)*12500L)
42#define US2BCLK(x) ((x/10)*125L)
43
44/*
45 * parameter table
46 */
47static struct s_ptab {
48 char *pt_name ;
49 u_short pt_num ;
50 u_short pt_type ;
51 u_long pt_min ;
52 u_long pt_max ;
53} ptab[] = {
54 { "PMFPASSWD",0, 0 } ,
55 { "USERDATA",1, 0 } ,
56 { "LERCUTOFFA",2, 1, 4, 15 } ,
57 { "LERCUTOFFB",3, 1, 4, 15 } ,
58 { "LERALARMA",4, 1, 4, 15 } ,
59 { "LERALARMB",5, 1, 4, 15 } ,
60 { "TMAX",6, 1, 5, 165 } ,
61 { "TMIN",7, 1, 5, 165 } ,
62 { "TREQ",8, 1, 5, 165 } ,
63 { "TVX",9, 1, 2500, 10000 } ,
64#ifdef ESS
65 { "SBAPAYLOAD",10, 1, 0, 1562 } ,
66 { "SBAOVERHEAD",11, 1, 50, 5000 } ,
67 { "MAXTNEG",12, 1, 5, 165 } ,
68 { "MINSEGMENTSIZE",13, 1, 0, 4478 } ,
69 { "SBACATEGORY",14, 1, 0, 0xffff } ,
70 { "SYNCHTXMODE",15, 0 } ,
71#endif
72#ifdef SBA
73 { "SBACOMMAND",16, 0 } ,
74 { "SBAAVAILABLE",17, 1, 0, 100 } ,
75#endif
76 { NULL }
77} ;
78
79/* Define maximum string size for values and keybuffer */
80#define MAX_VAL 40
81
82/*
83 * local function declarations
84 */
85static u_long parse_num(int type, char _far *value, char *v, u_long mn,
86 u_long mx, int scale);
87static int parse_word(char *buf, char _far *text);
88
89#ifdef SIM
90#define DB_MAIN(a,b,c) printf(a,b,c)
91#else
92#define DB_MAIN(a,b,c)
93#endif
94
95/*
96 * BEGIN_MANUAL_ENTRY()
97 *
98 * int smt_parse_arg(struct s_smc *,char _far *keyword,int type,
99 char _far *value)
100 *
101 * parse SMT parameter
102 * *keyword
103 * pointer to keyword, must be \0, \n or \r terminated
104 * *value pointer to value, either char * or u_long *
105 * if char *
106 * pointer to value, must be \0, \n or \r terminated
107 * if u_long *
108 * contains binary value
109 *
110 * type 0: integer
111 * 1: string
112 * return
113 * 0 parameter parsed ok
114 * != 0 error
115 * NOTE:
116 * function can be called with DS != SS
117 *
118 *
119 * END_MANUAL_ENTRY()
120 */
121int smt_parse_arg(struct s_smc *smc, char _far *keyword, int type,
122 char _far *value)
123{
124 char keybuf[MAX_VAL+1];
125 char valbuf[MAX_VAL+1];
126 char c ;
127 char *p ;
128 char *v ;
129 char *d ;
130 u_long val = 0 ;
131 struct s_ptab *pt ;
132 int st ;
133 int i ;
134
135 /*
136 * parse keyword
137 */
138 if ((st = parse_word(keybuf,keyword)))
139 return(st) ;
140 /*
141 * parse value if given as string
142 */
143 if (type == 1) {
144 if ((st = parse_word(valbuf,value)))
145 return(st) ;
146 }
147 /*
148 * search in table
149 */
150 st = 0 ;
151 for (pt = ptab ; (v = pt->pt_name) ; pt++) {
152 for (p = keybuf ; (c = *p) ; p++,v++) {
153 if (c != *v)
154 break ;
155 }
156 if (!c && !*v)
157 break ;
158 }
159 if (!v)
160 return(-1) ;
161#if 0
162 printf("=>%s<==>%s<=\n",pt->pt_name,valbuf) ;
163#endif
164 /*
165 * set value in MIB
166 */
167 if (pt->pt_type)
168 val = parse_num(type,value,valbuf,pt->pt_min,pt->pt_max,1) ;
169 switch (pt->pt_num) {
170 case 0 :
171 v = valbuf ;
172 d = (char *) smc->mib.fddiPRPMFPasswd ;
173 for (i = 0 ; i < (signed)sizeof(smc->mib.fddiPRPMFPasswd) ; i++)
174 *d++ = *v++ ;
175 DB_MAIN("SET %s = %s\n",pt->pt_name,smc->mib.fddiPRPMFPasswd) ;
176 break ;
177 case 1 :
178 v = valbuf ;
179 d = (char *) smc->mib.fddiSMTUserData ;
180 for (i = 0 ; i < (signed)sizeof(smc->mib.fddiSMTUserData) ; i++)
181 *d++ = *v++ ;
182 DB_MAIN("SET %s = %s\n",pt->pt_name,smc->mib.fddiSMTUserData) ;
183 break ;
184 case 2 :
185 smc->mib.p[PA].fddiPORTLer_Cutoff = (u_char) val ;
186 DB_MAIN("SET %s = %d\n",
187 pt->pt_name,smc->mib.p[PA].fddiPORTLer_Cutoff) ;
188 break ;
189 case 3 :
190 smc->mib.p[PB].fddiPORTLer_Cutoff = (u_char) val ;
191 DB_MAIN("SET %s = %d\n",
192 pt->pt_name,smc->mib.p[PB].fddiPORTLer_Cutoff) ;
193 break ;
194 case 4 :
195 smc->mib.p[PA].fddiPORTLer_Alarm = (u_char) val ;
196 DB_MAIN("SET %s = %d\n",
197 pt->pt_name,smc->mib.p[PA].fddiPORTLer_Alarm) ;
198 break ;
199 case 5 :
200 smc->mib.p[PB].fddiPORTLer_Alarm = (u_char) val ;
201 DB_MAIN("SET %s = %d\n",
202 pt->pt_name,smc->mib.p[PB].fddiPORTLer_Alarm) ;
203 break ;
204 case 6 : /* TMAX */
205 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
206 smc->mib.a[PATH0].fddiPATHT_MaxLowerBound =
207 (u_long) -MS2BCLK((long)val) ;
208 break ;
209 case 7 : /* TMIN */
210 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
211 smc->mib.m[MAC0].fddiMACT_Min =
212 (u_long) -MS2BCLK((long)val) ;
213 break ;
214 case 8 : /* TREQ */
215 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
216 smc->mib.a[PATH0].fddiPATHMaxT_Req =
217 (u_long) -MS2BCLK((long)val) ;
218 break ;
219 case 9 : /* TVX */
220 DB_MAIN("SET %s = %d \n",pt->pt_name,val) ;
221 smc->mib.a[PATH0].fddiPATHTVXLowerBound =
222 (u_long) -US2BCLK((long)val) ;
223 break ;
224#ifdef ESS
225 case 10 : /* SBAPAYLOAD */
226 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
227 if (smc->mib.fddiESSPayload != val) {
228 smc->ess.raf_act_timer_poll = TRUE ;
229 smc->mib.fddiESSPayload = val ;
230 }
231 break ;
232 case 11 : /* SBAOVERHEAD */
233 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
234 smc->mib.fddiESSOverhead = val ;
235 break ;
236 case 12 : /* MAXTNEG */
237 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
238 smc->mib.fddiESSMaxTNeg = (u_long) -MS2BCLK((long)val) ;
239 break ;
240 case 13 : /* MINSEGMENTSIZE */
241 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
242 smc->mib.fddiESSMinSegmentSize = val ;
243 break ;
244 case 14 : /* SBACATEGORY */
245 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
246 smc->mib.fddiESSCategory =
247 (smc->mib.fddiESSCategory & 0xffff) |
248 ((u_long)(val << 16)) ;
249 break ;
250 case 15 : /* SYNCHTXMODE */
251 /* do not use memcmp(valbuf,"ALL",3) because DS != SS */
252 if (valbuf[0] == 'A' && valbuf[1] == 'L' && valbuf[2] == 'L') {
253 smc->mib.fddiESSSynchTxMode = TRUE ;
254 DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ;
255 }
256 /* if (!memcmp(valbuf,"SPLIT",5)) { */
257 if (valbuf[0] == 'S' && valbuf[1] == 'P' && valbuf[2] == 'L' &&
258 valbuf[3] == 'I' && valbuf[4] == 'T') {
259 DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ;
260 smc->mib.fddiESSSynchTxMode = FALSE ;
261 }
262 break ;
263#endif
264#ifdef SBA
265 case 16 : /* SBACOMMAND */
266 /* if (!memcmp(valbuf,"START",5)) { */
267 if (valbuf[0] == 'S' && valbuf[1] == 'T' && valbuf[2] == 'A' &&
268 valbuf[3] == 'R' && valbuf[4] == 'T') {
269 DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ;
270 smc->mib.fddiSBACommand = SB_START ;
271 }
272 /* if (!memcmp(valbuf,"STOP",4)) { */
273 if (valbuf[0] == 'S' && valbuf[1] == 'T' && valbuf[2] == 'O' &&
274 valbuf[3] == 'P') {
275 DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ;
276 smc->mib.fddiSBACommand = SB_STOP ;
277 }
278 break ;
279 case 17 : /* SBAAVAILABLE */
280 DB_MAIN("SET %s = %d\n",pt->pt_name,val) ;
281 smc->mib.fddiSBAAvailable = (u_char) val ;
282 break ;
283#endif
284 }
285 return(0) ;
286}
287
288static int parse_word(char *buf, char _far *text)
289{
290 char c ;
291 char *p ;
292 int p_len ;
293 int quote ;
294 int i ;
295 int ok ;
296
297 /*
298 * skip leading white space
299 */
300 p = buf ;
301 for (i = 0 ; i < MAX_VAL ; i++)
302 *p++ = 0 ;
303 p = buf ;
304 p_len = 0 ;
305 ok = 0 ;
306 while ( (c = *text++) && (c != '\n') && (c != '\r')) {
307 if ((c != ' ') && (c != '\t')) {
308 ok = 1 ;
309 break ;
310 }
311 }
312 if (!ok)
313 return(-1) ;
314 if (c == '"') {
315 quote = 1 ;
316 }
317 else {
318 quote = 0 ;
319 text-- ;
320 }
321 /*
322 * parse valbuf
323 */
324 ok = 0 ;
325 while (!ok && p_len < MAX_VAL-1 && (c = *text++) && (c != '\n')
326 && (c != '\r')) {
327 switch (quote) {
328 case 0 :
329 if ((c == ' ') || (c == '\t') || (c == '=')) {
330 ok = 1 ;
331 break ;
332 }
333 *p++ = c ;
334 p_len++ ;
335 break ;
336 case 2 :
337 *p++ = c ;
338 p_len++ ;
339 quote = 1 ;
340 break ;
341 case 1 :
342 switch (c) {
343 case '"' :
344 ok = 1 ;
345 break ;
346 case '\\' :
347 quote = 2 ;
348 break ;
349 default :
350 *p++ = c ;
351 p_len++ ;
352 }
353 }
354 }
355 *p++ = 0 ;
356 for (p = buf ; (c = *p) ; p++) {
357 if (c >= 'a' && c <= 'z')
358 *p = c + 'A' - 'a' ;
359 }
360 return(0) ;
361}
362
363static u_long parse_num(int type, char _far *value, char *v, u_long mn,
364 u_long mx, int scale)
365{
366 u_long x = 0 ;
367 char c ;
368
369 if (type == 0) { /* integer */
370 u_long _far *l ;
371 u_long u1 ;
372
373 l = (u_long _far *) value ;
374 u1 = *l ;
375 /*
376 * if the value is negative take the lower limit
377 */
378 if ((long)u1 < 0) {
379 if (- ((long)u1) > (long) mx) {
380 u1 = 0 ;
381 }
382 else {
383 u1 = (u_long) - ((long)u1) ;
384 }
385 }
386 x = u1 ;
387 }
388 else { /* string */
389 int sign = 0 ;
390
391 if (*v == '-') {
392 sign = 1 ;
393 }
394 while ((c = *v++) && (c >= '0') && (c <= '9')) {
395 x = x * 10 + c - '0' ;
396 }
397 if (scale == 10) {
398 x *= 10 ;
399 if (c == '.') {
400 if ((c = *v++) && (c >= '0') && (c <= '9')) {
401 x += c - '0' ;
402 }
403 }
404 }
405 if (sign)
406 x = (u_long) - ((long)x) ;
407 }
408 /*
409 * if the value is negative
410 * and the absolute value is outside the limits
411 * take the lower limit
412 * else
413 * take the absoute value
414 */
415 if ((long)x < 0) {
416 if (- ((long)x) > (long) mx) {
417 x = 0 ;
418 }
419 else {
420 x = (u_long) - ((long)x) ;
421 }
422 }
423 if (x < mn)
424 return(mn) ;
425 else if (x > mx)
426 return(mx) ;
427 return(x) ;
428}
429
430#if 0
431struct s_smc SMC ;
432main()
433{
434 char *p ;
435 char *v ;
436 char buf[100] ;
437 int toggle = 0 ;
438
439 while (gets(buf)) {
440 p = buf ;
441 while (*p && ((*p == ' ') || (*p == '\t')))
442 p++ ;
443
444 while (*p && ((*p != ' ') && (*p != '\t')))
445 p++ ;
446
447 v = p ;
448 while (*v && ((*v == ' ') || (*v == '\t')))
449 v++ ;
450 if ((*v >= '0') && (*v <= '9')) {
451 toggle = !toggle ;
452 if (toggle) {
453 u_long l ;
454 l = atol(v) ;
455 smt_parse_arg(&SMC,buf,0,(char _far *)&l) ;
456 }
457 else
458 smt_parse_arg(&SMC,buf,1,(char _far *)p) ;
459 }
460 else {
461 smt_parse_arg(&SMC,buf,1,(char _far *)p) ;
462 }
463 }
464 exit(0) ;
465}
466#endif
467
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 30e8d589d167..f15739481d62 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -7,7 +7,7 @@
7 * of the original driver such as link fail-over and link management because 7 * of the original driver such as link fail-over and link management because
8 * those should be done at higher levels. 8 * those should be done at higher levels.
9 * 9 *
10 * Copyright (C) 2004, Stephen Hemminger <shemminger@osdl.org> 10 * Copyright (C) 2004, 2005 Stephen Hemminger <shemminger@osdl.org>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
@@ -42,19 +42,20 @@
42#include "skge.h" 42#include "skge.h"
43 43
44#define DRV_NAME "skge" 44#define DRV_NAME "skge"
45#define DRV_VERSION "0.6" 45#define DRV_VERSION "0.8"
46#define PFX DRV_NAME " " 46#define PFX DRV_NAME " "
47 47
48#define DEFAULT_TX_RING_SIZE 128 48#define DEFAULT_TX_RING_SIZE 128
49#define DEFAULT_RX_RING_SIZE 512 49#define DEFAULT_RX_RING_SIZE 512
50#define MAX_TX_RING_SIZE 1024 50#define MAX_TX_RING_SIZE 1024
51#define MAX_RX_RING_SIZE 4096 51#define MAX_RX_RING_SIZE 4096
52#define RX_COPY_THRESHOLD 128
53#define RX_BUF_SIZE 1536
52#define PHY_RETRIES 1000 54#define PHY_RETRIES 1000
53#define ETH_JUMBO_MTU 9000 55#define ETH_JUMBO_MTU 9000
54#define TX_WATCHDOG (5 * HZ) 56#define TX_WATCHDOG (5 * HZ)
55#define NAPI_WEIGHT 64 57#define NAPI_WEIGHT 64
56#define BLINK_HZ (HZ/4) 58#define BLINK_MS 250
57#define LINK_POLL_HZ (HZ/10)
58 59
59MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); 60MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
60MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 61MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>");
@@ -70,28 +71,16 @@ module_param(debug, int, 0);
70MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 71MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
71 72
72static const struct pci_device_id skge_id_table[] = { 73static const struct pci_device_id skge_id_table[] = {
73 { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940, 74 { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940) },
74 PCI_ANY_ID, PCI_ANY_ID }, 75 { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) },
75 { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B, 76 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) },
76 PCI_ANY_ID, PCI_ANY_ID }, 77 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) },
77 { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE, 78 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), },
78 PCI_ANY_ID, PCI_ANY_ID }, 79 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) },
79 { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU, 80 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */
80 PCI_ANY_ID, PCI_ANY_ID }, 81 { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) },
81 { PCI_VENDOR_ID_SYSKONNECT, 0x9E00, /* SK-9Exx */ 82 { PCI_DEVICE(PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1032) },
82 PCI_ANY_ID, PCI_ANY_ID }, 83 { PCI_DEVICE(PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1064) },
83 { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T,
84 PCI_ANY_ID, PCI_ANY_ID },
85 { PCI_VENDOR_ID_MARVELL, 0x4320, /* Gigabit Ethernet Controller */
86 PCI_ANY_ID, PCI_ANY_ID },
87 { PCI_VENDOR_ID_MARVELL, 0x5005, /* Marvell (11ab), Belkin */
88 PCI_ANY_ID, PCI_ANY_ID },
89 { PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD,
90 PCI_ANY_ID, PCI_ANY_ID },
91 { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1032,
92 PCI_ANY_ID, PCI_ANY_ID },
93 { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1064,
94 PCI_ANY_ID, PCI_ANY_ID },
95 { 0 } 84 { 0 }
96}; 85};
97MODULE_DEVICE_TABLE(pci, skge_id_table); 86MODULE_DEVICE_TABLE(pci, skge_id_table);
@@ -99,19 +88,22 @@ MODULE_DEVICE_TABLE(pci, skge_id_table);
99static int skge_up(struct net_device *dev); 88static int skge_up(struct net_device *dev);
100static int skge_down(struct net_device *dev); 89static int skge_down(struct net_device *dev);
101static void skge_tx_clean(struct skge_port *skge); 90static void skge_tx_clean(struct skge_port *skge);
102static void skge_xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); 91static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val);
103static void skge_gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); 92static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val);
104static void genesis_get_stats(struct skge_port *skge, u64 *data); 93static void genesis_get_stats(struct skge_port *skge, u64 *data);
105static void yukon_get_stats(struct skge_port *skge, u64 *data); 94static void yukon_get_stats(struct skge_port *skge, u64 *data);
106static void yukon_init(struct skge_hw *hw, int port); 95static void yukon_init(struct skge_hw *hw, int port);
107static void yukon_reset(struct skge_hw *hw, int port); 96static void yukon_reset(struct skge_hw *hw, int port);
108static void genesis_mac_init(struct skge_hw *hw, int port); 97static void genesis_mac_init(struct skge_hw *hw, int port);
109static void genesis_reset(struct skge_hw *hw, int port); 98static void genesis_reset(struct skge_hw *hw, int port);
99static void genesis_link_up(struct skge_port *skge);
110 100
101/* Avoid conditionals by using array */
111static const int txqaddr[] = { Q_XA1, Q_XA2 }; 102static const int txqaddr[] = { Q_XA1, Q_XA2 };
112static const int rxqaddr[] = { Q_R1, Q_R2 }; 103static const int rxqaddr[] = { Q_R1, Q_R2 };
113static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; 104static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
114static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; 105static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
106static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 };
115 107
116/* Don't need to look at whole 16K. 108/* Don't need to look at whole 16K.
117 * last interesting register is descriptor poll timer. 109 * last interesting register is descriptor poll timer.
@@ -154,7 +146,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs,
154static int wol_supported(const struct skge_hw *hw) 146static int wol_supported(const struct skge_hw *hw)
155{ 147{
156 return !((hw->chip_id == CHIP_ID_GENESIS || 148 return !((hw->chip_id == CHIP_ID_GENESIS ||
157 (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0))); 149 (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0)));
158} 150}
159 151
160static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 152static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -170,7 +162,7 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
170 struct skge_port *skge = netdev_priv(dev); 162 struct skge_port *skge = netdev_priv(dev);
171 struct skge_hw *hw = skge->hw; 163 struct skge_hw *hw = skge->hw;
172 164
173 if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) 165 if (wol->wolopts != WAKE_MAGIC && wol->wolopts != 0)
174 return -EOPNOTSUPP; 166 return -EOPNOTSUPP;
175 167
176 if (wol->wolopts == WAKE_MAGIC && !wol_supported(hw)) 168 if (wol->wolopts == WAKE_MAGIC && !wol_supported(hw))
@@ -190,6 +182,36 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
190 return 0; 182 return 0;
191} 183}
192 184
185/* Determine supported/adverised modes based on hardware.
186 * Note: ethtoool ADVERTISED_xxx == SUPPORTED_xxx
187 */
188static u32 skge_supported_modes(const struct skge_hw *hw)
189{
190 u32 supported;
191
192 if (iscopper(hw)) {
193 supported = SUPPORTED_10baseT_Half
194 | SUPPORTED_10baseT_Full
195 | SUPPORTED_100baseT_Half
196 | SUPPORTED_100baseT_Full
197 | SUPPORTED_1000baseT_Half
198 | SUPPORTED_1000baseT_Full
199 | SUPPORTED_Autoneg| SUPPORTED_TP;
200
201 if (hw->chip_id == CHIP_ID_GENESIS)
202 supported &= ~(SUPPORTED_10baseT_Half
203 | SUPPORTED_10baseT_Full
204 | SUPPORTED_100baseT_Half
205 | SUPPORTED_100baseT_Full);
206
207 else if (hw->chip_id == CHIP_ID_YUKON)
208 supported &= ~SUPPORTED_1000baseT_Half;
209 } else
210 supported = SUPPORTED_1000baseT_Full | SUPPORTED_FIBRE
211 | SUPPORTED_Autoneg;
212
213 return supported;
214}
193 215
194static int skge_get_settings(struct net_device *dev, 216static int skge_get_settings(struct net_device *dev,
195 struct ethtool_cmd *ecmd) 217 struct ethtool_cmd *ecmd)
@@ -198,38 +220,13 @@ static int skge_get_settings(struct net_device *dev,
198 struct skge_hw *hw = skge->hw; 220 struct skge_hw *hw = skge->hw;
199 221
200 ecmd->transceiver = XCVR_INTERNAL; 222 ecmd->transceiver = XCVR_INTERNAL;
223 ecmd->supported = skge_supported_modes(hw);
201 224
202 if (iscopper(hw)) { 225 if (iscopper(hw)) {
203 if (hw->chip_id == CHIP_ID_GENESIS)
204 ecmd->supported = SUPPORTED_1000baseT_Full
205 | SUPPORTED_1000baseT_Half
206 | SUPPORTED_Autoneg | SUPPORTED_TP;
207 else {
208 ecmd->supported = SUPPORTED_10baseT_Half
209 | SUPPORTED_10baseT_Full
210 | SUPPORTED_100baseT_Half
211 | SUPPORTED_100baseT_Full
212 | SUPPORTED_1000baseT_Half
213 | SUPPORTED_1000baseT_Full
214 | SUPPORTED_Autoneg| SUPPORTED_TP;
215
216 if (hw->chip_id == CHIP_ID_YUKON)
217 ecmd->supported &= ~SUPPORTED_1000baseT_Half;
218
219 else if (hw->chip_id == CHIP_ID_YUKON_FE)
220 ecmd->supported &= ~(SUPPORTED_1000baseT_Half
221 | SUPPORTED_1000baseT_Full);
222 }
223
224 ecmd->port = PORT_TP; 226 ecmd->port = PORT_TP;
225 ecmd->phy_address = hw->phy_addr; 227 ecmd->phy_address = hw->phy_addr;
226 } else { 228 } else
227 ecmd->supported = SUPPORTED_1000baseT_Full
228 | SUPPORTED_FIBRE
229 | SUPPORTED_Autoneg;
230
231 ecmd->port = PORT_FIBRE; 229 ecmd->port = PORT_FIBRE;
232 }
233 230
234 ecmd->advertising = skge->advertising; 231 ecmd->advertising = skge->advertising;
235 ecmd->autoneg = skge->autoneg; 232 ecmd->autoneg = skge->autoneg;
@@ -238,65 +235,57 @@ static int skge_get_settings(struct net_device *dev,
238 return 0; 235 return 0;
239} 236}
240 237
241static u32 skge_modes(const struct skge_hw *hw)
242{
243 u32 modes = ADVERTISED_Autoneg
244 | ADVERTISED_1000baseT_Full | ADVERTISED_1000baseT_Half
245 | ADVERTISED_100baseT_Full | ADVERTISED_100baseT_Half
246 | ADVERTISED_10baseT_Full | ADVERTISED_10baseT_Half;
247
248 if (iscopper(hw)) {
249 modes |= ADVERTISED_TP;
250 switch(hw->chip_id) {
251 case CHIP_ID_GENESIS:
252 modes &= ~(ADVERTISED_100baseT_Full
253 | ADVERTISED_100baseT_Half
254 | ADVERTISED_10baseT_Full
255 | ADVERTISED_10baseT_Half);
256 break;
257
258 case CHIP_ID_YUKON:
259 modes &= ~ADVERTISED_1000baseT_Half;
260 break;
261
262 case CHIP_ID_YUKON_FE:
263 modes &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full);
264 break;
265 }
266 } else {
267 modes |= ADVERTISED_FIBRE;
268 modes &= ~ADVERTISED_1000baseT_Half;
269 }
270 return modes;
271}
272
273static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 238static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
274{ 239{
275 struct skge_port *skge = netdev_priv(dev); 240 struct skge_port *skge = netdev_priv(dev);
276 const struct skge_hw *hw = skge->hw; 241 const struct skge_hw *hw = skge->hw;
242 u32 supported = skge_supported_modes(hw);
277 243
278 if (ecmd->autoneg == AUTONEG_ENABLE) { 244 if (ecmd->autoneg == AUTONEG_ENABLE) {
279 if (ecmd->advertising & skge_modes(hw)) 245 ecmd->advertising = supported;
280 return -EINVAL; 246 skge->duplex = -1;
247 skge->speed = -1;
281 } else { 248 } else {
282 switch(ecmd->speed) { 249 u32 setting;
250
251 switch (ecmd->speed) {
283 case SPEED_1000: 252 case SPEED_1000:
284 if (hw->chip_id == CHIP_ID_YUKON_FE) 253 if (ecmd->duplex == DUPLEX_FULL)
254 setting = SUPPORTED_1000baseT_Full;
255 else if (ecmd->duplex == DUPLEX_HALF)
256 setting = SUPPORTED_1000baseT_Half;
257 else
285 return -EINVAL; 258 return -EINVAL;
286 break; 259 break;
287 case SPEED_100: 260 case SPEED_100:
261 if (ecmd->duplex == DUPLEX_FULL)
262 setting = SUPPORTED_100baseT_Full;
263 else if (ecmd->duplex == DUPLEX_HALF)
264 setting = SUPPORTED_100baseT_Half;
265 else
266 return -EINVAL;
267 break;
268
288 case SPEED_10: 269 case SPEED_10:
289 if (iscopper(hw) || hw->chip_id == CHIP_ID_GENESIS) 270 if (ecmd->duplex == DUPLEX_FULL)
271 setting = SUPPORTED_10baseT_Full;
272 else if (ecmd->duplex == DUPLEX_HALF)
273 setting = SUPPORTED_10baseT_Half;
274 else
290 return -EINVAL; 275 return -EINVAL;
291 break; 276 break;
292 default: 277 default:
293 return -EINVAL; 278 return -EINVAL;
294 } 279 }
280
281 if ((setting & supported) == 0)
282 return -EINVAL;
283
284 skge->speed = ecmd->speed;
285 skge->duplex = ecmd->duplex;
295 } 286 }
296 287
297 skge->autoneg = ecmd->autoneg; 288 skge->autoneg = ecmd->autoneg;
298 skge->speed = ecmd->speed;
299 skge->duplex = ecmd->duplex;
300 skge->advertising = ecmd->advertising; 289 skge->advertising = ecmd->advertising;
301 290
302 if (netif_running(dev)) { 291 if (netif_running(dev)) {
@@ -393,7 +382,7 @@ static void skge_get_strings(struct net_device *dev, u32 stringset, u8 *data)
393{ 382{
394 int i; 383 int i;
395 384
396 switch(stringset) { 385 switch (stringset) {
397 case ETH_SS_STATS: 386 case ETH_SS_STATS:
398 for (i = 0; i < ARRAY_SIZE(skge_stats); i++) 387 for (i = 0; i < ARRAY_SIZE(skge_stats); i++)
399 memcpy(data + i * ETH_GSTRING_LEN, 388 memcpy(data + i * ETH_GSTRING_LEN,
@@ -511,14 +500,6 @@ static int skge_set_rx_csum(struct net_device *dev, u32 data)
511 return 0; 500 return 0;
512} 501}
513 502
514/* Only Yukon II supports TSO (not implemented yet) */
515static int skge_set_tso(struct net_device *dev, u32 data)
516{
517 if (data)
518 return -EOPNOTSUPP;
519 return 0;
520}
521
522static void skge_get_pauseparam(struct net_device *dev, 503static void skge_get_pauseparam(struct net_device *dev,
523 struct ethtool_pauseparam *ecmd) 504 struct ethtool_pauseparam *ecmd)
524{ 505{
@@ -540,9 +521,9 @@ static int skge_set_pauseparam(struct net_device *dev,
540 skge->autoneg = ecmd->autoneg; 521 skge->autoneg = ecmd->autoneg;
541 if (ecmd->rx_pause && ecmd->tx_pause) 522 if (ecmd->rx_pause && ecmd->tx_pause)
542 skge->flow_control = FLOW_MODE_SYMMETRIC; 523 skge->flow_control = FLOW_MODE_SYMMETRIC;
543 else if(ecmd->rx_pause && !ecmd->tx_pause) 524 else if (ecmd->rx_pause && !ecmd->tx_pause)
544 skge->flow_control = FLOW_MODE_REM_SEND; 525 skge->flow_control = FLOW_MODE_REM_SEND;
545 else if(!ecmd->rx_pause && ecmd->tx_pause) 526 else if (!ecmd->rx_pause && ecmd->tx_pause)
546 skge->flow_control = FLOW_MODE_LOC_SEND; 527 skge->flow_control = FLOW_MODE_LOC_SEND;
547 else 528 else
548 skge->flow_control = FLOW_MODE_NONE; 529 skge->flow_control = FLOW_MODE_NONE;
@@ -559,8 +540,6 @@ static inline u32 hwkhz(const struct skge_hw *hw)
559{ 540{
560 if (hw->chip_id == CHIP_ID_GENESIS) 541 if (hw->chip_id == CHIP_ID_GENESIS)
561 return 53215; /* or: 53.125 MHz */ 542 return 53215; /* or: 53.125 MHz */
562 else if (hw->chip_id == CHIP_ID_YUKON_EC)
563 return 125000; /* or: 125.000 MHz */
564 else 543 else
565 return 78215; /* or: 78.125 MHz */ 544 return 78215; /* or: 78.125 MHz */
566} 545}
@@ -640,107 +619,98 @@ static int skge_set_coalesce(struct net_device *dev,
640 return 0; 619 return 0;
641} 620}
642 621
643static void skge_led_on(struct skge_hw *hw, int port) 622enum led_mode { LED_MODE_OFF, LED_MODE_ON, LED_MODE_TST };
623static void skge_led(struct skge_port *skge, enum led_mode mode)
644{ 624{
625 struct skge_hw *hw = skge->hw;
626 int port = skge->port;
627
628 spin_lock_bh(&hw->phy_lock);
645 if (hw->chip_id == CHIP_ID_GENESIS) { 629 if (hw->chip_id == CHIP_ID_GENESIS) {
646 skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_ON); 630 switch (mode) {
647 skge_write8(hw, B0_LED, LED_STAT_ON); 631 case LED_MODE_OFF:
632 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF);
633 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
634 skge_write32(hw, SK_REG(port, RX_LED_VAL), 0);
635 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF);
636 break;
648 637
649 skge_write8(hw, SKGEMAC_REG(port, RX_LED_TST), LED_T_ON); 638 case LED_MODE_ON:
650 skge_write32(hw, SKGEMAC_REG(port, RX_LED_VAL), 100); 639 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON);
651 skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_START); 640 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON);
641
642 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
643 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START);
652 644
653 switch (hw->phy_type) {
654 case SK_PHY_BCOM:
655 skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL,
656 PHY_B_PEC_LED_ON);
657 break; 645 break;
658 case SK_PHY_LONE: 646
659 skge_xm_phy_write(hw, port, PHY_LONE_LED_CFG, 647 case LED_MODE_TST:
660 0x0800); 648 skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON);
649 skge_write32(hw, SK_REG(port, RX_LED_VAL), 100);
650 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
651
652 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON);
661 break; 653 break;
662 default:
663 skge_write8(hw, SKGEMAC_REG(port, TX_LED_TST), LED_T_ON);
664 skge_write32(hw, SKGEMAC_REG(port, TX_LED_VAL), 100);
665 skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_START);
666 } 654 }
667 } else { 655 } else {
668 skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); 656 switch (mode) {
669 skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER, 657 case LED_MODE_OFF:
670 PHY_M_LED_MO_DUP(MO_LED_ON) | 658 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
671 PHY_M_LED_MO_10(MO_LED_ON) | 659 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
672 PHY_M_LED_MO_100(MO_LED_ON) | 660 PHY_M_LED_MO_DUP(MO_LED_OFF) |
673 PHY_M_LED_MO_1000(MO_LED_ON) | 661 PHY_M_LED_MO_10(MO_LED_OFF) |
674 PHY_M_LED_MO_RX(MO_LED_ON)); 662 PHY_M_LED_MO_100(MO_LED_OFF) |
675 } 663 PHY_M_LED_MO_1000(MO_LED_OFF) |
676} 664 PHY_M_LED_MO_RX(MO_LED_OFF));
677
678static void skge_led_off(struct skge_hw *hw, int port)
679{
680 if (hw->chip_id == CHIP_ID_GENESIS) {
681 skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_OFF);
682 skge_write8(hw, B0_LED, LED_STAT_OFF);
683
684 skge_write32(hw, SKGEMAC_REG(port, RX_LED_VAL), 0);
685 skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_T_OFF);
686
687 switch (hw->phy_type) {
688 case SK_PHY_BCOM:
689 skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL,
690 PHY_B_PEC_LED_OFF);
691 break; 665 break;
692 case SK_PHY_LONE: 666 case LED_MODE_ON:
693 skge_xm_phy_write(hw, port, PHY_LONE_LED_CFG, 667 gm_phy_write(hw, port, PHY_MARV_LED_CTRL,
694 PHY_L_LC_LEDT); 668 PHY_M_LED_PULS_DUR(PULS_170MS) |
669 PHY_M_LED_BLINK_RT(BLINK_84MS) |
670 PHY_M_LEDC_TX_CTRL |
671 PHY_M_LEDC_DP_CTRL);
672
673 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
674 PHY_M_LED_MO_RX(MO_LED_OFF) |
675 (skge->speed == SPEED_100 ?
676 PHY_M_LED_MO_100(MO_LED_ON) : 0));
695 break; 677 break;
696 default: 678 case LED_MODE_TST:
697 skge_write32(hw, SKGEMAC_REG(port, TX_LED_VAL), 0); 679 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
698 skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_T_OFF); 680 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
681 PHY_M_LED_MO_DUP(MO_LED_ON) |
682 PHY_M_LED_MO_10(MO_LED_ON) |
683 PHY_M_LED_MO_100(MO_LED_ON) |
684 PHY_M_LED_MO_1000(MO_LED_ON) |
685 PHY_M_LED_MO_RX(MO_LED_ON));
699 } 686 }
700 } else {
701 skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
702 skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER,
703 PHY_M_LED_MO_DUP(MO_LED_OFF) |
704 PHY_M_LED_MO_10(MO_LED_OFF) |
705 PHY_M_LED_MO_100(MO_LED_OFF) |
706 PHY_M_LED_MO_1000(MO_LED_OFF) |
707 PHY_M_LED_MO_RX(MO_LED_OFF));
708 } 687 }
709} 688 spin_unlock_bh(&hw->phy_lock);
710
711static void skge_blink_timer(unsigned long data)
712{
713 struct skge_port *skge = (struct skge_port *) data;
714 struct skge_hw *hw = skge->hw;
715 unsigned long flags;
716
717 spin_lock_irqsave(&hw->phy_lock, flags);
718 if (skge->blink_on)
719 skge_led_on(hw, skge->port);
720 else
721 skge_led_off(hw, skge->port);
722 spin_unlock_irqrestore(&hw->phy_lock, flags);
723
724 skge->blink_on = !skge->blink_on;
725 mod_timer(&skge->led_blink, jiffies + BLINK_HZ);
726} 689}
727 690
728/* blink LED's for finding board */ 691/* blink LED's for finding board */
729static int skge_phys_id(struct net_device *dev, u32 data) 692static int skge_phys_id(struct net_device *dev, u32 data)
730{ 693{
731 struct skge_port *skge = netdev_priv(dev); 694 struct skge_port *skge = netdev_priv(dev);
695 unsigned long ms;
696 enum led_mode mode = LED_MODE_TST;
732 697
733 if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) 698 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
734 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 699 ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000;
700 else
701 ms = data * 1000;
735 702
736 /* start blinking */ 703 while (ms > 0) {
737 skge->blink_on = 1; 704 skge_led(skge, mode);
738 mod_timer(&skge->led_blink, jiffies+1); 705 mode ^= LED_MODE_TST;
739 706
740 msleep_interruptible(data * 1000); 707 if (msleep_interruptible(BLINK_MS))
741 del_timer_sync(&skge->led_blink); 708 break;
709 ms -= BLINK_MS;
710 }
742 711
743 skge_led_off(skge->hw, skge->port); 712 /* back to regular LED state */
713 skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF);
744 714
745 return 0; 715 return 0;
746} 716}
@@ -763,8 +733,6 @@ static struct ethtool_ops skge_ethtool_ops = {
763 .set_pauseparam = skge_set_pauseparam, 733 .set_pauseparam = skge_set_pauseparam,
764 .get_coalesce = skge_get_coalesce, 734 .get_coalesce = skge_get_coalesce,
765 .set_coalesce = skge_set_coalesce, 735 .set_coalesce = skge_set_coalesce,
766 .get_tso = ethtool_op_get_tso,
767 .set_tso = skge_set_tso,
768 .get_sg = ethtool_op_get_sg, 736 .get_sg = ethtool_op_get_sg,
769 .set_sg = skge_set_sg, 737 .set_sg = skge_set_sg,
770 .get_tx_csum = ethtool_op_get_tx_csum, 738 .get_tx_csum = ethtool_op_get_tx_csum,
@@ -793,6 +761,7 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base)
793 761
794 for (i = 0, e = ring->start, d = vaddr; i < ring->count; i++, e++, d++) { 762 for (i = 0, e = ring->start, d = vaddr; i < ring->count; i++, e++, d++) {
795 e->desc = d; 763 e->desc = d;
764 e->skb = NULL;
796 if (i == ring->count - 1) { 765 if (i == ring->count - 1) {
797 e->next = ring->start; 766 e->next = ring->start;
798 d->next_offset = base; 767 d->next_offset = base;
@@ -806,24 +775,23 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base)
806 return 0; 775 return 0;
807} 776}
808 777
809/* Setup buffer for receiving */ 778static struct sk_buff *skge_rx_alloc(struct net_device *dev, unsigned int size)
810static inline int skge_rx_alloc(struct skge_port *skge,
811 struct skge_element *e)
812{ 779{
813 unsigned long bufsize = skge->netdev->mtu + ETH_HLEN; /* VLAN? */ 780 struct sk_buff *skb = dev_alloc_skb(size);
814 struct skge_rx_desc *rd = e->desc;
815 struct sk_buff *skb;
816 u64 map;
817 781
818 skb = dev_alloc_skb(bufsize + NET_IP_ALIGN); 782 if (likely(skb)) {
819 if (unlikely(!skb)) { 783 skb->dev = dev;
820 printk(KERN_DEBUG PFX "%s: out of memory for receive\n", 784 skb_reserve(skb, NET_IP_ALIGN);
821 skge->netdev->name);
822 return -ENOMEM;
823 } 785 }
786 return skb;
787}
824 788
825 skb->dev = skge->netdev; 789/* Allocate and setup a new buffer for receiving */
826 skb_reserve(skb, NET_IP_ALIGN); 790static void skge_rx_setup(struct skge_port *skge, struct skge_element *e,
791 struct sk_buff *skb, unsigned int bufsize)
792{
793 struct skge_rx_desc *rd = e->desc;
794 u64 map;
827 795
828 map = pci_map_single(skge->hw->pdev, skb->data, bufsize, 796 map = pci_map_single(skge->hw->pdev, skb->data, bufsize,
829 PCI_DMA_FROMDEVICE); 797 PCI_DMA_FROMDEVICE);
@@ -841,55 +809,69 @@ static inline int skge_rx_alloc(struct skge_port *skge,
841 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; 809 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize;
842 pci_unmap_addr_set(e, mapaddr, map); 810 pci_unmap_addr_set(e, mapaddr, map);
843 pci_unmap_len_set(e, maplen, bufsize); 811 pci_unmap_len_set(e, maplen, bufsize);
844 return 0;
845} 812}
846 813
847/* Free all unused buffers in receive ring, assumes receiver stopped */ 814/* Resume receiving using existing skb,
815 * Note: DMA address is not changed by chip.
816 * MTU not changed while receiver active.
817 */
818static void skge_rx_reuse(struct skge_element *e, unsigned int size)
819{
820 struct skge_rx_desc *rd = e->desc;
821
822 rd->csum2 = 0;
823 rd->csum2_start = ETH_HLEN;
824
825 wmb();
826
827 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | size;
828}
829
830
831/* Free all buffers in receive ring, assumes receiver stopped */
848static void skge_rx_clean(struct skge_port *skge) 832static void skge_rx_clean(struct skge_port *skge)
849{ 833{
850 struct skge_hw *hw = skge->hw; 834 struct skge_hw *hw = skge->hw;
851 struct skge_ring *ring = &skge->rx_ring; 835 struct skge_ring *ring = &skge->rx_ring;
852 struct skge_element *e; 836 struct skge_element *e;
853 837
854 for (e = ring->to_clean; e != ring->to_use; e = e->next) { 838 e = ring->start;
839 do {
855 struct skge_rx_desc *rd = e->desc; 840 struct skge_rx_desc *rd = e->desc;
856 rd->control = 0; 841 rd->control = 0;
857 842 if (e->skb) {
858 pci_unmap_single(hw->pdev, 843 pci_unmap_single(hw->pdev,
859 pci_unmap_addr(e, mapaddr), 844 pci_unmap_addr(e, mapaddr),
860 pci_unmap_len(e, maplen), 845 pci_unmap_len(e, maplen),
861 PCI_DMA_FROMDEVICE); 846 PCI_DMA_FROMDEVICE);
862 dev_kfree_skb(e->skb); 847 dev_kfree_skb(e->skb);
863 e->skb = NULL; 848 e->skb = NULL;
864 } 849 }
865 ring->to_clean = e; 850 } while ((e = e->next) != ring->start);
866} 851}
867 852
853
868/* Allocate buffers for receive ring 854/* Allocate buffers for receive ring
869 * For receive: to_use is refill location 855 * For receive: to_clean is next received frame.
870 * to_clean is next received frame.
871 *
872 * if (to_use == to_clean)
873 * then ring all frames in ring need buffers
874 * if (to_use->next == to_clean)
875 * then ring all frames in ring have buffers
876 */ 856 */
877static int skge_rx_fill(struct skge_port *skge) 857static int skge_rx_fill(struct skge_port *skge)
878{ 858{
879 struct skge_ring *ring = &skge->rx_ring; 859 struct skge_ring *ring = &skge->rx_ring;
880 struct skge_element *e; 860 struct skge_element *e;
881 int ret = 0; 861 unsigned int bufsize = skge->rx_buf_size;
882 862
883 for (e = ring->to_use; e->next != ring->to_clean; e = e->next) { 863 e = ring->start;
884 if (skge_rx_alloc(skge, e)) { 864 do {
885 ret = 1; 865 struct sk_buff *skb = skge_rx_alloc(skge->netdev, bufsize);
886 break;
887 }
888 866
889 } 867 if (!skb)
890 ring->to_use = e; 868 return -ENOMEM;
869
870 skge_rx_setup(skge, e, skb, bufsize);
871 } while ( (e = e->next) != ring->start);
891 872
892 return ret; 873 ring->to_clean = ring->start;
874 return 0;
893} 875}
894 876
895static void skge_link_up(struct skge_port *skge) 877static void skge_link_up(struct skge_port *skge)
@@ -919,50 +901,50 @@ static void skge_link_down(struct skge_port *skge)
919 printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); 901 printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name);
920} 902}
921 903
922static u16 skge_xm_phy_read(struct skge_hw *hw, int port, u16 reg) 904static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg)
923{ 905{
924 int i; 906 int i;
925 u16 v; 907 u16 v;
926 908
927 skge_xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); 909 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr);
928 v = skge_xm_read16(hw, port, XM_PHY_DATA); 910 v = xm_read16(hw, port, XM_PHY_DATA);
929 if (hw->phy_type != SK_PHY_XMAC) {
930 for (i = 0; i < PHY_RETRIES; i++) {
931 udelay(1);
932 if (skge_xm_read16(hw, port, XM_MMU_CMD)
933 & XM_MMU_PHY_RDY)
934 goto ready;
935 }
936 911
937 printk(KERN_WARNING PFX "%s: phy read timed out\n", 912 /* Need to wait for external PHY */
938 hw->dev[port]->name); 913 for (i = 0; i < PHY_RETRIES; i++) {
939 return 0; 914 udelay(1);
940 ready: 915 if (xm_read16(hw, port, XM_MMU_CMD)
941 v = skge_xm_read16(hw, port, XM_PHY_DATA); 916 & XM_MMU_PHY_RDY)
917 goto ready;
942 } 918 }
943 919
920 printk(KERN_WARNING PFX "%s: phy read timed out\n",
921 hw->dev[port]->name);
922 return 0;
923 ready:
924 v = xm_read16(hw, port, XM_PHY_DATA);
925
944 return v; 926 return v;
945} 927}
946 928
947static void skge_xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) 929static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
948{ 930{
949 int i; 931 int i;
950 932
951 skge_xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); 933 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr);
952 for (i = 0; i < PHY_RETRIES; i++) { 934 for (i = 0; i < PHY_RETRIES; i++) {
953 if (!(skge_xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) 935 if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY))
954 goto ready; 936 goto ready;
955 cpu_relax(); 937 udelay(1);
956 } 938 }
957 printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", 939 printk(KERN_WARNING PFX "%s: phy write failed to come ready\n",
958 hw->dev[port]->name); 940 hw->dev[port]->name);
959 941
960 942
961 ready: 943 ready:
962 skge_xm_write16(hw, port, XM_PHY_DATA, val); 944 xm_write16(hw, port, XM_PHY_DATA, val);
963 for (i = 0; i < PHY_RETRIES; i++) { 945 for (i = 0; i < PHY_RETRIES; i++) {
964 udelay(1); 946 udelay(1);
965 if (!(skge_xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) 947 if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY))
966 return; 948 return;
967 } 949 }
968 printk(KERN_WARNING PFX "%s: phy write timed out\n", 950 printk(KERN_WARNING PFX "%s: phy write timed out\n",
@@ -999,34 +981,112 @@ static void genesis_init(struct skge_hw *hw)
999 981
1000static void genesis_reset(struct skge_hw *hw, int port) 982static void genesis_reset(struct skge_hw *hw, int port)
1001{ 983{
1002 int i; 984 const u8 zero[8] = { 0 };
1003 u64 zero = 0;
1004 985
1005 /* reset the statistics module */ 986 /* reset the statistics module */
1006 skge_xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT); 987 xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT);
1007 skge_xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */ 988 xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */
1008 skge_xm_write32(hw, port, XM_MODE, 0); /* clear Mode Reg */ 989 xm_write32(hw, port, XM_MODE, 0); /* clear Mode Reg */
1009 skge_xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */ 990 xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */
1010 skge_xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */ 991 xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */
1011 992
1012 /* disable all PHY IRQs */ 993 /* disable Broadcom PHY IRQ */
1013 if (hw->phy_type == SK_PHY_BCOM) 994 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
1014 skge_xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
1015 995
1016 skge_xm_outhash(hw, port, XM_HSM, (u8 *) &zero); 996 xm_outhash(hw, port, XM_HSM, zero);
1017 for (i = 0; i < 15; i++)
1018 skge_xm_outaddr(hw, port, XM_EXM(i), (u8 *) &zero);
1019 skge_xm_outhash(hw, port, XM_SRC_CHK, (u8 *) &zero);
1020} 997}
1021 998
1022 999
1023static void genesis_mac_init(struct skge_hw *hw, int port) 1000/* Convert mode to MII values */
1001static const u16 phy_pause_map[] = {
1002 [FLOW_MODE_NONE] = 0,
1003 [FLOW_MODE_LOC_SEND] = PHY_AN_PAUSE_ASYM,
1004 [FLOW_MODE_SYMMETRIC] = PHY_AN_PAUSE_CAP,
1005 [FLOW_MODE_REM_SEND] = PHY_AN_PAUSE_CAP | PHY_AN_PAUSE_ASYM,
1006};
1007
1008
1009/* Check status of Broadcom phy link */
1010static void bcom_check_link(struct skge_hw *hw, int port)
1024{ 1011{
1025 struct skge_port *skge = netdev_priv(hw->dev[port]); 1012 struct net_device *dev = hw->dev[port];
1013 struct skge_port *skge = netdev_priv(dev);
1014 u16 status;
1015
1016 /* read twice because of latch */
1017 (void) xm_phy_read(hw, port, PHY_BCOM_STAT);
1018 status = xm_phy_read(hw, port, PHY_BCOM_STAT);
1019
1020 pr_debug("bcom_check_link status=0x%x\n", status);
1021
1022 if ((status & PHY_ST_LSYNC) == 0) {
1023 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1024 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1025 xm_write16(hw, port, XM_MMU_CMD, cmd);
1026 /* dummy read to ensure writing */
1027 (void) xm_read16(hw, port, XM_MMU_CMD);
1028
1029 if (netif_carrier_ok(dev))
1030 skge_link_down(skge);
1031 } else {
1032 if (skge->autoneg == AUTONEG_ENABLE &&
1033 (status & PHY_ST_AN_OVER)) {
1034 u16 lpa = xm_phy_read(hw, port, PHY_BCOM_AUNE_LP);
1035 u16 aux = xm_phy_read(hw, port, PHY_BCOM_AUX_STAT);
1036
1037 if (lpa & PHY_B_AN_RF) {
1038 printk(KERN_NOTICE PFX "%s: remote fault\n",
1039 dev->name);
1040 return;
1041 }
1042
1043 /* Check Duplex mismatch */
1044 switch (aux & PHY_B_AS_AN_RES_MSK) {
1045 case PHY_B_RES_1000FD:
1046 skge->duplex = DUPLEX_FULL;
1047 break;
1048 case PHY_B_RES_1000HD:
1049 skge->duplex = DUPLEX_HALF;
1050 break;
1051 default:
1052 printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
1053 dev->name);
1054 return;
1055 }
1056
1057
1058 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
1059 switch (aux & PHY_B_AS_PAUSE_MSK) {
1060 case PHY_B_AS_PAUSE_MSK:
1061 skge->flow_control = FLOW_MODE_SYMMETRIC;
1062 break;
1063 case PHY_B_AS_PRR:
1064 skge->flow_control = FLOW_MODE_REM_SEND;
1065 break;
1066 case PHY_B_AS_PRT:
1067 skge->flow_control = FLOW_MODE_LOC_SEND;
1068 break;
1069 default:
1070 skge->flow_control = FLOW_MODE_NONE;
1071 }
1072
1073 skge->speed = SPEED_1000;
1074 }
1075
1076 if (!netif_carrier_ok(dev))
1077 genesis_link_up(skge);
1078 }
1079}
1080
1081/* Broadcom 5400 only supports giagabit! SysKonnect did not put an additional
1082 * Phy on for 100 or 10Mbit operation
1083 */
1084static void bcom_phy_init(struct skge_port *skge, int jumbo)
1085{
1086 struct skge_hw *hw = skge->hw;
1087 int port = skge->port;
1026 int i; 1088 int i;
1027 u32 r; 1089 u16 id1, r, ext, ctl;
1028 u16 id1;
1029 u16 ctrl1, ctrl2, ctrl3, ctrl4, ctrl5;
1030 1090
1031 /* magic workaround patterns for Broadcom */ 1091 /* magic workaround patterns for Broadcom */
1032 static const struct { 1092 static const struct {
@@ -1042,84 +1102,168 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1042 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 }, 1102 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 },
1043 }; 1103 };
1044 1104
1105 pr_debug("bcom_phy_init\n");
1045 1106
1046 /* initialize Rx, Tx and Link LED */ 1107 /* read Id from external PHY (all have the same address) */
1047 skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_ON); 1108 id1 = xm_phy_read(hw, port, PHY_XMAC_ID1);
1048 skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON);
1049 1109
1050 skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_START); 1110 /* Optimize MDIO transfer by suppressing preamble. */
1051 skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_START); 1111 r = xm_read16(hw, port, XM_MMU_CMD);
1112 r |= XM_MMU_NO_PRE;
1113 xm_write16(hw, port, XM_MMU_CMD,r);
1114
1115 switch (id1) {
1116 case PHY_BCOM_ID1_C0:
1117 /*
1118 * Workaround BCOM Errata for the C0 type.
1119 * Write magic patterns to reserved registers.
1120 */
1121 for (i = 0; i < ARRAY_SIZE(C0hack); i++)
1122 xm_phy_write(hw, port,
1123 C0hack[i].reg, C0hack[i].val);
1124
1125 break;
1126 case PHY_BCOM_ID1_A1:
1127 /*
1128 * Workaround BCOM Errata for the A1 type.
1129 * Write magic patterns to reserved registers.
1130 */
1131 for (i = 0; i < ARRAY_SIZE(A1hack); i++)
1132 xm_phy_write(hw, port,
1133 A1hack[i].reg, A1hack[i].val);
1134 break;
1135 }
1136
1137 /*
1138 * Workaround BCOM Errata (#10523) for all BCom PHYs.
1139 * Disable Power Management after reset.
1140 */
1141 r = xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL);
1142 r |= PHY_B_AC_DIS_PM;
1143 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, r);
1144
1145 /* Dummy read */
1146 xm_read16(hw, port, XM_ISRC);
1147
1148 ext = PHY_B_PEC_EN_LTR; /* enable tx led */
1149 ctl = PHY_CT_SP1000; /* always 1000mbit */
1150
1151 if (skge->autoneg == AUTONEG_ENABLE) {
1152 /*
1153 * Workaround BCOM Errata #1 for the C5 type.
1154 * 1000Base-T Link Acquisition Failure in Slave Mode
1155 * Set Repeater/DTE bit 10 of the 1000Base-T Control Register
1156 */
1157 u16 adv = PHY_B_1000C_RD;
1158 if (skge->advertising & ADVERTISED_1000baseT_Half)
1159 adv |= PHY_B_1000C_AHD;
1160 if (skge->advertising & ADVERTISED_1000baseT_Full)
1161 adv |= PHY_B_1000C_AFD;
1162 xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, adv);
1163
1164 ctl |= PHY_CT_ANE | PHY_CT_RE_CFG;
1165 } else {
1166 if (skge->duplex == DUPLEX_FULL)
1167 ctl |= PHY_CT_DUP_MD;
1168 /* Force to slave */
1169 xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, PHY_B_1000C_MSE);
1170 }
1171
1172 /* Set autonegotiation pause parameters */
1173 xm_phy_write(hw, port, PHY_BCOM_AUNE_ADV,
1174 phy_pause_map[skge->flow_control] | PHY_AN_CSMA);
1175
1176 /* Handle Jumbo frames */
1177 if (jumbo) {
1178 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL,
1179 PHY_B_AC_TX_TST | PHY_B_AC_LONG_PACK);
1180
1181 ext |= PHY_B_PEC_HIGH_LA;
1182
1183 }
1184
1185 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext);
1186 xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl);
1187
1188 /* Use link status change interrrupt */
1189 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK);
1190
1191 bcom_check_link(hw, port);
1192}
1193
1194static void genesis_mac_init(struct skge_hw *hw, int port)
1195{
1196 struct net_device *dev = hw->dev[port];
1197 struct skge_port *skge = netdev_priv(dev);
1198 int jumbo = hw->dev[port]->mtu > ETH_DATA_LEN;
1199 int i;
1200 u32 r;
1201 const u8 zero[6] = { 0 };
1202
1203 /* Clear MIB counters */
1204 xm_write16(hw, port, XM_STAT_CMD,
1205 XM_SC_CLR_RXC | XM_SC_CLR_TXC);
1206 /* Clear two times according to Errata #3 */
1207 xm_write16(hw, port, XM_STAT_CMD,
1208 XM_SC_CLR_RXC | XM_SC_CLR_TXC);
1052 1209
1053 /* Unreset the XMAC. */ 1210 /* Unreset the XMAC. */
1054 skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); 1211 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
1055 1212
1056 /* 1213 /*
1057 * Perform additional initialization for external PHYs, 1214 * Perform additional initialization for external PHYs,
1058 * namely for the 1000baseTX cards that use the XMAC's 1215 * namely for the 1000baseTX cards that use the XMAC's
1059 * GMII mode. 1216 * GMII mode.
1060 */ 1217 */
1061 spin_lock_bh(&hw->phy_lock); 1218 /* Take external Phy out of reset */
1062 if (hw->phy_type != SK_PHY_XMAC) { 1219 r = skge_read32(hw, B2_GP_IO);
1063 /* Take PHY out of reset. */ 1220 if (port == 0)
1064 r = skge_read32(hw, B2_GP_IO); 1221 r |= GP_DIR_0|GP_IO_0;
1065 if (port == 0) 1222 else
1066 r |= GP_DIR_0|GP_IO_0; 1223 r |= GP_DIR_2|GP_IO_2;
1067 else
1068 r |= GP_DIR_2|GP_IO_2;
1069
1070 skge_write32(hw, B2_GP_IO, r);
1071 skge_read32(hw, B2_GP_IO);
1072
1073 /* Enable GMII mode on the XMAC. */
1074 skge_xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD);
1075
1076 id1 = skge_xm_phy_read(hw, port, PHY_XMAC_ID1);
1077
1078 /* Optimize MDIO transfer by suppressing preamble. */
1079 skge_xm_write16(hw, port, XM_MMU_CMD,
1080 skge_xm_read16(hw, port, XM_MMU_CMD)
1081 | XM_MMU_NO_PRE);
1082
1083 if (id1 == PHY_BCOM_ID1_C0) {
1084 /*
1085 * Workaround BCOM Errata for the C0 type.
1086 * Write magic patterns to reserved registers.
1087 */
1088 for (i = 0; i < ARRAY_SIZE(C0hack); i++)
1089 skge_xm_phy_write(hw, port,
1090 C0hack[i].reg, C0hack[i].val);
1091
1092 } else if (id1 == PHY_BCOM_ID1_A1) {
1093 /*
1094 * Workaround BCOM Errata for the A1 type.
1095 * Write magic patterns to reserved registers.
1096 */
1097 for (i = 0; i < ARRAY_SIZE(A1hack); i++)
1098 skge_xm_phy_write(hw, port,
1099 A1hack[i].reg, A1hack[i].val);
1100 }
1101 1224
1102 /* 1225 skge_write32(hw, B2_GP_IO, r);
1103 * Workaround BCOM Errata (#10523) for all BCom PHYs. 1226 skge_read32(hw, B2_GP_IO);
1104 * Disable Power Management after reset.
1105 */
1106 r = skge_xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL);
1107 skge_xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, r | PHY_B_AC_DIS_PM);
1108 }
1109 1227
1110 /* Dummy read */ 1228 /* Enable GMII interfac */
1111 skge_xm_read16(hw, port, XM_ISRC); 1229 xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD);
1230
1231 bcom_phy_init(skge, jumbo);
1232
1233 /* Set Station Address */
1234 xm_outaddr(hw, port, XM_SA, dev->dev_addr);
1112 1235
1113 r = skge_xm_read32(hw, port, XM_MODE); 1236 /* We don't use match addresses so clear */
1114 skge_xm_write32(hw, port, XM_MODE, r|XM_MD_CSA); 1237 for (i = 1; i < 16; i++)
1238 xm_outaddr(hw, port, XM_EXM(i), zero);
1239
1240 /* configure Rx High Water Mark (XM_RX_HI_WM) */
1241 xm_write16(hw, port, XM_RX_HI_WM, 1450);
1115 1242
1116 /* We don't need the FCS appended to the packet. */ 1243 /* We don't need the FCS appended to the packet. */
1117 r = skge_xm_read16(hw, port, XM_RX_CMD); 1244 r = XM_RX_LENERR_OK | XM_RX_STRIP_FCS;
1118 skge_xm_write16(hw, port, XM_RX_CMD, r | XM_RX_STRIP_FCS); 1245 if (jumbo)
1246 r |= XM_RX_BIG_PK_OK;
1247
1248 if (skge->duplex == DUPLEX_HALF) {
1249 /*
1250 * If in manual half duplex mode the other side might be in
1251 * full duplex mode, so ignore if a carrier extension is not seen
1252 * on frames received
1253 */
1254 r |= XM_RX_DIS_CEXT;
1255 }
1256 xm_write16(hw, port, XM_RX_CMD, r);
1257
1119 1258
1120 /* We want short frames padded to 60 bytes. */ 1259 /* We want short frames padded to 60 bytes. */
1121 r = skge_xm_read16(hw, port, XM_TX_CMD); 1260 xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD);
1122 skge_xm_write16(hw, port, XM_TX_CMD, r | XM_TX_AUTO_PAD); 1261
1262 /*
1263 * Bump up the transmit threshold. This helps hold off transmit
1264 * underruns when we're blasting traffic from both ports at once.
1265 */
1266 xm_write16(hw, port, XM_TX_THR, 512);
1123 1267
1124 /* 1268 /*
1125 * Enable the reception of all error frames. This is is 1269 * Enable the reception of all error frames. This is is
@@ -1135,19 +1279,22 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1135 * case the XMAC will start transfering frames out of the 1279 * case the XMAC will start transfering frames out of the
1136 * RX FIFO as soon as the FIFO threshold is reached. 1280 * RX FIFO as soon as the FIFO threshold is reached.
1137 */ 1281 */
1138 r = skge_xm_read32(hw, port, XM_MODE); 1282 xm_write32(hw, port, XM_MODE, XM_DEF_MODE);
1139 skge_xm_write32(hw, port, XM_MODE,
1140 XM_MD_RX_CRCE|XM_MD_RX_LONG|XM_MD_RX_RUNT|
1141 XM_MD_RX_ERR|XM_MD_RX_IRLE);
1142 1283
1143 skge_xm_outaddr(hw, port, XM_SA, hw->dev[port]->dev_addr);
1144 skge_xm_outaddr(hw, port, XM_EXM(0), hw->dev[port]->dev_addr);
1145 1284
1146 /* 1285 /*
1147 * Bump up the transmit threshold. This helps hold off transmit 1286 * Initialize the Receive Counter Event Mask (XM_RX_EV_MSK)
1148 * underruns when we're blasting traffic from both ports at once. 1287 * - Enable all bits excepting 'Octets Rx OK Low CntOv'
1288 * and 'Octets Rx OK Hi Cnt Ov'.
1149 */ 1289 */
1150 skge_xm_write16(hw, port, XM_TX_THR, 512); 1290 xm_write32(hw, port, XM_RX_EV_MSK, XMR_DEF_MSK);
1291
1292 /*
1293 * Initialize the Transmit Counter Event Mask (XM_TX_EV_MSK)
1294 * - Enable all bits excepting 'Octets Tx OK Low CntOv'
1295 * and 'Octets Tx OK Hi Cnt Ov'.
1296 */
1297 xm_write32(hw, port, XM_TX_EV_MSK, XMT_DEF_MSK);
1151 1298
1152 /* Configure MAC arbiter */ 1299 /* Configure MAC arbiter */
1153 skge_write16(hw, B3_MA_TO_CTRL, MA_RST_CLR); 1300 skge_write16(hw, B3_MA_TO_CTRL, MA_RST_CLR);
@@ -1164,137 +1311,30 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1164 skge_write8(hw, B3_MA_RCINI_TX2, 0); 1311 skge_write8(hw, B3_MA_RCINI_TX2, 0);
1165 1312
1166 /* Configure Rx MAC FIFO */ 1313 /* Configure Rx MAC FIFO */
1167 skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_RST_CLR); 1314 skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_CLR);
1168 skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_ENA_TIM_PAT); 1315 skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_ENA_TIM_PAT);
1169 skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_ENA_OP_MD); 1316 skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_ENA_OP_MD);
1170 1317
1171 /* Configure Tx MAC FIFO */ 1318 /* Configure Tx MAC FIFO */
1172 skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_RST_CLR); 1319 skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_CLR);
1173 skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF); 1320 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF);
1174 skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_ENA_OP_MD); 1321 skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_ENA_OP_MD);
1175 1322
1176 if (hw->dev[port]->mtu > ETH_DATA_LEN) { 1323 if (jumbo) {
1177 /* Enable frame flushing if jumbo frames used */ 1324 /* Enable frame flushing if jumbo frames used */
1178 skge_write16(hw, SKGEMAC_REG(port,RX_MFF_CTRL1), MFF_ENA_FLUSH); 1325 skge_write16(hw, SK_REG(port,RX_MFF_CTRL1), MFF_ENA_FLUSH);
1179 } else { 1326 } else {
1180 /* enable timeout timers if normal frames */ 1327 /* enable timeout timers if normal frames */
1181 skge_write16(hw, B3_PA_CTRL, 1328 skge_write16(hw, B3_PA_CTRL,
1182 port == 0 ? PA_ENA_TO_TX1 : PA_ENA_TO_TX2); 1329 (port == 0) ? PA_ENA_TO_TX1 : PA_ENA_TO_TX2);
1183 }
1184
1185
1186 r = skge_xm_read16(hw, port, XM_RX_CMD);
1187 if (hw->dev[port]->mtu > ETH_DATA_LEN)
1188 skge_xm_write16(hw, port, XM_RX_CMD, r | XM_RX_BIG_PK_OK);
1189 else
1190 skge_xm_write16(hw, port, XM_RX_CMD, r & ~(XM_RX_BIG_PK_OK));
1191
1192 switch (hw->phy_type) {
1193 case SK_PHY_XMAC:
1194 if (skge->autoneg == AUTONEG_ENABLE) {
1195 ctrl1 = PHY_X_AN_FD | PHY_X_AN_HD;
1196
1197 switch (skge->flow_control) {
1198 case FLOW_MODE_NONE:
1199 ctrl1 |= PHY_X_P_NO_PAUSE;
1200 break;
1201 case FLOW_MODE_LOC_SEND:
1202 ctrl1 |= PHY_X_P_ASYM_MD;
1203 break;
1204 case FLOW_MODE_SYMMETRIC:
1205 ctrl1 |= PHY_X_P_SYM_MD;
1206 break;
1207 case FLOW_MODE_REM_SEND:
1208 ctrl1 |= PHY_X_P_BOTH_MD;
1209 break;
1210 }
1211
1212 skge_xm_phy_write(hw, port, PHY_XMAC_AUNE_ADV, ctrl1);
1213 ctrl2 = PHY_CT_ANE | PHY_CT_RE_CFG;
1214 } else {
1215 ctrl2 = 0;
1216 if (skge->duplex == DUPLEX_FULL)
1217 ctrl2 |= PHY_CT_DUP_MD;
1218 }
1219
1220 skge_xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl2);
1221 break;
1222
1223 case SK_PHY_BCOM:
1224 ctrl1 = PHY_CT_SP1000;
1225 ctrl2 = 0;
1226 ctrl3 = PHY_SEL_TYPE;
1227 ctrl4 = PHY_B_PEC_EN_LTR;
1228 ctrl5 = PHY_B_AC_TX_TST;
1229
1230 if (skge->autoneg == AUTONEG_ENABLE) {
1231 /*
1232 * Workaround BCOM Errata #1 for the C5 type.
1233 * 1000Base-T Link Acquisition Failure in Slave Mode
1234 * Set Repeater/DTE bit 10 of the 1000Base-T Control Register
1235 */
1236 ctrl2 |= PHY_B_1000C_RD;
1237 if (skge->advertising & ADVERTISED_1000baseT_Half)
1238 ctrl2 |= PHY_B_1000C_AHD;
1239 if (skge->advertising & ADVERTISED_1000baseT_Full)
1240 ctrl2 |= PHY_B_1000C_AFD;
1241
1242 /* Set Flow-control capabilities */
1243 switch (skge->flow_control) {
1244 case FLOW_MODE_NONE:
1245 ctrl3 |= PHY_B_P_NO_PAUSE;
1246 break;
1247 case FLOW_MODE_LOC_SEND:
1248 ctrl3 |= PHY_B_P_ASYM_MD;
1249 break;
1250 case FLOW_MODE_SYMMETRIC:
1251 ctrl3 |= PHY_B_P_SYM_MD;
1252 break;
1253 case FLOW_MODE_REM_SEND:
1254 ctrl3 |= PHY_B_P_BOTH_MD;
1255 break;
1256 }
1257
1258 /* Restart Auto-negotiation */
1259 ctrl1 |= PHY_CT_ANE | PHY_CT_RE_CFG;
1260 } else {
1261 if (skge->duplex == DUPLEX_FULL)
1262 ctrl1 |= PHY_CT_DUP_MD;
1263
1264 ctrl2 |= PHY_B_1000C_MSE; /* set it to Slave */
1265 }
1266
1267 skge_xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, ctrl2);
1268 skge_xm_phy_write(hw, port, PHY_BCOM_AUNE_ADV, ctrl3);
1269
1270 if (skge->netdev->mtu > ETH_DATA_LEN) {
1271 ctrl4 |= PHY_B_PEC_HIGH_LA;
1272 ctrl5 |= PHY_B_AC_LONG_PACK;
1273
1274 skge_xm_phy_write(hw, port,PHY_BCOM_AUX_CTRL, ctrl5);
1275 }
1276
1277 skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ctrl4);
1278 skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, ctrl1);
1279 break;
1280 } 1330 }
1281 spin_unlock_bh(&hw->phy_lock);
1282
1283 /* Clear MIB counters */
1284 skge_xm_write16(hw, port, XM_STAT_CMD,
1285 XM_SC_CLR_RXC | XM_SC_CLR_TXC);
1286 /* Clear two times according to Errata #3 */
1287 skge_xm_write16(hw, port, XM_STAT_CMD,
1288 XM_SC_CLR_RXC | XM_SC_CLR_TXC);
1289
1290 /* Start polling for link status */
1291 mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ);
1292} 1331}
1293 1332
1294static void genesis_stop(struct skge_port *skge) 1333static void genesis_stop(struct skge_port *skge)
1295{ 1334{
1296 struct skge_hw *hw = skge->hw; 1335 struct skge_hw *hw = skge->hw;
1297 int port = skge->port; 1336 int port = skge->port;
1337 u32 reg;
1298 1338
1299 /* Clear Tx packet arbiter timeout IRQ */ 1339 /* Clear Tx packet arbiter timeout IRQ */
1300 skge_write16(hw, B3_PA_CTRL, 1340 skge_write16(hw, B3_PA_CTRL,
@@ -1304,33 +1344,30 @@ static void genesis_stop(struct skge_port *skge)
1304 * If the transfer stucks at the MAC the STOP command will not 1344 * If the transfer stucks at the MAC the STOP command will not
1305 * terminate if we don't flush the XMAC's transmit FIFO ! 1345 * terminate if we don't flush the XMAC's transmit FIFO !
1306 */ 1346 */
1307 skge_xm_write32(hw, port, XM_MODE, 1347 xm_write32(hw, port, XM_MODE,
1308 skge_xm_read32(hw, port, XM_MODE)|XM_MD_FTF); 1348 xm_read32(hw, port, XM_MODE)|XM_MD_FTF);
1309 1349
1310 1350
1311 /* Reset the MAC */ 1351 /* Reset the MAC */
1312 skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); 1352 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
1313 1353
1314 /* For external PHYs there must be special handling */ 1354 /* For external PHYs there must be special handling */
1315 if (hw->phy_type != SK_PHY_XMAC) { 1355 reg = skge_read32(hw, B2_GP_IO);
1316 u32 reg = skge_read32(hw, B2_GP_IO); 1356 if (port == 0) {
1317 1357 reg |= GP_DIR_0;
1318 if (port == 0) { 1358 reg &= ~GP_IO_0;
1319 reg |= GP_DIR_0; 1359 } else {
1320 reg &= ~GP_IO_0; 1360 reg |= GP_DIR_2;
1321 } else { 1361 reg &= ~GP_IO_2;
1322 reg |= GP_DIR_2;
1323 reg &= ~GP_IO_2;
1324 }
1325 skge_write32(hw, B2_GP_IO, reg);
1326 skge_read32(hw, B2_GP_IO);
1327 } 1362 }
1363 skge_write32(hw, B2_GP_IO, reg);
1364 skge_read32(hw, B2_GP_IO);
1328 1365
1329 skge_xm_write16(hw, port, XM_MMU_CMD, 1366 xm_write16(hw, port, XM_MMU_CMD,
1330 skge_xm_read16(hw, port, XM_MMU_CMD) 1367 xm_read16(hw, port, XM_MMU_CMD)
1331 & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); 1368 & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX));
1332 1369
1333 skge_xm_read16(hw, port, XM_MMU_CMD); 1370 xm_read16(hw, port, XM_MMU_CMD);
1334} 1371}
1335 1372
1336 1373
@@ -1341,11 +1378,11 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data)
1341 int i; 1378 int i;
1342 unsigned long timeout = jiffies + HZ; 1379 unsigned long timeout = jiffies + HZ;
1343 1380
1344 skge_xm_write16(hw, port, 1381 xm_write16(hw, port,
1345 XM_STAT_CMD, XM_SC_SNP_TXC | XM_SC_SNP_RXC); 1382 XM_STAT_CMD, XM_SC_SNP_TXC | XM_SC_SNP_RXC);
1346 1383
1347 /* wait for update to complete */ 1384 /* wait for update to complete */
1348 while (skge_xm_read16(hw, port, XM_STAT_CMD) 1385 while (xm_read16(hw, port, XM_STAT_CMD)
1349 & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) { 1386 & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) {
1350 if (time_after(jiffies, timeout)) 1387 if (time_after(jiffies, timeout))
1351 break; 1388 break;
@@ -1353,68 +1390,60 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data)
1353 } 1390 }
1354 1391
1355 /* special case for 64 bit octet counter */ 1392 /* special case for 64 bit octet counter */
1356 data[0] = (u64) skge_xm_read32(hw, port, XM_TXO_OK_HI) << 32 1393 data[0] = (u64) xm_read32(hw, port, XM_TXO_OK_HI) << 32
1357 | skge_xm_read32(hw, port, XM_TXO_OK_LO); 1394 | xm_read32(hw, port, XM_TXO_OK_LO);
1358 data[1] = (u64) skge_xm_read32(hw, port, XM_RXO_OK_HI) << 32 1395 data[1] = (u64) xm_read32(hw, port, XM_RXO_OK_HI) << 32
1359 | skge_xm_read32(hw, port, XM_RXO_OK_LO); 1396 | xm_read32(hw, port, XM_RXO_OK_LO);
1360 1397
1361 for (i = 2; i < ARRAY_SIZE(skge_stats); i++) 1398 for (i = 2; i < ARRAY_SIZE(skge_stats); i++)
1362 data[i] = skge_xm_read32(hw, port, skge_stats[i].xmac_offset); 1399 data[i] = xm_read32(hw, port, skge_stats[i].xmac_offset);
1363} 1400}
1364 1401
1365static void genesis_mac_intr(struct skge_hw *hw, int port) 1402static void genesis_mac_intr(struct skge_hw *hw, int port)
1366{ 1403{
1367 struct skge_port *skge = netdev_priv(hw->dev[port]); 1404 struct skge_port *skge = netdev_priv(hw->dev[port]);
1368 u16 status = skge_xm_read16(hw, port, XM_ISRC); 1405 u16 status = xm_read16(hw, port, XM_ISRC);
1369 1406
1370 pr_debug("genesis_intr status %x\n", status); 1407 if (netif_msg_intr(skge))
1371 if (hw->phy_type == SK_PHY_XMAC) { 1408 printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n",
1372 /* LInk down, start polling for state change */ 1409 skge->netdev->name, status);
1373 if (status & XM_IS_INP_ASS) {
1374 skge_xm_write16(hw, port, XM_IMSK,
1375 skge_xm_read16(hw, port, XM_IMSK) | XM_IS_INP_ASS);
1376 mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ);
1377 }
1378 else if (status & XM_IS_AND)
1379 mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ);
1380 }
1381 1410
1382 if (status & XM_IS_TXF_UR) { 1411 if (status & XM_IS_TXF_UR) {
1383 skge_xm_write32(hw, port, XM_MODE, XM_MD_FTF); 1412 xm_write32(hw, port, XM_MODE, XM_MD_FTF);
1384 ++skge->net_stats.tx_fifo_errors; 1413 ++skge->net_stats.tx_fifo_errors;
1385 } 1414 }
1386 if (status & XM_IS_RXF_OV) { 1415 if (status & XM_IS_RXF_OV) {
1387 skge_xm_write32(hw, port, XM_MODE, XM_MD_FRF); 1416 xm_write32(hw, port, XM_MODE, XM_MD_FRF);
1388 ++skge->net_stats.rx_fifo_errors; 1417 ++skge->net_stats.rx_fifo_errors;
1389 } 1418 }
1390} 1419}
1391 1420
1392static void skge_gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) 1421static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val)
1393{ 1422{
1394 int i; 1423 int i;
1395 1424
1396 skge_gma_write16(hw, port, GM_SMI_DATA, val); 1425 gma_write16(hw, port, GM_SMI_DATA, val);
1397 skge_gma_write16(hw, port, GM_SMI_CTRL, 1426 gma_write16(hw, port, GM_SMI_CTRL,
1398 GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); 1427 GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg));
1399 for (i = 0; i < PHY_RETRIES; i++) { 1428 for (i = 0; i < PHY_RETRIES; i++) {
1400 udelay(1); 1429 udelay(1);
1401 1430
1402 if (!(skge_gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) 1431 if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY))
1403 break; 1432 break;
1404 } 1433 }
1405} 1434}
1406 1435
1407static u16 skge_gm_phy_read(struct skge_hw *hw, int port, u16 reg) 1436static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg)
1408{ 1437{
1409 int i; 1438 int i;
1410 1439
1411 skge_gma_write16(hw, port, GM_SMI_CTRL, 1440 gma_write16(hw, port, GM_SMI_CTRL,
1412 GM_SMI_CT_PHY_AD(hw->phy_addr) 1441 GM_SMI_CT_PHY_AD(hw->phy_addr)
1413 | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); 1442 | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD);
1414 1443
1415 for (i = 0; i < PHY_RETRIES; i++) { 1444 for (i = 0; i < PHY_RETRIES; i++) {
1416 udelay(1); 1445 udelay(1);
1417 if (skge_gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) 1446 if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL)
1418 goto ready; 1447 goto ready;
1419 } 1448 }
1420 1449
@@ -1422,24 +1451,7 @@ static u16 skge_gm_phy_read(struct skge_hw *hw, int port, u16 reg)
1422 hw->dev[port]->name); 1451 hw->dev[port]->name);
1423 return 0; 1452 return 0;
1424 ready: 1453 ready:
1425 return skge_gma_read16(hw, port, GM_SMI_DATA); 1454 return gma_read16(hw, port, GM_SMI_DATA);
1426}
1427
1428static void genesis_link_down(struct skge_port *skge)
1429{
1430 struct skge_hw *hw = skge->hw;
1431 int port = skge->port;
1432
1433 pr_debug("genesis_link_down\n");
1434
1435 skge_xm_write16(hw, port, XM_MMU_CMD,
1436 skge_xm_read16(hw, port, XM_MMU_CMD)
1437 & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX));
1438
1439 /* dummy read to ensure writing */
1440 (void) skge_xm_read16(hw, port, XM_MMU_CMD);
1441
1442 skge_link_down(skge);
1443} 1455}
1444 1456
1445static void genesis_link_up(struct skge_port *skge) 1457static void genesis_link_up(struct skge_port *skge)
@@ -1450,7 +1462,7 @@ static void genesis_link_up(struct skge_port *skge)
1450 u32 mode, msk; 1462 u32 mode, msk;
1451 1463
1452 pr_debug("genesis_link_up\n"); 1464 pr_debug("genesis_link_up\n");
1453 cmd = skge_xm_read16(hw, port, XM_MMU_CMD); 1465 cmd = xm_read16(hw, port, XM_MMU_CMD);
1454 1466
1455 /* 1467 /*
1456 * enabling pause frame reception is required for 1000BT 1468 * enabling pause frame reception is required for 1000BT
@@ -1458,14 +1470,15 @@ static void genesis_link_up(struct skge_port *skge)
1458 */ 1470 */
1459 if (skge->flow_control == FLOW_MODE_NONE || 1471 if (skge->flow_control == FLOW_MODE_NONE ||
1460 skge->flow_control == FLOW_MODE_LOC_SEND) 1472 skge->flow_control == FLOW_MODE_LOC_SEND)
1473 /* Disable Pause Frame Reception */
1461 cmd |= XM_MMU_IGN_PF; 1474 cmd |= XM_MMU_IGN_PF;
1462 else 1475 else
1463 /* Enable Pause Frame Reception */ 1476 /* Enable Pause Frame Reception */
1464 cmd &= ~XM_MMU_IGN_PF; 1477 cmd &= ~XM_MMU_IGN_PF;
1465 1478
1466 skge_xm_write16(hw, port, XM_MMU_CMD, cmd); 1479 xm_write16(hw, port, XM_MMU_CMD, cmd);
1467 1480
1468 mode = skge_xm_read32(hw, port, XM_MODE); 1481 mode = xm_read32(hw, port, XM_MODE);
1469 if (skge->flow_control == FLOW_MODE_SYMMETRIC || 1482 if (skge->flow_control == FLOW_MODE_SYMMETRIC ||
1470 skge->flow_control == FLOW_MODE_LOC_SEND) { 1483 skge->flow_control == FLOW_MODE_LOC_SEND) {
1471 /* 1484 /*
@@ -1479,10 +1492,10 @@ static void genesis_link_up(struct skge_port *skge)
1479 /* XM_PAUSE_DA = '010000C28001' (default) */ 1492 /* XM_PAUSE_DA = '010000C28001' (default) */
1480 /* XM_MAC_PTIME = 0xffff (maximum) */ 1493 /* XM_MAC_PTIME = 0xffff (maximum) */
1481 /* remember this value is defined in big endian (!) */ 1494 /* remember this value is defined in big endian (!) */
1482 skge_xm_write16(hw, port, XM_MAC_PTIME, 0xffff); 1495 xm_write16(hw, port, XM_MAC_PTIME, 0xffff);
1483 1496
1484 mode |= XM_PAUSE_MODE; 1497 mode |= XM_PAUSE_MODE;
1485 skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_ENA_PAUSE); 1498 skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_ENA_PAUSE);
1486 } else { 1499 } else {
1487 /* 1500 /*
1488 * disable pause frame generation is required for 1000BT 1501 * disable pause frame generation is required for 1000BT
@@ -1491,125 +1504,68 @@ static void genesis_link_up(struct skge_port *skge)
1491 /* Disable Pause Mode in Mode Register */ 1504 /* Disable Pause Mode in Mode Register */
1492 mode &= ~XM_PAUSE_MODE; 1505 mode &= ~XM_PAUSE_MODE;
1493 1506
1494 skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_DIS_PAUSE); 1507 skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_DIS_PAUSE);
1495 } 1508 }
1496 1509
1497 skge_xm_write32(hw, port, XM_MODE, mode); 1510 xm_write32(hw, port, XM_MODE, mode);
1498 1511
1499 msk = XM_DEF_MSK; 1512 msk = XM_DEF_MSK;
1500 if (hw->phy_type != SK_PHY_XMAC) 1513 /* disable GP0 interrupt bit for external Phy */
1501 msk |= XM_IS_INP_ASS; /* disable GP0 interrupt bit */ 1514 msk |= XM_IS_INP_ASS;
1502 1515
1503 skge_xm_write16(hw, port, XM_IMSK, msk); 1516 xm_write16(hw, port, XM_IMSK, msk);
1504 skge_xm_read16(hw, port, XM_ISRC); 1517 xm_read16(hw, port, XM_ISRC);
1505 1518
1506 /* get MMU Command Reg. */ 1519 /* get MMU Command Reg. */
1507 cmd = skge_xm_read16(hw, port, XM_MMU_CMD); 1520 cmd = xm_read16(hw, port, XM_MMU_CMD);
1508 if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL) 1521 if (skge->duplex == DUPLEX_FULL)
1509 cmd |= XM_MMU_GMII_FD; 1522 cmd |= XM_MMU_GMII_FD;
1510 1523
1511 if (hw->phy_type == SK_PHY_BCOM) { 1524 /*
1512 /* 1525 * Workaround BCOM Errata (#10523) for all BCom Phys
1513 * Workaround BCOM Errata (#10523) for all BCom Phys 1526 * Enable Power Management after link up
1514 * Enable Power Management after link up 1527 */
1515 */ 1528 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL,
1516 skge_xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, 1529 xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL)
1517 skge_xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL) 1530 & ~PHY_B_AC_DIS_PM);
1518 & ~PHY_B_AC_DIS_PM); 1531 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK);
1519 skge_xm_phy_write(hw, port, PHY_BCOM_INT_MASK,
1520 PHY_B_DEF_MSK);
1521 }
1522 1532
1523 /* enable Rx/Tx */ 1533 /* enable Rx/Tx */
1524 skge_xm_write16(hw, port, XM_MMU_CMD, 1534 xm_write16(hw, port, XM_MMU_CMD,
1525 cmd | XM_MMU_ENA_RX | XM_MMU_ENA_TX); 1535 cmd | XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1526 skge_link_up(skge); 1536 skge_link_up(skge);
1527} 1537}
1528 1538
1529 1539
1530static void genesis_bcom_intr(struct skge_port *skge) 1540static inline void bcom_phy_intr(struct skge_port *skge)
1531{ 1541{
1532 struct skge_hw *hw = skge->hw; 1542 struct skge_hw *hw = skge->hw;
1533 int port = skge->port; 1543 int port = skge->port;
1534 u16 stat = skge_xm_phy_read(hw, port, PHY_BCOM_INT_STAT); 1544 u16 isrc;
1545
1546 isrc = xm_phy_read(hw, port, PHY_BCOM_INT_STAT);
1547 if (netif_msg_intr(skge))
1548 printk(KERN_DEBUG PFX "%s: phy interrupt status 0x%x\n",
1549 skge->netdev->name, isrc);
1535 1550
1536 pr_debug("genesis_bcom intr stat=%x\n", stat); 1551 if (isrc & PHY_B_IS_PSE)
1552 printk(KERN_ERR PFX "%s: uncorrectable pair swap error\n",
1553 hw->dev[port]->name);
1537 1554
1538 /* Workaround BCom Errata: 1555 /* Workaround BCom Errata:
1539 * enable and disable loopback mode if "NO HCD" occurs. 1556 * enable and disable loopback mode if "NO HCD" occurs.
1540 */ 1557 */
1541 if (stat & PHY_B_IS_NO_HDCL) { 1558 if (isrc & PHY_B_IS_NO_HDCL) {
1542 u16 ctrl = skge_xm_phy_read(hw, port, PHY_BCOM_CTRL); 1559 u16 ctrl = xm_phy_read(hw, port, PHY_BCOM_CTRL);
1543 skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, 1560 xm_phy_write(hw, port, PHY_BCOM_CTRL,
1544 ctrl | PHY_CT_LOOP); 1561 ctrl | PHY_CT_LOOP);
1545 skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, 1562 xm_phy_write(hw, port, PHY_BCOM_CTRL,
1546 ctrl & ~PHY_CT_LOOP); 1563 ctrl & ~PHY_CT_LOOP);
1547 } 1564 }
1548 1565
1549 stat = skge_xm_phy_read(hw, port, PHY_BCOM_STAT); 1566 if (isrc & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE))
1550 if (stat & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) { 1567 bcom_check_link(hw, port);
1551 u16 aux = skge_xm_phy_read(hw, port, PHY_BCOM_AUX_STAT);
1552 if ( !(aux & PHY_B_AS_LS) && netif_carrier_ok(skge->netdev))
1553 genesis_link_down(skge);
1554
1555 else if (stat & PHY_B_IS_LST_CHANGE) {
1556 if (aux & PHY_B_AS_AN_C) {
1557 switch (aux & PHY_B_AS_AN_RES_MSK) {
1558 case PHY_B_RES_1000FD:
1559 skge->duplex = DUPLEX_FULL;
1560 break;
1561 case PHY_B_RES_1000HD:
1562 skge->duplex = DUPLEX_HALF;
1563 break;
1564 }
1565
1566 switch (aux & PHY_B_AS_PAUSE_MSK) {
1567 case PHY_B_AS_PAUSE_MSK:
1568 skge->flow_control = FLOW_MODE_SYMMETRIC;
1569 break;
1570 case PHY_B_AS_PRR:
1571 skge->flow_control = FLOW_MODE_REM_SEND;
1572 break;
1573 case PHY_B_AS_PRT:
1574 skge->flow_control = FLOW_MODE_LOC_SEND;
1575 break;
1576 default:
1577 skge->flow_control = FLOW_MODE_NONE;
1578 }
1579 skge->speed = SPEED_1000;
1580 }
1581 genesis_link_up(skge);
1582 }
1583 else
1584 mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ);
1585 }
1586}
1587
1588/* Perodic poll of phy status to check for link transistion */
1589static void skge_link_timer(unsigned long __arg)
1590{
1591 struct skge_port *skge = (struct skge_port *) __arg;
1592 struct skge_hw *hw = skge->hw;
1593 int port = skge->port;
1594
1595 if (hw->chip_id != CHIP_ID_GENESIS || !netif_running(skge->netdev))
1596 return;
1597
1598 spin_lock_bh(&hw->phy_lock);
1599 if (hw->phy_type == SK_PHY_BCOM)
1600 genesis_bcom_intr(skge);
1601 else {
1602 int i;
1603 for (i = 0; i < 3; i++)
1604 if (skge_xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS)
1605 break;
1606 1568
1607 if (i == 3)
1608 mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ);
1609 else
1610 genesis_link_up(skge);
1611 }
1612 spin_unlock_bh(&hw->phy_lock);
1613} 1569}
1614 1570
1615/* Marvell Phy Initailization */ 1571/* Marvell Phy Initailization */
@@ -1617,35 +1573,30 @@ static void yukon_init(struct skge_hw *hw, int port)
1617{ 1573{
1618 struct skge_port *skge = netdev_priv(hw->dev[port]); 1574 struct skge_port *skge = netdev_priv(hw->dev[port]);
1619 u16 ctrl, ct1000, adv; 1575 u16 ctrl, ct1000, adv;
1620 u16 ledctrl, ledover;
1621 1576
1622 pr_debug("yukon_init\n"); 1577 pr_debug("yukon_init\n");
1623 if (skge->autoneg == AUTONEG_ENABLE) { 1578 if (skge->autoneg == AUTONEG_ENABLE) {
1624 u16 ectrl = skge_gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 1579 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
1625 1580
1626 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | 1581 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
1627 PHY_M_EC_MAC_S_MSK); 1582 PHY_M_EC_MAC_S_MSK);
1628 ectrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ); 1583 ectrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ);
1629 1584
1630 /* on PHY 88E1111 there is a change for downshift control */ 1585 ectrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1);
1631 if (hw->chip_id == CHIP_ID_YUKON_EC)
1632 ectrl |= PHY_M_EC_M_DSC_2(0) | PHY_M_EC_DOWN_S_ENA;
1633 else
1634 ectrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1);
1635 1586
1636 skge_gm_phy_write(hw, port, PHY_MARV_EXT_CTRL, ectrl); 1587 gm_phy_write(hw, port, PHY_MARV_EXT_CTRL, ectrl);
1637 } 1588 }
1638 1589
1639 ctrl = skge_gm_phy_read(hw, port, PHY_MARV_CTRL); 1590 ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL);
1640 if (skge->autoneg == AUTONEG_DISABLE) 1591 if (skge->autoneg == AUTONEG_DISABLE)
1641 ctrl &= ~PHY_CT_ANE; 1592 ctrl &= ~PHY_CT_ANE;
1642 1593
1643 ctrl |= PHY_CT_RESET; 1594 ctrl |= PHY_CT_RESET;
1644 skge_gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); 1595 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
1645 1596
1646 ctrl = 0; 1597 ctrl = 0;
1647 ct1000 = 0; 1598 ct1000 = 0;
1648 adv = PHY_SEL_TYPE; 1599 adv = PHY_AN_CSMA;
1649 1600
1650 if (skge->autoneg == AUTONEG_ENABLE) { 1601 if (skge->autoneg == AUTONEG_ENABLE) {
1651 if (iscopper(hw)) { 1602 if (iscopper(hw)) {
@@ -1661,41 +1612,12 @@ static void yukon_init(struct skge_hw *hw, int port)
1661 adv |= PHY_M_AN_10_FD; 1612 adv |= PHY_M_AN_10_FD;
1662 if (skge->advertising & ADVERTISED_10baseT_Half) 1613 if (skge->advertising & ADVERTISED_10baseT_Half)
1663 adv |= PHY_M_AN_10_HD; 1614 adv |= PHY_M_AN_10_HD;
1664 1615 } else /* special defines for FIBER (88E1011S only) */
1665 /* Set Flow-control capabilities */
1666 switch (skge->flow_control) {
1667 case FLOW_MODE_NONE:
1668 adv |= PHY_B_P_NO_PAUSE;
1669 break;
1670 case FLOW_MODE_LOC_SEND:
1671 adv |= PHY_B_P_ASYM_MD;
1672 break;
1673 case FLOW_MODE_SYMMETRIC:
1674 adv |= PHY_B_P_SYM_MD;
1675 break;
1676 case FLOW_MODE_REM_SEND:
1677 adv |= PHY_B_P_BOTH_MD;
1678 break;
1679 }
1680 } else { /* special defines for FIBER (88E1011S only) */
1681 adv |= PHY_M_AN_1000X_AHD | PHY_M_AN_1000X_AFD; 1616 adv |= PHY_M_AN_1000X_AHD | PHY_M_AN_1000X_AFD;
1682 1617
1683 /* Set Flow-control capabilities */ 1618 /* Set Flow-control capabilities */
1684 switch (skge->flow_control) { 1619 adv |= phy_pause_map[skge->flow_control];
1685 case FLOW_MODE_NONE: 1620
1686 adv |= PHY_M_P_NO_PAUSE_X;
1687 break;
1688 case FLOW_MODE_LOC_SEND:
1689 adv |= PHY_M_P_ASYM_MD_X;
1690 break;
1691 case FLOW_MODE_SYMMETRIC:
1692 adv |= PHY_M_P_SYM_MD_X;
1693 break;
1694 case FLOW_MODE_REM_SEND:
1695 adv |= PHY_M_P_BOTH_MD_X;
1696 break;
1697 }
1698 }
1699 /* Restart Auto-negotiation */ 1621 /* Restart Auto-negotiation */
1700 ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG; 1622 ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG;
1701 } else { 1623 } else {
@@ -1717,62 +1639,28 @@ static void yukon_init(struct skge_hw *hw, int port)
1717 ctrl |= PHY_CT_RESET; 1639 ctrl |= PHY_CT_RESET;
1718 } 1640 }
1719 1641
1720 if (hw->chip_id != CHIP_ID_YUKON_FE) 1642 gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);
1721 skge_gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);
1722
1723 skge_gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
1724 skge_gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
1725
1726 /* Setup Phy LED's */
1727 ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS);
1728 ledover = 0;
1729
1730 if (hw->chip_id == CHIP_ID_YUKON_FE) {
1731 /* on 88E3082 these bits are at 11..9 (shifted left) */
1732 ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) << 1;
1733
1734 skge_gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR,
1735 ((skge_gm_phy_read(hw, port, PHY_MARV_FE_LED_PAR)
1736
1737 & ~PHY_M_FELP_LED1_MSK)
1738 | PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_ACT_BL)));
1739 } else {
1740 /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */
1741 ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL;
1742
1743 /* turn off the Rx LED (LED_RX) */
1744 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);
1745 }
1746
1747 /* disable blink mode (LED_DUPLEX) on collisions */
1748 ctrl |= PHY_M_LEDC_DP_CTRL;
1749 skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
1750 1643
1751 if (skge->autoneg == AUTONEG_DISABLE || skge->speed == SPEED_100) { 1644 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
1752 /* turn on 100 Mbps LED (LED_LINK100) */ 1645 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
1753 ledover |= PHY_M_LED_MO_100(MO_LED_ON);
1754 }
1755
1756 if (ledover)
1757 skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover);
1758 1646
1759 /* Enable phy interrupt on autonegotiation complete (or link up) */ 1647 /* Enable phy interrupt on autonegotiation complete (or link up) */
1760 if (skge->autoneg == AUTONEG_ENABLE) 1648 if (skge->autoneg == AUTONEG_ENABLE)
1761 skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); 1649 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_MSK);
1762 else 1650 else
1763 skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 1651 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK);
1764} 1652}
1765 1653
1766static void yukon_reset(struct skge_hw *hw, int port) 1654static void yukon_reset(struct skge_hw *hw, int port)
1767{ 1655{
1768 skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);/* disable PHY IRQs */ 1656 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);/* disable PHY IRQs */
1769 skge_gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ 1657 gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */
1770 skge_gma_write16(hw, port, GM_MC_ADDR_H2, 0); 1658 gma_write16(hw, port, GM_MC_ADDR_H2, 0);
1771 skge_gma_write16(hw, port, GM_MC_ADDR_H3, 0); 1659 gma_write16(hw, port, GM_MC_ADDR_H3, 0);
1772 skge_gma_write16(hw, port, GM_MC_ADDR_H4, 0); 1660 gma_write16(hw, port, GM_MC_ADDR_H4, 0);
1773 1661
1774 skge_gma_write16(hw, port, GM_RX_CTRL, 1662 gma_write16(hw, port, GM_RX_CTRL,
1775 skge_gma_read16(hw, port, GM_RX_CTRL) 1663 gma_read16(hw, port, GM_RX_CTRL)
1776 | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); 1664 | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
1777} 1665}
1778 1666
@@ -1785,17 +1673,17 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1785 1673
1786 /* WA code for COMA mode -- set PHY reset */ 1674 /* WA code for COMA mode -- set PHY reset */
1787 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1675 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1788 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1676 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1789 skge_write32(hw, B2_GP_IO, 1677 skge_write32(hw, B2_GP_IO,
1790 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); 1678 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9));
1791 1679
1792 /* hard reset */ 1680 /* hard reset */
1793 skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), GPC_RST_SET); 1681 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1794 skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_RST_SET); 1682 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET);
1795 1683
1796 /* WA code for COMA mode -- clear PHY reset */ 1684 /* WA code for COMA mode -- clear PHY reset */
1797 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1685 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1798 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1686 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1799 skge_write32(hw, B2_GP_IO, 1687 skge_write32(hw, B2_GP_IO,
1800 (skge_read32(hw, B2_GP_IO) | GP_DIR_9) 1688 (skge_read32(hw, B2_GP_IO) | GP_DIR_9)
1801 & ~GP_IO_9); 1689 & ~GP_IO_9);
@@ -1806,13 +1694,13 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1806 reg |= iscopper(hw) ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB; 1694 reg |= iscopper(hw) ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB;
1807 1695
1808 /* Clear GMC reset */ 1696 /* Clear GMC reset */
1809 skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), reg | GPC_RST_SET); 1697 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET);
1810 skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), reg | GPC_RST_CLR); 1698 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR);
1811 skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR); 1699 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
1812 if (skge->autoneg == AUTONEG_DISABLE) { 1700 if (skge->autoneg == AUTONEG_DISABLE) {
1813 reg = GM_GPCR_AU_ALL_DIS; 1701 reg = GM_GPCR_AU_ALL_DIS;
1814 skge_gma_write16(hw, port, GM_GP_CTRL, 1702 gma_write16(hw, port, GM_GP_CTRL,
1815 skge_gma_read16(hw, port, GM_GP_CTRL) | reg); 1703 gma_read16(hw, port, GM_GP_CTRL) | reg);
1816 1704
1817 switch (skge->speed) { 1705 switch (skge->speed) {
1818 case SPEED_1000: 1706 case SPEED_1000:
@@ -1828,7 +1716,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1828 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; 1716 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL;
1829 switch (skge->flow_control) { 1717 switch (skge->flow_control) {
1830 case FLOW_MODE_NONE: 1718 case FLOW_MODE_NONE:
1831 skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1719 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
1832 reg |= GM_GPCR_FC_TX_DIS | GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; 1720 reg |= GM_GPCR_FC_TX_DIS | GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS;
1833 break; 1721 break;
1834 case FLOW_MODE_LOC_SEND: 1722 case FLOW_MODE_LOC_SEND:
@@ -1836,33 +1724,31 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1836 reg |= GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; 1724 reg |= GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS;
1837 } 1725 }
1838 1726
1839 skge_gma_write16(hw, port, GM_GP_CTRL, reg); 1727 gma_write16(hw, port, GM_GP_CTRL, reg);
1840 skge_read16(hw, GMAC_IRQ_SRC); 1728 skge_read16(hw, GMAC_IRQ_SRC);
1841 1729
1842 spin_lock_bh(&hw->phy_lock);
1843 yukon_init(hw, port); 1730 yukon_init(hw, port);
1844 spin_unlock_bh(&hw->phy_lock);
1845 1731
1846 /* MIB clear */ 1732 /* MIB clear */
1847 reg = skge_gma_read16(hw, port, GM_PHY_ADDR); 1733 reg = gma_read16(hw, port, GM_PHY_ADDR);
1848 skge_gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR); 1734 gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR);
1849 1735
1850 for (i = 0; i < GM_MIB_CNT_SIZE; i++) 1736 for (i = 0; i < GM_MIB_CNT_SIZE; i++)
1851 skge_gma_read16(hw, port, GM_MIB_CNT_BASE + 8*i); 1737 gma_read16(hw, port, GM_MIB_CNT_BASE + 8*i);
1852 skge_gma_write16(hw, port, GM_PHY_ADDR, reg); 1738 gma_write16(hw, port, GM_PHY_ADDR, reg);
1853 1739
1854 /* transmit control */ 1740 /* transmit control */
1855 skge_gma_write16(hw, port, GM_TX_CTRL, TX_COL_THR(TX_COL_DEF)); 1741 gma_write16(hw, port, GM_TX_CTRL, TX_COL_THR(TX_COL_DEF));
1856 1742
1857 /* receive control reg: unicast + multicast + no FCS */ 1743 /* receive control reg: unicast + multicast + no FCS */
1858 skge_gma_write16(hw, port, GM_RX_CTRL, 1744 gma_write16(hw, port, GM_RX_CTRL,
1859 GM_RXCR_UCF_ENA | GM_RXCR_CRC_DIS | GM_RXCR_MCF_ENA); 1745 GM_RXCR_UCF_ENA | GM_RXCR_CRC_DIS | GM_RXCR_MCF_ENA);
1860 1746
1861 /* transmit flow control */ 1747 /* transmit flow control */
1862 skge_gma_write16(hw, port, GM_TX_FLOW_CTRL, 0xffff); 1748 gma_write16(hw, port, GM_TX_FLOW_CTRL, 0xffff);
1863 1749
1864 /* transmit parameter */ 1750 /* transmit parameter */
1865 skge_gma_write16(hw, port, GM_TX_PARAM, 1751 gma_write16(hw, port, GM_TX_PARAM,
1866 TX_JAM_LEN_VAL(TX_JAM_LEN_DEF) | 1752 TX_JAM_LEN_VAL(TX_JAM_LEN_DEF) |
1867 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | 1753 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) |
1868 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); 1754 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF));
@@ -1872,33 +1758,33 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1872 if (hw->dev[port]->mtu > 1500) 1758 if (hw->dev[port]->mtu > 1500)
1873 reg |= GM_SMOD_JUMBO_ENA; 1759 reg |= GM_SMOD_JUMBO_ENA;
1874 1760
1875 skge_gma_write16(hw, port, GM_SERIAL_MODE, reg); 1761 gma_write16(hw, port, GM_SERIAL_MODE, reg);
1876 1762
1877 /* physical address: used for pause frames */ 1763 /* physical address: used for pause frames */
1878 skge_gm_set_addr(hw, port, GM_SRC_ADDR_1L, addr); 1764 gma_set_addr(hw, port, GM_SRC_ADDR_1L, addr);
1879 /* virtual address for data */ 1765 /* virtual address for data */
1880 skge_gm_set_addr(hw, port, GM_SRC_ADDR_2L, addr); 1766 gma_set_addr(hw, port, GM_SRC_ADDR_2L, addr);
1881 1767
1882 /* enable interrupt mask for counter overflows */ 1768 /* enable interrupt mask for counter overflows */
1883 skge_gma_write16(hw, port, GM_TX_IRQ_MSK, 0); 1769 gma_write16(hw, port, GM_TX_IRQ_MSK, 0);
1884 skge_gma_write16(hw, port, GM_RX_IRQ_MSK, 0); 1770 gma_write16(hw, port, GM_RX_IRQ_MSK, 0);
1885 skge_gma_write16(hw, port, GM_TR_IRQ_MSK, 0); 1771 gma_write16(hw, port, GM_TR_IRQ_MSK, 0);
1886 1772
1887 /* Initialize Mac Fifo */ 1773 /* Initialize Mac Fifo */
1888 1774
1889 /* Configure Rx MAC FIFO */ 1775 /* Configure Rx MAC FIFO */
1890 skge_write16(hw, SKGEMAC_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); 1776 skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK);
1891 reg = GMF_OPER_ON | GMF_RX_F_FL_ON; 1777 reg = GMF_OPER_ON | GMF_RX_F_FL_ON;
1892 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1778 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1893 chip_rev(hw) == CHIP_REV_YU_LITE_A3) 1779 hw->chip_rev >= CHIP_REV_YU_LITE_A3)
1894 reg &= ~GMF_RX_F_FL_ON; 1780 reg &= ~GMF_RX_F_FL_ON;
1895 skge_write8(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); 1781 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
1896 skge_write16(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), reg); 1782 skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg);
1897 skge_write16(hw, SKGEMAC_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF); 1783 skge_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF);
1898 1784
1899 /* Configure Tx MAC FIFO */ 1785 /* Configure Tx MAC FIFO */
1900 skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); 1786 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
1901 skge_write16(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); 1787 skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
1902} 1788}
1903 1789
1904static void yukon_stop(struct skge_port *skge) 1790static void yukon_stop(struct skge_port *skge)
@@ -1907,19 +1793,19 @@ static void yukon_stop(struct skge_port *skge)
1907 int port = skge->port; 1793 int port = skge->port;
1908 1794
1909 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1795 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1910 chip_rev(hw) == CHIP_REV_YU_LITE_A3) { 1796 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1911 skge_write32(hw, B2_GP_IO, 1797 skge_write32(hw, B2_GP_IO,
1912 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); 1798 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9);
1913 } 1799 }
1914 1800
1915 skge_gma_write16(hw, port, GM_GP_CTRL, 1801 gma_write16(hw, port, GM_GP_CTRL,
1916 skge_gma_read16(hw, port, GM_GP_CTRL) 1802 gma_read16(hw, port, GM_GP_CTRL)
1917 & ~(GM_GPCR_RX_ENA|GM_GPCR_RX_ENA)); 1803 & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA));
1918 skge_gma_read16(hw, port, GM_GP_CTRL); 1804 gma_read16(hw, port, GM_GP_CTRL);
1919 1805
1920 /* set GPHY Control reset */ 1806 /* set GPHY Control reset */
1921 skge_gma_write32(hw, port, GPHY_CTRL, GPC_RST_SET); 1807 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1922 skge_gma_write32(hw, port, GMAC_CTRL, GMC_RST_SET); 1808 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET);
1923} 1809}
1924 1810
1925static void yukon_get_stats(struct skge_port *skge, u64 *data) 1811static void yukon_get_stats(struct skge_port *skge, u64 *data)
@@ -1928,39 +1814,41 @@ static void yukon_get_stats(struct skge_port *skge, u64 *data)
1928 int port = skge->port; 1814 int port = skge->port;
1929 int i; 1815 int i;
1930 1816
1931 data[0] = (u64) skge_gma_read32(hw, port, GM_TXO_OK_HI) << 32 1817 data[0] = (u64) gma_read32(hw, port, GM_TXO_OK_HI) << 32
1932 | skge_gma_read32(hw, port, GM_TXO_OK_LO); 1818 | gma_read32(hw, port, GM_TXO_OK_LO);
1933 data[1] = (u64) skge_gma_read32(hw, port, GM_RXO_OK_HI) << 32 1819 data[1] = (u64) gma_read32(hw, port, GM_RXO_OK_HI) << 32
1934 | skge_gma_read32(hw, port, GM_RXO_OK_LO); 1820 | gma_read32(hw, port, GM_RXO_OK_LO);
1935 1821
1936 for (i = 2; i < ARRAY_SIZE(skge_stats); i++) 1822 for (i = 2; i < ARRAY_SIZE(skge_stats); i++)
1937 data[i] = skge_gma_read32(hw, port, 1823 data[i] = gma_read32(hw, port,
1938 skge_stats[i].gma_offset); 1824 skge_stats[i].gma_offset);
1939} 1825}
1940 1826
1941static void yukon_mac_intr(struct skge_hw *hw, int port) 1827static void yukon_mac_intr(struct skge_hw *hw, int port)
1942{ 1828{
1943 struct skge_port *skge = netdev_priv(hw->dev[port]); 1829 struct net_device *dev = hw->dev[port];
1944 u8 status = skge_read8(hw, SKGEMAC_REG(port, GMAC_IRQ_SRC)); 1830 struct skge_port *skge = netdev_priv(dev);
1831 u8 status = skge_read8(hw, SK_REG(port, GMAC_IRQ_SRC));
1832
1833 if (netif_msg_intr(skge))
1834 printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n",
1835 dev->name, status);
1945 1836
1946 pr_debug("yukon_intr status %x\n", status);
1947 if (status & GM_IS_RX_FF_OR) { 1837 if (status & GM_IS_RX_FF_OR) {
1948 ++skge->net_stats.rx_fifo_errors; 1838 ++skge->net_stats.rx_fifo_errors;
1949 skge_gma_write8(hw, port, RX_GMF_CTRL_T, GMF_CLI_RX_FO); 1839 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO);
1950 } 1840 }
1841
1951 if (status & GM_IS_TX_FF_UR) { 1842 if (status & GM_IS_TX_FF_UR) {
1952 ++skge->net_stats.tx_fifo_errors; 1843 ++skge->net_stats.tx_fifo_errors;
1953 skge_gma_write8(hw, port, TX_GMF_CTRL_T, GMF_CLI_TX_FU); 1844 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU);
1954 } 1845 }
1955 1846
1956} 1847}
1957 1848
1958static u16 yukon_speed(const struct skge_hw *hw, u16 aux) 1849static u16 yukon_speed(const struct skge_hw *hw, u16 aux)
1959{ 1850{
1960 if (hw->chip_id == CHIP_ID_YUKON_FE) 1851 switch (aux & PHY_M_PS_SPEED_MSK) {
1961 return (aux & PHY_M_PS_SPEED_100) ? SPEED_100 : SPEED_10;
1962
1963 switch(aux & PHY_M_PS_SPEED_MSK) {
1964 case PHY_M_PS_SPEED_1000: 1852 case PHY_M_PS_SPEED_1000:
1965 return SPEED_1000; 1853 return SPEED_1000;
1966 case PHY_M_PS_SPEED_100: 1854 case PHY_M_PS_SPEED_100:
@@ -1981,15 +1869,15 @@ static void yukon_link_up(struct skge_port *skge)
1981 /* Enable Transmit FIFO Underrun */ 1869 /* Enable Transmit FIFO Underrun */
1982 skge_write8(hw, GMAC_IRQ_MSK, GMAC_DEF_MSK); 1870 skge_write8(hw, GMAC_IRQ_MSK, GMAC_DEF_MSK);
1983 1871
1984 reg = skge_gma_read16(hw, port, GM_GP_CTRL); 1872 reg = gma_read16(hw, port, GM_GP_CTRL);
1985 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) 1873 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE)
1986 reg |= GM_GPCR_DUP_FULL; 1874 reg |= GM_GPCR_DUP_FULL;
1987 1875
1988 /* enable Rx/Tx */ 1876 /* enable Rx/Tx */
1989 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; 1877 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
1990 skge_gma_write16(hw, port, GM_GP_CTRL, reg); 1878 gma_write16(hw, port, GM_GP_CTRL, reg);
1991 1879
1992 skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 1880 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK);
1993 skge_link_up(skge); 1881 skge_link_up(skge);
1994} 1882}
1995 1883
@@ -1997,18 +1885,19 @@ static void yukon_link_down(struct skge_port *skge)
1997{ 1885{
1998 struct skge_hw *hw = skge->hw; 1886 struct skge_hw *hw = skge->hw;
1999 int port = skge->port; 1887 int port = skge->port;
1888 u16 ctrl;
2000 1889
2001 pr_debug("yukon_link_down\n"); 1890 pr_debug("yukon_link_down\n");
2002 skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); 1891 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);
2003 skge_gm_phy_write(hw, port, GM_GP_CTRL, 1892
2004 skge_gm_phy_read(hw, port, GM_GP_CTRL) 1893 ctrl = gma_read16(hw, port, GM_GP_CTRL);
2005 & ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)); 1894 ctrl &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
1895 gma_write16(hw, port, GM_GP_CTRL, ctrl);
2006 1896
2007 if (hw->chip_id != CHIP_ID_YUKON_FE && 1897 if (skge->flow_control == FLOW_MODE_REM_SEND) {
2008 skge->flow_control == FLOW_MODE_REM_SEND) {
2009 /* restore Asymmetric Pause bit */ 1898 /* restore Asymmetric Pause bit */
2010 skge_gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, 1899 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV,
2011 skge_gm_phy_read(hw, port, 1900 gm_phy_read(hw, port,
2012 PHY_MARV_AUNE_ADV) 1901 PHY_MARV_AUNE_ADV)
2013 | PHY_M_AN_ASP); 1902 | PHY_M_AN_ASP);
2014 1903
@@ -2027,20 +1916,21 @@ static void yukon_phy_intr(struct skge_port *skge)
2027 const char *reason = NULL; 1916 const char *reason = NULL;
2028 u16 istatus, phystat; 1917 u16 istatus, phystat;
2029 1918
2030 istatus = skge_gm_phy_read(hw, port, PHY_MARV_INT_STAT); 1919 istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT);
2031 phystat = skge_gm_phy_read(hw, port, PHY_MARV_PHY_STAT); 1920 phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT);
2032 pr_debug("yukon phy intr istat=%x phy_stat=%x\n", istatus, phystat); 1921
1922 if (netif_msg_intr(skge))
1923 printk(KERN_DEBUG PFX "%s: phy interrupt status 0x%x 0x%x\n",
1924 skge->netdev->name, istatus, phystat);
2033 1925
2034 if (istatus & PHY_M_IS_AN_COMPL) { 1926 if (istatus & PHY_M_IS_AN_COMPL) {
2035 if (skge_gm_phy_read(hw, port, PHY_MARV_AUNE_LP) 1927 if (gm_phy_read(hw, port, PHY_MARV_AUNE_LP)
2036 & PHY_M_AN_RF) { 1928 & PHY_M_AN_RF) {
2037 reason = "remote fault"; 1929 reason = "remote fault";
2038 goto failed; 1930 goto failed;
2039 } 1931 }
2040 1932
2041 if (!(hw->chip_id == CHIP_ID_YUKON_FE || hw->chip_id == CHIP_ID_YUKON_EC) 1933 if (gm_phy_read(hw, port, PHY_MARV_1000T_STAT) & PHY_B_1000S_MSF) {
2042 && (skge_gm_phy_read(hw, port, PHY_MARV_1000T_STAT)
2043 & PHY_B_1000S_MSF)) {
2044 reason = "master/slave fault"; 1934 reason = "master/slave fault";
2045 goto failed; 1935 goto failed;
2046 } 1936 }
@@ -2054,10 +1944,6 @@ static void yukon_phy_intr(struct skge_port *skge)
2054 ? DUPLEX_FULL : DUPLEX_HALF; 1944 ? DUPLEX_FULL : DUPLEX_HALF;
2055 skge->speed = yukon_speed(hw, phystat); 1945 skge->speed = yukon_speed(hw, phystat);
2056 1946
2057 /* Tx & Rx Pause Enabled bits are at 9..8 */
2058 if (hw->chip_id == CHIP_ID_YUKON_XL)
2059 phystat >>= 6;
2060
2061 /* We are using IEEE 802.3z/D5.0 Table 37-4 */ 1947 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
2062 switch (phystat & PHY_M_PS_PAUSE_MSK) { 1948 switch (phystat & PHY_M_PS_PAUSE_MSK) {
2063 case PHY_M_PS_PAUSE_MSK: 1949 case PHY_M_PS_PAUSE_MSK:
@@ -2075,9 +1961,9 @@ static void yukon_phy_intr(struct skge_port *skge)
2075 1961
2076 if (skge->flow_control == FLOW_MODE_NONE || 1962 if (skge->flow_control == FLOW_MODE_NONE ||
2077 (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF)) 1963 (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF))
2078 skge_write8(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1964 skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
2079 else 1965 else
2080 skge_write8(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_ON); 1966 skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON);
2081 yukon_link_up(skge); 1967 yukon_link_up(skge);
2082 return; 1968 return;
2083 } 1969 }
@@ -2161,6 +2047,12 @@ static int skge_up(struct net_device *dev)
2161 if (netif_msg_ifup(skge)) 2047 if (netif_msg_ifup(skge))
2162 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); 2048 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
2163 2049
2050 if (dev->mtu > RX_BUF_SIZE)
2051 skge->rx_buf_size = dev->mtu + ETH_HLEN + NET_IP_ALIGN;
2052 else
2053 skge->rx_buf_size = RX_BUF_SIZE;
2054
2055
2164 rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc); 2056 rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc);
2165 tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc); 2057 tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc);
2166 skge->mem_size = tx_size + rx_size; 2058 skge->mem_size = tx_size + rx_size;
@@ -2173,7 +2065,8 @@ static int skge_up(struct net_device *dev)
2173 if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma))) 2065 if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma)))
2174 goto free_pci_mem; 2066 goto free_pci_mem;
2175 2067
2176 if (skge_rx_fill(skge)) 2068 err = skge_rx_fill(skge);
2069 if (err)
2177 goto free_rx_ring; 2070 goto free_rx_ring;
2178 2071
2179 if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size, 2072 if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size,
@@ -2182,14 +2075,20 @@ static int skge_up(struct net_device *dev)
2182 2075
2183 skge->tx_avail = skge->tx_ring.count - 1; 2076 skge->tx_avail = skge->tx_ring.count - 1;
2184 2077
2078 /* Enable IRQ from port */
2079 hw->intr_mask |= portirqmask[port];
2080 skge_write32(hw, B0_IMSK, hw->intr_mask);
2081
2185 /* Initialze MAC */ 2082 /* Initialze MAC */
2083 spin_lock_bh(&hw->phy_lock);
2186 if (hw->chip_id == CHIP_ID_GENESIS) 2084 if (hw->chip_id == CHIP_ID_GENESIS)
2187 genesis_mac_init(hw, port); 2085 genesis_mac_init(hw, port);
2188 else 2086 else
2189 yukon_mac_init(hw, port); 2087 yukon_mac_init(hw, port);
2088 spin_unlock_bh(&hw->phy_lock);
2190 2089
2191 /* Configure RAMbuffers */ 2090 /* Configure RAMbuffers */
2192 chunk = hw->ram_size / (isdualport(hw) ? 4 : 2); 2091 chunk = hw->ram_size / ((hw->ports + 1)*2);
2193 ram_addr = hw->ram_offset + 2 * chunk * port; 2092 ram_addr = hw->ram_offset + 2 * chunk * port;
2194 2093
2195 skge_ramset(hw, rxqaddr[port], ram_addr, chunk); 2094 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
@@ -2202,6 +2101,7 @@ static int skge_up(struct net_device *dev)
2202 /* Start receiver BMU */ 2101 /* Start receiver BMU */
2203 wmb(); 2102 wmb();
2204 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2103 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2104 skge_led(skge, LED_MODE_ON);
2205 2105
2206 pr_debug("skge_up completed\n"); 2106 pr_debug("skge_up completed\n");
2207 return 0; 2107 return 0;
@@ -2226,9 +2126,6 @@ static int skge_down(struct net_device *dev)
2226 2126
2227 netif_stop_queue(dev); 2127 netif_stop_queue(dev);
2228 2128
2229 del_timer_sync(&skge->led_blink);
2230 del_timer_sync(&skge->link_check);
2231
2232 /* Stop transmitter */ 2129 /* Stop transmitter */
2233 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); 2130 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP);
2234 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), 2131 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL),
@@ -2240,12 +2137,12 @@ static int skge_down(struct net_device *dev)
2240 yukon_stop(skge); 2137 yukon_stop(skge);
2241 2138
2242 /* Disable Force Sync bit and Enable Alloc bit */ 2139 /* Disable Force Sync bit and Enable Alloc bit */
2243 skge_write8(hw, SKGEMAC_REG(port, TXA_CTRL), 2140 skge_write8(hw, SK_REG(port, TXA_CTRL),
2244 TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); 2141 TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC);
2245 2142
2246 /* Stop Interval Timer and Limit Counter of Tx Arbiter */ 2143 /* Stop Interval Timer and Limit Counter of Tx Arbiter */
2247 skge_write32(hw, SKGEMAC_REG(port, TXA_ITI_INI), 0L); 2144 skge_write32(hw, SK_REG(port, TXA_ITI_INI), 0L);
2248 skge_write32(hw, SKGEMAC_REG(port, TXA_LIM_INI), 0L); 2145 skge_write32(hw, SK_REG(port, TXA_LIM_INI), 0L);
2249 2146
2250 /* Reset PCI FIFO */ 2147 /* Reset PCI FIFO */
2251 skge_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_SET_RESET); 2148 skge_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_SET_RESET);
@@ -2260,17 +2157,14 @@ static int skge_down(struct net_device *dev)
2260 skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET); 2157 skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET);
2261 2158
2262 if (hw->chip_id == CHIP_ID_GENESIS) { 2159 if (hw->chip_id == CHIP_ID_GENESIS) {
2263 skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_RST_SET); 2160 skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET);
2264 skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_RST_SET); 2161 skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET);
2265 skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_STOP);
2266 skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_STOP);
2267 } else { 2162 } else {
2268 skge_write8(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 2163 skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
2269 skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 2164 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
2270 } 2165 }
2271 2166
2272 /* turn off led's */ 2167 skge_led(skge, LED_MODE_OFF);
2273 skge_write16(hw, B0_LED, LED_STAT_OFF);
2274 2168
2275 skge_tx_clean(skge); 2169 skge_tx_clean(skge);
2276 skge_rx_clean(skge); 2170 skge_rx_clean(skge);
@@ -2299,10 +2193,10 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2299 2193
2300 local_irq_save(flags); 2194 local_irq_save(flags);
2301 if (!spin_trylock(&skge->tx_lock)) { 2195 if (!spin_trylock(&skge->tx_lock)) {
2302 /* Collision - tell upper layer to requeue */ 2196 /* Collision - tell upper layer to requeue */
2303 local_irq_restore(flags); 2197 local_irq_restore(flags);
2304 return NETDEV_TX_LOCKED; 2198 return NETDEV_TX_LOCKED;
2305 } 2199 }
2306 2200
2307 if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { 2201 if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) {
2308 netif_stop_queue(dev); 2202 netif_stop_queue(dev);
@@ -2333,7 +2227,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2333 * does. Looks like hardware is wrong? 2227 * does. Looks like hardware is wrong?
2334 */ 2228 */
2335 if (ip->protocol == IPPROTO_UDP 2229 if (ip->protocol == IPPROTO_UDP
2336 && chip_rev(hw) == 0 && hw->chip_id == CHIP_ID_YUKON) 2230 && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON)
2337 control = BMU_TCP_CHECK; 2231 control = BMU_TCP_CHECK;
2338 else 2232 else
2339 control = BMU_UDP_CHECK; 2233 control = BMU_UDP_CHECK;
@@ -2394,6 +2288,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2394 2288
2395static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e) 2289static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e)
2396{ 2290{
2291 /* This ring element can be skb or fragment */
2397 if (e->skb) { 2292 if (e->skb) {
2398 pci_unmap_single(hw->pdev, 2293 pci_unmap_single(hw->pdev,
2399 pci_unmap_addr(e, mapaddr), 2294 pci_unmap_addr(e, mapaddr),
@@ -2438,16 +2333,17 @@ static void skge_tx_timeout(struct net_device *dev)
2438static int skge_change_mtu(struct net_device *dev, int new_mtu) 2333static int skge_change_mtu(struct net_device *dev, int new_mtu)
2439{ 2334{
2440 int err = 0; 2335 int err = 0;
2336 int running = netif_running(dev);
2441 2337
2442 if(new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 2338 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
2443 return -EINVAL; 2339 return -EINVAL;
2444 2340
2445 dev->mtu = new_mtu;
2446 2341
2447 if (netif_running(dev)) { 2342 if (running)
2448 skge_down(dev); 2343 skge_down(dev);
2344 dev->mtu = new_mtu;
2345 if (running)
2449 skge_up(dev); 2346 skge_up(dev);
2450 }
2451 2347
2452 return err; 2348 return err;
2453} 2349}
@@ -2462,7 +2358,9 @@ static void genesis_set_multicast(struct net_device *dev)
2462 u32 mode; 2358 u32 mode;
2463 u8 filter[8]; 2359 u8 filter[8];
2464 2360
2465 mode = skge_xm_read32(hw, port, XM_MODE); 2361 pr_debug("genesis_set_multicast flags=%x count=%d\n", dev->flags, dev->mc_count);
2362
2363 mode = xm_read32(hw, port, XM_MODE);
2466 mode |= XM_MD_ENA_HASH; 2364 mode |= XM_MD_ENA_HASH;
2467 if (dev->flags & IFF_PROMISC) 2365 if (dev->flags & IFF_PROMISC)
2468 mode |= XM_MD_ENA_PROM; 2366 mode |= XM_MD_ENA_PROM;
@@ -2473,17 +2371,16 @@ static void genesis_set_multicast(struct net_device *dev)
2473 memset(filter, 0xff, sizeof(filter)); 2371 memset(filter, 0xff, sizeof(filter));
2474 else { 2372 else {
2475 memset(filter, 0, sizeof(filter)); 2373 memset(filter, 0, sizeof(filter));
2476 for(i = 0; list && i < count; i++, list = list->next) { 2374 for (i = 0; list && i < count; i++, list = list->next) {
2477 u32 crc = crc32_le(~0, list->dmi_addr, ETH_ALEN); 2375 u32 crc, bit;
2478 u8 bit = 63 - (crc & 63); 2376 crc = ether_crc_le(ETH_ALEN, list->dmi_addr);
2479 2377 bit = ~crc & 0x3f;
2480 filter[bit/8] |= 1 << (bit%8); 2378 filter[bit/8] |= 1 << (bit%8);
2481 } 2379 }
2482 } 2380 }
2483 2381
2484 skge_xm_outhash(hw, port, XM_HSM, filter); 2382 xm_write32(hw, port, XM_MODE, mode);
2485 2383 xm_outhash(hw, port, XM_HSM, filter);
2486 skge_xm_write32(hw, port, XM_MODE, mode);
2487} 2384}
2488 2385
2489static void yukon_set_multicast(struct net_device *dev) 2386static void yukon_set_multicast(struct net_device *dev)
@@ -2497,7 +2394,7 @@ static void yukon_set_multicast(struct net_device *dev)
2497 2394
2498 memset(filter, 0, sizeof(filter)); 2395 memset(filter, 0, sizeof(filter));
2499 2396
2500 reg = skge_gma_read16(hw, port, GM_RX_CTRL); 2397 reg = gma_read16(hw, port, GM_RX_CTRL);
2501 reg |= GM_RXCR_UCF_ENA; 2398 reg |= GM_RXCR_UCF_ENA;
2502 2399
2503 if (dev->flags & IFF_PROMISC) /* promiscious */ 2400 if (dev->flags & IFF_PROMISC) /* promiscious */
@@ -2510,23 +2407,23 @@ static void yukon_set_multicast(struct net_device *dev)
2510 int i; 2407 int i;
2511 reg |= GM_RXCR_MCF_ENA; 2408 reg |= GM_RXCR_MCF_ENA;
2512 2409
2513 for(i = 0; list && i < dev->mc_count; i++, list = list->next) { 2410 for (i = 0; list && i < dev->mc_count; i++, list = list->next) {
2514 u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f; 2411 u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f;
2515 filter[bit/8] |= 1 << (bit%8); 2412 filter[bit/8] |= 1 << (bit%8);
2516 } 2413 }
2517 } 2414 }
2518 2415
2519 2416
2520 skge_gma_write16(hw, port, GM_MC_ADDR_H1, 2417 gma_write16(hw, port, GM_MC_ADDR_H1,
2521 (u16)filter[0] | ((u16)filter[1] << 8)); 2418 (u16)filter[0] | ((u16)filter[1] << 8));
2522 skge_gma_write16(hw, port, GM_MC_ADDR_H2, 2419 gma_write16(hw, port, GM_MC_ADDR_H2,
2523 (u16)filter[2] | ((u16)filter[3] << 8)); 2420 (u16)filter[2] | ((u16)filter[3] << 8));
2524 skge_gma_write16(hw, port, GM_MC_ADDR_H3, 2421 gma_write16(hw, port, GM_MC_ADDR_H3,
2525 (u16)filter[4] | ((u16)filter[5] << 8)); 2422 (u16)filter[4] | ((u16)filter[5] << 8));
2526 skge_gma_write16(hw, port, GM_MC_ADDR_H4, 2423 gma_write16(hw, port, GM_MC_ADDR_H4,
2527 (u16)filter[6] | ((u16)filter[7] << 8)); 2424 (u16)filter[6] | ((u16)filter[7] << 8));
2528 2425
2529 skge_gma_write16(hw, port, GM_RX_CTRL, reg); 2426 gma_write16(hw, port, GM_RX_CTRL, reg);
2530} 2427}
2531 2428
2532static inline int bad_phy_status(const struct skge_hw *hw, u32 status) 2429static inline int bad_phy_status(const struct skge_hw *hw, u32 status)
@@ -2545,28 +2442,76 @@ static void skge_rx_error(struct skge_port *skge, int slot,
2545 printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n", 2442 printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n",
2546 skge->netdev->name, slot, control, status); 2443 skge->netdev->name, slot, control, status);
2547 2444
2548 if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) 2445 if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF))
2549 || (control & BMU_BBC) > skge->netdev->mtu + VLAN_ETH_HLEN)
2550 skge->net_stats.rx_length_errors++; 2446 skge->net_stats.rx_length_errors++;
2551 else { 2447 else if (skge->hw->chip_id == CHIP_ID_GENESIS) {
2552 if (skge->hw->chip_id == CHIP_ID_GENESIS) { 2448 if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR))
2553 if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) 2449 skge->net_stats.rx_length_errors++;
2554 skge->net_stats.rx_length_errors++; 2450 if (status & XMR_FS_FRA_ERR)
2555 if (status & XMR_FS_FRA_ERR) 2451 skge->net_stats.rx_frame_errors++;
2556 skge->net_stats.rx_frame_errors++; 2452 if (status & XMR_FS_FCS_ERR)
2557 if (status & XMR_FS_FCS_ERR) 2453 skge->net_stats.rx_crc_errors++;
2558 skge->net_stats.rx_crc_errors++; 2454 } else {
2559 } else { 2455 if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE))
2560 if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) 2456 skge->net_stats.rx_length_errors++;
2561 skge->net_stats.rx_length_errors++; 2457 if (status & GMR_FS_FRAGMENT)
2562 if (status & GMR_FS_FRAGMENT) 2458 skge->net_stats.rx_frame_errors++;
2563 skge->net_stats.rx_frame_errors++; 2459 if (status & GMR_FS_CRC_ERR)
2564 if (status & GMR_FS_CRC_ERR) 2460 skge->net_stats.rx_crc_errors++;
2565 skge->net_stats.rx_crc_errors++; 2461 }
2462}
2463
2464/* Get receive buffer from descriptor.
2465 * Handles copy of small buffers and reallocation failures
2466 */
2467static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
2468 struct skge_element *e,
2469 unsigned int len)
2470{
2471 struct sk_buff *nskb, *skb;
2472
2473 if (len < RX_COPY_THRESHOLD) {
2474 nskb = skge_rx_alloc(skge->netdev, len + NET_IP_ALIGN);
2475 if (unlikely(!nskb))
2476 return NULL;
2477
2478 pci_dma_sync_single_for_cpu(skge->hw->pdev,
2479 pci_unmap_addr(e, mapaddr),
2480 len, PCI_DMA_FROMDEVICE);
2481 memcpy(nskb->data, e->skb->data, len);
2482 pci_dma_sync_single_for_device(skge->hw->pdev,
2483 pci_unmap_addr(e, mapaddr),
2484 len, PCI_DMA_FROMDEVICE);
2485
2486 if (skge->rx_csum) {
2487 struct skge_rx_desc *rd = e->desc;
2488 nskb->csum = le16_to_cpu(rd->csum2);
2489 nskb->ip_summed = CHECKSUM_HW;
2566 } 2490 }
2491 skge_rx_reuse(e, skge->rx_buf_size);
2492 return nskb;
2493 } else {
2494 nskb = skge_rx_alloc(skge->netdev, skge->rx_buf_size);
2495 if (unlikely(!nskb))
2496 return NULL;
2497
2498 pci_unmap_single(skge->hw->pdev,
2499 pci_unmap_addr(e, mapaddr),
2500 pci_unmap_len(e, maplen),
2501 PCI_DMA_FROMDEVICE);
2502 skb = e->skb;
2503 if (skge->rx_csum) {
2504 struct skge_rx_desc *rd = e->desc;
2505 skb->csum = le16_to_cpu(rd->csum2);
2506 skb->ip_summed = CHECKSUM_HW;
2507 }
2508
2509 skge_rx_setup(skge, e, nskb, skge->rx_buf_size);
2510 return skb;
2567 } 2511 }
2568} 2512}
2569 2513
2514
2570static int skge_poll(struct net_device *dev, int *budget) 2515static int skge_poll(struct net_device *dev, int *budget)
2571{ 2516{
2572 struct skge_port *skge = netdev_priv(dev); 2517 struct skge_port *skge = netdev_priv(dev);
@@ -2575,13 +2520,12 @@ static int skge_poll(struct net_device *dev, int *budget)
2575 struct skge_element *e; 2520 struct skge_element *e;
2576 unsigned int to_do = min(dev->quota, *budget); 2521 unsigned int to_do = min(dev->quota, *budget);
2577 unsigned int work_done = 0; 2522 unsigned int work_done = 0;
2578 int done;
2579 static const u32 irqmask[] = { IS_PORT_1, IS_PORT_2 };
2580 2523
2581 for (e = ring->to_clean; e != ring->to_use && work_done < to_do; 2524 pr_debug("skge_poll\n");
2582 e = e->next) { 2525
2526 for (e = ring->to_clean; work_done < to_do; e = e->next) {
2583 struct skge_rx_desc *rd = e->desc; 2527 struct skge_rx_desc *rd = e->desc;
2584 struct sk_buff *skb = e->skb; 2528 struct sk_buff *skb;
2585 u32 control, len, status; 2529 u32 control, len, status;
2586 2530
2587 rmb(); 2531 rmb();
@@ -2590,19 +2534,12 @@ static int skge_poll(struct net_device *dev, int *budget)
2590 break; 2534 break;
2591 2535
2592 len = control & BMU_BBC; 2536 len = control & BMU_BBC;
2593 e->skb = NULL;
2594
2595 pci_unmap_single(hw->pdev,
2596 pci_unmap_addr(e, mapaddr),
2597 pci_unmap_len(e, maplen),
2598 PCI_DMA_FROMDEVICE);
2599
2600 status = rd->status; 2537 status = rd->status;
2601 if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) 2538
2602 || len > dev->mtu + VLAN_ETH_HLEN 2539 if (unlikely((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF)
2603 || bad_phy_status(hw, status)) { 2540 || bad_phy_status(hw, status))) {
2604 skge_rx_error(skge, e - ring->start, control, status); 2541 skge_rx_error(skge, e - ring->start, control, status);
2605 dev_kfree_skb(skb); 2542 skge_rx_reuse(e, skge->rx_buf_size);
2606 continue; 2543 continue;
2607 } 2544 }
2608 2545
@@ -2610,43 +2547,37 @@ static int skge_poll(struct net_device *dev, int *budget)
2610 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", 2547 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n",
2611 dev->name, e - ring->start, rd->status, len); 2548 dev->name, e - ring->start, rd->status, len);
2612 2549
2613 skb_put(skb, len); 2550 skb = skge_rx_get(skge, e, len);
2614 skb->protocol = eth_type_trans(skb, dev); 2551 if (likely(skb)) {
2552 skb_put(skb, len);
2553 skb->protocol = eth_type_trans(skb, dev);
2615 2554
2616 if (skge->rx_csum) { 2555 dev->last_rx = jiffies;
2617 skb->csum = le16_to_cpu(rd->csum2); 2556 netif_receive_skb(skb);
2618 skb->ip_summed = CHECKSUM_HW;
2619 }
2620
2621 dev->last_rx = jiffies;
2622 netif_receive_skb(skb);
2623 2557
2624 ++work_done; 2558 ++work_done;
2559 } else
2560 skge_rx_reuse(e, skge->rx_buf_size);
2625 } 2561 }
2626 ring->to_clean = e; 2562 ring->to_clean = e;
2627 2563
2628 *budget -= work_done;
2629 dev->quota -= work_done;
2630 done = work_done < to_do;
2631
2632 if (skge_rx_fill(skge))
2633 done = 0;
2634
2635 /* restart receiver */ 2564 /* restart receiver */
2636 wmb(); 2565 wmb();
2637 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), 2566 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR),
2638 CSR_START | CSR_IRQ_CL_F); 2567 CSR_START | CSR_IRQ_CL_F);
2639 2568
2640 if (done) { 2569 *budget -= work_done;
2641 local_irq_disable(); 2570 dev->quota -= work_done;
2642 hw->intr_mask |= irqmask[skge->port];
2643 /* Order is important since data can get interrupted */
2644 skge_write32(hw, B0_IMSK, hw->intr_mask);
2645 __netif_rx_complete(dev);
2646 local_irq_enable();
2647 }
2648 2571
2649 return !done; 2572 if (work_done >= to_do)
2573 return 1; /* not done */
2574
2575 local_irq_disable();
2576 __netif_rx_complete(dev);
2577 hw->intr_mask |= portirqmask[skge->port];
2578 skge_write32(hw, B0_IMSK, hw->intr_mask);
2579 local_irq_enable();
2580 return 0;
2650} 2581}
2651 2582
2652static inline void skge_tx_intr(struct net_device *dev) 2583static inline void skge_tx_intr(struct net_device *dev)
@@ -2657,7 +2588,7 @@ static inline void skge_tx_intr(struct net_device *dev)
2657 struct skge_element *e; 2588 struct skge_element *e;
2658 2589
2659 spin_lock(&skge->tx_lock); 2590 spin_lock(&skge->tx_lock);
2660 for(e = ring->to_clean; e != ring->to_use; e = e->next) { 2591 for (e = ring->to_clean; e != ring->to_use; e = e->next) {
2661 struct skge_tx_desc *td = e->desc; 2592 struct skge_tx_desc *td = e->desc;
2662 u32 control; 2593 u32 control;
2663 2594
@@ -2683,19 +2614,25 @@ static inline void skge_tx_intr(struct net_device *dev)
2683 spin_unlock(&skge->tx_lock); 2614 spin_unlock(&skge->tx_lock);
2684} 2615}
2685 2616
2617/* Parity errors seem to happen when Genesis is connected to a switch
2618 * with no other ports present. Heartbeat error??
2619 */
2686static void skge_mac_parity(struct skge_hw *hw, int port) 2620static void skge_mac_parity(struct skge_hw *hw, int port)
2687{ 2621{
2688 printk(KERN_ERR PFX "%s: mac data parity error\n", 2622 struct net_device *dev = hw->dev[port];
2689 hw->dev[port] ? hw->dev[port]->name 2623
2690 : (port == 0 ? "(port A)": "(port B")); 2624 if (dev) {
2625 struct skge_port *skge = netdev_priv(dev);
2626 ++skge->net_stats.tx_heartbeat_errors;
2627 }
2691 2628
2692 if (hw->chip_id == CHIP_ID_GENESIS) 2629 if (hw->chip_id == CHIP_ID_GENESIS)
2693 skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), 2630 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1),
2694 MFF_CLR_PERR); 2631 MFF_CLR_PERR);
2695 else 2632 else
2696 /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */ 2633 /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */
2697 skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), 2634 skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T),
2698 (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0) 2635 (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0)
2699 ? GMF_CLI_TX_FC : GMF_CLI_TX_PE); 2636 ? GMF_CLI_TX_FC : GMF_CLI_TX_PE);
2700} 2637}
2701 2638
@@ -2703,16 +2640,16 @@ static void skge_pci_clear(struct skge_hw *hw)
2703{ 2640{
2704 u16 status; 2641 u16 status;
2705 2642
2706 status = skge_read16(hw, SKGEPCI_REG(PCI_STATUS)); 2643 pci_read_config_word(hw->pdev, PCI_STATUS, &status);
2707 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2644 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2708 skge_write16(hw, SKGEPCI_REG(PCI_STATUS), 2645 pci_write_config_word(hw->pdev, PCI_STATUS,
2709 status | PCI_STATUS_ERROR_BITS); 2646 status | PCI_STATUS_ERROR_BITS);
2710 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 2647 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2711} 2648}
2712 2649
2713static void skge_mac_intr(struct skge_hw *hw, int port) 2650static void skge_mac_intr(struct skge_hw *hw, int port)
2714{ 2651{
2715 if (hw->chip_id == CHIP_ID_GENESIS) 2652 if (hw->chip_id == CHIP_ID_GENESIS)
2716 genesis_mac_intr(hw, port); 2653 genesis_mac_intr(hw, port);
2717 else 2654 else
2718 yukon_mac_intr(hw, port); 2655 yukon_mac_intr(hw, port);
@@ -2726,9 +2663,9 @@ static void skge_error_irq(struct skge_hw *hw)
2726 if (hw->chip_id == CHIP_ID_GENESIS) { 2663 if (hw->chip_id == CHIP_ID_GENESIS) {
2727 /* clear xmac errors */ 2664 /* clear xmac errors */
2728 if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1)) 2665 if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1))
2729 skge_write16(hw, SKGEMAC_REG(0, RX_MFF_CTRL1), MFF_CLR_INSTAT); 2666 skge_write16(hw, SK_REG(0, RX_MFF_CTRL1), MFF_CLR_INSTAT);
2730 if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2)) 2667 if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2))
2731 skge_write16(hw, SKGEMAC_REG(0, RX_MFF_CTRL2), MFF_CLR_INSTAT); 2668 skge_write16(hw, SK_REG(0, RX_MFF_CTRL2), MFF_CLR_INSTAT);
2732 } else { 2669 } else {
2733 /* Timestamp (unused) overflow */ 2670 /* Timestamp (unused) overflow */
2734 if (hwstatus & IS_IRQ_TIST_OV) 2671 if (hwstatus & IS_IRQ_TIST_OV)
@@ -2803,8 +2740,8 @@ static void skge_extirq(unsigned long data)
2803 2740
2804 if (hw->chip_id != CHIP_ID_GENESIS) 2741 if (hw->chip_id != CHIP_ID_GENESIS)
2805 yukon_phy_intr(skge); 2742 yukon_phy_intr(skge);
2806 else if (hw->phy_type == SK_PHY_BCOM) 2743 else
2807 genesis_bcom_intr(skge); 2744 bcom_phy_intr(skge);
2808 } 2745 }
2809 } 2746 }
2810 spin_unlock(&hw->phy_lock); 2747 spin_unlock(&hw->phy_lock);
@@ -2824,19 +2761,14 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)
2824 return IRQ_NONE; 2761 return IRQ_NONE;
2825 2762
2826 status &= hw->intr_mask; 2763 status &= hw->intr_mask;
2827 2764 if (status & IS_R1_F) {
2828 if ((status & IS_R1_F) && netif_rx_schedule_prep(hw->dev[0])) {
2829 status &= ~IS_R1_F;
2830 hw->intr_mask &= ~IS_R1_F; 2765 hw->intr_mask &= ~IS_R1_F;
2831 skge_write32(hw, B0_IMSK, hw->intr_mask); 2766 netif_rx_schedule(hw->dev[0]);
2832 __netif_rx_schedule(hw->dev[0]);
2833 } 2767 }
2834 2768
2835 if ((status & IS_R2_F) && netif_rx_schedule_prep(hw->dev[1])) { 2769 if (status & IS_R2_F) {
2836 status &= ~IS_R2_F;
2837 hw->intr_mask &= ~IS_R2_F; 2770 hw->intr_mask &= ~IS_R2_F;
2838 skge_write32(hw, B0_IMSK, hw->intr_mask); 2771 netif_rx_schedule(hw->dev[1]);
2839 __netif_rx_schedule(hw->dev[1]);
2840 } 2772 }
2841 2773
2842 if (status & IS_XA1_F) 2774 if (status & IS_XA1_F)
@@ -2845,9 +2777,27 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)
2845 if (status & IS_XA2_F) 2777 if (status & IS_XA2_F)
2846 skge_tx_intr(hw->dev[1]); 2778 skge_tx_intr(hw->dev[1]);
2847 2779
2780 if (status & IS_PA_TO_RX1) {
2781 struct skge_port *skge = netdev_priv(hw->dev[0]);
2782 ++skge->net_stats.rx_over_errors;
2783 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX1);
2784 }
2785
2786 if (status & IS_PA_TO_RX2) {
2787 struct skge_port *skge = netdev_priv(hw->dev[1]);
2788 ++skge->net_stats.rx_over_errors;
2789 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2);
2790 }
2791
2792 if (status & IS_PA_TO_TX1)
2793 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX1);
2794
2795 if (status & IS_PA_TO_TX2)
2796 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX2);
2797
2848 if (status & IS_MAC1) 2798 if (status & IS_MAC1)
2849 skge_mac_intr(hw, 0); 2799 skge_mac_intr(hw, 0);
2850 2800
2851 if (status & IS_MAC2) 2801 if (status & IS_MAC2)
2852 skge_mac_intr(hw, 1); 2802 skge_mac_intr(hw, 1);
2853 2803
@@ -2859,8 +2809,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)
2859 tasklet_schedule(&hw->ext_tasklet); 2809 tasklet_schedule(&hw->ext_tasklet);
2860 } 2810 }
2861 2811
2862 if (status) 2812 skge_write32(hw, B0_IMSK, hw->intr_mask);
2863 skge_write32(hw, B0_IMSK, hw->intr_mask);
2864 2813
2865 return IRQ_HANDLED; 2814 return IRQ_HANDLED;
2866} 2815}
@@ -2904,9 +2853,6 @@ static const struct {
2904 { CHIP_ID_YUKON, "Yukon" }, 2853 { CHIP_ID_YUKON, "Yukon" },
2905 { CHIP_ID_YUKON_LITE, "Yukon-Lite"}, 2854 { CHIP_ID_YUKON_LITE, "Yukon-Lite"},
2906 { CHIP_ID_YUKON_LP, "Yukon-LP"}, 2855 { CHIP_ID_YUKON_LP, "Yukon-LP"},
2907 { CHIP_ID_YUKON_XL, "Yukon-2 XL"},
2908 { CHIP_ID_YUKON_EC, "YUKON-2 EC"},
2909 { CHIP_ID_YUKON_FE, "YUKON-2 FE"},
2910}; 2856};
2911 2857
2912static const char *skge_board_name(const struct skge_hw *hw) 2858static const char *skge_board_name(const struct skge_hw *hw)
@@ -2930,8 +2876,8 @@ static const char *skge_board_name(const struct skge_hw *hw)
2930static int skge_reset(struct skge_hw *hw) 2876static int skge_reset(struct skge_hw *hw)
2931{ 2877{
2932 u16 ctst; 2878 u16 ctst;
2933 u8 t8; 2879 u8 t8, mac_cfg;
2934 int i, ports; 2880 int i;
2935 2881
2936 ctst = skge_read16(hw, B0_CTST); 2882 ctst = skge_read16(hw, B0_CTST);
2937 2883
@@ -2952,12 +2898,9 @@ static int skge_reset(struct skge_hw *hw)
2952 hw->phy_type = skge_read8(hw, B2_E_1) & 0xf; 2898 hw->phy_type = skge_read8(hw, B2_E_1) & 0xf;
2953 hw->pmd_type = skge_read8(hw, B2_PMD_TYP); 2899 hw->pmd_type = skge_read8(hw, B2_PMD_TYP);
2954 2900
2955 switch(hw->chip_id) { 2901 switch (hw->chip_id) {
2956 case CHIP_ID_GENESIS: 2902 case CHIP_ID_GENESIS:
2957 switch (hw->phy_type) { 2903 switch (hw->phy_type) {
2958 case SK_PHY_XMAC:
2959 hw->phy_addr = PHY_ADDR_XMAC;
2960 break;
2961 case SK_PHY_BCOM: 2904 case SK_PHY_BCOM:
2962 hw->phy_addr = PHY_ADDR_BCOM; 2905 hw->phy_addr = PHY_ADDR_BCOM;
2963 break; 2906 break;
@@ -2986,8 +2929,9 @@ static int skge_reset(struct skge_hw *hw)
2986 return -EOPNOTSUPP; 2929 return -EOPNOTSUPP;
2987 } 2930 }
2988 2931
2989 hw->mac_cfg = skge_read8(hw, B2_MAC_CFG); 2932 mac_cfg = skge_read8(hw, B2_MAC_CFG);
2990 ports = isdualport(hw) ? 2 : 1; 2933 hw->ports = (mac_cfg & CFG_SNG_MAC) ? 1 : 2;
2934 hw->chip_rev = (mac_cfg & CFG_CHIP_R_MSK) >> 4;
2991 2935
2992 /* read the adapters RAM size */ 2936 /* read the adapters RAM size */
2993 t8 = skge_read8(hw, B2_E_0); 2937 t8 = skge_read8(hw, B2_E_0);
@@ -3010,9 +2954,9 @@ static int skge_reset(struct skge_hw *hw)
3010 /* switch power to VCC (WA for VAUX problem) */ 2954 /* switch power to VCC (WA for VAUX problem) */
3011 skge_write8(hw, B0_POWER_CTRL, 2955 skge_write8(hw, B0_POWER_CTRL,
3012 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); 2956 PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON);
3013 for (i = 0; i < ports; i++) { 2957 for (i = 0; i < hw->ports; i++) {
3014 skge_write16(hw, SKGEMAC_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); 2958 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
3015 skge_write16(hw, SKGEMAC_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); 2959 skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR);
3016 } 2960 }
3017 } 2961 }
3018 2962
@@ -3022,8 +2966,8 @@ static int skge_reset(struct skge_hw *hw)
3022 skge_write8(hw, B0_LED, LED_STAT_ON); 2966 skge_write8(hw, B0_LED, LED_STAT_ON);
3023 2967
3024 /* enable the Tx Arbiters */ 2968 /* enable the Tx Arbiters */
3025 for (i = 0; i < ports; i++) 2969 for (i = 0; i < hw->ports; i++)
3026 skge_write8(hw, SKGEMAC_REG(i, TXA_CTRL), TXA_ENA_ARB); 2970 skge_write8(hw, SK_REG(i, TXA_CTRL), TXA_ENA_ARB);
3027 2971
3028 /* Initialize ram interface */ 2972 /* Initialize ram interface */
3029 skge_write16(hw, B3_RI_CTRL, RI_RST_CLR); 2973 skge_write16(hw, B3_RI_CTRL, RI_RST_CLR);
@@ -3050,16 +2994,14 @@ static int skge_reset(struct skge_hw *hw)
3050 skge_write32(hw, B2_IRQM_INI, skge_usecs2clk(hw, 100)); 2994 skge_write32(hw, B2_IRQM_INI, skge_usecs2clk(hw, 100));
3051 skge_write32(hw, B2_IRQM_CTRL, TIM_START); 2995 skge_write32(hw, B2_IRQM_CTRL, TIM_START);
3052 2996
3053 hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1; 2997 hw->intr_mask = IS_HW_ERR | IS_EXT_REG;
3054 if (isdualport(hw))
3055 hw->intr_mask |= IS_PORT_2;
3056 skge_write32(hw, B0_IMSK, hw->intr_mask); 2998 skge_write32(hw, B0_IMSK, hw->intr_mask);
3057 2999
3058 if (hw->chip_id != CHIP_ID_GENESIS) 3000 if (hw->chip_id != CHIP_ID_GENESIS)
3059 skge_write8(hw, GMAC_IRQ_MSK, 0); 3001 skge_write8(hw, GMAC_IRQ_MSK, 0);
3060 3002
3061 spin_lock_bh(&hw->phy_lock); 3003 spin_lock_bh(&hw->phy_lock);
3062 for (i = 0; i < ports; i++) { 3004 for (i = 0; i < hw->ports; i++) {
3063 if (hw->chip_id == CHIP_ID_GENESIS) 3005 if (hw->chip_id == CHIP_ID_GENESIS)
3064 genesis_reset(hw, i); 3006 genesis_reset(hw, i);
3065 else 3007 else
@@ -3071,7 +3013,8 @@ static int skge_reset(struct skge_hw *hw)
3071} 3013}
3072 3014
3073/* Initialize network device */ 3015/* Initialize network device */
3074static struct net_device *skge_devinit(struct skge_hw *hw, int port) 3016static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3017 int highmem)
3075{ 3018{
3076 struct skge_port *skge; 3019 struct skge_port *skge;
3077 struct net_device *dev = alloc_etherdev(sizeof(*skge)); 3020 struct net_device *dev = alloc_etherdev(sizeof(*skge));
@@ -3104,6 +3047,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port)
3104#endif 3047#endif
3105 dev->irq = hw->pdev->irq; 3048 dev->irq = hw->pdev->irq;
3106 dev->features = NETIF_F_LLTX; 3049 dev->features = NETIF_F_LLTX;
3050 if (highmem)
3051 dev->features |= NETIF_F_HIGHDMA;
3107 3052
3108 skge = netdev_priv(dev); 3053 skge = netdev_priv(dev);
3109 skge->netdev = dev; 3054 skge->netdev = dev;
@@ -3117,7 +3062,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port)
3117 skge->flow_control = FLOW_MODE_SYMMETRIC; 3062 skge->flow_control = FLOW_MODE_SYMMETRIC;
3118 skge->duplex = -1; 3063 skge->duplex = -1;
3119 skge->speed = -1; 3064 skge->speed = -1;
3120 skge->advertising = skge_modes(hw); 3065 skge->advertising = skge_supported_modes(hw);
3121 3066
3122 hw->dev[port] = dev; 3067 hw->dev[port] = dev;
3123 3068
@@ -3125,14 +3070,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port)
3125 3070
3126 spin_lock_init(&skge->tx_lock); 3071 spin_lock_init(&skge->tx_lock);
3127 3072
3128 init_timer(&skge->link_check);
3129 skge->link_check.function = skge_link_timer;
3130 skge->link_check.data = (unsigned long) skge;
3131
3132 init_timer(&skge->led_blink);
3133 skge->led_blink.function = skge_blink_timer;
3134 skge->led_blink.data = (unsigned long) skge;
3135
3136 if (hw->chip_id != CHIP_ID_GENESIS) { 3073 if (hw->chip_id != CHIP_ID_GENESIS) {
3137 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3074 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
3138 skge->rx_csum = 1; 3075 skge->rx_csum = 1;
@@ -3232,14 +3169,11 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3232 3169
3233 printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", 3170 printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n",
3234 pci_resource_start(pdev, 0), pdev->irq, 3171 pci_resource_start(pdev, 0), pdev->irq,
3235 skge_board_name(hw), chip_rev(hw)); 3172 skge_board_name(hw), hw->chip_rev);
3236 3173
3237 if ((dev = skge_devinit(hw, 0)) == NULL) 3174 if ((dev = skge_devinit(hw, 0, using_dac)) == NULL)
3238 goto err_out_led_off; 3175 goto err_out_led_off;
3239 3176
3240 if (using_dac)
3241 dev->features |= NETIF_F_HIGHDMA;
3242
3243 if ((err = register_netdev(dev))) { 3177 if ((err = register_netdev(dev))) {
3244 printk(KERN_ERR PFX "%s: cannot register net device\n", 3178 printk(KERN_ERR PFX "%s: cannot register net device\n",
3245 pci_name(pdev)); 3179 pci_name(pdev));
@@ -3248,10 +3182,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3248 3182
3249 skge_show_addr(dev); 3183 skge_show_addr(dev);
3250 3184
3251 if (isdualport(hw) && (dev1 = skge_devinit(hw, 1))) { 3185 if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) {
3252 if (using_dac)
3253 dev1->features |= NETIF_F_HIGHDMA;
3254
3255 if (register_netdev(dev1) == 0) 3186 if (register_netdev(dev1) == 0)
3256 skge_show_addr(dev1); 3187 skge_show_addr(dev1);
3257 else { 3188 else {
@@ -3288,7 +3219,7 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3288 struct skge_hw *hw = pci_get_drvdata(pdev); 3219 struct skge_hw *hw = pci_get_drvdata(pdev);
3289 struct net_device *dev0, *dev1; 3220 struct net_device *dev0, *dev1;
3290 3221
3291 if(!hw) 3222 if (!hw)
3292 return; 3223 return;
3293 3224
3294 if ((dev1 = hw->dev[1])) 3225 if ((dev1 = hw->dev[1]))
@@ -3311,12 +3242,12 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3311} 3242}
3312 3243
3313#ifdef CONFIG_PM 3244#ifdef CONFIG_PM
3314static int skge_suspend(struct pci_dev *pdev, u32 state) 3245static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3315{ 3246{
3316 struct skge_hw *hw = pci_get_drvdata(pdev); 3247 struct skge_hw *hw = pci_get_drvdata(pdev);
3317 int i, wol = 0; 3248 int i, wol = 0;
3318 3249
3319 for(i = 0; i < 2; i++) { 3250 for (i = 0; i < 2; i++) {
3320 struct net_device *dev = hw->dev[i]; 3251 struct net_device *dev = hw->dev[i];
3321 3252
3322 if (dev) { 3253 if (dev) {
@@ -3331,7 +3262,7 @@ static int skge_suspend(struct pci_dev *pdev, u32 state)
3331 } 3262 }
3332 3263
3333 pci_save_state(pdev); 3264 pci_save_state(pdev);
3334 pci_enable_wake(pdev, state, wol); 3265 pci_enable_wake(pdev, pci_choose_state(pdev, state), wol);
3335 pci_disable_device(pdev); 3266 pci_disable_device(pdev);
3336 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3267 pci_set_power_state(pdev, pci_choose_state(pdev, state));
3337 3268
@@ -3349,11 +3280,11 @@ static int skge_resume(struct pci_dev *pdev)
3349 3280
3350 skge_reset(hw); 3281 skge_reset(hw);
3351 3282
3352 for(i = 0; i < 2; i++) { 3283 for (i = 0; i < 2; i++) {
3353 struct net_device *dev = hw->dev[i]; 3284 struct net_device *dev = hw->dev[i];
3354 if (dev) { 3285 if (dev) {
3355 netif_device_attach(dev); 3286 netif_device_attach(dev);
3356 if(netif_running(dev)) 3287 if (netif_running(dev))
3357 skge_up(dev); 3288 skge_up(dev);
3358 } 3289 }
3359 } 3290 }
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index 36c62b68fab4..b432f1bb8168 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -7,31 +7,7 @@
7/* PCI config registers */ 7/* PCI config registers */
8#define PCI_DEV_REG1 0x40 8#define PCI_DEV_REG1 0x40
9#define PCI_DEV_REG2 0x44 9#define PCI_DEV_REG2 0x44
10#ifndef PCI_VPD 10#define PCI_REV_DESC 0x4
11#define PCI_VPD 0x50
12#endif
13
14/* PCI_OUR_REG_2 32 bit Our Register 2 */
15enum {
16 PCI_VPD_WR_THR = 0xff<<24, /* Bit 31..24: VPD Write Threshold */
17 PCI_DEV_SEL = 0x7f<<17, /* Bit 23..17: EEPROM Device Select */
18 PCI_VPD_ROM_SZ = 7 <<14, /* Bit 16..14: VPD ROM Size */
19 /* Bit 13..12: reserved */
20 PCI_EN_DUMMY_RD = 1<<3, /* Enable Dummy Read */
21 PCI_REV_DESC = 1<<2, /* Reverse Desc. Bytes */
22 PCI_USEDATA64 = 1<<0, /* Use 64Bit Data bus ext */
23};
24
25/* PCI_VPD_ADR_REG 16 bit VPD Address Register */
26enum {
27 PCI_VPD_FLAG = 1<<15, /* starts VPD rd/wr cycle */
28 PCI_VPD_ADR_MSK =0x7fffL, /* Bit 14.. 0: VPD Address Mask */
29 VPD_RES_ID = 0x82,
30 VPD_RES_READ = 0x90,
31 VPD_RES_WRITE = 0x81,
32 VPD_RES_END = 0x78,
33};
34
35 11
36#define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ 12#define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
37 PCI_STATUS_SIG_SYSTEM_ERROR | \ 13 PCI_STATUS_SIG_SYSTEM_ERROR | \
@@ -39,7 +15,6 @@ enum {
39 PCI_STATUS_REC_TARGET_ABORT | \ 15 PCI_STATUS_REC_TARGET_ABORT | \
40 PCI_STATUS_PARITY) 16 PCI_STATUS_PARITY)
41 17
42
43enum csr_regs { 18enum csr_regs {
44 B0_RAP = 0x0000, 19 B0_RAP = 0x0000,
45 B0_CTST = 0x0004, 20 B0_CTST = 0x0004,
@@ -229,8 +204,11 @@ enum {
229 IS_XA2_F = 1<<1, /* Q_XA2 End of Frame */ 204 IS_XA2_F = 1<<1, /* Q_XA2 End of Frame */
230 IS_XA2_C = 1<<0, /* Q_XA2 Encoding Error */ 205 IS_XA2_C = 1<<0, /* Q_XA2 Encoding Error */
231 206
232 IS_PORT_1 = IS_XA1_F| IS_R1_F| IS_MAC1, 207 IS_TO_PORT1 = IS_PA_TO_RX1 | IS_PA_TO_TX1,
233 IS_PORT_2 = IS_XA2_F| IS_R2_F| IS_MAC2, 208 IS_TO_PORT2 = IS_PA_TO_RX2 | IS_PA_TO_TX2,
209
210 IS_PORT_1 = IS_XA1_F| IS_R1_F | IS_TO_PORT1 | IS_MAC1,
211 IS_PORT_2 = IS_XA2_F| IS_R2_F | IS_TO_PORT2 | IS_MAC2,
234}; 212};
235 213
236 214
@@ -288,14 +266,6 @@ enum {
288 CHIP_REV_YU_LITE_A3 = 7, /* Chip Rev. for YUKON-Lite A3 */ 266 CHIP_REV_YU_LITE_A3 = 7, /* Chip Rev. for YUKON-Lite A3 */
289}; 267};
290 268
291/* B2_LD_TEST 8 bit EPROM loader test register */
292enum {
293 LD_T_ON = 1<<3, /* Loader Test mode on */
294 LD_T_OFF = 1<<2, /* Loader Test mode off */
295 LD_T_STEP = 1<<1, /* Decrement FPROM addr. Counter */
296 LD_START = 1<<0, /* Start loading FPROM */
297};
298
299/* B2_TI_CTRL 8 bit Timer control */ 269/* B2_TI_CTRL 8 bit Timer control */
300/* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */ 270/* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */
301enum { 271enum {
@@ -313,16 +283,6 @@ enum {
313 TIM_T_STEP = 1<<0, /* Test step */ 283 TIM_T_STEP = 1<<0, /* Test step */
314}; 284};
315 285
316/* B28_DPT_INI 32 bit Descriptor Poll Timer Init Val */
317/* B28_DPT_VAL 32 bit Descriptor Poll Timer Curr Val */
318/* B28_DPT_CTRL 8 bit Descriptor Poll Timer Ctrl Reg */
319enum {
320 DPT_MSK = 0x00ffffffL, /* Bit 23.. 0: Desc Poll Timer Bits */
321
322 DPT_START = 1<<1, /* Start Descriptor Poll Timer */
323 DPT_STOP = 1<<0, /* Stop Descriptor Poll Timer */
324};
325
326/* B2_GP_IO 32 bit General Purpose I/O Register */ 286/* B2_GP_IO 32 bit General Purpose I/O Register */
327enum { 287enum {
328 GP_DIR_9 = 1<<25, /* IO_9 direct, 0=In/1=Out */ 288 GP_DIR_9 = 1<<25, /* IO_9 direct, 0=In/1=Out */
@@ -348,30 +308,6 @@ enum {
348 GP_IO_0 = 1<<0, /* IO_0 pin */ 308 GP_IO_0 = 1<<0, /* IO_0 pin */
349}; 309};
350 310
351/* Rx/Tx Path related Arbiter Test Registers */
352/* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */
353/* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */
354/* B3_PA_TEST 16 bit Packet Arbiter Test Register */
355/* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */
356enum {
357 TX2_T_EV = 1<<15,/* TX2 Timeout/Recv Event occured */
358 TX2_T_ON = 1<<14,/* TX2 Timeout/Recv Timer Test On */
359 TX2_T_OFF = 1<<13,/* TX2 Timeout/Recv Timer Tst Off */
360 TX2_T_STEP = 1<<12,/* TX2 Timeout/Recv Timer Step */
361 TX1_T_EV = 1<<11,/* TX1 Timeout/Recv Event occured */
362 TX1_T_ON = 1<<10,/* TX1 Timeout/Recv Timer Test On */
363 TX1_T_OFF = 1<<9, /* TX1 Timeout/Recv Timer Tst Off */
364 TX1_T_STEP = 1<<8, /* TX1 Timeout/Recv Timer Step */
365 RX2_T_EV = 1<<7, /* RX2 Timeout/Recv Event occured */
366 RX2_T_ON = 1<<6, /* RX2 Timeout/Recv Timer Test On */
367 RX2_T_OFF = 1<<5, /* RX2 Timeout/Recv Timer Tst Off */
368 RX2_T_STEP = 1<<4, /* RX2 Timeout/Recv Timer Step */
369 RX1_T_EV = 1<<3, /* RX1 Timeout/Recv Event occured */
370 RX1_T_ON = 1<<2, /* RX1 Timeout/Recv Timer Test On */
371 RX1_T_OFF = 1<<1, /* RX1 Timeout/Recv Timer Tst Off */
372 RX1_T_STEP = 1<<0, /* RX1 Timeout/Recv Timer Step */
373};
374
375/* Descriptor Bit Definition */ 311/* Descriptor Bit Definition */
376/* TxCtrl Transmit Buffer Control Field */ 312/* TxCtrl Transmit Buffer Control Field */
377/* RxCtrl Receive Buffer Control Field */ 313/* RxCtrl Receive Buffer Control Field */
@@ -428,14 +364,6 @@ enum {
428 RI_RST_SET = 1<<0, /* Set RAM Interface Reset */ 364 RI_RST_SET = 1<<0, /* Set RAM Interface Reset */
429}; 365};
430 366
431/* B3_RI_TEST 8 bit RAM Iface Test Register */
432enum {
433 RI_T_EV = 1<<3, /* Timeout Event occured */
434 RI_T_ON = 1<<2, /* Timeout Timer Test On */
435 RI_T_OFF = 1<<1, /* Timeout Timer Test Off */
436 RI_T_STEP = 1<<0, /* Timeout Timer Step */
437};
438
439/* MAC Arbiter Registers */ 367/* MAC Arbiter Registers */
440/* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */ 368/* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */
441enum { 369enum {
@@ -452,19 +380,6 @@ enum {
452#define SK_PKT_TO_MAX 0xffff /* Maximum value */ 380#define SK_PKT_TO_MAX 0xffff /* Maximum value */
453#define SK_RI_TO_53 36 /* RAM interface timeout */ 381#define SK_RI_TO_53 36 /* RAM interface timeout */
454 382
455
456/* B3_MA_RC_CTRL 16 bit MAC Arbiter Recovery Ctrl Reg */
457enum {
458 MA_ENA_REC_TX2 = 1<<7, /* Enable Recovery Timer TX2 */
459 MA_DIS_REC_TX2 = 1<<6, /* Disable Recovery Timer TX2 */
460 MA_ENA_REC_TX1 = 1<<5, /* Enable Recovery Timer TX1 */
461 MA_DIS_REC_TX1 = 1<<4, /* Disable Recovery Timer TX1 */
462 MA_ENA_REC_RX2 = 1<<3, /* Enable Recovery Timer RX2 */
463 MA_DIS_REC_RX2 = 1<<2, /* Disable Recovery Timer RX2 */
464 MA_ENA_REC_RX1 = 1<<1, /* Enable Recovery Timer RX1 */
465 MA_DIS_REC_RX1 = 1<<0, /* Disable Recovery Timer RX1 */
466};
467
468/* Packet Arbiter Registers */ 383/* Packet Arbiter Registers */
469/* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ 384/* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */
470enum { 385enum {
@@ -488,7 +403,7 @@ enum {
488 PA_ENA_TO_TX1 | PA_ENA_TO_TX2) 403 PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
489 404
490 405
491/* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */ 406/* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */
492/* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */ 407/* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */
493/* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */ 408/* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */
494/* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */ 409/* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */
@@ -511,7 +426,7 @@ enum {
511/* 426/*
512 * Bank 4 - 5 427 * Bank 4 - 5
513 */ 428 */
514/* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */ 429/* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */
515enum { 430enum {
516 TXA_ITI_INI = 0x0200,/* 32 bit Tx Arb Interval Timer Init Val*/ 431 TXA_ITI_INI = 0x0200,/* 32 bit Tx Arb Interval Timer Init Val*/
517 TXA_ITI_VAL = 0x0204,/* 32 bit Tx Arb Interval Timer Value */ 432 TXA_ITI_VAL = 0x0204,/* 32 bit Tx Arb Interval Timer Value */
@@ -537,7 +452,7 @@ enum {
537 452
538/* Queue Register Offsets, use Q_ADDR() to access */ 453/* Queue Register Offsets, use Q_ADDR() to access */
539enum { 454enum {
540 B8_Q_REGS = 0x0400, /* base of Queue registers */ 455 B8_Q_REGS = 0x0400, /* base of Queue registers */
541 Q_D = 0x00, /* 8*32 bit Current Descriptor */ 456 Q_D = 0x00, /* 8*32 bit Current Descriptor */
542 Q_DA_L = 0x20, /* 32 bit Current Descriptor Address Low dWord */ 457 Q_DA_L = 0x20, /* 32 bit Current Descriptor Address Low dWord */
543 Q_DA_H = 0x24, /* 32 bit Current Descriptor Address High dWord */ 458 Q_DA_H = 0x24, /* 32 bit Current Descriptor Address High dWord */
@@ -618,8 +533,7 @@ enum {
618enum { 533enum {
619 PHY_ADDR_XMAC = 0<<8, 534 PHY_ADDR_XMAC = 0<<8,
620 PHY_ADDR_BCOM = 1<<8, 535 PHY_ADDR_BCOM = 1<<8,
621 PHY_ADDR_LONE = 3<<8, 536
622 PHY_ADDR_NAT = 0<<8,
623/* GPHY address (bits 15..11 of SMI control reg) */ 537/* GPHY address (bits 15..11 of SMI control reg) */
624 PHY_ADDR_MARV = 0, 538 PHY_ADDR_MARV = 0,
625}; 539};
@@ -986,7 +900,7 @@ enum {
986 LINKLED_BLINK_OFF = 0x10, 900 LINKLED_BLINK_OFF = 0x10,
987 LINKLED_BLINK_ON = 0x20, 901 LINKLED_BLINK_ON = 0x20,
988}; 902};
989 903
990/* GMAC and GPHY Control Registers (YUKON only) */ 904/* GMAC and GPHY Control Registers (YUKON only) */
991enum { 905enum {
992 GMAC_CTRL = 0x0f00,/* 32 bit GMAC Control Reg */ 906 GMAC_CTRL = 0x0f00,/* 32 bit GMAC Control Reg */
@@ -1151,54 +1065,6 @@ enum {
1151 PHY_MARV_FE_SPEC_2 = 0x1c,/* 16 bit r/w Specific Control Reg. 2 */ 1065 PHY_MARV_FE_SPEC_2 = 0x1c,/* 16 bit r/w Specific Control Reg. 2 */
1152}; 1066};
1153 1067
1154/* Level One-PHY Registers, indirect addressed over XMAC */
1155enum {
1156 PHY_LONE_CTRL = 0x00,/* 16 bit r/w PHY Control Register */
1157 PHY_LONE_STAT = 0x01,/* 16 bit r/o PHY Status Register */
1158 PHY_LONE_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */
1159 PHY_LONE_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */
1160 PHY_LONE_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
1161 PHY_LONE_AUNE_LP = 0x05,/* 16 bit r/o Link Part Ability Reg */
1162 PHY_LONE_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
1163 PHY_LONE_NEPG = 0x07,/* 16 bit r/w Next Page Register */
1164 PHY_LONE_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */
1165 /* Level One-specific registers */
1166 PHY_LONE_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */
1167 PHY_LONE_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */
1168 PHY_LONE_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Reg */
1169 PHY_LONE_PORT_CFG = 0x10,/* 16 bit r/w Port Configuration Reg*/
1170 PHY_LONE_Q_STAT = 0x11,/* 16 bit r/o Quick Status Reg */
1171 PHY_LONE_INT_ENAB = 0x12,/* 16 bit r/w Interrupt Enable Reg */
1172 PHY_LONE_INT_STAT = 0x13,/* 16 bit r/o Interrupt Status Reg */
1173 PHY_LONE_LED_CFG = 0x14,/* 16 bit r/w LED Configuration Reg */
1174 PHY_LONE_PORT_CTRL = 0x15,/* 16 bit r/w Port Control Reg */
1175 PHY_LONE_CIM = 0x16,/* 16 bit r/o CIM Reg */
1176};
1177
1178/* National-PHY Registers, indirect addressed over XMAC */
1179enum {
1180 PHY_NAT_CTRL = 0x00,/* 16 bit r/w PHY Control Register */
1181 PHY_NAT_STAT = 0x01,/* 16 bit r/w PHY Status Register */
1182 PHY_NAT_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */
1183 PHY_NAT_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */
1184 PHY_NAT_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
1185 PHY_NAT_AUNE_LP = 0x05,/* 16 bit r/o Link Partner Ability Reg */
1186 PHY_NAT_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
1187 PHY_NAT_NEPG = 0x07,/* 16 bit r/w Next Page Register */
1188 PHY_NAT_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner Reg */
1189 /* National-specific registers */
1190 PHY_NAT_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */
1191 PHY_NAT_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */
1192 PHY_NAT_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Register */
1193 PHY_NAT_EXT_CTRL1 = 0x10,/* 16 bit r/o Extended Control Reg1 */
1194 PHY_NAT_Q_STAT1 = 0x11,/* 16 bit r/o Quick Status Reg1 */
1195 PHY_NAT_10B_OP = 0x12,/* 16 bit r/o 10Base-T Operations Reg */
1196 PHY_NAT_EXT_CTRL2 = 0x13,/* 16 bit r/o Extended Control Reg1 */
1197 PHY_NAT_Q_STAT2 = 0x14,/* 16 bit r/o Quick Status Reg2 */
1198
1199 PHY_NAT_PHY_ADDR = 0x19,/* 16 bit r/o PHY Address Register */
1200};
1201
1202enum { 1068enum {
1203 PHY_CT_RESET = 1<<15, /* Bit 15: (sc) clear all PHY related regs */ 1069 PHY_CT_RESET = 1<<15, /* Bit 15: (sc) clear all PHY related regs */
1204 PHY_CT_LOOP = 1<<14, /* Bit 14: enable Loopback over PHY */ 1070 PHY_CT_LOOP = 1<<14, /* Bit 14: enable Loopback over PHY */
@@ -1253,8 +1119,29 @@ enum {
1253 PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */ 1119 PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */
1254}; 1120};
1255 1121
1122/* Advertisement register bits */
1256enum { 1123enum {
1257 PHY_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */ 1124 PHY_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */
1125 PHY_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */
1126 PHY_AN_RF = 1<<13, /* Bit 13: Remote Fault Bits */
1127
1128 PHY_AN_PAUSE_ASYM = 1<<11,/* Bit 11: Try for asymmetric */
1129 PHY_AN_PAUSE_CAP = 1<<10, /* Bit 10: Try for pause */
1130 PHY_AN_100BASE4 = 1<<9, /* Bit 9: Try for 100mbps 4k packets */
1131 PHY_AN_100FULL = 1<<8, /* Bit 8: Try for 100mbps full-duplex */
1132 PHY_AN_100HALF = 1<<7, /* Bit 7: Try for 100mbps half-duplex */
1133 PHY_AN_10FULL = 1<<6, /* Bit 6: Try for 10mbps full-duplex */
1134 PHY_AN_10HALF = 1<<5, /* Bit 5: Try for 10mbps half-duplex */
1135 PHY_AN_CSMA = 1<<0, /* Bit 0: Only selector supported */
1136 PHY_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/
1137 PHY_AN_FULL = PHY_AN_100FULL | PHY_AN_10FULL | PHY_AN_CSMA,
1138 PHY_AN_ALL = PHY_AN_10HALF | PHY_AN_10FULL |
1139 PHY_AN_100HALF | PHY_AN_100FULL,
1140};
1141
1142/* Xmac Specific */
1143enum {
1144 PHY_X_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */
1258 PHY_X_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */ 1145 PHY_X_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */
1259 PHY_X_AN_RFB = 3<<12,/* Bit 13..12: Remote Fault Bits */ 1146 PHY_X_AN_RFB = 3<<12,/* Bit 13..12: Remote Fault Bits */
1260 1147
@@ -1263,82 +1150,6 @@ enum {
1263 PHY_X_AN_FD = 1<<5, /* Bit 5: Full Duplex */ 1150 PHY_X_AN_FD = 1<<5, /* Bit 5: Full Duplex */
1264}; 1151};
1265 1152
1266enum {
1267 PHY_B_AN_RF = 1<<13, /* Bit 13: Remote Fault */
1268
1269 PHY_B_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */
1270 PHY_B_AN_PC = 1<<10, /* Bit 10: Pause Capable */
1271 PHY_B_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/
1272};
1273
1274enum {
1275 PHY_L_AN_RF = 1<<13, /* Bit 13: Remote Fault */
1276 /* Bit 12: reserved */
1277 PHY_L_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */
1278 PHY_L_AN_PC = 1<<10, /* Bit 10: Pause Capable */
1279
1280 PHY_L_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/
1281};
1282
1283/* PHY_NAT_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement */
1284/* PHY_NAT_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
1285/* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */
1286enum {
1287 PHY_N_AN_RF = 1<<13, /* Bit 13: Remote Fault */
1288
1289 PHY_N_AN_100F = 1<<11, /* Bit 11: 100Base-T2 FD Support */
1290 PHY_N_AN_100H = 1<<10, /* Bit 10: 100Base-T2 HD Support */
1291
1292 PHY_N_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/
1293};
1294
1295/* field type definition for PHY_x_AN_SEL */
1296enum {
1297 PHY_SEL_TYPE = 1, /* 00001 = Ethernet */
1298};
1299
1300enum {
1301 PHY_ANE_LP_NP = 1<<3, /* Bit 3: Link Partner can Next Page */
1302 PHY_ANE_LOC_NP = 1<<2, /* Bit 2: Local PHY can Next Page */
1303 PHY_ANE_RX_PG = 1<<1, /* Bit 1: Page Received */
1304};
1305
1306enum {
1307 PHY_ANE_PAR_DF = 1<<4, /* Bit 4: Parallel Detection Fault */
1308
1309 PHY_ANE_LP_CAP = 1<<0, /* Bit 0: Link Partner Auto-Neg. Cap. */
1310};
1311
1312enum {
1313 PHY_NP_MORE = 1<<15, /* Bit 15: More, Next Pages to follow */
1314 PHY_NP_ACK1 = 1<<14, /* Bit 14: (ro) Ack1, for receiving a message */
1315 PHY_NP_MSG_VAL = 1<<13, /* Bit 13: Message Page valid */
1316 PHY_NP_ACK2 = 1<<12, /* Bit 12: Ack2, comply with msg content */
1317 PHY_NP_TOG = 1<<11, /* Bit 11: Toggle Bit, ensure sync */
1318 PHY_NP_MSG = 0x07ff, /* Bit 10..0: Message from/to Link Partner */
1319};
1320
1321enum {
1322 PHY_X_EX_FD = 1<<15, /* Bit 15: Device Supports Full Duplex */
1323 PHY_X_EX_HD = 1<<14, /* Bit 14: Device Supports Half Duplex */
1324};
1325
1326enum {
1327 PHY_X_RS_PAUSE = 3<<7,/* Bit 8..7: selected Pause Mode */
1328 PHY_X_RS_HD = 1<<6, /* Bit 6: Half Duplex Mode selected */
1329 PHY_X_RS_FD = 1<<5, /* Bit 5: Full Duplex Mode selected */
1330 PHY_X_RS_ABLMIS = 1<<4, /* Bit 4: duplex or pause cap mismatch */
1331 PHY_X_RS_PAUMIS = 1<<3, /* Bit 3: pause capability mismatch */
1332};
1333
1334/** Remote Fault Bits (PHY_X_AN_RFB) encoding */
1335enum {
1336 X_RFB_OK = 0<<12,/* Bit 13..12 No errors, Link OK */
1337 X_RFB_LF = 1<<12, /* Bit 13..12 Link Failure */
1338 X_RFB_OFF = 2<<12,/* Bit 13..12 Offline */
1339 X_RFB_AN_ERR = 3<<12,/* Bit 13..12 Auto-Negotiation Error */
1340};
1341
1342/* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */ 1153/* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */
1343enum { 1154enum {
1344 PHY_X_P_NO_PAUSE = 0<<7,/* Bit 8..7: no Pause Mode */ 1155 PHY_X_P_NO_PAUSE = 0<<7,/* Bit 8..7: no Pause Mode */
@@ -1418,6 +1229,16 @@ enum {
1418 PHY_B_PES_MLT3_ER = 1<<0, /* Bit 0: MLT3 code Error */ 1229 PHY_B_PES_MLT3_ER = 1<<0, /* Bit 0: MLT3 code Error */
1419}; 1230};
1420 1231
1232/* PHY_BCOM_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
1233/* PHY_BCOM_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
1234enum {
1235 PHY_B_AN_RF = 1<<13, /* Bit 13: Remote Fault */
1236
1237 PHY_B_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */
1238 PHY_B_AN_PC = 1<<10, /* Bit 10: Pause Capable */
1239};
1240
1241
1421/***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/ 1242/***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/
1422enum { 1243enum {
1423 PHY_B_FC_CTR = 0xff, /* Bit 7..0: False Carrier Counter */ 1244 PHY_B_FC_CTR = 0xff, /* Bit 7..0: False Carrier Counter */
@@ -1478,7 +1299,9 @@ enum {
1478 PHY_B_IS_LST_CHANGE = 1<<1, /* Bit 1: Link Status Changed */ 1299 PHY_B_IS_LST_CHANGE = 1<<1, /* Bit 1: Link Status Changed */
1479 PHY_B_IS_CRC_ER = 1<<0, /* Bit 0: CRC Error */ 1300 PHY_B_IS_CRC_ER = 1<<0, /* Bit 0: CRC Error */
1480}; 1301};
1481#define PHY_B_DEF_MSK (~(PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) 1302#define PHY_B_DEF_MSK \
1303 (~(PHY_B_IS_PSE | PHY_B_IS_AN_PR | PHY_B_IS_DUP_CHANGE | \
1304 PHY_B_IS_LSP_CHANGE | PHY_B_IS_LST_CHANGE))
1482 1305
1483/* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */ 1306/* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */
1484enum { 1307enum {
@@ -1495,166 +1318,6 @@ enum {
1495 PHY_B_RES_1000HD = 6<<8,/* Bit 10..8: 1000Base-T Half Dup. */ 1318 PHY_B_RES_1000HD = 6<<8,/* Bit 10..8: 1000Base-T Half Dup. */
1496}; 1319};
1497 1320
1498/*
1499 * Level One-Specific
1500 */
1501/***** PHY_LONE_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
1502enum {
1503 PHY_L_1000C_TEST = 7<<13,/* Bit 15..13: Test Modes */
1504 PHY_L_1000C_MSE = 1<<12, /* Bit 12: Master/Slave Enable */
1505 PHY_L_1000C_MSC = 1<<11, /* Bit 11: M/S Configuration */
1506 PHY_L_1000C_RD = 1<<10, /* Bit 10: Repeater/DTE */
1507 PHY_L_1000C_AFD = 1<<9, /* Bit 9: Advertise Full Duplex */
1508 PHY_L_1000C_AHD = 1<<8, /* Bit 8: Advertise Half Duplex */
1509};
1510
1511/***** PHY_LONE_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
1512enum {
1513 PHY_L_1000S_MSF = 1<<15, /* Bit 15: Master/Slave Fault */
1514 PHY_L_1000S_MSR = 1<<14, /* Bit 14: Master/Slave Result */
1515 PHY_L_1000S_LRS = 1<<13, /* Bit 13: Local Receiver Status */
1516 PHY_L_1000S_RRS = 1<<12, /* Bit 12: Remote Receiver Status */
1517 PHY_L_1000S_LP_FD = 1<<11, /* Bit 11: Link Partner can FD */
1518 PHY_L_1000S_LP_HD = 1<<10, /* Bit 10: Link Partner can HD */
1519
1520 PHY_L_1000S_IEC = 0xff, /* Bit 7..0: Idle Error Count */
1521
1522/***** PHY_LONE_EXT_STAT 16 bit r/o Extended Status Register *****/
1523 PHY_L_ES_X_FD_CAP = 1<<15, /* Bit 15: 1000Base-X FD capable */
1524 PHY_L_ES_X_HD_CAP = 1<<14, /* Bit 14: 1000Base-X HD capable */
1525 PHY_L_ES_T_FD_CAP = 1<<13, /* Bit 13: 1000Base-T FD capable */
1526 PHY_L_ES_T_HD_CAP = 1<<12, /* Bit 12: 1000Base-T HD capable */
1527};
1528
1529/***** PHY_LONE_PORT_CFG 16 bit r/w Port Configuration Reg *****/
1530enum {
1531 PHY_L_PC_REP_MODE = 1<<15, /* Bit 15: Repeater Mode */
1532
1533 PHY_L_PC_TX_DIS = 1<<13, /* Bit 13: Tx output Disabled */
1534 PHY_L_PC_BY_SCR = 1<<12, /* Bit 12: Bypass Scrambler */
1535 PHY_L_PC_BY_45 = 1<<11, /* Bit 11: Bypass 4B5B-Decoder */
1536 PHY_L_PC_JAB_DIS = 1<<10, /* Bit 10: Jabber Disabled */
1537 PHY_L_PC_SQE = 1<<9, /* Bit 9: Enable Heartbeat */
1538 PHY_L_PC_TP_LOOP = 1<<8, /* Bit 8: TP Loopback */
1539 PHY_L_PC_SSS = 1<<7, /* Bit 7: Smart Speed Selection */
1540 PHY_L_PC_FIFO_SIZE = 1<<6, /* Bit 6: FIFO Size */
1541 PHY_L_PC_PRE_EN = 1<<5, /* Bit 5: Preamble Enable */
1542 PHY_L_PC_CIM = 1<<4, /* Bit 4: Carrier Integrity Mon */
1543 PHY_L_PC_10_SER = 1<<3, /* Bit 3: Use Serial Output */
1544 PHY_L_PC_ANISOL = 1<<2, /* Bit 2: Unisolate Port */
1545 PHY_L_PC_TEN_BIT = 1<<1, /* Bit 1: 10bit iface mode on */
1546 PHY_L_PC_ALTCLOCK = 1<<0, /* Bit 0: (ro) ALTCLOCK Mode on */
1547};
1548
1549/***** PHY_LONE_Q_STAT 16 bit r/o Quick Status Reg *****/
1550enum {
1551 PHY_L_QS_D_RATE = 3<<14,/* Bit 15..14: Data Rate */
1552 PHY_L_QS_TX_STAT = 1<<13, /* Bit 13: Transmitting */
1553 PHY_L_QS_RX_STAT = 1<<12, /* Bit 12: Receiving */
1554 PHY_L_QS_COL_STAT = 1<<11, /* Bit 11: Collision */
1555 PHY_L_QS_L_STAT = 1<<10, /* Bit 10: Link is up */
1556 PHY_L_QS_DUP_MOD = 1<<9, /* Bit 9: Full/Half Duplex */
1557 PHY_L_QS_AN = 1<<8, /* Bit 8: AutoNeg is On */
1558 PHY_L_QS_AN_C = 1<<7, /* Bit 7: AN is Complete */
1559 PHY_L_QS_LLE = 7<<4,/* Bit 6..4: Line Length Estim. */
1560 PHY_L_QS_PAUSE = 1<<3, /* Bit 3: LP advertised Pause */
1561 PHY_L_QS_AS_PAUSE = 1<<2, /* Bit 2: LP adv. asym. Pause */
1562 PHY_L_QS_ISOLATE = 1<<1, /* Bit 1: CIM Isolated */
1563 PHY_L_QS_EVENT = 1<<0, /* Bit 0: Event has occurred */
1564};
1565
1566/***** PHY_LONE_INT_ENAB 16 bit r/w Interrupt Enable Reg *****/
1567/***** PHY_LONE_INT_STAT 16 bit r/o Interrupt Status Reg *****/
1568enum {
1569 PHY_L_IS_AN_F = 1<<13, /* Bit 13: Auto-Negotiation fault */
1570 PHY_L_IS_CROSS = 1<<11, /* Bit 11: Crossover used */
1571 PHY_L_IS_POL = 1<<10, /* Bit 10: Polarity correct. used */
1572 PHY_L_IS_SS = 1<<9, /* Bit 9: Smart Speed Downgrade */
1573 PHY_L_IS_CFULL = 1<<8, /* Bit 8: Counter Full */
1574 PHY_L_IS_AN_C = 1<<7, /* Bit 7: AutoNeg Complete */
1575 PHY_L_IS_SPEED = 1<<6, /* Bit 6: Speed Changed */
1576 PHY_L_IS_DUP = 1<<5, /* Bit 5: Duplex Changed */
1577 PHY_L_IS_LS = 1<<4, /* Bit 4: Link Status Changed */
1578 PHY_L_IS_ISOL = 1<<3, /* Bit 3: Isolate Occured */
1579 PHY_L_IS_MDINT = 1<<2, /* Bit 2: (ro) STAT: MII Int Pending */
1580 PHY_L_IS_INTEN = 1<<1, /* Bit 1: ENAB: Enable IRQs */
1581 PHY_L_IS_FORCE = 1<<0, /* Bit 0: ENAB: Force Interrupt */
1582};
1583
1584/* int. mask */
1585#define PHY_L_DEF_MSK (PHY_L_IS_LS | PHY_L_IS_ISOL | PHY_L_IS_INTEN)
1586
1587/***** PHY_LONE_LED_CFG 16 bit r/w LED Configuration Reg *****/
1588enum {
1589 PHY_L_LC_LEDC = 3<<14,/* Bit 15..14: Col/Blink/On/Off */
1590 PHY_L_LC_LEDR = 3<<12,/* Bit 13..12: Rx/Blink/On/Off */
1591 PHY_L_LC_LEDT = 3<<10,/* Bit 11..10: Tx/Blink/On/Off */
1592 PHY_L_LC_LEDG = 3<<8,/* Bit 9..8: Giga/Blink/On/Off */
1593 PHY_L_LC_LEDS = 3<<6,/* Bit 7..6: 10-100/Blink/On/Off */
1594 PHY_L_LC_LEDL = 3<<4,/* Bit 5..4: Link/Blink/On/Off */
1595 PHY_L_LC_LEDF = 3<<2,/* Bit 3..2: Duplex/Blink/On/Off */
1596 PHY_L_LC_PSTRECH= 1<<1, /* Bit 1: Strech LED Pulses */
1597 PHY_L_LC_FREQ = 1<<0, /* Bit 0: 30/100 ms */
1598};
1599
1600/***** PHY_LONE_PORT_CTRL 16 bit r/w Port Control Reg *****/
1601enum {
1602 PHY_L_PC_TX_TCLK = 1<<15, /* Bit 15: Enable TX_TCLK */
1603 PHY_L_PC_ALT_NP = 1<<13, /* Bit 14: Alternate Next Page */
1604 PHY_L_PC_GMII_ALT= 1<<12, /* Bit 13: Alternate GMII driver */
1605 PHY_L_PC_TEN_CRS = 1<<10, /* Bit 10: Extend CRS*/
1606};
1607
1608/***** PHY_LONE_CIM 16 bit r/o CIM Reg *****/
1609enum {
1610 PHY_L_CIM_ISOL = 0xff<<8,/* Bit 15..8: Isolate Count */
1611 PHY_L_CIM_FALSE_CAR = 0xff, /* Bit 7..0: False Carrier Count */
1612};
1613
1614/*
1615 * Pause Bits (PHY_L_AN_ASP and PHY_L_AN_PC) encoding
1616 */
1617enum {
1618 PHY_L_P_NO_PAUSE= 0<<10,/* Bit 11..10: no Pause Mode */
1619 PHY_L_P_SYM_MD = 1<<10, /* Bit 11..10: symmetric Pause Mode */
1620 PHY_L_P_ASYM_MD = 2<<10,/* Bit 11..10: asymmetric Pause Mode */
1621 PHY_L_P_BOTH_MD = 3<<10,/* Bit 11..10: both Pause Mode */
1622};
1623
1624/*
1625 * National-Specific
1626 */
1627/***** PHY_NAT_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
1628enum {
1629 PHY_N_1000C_TEST= 7<<13,/* Bit 15..13: Test Modes */
1630 PHY_N_1000C_MSE = 1<<12, /* Bit 12: Master/Slave Enable */
1631 PHY_N_1000C_MSC = 1<<11, /* Bit 11: M/S Configuration */
1632 PHY_N_1000C_RD = 1<<10, /* Bit 10: Repeater/DTE */
1633 PHY_N_1000C_AFD = 1<<9, /* Bit 9: Advertise Full Duplex */
1634 PHY_N_1000C_AHD = 1<<8, /* Bit 8: Advertise Half Duplex */
1635 PHY_N_1000C_APC = 1<<7, /* Bit 7: Asymmetric Pause Cap. */};
1636
1637
1638/***** PHY_NAT_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
1639enum {
1640 PHY_N_1000S_MSF = 1<<15, /* Bit 15: Master/Slave Fault */
1641 PHY_N_1000S_MSR = 1<<14, /* Bit 14: Master/Slave Result */
1642 PHY_N_1000S_LRS = 1<<13, /* Bit 13: Local Receiver Status */
1643 PHY_N_1000S_RRS = 1<<12, /* Bit 12: Remote Receiver Status*/
1644 PHY_N_1000S_LP_FD= 1<<11, /* Bit 11: Link Partner can FD */
1645 PHY_N_1000S_LP_HD= 1<<10, /* Bit 10: Link Partner can HD */
1646 PHY_N_1000C_LP_APC= 1<<9, /* Bit 9: LP Asym. Pause Cap. */
1647 PHY_N_1000S_IEC = 0xff, /* Bit 7..0: Idle Error Count */
1648};
1649
1650/***** PHY_NAT_EXT_STAT 16 bit r/o Extended Status Register *****/
1651enum {
1652 PHY_N_ES_X_FD_CAP= 1<<15, /* Bit 15: 1000Base-X FD capable */
1653 PHY_N_ES_X_HD_CAP= 1<<14, /* Bit 14: 1000Base-X HD capable */
1654 PHY_N_ES_T_FD_CAP= 1<<13, /* Bit 13: 1000Base-T FD capable */
1655 PHY_N_ES_T_HD_CAP= 1<<12, /* Bit 12: 1000Base-T HD capable */
1656};
1657
1658/** Marvell-Specific */ 1321/** Marvell-Specific */
1659enum { 1322enum {
1660 PHY_M_AN_NXT_PG = 1<<15, /* Request Next Page */ 1323 PHY_M_AN_NXT_PG = 1<<15, /* Request Next Page */
@@ -1718,7 +1381,7 @@ enum {
1718 PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ 1381 PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */
1719}; 1382};
1720 1383
1721#define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK) 1384#define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK)
1722 1385
1723enum { 1386enum {
1724 PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ 1387 PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */
@@ -1786,10 +1449,12 @@ enum {
1786 PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */ 1449 PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */
1787 PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */ 1450 PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */
1788 PHY_M_IS_JABBER = 1<<0, /* Jabber */ 1451 PHY_M_IS_JABBER = 1<<0, /* Jabber */
1789};
1790 1452
1791#define PHY_M_DEF_MSK ( PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE | \ 1453 PHY_M_IS_DEF_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE |
1792 PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR) 1454 PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR,
1455
1456 PHY_M_IS_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL,
1457};
1793 1458
1794/***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/ 1459/***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/
1795enum { 1460enum {
@@ -1846,7 +1511,7 @@ enum {
1846 PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ 1511 PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */
1847}; 1512};
1848 1513
1849#define PHY_M_LED_PULS_DUR(x) ( ((x)<<12) & PHY_M_LEDC_PULS_MSK) 1514#define PHY_M_LED_PULS_DUR(x) (((x)<<12) & PHY_M_LEDC_PULS_MSK)
1850 1515
1851enum { 1516enum {
1852 PULS_NO_STR = 0,/* no pulse stretching */ 1517 PULS_NO_STR = 0,/* no pulse stretching */
@@ -1859,7 +1524,7 @@ enum {
1859 PULS_1300MS = 7,/* 1.3 s to 2.7 s */ 1524 PULS_1300MS = 7,/* 1.3 s to 2.7 s */
1860}; 1525};
1861 1526
1862#define PHY_M_LED_BLINK_RT(x) ( ((x)<<8) & PHY_M_LEDC_BL_R_MSK) 1527#define PHY_M_LED_BLINK_RT(x) (((x)<<8) & PHY_M_LEDC_BL_R_MSK)
1863 1528
1864enum { 1529enum {
1865 BLINK_42MS = 0,/* 42 ms */ 1530 BLINK_42MS = 0,/* 42 ms */
@@ -1939,9 +1604,9 @@ enum {
1939 PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ 1604 PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */
1940}; 1605};
1941 1606
1942#define PHY_M_FELP_LED2_CTRL(x) ( ((x)<<8) & PHY_M_FELP_LED2_MSK) 1607#define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK)
1943#define PHY_M_FELP_LED1_CTRL(x) ( ((x)<<4) & PHY_M_FELP_LED1_MSK) 1608#define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK)
1944#define PHY_M_FELP_LED0_CTRL(x) ( ((x)<<0) & PHY_M_FELP_LED0_MSK) 1609#define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK)
1945 1610
1946enum { 1611enum {
1947 LED_PAR_CTRL_COLX = 0x00, 1612 LED_PAR_CTRL_COLX = 0x00,
@@ -1977,7 +1642,7 @@ enum {
1977 PHY_M_MAC_MD_COPPER = 5,/* Copper only */ 1642 PHY_M_MAC_MD_COPPER = 5,/* Copper only */
1978 PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */ 1643 PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */
1979}; 1644};
1980#define PHY_M_MAC_MODE_SEL(x) ( ((x)<<7) & PHY_M_MAC_MD_MSK) 1645#define PHY_M_MAC_MODE_SEL(x) (((x)<<7) & PHY_M_MAC_MD_MSK)
1981 1646
1982/***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ 1647/***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/
1983enum { 1648enum {
@@ -1987,10 +1652,10 @@ enum {
1987 PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ 1652 PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */
1988}; 1653};
1989 1654
1990#define PHY_M_LEDC_LOS_CTRL(x) ( ((x)<<12) & PHY_M_LEDC_LOS_MSK) 1655#define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK)
1991#define PHY_M_LEDC_INIT_CTRL(x) ( ((x)<<8) & PHY_M_LEDC_INIT_MSK) 1656#define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK)
1992#define PHY_M_LEDC_STA1_CTRL(x) ( ((x)<<4) & PHY_M_LEDC_STA1_MSK) 1657#define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK)
1993#define PHY_M_LEDC_STA0_CTRL(x) ( ((x)<<0) & PHY_M_LEDC_STA0_MSK) 1658#define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK)
1994 1659
1995/* GMAC registers */ 1660/* GMAC registers */
1996/* Port Registers */ 1661/* Port Registers */
@@ -2105,7 +1770,7 @@ enum {
2105 GM_GPSR_FC_RX_DIS = 1<<2, /* Bit 2: Rx Flow-Control Mode Disabled */ 1770 GM_GPSR_FC_RX_DIS = 1<<2, /* Bit 2: Rx Flow-Control Mode Disabled */
2106 GM_GPSR_PROM_EN = 1<<1, /* Bit 1: Promiscuous Mode Enabled */ 1771 GM_GPSR_PROM_EN = 1<<1, /* Bit 1: Promiscuous Mode Enabled */
2107}; 1772};
2108 1773
2109/* GM_GP_CTRL 16 bit r/w General Purpose Control Register */ 1774/* GM_GP_CTRL 16 bit r/w General Purpose Control Register */
2110enum { 1775enum {
2111 GM_GPCR_PROM_ENA = 1<<14, /* Bit 14: Enable Promiscuous Mode */ 1776 GM_GPCR_PROM_ENA = 1<<14, /* Bit 14: Enable Promiscuous Mode */
@@ -2127,7 +1792,7 @@ enum {
2127 1792
2128#define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100) 1793#define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
2129#define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS) 1794#define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS)
2130 1795
2131/* GM_TX_CTRL 16 bit r/w Transmit Control Register */ 1796/* GM_TX_CTRL 16 bit r/w Transmit Control Register */
2132enum { 1797enum {
2133 GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ 1798 GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */
@@ -2138,7 +1803,7 @@ enum {
2138 1803
2139#define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) 1804#define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK)
2140#define TX_COL_DEF 0x04 1805#define TX_COL_DEF 0x04
2141 1806
2142/* GM_RX_CTRL 16 bit r/w Receive Control Register */ 1807/* GM_RX_CTRL 16 bit r/w Receive Control Register */
2143enum { 1808enum {
2144 GM_RXCR_UCF_ENA = 1<<15, /* Bit 15: Enable Unicast filtering */ 1809 GM_RXCR_UCF_ENA = 1<<15, /* Bit 15: Enable Unicast filtering */
@@ -2146,7 +1811,7 @@ enum {
2146 GM_RXCR_CRC_DIS = 1<<13, /* Bit 13: Remove 4-byte CRC */ 1811 GM_RXCR_CRC_DIS = 1<<13, /* Bit 13: Remove 4-byte CRC */
2147 GM_RXCR_PASS_FC = 1<<12, /* Bit 12: Pass FC packets to FIFO */ 1812 GM_RXCR_PASS_FC = 1<<12, /* Bit 12: Pass FC packets to FIFO */
2148}; 1813};
2149 1814
2150/* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */ 1815/* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */
2151enum { 1816enum {
2152 GM_TXPA_JAMLEN_MSK = 0x03<<14, /* Bit 15..14: Jam Length */ 1817 GM_TXPA_JAMLEN_MSK = 0x03<<14, /* Bit 15..14: Jam Length */
@@ -2171,7 +1836,7 @@ enum {
2171 GM_SMOD_JUMBO_ENA = 1<<8, /* Bit 8: Enable Jumbo (Max. Frame Len) */ 1836 GM_SMOD_JUMBO_ENA = 1<<8, /* Bit 8: Enable Jumbo (Max. Frame Len) */
2172 GM_SMOD_IPG_MSK = 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */ 1837 GM_SMOD_IPG_MSK = 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */
2173}; 1838};
2174 1839
2175#define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) 1840#define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK)
2176#define DATA_BLIND_DEF 0x04 1841#define DATA_BLIND_DEF 0x04
2177 1842
@@ -2186,7 +1851,7 @@ enum {
2186 GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */ 1851 GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */
2187 GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ 1852 GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */
2188}; 1853};
2189 1854
2190#define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK) 1855#define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK)
2191#define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK) 1856#define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK)
2192 1857
@@ -2195,7 +1860,7 @@ enum {
2195 GM_PAR_MIB_CLR = 1<<5, /* Bit 5: Set MIB Clear Counter Mode */ 1860 GM_PAR_MIB_CLR = 1<<5, /* Bit 5: Set MIB Clear Counter Mode */
2196 GM_PAR_MIB_TST = 1<<4, /* Bit 4: MIB Load Counter (Test Mode) */ 1861 GM_PAR_MIB_TST = 1<<4, /* Bit 4: MIB Load Counter (Test Mode) */
2197}; 1862};
2198 1863
2199/* Receive Frame Status Encoding */ 1864/* Receive Frame Status Encoding */
2200enum { 1865enum {
2201 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ 1866 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */
@@ -2217,12 +1882,12 @@ enum {
2217/* 1882/*
2218 * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR) 1883 * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR)
2219 */ 1884 */
2220 GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR | 1885 GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR |
2221 GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | 1886 GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC |
2222 GMR_FS_JABBER, 1887 GMR_FS_JABBER,
2223/* Rx GMAC FIFO Flush Mask (default) */ 1888/* Rx GMAC FIFO Flush Mask (default) */
2224 RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR | 1889 RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR |
2225 GMR_FS_BAD_FC | GMR_FS_GOOD_FC | GMR_FS_UN_SIZE | 1890 GMR_FS_BAD_FC | GMR_FS_GOOD_FC | GMR_FS_UN_SIZE |
2226 GMR_FS_JABBER, 1891 GMR_FS_JABBER,
2227}; 1892};
2228 1893
@@ -2540,10 +2205,6 @@ enum {
2540}; 2205};
2541 2206
2542 2207
2543/* XM_PHY_ADDR 16 bit r/w PHY Address Register */
2544#define XM_PHY_ADDR_SZ 0x1f /* Bit 4..0: PHY Address bits */
2545
2546
2547/* XM_GP_PORT 32 bit r/w General Purpose Port Register */ 2208/* XM_GP_PORT 32 bit r/w General Purpose Port Register */
2548enum { 2209enum {
2549 XM_GP_ANIP = 1<<6, /* Bit 6: (ro) Auto-Neg. in progress */ 2210 XM_GP_ANIP = 1<<6, /* Bit 6: (ro) Auto-Neg. in progress */
@@ -2662,8 +2323,8 @@ enum {
2662}; 2323};
2663 2324
2664#define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I) 2325#define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I)
2665#define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\ 2326#define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\
2666 XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA | XM_MD_CAA) 2327 XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA)
2667 2328
2668/* XM_STAT_CMD 16 bit r/w Statistics Command Register */ 2329/* XM_STAT_CMD 16 bit r/w Statistics Command Register */
2669enum { 2330enum {
@@ -2793,28 +2454,20 @@ struct skge_hw {
2793 u32 intr_mask; 2454 u32 intr_mask;
2794 struct net_device *dev[2]; 2455 struct net_device *dev[2];
2795 2456
2796 u8 mac_cfg;
2797 u8 chip_id; 2457 u8 chip_id;
2458 u8 chip_rev;
2798 u8 phy_type; 2459 u8 phy_type;
2799 u8 pmd_type; 2460 u8 pmd_type;
2800 u16 phy_addr; 2461 u16 phy_addr;
2462 u8 ports;
2801 2463
2802 u32 ram_size; 2464 u32 ram_size;
2803 u32 ram_offset; 2465 u32 ram_offset;
2804 2466
2805 struct tasklet_struct ext_tasklet; 2467 struct tasklet_struct ext_tasklet;
2806 spinlock_t phy_lock; 2468 spinlock_t phy_lock;
2807}; 2469};
2808 2470
2809static inline int isdualport(const struct skge_hw *hw)
2810{
2811 return !(hw->mac_cfg & CFG_SNG_MAC);
2812}
2813
2814static inline u8 chip_rev(const struct skge_hw *hw)
2815{
2816 return (hw->mac_cfg & CFG_CHIP_R_MSK) >> 4;
2817}
2818 2471
2819static inline int iscopper(const struct skge_hw *hw) 2472static inline int iscopper(const struct skge_hw *hw)
2820{ 2473{
@@ -2827,7 +2480,7 @@ enum {
2827 FLOW_MODE_REM_SEND = 2, /* Symmetric or just remote */ 2480 FLOW_MODE_REM_SEND = 2, /* Symmetric or just remote */
2828 FLOW_MODE_SYMMETRIC = 3, /* Both stations may send PAUSE */ 2481 FLOW_MODE_SYMMETRIC = 3, /* Both stations may send PAUSE */
2829}; 2482};
2830 2483
2831struct skge_port { 2484struct skge_port {
2832 u32 msg_enable; 2485 u32 msg_enable;
2833 struct skge_hw *hw; 2486 struct skge_hw *hw;
@@ -2853,9 +2506,7 @@ struct skge_port {
2853 void *mem; /* PCI memory for rings */ 2506 void *mem; /* PCI memory for rings */
2854 dma_addr_t dma; 2507 dma_addr_t dma;
2855 unsigned long mem_size; 2508 unsigned long mem_size;
2856 2509 unsigned int rx_buf_size;
2857 struct timer_list link_check;
2858 struct timer_list led_blink;
2859}; 2510};
2860 2511
2861 2512
@@ -2863,7 +2514,6 @@ struct skge_port {
2863static inline u32 skge_read32(const struct skge_hw *hw, int reg) 2514static inline u32 skge_read32(const struct skge_hw *hw, int reg)
2864{ 2515{
2865 return readl(hw->regs + reg); 2516 return readl(hw->regs + reg);
2866
2867} 2517}
2868 2518
2869static inline u16 skge_read16(const struct skge_hw *hw, int reg) 2519static inline u16 skge_read16(const struct skge_hw *hw, int reg)
@@ -2892,114 +2542,76 @@ static inline void skge_write8(const struct skge_hw *hw, int reg, u8 val)
2892} 2542}
2893 2543
2894/* MAC Related Registers inside the device. */ 2544/* MAC Related Registers inside the device. */
2895#define SKGEMAC_REG(port,reg) (((port)<<7)+(reg)) 2545#define SK_REG(port,reg) (((port)<<7)+(reg))
2896 2546#define SK_XMAC_REG(port, reg) \
2897/* PCI config space can be accessed via memory mapped space */
2898#define SKGEPCI_REG(reg) ((reg)+ 0x380)
2899
2900#define SKGEXM_REG(port, reg) \
2901 ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1) 2547 ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1)
2902 2548
2903static inline u32 skge_xm_read32(const struct skge_hw *hw, int port, int reg) 2549static inline u32 xm_read32(const struct skge_hw *hw, int port, int reg)
2904{
2905 return skge_read32(hw, SKGEXM_REG(port,reg));
2906}
2907
2908static inline u16 skge_xm_read16(const struct skge_hw *hw, int port, int reg)
2909{ 2550{
2910 return skge_read16(hw, SKGEXM_REG(port,reg)); 2551 u32 v;
2552 v = skge_read16(hw, SK_XMAC_REG(port, reg));
2553 v |= (u32)skge_read16(hw, SK_XMAC_REG(port, reg+2)) << 16;
2554 return v;
2911} 2555}
2912 2556
2913static inline u8 skge_xm_read8(const struct skge_hw *hw, int port, int reg) 2557static inline u16 xm_read16(const struct skge_hw *hw, int port, int reg)
2914{ 2558{
2915 return skge_read8(hw, SKGEXM_REG(port,reg)); 2559 return skge_read16(hw, SK_XMAC_REG(port,reg));
2916} 2560}
2917 2561
2918static inline void skge_xm_write32(const struct skge_hw *hw, int port, int r, u32 v) 2562static inline void xm_write32(const struct skge_hw *hw, int port, int r, u32 v)
2919{ 2563{
2920 skge_write32(hw, SKGEXM_REG(port,r), v); 2564 skge_write16(hw, SK_XMAC_REG(port,r), v & 0xffff);
2565 skge_write16(hw, SK_XMAC_REG(port,r+2), v >> 16);
2921} 2566}
2922 2567
2923static inline void skge_xm_write16(const struct skge_hw *hw, int port, int r, u16 v) 2568static inline void xm_write16(const struct skge_hw *hw, int port, int r, u16 v)
2924{ 2569{
2925 skge_write16(hw, SKGEXM_REG(port,r), v); 2570 skge_write16(hw, SK_XMAC_REG(port,r), v);
2926} 2571}
2927 2572
2928static inline void skge_xm_write8(const struct skge_hw *hw, int port, int r, u8 v) 2573static inline void xm_outhash(const struct skge_hw *hw, int port, int reg,
2929{
2930 skge_write8(hw, SKGEXM_REG(port,r), v);
2931}
2932
2933static inline void skge_xm_outhash(const struct skge_hw *hw, int port, int reg,
2934 const u8 *hash) 2574 const u8 *hash)
2935{ 2575{
2936 skge_xm_write16(hw, port, reg, 2576 xm_write16(hw, port, reg, (u16)hash[0] | ((u16)hash[1] << 8));
2937 (u16)hash[0] | ((u16)hash[1] << 8)); 2577 xm_write16(hw, port, reg+2, (u16)hash[2] | ((u16)hash[3] << 8));
2938 skge_xm_write16(hw, port, reg+2, 2578 xm_write16(hw, port, reg+4, (u16)hash[4] | ((u16)hash[5] << 8));
2939 (u16)hash[2] | ((u16)hash[3] << 8)); 2579 xm_write16(hw, port, reg+6, (u16)hash[6] | ((u16)hash[7] << 8));
2940 skge_xm_write16(hw, port, reg+4,
2941 (u16)hash[4] | ((u16)hash[5] << 8));
2942 skge_xm_write16(hw, port, reg+6,
2943 (u16)hash[6] | ((u16)hash[7] << 8));
2944} 2580}
2945 2581
2946static inline void skge_xm_outaddr(const struct skge_hw *hw, int port, int reg, 2582static inline void xm_outaddr(const struct skge_hw *hw, int port, int reg,
2947 const u8 *addr) 2583 const u8 *addr)
2948{ 2584{
2949 skge_xm_write16(hw, port, reg, 2585 xm_write16(hw, port, reg, (u16)addr[0] | ((u16)addr[1] << 8));
2950 (u16)addr[0] | ((u16)addr[1] << 8)); 2586 xm_write16(hw, port, reg+2, (u16)addr[2] | ((u16)addr[3] << 8));
2951 skge_xm_write16(hw, port, reg, 2587 xm_write16(hw, port, reg+4, (u16)addr[4] | ((u16)addr[5] << 8));
2952 (u16)addr[2] | ((u16)addr[3] << 8));
2953 skge_xm_write16(hw, port, reg,
2954 (u16)addr[4] | ((u16)addr[5] << 8));
2955} 2588}
2956 2589
2590#define SK_GMAC_REG(port,reg) \
2591 (BASE_GMAC_1 + (port) * (BASE_GMAC_2-BASE_GMAC_1) + (reg))
2957 2592
2958#define SKGEGMA_REG(port,reg) \ 2593static inline u16 gma_read16(const struct skge_hw *hw, int port, int reg)
2959 ((reg) + BASE_GMAC_1 + \
2960 (port) * (BASE_GMAC_2-BASE_GMAC_1))
2961
2962static inline u16 skge_gma_read16(const struct skge_hw *hw, int port, int reg)
2963{ 2594{
2964 return skge_read16(hw, SKGEGMA_REG(port,reg)); 2595 return skge_read16(hw, SK_GMAC_REG(port,reg));
2965} 2596}
2966 2597
2967static inline u32 skge_gma_read32(const struct skge_hw *hw, int port, int reg) 2598static inline u32 gma_read32(const struct skge_hw *hw, int port, int reg)
2968{ 2599{
2969 return (u32) skge_read16(hw, SKGEGMA_REG(port,reg)) 2600 return (u32) skge_read16(hw, SK_GMAC_REG(port,reg))
2970 | ((u32)skge_read16(hw, SKGEGMA_REG(port,reg+4)) << 16); 2601 | ((u32)skge_read16(hw, SK_GMAC_REG(port,reg+4)) << 16);
2971} 2602}
2972 2603
2973static inline u8 skge_gma_read8(const struct skge_hw *hw, int port, int reg) 2604static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
2974{ 2605{
2975 return skge_read8(hw, SKGEGMA_REG(port,reg)); 2606 skge_write16(hw, SK_GMAC_REG(port,r), v);
2976} 2607}
2977 2608
2978static inline void skge_gma_write16(const struct skge_hw *hw, int port, int r, u16 v) 2609static inline void gma_set_addr(struct skge_hw *hw, int port, int reg,
2979{
2980 skge_write16(hw, SKGEGMA_REG(port,r), v);
2981}
2982
2983static inline void skge_gma_write32(const struct skge_hw *hw, int port, int r, u32 v)
2984{
2985 skge_write16(hw, SKGEGMA_REG(port, r), (u16) v);
2986 skge_write32(hw, SKGEGMA_REG(port, r+4), (u16)(v >> 16));
2987}
2988
2989static inline void skge_gma_write8(const struct skge_hw *hw, int port, int r, u8 v)
2990{
2991 skge_write8(hw, SKGEGMA_REG(port,r), v);
2992}
2993
2994static inline void skge_gm_set_addr(struct skge_hw *hw, int port, int reg,
2995 const u8 *addr) 2610 const u8 *addr)
2996{ 2611{
2997 skge_gma_write16(hw, port, reg, 2612 gma_write16(hw, port, reg, (u16) addr[0] | ((u16) addr[1] << 8));
2998 (u16) addr[0] | ((u16) addr[1] << 8)); 2613 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
2999 skge_gma_write16(hw, port, reg+4, 2614 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
3000 (u16) addr[2] | ((u16) addr[3] << 8));
3001 skge_gma_write16(hw, port, reg+8,
3002 (u16) addr[4] | ((u16) addr[5] << 8));
3003} 2615}
3004 2616
3005#endif 2617#endif
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 8f7841c0374d..404ea4297e32 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -74,6 +74,7 @@
74#include <linux/rtnetlink.h> 74#include <linux/rtnetlink.h>
75#include <linux/if_arp.h> 75#include <linux/if_arp.h>
76#include <linux/if_slip.h> 76#include <linux/if_slip.h>
77#include <linux/delay.h>
77#include <linux/init.h> 78#include <linux/init.h>
78#include "slip.h" 79#include "slip.h"
79#ifdef CONFIG_INET 80#ifdef CONFIG_INET
@@ -198,18 +199,12 @@ err_exit:
198static void 199static void
199sl_free_bufs(struct slip *sl) 200sl_free_bufs(struct slip *sl)
200{ 201{
201 void * tmp;
202
203 /* Free all SLIP frame buffers. */ 202 /* Free all SLIP frame buffers. */
204 tmp = xchg(&sl->rbuff, NULL); 203 kfree(xchg(&sl->rbuff, NULL));
205 kfree(tmp); 204 kfree(xchg(&sl->xbuff, NULL));
206 tmp = xchg(&sl->xbuff, NULL);
207 kfree(tmp);
208#ifdef SL_INCLUDE_CSLIP 205#ifdef SL_INCLUDE_CSLIP
209 tmp = xchg(&sl->cbuff, NULL); 206 kfree(xchg(&sl->cbuff, NULL));
210 kfree(tmp); 207 slhc_free(xchg(&sl->slcomp, NULL));
211 if ((tmp = xchg(&sl->slcomp, NULL)) != NULL)
212 slhc_free(tmp);
213#endif 208#endif
214} 209}
215 210
@@ -1389,10 +1384,8 @@ static void __exit slip_exit(void)
1389 /* First of all: check for active disciplines and hangup them. 1384 /* First of all: check for active disciplines and hangup them.
1390 */ 1385 */
1391 do { 1386 do {
1392 if (busy) { 1387 if (busy)
1393 set_current_state(TASK_INTERRUPTIBLE); 1388 msleep_interruptible(100);
1394 schedule_timeout(HZ / 10);
1395 }
1396 1389
1397 busy = 0; 1390 busy = 0;
1398 for (i = 0; i < slip_maxdev; i++) { 1391 for (i = 0; i < slip_maxdev; i++) {
@@ -1430,7 +1423,7 @@ static void __exit slip_exit(void)
1430 kfree(slip_devs); 1423 kfree(slip_devs);
1431 slip_devs = NULL; 1424 slip_devs = NULL;
1432 1425
1433 if ((i = tty_register_ldisc(N_SLIP, NULL))) 1426 if ((i = tty_unregister_ldisc(N_SLIP)))
1434 { 1427 {
1435 printk(KERN_ERR "SLIP: can't unregister line discipline (err = %d)\n", i); 1428 printk(KERN_ERR "SLIP: can't unregister line discipline (err = %d)\n", i);
1436 } 1429 }
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c
index 990201f42ba0..f00c476064f0 100644
--- a/drivers/net/smc-mca.c
+++ b/drivers/net/smc-mca.c
@@ -49,7 +49,6 @@
49#include <asm/system.h> 49#include <asm/system.h>
50 50
51#include "8390.h" 51#include "8390.h"
52#include "smc-mca.h"
53 52
54#define DRV_NAME "smc-mca" 53#define DRV_NAME "smc-mca"
55 54
@@ -100,6 +99,63 @@ module_param_array(ultra_irq, int, NULL, 0);
100MODULE_PARM_DESC(ultra_io, "SMC Ultra/EtherEZ MCA I/O base address(es)"); 99MODULE_PARM_DESC(ultra_io, "SMC Ultra/EtherEZ MCA I/O base address(es)");
101MODULE_PARM_DESC(ultra_irq, "SMC Ultra/EtherEZ MCA IRQ number(s)"); 100MODULE_PARM_DESC(ultra_irq, "SMC Ultra/EtherEZ MCA IRQ number(s)");
102 101
102static const struct {
103 unsigned int base_addr;
104} addr_table[] = {
105 { 0x0800 },
106 { 0x1800 },
107 { 0x2800 },
108 { 0x3800 },
109 { 0x4800 },
110 { 0x5800 },
111 { 0x6800 },
112 { 0x7800 },
113 { 0x8800 },
114 { 0x9800 },
115 { 0xa800 },
116 { 0xb800 },
117 { 0xc800 },
118 { 0xd800 },
119 { 0xe800 },
120 { 0xf800 }
121};
122
123#define MEM_MASK 64
124
125static const struct {
126 unsigned char mem_index;
127 unsigned long mem_start;
128 unsigned char num_pages;
129} mem_table[] = {
130 { 16, 0x0c0000, 40 },
131 { 18, 0x0c4000, 40 },
132 { 20, 0x0c8000, 40 },
133 { 22, 0x0cc000, 40 },
134 { 24, 0x0d0000, 40 },
135 { 26, 0x0d4000, 40 },
136 { 28, 0x0d8000, 40 },
137 { 30, 0x0dc000, 40 },
138 {144, 0xfc0000, 40 },
139 {148, 0xfc8000, 40 },
140 {154, 0xfd0000, 40 },
141 {156, 0xfd8000, 40 },
142 { 0, 0x0c0000, 20 },
143 { 1, 0x0c2000, 20 },
144 { 2, 0x0c4000, 20 },
145 { 3, 0x0c6000, 20 }
146};
147
148#define IRQ_MASK 243
149static const struct {
150 unsigned char new_irq;
151 unsigned char old_irq;
152} irq_table[] = {
153 { 3, 3 },
154 { 4, 4 },
155 { 10, 10 },
156 { 14, 15 }
157};
158
103static short smc_mca_adapter_ids[] __initdata = { 159static short smc_mca_adapter_ids[] __initdata = {
104 0x61c8, 160 0x61c8,
105 0x61c9, 161 0x61c9,
@@ -126,7 +182,7 @@ static char *smc_mca_adapter_names[] __initdata = {
126 182
127static int ultra_found = 0; 183static int ultra_found = 0;
128 184
129int __init ultramca_probe(struct device *gen_dev) 185static int __init ultramca_probe(struct device *gen_dev)
130{ 186{
131 unsigned short ioaddr; 187 unsigned short ioaddr;
132 struct net_device *dev; 188 struct net_device *dev;
diff --git a/drivers/net/smc-mca.h b/drivers/net/smc-mca.h
deleted file mode 100644
index ac50117a7e84..000000000000
--- a/drivers/net/smc-mca.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * djweis weisd3458@uni.edu
3 * most of this file was taken from ps2esdi.h
4 */
5
6struct {
7 unsigned int base_addr;
8} addr_table[] = {
9 { 0x0800 },
10 { 0x1800 },
11 { 0x2800 },
12 { 0x3800 },
13 { 0x4800 },
14 { 0x5800 },
15 { 0x6800 },
16 { 0x7800 },
17 { 0x8800 },
18 { 0x9800 },
19 { 0xa800 },
20 { 0xb800 },
21 { 0xc800 },
22 { 0xd800 },
23 { 0xe800 },
24 { 0xf800 }
25};
26
27#define MEM_MASK 64
28
29struct {
30 unsigned char mem_index;
31 unsigned long mem_start;
32 unsigned char num_pages;
33} mem_table[] = {
34 { 16, 0x0c0000, 40 },
35 { 18, 0x0c4000, 40 },
36 { 20, 0x0c8000, 40 },
37 { 22, 0x0cc000, 40 },
38 { 24, 0x0d0000, 40 },
39 { 26, 0x0d4000, 40 },
40 { 28, 0x0d8000, 40 },
41 { 30, 0x0dc000, 40 },
42 {144, 0xfc0000, 40 },
43 {148, 0xfc8000, 40 },
44 {154, 0xfd0000, 40 },
45 {156, 0xfd8000, 40 },
46 { 0, 0x0c0000, 20 },
47 { 1, 0x0c2000, 20 },
48 { 2, 0x0c4000, 20 },
49 { 3, 0x0c6000, 20 }
50};
51
52#define IRQ_MASK 243
53struct {
54 unsigned char new_irq;
55 unsigned char old_irq;
56} irq_table[] = {
57 { 3, 3 },
58 { 4, 4 },
59 { 10, 10 },
60 { 14, 15 }
61};
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index b564c677c6d2..6d9dae60a697 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -194,12 +194,7 @@ struct net_device * __init ultra_probe(int unit)
194 err = do_ultra_probe(dev); 194 err = do_ultra_probe(dev);
195 if (err) 195 if (err)
196 goto out; 196 goto out;
197 err = register_netdev(dev);
198 if (err)
199 goto out1;
200 return dev; 197 return dev;
201out1:
202 cleanup_card(dev);
203out: 198out:
204 free_netdev(dev); 199 free_netdev(dev);
205 return ERR_PTR(err); 200 return ERR_PTR(err);
@@ -325,6 +320,9 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
325#endif 320#endif
326 NS8390_init(dev, 0); 321 NS8390_init(dev, 0);
327 322
323 retval = register_netdev(dev);
324 if (retval)
325 goto out;
328 return 0; 326 return 0;
329out: 327out:
330 release_region(ioaddr, ULTRA_IO_EXTENT); 328 release_region(ioaddr, ULTRA_IO_EXTENT);
@@ -583,11 +581,8 @@ init_module(void)
583 dev->irq = irq[this_dev]; 581 dev->irq = irq[this_dev];
584 dev->base_addr = io[this_dev]; 582 dev->base_addr = io[this_dev];
585 if (do_ultra_probe(dev) == 0) { 583 if (do_ultra_probe(dev) == 0) {
586 if (register_netdev(dev) == 0) { 584 dev_ultra[found++] = dev;
587 dev_ultra[found++] = dev; 585 continue;
588 continue;
589 }
590 cleanup_card(dev);
591 } 586 }
592 free_netdev(dev); 587 free_netdev(dev);
593 printk(KERN_WARNING "smc-ultra.c: No SMC Ultra card found (i/o = 0x%x).\n", io[this_dev]); 588 printk(KERN_WARNING "smc-ultra.c: No SMC Ultra card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index fd80048f7f7a..1438fdd20826 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -315,15 +315,25 @@ static void smc_reset(struct net_device *dev)
315 struct smc_local *lp = netdev_priv(dev); 315 struct smc_local *lp = netdev_priv(dev);
316 void __iomem *ioaddr = lp->base; 316 void __iomem *ioaddr = lp->base;
317 unsigned int ctl, cfg; 317 unsigned int ctl, cfg;
318 struct sk_buff *pending_skb;
318 319
319 DBG(2, "%s: %s\n", dev->name, __FUNCTION__); 320 DBG(2, "%s: %s\n", dev->name, __FUNCTION__);
320 321
321 /* Disable all interrupts */ 322 /* Disable all interrupts, block TX tasklet */
322 spin_lock(&lp->lock); 323 spin_lock(&lp->lock);
323 SMC_SELECT_BANK(2); 324 SMC_SELECT_BANK(2);
324 SMC_SET_INT_MASK(0); 325 SMC_SET_INT_MASK(0);
326 pending_skb = lp->pending_tx_skb;
327 lp->pending_tx_skb = NULL;
325 spin_unlock(&lp->lock); 328 spin_unlock(&lp->lock);
326 329
330 /* free any pending tx skb */
331 if (pending_skb) {
332 dev_kfree_skb(pending_skb);
333 lp->stats.tx_errors++;
334 lp->stats.tx_aborted_errors++;
335 }
336
327 /* 337 /*
328 * This resets the registers mostly to defaults, but doesn't 338 * This resets the registers mostly to defaults, but doesn't
329 * affect EEPROM. That seems unnecessary 339 * affect EEPROM. That seems unnecessary
@@ -389,14 +399,6 @@ static void smc_reset(struct net_device *dev)
389 SMC_SELECT_BANK(2); 399 SMC_SELECT_BANK(2);
390 SMC_SET_MMU_CMD(MC_RESET); 400 SMC_SET_MMU_CMD(MC_RESET);
391 SMC_WAIT_MMU_BUSY(); 401 SMC_WAIT_MMU_BUSY();
392
393 /* clear anything saved */
394 if (lp->pending_tx_skb != NULL) {
395 dev_kfree_skb (lp->pending_tx_skb);
396 lp->pending_tx_skb = NULL;
397 lp->stats.tx_errors++;
398 lp->stats.tx_aborted_errors++;
399 }
400} 402}
401 403
402/* 404/*
@@ -440,6 +442,7 @@ static void smc_shutdown(struct net_device *dev)
440{ 442{
441 struct smc_local *lp = netdev_priv(dev); 443 struct smc_local *lp = netdev_priv(dev);
442 void __iomem *ioaddr = lp->base; 444 void __iomem *ioaddr = lp->base;
445 struct sk_buff *pending_skb;
443 446
444 DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__); 447 DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__);
445 448
@@ -447,7 +450,11 @@ static void smc_shutdown(struct net_device *dev)
447 spin_lock(&lp->lock); 450 spin_lock(&lp->lock);
448 SMC_SELECT_BANK(2); 451 SMC_SELECT_BANK(2);
449 SMC_SET_INT_MASK(0); 452 SMC_SET_INT_MASK(0);
453 pending_skb = lp->pending_tx_skb;
454 lp->pending_tx_skb = NULL;
450 spin_unlock(&lp->lock); 455 spin_unlock(&lp->lock);
456 if (pending_skb)
457 dev_kfree_skb(pending_skb);
451 458
452 /* and tell the card to stay away from that nasty outside world */ 459 /* and tell the card to stay away from that nasty outside world */
453 SMC_SELECT_BANK(0); 460 SMC_SELECT_BANK(0);
@@ -627,7 +634,12 @@ static void smc_hardware_send_pkt(unsigned long data)
627 } 634 }
628 635
629 skb = lp->pending_tx_skb; 636 skb = lp->pending_tx_skb;
637 if (unlikely(!skb)) {
638 smc_special_unlock(&lp->lock);
639 return;
640 }
630 lp->pending_tx_skb = NULL; 641 lp->pending_tx_skb = NULL;
642
631 packet_no = SMC_GET_AR(); 643 packet_no = SMC_GET_AR();
632 if (unlikely(packet_no & AR_FAILED)) { 644 if (unlikely(packet_no & AR_FAILED)) {
633 printk("%s: Memory allocation failed.\n", dev->name); 645 printk("%s: Memory allocation failed.\n", dev->name);
@@ -702,7 +714,6 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
702 DBG(3, "%s: %s\n", dev->name, __FUNCTION__); 714 DBG(3, "%s: %s\n", dev->name, __FUNCTION__);
703 715
704 BUG_ON(lp->pending_tx_skb != NULL); 716 BUG_ON(lp->pending_tx_skb != NULL);
705 lp->pending_tx_skb = skb;
706 717
707 /* 718 /*
708 * The MMU wants the number of pages to be the number of 256 bytes 719 * The MMU wants the number of pages to be the number of 256 bytes
@@ -718,7 +729,6 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
718 numPages = ((skb->len & ~1) + (6 - 1)) >> 8; 729 numPages = ((skb->len & ~1) + (6 - 1)) >> 8;
719 if (unlikely(numPages > 7)) { 730 if (unlikely(numPages > 7)) {
720 printk("%s: Far too big packet error.\n", dev->name); 731 printk("%s: Far too big packet error.\n", dev->name);
721 lp->pending_tx_skb = NULL;
722 lp->stats.tx_errors++; 732 lp->stats.tx_errors++;
723 lp->stats.tx_dropped++; 733 lp->stats.tx_dropped++;
724 dev_kfree_skb(skb); 734 dev_kfree_skb(skb);
@@ -745,6 +755,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
745 755
746 smc_special_unlock(&lp->lock); 756 smc_special_unlock(&lp->lock);
747 757
758 lp->pending_tx_skb = skb;
748 if (!poll_count) { 759 if (!poll_count) {
749 /* oh well, wait until the chip finds memory later */ 760 /* oh well, wait until the chip finds memory later */
750 netif_stop_queue(dev); 761 netif_stop_queue(dev);
@@ -1062,7 +1073,7 @@ static void smc_phy_powerdown(struct net_device *dev)
1062 above). linkwatch_event() also wants the netlink semaphore. 1073 above). linkwatch_event() also wants the netlink semaphore.
1063 */ 1074 */
1064 while(lp->work_pending) 1075 while(lp->work_pending)
1065 schedule(); 1076 yield();
1066 1077
1067 bmcr = smc_phy_read(dev, phy, MII_BMCR); 1078 bmcr = smc_phy_read(dev, phy, MII_BMCR);
1068 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN); 1079 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN);
@@ -1606,14 +1617,8 @@ static int smc_close(struct net_device *dev)
1606 1617
1607 /* clear everything */ 1618 /* clear everything */
1608 smc_shutdown(dev); 1619 smc_shutdown(dev);
1609 1620 tasklet_kill(&lp->tx_task);
1610 smc_phy_powerdown(dev); 1621 smc_phy_powerdown(dev);
1611
1612 if (lp->pending_tx_skb) {
1613 dev_kfree_skb(lp->pending_tx_skb);
1614 lp->pending_tx_skb = NULL;
1615 }
1616
1617 return 0; 1622 return 0;
1618} 1623}
1619 1624
@@ -1993,7 +1998,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr)
1993 if (retval) 1998 if (retval)
1994 goto err_out; 1999 goto err_out;
1995 2000
1996 set_irq_type(dev->irq, IRQT_RISING); 2001 set_irq_type(dev->irq, SMC_IRQ_TRIGGER_TYPE);
1997 2002
1998#ifdef SMC_USE_PXA_DMA 2003#ifdef SMC_USE_PXA_DMA
1999 { 2004 {
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 946528e6b742..a9b06b8d8e3f 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -182,6 +182,16 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
182#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) 182#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
183#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) 183#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
184 184
185#include <asm/mach-types.h>
186#include <asm/arch/cpu.h>
187
188#define SMC_IRQ_TRIGGER_TYPE (( \
189 machine_is_omap_h2() \
190 || machine_is_omap_h3() \
191 || (machine_is_omap_innovator() && !cpu_is_omap1510()) \
192 ) ? IRQT_FALLING : IRQT_RISING)
193
194
185#elif defined(CONFIG_SH_SH4202_MICRODEV) 195#elif defined(CONFIG_SH_SH4202_MICRODEV)
186 196
187#define SMC_CAN_USE_8BIT 0 197#define SMC_CAN_USE_8BIT 0
@@ -300,6 +310,9 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l)
300 310
301#endif 311#endif
302 312
313#ifndef SMC_IRQ_TRIGGER_TYPE
314#define SMC_IRQ_TRIGGER_TYPE IRQT_RISING
315#endif
303 316
304#ifdef SMC_USE_PXA_DMA 317#ifdef SMC_USE_PXA_DMA
305/* 318/*
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 12e2b6826fa3..88b89dc95c77 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1286,7 +1286,7 @@ static void init_ring(struct net_device *dev)
1286 np->rx_info[i].skb = skb; 1286 np->rx_info[i].skb = skb;
1287 if (skb == NULL) 1287 if (skb == NULL)
1288 break; 1288 break;
1289 np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1289 np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1290 skb->dev = dev; /* Mark as being used by this device. */ 1290 skb->dev = dev; /* Mark as being used by this device. */
1291 /* Grrr, we cannot offset to correctly align the IP header. */ 1291 /* Grrr, we cannot offset to correctly align the IP header. */
1292 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); 1292 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid);
@@ -1572,7 +1572,7 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1572 pci_dma_sync_single_for_cpu(np->pci_dev, 1572 pci_dma_sync_single_for_cpu(np->pci_dev,
1573 np->rx_info[entry].mapping, 1573 np->rx_info[entry].mapping,
1574 pkt_len, PCI_DMA_FROMDEVICE); 1574 pkt_len, PCI_DMA_FROMDEVICE);
1575 eth_copy_and_sum(skb, np->rx_info[entry].skb->tail, pkt_len, 0); 1575 eth_copy_and_sum(skb, np->rx_info[entry].skb->data, pkt_len, 0);
1576 pci_dma_sync_single_for_device(np->pci_dev, 1576 pci_dma_sync_single_for_device(np->pci_dev,
1577 np->rx_info[entry].mapping, 1577 np->rx_info[entry].mapping,
1578 pkt_len, PCI_DMA_FROMDEVICE); 1578 pkt_len, PCI_DMA_FROMDEVICE);
@@ -1696,7 +1696,7 @@ static void refill_rx_ring(struct net_device *dev)
1696 if (skb == NULL) 1696 if (skb == NULL)
1697 break; /* Better luck next round. */ 1697 break; /* Better luck next round. */
1698 np->rx_info[entry].mapping = 1698 np->rx_info[entry].mapping =
1699 pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1699 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1700 skb->dev = dev; /* Mark as being used by this device. */ 1700 skb->dev = dev; /* Mark as being used by this device. */
1701 np->rx_ring[entry].rxaddr = 1701 np->rx_ring[entry].rxaddr =
1702 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); 1702 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid);
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 08cb7177a175..d500a5771dbc 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1028,7 +1028,7 @@ static void init_ring(struct net_device *dev)
1028 skb->dev = dev; /* Mark as being used by this device. */ 1028 skb->dev = dev; /* Mark as being used by this device. */
1029 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 1029 skb_reserve(skb, 2); /* 16 byte align the IP header. */
1030 np->rx_ring[i].frag[0].addr = cpu_to_le32( 1030 np->rx_ring[i].frag[0].addr = cpu_to_le32(
1031 pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, 1031 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz,
1032 PCI_DMA_FROMDEVICE)); 1032 PCI_DMA_FROMDEVICE));
1033 np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag); 1033 np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);
1034 } 1034 }
@@ -1341,7 +1341,7 @@ static void rx_poll(unsigned long data)
1341 np->rx_buf_sz, 1341 np->rx_buf_sz,
1342 PCI_DMA_FROMDEVICE); 1342 PCI_DMA_FROMDEVICE);
1343 1343
1344 eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); 1344 eth_copy_and_sum(skb, np->rx_skbuff[entry]->data, pkt_len, 0);
1345 pci_dma_sync_single_for_device(np->pci_dev, 1345 pci_dma_sync_single_for_device(np->pci_dev,
1346 desc->frag[0].addr, 1346 desc->frag[0].addr,
1347 np->rx_buf_sz, 1347 np->rx_buf_sz,
@@ -1400,7 +1400,7 @@ static void refill_rx (struct net_device *dev)
1400 skb->dev = dev; /* Mark as being used by this device. */ 1400 skb->dev = dev; /* Mark as being used by this device. */
1401 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1401 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1402 np->rx_ring[entry].frag[0].addr = cpu_to_le32( 1402 np->rx_ring[entry].frag[0].addr = cpu_to_le32(
1403 pci_map_single(np->pci_dev, skb->tail, 1403 pci_map_single(np->pci_dev, skb->data,
1404 np->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1404 np->rx_buf_sz, PCI_DMA_FROMDEVICE));
1405 } 1405 }
1406 /* Perhaps we need not reset this field. */ 1406 /* Perhaps we need not reset this field. */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 5cd50fd53c12..2608e7a3d214 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -44,6 +44,7 @@
44#include <linux/init.h> 44#include <linux/init.h>
45#include <linux/errno.h> 45#include <linux/errno.h>
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/dma-mapping.h>
47#include <linux/netdevice.h> 48#include <linux/netdevice.h>
48#include <linux/etherdevice.h> 49#include <linux/etherdevice.h>
49#include <linux/skbuff.h> 50#include <linux/skbuff.h>
@@ -2989,10 +2990,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
2989 */ 2990 */
2990 if (pdev->vendor == PCI_VENDOR_ID_SUN && 2991 if (pdev->vendor == PCI_VENDOR_ID_SUN &&
2991 pdev->device == PCI_DEVICE_ID_SUN_GEM && 2992 pdev->device == PCI_DEVICE_ID_SUN_GEM &&
2992 !pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL)) { 2993 !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
2993 pci_using_dac = 1; 2994 pci_using_dac = 1;
2994 } else { 2995 } else {
2995 err = pci_set_dma_mask(pdev, (u64) 0xffffffff); 2996 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
2996 if (err) { 2997 if (err) {
2997 printk(KERN_ERR PFX "No usable DMA configuration, " 2998 printk(KERN_ERR PFX "No usable DMA configuration, "
2998 "aborting.\n"); 2999 "aborting.\n");
@@ -3078,7 +3079,9 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3078 gp->phy_mii.dev = dev; 3079 gp->phy_mii.dev = dev;
3079 gp->phy_mii.mdio_read = _phy_read; 3080 gp->phy_mii.mdio_read = _phy_read;
3080 gp->phy_mii.mdio_write = _phy_write; 3081 gp->phy_mii.mdio_write = _phy_write;
3081 3082#ifdef CONFIG_PPC_PMAC
3083 gp->phy_mii.platform_data = gp->of_node;
3084#endif
3082 /* By default, we start with autoneg */ 3085 /* By default, we start with autoneg */
3083 gp->want_autoneg = 1; 3086 gp->want_autoneg = 1;
3084 3087
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 0fca414d3657..d3ddb41d6e5c 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -32,6 +32,10 @@
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34 34
35#ifdef CONFIG_PPC_PMAC
36#include <asm/prom.h>
37#endif
38
35#include "sungem_phy.h" 39#include "sungem_phy.h"
36 40
37/* Link modes of the BCM5400 PHY */ 41/* Link modes of the BCM5400 PHY */
@@ -281,10 +285,12 @@ static int bcm5411_suspend(struct mii_phy* phy)
281static int bcm5421_init(struct mii_phy* phy) 285static int bcm5421_init(struct mii_phy* phy)
282{ 286{
283 u16 data; 287 u16 data;
284 int rev; 288 unsigned int id;
285 289
286 rev = phy_read(phy, MII_PHYSID2) & 0x000f; 290 id = (phy_read(phy, MII_PHYSID1) << 16 | phy_read(phy, MII_PHYSID2));
287 if (rev == 0) { 291
292 /* Revision 0 of 5421 needs some fixups */
293 if (id == 0x002060e0) {
288 /* This is borrowed from MacOS 294 /* This is borrowed from MacOS
289 */ 295 */
290 phy_write(phy, 0x18, 0x1007); 296 phy_write(phy, 0x18, 0x1007);
@@ -297,21 +303,28 @@ static int bcm5421_init(struct mii_phy* phy)
297 data = phy_read(phy, 0x15); 303 data = phy_read(phy, 0x15);
298 phy_write(phy, 0x15, data | 0x0200); 304 phy_write(phy, 0x15, data | 0x0200);
299 } 305 }
300#if 0
301 /* This has to be verified before I enable it */
302 /* Enable automatic low-power */
303 phy_write(phy, 0x1c, 0x9002);
304 phy_write(phy, 0x1c, 0xa821);
305 phy_write(phy, 0x1c, 0x941d);
306#endif
307 return 0;
308}
309 306
310static int bcm5421k2_init(struct mii_phy* phy) 307 /* Pick up some init code from OF for K2 version */
311{ 308 if ((id & 0xfffffff0) == 0x002062e0) {
312 /* Init code borrowed from OF */ 309 phy_write(phy, 4, 0x01e1);
313 phy_write(phy, 4, 0x01e1); 310 phy_write(phy, 9, 0x0300);
314 phy_write(phy, 9, 0x0300); 311 }
312
313 /* Check if we can enable automatic low power */
314#ifdef CONFIG_PPC_PMAC
315 if (phy->platform_data) {
316 struct device_node *np = of_get_parent(phy->platform_data);
317 int can_low_power = 1;
318 if (np == NULL || get_property(np, "no-autolowpower", NULL))
319 can_low_power = 0;
320 if (can_low_power) {
321 /* Enable automatic low-power */
322 phy_write(phy, 0x1c, 0x9002);
323 phy_write(phy, 0x1c, 0xa821);
324 phy_write(phy, 0x1c, 0x941d);
325 }
326 }
327#endif /* CONFIG_PPC_PMAC */
315 328
316 return 0; 329 return 0;
317} 330}
@@ -762,7 +775,7 @@ static struct mii_phy_def bcm5421_phy_def = {
762 775
763/* Broadcom BCM 5421 built-in K2 */ 776/* Broadcom BCM 5421 built-in K2 */
764static struct mii_phy_ops bcm5421k2_phy_ops = { 777static struct mii_phy_ops bcm5421k2_phy_ops = {
765 .init = bcm5421k2_init, 778 .init = bcm5421_init,
766 .suspend = bcm5411_suspend, 779 .suspend = bcm5411_suspend,
767 .setup_aneg = bcm54xx_setup_aneg, 780 .setup_aneg = bcm54xx_setup_aneg,
768 .setup_forced = bcm54xx_setup_forced, 781 .setup_forced = bcm54xx_setup_forced,
@@ -779,6 +792,25 @@ static struct mii_phy_def bcm5421k2_phy_def = {
779 .ops = &bcm5421k2_phy_ops 792 .ops = &bcm5421k2_phy_ops
780}; 793};
781 794
795/* Broadcom BCM 5462 built-in Vesta */
796static struct mii_phy_ops bcm5462V_phy_ops = {
797 .init = bcm5421_init,
798 .suspend = bcm5411_suspend,
799 .setup_aneg = bcm54xx_setup_aneg,
800 .setup_forced = bcm54xx_setup_forced,
801 .poll_link = genmii_poll_link,
802 .read_link = bcm54xx_read_link,
803};
804
805static struct mii_phy_def bcm5462V_phy_def = {
806 .phy_id = 0x002060d0,
807 .phy_id_mask = 0xfffffff0,
808 .name = "BCM5462-Vesta",
809 .features = MII_GBIT_FEATURES,
810 .magic_aneg = 1,
811 .ops = &bcm5462V_phy_ops
812};
813
782/* Marvell 88E1101 (Apple seem to deal with 2 different revs, 814/* Marvell 88E1101 (Apple seem to deal with 2 different revs,
783 * I masked out the 8 last bits to get both, but some specs 815 * I masked out the 8 last bits to get both, but some specs
784 * would be useful here) --BenH. 816 * would be useful here) --BenH.
@@ -824,6 +856,7 @@ static struct mii_phy_def* mii_phy_table[] = {
824 &bcm5411_phy_def, 856 &bcm5411_phy_def,
825 &bcm5421_phy_def, 857 &bcm5421_phy_def,
826 &bcm5421k2_phy_def, 858 &bcm5421k2_phy_def,
859 &bcm5462V_phy_def,
827 &marvell_phy_def, 860 &marvell_phy_def,
828 &genmii_phy_def, 861 &genmii_phy_def,
829 NULL 862 NULL
diff --git a/drivers/net/sungem_phy.h b/drivers/net/sungem_phy.h
index 822cb58174ea..430544496c52 100644
--- a/drivers/net/sungem_phy.h
+++ b/drivers/net/sungem_phy.h
@@ -43,9 +43,10 @@ struct mii_phy
43 int pause; 43 int pause;
44 44
45 /* Provided by host chip */ 45 /* Provided by host chip */
46 struct net_device* dev; 46 struct net_device *dev;
47 int (*mdio_read) (struct net_device *dev, int mii_id, int reg); 47 int (*mdio_read) (struct net_device *dev, int mii_id, int reg);
48 void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val); 48 void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val);
49 void *platform_data;
49}; 50};
50 51
51/* Pass in a struct mii_phy with dev, mdio_read and mdio_write 52/* Pass in a struct mii_phy with dev, mdio_read and mdio_write
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a0b8848049c9..6d4ab1e333b5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -66,8 +66,8 @@
66 66
67#define DRV_MODULE_NAME "tg3" 67#define DRV_MODULE_NAME "tg3"
68#define PFX DRV_MODULE_NAME ": " 68#define PFX DRV_MODULE_NAME ": "
69#define DRV_MODULE_VERSION "3.31" 69#define DRV_MODULE_VERSION "3.37"
70#define DRV_MODULE_RELDATE "June 8, 2005" 70#define DRV_MODULE_RELDATE "August 25, 2005"
71 71
72#define TG3_DEF_MAC_MODE 0 72#define TG3_DEF_MAC_MODE 0
73#define TG3_DEF_RX_MODE 0 73#define TG3_DEF_RX_MODE 0
@@ -90,7 +90,7 @@
90/* hardware minimum and maximum for a single frame's data payload */ 90/* hardware minimum and maximum for a single frame's data payload */
91#define TG3_MIN_MTU 60 91#define TG3_MIN_MTU 60
92#define TG3_MAX_MTU(tp) \ 92#define TG3_MAX_MTU(tp) \
93 (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ? 9000 : 1500) 93 ((tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) ? 9000 : 1500)
94 94
95/* These numbers seem to be hard coded in the NIC firmware somehow. 95/* These numbers seem to be hard coded in the NIC firmware somehow.
96 * You can't change the ring sizes, but you can change where you place 96 * You can't change the ring sizes, but you can change where you place
@@ -221,6 +221,10 @@ static struct pci_device_id tg3_pci_tbl[] = {
221 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 221 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
222 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5753F, 222 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5753F,
223 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 223 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
224 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780,
225 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
226 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S,
227 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
224 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781, 228 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781,
225 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
226 { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX, 230 { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX,
@@ -337,12 +341,10 @@ static struct {
337static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) 341static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
338{ 342{
339 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { 343 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) {
340 unsigned long flags; 344 spin_lock_bh(&tp->indirect_lock);
341
342 spin_lock_irqsave(&tp->indirect_lock, flags);
343 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); 345 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
344 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); 346 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val);
345 spin_unlock_irqrestore(&tp->indirect_lock, flags); 347 spin_unlock_bh(&tp->indirect_lock);
346 } else { 348 } else {
347 writel(val, tp->regs + off); 349 writel(val, tp->regs + off);
348 if ((tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) != 0) 350 if ((tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) != 0)
@@ -353,12 +355,10 @@ static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
353static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) 355static void _tw32_flush(struct tg3 *tp, u32 off, u32 val)
354{ 356{
355 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { 357 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) {
356 unsigned long flags; 358 spin_lock_bh(&tp->indirect_lock);
357
358 spin_lock_irqsave(&tp->indirect_lock, flags);
359 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off); 359 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
360 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); 360 pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val);
361 spin_unlock_irqrestore(&tp->indirect_lock, flags); 361 spin_unlock_bh(&tp->indirect_lock);
362 } else { 362 } else {
363 void __iomem *dest = tp->regs + off; 363 void __iomem *dest = tp->regs + off;
364 writel(val, dest); 364 writel(val, dest);
@@ -398,28 +398,24 @@ static inline void _tw32_tx_mbox(struct tg3 *tp, u32 off, u32 val)
398 398
399static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) 399static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
400{ 400{
401 unsigned long flags; 401 spin_lock_bh(&tp->indirect_lock);
402
403 spin_lock_irqsave(&tp->indirect_lock, flags);
404 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 402 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
405 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 403 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
406 404
407 /* Always leave this as zero. */ 405 /* Always leave this as zero. */
408 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 406 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
409 spin_unlock_irqrestore(&tp->indirect_lock, flags); 407 spin_unlock_bh(&tp->indirect_lock);
410} 408}
411 409
412static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) 410static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
413{ 411{
414 unsigned long flags; 412 spin_lock_bh(&tp->indirect_lock);
415
416 spin_lock_irqsave(&tp->indirect_lock, flags);
417 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 413 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
418 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 414 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
419 415
420 /* Always leave this as zero. */ 416 /* Always leave this as zero. */
421 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 417 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
422 spin_unlock_irqrestore(&tp->indirect_lock, flags); 418 spin_unlock_bh(&tp->indirect_lock);
423} 419}
424 420
425static void tg3_disable_ints(struct tg3 *tp) 421static void tg3_disable_ints(struct tg3 *tp)
@@ -438,12 +434,14 @@ static inline void tg3_cond_int(struct tg3 *tp)
438 434
439static void tg3_enable_ints(struct tg3 *tp) 435static void tg3_enable_ints(struct tg3 *tp)
440{ 436{
437 tp->irq_sync = 0;
438 wmb();
439
441 tw32(TG3PCI_MISC_HOST_CTRL, 440 tw32(TG3PCI_MISC_HOST_CTRL,
442 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); 441 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT));
443 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 442 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
444 (tp->last_tag << 24)); 443 (tp->last_tag << 24));
445 tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW); 444 tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
446
447 tg3_cond_int(tp); 445 tg3_cond_int(tp);
448} 446}
449 447
@@ -492,6 +490,7 @@ static void tg3_restart_ints(struct tg3 *tp)
492 490
493static inline void tg3_netif_stop(struct tg3 *tp) 491static inline void tg3_netif_stop(struct tg3 *tp)
494{ 492{
493 tp->dev->trans_start = jiffies; /* prevent tx timeout */
495 netif_poll_disable(tp->dev); 494 netif_poll_disable(tp->dev);
496 netif_tx_disable(tp->dev); 495 netif_tx_disable(tp->dev);
497} 496}
@@ -504,7 +503,8 @@ static inline void tg3_netif_start(struct tg3 *tp)
504 * (such as after tg3_init_hw) 503 * (such as after tg3_init_hw)
505 */ 504 */
506 netif_poll_enable(tp->dev); 505 netif_poll_enable(tp->dev);
507 tg3_cond_int(tp); 506 tp->hw_status->status |= SD_STATUS_UPDATED;
507 tg3_enable_ints(tp);
508} 508}
509 509
510static void tg3_switch_clocks(struct tg3 *tp) 510static void tg3_switch_clocks(struct tg3 *tp)
@@ -512,6 +512,9 @@ static void tg3_switch_clocks(struct tg3 *tp)
512 u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); 512 u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL);
513 u32 orig_clock_ctrl; 513 u32 orig_clock_ctrl;
514 514
515 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780)
516 return;
517
515 orig_clock_ctrl = clock_ctrl; 518 orig_clock_ctrl = clock_ctrl;
516 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | 519 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN |
517 CLOCK_CTRL_CLKRUN_OENABLE | 520 CLOCK_CTRL_CLKRUN_OENABLE |
@@ -911,7 +914,7 @@ out:
911 if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { 914 if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
912 /* Cannot do read-modify-write on 5401 */ 915 /* Cannot do read-modify-write on 5401 */
913 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); 916 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20);
914 } else if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 917 } else if (tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) {
915 u32 phy_reg; 918 u32 phy_reg;
916 919
917 /* Set bit 14 with read-modify-write to preserve other bits */ 920 /* Set bit 14 with read-modify-write to preserve other bits */
@@ -923,7 +926,7 @@ out:
923 /* Set phy register 0x10 bit 0 to high fifo elasticity to support 926 /* Set phy register 0x10 bit 0 to high fifo elasticity to support
924 * jumbo frames transmission. 927 * jumbo frames transmission.
925 */ 928 */
926 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 929 if (tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) {
927 u32 phy_reg; 930 u32 phy_reg;
928 931
929 if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg)) 932 if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg))
@@ -1097,7 +1100,7 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1097 tp->link_config.orig_autoneg = tp->link_config.autoneg; 1100 tp->link_config.orig_autoneg = tp->link_config.autoneg;
1098 } 1101 }
1099 1102
1100 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 1103 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) {
1101 tp->link_config.speed = SPEED_10; 1104 tp->link_config.speed = SPEED_10;
1102 tp->link_config.duplex = DUPLEX_HALF; 1105 tp->link_config.duplex = DUPLEX_HALF;
1103 tp->link_config.autoneg = AUTONEG_ENABLE; 1106 tp->link_config.autoneg = AUTONEG_ENABLE;
@@ -1149,6 +1152,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1149 CLOCK_CTRL_ALTCLK | 1152 CLOCK_CTRL_ALTCLK |
1150 CLOCK_CTRL_PWRDOWN_PLL133); 1153 CLOCK_CTRL_PWRDOWN_PLL133);
1151 udelay(40); 1154 udelay(40);
1155 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
1156 /* do nothing */
1152 } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && 1157 } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) &&
1153 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) { 1158 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) {
1154 u32 newbits1, newbits2; 1159 u32 newbits1, newbits2;
@@ -1242,6 +1247,25 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv
1242 u32 old_tx_mode = tp->tx_mode; 1247 u32 old_tx_mode = tp->tx_mode;
1243 1248
1244 if (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) { 1249 if (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) {
1250
1251 /* Convert 1000BaseX flow control bits to 1000BaseT
1252 * bits before resolving flow control.
1253 */
1254 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
1255 local_adv &= ~(ADVERTISE_PAUSE_CAP |
1256 ADVERTISE_PAUSE_ASYM);
1257 remote_adv &= ~(LPA_PAUSE_CAP | LPA_PAUSE_ASYM);
1258
1259 if (local_adv & ADVERTISE_1000XPAUSE)
1260 local_adv |= ADVERTISE_PAUSE_CAP;
1261 if (local_adv & ADVERTISE_1000XPSE_ASYM)
1262 local_adv |= ADVERTISE_PAUSE_ASYM;
1263 if (remote_adv & LPA_1000XPAUSE)
1264 remote_adv |= LPA_PAUSE_CAP;
1265 if (remote_adv & LPA_1000XPAUSE_ASYM)
1266 remote_adv |= LPA_PAUSE_ASYM;
1267 }
1268
1245 if (local_adv & ADVERTISE_PAUSE_CAP) { 1269 if (local_adv & ADVERTISE_PAUSE_CAP) {
1246 if (local_adv & ADVERTISE_PAUSE_ASYM) { 1270 if (local_adv & ADVERTISE_PAUSE_ASYM) {
1247 if (remote_adv & LPA_PAUSE_CAP) 1271 if (remote_adv & LPA_PAUSE_CAP)
@@ -2502,12 +2526,226 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
2502 return 0; 2526 return 0;
2503} 2527}
2504 2528
2529static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
2530{
2531 int current_link_up, err = 0;
2532 u32 bmsr, bmcr;
2533 u16 current_speed;
2534 u8 current_duplex;
2535
2536 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
2537 tw32_f(MAC_MODE, tp->mac_mode);
2538 udelay(40);
2539
2540 tw32(MAC_EVENT, 0);
2541
2542 tw32_f(MAC_STATUS,
2543 (MAC_STATUS_SYNC_CHANGED |
2544 MAC_STATUS_CFG_CHANGED |
2545 MAC_STATUS_MI_COMPLETION |
2546 MAC_STATUS_LNKSTATE_CHANGED));
2547 udelay(40);
2548
2549 if (force_reset)
2550 tg3_phy_reset(tp);
2551
2552 current_link_up = 0;
2553 current_speed = SPEED_INVALID;
2554 current_duplex = DUPLEX_INVALID;
2555
2556 err |= tg3_readphy(tp, MII_BMSR, &bmsr);
2557 err |= tg3_readphy(tp, MII_BMSR, &bmsr);
2558
2559 err |= tg3_readphy(tp, MII_BMCR, &bmcr);
2560
2561 if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset &&
2562 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
2563 /* do nothing, just check for link up at the end */
2564 } else if (tp->link_config.autoneg == AUTONEG_ENABLE) {
2565 u32 adv, new_adv;
2566
2567 err |= tg3_readphy(tp, MII_ADVERTISE, &adv);
2568 new_adv = adv & ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF |
2569 ADVERTISE_1000XPAUSE |
2570 ADVERTISE_1000XPSE_ASYM |
2571 ADVERTISE_SLCT);
2572
2573 /* Always advertise symmetric PAUSE just like copper */
2574 new_adv |= ADVERTISE_1000XPAUSE;
2575
2576 if (tp->link_config.advertising & ADVERTISED_1000baseT_Half)
2577 new_adv |= ADVERTISE_1000XHALF;
2578 if (tp->link_config.advertising & ADVERTISED_1000baseT_Full)
2579 new_adv |= ADVERTISE_1000XFULL;
2580
2581 if ((new_adv != adv) || !(bmcr & BMCR_ANENABLE)) {
2582 tg3_writephy(tp, MII_ADVERTISE, new_adv);
2583 bmcr |= BMCR_ANENABLE | BMCR_ANRESTART;
2584 tg3_writephy(tp, MII_BMCR, bmcr);
2585
2586 tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
2587 tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
2588 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
2589
2590 return err;
2591 }
2592 } else {
2593 u32 new_bmcr;
2594
2595 bmcr &= ~BMCR_SPEED1000;
2596 new_bmcr = bmcr & ~(BMCR_ANENABLE | BMCR_FULLDPLX);
2597
2598 if (tp->link_config.duplex == DUPLEX_FULL)
2599 new_bmcr |= BMCR_FULLDPLX;
2600
2601 if (new_bmcr != bmcr) {
2602 /* BMCR_SPEED1000 is a reserved bit that needs
2603 * to be set on write.
2604 */
2605 new_bmcr |= BMCR_SPEED1000;
2606
2607 /* Force a linkdown */
2608 if (netif_carrier_ok(tp->dev)) {
2609 u32 adv;
2610
2611 err |= tg3_readphy(tp, MII_ADVERTISE, &adv);
2612 adv &= ~(ADVERTISE_1000XFULL |
2613 ADVERTISE_1000XHALF |
2614 ADVERTISE_SLCT);
2615 tg3_writephy(tp, MII_ADVERTISE, adv);
2616 tg3_writephy(tp, MII_BMCR, bmcr |
2617 BMCR_ANRESTART |
2618 BMCR_ANENABLE);
2619 udelay(10);
2620 netif_carrier_off(tp->dev);
2621 }
2622 tg3_writephy(tp, MII_BMCR, new_bmcr);
2623 bmcr = new_bmcr;
2624 err |= tg3_readphy(tp, MII_BMSR, &bmsr);
2625 err |= tg3_readphy(tp, MII_BMSR, &bmsr);
2626 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
2627 }
2628 }
2629
2630 if (bmsr & BMSR_LSTATUS) {
2631 current_speed = SPEED_1000;
2632 current_link_up = 1;
2633 if (bmcr & BMCR_FULLDPLX)
2634 current_duplex = DUPLEX_FULL;
2635 else
2636 current_duplex = DUPLEX_HALF;
2637
2638 if (bmcr & BMCR_ANENABLE) {
2639 u32 local_adv, remote_adv, common;
2640
2641 err |= tg3_readphy(tp, MII_ADVERTISE, &local_adv);
2642 err |= tg3_readphy(tp, MII_LPA, &remote_adv);
2643 common = local_adv & remote_adv;
2644 if (common & (ADVERTISE_1000XHALF |
2645 ADVERTISE_1000XFULL)) {
2646 if (common & ADVERTISE_1000XFULL)
2647 current_duplex = DUPLEX_FULL;
2648 else
2649 current_duplex = DUPLEX_HALF;
2650
2651 tg3_setup_flow_control(tp, local_adv,
2652 remote_adv);
2653 }
2654 else
2655 current_link_up = 0;
2656 }
2657 }
2658
2659 tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX;
2660 if (tp->link_config.active_duplex == DUPLEX_HALF)
2661 tp->mac_mode |= MAC_MODE_HALF_DUPLEX;
2662
2663 tw32_f(MAC_MODE, tp->mac_mode);
2664 udelay(40);
2665
2666 tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
2667
2668 tp->link_config.active_speed = current_speed;
2669 tp->link_config.active_duplex = current_duplex;
2670
2671 if (current_link_up != netif_carrier_ok(tp->dev)) {
2672 if (current_link_up)
2673 netif_carrier_on(tp->dev);
2674 else {
2675 netif_carrier_off(tp->dev);
2676 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
2677 }
2678 tg3_link_report(tp);
2679 }
2680 return err;
2681}
2682
2683static void tg3_serdes_parallel_detect(struct tg3 *tp)
2684{
2685 if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED) {
2686 /* Give autoneg time to complete. */
2687 tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED;
2688 return;
2689 }
2690 if (!netif_carrier_ok(tp->dev) &&
2691 (tp->link_config.autoneg == AUTONEG_ENABLE)) {
2692 u32 bmcr;
2693
2694 tg3_readphy(tp, MII_BMCR, &bmcr);
2695 if (bmcr & BMCR_ANENABLE) {
2696 u32 phy1, phy2;
2697
2698 /* Select shadow register 0x1f */
2699 tg3_writephy(tp, 0x1c, 0x7c00);
2700 tg3_readphy(tp, 0x1c, &phy1);
2701
2702 /* Select expansion interrupt status register */
2703 tg3_writephy(tp, 0x17, 0x0f01);
2704 tg3_readphy(tp, 0x15, &phy2);
2705 tg3_readphy(tp, 0x15, &phy2);
2706
2707 if ((phy1 & 0x10) && !(phy2 & 0x20)) {
2708 /* We have signal detect and not receiving
2709 * config code words, link is up by parallel
2710 * detection.
2711 */
2712
2713 bmcr &= ~BMCR_ANENABLE;
2714 bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX;
2715 tg3_writephy(tp, MII_BMCR, bmcr);
2716 tp->tg3_flags2 |= TG3_FLG2_PARALLEL_DETECT;
2717 }
2718 }
2719 }
2720 else if (netif_carrier_ok(tp->dev) &&
2721 (tp->link_config.autoneg == AUTONEG_ENABLE) &&
2722 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
2723 u32 phy2;
2724
2725 /* Select expansion interrupt status register */
2726 tg3_writephy(tp, 0x17, 0x0f01);
2727 tg3_readphy(tp, 0x15, &phy2);
2728 if (phy2 & 0x20) {
2729 u32 bmcr;
2730
2731 /* Config code words received, turn on autoneg. */
2732 tg3_readphy(tp, MII_BMCR, &bmcr);
2733 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANENABLE);
2734
2735 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
2736
2737 }
2738 }
2739}
2740
2505static int tg3_setup_phy(struct tg3 *tp, int force_reset) 2741static int tg3_setup_phy(struct tg3 *tp, int force_reset)
2506{ 2742{
2507 int err; 2743 int err;
2508 2744
2509 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 2745 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
2510 err = tg3_setup_fiber_phy(tp, force_reset); 2746 err = tg3_setup_fiber_phy(tp, force_reset);
2747 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
2748 err = tg3_setup_fiber_mii_phy(tp, force_reset);
2511 } else { 2749 } else {
2512 err = tg3_setup_copper_phy(tp, force_reset); 2750 err = tg3_setup_copper_phy(tp, force_reset);
2513 } 2751 }
@@ -2578,7 +2816,7 @@ static void tg3_tx(struct tg3 *tp)
2578 sw_idx = NEXT_TX(sw_idx); 2816 sw_idx = NEXT_TX(sw_idx);
2579 } 2817 }
2580 2818
2581 dev_kfree_skb_irq(skb); 2819 dev_kfree_skb(skb);
2582 } 2820 }
2583 2821
2584 tp->tx_cons = sw_idx; 2822 tp->tx_cons = sw_idx;
@@ -2616,7 +2854,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key,
2616 map = &tp->rx_std_buffers[dest_idx]; 2854 map = &tp->rx_std_buffers[dest_idx];
2617 if (src_idx >= 0) 2855 if (src_idx >= 0)
2618 src_map = &tp->rx_std_buffers[src_idx]; 2856 src_map = &tp->rx_std_buffers[src_idx];
2619 skb_size = RX_PKT_BUF_SZ; 2857 skb_size = tp->rx_pkt_buf_sz;
2620 break; 2858 break;
2621 2859
2622 case RXD_OPAQUE_RING_JUMBO: 2860 case RXD_OPAQUE_RING_JUMBO:
@@ -2884,11 +3122,8 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2884{ 3122{
2885 struct tg3 *tp = netdev_priv(netdev); 3123 struct tg3 *tp = netdev_priv(netdev);
2886 struct tg3_hw_status *sblk = tp->hw_status; 3124 struct tg3_hw_status *sblk = tp->hw_status;
2887 unsigned long flags;
2888 int done; 3125 int done;
2889 3126
2890 spin_lock_irqsave(&tp->lock, flags);
2891
2892 /* handle link change and other phy events */ 3127 /* handle link change and other phy events */
2893 if (!(tp->tg3_flags & 3128 if (!(tp->tg3_flags &
2894 (TG3_FLAG_USE_LINKCHG_REG | 3129 (TG3_FLAG_USE_LINKCHG_REG |
@@ -2896,7 +3131,9 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2896 if (sblk->status & SD_STATUS_LINK_CHG) { 3131 if (sblk->status & SD_STATUS_LINK_CHG) {
2897 sblk->status = SD_STATUS_UPDATED | 3132 sblk->status = SD_STATUS_UPDATED |
2898 (sblk->status & ~SD_STATUS_LINK_CHG); 3133 (sblk->status & ~SD_STATUS_LINK_CHG);
3134 spin_lock(&tp->lock);
2899 tg3_setup_phy(tp, 0); 3135 tg3_setup_phy(tp, 0);
3136 spin_unlock(&tp->lock);
2900 } 3137 }
2901 } 3138 }
2902 3139
@@ -2907,8 +3144,6 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2907 spin_unlock(&tp->tx_lock); 3144 spin_unlock(&tp->tx_lock);
2908 } 3145 }
2909 3146
2910 spin_unlock_irqrestore(&tp->lock, flags);
2911
2912 /* run RX thread, within the bounds set by NAPI. 3147 /* run RX thread, within the bounds set by NAPI.
2913 * All RX "locking" is done by ensuring outside 3148 * All RX "locking" is done by ensuring outside
2914 * code synchronizes with dev->poll() 3149 * code synchronizes with dev->poll()
@@ -2929,19 +3164,54 @@ static int tg3_poll(struct net_device *netdev, int *budget)
2929 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) 3164 if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
2930 tp->last_tag = sblk->status_tag; 3165 tp->last_tag = sblk->status_tag;
2931 rmb(); 3166 rmb();
3167 sblk->status &= ~SD_STATUS_UPDATED;
2932 3168
2933 /* if no more work, tell net stack and NIC we're done */ 3169 /* if no more work, tell net stack and NIC we're done */
2934 done = !tg3_has_work(tp); 3170 done = !tg3_has_work(tp);
2935 if (done) { 3171 if (done) {
2936 spin_lock_irqsave(&tp->lock, flags); 3172 spin_lock(&tp->lock);
2937 __netif_rx_complete(netdev); 3173 netif_rx_complete(netdev);
2938 tg3_restart_ints(tp); 3174 tg3_restart_ints(tp);
2939 spin_unlock_irqrestore(&tp->lock, flags); 3175 spin_unlock(&tp->lock);
2940 } 3176 }
2941 3177
2942 return (done ? 0 : 1); 3178 return (done ? 0 : 1);
2943} 3179}
2944 3180
3181static void tg3_irq_quiesce(struct tg3 *tp)
3182{
3183 BUG_ON(tp->irq_sync);
3184
3185 tp->irq_sync = 1;
3186 smp_mb();
3187
3188 synchronize_irq(tp->pdev->irq);
3189}
3190
3191static inline int tg3_irq_sync(struct tg3 *tp)
3192{
3193 return tp->irq_sync;
3194}
3195
3196/* Fully shutdown all tg3 driver activity elsewhere in the system.
3197 * If irq_sync is non-zero, then the IRQ handler must be synchronized
3198 * with as well. Most of the time, this is not necessary except when
3199 * shutting down the device.
3200 */
3201static inline void tg3_full_lock(struct tg3 *tp, int irq_sync)
3202{
3203 if (irq_sync)
3204 tg3_irq_quiesce(tp);
3205 spin_lock_bh(&tp->lock);
3206 spin_lock(&tp->tx_lock);
3207}
3208
3209static inline void tg3_full_unlock(struct tg3 *tp)
3210{
3211 spin_unlock(&tp->tx_lock);
3212 spin_unlock_bh(&tp->lock);
3213}
3214
2945/* MSI ISR - No need to check for interrupt sharing and no need to 3215/* MSI ISR - No need to check for interrupt sharing and no need to
2946 * flush status block and interrupt mailbox. PCI ordering rules 3216 * flush status block and interrupt mailbox. PCI ordering rules
2947 * guarantee that MSI will arrive after the status block. 3217 * guarantee that MSI will arrive after the status block.
@@ -2951,9 +3221,6 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2951 struct net_device *dev = dev_id; 3221 struct net_device *dev = dev_id;
2952 struct tg3 *tp = netdev_priv(dev); 3222 struct tg3 *tp = netdev_priv(dev);
2953 struct tg3_hw_status *sblk = tp->hw_status; 3223 struct tg3_hw_status *sblk = tp->hw_status;
2954 unsigned long flags;
2955
2956 spin_lock_irqsave(&tp->lock, flags);
2957 3224
2958 /* 3225 /*
2959 * Writing any value to intr-mbox-0 clears PCI INTA# and 3226 * Writing any value to intr-mbox-0 clears PCI INTA# and
@@ -2964,6 +3231,9 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2964 */ 3231 */
2965 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 3232 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
2966 tp->last_tag = sblk->status_tag; 3233 tp->last_tag = sblk->status_tag;
3234 rmb();
3235 if (tg3_irq_sync(tp))
3236 goto out;
2967 sblk->status &= ~SD_STATUS_UPDATED; 3237 sblk->status &= ~SD_STATUS_UPDATED;
2968 if (likely(tg3_has_work(tp))) 3238 if (likely(tg3_has_work(tp)))
2969 netif_rx_schedule(dev); /* schedule NAPI poll */ 3239 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -2972,9 +3242,7 @@ static irqreturn_t tg3_msi(int irq, void *dev_id, struct pt_regs *regs)
2972 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3242 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
2973 tp->last_tag << 24); 3243 tp->last_tag << 24);
2974 } 3244 }
2975 3245out:
2976 spin_unlock_irqrestore(&tp->lock, flags);
2977
2978 return IRQ_RETVAL(1); 3246 return IRQ_RETVAL(1);
2979} 3247}
2980 3248
@@ -2983,11 +3251,8 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2983 struct net_device *dev = dev_id; 3251 struct net_device *dev = dev_id;
2984 struct tg3 *tp = netdev_priv(dev); 3252 struct tg3 *tp = netdev_priv(dev);
2985 struct tg3_hw_status *sblk = tp->hw_status; 3253 struct tg3_hw_status *sblk = tp->hw_status;
2986 unsigned long flags;
2987 unsigned int handled = 1; 3254 unsigned int handled = 1;
2988 3255
2989 spin_lock_irqsave(&tp->lock, flags);
2990
2991 /* In INTx mode, it is possible for the interrupt to arrive at 3256 /* In INTx mode, it is possible for the interrupt to arrive at
2992 * the CPU before the status block posted prior to the interrupt. 3257 * the CPU before the status block posted prior to the interrupt.
2993 * Reading the PCI State register will confirm whether the 3258 * Reading the PCI State register will confirm whether the
@@ -3004,6 +3269,8 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3004 */ 3269 */
3005 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3270 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3006 0x00000001); 3271 0x00000001);
3272 if (tg3_irq_sync(tp))
3273 goto out;
3007 sblk->status &= ~SD_STATUS_UPDATED; 3274 sblk->status &= ~SD_STATUS_UPDATED;
3008 if (likely(tg3_has_work(tp))) 3275 if (likely(tg3_has_work(tp)))
3009 netif_rx_schedule(dev); /* schedule NAPI poll */ 3276 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -3018,9 +3285,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3018 } else { /* shared interrupt */ 3285 } else { /* shared interrupt */
3019 handled = 0; 3286 handled = 0;
3020 } 3287 }
3021 3288out:
3022 spin_unlock_irqrestore(&tp->lock, flags);
3023
3024 return IRQ_RETVAL(handled); 3289 return IRQ_RETVAL(handled);
3025} 3290}
3026 3291
@@ -3029,11 +3294,8 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3029 struct net_device *dev = dev_id; 3294 struct net_device *dev = dev_id;
3030 struct tg3 *tp = netdev_priv(dev); 3295 struct tg3 *tp = netdev_priv(dev);
3031 struct tg3_hw_status *sblk = tp->hw_status; 3296 struct tg3_hw_status *sblk = tp->hw_status;
3032 unsigned long flags;
3033 unsigned int handled = 1; 3297 unsigned int handled = 1;
3034 3298
3035 spin_lock_irqsave(&tp->lock, flags);
3036
3037 /* In INTx mode, it is possible for the interrupt to arrive at 3299 /* In INTx mode, it is possible for the interrupt to arrive at
3038 * the CPU before the status block posted prior to the interrupt. 3300 * the CPU before the status block posted prior to the interrupt.
3039 * Reading the PCI State register will confirm whether the 3301 * Reading the PCI State register will confirm whether the
@@ -3051,6 +3313,9 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3051 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 3313 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3052 0x00000001); 3314 0x00000001);
3053 tp->last_tag = sblk->status_tag; 3315 tp->last_tag = sblk->status_tag;
3316 rmb();
3317 if (tg3_irq_sync(tp))
3318 goto out;
3054 sblk->status &= ~SD_STATUS_UPDATED; 3319 sblk->status &= ~SD_STATUS_UPDATED;
3055 if (likely(tg3_has_work(tp))) 3320 if (likely(tg3_has_work(tp)))
3056 netif_rx_schedule(dev); /* schedule NAPI poll */ 3321 netif_rx_schedule(dev); /* schedule NAPI poll */
@@ -3065,9 +3330,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id, struct pt_regs *r
3065 } else { /* shared interrupt */ 3330 } else { /* shared interrupt */
3066 handled = 0; 3331 handled = 0;
3067 } 3332 }
3068 3333out:
3069 spin_unlock_irqrestore(&tp->lock, flags);
3070
3071 return IRQ_RETVAL(handled); 3334 return IRQ_RETVAL(handled);
3072} 3335}
3073 3336
@@ -3106,8 +3369,7 @@ static void tg3_reset_task(void *_data)
3106 3369
3107 tg3_netif_stop(tp); 3370 tg3_netif_stop(tp);
3108 3371
3109 spin_lock_irq(&tp->lock); 3372 tg3_full_lock(tp, 1);
3110 spin_lock(&tp->tx_lock);
3111 3373
3112 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER; 3374 restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER;
3113 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; 3375 tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
@@ -3117,8 +3379,7 @@ static void tg3_reset_task(void *_data)
3117 3379
3118 tg3_netif_start(tp); 3380 tg3_netif_start(tp);
3119 3381
3120 spin_unlock(&tp->tx_lock); 3382 tg3_full_unlock(tp);
3121 spin_unlock_irq(&tp->lock);
3122 3383
3123 if (restart_timer) 3384 if (restart_timer)
3124 mod_timer(&tp->timer, jiffies + 1); 3385 mod_timer(&tp->timer, jiffies + 1);
@@ -3224,39 +3485,21 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3224 unsigned int i; 3485 unsigned int i;
3225 u32 len, entry, base_flags, mss; 3486 u32 len, entry, base_flags, mss;
3226 int would_hit_hwbug; 3487 int would_hit_hwbug;
3227 unsigned long flags;
3228 3488
3229 len = skb_headlen(skb); 3489 len = skb_headlen(skb);
3230 3490
3231 /* No BH disabling for tx_lock here. We are running in BH disabled 3491 /* No BH disabling for tx_lock here. We are running in BH disabled
3232 * context and TX reclaim runs via tp->poll inside of a software 3492 * context and TX reclaim runs via tp->poll inside of a software
3233 * interrupt. Rejoice! 3493 * interrupt. Furthermore, IRQ processing runs lockless so we have
3234 * 3494 * no IRQ context deadlocks to worry about either. Rejoice!
3235 * Actually, things are not so simple. If we are to take a hw
3236 * IRQ here, we can deadlock, consider:
3237 *
3238 * CPU1 CPU2
3239 * tg3_start_xmit
3240 * take tp->tx_lock
3241 * tg3_timer
3242 * take tp->lock
3243 * tg3_interrupt
3244 * spin on tp->lock
3245 * spin on tp->tx_lock
3246 *
3247 * So we really do need to disable interrupts when taking
3248 * tx_lock here.
3249 */ 3495 */
3250 local_irq_save(flags); 3496 if (!spin_trylock(&tp->tx_lock))
3251 if (!spin_trylock(&tp->tx_lock)) {
3252 local_irq_restore(flags);
3253 return NETDEV_TX_LOCKED; 3497 return NETDEV_TX_LOCKED;
3254 }
3255 3498
3256 /* This is a hard error, log it. */ 3499 /* This is a hard error, log it. */
3257 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { 3500 if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
3258 netif_stop_queue(dev); 3501 netif_stop_queue(dev);
3259 spin_unlock_irqrestore(&tp->tx_lock, flags); 3502 spin_unlock(&tp->tx_lock);
3260 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", 3503 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
3261 dev->name); 3504 dev->name);
3262 return NETDEV_TX_BUSY; 3505 return NETDEV_TX_BUSY;
@@ -3421,7 +3664,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3421 3664
3422out_unlock: 3665out_unlock:
3423 mmiowb(); 3666 mmiowb();
3424 spin_unlock_irqrestore(&tp->tx_lock, flags); 3667 spin_unlock(&tp->tx_lock);
3425 3668
3426 dev->trans_start = jiffies; 3669 dev->trans_start = jiffies;
3427 3670
@@ -3433,10 +3676,18 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
3433{ 3676{
3434 dev->mtu = new_mtu; 3677 dev->mtu = new_mtu;
3435 3678
3436 if (new_mtu > ETH_DATA_LEN) 3679 if (new_mtu > ETH_DATA_LEN) {
3437 tp->tg3_flags |= TG3_FLAG_JUMBO_ENABLE; 3680 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
3438 else 3681 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
3439 tp->tg3_flags &= ~TG3_FLAG_JUMBO_ENABLE; 3682 ethtool_op_set_tso(dev, 0);
3683 }
3684 else
3685 tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE;
3686 } else {
3687 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780)
3688 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
3689 tp->tg3_flags &= ~TG3_FLAG_JUMBO_RING_ENABLE;
3690 }
3440} 3691}
3441 3692
3442static int tg3_change_mtu(struct net_device *dev, int new_mtu) 3693static int tg3_change_mtu(struct net_device *dev, int new_mtu)
@@ -3455,8 +3706,8 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3455 } 3706 }
3456 3707
3457 tg3_netif_stop(tp); 3708 tg3_netif_stop(tp);
3458 spin_lock_irq(&tp->lock); 3709
3459 spin_lock(&tp->tx_lock); 3710 tg3_full_lock(tp, 1);
3460 3711
3461 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 3712 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
3462 3713
@@ -3466,8 +3717,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3466 3717
3467 tg3_netif_start(tp); 3718 tg3_netif_start(tp);
3468 3719
3469 spin_unlock(&tp->tx_lock); 3720 tg3_full_unlock(tp);
3470 spin_unlock_irq(&tp->lock);
3471 3721
3472 return 0; 3722 return 0;
3473} 3723}
@@ -3491,7 +3741,7 @@ static void tg3_free_rings(struct tg3 *tp)
3491 continue; 3741 continue;
3492 pci_unmap_single(tp->pdev, 3742 pci_unmap_single(tp->pdev,
3493 pci_unmap_addr(rxp, mapping), 3743 pci_unmap_addr(rxp, mapping),
3494 RX_PKT_BUF_SZ - tp->rx_offset, 3744 tp->rx_pkt_buf_sz - tp->rx_offset,
3495 PCI_DMA_FROMDEVICE); 3745 PCI_DMA_FROMDEVICE);
3496 dev_kfree_skb_any(rxp->skb); 3746 dev_kfree_skb_any(rxp->skb);
3497 rxp->skb = NULL; 3747 rxp->skb = NULL;
@@ -3564,6 +3814,11 @@ static void tg3_init_rings(struct tg3 *tp)
3564 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 3814 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
3565 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES); 3815 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES);
3566 3816
3817 tp->rx_pkt_buf_sz = RX_PKT_BUF_SZ;
3818 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) &&
3819 (tp->dev->mtu > ETH_DATA_LEN))
3820 tp->rx_pkt_buf_sz = RX_JUMBO_PKT_BUF_SZ;
3821
3567 /* Initialize invariants of the rings, we only set this 3822 /* Initialize invariants of the rings, we only set this
3568 * stuff once. This works because the card does not 3823 * stuff once. This works because the card does not
3569 * write into the rx buffer posting rings. 3824 * write into the rx buffer posting rings.
@@ -3572,14 +3827,14 @@ static void tg3_init_rings(struct tg3 *tp)
3572 struct tg3_rx_buffer_desc *rxd; 3827 struct tg3_rx_buffer_desc *rxd;
3573 3828
3574 rxd = &tp->rx_std[i]; 3829 rxd = &tp->rx_std[i];
3575 rxd->idx_len = (RX_PKT_BUF_SZ - tp->rx_offset - 64) 3830 rxd->idx_len = (tp->rx_pkt_buf_sz - tp->rx_offset - 64)
3576 << RXD_LEN_SHIFT; 3831 << RXD_LEN_SHIFT;
3577 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT); 3832 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT);
3578 rxd->opaque = (RXD_OPAQUE_RING_STD | 3833 rxd->opaque = (RXD_OPAQUE_RING_STD |
3579 (i << RXD_OPAQUE_INDEX_SHIFT)); 3834 (i << RXD_OPAQUE_INDEX_SHIFT));
3580 } 3835 }
3581 3836
3582 if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 3837 if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) {
3583 for (i = 0; i < TG3_RX_JUMBO_RING_SIZE; i++) { 3838 for (i = 0; i < TG3_RX_JUMBO_RING_SIZE; i++) {
3584 struct tg3_rx_buffer_desc *rxd; 3839 struct tg3_rx_buffer_desc *rxd;
3585 3840
@@ -3600,7 +3855,7 @@ static void tg3_init_rings(struct tg3 *tp)
3600 break; 3855 break;
3601 } 3856 }
3602 3857
3603 if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 3858 if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) {
3604 for (i = 0; i < tp->rx_jumbo_pending; i++) { 3859 for (i = 0; i < tp->rx_jumbo_pending; i++) {
3605 if (tg3_alloc_rx_skb(tp, RXD_OPAQUE_RING_JUMBO, 3860 if (tg3_alloc_rx_skb(tp, RXD_OPAQUE_RING_JUMBO,
3606 -1, i) < 0) 3861 -1, i) < 0)
@@ -4056,7 +4311,30 @@ static int tg3_chip_reset(struct tg3 *tp)
4056 val &= ~PCIX_CAPS_RELAXED_ORDERING; 4311 val &= ~PCIX_CAPS_RELAXED_ORDERING;
4057 pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val); 4312 pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val);
4058 4313
4059 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 4314 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
4315 u32 val;
4316
4317 /* Chip reset on 5780 will reset MSI enable bit,
4318 * so need to restore it.
4319 */
4320 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
4321 u16 ctrl;
4322
4323 pci_read_config_word(tp->pdev,
4324 tp->msi_cap + PCI_MSI_FLAGS,
4325 &ctrl);
4326 pci_write_config_word(tp->pdev,
4327 tp->msi_cap + PCI_MSI_FLAGS,
4328 ctrl | PCI_MSI_FLAGS_ENABLE);
4329 val = tr32(MSGINT_MODE);
4330 tw32(MSGINT_MODE, val | MSGINT_MODE_ENABLE);
4331 }
4332
4333 val = tr32(MEMARB_MODE);
4334 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE);
4335
4336 } else
4337 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
4060 4338
4061 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) { 4339 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) {
4062 tg3_stop_fw(tp); 4340 tg3_stop_fw(tp);
@@ -4082,6 +4360,9 @@ static int tg3_chip_reset(struct tg3 *tp)
4082 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 4360 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
4083 tp->mac_mode = MAC_MODE_PORT_MODE_TBI; 4361 tp->mac_mode = MAC_MODE_PORT_MODE_TBI;
4084 tw32_f(MAC_MODE, tp->mac_mode); 4362 tw32_f(MAC_MODE, tp->mac_mode);
4363 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
4364 tp->mac_mode = MAC_MODE_PORT_MODE_GMII;
4365 tw32_f(MAC_MODE, tp->mac_mode);
4085 } else 4366 } else
4086 tw32_f(MAC_MODE, 0); 4367 tw32_f(MAC_MODE, 0);
4087 udelay(40); 4368 udelay(40);
@@ -5088,9 +5369,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
5088 5369
5089 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 5370 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
5090 5371
5091 spin_lock_irq(&tp->lock); 5372 spin_lock_bh(&tp->lock);
5092 __tg3_set_mac_addr(tp); 5373 __tg3_set_mac_addr(tp);
5093 spin_unlock_irq(&tp->lock); 5374 spin_unlock_bh(&tp->lock);
5094 5375
5095 return 0; 5376 return 0;
5096} 5377}
@@ -5117,7 +5398,7 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr,
5117} 5398}
5118 5399
5119static void __tg3_set_rx_mode(struct net_device *); 5400static void __tg3_set_rx_mode(struct net_device *);
5120static void tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) 5401static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
5121{ 5402{
5122 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs); 5403 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs);
5123 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs); 5404 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs);
@@ -5245,7 +5526,7 @@ static int tg3_reset_hw(struct tg3 *tp)
5245 } 5526 }
5246#endif 5527#endif
5247 5528
5248 if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) { 5529 if (tp->dev->mtu <= ETH_DATA_LEN) {
5249 tw32(BUFMGR_MB_RDMA_LOW_WATER, 5530 tw32(BUFMGR_MB_RDMA_LOW_WATER,
5250 tp->bufmgr_config.mbuf_read_dma_low_water); 5531 tp->bufmgr_config.mbuf_read_dma_low_water);
5251 tw32(BUFMGR_MB_MACRX_LOW_WATER, 5532 tw32(BUFMGR_MB_MACRX_LOW_WATER,
@@ -5320,7 +5601,7 @@ static int tg3_reset_hw(struct tg3 *tp)
5320 /* Setup replenish threshold. */ 5601 /* Setup replenish threshold. */
5321 tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8); 5602 tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8);
5322 5603
5323 if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 5604 if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) {
5324 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, 5605 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH,
5325 ((u64) tp->rx_jumbo_mapping >> 32)); 5606 ((u64) tp->rx_jumbo_mapping >> 32));
5326 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, 5607 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
@@ -5381,7 +5662,7 @@ static int tg3_reset_hw(struct tg3 *tp)
5381 tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, 5662 tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW,
5382 tp->rx_std_ptr); 5663 tp->rx_std_ptr);
5383 5664
5384 tp->rx_jumbo_ptr = (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) ? 5665 tp->rx_jumbo_ptr = (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) ?
5385 tp->rx_jumbo_pending : 0; 5666 tp->rx_jumbo_pending : 0;
5386 tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 5667 tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW,
5387 tp->rx_jumbo_ptr); 5668 tp->rx_jumbo_ptr);
@@ -5460,7 +5741,7 @@ static int tg3_reset_hw(struct tg3 *tp)
5460 udelay(10); 5741 udelay(10);
5461 } 5742 }
5462 5743
5463 tg3_set_coalesce(tp, &tp->coal); 5744 __tg3_set_coalesce(tp, &tp->coal);
5464 5745
5465 /* set status block DMA address */ 5746 /* set status block DMA address */
5466 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 5747 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
@@ -5683,7 +5964,8 @@ static int tg3_reset_hw(struct tg3 *tp)
5683 tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK); 5964 tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK);
5684 tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK); 5965 tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK);
5685 5966
5686 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) 5967 if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) &&
5968 (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780))
5687 limit = 8; 5969 limit = 8;
5688 else 5970 else
5689 limit = 16; 5971 limit = 16;
@@ -5727,9 +6009,6 @@ static int tg3_reset_hw(struct tg3 *tp)
5727 6009
5728 tg3_write_sig_post_reset(tp, RESET_KIND_INIT); 6010 tg3_write_sig_post_reset(tp, RESET_KIND_INIT);
5729 6011
5730 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)
5731 tg3_enable_ints(tp);
5732
5733 return 0; 6012 return 0;
5734} 6013}
5735 6014
@@ -5802,10 +6081,8 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp)
5802static void tg3_timer(unsigned long __opaque) 6081static void tg3_timer(unsigned long __opaque)
5803{ 6082{
5804 struct tg3 *tp = (struct tg3 *) __opaque; 6083 struct tg3 *tp = (struct tg3 *) __opaque;
5805 unsigned long flags;
5806 6084
5807 spin_lock_irqsave(&tp->lock, flags); 6085 spin_lock(&tp->lock);
5808 spin_lock(&tp->tx_lock);
5809 6086
5810 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { 6087 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) {
5811 /* All of this garbage is because when using non-tagged 6088 /* All of this garbage is because when using non-tagged
@@ -5822,8 +6099,7 @@ static void tg3_timer(unsigned long __opaque)
5822 6099
5823 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 6100 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
5824 tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER; 6101 tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER;
5825 spin_unlock(&tp->tx_lock); 6102 spin_unlock(&tp->lock);
5826 spin_unlock_irqrestore(&tp->lock, flags);
5827 schedule_work(&tp->reset_task); 6103 schedule_work(&tp->reset_task);
5828 return; 6104 return;
5829 } 6105 }
@@ -5871,7 +6147,8 @@ static void tg3_timer(unsigned long __opaque)
5871 udelay(40); 6147 udelay(40);
5872 tg3_setup_phy(tp, 0); 6148 tg3_setup_phy(tp, 0);
5873 } 6149 }
5874 } 6150 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)
6151 tg3_serdes_parallel_detect(tp);
5875 6152
5876 tp->timer_counter = tp->timer_multiplier; 6153 tp->timer_counter = tp->timer_multiplier;
5877 } 6154 }
@@ -5891,8 +6168,7 @@ static void tg3_timer(unsigned long __opaque)
5891 tp->asf_counter = tp->asf_multiplier; 6168 tp->asf_counter = tp->asf_multiplier;
5892 } 6169 }
5893 6170
5894 spin_unlock(&tp->tx_lock); 6171 spin_unlock(&tp->lock);
5895 spin_unlock_irqrestore(&tp->lock, flags);
5896 6172
5897 tp->timer.expires = jiffies + tp->timer_offset; 6173 tp->timer.expires = jiffies + tp->timer_offset;
5898 add_timer(&tp->timer); 6174 add_timer(&tp->timer);
@@ -6007,14 +6283,12 @@ static int tg3_test_msi(struct tg3 *tp)
6007 /* Need to reset the chip because the MSI cycle may have terminated 6283 /* Need to reset the chip because the MSI cycle may have terminated
6008 * with Master Abort. 6284 * with Master Abort.
6009 */ 6285 */
6010 spin_lock_irq(&tp->lock); 6286 tg3_full_lock(tp, 1);
6011 spin_lock(&tp->tx_lock);
6012 6287
6013 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 6288 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
6014 err = tg3_init_hw(tp); 6289 err = tg3_init_hw(tp);
6015 6290
6016 spin_unlock(&tp->tx_lock); 6291 tg3_full_unlock(tp);
6017 spin_unlock_irq(&tp->lock);
6018 6292
6019 if (err) 6293 if (err)
6020 free_irq(tp->pdev->irq, dev); 6294 free_irq(tp->pdev->irq, dev);
@@ -6027,14 +6301,12 @@ static int tg3_open(struct net_device *dev)
6027 struct tg3 *tp = netdev_priv(dev); 6301 struct tg3 *tp = netdev_priv(dev);
6028 int err; 6302 int err;
6029 6303
6030 spin_lock_irq(&tp->lock); 6304 tg3_full_lock(tp, 0);
6031 spin_lock(&tp->tx_lock);
6032 6305
6033 tg3_disable_ints(tp); 6306 tg3_disable_ints(tp);
6034 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; 6307 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
6035 6308
6036 spin_unlock(&tp->tx_lock); 6309 tg3_full_unlock(tp);
6037 spin_unlock_irq(&tp->lock);
6038 6310
6039 /* The placement of this call is tied 6311 /* The placement of this call is tied
6040 * to the setup and use of Host TX descriptors. 6312 * to the setup and use of Host TX descriptors.
@@ -6081,8 +6353,7 @@ static int tg3_open(struct net_device *dev)
6081 return err; 6353 return err;
6082 } 6354 }
6083 6355
6084 spin_lock_irq(&tp->lock); 6356 tg3_full_lock(tp, 0);
6085 spin_lock(&tp->tx_lock);
6086 6357
6087 err = tg3_init_hw(tp); 6358 err = tg3_init_hw(tp);
6088 if (err) { 6359 if (err) {
@@ -6106,8 +6377,7 @@ static int tg3_open(struct net_device *dev)
6106 tp->timer.function = tg3_timer; 6377 tp->timer.function = tg3_timer;
6107 } 6378 }
6108 6379
6109 spin_unlock(&tp->tx_lock); 6380 tg3_full_unlock(tp);
6110 spin_unlock_irq(&tp->lock);
6111 6381
6112 if (err) { 6382 if (err) {
6113 free_irq(tp->pdev->irq, dev); 6383 free_irq(tp->pdev->irq, dev);
@@ -6123,8 +6393,7 @@ static int tg3_open(struct net_device *dev)
6123 err = tg3_test_msi(tp); 6393 err = tg3_test_msi(tp);
6124 6394
6125 if (err) { 6395 if (err) {
6126 spin_lock_irq(&tp->lock); 6396 tg3_full_lock(tp, 0);
6127 spin_lock(&tp->tx_lock);
6128 6397
6129 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 6398 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
6130 pci_disable_msi(tp->pdev); 6399 pci_disable_msi(tp->pdev);
@@ -6134,22 +6403,19 @@ static int tg3_open(struct net_device *dev)
6134 tg3_free_rings(tp); 6403 tg3_free_rings(tp);
6135 tg3_free_consistent(tp); 6404 tg3_free_consistent(tp);
6136 6405
6137 spin_unlock(&tp->tx_lock); 6406 tg3_full_unlock(tp);
6138 spin_unlock_irq(&tp->lock);
6139 6407
6140 return err; 6408 return err;
6141 } 6409 }
6142 } 6410 }
6143 6411
6144 spin_lock_irq(&tp->lock); 6412 tg3_full_lock(tp, 0);
6145 spin_lock(&tp->tx_lock);
6146 6413
6147 add_timer(&tp->timer); 6414 add_timer(&tp->timer);
6148 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; 6415 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
6149 tg3_enable_ints(tp); 6416 tg3_enable_ints(tp);
6150 6417
6151 spin_unlock(&tp->tx_lock); 6418 tg3_full_unlock(tp);
6152 spin_unlock_irq(&tp->lock);
6153 6419
6154 netif_start_queue(dev); 6420 netif_start_queue(dev);
6155 6421
@@ -6395,8 +6661,7 @@ static int tg3_close(struct net_device *dev)
6395 6661
6396 del_timer_sync(&tp->timer); 6662 del_timer_sync(&tp->timer);
6397 6663
6398 spin_lock_irq(&tp->lock); 6664 tg3_full_lock(tp, 1);
6399 spin_lock(&tp->tx_lock);
6400#if 0 6665#if 0
6401 tg3_dump_state(tp); 6666 tg3_dump_state(tp);
6402#endif 6667#endif
@@ -6410,8 +6675,7 @@ static int tg3_close(struct net_device *dev)
6410 TG3_FLAG_GOT_SERDES_FLOWCTL); 6675 TG3_FLAG_GOT_SERDES_FLOWCTL);
6411 netif_carrier_off(tp->dev); 6676 netif_carrier_off(tp->dev);
6412 6677
6413 spin_unlock(&tp->tx_lock); 6678 tg3_full_unlock(tp);
6414 spin_unlock_irq(&tp->lock);
6415 6679
6416 free_irq(tp->pdev->irq, dev); 6680 free_irq(tp->pdev->irq, dev);
6417 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 6681 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
@@ -6448,16 +6712,15 @@ static unsigned long calc_crc_errors(struct tg3 *tp)
6448 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 6712 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) &&
6449 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 6713 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
6450 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) { 6714 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) {
6451 unsigned long flags;
6452 u32 val; 6715 u32 val;
6453 6716
6454 spin_lock_irqsave(&tp->lock, flags); 6717 spin_lock_bh(&tp->lock);
6455 if (!tg3_readphy(tp, 0x1e, &val)) { 6718 if (!tg3_readphy(tp, 0x1e, &val)) {
6456 tg3_writephy(tp, 0x1e, val | 0x8000); 6719 tg3_writephy(tp, 0x1e, val | 0x8000);
6457 tg3_readphy(tp, 0x14, &val); 6720 tg3_readphy(tp, 0x14, &val);
6458 } else 6721 } else
6459 val = 0; 6722 val = 0;
6460 spin_unlock_irqrestore(&tp->lock, flags); 6723 spin_unlock_bh(&tp->lock);
6461 6724
6462 tp->phy_crc_errors += val; 6725 tp->phy_crc_errors += val;
6463 6726
@@ -6719,11 +6982,9 @@ static void tg3_set_rx_mode(struct net_device *dev)
6719{ 6982{
6720 struct tg3 *tp = netdev_priv(dev); 6983 struct tg3 *tp = netdev_priv(dev);
6721 6984
6722 spin_lock_irq(&tp->lock); 6985 tg3_full_lock(tp, 0);
6723 spin_lock(&tp->tx_lock);
6724 __tg3_set_rx_mode(dev); 6986 __tg3_set_rx_mode(dev);
6725 spin_unlock(&tp->tx_lock); 6987 tg3_full_unlock(tp);
6726 spin_unlock_irq(&tp->lock);
6727} 6988}
6728 6989
6729#define TG3_REGDUMP_LEN (32 * 1024) 6990#define TG3_REGDUMP_LEN (32 * 1024)
@@ -6745,8 +7006,7 @@ static void tg3_get_regs(struct net_device *dev,
6745 7006
6746 memset(p, 0, TG3_REGDUMP_LEN); 7007 memset(p, 0, TG3_REGDUMP_LEN);
6747 7008
6748 spin_lock_irq(&tp->lock); 7009 tg3_full_lock(tp, 0);
6749 spin_lock(&tp->tx_lock);
6750 7010
6751#define __GET_REG32(reg) (*(p)++ = tr32(reg)) 7011#define __GET_REG32(reg) (*(p)++ = tr32(reg))
6752#define GET_REG32_LOOP(base,len) \ 7012#define GET_REG32_LOOP(base,len) \
@@ -6796,8 +7056,7 @@ do { p = (u32 *)(orig_p + (reg)); \
6796#undef GET_REG32_LOOP 7056#undef GET_REG32_LOOP
6797#undef GET_REG32_1 7057#undef GET_REG32_1
6798 7058
6799 spin_unlock(&tp->tx_lock); 7059 tg3_full_unlock(tp);
6800 spin_unlock_irq(&tp->lock);
6801} 7060}
6802 7061
6803static int tg3_get_eeprom_len(struct net_device *dev) 7062static int tg3_get_eeprom_len(struct net_device *dev)
@@ -6973,8 +7232,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
6973 return -EINVAL; 7232 return -EINVAL;
6974 } 7233 }
6975 7234
6976 spin_lock_irq(&tp->lock); 7235 tg3_full_lock(tp, 0);
6977 spin_lock(&tp->tx_lock);
6978 7236
6979 tp->link_config.autoneg = cmd->autoneg; 7237 tp->link_config.autoneg = cmd->autoneg;
6980 if (cmd->autoneg == AUTONEG_ENABLE) { 7238 if (cmd->autoneg == AUTONEG_ENABLE) {
@@ -6990,8 +7248,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
6990 if (netif_running(dev)) 7248 if (netif_running(dev))
6991 tg3_setup_phy(tp, 1); 7249 tg3_setup_phy(tp, 1);
6992 7250
6993 spin_unlock(&tp->tx_lock); 7251 tg3_full_unlock(tp);
6994 spin_unlock_irq(&tp->lock);
6995 7252
6996 return 0; 7253 return 0;
6997} 7254}
@@ -7027,12 +7284,12 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
7027 !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP)) 7284 !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP))
7028 return -EINVAL; 7285 return -EINVAL;
7029 7286
7030 spin_lock_irq(&tp->lock); 7287 spin_lock_bh(&tp->lock);
7031 if (wol->wolopts & WAKE_MAGIC) 7288 if (wol->wolopts & WAKE_MAGIC)
7032 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 7289 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
7033 else 7290 else
7034 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE; 7291 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
7035 spin_unlock_irq(&tp->lock); 7292 spin_unlock_bh(&tp->lock);
7036 7293
7037 return 0; 7294 return 0;
7038} 7295}
@@ -7072,7 +7329,7 @@ static int tg3_nway_reset(struct net_device *dev)
7072 if (!netif_running(dev)) 7329 if (!netif_running(dev))
7073 return -EAGAIN; 7330 return -EAGAIN;
7074 7331
7075 spin_lock_irq(&tp->lock); 7332 spin_lock_bh(&tp->lock);
7076 r = -EINVAL; 7333 r = -EINVAL;
7077 tg3_readphy(tp, MII_BMCR, &bmcr); 7334 tg3_readphy(tp, MII_BMCR, &bmcr);
7078 if (!tg3_readphy(tp, MII_BMCR, &bmcr) && 7335 if (!tg3_readphy(tp, MII_BMCR, &bmcr) &&
@@ -7080,7 +7337,7 @@ static int tg3_nway_reset(struct net_device *dev)
7080 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART); 7337 tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANRESTART);
7081 r = 0; 7338 r = 0;
7082 } 7339 }
7083 spin_unlock_irq(&tp->lock); 7340 spin_unlock_bh(&tp->lock);
7084 7341
7085 return r; 7342 return r;
7086} 7343}
@@ -7102,17 +7359,19 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
7102static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) 7359static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
7103{ 7360{
7104 struct tg3 *tp = netdev_priv(dev); 7361 struct tg3 *tp = netdev_priv(dev);
7362 int irq_sync = 0;
7105 7363
7106 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 7364 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
7107 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 7365 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
7108 (ering->tx_pending > TG3_TX_RING_SIZE - 1)) 7366 (ering->tx_pending > TG3_TX_RING_SIZE - 1))
7109 return -EINVAL; 7367 return -EINVAL;
7110 7368
7111 if (netif_running(dev)) 7369 if (netif_running(dev)) {
7112 tg3_netif_stop(tp); 7370 tg3_netif_stop(tp);
7371 irq_sync = 1;
7372 }
7113 7373
7114 spin_lock_irq(&tp->lock); 7374 tg3_full_lock(tp, irq_sync);
7115 spin_lock(&tp->tx_lock);
7116 7375
7117 tp->rx_pending = ering->rx_pending; 7376 tp->rx_pending = ering->rx_pending;
7118 7377
@@ -7128,8 +7387,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
7128 tg3_netif_start(tp); 7387 tg3_netif_start(tp);
7129 } 7388 }
7130 7389
7131 spin_unlock(&tp->tx_lock); 7390 tg3_full_unlock(tp);
7132 spin_unlock_irq(&tp->lock);
7133 7391
7134 return 0; 7392 return 0;
7135} 7393}
@@ -7146,12 +7404,15 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam
7146static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) 7404static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
7147{ 7405{
7148 struct tg3 *tp = netdev_priv(dev); 7406 struct tg3 *tp = netdev_priv(dev);
7407 int irq_sync = 0;
7149 7408
7150 if (netif_running(dev)) 7409 if (netif_running(dev)) {
7151 tg3_netif_stop(tp); 7410 tg3_netif_stop(tp);
7411 irq_sync = 1;
7412 }
7413
7414 tg3_full_lock(tp, irq_sync);
7152 7415
7153 spin_lock_irq(&tp->lock);
7154 spin_lock(&tp->tx_lock);
7155 if (epause->autoneg) 7416 if (epause->autoneg)
7156 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; 7417 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG;
7157 else 7418 else
@@ -7170,8 +7431,8 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
7170 tg3_init_hw(tp); 7431 tg3_init_hw(tp);
7171 tg3_netif_start(tp); 7432 tg3_netif_start(tp);
7172 } 7433 }
7173 spin_unlock(&tp->tx_lock); 7434
7174 spin_unlock_irq(&tp->lock); 7435 tg3_full_unlock(tp);
7175 7436
7176 return 0; 7437 return 0;
7177} 7438}
@@ -7192,12 +7453,12 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data)
7192 return 0; 7453 return 0;
7193 } 7454 }
7194 7455
7195 spin_lock_irq(&tp->lock); 7456 spin_lock_bh(&tp->lock);
7196 if (data) 7457 if (data)
7197 tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS; 7458 tp->tg3_flags |= TG3_FLAG_RX_CHECKSUMS;
7198 else 7459 else
7199 tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS; 7460 tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS;
7200 spin_unlock_irq(&tp->lock); 7461 spin_unlock_bh(&tp->lock);
7201 7462
7202 return 0; 7463 return 0;
7203} 7464}
@@ -7604,10 +7865,6 @@ static int tg3_test_loopback(struct tg3 *tp)
7604 7865
7605 err = -EIO; 7866 err = -EIO;
7606 7867
7607 tg3_abort_hw(tp, 1);
7608
7609 /* Clearing this flag to keep interrupts disabled */
7610 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
7611 tg3_reset_hw(tp); 7868 tg3_reset_hw(tp);
7612 7869
7613 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | 7870 mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) |
@@ -7716,11 +7973,14 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7716 data[1] = 1; 7973 data[1] = 1;
7717 } 7974 }
7718 if (etest->flags & ETH_TEST_FL_OFFLINE) { 7975 if (etest->flags & ETH_TEST_FL_OFFLINE) {
7719 if (netif_running(dev)) 7976 int irq_sync = 0;
7977
7978 if (netif_running(dev)) {
7720 tg3_netif_stop(tp); 7979 tg3_netif_stop(tp);
7980 irq_sync = 1;
7981 }
7721 7982
7722 spin_lock_irq(&tp->lock); 7983 tg3_full_lock(tp, irq_sync);
7723 spin_lock(&tp->tx_lock);
7724 7984
7725 tg3_halt(tp, RESET_KIND_SUSPEND, 1); 7985 tg3_halt(tp, RESET_KIND_SUSPEND, 1);
7726 tg3_nvram_lock(tp); 7986 tg3_nvram_lock(tp);
@@ -7742,14 +8002,14 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7742 data[4] = 1; 8002 data[4] = 1;
7743 } 8003 }
7744 8004
7745 spin_unlock(&tp->tx_lock); 8005 tg3_full_unlock(tp);
7746 spin_unlock_irq(&tp->lock); 8006
7747 if (tg3_test_interrupt(tp) != 0) { 8007 if (tg3_test_interrupt(tp) != 0) {
7748 etest->flags |= ETH_TEST_FL_FAILED; 8008 etest->flags |= ETH_TEST_FL_FAILED;
7749 data[5] = 1; 8009 data[5] = 1;
7750 } 8010 }
7751 spin_lock_irq(&tp->lock); 8011
7752 spin_lock(&tp->tx_lock); 8012 tg3_full_lock(tp, 0);
7753 8013
7754 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 8014 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
7755 if (netif_running(dev)) { 8015 if (netif_running(dev)) {
@@ -7757,8 +8017,8 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
7757 tg3_init_hw(tp); 8017 tg3_init_hw(tp);
7758 tg3_netif_start(tp); 8018 tg3_netif_start(tp);
7759 } 8019 }
7760 spin_unlock(&tp->tx_lock); 8020
7761 spin_unlock_irq(&tp->lock); 8021 tg3_full_unlock(tp);
7762 } 8022 }
7763} 8023}
7764 8024
@@ -7779,9 +8039,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7779 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 8039 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
7780 break; /* We have no PHY */ 8040 break; /* We have no PHY */
7781 8041
7782 spin_lock_irq(&tp->lock); 8042 spin_lock_bh(&tp->lock);
7783 err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval); 8043 err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval);
7784 spin_unlock_irq(&tp->lock); 8044 spin_unlock_bh(&tp->lock);
7785 8045
7786 data->val_out = mii_regval; 8046 data->val_out = mii_regval;
7787 8047
@@ -7795,9 +8055,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7795 if (!capable(CAP_NET_ADMIN)) 8055 if (!capable(CAP_NET_ADMIN))
7796 return -EPERM; 8056 return -EPERM;
7797 8057
7798 spin_lock_irq(&tp->lock); 8058 spin_lock_bh(&tp->lock);
7799 err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in); 8059 err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in);
7800 spin_unlock_irq(&tp->lock); 8060 spin_unlock_bh(&tp->lock);
7801 8061
7802 return err; 8062 return err;
7803 8063
@@ -7813,28 +8073,24 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
7813{ 8073{
7814 struct tg3 *tp = netdev_priv(dev); 8074 struct tg3 *tp = netdev_priv(dev);
7815 8075
7816 spin_lock_irq(&tp->lock); 8076 tg3_full_lock(tp, 0);
7817 spin_lock(&tp->tx_lock);
7818 8077
7819 tp->vlgrp = grp; 8078 tp->vlgrp = grp;
7820 8079
7821 /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */ 8080 /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */
7822 __tg3_set_rx_mode(dev); 8081 __tg3_set_rx_mode(dev);
7823 8082
7824 spin_unlock(&tp->tx_lock); 8083 tg3_full_unlock(tp);
7825 spin_unlock_irq(&tp->lock);
7826} 8084}
7827 8085
7828static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 8086static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
7829{ 8087{
7830 struct tg3 *tp = netdev_priv(dev); 8088 struct tg3 *tp = netdev_priv(dev);
7831 8089
7832 spin_lock_irq(&tp->lock); 8090 tg3_full_lock(tp, 0);
7833 spin_lock(&tp->tx_lock);
7834 if (tp->vlgrp) 8091 if (tp->vlgrp)
7835 tp->vlgrp->vlan_devices[vid] = NULL; 8092 tp->vlgrp->vlan_devices[vid] = NULL;
7836 spin_unlock(&tp->tx_lock); 8093 tg3_full_unlock(tp);
7837 spin_unlock_irq(&tp->lock);
7838} 8094}
7839#endif 8095#endif
7840 8096
@@ -7846,6 +8102,60 @@ static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
7846 return 0; 8102 return 0;
7847} 8103}
7848 8104
8105static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
8106{
8107 struct tg3 *tp = netdev_priv(dev);
8108 u32 max_rxcoal_tick_int = 0, max_txcoal_tick_int = 0;
8109 u32 max_stat_coal_ticks = 0, min_stat_coal_ticks = 0;
8110
8111 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
8112 max_rxcoal_tick_int = MAX_RXCOAL_TICK_INT;
8113 max_txcoal_tick_int = MAX_TXCOAL_TICK_INT;
8114 max_stat_coal_ticks = MAX_STAT_COAL_TICKS;
8115 min_stat_coal_ticks = MIN_STAT_COAL_TICKS;
8116 }
8117
8118 if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) ||
8119 (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) ||
8120 (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) ||
8121 (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) ||
8122 (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) ||
8123 (ec->tx_coalesce_usecs_irq > max_txcoal_tick_int) ||
8124 (ec->rx_max_coalesced_frames_irq > MAX_RXCOAL_MAXF_INT) ||
8125 (ec->tx_max_coalesced_frames_irq > MAX_TXCOAL_MAXF_INT) ||
8126 (ec->stats_block_coalesce_usecs > max_stat_coal_ticks) ||
8127 (ec->stats_block_coalesce_usecs < min_stat_coal_ticks))
8128 return -EINVAL;
8129
8130 /* No rx interrupts will be generated if both are zero */
8131 if ((ec->rx_coalesce_usecs == 0) &&
8132 (ec->rx_max_coalesced_frames == 0))
8133 return -EINVAL;
8134
8135 /* No tx interrupts will be generated if both are zero */
8136 if ((ec->tx_coalesce_usecs == 0) &&
8137 (ec->tx_max_coalesced_frames == 0))
8138 return -EINVAL;
8139
8140 /* Only copy relevant parameters, ignore all others. */
8141 tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs;
8142 tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs;
8143 tp->coal.rx_max_coalesced_frames = ec->rx_max_coalesced_frames;
8144 tp->coal.tx_max_coalesced_frames = ec->tx_max_coalesced_frames;
8145 tp->coal.rx_coalesce_usecs_irq = ec->rx_coalesce_usecs_irq;
8146 tp->coal.tx_coalesce_usecs_irq = ec->tx_coalesce_usecs_irq;
8147 tp->coal.rx_max_coalesced_frames_irq = ec->rx_max_coalesced_frames_irq;
8148 tp->coal.tx_max_coalesced_frames_irq = ec->tx_max_coalesced_frames_irq;
8149 tp->coal.stats_block_coalesce_usecs = ec->stats_block_coalesce_usecs;
8150
8151 if (netif_running(dev)) {
8152 tg3_full_lock(tp, 0);
8153 __tg3_set_coalesce(tp, &tp->coal);
8154 tg3_full_unlock(tp);
8155 }
8156 return 0;
8157}
8158
7849static struct ethtool_ops tg3_ethtool_ops = { 8159static struct ethtool_ops tg3_ethtool_ops = {
7850 .get_settings = tg3_get_settings, 8160 .get_settings = tg3_get_settings,
7851 .set_settings = tg3_set_settings, 8161 .set_settings = tg3_set_settings,
@@ -7881,6 +8191,7 @@ static struct ethtool_ops tg3_ethtool_ops = {
7881 .get_stats_count = tg3_get_stats_count, 8191 .get_stats_count = tg3_get_stats_count,
7882 .get_ethtool_stats = tg3_get_ethtool_stats, 8192 .get_ethtool_stats = tg3_get_ethtool_stats,
7883 .get_coalesce = tg3_get_coalesce, 8193 .get_coalesce = tg3_get_coalesce,
8194 .set_coalesce = tg3_set_coalesce,
7884}; 8195};
7885 8196
7886static void __devinit tg3_get_eeprom_size(struct tg3 *tp) 8197static void __devinit tg3_get_eeprom_size(struct tg3 *tp)
@@ -8539,8 +8850,12 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
8539 eeprom_phy_id = 0; 8850 eeprom_phy_id = 0;
8540 8851
8541 tp->phy_id = eeprom_phy_id; 8852 tp->phy_id = eeprom_phy_id;
8542 if (eeprom_phy_serdes) 8853 if (eeprom_phy_serdes) {
8543 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 8854 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780)
8855 tp->tg3_flags2 |= TG3_FLG2_MII_SERDES;
8856 else
8857 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES;
8858 }
8544 8859
8545 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 8860 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
8546 led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK | 8861 led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK |
@@ -8653,6 +8968,8 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
8653 tp->phy_id = hw_phy_id; 8968 tp->phy_id = hw_phy_id;
8654 if (hw_phy_id_masked == PHY_ID_BCM8002) 8969 if (hw_phy_id_masked == PHY_ID_BCM8002)
8655 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 8970 tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES;
8971 else
8972 tp->tg3_flags2 &= ~TG3_FLG2_PHY_SERDES;
8656 } else { 8973 } else {
8657 if (tp->phy_id != PHY_ID_INVALID) { 8974 if (tp->phy_id != PHY_ID_INVALID) {
8658 /* Do nothing, phy ID already set up in 8975 /* Do nothing, phy ID already set up in
@@ -8675,7 +8992,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
8675 } 8992 }
8676 } 8993 }
8677 8994
8678 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 8995 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) &&
8679 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { 8996 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
8680 u32 bmsr, adv_reg, tg3_ctrl; 8997 u32 bmsr, adv_reg, tg3_ctrl;
8681 8998
@@ -8728,7 +9045,7 @@ skip_phy_reset:
8728 err = tg3_init_5401phy_dsp(tp); 9045 err = tg3_init_5401phy_dsp(tp);
8729 } 9046 }
8730 9047
8731 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 9048 if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)
8732 tp->link_config.advertising = 9049 tp->link_config.advertising =
8733 (ADVERTISED_1000baseT_Half | 9050 (ADVERTISED_1000baseT_Half |
8734 ADVERTISED_1000baseT_Full | 9051 ADVERTISED_1000baseT_Full |
@@ -8898,6 +9215,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
8898 if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW) 9215 if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW)
8899 tp->pci_chip_rev_id = CHIPREV_ID_5752_A0; 9216 tp->pci_chip_rev_id = CHIPREV_ID_5752_A0;
8900 9217
9218 /* Find msi capability. */
9219 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780)
9220 tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI);
9221
8901 /* Initialize misc host control in PCI block. */ 9222 /* Initialize misc host control in PCI block. */
8902 tp->misc_host_ctrl |= (misc_ctrl_reg & 9223 tp->misc_host_ctrl |= (misc_ctrl_reg &
8903 MISC_HOST_CTRL_CHIPREV); 9224 MISC_HOST_CTRL_CHIPREV);
@@ -8913,7 +9234,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
8913 tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; 9234 tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff;
8914 9235
8915 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || 9236 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
8916 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 9237 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
9238 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780)
8917 tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; 9239 tp->tg3_flags2 |= TG3_FLG2_5750_PLUS;
8918 9240
8919 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) || 9241 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) ||
@@ -8923,6 +9245,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
8923 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 9245 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS)
8924 tp->tg3_flags2 |= TG3_FLG2_HW_TSO; 9246 tp->tg3_flags2 |= TG3_FLG2_HW_TSO;
8925 9247
9248 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
9249 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 &&
9250 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752)
9251 tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE;
9252
8926 if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) 9253 if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0)
8927 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; 9254 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
8928 9255
@@ -9049,8 +9376,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9049 /* Derive initial jumbo mode from MTU assigned in 9376 /* Derive initial jumbo mode from MTU assigned in
9050 * ether_setup() via the alloc_etherdev() call 9377 * ether_setup() via the alloc_etherdev() call
9051 */ 9378 */
9052 if (tp->dev->mtu > ETH_DATA_LEN) 9379 if (tp->dev->mtu > ETH_DATA_LEN &&
9053 tp->tg3_flags |= TG3_FLAG_JUMBO_ENABLE; 9380 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780)
9381 tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE;
9054 9382
9055 /* Determine WakeOnLan speed to use. */ 9383 /* Determine WakeOnLan speed to use. */
9056 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 9384 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -9066,7 +9394,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9066 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) || 9394 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
9067 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && 9395 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
9068 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && 9396 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
9069 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1))) 9397 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) ||
9398 (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES))
9070 tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; 9399 tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED;
9071 9400
9072 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX || 9401 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX ||
@@ -9275,8 +9604,9 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
9275#endif 9604#endif
9276 9605
9277 mac_offset = 0x7c; 9606 mac_offset = 0x7c;
9278 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && 9607 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
9279 !(tp->tg3_flags & TG3_FLG2_SUN_570X)) { 9608 !(tp->tg3_flags & TG3_FLG2_SUN_570X)) ||
9609 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
9280 if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) 9610 if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID)
9281 mac_offset = 0xcc; 9611 mac_offset = 0xcc;
9282 if (tg3_nvram_lock(tp)) 9612 if (tg3_nvram_lock(tp))
@@ -9590,6 +9920,9 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
9590 9920
9591 /* Set bit 23 to enable PCIX hw bug fix */ 9921 /* Set bit 23 to enable PCIX hw bug fix */
9592 tp->dma_rwctrl |= 0x009f0000; 9922 tp->dma_rwctrl |= 0x009f0000;
9923 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) {
9924 /* 5780 always in PCIX mode */
9925 tp->dma_rwctrl |= 0x00144000;
9593 } else { 9926 } else {
9594 tp->dma_rwctrl |= 0x001b000f; 9927 tp->dma_rwctrl |= 0x001b000f;
9595 } 9928 }
@@ -9743,19 +10076,35 @@ static void __devinit tg3_init_link_config(struct tg3 *tp)
9743 10076
9744static void __devinit tg3_init_bufmgr_config(struct tg3 *tp) 10077static void __devinit tg3_init_bufmgr_config(struct tg3 *tp)
9745{ 10078{
9746 tp->bufmgr_config.mbuf_read_dma_low_water = 10079 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
9747 DEFAULT_MB_RDMA_LOW_WATER; 10080 tp->bufmgr_config.mbuf_read_dma_low_water =
9748 tp->bufmgr_config.mbuf_mac_rx_low_water = 10081 DEFAULT_MB_RDMA_LOW_WATER_5705;
9749 DEFAULT_MB_MACRX_LOW_WATER; 10082 tp->bufmgr_config.mbuf_mac_rx_low_water =
9750 tp->bufmgr_config.mbuf_high_water = 10083 DEFAULT_MB_MACRX_LOW_WATER_5705;
9751 DEFAULT_MB_HIGH_WATER; 10084 tp->bufmgr_config.mbuf_high_water =
10085 DEFAULT_MB_HIGH_WATER_5705;
9752 10086
9753 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = 10087 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
9754 DEFAULT_MB_RDMA_LOW_WATER_JUMBO; 10088 DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780;
9755 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo = 10089 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo =
9756 DEFAULT_MB_MACRX_LOW_WATER_JUMBO; 10090 DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780;
9757 tp->bufmgr_config.mbuf_high_water_jumbo = 10091 tp->bufmgr_config.mbuf_high_water_jumbo =
9758 DEFAULT_MB_HIGH_WATER_JUMBO; 10092 DEFAULT_MB_HIGH_WATER_JUMBO_5780;
10093 } else {
10094 tp->bufmgr_config.mbuf_read_dma_low_water =
10095 DEFAULT_MB_RDMA_LOW_WATER;
10096 tp->bufmgr_config.mbuf_mac_rx_low_water =
10097 DEFAULT_MB_MACRX_LOW_WATER;
10098 tp->bufmgr_config.mbuf_high_water =
10099 DEFAULT_MB_HIGH_WATER;
10100
10101 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
10102 DEFAULT_MB_RDMA_LOW_WATER_JUMBO;
10103 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo =
10104 DEFAULT_MB_MACRX_LOW_WATER_JUMBO;
10105 tp->bufmgr_config.mbuf_high_water_jumbo =
10106 DEFAULT_MB_HIGH_WATER_JUMBO;
10107 }
9759 10108
9760 tp->bufmgr_config.dma_low_water = DEFAULT_DMA_LOW_WATER; 10109 tp->bufmgr_config.dma_low_water = DEFAULT_DMA_LOW_WATER;
9761 tp->bufmgr_config.dma_high_water = DEFAULT_DMA_HIGH_WATER; 10110 tp->bufmgr_config.dma_high_water = DEFAULT_DMA_HIGH_WATER;
@@ -9773,6 +10122,7 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
9773 case PHY_ID_BCM5705: return "5705"; 10122 case PHY_ID_BCM5705: return "5705";
9774 case PHY_ID_BCM5750: return "5750"; 10123 case PHY_ID_BCM5750: return "5750";
9775 case PHY_ID_BCM5752: return "5752"; 10124 case PHY_ID_BCM5752: return "5752";
10125 case PHY_ID_BCM5780: return "5780";
9776 case PHY_ID_BCM8002: return "8002/serdes"; 10126 case PHY_ID_BCM8002: return "8002/serdes";
9777 case 0: return "serdes"; 10127 case 0: return "serdes";
9778 default: return "unknown"; 10128 default: return "unknown";
@@ -9825,6 +10175,12 @@ static void __devinit tg3_init_coal(struct tg3 *tp)
9825 ec->tx_coalesce_usecs = LOW_TXCOL_TICKS_CLRTCKS; 10175 ec->tx_coalesce_usecs = LOW_TXCOL_TICKS_CLRTCKS;
9826 ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT_CLRTCKS; 10176 ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT_CLRTCKS;
9827 } 10177 }
10178
10179 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
10180 ec->rx_coalesce_usecs_irq = 0;
10181 ec->tx_coalesce_usecs_irq = 0;
10182 ec->stats_block_coalesce_usecs = 0;
10183 }
9828} 10184}
9829 10185
9830static int __devinit tg3_init_one(struct pci_dev *pdev, 10186static int __devinit tg3_init_one(struct pci_dev *pdev,
@@ -9962,8 +10318,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
9962 10318
9963 tg3_init_link_config(tp); 10319 tg3_init_link_config(tp);
9964 10320
9965 tg3_init_bufmgr_config(tp);
9966
9967 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 10321 tp->rx_pending = TG3_DEF_RX_RING_PENDING;
9968 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 10322 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
9969 tp->tx_pending = TG3_DEF_TX_RING_PENDING; 10323 tp->tx_pending = TG3_DEF_TX_RING_PENDING;
@@ -9992,14 +10346,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
9992 goto err_out_iounmap; 10346 goto err_out_iounmap;
9993 } 10347 }
9994 10348
9995 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { 10349 tg3_init_bufmgr_config(tp);
9996 tp->bufmgr_config.mbuf_read_dma_low_water =
9997 DEFAULT_MB_RDMA_LOW_WATER_5705;
9998 tp->bufmgr_config.mbuf_mac_rx_low_water =
9999 DEFAULT_MB_MACRX_LOW_WATER_5705;
10000 tp->bufmgr_config.mbuf_high_water =
10001 DEFAULT_MB_HIGH_WATER_5705;
10002 }
10003 10350
10004#if TG3_TSO_SUPPORT != 0 10351#if TG3_TSO_SUPPORT != 0
10005 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { 10352 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
@@ -10074,6 +10421,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10074 10421
10075 tg3_init_coal(tp); 10422 tg3_init_coal(tp);
10076 10423
10424 /* Now that we have fully setup the chip, save away a snapshot
10425 * of the PCI config space. We need to restore this after
10426 * GRC_MISC_CFG core clock resets and some resume events.
10427 */
10428 pci_save_state(tp->pdev);
10429
10077 err = register_netdev(dev); 10430 err = register_netdev(dev);
10078 if (err) { 10431 if (err) {
10079 printk(KERN_ERR PFX "Cannot register net device, " 10432 printk(KERN_ERR PFX "Cannot register net device, "
@@ -10083,12 +10436,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10083 10436
10084 pci_set_drvdata(pdev, dev); 10437 pci_set_drvdata(pdev, dev);
10085 10438
10086 /* Now that we have fully setup the chip, save away a snapshot
10087 * of the PCI config space. We need to restore this after
10088 * GRC_MISC_CFG core clock resets and some resume events.
10089 */
10090 pci_save_state(tp->pdev);
10091
10092 printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", 10439 printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ",
10093 dev->name, 10440 dev->name,
10094 tp->board_part_number, 10441 tp->board_part_number,
@@ -10165,24 +10512,19 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10165 10512
10166 del_timer_sync(&tp->timer); 10513 del_timer_sync(&tp->timer);
10167 10514
10168 spin_lock_irq(&tp->lock); 10515 tg3_full_lock(tp, 1);
10169 spin_lock(&tp->tx_lock);
10170 tg3_disable_ints(tp); 10516 tg3_disable_ints(tp);
10171 spin_unlock(&tp->tx_lock); 10517 tg3_full_unlock(tp);
10172 spin_unlock_irq(&tp->lock);
10173 10518
10174 netif_device_detach(dev); 10519 netif_device_detach(dev);
10175 10520
10176 spin_lock_irq(&tp->lock); 10521 tg3_full_lock(tp, 0);
10177 spin_lock(&tp->tx_lock);
10178 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 10522 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
10179 spin_unlock(&tp->tx_lock); 10523 tg3_full_unlock(tp);
10180 spin_unlock_irq(&tp->lock);
10181 10524
10182 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 10525 err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
10183 if (err) { 10526 if (err) {
10184 spin_lock_irq(&tp->lock); 10527 tg3_full_lock(tp, 0);
10185 spin_lock(&tp->tx_lock);
10186 10528
10187 tg3_init_hw(tp); 10529 tg3_init_hw(tp);
10188 10530
@@ -10192,8 +10534,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10192 netif_device_attach(dev); 10534 netif_device_attach(dev);
10193 tg3_netif_start(tp); 10535 tg3_netif_start(tp);
10194 10536
10195 spin_unlock(&tp->tx_lock); 10537 tg3_full_unlock(tp);
10196 spin_unlock_irq(&tp->lock);
10197 } 10538 }
10198 10539
10199 return err; 10540 return err;
@@ -10216,20 +10557,16 @@ static int tg3_resume(struct pci_dev *pdev)
10216 10557
10217 netif_device_attach(dev); 10558 netif_device_attach(dev);
10218 10559
10219 spin_lock_irq(&tp->lock); 10560 tg3_full_lock(tp, 0);
10220 spin_lock(&tp->tx_lock);
10221 10561
10222 tg3_init_hw(tp); 10562 tg3_init_hw(tp);
10223 10563
10224 tp->timer.expires = jiffies + tp->timer_offset; 10564 tp->timer.expires = jiffies + tp->timer_offset;
10225 add_timer(&tp->timer); 10565 add_timer(&tp->timer);
10226 10566
10227 tg3_enable_ints(tp);
10228
10229 tg3_netif_start(tp); 10567 tg3_netif_start(tp);
10230 10568
10231 spin_unlock(&tp->tx_lock); 10569 tg3_full_unlock(tp);
10232 spin_unlock_irq(&tp->lock);
10233 10570
10234 return 0; 10571 return 0;
10235} 10572}
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 993f84c93dc4..5c4433c147fa 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -136,6 +136,7 @@
136#define ASIC_REV_5705 0x03 136#define ASIC_REV_5705 0x03
137#define ASIC_REV_5750 0x04 137#define ASIC_REV_5750 0x04
138#define ASIC_REV_5752 0x06 138#define ASIC_REV_5752 0x06
139#define ASIC_REV_5780 0x08
139#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) 140#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8)
140#define CHIPREV_5700_AX 0x70 141#define CHIPREV_5700_AX 0x70
141#define CHIPREV_5700_BX 0x71 142#define CHIPREV_5700_BX 0x71
@@ -879,31 +880,41 @@
879#define LOW_RXCOL_TICKS_CLRTCKS 0x00000014 880#define LOW_RXCOL_TICKS_CLRTCKS 0x00000014
880#define DEFAULT_RXCOL_TICKS 0x00000048 881#define DEFAULT_RXCOL_TICKS 0x00000048
881#define HIGH_RXCOL_TICKS 0x00000096 882#define HIGH_RXCOL_TICKS 0x00000096
883#define MAX_RXCOL_TICKS 0x000003ff
882#define HOSTCC_TXCOL_TICKS 0x00003c0c 884#define HOSTCC_TXCOL_TICKS 0x00003c0c
883#define LOW_TXCOL_TICKS 0x00000096 885#define LOW_TXCOL_TICKS 0x00000096
884#define LOW_TXCOL_TICKS_CLRTCKS 0x00000048 886#define LOW_TXCOL_TICKS_CLRTCKS 0x00000048
885#define DEFAULT_TXCOL_TICKS 0x0000012c 887#define DEFAULT_TXCOL_TICKS 0x0000012c
886#define HIGH_TXCOL_TICKS 0x00000145 888#define HIGH_TXCOL_TICKS 0x00000145
889#define MAX_TXCOL_TICKS 0x000003ff
887#define HOSTCC_RXMAX_FRAMES 0x00003c10 890#define HOSTCC_RXMAX_FRAMES 0x00003c10
888#define LOW_RXMAX_FRAMES 0x00000005 891#define LOW_RXMAX_FRAMES 0x00000005
889#define DEFAULT_RXMAX_FRAMES 0x00000008 892#define DEFAULT_RXMAX_FRAMES 0x00000008
890#define HIGH_RXMAX_FRAMES 0x00000012 893#define HIGH_RXMAX_FRAMES 0x00000012
894#define MAX_RXMAX_FRAMES 0x000000ff
891#define HOSTCC_TXMAX_FRAMES 0x00003c14 895#define HOSTCC_TXMAX_FRAMES 0x00003c14
892#define LOW_TXMAX_FRAMES 0x00000035 896#define LOW_TXMAX_FRAMES 0x00000035
893#define DEFAULT_TXMAX_FRAMES 0x0000004b 897#define DEFAULT_TXMAX_FRAMES 0x0000004b
894#define HIGH_TXMAX_FRAMES 0x00000052 898#define HIGH_TXMAX_FRAMES 0x00000052
899#define MAX_TXMAX_FRAMES 0x000000ff
895#define HOSTCC_RXCOAL_TICK_INT 0x00003c18 900#define HOSTCC_RXCOAL_TICK_INT 0x00003c18
896#define DEFAULT_RXCOAL_TICK_INT 0x00000019 901#define DEFAULT_RXCOAL_TICK_INT 0x00000019
897#define DEFAULT_RXCOAL_TICK_INT_CLRTCKS 0x00000014 902#define DEFAULT_RXCOAL_TICK_INT_CLRTCKS 0x00000014
903#define MAX_RXCOAL_TICK_INT 0x000003ff
898#define HOSTCC_TXCOAL_TICK_INT 0x00003c1c 904#define HOSTCC_TXCOAL_TICK_INT 0x00003c1c
899#define DEFAULT_TXCOAL_TICK_INT 0x00000019 905#define DEFAULT_TXCOAL_TICK_INT 0x00000019
900#define DEFAULT_TXCOAL_TICK_INT_CLRTCKS 0x00000014 906#define DEFAULT_TXCOAL_TICK_INT_CLRTCKS 0x00000014
907#define MAX_TXCOAL_TICK_INT 0x000003ff
901#define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 908#define HOSTCC_RXCOAL_MAXF_INT 0x00003c20
902#define DEFAULT_RXCOAL_MAXF_INT 0x00000005 909#define DEFAULT_RXCOAL_MAXF_INT 0x00000005
910#define MAX_RXCOAL_MAXF_INT 0x000000ff
903#define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 911#define HOSTCC_TXCOAL_MAXF_INT 0x00003c24
904#define DEFAULT_TXCOAL_MAXF_INT 0x00000005 912#define DEFAULT_TXCOAL_MAXF_INT 0x00000005
913#define MAX_TXCOAL_MAXF_INT 0x000000ff
905#define HOSTCC_STAT_COAL_TICKS 0x00003c28 914#define HOSTCC_STAT_COAL_TICKS 0x00003c28
906#define DEFAULT_STAT_COAL_TICKS 0x000f4240 915#define DEFAULT_STAT_COAL_TICKS 0x000f4240
916#define MAX_STAT_COAL_TICKS 0xd693d400
917#define MIN_STAT_COAL_TICKS 0x00000064
907/* 0x3c2c --> 0x3c30 unused */ 918/* 0x3c2c --> 0x3c30 unused */
908#define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */ 919#define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */
909#define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */ 920#define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */
@@ -974,14 +985,17 @@
974#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050 985#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050
975#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000 986#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000
976#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130 987#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130
988#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780 0x00000000
977#define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 989#define BUFMGR_MB_MACRX_LOW_WATER 0x00004414
978#define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 990#define DEFAULT_MB_MACRX_LOW_WATER 0x00000020
979#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 991#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010
980#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 992#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098
993#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780 0x0000004b
981#define BUFMGR_MB_HIGH_WATER 0x00004418 994#define BUFMGR_MB_HIGH_WATER 0x00004418
982#define DEFAULT_MB_HIGH_WATER 0x00000060 995#define DEFAULT_MB_HIGH_WATER 0x00000060
983#define DEFAULT_MB_HIGH_WATER_5705 0x00000060 996#define DEFAULT_MB_HIGH_WATER_5705 0x00000060
984#define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c 997#define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c
998#define DEFAULT_MB_HIGH_WATER_JUMBO_5780 0x00000096
985#define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c 999#define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c
986#define BUFMGR_MB_ALLOC_BIT 0x10000000 1000#define BUFMGR_MB_ALLOC_BIT 0x10000000
987#define BUFMGR_RX_MB_ALLOC_RESP 0x00004420 1001#define BUFMGR_RX_MB_ALLOC_RESP 0x00004420
@@ -2006,17 +2020,31 @@ struct tg3_ethtool_stats {
2006struct tg3 { 2020struct tg3 {
2007 /* begin "general, frequently-used members" cacheline section */ 2021 /* begin "general, frequently-used members" cacheline section */
2008 2022
2023 /* If the IRQ handler (which runs lockless) needs to be
2024 * quiesced, the following bitmask state is used. The
2025 * SYNC flag is set by non-IRQ context code to initiate
2026 * the quiescence.
2027 *
2028 * When the IRQ handler notices that SYNC is set, it
2029 * disables interrupts and returns.
2030 *
2031 * When all outstanding IRQ handlers have returned after
2032 * the SYNC flag has been set, the setter can be assured
2033 * that interrupts will no longer get run.
2034 *
2035 * In this way all SMP driver locks are never acquired
2036 * in hw IRQ context, only sw IRQ context or lower.
2037 */
2038 unsigned int irq_sync;
2039
2009 /* SMP locking strategy: 2040 /* SMP locking strategy:
2010 * 2041 *
2011 * lock: Held during all operations except TX packet 2042 * lock: Held during all operations except TX packet
2012 * processing. 2043 * processing.
2013 * 2044 *
2014 * tx_lock: Held during tg3_start_xmit{,_4gbug} and tg3_tx 2045 * tx_lock: Held during tg3_start_xmit and tg3_tx
2015 * 2046 *
2016 * If you want to shut up all asynchronous processing you must 2047 * Both of these locks are to be held with BH safety.
2017 * acquire both locks, 'lock' taken before 'tx_lock'. IRQs must
2018 * be disabled to take 'lock' but only softirq disabling is
2019 * necessary for acquisition of 'tx_lock'.
2020 */ 2048 */
2021 spinlock_t lock; 2049 spinlock_t lock;
2022 spinlock_t indirect_lock; 2050 spinlock_t indirect_lock;
@@ -2063,6 +2091,8 @@ struct tg3 {
2063 struct tg3_rx_buffer_desc *rx_rcb; 2091 struct tg3_rx_buffer_desc *rx_rcb;
2064 dma_addr_t rx_rcb_mapping; 2092 dma_addr_t rx_rcb_mapping;
2065 2093
2094 u32 rx_pkt_buf_sz;
2095
2066 /* begin "everything else" cacheline(s) section */ 2096 /* begin "everything else" cacheline(s) section */
2067 struct net_device_stats net_stats; 2097 struct net_device_stats net_stats;
2068 struct net_device_stats net_stats_prev; 2098 struct net_device_stats net_stats_prev;
@@ -2100,7 +2130,7 @@ struct tg3 {
2100#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000 2130#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000
2101#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000 2131#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000
2102#define TG3_FLAG_SERDES_WOL_CAP 0x00400000 2132#define TG3_FLAG_SERDES_WOL_CAP 0x00400000
2103#define TG3_FLAG_JUMBO_ENABLE 0x00800000 2133#define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000
2104#define TG3_FLAG_10_100_ONLY 0x01000000 2134#define TG3_FLAG_10_100_ONLY 0x01000000
2105#define TG3_FLAG_PAUSE_AUTONEG 0x02000000 2135#define TG3_FLAG_PAUSE_AUTONEG 0x02000000
2106#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 2136#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000
@@ -2130,6 +2160,11 @@ struct tg3 {
2130#define TG3_FLG2_5750_PLUS 0x00080000 2160#define TG3_FLG2_5750_PLUS 0x00080000
2131#define TG3_FLG2_PROTECTED_NVRAM 0x00100000 2161#define TG3_FLG2_PROTECTED_NVRAM 0x00100000
2132#define TG3_FLG2_USING_MSI 0x00200000 2162#define TG3_FLG2_USING_MSI 0x00200000
2163#define TG3_FLG2_JUMBO_CAPABLE 0x00400000
2164#define TG3_FLG2_MII_SERDES 0x00800000
2165#define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \
2166 TG3_FLG2_MII_SERDES)
2167#define TG3_FLG2_PARALLEL_DETECT 0x01000000
2133 2168
2134 u32 split_mode_max_reqs; 2169 u32 split_mode_max_reqs;
2135#define SPLIT_MODE_5704_MAX_REQ 3 2170#define SPLIT_MODE_5704_MAX_REQ 3
@@ -2163,6 +2198,7 @@ struct tg3 {
2163 u8 pci_bist; 2198 u8 pci_bist;
2164 2199
2165 int pm_cap; 2200 int pm_cap;
2201 int msi_cap;
2166 2202
2167 /* PHY info */ 2203 /* PHY info */
2168 u32 phy_id; 2204 u32 phy_id;
@@ -2176,6 +2212,7 @@ struct tg3 {
2176#define PHY_ID_BCM5705 0x600081a0 2212#define PHY_ID_BCM5705 0x600081a0
2177#define PHY_ID_BCM5750 0x60008180 2213#define PHY_ID_BCM5750 0x60008180
2178#define PHY_ID_BCM5752 0x60008100 2214#define PHY_ID_BCM5752 0x60008100
2215#define PHY_ID_BCM5780 0x60008350
2179#define PHY_ID_BCM8002 0x60010140 2216#define PHY_ID_BCM8002 0x60010140
2180#define PHY_ID_INVALID 0xffffffff 2217#define PHY_ID_INVALID 0xffffffff
2181#define PHY_ID_REV_MASK 0x0000000f 2218#define PHY_ID_REV_MASK 0x0000000f
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index cf31c0629852..942fae0f2130 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -171,6 +171,7 @@
171#include <linux/ioport.h> 171#include <linux/ioport.h>
172#include <linux/eisa.h> 172#include <linux/eisa.h>
173#include <linux/pci.h> 173#include <linux/pci.h>
174#include <linux/dma-mapping.h>
174#include <linux/netdevice.h> 175#include <linux/netdevice.h>
175#include <linux/etherdevice.h> 176#include <linux/etherdevice.h>
176#include <linux/delay.h> 177#include <linux/delay.h>
@@ -566,7 +567,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
566 567
567 priv->adapter = &board_info[ent->driver_data]; 568 priv->adapter = &board_info[ent->driver_data];
568 569
569 rc = pci_set_dma_mask(pdev, 0xFFFFFFFF); 570 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
570 if (rc) { 571 if (rc) {
571 printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n"); 572 printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n");
572 goto err_out_free_dev; 573 goto err_out_free_dev;
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 0d1dcf421771..41e0cd8f4786 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -276,7 +276,8 @@ static void xl_ee_write(struct net_device *dev, int ee_addr, u16 ee_value)
276 return ; 276 return ;
277} 277}
278 278
279int __devinit xl_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 279static int __devinit xl_probe(struct pci_dev *pdev,
280 const struct pci_device_id *ent)
280{ 281{
281 struct net_device *dev ; 282 struct net_device *dev ;
282 struct xl_private *xl_priv ; 283 struct xl_private *xl_priv ;
diff --git a/drivers/net/tokenring/3c359_microcode.h b/drivers/net/tokenring/3c359_microcode.h
index 81354afa3d34..0400c029c077 100644
--- a/drivers/net/tokenring/3c359_microcode.h
+++ b/drivers/net/tokenring/3c359_microcode.h
@@ -22,7 +22,7 @@
22 22
23static int mc_size = 24880 ; 23static int mc_size = 24880 ;
24 24
25u8 microcode[] = { 25static const u8 microcode[] = {
26 0xfe,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 26 0xfe,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
27,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 27,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
diff --git a/drivers/net/tokenring/Kconfig b/drivers/net/tokenring/Kconfig
index 23d0fa4bbceb..7e99e9f8045e 100644
--- a/drivers/net/tokenring/Kconfig
+++ b/drivers/net/tokenring/Kconfig
@@ -84,7 +84,7 @@ config 3C359
84 84
85config TMS380TR 85config TMS380TR
86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support" 86 tristate "Generic TMS380 Token Ring ISA/PCI adapter support"
87 depends on TR && (PCI || ISA) 87 depends on TR && (PCI || ISA && ISA_DMA_API)
88 select FW_LOADER 88 select FW_LOADER
89 ---help--- 89 ---help---
90 This driver provides generic support for token ring adapters 90 This driver provides generic support for token ring adapters
diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c
index bd4a2bccf867..87103c400999 100644
--- a/drivers/net/tokenring/abyss.c
+++ b/drivers/net/tokenring/abyss.c
@@ -468,14 +468,3 @@ static void __exit abyss_rmmod (void)
468module_init(abyss_init); 468module_init(abyss_init);
469module_exit(abyss_rmmod); 469module_exit(abyss_rmmod);
470 470
471
472/*
473 * Local variables:
474 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c abyss.c"
475 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c abyss.c"
476 * c-set-style "K&R"
477 * c-indent-level: 8
478 * c-basic-offset: 8
479 * tab-width: 8
480 * End:
481 */
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 3873917a9c22..e7b001017b9a 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -151,7 +151,7 @@ static char version[] __initdata =
151 151
152/* this allows displaying full adapter information */ 152/* this allows displaying full adapter information */
153 153
154char *channel_def[] __devinitdata = { "ISA", "MCA", "ISA P&P" }; 154static char *channel_def[] __devinitdata = { "ISA", "MCA", "ISA P&P" };
155 155
156static char pcchannelid[] __devinitdata = { 156static char pcchannelid[] __devinitdata = {
157 0x05, 0x00, 0x04, 0x09, 157 0x05, 0x00, 0x04, 0x09,
@@ -171,7 +171,7 @@ static char mcchannelid[] __devinitdata = {
171 0x03, 0x08, 0x02, 0x00 171 0x03, 0x08, 0x02, 0x00
172}; 172};
173 173
174char __devinit *adapter_def(char type) 174static char __devinit *adapter_def(char type)
175{ 175{
176 switch (type) { 176 switch (type) {
177 case 0xF: return "PC Adapter | PC Adapter II | Adapter/A"; 177 case 0xF: return "PC Adapter | PC Adapter II | Adapter/A";
@@ -184,7 +184,7 @@ char __devinit *adapter_def(char type)
184 184
185#define TRC_INIT 0x01 /* Trace initialization & PROBEs */ 185#define TRC_INIT 0x01 /* Trace initialization & PROBEs */
186#define TRC_INITV 0x02 /* verbose init trace points */ 186#define TRC_INITV 0x02 /* verbose init trace points */
187unsigned char ibmtr_debug_trace = 0; 187static unsigned char ibmtr_debug_trace = 0;
188 188
189static int ibmtr_probe(struct net_device *dev); 189static int ibmtr_probe(struct net_device *dev);
190static int ibmtr_probe1(struct net_device *dev, int ioaddr); 190static int ibmtr_probe1(struct net_device *dev, int ioaddr);
@@ -192,20 +192,20 @@ static unsigned char get_sram_size(struct tok_info *adapt_info);
192static int trdev_init(struct net_device *dev); 192static int trdev_init(struct net_device *dev);
193static int tok_open(struct net_device *dev); 193static int tok_open(struct net_device *dev);
194static int tok_init_card(struct net_device *dev); 194static int tok_init_card(struct net_device *dev);
195void tok_open_adapter(unsigned long dev_addr); 195static void tok_open_adapter(unsigned long dev_addr);
196static void open_sap(unsigned char type, struct net_device *dev); 196static void open_sap(unsigned char type, struct net_device *dev);
197static void tok_set_multicast_list(struct net_device *dev); 197static void tok_set_multicast_list(struct net_device *dev);
198static int tok_send_packet(struct sk_buff *skb, struct net_device *dev); 198static int tok_send_packet(struct sk_buff *skb, struct net_device *dev);
199static int tok_close(struct net_device *dev); 199static int tok_close(struct net_device *dev);
200irqreturn_t tok_interrupt(int irq, void *dev_id, struct pt_regs *regs); 200static irqreturn_t tok_interrupt(int irq, void *dev_id, struct pt_regs *regs);
201static void initial_tok_int(struct net_device *dev); 201static void initial_tok_int(struct net_device *dev);
202static void tr_tx(struct net_device *dev); 202static void tr_tx(struct net_device *dev);
203static void tr_rx(struct net_device *dev); 203static void tr_rx(struct net_device *dev);
204void ibmtr_reset_timer(struct timer_list*tmr,struct net_device *dev); 204static void ibmtr_reset_timer(struct timer_list*tmr,struct net_device *dev);
205static void tok_rerun(unsigned long dev_addr); 205static void tok_rerun(unsigned long dev_addr);
206void ibmtr_readlog(struct net_device *dev); 206static void ibmtr_readlog(struct net_device *dev);
207static struct net_device_stats *tok_get_stats(struct net_device *dev); 207static struct net_device_stats *tok_get_stats(struct net_device *dev);
208int ibmtr_change_mtu(struct net_device *dev, int mtu); 208static int ibmtr_change_mtu(struct net_device *dev, int mtu);
209static void find_turbo_adapters(int *iolist); 209static void find_turbo_adapters(int *iolist);
210 210
211static int ibmtr_portlist[IBMTR_MAX_ADAPTERS+1] __devinitdata = { 211static int ibmtr_portlist[IBMTR_MAX_ADAPTERS+1] __devinitdata = {
@@ -928,7 +928,7 @@ static int tok_open(struct net_device *dev)
928#define DLC_MAX_SAP_OFST 32 928#define DLC_MAX_SAP_OFST 32
929#define DLC_MAX_STA_OFST 33 929#define DLC_MAX_STA_OFST 33
930 930
931void tok_open_adapter(unsigned long dev_addr) 931static void tok_open_adapter(unsigned long dev_addr)
932{ 932{
933 struct net_device *dev = (struct net_device *) dev_addr; 933 struct net_device *dev = (struct net_device *) dev_addr;
934 struct tok_info *ti; 934 struct tok_info *ti;
@@ -1099,7 +1099,7 @@ static void __iomem *map_address(struct tok_info *ti, unsigned index, __u8 *page
1099 return ti->sram_virt + index; 1099 return ti->sram_virt + index;
1100} 1100}
1101 1101
1102void dir_open_adapter (struct net_device *dev) 1102static void dir_open_adapter (struct net_device *dev)
1103{ 1103{
1104 struct tok_info *ti = (struct tok_info *) dev->priv; 1104 struct tok_info *ti = (struct tok_info *) dev->priv;
1105 unsigned char ret_code; 1105 unsigned char ret_code;
@@ -1172,7 +1172,7 @@ void dir_open_adapter (struct net_device *dev)
1172 1172
1173/******************************************************************************/ 1173/******************************************************************************/
1174 1174
1175irqreturn_t tok_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1175static irqreturn_t tok_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1176{ 1176{
1177 unsigned char status; 1177 unsigned char status;
1178 /* unsigned char status_even ; */ 1178 /* unsigned char status_even ; */
@@ -1840,7 +1840,7 @@ static void tr_rx(struct net_device *dev)
1840 1840
1841/*****************************************************************************/ 1841/*****************************************************************************/
1842 1842
1843void ibmtr_reset_timer(struct timer_list *tmr, struct net_device *dev) 1843static void ibmtr_reset_timer(struct timer_list *tmr, struct net_device *dev)
1844{ 1844{
1845 tmr->expires = jiffies + TR_RETRY_INTERVAL; 1845 tmr->expires = jiffies + TR_RETRY_INTERVAL;
1846 tmr->data = (unsigned long) dev; 1846 tmr->data = (unsigned long) dev;
@@ -1872,7 +1872,7 @@ void tok_rerun(unsigned long dev_addr){
1872 1872
1873/*****************************************************************************/ 1873/*****************************************************************************/
1874 1874
1875void ibmtr_readlog(struct net_device *dev) 1875static void ibmtr_readlog(struct net_device *dev)
1876{ 1876{
1877 struct tok_info *ti; 1877 struct tok_info *ti;
1878 1878
@@ -1905,7 +1905,7 @@ static struct net_device_stats *tok_get_stats(struct net_device *dev)
1905 1905
1906/*****************************************************************************/ 1906/*****************************************************************************/
1907 1907
1908int ibmtr_change_mtu(struct net_device *dev, int mtu) 1908static int ibmtr_change_mtu(struct net_device *dev, int mtu)
1909{ 1909{
1910 struct tok_info *ti = (struct tok_info *) dev->priv; 1910 struct tok_info *ti = (struct tok_info *) dev->priv;
1911 1911
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 99e0b03b69a8..97712c3c4e07 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -118,6 +118,7 @@
118#include <linux/stddef.h> 118#include <linux/stddef.h>
119#include <linux/init.h> 119#include <linux/init.h>
120#include <linux/pci.h> 120#include <linux/pci.h>
121#include <linux/dma-mapping.h>
121#include <linux/spinlock.h> 122#include <linux/spinlock.h>
122#include <linux/version.h> 123#include <linux/version.h>
123#include <linux/bitops.h> 124#include <linux/bitops.h>
@@ -257,7 +258,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
257#endif 258#endif
258#endif 259#endif
259 260
260 rc = pci_set_dma_mask(pdev, 0xFFFFFFFFULL); 261 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
261 if (rc) { 262 if (rc) {
262 printk(KERN_ERR "%s: No suitable PCI mapping available.\n", 263 printk(KERN_ERR "%s: No suitable PCI mapping available.\n",
263 dev->name); 264 dev->name);
@@ -454,8 +455,7 @@ static int streamer_reset(struct net_device *dev)
454 writew(readw(streamer_mmio + BCTL) | BCTL_SOFTRESET, streamer_mmio + BCTL); 455 writew(readw(streamer_mmio + BCTL) | BCTL_SOFTRESET, streamer_mmio + BCTL);
455 t = jiffies; 456 t = jiffies;
456 /* Hold soft reset bit for a while */ 457 /* Hold soft reset bit for a while */
457 current->state = TASK_UNINTERRUPTIBLE; 458 ssleep(1);
458 schedule_timeout(HZ);
459 459
460 writew(readw(streamer_mmio + BCTL) & ~BCTL_SOFTRESET, 460 writew(readw(streamer_mmio + BCTL) & ~BCTL_SOFTRESET,
461 streamer_mmio + BCTL); 461 streamer_mmio + BCTL);
@@ -511,8 +511,7 @@ static int streamer_reset(struct net_device *dev)
511 writew(SISR_MI, streamer_mmio + SISR_MASK_SUM); 511 writew(SISR_MI, streamer_mmio + SISR_MASK_SUM);
512 512
513 while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { 513 while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) {
514 current->state = TASK_INTERRUPTIBLE; 514 msleep_interruptible(100);
515 schedule_timeout(HZ/10);
516 if (jiffies - t > 40 * HZ) { 515 if (jiffies - t > 40 * HZ) {
517 printk(KERN_ERR 516 printk(KERN_ERR
518 "IBM PCI tokenring card not responding\n"); 517 "IBM PCI tokenring card not responding\n");
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
index cfae2bbf2167..659cbdbef7f3 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -625,7 +625,7 @@ static int madgemc_chipset_init(struct net_device *dev)
625/* 625/*
626 * Disable the board, and put back into power-up state. 626 * Disable the board, and put back into power-up state.
627 */ 627 */
628void madgemc_chipset_close(struct net_device *dev) 628static void madgemc_chipset_close(struct net_device *dev)
629{ 629{
630 /* disable interrupts */ 630 /* disable interrupts */
631 madgemc_setint(dev, 0); 631 madgemc_setint(dev, 0);
@@ -786,15 +786,3 @@ module_exit(madgemc_exit);
786 786
787MODULE_LICENSE("GPL"); 787MODULE_LICENSE("GPL");
788 788
789
790/*
791 * Local variables:
792 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c madgemc.c"
793 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c madgemc.c"
794 * c-set-style "K&R"
795 * c-indent-level: 8
796 * c-basic-offset: 8
797 * tab-width: 8
798 * End:
799 */
800
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c
index 675b063508e3..40ad0fde28af 100644
--- a/drivers/net/tokenring/proteon.c
+++ b/drivers/net/tokenring/proteon.c
@@ -419,14 +419,3 @@ void cleanup_module(void)
419} 419}
420#endif /* MODULE */ 420#endif /* MODULE */
421 421
422
423/*
424 * Local variables:
425 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c proteon.c"
426 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c proteon.c"
427 * c-set-style "K&R"
428 * c-indent-level: 8
429 * c-basic-offset: 8
430 * tab-width: 8
431 * End:
432 */
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c
index 3fab54a26466..f26796e2d0e5 100644
--- a/drivers/net/tokenring/skisa.c
+++ b/drivers/net/tokenring/skisa.c
@@ -429,14 +429,3 @@ void cleanup_module(void)
429} 429}
430#endif /* MODULE */ 430#endif /* MODULE */
431 431
432
433/*
434 * Local variables:
435 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c skisa.c"
436 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c skisa.c"
437 * c-set-style "K&R"
438 * c-indent-level: 8
439 * c-basic-offset: 8
440 * tab-width: 8
441 * End:
442 */
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 5c8aeacb8318..67d2b596ce22 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -77,7 +77,7 @@ static int ringspeed;
77 77
78/* SMC Name of the Adapter. */ 78/* SMC Name of the Adapter. */
79static char smctr_name[] = "SMC TokenCard"; 79static char smctr_name[] = "SMC TokenCard";
80char *smctr_model = "Unknown"; 80static char *smctr_model = "Unknown";
81 81
82/* Use 0 for production, 1 for verification, 2 for debug, and 82/* Use 0 for production, 1 for verification, 2 for debug, and
83 * 3 for very verbose debug. 83 * 3 for very verbose debug.
diff --git a/drivers/net/tokenring/smctr_firmware.h b/drivers/net/tokenring/smctr_firmware.h
index 53f2cbc817c9..48994b043b7c 100644
--- a/drivers/net/tokenring/smctr_firmware.h
+++ b/drivers/net/tokenring/smctr_firmware.h
@@ -21,7 +21,7 @@
21 21
22#if defined(CONFIG_SMCTR) || defined(CONFIG_SMCTR_MODULE) 22#if defined(CONFIG_SMCTR) || defined(CONFIG_SMCTR_MODULE)
23 23
24unsigned char smctr_code[] = { 24static const unsigned char smctr_code[] = {
25 0x0BC, 0x01D, 0x012, 0x03B, 0x063, 0x0B4, 0x0E9, 0x000, 25 0x0BC, 0x01D, 0x012, 0x03B, 0x063, 0x0B4, 0x0E9, 0x000,
26 0x000, 0x01F, 0x000, 0x001, 0x001, 0x000, 0x002, 0x005, 26 0x000, 0x01F, 0x000, 0x001, 0x001, 0x000, 0x002, 0x005,
27 0x001, 0x000, 0x006, 0x003, 0x001, 0x000, 0x004, 0x009, 27 0x001, 0x000, 0x006, 0x003, 0x001, 0x000, 0x004, 0x009,
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index df43b449e429..5e0b0ce98ed7 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -2379,7 +2379,7 @@ EXPORT_SYMBOL(tmsdev_init);
2379EXPORT_SYMBOL(tmsdev_term); 2379EXPORT_SYMBOL(tmsdev_term);
2380EXPORT_SYMBOL(tms380tr_wait); 2380EXPORT_SYMBOL(tms380tr_wait);
2381 2381
2382struct module *TMS380_module = NULL; 2382static struct module *TMS380_module = NULL;
2383 2383
2384int init_module(void) 2384int init_module(void)
2385{ 2385{
@@ -2397,14 +2397,3 @@ void cleanup_module(void)
2397 2397
2398MODULE_LICENSE("GPL"); 2398MODULE_LICENSE("GPL");
2399 2399
2400
2401/*
2402 * Local variables:
2403 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c tms380tr.c"
2404 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c tms380tr.c"
2405 * c-set-style "K&R"
2406 * c-indent-level: 8
2407 * c-basic-offset: 8
2408 * tab-width: 8
2409 * End:
2410 */
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c
index 37ddb5c2bec3..2e18c0a46482 100644
--- a/drivers/net/tokenring/tmspci.c
+++ b/drivers/net/tokenring/tmspci.c
@@ -254,14 +254,3 @@ static void __exit tms_pci_rmmod (void)
254module_init(tms_pci_init); 254module_init(tms_pci_init);
255module_exit(tms_pci_rmmod); 255module_exit(tms_pci_rmmod);
256 256
257
258/*
259 * Local variables:
260 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c tmspci.c"
261 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c tmspci.c"
262 * c-set-style "K&R"
263 * c-indent-level: 8
264 * c-basic-offset: 8
265 * tab-width: 8
266 * End:
267 */
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index dd357dd8c370..fc353e348f9a 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -446,13 +446,13 @@ static void de_rx (struct de_private *de)
446 446
447 mapping = 447 mapping =
448 de->rx_skb[rx_tail].mapping = 448 de->rx_skb[rx_tail].mapping =
449 pci_map_single(de->pdev, copy_skb->tail, 449 pci_map_single(de->pdev, copy_skb->data,
450 buflen, PCI_DMA_FROMDEVICE); 450 buflen, PCI_DMA_FROMDEVICE);
451 de->rx_skb[rx_tail].skb = copy_skb; 451 de->rx_skb[rx_tail].skb = copy_skb;
452 } else { 452 } else {
453 pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); 453 pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
454 skb_reserve(copy_skb, RX_OFFSET); 454 skb_reserve(copy_skb, RX_OFFSET);
455 memcpy(skb_put(copy_skb, len), skb->tail, len); 455 memcpy(skb_put(copy_skb, len), skb->data, len);
456 456
457 pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); 457 pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
458 458
@@ -1269,7 +1269,7 @@ static int de_refill_rx (struct de_private *de)
1269 skb->dev = de->dev; 1269 skb->dev = de->dev;
1270 1270
1271 de->rx_skb[i].mapping = pci_map_single(de->pdev, 1271 de->rx_skb[i].mapping = pci_map_single(de->pdev,
1272 skb->tail, de->rx_buf_sz, PCI_DMA_FROMDEVICE); 1272 skb->data, de->rx_buf_sz, PCI_DMA_FROMDEVICE);
1273 de->rx_skb[i].skb = skb; 1273 de->rx_skb[i].skb = skb;
1274 1274
1275 de->rx_ring[i].opts1 = cpu_to_le32(DescOwn); 1275 de->rx_ring[i].opts1 = cpu_to_le32(DescOwn);
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index e25f33df223e..74e9075d9c48 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -78,6 +78,7 @@
78#include <linux/slab.h> 78#include <linux/slab.h>
79#include <linux/interrupt.h> 79#include <linux/interrupt.h>
80#include <linux/pci.h> 80#include <linux/pci.h>
81#include <linux/dma-mapping.h>
81#include <linux/init.h> 82#include <linux/init.h>
82#include <linux/netdevice.h> 83#include <linux/netdevice.h>
83#include <linux/etherdevice.h> 84#include <linux/etherdevice.h>
@@ -354,7 +355,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
354 SET_MODULE_OWNER(dev); 355 SET_MODULE_OWNER(dev);
355 SET_NETDEV_DEV(dev, &pdev->dev); 356 SET_NETDEV_DEV(dev, &pdev->dev);
356 357
357 if (pci_set_dma_mask(pdev, 0xffffffff)) { 358 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
358 printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); 359 printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n");
359 err = -ENODEV; 360 err = -ENODEV;
360 goto err_out_free; 361 goto err_out_free;
@@ -743,11 +744,6 @@ static irqreturn_t dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
743 744
744 DMFE_DBUG(0, "dmfe_interrupt()", 0); 745 DMFE_DBUG(0, "dmfe_interrupt()", 0);
745 746
746 if (!dev) {
747 DMFE_DBUG(1, "dmfe_interrupt() without DEVICE arg", 0);
748 return IRQ_NONE;
749 }
750
751 spin_lock_irqsave(&db->lock, flags); 747 spin_lock_irqsave(&db->lock, flags);
752 748
753 /* Got DM910X status */ 749 /* Got DM910X status */
@@ -949,8 +945,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
949 945
950 /* Received Packet CRC check need or not */ 946 /* Received Packet CRC check need or not */
951 if ( (db->dm910x_chk_mode & 1) && 947 if ( (db->dm910x_chk_mode & 1) &&
952 (cal_CRC(skb->tail, rxlen, 1) != 948 (cal_CRC(skb->data, rxlen, 1) !=
953 (*(u32 *) (skb->tail+rxlen) ))) { /* FIXME (?) */ 949 (*(u32 *) (skb->data+rxlen) ))) { /* FIXME (?) */
954 /* Found a error received packet */ 950 /* Found a error received packet */
955 dmfe_reuse_skb(db, rxptr->rx_skb_ptr); 951 dmfe_reuse_skb(db, rxptr->rx_skb_ptr);
956 db->dm910x_chk_mode = 3; 952 db->dm910x_chk_mode = 3;
@@ -963,7 +959,7 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
963 /* size less than COPY_SIZE, allocate a rxlen SKB */ 959 /* size less than COPY_SIZE, allocate a rxlen SKB */
964 skb->dev = dev; 960 skb->dev = dev;
965 skb_reserve(skb, 2); /* 16byte align */ 961 skb_reserve(skb, 2); /* 16byte align */
966 memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); 962 memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->data, rxlen);
967 dmfe_reuse_skb(db, rxptr->rx_skb_ptr); 963 dmfe_reuse_skb(db, rxptr->rx_skb_ptr);
968 } else { 964 } else {
969 skb->dev = dev; 965 skb->dev = dev;
@@ -1256,7 +1252,7 @@ static void dmfe_reuse_skb(struct dmfe_board_info *db, struct sk_buff * skb)
1256 1252
1257 if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { 1253 if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) {
1258 rxptr->rx_skb_ptr = skb; 1254 rxptr->rx_skb_ptr = skb;
1259 rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); 1255 rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
1260 wmb(); 1256 wmb();
1261 rxptr->rdes0 = cpu_to_le32(0x80000000); 1257 rxptr->rdes0 = cpu_to_le32(0x80000000);
1262 db->rx_avail_cnt++; 1258 db->rx_avail_cnt++;
@@ -1467,7 +1463,7 @@ static void allocate_rx_buffer(struct dmfe_board_info *db)
1467 if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) 1463 if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL )
1468 break; 1464 break;
1469 rxptr->rx_skb_ptr = skb; /* FIXME (?) */ 1465 rxptr->rx_skb_ptr = skb; /* FIXME (?) */
1470 rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); 1466 rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
1471 wmb(); 1467 wmb();
1472 rxptr->rdes0 = cpu_to_le32(0x80000000); 1468 rxptr->rdes0 = cpu_to_le32(0x80000000);
1473 rxptr = rxptr->next_rx_desc; 1469 rxptr = rxptr->next_rx_desc;
@@ -1806,7 +1802,7 @@ static void dmfe_parse_srom(struct dmfe_board_info * db)
1806 if ( ( (int) srom[18] & 0xff) == SROM_V41_CODE) { 1802 if ( ( (int) srom[18] & 0xff) == SROM_V41_CODE) {
1807 /* SROM V4.01 */ 1803 /* SROM V4.01 */
1808 /* Get NIC support media mode */ 1804 /* Get NIC support media mode */
1809 db->NIC_capability = le16_to_cpup(srom + 34); 1805 db->NIC_capability = le16_to_cpup((__le16 *)srom + 34/2);
1810 db->PHY_reg4 = 0; 1806 db->PHY_reg4 = 0;
1811 for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) { 1807 for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) {
1812 switch( db->NIC_capability & tmp_reg ) { 1808 switch( db->NIC_capability & tmp_reg ) {
@@ -1818,7 +1814,8 @@ static void dmfe_parse_srom(struct dmfe_board_info * db)
1818 } 1814 }
1819 1815
1820 /* Media Mode Force or not check */ 1816 /* Media Mode Force or not check */
1821 dmfe_mode = le32_to_cpup(srom + 34) & le32_to_cpup(srom + 36); 1817 dmfe_mode = le32_to_cpup((__le32 *)srom + 34/4) &
1818 le32_to_cpup((__le32 *)srom + 36/4);
1822 switch(dmfe_mode) { 1819 switch(dmfe_mode) {
1823 case 0x4: dmfe_media_mode = DMFE_100MHF; break; /* 100MHF */ 1820 case 0x4: dmfe_media_mode = DMFE_100MHF; break; /* 100MHF */
1824 case 0x2: dmfe_media_mode = DMFE_10MFD; break; /* 10MFD */ 1821 case 0x2: dmfe_media_mode = DMFE_10MFD; break; /* 10MFD */
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index ac5bf49ff60f..fbd9ab60b052 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -63,6 +63,22 @@ static struct eeprom_fixup eeprom_fixups[] __devinitdata = {
63 */ 63 */
64 { 0x1e00, 0x0000, 0x000b, 0x8f01, 0x0103, 0x0300, 0x0821, 0x000, 0x0001, 0x0000, 0x01e1 } 64 { 0x1e00, 0x0000, 0x000b, 0x8f01, 0x0103, 0x0300, 0x0821, 0x000, 0x0001, 0x0000, 0x01e1 }
65 }, 65 },
66 {"Cobalt Microserver", 0, 0x10, 0xE0, {0x1e00, /* 0 == controller #, 1e == offset */
67 0x0000, /* 0 == high offset, 0 == gap */
68 0x0800, /* Default Autoselect */
69 0x8001, /* 1 leaf, extended type, bogus len */
70 0x0003, /* Type 3 (MII), PHY #0 */
71 0x0400, /* 0 init instr, 4 reset instr */
72 0x0801, /* Set control mode, GP0 output */
73 0x0000, /* Drive GP0 Low (RST is active low) */
74 0x0800, /* control mode, GP0 input (undriven) */
75 0x0000, /* clear control mode */
76 0x7800, /* 100TX FDX + HDX, 10bT FDX + HDX */
77 0x01e0, /* Advertise all above */
78 0x5000, /* FDX all above */
79 0x1800, /* Set fast TTM in 100bt modes */
80 0x0000, /* PHY cannot be unplugged */
81 }},
66 {NULL}}; 82 {NULL}};
67 83
68 84
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index afb5cda9d8e1..bb3558164a5b 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -78,7 +78,7 @@ int tulip_refill_rx(struct net_device *dev)
78 if (skb == NULL) 78 if (skb == NULL)
79 break; 79 break;
80 80
81 mapping = pci_map_single(tp->pdev, skb->tail, PKT_BUF_SZ, 81 mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
82 PCI_DMA_FROMDEVICE); 82 PCI_DMA_FROMDEVICE);
83 tp->rx_buffers[entry].mapping = mapping; 83 tp->rx_buffers[entry].mapping = mapping;
84 84
@@ -199,12 +199,12 @@ int tulip_poll(struct net_device *dev, int *budget)
199 tp->rx_buffers[entry].mapping, 199 tp->rx_buffers[entry].mapping,
200 pkt_len, PCI_DMA_FROMDEVICE); 200 pkt_len, PCI_DMA_FROMDEVICE);
201#if ! defined(__alpha__) 201#if ! defined(__alpha__)
202 eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->tail, 202 eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->data,
203 pkt_len, 0); 203 pkt_len, 0);
204 skb_put(skb, pkt_len); 204 skb_put(skb, pkt_len);
205#else 205#else
206 memcpy(skb_put(skb, pkt_len), 206 memcpy(skb_put(skb, pkt_len),
207 tp->rx_buffers[entry].skb->tail, 207 tp->rx_buffers[entry].skb->data,
208 pkt_len); 208 pkt_len);
209#endif 209#endif
210 pci_dma_sync_single_for_device(tp->pdev, 210 pci_dma_sync_single_for_device(tp->pdev,
@@ -423,12 +423,12 @@ static int tulip_rx(struct net_device *dev)
423 tp->rx_buffers[entry].mapping, 423 tp->rx_buffers[entry].mapping,
424 pkt_len, PCI_DMA_FROMDEVICE); 424 pkt_len, PCI_DMA_FROMDEVICE);
425#if ! defined(__alpha__) 425#if ! defined(__alpha__)
426 eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->tail, 426 eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->data,
427 pkt_len, 0); 427 pkt_len, 0);
428 skb_put(skb, pkt_len); 428 skb_put(skb, pkt_len);
429#else 429#else
430 memcpy(skb_put(skb, pkt_len), 430 memcpy(skb_put(skb, pkt_len),
431 tp->rx_buffers[entry].skb->tail, 431 tp->rx_buffers[entry].skb->data,
432 pkt_len); 432 pkt_len);
433#endif 433#endif
434 pci_dma_sync_single_for_device(tp->pdev, 434 pci_dma_sync_single_for_device(tp->pdev,
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index 919c40cd635c..e26c31f944bf 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -400,6 +400,9 @@ void tulip_select_media(struct net_device *dev, int startup)
400 } 400 }
401 401
402 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); 402 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0);
403
404 mdelay(1);
405
403 return; 406 return;
404} 407}
405 408
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index e0ae3ed6e578..d45d8f56e5b4 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -242,6 +242,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
242 { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */ 242 { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */
243 { 0x10b9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */ 243 { 0x10b9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ULI526X }, /* ALi 1563 integrated ethernet */
244 { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */ 244 { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
245 { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */
245 { } /* terminate list */ 246 { } /* terminate list */
246}; 247};
247MODULE_DEVICE_TABLE(pci, tulip_pci_tbl); 248MODULE_DEVICE_TABLE(pci, tulip_pci_tbl);
@@ -624,7 +625,7 @@ static void tulip_init_ring(struct net_device *dev)
624 tp->rx_buffers[i].skb = skb; 625 tp->rx_buffers[i].skb = skb;
625 if (skb == NULL) 626 if (skb == NULL)
626 break; 627 break;
627 mapping = pci_map_single(tp->pdev, skb->tail, 628 mapping = pci_map_single(tp->pdev, skb->data,
628 PKT_BUF_SZ, PCI_DMA_FROMDEVICE); 629 PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
629 tp->rx_buffers[i].mapping = mapping; 630 tp->rx_buffers[i].mapping = mapping;
630 skb->dev = dev; /* Mark as being used by this device. */ 631 skb->dev = dev; /* Mark as being used by this device. */
@@ -1514,8 +1515,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1514 (PCI_SLOT(pdev->devfn) == 12))) { 1515 (PCI_SLOT(pdev->devfn) == 12))) {
1515 /* Cobalt MAC address in first EEPROM locations. */ 1516 /* Cobalt MAC address in first EEPROM locations. */
1516 sa_offset = 0; 1517 sa_offset = 0;
1517 /* No media table either */ 1518 /* Ensure our media table fixup get's applied */
1518 tp->flags &= ~HAS_MEDIA_TABLE; 1519 memcpy(ee_data + 16, ee_data, 8);
1519 } 1520 }
1520#endif 1521#endif
1521#ifdef CONFIG_GSC 1522#ifdef CONFIG_GSC
@@ -1756,11 +1757,19 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
1756{ 1757{
1757 struct net_device *dev = pci_get_drvdata(pdev); 1758 struct net_device *dev = pci_get_drvdata(pdev);
1758 1759
1759 if (dev && netif_running (dev) && netif_device_present (dev)) { 1760 if (!dev)
1760 netif_device_detach (dev); 1761 return -EINVAL;
1761 tulip_down (dev); 1762
1762 /* pci_power_off(pdev, -1); */ 1763 if (netif_running(dev))
1763 } 1764 tulip_down(dev);
1765
1766 netif_device_detach(dev);
1767 free_irq(dev->irq, dev);
1768
1769 pci_save_state(pdev);
1770 pci_disable_device(pdev);
1771 pci_set_power_state(pdev, pci_choose_state(pdev, state));
1772
1764 return 0; 1773 return 0;
1765} 1774}
1766 1775
@@ -1768,15 +1777,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
1768static int tulip_resume(struct pci_dev *pdev) 1777static int tulip_resume(struct pci_dev *pdev)
1769{ 1778{
1770 struct net_device *dev = pci_get_drvdata(pdev); 1779 struct net_device *dev = pci_get_drvdata(pdev);
1780 int retval;
1771 1781
1772 if (dev && netif_running (dev) && !netif_device_present (dev)) { 1782 if (!dev)
1773#if 1 1783 return -EINVAL;
1774 pci_enable_device (pdev); 1784
1775#endif 1785 pci_set_power_state(pdev, PCI_D0);
1776 /* pci_power_on(pdev); */ 1786 pci_restore_state(pdev);
1777 tulip_up (dev); 1787
1778 netif_device_attach (dev); 1788 pci_enable_device(pdev);
1789
1790 if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) {
1791 printk (KERN_ERR "tulip: request_irq failed in resume\n");
1792 return retval;
1779 } 1793 }
1794
1795 netif_device_attach(dev);
1796
1797 if (netif_running(dev))
1798 tulip_up(dev);
1799
1780 return 0; 1800 return 0;
1781} 1801}
1782 1802
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index caff2f590165..5b1af3986abf 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -121,6 +121,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
121#include <linux/slab.h> 121#include <linux/slab.h>
122#include <linux/interrupt.h> 122#include <linux/interrupt.h>
123#include <linux/pci.h> 123#include <linux/pci.h>
124#include <linux/dma-mapping.h>
124#include <linux/netdevice.h> 125#include <linux/netdevice.h>
125#include <linux/etherdevice.h> 126#include <linux/etherdevice.h>
126#include <linux/skbuff.h> 127#include <linux/skbuff.h>
@@ -394,7 +395,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
394 395
395 irq = pdev->irq; 396 irq = pdev->irq;
396 397
397 if (pci_set_dma_mask(pdev,0xFFFFffff)) { 398 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
398 printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n", 399 printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n",
399 pci_name(pdev)); 400 pci_name(pdev));
400 return -EIO; 401 return -EIO;
@@ -848,7 +849,7 @@ static void init_rxtx_rings(struct net_device *dev)
848 if (skb == NULL) 849 if (skb == NULL)
849 break; 850 break;
850 skb->dev = dev; /* Mark as being used by this device. */ 851 skb->dev = dev; /* Mark as being used by this device. */
851 np->rx_addr[i] = pci_map_single(np->pci_dev,skb->tail, 852 np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data,
852 skb->len,PCI_DMA_FROMDEVICE); 853 skb->len,PCI_DMA_FROMDEVICE);
853 854
854 np->rx_ring[i].buffer1 = np->rx_addr[i]; 855 np->rx_ring[i].buffer1 = np->rx_addr[i];
@@ -1268,7 +1269,7 @@ static int netdev_rx(struct net_device *dev)
1268 pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], 1269 pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry],
1269 np->rx_skbuff[entry]->len, 1270 np->rx_skbuff[entry]->len,
1270 PCI_DMA_FROMDEVICE); 1271 PCI_DMA_FROMDEVICE);
1271 eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); 1272 eth_copy_and_sum(skb, np->rx_skbuff[entry]->data, pkt_len, 0);
1272 skb_put(skb, pkt_len); 1273 skb_put(skb, pkt_len);
1273 pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry], 1274 pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry],
1274 np->rx_skbuff[entry]->len, 1275 np->rx_skbuff[entry]->len,
@@ -1314,7 +1315,7 @@ static int netdev_rx(struct net_device *dev)
1314 break; /* Better luck next round. */ 1315 break; /* Better luck next round. */
1315 skb->dev = dev; /* Mark as being used by this device. */ 1316 skb->dev = dev; /* Mark as being used by this device. */
1316 np->rx_addr[entry] = pci_map_single(np->pci_dev, 1317 np->rx_addr[entry] = pci_map_single(np->pci_dev,
1317 skb->tail, 1318 skb->data,
1318 skb->len, PCI_DMA_FROMDEVICE); 1319 skb->len, PCI_DMA_FROMDEVICE);
1319 np->rx_ring[entry].buffer1 = np->rx_addr[entry]; 1320 np->rx_ring[entry].buffer1 = np->rx_addr[entry];
1320 } 1321 }
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index b8a9b395c5ea..887d7245fe7b 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -899,7 +899,7 @@ static void xircom_init_ring(struct net_device *dev)
899 break; 899 break;
900 skb->dev = dev; /* Mark as being used by this device. */ 900 skb->dev = dev; /* Mark as being used by this device. */
901 tp->rx_ring[i].status = Rx0DescOwned; /* Owned by Xircom chip */ 901 tp->rx_ring[i].status = Rx0DescOwned; /* Owned by Xircom chip */
902 tp->rx_ring[i].buffer1 = virt_to_bus(skb->tail); 902 tp->rx_ring[i].buffer1 = virt_to_bus(skb->data);
903 } 903 }
904 tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 904 tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
905 905
@@ -1291,7 +1291,7 @@ xircom_rx(struct net_device *dev)
1291 if (skb == NULL) 1291 if (skb == NULL)
1292 break; 1292 break;
1293 skb->dev = dev; /* Mark as being used by this device. */ 1293 skb->dev = dev; /* Mark as being used by this device. */
1294 tp->rx_ring[entry].buffer1 = virt_to_bus(skb->tail); 1294 tp->rx_ring[entry].buffer1 = virt_to_bus(skb->data);
1295 work_done++; 1295 work_done++;
1296 } 1296 }
1297 tp->rx_ring[entry].status = Rx0DescOwned; 1297 tp->rx_ring[entry].status = Rx0DescOwned;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7bfee366297b..effab0b9adca 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -215,7 +215,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
215 215
216 poll_wait(file, &tun->read_wait, wait); 216 poll_wait(file, &tun->read_wait, wait);
217 217
218 if (skb_queue_len(&tun->readq)) 218 if (!skb_queue_empty(&tun->readq))
219 mask |= POLLIN | POLLRDNORM; 219 mask |= POLLIN | POLLRDNORM;
220 220
221 return mask; 221 return mask;
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 8f3392989a06..ecfa6f8805ce 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1661,7 +1661,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
1661#endif 1661#endif
1662 1662
1663 skb->dev = tp->dev; 1663 skb->dev = tp->dev;
1664 dma_addr = pci_map_single(tp->pdev, skb->tail, 1664 dma_addr = pci_map_single(tp->pdev, skb->data,
1665 PKT_BUF_SZ, PCI_DMA_FROMDEVICE); 1665 PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
1666 1666
1667 /* Since no card does 64 bit DAC, the high bits will never 1667 /* Since no card does 64 bit DAC, the high bits will never
@@ -1721,7 +1721,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile u32 * ready,
1721 pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, 1721 pci_dma_sync_single_for_cpu(tp->pdev, dma_addr,
1722 PKT_BUF_SZ, 1722 PKT_BUF_SZ,
1723 PCI_DMA_FROMDEVICE); 1723 PCI_DMA_FROMDEVICE);
1724 eth_copy_and_sum(new_skb, skb->tail, pkt_len, 0); 1724 eth_copy_and_sum(new_skb, skb->data, pkt_len, 0);
1725 pci_dma_sync_single_for_device(tp->pdev, dma_addr, 1725 pci_dma_sync_single_for_device(tp->pdev, dma_addr,
1726 PKT_BUF_SZ, 1726 PKT_BUF_SZ,
1727 PCI_DMA_FROMDEVICE); 1727 PCI_DMA_FROMDEVICE);
@@ -1906,9 +1906,9 @@ typhoon_sleep(struct typhoon *tp, pci_power_t state, u16 events)
1906 */ 1906 */
1907 netif_carrier_off(tp->dev); 1907 netif_carrier_off(tp->dev);
1908 1908
1909 pci_enable_wake(tp->pdev, pci_choose_state(pdev, state), 1); 1909 pci_enable_wake(tp->pdev, state, 1);
1910 pci_disable_device(pdev); 1910 pci_disable_device(pdev);
1911 return pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1911 return pci_set_power_state(pdev, state);
1912} 1912}
1913 1913
1914static int 1914static int
@@ -2274,7 +2274,7 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state)
2274 goto need_resume; 2274 goto need_resume;
2275 } 2275 }
2276 2276
2277 if(typhoon_sleep(tp, state, tp->wol_events) < 0) { 2277 if(typhoon_sleep(tp, pci_choose_state(pdev, state), tp->wol_events) < 0) {
2278 printk(KERN_ERR "%s: unable to put card to sleep\n", dev->name); 2278 printk(KERN_ERR "%s: unable to put card to sleep\n", dev->name);
2279 goto need_resume; 2279 goto need_resume;
2280 } 2280 }
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 7b57d552094a..fc7738ffbfff 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -186,6 +186,7 @@ static const int multicast_filter_limit = 32;
186#include <linux/slab.h> 186#include <linux/slab.h>
187#include <linux/interrupt.h> 187#include <linux/interrupt.h>
188#include <linux/pci.h> 188#include <linux/pci.h>
189#include <linux/dma-mapping.h>
189#include <linux/netdevice.h> 190#include <linux/netdevice.h>
190#include <linux/etherdevice.h> 191#include <linux/etherdevice.h>
191#include <linux/skbuff.h> 192#include <linux/skbuff.h>
@@ -506,7 +507,7 @@ static struct net_device_stats *rhine_get_stats(struct net_device *dev);
506static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 507static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
507static struct ethtool_ops netdev_ethtool_ops; 508static struct ethtool_ops netdev_ethtool_ops;
508static int rhine_close(struct net_device *dev); 509static int rhine_close(struct net_device *dev);
509static void rhine_shutdown (struct device *gdev); 510static void rhine_shutdown (struct pci_dev *pdev);
510 511
511#define RHINE_WAIT_FOR(condition) do { \ 512#define RHINE_WAIT_FOR(condition) do { \
512 int i=1024; \ 513 int i=1024; \
@@ -740,7 +741,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
740 goto err_out; 741 goto err_out;
741 742
742 /* this should always be supported */ 743 /* this should always be supported */
743 rc = pci_set_dma_mask(pdev, 0xffffffff); 744 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
744 if (rc) { 745 if (rc) {
745 printk(KERN_ERR "32-bit PCI DMA addresses not supported by " 746 printk(KERN_ERR "32-bit PCI DMA addresses not supported by "
746 "the card!?\n"); 747 "the card!?\n");
@@ -989,7 +990,7 @@ static void alloc_rbufs(struct net_device *dev)
989 skb->dev = dev; /* Mark as being used by this device. */ 990 skb->dev = dev; /* Mark as being used by this device. */
990 991
991 rp->rx_skbuff_dma[i] = 992 rp->rx_skbuff_dma[i] =
992 pci_map_single(rp->pdev, skb->tail, rp->rx_buf_sz, 993 pci_map_single(rp->pdev, skb->data, rp->rx_buf_sz,
993 PCI_DMA_FROMDEVICE); 994 PCI_DMA_FROMDEVICE);
994 995
995 rp->rx_ring[i].addr = cpu_to_le32(rp->rx_skbuff_dma[i]); 996 rp->rx_ring[i].addr = cpu_to_le32(rp->rx_skbuff_dma[i]);
@@ -1397,7 +1398,7 @@ static void rhine_tx(struct net_device *dev)
1397 while (rp->dirty_tx != rp->cur_tx) { 1398 while (rp->dirty_tx != rp->cur_tx) {
1398 txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); 1399 txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status);
1399 if (debug > 6) 1400 if (debug > 6)
1400 printk(KERN_DEBUG " Tx scavenge %d status %8.8x.\n", 1401 printk(KERN_DEBUG "Tx scavenge %d status %8.8x.\n",
1401 entry, txstatus); 1402 entry, txstatus);
1402 if (txstatus & DescOwn) 1403 if (txstatus & DescOwn)
1403 break; 1404 break;
@@ -1468,7 +1469,7 @@ static void rhine_rx(struct net_device *dev)
1468 int data_size = desc_status >> 16; 1469 int data_size = desc_status >> 16;
1469 1470
1470 if (debug > 4) 1471 if (debug > 4)
1471 printk(KERN_DEBUG " rhine_rx() status is %8.8x.\n", 1472 printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n",
1472 desc_status); 1473 desc_status);
1473 if (--boguscnt < 0) 1474 if (--boguscnt < 0)
1474 break; 1475 break;
@@ -1486,7 +1487,7 @@ static void rhine_rx(struct net_device *dev)
1486 } else if (desc_status & RxErr) { 1487 } else if (desc_status & RxErr) {
1487 /* There was a error. */ 1488 /* There was a error. */
1488 if (debug > 2) 1489 if (debug > 2)
1489 printk(KERN_DEBUG " rhine_rx() Rx " 1490 printk(KERN_DEBUG "rhine_rx() Rx "
1490 "error was %8.8x.\n", 1491 "error was %8.8x.\n",
1491 desc_status); 1492 desc_status);
1492 rp->stats.rx_errors++; 1493 rp->stats.rx_errors++;
@@ -1517,7 +1518,7 @@ static void rhine_rx(struct net_device *dev)
1517 PCI_DMA_FROMDEVICE); 1518 PCI_DMA_FROMDEVICE);
1518 1519
1519 eth_copy_and_sum(skb, 1520 eth_copy_and_sum(skb,
1520 rp->rx_skbuff[entry]->tail, 1521 rp->rx_skbuff[entry]->data,
1521 pkt_len, 0); 1522 pkt_len, 0);
1522 skb_put(skb, pkt_len); 1523 skb_put(skb, pkt_len);
1523 pci_dma_sync_single_for_device(rp->pdev, 1524 pci_dma_sync_single_for_device(rp->pdev,
@@ -1560,7 +1561,7 @@ static void rhine_rx(struct net_device *dev)
1560 break; /* Better luck next round. */ 1561 break; /* Better luck next round. */
1561 skb->dev = dev; /* Mark as being used by this device. */ 1562 skb->dev = dev; /* Mark as being used by this device. */
1562 rp->rx_skbuff_dma[entry] = 1563 rp->rx_skbuff_dma[entry] =
1563 pci_map_single(rp->pdev, skb->tail, 1564 pci_map_single(rp->pdev, skb->data,
1564 rp->rx_buf_sz, 1565 rp->rx_buf_sz,
1565 PCI_DMA_FROMDEVICE); 1566 PCI_DMA_FROMDEVICE);
1566 rp->rx_ring[entry].addr = cpu_to_le32(rp->rx_skbuff_dma[entry]); 1567 rp->rx_ring[entry].addr = cpu_to_le32(rp->rx_skbuff_dma[entry]);
@@ -1894,9 +1895,8 @@ static void __devexit rhine_remove_one(struct pci_dev *pdev)
1894 pci_set_drvdata(pdev, NULL); 1895 pci_set_drvdata(pdev, NULL);
1895} 1896}
1896 1897
1897static void rhine_shutdown (struct device *gendev) 1898static void rhine_shutdown (struct pci_dev *pdev)
1898{ 1899{
1899 struct pci_dev *pdev = to_pci_dev(gendev);
1900 struct net_device *dev = pci_get_drvdata(pdev); 1900 struct net_device *dev = pci_get_drvdata(pdev);
1901 struct rhine_private *rp = netdev_priv(dev); 1901 struct rhine_private *rp = netdev_priv(dev);
1902 void __iomem *ioaddr = rp->base; 1902 void __iomem *ioaddr = rp->base;
@@ -1955,7 +1955,7 @@ static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
1955 pci_save_state(pdev); 1955 pci_save_state(pdev);
1956 1956
1957 spin_lock_irqsave(&rp->lock, flags); 1957 spin_lock_irqsave(&rp->lock, flags);
1958 rhine_shutdown(&pdev->dev); 1958 rhine_shutdown(pdev);
1959 spin_unlock_irqrestore(&rp->lock, flags); 1959 spin_unlock_irqrestore(&rp->lock, flags);
1960 1960
1961 free_irq(dev->irq, dev); 1961 free_irq(dev->irq, dev);
@@ -2009,9 +2009,7 @@ static struct pci_driver rhine_driver = {
2009 .suspend = rhine_suspend, 2009 .suspend = rhine_suspend,
2010 .resume = rhine_resume, 2010 .resume = rhine_resume,
2011#endif /* CONFIG_PM */ 2011#endif /* CONFIG_PM */
2012 .driver = { 2012 .shutdown = rhine_shutdown,
2013 .shutdown = rhine_shutdown,
2014 }
2015}; 2013};
2016 2014
2017 2015
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 15e710283493..abc5cee6eedc 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1335,7 +1335,7 @@ static inline int velocity_rx_copy(struct sk_buff **rx_skb, int pkt_size,
1335 if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) 1335 if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN)
1336 skb_reserve(new_skb, 2); 1336 skb_reserve(new_skb, 2);
1337 1337
1338 memcpy(new_skb->data, rx_skb[0]->tail, pkt_size); 1338 memcpy(new_skb->data, rx_skb[0]->data, pkt_size);
1339 *rx_skb = new_skb; 1339 *rx_skb = new_skb;
1340 ret = 0; 1340 ret = 0;
1341 } 1341 }
@@ -1456,9 +1456,9 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1456 * Do the gymnastics to get the buffer head for data at 1456 * Do the gymnastics to get the buffer head for data at
1457 * 64byte alignment. 1457 * 64byte alignment.
1458 */ 1458 */
1459 skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->tail & 63); 1459 skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->data & 63);
1460 rd_info->skb->dev = vptr->dev; 1460 rd_info->skb->dev = vptr->dev;
1461 rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->tail, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); 1461 rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE);
1462 1462
1463 /* 1463 /*
1464 * Fill in the descriptor to match 1464 * Fill in the descriptor to match
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index 1b70b7c97580..d9a774b91ddc 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1414,7 +1414,7 @@ static inline void mac_get_cam(struct mac_regs __iomem * regs, int idx, u8 *addr
1414 * the rest of the logic from the result of sleep/wakeup 1414 * the rest of the logic from the result of sleep/wakeup
1415 */ 1415 */
1416 1416
1417inline static void mac_wol_reset(struct mac_regs __iomem * regs) 1417static inline void mac_wol_reset(struct mac_regs __iomem * regs)
1418{ 1418{
1419 1419
1420 /* Turn off SWPTAG right after leaving power mode */ 1420 /* Turn off SWPTAG right after leaving power mode */
@@ -1811,7 +1811,7 @@ struct velocity_info {
1811 * CHECK ME: locking 1811 * CHECK ME: locking
1812 */ 1812 */
1813 1813
1814inline static int velocity_get_ip(struct velocity_info *vptr) 1814static inline int velocity_get_ip(struct velocity_info *vptr)
1815{ 1815{
1816 struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr; 1816 struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr;
1817 struct in_ifaddr *ifa; 1817 struct in_ifaddr *ifa;
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 66b94668ddd8..18c27e1e7884 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -435,7 +435,7 @@ config VENDOR_SANGOMA
435 the driver to support. 435 the driver to support.
436 436
437 If you have one or more of these cards, say M to this option; 437 If you have one or more of these cards, say M to this option;
438 and read <file:Documentation/networking/wanpipe.txt>. 438 and read <file:Documentation/networking/wan-router.txt>.
439 439
440 To compile this driver as a module, choose M here: the 440 To compile this driver as a module, choose M here: the
441 module will be called wanpipe. 441 module will be called wanpipe.
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 7575b799ce53..2c83cca34b86 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -861,8 +861,7 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
861/* 861/*
862 * Mark it for our own raw sockets interface 862 * Mark it for our own raw sockets interface
863 */ 863 */
864static unsigned short farsync_type_trans(struct sk_buff *skb, 864static __be16 farsync_type_trans(struct sk_buff *skb, struct net_device *dev)
865 struct net_device *dev)
866{ 865{
867 skb->dev = dev; 866 skb->dev = dev;
868 skb->mac.raw = skb->data; 867 skb->mac.raw = skb->data;
@@ -981,6 +980,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd)
981 /* Wait for any previous command to complete */ 980 /* Wait for any previous command to complete */
982 while (mbval > NAK) { 981 while (mbval > NAK) {
983 spin_unlock_irqrestore(&card->card_lock, flags); 982 spin_unlock_irqrestore(&card->card_lock, flags);
983 set_current_state(TASK_UNINTERRUPTIBLE);
984 schedule_timeout(1); 984 schedule_timeout(1);
985 spin_lock_irqsave(&card->card_lock, flags); 985 spin_lock_irqsave(&card->card_lock, flags);
986 986
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index c1b6896d7007..48c03c11cd9a 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -72,7 +72,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
72 } 72 }
73 skb_reserve(skb, 4); 73 skb_reserve(skb, 4);
74 cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0); 74 cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0);
75 data = (cisco_packet*)skb->tail; 75 data = (cisco_packet*)skb->data;
76 76
77 data->type = htonl(type); 77 data->type = htonl(type);
78 data->par1 = htonl(par1); 78 data->par1 = htonl(par1);
@@ -91,8 +91,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
91 91
92 92
93 93
94static unsigned short cisco_type_trans(struct sk_buff *skb, 94static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
95 struct net_device *dev)
96{ 95{
97 hdlc_header *data = (hdlc_header*)skb->data; 96 hdlc_header *data = (hdlc_header*)skb->data;
98 97
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 7cd6195a2e46..b81263eaede0 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -66,8 +66,7 @@ static void ppp_close(struct net_device *dev)
66 66
67 67
68 68
69static unsigned short ppp_type_trans(struct sk_buff *skb, 69static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev)
70 struct net_device *dev)
71{ 70{
72 return __constant_htons(ETH_P_WAN_PPP); 71 return __constant_htons(ETH_P_WAN_PPP);
73} 72}
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c
index c41fb70b6929..9456d31cb1c1 100644
--- a/drivers/net/wan/hdlc_raw.c
+++ b/drivers/net/wan/hdlc_raw.c
@@ -24,8 +24,7 @@
24#include <linux/hdlc.h> 24#include <linux/hdlc.h>
25 25
26 26
27static unsigned short raw_type_trans(struct sk_buff *skb, 27static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev)
28 struct net_device *dev)
29{ 28{
30 return __constant_htons(ETH_P_IP); 29 return __constant_htons(ETH_P_IP);
31} 30}
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c
index 2efccb0554c0..c5f5e62aab8b 100644
--- a/drivers/net/wan/sdla_fr.c
+++ b/drivers/net/wan/sdla_fr.c
@@ -152,6 +152,7 @@
152#include <asm/io.h> /* for inb(), outb(), etc. */ 152#include <asm/io.h> /* for inb(), outb(), etc. */
153#include <linux/time.h> /* for do_gettimeofday */ 153#include <linux/time.h> /* for do_gettimeofday */
154#include <linux/in.h> /* sockaddr_in */ 154#include <linux/in.h> /* sockaddr_in */
155#include <linux/jiffies.h> /* time_after() macro */
155#include <asm/errno.h> 156#include <asm/errno.h>
156 157
157#include <linux/ip.h> 158#include <linux/ip.h>
@@ -773,7 +774,7 @@ static int update(struct wan_device* wandev)
773 for(;;) { 774 for(;;) {
774 if(card->u.f.update_comms_stats == 0) 775 if(card->u.f.update_comms_stats == 0)
775 break; 776 break;
776 if ((jiffies - timeout) > (1 * HZ)){ 777 if (time_after(jiffies, timeout + 1 * HZ)){
777 card->u.f.update_comms_stats = 0; 778 card->u.f.update_comms_stats = 0;
778 return -EAGAIN; 779 return -EAGAIN;
779 } 780 }
@@ -4799,7 +4800,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
4799{ 4800{
4800 fr_channel_t *chan = dev->priv; 4801 fr_channel_t *chan = dev->priv;
4801 volatile sdla_t *card = chan->card; 4802 volatile sdla_t *card = chan->card;
4802 u32 timeout; 4803 unsigned long timeout;
4803 fr508_flags_t* flags = card->flags; 4804 fr508_flags_t* flags = card->flags;
4804 int reset_critical=0; 4805 int reset_critical=0;
4805 4806
@@ -4821,7 +4822,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
4821 if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG)) 4822 if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG))
4822 break; 4823 break;
4823 4824
4824 if ((jiffies - timeout) > (1 * HZ)){ 4825 if (time_after(jiffies, timeout + 1 * HZ)){
4825 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG; 4826 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
4826 printk(KERN_INFO "%s: Failed to delete DLCI %i\n", 4827 printk(KERN_INFO "%s: Failed to delete DLCI %i\n",
4827 card->devname,chan->dlci); 4828 card->devname,chan->dlci);
diff --git a/drivers/net/wan/sdla_ft1.c b/drivers/net/wan/sdla_ft1.c
index 5e3124856eb0..9d6528a50f7b 100644
--- a/drivers/net/wan/sdla_ft1.c
+++ b/drivers/net/wan/sdla_ft1.c
@@ -29,6 +29,7 @@
29#include <linux/wanrouter.h> /* WAN router definitions */ 29#include <linux/wanrouter.h> /* WAN router definitions */
30#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 30#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
31#include <linux/if_arp.h> /* ARPHRD_* defines */ 31#include <linux/if_arp.h> /* ARPHRD_* defines */
32#include <linux/jiffies.h> /* time_after() macro */
32 33
33#include <linux/inetdevice.h> 34#include <linux/inetdevice.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -164,7 +165,7 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf)
164 165
165 timeout = jiffies; 166 timeout = jiffies;
166 while (mb->return_code != 'I') /* Wait 1s for board to initialize */ 167 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
167 if ((jiffies - timeout) > 1*HZ) break; 168 if (time_after(jiffies, timeout + 1*HZ)) break;
168 169
169 if (mb->return_code != 'I') { 170 if (mb->return_code != 'I') {
170 printk(KERN_INFO 171 printk(KERN_INFO
diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c
index 1761cb68ab48..a4b489cccbbf 100644
--- a/drivers/net/wan/sdla_ppp.c
+++ b/drivers/net/wan/sdla_ppp.c
@@ -101,6 +101,7 @@
101#include <linux/if_arp.h> /* ARPHRD_* defines */ 101#include <linux/if_arp.h> /* ARPHRD_* defines */
102#include <asm/byteorder.h> /* htons(), etc. */ 102#include <asm/byteorder.h> /* htons(), etc. */
103#include <linux/in.h> /* sockaddr_in */ 103#include <linux/in.h> /* sockaddr_in */
104#include <linux/jiffies.h> /* time_after() macro */
104 105
105 106
106#include <asm/uaccess.h> 107#include <asm/uaccess.h>
@@ -482,7 +483,7 @@ static int update(struct wan_device *wandev)
482 if(ppp_priv_area->update_comms_stats == 0){ 483 if(ppp_priv_area->update_comms_stats == 0){
483 break; 484 break;
484 } 485 }
485 if ((jiffies - timeout) > (1 * HZ)){ 486 if (time_after(jiffies, timeout + 1 * HZ)){
486 ppp_priv_area->update_comms_stats = 0; 487 ppp_priv_area->update_comms_stats = 0;
487 ppp_priv_area->timer_int_enabled &= 488 ppp_priv_area->timer_int_enabled &=
488 ~TMR_INT_ENABLED_UPDATE; 489 ~TMR_INT_ENABLED_UPDATE;
diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c
index 3a93d2fd4fbf..8a95d61a2f8f 100644
--- a/drivers/net/wan/sdla_x25.c
+++ b/drivers/net/wan/sdla_x25.c
@@ -91,6 +91,7 @@
91#include <linux/wanrouter.h> /* WAN router definitions */ 91#include <linux/wanrouter.h> /* WAN router definitions */
92#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 92#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
93#include <linux/workqueue.h> 93#include <linux/workqueue.h>
94#include <linux/jiffies.h> /* time_after() macro */
94#include <asm/byteorder.h> /* htons(), etc. */ 95#include <asm/byteorder.h> /* htons(), etc. */
95#include <asm/atomic.h> 96#include <asm/atomic.h>
96#include <linux/delay.h> /* Experimental delay */ 97#include <linux/delay.h> /* Experimental delay */
@@ -867,7 +868,7 @@ static int update(struct wan_device* wandev)
867 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){ 868 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){
868 break; 869 break;
869 } 870 }
870 if ((jiffies-timeout) > 1*HZ){ 871 if (time_after(jiffies, timeout + 1*HZ)){
871 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE; 872 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
872 return -EAGAIN; 873 return -EAGAIN;
873 } 874 }
diff --git a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c
index 6aa6987d96cb..812a1183c502 100644
--- a/drivers/net/wan/wanpipe_multppp.c
+++ b/drivers/net/wan/wanpipe_multppp.c
@@ -26,6 +26,7 @@
26#include <linux/wanrouter.h> /* WAN router definitions */ 26#include <linux/wanrouter.h> /* WAN router definitions */
27#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 27#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
28#include <linux/if_arp.h> /* ARPHRD_* defines */ 28#include <linux/if_arp.h> /* ARPHRD_* defines */
29#include <linux/jiffies.h> /* time_after() macro */
29 30
30#include <linux/in.h> /* sockaddr_in */ 31#include <linux/in.h> /* sockaddr_in */
31#include <linux/inet.h> 32#include <linux/inet.h>
@@ -270,9 +271,9 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf)
270 ready to accept commands. We expect this to be completed in less 271 ready to accept commands. We expect this to be completed in less
271 than 1 second. */ 272 than 1 second. */
272 273
273 timeout = jiffies; 274 timeout = jiffies + 1 * HZ;
274 while (mb->return_code != 'I') /* Wait 1s for board to initialize */ 275 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
275 if ((jiffies - timeout) > 1*HZ) break; 276 if (time_after(jiffies, timeout)) break;
276 277
277 if (mb->return_code != 'I') { 278 if (mb->return_code != 'I') {
278 printk(KERN_INFO 279 printk(KERN_INFO
@@ -493,11 +494,11 @@ static int update(struct wan_device* wandev)
493 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE; 494 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE;
494 495
495 /* wait a maximum of 1 second for the statistics to be updated */ 496 /* wait a maximum of 1 second for the statistics to be updated */
496 timeout = jiffies; 497 timeout = jiffies + 1 * HZ;
497 for(;;) { 498 for(;;) {
498 if(chdlc_priv_area->update_comms_stats == 0) 499 if(chdlc_priv_area->update_comms_stats == 0)
499 break; 500 break;
500 if ((jiffies - timeout) > (1 * HZ)){ 501 if (time_after(jiffies, timeout)){
501 chdlc_priv_area->update_comms_stats = 0; 502 chdlc_priv_area->update_comms_stats = 0;
502 chdlc_priv_area->timer_int_enabled &= 503 chdlc_priv_area->timer_int_enabled &=
503 ~TMR_INT_ENABLED_UPDATE; 504 ~TMR_INT_ENABLED_UPDATE;
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 1e7b47704ad9..9c1e10602f2b 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -26,6 +26,7 @@
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/hdlc.h> 27#include <linux/hdlc.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/dma-mapping.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/delay.h> 31#include <asm/delay.h>
31 32
@@ -624,8 +625,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
624 /* FIXME when PCI/DMA subsystems are fixed. 625 /* FIXME when PCI/DMA subsystems are fixed.
625 We set both dma_mask and consistent_dma_mask back to 32 bits 626 We set both dma_mask and consistent_dma_mask back to 32 bits
626 to indicate the card can do 32-bit DMA addressing */ 627 to indicate the card can do 32-bit DMA addressing */
627 if (pci_set_consistent_dma_mask(pdev, 0xFFFFFFFF) || 628 if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) ||
628 pci_set_dma_mask(pdev, 0xFFFFFFFF)) { 629 pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
629 printk(KERN_ERR "wanXL: No usable DMA configuration\n"); 630 printk(KERN_ERR "wanXL: No usable DMA configuration\n");
630 wanxl_pci_remove_one(pdev); 631 wanxl_pci_remove_one(pdev);
631 return -EIO; 632 return -EIO;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 1c540d825551..bdf672c48182 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -829,7 +829,7 @@ static void __exit exit_x25_asy(void)
829 } 829 }
830 830
831 kfree(x25_asy_devs); 831 kfree(x25_asy_devs);
832 tty_register_ldisc(N_X25, NULL); 832 tty_unregister_ldisc(N_X25);
833} 833}
834 834
835module_init(init_x25_asy); 835module_init(init_x25_asy);
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index 1f05d9bd05e4..b03feae459fc 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -149,12 +149,7 @@ struct net_device * __init wd_probe(int unit)
149 err = do_wd_probe(dev); 149 err = do_wd_probe(dev);
150 if (err) 150 if (err)
151 goto out; 151 goto out;
152 err = register_netdev(dev);
153 if (err)
154 goto out1;
155 return dev; 152 return dev;
156out1:
157 cleanup_card(dev);
158out: 153out:
159 free_netdev(dev); 154 free_netdev(dev);
160 return ERR_PTR(err); 155 return ERR_PTR(err);
@@ -164,6 +159,7 @@ out:
164static int __init wd_probe1(struct net_device *dev, int ioaddr) 159static int __init wd_probe1(struct net_device *dev, int ioaddr)
165{ 160{
166 int i; 161 int i;
162 int err;
167 int checksum = 0; 163 int checksum = 0;
168 int ancient = 0; /* An old card without config registers. */ 164 int ancient = 0; /* An old card without config registers. */
169 int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */ 165 int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */
@@ -356,7 +352,10 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
356 outb(inb(ioaddr+4)|0x80, ioaddr+4); 352 outb(inb(ioaddr+4)|0x80, ioaddr+4);
357#endif 353#endif
358 354
359 return 0; 355 err = register_netdev(dev);
356 if (err)
357 free_irq(dev->irq, dev);
358 return err;
360} 359}
361 360
362static int 361static int
@@ -527,11 +526,8 @@ init_module(void)
527 dev->mem_start = mem[this_dev]; 526 dev->mem_start = mem[this_dev];
528 dev->mem_end = mem_end[this_dev]; 527 dev->mem_end = mem_end[this_dev];
529 if (do_wd_probe(dev) == 0) { 528 if (do_wd_probe(dev) == 0) {
530 if (register_netdev(dev) == 0) { 529 dev_wd[found++] = dev;
531 dev_wd[found++] = dev; 530 continue;
532 continue;
533 }
534 cleanup_card(dev);
535 } 531 }
536 free_netdev(dev); 532 free_netdev(dev);
537 printk(KERN_WARNING "wd.c: No wd80x3 card found (i/o = 0x%x).\n", io[this_dev]); 533 printk(KERN_WARNING "wd.c: No wd80x3 card found (i/o = 0x%x).\n", io[this_dev]);
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 1d3231cc471a..ec3f75a030d2 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -270,7 +270,7 @@ config PCMCIA_HERMES
270 270
271config AIRO_CS 271config AIRO_CS
272 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" 272 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
273 depends on NET_RADIO && PCMCIA 273 depends on NET_RADIO && PCMCIA && (BROKEN || !M32R)
274 ---help--- 274 ---help---
275 This is the standard Linux driver to support Cisco/Aironet PCMCIA 275 This is the standard Linux driver to support Cisco/Aironet PCMCIA
276 802.11 wireless cards. This driver is the same as the Aironet 276 802.11 wireless cards. This driver is the same as the Aironet
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index fb10a2db63ad..df20adcd0730 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -900,7 +900,7 @@ typedef struct aironet_ioctl {
900 unsigned char __user *data; // d-data 900 unsigned char __user *data; // d-data
901} aironet_ioctl; 901} aironet_ioctl;
902 902
903static char *swversion = "2.1"; 903static char swversion[] = "2.1";
904#endif /* CISCO_EXT */ 904#endif /* CISCO_EXT */
905 905
906#define NUM_MODULES 2 906#define NUM_MODULES 2
@@ -1209,7 +1209,7 @@ struct airo_info {
1209 unsigned char __iomem *pciaux; 1209 unsigned char __iomem *pciaux;
1210 unsigned char *shared; 1210 unsigned char *shared;
1211 dma_addr_t shared_dma; 1211 dma_addr_t shared_dma;
1212 int power; 1212 pm_message_t power;
1213 SsidRid *SSID; 1213 SsidRid *SSID;
1214 APListRid *APList; 1214 APListRid *APList;
1215#define PCI_SHARED_LEN 2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE 1215#define PCI_SHARED_LEN 2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE
@@ -2374,7 +2374,7 @@ void stop_airo_card( struct net_device *dev, int freeres )
2374 /* 2374 /*
2375 * Clean out tx queue 2375 * Clean out tx queue
2376 */ 2376 */
2377 if (test_bit(FLAG_MPI, &ai->flags) && skb_queue_len (&ai->txq) > 0) { 2377 if (test_bit(FLAG_MPI, &ai->flags) && !skb_queue_empty(&ai->txq)) {
2378 struct sk_buff *skb = NULL; 2378 struct sk_buff *skb = NULL;
2379 for (;(skb = skb_dequeue(&ai->txq));) 2379 for (;(skb = skb_dequeue(&ai->txq));)
2380 dev_kfree_skb(skb); 2380 dev_kfree_skb(skb);
@@ -2918,7 +2918,7 @@ static int airo_thread(void *data) {
2918 flush_signals(current); 2918 flush_signals(current);
2919 2919
2920 /* make swsusp happy with our thread */ 2920 /* make swsusp happy with our thread */
2921 try_to_freeze(PF_FREEZE); 2921 try_to_freeze();
2922 2922
2923 if (test_bit(JOB_DIE, &ai->flags)) 2923 if (test_bit(JOB_DIE, &ai->flags))
2924 break; 2924 break;
@@ -3287,7 +3287,7 @@ exitrx:
3287 if (status & EV_TXEXC) 3287 if (status & EV_TXEXC)
3288 get_tx_error(apriv, -1); 3288 get_tx_error(apriv, -1);
3289 spin_lock_irqsave(&apriv->aux_lock, flags); 3289 spin_lock_irqsave(&apriv->aux_lock, flags);
3290 if (skb_queue_len (&apriv->txq)) { 3290 if (!skb_queue_empty(&apriv->txq)) {
3291 spin_unlock_irqrestore(&apriv->aux_lock,flags); 3291 spin_unlock_irqrestore(&apriv->aux_lock,flags);
3292 mpi_send_packet (dev); 3292 mpi_send_packet (dev);
3293 } else { 3293 } else {
@@ -5013,7 +5013,7 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
5013 enable_MAC(ai, &rsp, 1); 5013 enable_MAC(ai, &rsp, 1);
5014} 5014}
5015 5015
5016inline static u8 hexVal(char c) { 5016static inline u8 hexVal(char c) {
5017 if (c>='0' && c<='9') return c -= '0'; 5017 if (c>='0' && c<='9') return c -= '0';
5018 if (c>='a' && c<='f') return c -= 'a'-10; 5018 if (c>='a' && c<='f') return c -= 'a'-10;
5019 if (c>='A' && c<='F') return c -= 'A'-10; 5019 if (c>='A' && c<='F') return c -= 'A'-10;
@@ -5499,9 +5499,9 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
5499 cmd.cmd=HOSTSLEEP; 5499 cmd.cmd=HOSTSLEEP;
5500 issuecommand(ai, &cmd, &rsp); 5500 issuecommand(ai, &cmd, &rsp);
5501 5501
5502 pci_enable_wake(pdev, state, 1); 5502 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
5503 pci_save_state(pdev); 5503 pci_save_state(pdev);
5504 return pci_set_power_state(pdev, state); 5504 return pci_set_power_state(pdev, pci_choose_state(pdev, state));
5505} 5505}
5506 5506
5507static int airo_pci_resume(struct pci_dev *pdev) 5507static int airo_pci_resume(struct pci_dev *pdev)
@@ -5512,7 +5512,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
5512 5512
5513 pci_set_power_state(pdev, 0); 5513 pci_set_power_state(pdev, 0);
5514 pci_restore_state(pdev); 5514 pci_restore_state(pdev);
5515 pci_enable_wake(pdev, ai->power, 0); 5515 pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0);
5516 5516
5517 if (ai->power > 1) { 5517 if (ai->power > 1) {
5518 reset_card(dev, 0); 5518 reset_card(dev, 0);
@@ -5541,7 +5541,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
5541 } 5541 }
5542 writeConfigRid(ai, 0); 5542 writeConfigRid(ai, 0);
5543 enable_MAC(ai, &rsp, 0); 5543 enable_MAC(ai, &rsp, 0);
5544 ai->power = 0; 5544 ai->power = PMSG_ON;
5545 netif_device_attach(dev); 5545 netif_device_attach(dev);
5546 netif_wake_queue(dev); 5546 netif_wake_queue(dev);
5547 enable_interrupts(ai); 5547 enable_interrupts(ai);
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index fbf53af6cda4..bf25584d68d3 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -33,7 +33,6 @@
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/netdevice.h> 34#include <linux/netdevice.h>
35 35
36#include <pcmcia/version.h>
37#include <pcmcia/cs_types.h> 36#include <pcmcia/cs_types.h>
38#include <pcmcia/cs.h> 37#include <pcmcia/cs.h>
39#include <pcmcia/cistpl.h> 38#include <pcmcia/cistpl.h>
@@ -210,11 +209,6 @@ static dev_link_t *airo_attach(void)
210 link->next = dev_list; 209 link->next = dev_list;
211 dev_list = link; 210 dev_list = link;
212 client_reg.dev_info = &dev_info; 211 client_reg.dev_info = &dev_info;
213 client_reg.EventMask =
214 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
215 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
216 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
217 client_reg.event_handler = &airo_event;
218 client_reg.Version = 0x0210; 212 client_reg.Version = 0x0210;
219 client_reg.event_callback_args.client_data = link; 213 client_reg.event_callback_args.client_data = link;
220 ret = pcmcia_register_client(&link->handle, &client_reg); 214 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -559,13 +553,24 @@ static int airo_event(event_t event, int priority,
559 return 0; 553 return 0;
560} /* airo_event */ 554} /* airo_event */
561 555
556static struct pcmcia_device_id airo_ids[] = {
557 PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a),
558 PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005),
559 PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0007),
560 PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0007),
561 PCMCIA_DEVICE_NULL,
562};
563MODULE_DEVICE_TABLE(pcmcia, airo_ids);
564
562static struct pcmcia_driver airo_driver = { 565static struct pcmcia_driver airo_driver = {
563 .owner = THIS_MODULE, 566 .owner = THIS_MODULE,
564 .drv = { 567 .drv = {
565 .name = "airo_cs", 568 .name = "airo_cs",
566 }, 569 },
567 .attach = airo_attach, 570 .attach = airo_attach,
571 .event = airo_event,
568 .detach = airo_detach, 572 .detach = airo_detach,
573 .id_table = airo_ids,
569}; 574};
570 575
571static int airo_cs_init(void) 576static int airo_cs_init(void)
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
index b4f4bd7956a2..9d496703c465 100644
--- a/drivers/net/wireless/airport.c
+++ b/drivers/net/wireless/airport.c
@@ -184,7 +184,7 @@ static int airport_hard_reset(struct orinoco_private *priv)
184} 184}
185 185
186static int 186static int
187airport_attach(struct macio_dev *mdev, const struct of_match *match) 187airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
188{ 188{
189 struct orinoco_private *priv; 189 struct orinoco_private *priv;
190 struct net_device *dev; 190 struct net_device *dev;
@@ -266,16 +266,16 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); 266MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
267MODULE_LICENSE("Dual MPL/GPL"); 267MODULE_LICENSE("Dual MPL/GPL");
268 268
269static struct of_match airport_match[] = 269static struct of_device_id airport_match[] =
270{ 270{
271 { 271 {
272 .name = "radio", 272 .name = "radio",
273 .type = OF_ANY_MATCH,
274 .compatible = OF_ANY_MATCH
275 }, 273 },
276 {}, 274 {},
277}; 275};
278 276
277MODULE_DEVICE_TABLE (of, airport_match);
278
279static struct macio_driver airport_driver = 279static struct macio_driver airport_driver =
280{ 280{
281 .name = DRIVER_NAME, 281 .name = DRIVER_NAME,
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c
index 4f304c6e693a..0e1ac338cac1 100644
--- a/drivers/net/wireless/arlan-main.c
+++ b/drivers/net/wireless/arlan-main.c
@@ -33,8 +33,6 @@ static int arlan_EEPROM_bad;
33 33
34#ifdef ARLAN_DEBUGGING 34#ifdef ARLAN_DEBUGGING
35 35
36static int arlan_entry_debug;
37static int arlan_exit_debug;
38static int testMemory = testMemoryUNKNOWN; 36static int testMemory = testMemoryUNKNOWN;
39static int irq = irqUNKNOWN; 37static int irq = irqUNKNOWN;
40static int txScrambled = 1; 38static int txScrambled = 1;
@@ -43,15 +41,13 @@ static int mdebug;
43module_param(irq, int, 0); 41module_param(irq, int, 0);
44module_param(mdebug, int, 0); 42module_param(mdebug, int, 0);
45module_param(testMemory, int, 0); 43module_param(testMemory, int, 0);
46module_param(arlan_entry_debug, int, 0);
47module_param(arlan_exit_debug, int, 0);
48module_param(txScrambled, int, 0); 44module_param(txScrambled, int, 0);
49MODULE_PARM_DESC(irq, "(unused)"); 45MODULE_PARM_DESC(irq, "(unused)");
50MODULE_PARM_DESC(testMemory, "(unused)"); 46MODULE_PARM_DESC(testMemory, "(unused)");
51MODULE_PARM_DESC(mdebug, "Arlan multicast debugging (0-1)"); 47MODULE_PARM_DESC(mdebug, "Arlan multicast debugging (0-1)");
52#endif 48#endif
53 49
54module_param(arlan_debug, int, 0); 50module_param_named(debug, arlan_debug, int, 0);
55module_param(spreadingCode, int, 0); 51module_param(spreadingCode, int, 0);
56module_param(channelNumber, int, 0); 52module_param(channelNumber, int, 0);
57module_param(channelSet, int, 0); 53module_param(channelSet, int, 0);
@@ -63,17 +59,19 @@ module_param(keyStart, int, 0);
63module_param(tx_delay_ms, int, 0); 59module_param(tx_delay_ms, int, 0);
64module_param(retries, int, 0); 60module_param(retries, int, 0);
65module_param(tx_queue_len, int, 0); 61module_param(tx_queue_len, int, 0);
66module_param(arlan_EEPROM_bad, int, 0); 62module_param_named(EEPROM_bad, arlan_EEPROM_bad, int, 0);
67MODULE_PARM_DESC(arlan_debug, "Arlan debug enable (0-1)"); 63MODULE_PARM_DESC(debug, "Arlan debug enable (0-1)");
68MODULE_PARM_DESC(retries, "Arlan maximum packet retransmisions"); 64MODULE_PARM_DESC(retries, "Arlan maximum packet retransmisions");
69#ifdef ARLAN_ENTRY_EXIT_DEBUGGING 65#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
70MODULE_PARM_DESC(arlan_entry_debug, "Arlan driver function entry debugging"); 66static int arlan_entry_debug;
71MODULE_PARM_DESC(arlan_exit_debug, "Arlan driver function exit debugging"); 67static int arlan_exit_debug;
72MODULE_PARM_DESC(arlan_entry_and_exit_debug, "Arlan driver function entry and exit debugging"); 68static int arlan_entry_and_exit_debug;
73#else 69module_param_named(entry_debug, arlan_entry_debug, int, 0);
74MODULE_PARM_DESC(arlan_entry_debug, "(ignored)"); 70module_param_named(exit_debug, arlan_exit_debug, int, 0);
75MODULE_PARM_DESC(arlan_exit_debug, "(ignored)"); 71module_param_named(entry_and_exit_debug, arlan_entry_and_exit_debug, int, 0);
76MODULE_PARM_DESC(arlan_entry_and_exit_debug, "(ignored)"); 72MODULE_PARM_DESC(entry_debug, "Arlan driver function entry debugging");
73MODULE_PARM_DESC(exit_debug, "Arlan driver function exit debugging");
74MODULE_PARM_DESC(entry_and_exit_debug, "Arlan driver function entry and exit debugging");
77#endif 75#endif
78 76
79struct arlan_conf_stru arlan_conf[MAX_ARLANS]; 77struct arlan_conf_stru arlan_conf[MAX_ARLANS];
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index a4ed28d9c783..ff031a3985b3 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -43,7 +43,6 @@
43#include <linux/moduleparam.h> 43#include <linux/moduleparam.h>
44#include <linux/device.h> 44#include <linux/device.h>
45 45
46#include <pcmcia/version.h>
47#include <pcmcia/cs_types.h> 46#include <pcmcia/cs_types.h>
48#include <pcmcia/cs.h> 47#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
@@ -218,11 +217,6 @@ static dev_link_t *atmel_attach(void)
218 link->next = dev_list; 217 link->next = dev_list;
219 dev_list = link; 218 dev_list = link;
220 client_reg.dev_info = &dev_info; 219 client_reg.dev_info = &dev_info;
221 client_reg.EventMask =
222 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
223 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
224 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
225 client_reg.event_handler = &atmel_event;
226 client_reg.Version = 0x0210; 220 client_reg.Version = 0x0210;
227 client_reg.event_callback_args.client_data = link; 221 client_reg.event_callback_args.client_data = link;
228 ret = pcmcia_register_client(&link->handle, &client_reg); 222 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -646,13 +640,36 @@ static int atmel_event(event_t event, int priority,
646} /* atmel_event */ 640} /* atmel_event */
647 641
648/*====================================================================*/ 642/*====================================================================*/
643static struct pcmcia_device_id atmel_ids[] = {
644 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620),
645 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696),
646 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302),
647 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007),
648 PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9),
649 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f),
650 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a),
651 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f),
652 PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5),
653 PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b),
654 PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6),
655 PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68),
656 PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774),
657 PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377),
658 PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e),
659 PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4),
660 PCMCIA_DEVICE_NULL
661};
662MODULE_DEVICE_TABLE(pcmcia, atmel_ids);
663
649static struct pcmcia_driver atmel_driver = { 664static struct pcmcia_driver atmel_driver = {
650 .owner = THIS_MODULE, 665 .owner = THIS_MODULE,
651 .drv = { 666 .drv = {
652 .name = "atmel_cs", 667 .name = "atmel_cs",
653 }, 668 },
654 .attach = atmel_attach, 669 .attach = atmel_attach,
655 .detach = atmel_detach, 670 .event = atmel_event,
671 .detach = atmel_detach,
672 .id_table = atmel_ids,
656}; 673};
657 674
658static int atmel_cs_init(void) 675static int atmel_cs_init(void)
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 382241e7edbb..5f507c49907b 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -62,7 +62,6 @@
62#endif /* WIRELESS_EXT > 12 */ 62#endif /* WIRELESS_EXT > 12 */
63#endif 63#endif
64 64
65#include <pcmcia/version.h>
66#include <pcmcia/cs_types.h> 65#include <pcmcia/cs_types.h>
67#include <pcmcia/cs.h> 66#include <pcmcia/cs.h>
68#include <pcmcia/cistpl.h> 67#include <pcmcia/cistpl.h>
@@ -491,11 +490,6 @@ static dev_link_t *netwave_attach(void)
491 link->next = dev_list; 490 link->next = dev_list;
492 dev_list = link; 491 dev_list = link;
493 client_reg.dev_info = &dev_info; 492 client_reg.dev_info = &dev_info;
494 client_reg.EventMask =
495 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
496 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
497 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
498 client_reg.event_handler = &netwave_event;
499 client_reg.Version = 0x0210; 493 client_reg.Version = 0x0210;
500 client_reg.event_callback_args.client_data = link; 494 client_reg.event_callback_args.client_data = link;
501 ret = pcmcia_register_client(&link->handle, &client_reg); 495 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -1668,13 +1662,21 @@ static int netwave_close(struct net_device *dev) {
1668 return 0; 1662 return 0;
1669} 1663}
1670 1664
1665static struct pcmcia_device_id netwave_ids[] = {
1666 PCMCIA_DEVICE_PROD_ID12("Xircom", "CreditCard Netwave", 0x2e3ee845, 0x54e28a28),
1667 PCMCIA_DEVICE_NULL,
1668};
1669MODULE_DEVICE_TABLE(pcmcia, netwave_ids);
1670
1671static struct pcmcia_driver netwave_driver = { 1671static struct pcmcia_driver netwave_driver = {
1672 .owner = THIS_MODULE, 1672 .owner = THIS_MODULE,
1673 .drv = { 1673 .drv = {
1674 .name = "netwave_cs", 1674 .name = "netwave_cs",
1675 }, 1675 },
1676 .attach = netwave_attach, 1676 .attach = netwave_attach,
1677 .event = netwave_event,
1677 .detach = netwave_detach, 1678 .detach = netwave_detach,
1679 .id_table = netwave_ids,
1678}; 1680};
1679 1681
1680static int __init init_netwave_cs(void) 1682static int __init init_netwave_cs(void)
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index b1078baa1d5e..aabcdc2be05e 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -46,382 +46,9 @@
46 * under either the MPL or the GPL. */ 46 * under either the MPL or the GPL. */
47 47
48/* 48/*
49 * v0.01 -> v0.02 - 21/3/2001 - Jean II
50 * o Allow to use regular ethX device name instead of dldwdX
51 * o Warning on IBSS with ESSID=any for firmware 6.06
52 * o Put proper range.throughput values (optimistic)
53 * o IWSPY support (IOCTL and stat gather in Rx path)
54 * o Allow setting frequency in Ad-Hoc mode
55 * o Disable WEP setting if !has_wep to work on old firmware
56 * o Fix txpower range
57 * o Start adding support for Samsung/Compaq firmware
58 *
59 * v0.02 -> v0.03 - 23/3/2001 - Jean II
60 * o Start adding Symbol support - need to check all that
61 * o Fix Prism2/Symbol WEP to accept 128 bits keys
62 * o Add Symbol WEP (add authentication type)
63 * o Add Prism2/Symbol rate
64 * o Add PM timeout (holdover duration)
65 * o Enable "iwconfig eth0 key off" and friends (toggle flags)
66 * o Enable "iwconfig eth0 power unicast/all" (toggle flags)
67 * o Try with an Intel card. It report firmware 1.01, behave like
68 * an antiquated firmware, however on windows it says 2.00. Yuck !
69 * o Workaround firmware bug in allocate buffer (Intel 1.01)
70 * o Finish external renaming to orinoco...
71 * o Testing with various Wavelan firmwares
72 *
73 * v0.03 -> v0.04 - 30/3/2001 - Jean II
74 * o Update to Wireless 11 -> add retry limit/lifetime support
75 * o Tested with a D-Link DWL 650 card, fill in firmware support
76 * o Warning on Vcc mismatch (D-Link 3.3v card in Lucent 5v only slot)
77 * o Fixed the Prism2 WEP bugs that I introduced in v0.03 :-(
78 * It works on D-Link *only* after a tcpdump. Weird...
79 * And still doesn't work on Intel card. Grrrr...
80 * o Update the mode after a setport3
81 * o Add preamble setting for Symbol cards (not yet enabled)
82 * o Don't complain as much about Symbol cards...
83 *
84 * v0.04 -> v0.04b - 22/4/2001 - David Gibson
85 * o Removed the 'eth' parameter - always use ethXX as the
86 * interface name instead of dldwdXX. The other was racy
87 * anyway.
88 * o Clean up RID definitions in hermes.h, other cleanups
89 *
90 * v0.04b -> v0.04c - 24/4/2001 - Jean II
91 * o Tim Hurley <timster AT seiki.bliztech.com> reported a D-Link card
92 * with vendor 02 and firmware 0.08. Added in the capabilities...
93 * o Tested Lucent firmware 7.28, everything works...
94 *
95 * v0.04c -> v0.05 - 3/5/2001 - Benjamin Herrenschmidt
96 * o Spin-off Pcmcia code. This file is renamed orinoco.c,
97 * and orinoco_cs.c now contains only the Pcmcia specific stuff
98 * o Add Airport driver support on top of orinoco.c (see airport.c)
99 *
100 * v0.05 -> v0.05a - 4/5/2001 - Jean II
101 * o Revert to old Pcmcia code to fix breakage of Ben's changes...
102 *
103 * v0.05a -> v0.05b - 4/5/2001 - Jean II
104 * o add module parameter 'ignore_cis_vcc' for D-Link @ 5V
105 * o D-Link firmware doesn't support multicast. We just print a few
106 * error messages, but otherwise everything works...
107 * o For David : set/getport3 works fine, just upgrade iwpriv...
108 *
109 * v0.05b -> v0.05c - 5/5/2001 - Benjamin Herrenschmidt
110 * o Adapt airport.c to latest changes in orinoco.c
111 * o Remove deferred power enabling code
112 *
113 * v0.05c -> v0.05d - 5/5/2001 - Jean II
114 * o Workaround to SNAP decapsulate frame from Linksys AP
115 * original patch from : Dong Liu <dliu AT research.bell-labs.com>
116 * (note : the memcmp bug was mine - fixed)
117 * o Remove set_retry stuff, no firmware support it (bloat--).
118 *
119 * v0.05d -> v0.06 - 25/5/2001 - Jean II
120 * Original patch from "Hong Lin" <alin AT redhat.com>,
121 * "Ian Kinner" <ikinner AT redhat.com>
122 * and "David Smith" <dsmith AT redhat.com>
123 * o Init of priv->tx_rate_ctrl in firmware specific section.
124 * o Prism2/Symbol rate, upto should be 0xF and not 0x15. Doh !
125 * o Spectrum card always need cor_reset (for every reset)
126 * o Fix cor_reset to not lose bit 7 in the register
127 * o flush_stale_links to remove zombie Pcmcia instances
128 * o Ack previous hermes event before reset
129 * Me (with my little hands)
130 * o Allow orinoco.c to call cor_reset via priv->card_reset_handler
131 * o Add priv->need_card_reset to toggle this feature
132 * o Fix various buglets when setting WEP in Symbol firmware
133 * Now, encryption is fully functional on Symbol cards. Youpi !
134 *
135 * v0.06 -> v0.06b - 25/5/2001 - Jean II
136 * o IBSS on Symbol use port_mode = 4. Please don't ask...
137 *
138 * v0.06b -> v0.06c - 29/5/2001 - Jean II
139 * o Show first spy address in /proc/net/wireless for IBSS mode as well
140 *
141 * v0.06c -> v0.06d - 6/7/2001 - David Gibson
142 * o Change a bunch of KERN_INFO messages to KERN_DEBUG, as per Linus'
143 * wishes to reduce the number of unnecessary messages.
144 * o Removed bogus message on CRC error.
145 * o Merged fixes for v0.08 Prism 2 firmware from William Waghorn
146 * <willwaghorn AT yahoo.co.uk>
147 * o Slight cleanup/re-arrangement of firmware detection code.
148 *
149 * v0.06d -> v0.06e - 1/8/2001 - David Gibson
150 * o Removed some redundant global initializers (orinoco_cs.c).
151 * o Added some module metadata
152 *
153 * v0.06e -> v0.06f - 14/8/2001 - David Gibson
154 * o Wording fix to license
155 * o Added a 'use_alternate_encaps' module parameter for APs which need an
156 * oui of 00:00:00. We really need a better way of handling this, but
157 * the module flag is better than nothing for now.
158 *
159 * v0.06f -> v0.07 - 20/8/2001 - David Gibson
160 * o Removed BAP error retries from hermes_bap_seek(). For Tx we now
161 * let the upper layers handle the retry, we retry explicitly in the
162 * Rx path, but don't make as much noise about it.
163 * o Firmware detection cleanups.
164 *
165 * v0.07 -> v0.07a - 1/10/3001 - Jean II
166 * o Add code to read Symbol firmware revision, inspired by latest code
167 * in Spectrum24 by Lee John Keyser-Allen - Thanks Lee !
168 * o Thanks to Jared Valentine <hidden AT xmission.com> for "providing" me
169 * a 3Com card with a recent firmware, fill out Symbol firmware
170 * capabilities of latest rev (2.20), as well as older Symbol cards.
171 * o Disable Power Management in newer Symbol firmware, the API
172 * has changed (documentation needed).
173 *
174 * v0.07a -> v0.08 - 3/10/2001 - David Gibson
175 * o Fixed a possible buffer overrun found by the Stanford checker (in
176 * dldwd_ioctl_setiwencode()). Can only be called by root anyway, so not
177 * a big problem.
178 * o Turned has_big_wep on for Intersil cards. That's not true for all of
179 * them but we should at least let the capable ones try.
180 * o Wait for BUSY to clear at the beginning of hermes_bap_seek(). I
181 * realized that my assumption that the driver's serialization
182 * would prevent the BAP being busy on entry was possibly false, because
183 * things other than seeks may make the BAP busy.
184 * o Use "alternate" (oui 00:00:00) encapsulation by default.
185 * Setting use_old_encaps will mimic the old behaviour, but I think we
186 * will be able to eliminate this.
187 * o Don't try to make __initdata const (the version string). This can't
188 * work because of the way the __initdata sectioning works.
189 * o Added MODULE_LICENSE tags.
190 * o Support for PLX (transparent PCMCIA->PCI bridge) cards.
191 * o Changed to using the new type-fascist min/max.
192 *
193 * v0.08 -> v0.08a - 9/10/2001 - David Gibson
194 * o Inserted some missing acknowledgements/info into the Changelog.
195 * o Fixed some bugs in the normalization of signal level reporting.
196 * o Fixed bad bug in WEP key handling on Intersil and Symbol firmware,
197 * which led to an instant crash on big-endian machines.
198 *
199 * v0.08a -> v0.08b - 20/11/2001 - David Gibson
200 * o Lots of cleanup and bugfixes in orinoco_plx.c
201 * o Cleanup to handling of Tx rate setting.
202 * o Removed support for old encapsulation method.
203 * o Removed old "dldwd" names.
204 * o Split RID constants into a new file hermes_rid.h
205 * o Renamed RID constants to match linux-wlan-ng and prism2.o
206 * o Bugfixes in hermes.c
207 * o Poke the PLX's INTCSR register, so it actually starts
208 * generating interrupts. These cards might actually work now.
209 * o Update to wireless extensions v12 (Jean II)
210 * o Support for tallies and inquire command (Jean II)
211 * o Airport updates for newer PPC kernels (BenH)
212 *
213 * v0.08b -> v0.09 - 21/12/2001 - David Gibson
214 * o Some new PCI IDs for PLX cards.
215 * o Removed broken attempt to do ALLMULTI reception. Just use
216 * promiscuous mode instead
217 * o Preliminary work for list-AP (Jean II)
218 * o Airport updates from (BenH)
219 * o Eliminated racy hw_ready stuff
220 * o Fixed generation of fake events in irq handler. This should
221 * finally kill the EIO problems (Jean II & dgibson)
222 * o Fixed breakage of bitrate set/get on Agere firmware (Jean II)
223 *
224 * v0.09 -> v0.09a - 2/1/2002 - David Gibson
225 * o Fixed stupid mistake in multicast list handling, triggering
226 * a BUG()
227 *
228 * v0.09a -> v0.09b - 16/1/2002 - David Gibson
229 * o Fixed even stupider mistake in new interrupt handling, which
230 * seriously broke things on big-endian machines.
231 * o Removed a bunch of redundant includes and exports.
232 * o Removed a redundant MOD_{INC,DEC}_USE_COUNT pair in airport.c
233 * o Don't attempt to do hardware level multicast reception on
234 * Intersil firmware, just go promisc instead.
235 * o Typo fixed in hermes_issue_cmd()
236 * o Eliminated WIRELESS_SPY #ifdefs
237 * o Status code reported on Tx exceptions
238 * o Moved netif_wake_queue() from ALLOC interrupts to TX and TXEXC
239 * interrupts, which should fix the timeouts we're seeing.
240 *
241 * v0.09b -> v0.10 - 25 Feb 2002 - David Gibson
242 * o Removed nested structures used for header parsing, so the
243 * driver should now work without hackery on ARM
244 * o Fix for WEP handling on Intersil (Hawk Newton)
245 * o Eliminated the /proc/hermes/ethXX/regs debugging file. It
246 * was never very useful.
247 * o Make Rx errors less noisy.
248 *
249 * v0.10 -> v0.11 - 5 Apr 2002 - David Gibson
250 * o Laid the groundwork in hermes.[ch] for devices which map
251 * into PCI memory space rather than IO space.
252 * o Fixed bug in multicast handling (cleared multicast list when
253 * leaving promiscuous mode).
254 * o Relegated Tx error messages to debug.
255 * o Cleaned up / corrected handling of allocation lengths.
256 * o Set OWNSSID in IBSS mode for WinXP interoperability (jimc).
257 * o Change to using alloc_etherdev() for structure allocations.
258 * o Check for and drop undersized packets.
259 * o Fixed a race in stopping/waking the queue. This should fix
260 * the timeout problems (Pavel Roskin)
261 * o Reverted to netif_wake_queue() on the ALLOC event.
262 * o Fixes for recent Symbol firmwares which lack AP density
263 * (Pavel Roskin).
264 *
265 * v0.11 -> v0.11a - 29 Apr 2002 - David Gibson
266 * o Handle different register spacing, necessary for Prism 2.5
267 * PCI adaptors (Steve Hill).
268 * o Cleaned up initialization of card structures in orinoco_cs
269 * and airport. Removed card->priv field.
270 * o Make response structure optional for hermes_docmd_wait()
271 * Pavel Roskin)
272 * o Added PCI id for Nortel emobility to orinoco_plx.c.
273 * o Cleanup to handling of Symbol's allocation bug. (Pavel Roskin)
274 * o Cleanups to firmware capability detection.
275 * o Arrange for orinoco_pci.c to override firmware detection.
276 * We should be able to support the PCI Intersil cards now.
277 * o Cleanup handling of reset_cor and hard_reset (Pavel Roskin).
278 * o Remove erroneous use of USER_BAP in the TxExc handler (Jouni
279 * Malinen).
280 * o Makefile changes for better integration into David Hinds
281 * pcmcia-cs package.
282 *
283 * v0.11a -> v0.11b - 1 May 2002 - David Gibson
284 * o Better error reporting in orinoco_plx_init_one()
285 * o Fixed multiple bad kfree() bugs introduced by the
286 * alloc_orinocodev() changes.
287 *
288 * v0.11b -> v0.12 - 19 Jun 2002 - David Gibson
289 * o Support changing the MAC address.
290 * o Correct display of Intersil firmware revision numbers.
291 * o Entirely revised locking scheme. Should be both simpler and
292 * better.
293 * o Merged some common code in orinoco_plx, orinoco_pci and
294 * airport by creating orinoco_default_{open,stop,reset}()
295 * which are used as the dev->open, dev->stop, priv->reset
296 * callbacks if none are specified when alloc_orinocodev() is
297 * called.
298 * o Removed orinoco_plx_interrupt() and orinoco_pci_interrupt().
299 * They didn't do anything.
300 *
301 * v0.12 -> v0.12a - 4 Jul 2002 - David Gibson
302 * o Some rearrangement of code.
303 * o Numerous fixups to locking and rest handling, particularly
304 * for PCMCIA.
305 * o This allows open and stop net_device methods to be in
306 * orinoco.c now, rather than in the init modules.
307 * o In orinoco_cs.c link->priv now points to the struct
308 * net_device not to the struct orinoco_private.
309 * o Added a check for undersized SNAP frames, which could cause
310 * crashes.
311 *
312 * v0.12a -> v0.12b - 11 Jul 2002 - David Gibson
313 * o Fix hw->num_init testing code, so num_init is actually
314 * incremented.
315 * o Fix very stupid bug in orinoco_cs which broke compile with
316 * CONFIG_SMP.
317 * o Squashed a warning.
318 *
319 * v0.12b -> v0.12c - 26 Jul 2002 - David Gibson
320 * o Change to C9X style designated initializers.
321 * o Add support for 3Com AirConnect PCI.
322 * o No longer ignore the hard_reset argument to
323 * alloc_orinocodev(). Oops.
324 *
325 * v0.12c -> v0.13beta1 - 13 Sep 2002 - David Gibson
326 * o Revert the broken 0.12* locking scheme and go to a new yet
327 * simpler scheme.
328 * o Do firmware resets only in orinoco_init() and when waking
329 * the card from hard sleep.
330 *
331 * v0.13beta1 -> v0.13 - 27 Sep 2002 - David Gibson
332 * o Re-introduced full resets (via schedule_task()) on Tx
333 * timeout.
334 *
335 * v0.13 -> v0.13a - 30 Sep 2002 - David Gibson
336 * o Minor cleanups to info frame handling. Add basic support
337 * for linkstatus info frames.
338 * o Include required kernel headers in orinoco.h, to avoid
339 * compile problems.
340 *
341 * v0.13a -> v0.13b - 10 Feb 2003 - David Gibson
342 * o Implemented hard reset for Airport cards
343 * o Experimental suspend/resume implementation for orinoco_pci
344 * o Abolished /proc debugging support, replaced with a debugging
345 * iwpriv. Now it's ugly and simple instead of ugly and complex.
346 * o Bugfix in hermes.c if the firmware returned a record length
347 * of 0, we could go clobbering memory.
348 * o Bugfix in orinoco_stop() - it used to fail if hw_unavailable
349 * was set, which was usually true on PCMCIA hot removes.
350 * o Track LINKSTATUS messages, silently drop Tx packets before
351 * we are connected (avoids confusing the firmware), and only
352 * give LINKSTATUS printk()s if the status has changed.
353 *
354 * v0.13b -> v0.13c - 11 Mar 2003 - David Gibson
355 * o Cleanup: use dev instead of priv in various places.
356 * o Bug fix: Don't ReleaseConfiguration on RESET_PHYSICAL event
357 * if we're in the middle of a (driver initiated) hard reset.
358 * o Bug fix: ETH_ZLEN is supposed to include the header
359 * (Dionysus Blazakis & Manish Karir)
360 * o Convert to using workqueues instead of taskqueues (and
361 * backwards compatibility macros for pre 2.5.41 kernels).
362 * o Drop redundant (I think...) MOD_{INC,DEC}_USE_COUNT in
363 * airport.c
364 * o New orinoco_tmd.c init module from Joerg Dorchain for
365 * TMD7160 based PCI to PCMCIA bridges (similar to
366 * orinoco_plx.c).
367 *
368 * v0.13c -> v0.13d - 22 Apr 2003 - David Gibson
369 * o Make hw_unavailable a counter, rather than just a flag, this
370 * is necessary to avoid some races (such as a card being
371 * removed in the middle of orinoco_reset().
372 * o Restore Release/RequestConfiguration in the PCMCIA event handler
373 * when dealing with a driver initiated hard reset. This is
374 * necessary to prevent hangs due to a spurious interrupt while
375 * the reset is in progress.
376 * o Clear the 802.11 header when transmitting, even though we
377 * don't use it. This fixes a long standing bug on some
378 * firmwares, which seem to get confused if that isn't done.
379 * o Be less eager to de-encapsulate SNAP frames, only do so if
380 * the OUI is 00:00:00 or 00:00:f8, leave others alone. The old
381 * behaviour broke CDP (Cisco Discovery Protocol).
382 * o Use dev instead of priv for free_irq() as well as
383 * request_irq() (oops).
384 * o Attempt to reset rather than giving up if we get too many
385 * IRQs.
386 * o Changed semantics of __orinoco_down() so it can be called
387 * safely with hw_unavailable set. It also now clears the
388 * linkstatus (since we're going to have to reassociate).
389 *
390 * v0.13d -> v0.13e - 12 May 2003 - David Gibson
391 * o Support for post-2.5.68 return values from irq handler.
392 * o Fixed bug where underlength packets would be double counted
393 * in the rx_dropped statistics.
394 * o Provided a module parameter to suppress linkstatus messages.
395 *
396 * v0.13e -> v0.14alpha1 - 30 Sep 2003 - David Gibson
397 * o Replaced priv->connected logic with netif_carrier_on/off()
398 * calls.
399 * o Remove has_ibss_any and never set the CREATEIBSS RID when
400 * the ESSID is empty. Too many firmwares break if we do.
401 * o 2.6 merges: Replace pdev->slot_name with pci_name(), remove
402 * __devinitdata from PCI ID tables, use free_netdev().
403 * o Enabled shared-key authentication for Agere firmware (from
404 * Robert J. Moore <Robert.J.Moore AT allanbank.com>
405 * o Move netif_wake_queue() (back) to the Tx completion from the
406 * ALLOC event. This seems to prevent/mitigate the rolling
407 * error -110 problems at least on some Intersil firmwares.
408 * Theoretically reduces performance, but I can't measure it.
409 * Patch from Andrew Tridgell <tridge AT samba.org>
410 *
411 * v0.14alpha1 -> v0.14alpha2 - 20 Oct 2003 - David Gibson
412 * o Correctly turn off shared-key authentication when requested
413 * (bugfix from Robert J. Moore).
414 * o Correct airport sleep interfaces for current 2.6 kernels.
415 * o Add code for key change without disabling/enabling the MAC
416 * port. This is supposed to allow 802.1x to work sanely, but
417 * doesn't seem to yet.
418 *
419 * TODO 49 * TODO
420 * o New wireless extensions API (patch from Moustafa
421 * Youssef, updated by Jim Carter and Pavel Roskin).
422 * o Handle de-encapsulation within network layer, provide 802.11 50 * o Handle de-encapsulation within network layer, provide 802.11
423 * headers (patch from Thomas 'Dent' Mirlacher) 51 * headers (patch from Thomas 'Dent' Mirlacher)
424 * o RF monitor mode support
425 * o Fix possible races in SPY handling. 52 * o Fix possible races in SPY handling.
426 * o Disconnect wireless extensions from fundamental configuration. 53 * o Disconnect wireless extensions from fundamental configuration.
427 * o (maybe) Software WEP support (patch from Stano Meduna). 54 * o (maybe) Software WEP support (patch from Stano Meduna).
@@ -462,7 +89,10 @@
462#include <linux/netdevice.h> 89#include <linux/netdevice.h>
463#include <linux/if_arp.h> 90#include <linux/if_arp.h>
464#include <linux/etherdevice.h> 91#include <linux/etherdevice.h>
92#include <linux/ethtool.h>
465#include <linux/wireless.h> 93#include <linux/wireless.h>
94#include <net/iw_handler.h>
95#include <net/ieee80211.h>
466 96
467#include <asm/uaccess.h> 97#include <asm/uaccess.h>
468#include <asm/io.h> 98#include <asm/io.h>
@@ -496,6 +126,10 @@ static int ignore_disconnect; /* = 0 */
496module_param(ignore_disconnect, int, 0644); 126module_param(ignore_disconnect, int, 0644);
497MODULE_PARM_DESC(ignore_disconnect, "Don't report lost link to the network layer"); 127MODULE_PARM_DESC(ignore_disconnect, "Don't report lost link to the network layer");
498 128
129static int force_monitor; /* = 0 */
130module_param(force_monitor, int, 0644);
131MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions");
132
499/********************************************************************/ 133/********************************************************************/
500/* Compile time configuration and compatibility stuff */ 134/* Compile time configuration and compatibility stuff */
501/********************************************************************/ 135/********************************************************************/
@@ -511,6 +145,10 @@ MODULE_PARM_DESC(ignore_disconnect, "Don't report lost link to the network layer
511/* Internal constants */ 145/* Internal constants */
512/********************************************************************/ 146/********************************************************************/
513 147
148/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */
149static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
150#define ENCAPS_OVERHEAD (sizeof(encaps_hdr) + 2)
151
514#define ORINOCO_MIN_MTU 256 152#define ORINOCO_MIN_MTU 256
515#define ORINOCO_MAX_MTU (IEEE802_11_DATA_LEN - ENCAPS_OVERHEAD) 153#define ORINOCO_MAX_MTU (IEEE802_11_DATA_LEN - ENCAPS_OVERHEAD)
516 154
@@ -537,6 +175,11 @@ MODULE_PARM_DESC(ignore_disconnect, "Don't report lost link to the network layer
537 | HERMES_EV_WTERR | HERMES_EV_INFO \ 175 | HERMES_EV_WTERR | HERMES_EV_INFO \
538 | HERMES_EV_INFDROP ) 176 | HERMES_EV_INFDROP )
539 177
178#define MAX_RID_LEN 1024
179
180static const struct iw_handler_def orinoco_handler_def;
181static struct ethtool_ops orinoco_ethtool_ops;
182
540/********************************************************************/ 183/********************************************************************/
541/* Data tables */ 184/* Data tables */
542/********************************************************************/ 185/********************************************************************/
@@ -571,26 +214,45 @@ static struct {
571/* Data types */ 214/* Data types */
572/********************************************************************/ 215/********************************************************************/
573 216
574struct header_struct { 217/* Used in Event handling.
575 /* 802.3 */ 218 * We avoid nested structres as they break on ARM -- Moustafa */
576 u8 dest[ETH_ALEN]; 219struct hermes_tx_descriptor_802_11 {
577 u8 src[ETH_ALEN]; 220 /* hermes_tx_descriptor */
578 u16 len; 221 u16 status;
579 /* 802.2 */ 222 u16 reserved1;
223 u16 reserved2;
224 u32 sw_support;
225 u8 retry_count;
226 u8 tx_rate;
227 u16 tx_control;
228
229 /* ieee802_11_hdr */
230 u16 frame_ctl;
231 u16 duration_id;
232 u8 addr1[ETH_ALEN];
233 u8 addr2[ETH_ALEN];
234 u8 addr3[ETH_ALEN];
235 u16 seq_ctl;
236 u8 addr4[ETH_ALEN];
237 u16 data_len;
238
239 /* ethhdr */
240 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
241 unsigned char h_source[ETH_ALEN]; /* source ether addr */
242 unsigned short h_proto; /* packet type ID field */
243
244 /* p8022_hdr */
580 u8 dsap; 245 u8 dsap;
581 u8 ssap; 246 u8 ssap;
582 u8 ctrl; 247 u8 ctrl;
583 /* SNAP */
584 u8 oui[3]; 248 u8 oui[3];
249
585 u16 ethertype; 250 u16 ethertype;
586} __attribute__ ((packed)); 251} __attribute__ ((packed));
587 252
588/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */ 253/* Rx frame header except compatibility 802.3 header */
589u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
590
591#define ENCAPS_OVERHEAD (sizeof(encaps_hdr) + 2)
592
593struct hermes_rx_descriptor { 254struct hermes_rx_descriptor {
255 /* Control */
594 u16 status; 256 u16 status;
595 u32 time; 257 u32 time;
596 u8 silence; 258 u8 silence;
@@ -598,13 +260,24 @@ struct hermes_rx_descriptor {
598 u8 rate; 260 u8 rate;
599 u8 rxflow; 261 u8 rxflow;
600 u32 reserved; 262 u32 reserved;
263
264 /* 802.11 header */
265 u16 frame_ctl;
266 u16 duration_id;
267 u8 addr1[ETH_ALEN];
268 u8 addr2[ETH_ALEN];
269 u8 addr3[ETH_ALEN];
270 u16 seq_ctl;
271 u8 addr4[ETH_ALEN];
272
273 /* Data length */
274 u16 data_len;
601} __attribute__ ((packed)); 275} __attribute__ ((packed));
602 276
603/********************************************************************/ 277/********************************************************************/
604/* Function prototypes */ 278/* Function prototypes */
605/********************************************************************/ 279/********************************************************************/
606 280
607static int orinoco_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
608static int __orinoco_program_rids(struct net_device *dev); 281static int __orinoco_program_rids(struct net_device *dev);
609static void __orinoco_set_multicast_list(struct net_device *dev); 282static void __orinoco_set_multicast_list(struct net_device *dev);
610 283
@@ -628,6 +301,10 @@ static inline void set_port_type(struct orinoco_private *priv)
628 priv->createibss = 1; 301 priv->createibss = 1;
629 } 302 }
630 break; 303 break;
304 case IW_MODE_MONITOR:
305 priv->port_type = 3;
306 priv->createibss = 0;
307 break;
631 default: 308 default:
632 printk(KERN_ERR "%s: Invalid priv->iw_mode in set_port_type()\n", 309 printk(KERN_ERR "%s: Invalid priv->iw_mode in set_port_type()\n",
633 priv->ndev->name); 310 priv->ndev->name);
@@ -814,7 +491,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
814 return 1; 491 return 1;
815 } 492 }
816 493
817 if (! netif_carrier_ok(dev)) { 494 if (! netif_carrier_ok(dev) || (priv->iw_mode == IW_MODE_MONITOR)) {
818 /* Oops, the firmware hasn't established a connection, 495 /* Oops, the firmware hasn't established a connection,
819 silently drop the packet (this seems to be the 496 silently drop the packet (this seems to be the
820 safest approach). */ 497 safest approach). */
@@ -951,26 +628,55 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
951 struct orinoco_private *priv = netdev_priv(dev); 628 struct orinoco_private *priv = netdev_priv(dev);
952 struct net_device_stats *stats = &priv->stats; 629 struct net_device_stats *stats = &priv->stats;
953 u16 fid = hermes_read_regn(hw, TXCOMPLFID); 630 u16 fid = hermes_read_regn(hw, TXCOMPLFID);
954 struct hermes_tx_descriptor desc; 631 struct hermes_tx_descriptor_802_11 hdr;
955 int err = 0; 632 int err = 0;
956 633
957 if (fid == DUMMY_FID) 634 if (fid == DUMMY_FID)
958 return; /* Nothing's really happened */ 635 return; /* Nothing's really happened */
959 636
960 err = hermes_bap_pread(hw, IRQ_BAP, &desc, sizeof(desc), fid, 0); 637 /* Read the frame header */
638 err = hermes_bap_pread(hw, IRQ_BAP, &hdr,
639 sizeof(struct hermes_tx_descriptor) +
640 sizeof(struct ieee80211_hdr),
641 fid, 0);
642
643 hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
644 stats->tx_errors++;
645
961 if (err) { 646 if (err) {
962 printk(KERN_WARNING "%s: Unable to read descriptor on Tx error " 647 printk(KERN_WARNING "%s: Unable to read descriptor on Tx error "
963 "(FID=%04X error %d)\n", 648 "(FID=%04X error %d)\n",
964 dev->name, fid, err); 649 dev->name, fid, err);
965 } else { 650 return;
966 DEBUG(1, "%s: Tx error, status %d\n",
967 dev->name, le16_to_cpu(desc.status));
968 } 651 }
969 652
970 stats->tx_errors++; 653 DEBUG(1, "%s: Tx error, err %d (FID=%04X)\n", dev->name,
654 err, fid);
655
656 /* We produce a TXDROP event only for retry or lifetime
657 * exceeded, because that's the only status that really mean
658 * that this particular node went away.
659 * Other errors means that *we* screwed up. - Jean II */
660 hdr.status = le16_to_cpu(hdr.status);
661 if (hdr.status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) {
662 union iwreq_data wrqu;
663
664 /* Copy 802.11 dest address.
665 * We use the 802.11 header because the frame may
666 * not be 802.3 or may be mangled...
667 * In Ad-Hoc mode, it will be the node address.
668 * In managed mode, it will be most likely the AP addr
669 * User space will figure out how to convert it to
670 * whatever it needs (IP address or else).
671 * - Jean II */
672 memcpy(wrqu.addr.sa_data, hdr.addr1, ETH_ALEN);
673 wrqu.addr.sa_family = ARPHRD_ETHER;
674
675 /* Send event to user space */
676 wireless_send_event(dev, IWEVTXDROP, &wrqu, NULL);
677 }
971 678
972 netif_wake_queue(dev); 679 netif_wake_queue(dev);
973 hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
974} 680}
975 681
976static void orinoco_tx_timeout(struct net_device *dev) 682static void orinoco_tx_timeout(struct net_device *dev)
@@ -1047,18 +753,127 @@ static void orinoco_stat_gather(struct net_device *dev,
1047 } 753 }
1048} 754}
1049 755
756/*
757 * orinoco_rx_monitor - handle received monitor frames.
758 *
759 * Arguments:
760 * dev network device
761 * rxfid received FID
762 * desc rx descriptor of the frame
763 *
764 * Call context: interrupt
765 */
766static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
767 struct hermes_rx_descriptor *desc)
768{
769 u32 hdrlen = 30; /* return full header by default */
770 u32 datalen = 0;
771 u16 fc;
772 int err;
773 int len;
774 struct sk_buff *skb;
775 struct orinoco_private *priv = netdev_priv(dev);
776 struct net_device_stats *stats = &priv->stats;
777 hermes_t *hw = &priv->hw;
778
779 len = le16_to_cpu(desc->data_len);
780
781 /* Determine the size of the header and the data */
782 fc = le16_to_cpu(desc->frame_ctl);
783 switch (fc & IEEE80211_FCTL_FTYPE) {
784 case IEEE80211_FTYPE_DATA:
785 if ((fc & IEEE80211_FCTL_TODS)
786 && (fc & IEEE80211_FCTL_FROMDS))
787 hdrlen = 30;
788 else
789 hdrlen = 24;
790 datalen = len;
791 break;
792 case IEEE80211_FTYPE_MGMT:
793 hdrlen = 24;
794 datalen = len;
795 break;
796 case IEEE80211_FTYPE_CTL:
797 switch (fc & IEEE80211_FCTL_STYPE) {
798 case IEEE80211_STYPE_PSPOLL:
799 case IEEE80211_STYPE_RTS:
800 case IEEE80211_STYPE_CFEND:
801 case IEEE80211_STYPE_CFENDACK:
802 hdrlen = 16;
803 break;
804 case IEEE80211_STYPE_CTS:
805 case IEEE80211_STYPE_ACK:
806 hdrlen = 10;
807 break;
808 }
809 break;
810 default:
811 /* Unknown frame type */
812 break;
813 }
814
815 /* sanity check the length */
816 if (datalen > IEEE80211_DATA_LEN + 12) {
817 printk(KERN_DEBUG "%s: oversized monitor frame, "
818 "data length = %d\n", dev->name, datalen);
819 err = -EIO;
820 stats->rx_length_errors++;
821 goto update_stats;
822 }
823
824 skb = dev_alloc_skb(hdrlen + datalen);
825 if (!skb) {
826 printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n",
827 dev->name);
828 err = -ENOMEM;
829 goto drop;
830 }
831
832 /* Copy the 802.11 header to the skb */
833 memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen);
834 skb->mac.raw = skb->data;
835
836 /* If any, copy the data from the card to the skb */
837 if (datalen > 0) {
838 err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen),
839 ALIGN(datalen, 2), rxfid,
840 HERMES_802_2_OFFSET);
841 if (err) {
842 printk(KERN_ERR "%s: error %d reading monitor frame\n",
843 dev->name, err);
844 goto drop;
845 }
846 }
847
848 skb->dev = dev;
849 skb->ip_summed = CHECKSUM_NONE;
850 skb->pkt_type = PACKET_OTHERHOST;
851 skb->protocol = __constant_htons(ETH_P_802_2);
852
853 dev->last_rx = jiffies;
854 stats->rx_packets++;
855 stats->rx_bytes += skb->len;
856
857 netif_rx(skb);
858 return;
859
860 drop:
861 dev_kfree_skb_irq(skb);
862 update_stats:
863 stats->rx_errors++;
864 stats->rx_dropped++;
865}
866
1050static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) 867static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
1051{ 868{
1052 struct orinoco_private *priv = netdev_priv(dev); 869 struct orinoco_private *priv = netdev_priv(dev);
1053 struct net_device_stats *stats = &priv->stats; 870 struct net_device_stats *stats = &priv->stats;
1054 struct iw_statistics *wstats = &priv->wstats; 871 struct iw_statistics *wstats = &priv->wstats;
1055 struct sk_buff *skb = NULL; 872 struct sk_buff *skb = NULL;
1056 u16 rxfid, status; 873 u16 rxfid, status, fc;
1057 int length, data_len, data_off; 874 int length;
1058 char *p;
1059 struct hermes_rx_descriptor desc; 875 struct hermes_rx_descriptor desc;
1060 struct header_struct hdr; 876 struct ethhdr *hdr;
1061 struct ethhdr *eh;
1062 int err; 877 int err;
1063 878
1064 rxfid = hermes_read_regn(hw, RXFID); 879 rxfid = hermes_read_regn(hw, RXFID);
@@ -1068,53 +883,46 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
1068 if (err) { 883 if (err) {
1069 printk(KERN_ERR "%s: error %d reading Rx descriptor. " 884 printk(KERN_ERR "%s: error %d reading Rx descriptor. "
1070 "Frame dropped.\n", dev->name, err); 885 "Frame dropped.\n", dev->name, err);
1071 stats->rx_errors++; 886 goto update_stats;
1072 goto drop;
1073 } 887 }
1074 888
1075 status = le16_to_cpu(desc.status); 889 status = le16_to_cpu(desc.status);
1076 890
1077 if (status & HERMES_RXSTAT_ERR) { 891 if (status & HERMES_RXSTAT_BADCRC) {
1078 if (status & HERMES_RXSTAT_UNDECRYPTABLE) { 892 DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n",
1079 wstats->discard.code++; 893 dev->name);
1080 DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n", 894 stats->rx_crc_errors++;
1081 dev->name); 895 goto update_stats;
1082 } else {
1083 stats->rx_crc_errors++;
1084 DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n", dev->name);
1085 }
1086 stats->rx_errors++;
1087 goto drop;
1088 } 896 }
1089 897
1090 /* For now we ignore the 802.11 header completely, assuming 898 /* Handle frames in monitor mode */
1091 that the card's firmware has handled anything vital */ 899 if (priv->iw_mode == IW_MODE_MONITOR) {
900 orinoco_rx_monitor(dev, rxfid, &desc);
901 return;
902 }
1092 903
1093 err = hermes_bap_pread(hw, IRQ_BAP, &hdr, sizeof(hdr), 904 if (status & HERMES_RXSTAT_UNDECRYPTABLE) {
1094 rxfid, HERMES_802_3_OFFSET); 905 DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n",
1095 if (err) { 906 dev->name);
1096 printk(KERN_ERR "%s: error %d reading frame header. " 907 wstats->discard.code++;
1097 "Frame dropped.\n", dev->name, err); 908 goto update_stats;
1098 stats->rx_errors++;
1099 goto drop;
1100 } 909 }
1101 910
1102 length = ntohs(hdr.len); 911 length = le16_to_cpu(desc.data_len);
1103 912 fc = le16_to_cpu(desc.frame_ctl);
913
1104 /* Sanity checks */ 914 /* Sanity checks */
1105 if (length < 3) { /* No for even an 802.2 LLC header */ 915 if (length < 3) { /* No for even an 802.2 LLC header */
1106 /* At least on Symbol firmware with PCF we get quite a 916 /* At least on Symbol firmware with PCF we get quite a
1107 lot of these legitimately - Poll frames with no 917 lot of these legitimately - Poll frames with no
1108 data. */ 918 data. */
1109 stats->rx_dropped++; 919 return;
1110 goto drop;
1111 } 920 }
1112 if (length > IEEE802_11_DATA_LEN) { 921 if (length > IEEE802_11_DATA_LEN) {
1113 printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n", 922 printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n",
1114 dev->name, length); 923 dev->name, length);
1115 stats->rx_length_errors++; 924 stats->rx_length_errors++;
1116 stats->rx_errors++; 925 goto update_stats;
1117 goto drop;
1118 } 926 }
1119 927
1120 /* We need space for the packet data itself, plus an ethernet 928 /* We need space for the packet data itself, plus an ethernet
@@ -1126,60 +934,53 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
1126 if (!skb) { 934 if (!skb) {
1127 printk(KERN_WARNING "%s: Can't allocate skb for Rx\n", 935 printk(KERN_WARNING "%s: Can't allocate skb for Rx\n",
1128 dev->name); 936 dev->name);
1129 goto drop; 937 goto update_stats;
1130 } 938 }
1131 939
1132 skb_reserve(skb, 2); /* This way the IP header is aligned */ 940 /* We'll prepend the header, so reserve space for it. The worst
941 case is no decapsulation, when 802.3 header is prepended and
942 nothing is removed. 2 is for aligning the IP header. */
943 skb_reserve(skb, ETH_HLEN + 2);
944
945 err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length),
946 ALIGN(length, 2), rxfid,
947 HERMES_802_2_OFFSET);
948 if (err) {
949 printk(KERN_ERR "%s: error %d reading frame. "
950 "Frame dropped.\n", dev->name, err);
951 goto drop;
952 }
1133 953
1134 /* Handle decapsulation 954 /* Handle decapsulation
1135 * In most cases, the firmware tell us about SNAP frames. 955 * In most cases, the firmware tell us about SNAP frames.
1136 * For some reason, the SNAP frames sent by LinkSys APs 956 * For some reason, the SNAP frames sent by LinkSys APs
1137 * are not properly recognised by most firmwares. 957 * are not properly recognised by most firmwares.
1138 * So, check ourselves */ 958 * So, check ourselves */
1139 if (((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_1042) || 959 if (length >= ENCAPS_OVERHEAD &&
1140 ((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_TUNNEL) || 960 (((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_1042) ||
1141 is_ethersnap(&hdr)) { 961 ((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_TUNNEL) ||
962 is_ethersnap(skb->data))) {
1142 /* These indicate a SNAP within 802.2 LLC within 963 /* These indicate a SNAP within 802.2 LLC within
1143 802.11 frame which we'll need to de-encapsulate to 964 802.11 frame which we'll need to de-encapsulate to
1144 the original EthernetII frame. */ 965 the original EthernetII frame. */
1145 966 hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN - ENCAPS_OVERHEAD);
1146 if (length < ENCAPS_OVERHEAD) { /* No room for full LLC+SNAP */
1147 stats->rx_length_errors++;
1148 goto drop;
1149 }
1150
1151 /* Remove SNAP header, reconstruct EthernetII frame */
1152 data_len = length - ENCAPS_OVERHEAD;
1153 data_off = HERMES_802_3_OFFSET + sizeof(hdr);
1154
1155 eh = (struct ethhdr *)skb_put(skb, ETH_HLEN);
1156
1157 memcpy(eh, &hdr, 2 * ETH_ALEN);
1158 eh->h_proto = hdr.ethertype;
1159 } else { 967 } else {
1160 /* All other cases indicate a genuine 802.3 frame. No 968 /* 802.3 frame - prepend 802.3 header as is */
1161 decapsulation needed. We just throw the whole 969 hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN);
1162 thing in, and hope the protocol layer can deal with 970 hdr->h_proto = htons(length);
1163 it as 802.3 */
1164 data_len = length;
1165 data_off = HERMES_802_3_OFFSET;
1166 /* FIXME: we re-read from the card data we already read here */
1167 }
1168
1169 p = skb_put(skb, data_len);
1170 err = hermes_bap_pread(hw, IRQ_BAP, p, ALIGN(data_len, 2),
1171 rxfid, data_off);
1172 if (err) {
1173 printk(KERN_ERR "%s: error %d reading frame. "
1174 "Frame dropped.\n", dev->name, err);
1175 stats->rx_errors++;
1176 goto drop;
1177 } 971 }
972 memcpy(hdr->h_dest, desc.addr1, ETH_ALEN);
973 if (fc & IEEE80211_FCTL_FROMDS)
974 memcpy(hdr->h_source, desc.addr3, ETH_ALEN);
975 else
976 memcpy(hdr->h_source, desc.addr2, ETH_ALEN);
1178 977
1179 dev->last_rx = jiffies; 978 dev->last_rx = jiffies;
1180 skb->dev = dev; 979 skb->dev = dev;
1181 skb->protocol = eth_type_trans(skb, dev); 980 skb->protocol = eth_type_trans(skb, dev);
1182 skb->ip_summed = CHECKSUM_NONE; 981 skb->ip_summed = CHECKSUM_NONE;
982 if (fc & IEEE80211_FCTL_TODS)
983 skb->pkt_type = PACKET_OTHERHOST;
1183 984
1184 /* Process the wireless stats if needed */ 985 /* Process the wireless stats if needed */
1185 orinoco_stat_gather(dev, skb, &desc); 986 orinoco_stat_gather(dev, skb, &desc);
@@ -1192,11 +993,10 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
1192 return; 993 return;
1193 994
1194 drop: 995 drop:
996 dev_kfree_skb_irq(skb);
997 update_stats:
998 stats->rx_errors++;
1195 stats->rx_dropped++; 999 stats->rx_dropped++;
1196
1197 if (skb)
1198 dev_kfree_skb_irq(skb);
1199 return;
1200} 1000}
1201 1001
1202/********************************************************************/ 1002/********************************************************************/
@@ -1240,6 +1040,99 @@ static void print_linkstatus(struct net_device *dev, u16 status)
1240 dev->name, s, status); 1040 dev->name, s, status);
1241} 1041}
1242 1042
1043/* Search scan results for requested BSSID, join it if found */
1044static void orinoco_join_ap(struct net_device *dev)
1045{
1046 struct orinoco_private *priv = netdev_priv(dev);
1047 struct hermes *hw = &priv->hw;
1048 int err;
1049 unsigned long flags;
1050 struct join_req {
1051 u8 bssid[ETH_ALEN];
1052 u16 channel;
1053 } __attribute__ ((packed)) req;
1054 const int atom_len = offsetof(struct prism2_scan_apinfo, atim);
1055 struct prism2_scan_apinfo *atom;
1056 int offset = 4;
1057 u8 *buf;
1058 u16 len;
1059
1060 /* Allocate buffer for scan results */
1061 buf = kmalloc(MAX_SCAN_LEN, GFP_KERNEL);
1062 if (! buf)
1063 return;
1064
1065 if (orinoco_lock(priv, &flags) != 0)
1066 goto out;
1067
1068 /* Sanity checks in case user changed something in the meantime */
1069 if (! priv->bssid_fixed)
1070 goto out;
1071
1072 if (strlen(priv->desired_essid) == 0)
1073 goto out;
1074
1075 /* Read scan results from the firmware */
1076 err = hermes_read_ltv(hw, USER_BAP,
1077 HERMES_RID_SCANRESULTSTABLE,
1078 MAX_SCAN_LEN, &len, buf);
1079 if (err) {
1080 printk(KERN_ERR "%s: Cannot read scan results\n",
1081 dev->name);
1082 goto out;
1083 }
1084
1085 len = HERMES_RECLEN_TO_BYTES(len);
1086
1087 /* Go through the scan results looking for the channel of the AP
1088 * we were requested to join */
1089 for (; offset + atom_len <= len; offset += atom_len) {
1090 atom = (struct prism2_scan_apinfo *) (buf + offset);
1091 if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0)
1092 goto found;
1093 }
1094
1095 DEBUG(1, "%s: Requested AP not found in scan results\n",
1096 dev->name);
1097 goto out;
1098
1099 found:
1100 memcpy(req.bssid, priv->desired_bssid, ETH_ALEN);
1101 req.channel = atom->channel; /* both are little-endian */
1102 err = HERMES_WRITE_RECORD(hw, USER_BAP, HERMES_RID_CNFJOINREQUEST,
1103 &req);
1104 if (err)
1105 printk(KERN_ERR "%s: Error issuing join request\n", dev->name);
1106
1107 out:
1108 kfree(buf);
1109 orinoco_unlock(priv, &flags);
1110}
1111
1112/* Send new BSSID to userspace */
1113static void orinoco_send_wevents(struct net_device *dev)
1114{
1115 struct orinoco_private *priv = netdev_priv(dev);
1116 struct hermes *hw = &priv->hw;
1117 union iwreq_data wrqu;
1118 int err;
1119 unsigned long flags;
1120
1121 if (orinoco_lock(priv, &flags) != 0)
1122 return;
1123
1124 err = hermes_read_ltv(hw, IRQ_BAP, HERMES_RID_CURRENTBSSID,
1125 ETH_ALEN, NULL, wrqu.ap_addr.sa_data);
1126 if (err != 0)
1127 return;
1128
1129 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
1130
1131 /* Send event to user space */
1132 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
1133 orinoco_unlock(priv, &flags);
1134}
1135
1243static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) 1136static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1244{ 1137{
1245 struct orinoco_private *priv = netdev_priv(dev); 1138 struct orinoco_private *priv = netdev_priv(dev);
@@ -1307,6 +1200,9 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1307 u16 newstatus; 1200 u16 newstatus;
1308 int connected; 1201 int connected;
1309 1202
1203 if (priv->iw_mode == IW_MODE_MONITOR)
1204 break;
1205
1310 if (len != sizeof(linkstatus)) { 1206 if (len != sizeof(linkstatus)) {
1311 printk(KERN_WARNING "%s: Unexpected size for linkstatus frame (%d bytes)\n", 1207 printk(KERN_WARNING "%s: Unexpected size for linkstatus frame (%d bytes)\n",
1312 dev->name, len); 1208 dev->name, len);
@@ -1319,6 +1215,15 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1319 break; 1215 break;
1320 newstatus = le16_to_cpu(linkstatus.linkstatus); 1216 newstatus = le16_to_cpu(linkstatus.linkstatus);
1321 1217
1218 /* Symbol firmware uses "out of range" to signal that
1219 * the hostscan frame can be requested. */
1220 if (newstatus == HERMES_LINKSTATUS_AP_OUT_OF_RANGE &&
1221 priv->firmware_type == FIRMWARE_TYPE_SYMBOL &&
1222 priv->has_hostscan && priv->scan_inprogress) {
1223 hermes_inquire(hw, HERMES_INQ_HOSTSCAN_SYMBOL);
1224 break;
1225 }
1226
1322 connected = (newstatus == HERMES_LINKSTATUS_CONNECTED) 1227 connected = (newstatus == HERMES_LINKSTATUS_CONNECTED)
1323 || (newstatus == HERMES_LINKSTATUS_AP_CHANGE) 1228 || (newstatus == HERMES_LINKSTATUS_AP_CHANGE)
1324 || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE); 1229 || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE);
@@ -1328,12 +1233,89 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1328 else if (!ignore_disconnect) 1233 else if (!ignore_disconnect)
1329 netif_carrier_off(dev); 1234 netif_carrier_off(dev);
1330 1235
1331 if (newstatus != priv->last_linkstatus) 1236 if (newstatus != priv->last_linkstatus) {
1237 priv->last_linkstatus = newstatus;
1332 print_linkstatus(dev, newstatus); 1238 print_linkstatus(dev, newstatus);
1239 /* The info frame contains only one word which is the
1240 * status (see hermes.h). The status is pretty boring
1241 * in itself, that's why we export the new BSSID...
1242 * Jean II */
1243 schedule_work(&priv->wevent_work);
1244 }
1245 }
1246 break;
1247 case HERMES_INQ_SCAN:
1248 if (!priv->scan_inprogress && priv->bssid_fixed &&
1249 priv->firmware_type == FIRMWARE_TYPE_INTERSIL) {
1250 schedule_work(&priv->join_work);
1251 break;
1252 }
1253 /* fall through */
1254 case HERMES_INQ_HOSTSCAN:
1255 case HERMES_INQ_HOSTSCAN_SYMBOL: {
1256 /* Result of a scanning. Contains information about
1257 * cells in the vicinity - Jean II */
1258 union iwreq_data wrqu;
1259 unsigned char *buf;
1260
1261 /* Sanity check */
1262 if (len > 4096) {
1263 printk(KERN_WARNING "%s: Scan results too large (%d bytes)\n",
1264 dev->name, len);
1265 break;
1266 }
1333 1267
1334 priv->last_linkstatus = newstatus; 1268 /* We are a strict producer. If the previous scan results
1269 * have not been consumed, we just have to drop this
1270 * frame. We can't remove the previous results ourselves,
1271 * that would be *very* racy... Jean II */
1272 if (priv->scan_result != NULL) {
1273 printk(KERN_WARNING "%s: Previous scan results not consumed, dropping info frame.\n", dev->name);
1274 break;
1275 }
1276
1277 /* Allocate buffer for results */
1278 buf = kmalloc(len, GFP_ATOMIC);
1279 if (buf == NULL)
1280 /* No memory, so can't printk()... */
1281 break;
1282
1283 /* Read scan data */
1284 err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len,
1285 infofid, sizeof(info));
1286 if (err)
1287 break;
1288
1289#ifdef ORINOCO_DEBUG
1290 {
1291 int i;
1292 printk(KERN_DEBUG "Scan result [%02X", buf[0]);
1293 for(i = 1; i < (len * 2); i++)
1294 printk(":%02X", buf[i]);
1295 printk("]\n");
1296 }
1297#endif /* ORINOCO_DEBUG */
1298
1299 /* Allow the clients to access the results */
1300 priv->scan_len = len;
1301 priv->scan_result = buf;
1302
1303 /* Send an empty event to user space.
1304 * We don't send the received data on the event because
1305 * it would require us to do complex transcoding, and
1306 * we want to minimise the work done in the irq handler
1307 * Use a request to extract the data - Jean II */
1308 wrqu.data.length = 0;
1309 wrqu.data.flags = 0;
1310 wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
1335 } 1311 }
1336 break; 1312 break;
1313 case HERMES_INQ_SEC_STAT_AGERE:
1314 /* Security status (Agere specific) */
1315 /* Ignore this frame for now */
1316 if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
1317 break;
1318 /* fall through */
1337 default: 1319 default:
1338 printk(KERN_DEBUG "%s: Unknown information frame received: " 1320 printk(KERN_DEBUG "%s: Unknown information frame received: "
1339 "type 0x%04x, length %d\n", dev->name, type, len); 1321 "type 0x%04x, length %d\n", dev->name, type, len);
@@ -1470,6 +1452,36 @@ static int __orinoco_hw_set_bitrate(struct orinoco_private *priv)
1470 return err; 1452 return err;
1471} 1453}
1472 1454
1455/* Set fixed AP address */
1456static int __orinoco_hw_set_wap(struct orinoco_private *priv)
1457{
1458 int roaming_flag;
1459 int err = 0;
1460 hermes_t *hw = &priv->hw;
1461
1462 switch (priv->firmware_type) {
1463 case FIRMWARE_TYPE_AGERE:
1464 /* not supported */
1465 break;
1466 case FIRMWARE_TYPE_INTERSIL:
1467 if (priv->bssid_fixed)
1468 roaming_flag = 2;
1469 else
1470 roaming_flag = 1;
1471
1472 err = hermes_write_wordrec(hw, USER_BAP,
1473 HERMES_RID_CNFROAMINGMODE,
1474 roaming_flag);
1475 break;
1476 case FIRMWARE_TYPE_SYMBOL:
1477 err = HERMES_WRITE_RECORD(hw, USER_BAP,
1478 HERMES_RID_CNFMANDATORYBSSID_SYMBOL,
1479 &priv->desired_bssid);
1480 break;
1481 }
1482 return err;
1483}
1484
1473/* Change the WEP keys and/or the current keys. Can be called 1485/* Change the WEP keys and/or the current keys. Can be called
1474 * either from __orinoco_hw_setup_wep() or directly from 1486 * either from __orinoco_hw_setup_wep() or directly from
1475 * orinoco_ioctl_setiwencode(). In the later case the association 1487 * orinoco_ioctl_setiwencode(). In the later case the association
@@ -1655,6 +1667,13 @@ static int __orinoco_program_rids(struct net_device *dev)
1655 } 1667 }
1656 } 1668 }
1657 1669
1670 /* Set the desired BSSID */
1671 err = __orinoco_hw_set_wap(priv);
1672 if (err) {
1673 printk(KERN_ERR "%s: Error %d setting AP address\n",
1674 dev->name, err);
1675 return err;
1676 }
1658 /* Set the desired ESSID */ 1677 /* Set the desired ESSID */
1659 idbuf.len = cpu_to_le16(strlen(priv->desired_essid)); 1678 idbuf.len = cpu_to_le16(strlen(priv->desired_essid));
1660 memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val)); 1679 memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val));
@@ -1793,6 +1812,20 @@ static int __orinoco_program_rids(struct net_device *dev)
1793 } 1812 }
1794 } 1813 }
1795 1814
1815 if (priv->iw_mode == IW_MODE_MONITOR) {
1816 /* Enable monitor mode */
1817 dev->type = ARPHRD_IEEE80211;
1818 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
1819 HERMES_TEST_MONITOR, 0, NULL);
1820 } else {
1821 /* Disable monitor mode */
1822 dev->type = ARPHRD_ETHER;
1823 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
1824 HERMES_TEST_STOP, 0, NULL);
1825 }
1826 if (err)
1827 return err;
1828
1796 /* Set promiscuity / multicast*/ 1829 /* Set promiscuity / multicast*/
1797 priv->promiscuous = 0; 1830 priv->promiscuous = 0;
1798 priv->mc_count = 0; 1831 priv->mc_count = 0;
@@ -1869,55 +1902,6 @@ __orinoco_set_multicast_list(struct net_device *dev)
1869 dev->flags &= ~IFF_PROMISC; 1902 dev->flags &= ~IFF_PROMISC;
1870} 1903}
1871 1904
1872static int orinoco_reconfigure(struct net_device *dev)
1873{
1874 struct orinoco_private *priv = netdev_priv(dev);
1875 struct hermes *hw = &priv->hw;
1876 unsigned long flags;
1877 int err = 0;
1878
1879 if (priv->broken_disableport) {
1880 schedule_work(&priv->reset_work);
1881 return 0;
1882 }
1883
1884 if (orinoco_lock(priv, &flags) != 0)
1885 return -EBUSY;
1886
1887 err = hermes_disable_port(hw, 0);
1888 if (err) {
1889 printk(KERN_WARNING "%s: Unable to disable port while reconfiguring card\n",
1890 dev->name);
1891 priv->broken_disableport = 1;
1892 goto out;
1893 }
1894
1895 err = __orinoco_program_rids(dev);
1896 if (err) {
1897 printk(KERN_WARNING "%s: Unable to reconfigure card\n",
1898 dev->name);
1899 goto out;
1900 }
1901
1902 err = hermes_enable_port(hw, 0);
1903 if (err) {
1904 printk(KERN_WARNING "%s: Unable to enable port while reconfiguring card\n",
1905 dev->name);
1906 goto out;
1907 }
1908
1909 out:
1910 if (err) {
1911 printk(KERN_WARNING "%s: Resetting instead...\n", dev->name);
1912 schedule_work(&priv->reset_work);
1913 err = 0;
1914 }
1915
1916 orinoco_unlock(priv, &flags);
1917 return err;
1918
1919}
1920
1921/* This must be called from user context, without locks held - use 1905/* This must be called from user context, without locks held - use
1922 * schedule_work() */ 1906 * schedule_work() */
1923static void orinoco_reset(struct net_device *dev) 1907static void orinoco_reset(struct net_device *dev)
@@ -1946,6 +1930,11 @@ static void orinoco_reset(struct net_device *dev)
1946 1930
1947 orinoco_unlock(priv, &flags); 1931 orinoco_unlock(priv, &flags);
1948 1932
1933 /* Scanning support: Cleanup of driver struct */
1934 kfree(priv->scan_result);
1935 priv->scan_result = NULL;
1936 priv->scan_inprogress = 0;
1937
1949 if (priv->hard_reset) { 1938 if (priv->hard_reset) {
1950 err = (*priv->hard_reset)(priv); 1939 err = (*priv->hard_reset)(priv);
1951 if (err) { 1940 if (err) {
@@ -2184,6 +2173,8 @@ static int determine_firmware(struct net_device *dev)
2184 priv->has_mwo = (firmver >= 0x60000); 2173 priv->has_mwo = (firmver >= 0x60000);
2185 priv->has_pm = (firmver >= 0x40020); /* Don't work in 7.52 ? */ 2174 priv->has_pm = (firmver >= 0x40020); /* Don't work in 7.52 ? */
2186 priv->ibss_port = 1; 2175 priv->ibss_port = 1;
2176 priv->has_hostscan = (firmver >= 0x8000a);
2177 priv->broken_monitor = (firmver >= 0x80000);
2187 2178
2188 /* Tested with Agere firmware : 2179 /* Tested with Agere firmware :
2189 * 1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II 2180 * 1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II
@@ -2229,6 +2220,8 @@ static int determine_firmware(struct net_device *dev)
2229 priv->ibss_port = 4; 2220 priv->ibss_port = 4;
2230 priv->broken_disableport = (firmver == 0x25013) || 2221 priv->broken_disableport = (firmver == 0x25013) ||
2231 (firmver >= 0x30000 && firmver <= 0x31000); 2222 (firmver >= 0x30000 && firmver <= 0x31000);
2223 priv->has_hostscan = (firmver >= 0x31001) ||
2224 (firmver >= 0x29057 && firmver < 0x30000);
2232 /* Tested with Intel firmware : 0x20015 => Jean II */ 2225 /* Tested with Intel firmware : 0x20015 => Jean II */
2233 /* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */ 2226 /* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */
2234 break; 2227 break;
@@ -2248,6 +2241,7 @@ static int determine_firmware(struct net_device *dev)
2248 priv->has_ibss = (firmver >= 0x000700); /* FIXME */ 2241 priv->has_ibss = (firmver >= 0x000700); /* FIXME */
2249 priv->has_big_wep = priv->has_wep = (firmver >= 0x000800); 2242 priv->has_big_wep = priv->has_wep = (firmver >= 0x000800);
2250 priv->has_pm = (firmver >= 0x000700); 2243 priv->has_pm = (firmver >= 0x000700);
2244 priv->has_hostscan = (firmver >= 0x010301);
2251 2245
2252 if (firmver >= 0x000800) 2246 if (firmver >= 0x000800)
2253 priv->ibss_port = 0; 2247 priv->ibss_port = 0;
@@ -2456,8 +2450,9 @@ struct net_device *alloc_orinocodev(int sizeof_card,
2456 dev->tx_timeout = orinoco_tx_timeout; 2450 dev->tx_timeout = orinoco_tx_timeout;
2457 dev->watchdog_timeo = HZ; /* 1 second timeout */ 2451 dev->watchdog_timeo = HZ; /* 1 second timeout */
2458 dev->get_stats = orinoco_get_stats; 2452 dev->get_stats = orinoco_get_stats;
2453 dev->ethtool_ops = &orinoco_ethtool_ops;
2459 dev->get_wireless_stats = orinoco_get_wireless_stats; 2454 dev->get_wireless_stats = orinoco_get_wireless_stats;
2460 dev->do_ioctl = orinoco_ioctl; 2455 dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def;
2461 dev->change_mtu = orinoco_change_mtu; 2456 dev->change_mtu = orinoco_change_mtu;
2462 dev->set_multicast_list = orinoco_set_multicast_list; 2457 dev->set_multicast_list = orinoco_set_multicast_list;
2463 /* we use the default eth_mac_addr for setting the MAC addr */ 2458 /* we use the default eth_mac_addr for setting the MAC addr */
@@ -2473,6 +2468,8 @@ struct net_device *alloc_orinocodev(int sizeof_card,
2473 * before anything else touches the 2468 * before anything else touches the
2474 * hardware */ 2469 * hardware */
2475 INIT_WORK(&priv->reset_work, (void (*)(void *))orinoco_reset, dev); 2470 INIT_WORK(&priv->reset_work, (void (*)(void *))orinoco_reset, dev);
2471 INIT_WORK(&priv->join_work, (void (*)(void *))orinoco_join_ap, dev);
2472 INIT_WORK(&priv->wevent_work, (void (*)(void *))orinoco_send_wevents, dev);
2476 2473
2477 netif_carrier_off(dev); 2474 netif_carrier_off(dev);
2478 priv->last_linkstatus = 0xffff; 2475 priv->last_linkstatus = 0xffff;
@@ -2483,6 +2480,9 @@ struct net_device *alloc_orinocodev(int sizeof_card,
2483 2480
2484void free_orinocodev(struct net_device *dev) 2481void free_orinocodev(struct net_device *dev)
2485{ 2482{
2483 struct orinoco_private *priv = netdev_priv(dev);
2484
2485 kfree(priv->scan_result);
2486 free_netdev(dev); 2486 free_netdev(dev);
2487} 2487}
2488 2488
@@ -2490,24 +2490,6 @@ void free_orinocodev(struct net_device *dev)
2490/* Wireless extensions */ 2490/* Wireless extensions */
2491/********************************************************************/ 2491/********************************************************************/
2492 2492
2493static int orinoco_hw_get_bssid(struct orinoco_private *priv,
2494 char buf[ETH_ALEN])
2495{
2496 hermes_t *hw = &priv->hw;
2497 int err = 0;
2498 unsigned long flags;
2499
2500 if (orinoco_lock(priv, &flags) != 0)
2501 return -EBUSY;
2502
2503 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
2504 ETH_ALEN, NULL, buf);
2505
2506 orinoco_unlock(priv, &flags);
2507
2508 return err;
2509}
2510
2511static int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, 2493static int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
2512 char buf[IW_ESSID_MAX_SIZE+1]) 2494 char buf[IW_ESSID_MAX_SIZE+1])
2513{ 2495{
@@ -2633,140 +2615,271 @@ static int orinoco_hw_get_bitratelist(struct orinoco_private *priv,
2633 return 0; 2615 return 0;
2634} 2616}
2635 2617
2636static int orinoco_ioctl_getiwrange(struct net_device *dev, struct iw_point *rrq) 2618static int orinoco_ioctl_getname(struct net_device *dev,
2619 struct iw_request_info *info,
2620 char *name,
2621 char *extra)
2637{ 2622{
2638 struct orinoco_private *priv = netdev_priv(dev); 2623 struct orinoco_private *priv = netdev_priv(dev);
2639 int err = 0;
2640 int mode;
2641 struct iw_range range;
2642 int numrates; 2624 int numrates;
2643 int i, k; 2625 int err;
2626
2627 err = orinoco_hw_get_bitratelist(priv, &numrates, NULL, 0);
2628
2629 if (!err && (numrates > 2))
2630 strcpy(name, "IEEE 802.11b");
2631 else
2632 strcpy(name, "IEEE 802.11-DS");
2633
2634 return 0;
2635}
2636
2637static int orinoco_ioctl_setwap(struct net_device *dev,
2638 struct iw_request_info *info,
2639 struct sockaddr *ap_addr,
2640 char *extra)
2641{
2642 struct orinoco_private *priv = netdev_priv(dev);
2643 int err = -EINPROGRESS; /* Call commit handler */
2644 unsigned long flags; 2644 unsigned long flags;
2645 static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
2646 static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2645 2647
2646 TRACE_ENTER(dev->name); 2648 if (orinoco_lock(priv, &flags) != 0)
2649 return -EBUSY;
2650
2651 /* Enable automatic roaming - no sanity checks are needed */
2652 if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
2653 memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
2654 priv->bssid_fixed = 0;
2655 memset(priv->desired_bssid, 0, ETH_ALEN);
2656
2657 /* "off" means keep existing connection */
2658 if (ap_addr->sa_data[0] == 0) {
2659 __orinoco_hw_set_wap(priv);
2660 err = 0;
2661 }
2662 goto out;
2663 }
2664
2665 if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
2666 printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
2667 "support manual roaming\n",
2668 dev->name);
2669 err = -EOPNOTSUPP;
2670 goto out;
2671 }
2672
2673 if (priv->iw_mode != IW_MODE_INFRA) {
2674 printk(KERN_WARNING "%s: Manual roaming supported only in "
2675 "managed mode\n", dev->name);
2676 err = -EOPNOTSUPP;
2677 goto out;
2678 }
2679
2680 /* Intersil firmware hangs without Desired ESSID */
2681 if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
2682 strlen(priv->desired_essid) == 0) {
2683 printk(KERN_WARNING "%s: Desired ESSID must be set for "
2684 "manual roaming\n", dev->name);
2685 err = -EOPNOTSUPP;
2686 goto out;
2687 }
2688
2689 /* Finally, enable manual roaming */
2690 priv->bssid_fixed = 1;
2691 memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
2692
2693 out:
2694 orinoco_unlock(priv, &flags);
2695 return err;
2696}
2697
2698static int orinoco_ioctl_getwap(struct net_device *dev,
2699 struct iw_request_info *info,
2700 struct sockaddr *ap_addr,
2701 char *extra)
2702{
2703 struct orinoco_private *priv = netdev_priv(dev);
2704
2705 hermes_t *hw = &priv->hw;
2706 int err = 0;
2707 unsigned long flags;
2708
2709 if (orinoco_lock(priv, &flags) != 0)
2710 return -EBUSY;
2711
2712 ap_addr->sa_family = ARPHRD_ETHER;
2713 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
2714 ETH_ALEN, NULL, ap_addr->sa_data);
2715
2716 orinoco_unlock(priv, &flags);
2717
2718 return err;
2719}
2647 2720
2648 if (!access_ok(VERIFY_WRITE, rrq->pointer, sizeof(range))) 2721static int orinoco_ioctl_setmode(struct net_device *dev,
2649 return -EFAULT; 2722 struct iw_request_info *info,
2723 u32 *mode,
2724 char *extra)
2725{
2726 struct orinoco_private *priv = netdev_priv(dev);
2727 int err = -EINPROGRESS; /* Call commit handler */
2728 unsigned long flags;
2650 2729
2651 rrq->length = sizeof(range); 2730 if (priv->iw_mode == *mode)
2731 return 0;
2652 2732
2653 if (orinoco_lock(priv, &flags) != 0) 2733 if (orinoco_lock(priv, &flags) != 0)
2654 return -EBUSY; 2734 return -EBUSY;
2655 2735
2656 mode = priv->iw_mode; 2736 switch (*mode) {
2737 case IW_MODE_ADHOC:
2738 if (!priv->has_ibss && !priv->has_port3)
2739 err = -EOPNOTSUPP;
2740 break;
2741
2742 case IW_MODE_INFRA:
2743 break;
2744
2745 case IW_MODE_MONITOR:
2746 if (priv->broken_monitor && !force_monitor) {
2747 printk(KERN_WARNING "%s: Monitor mode support is "
2748 "buggy in this firmware, not enabling\n",
2749 dev->name);
2750 err = -EOPNOTSUPP;
2751 }
2752 break;
2753
2754 default:
2755 err = -EOPNOTSUPP;
2756 break;
2757 }
2758
2759 if (err == -EINPROGRESS) {
2760 priv->iw_mode = *mode;
2761 set_port_type(priv);
2762 }
2763
2657 orinoco_unlock(priv, &flags); 2764 orinoco_unlock(priv, &flags);
2658 2765
2659 memset(&range, 0, sizeof(range)); 2766 return err;
2767}
2768
2769static int orinoco_ioctl_getmode(struct net_device *dev,
2770 struct iw_request_info *info,
2771 u32 *mode,
2772 char *extra)
2773{
2774 struct orinoco_private *priv = netdev_priv(dev);
2775
2776 *mode = priv->iw_mode;
2777 return 0;
2778}
2779
2780static int orinoco_ioctl_getiwrange(struct net_device *dev,
2781 struct iw_request_info *info,
2782 struct iw_point *rrq,
2783 char *extra)
2784{
2785 struct orinoco_private *priv = netdev_priv(dev);
2786 int err = 0;
2787 struct iw_range *range = (struct iw_range *) extra;
2788 int numrates;
2789 int i, k;
2790
2791 TRACE_ENTER(dev->name);
2660 2792
2661 /* Much of this shamelessly taken from wvlan_cs.c. No idea 2793 rrq->length = sizeof(struct iw_range);
2662 * what it all means -dgibson */ 2794 memset(range, 0, sizeof(struct iw_range));
2663 range.we_version_compiled = WIRELESS_EXT;
2664 range.we_version_source = 11;
2665 2795
2666 range.min_nwid = range.max_nwid = 0; /* We don't use nwids */ 2796 range->we_version_compiled = WIRELESS_EXT;
2797 range->we_version_source = 14;
2667 2798
2668 /* Set available channels/frequencies */ 2799 /* Set available channels/frequencies */
2669 range.num_channels = NUM_CHANNELS; 2800 range->num_channels = NUM_CHANNELS;
2670 k = 0; 2801 k = 0;
2671 for (i = 0; i < NUM_CHANNELS; i++) { 2802 for (i = 0; i < NUM_CHANNELS; i++) {
2672 if (priv->channel_mask & (1 << i)) { 2803 if (priv->channel_mask & (1 << i)) {
2673 range.freq[k].i = i + 1; 2804 range->freq[k].i = i + 1;
2674 range.freq[k].m = channel_frequency[i] * 100000; 2805 range->freq[k].m = channel_frequency[i] * 100000;
2675 range.freq[k].e = 1; 2806 range->freq[k].e = 1;
2676 k++; 2807 k++;
2677 } 2808 }
2678 2809
2679 if (k >= IW_MAX_FREQUENCIES) 2810 if (k >= IW_MAX_FREQUENCIES)
2680 break; 2811 break;
2681 } 2812 }
2682 range.num_frequency = k; 2813 range->num_frequency = k;
2814 range->sensitivity = 3;
2683 2815
2684 range.sensitivity = 3; 2816 if (priv->has_wep) {
2817 range->max_encoding_tokens = ORINOCO_MAX_KEYS;
2818 range->encoding_size[0] = SMALL_KEY_SIZE;
2819 range->num_encoding_sizes = 1;
2685 2820
2686 if ((mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){ 2821 if (priv->has_big_wep) {
2822 range->encoding_size[1] = LARGE_KEY_SIZE;
2823 range->num_encoding_sizes = 2;
2824 }
2825 }
2826
2827 if ((priv->iw_mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){
2687 /* Quality stats meaningless in ad-hoc mode */ 2828 /* Quality stats meaningless in ad-hoc mode */
2688 range.max_qual.qual = 0;
2689 range.max_qual.level = 0;
2690 range.max_qual.noise = 0;
2691 range.avg_qual.qual = 0;
2692 range.avg_qual.level = 0;
2693 range.avg_qual.noise = 0;
2694 } else { 2829 } else {
2695 range.max_qual.qual = 0x8b - 0x2f; 2830 range->max_qual.qual = 0x8b - 0x2f;
2696 range.max_qual.level = 0x2f - 0x95 - 1; 2831 range->max_qual.level = 0x2f - 0x95 - 1;
2697 range.max_qual.noise = 0x2f - 0x95 - 1; 2832 range->max_qual.noise = 0x2f - 0x95 - 1;
2698 /* Need to get better values */ 2833 /* Need to get better values */
2699 range.avg_qual.qual = 0x24; 2834 range->avg_qual.qual = 0x24;
2700 range.avg_qual.level = 0xC2; 2835 range->avg_qual.level = 0xC2;
2701 range.avg_qual.noise = 0x9E; 2836 range->avg_qual.noise = 0x9E;
2702 } 2837 }
2703 2838
2704 err = orinoco_hw_get_bitratelist(priv, &numrates, 2839 err = orinoco_hw_get_bitratelist(priv, &numrates,
2705 range.bitrate, IW_MAX_BITRATES); 2840 range->bitrate, IW_MAX_BITRATES);
2706 if (err) 2841 if (err)
2707 return err; 2842 return err;
2708 range.num_bitrates = numrates; 2843 range->num_bitrates = numrates;
2709 2844
2710 /* Set an indication of the max TCP throughput in bit/s that we can 2845 /* Set an indication of the max TCP throughput in bit/s that we can
2711 * expect using this interface. May be use for QoS stuff... 2846 * expect using this interface. May be use for QoS stuff...
2712 * Jean II */ 2847 * Jean II */
2713 if(numrates > 2) 2848 if (numrates > 2)
2714 range.throughput = 5 * 1000 * 1000; /* ~5 Mb/s */ 2849 range->throughput = 5 * 1000 * 1000; /* ~5 Mb/s */
2715 else 2850 else
2716 range.throughput = 1.5 * 1000 * 1000; /* ~1.5 Mb/s */ 2851 range->throughput = 1.5 * 1000 * 1000; /* ~1.5 Mb/s */
2717 2852
2718 range.min_rts = 0; 2853 range->min_rts = 0;
2719 range.max_rts = 2347; 2854 range->max_rts = 2347;
2720 range.min_frag = 256; 2855 range->min_frag = 256;
2721 range.max_frag = 2346; 2856 range->max_frag = 2346;
2722 2857
2723 if (orinoco_lock(priv, &flags) != 0) 2858 range->min_pmp = 0;
2724 return -EBUSY; 2859 range->max_pmp = 65535000;
2725 if (priv->has_wep) { 2860 range->min_pmt = 0;
2726 range.max_encoding_tokens = ORINOCO_MAX_KEYS; 2861 range->max_pmt = 65535 * 1000; /* ??? */
2727 2862 range->pmp_flags = IW_POWER_PERIOD;
2728 range.encoding_size[0] = SMALL_KEY_SIZE; 2863 range->pmt_flags = IW_POWER_TIMEOUT;
2729 range.num_encoding_sizes = 1; 2864 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_UNICAST_R;
2730 2865
2731 if (priv->has_big_wep) { 2866 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
2732 range.encoding_size[1] = LARGE_KEY_SIZE; 2867 range->retry_flags = IW_RETRY_LIMIT;
2733 range.num_encoding_sizes = 2; 2868 range->r_time_flags = IW_RETRY_LIFETIME;
2734 } 2869 range->min_retry = 0;
2735 } else { 2870 range->max_retry = 65535; /* ??? */
2736 range.num_encoding_sizes = 0; 2871 range->min_r_time = 0;
2737 range.max_encoding_tokens = 0; 2872 range->max_r_time = 65535 * 1000; /* ??? */
2738 }
2739 orinoco_unlock(priv, &flags);
2740
2741 range.min_pmp = 0;
2742 range.max_pmp = 65535000;
2743 range.min_pmt = 0;
2744 range.max_pmt = 65535 * 1000; /* ??? */
2745 range.pmp_flags = IW_POWER_PERIOD;
2746 range.pmt_flags = IW_POWER_TIMEOUT;
2747 range.pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_UNICAST_R;
2748
2749 range.num_txpower = 1;
2750 range.txpower[0] = 15; /* 15dBm */
2751 range.txpower_capa = IW_TXPOW_DBM;
2752
2753 range.retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
2754 range.retry_flags = IW_RETRY_LIMIT;
2755 range.r_time_flags = IW_RETRY_LIFETIME;
2756 range.min_retry = 0;
2757 range.max_retry = 65535; /* ??? */
2758 range.min_r_time = 0;
2759 range.max_r_time = 65535 * 1000; /* ??? */
2760
2761 if (copy_to_user(rrq->pointer, &range, sizeof(range)))
2762 return -EFAULT;
2763 2873
2764 TRACE_EXIT(dev->name); 2874 TRACE_EXIT(dev->name);
2765 2875
2766 return 0; 2876 return 0;
2767} 2877}
2768 2878
2769static int orinoco_ioctl_setiwencode(struct net_device *dev, struct iw_point *erq) 2879static int orinoco_ioctl_setiwencode(struct net_device *dev,
2880 struct iw_request_info *info,
2881 struct iw_point *erq,
2882 char *keybuf)
2770{ 2883{
2771 struct orinoco_private *priv = netdev_priv(dev); 2884 struct orinoco_private *priv = netdev_priv(dev);
2772 int index = (erq->flags & IW_ENCODE_INDEX) - 1; 2885 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
@@ -2774,8 +2887,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, struct iw_point *er
2774 int enable = priv->wep_on; 2887 int enable = priv->wep_on;
2775 int restricted = priv->wep_restrict; 2888 int restricted = priv->wep_restrict;
2776 u16 xlen = 0; 2889 u16 xlen = 0;
2777 int err = 0; 2890 int err = -EINPROGRESS; /* Call commit handler */
2778 char keybuf[ORINOCO_MAX_KEY_SIZE];
2779 unsigned long flags; 2891 unsigned long flags;
2780 2892
2781 if (! priv->has_wep) 2893 if (! priv->has_wep)
@@ -2788,9 +2900,6 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, struct iw_point *er
2788 2900
2789 if ( (erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep ) 2901 if ( (erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep )
2790 return -E2BIG; 2902 return -E2BIG;
2791
2792 if (copy_from_user(keybuf, erq->pointer, erq->length))
2793 return -EFAULT;
2794 } 2903 }
2795 2904
2796 if (orinoco_lock(priv, &flags) != 0) 2905 if (orinoco_lock(priv, &flags) != 0)
@@ -2864,12 +2973,14 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, struct iw_point *er
2864 return err; 2973 return err;
2865} 2974}
2866 2975
2867static int orinoco_ioctl_getiwencode(struct net_device *dev, struct iw_point *erq) 2976static int orinoco_ioctl_getiwencode(struct net_device *dev,
2977 struct iw_request_info *info,
2978 struct iw_point *erq,
2979 char *keybuf)
2868{ 2980{
2869 struct orinoco_private *priv = netdev_priv(dev); 2981 struct orinoco_private *priv = netdev_priv(dev);
2870 int index = (erq->flags & IW_ENCODE_INDEX) - 1; 2982 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
2871 u16 xlen = 0; 2983 u16 xlen = 0;
2872 char keybuf[ORINOCO_MAX_KEY_SIZE];
2873 unsigned long flags; 2984 unsigned long flags;
2874 2985
2875 if (! priv->has_wep) 2986 if (! priv->has_wep)
@@ -2898,51 +3009,47 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev, struct iw_point *er
2898 memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE); 3009 memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE);
2899 3010
2900 orinoco_unlock(priv, &flags); 3011 orinoco_unlock(priv, &flags);
2901
2902 if (erq->pointer) {
2903 if (copy_to_user(erq->pointer, keybuf, xlen))
2904 return -EFAULT;
2905 }
2906
2907 return 0; 3012 return 0;
2908} 3013}
2909 3014
2910static int orinoco_ioctl_setessid(struct net_device *dev, struct iw_point *erq) 3015static int orinoco_ioctl_setessid(struct net_device *dev,
3016 struct iw_request_info *info,
3017 struct iw_point *erq,
3018 char *essidbuf)
2911{ 3019{
2912 struct orinoco_private *priv = netdev_priv(dev); 3020 struct orinoco_private *priv = netdev_priv(dev);
2913 char essidbuf[IW_ESSID_MAX_SIZE+1];
2914 unsigned long flags; 3021 unsigned long flags;
2915 3022
2916 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it 3023 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
2917 * anyway... - Jean II */ 3024 * anyway... - Jean II */
2918 3025
2919 memset(&essidbuf, 0, sizeof(essidbuf)); 3026 /* Hum... Should not use Wireless Extension constant (may change),
2920 3027 * should use our own... - Jean II */
2921 if (erq->flags) { 3028 if (erq->length > IW_ESSID_MAX_SIZE)
2922 /* iwconfig includes the NUL in the specified length */ 3029 return -E2BIG;
2923 if (erq->length > IW_ESSID_MAX_SIZE+1)
2924 return -E2BIG;
2925
2926 if (copy_from_user(&essidbuf, erq->pointer, erq->length))
2927 return -EFAULT;
2928
2929 essidbuf[IW_ESSID_MAX_SIZE] = '\0';
2930 }
2931 3030
2932 if (orinoco_lock(priv, &flags) != 0) 3031 if (orinoco_lock(priv, &flags) != 0)
2933 return -EBUSY; 3032 return -EBUSY;
2934 3033
2935 memcpy(priv->desired_essid, essidbuf, sizeof(priv->desired_essid)); 3034 /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
3035 memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
3036
3037 /* If not ANY, get the new ESSID */
3038 if (erq->flags) {
3039 memcpy(priv->desired_essid, essidbuf, erq->length);
3040 }
2936 3041
2937 orinoco_unlock(priv, &flags); 3042 orinoco_unlock(priv, &flags);
2938 3043
2939 return 0; 3044 return -EINPROGRESS; /* Call commit handler */
2940} 3045}
2941 3046
2942static int orinoco_ioctl_getessid(struct net_device *dev, struct iw_point *erq) 3047static int orinoco_ioctl_getessid(struct net_device *dev,
3048 struct iw_request_info *info,
3049 struct iw_point *erq,
3050 char *essidbuf)
2943{ 3051{
2944 struct orinoco_private *priv = netdev_priv(dev); 3052 struct orinoco_private *priv = netdev_priv(dev);
2945 char essidbuf[IW_ESSID_MAX_SIZE+1];
2946 int active; 3053 int active;
2947 int err = 0; 3054 int err = 0;
2948 unsigned long flags; 3055 unsigned long flags;
@@ -2956,51 +3063,46 @@ static int orinoco_ioctl_getessid(struct net_device *dev, struct iw_point *erq)
2956 } else { 3063 } else {
2957 if (orinoco_lock(priv, &flags) != 0) 3064 if (orinoco_lock(priv, &flags) != 0)
2958 return -EBUSY; 3065 return -EBUSY;
2959 memcpy(essidbuf, priv->desired_essid, sizeof(essidbuf)); 3066 memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE + 1);
2960 orinoco_unlock(priv, &flags); 3067 orinoco_unlock(priv, &flags);
2961 } 3068 }
2962 3069
2963 erq->flags = 1; 3070 erq->flags = 1;
2964 erq->length = strlen(essidbuf) + 1; 3071 erq->length = strlen(essidbuf) + 1;
2965 if (erq->pointer)
2966 if (copy_to_user(erq->pointer, essidbuf, erq->length))
2967 return -EFAULT;
2968 3072
2969 TRACE_EXIT(dev->name); 3073 TRACE_EXIT(dev->name);
2970 3074
2971 return 0; 3075 return 0;
2972} 3076}
2973 3077
2974static int orinoco_ioctl_setnick(struct net_device *dev, struct iw_point *nrq) 3078static int orinoco_ioctl_setnick(struct net_device *dev,
3079 struct iw_request_info *info,
3080 struct iw_point *nrq,
3081 char *nickbuf)
2975{ 3082{
2976 struct orinoco_private *priv = netdev_priv(dev); 3083 struct orinoco_private *priv = netdev_priv(dev);
2977 char nickbuf[IW_ESSID_MAX_SIZE+1];
2978 unsigned long flags; 3084 unsigned long flags;
2979 3085
2980 if (nrq->length > IW_ESSID_MAX_SIZE) 3086 if (nrq->length > IW_ESSID_MAX_SIZE)
2981 return -E2BIG; 3087 return -E2BIG;
2982 3088
2983 memset(nickbuf, 0, sizeof(nickbuf));
2984
2985 if (copy_from_user(nickbuf, nrq->pointer, nrq->length))
2986 return -EFAULT;
2987
2988 nickbuf[nrq->length] = '\0';
2989
2990 if (orinoco_lock(priv, &flags) != 0) 3089 if (orinoco_lock(priv, &flags) != 0)
2991 return -EBUSY; 3090 return -EBUSY;
2992 3091
2993 memcpy(priv->nick, nickbuf, sizeof(priv->nick)); 3092 memset(priv->nick, 0, sizeof(priv->nick));
3093 memcpy(priv->nick, nickbuf, nrq->length);
2994 3094
2995 orinoco_unlock(priv, &flags); 3095 orinoco_unlock(priv, &flags);
2996 3096
2997 return 0; 3097 return -EINPROGRESS; /* Call commit handler */
2998} 3098}
2999 3099
3000static int orinoco_ioctl_getnick(struct net_device *dev, struct iw_point *nrq) 3100static int orinoco_ioctl_getnick(struct net_device *dev,
3101 struct iw_request_info *info,
3102 struct iw_point *nrq,
3103 char *nickbuf)
3001{ 3104{
3002 struct orinoco_private *priv = netdev_priv(dev); 3105 struct orinoco_private *priv = netdev_priv(dev);
3003 char nickbuf[IW_ESSID_MAX_SIZE+1];
3004 unsigned long flags; 3106 unsigned long flags;
3005 3107
3006 if (orinoco_lock(priv, &flags) != 0) 3108 if (orinoco_lock(priv, &flags) != 0)
@@ -3011,23 +3113,22 @@ static int orinoco_ioctl_getnick(struct net_device *dev, struct iw_point *nrq)
3011 3113
3012 nrq->length = strlen(nickbuf)+1; 3114 nrq->length = strlen(nickbuf)+1;
3013 3115
3014 if (copy_to_user(nrq->pointer, nickbuf, sizeof(nickbuf)))
3015 return -EFAULT;
3016
3017 return 0; 3116 return 0;
3018} 3117}
3019 3118
3020static int orinoco_ioctl_setfreq(struct net_device *dev, struct iw_freq *frq) 3119static int orinoco_ioctl_setfreq(struct net_device *dev,
3120 struct iw_request_info *info,
3121 struct iw_freq *frq,
3122 char *extra)
3021{ 3123{
3022 struct orinoco_private *priv = netdev_priv(dev); 3124 struct orinoco_private *priv = netdev_priv(dev);
3023 int chan = -1; 3125 int chan = -1;
3024 unsigned long flags; 3126 unsigned long flags;
3127 int err = -EINPROGRESS; /* Call commit handler */
3025 3128
3026 /* We can only use this in Ad-Hoc demo mode to set the operating 3129 /* In infrastructure mode the AP sets the channel */
3027 * frequency, or in IBSS mode to set the frequency where the IBSS 3130 if (priv->iw_mode == IW_MODE_INFRA)
3028 * will be created - Jean II */ 3131 return -EBUSY;
3029 if (priv->iw_mode != IW_MODE_ADHOC)
3030 return -EOPNOTSUPP;
3031 3132
3032 if ( (frq->e == 0) && (frq->m <= 1000) ) { 3133 if ( (frq->e == 0) && (frq->m <= 1000) ) {
3033 /* Setting by channel number */ 3134 /* Setting by channel number */
@@ -3051,13 +3152,44 @@ static int orinoco_ioctl_setfreq(struct net_device *dev, struct iw_freq *frq)
3051 3152
3052 if (orinoco_lock(priv, &flags) != 0) 3153 if (orinoco_lock(priv, &flags) != 0)
3053 return -EBUSY; 3154 return -EBUSY;
3155
3054 priv->channel = chan; 3156 priv->channel = chan;
3157 if (priv->iw_mode == IW_MODE_MONITOR) {
3158 /* Fast channel change - no commit if successful */
3159 hermes_t *hw = &priv->hw;
3160 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
3161 HERMES_TEST_SET_CHANNEL,
3162 chan, NULL);
3163 }
3055 orinoco_unlock(priv, &flags); 3164 orinoco_unlock(priv, &flags);
3056 3165
3166 return err;
3167}
3168
3169static int orinoco_ioctl_getfreq(struct net_device *dev,
3170 struct iw_request_info *info,
3171 struct iw_freq *frq,
3172 char *extra)
3173{
3174 struct orinoco_private *priv = netdev_priv(dev);
3175 int tmp;
3176
3177 /* Locking done in there */
3178 tmp = orinoco_hw_get_freq(priv);
3179 if (tmp < 0) {
3180 return tmp;
3181 }
3182
3183 frq->m = tmp;
3184 frq->e = 1;
3185
3057 return 0; 3186 return 0;
3058} 3187}
3059 3188
3060static int orinoco_ioctl_getsens(struct net_device *dev, struct iw_param *srq) 3189static int orinoco_ioctl_getsens(struct net_device *dev,
3190 struct iw_request_info *info,
3191 struct iw_param *srq,
3192 char *extra)
3061{ 3193{
3062 struct orinoco_private *priv = netdev_priv(dev); 3194 struct orinoco_private *priv = netdev_priv(dev);
3063 hermes_t *hw = &priv->hw; 3195 hermes_t *hw = &priv->hw;
@@ -3083,7 +3215,10 @@ static int orinoco_ioctl_getsens(struct net_device *dev, struct iw_param *srq)
3083 return 0; 3215 return 0;
3084} 3216}
3085 3217
3086static int orinoco_ioctl_setsens(struct net_device *dev, struct iw_param *srq) 3218static int orinoco_ioctl_setsens(struct net_device *dev,
3219 struct iw_request_info *info,
3220 struct iw_param *srq,
3221 char *extra)
3087{ 3222{
3088 struct orinoco_private *priv = netdev_priv(dev); 3223 struct orinoco_private *priv = netdev_priv(dev);
3089 int val = srq->value; 3224 int val = srq->value;
@@ -3100,10 +3235,13 @@ static int orinoco_ioctl_setsens(struct net_device *dev, struct iw_param *srq)
3100 priv->ap_density = val; 3235 priv->ap_density = val;
3101 orinoco_unlock(priv, &flags); 3236 orinoco_unlock(priv, &flags);
3102 3237
3103 return 0; 3238 return -EINPROGRESS; /* Call commit handler */
3104} 3239}
3105 3240
3106static int orinoco_ioctl_setrts(struct net_device *dev, struct iw_param *rrq) 3241static int orinoco_ioctl_setrts(struct net_device *dev,
3242 struct iw_request_info *info,
3243 struct iw_param *rrq,
3244 char *extra)
3107{ 3245{
3108 struct orinoco_private *priv = netdev_priv(dev); 3246 struct orinoco_private *priv = netdev_priv(dev);
3109 int val = rrq->value; 3247 int val = rrq->value;
@@ -3121,13 +3259,30 @@ static int orinoco_ioctl_setrts(struct net_device *dev, struct iw_param *rrq)
3121 priv->rts_thresh = val; 3259 priv->rts_thresh = val;
3122 orinoco_unlock(priv, &flags); 3260 orinoco_unlock(priv, &flags);
3123 3261
3262 return -EINPROGRESS; /* Call commit handler */
3263}
3264
3265static int orinoco_ioctl_getrts(struct net_device *dev,
3266 struct iw_request_info *info,
3267 struct iw_param *rrq,
3268 char *extra)
3269{
3270 struct orinoco_private *priv = netdev_priv(dev);
3271
3272 rrq->value = priv->rts_thresh;
3273 rrq->disabled = (rrq->value == 2347);
3274 rrq->fixed = 1;
3275
3124 return 0; 3276 return 0;
3125} 3277}
3126 3278
3127static int orinoco_ioctl_setfrag(struct net_device *dev, struct iw_param *frq) 3279static int orinoco_ioctl_setfrag(struct net_device *dev,
3280 struct iw_request_info *info,
3281 struct iw_param *frq,
3282 char *extra)
3128{ 3283{
3129 struct orinoco_private *priv = netdev_priv(dev); 3284 struct orinoco_private *priv = netdev_priv(dev);
3130 int err = 0; 3285 int err = -EINPROGRESS; /* Call commit handler */
3131 unsigned long flags; 3286 unsigned long flags;
3132 3287
3133 if (orinoco_lock(priv, &flags) != 0) 3288 if (orinoco_lock(priv, &flags) != 0)
@@ -3159,11 +3314,14 @@ static int orinoco_ioctl_setfrag(struct net_device *dev, struct iw_param *frq)
3159 return err; 3314 return err;
3160} 3315}
3161 3316
3162static int orinoco_ioctl_getfrag(struct net_device *dev, struct iw_param *frq) 3317static int orinoco_ioctl_getfrag(struct net_device *dev,
3318 struct iw_request_info *info,
3319 struct iw_param *frq,
3320 char *extra)
3163{ 3321{
3164 struct orinoco_private *priv = netdev_priv(dev); 3322 struct orinoco_private *priv = netdev_priv(dev);
3165 hermes_t *hw = &priv->hw; 3323 hermes_t *hw = &priv->hw;
3166 int err = 0; 3324 int err;
3167 u16 val; 3325 u16 val;
3168 unsigned long flags; 3326 unsigned long flags;
3169 3327
@@ -3196,10 +3354,12 @@ static int orinoco_ioctl_getfrag(struct net_device *dev, struct iw_param *frq)
3196 return err; 3354 return err;
3197} 3355}
3198 3356
3199static int orinoco_ioctl_setrate(struct net_device *dev, struct iw_param *rrq) 3357static int orinoco_ioctl_setrate(struct net_device *dev,
3358 struct iw_request_info *info,
3359 struct iw_param *rrq,
3360 char *extra)
3200{ 3361{
3201 struct orinoco_private *priv = netdev_priv(dev); 3362 struct orinoco_private *priv = netdev_priv(dev);
3202 int err = 0;
3203 int ratemode = -1; 3363 int ratemode = -1;
3204 int bitrate; /* 100s of kilobits */ 3364 int bitrate; /* 100s of kilobits */
3205 int i; 3365 int i;
@@ -3235,10 +3395,13 @@ static int orinoco_ioctl_setrate(struct net_device *dev, struct iw_param *rrq)
3235 priv->bitratemode = ratemode; 3395 priv->bitratemode = ratemode;
3236 orinoco_unlock(priv, &flags); 3396 orinoco_unlock(priv, &flags);
3237 3397
3238 return err; 3398 return -EINPROGRESS;
3239} 3399}
3240 3400
3241static int orinoco_ioctl_getrate(struct net_device *dev, struct iw_param *rrq) 3401static int orinoco_ioctl_getrate(struct net_device *dev,
3402 struct iw_request_info *info,
3403 struct iw_param *rrq,
3404 char *extra)
3242{ 3405{
3243 struct orinoco_private *priv = netdev_priv(dev); 3406 struct orinoco_private *priv = netdev_priv(dev);
3244 hermes_t *hw = &priv->hw; 3407 hermes_t *hw = &priv->hw;
@@ -3303,10 +3466,13 @@ static int orinoco_ioctl_getrate(struct net_device *dev, struct iw_param *rrq)
3303 return err; 3466 return err;
3304} 3467}
3305 3468
3306static int orinoco_ioctl_setpower(struct net_device *dev, struct iw_param *prq) 3469static int orinoco_ioctl_setpower(struct net_device *dev,
3470 struct iw_request_info *info,
3471 struct iw_param *prq,
3472 char *extra)
3307{ 3473{
3308 struct orinoco_private *priv = netdev_priv(dev); 3474 struct orinoco_private *priv = netdev_priv(dev);
3309 int err = 0; 3475 int err = -EINPROGRESS; /* Call commit handler */
3310 unsigned long flags; 3476 unsigned long flags;
3311 3477
3312 if (orinoco_lock(priv, &flags) != 0) 3478 if (orinoco_lock(priv, &flags) != 0)
@@ -3355,7 +3521,10 @@ static int orinoco_ioctl_setpower(struct net_device *dev, struct iw_param *prq)
3355 return err; 3521 return err;
3356} 3522}
3357 3523
3358static int orinoco_ioctl_getpower(struct net_device *dev, struct iw_param *prq) 3524static int orinoco_ioctl_getpower(struct net_device *dev,
3525 struct iw_request_info *info,
3526 struct iw_param *prq,
3527 char *extra)
3359{ 3528{
3360 struct orinoco_private *priv = netdev_priv(dev); 3529 struct orinoco_private *priv = netdev_priv(dev);
3361 hermes_t *hw = &priv->hw; 3530 hermes_t *hw = &priv->hw;
@@ -3403,7 +3572,10 @@ static int orinoco_ioctl_getpower(struct net_device *dev, struct iw_param *prq)
3403 return err; 3572 return err;
3404} 3573}
3405 3574
3406static int orinoco_ioctl_getretry(struct net_device *dev, struct iw_param *rrq) 3575static int orinoco_ioctl_getretry(struct net_device *dev,
3576 struct iw_request_info *info,
3577 struct iw_param *rrq,
3578 char *extra)
3407{ 3579{
3408 struct orinoco_private *priv = netdev_priv(dev); 3580 struct orinoco_private *priv = netdev_priv(dev);
3409 hermes_t *hw = &priv->hw; 3581 hermes_t *hw = &priv->hw;
@@ -3454,10 +3626,38 @@ static int orinoco_ioctl_getretry(struct net_device *dev, struct iw_param *rrq)
3454 return err; 3626 return err;
3455} 3627}
3456 3628
3457static int orinoco_ioctl_setibssport(struct net_device *dev, struct iwreq *wrq) 3629static int orinoco_ioctl_reset(struct net_device *dev,
3630 struct iw_request_info *info,
3631 void *wrqu,
3632 char *extra)
3458{ 3633{
3459 struct orinoco_private *priv = netdev_priv(dev); 3634 struct orinoco_private *priv = netdev_priv(dev);
3460 int val = *( (int *) wrq->u.name ); 3635
3636 if (! capable(CAP_NET_ADMIN))
3637 return -EPERM;
3638
3639 if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
3640 printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
3641
3642 /* Firmware reset */
3643 orinoco_reset(dev);
3644 } else {
3645 printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
3646
3647 schedule_work(&priv->reset_work);
3648 }
3649
3650 return 0;
3651}
3652
3653static int orinoco_ioctl_setibssport(struct net_device *dev,
3654 struct iw_request_info *info,
3655 void *wrqu,
3656 char *extra)
3657
3658{
3659 struct orinoco_private *priv = netdev_priv(dev);
3660 int val = *( (int *) extra );
3461 unsigned long flags; 3661 unsigned long flags;
3462 3662
3463 if (orinoco_lock(priv, &flags) != 0) 3663 if (orinoco_lock(priv, &flags) != 0)
@@ -3469,28 +3669,28 @@ static int orinoco_ioctl_setibssport(struct net_device *dev, struct iwreq *wrq)
3469 set_port_type(priv); 3669 set_port_type(priv);
3470 3670
3471 orinoco_unlock(priv, &flags); 3671 orinoco_unlock(priv, &flags);
3472 return 0; 3672 return -EINPROGRESS; /* Call commit handler */
3473} 3673}
3474 3674
3475static int orinoco_ioctl_getibssport(struct net_device *dev, struct iwreq *wrq) 3675static int orinoco_ioctl_getibssport(struct net_device *dev,
3676 struct iw_request_info *info,
3677 void *wrqu,
3678 char *extra)
3476{ 3679{
3477 struct orinoco_private *priv = netdev_priv(dev); 3680 struct orinoco_private *priv = netdev_priv(dev);
3478 int *val = (int *)wrq->u.name; 3681 int *val = (int *) extra;
3479 unsigned long flags;
3480
3481 if (orinoco_lock(priv, &flags) != 0)
3482 return -EBUSY;
3483 3682
3484 *val = priv->ibss_port; 3683 *val = priv->ibss_port;
3485 orinoco_unlock(priv, &flags);
3486
3487 return 0; 3684 return 0;
3488} 3685}
3489 3686
3490static int orinoco_ioctl_setport3(struct net_device *dev, struct iwreq *wrq) 3687static int orinoco_ioctl_setport3(struct net_device *dev,
3688 struct iw_request_info *info,
3689 void *wrqu,
3690 char *extra)
3491{ 3691{
3492 struct orinoco_private *priv = netdev_priv(dev); 3692 struct orinoco_private *priv = netdev_priv(dev);
3493 int val = *( (int *) wrq->u.name ); 3693 int val = *( (int *) extra );
3494 int err = 0; 3694 int err = 0;
3495 unsigned long flags; 3695 unsigned long flags;
3496 3696
@@ -3519,51 +3719,131 @@ static int orinoco_ioctl_setport3(struct net_device *dev, struct iwreq *wrq)
3519 err = -EINVAL; 3719 err = -EINVAL;
3520 } 3720 }
3521 3721
3522 if (! err) 3722 if (! err) {
3523 /* Actually update the mode we are using */ 3723 /* Actually update the mode we are using */
3524 set_port_type(priv); 3724 set_port_type(priv);
3725 err = -EINPROGRESS;
3726 }
3525 3727
3526 orinoco_unlock(priv, &flags); 3728 orinoco_unlock(priv, &flags);
3527 3729
3528 return err; 3730 return err;
3529} 3731}
3530 3732
3531static int orinoco_ioctl_getport3(struct net_device *dev, struct iwreq *wrq) 3733static int orinoco_ioctl_getport3(struct net_device *dev,
3734 struct iw_request_info *info,
3735 void *wrqu,
3736 char *extra)
3737{
3738 struct orinoco_private *priv = netdev_priv(dev);
3739 int *val = (int *) extra;
3740
3741 *val = priv->prefer_port3;
3742 return 0;
3743}
3744
3745static int orinoco_ioctl_setpreamble(struct net_device *dev,
3746 struct iw_request_info *info,
3747 void *wrqu,
3748 char *extra)
3532{ 3749{
3533 struct orinoco_private *priv = netdev_priv(dev); 3750 struct orinoco_private *priv = netdev_priv(dev);
3534 int *val = (int *)wrq->u.name;
3535 unsigned long flags; 3751 unsigned long flags;
3752 int val;
3753
3754 if (! priv->has_preamble)
3755 return -EOPNOTSUPP;
3756
3757 /* 802.11b has recently defined some short preamble.
3758 * Basically, the Phy header has been reduced in size.
3759 * This increase performance, especially at high rates
3760 * (the preamble is transmitted at 1Mb/s), unfortunately
3761 * this give compatibility troubles... - Jean II */
3762 val = *( (int *) extra );
3536 3763
3537 if (orinoco_lock(priv, &flags) != 0) 3764 if (orinoco_lock(priv, &flags) != 0)
3538 return -EBUSY; 3765 return -EBUSY;
3539 3766
3540 *val = priv->prefer_port3; 3767 if (val)
3768 priv->preamble = 1;
3769 else
3770 priv->preamble = 0;
3771
3541 orinoco_unlock(priv, &flags); 3772 orinoco_unlock(priv, &flags);
3773
3774 return -EINPROGRESS; /* Call commit handler */
3775}
3776
3777static int orinoco_ioctl_getpreamble(struct net_device *dev,
3778 struct iw_request_info *info,
3779 void *wrqu,
3780 char *extra)
3781{
3782 struct orinoco_private *priv = netdev_priv(dev);
3783 int *val = (int *) extra;
3784
3785 if (! priv->has_preamble)
3786 return -EOPNOTSUPP;
3787
3788 *val = priv->preamble;
3542 return 0; 3789 return 0;
3543} 3790}
3544 3791
3792/* ioctl interface to hermes_read_ltv()
3793 * To use with iwpriv, pass the RID as the token argument, e.g.
3794 * iwpriv get_rid [0xfc00]
3795 * At least Wireless Tools 25 is required to use iwpriv.
3796 * For Wireless Tools 25 and 26 append "dummy" are the end. */
3797static int orinoco_ioctl_getrid(struct net_device *dev,
3798 struct iw_request_info *info,
3799 struct iw_point *data,
3800 char *extra)
3801{
3802 struct orinoco_private *priv = netdev_priv(dev);
3803 hermes_t *hw = &priv->hw;
3804 int rid = data->flags;
3805 u16 length;
3806 int err;
3807 unsigned long flags;
3808
3809 /* It's a "get" function, but we don't want users to access the
3810 * WEP key and other raw firmware data */
3811 if (! capable(CAP_NET_ADMIN))
3812 return -EPERM;
3813
3814 if (rid < 0xfc00 || rid > 0xffff)
3815 return -EINVAL;
3816
3817 if (orinoco_lock(priv, &flags) != 0)
3818 return -EBUSY;
3819
3820 err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
3821 extra);
3822 if (err)
3823 goto out;
3824
3825 data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
3826 MAX_RID_LEN);
3827
3828 out:
3829 orinoco_unlock(priv, &flags);
3830 return err;
3831}
3832
3545/* Spy is used for link quality/strength measurements in Ad-Hoc mode 3833/* Spy is used for link quality/strength measurements in Ad-Hoc mode
3546 * Jean II */ 3834 * Jean II */
3547static int orinoco_ioctl_setspy(struct net_device *dev, struct iw_point *srq) 3835static int orinoco_ioctl_setspy(struct net_device *dev,
3836 struct iw_request_info *info,
3837 struct iw_point *srq,
3838 char *extra)
3839
3548{ 3840{
3549 struct orinoco_private *priv = netdev_priv(dev); 3841 struct orinoco_private *priv = netdev_priv(dev);
3550 struct sockaddr address[IW_MAX_SPY]; 3842 struct sockaddr *address = (struct sockaddr *) extra;
3551 int number = srq->length; 3843 int number = srq->length;
3552 int i; 3844 int i;
3553 int err = 0;
3554 unsigned long flags; 3845 unsigned long flags;
3555 3846
3556 /* Check the number of addresses */
3557 if (number > IW_MAX_SPY)
3558 return -E2BIG;
3559
3560 /* Get the data in the driver */
3561 if (srq->pointer) {
3562 if (copy_from_user(address, srq->pointer,
3563 sizeof(struct sockaddr) * number))
3564 return -EFAULT;
3565 }
3566
3567 /* Make sure nobody mess with the structure while we do */ 3847 /* Make sure nobody mess with the structure while we do */
3568 if (orinoco_lock(priv, &flags) != 0) 3848 if (orinoco_lock(priv, &flags) != 0)
3569 return -EBUSY; 3849 return -EBUSY;
@@ -3587,14 +3867,17 @@ static int orinoco_ioctl_setspy(struct net_device *dev, struct iw_point *srq)
3587 /* Now, let the others play */ 3867 /* Now, let the others play */
3588 orinoco_unlock(priv, &flags); 3868 orinoco_unlock(priv, &flags);
3589 3869
3590 return err; 3870 /* Do NOT call commit handler */
3871 return 0;
3591} 3872}
3592 3873
3593static int orinoco_ioctl_getspy(struct net_device *dev, struct iw_point *srq) 3874static int orinoco_ioctl_getspy(struct net_device *dev,
3875 struct iw_request_info *info,
3876 struct iw_point *srq,
3877 char *extra)
3594{ 3878{
3595 struct orinoco_private *priv = netdev_priv(dev); 3879 struct orinoco_private *priv = netdev_priv(dev);
3596 struct sockaddr address[IW_MAX_SPY]; 3880 struct sockaddr *address = (struct sockaddr *) extra;
3597 struct iw_quality spy_stat[IW_MAX_SPY];
3598 int number; 3881 int number;
3599 int i; 3882 int i;
3600 unsigned long flags; 3883 unsigned long flags;
@@ -3603,7 +3886,12 @@ static int orinoco_ioctl_getspy(struct net_device *dev, struct iw_point *srq)
3603 return -EBUSY; 3886 return -EBUSY;
3604 3887
3605 number = priv->spy_number; 3888 number = priv->spy_number;
3606 if ((number > 0) && (srq->pointer)) { 3889 /* Create address struct */
3890 for (i = 0; i < number; i++) {
3891 memcpy(address[i].sa_data, priv->spy_address[i], ETH_ALEN);
3892 address[i].sa_family = AF_UNIX;
3893 }
3894 if (number > 0) {
3607 /* Create address struct */ 3895 /* Create address struct */
3608 for (i = 0; i < number; i++) { 3896 for (i = 0; i < number; i++) {
3609 memcpy(address[i].sa_data, priv->spy_address[i], 3897 memcpy(address[i].sa_data, priv->spy_address[i],
@@ -3614,344 +3902,503 @@ static int orinoco_ioctl_getspy(struct net_device *dev, struct iw_point *srq)
3614 /* In theory, we should disable irqs while copying the stats 3902 /* In theory, we should disable irqs while copying the stats
3615 * because the rx path might update it in the middle... 3903 * because the rx path might update it in the middle...
3616 * Bah, who care ? - Jean II */ 3904 * Bah, who care ? - Jean II */
3617 memcpy(&spy_stat, priv->spy_stat, 3905 memcpy(extra + (sizeof(struct sockaddr) * number),
3618 sizeof(struct iw_quality) * IW_MAX_SPY); 3906 priv->spy_stat, sizeof(struct iw_quality) * number);
3619 for (i=0; i < number; i++)
3620 priv->spy_stat[i].updated = 0;
3621 } 3907 }
3908 /* Reset updated flags. */
3909 for (i = 0; i < number; i++)
3910 priv->spy_stat[i].updated = 0;
3622 3911
3623 orinoco_unlock(priv, &flags); 3912 orinoco_unlock(priv, &flags);
3624 3913
3625 /* Push stuff to user space */
3626 srq->length = number; 3914 srq->length = number;
3627 if(copy_to_user(srq->pointer, address,
3628 sizeof(struct sockaddr) * number))
3629 return -EFAULT;
3630 if(copy_to_user(srq->pointer + (sizeof(struct sockaddr)*number),
3631 &spy_stat, sizeof(struct iw_quality) * number))
3632 return -EFAULT;
3633 3915
3634 return 0; 3916 return 0;
3635} 3917}
3636 3918
3637static int 3919/* Trigger a scan (look for other cells in the vicinity */
3638orinoco_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 3920static int orinoco_ioctl_setscan(struct net_device *dev,
3921 struct iw_request_info *info,
3922 struct iw_param *srq,
3923 char *extra)
3639{ 3924{
3640 struct orinoco_private *priv = netdev_priv(dev); 3925 struct orinoco_private *priv = netdev_priv(dev);
3641 struct iwreq *wrq = (struct iwreq *)rq; 3926 hermes_t *hw = &priv->hw;
3642 int err = 0; 3927 int err = 0;
3643 int tmp;
3644 int changed = 0;
3645 unsigned long flags; 3928 unsigned long flags;
3646 3929
3647 TRACE_ENTER(dev->name); 3930 /* Note : you may have realised that, as this is a SET operation,
3931 * this is priviledged and therefore a normal user can't
3932 * perform scanning.
3933 * This is not an error, while the device perform scanning,
3934 * traffic doesn't flow, so it's a perfect DoS...
3935 * Jean II */
3648 3936
3649 /* In theory, we could allow most of the the SET stuff to be 3937 if (orinoco_lock(priv, &flags) != 0)
3650 * done. In practice, the lapse of time at startup when the 3938 return -EBUSY;
3651 * card is not ready is very short, so why bother... Note
3652 * that netif_device_present is different from up/down
3653 * (ifconfig), when the device is not yet up, it is usually
3654 * already ready... Jean II */
3655 if (! netif_device_present(dev))
3656 return -ENODEV;
3657 3939
3658 switch (cmd) { 3940 /* Scanning with port 0 disabled would fail */
3659 case SIOCGIWNAME: 3941 if (!netif_running(dev)) {
3660 strcpy(wrq->u.name, "IEEE 802.11-DS"); 3942 err = -ENETDOWN;
3661 break; 3943 goto out;
3662 3944 }
3663 case SIOCGIWAP:
3664 wrq->u.ap_addr.sa_family = ARPHRD_ETHER;
3665 err = orinoco_hw_get_bssid(priv, wrq->u.ap_addr.sa_data);
3666 break;
3667 3945
3668 case SIOCGIWRANGE: 3946 /* In monitor mode, the scan results are always empty.
3669 err = orinoco_ioctl_getiwrange(dev, &wrq->u.data); 3947 * Probe responses are passed to the driver as received
3670 break; 3948 * frames and could be processed in software. */
3949 if (priv->iw_mode == IW_MODE_MONITOR) {
3950 err = -EOPNOTSUPP;
3951 goto out;
3952 }
3671 3953
3672 case SIOCSIWMODE: 3954 /* Note : because we don't lock out the irq handler, the way
3673 if (orinoco_lock(priv, &flags) != 0) 3955 * we access scan variables in priv is critical.
3674 return -EBUSY; 3956 * o scan_inprogress : not touched by irq handler
3675 switch (wrq->u.mode) { 3957 * o scan_mode : not touched by irq handler
3676 case IW_MODE_ADHOC: 3958 * o scan_result : irq is strict producer, non-irq is strict
3677 if (! (priv->has_ibss || priv->has_port3) ) 3959 * consumer.
3678 err = -EINVAL; 3960 * o scan_len : synchronised with scan_result
3679 else { 3961 * Before modifying anything on those variables, please think hard !
3680 priv->iw_mode = IW_MODE_ADHOC; 3962 * Jean II */
3681 changed = 1;
3682 }
3683 break;
3684 3963
3685 case IW_MODE_INFRA: 3964 /* If there is still some left-over scan results, get rid of it */
3686 priv->iw_mode = IW_MODE_INFRA; 3965 if (priv->scan_result != NULL) {
3687 changed = 1; 3966 /* What's likely is that a client did crash or was killed
3688 break; 3967 * between triggering the scan request and reading the
3968 * results, so we need to reset everything.
3969 * Some clients that are too slow may suffer from that...
3970 * Jean II */
3971 kfree(priv->scan_result);
3972 priv->scan_result = NULL;
3973 }
3689 3974
3690 default: 3975 /* Save flags */
3691 err = -EINVAL; 3976 priv->scan_mode = srq->flags;
3692 break;
3693 }
3694 set_port_type(priv);
3695 orinoco_unlock(priv, &flags);
3696 break;
3697 3977
3698 case SIOCGIWMODE: 3978 /* Always trigger scanning, even if it's in progress.
3699 if (orinoco_lock(priv, &flags) != 0) 3979 * This way, if the info frame get lost, we will recover somewhat
3700 return -EBUSY; 3980 * gracefully - Jean II */
3701 wrq->u.mode = priv->iw_mode;
3702 orinoco_unlock(priv, &flags);
3703 break;
3704 3981
3705 case SIOCSIWENCODE: 3982 if (priv->has_hostscan) {
3706 err = orinoco_ioctl_setiwencode(dev, &wrq->u.encoding); 3983 switch (priv->firmware_type) {
3707 if (! err) 3984 case FIRMWARE_TYPE_SYMBOL:
3708 changed = 1; 3985 err = hermes_write_wordrec(hw, USER_BAP,
3986 HERMES_RID_CNFHOSTSCAN_SYMBOL,
3987 HERMES_HOSTSCAN_SYMBOL_ONCE |
3988 HERMES_HOSTSCAN_SYMBOL_BCAST);
3989 break;
3990 case FIRMWARE_TYPE_INTERSIL: {
3991 u16 req[3];
3992
3993 req[0] = cpu_to_le16(0x3fff); /* All channels */
3994 req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */
3995 req[2] = 0; /* Any ESSID */
3996 err = HERMES_WRITE_RECORD(hw, USER_BAP,
3997 HERMES_RID_CNFHOSTSCAN, &req);
3998 }
3709 break; 3999 break;
4000 case FIRMWARE_TYPE_AGERE:
4001 err = hermes_write_wordrec(hw, USER_BAP,
4002 HERMES_RID_CNFSCANSSID_AGERE,
4003 0); /* Any ESSID */
4004 if (err)
4005 break;
3710 4006
3711 case SIOCGIWENCODE: 4007 err = hermes_inquire(hw, HERMES_INQ_SCAN);
3712 if (! capable(CAP_NET_ADMIN)) {
3713 err = -EPERM;
3714 break; 4008 break;
3715 } 4009 }
4010 } else
4011 err = hermes_inquire(hw, HERMES_INQ_SCAN);
3716 4012
3717 err = orinoco_ioctl_getiwencode(dev, &wrq->u.encoding); 4013 /* One more client */
3718 break; 4014 if (! err)
3719 4015 priv->scan_inprogress = 1;
3720 case SIOCSIWESSID:
3721 err = orinoco_ioctl_setessid(dev, &wrq->u.essid);
3722 if (! err)
3723 changed = 1;
3724 break;
3725 4016
3726 case SIOCGIWESSID: 4017 out:
3727 err = orinoco_ioctl_getessid(dev, &wrq->u.essid); 4018 orinoco_unlock(priv, &flags);
3728 break; 4019 return err;
4020}
3729 4021
3730 case SIOCSIWNICKN: 4022/* Translate scan data returned from the card to a card independant
3731 err = orinoco_ioctl_setnick(dev, &wrq->u.data); 4023 * format that the Wireless Tools will understand - Jean II */
3732 if (! err) 4024static inline int orinoco_translate_scan(struct net_device *dev,
3733 changed = 1; 4025 char *buffer,
3734 break; 4026 char *scan,
4027 int scan_len)
4028{
4029 struct orinoco_private *priv = netdev_priv(dev);
4030 int offset; /* In the scan data */
4031 union hermes_scan_info *atom;
4032 int atom_len;
4033 u16 capabilities;
4034 u16 channel;
4035 struct iw_event iwe; /* Temporary buffer */
4036 char * current_ev = buffer;
4037 char * end_buf = buffer + IW_SCAN_MAX_DATA;
3735 4038
3736 case SIOCGIWNICKN: 4039 switch (priv->firmware_type) {
3737 err = orinoco_ioctl_getnick(dev, &wrq->u.data); 4040 case FIRMWARE_TYPE_AGERE:
4041 atom_len = sizeof(struct agere_scan_apinfo);
4042 offset = 0;
3738 break; 4043 break;
3739 4044 case FIRMWARE_TYPE_SYMBOL:
3740 case SIOCGIWFREQ: 4045 /* Lack of documentation necessitates this hack.
3741 tmp = orinoco_hw_get_freq(priv); 4046 * Different firmwares have 68 or 76 byte long atoms.
3742 if (tmp < 0) { 4047 * We try modulo first. If the length divides by both,
3743 err = tmp; 4048 * we check what would be the channel in the second
3744 } else { 4049 * frame for a 68-byte atom. 76-byte atoms have 0 there.
3745 wrq->u.freq.m = tmp; 4050 * Valid channel cannot be 0. */
3746 wrq->u.freq.e = 1; 4051 if (scan_len % 76)
3747 } 4052 atom_len = 68;
4053 else if (scan_len % 68)
4054 atom_len = 76;
4055 else if (scan_len >= 1292 && scan[68] == 0)
4056 atom_len = 76;
4057 else
4058 atom_len = 68;
4059 offset = 0;
3748 break; 4060 break;
3749 4061 case FIRMWARE_TYPE_INTERSIL:
3750 case SIOCSIWFREQ: 4062 offset = 4;
3751 err = orinoco_ioctl_setfreq(dev, &wrq->u.freq); 4063 if (priv->has_hostscan)
3752 if (! err) 4064 atom_len = scan[0] + (scan[1] << 8);
3753 changed = 1; 4065 else
4066 atom_len = offsetof(struct prism2_scan_apinfo, atim);
3754 break; 4067 break;
4068 default:
4069 return 0;
4070 }
3755 4071
3756 case SIOCGIWSENS: 4072 /* Check that we got an whole number of atoms */
3757 err = orinoco_ioctl_getsens(dev, &wrq->u.sens); 4073 if ((scan_len - offset) % atom_len) {
3758 break; 4074 printk(KERN_ERR "%s: Unexpected scan data length %d, "
4075 "atom_len %d, offset %d\n", dev->name, scan_len,
4076 atom_len, offset);
4077 return 0;
4078 }
3759 4079
3760 case SIOCSIWSENS: 4080 /* Read the entries one by one */
3761 err = orinoco_ioctl_setsens(dev, &wrq->u.sens); 4081 for (; offset + atom_len <= scan_len; offset += atom_len) {
3762 if (! err) 4082 /* Get next atom */
3763 changed = 1; 4083 atom = (union hermes_scan_info *) (scan + offset);
3764 break; 4084
4085 /* First entry *MUST* be the AP MAC address */
4086 iwe.cmd = SIOCGIWAP;
4087 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
4088 memcpy(iwe.u.ap_addr.sa_data, atom->a.bssid, ETH_ALEN);
4089 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
4090
4091 /* Other entries will be displayed in the order we give them */
4092
4093 /* Add the ESSID */
4094 iwe.u.data.length = le16_to_cpu(atom->a.essid_len);
4095 if (iwe.u.data.length > 32)
4096 iwe.u.data.length = 32;
4097 iwe.cmd = SIOCGIWESSID;
4098 iwe.u.data.flags = 1;
4099 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, atom->a.essid);
4100
4101 /* Add mode */
4102 iwe.cmd = SIOCGIWMODE;
4103 capabilities = le16_to_cpu(atom->a.capabilities);
4104 if (capabilities & 0x3) {
4105 if (capabilities & 0x1)
4106 iwe.u.mode = IW_MODE_MASTER;
4107 else
4108 iwe.u.mode = IW_MODE_ADHOC;
4109 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
4110 }
3765 4111
3766 case SIOCGIWRTS: 4112 channel = atom->s.channel;
3767 wrq->u.rts.value = priv->rts_thresh; 4113 if ( (channel >= 1) && (channel <= NUM_CHANNELS) ) {
3768 wrq->u.rts.disabled = (wrq->u.rts.value == 2347); 4114 /* Add frequency */
3769 wrq->u.rts.fixed = 1; 4115 iwe.cmd = SIOCGIWFREQ;
3770 break; 4116 iwe.u.freq.m = channel_frequency[channel-1] * 100000;
4117 iwe.u.freq.e = 1;
4118 current_ev = iwe_stream_add_event(current_ev, end_buf,
4119 &iwe, IW_EV_FREQ_LEN);
4120 }
3771 4121
3772 case SIOCSIWRTS: 4122 /* Add quality statistics */
3773 err = orinoco_ioctl_setrts(dev, &wrq->u.rts); 4123 iwe.cmd = IWEVQUAL;
3774 if (! err) 4124 iwe.u.qual.updated = 0x10; /* no link quality */
3775 changed = 1; 4125 iwe.u.qual.level = (__u8) le16_to_cpu(atom->a.level) - 0x95;
3776 break; 4126 iwe.u.qual.noise = (__u8) le16_to_cpu(atom->a.noise) - 0x95;
4127 /* Wireless tools prior to 27.pre22 will show link quality
4128 * anyway, so we provide a reasonable value. */
4129 if (iwe.u.qual.level > iwe.u.qual.noise)
4130 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
4131 else
4132 iwe.u.qual.qual = 0;
4133 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
3777 4134
3778 case SIOCSIWFRAG: 4135 /* Add encryption capability */
3779 err = orinoco_ioctl_setfrag(dev, &wrq->u.frag); 4136 iwe.cmd = SIOCGIWENCODE;
3780 if (! err) 4137 if (capabilities & 0x10)
3781 changed = 1; 4138 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
3782 break; 4139 else
4140 iwe.u.data.flags = IW_ENCODE_DISABLED;
4141 iwe.u.data.length = 0;
4142 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, atom->a.essid);
4143
4144 /* Bit rate is not available in Lucent/Agere firmwares */
4145 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
4146 char * current_val = current_ev + IW_EV_LCP_LEN;
4147 int i;
4148 int step;
4149
4150 if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)
4151 step = 2;
4152 else
4153 step = 1;
4154
4155 iwe.cmd = SIOCGIWRATE;
4156 /* Those two flags are ignored... */
4157 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
4158 /* Max 10 values */
4159 for (i = 0; i < 10; i += step) {
4160 /* NULL terminated */
4161 if (atom->p.rates[i] == 0x0)
4162 break;
4163 /* Bit rate given in 500 kb/s units (+ 0x80) */
4164 iwe.u.bitrate.value = ((atom->p.rates[i] & 0x7f) * 500000);
4165 current_val = iwe_stream_add_value(current_ev, current_val,
4166 end_buf, &iwe,
4167 IW_EV_PARAM_LEN);
4168 }
4169 /* Check if we added any event */
4170 if ((current_val - current_ev) > IW_EV_LCP_LEN)
4171 current_ev = current_val;
4172 }
3783 4173
3784 case SIOCGIWFRAG: 4174 /* The other data in the scan result are not really
3785 err = orinoco_ioctl_getfrag(dev, &wrq->u.frag); 4175 * interesting, so for now drop it - Jean II */
3786 break; 4176 }
4177 return current_ev - buffer;
4178}
3787 4179
3788 case SIOCSIWRATE: 4180/* Return results of a scan */
3789 err = orinoco_ioctl_setrate(dev, &wrq->u.bitrate); 4181static int orinoco_ioctl_getscan(struct net_device *dev,
3790 if (! err) 4182 struct iw_request_info *info,
3791 changed = 1; 4183 struct iw_point *srq,
3792 break; 4184 char *extra)
4185{
4186 struct orinoco_private *priv = netdev_priv(dev);
4187 int err = 0;
4188 unsigned long flags;
3793 4189
3794 case SIOCGIWRATE: 4190 if (orinoco_lock(priv, &flags) != 0)
3795 err = orinoco_ioctl_getrate(dev, &wrq->u.bitrate); 4191 return -EBUSY;
3796 break;
3797 4192
3798 case SIOCSIWPOWER: 4193 /* If no results yet, ask to try again later */
3799 err = orinoco_ioctl_setpower(dev, &wrq->u.power); 4194 if (priv->scan_result == NULL) {
3800 if (! err) 4195 if (priv->scan_inprogress)
3801 changed = 1; 4196 /* Important note : we don't want to block the caller
3802 break; 4197 * until results are ready for various reasons.
4198 * First, managing wait queues is complex and racy.
4199 * Second, we grab some rtnetlink lock before comming
4200 * here (in dev_ioctl()).
4201 * Third, we generate an Wireless Event, so the
4202 * caller can wait itself on that - Jean II */
4203 err = -EAGAIN;
4204 else
4205 /* Client error, no scan results...
4206 * The caller need to restart the scan. */
4207 err = -ENODATA;
4208 } else {
4209 /* We have some results to push back to user space */
4210
4211 /* Translate to WE format */
4212 srq->length = orinoco_translate_scan(dev, extra,
4213 priv->scan_result,
4214 priv->scan_len);
4215
4216 /* Return flags */
4217 srq->flags = (__u16) priv->scan_mode;
4218
4219 /* Results are here, so scan no longer in progress */
4220 priv->scan_inprogress = 0;
4221
4222 /* In any case, Scan results will be cleaned up in the
4223 * reset function and when exiting the driver.
4224 * The person triggering the scanning may never come to
4225 * pick the results, so we need to do it in those places.
4226 * Jean II */
4227
4228#ifdef SCAN_SINGLE_READ
4229 /* If you enable this option, only one client (the first
4230 * one) will be able to read the result (and only one
4231 * time). If there is multiple concurent clients that
4232 * want to read scan results, this behavior is not
4233 * advisable - Jean II */
4234 kfree(priv->scan_result);
4235 priv->scan_result = NULL;
4236#endif /* SCAN_SINGLE_READ */
4237 /* Here, if too much time has elapsed since last scan,
4238 * we may want to clean up scan results... - Jean II */
4239 }
4240
4241 orinoco_unlock(priv, &flags);
4242 return err;
4243}
3803 4244
3804 case SIOCGIWPOWER: 4245/* Commit handler, called after set operations */
3805 err = orinoco_ioctl_getpower(dev, &wrq->u.power); 4246static int orinoco_ioctl_commit(struct net_device *dev,
3806 break; 4247 struct iw_request_info *info,
4248 void *wrqu,
4249 char *extra)
4250{
4251 struct orinoco_private *priv = netdev_priv(dev);
4252 struct hermes *hw = &priv->hw;
4253 unsigned long flags;
4254 int err = 0;
3807 4255
3808 case SIOCGIWTXPOW: 4256 if (!priv->open)
3809 /* The card only supports one tx power, so this is easy */ 4257 return 0;
3810 wrq->u.txpower.value = 15; /* dBm */
3811 wrq->u.txpower.fixed = 1;
3812 wrq->u.txpower.disabled = 0;
3813 wrq->u.txpower.flags = IW_TXPOW_DBM;
3814 break;
3815 4258
3816 case SIOCSIWRETRY: 4259 if (priv->broken_disableport) {
3817 err = -EOPNOTSUPP; 4260 orinoco_reset(dev);
3818 break; 4261 return 0;
4262 }
3819 4263
3820 case SIOCGIWRETRY: 4264 if (orinoco_lock(priv, &flags) != 0)
3821 err = orinoco_ioctl_getretry(dev, &wrq->u.retry); 4265 return err;
3822 break;
3823 4266
3824 case SIOCSIWSPY: 4267 err = hermes_disable_port(hw, 0);
3825 err = orinoco_ioctl_setspy(dev, &wrq->u.data); 4268 if (err) {
3826 break; 4269 printk(KERN_WARNING "%s: Unable to disable port "
4270 "while reconfiguring card\n", dev->name);
4271 priv->broken_disableport = 1;
4272 goto out;
4273 }
3827 4274
3828 case SIOCGIWSPY: 4275 err = __orinoco_program_rids(dev);
3829 err = orinoco_ioctl_getspy(dev, &wrq->u.data); 4276 if (err) {
3830 break; 4277 printk(KERN_WARNING "%s: Unable to reconfigure card\n",
4278 dev->name);
4279 goto out;
4280 }
3831 4281
3832 case SIOCGIWPRIV: 4282 err = hermes_enable_port(hw, 0);
3833 if (wrq->u.data.pointer) { 4283 if (err) {
3834 struct iw_priv_args privtab[] = { 4284 printk(KERN_WARNING "%s: Unable to enable port while reconfiguring card\n",
3835 { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" }, 4285 dev->name);
3836 { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" }, 4286 goto out;
3837 { SIOCIWFIRSTPRIV + 0x2, 4287 }
3838 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3839 0, "set_port3" },
3840 { SIOCIWFIRSTPRIV + 0x3, 0,
3841 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3842 "get_port3" },
3843 { SIOCIWFIRSTPRIV + 0x4,
3844 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3845 0, "set_preamble" },
3846 { SIOCIWFIRSTPRIV + 0x5, 0,
3847 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3848 "get_preamble" },
3849 { SIOCIWFIRSTPRIV + 0x6,
3850 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3851 0, "set_ibssport" },
3852 { SIOCIWFIRSTPRIV + 0x7, 0,
3853 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3854 "get_ibssport" },
3855 };
3856
3857 wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]);
3858 if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab)))
3859 err = -EFAULT;
3860 }
3861 break;
3862
3863 case SIOCIWFIRSTPRIV + 0x0: /* force_reset */
3864 case SIOCIWFIRSTPRIV + 0x1: /* card_reset */
3865 if (! capable(CAP_NET_ADMIN)) {
3866 err = -EPERM;
3867 break;
3868 }
3869
3870 printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
3871 4288
4289 out:
4290 if (err) {
4291 printk(KERN_WARNING "%s: Resetting instead...\n", dev->name);
3872 schedule_work(&priv->reset_work); 4292 schedule_work(&priv->reset_work);
3873 break; 4293 err = 0;
3874 4294 }
3875 case SIOCIWFIRSTPRIV + 0x2: /* set_port3 */
3876 if (! capable(CAP_NET_ADMIN)) {
3877 err = -EPERM;
3878 break;
3879 }
3880
3881 err = orinoco_ioctl_setport3(dev, wrq);
3882 if (! err)
3883 changed = 1;
3884 break;
3885 4295
3886 case SIOCIWFIRSTPRIV + 0x3: /* get_port3 */ 4296 orinoco_unlock(priv, &flags);
3887 err = orinoco_ioctl_getport3(dev, wrq); 4297 return err;
3888 break; 4298}
3889 4299
3890 case SIOCIWFIRSTPRIV + 0x4: /* set_preamble */ 4300static const struct iw_priv_args orinoco_privtab[] = {
3891 if (! capable(CAP_NET_ADMIN)) { 4301 { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
3892 err = -EPERM; 4302 { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
3893 break; 4303 { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3894 } 4304 0, "set_port3" },
4305 { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4306 "get_port3" },
4307 { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4308 0, "set_preamble" },
4309 { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4310 "get_preamble" },
4311 { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4312 0, "set_ibssport" },
4313 { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4314 "get_ibssport" },
4315 { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
4316 "get_rid" },
4317};
3895 4318
3896 /* 802.11b has recently defined some short preamble.
3897 * Basically, the Phy header has been reduced in size.
3898 * This increase performance, especially at high rates
3899 * (the preamble is transmitted at 1Mb/s), unfortunately
3900 * this give compatibility troubles... - Jean II */
3901 if(priv->has_preamble) {
3902 int val = *( (int *) wrq->u.name );
3903
3904 if (orinoco_lock(priv, &flags) != 0)
3905 return -EBUSY;
3906 if (val)
3907 priv->preamble = 1;
3908 else
3909 priv->preamble = 0;
3910 orinoco_unlock(priv, &flags);
3911 changed = 1;
3912 } else
3913 err = -EOPNOTSUPP;
3914 break;
3915 4319
3916 case SIOCIWFIRSTPRIV + 0x5: /* get_preamble */ 4320/*
3917 if(priv->has_preamble) { 4321 * Structures to export the Wireless Handlers
3918 int *val = (int *)wrq->u.name; 4322 */
3919 4323
3920 if (orinoco_lock(priv, &flags) != 0) 4324static const iw_handler orinoco_handler[] = {
3921 return -EBUSY; 4325 [SIOCSIWCOMMIT-SIOCIWFIRST] (iw_handler) orinoco_ioctl_commit,
3922 *val = priv->preamble; 4326 [SIOCGIWNAME -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getname,
3923 orinoco_unlock(priv, &flags); 4327 [SIOCSIWFREQ -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setfreq,
3924 } else 4328 [SIOCGIWFREQ -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getfreq,
3925 err = -EOPNOTSUPP; 4329 [SIOCSIWMODE -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setmode,
3926 break; 4330 [SIOCGIWMODE -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getmode,
3927 case SIOCIWFIRSTPRIV + 0x6: /* set_ibssport */ 4331 [SIOCSIWSENS -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setsens,
3928 if (! capable(CAP_NET_ADMIN)) { 4332 [SIOCGIWSENS -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getsens,
3929 err = -EPERM; 4333 [SIOCGIWRANGE -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getiwrange,
3930 break; 4334 [SIOCSIWSPY -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setspy,
3931 } 4335 [SIOCGIWSPY -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getspy,
4336 [SIOCSIWAP -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setwap,
4337 [SIOCGIWAP -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getwap,
4338 [SIOCSIWSCAN -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setscan,
4339 [SIOCGIWSCAN -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getscan,
4340 [SIOCSIWESSID -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setessid,
4341 [SIOCGIWESSID -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getessid,
4342 [SIOCSIWNICKN -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setnick,
4343 [SIOCGIWNICKN -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getnick,
4344 [SIOCSIWRATE -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setrate,
4345 [SIOCGIWRATE -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getrate,
4346 [SIOCSIWRTS -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setrts,
4347 [SIOCGIWRTS -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getrts,
4348 [SIOCSIWFRAG -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setfrag,
4349 [SIOCGIWFRAG -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getfrag,
4350 [SIOCGIWRETRY -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getretry,
4351 [SIOCSIWENCODE-SIOCIWFIRST] (iw_handler) orinoco_ioctl_setiwencode,
4352 [SIOCGIWENCODE-SIOCIWFIRST] (iw_handler) orinoco_ioctl_getiwencode,
4353 [SIOCSIWPOWER -SIOCIWFIRST] (iw_handler) orinoco_ioctl_setpower,
4354 [SIOCGIWPOWER -SIOCIWFIRST] (iw_handler) orinoco_ioctl_getpower,
4355};
3932 4356
3933 err = orinoco_ioctl_setibssport(dev, wrq);
3934 if (! err)
3935 changed = 1;
3936 break;
3937 4357
3938 case SIOCIWFIRSTPRIV + 0x7: /* get_ibssport */ 4358/*
3939 err = orinoco_ioctl_getibssport(dev, wrq); 4359 Added typecasting since we no longer use iwreq_data -- Moustafa
3940 break; 4360 */
4361static const iw_handler orinoco_private_handler[] = {
4362 [0] (iw_handler) orinoco_ioctl_reset,
4363 [1] (iw_handler) orinoco_ioctl_reset,
4364 [2] (iw_handler) orinoco_ioctl_setport3,
4365 [3] (iw_handler) orinoco_ioctl_getport3,
4366 [4] (iw_handler) orinoco_ioctl_setpreamble,
4367 [5] (iw_handler) orinoco_ioctl_getpreamble,
4368 [6] (iw_handler) orinoco_ioctl_setibssport,
4369 [7] (iw_handler) orinoco_ioctl_getibssport,
4370 [9] (iw_handler) orinoco_ioctl_getrid,
4371};
3941 4372
3942 default: 4373static const struct iw_handler_def orinoco_handler_def = {
3943 err = -EOPNOTSUPP; 4374 .num_standard = ARRAY_SIZE(orinoco_handler),
3944 } 4375 .num_private = ARRAY_SIZE(orinoco_private_handler),
3945 4376 .num_private_args = ARRAY_SIZE(orinoco_privtab),
3946 if (! err && changed && netif_running(dev)) { 4377 .standard = orinoco_handler,
3947 err = orinoco_reconfigure(dev); 4378 .private = orinoco_private_handler,
3948 } 4379 .private_args = orinoco_privtab,
4380};
3949 4381
3950 TRACE_EXIT(dev->name); 4382static void orinoco_get_drvinfo(struct net_device *dev,
4383 struct ethtool_drvinfo *info)
4384{
4385 struct orinoco_private *priv = netdev_priv(dev);
3951 4386
3952 return err; 4387 strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
4388 strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
4389 strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
4390 if (dev->class_dev.dev)
4391 strncpy(info->bus_info, dev->class_dev.dev->bus_id,
4392 sizeof(info->bus_info) - 1);
4393 else
4394 snprintf(info->bus_info, sizeof(info->bus_info) - 1,
4395 "PCMCIA %p", priv->hw.iobase);
3953} 4396}
3954 4397
4398static struct ethtool_ops orinoco_ethtool_ops = {
4399 .get_drvinfo = orinoco_get_drvinfo,
4400 .get_link = ethtool_op_get_link,
4401};
3955 4402
3956/********************************************************************/ 4403/********************************************************************/
3957/* Debugging */ 4404/* Debugging */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index f749b50d1088..2f213a7103fe 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -7,7 +7,7 @@
7#ifndef _ORINOCO_H 7#ifndef _ORINOCO_H
8#define _ORINOCO_H 8#define _ORINOCO_H
9 9
10#define DRIVER_VERSION "0.14alpha2" 10#define DRIVER_VERSION "0.15rc2"
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
@@ -22,6 +22,8 @@
22 22
23#define WIRELESS_SPY // enable iwspy support 23#define WIRELESS_SPY // enable iwspy support
24 24
25#define MAX_SCAN_LEN 4096
26
25#define ORINOCO_MAX_KEY_SIZE 14 27#define ORINOCO_MAX_KEY_SIZE 14
26#define ORINOCO_MAX_KEYS 4 28#define ORINOCO_MAX_KEYS 4
27 29
@@ -30,6 +32,20 @@ struct orinoco_key {
30 char data[ORINOCO_MAX_KEY_SIZE]; 32 char data[ORINOCO_MAX_KEY_SIZE];
31} __attribute__ ((packed)); 33} __attribute__ ((packed));
32 34
35struct header_struct {
36 /* 802.3 */
37 u8 dest[ETH_ALEN];
38 u8 src[ETH_ALEN];
39 u16 len;
40 /* 802.2 */
41 u8 dsap;
42 u8 ssap;
43 u8 ctrl;
44 /* SNAP */
45 u8 oui[3];
46 u16 ethertype;
47} __attribute__ ((packed));
48
33typedef enum { 49typedef enum {
34 FIRMWARE_TYPE_AGERE, 50 FIRMWARE_TYPE_AGERE,
35 FIRMWARE_TYPE_INTERSIL, 51 FIRMWARE_TYPE_INTERSIL,
@@ -48,6 +64,8 @@ struct orinoco_private {
48 /* driver state */ 64 /* driver state */
49 int open; 65 int open;
50 u16 last_linkstatus; 66 u16 last_linkstatus;
67 struct work_struct join_work;
68 struct work_struct wevent_work;
51 69
52 /* Net device stuff */ 70 /* Net device stuff */
53 struct net_device *ndev; 71 struct net_device *ndev;
@@ -74,7 +92,9 @@ struct orinoco_private {
74 unsigned int has_pm:1; 92 unsigned int has_pm:1;
75 unsigned int has_preamble:1; 93 unsigned int has_preamble:1;
76 unsigned int has_sensitivity:1; 94 unsigned int has_sensitivity:1;
95 unsigned int has_hostscan:1;
77 unsigned int broken_disableport:1; 96 unsigned int broken_disableport:1;
97 unsigned int broken_monitor:1;
78 98
79 /* Configuration paramaters */ 99 /* Configuration paramaters */
80 u32 iw_mode; 100 u32 iw_mode;
@@ -84,6 +104,8 @@ struct orinoco_private {
84 int bitratemode; 104 int bitratemode;
85 char nick[IW_ESSID_MAX_SIZE+1]; 105 char nick[IW_ESSID_MAX_SIZE+1];
86 char desired_essid[IW_ESSID_MAX_SIZE+1]; 106 char desired_essid[IW_ESSID_MAX_SIZE+1];
107 char desired_bssid[ETH_ALEN];
108 int bssid_fixed;
87 u16 frag_thresh, mwo_robust; 109 u16 frag_thresh, mwo_robust;
88 u16 channel; 110 u16 channel;
89 u16 ap_density, rts_thresh; 111 u16 ap_density, rts_thresh;
@@ -98,6 +120,12 @@ struct orinoco_private {
98 /* Configuration dependent variables */ 120 /* Configuration dependent variables */
99 int port_type, createibss; 121 int port_type, createibss;
100 int promiscuous, mc_count; 122 int promiscuous, mc_count;
123
124 /* Scanning support */
125 int scan_inprogress; /* Scan pending... */
126 u32 scan_mode; /* Type of scan done */
127 char * scan_result; /* Result of previous scan */
128 int scan_len; /* Lenght of result */
101}; 129};
102 130
103#ifdef ORINOCO_DEBUG 131#ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 74a8227256aa..1cc1492083c9 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -31,7 +31,6 @@
31#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
32#include <linux/wireless.h> 32#include <linux/wireless.h>
33 33
34#include <pcmcia/version.h>
35#include <pcmcia/cs_types.h> 34#include <pcmcia/cs_types.h>
36#include <pcmcia/cs.h> 35#include <pcmcia/cs.h>
37#include <pcmcia/cistpl.h> 36#include <pcmcia/cistpl.h>
@@ -186,11 +185,6 @@ orinoco_cs_attach(void)
186 dev_list = link; 185 dev_list = link;
187 186
188 client_reg.dev_info = &dev_info; 187 client_reg.dev_info = &dev_info;
189 client_reg.EventMask =
190 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
191 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
192 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
193 client_reg.event_handler = &orinoco_cs_event;
194 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 188 client_reg.Version = 0x0210; /* FIXME: what does this mean? */
195 client_reg.event_callback_args.client_data = link; 189 client_reg.event_callback_args.client_data = link;
196 190
@@ -608,13 +602,63 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
608 " (David Gibson <hermes@gibson.dropbear.id.au>, " 602 " (David Gibson <hermes@gibson.dropbear.id.au>, "
609 "Pavel Roskin <proski@gnu.org>, et al)"; 603 "Pavel Roskin <proski@gnu.org>, et al)";
610 604
605static struct pcmcia_device_id orinoco_cs_ids[] = {
606 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
607 PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001),
608 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
609 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002),
610 PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a),
611 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002),
612 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001),
613 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305),
614 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
615 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
616 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673),
617 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
618 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002),
619 PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001),
620 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021),
622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
625 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
626 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
627 PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
628 PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
629 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
630 PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
631 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
632 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
633 PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
634 PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab),
635 PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
636 PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
637 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
638 PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
639 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
640 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
641 PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
642 PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a),
643 PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
644 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
645 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
646 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
647 PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
648 PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6),
649 PCMCIA_DEVICE_NULL,
650};
651MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
652
611static struct pcmcia_driver orinoco_driver = { 653static struct pcmcia_driver orinoco_driver = {
612 .owner = THIS_MODULE, 654 .owner = THIS_MODULE,
613 .drv = { 655 .drv = {
614 .name = DRIVER_NAME, 656 .name = DRIVER_NAME,
615 }, 657 },
616 .attach = orinoco_cs_attach, 658 .attach = orinoco_cs_attach,
659 .event = orinoco_cs_event,
617 .detach = orinoco_cs_detach, 660 .detach = orinoco_cs_detach,
661 .id_table = orinoco_cs_ids,
618}; 662};
619 663
620static int __init 664static int __init
diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c
index 4481ec18c5a0..adc7499136dc 100644
--- a/drivers/net/wireless/prism54/isl_38xx.c
+++ b/drivers/net/wireless/prism54/isl_38xx.c
@@ -112,10 +112,10 @@ isl38xx_handle_wakeup(isl38xx_control_block *control_block,
112void 112void
113isl38xx_trigger_device(int asleep, void __iomem *device_base) 113isl38xx_trigger_device(int asleep, void __iomem *device_base)
114{ 114{
115 struct timeval current_time;
116 u32 reg, counter = 0; 115 u32 reg, counter = 0;
117 116
118#if VERBOSE > SHOW_ERROR_MESSAGES 117#if VERBOSE > SHOW_ERROR_MESSAGES
118 struct timeval current_time;
119 DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); 119 DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n");
120#endif 120#endif
121 121
@@ -126,11 +126,11 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
126 do_gettimeofday(&current_time); 126 do_gettimeofday(&current_time);
127 DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n", 127 DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n",
128 current_time.tv_sec, (long)current_time.tv_usec); 128 current_time.tv_sec, (long)current_time.tv_usec);
129#endif
130 129
131 DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", 130 DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n",
132 current_time.tv_sec, (long)current_time.tv_usec, 131 current_time.tv_sec, (long)current_time.tv_usec,
133 readl(device_base + ISL38XX_CTRL_STAT_REG)); 132 readl(device_base + ISL38XX_CTRL_STAT_REG));
133#endif
134 udelay(ISL38XX_WRITEIO_DELAY); 134 udelay(ISL38XX_WRITEIO_DELAY);
135 135
136 reg = readl(device_base + ISL38XX_INT_IDENT_REG); 136 reg = readl(device_base + ISL38XX_INT_IDENT_REG);
@@ -148,10 +148,12 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
148 counter++; 148 counter++;
149 } 149 }
150 150
151#if VERBOSE > SHOW_ERROR_MESSAGES
151 DEBUG(SHOW_TRACING, 152 DEBUG(SHOW_TRACING,
152 "%08li.%08li Device register read %08x\n", 153 "%08li.%08li Device register read %08x\n",
153 current_time.tv_sec, (long)current_time.tv_usec, 154 current_time.tv_sec, (long)current_time.tv_usec,
154 readl(device_base + ISL38XX_CTRL_STAT_REG)); 155 readl(device_base + ISL38XX_CTRL_STAT_REG));
156#endif
155 udelay(ISL38XX_WRITEIO_DELAY); 157 udelay(ISL38XX_WRITEIO_DELAY);
156 158
157#if VERBOSE > SHOW_ERROR_MESSAGES 159#if VERBOSE > SHOW_ERROR_MESSAGES
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 6e5bda56b8f8..0e0ba614259a 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -46,7 +46,6 @@
46#include <linux/skbuff.h> 46#include <linux/skbuff.h>
47#include <linux/ethtool.h> 47#include <linux/ethtool.h>
48 48
49#include <pcmcia/version.h>
50#include <pcmcia/cs_types.h> 49#include <pcmcia/cs_types.h>
51#include <pcmcia/cs.h> 50#include <pcmcia/cs.h>
52#include <pcmcia/cistpl.h> 51#include <pcmcia/cistpl.h>
@@ -393,11 +392,6 @@ static dev_link_t *ray_attach(void)
393 link->next = dev_list; 392 link->next = dev_list;
394 dev_list = link; 393 dev_list = link;
395 client_reg.dev_info = &dev_info; 394 client_reg.dev_info = &dev_info;
396 client_reg.EventMask =
397 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
398 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
399 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
400 client_reg.event_handler = &ray_event;
401 client_reg.Version = 0x0210; 395 client_reg.Version = 0x0210;
402 client_reg.event_callback_args.client_data = link; 396 client_reg.event_callback_args.client_data = link;
403 397
@@ -2904,13 +2898,21 @@ static int write_int(struct file *file, const char __user *buffer, unsigned long
2904} 2898}
2905#endif 2899#endif
2906 2900
2901static struct pcmcia_device_id ray_ids[] = {
2902 PCMCIA_DEVICE_MANF_CARD(0x01a6, 0x0000),
2903 PCMCIA_DEVICE_NULL,
2904};
2905MODULE_DEVICE_TABLE(pcmcia, ray_ids);
2906
2907static struct pcmcia_driver ray_driver = { 2907static struct pcmcia_driver ray_driver = {
2908 .owner = THIS_MODULE, 2908 .owner = THIS_MODULE,
2909 .drv = { 2909 .drv = {
2910 .name = "ray_cs", 2910 .name = "ray_cs",
2911 }, 2911 },
2912 .attach = ray_attach, 2912 .attach = ray_attach,
2913 .event = ray_event,
2913 .detach = ray_detach, 2914 .detach = ray_detach,
2915 .id_table = ray_ids,
2914}; 2916};
2915 2917
2916static int __init init_ray_cs(void) 2918static int __init init_ray_cs(void)
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ec8cf29ffced..6c42b573a95a 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2828,7 +2828,7 @@ static void __exit strip_exit_driver(void)
2828 /* Unregister with the /proc/net file here. */ 2828 /* Unregister with the /proc/net file here. */
2829 proc_net_remove("strip"); 2829 proc_net_remove("strip");
2830 2830
2831 if ((i = tty_register_ldisc(N_STRIP, NULL))) 2831 if ((i = tty_unregister_ldisc(N_STRIP)))
2832 printk(KERN_ERR "STRIP: can't unregister line discipline (err = %d)\n", i); 2832 printk(KERN_ERR "STRIP: can't unregister line discipline (err = %d)\n", i);
2833 2833
2834 printk(signoff); 2834 printk(signoff);
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index ec8329788e49..f6130a53b796 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4684,12 +4684,6 @@ wavelan_attach(void)
4684 4684
4685 /* Register with Card Services */ 4685 /* Register with Card Services */
4686 client_reg.dev_info = &dev_info; 4686 client_reg.dev_info = &dev_info;
4687 client_reg.EventMask =
4688 CS_EVENT_REGISTRATION_COMPLETE |
4689 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
4690 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
4691 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
4692 client_reg.event_handler = &wavelan_event;
4693 client_reg.Version = 0x0210; 4687 client_reg.Version = 0x0210;
4694 client_reg.event_callback_args.client_data = link; 4688 client_reg.event_callback_args.client_data = link;
4695 4689
@@ -4889,13 +4883,24 @@ wavelan_event(event_t event, /* The event received */
4889 return 0; 4883 return 0;
4890} 4884}
4891 4885
4886static struct pcmcia_device_id wavelan_ids[] = {
4887 PCMCIA_DEVICE_PROD_ID12("AT&T","WaveLAN/PCMCIA", 0xe7c5affd, 0x1bc50975),
4888 PCMCIA_DEVICE_PROD_ID12("Digital", "RoamAbout/DS", 0x9999ab35, 0x00d05e06),
4889 PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/PCMCIA", 0x23eb9949, 0x1bc50975),
4890 PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/PCMCIA", 0x24358cd4, 0x1bc50975),
4891 PCMCIA_DEVICE_NULL,
4892};
4893MODULE_DEVICE_TABLE(pcmcia, wavelan_ids);
4894
4892static struct pcmcia_driver wavelan_driver = { 4895static struct pcmcia_driver wavelan_driver = {
4893 .owner = THIS_MODULE, 4896 .owner = THIS_MODULE,
4894 .drv = { 4897 .drv = {
4895 .name = "wavelan_cs", 4898 .name = "wavelan_cs",
4896 }, 4899 },
4897 .attach = wavelan_attach, 4900 .attach = wavelan_attach,
4901 .event = wavelan_event,
4898 .detach = wavelan_detach, 4902 .detach = wavelan_detach,
4903 .id_table = wavelan_ids,
4899}; 4904};
4900 4905
4901static int __init 4906static int __init
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index ea2ef8dddb92..677ff71883cb 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -452,7 +452,6 @@
452#include <pcmcia/cistpl.h> 452#include <pcmcia/cistpl.h>
453#include <pcmcia/cisreg.h> 453#include <pcmcia/cisreg.h>
454#include <pcmcia/ds.h> 454#include <pcmcia/ds.h>
455#include <pcmcia/version.h>
456 455
457/* Wavelan declarations */ 456/* Wavelan declarations */
458#include "i82593.h" /* Definitions for the Intel chip */ 457#include "i82593.h" /* Definitions for the Intel chip */
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 1433e5aaf1b4..dd902126d018 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -49,7 +49,6 @@
49 49
50#include <net/iw_handler.h> 50#include <net/iw_handler.h>
51 51
52#include <pcmcia/version.h>
53#include <pcmcia/cs_types.h> 52#include <pcmcia/cs_types.h>
54#include <pcmcia/cs.h> 53#include <pcmcia/cs.h>
55#include <pcmcia/cistpl.h> 54#include <pcmcia/cistpl.h>
@@ -2005,13 +2004,6 @@ static dev_link_t *wl3501_attach(void)
2005 link->next = wl3501_dev_list; 2004 link->next = wl3501_dev_list;
2006 wl3501_dev_list = link; 2005 wl3501_dev_list = link;
2007 client_reg.dev_info = &wl3501_dev_info; 2006 client_reg.dev_info = &wl3501_dev_info;
2008 client_reg.EventMask = CS_EVENT_CARD_INSERTION |
2009 CS_EVENT_RESET_PHYSICAL |
2010 CS_EVENT_CARD_RESET |
2011 CS_EVENT_CARD_REMOVAL |
2012 CS_EVENT_PM_SUSPEND |
2013 CS_EVENT_PM_RESUME;
2014 client_reg.event_handler = wl3501_event;
2015 client_reg.Version = 0x0210; 2007 client_reg.Version = 0x0210;
2016 client_reg.event_callback_args.client_data = link; 2008 client_reg.event_callback_args.client_data = link;
2017 ret = pcmcia_register_client(&link->handle, &client_reg); 2009 ret = pcmcia_register_client(&link->handle, &client_reg);
@@ -2239,13 +2231,21 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args)
2239 return 0; 2231 return 0;
2240} 2232}
2241 2233
2234static struct pcmcia_device_id wl3501_ids[] = {
2235 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001),
2236 PCMCIA_DEVICE_NULL
2237};
2238MODULE_DEVICE_TABLE(pcmcia, wl3501_ids);
2239
2242static struct pcmcia_driver wl3501_driver = { 2240static struct pcmcia_driver wl3501_driver = {
2243 .owner = THIS_MODULE, 2241 .owner = THIS_MODULE,
2244 .drv = { 2242 .drv = {
2245 .name = "wl3501_cs", 2243 .name = "wl3501_cs",
2246 }, 2244 },
2247 .attach = wl3501_attach, 2245 .attach = wl3501_attach,
2248 .detach = wl3501_detach, 2246 .event = wl3501_event,
2247 .detach = wl3501_detach,
2248 .id_table = wl3501_ids,
2249}; 2249};
2250 2250
2251static int __init wl3501_init_module(void) 2251static int __init wl3501_init_module(void)
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 9da925430109..1c2506535f7e 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -786,7 +786,7 @@ static void yellowfin_init_ring(struct net_device *dev)
786 skb->dev = dev; /* Mark as being used by this device. */ 786 skb->dev = dev; /* Mark as being used by this device. */
787 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 787 skb_reserve(skb, 2); /* 16 byte align the IP header. */
788 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 788 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
789 skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 789 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
790 } 790 }
791 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); 791 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP);
792 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 792 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1111,7 +1111,7 @@ static int yellowfin_rx(struct net_device *dev)
1111 pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, 1111 pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr,
1112 yp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1112 yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1113 desc_status = le32_to_cpu(desc->result_status) >> 16; 1113 desc_status = le32_to_cpu(desc->result_status) >> 16;
1114 buf_addr = rx_skb->tail; 1114 buf_addr = rx_skb->data;
1115 data_size = (le32_to_cpu(desc->dbdma_cmd) - 1115 data_size = (le32_to_cpu(desc->dbdma_cmd) -
1116 le32_to_cpu(desc->result_status)) & 0xffff; 1116 le32_to_cpu(desc->result_status)) & 0xffff;
1117 frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); 1117 frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2])));
@@ -1185,7 +1185,7 @@ static int yellowfin_rx(struct net_device *dev)
1185 break; 1185 break;
1186 skb->dev = dev; 1186 skb->dev = dev;
1187 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1187 skb_reserve(skb, 2); /* 16 byte align the IP header */
1188 eth_copy_and_sum(skb, rx_skb->tail, pkt_len, 0); 1188 eth_copy_and_sum(skb, rx_skb->data, pkt_len, 0);
1189 skb_put(skb, pkt_len); 1189 skb_put(skb, pkt_len);
1190 pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, 1190 pci_dma_sync_single_for_device(yp->pci_dev, desc->addr,
1191 yp->rx_buf_sz, 1191 yp->rx_buf_sz,
@@ -1211,7 +1211,7 @@ static int yellowfin_rx(struct net_device *dev)
1211 skb->dev = dev; /* Mark as being used by this device. */ 1211 skb->dev = dev; /* Mark as being used by this device. */
1212 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1212 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
1213 yp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 1213 yp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
1214 skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 1214 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
1215 } 1215 }
1216 yp->rx_ring[entry].dbdma_cmd = cpu_to_le32(CMD_STOP); 1216 yp->rx_ring[entry].dbdma_cmd = cpu_to_le32(CMD_STOP);
1217 yp->rx_ring[entry].result_status = 0; /* Clear complete bit. */ 1217 yp->rx_ring[entry].result_status = 0; /* Clear complete bit. */