diff options
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r-- | drivers/net/hp100.c | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index dd1dc32dc98..03b3df33d81 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | ** hp100.c | 2 | ** hp100.c |
3 | ** HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters | 3 | ** HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters |
4 | ** | 4 | ** |
5 | ** $Id: hp100.c,v 1.58 2001/09/24 18:03:01 perex Exp perex $ | 5 | ** $Id: hp100.c,v 1.58 2001/09/24 18:03:01 perex Exp perex $ |
6 | ** | 6 | ** |
7 | ** Based on the HP100 driver written by Jaroslav Kysela <perex@jcu.cz> | 7 | ** Based on the HP100 driver written by Jaroslav Kysela <perex@jcu.cz> |
8 | ** Extended for new busmaster capable chipsets by | 8 | ** Extended for new busmaster capable chipsets by |
9 | ** Siegfried "Frieder" Loeffler (dg1sek) <floeff@mathematik.uni-stuttgart.de> | 9 | ** Siegfried "Frieder" Loeffler (dg1sek) <floeff@mathematik.uni-stuttgart.de> |
10 | ** | 10 | ** |
11 | ** Maintained by: Jaroslav Kysela <perex@suse.cz> | 11 | ** Maintained by: Jaroslav Kysela <perex@suse.cz> |
12 | ** | 12 | ** |
13 | ** This driver has only been tested with | 13 | ** This driver has only been tested with |
14 | ** -- HP J2585B 10/100 Mbit/s PCI Busmaster | 14 | ** -- HP J2585B 10/100 Mbit/s PCI Busmaster |
15 | ** -- HP J2585A 10/100 Mbit/s PCI | 15 | ** -- HP J2585A 10/100 Mbit/s PCI |
16 | ** -- HP J2970A 10 Mbit/s PCI Combo 10base-T/BNC | 16 | ** -- HP J2970A 10 Mbit/s PCI Combo 10base-T/BNC |
17 | ** -- HP J2973A 10 Mbit/s PCI 10base-T | 17 | ** -- HP J2973A 10 Mbit/s PCI 10base-T |
18 | ** -- HP J2573 10/100 ISA | 18 | ** -- HP J2573 10/100 ISA |
19 | ** -- Compex ReadyLink ENET100-VG4 10/100 Mbit/s PCI / EISA | 19 | ** -- Compex ReadyLink ENET100-VG4 10/100 Mbit/s PCI / EISA |
20 | ** -- Compex FreedomLine 100/VG 10/100 Mbit/s ISA / EISA / PCI | 20 | ** -- Compex FreedomLine 100/VG 10/100 Mbit/s ISA / EISA / PCI |
21 | ** | 21 | ** |
22 | ** but it should also work with the other CASCADE based adapters. | 22 | ** but it should also work with the other CASCADE based adapters. |
23 | ** | 23 | ** |
24 | ** TODO: | 24 | ** TODO: |
@@ -65,7 +65,7 @@ | |||
65 | ** - timing changes in xmit routines, relogin to 100VG hub added when | 65 | ** - timing changes in xmit routines, relogin to 100VG hub added when |
66 | ** driver does reset | 66 | ** driver does reset |
67 | ** - included fix for Compex FreedomLine PCI adapter | 67 | ** - included fix for Compex FreedomLine PCI adapter |
68 | ** | 68 | ** |
69 | ** 1.54 -> 1.55 | 69 | ** 1.54 -> 1.55 |
70 | ** - fixed bad initialization in init_module | 70 | ** - fixed bad initialization in init_module |
71 | ** - added Compex FreedomLine adapter | 71 | ** - added Compex FreedomLine adapter |
@@ -73,10 +73,10 @@ | |||
73 | ** | 73 | ** |
74 | ** 1.53 -> 1.54 | 74 | ** 1.53 -> 1.54 |
75 | ** - added hardware multicast filter support (doesn't work) | 75 | ** - added hardware multicast filter support (doesn't work) |
76 | ** - little changes in hp100_sense_lan routine | 76 | ** - little changes in hp100_sense_lan routine |
77 | ** - added support for Coax and AUI (J2970) | 77 | ** - added support for Coax and AUI (J2970) |
78 | ** - fix for multiple cards and hp100_mode parameter (insmod) | 78 | ** - fix for multiple cards and hp100_mode parameter (insmod) |
79 | ** - fix for shared IRQ | 79 | ** - fix for shared IRQ |
80 | ** | 80 | ** |
81 | ** 1.52 -> 1.53 | 81 | ** 1.52 -> 1.53 |
82 | ** - fixed bug in multicast support | 82 | ** - fixed bug in multicast support |
@@ -111,7 +111,6 @@ | |||
111 | #include <linux/etherdevice.h> | 111 | #include <linux/etherdevice.h> |
112 | #include <linux/skbuff.h> | 112 | #include <linux/skbuff.h> |
113 | #include <linux/types.h> | 113 | #include <linux/types.h> |
114 | #include <linux/config.h> /* for CONFIG_PCI */ | ||
115 | #include <linux/delay.h> | 114 | #include <linux/delay.h> |
116 | #include <linux/init.h> | 115 | #include <linux/init.h> |
117 | #include <linux/bitops.h> | 116 | #include <linux/bitops.h> |
@@ -287,7 +286,7 @@ static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr) | |||
287 | 286 | ||
288 | static inline u_int pdl_map_data(struct hp100_private *lp, void *data) | 287 | static inline u_int pdl_map_data(struct hp100_private *lp, void *data) |
289 | { | 288 | { |
290 | return pci_map_single(lp->pci_dev, data, | 289 | return pci_map_single(lp->pci_dev, data, |
291 | MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); | 290 | MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); |
292 | } | 291 | } |
293 | 292 | ||
@@ -354,7 +353,7 @@ static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) | |||
354 | goto err; | 353 | goto err; |
355 | 354 | ||
356 | for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { | 355 | for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { |
357 | if (!strcmp(hp100_isa_tbl[i], sig)) | 356 | if (!strcmp(hp100_isa_tbl[i], sig)) |
358 | break; | 357 | break; |
359 | 358 | ||
360 | } | 359 | } |
@@ -374,11 +373,11 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) | |||
374 | { | 373 | { |
375 | int err = -ENODEV; | 374 | int err = -ENODEV; |
376 | 375 | ||
377 | /* Probe for a specific ISA address */ | 376 | /* Probe for a specific ISA address */ |
378 | if (addr > 0xff && addr < 0x400) | 377 | if (addr > 0xff && addr < 0x400) |
379 | err = hp100_isa_probe1(dev, addr); | 378 | err = hp100_isa_probe1(dev, addr); |
380 | 379 | ||
381 | else if (addr != 0) | 380 | else if (addr != 0) |
382 | err = -ENXIO; | 381 | err = -ENXIO; |
383 | 382 | ||
384 | else { | 383 | else { |
@@ -449,7 +448,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
449 | if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) | 448 | if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) |
450 | goto out1; | 449 | goto out1; |
451 | 450 | ||
452 | if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) | 451 | if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) |
453 | goto out2; | 452 | goto out2; |
454 | 453 | ||
455 | chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; | 454 | chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; |
@@ -492,7 +491,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
492 | * Use the variable "hp100_mode" upon insmod or as kernel parameter to | 491 | * Use the variable "hp100_mode" upon insmod or as kernel parameter to |
493 | * force driver modes: | 492 | * force driver modes: |
494 | * hp100_mode=1 -> default, use busmaster mode if configured. | 493 | * hp100_mode=1 -> default, use busmaster mode if configured. |
495 | * hp100_mode=2 -> enable shared memory mode | 494 | * hp100_mode=2 -> enable shared memory mode |
496 | * hp100_mode=3 -> force use of i/o mapped mode. | 495 | * hp100_mode=3 -> force use of i/o mapped mode. |
497 | * hp100_mode=4 -> same as 1, but re-set the enable bit on the card. | 496 | * hp100_mode=4 -> same as 1, but re-set the enable bit on the card. |
498 | */ | 497 | */ |
@@ -690,9 +689,9 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
690 | hp100_clear_stats(lp, ioaddr); | 689 | hp100_clear_stats(lp, ioaddr); |
691 | 690 | ||
692 | /* If busmaster mode is wanted, a dma-capable memory area is needed for | 691 | /* If busmaster mode is wanted, a dma-capable memory area is needed for |
693 | * the rx and tx PDLs | 692 | * the rx and tx PDLs |
694 | * PCI cards can access the whole PC memory. Therefore GFP_DMA is not | 693 | * PCI cards can access the whole PC memory. Therefore GFP_DMA is not |
695 | * needed for the allocation of the memory area. | 694 | * needed for the allocation of the memory area. |
696 | */ | 695 | */ |
697 | 696 | ||
698 | /* TODO: We do not need this with old cards, where PDLs are stored | 697 | /* TODO: We do not need this with old cards, where PDLs are stored |
@@ -719,7 +718,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
719 | } | 718 | } |
720 | 719 | ||
721 | /* Initialise the card. */ | 720 | /* Initialise the card. */ |
722 | /* (I'm not really sure if it's a good idea to do this during probing, but | 721 | /* (I'm not really sure if it's a good idea to do this during probing, but |
723 | * like this it's assured that the lan connection type can be sensed | 722 | * like this it's assured that the lan connection type can be sensed |
724 | * correctly) | 723 | * correctly) |
725 | */ | 724 | */ |
@@ -779,8 +778,8 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
779 | return 0; | 778 | return 0; |
780 | out3: | 779 | out3: |
781 | if (local_mode == 1) | 780 | if (local_mode == 1) |
782 | pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, | 781 | pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, |
783 | lp->page_vaddr_algn, | 782 | lp->page_vaddr_algn, |
784 | virt_to_whatever(dev, lp->page_vaddr_algn)); | 783 | virt_to_whatever(dev, lp->page_vaddr_algn)); |
785 | if (mem_ptr_virt) | 784 | if (mem_ptr_virt) |
786 | iounmap(mem_ptr_virt); | 785 | iounmap(mem_ptr_virt); |
@@ -861,7 +860,7 @@ static void hp100_hwinit(struct net_device *dev) | |||
861 | /* Next comes code from mmuinit procedure of SCO BM driver which is | 860 | /* Next comes code from mmuinit procedure of SCO BM driver which is |
862 | * called from HWconfigure in the SCO driver. */ | 861 | * called from HWconfigure in the SCO driver. */ |
863 | 862 | ||
864 | /* Initialise MMU, eventually switch on Busmaster Mode, initialise | 863 | /* Initialise MMU, eventually switch on Busmaster Mode, initialise |
865 | * multicast filter... | 864 | * multicast filter... |
866 | */ | 865 | */ |
867 | hp100_mmuinit(dev); | 866 | hp100_mmuinit(dev); |
@@ -879,11 +878,11 @@ static void hp100_hwinit(struct net_device *dev) | |||
879 | hp100_login_to_vg_hub(dev, 0); /* relogin */ | 878 | hp100_login_to_vg_hub(dev, 0); /* relogin */ |
880 | 879 | ||
881 | } | 880 | } |
882 | |||
883 | 881 | ||
884 | /* | 882 | |
883 | /* | ||
885 | * mmuinit - Reinitialise Cascade MMU and MAC settings. | 884 | * mmuinit - Reinitialise Cascade MMU and MAC settings. |
886 | * Note: Must already be in reset and leaves card in reset. | 885 | * Note: Must already be in reset and leaves card in reset. |
887 | */ | 886 | */ |
888 | static void hp100_mmuinit(struct net_device *dev) | 887 | static void hp100_mmuinit(struct net_device *dev) |
889 | { | 888 | { |
@@ -909,7 +908,7 @@ static void hp100_mmuinit(struct net_device *dev) | |||
909 | hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ | 908 | hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ |
910 | 909 | ||
911 | /* | 910 | /* |
912 | * Enable Hardware | 911 | * Enable Hardware |
913 | * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En | 912 | * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En |
914 | * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable | 913 | * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable |
915 | * - Clear Priority, Advance Pkt and Xmit Cmd | 914 | * - Clear Priority, Advance Pkt and Xmit Cmd |
@@ -984,7 +983,7 @@ static void hp100_mmuinit(struct net_device *dev) | |||
984 | * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded | 983 | * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded |
985 | * to the next higher 1k boundary) bytes for the rx-pdl's | 984 | * to the next higher 1k boundary) bytes for the rx-pdl's |
986 | * Note: For non-etr chips the transmit stop register must be | 985 | * Note: For non-etr chips the transmit stop register must be |
987 | * programmed on a 1k boundary, i.e. bits 9:0 must be zero. | 986 | * programmed on a 1k boundary, i.e. bits 9:0 must be zero. |
988 | */ | 987 | */ |
989 | pdl_stop = lp->memory_size; | 988 | pdl_stop = lp->memory_size; |
990 | xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); | 989 | xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); |
@@ -1079,7 +1078,7 @@ static int hp100_open(struct net_device *dev) | |||
1079 | /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ | 1078 | /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ |
1080 | if (request_irq(dev->irq, hp100_interrupt, | 1079 | if (request_irq(dev->irq, hp100_interrupt, |
1081 | lp->bus == HP100_BUS_PCI || lp->bus == | 1080 | lp->bus == HP100_BUS_PCI || lp->bus == |
1082 | HP100_BUS_EISA ? SA_SHIRQ : SA_INTERRUPT, | 1081 | HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED, |
1083 | "hp100", dev)) { | 1082 | "hp100", dev)) { |
1084 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); | 1083 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); |
1085 | return -EAGAIN; | 1084 | return -EAGAIN; |
@@ -1132,10 +1131,10 @@ static int hp100_close(struct net_device *dev) | |||
1132 | 1131 | ||
1133 | return 0; | 1132 | return 0; |
1134 | } | 1133 | } |
1135 | 1134 | ||
1136 | 1135 | ||
1137 | /* | 1136 | /* |
1138 | * Configure the PDL Rx rings and LAN | 1137 | * Configure the PDL Rx rings and LAN |
1139 | */ | 1138 | */ |
1140 | static void hp100_init_pdls(struct net_device *dev) | 1139 | static void hp100_init_pdls(struct net_device *dev) |
1141 | { | 1140 | { |
@@ -1183,7 +1182,7 @@ static void hp100_init_pdls(struct net_device *dev) | |||
1183 | } | 1182 | } |
1184 | } | 1183 | } |
1185 | } | 1184 | } |
1186 | 1185 | ||
1187 | 1186 | ||
1188 | /* These functions "format" the entries in the pdl structure */ | 1187 | /* These functions "format" the entries in the pdl structure */ |
1189 | /* They return how much memory the fragments need. */ | 1188 | /* They return how much memory the fragments need. */ |
@@ -1201,10 +1200,10 @@ static int hp100_init_rxpdl(struct net_device *dev, | |||
1201 | ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); | 1200 | ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); |
1202 | ringptr->skb = (void *) NULL; | 1201 | ringptr->skb = (void *) NULL; |
1203 | 1202 | ||
1204 | /* | 1203 | /* |
1205 | * Write address and length of first PDL Fragment (which is used for | 1204 | * Write address and length of first PDL Fragment (which is used for |
1206 | * storing the RX-Header | 1205 | * storing the RX-Header |
1207 | * We use the 4 bytes _before_ the PDH in the pdl memory area to | 1206 | * We use the 4 bytes _before_ the PDH in the pdl memory area to |
1208 | * store this information. (PDH is at offset 0x04) | 1207 | * store this information. (PDH is at offset 0x04) |
1209 | */ | 1208 | */ |
1210 | /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */ | 1209 | /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */ |
@@ -1231,9 +1230,9 @@ static int hp100_init_txpdl(struct net_device *dev, | |||
1231 | } | 1230 | } |
1232 | 1231 | ||
1233 | /* | 1232 | /* |
1234 | * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes | 1233 | * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes |
1235 | * for possible odd word alignment rounding up to next dword and set PDL | 1234 | * for possible odd word alignment rounding up to next dword and set PDL |
1236 | * address for fragment#2 | 1235 | * address for fragment#2 |
1237 | * Returns: 0 if unable to allocate skb_buff | 1236 | * Returns: 0 if unable to allocate skb_buff |
1238 | * 1 if successful | 1237 | * 1 if successful |
1239 | */ | 1238 | */ |
@@ -1253,13 +1252,13 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1253 | #endif | 1252 | #endif |
1254 | 1253 | ||
1255 | /* Allocate skb buffer of maximum size */ | 1254 | /* Allocate skb buffer of maximum size */ |
1256 | /* Note: This depends on the alloc_skb functions allocating more | 1255 | /* Note: This depends on the alloc_skb functions allocating more |
1257 | * space than requested, i.e. aligning to 16bytes */ | 1256 | * space than requested, i.e. aligning to 16bytes */ |
1258 | 1257 | ||
1259 | ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4); | 1258 | ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4); |
1260 | 1259 | ||
1261 | if (NULL != ringptr->skb) { | 1260 | if (NULL != ringptr->skb) { |
1262 | /* | 1261 | /* |
1263 | * Reserve 2 bytes at the head of the buffer to land the IP header | 1262 | * Reserve 2 bytes at the head of the buffer to land the IP header |
1264 | * on a long word boundary (According to the Network Driver section | 1263 | * on a long word boundary (According to the Network Driver section |
1265 | * in the Linux KHG, this should help to increase performance.) | 1264 | * in the Linux KHG, this should help to increase performance.) |
@@ -1271,10 +1270,10 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1271 | 1270 | ||
1272 | /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */ | 1271 | /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */ |
1273 | /* Note: 1st Fragment is used for the 4 byte packet status | 1272 | /* Note: 1st Fragment is used for the 4 byte packet status |
1274 | * (receive header). Its PDL entries are set up by init_rxpdl. So | 1273 | * (receive header). Its PDL entries are set up by init_rxpdl. So |
1275 | * here we only have to set up the PDL fragment entries for the data | 1274 | * here we only have to set up the PDL fragment entries for the data |
1276 | * part. Those 4 bytes will be stored in the DMA memory region | 1275 | * part. Those 4 bytes will be stored in the DMA memory region |
1277 | * directly before the PDL. | 1276 | * directly before the PDL. |
1278 | */ | 1277 | */ |
1279 | #ifdef HP100_DEBUG_BM | 1278 | #ifdef HP100_DEBUG_BM |
1280 | printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n", | 1279 | printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n", |
@@ -1286,7 +1285,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1286 | /* Conversion to new PCI API : map skbuf data to PCI bus. | 1285 | /* Conversion to new PCI API : map skbuf data to PCI bus. |
1287 | * Doc says it's OK for EISA as well - Jean II */ | 1286 | * Doc says it's OK for EISA as well - Jean II */ |
1288 | ringptr->pdl[0] = 0x00020000; /* Write PDH */ | 1287 | ringptr->pdl[0] = 0x00020000; /* Write PDH */ |
1289 | ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), | 1288 | ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), |
1290 | ringptr->skb->data); | 1289 | ringptr->skb->data); |
1291 | ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ | 1290 | ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ |
1292 | 1291 | ||
@@ -1407,7 +1406,7 @@ static void hp100_BM_shutdown(struct net_device *dev) | |||
1407 | } | 1406 | } |
1408 | } else { /* Shasta or Rainier Shutdown/Reset */ | 1407 | } else { /* Shasta or Rainier Shutdown/Reset */ |
1409 | /* To ensure all bus master inloading activity has ceased, | 1408 | /* To ensure all bus master inloading activity has ceased, |
1410 | * wait for no Rx PDAs or no Rx packets on card. | 1409 | * wait for no Rx PDAs or no Rx packets on card. |
1411 | */ | 1410 | */ |
1412 | hp100_page(PERFORMANCE); | 1411 | hp100_page(PERFORMANCE); |
1413 | /* 100 ms timeout */ | 1412 | /* 100 ms timeout */ |
@@ -1423,7 +1422,7 @@ static void hp100_BM_shutdown(struct net_device *dev) | |||
1423 | 1422 | ||
1424 | /* To ensure all bus master outloading activity has ceased, | 1423 | /* To ensure all bus master outloading activity has ceased, |
1425 | * wait until the Tx PDA count goes to zero or no more Tx space | 1424 | * wait until the Tx PDA count goes to zero or no more Tx space |
1426 | * available in the Tx region of the card. | 1425 | * available in the Tx region of the card. |
1427 | */ | 1426 | */ |
1428 | /* 100 ms timeout */ | 1427 | /* 100 ms timeout */ |
1429 | for (time = 0; time < 10000; time++) { | 1428 | for (time = 0; time < 10000; time++) { |
@@ -1462,7 +1461,7 @@ static int hp100_check_lan(struct net_device *dev) | |||
1462 | return 0; | 1461 | return 0; |
1463 | } | 1462 | } |
1464 | 1463 | ||
1465 | /* | 1464 | /* |
1466 | * transmit functions | 1465 | * transmit functions |
1467 | */ | 1466 | */ |
1468 | 1467 | ||
@@ -1486,7 +1485,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1486 | 1485 | ||
1487 | if (skb->len <= 0) | 1486 | if (skb->len <= 0) |
1488 | return 0; | 1487 | return 0; |
1489 | 1488 | ||
1490 | if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) | 1489 | if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) |
1491 | return 0; | 1490 | return 0; |
1492 | 1491 | ||
@@ -1576,14 +1575,14 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1576 | 1575 | ||
1577 | return 0; | 1576 | return 0; |
1578 | } | 1577 | } |
1579 | 1578 | ||
1580 | 1579 | ||
1581 | /* clean_txring checks if packets have been sent by the card by reading | 1580 | /* clean_txring checks if packets have been sent by the card by reading |
1582 | * the TX_PDL register from the performance page and comparing it to the | 1581 | * the TX_PDL register from the performance page and comparing it to the |
1583 | * number of commited packets. It then frees the skb's of the packets that | 1582 | * number of commited packets. It then frees the skb's of the packets that |
1584 | * obviously have been sent to the network. | 1583 | * obviously have been sent to the network. |
1585 | * | 1584 | * |
1586 | * Needs the PERFORMANCE page selected. | 1585 | * Needs the PERFORMANCE page selected. |
1587 | */ | 1586 | */ |
1588 | static void hp100_clean_txring(struct net_device *dev) | 1587 | static void hp100_clean_txring(struct net_device *dev) |
1589 | { | 1588 | { |
@@ -1744,15 +1743,15 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1744 | 1743 | ||
1745 | return 0; | 1744 | return 0; |
1746 | } | 1745 | } |
1747 | 1746 | ||
1748 | 1747 | ||
1749 | /* | 1748 | /* |
1750 | * Receive Function (Non-Busmaster mode) | 1749 | * Receive Function (Non-Busmaster mode) |
1751 | * Called when an "Receive Packet" interrupt occurs, i.e. the receive | 1750 | * Called when an "Receive Packet" interrupt occurs, i.e. the receive |
1752 | * packet counter is non-zero. | 1751 | * packet counter is non-zero. |
1753 | * For non-busmaster, this function does the whole work of transfering | 1752 | * For non-busmaster, this function does the whole work of transfering |
1754 | * the packet to the host memory and then up to higher layers via skb | 1753 | * the packet to the host memory and then up to higher layers via skb |
1755 | * and netif_rx. | 1754 | * and netif_rx. |
1756 | */ | 1755 | */ |
1757 | 1756 | ||
1758 | static void hp100_rx(struct net_device *dev) | 1757 | static void hp100_rx(struct net_device *dev) |
@@ -1855,7 +1854,7 @@ static void hp100_rx(struct net_device *dev) | |||
1855 | #endif | 1854 | #endif |
1856 | } | 1855 | } |
1857 | 1856 | ||
1858 | /* | 1857 | /* |
1859 | * Receive Function for Busmaster Mode | 1858 | * Receive Function for Busmaster Mode |
1860 | */ | 1859 | */ |
1861 | static void hp100_rx_bm(struct net_device *dev) | 1860 | static void hp100_rx_bm(struct net_device *dev) |
@@ -1876,7 +1875,7 @@ static void hp100_rx_bm(struct net_device *dev) | |||
1876 | printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name); | 1875 | printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name); |
1877 | return; | 1876 | return; |
1878 | } else | 1877 | } else |
1879 | /* RX_PKT_CNT states how many PDLs are currently formatted and available to | 1878 | /* RX_PKT_CNT states how many PDLs are currently formatted and available to |
1880 | * the cards BM engine */ | 1879 | * the cards BM engine */ |
1881 | if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { | 1880 | if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { |
1882 | printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n", | 1881 | printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n", |
@@ -1889,7 +1888,7 @@ static void hp100_rx_bm(struct net_device *dev) | |||
1889 | while ((lp->rxrcommit > hp100_inb(RX_PDL))) { | 1888 | while ((lp->rxrcommit > hp100_inb(RX_PDL))) { |
1890 | /* | 1889 | /* |
1891 | * The packet was received into the pdl pointed to by lp->rxrhead ( | 1890 | * The packet was received into the pdl pointed to by lp->rxrhead ( |
1892 | * the oldest pdl in the ring | 1891 | * the oldest pdl in the ring |
1893 | */ | 1892 | */ |
1894 | 1893 | ||
1895 | /* First we get the header, which contains information about the */ | 1894 | /* First we get the header, which contains information about the */ |
@@ -2044,7 +2043,7 @@ static void hp100_clear_stats(struct hp100_private *lp, int ioaddr) | |||
2044 | hp100_page(PERFORMANCE); | 2043 | hp100_page(PERFORMANCE); |
2045 | spin_unlock_irqrestore(&lp->lock, flags); | 2044 | spin_unlock_irqrestore(&lp->lock, flags); |
2046 | } | 2045 | } |
2047 | 2046 | ||
2048 | 2047 | ||
2049 | /* | 2048 | /* |
2050 | * multicast setup | 2049 | * multicast setup |
@@ -2221,9 +2220,9 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2221 | /* We're only interested in those interrupts we really enabled. */ | 2220 | /* We're only interested in those interrupts we really enabled. */ |
2222 | /* val &= hp100_inw( IRQ_MASK ); */ | 2221 | /* val &= hp100_inw( IRQ_MASK ); */ |
2223 | 2222 | ||
2224 | /* | 2223 | /* |
2225 | * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL | 2224 | * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL |
2226 | * is considered executed whenever the RX_PDL data structure is no longer | 2225 | * is considered executed whenever the RX_PDL data structure is no longer |
2227 | * needed. | 2226 | * needed. |
2228 | */ | 2227 | */ |
2229 | if (val & HP100_RX_PDL_FILL_COMPL) { | 2228 | if (val & HP100_RX_PDL_FILL_COMPL) { |
@@ -2234,7 +2233,7 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2234 | } | 2233 | } |
2235 | } | 2234 | } |
2236 | 2235 | ||
2237 | /* | 2236 | /* |
2238 | * The RX_PACKET interrupt is set, when the receive packet counter is | 2237 | * The RX_PACKET interrupt is set, when the receive packet counter is |
2239 | * non zero. We use this interrupt for receiving in slave mode. In | 2238 | * non zero. We use this interrupt for receiving in slave mode. In |
2240 | * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill | 2239 | * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill |
@@ -2260,10 +2259,10 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2260 | hp100_outw(val, IRQ_STATUS); | 2259 | hp100_outw(val, IRQ_STATUS); |
2261 | 2260 | ||
2262 | /* | 2261 | /* |
2263 | * RX_ERROR is set when a packet is dropped due to no memory resources on | 2262 | * RX_ERROR is set when a packet is dropped due to no memory resources on |
2264 | * the card or when a RCV_ERR occurs. | 2263 | * the card or when a RCV_ERR occurs. |
2265 | * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists | 2264 | * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists |
2266 | * only in the 802.3 MAC and happens when 16 collisions occur during a TX | 2265 | * only in the 802.3 MAC and happens when 16 collisions occur during a TX |
2267 | */ | 2266 | */ |
2268 | if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { | 2267 | if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { |
2269 | #ifdef HP100_DEBUG_IRQ | 2268 | #ifdef HP100_DEBUG_IRQ |
@@ -2276,20 +2275,20 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2276 | } | 2275 | } |
2277 | } | 2276 | } |
2278 | 2277 | ||
2279 | /* | 2278 | /* |
2280 | * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. | 2279 | * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. |
2281 | */ | 2280 | */ |
2282 | if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) | 2281 | if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) |
2283 | hp100_rxfill(dev); | 2282 | hp100_rxfill(dev); |
2284 | 2283 | ||
2285 | /* | 2284 | /* |
2286 | * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire | 2285 | * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire |
2287 | * is completed | 2286 | * is completed |
2288 | */ | 2287 | */ |
2289 | if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) | 2288 | if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) |
2290 | hp100_clean_txring(dev); | 2289 | hp100_clean_txring(dev); |
2291 | 2290 | ||
2292 | /* | 2291 | /* |
2293 | * MISC_ERROR is set when either the LAN link goes down or a detected | 2292 | * MISC_ERROR is set when either the LAN link goes down or a detected |
2294 | * bus error occurs. | 2293 | * bus error occurs. |
2295 | */ | 2294 | */ |
@@ -2472,12 +2471,12 @@ static int hp100_sense_lan(struct net_device *dev) | |||
2472 | 2471 | ||
2473 | /* Those cards don't have a 100 Mbit connector */ | 2472 | /* Those cards don't have a 100 Mbit connector */ |
2474 | if ( !strcmp(lp->id, "HWP1920") || | 2473 | if ( !strcmp(lp->id, "HWP1920") || |
2475 | (lp->pci_dev && | 2474 | (lp->pci_dev && |
2476 | lp->pci_dev->vendor == PCI_VENDOR_ID && | 2475 | lp->pci_dev->vendor == PCI_VENDOR_ID && |
2477 | (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || | 2476 | (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || |
2478 | lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) | 2477 | lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) |
2479 | return HP100_LAN_ERR; | 2478 | return HP100_LAN_ERR; |
2480 | 2479 | ||
2481 | if (val_VG & HP100_LINK_CABLE_ST) /* Can hear the HUBs tone. */ | 2480 | if (val_VG & HP100_LINK_CABLE_ST) /* Can hear the HUBs tone. */ |
2482 | return HP100_LAN_100; | 2481 | return HP100_LAN_100; |
2483 | return HP100_LAN_ERR; | 2482 | return HP100_LAN_ERR; |
@@ -2823,8 +2822,8 @@ static void cleanup_dev(struct net_device *d) | |||
2823 | release_region(d->base_addr, HP100_REGION_SIZE); | 2822 | release_region(d->base_addr, HP100_REGION_SIZE); |
2824 | 2823 | ||
2825 | if (p->mode == 1) /* busmaster */ | 2824 | if (p->mode == 1) /* busmaster */ |
2826 | pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, | 2825 | pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, |
2827 | p->page_vaddr_algn, | 2826 | p->page_vaddr_algn, |
2828 | virt_to_whatever(d, p->page_vaddr_algn)); | 2827 | virt_to_whatever(d, p->page_vaddr_algn)); |
2829 | if (p->mem_ptr_virt) | 2828 | if (p->mem_ptr_virt) |
2830 | iounmap(p->mem_ptr_virt); | 2829 | iounmap(p->mem_ptr_virt); |
@@ -2850,7 +2849,7 @@ static int __init hp100_eisa_probe (struct device *gendev) | |||
2850 | goto out1; | 2849 | goto out1; |
2851 | 2850 | ||
2852 | #ifdef HP100_DEBUG | 2851 | #ifdef HP100_DEBUG |
2853 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, | 2852 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, |
2854 | dev->base_addr); | 2853 | dev->base_addr); |
2855 | #endif | 2854 | #endif |
2856 | gendev->driver_data = dev; | 2855 | gendev->driver_data = dev; |
@@ -2914,12 +2913,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, | |||
2914 | pci_command |= PCI_COMMAND_MASTER; | 2913 | pci_command |= PCI_COMMAND_MASTER; |
2915 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); | 2914 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); |
2916 | } | 2915 | } |
2917 | 2916 | ||
2918 | ioaddr = pci_resource_start(pdev, 0); | 2917 | ioaddr = pci_resource_start(pdev, 0); |
2919 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); | 2918 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); |
2920 | if (err) | 2919 | if (err) |
2921 | goto out1; | 2920 | goto out1; |
2922 | 2921 | ||
2923 | #ifdef HP100_DEBUG | 2922 | #ifdef HP100_DEBUG |
2924 | printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); | 2923 | printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); |
2925 | #endif | 2924 | #endif |
@@ -3004,7 +3003,7 @@ static int __init hp100_isa_init(void) | |||
3004 | return cards > 0 ? 0 : -ENODEV; | 3003 | return cards > 0 ? 0 : -ENODEV; |
3005 | } | 3004 | } |
3006 | 3005 | ||
3007 | static void __exit hp100_isa_cleanup(void) | 3006 | static void __exit hp100_isa_cleanup(void) |
3008 | { | 3007 | { |
3009 | int i; | 3008 | int i; |
3010 | 3009 | ||
@@ -3028,12 +3027,12 @@ static int __init hp100_module_init(void) | |||
3028 | goto out; | 3027 | goto out; |
3029 | #ifdef CONFIG_EISA | 3028 | #ifdef CONFIG_EISA |
3030 | err = eisa_driver_register(&hp100_eisa_driver); | 3029 | err = eisa_driver_register(&hp100_eisa_driver); |
3031 | if (err && err != -ENODEV) | 3030 | if (err && err != -ENODEV) |
3032 | goto out2; | 3031 | goto out2; |
3033 | #endif | 3032 | #endif |
3034 | #ifdef CONFIG_PCI | 3033 | #ifdef CONFIG_PCI |
3035 | err = pci_module_init(&hp100_pci_driver); | 3034 | err = pci_module_init(&hp100_pci_driver); |
3036 | if (err && err != -ENODEV) | 3035 | if (err && err != -ENODEV) |
3037 | goto out3; | 3036 | goto out3; |
3038 | #endif | 3037 | #endif |
3039 | out: | 3038 | out: |