patch-2.1.19 linux/drivers/net/ewrk3.c

Next file: linux/drivers/net/fmv18x.c
Previous file: linux/drivers/net/eth16i.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.18/linux/drivers/net/ewrk3.c linux/drivers/net/ewrk3.c
@@ -76,14 +76,14 @@
     kernel with the ewrk3 configuration turned off and reboot.
     5) insmod ewrk3.o
           [Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y]
-    6) run the net startup bits for your new eth?? interface manually 
-    (usually /etc/rc.inet[12] at boot time). 
+    6) run the net startup bits for your new eth?? interface manually
+    (usually /etc/rc.inet[12] at boot time).
     7) enjoy!
 
     Note that autoprobing is not allowed in loadable modules - the system is
     already up and running and you're messing with interrupts.
 
-    To unload a module, turn off the associated interface 
+    To unload a module, turn off the associated interface
     'ifconfig eth?? down' then 'rmmod ewrk3'.
 
     Promiscuous   mode has been  turned  off  in this driver,   but  all the
@@ -105,9 +105,9 @@
     ----------------
 
     Version   Date        Description
-  
+
       0.1     26-aug-94   Initial writing. ALPHA code release.
-      0.11    31-aug-94   Fixed: 2k mode memory base calc., 
+      0.11    31-aug-94   Fixed: 2k mode memory base calc.,
                                  LeMAC version calc.,
 				 IRQ vector assignments during autoprobe.
       0.12    31-aug-94   Tested working on LeMAC2 (DE20[345]-AC) card.
@@ -128,7 +128,7 @@
                           Added verify_area() calls in ewrk3_ioctl() from
                           suggestion by <heiko@colossus.escape.de>.
 			  Add new multicasting code.
-      0.41    20-Jan-96   Fix IRQ set up problem reported by 
+      0.41    20-Jan-96   Fix IRQ set up problem reported by
                           <kenneth@bbs.sas.ntu.ac.sg>.
       0.42    22-Apr-96	  Fix alloc_device() bug <jari@markkus2.fimr.fi>
       0.43    16-Aug-96	  Update alloc_device() to conform to de4x5.c
@@ -196,7 +196,7 @@
 #define MAX_NUM_EWRK3S 21
 #endif
 
-#ifndef EWRK3_EISA_IO_PORTS 
+#ifndef EWRK3_EISA_IO_PORTS
 #define EWRK3_EISA_IO_PORTS 0x0c00      /* I/O port base address, slot 0 */
 #endif
 
@@ -358,7 +358,7 @@
     eisa_probe(dev, iobase);
 
     if ((tmp == num_ewrk3s) && (iobase != 0) && loading_module) {
-      printk("%s: ewrk3_probe() cannot find device at 0x%04lx.\n", dev->name, 
+      printk("%s: ewrk3_probe() cannot find device at 0x%04lx.\n", dev->name,
 	                                                               iobase);
     }
 
@@ -419,7 +419,7 @@
       EthwrkSignature(name, eeprom_image);
       if (*name != '\0') {                         /* found a EWRK3 device */
 	dev->base_addr = iobase;
-      
+
 	if (iobase > 0x400) {
 	  outb(eisa_cr, EISA_CR);                  /* Rewrite the EISA CR */
 	}
@@ -433,12 +433,12 @@
 	  hard_strapped = 1;
 	} else if ((iobase&0x0fff)==EWRK3_EISA_IO_PORTS) {
 	                                           /* EISA slot address */
-	  printk("%s: %s at %#4lx (EISA slot %ld)", 
+	  printk("%s: %s at %#4lx (EISA slot %ld)",
 	                         dev->name, name, iobase, ((iobase>>12)&0x0f));
 	} else {                                   /* ISA port address */
 	  printk("%s: %s at %#4lx", dev->name, name, iobase);
 	}
-	
+
 	if (!status) {
 	  printk(", h/w address ");
 	  if (lemac!=LeMAC2) DevicePresent(iobase);/* need after EWRK3_INIT */
@@ -470,7 +470,7 @@
 	    cr |= eeprom_image[EEPROM_MISC0] & ENA_16;
 	    outb(cr, EWRK3_CR);
 
-	    /* 
+	    /*
 	    ** Determine the base address and window length for the EWRK3
 	    ** RAM from the memory base register.
 	    */
@@ -490,7 +490,7 @@
 		status = -ENXIO;
 	      }
 	    }
-	  
+
 	    /*
 	    ** See the top of this source code for comments about
 	    ** uncommenting this line.
@@ -506,9 +506,9 @@
 	      } else {
 		printk("      is in I/O only mode");
 	      }
-	    
+
 	      /* private area & initialise */
-	      dev->priv = (void *) kmalloc(sizeof(struct ewrk3_private), 
+	      dev->priv = (void *) kmalloc(sizeof(struct ewrk3_private),
 					                           GFP_KERNEL);
 	      if (dev->priv == NULL) {
 		return -ENOMEM;
@@ -521,40 +521,40 @@
 	      lp->hard_strapped = hard_strapped;
 
 	      lp->mPage = 64;
-	      if (cmr & CMR_DRAM) lp->mPage <<= 1 ;/* 2 DRAMS on module */ 
+	      if (cmr & CMR_DRAM) lp->mPage <<= 1 ;/* 2 DRAMS on module */
 
 	      sprintf(lp->adapter_name,"%s (%s)", name, dev->name);
 	      request_region(iobase, EWRK3_TOTAL_SIZE, lp->adapter_name);
 
 	      lp->irq_mask = ICR_TNEM|ICR_TXDM|ICR_RNEM|ICR_RXDM;
-	      
+
 	      if (!hard_strapped) {
 		/*
 		** Enable EWRK3 board interrupts for autoprobing
 		*/
 		icr |= ICR_IE;	                   /* Enable interrupts */
 		outb(icr, EWRK3_ICR);
-	    
+
 		/* The DMA channel may be passed in on this parameter. */
 		dev->dma = 0;
-	
+
 		/* To auto-IRQ we enable the initialization-done and DMA err,
 		   interrupts. For now we will always get a DMA error. */
 		if (dev->irq < 2) {
 #ifndef MODULE
 		  u_char irqnum;
-	      
+
 		  autoirq_setup(0);
 
-		  /* 
+		  /*
 		  ** Trigger a TNE interrupt.
 		  */
 		  icr |=ICR_TNEM;
 		  outb(1,EWRK3_TDQ);          /* Write to the TX done queue */
 		  outb(icr, EWRK3_ICR);       /* Unmask the TXD interrupt */
-	      
+
 		  irqnum = irq[((icr & IRQ_SEL) >> 4)];
-	      
+
 		  dev->irq = autoirq_report(1);
 		  if ((dev->irq) && (irqnum == dev->irq)) {
 		    printk(" and uses IRQ%d.\n", dev->irq);
@@ -568,7 +568,7 @@
 		    }
 		    status = -ENXIO;
 		  }
-		
+
 		  DISABLE_IRQs;                 /* Mask all interrupts */
 
 #endif /* MODULE */
@@ -591,7 +591,7 @@
       if (ewrk3_debug > 1) {
 	printk(version);
       }
-      
+
       /* The EWRK3-specific entries in the device structure. */
       dev->open = &ewrk3_open;
       dev->hard_start_xmit = &ewrk3_queue_pkt;
@@ -601,7 +601,7 @@
       dev->do_ioctl = &ewrk3_ioctl;
 
       dev->mem_start = 0;
-	
+
       /* Fill in the generic field of the device structure. */
       ether_setup(dev);
     }
@@ -634,8 +634,8 @@
       status = -EAGAIN;
     } else {
 
-      /* 
-      ** Re-initialize the EWRK3... 
+      /*
+      ** Re-initialize the EWRK3...
       */
       ewrk3_init(dev);
 
@@ -660,7 +660,7 @@
 	printk("  fmqc: 0x%02x\n", inb(EWRK3_FMQC));
       }
 
-      dev->tbusy = 0;                         
+      dev->tbusy = 0;
       dev->start = 1;
       dev->interrupt = UNMASK_INTERRUPTS;
 
@@ -692,9 +692,9 @@
   struct ewrk3_private *lp = (struct ewrk3_private *)dev->priv;
   u_char csr, page;
   u_long iobase = dev->base_addr;
-  
-  /* 
-  ** Enable any multicasts 
+
+  /*
+  ** Enable any multicasts
   */
   set_multicast_list(dev);
 
@@ -718,7 +718,7 @@
   START_EWRK3;                              /* Enable the TX and/or RX */
 }
 
-/* 
+/*
 ** Writes a socket buffer to the free page queue
 */
 static int
@@ -737,7 +737,7 @@
     } else if (!lp->hard_strapped) {
       printk("%s: transmit timed/locked out, status %04x, resetting.\n",
 	                                           dev->name, inb(EWRK3_CSR));
-	
+
       /*
       ** Mask all board interrupts
       */
@@ -762,16 +762,16 @@
     dev_tint(dev);
   } else if (skb->len > 0) {
 
-    /* 
+    /*
     ** Block a timer-based transmit from overlapping.  This could better be
-    ** done with atomic_swap(1, dev->tbusy), but set_bit() works as well. 
+    ** done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
     */
     if (set_bit(0, (void*)&dev->tbusy) != 0)
       printk("%s: Transmitter access conflict.\n", dev->name);
 
     DISABLE_IRQs;                      /* So that the page # remains correct */
-    
-    /* 
+
+    /*
     ** Get a free page from the FMQ when resources are available
     */
     if (inb(EWRK3_FMQC) > 0) {
@@ -801,7 +801,7 @@
 
 	if (!status) {
 
-          /* 
+          /*
 	  ** Set up the buffer control structures and copy the data from
 	  ** the socket buffer to the shared memory .
 	  */
@@ -809,7 +809,7 @@
 	  if (lp->shmem_length == IO_ONLY) {
 	    int i;
 	    u_char *p = skb->data;
-	    
+
 	    outb((char)(TCR_QMODE | TCR_PAD | TCR_IFC), EWRK3_DATA);
 	    outb((char)(skb->len & 0xff), EWRK3_DATA);
 	    outb((char)((skb->len >> 8) & 0xff), EWRK3_DATA);
@@ -858,7 +858,7 @@
       printk("ewrk3_queue_pkt(): No free resources...\n");
       printk("ewrk3_queue_pkt(): CSR: %02x ICR: %02x FMQC: %02x\n",inb(EWRK3_CSR),inb(EWRK3_ICR),inb(EWRK3_FMQC));
     }
-    
+
     /* Check for free resources: clear 'tbusy' if there are some */
     if (inb(EWRK3_FMQC) > 0) {
       dev->tbusy = 0;
@@ -871,7 +871,7 @@
 }
 
 /*
-** The EWRK3 interrupt handler. 
+** The EWRK3 interrupt handler.
 */
 static void
 ewrk3_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -895,8 +895,8 @@
       /* get the interrupt information */
       csr = inb(EWRK3_CSR);
 
-      /* 
-      ** Mask the EWRK3 board interrupts and turn on the LED 
+      /*
+      ** Mask the EWRK3 board interrupts and turn on the LED
       */
       DISABLE_IRQs;
 
@@ -1017,8 +1017,8 @@
 	      memcpy_fromio(p, buf, pkt_len);
 	    }
 
-	    /* 
-	    ** Notify the upper protocol layers that there is another 
+	    /*
+	    ** Notify the upper protocol layers that there is another
 	    ** packet to handle
 	    */
 	    skb->protocol=eth_type_trans(skb,dev);
@@ -1131,7 +1131,7 @@
 	   dev->name, inb(EWRK3_CSR));
   }
 
-  /* 
+  /*
   ** We stop the EWRK3 here... mask interrupts and stop TX & RX
   */
   DISABLE_IRQs;
@@ -1150,7 +1150,7 @@
 
   if (!lp->hard_strapped) {
     free_irq(dev->irq, NULL);
-    
+
     irq2dev_map[dev->irq] = 0;
   }
 
@@ -1165,7 +1165,7 @@
   struct ewrk3_private *lp = (struct ewrk3_private *)dev->priv;
 
   /* Null body since there is no framing error counter */
-    
+
   return &lp->stats;
 }
 
@@ -1181,7 +1181,7 @@
 
   if (irq2dev_map[dev->irq] != NULL) {
     csr = inb(EWRK3_CSR);
-    
+
     if (lp->shmem_length == IO_ONLY) {
       lp->mctbl = (char *) PAGE0_HTE;
     } else {
@@ -1242,11 +1242,11 @@
     if (lp->shmem_length == IO_ONLY) {
       for (i=0; i<(HASH_TABLE_LEN >> 4) - 1; i++) {
 	outb(0x00, EWRK3_DATA);
-      } 
+      }
       outb(0x80, EWRK3_DATA); i++;           /* insert the broadcast bit */
       for (; i<(HASH_TABLE_LEN >> 3); i++) {
 	outb(0x00, EWRK3_DATA);
-      } 
+      }
     } else {
       memset_io(lp->mctbl, 0, (HASH_TABLE_LEN >> 3));
       writeb(0x80, (char *)(lp->mctbl + (HASH_TABLE_LEN >> 4) - 1));
@@ -1256,10 +1256,10 @@
     for (i=0;i<dev->mc_count;i++) {          /* for each address in the list */
       addrs=dmi->dmi_addr;
       dmi=dmi->next;
-      if ((*addrs & 0x01) == 1) {            /* multicast address? */ 
+      if ((*addrs & 0x01) == 1) {            /* multicast address? */
 	crc = 0xffffffff;                    /* init CRC for each address */
 	for (byte=0;byte<ETH_ALEN;byte++) {  /* for each address byte */
-	                                     /* process each address bit */ 
+	                                     /* process each address bit */
 	  for (bit = *addrs++,j=0;j<8;j++, bit>>=1) {
 	    crc = (crc >> 1) ^ (((crc ^ bit) & 0x01) ? poly : 0);
 	  }
@@ -1276,7 +1276,7 @@
 	  tmp = inb(EWRK3_DATA);
 	  tmp |= bit;
 	  outw((short)((long)lp->mctbl) + byte, EWRK3_PIR1);
-	  outb(tmp, EWRK3_DATA); 
+	  outb(tmp, EWRK3_DATA);
 	} else {
 	  writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte);
 	}
@@ -1309,7 +1309,7 @@
   }
 
   for (; (i<maxSlots) && (dev!=NULL);iobase+=EWRK3_IOP_INC, i++) {
-    if (!check_region(iobase, EWRK3_TOTAL_SIZE)) {    
+    if (!check_region(iobase, EWRK3_TOTAL_SIZE)) {
       if (DevicePresent(iobase) == 0) {
 	if ((dev = alloc_device(dev, iobase)) != NULL) {
 	  if (ewrk3_hw_init(dev, iobase) == 0) {
@@ -1383,7 +1383,7 @@
 
     num_eth = ewrk3_dev_index(dev->name);
     if (loading_module) return dev;
-    
+
     while (1) {
 	if (((dev->base_addr == EWRK3_NDA) || (dev->base_addr==0)) && !adev) {
 	    adev=dev;
@@ -1406,13 +1406,13 @@
 	new_dev = 0;
     }
 
-    if (((dev->next == NULL) &&  
+    if (((dev->next == NULL) &&
 	((dev->base_addr != EWRK3_NDA) && (dev->base_addr != 0)) && !fixed) ||
 	new_dev) {
 	num_eth++;                         /* New device */
 	dev = insert_device(dev, iobase, ewrk3_probe);
     }
-    
+
     return dev;
 }
 
@@ -1525,7 +1525,7 @@
 /*
 ** Look for a special sequence in the Ethernet station address PROM that
 ** is common across all EWRK3 products.
-** 
+**
 ** Search the Ethernet address ROM for the signature. Since the ROM address
 ** counter can start at an arbitrary point, the search must include the entire
 ** probe sequence length plus the (length_of_the_signature - 1).
@@ -1737,7 +1737,7 @@
 	memcpy_fromio(tmp.addr, (char *)(lp->shmem_base + PAGE0_HTE), (HASH_TABLE_LEN >> 3));
       }
       ioc->len = (HASH_TABLE_LEN >> 3);
-      copy_to_user(ioc->data, tmp.addr, ioc->len); 
+      copy_to_user(ioc->data, tmp.addr, ioc->len);
     }
     lp->lock = 0;                               /* Unlock the page register */
 
@@ -1776,7 +1776,7 @@
     cli();
     ioc->len = sizeof(lp->pktStats);
     if (!(status=verify_area(VERIFY_WRITE, ioc->data, ioc->len))) {
-      copy_to_user(ioc->data, &lp->pktStats, ioc->len); 
+      copy_to_user(ioc->data, &lp->pktStats, ioc->len);
     }
     sti();
 
@@ -1880,10 +1880,13 @@
   0, 0, 0, 0,
   0x300, 5,   /* I/O address, IRQ */
   0, 0, 0, NULL, ewrk3_probe };
-	
+
 static int io=0x300;	/* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
 static int irq=5;	/* or use the insmod io= irq= options 		*/
 
+MODULE_PARM(io, "i");
+MODULE_PARM(irq, "i");
+
 int
 init_module(void)
 {
@@ -1916,4 +1919,3 @@
  *  compile-command: "gcc -D__KERNEL__ -DMODULE -I/linux/include -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2 -O2 -m486 -c ewrk3.c"
  * End:
  */
-

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov