patch-2.1.19 linux/drivers/net/depca.c
Next file: linux/drivers/net/dgrs.c
Previous file: linux/drivers/net/de620.c
Back to the patch index
Back to the overall index
- Lines: 511
- Date:
Tue Dec 31 10:30:00 1996
- Orig file:
v2.1.18/linux/drivers/net/depca.c
- Orig date:
Tue Nov 12 15:56:07 1996
diff -u --recursive --new-file v2.1.18/linux/drivers/net/depca.c linux/drivers/net/depca.c
@@ -4,9 +4,9 @@
Copyright 1994 David C. Davies
- and
+ and
United States Government
- (as represented by the Director, National Security Agency).
+ (as represented by the Director, National Security Agency).
Copyright 1995 Digital Equipment Corporation.
@@ -61,7 +61,7 @@
Digital Equipment Corporation, 1989
8) "DEC EtherWORKS Turbo_(TP BNC) Ethernet Controller Owners Manual",
Digital Equipment corporation, 1991, Pub. #EK-DE202-OM.001
-
+
Peter Bauer's depca.c (V0.5) was referred to when debugging V0.1 of this
driver.
@@ -135,20 +135,20 @@
[Alan Cox: Changed the code to allow command line irq/io assignments]
[Dave Davies: Changed the code to allow command line mem/name
assignments]
- 6) run the net startup bits for your eth?? interface manually
- (usually /etc/rc.inet[12] at boot time).
+ 6) run the net startup bits for your 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 depca'.
To assign a base memory address for the shared memory when running as a
loadable module, see 5 above. To include the adapter name (if you have
no PROM but know the card name) also see 5 above. Note that this last
- option will not work with kernel built-in depca's.
+ option will not work with kernel built-in depca's.
The shared memory assignment for a loadable module makes sense to avoid
the 'memory autoprobe' picking the wrong shared memory (for the case of
@@ -163,7 +163,7 @@
----------------
Version Date Description
-
+
0.1 25-jan-94 Initial writing.
0.2 27-jan-94 Added LANCE TX hardware buffer chaining.
0.3 1-feb-94 Added multiple DEPCA support.
@@ -177,7 +177,7 @@
0.351 30-apr-94 Added EISA support. Added DE422 recognition.
0.36 16-may-94 DE422 fix released.
0.37 22-jul-94 Added MODULE support
- 0.38 15-aug-94 Added DBR ROM switch in depca_close().
+ 0.38 15-aug-94 Added DBR ROM switch in depca_close().
Multi DEPCA bug fix.
0.38axp 15-sep-94 Special version for Alpha AXP Linux V1.0.
0.381 12-dec-94 Added DE101 recognition, fix multicast bug.
@@ -185,17 +185,17 @@
0.383 22-feb-95 Fix for conflict with VESA SCSI reported by
<stromain@alf.dec.com>
0.384 17-mar-95 Fix a ring full bug reported by <bkm@star.rl.ac.uk>
- 0.385 3-apr-95 Fix a recognition bug reported by
+ 0.385 3-apr-95 Fix a recognition bug reported by
<ryan.niemi@lastfrontier.com>
0.386 21-apr-95 Fix the last fix...sorry, must be galloping senility
0.40 25-May-95 Rewrite for portability & updated.
ALPHA support from <jestabro@amt.tay1.dec.com>
0.41 26-Jun-95 Added verify_area() calls in depca_ioctl() from
suggestion by <heiko@colossus.escape.de>
- 0.42 27-Dec-95 Add 'mem' shared memory assignment for loadable
+ 0.42 27-Dec-95 Add 'mem' shared memory assignment for loadable
modules.
Add 'adapter_name' for loadable modules when no PROM.
- Both above from a suggestion by
+ Both above from a suggestion by
<pchen@woodruffs121.residence.gatech.edu>.
Add new multicasting code.
0.421 22-Apr-96 Fix alloc_device() bug <jari@markkus2.fimr.fi>
@@ -300,14 +300,14 @@
** Memory Alignment. Each descriptor is 4 longwords long. To force a
** particular alignment on the TX descriptor, adjust DESC_SKIP_LEN and
** DESC_ALIGN. ALIGN aligns the start address of the private memory area
-** and hence the RX descriptor ring's first entry.
+** and hence the RX descriptor ring's first entry.
*/
#define ALIGN4 ((u_long)4 - 1) /* 1 longword align */
#define ALIGN8 ((u_long)8 - 1) /* 2 longword (quadword) align */
#define ALIGN ALIGN8 /* Keep the LANCE happy... */
/*
-** The DEPCA Rx and Tx ring descriptors.
+** The DEPCA Rx and Tx ring descriptors.
*/
struct depca_rx_desc {
volatile s32 base;
@@ -454,7 +454,7 @@
eisa_probe(dev, iobase);
if ((tmp == num_depcas) && (iobase != 0) && loading_module) {
- printk("%s: depca_probe() cannot find device at 0x%04lx.\n", dev->name,
+ printk("%s: depca_probe() cannot find device at 0x%04lx.\n", dev->name,
iobase);
}
@@ -496,7 +496,7 @@
dev->base_addr = ioaddr;
if ((ioaddr&0x0fff)==DEPCA_EISA_IO_PORTS) {/* EISA slot address */
- printk("%s: %s at 0x%04lx (EISA slot %d)",
+ printk("%s: %s at 0x%04lx (EISA slot %d)",
dev->name, name, ioaddr, (int)((ioaddr>>12)&0x0f));
} else { /* ISA port address */
printk("%s: %s at 0x%04lx", dev->name, name, ioaddr);
@@ -515,7 +515,7 @@
if ((nicsr & _128KB) && (adapter == de422)) netRAM = 128;
offset = 0x0000;
- /* Shared Memory Base Address */
+ /* Shared Memory Base Address */
if (nicsr & BUF) {
offset = 0x8000; /* 32kbyte RAM offset*/
nicsr &= ~BS; /* DEPCA RAM in top 32k */
@@ -533,7 +533,7 @@
nicsr |= SHE;
outb(nicsr, DEPCA_NICSR);
}
-
+
/* Define the device private memory */
dev->priv = (void *) kmalloc(sizeof(struct depca_private), GFP_KERNEL);
if (dev->priv == NULL)
@@ -591,7 +591,7 @@
#ifndef MODULE
unsigned char irqnum;
autoirq_setup(0);
-
+
/* Assign the correct irq list */
switch (lp->adapter) {
case DEPCA:
@@ -612,7 +612,7 @@
/* Trigger an initialization just for the interrupt. */
outw(INEA | INIT, DEPCA_DATA);
-
+
irqnum = autoirq_report(1);
if (!irqnum) {
printk(" and failed to detect IRQ line.\n");
@@ -624,7 +624,7 @@
printk(" and uses IRQ%d.\n", dev->irq);
}
}
-
+
if (!dev->irq) {
printk(" but incorrect IRQ line detected.\n");
status = -ENXIO;
@@ -636,7 +636,7 @@
}
if (status) release_region(ioaddr, DEPCA_TOTAL_SIZE);
} else {
- printk(",\n requests %dkB RAM: only %dkB is available!\n",
+ printk(",\n requests %dkB RAM: only %dkB is available!\n",
(mem_len>>10), netRAM);
status = -ENXIO;
}
@@ -661,7 +661,7 @@
dev->do_ioctl = &depca_ioctl;
dev->mem_start = 0;
-
+
/* Fill in the generic field of the device structure. */
ether_setup(dev);
} else { /* Incorrectly initialised hardware */
@@ -711,11 +711,11 @@
nicsr = ((nicsr & ~IM & ~LED)|IEN);
outb(nicsr, DEPCA_NICSR);
outw(CSR0,DEPCA_ADDR);
-
- dev->tbusy = 0;
+
+ dev->tbusy = 0;
dev->interrupt = 0;
dev->start = 1;
-
+
status = InitRestartDepca(dev);
if (depca_debug > 1){
@@ -725,7 +725,7 @@
}
MOD_INC_USE_COUNT;
-
+
return status;
}
@@ -770,8 +770,8 @@
return;
}
-/*
-** Writes a socket buffer to TX descriptor ring and starts transmission
+/*
+** Writes a socket buffer to TX descriptor ring and starts transmission
*/
static int
depca_start_xmit(struct sk_buff *skb, struct device *dev)
@@ -788,7 +788,7 @@
} else {
printk("%s: transmit timed out, status %04x, resetting.\n",
dev->name, inw(DEPCA_DATA));
-
+
STOP_DEPCA;
depca_init_ring(dev);
LoadCSRs(dev);
@@ -814,24 +814,24 @@
/* Trigger an immediate send demand. */
outw(CSR0, DEPCA_ADDR);
outw(INEA | TDMD, DEPCA_DATA);
-
+
dev->trans_start = jiffies;
dev_kfree_skb(skb, FREE_WRITE);
}
if (TX_BUFFS_AVAIL) {
dev->tbusy=0;
- }
+ }
} else {
status = -1;
}
}
}
-
+
return status;
}
/*
-** The DEPCA interrupt handler.
+** The DEPCA interrupt handler.
*/
static void
depca_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -846,7 +846,7 @@
} else {
lp = (struct depca_private *)dev->priv;
ioaddr = dev->base_addr;
-
+
if (dev->interrupt)
printk("%s: Re-entering the interrupt handler.\n", dev->name);
@@ -891,7 +891,7 @@
int i, entry;
s32 status;
- for (entry=lp->rx_new;
+ for (entry=lp->rx_new;
!(readl(&lp->rx_ring[entry].base) & R_OWN);
entry=lp->rx_new){
status = readl(&lp->rx_ring[entry].base) >> 16 ;
@@ -905,7 +905,7 @@
if (status & R_OFLO) lp->stats.rx_over_errors++;
if (status & R_CRC) lp->stats.rx_crc_errors++;
if (status & R_BUFF) lp->stats.rx_fifo_errors++;
- } else {
+ } else {
short len, pkt_len = readw(&lp->rx_ring[entry].msg_length);
struct sk_buff *skb;
@@ -923,13 +923,13 @@
memcpy_fromio(buf, lp->rx_memcpy[lp->rx_old], 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);
netif_rx(skb);
-
+
/*
** Update stats
*/
@@ -953,7 +953,7 @@
(*(s16 *)&buf[4] == *(s16 *)&dev->dev_addr[4])) {
lp->pktStats.unicast++;
}
-
+
lp->pktStats.bins[0]++; /* Duplicates stats.rx_packets */
if (lp->pktStats.bins[0] == 0) { /* Reset counters */
memset((char *)&lp->pktStats, 0, sizeof(lp->pktStats));
@@ -966,7 +966,7 @@
}
/* Change buffer ownership for this last frame, back to the adapter */
for (; lp->rx_old!=entry; lp->rx_old=(++lp->rx_old)&lp->rxRingMask) {
- writel(readl(&lp->rx_ring[lp->rx_old].base) | R_OWN,
+ writel(readl(&lp->rx_ring[lp->rx_old].base) | R_OWN,
&lp->rx_ring[lp->rx_old].base);
}
writel(readl(&lp->rx_ring[entry].base) | R_OWN, &lp->rx_ring[entry].base);
@@ -1039,9 +1039,9 @@
dev->name, inw(DEPCA_DATA));
}
- /*
+ /*
** We stop the DEPCA here -- it occasionally polls
- ** memory if we don't.
+ ** memory if we don't.
*/
outw(STOP, DEPCA_DATA);
@@ -1095,7 +1095,7 @@
outw(INIT, DEPCA_DATA); /* initialize DEPCA */
/* wait for lance to complete initialisation */
- for (i=0;(i<100) && !(inw(DEPCA_DATA) & IDON); i++);
+ for (i=0;(i<100) && !(inw(DEPCA_DATA) & IDON); i++);
if (i!=100) {
/* clear IDON by writing a "1", enable interrupts and start lance */
@@ -1131,7 +1131,7 @@
{
struct depca_private *lp = (struct depca_private *)dev->priv;
u_long ioaddr = dev->base_addr;
-
+
if (irq2dev_map[dev->irq] != NULL) {
while(dev->tbusy); /* Stop ring access */
set_bit(0, (void*)&dev->tbusy);
@@ -1180,10 +1180,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<0?1:0) ^ bit) & 0x01) ? poly : 0);
}
@@ -1191,9 +1191,9 @@
hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */
for (j=0;j<5;j++) { /* ... in reverse order. */
hashcode = (hashcode << 1) | ((crc>>=1) & 1);
- }
-
-
+ }
+
+
byte = hashcode >> 3; /* bit[3-5] -> byte in filter */
bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */
lp->init_block.mcast_table[byte] |= bit;
@@ -1224,7 +1224,7 @@
}
for (; (i<maxSlots) && (dev!=NULL) && ports[i]; i++) {
- if (DevicePresent(ports[i]) == 0) {
+ if (DevicePresent(ports[i]) == 0) {
if (check_region(ports[i], DEPCA_TOTAL_SIZE) == 0) {
if ((dev = alloc_device(dev, ports[i])) != NULL) {
if (depca_hw_init(dev, ports[i]) == 0) {
@@ -1267,7 +1267,7 @@
for (; (i<maxSlots) && (dev!=NULL); i++, iobase+=EISA_SLOT_INC) {
if (EISA_signature(name, EISA_ID)) {
- if (DevicePresent(iobase) == 0) {
+ if (DevicePresent(iobase) == 0) {
if (check_region(iobase, DEPCA_TOTAL_SIZE) == 0) {
if ((dev = alloc_device(dev, iobase)) != NULL) {
if (depca_hw_init(dev, iobase) == 0) {
@@ -1299,7 +1299,7 @@
num_eth = depca_dev_index(dev->name);
if (loading_module) return dev;
-
+
while (1) {
if (((dev->base_addr == DEPCA_NDA) || (dev->base_addr==0)) && !adev) {
adev=dev;
@@ -1322,13 +1322,13 @@
new_dev = 0;
}
- if (((dev->next == NULL) &&
+ if (((dev->next == NULL) &&
((dev->base_addr != DEPCA_NDA) && (dev->base_addr != 0)) && !fixed) ||
new_dev) {
num_eth++; /* New device */
dev = insert_device(dev, iobase, depca_probe);
}
-
+
return dev;
}
@@ -1426,7 +1426,7 @@
** if the first address octet is a 0x08 - this minimises the chances of
** messing around with some other hardware, but it assumes that this DEPCA
** card initialized itself correctly.
-**
+**
** 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).
@@ -1456,7 +1456,7 @@
nicsr |= AAC;
outb(nicsr, DEPCA_NICSR);
}
-
+
dev.llsig.a = ETH_PROM_SIG;
dev.llsig.b = ETH_PROM_SIG;
sigLength = sizeof(u32) << 1;
@@ -1525,7 +1525,7 @@
entry = lp->tx_new; /* Ring around buffer number. */
end = (entry + (skb->len - 1) / TX_BUFF_SZ) & lp->txRingMask;
if (!(readl(&lp->tx_ring[end].base) & T_OWN)) {/* Enough room? */
- /*
+ /*
** Caution: the write order is important here... don't set up the
** ownership rights until all the other information is in place.
*/
@@ -1560,9 +1560,9 @@
/* ownership of packet */
writel(readl(&lp->tx_ring[i].base) | T_OWN, &lp->tx_ring[i].base);
if (i == 0) i=lp->txRingMask+1;
- }
+ }
writel(readl(&lp->tx_ring[entry].base) | T_OWN, &lp->tx_ring[entry].base);
-
+
lp->tx_new = (++end) & lp->txRingMask; /* update current pointers */
} else {
status = -1;
@@ -1610,7 +1610,7 @@
struct depca_private *lp = (struct depca_private *)dev->priv;
u_long ioaddr = dev->base_addr;
struct depca_init *p = (struct depca_init *)lp->sh_mem;
- int i;
+ int i;
if (depca_debug > 1){
/* Copy the shadow init_block to shared memory */
@@ -1662,11 +1662,11 @@
printk("\trx_ring at: 0x%8.8x\n",readl(&p->rx_ring));
printk("\ttx_ring at: 0x%8.8x\n",readl(&p->tx_ring));
printk("dma_buffs: 0x%8.8lx\n",lp->dma_buffs);
- printk("Ring size:\nRX: %d Log2(rxRingMask): 0x%8.8x\n",
- (int)lp->rxRingMask + 1,
+ printk("Ring size:\nRX: %d Log2(rxRingMask): 0x%8.8x\n",
+ (int)lp->rxRingMask + 1,
lp->rx_rlen);
- printk("TX: %d Log2(txRingMask): 0x%8.8x\n",
- (int)lp->txRingMask + 1,
+ printk("TX: %d Log2(txRingMask): 0x%8.8x\n",
+ (int)lp->txRingMask + 1,
lp->tx_rlen);
outw(CSR2,DEPCA_ADDR);
printk("CSR2&1: 0x%4.4x",inw(DEPCA_DATA));
@@ -1772,7 +1772,7 @@
case DEPCA_GET_MCA: /* Get the multicast address table */
ioc->len = (HASH_TABLE_LEN >> 3);
if (!(status = verify_area(VERIFY_WRITE, ioc->data, ioc->len))) {
- copy_to_user(ioc->data, lp->init_block.mcast_table, ioc->len);
+ copy_to_user(ioc->data, lp->init_block.mcast_table, ioc->len);
}
break;
@@ -1807,7 +1807,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();
@@ -1851,8 +1851,10 @@
static int irq=7; /* EDIT THESE LINE FOR YOUR CONFIGURATION */
static int io=0x200; /* Or use the irq= io= options to insmod */
+MODULE_PARM(irq, "i");
+MODULE_PARM(io, "i");
-/* See depca_probe() for autoprobe messages when a module */
+/* See depca_probe() for autoprobe messages when a module */
int
init_module(void)
{
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov