patch-2.1.19 linux/drivers/net/atarilance.c
Next file: linux/drivers/net/baycom.c
Previous file: linux/drivers/net/atari_pamsnet.c
Back to the patch index
Back to the overall index
- Lines: 295
- Date:
Tue Dec 31 10:30:00 1996
- Orig file:
v2.1.18/linux/drivers/net/atarilance.c
- Orig date:
Sun Dec 22 16:37:32 1996
diff -u --recursive --new-file v2.1.18/linux/drivers/net/atarilance.c linux/drivers/net/atarilance.c
@@ -81,6 +81,7 @@
#else
static int lance_debug = 1;
#endif
+MODULE_PARM(lance_debug, "i");
/* Print debug messages on probing? */
#undef LANCE_DEBUG_PROBE
@@ -94,7 +95,7 @@
#ifdef LANCE_DEBUG_PROBE
# define PROBE_PRINT(a) printk a
#else
-# define PROBE_PRINT(a)
+# define PROBE_PRINT(a)
#endif
/* These define the number of Rx and Tx buffers as log2. (Only powers
@@ -372,12 +373,12 @@
{ int i;
static int found = 0;
-
+
if (!MACH_IS_ATARI || found)
/* Assume there's only one board possible... That seems true, since
* the Riebl/PAM board's address cannot be changed. */
return( ENODEV );
-
+
for( i = 0; i < N_LANCE_ADDR; ++i ) {
if (lance_probe1( dev, &lance_addr_list[i] )) {
found = 1;
@@ -402,7 +403,7 @@
__asm__ __volatile__ ( "movec %/vbr,%0" : "=r" (vbr) : );
save_berr = vbr[2];
-
+
__asm__ __volatile__
( "movel %/sp,%/d1\n\t"
"movel #Lberr,%2@\n\t"
@@ -436,7 +437,7 @@
vbr[2] = save_berr;
restore_flags(flags);
-
+
return( ret );
}
@@ -453,7 +454,7 @@
int i;
static int did_version = 0;
unsigned short save1, save2;
-
+
PROBE_PRINT(( "Probing for Lance card at mem %#lx io %#lx\n",
(long)memaddr, (long)ioaddr ));
@@ -470,7 +471,7 @@
*memaddr = 0x0000;
if (*memaddr != 0x0000) goto probe_fail;
*memaddr = save1;
-
+
/* First port should be readable and writable */
PROBE_PRINT(( "lance_probe1: testing ioport to be accessible\n" ));
if (!addr_accessible( ioaddr, 1, 1 )) goto probe_fail;
@@ -505,7 +506,7 @@
probe_fail:
return( 0 );
-
+
probe_ok:
init_etherdev( dev, sizeof(struct lance_private) );
if (!dev->priv)
@@ -515,7 +516,7 @@
IO = lp->iobase = (struct lance_ioreg *)ioaddr;
dev->base_addr = (unsigned long)ioaddr; /* informational only */
lp->memcpy_f = init_rec->slow_flag ? slow_memcpy : memcpy;
-
+
REGA( CSR0 ) = CSR0_STOP;
/* Now test for type: If the eeprom I/O port is readable, it is a
@@ -530,7 +531,7 @@
}
else
lp->cardtype = OLD_RIEBL;
-
+
if (lp->cardtype == PAM_CARD ||
memaddr == (unsigned short *)0xffe00000) {
/* PAMs card and Riebl on ST use level 5 autovector */
@@ -572,7 +573,7 @@
case PAM_CARD:
i = IO->eeprom;
for( i = 0; i < 6; ++i )
- dev->dev_addr[i] =
+ dev->dev_addr[i] =
((((unsigned short *)MEM)[i*2] & 0x0f) << 4) |
((((unsigned short *)MEM)[i*2+1] & 0x0f));
i = IO->mem;
@@ -585,7 +586,7 @@
dev->name );
printk( " Use \"ifconfig hw ether ...\" to set the address.\n" );
}
-
+
MEM->init.mode = 0x0000; /* Disable Rx and Tx. */
for( i = 0; i < 6; i++ )
MEM->init.hwaddr[i] = dev->dev_addr[i^1]; /* <- 16 bit swap! */
@@ -602,7 +603,7 @@
IO->ivec = IRQ_SOURCE_TO_VECTOR(dev->irq);
else
*RIEBL_IVEC_ADDR = IRQ_SOURCE_TO_VECTOR(dev->irq);
-
+
if (did_version++ == 0)
DPRINTK( 1, ( version ));
@@ -616,7 +617,7 @@
dev->start = 0;
memset( &lp->stats, 0, sizeof(lp->stats) );
-
+
return( 1 );
}
@@ -632,12 +633,12 @@
lance_init_ring(dev);
/* Re-initialize the LANCE, and start it when done. */
- REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
+ REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
REGA( CSR2 ) = 0;
REGA( CSR1 ) = 0;
REGA( CSR0 ) = CSR0_INIT;
/* From now on, AREG is kept to point to CSR0 */
-
+
i = 1000000;
while (--i > 0)
if (DREG & CSR0_IDON)
@@ -670,7 +671,7 @@
{ struct lance_private *lp = (struct lance_private *)dev->priv;
int i;
unsigned offset;
-
+
lp->lock = 0;
lp->tx_full = 0;
lp->cur_rx = lp->cur_tx = 0;
@@ -718,7 +719,7 @@
int entry, len;
struct lance_tx_head *head;
unsigned long flags;
-
+
/* Transmitter timeout, serious problems. */
if (dev->tbusy) {
int tickssofar = jiffies - dev->trans_start;
@@ -732,7 +733,7 @@
* Always set BSWP after a STOP as STOP puts it back into
* little endian mode.
*/
- REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
+ REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
lp->stats.tx_errors++;
#ifndef final_version
{ int i;
@@ -808,7 +809,7 @@
/* Mask to ring buffer boundary. */
entry = lp->cur_tx & TX_RING_MOD_MASK;
head = &(MEM->tx_head[entry]);
-
+
/* Caution: the write order is important here, set the "ownership" bits
* last.
*/
@@ -885,7 +886,7 @@
while( dirty_tx < lp->cur_tx) {
int entry = dirty_tx & TX_RING_MOD_MASK;
int status = MEM->tx_head[entry].flag;
-
+
if (status & TMD1_OWN_CHIP)
break; /* It still hasn't been Txed */
@@ -965,12 +966,12 @@
DPRINTK( 2, ( "%s: rx int, flag=%04x\n", dev->name,
MEM->rx_head[entry].flag ));
-
+
/* If we own the next entry, it's a new packet. Send it up. */
while( (MEM->rx_head[entry].flag & RMD1_OWN) == RMD1_OWN_HOST ) {
struct lance_rx_head *head = &(MEM->rx_head[entry]);
int status = head->flag;
-
+
if (status != (RMD1_ENP|RMD1_STP)) { /* There was an error. */
/* There is a tricky error noted by John Murphy,
<murf@perftech.com> to Russ Nelson: Even with full-sized
@@ -1001,7 +1002,7 @@
if (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag &
RMD1_OWN_CHIP)
break;
-
+
if (i > RX_RING_SIZE - 2) {
lp->stats.rx_dropped++;
head->flag |= RMD1_OWN_CHIP;
@@ -1025,7 +1026,7 @@
data[19], data[20], data[21], data[22],
pkt_len );
}
-
+
skb->dev = dev;
skb_reserve( skb, 2 ); /* 16 byte align */
skb_put( skb, pkt_len ); /* Make room */
@@ -1094,7 +1095,7 @@
if (!dev->start)
/* Only possible if board is already started */
return;
-
+
/* We take the simple way out and always enable promiscuous mode. */
DREG = CSR0_STOP; /* Temporarily stop the lance. */
@@ -1119,7 +1120,7 @@
* Always set BSWP after a STOP as STOP puts it back into
* little endian mode.
*/
- REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
+ REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
/* Resume normal operation and reset AREG to CSR0 */
REGA( CSR0 ) = CSR0_IDON | CSR0_INEA | CSR0_STRT;
@@ -1133,7 +1134,7 @@
{ struct lance_private *lp = (struct lance_private *)dev->priv;
struct sockaddr *saddr = addr;
int i;
-
+
if (lp->cardtype != OLD_RIEBL && lp->cardtype != NEW_RIEBL)
return( -EOPNOTSUPP );
@@ -1150,7 +1151,7 @@
lp->memcpy_f( RIEBL_HWADDR_ADDR, dev->dev_addr, 6 );
/* set also the magic for future sessions */
*RIEBL_MAGIC_ADDR = RIEBL_MAGIC;
-
+
return( 0 );
}
@@ -1158,7 +1159,7 @@
#ifdef MODULE
static char devicename[9] = { 0, };
-static struct device atarilance_dev =
+static struct device atarilance_dev =
{
devicename, /* filled in by register_netdev() */
0, 0, 0, 0, /* memory */
@@ -1169,7 +1170,7 @@
int init_module(void)
{ int err;
-
+
if ((err = register_netdev( &atarilance_dev ))) {
if (err == -EIO) {
printk( "No Atari Lance board found. Module not loaded.\n");
@@ -1177,14 +1178,14 @@
return( err );
}
return( 0 );
-}
+}
void cleanup_module(void)
{
unregister_netdev( &atarilance_dev );
}
-
+
#endif /* MODULE */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov