diff options
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r-- | drivers/net/hp100.c | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index ff5a67d619bb..03b3df33d81b 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 |
@@ -286,7 +286,7 @@ static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr) | |||
286 | 286 | ||
287 | 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) |
288 | { | 288 | { |
289 | return pci_map_single(lp->pci_dev, data, | 289 | return pci_map_single(lp->pci_dev, data, |
290 | MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); | 290 | MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); |
291 | } | 291 | } |
292 | 292 | ||
@@ -353,7 +353,7 @@ static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) | |||
353 | goto err; | 353 | goto err; |
354 | 354 | ||
355 | for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { | 355 | for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { |
356 | if (!strcmp(hp100_isa_tbl[i], sig)) | 356 | if (!strcmp(hp100_isa_tbl[i], sig)) |
357 | break; | 357 | break; |
358 | 358 | ||
359 | } | 359 | } |
@@ -373,11 +373,11 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) | |||
373 | { | 373 | { |
374 | int err = -ENODEV; | 374 | int err = -ENODEV; |
375 | 375 | ||
376 | /* Probe for a specific ISA address */ | 376 | /* Probe for a specific ISA address */ |
377 | if (addr > 0xff && addr < 0x400) | 377 | if (addr > 0xff && addr < 0x400) |
378 | err = hp100_isa_probe1(dev, addr); | 378 | err = hp100_isa_probe1(dev, addr); |
379 | 379 | ||
380 | else if (addr != 0) | 380 | else if (addr != 0) |
381 | err = -ENXIO; | 381 | err = -ENXIO; |
382 | 382 | ||
383 | else { | 383 | else { |
@@ -448,7 +448,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
448 | if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) | 448 | if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) |
449 | goto out1; | 449 | goto out1; |
450 | 450 | ||
451 | if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) | 451 | if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) |
452 | goto out2; | 452 | goto out2; |
453 | 453 | ||
454 | chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; | 454 | chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; |
@@ -491,7 +491,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
491 | * 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 |
492 | * force driver modes: | 492 | * force driver modes: |
493 | * hp100_mode=1 -> default, use busmaster mode if configured. | 493 | * hp100_mode=1 -> default, use busmaster mode if configured. |
494 | * hp100_mode=2 -> enable shared memory mode | 494 | * hp100_mode=2 -> enable shared memory mode |
495 | * hp100_mode=3 -> force use of i/o mapped mode. | 495 | * hp100_mode=3 -> force use of i/o mapped mode. |
496 | * 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. |
497 | */ | 497 | */ |
@@ -689,9 +689,9 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
689 | hp100_clear_stats(lp, ioaddr); | 689 | hp100_clear_stats(lp, ioaddr); |
690 | 690 | ||
691 | /* 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 |
692 | * the rx and tx PDLs | 692 | * the rx and tx PDLs |
693 | * 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 |
694 | * needed for the allocation of the memory area. | 694 | * needed for the allocation of the memory area. |
695 | */ | 695 | */ |
696 | 696 | ||
697 | /* 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 |
@@ -718,7 +718,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
718 | } | 718 | } |
719 | 719 | ||
720 | /* Initialise the card. */ | 720 | /* Initialise the card. */ |
721 | /* (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 |
722 | * 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 |
723 | * correctly) | 723 | * correctly) |
724 | */ | 724 | */ |
@@ -778,8 +778,8 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
778 | return 0; | 778 | return 0; |
779 | out3: | 779 | out3: |
780 | if (local_mode == 1) | 780 | if (local_mode == 1) |
781 | pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, | 781 | pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, |
782 | lp->page_vaddr_algn, | 782 | lp->page_vaddr_algn, |
783 | virt_to_whatever(dev, lp->page_vaddr_algn)); | 783 | virt_to_whatever(dev, lp->page_vaddr_algn)); |
784 | if (mem_ptr_virt) | 784 | if (mem_ptr_virt) |
785 | iounmap(mem_ptr_virt); | 785 | iounmap(mem_ptr_virt); |
@@ -860,7 +860,7 @@ static void hp100_hwinit(struct net_device *dev) | |||
860 | /* 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 |
861 | * called from HWconfigure in the SCO driver. */ | 861 | * called from HWconfigure in the SCO driver. */ |
862 | 862 | ||
863 | /* Initialise MMU, eventually switch on Busmaster Mode, initialise | 863 | /* Initialise MMU, eventually switch on Busmaster Mode, initialise |
864 | * multicast filter... | 864 | * multicast filter... |
865 | */ | 865 | */ |
866 | hp100_mmuinit(dev); | 866 | hp100_mmuinit(dev); |
@@ -878,11 +878,11 @@ static void hp100_hwinit(struct net_device *dev) | |||
878 | hp100_login_to_vg_hub(dev, 0); /* relogin */ | 878 | hp100_login_to_vg_hub(dev, 0); /* relogin */ |
879 | 879 | ||
880 | } | 880 | } |
881 | |||
882 | 881 | ||
883 | /* | 882 | |
883 | /* | ||
884 | * mmuinit - Reinitialise Cascade MMU and MAC settings. | 884 | * mmuinit - Reinitialise Cascade MMU and MAC settings. |
885 | * Note: Must already be in reset and leaves card in reset. | 885 | * Note: Must already be in reset and leaves card in reset. |
886 | */ | 886 | */ |
887 | static void hp100_mmuinit(struct net_device *dev) | 887 | static void hp100_mmuinit(struct net_device *dev) |
888 | { | 888 | { |
@@ -908,7 +908,7 @@ static void hp100_mmuinit(struct net_device *dev) | |||
908 | hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ | 908 | hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ |
909 | 909 | ||
910 | /* | 910 | /* |
911 | * Enable Hardware | 911 | * Enable Hardware |
912 | * - 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 |
913 | * - 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 |
914 | * - Clear Priority, Advance Pkt and Xmit Cmd | 914 | * - Clear Priority, Advance Pkt and Xmit Cmd |
@@ -983,7 +983,7 @@ static void hp100_mmuinit(struct net_device *dev) | |||
983 | * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded | 983 | * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded |
984 | * 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 |
985 | * Note: For non-etr chips the transmit stop register must be | 985 | * Note: For non-etr chips the transmit stop register must be |
986 | * 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. |
987 | */ | 987 | */ |
988 | pdl_stop = lp->memory_size; | 988 | pdl_stop = lp->memory_size; |
989 | xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); | 989 | xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); |
@@ -1131,10 +1131,10 @@ static int hp100_close(struct net_device *dev) | |||
1131 | 1131 | ||
1132 | return 0; | 1132 | return 0; |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | 1135 | ||
1136 | /* | 1136 | /* |
1137 | * Configure the PDL Rx rings and LAN | 1137 | * Configure the PDL Rx rings and LAN |
1138 | */ | 1138 | */ |
1139 | static void hp100_init_pdls(struct net_device *dev) | 1139 | static void hp100_init_pdls(struct net_device *dev) |
1140 | { | 1140 | { |
@@ -1182,7 +1182,7 @@ static void hp100_init_pdls(struct net_device *dev) | |||
1182 | } | 1182 | } |
1183 | } | 1183 | } |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | 1186 | ||
1187 | /* These functions "format" the entries in the pdl structure */ | 1187 | /* These functions "format" the entries in the pdl structure */ |
1188 | /* They return how much memory the fragments need. */ | 1188 | /* They return how much memory the fragments need. */ |
@@ -1200,10 +1200,10 @@ static int hp100_init_rxpdl(struct net_device *dev, | |||
1200 | ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); | 1200 | ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); |
1201 | ringptr->skb = (void *) NULL; | 1201 | ringptr->skb = (void *) NULL; |
1202 | 1202 | ||
1203 | /* | 1203 | /* |
1204 | * 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 |
1205 | * storing the RX-Header | 1205 | * storing the RX-Header |
1206 | * 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 |
1207 | * store this information. (PDH is at offset 0x04) | 1207 | * store this information. (PDH is at offset 0x04) |
1208 | */ | 1208 | */ |
1209 | /* 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 */ |
@@ -1230,9 +1230,9 @@ static int hp100_init_txpdl(struct net_device *dev, | |||
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | /* | 1232 | /* |
1233 | * 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 |
1234 | * 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 |
1235 | * address for fragment#2 | 1235 | * address for fragment#2 |
1236 | * Returns: 0 if unable to allocate skb_buff | 1236 | * Returns: 0 if unable to allocate skb_buff |
1237 | * 1 if successful | 1237 | * 1 if successful |
1238 | */ | 1238 | */ |
@@ -1252,13 +1252,13 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1252 | #endif | 1252 | #endif |
1253 | 1253 | ||
1254 | /* Allocate skb buffer of maximum size */ | 1254 | /* Allocate skb buffer of maximum size */ |
1255 | /* Note: This depends on the alloc_skb functions allocating more | 1255 | /* Note: This depends on the alloc_skb functions allocating more |
1256 | * space than requested, i.e. aligning to 16bytes */ | 1256 | * space than requested, i.e. aligning to 16bytes */ |
1257 | 1257 | ||
1258 | 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); |
1259 | 1259 | ||
1260 | if (NULL != ringptr->skb) { | 1260 | if (NULL != ringptr->skb) { |
1261 | /* | 1261 | /* |
1262 | * 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 |
1263 | * on a long word boundary (According to the Network Driver section | 1263 | * on a long word boundary (According to the Network Driver section |
1264 | * in the Linux KHG, this should help to increase performance.) | 1264 | * in the Linux KHG, this should help to increase performance.) |
@@ -1270,10 +1270,10 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1270 | 1270 | ||
1271 | /* 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 */ |
1272 | /* Note: 1st Fragment is used for the 4 byte packet status | 1272 | /* Note: 1st Fragment is used for the 4 byte packet status |
1273 | * (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 |
1274 | * 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 |
1275 | * 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 |
1276 | * directly before the PDL. | 1276 | * directly before the PDL. |
1277 | */ | 1277 | */ |
1278 | #ifdef HP100_DEBUG_BM | 1278 | #ifdef HP100_DEBUG_BM |
1279 | 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", |
@@ -1285,7 +1285,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, | |||
1285 | /* Conversion to new PCI API : map skbuf data to PCI bus. | 1285 | /* Conversion to new PCI API : map skbuf data to PCI bus. |
1286 | * Doc says it's OK for EISA as well - Jean II */ | 1286 | * Doc says it's OK for EISA as well - Jean II */ |
1287 | ringptr->pdl[0] = 0x00020000; /* Write PDH */ | 1287 | ringptr->pdl[0] = 0x00020000; /* Write PDH */ |
1288 | ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), | 1288 | ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), |
1289 | ringptr->skb->data); | 1289 | ringptr->skb->data); |
1290 | ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ | 1290 | ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ |
1291 | 1291 | ||
@@ -1406,7 +1406,7 @@ static void hp100_BM_shutdown(struct net_device *dev) | |||
1406 | } | 1406 | } |
1407 | } else { /* Shasta or Rainier Shutdown/Reset */ | 1407 | } else { /* Shasta or Rainier Shutdown/Reset */ |
1408 | /* To ensure all bus master inloading activity has ceased, | 1408 | /* To ensure all bus master inloading activity has ceased, |
1409 | * wait for no Rx PDAs or no Rx packets on card. | 1409 | * wait for no Rx PDAs or no Rx packets on card. |
1410 | */ | 1410 | */ |
1411 | hp100_page(PERFORMANCE); | 1411 | hp100_page(PERFORMANCE); |
1412 | /* 100 ms timeout */ | 1412 | /* 100 ms timeout */ |
@@ -1422,7 +1422,7 @@ static void hp100_BM_shutdown(struct net_device *dev) | |||
1422 | 1422 | ||
1423 | /* To ensure all bus master outloading activity has ceased, | 1423 | /* To ensure all bus master outloading activity has ceased, |
1424 | * 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 |
1425 | * available in the Tx region of the card. | 1425 | * available in the Tx region of the card. |
1426 | */ | 1426 | */ |
1427 | /* 100 ms timeout */ | 1427 | /* 100 ms timeout */ |
1428 | for (time = 0; time < 10000; time++) { | 1428 | for (time = 0; time < 10000; time++) { |
@@ -1461,7 +1461,7 @@ static int hp100_check_lan(struct net_device *dev) | |||
1461 | return 0; | 1461 | return 0; |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | /* | 1464 | /* |
1465 | * transmit functions | 1465 | * transmit functions |
1466 | */ | 1466 | */ |
1467 | 1467 | ||
@@ -1485,7 +1485,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1485 | 1485 | ||
1486 | if (skb->len <= 0) | 1486 | if (skb->len <= 0) |
1487 | return 0; | 1487 | return 0; |
1488 | 1488 | ||
1489 | if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) | 1489 | if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) |
1490 | return 0; | 1490 | return 0; |
1491 | 1491 | ||
@@ -1575,14 +1575,14 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) | |||
1575 | 1575 | ||
1576 | return 0; | 1576 | return 0; |
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | 1579 | ||
1580 | /* 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 |
1581 | * 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 |
1582 | * 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 |
1583 | * obviously have been sent to the network. | 1583 | * obviously have been sent to the network. |
1584 | * | 1584 | * |
1585 | * Needs the PERFORMANCE page selected. | 1585 | * Needs the PERFORMANCE page selected. |
1586 | */ | 1586 | */ |
1587 | static void hp100_clean_txring(struct net_device *dev) | 1587 | static void hp100_clean_txring(struct net_device *dev) |
1588 | { | 1588 | { |
@@ -1743,15 +1743,15 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1743 | 1743 | ||
1744 | return 0; | 1744 | return 0; |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | 1747 | ||
1748 | /* | 1748 | /* |
1749 | * Receive Function (Non-Busmaster mode) | 1749 | * Receive Function (Non-Busmaster mode) |
1750 | * Called when an "Receive Packet" interrupt occurs, i.e. the receive | 1750 | * Called when an "Receive Packet" interrupt occurs, i.e. the receive |
1751 | * packet counter is non-zero. | 1751 | * packet counter is non-zero. |
1752 | * For non-busmaster, this function does the whole work of transfering | 1752 | * For non-busmaster, this function does the whole work of transfering |
1753 | * 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 |
1754 | * and netif_rx. | 1754 | * and netif_rx. |
1755 | */ | 1755 | */ |
1756 | 1756 | ||
1757 | static void hp100_rx(struct net_device *dev) | 1757 | static void hp100_rx(struct net_device *dev) |
@@ -1854,7 +1854,7 @@ static void hp100_rx(struct net_device *dev) | |||
1854 | #endif | 1854 | #endif |
1855 | } | 1855 | } |
1856 | 1856 | ||
1857 | /* | 1857 | /* |
1858 | * Receive Function for Busmaster Mode | 1858 | * Receive Function for Busmaster Mode |
1859 | */ | 1859 | */ |
1860 | static void hp100_rx_bm(struct net_device *dev) | 1860 | static void hp100_rx_bm(struct net_device *dev) |
@@ -1875,7 +1875,7 @@ static void hp100_rx_bm(struct net_device *dev) | |||
1875 | 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); |
1876 | return; | 1876 | return; |
1877 | } else | 1877 | } else |
1878 | /* 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 |
1879 | * the cards BM engine */ | 1879 | * the cards BM engine */ |
1880 | if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { | 1880 | if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { |
1881 | 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", |
@@ -1888,7 +1888,7 @@ static void hp100_rx_bm(struct net_device *dev) | |||
1888 | while ((lp->rxrcommit > hp100_inb(RX_PDL))) { | 1888 | while ((lp->rxrcommit > hp100_inb(RX_PDL))) { |
1889 | /* | 1889 | /* |
1890 | * 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 ( |
1891 | * the oldest pdl in the ring | 1891 | * the oldest pdl in the ring |
1892 | */ | 1892 | */ |
1893 | 1893 | ||
1894 | /* First we get the header, which contains information about the */ | 1894 | /* First we get the header, which contains information about the */ |
@@ -2043,7 +2043,7 @@ static void hp100_clear_stats(struct hp100_private *lp, int ioaddr) | |||
2043 | hp100_page(PERFORMANCE); | 2043 | hp100_page(PERFORMANCE); |
2044 | spin_unlock_irqrestore(&lp->lock, flags); | 2044 | spin_unlock_irqrestore(&lp->lock, flags); |
2045 | } | 2045 | } |
2046 | 2046 | ||
2047 | 2047 | ||
2048 | /* | 2048 | /* |
2049 | * multicast setup | 2049 | * multicast setup |
@@ -2220,9 +2220,9 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2220 | /* We're only interested in those interrupts we really enabled. */ | 2220 | /* We're only interested in those interrupts we really enabled. */ |
2221 | /* val &= hp100_inw( IRQ_MASK ); */ | 2221 | /* val &= hp100_inw( IRQ_MASK ); */ |
2222 | 2222 | ||
2223 | /* | 2223 | /* |
2224 | * 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 |
2225 | * 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 |
2226 | * needed. | 2226 | * needed. |
2227 | */ | 2227 | */ |
2228 | if (val & HP100_RX_PDL_FILL_COMPL) { | 2228 | if (val & HP100_RX_PDL_FILL_COMPL) { |
@@ -2233,7 +2233,7 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2233 | } | 2233 | } |
2234 | } | 2234 | } |
2235 | 2235 | ||
2236 | /* | 2236 | /* |
2237 | * 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 |
2238 | * 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 |
2239 | * 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 |
@@ -2259,10 +2259,10 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2259 | hp100_outw(val, IRQ_STATUS); | 2259 | hp100_outw(val, IRQ_STATUS); |
2260 | 2260 | ||
2261 | /* | 2261 | /* |
2262 | * 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 |
2263 | * the card or when a RCV_ERR occurs. | 2263 | * the card or when a RCV_ERR occurs. |
2264 | * 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 |
2265 | * 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 |
2266 | */ | 2266 | */ |
2267 | if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { | 2267 | if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { |
2268 | #ifdef HP100_DEBUG_IRQ | 2268 | #ifdef HP100_DEBUG_IRQ |
@@ -2275,20 +2275,20 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
2275 | } | 2275 | } |
2276 | } | 2276 | } |
2277 | 2277 | ||
2278 | /* | 2278 | /* |
2279 | * 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. |
2280 | */ | 2280 | */ |
2281 | if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) | 2281 | if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) |
2282 | hp100_rxfill(dev); | 2282 | hp100_rxfill(dev); |
2283 | 2283 | ||
2284 | /* | 2284 | /* |
2285 | * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire | 2285 | * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire |
2286 | * is completed | 2286 | * is completed |
2287 | */ | 2287 | */ |
2288 | if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) | 2288 | if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) |
2289 | hp100_clean_txring(dev); | 2289 | hp100_clean_txring(dev); |
2290 | 2290 | ||
2291 | /* | 2291 | /* |
2292 | * 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 |
2293 | * bus error occurs. | 2293 | * bus error occurs. |
2294 | */ | 2294 | */ |
@@ -2471,12 +2471,12 @@ static int hp100_sense_lan(struct net_device *dev) | |||
2471 | 2471 | ||
2472 | /* Those cards don't have a 100 Mbit connector */ | 2472 | /* Those cards don't have a 100 Mbit connector */ |
2473 | if ( !strcmp(lp->id, "HWP1920") || | 2473 | if ( !strcmp(lp->id, "HWP1920") || |
2474 | (lp->pci_dev && | 2474 | (lp->pci_dev && |
2475 | lp->pci_dev->vendor == PCI_VENDOR_ID && | 2475 | lp->pci_dev->vendor == PCI_VENDOR_ID && |
2476 | (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || | 2476 | (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || |
2477 | lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) | 2477 | lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) |
2478 | return HP100_LAN_ERR; | 2478 | return HP100_LAN_ERR; |
2479 | 2479 | ||
2480 | 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. */ |
2481 | return HP100_LAN_100; | 2481 | return HP100_LAN_100; |
2482 | return HP100_LAN_ERR; | 2482 | return HP100_LAN_ERR; |
@@ -2822,8 +2822,8 @@ static void cleanup_dev(struct net_device *d) | |||
2822 | release_region(d->base_addr, HP100_REGION_SIZE); | 2822 | release_region(d->base_addr, HP100_REGION_SIZE); |
2823 | 2823 | ||
2824 | if (p->mode == 1) /* busmaster */ | 2824 | if (p->mode == 1) /* busmaster */ |
2825 | pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, | 2825 | pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, |
2826 | p->page_vaddr_algn, | 2826 | p->page_vaddr_algn, |
2827 | virt_to_whatever(d, p->page_vaddr_algn)); | 2827 | virt_to_whatever(d, p->page_vaddr_algn)); |
2828 | if (p->mem_ptr_virt) | 2828 | if (p->mem_ptr_virt) |
2829 | iounmap(p->mem_ptr_virt); | 2829 | iounmap(p->mem_ptr_virt); |
@@ -2849,7 +2849,7 @@ static int __init hp100_eisa_probe (struct device *gendev) | |||
2849 | goto out1; | 2849 | goto out1; |
2850 | 2850 | ||
2851 | #ifdef HP100_DEBUG | 2851 | #ifdef HP100_DEBUG |
2852 | 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, |
2853 | dev->base_addr); | 2853 | dev->base_addr); |
2854 | #endif | 2854 | #endif |
2855 | gendev->driver_data = dev; | 2855 | gendev->driver_data = dev; |
@@ -2913,12 +2913,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, | |||
2913 | pci_command |= PCI_COMMAND_MASTER; | 2913 | pci_command |= PCI_COMMAND_MASTER; |
2914 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); | 2914 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | ioaddr = pci_resource_start(pdev, 0); | 2917 | ioaddr = pci_resource_start(pdev, 0); |
2918 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); | 2918 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); |
2919 | if (err) | 2919 | if (err) |
2920 | goto out1; | 2920 | goto out1; |
2921 | 2921 | ||
2922 | #ifdef HP100_DEBUG | 2922 | #ifdef HP100_DEBUG |
2923 | 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); |
2924 | #endif | 2924 | #endif |
@@ -3003,7 +3003,7 @@ static int __init hp100_isa_init(void) | |||
3003 | return cards > 0 ? 0 : -ENODEV; | 3003 | return cards > 0 ? 0 : -ENODEV; |
3004 | } | 3004 | } |
3005 | 3005 | ||
3006 | static void __exit hp100_isa_cleanup(void) | 3006 | static void __exit hp100_isa_cleanup(void) |
3007 | { | 3007 | { |
3008 | int i; | 3008 | int i; |
3009 | 3009 | ||
@@ -3027,12 +3027,12 @@ static int __init hp100_module_init(void) | |||
3027 | goto out; | 3027 | goto out; |
3028 | #ifdef CONFIG_EISA | 3028 | #ifdef CONFIG_EISA |
3029 | err = eisa_driver_register(&hp100_eisa_driver); | 3029 | err = eisa_driver_register(&hp100_eisa_driver); |
3030 | if (err && err != -ENODEV) | 3030 | if (err && err != -ENODEV) |
3031 | goto out2; | 3031 | goto out2; |
3032 | #endif | 3032 | #endif |
3033 | #ifdef CONFIG_PCI | 3033 | #ifdef CONFIG_PCI |
3034 | err = pci_module_init(&hp100_pci_driver); | 3034 | err = pci_module_init(&hp100_pci_driver); |
3035 | if (err && err != -ENODEV) | 3035 | if (err && err != -ENODEV) |
3036 | goto out3; | 3036 | goto out3; |
3037 | #endif | 3037 | #endif |
3038 | out: | 3038 | out: |