Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ni52.c

Go to the documentation of this file.
00001 /*
00002  * net-3-driver for the NI5210 card (i82586 Ethernet chip)
00003  *
00004  * This is an extension to the Linux operating system, and is covered by the
00005  * same Gnu Public License that covers that work.
00006  *
00007  * Alphacode 0.82 (96/09/29) for Linux 2.0.0 (or later)
00008  * Copyrights (c) 1994,1995,1996 by M.Hipp (hippm@informatik.uni-tuebingen.de)
00009  *    [feel free to mail ....]
00010  *
00011  * when using as module: (no autoprobing!)
00012  *   compile with:
00013  *       gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ -DMODULE -c ni52.c
00014  *   run with e.g:
00015  *       insmod ni52.o io=0x360 irq=9 memstart=0xd0000 memend=0xd4000
00016  *
00017  * CAN YOU PLEASE REPORT ME YOUR PERFORMANCE EXPERIENCES !!.
00018  *
00019  * If you find a bug, please report me:
00020  *   The kernel panic output and any kmsg from the ni52 driver
00021  *   the ni5210-driver-version and the linux-kernel version
00022  *   how many shared memory (memsize) on the netcard,
00023  *   bootprom: yes/no, base_addr, mem_start
00024  *   maybe the ni5210-card revision and the i82586 version
00025  *
00026  * autoprobe for: base_addr: 0x300,0x280,0x360,0x320,0x340
00027  *                mem_start: 0xd0000,0xd2000,0xc8000,0xca000,0xd4000,0xd6000,
00028  *                           0xd8000,0xcc000,0xce000,0xda000,0xdc000
00029  *
00030  * sources:
00031  *   skeleton.c from Donald Becker
00032  *
00033  * I have also done a look in the following sources: (mail me if you need them)
00034  *   crynwr-packet-driver by Russ Nelson
00035  *   Garret A. Wollman's (fourth) i82586-driver for BSD
00036  *   (before getting an i82596 (yes 596 not 586) manual, the existing drivers
00037  *    helped me a lot to understand this tricky chip.)
00038  *
00039  * Known Problems:
00040  *   The internal sysbus seems to be slow. So we often lose packets because of
00041  *   overruns while receiving from a fast remote host.
00042  *   This can slow down TCP connections. Maybe the newer ni5210 cards are
00043  *   better.  My experience is, that if a machine sends with more than
00044  *   about 500-600K/s the fifo/sysbus overflows.
00045  *
00046  * IMPORTANT NOTE:
00047  *   On fast networks, it's a (very) good idea to have 16K shared memory. With
00048  *   8K, we can store only 4 receive frames, so it can (easily) happen that a
00049  *   remote machine 'overruns' our system.
00050  *
00051  * Known i82586/card problems (I'm sure, there are many more!):
00052  *   Running the NOP-mode, the i82586 sometimes seems to forget to report
00053  *   every xmit-interrupt until we restart the CU.
00054  *   Another MAJOR bug is, that the RU sometimes seems to ignore the EL-Bit
00055  *   in the RBD-Struct which indicates an end of the RBD queue.
00056  *   Instead, the RU fetches another (randomly selected and
00057  *   usually used) RBD and begins to fill it. (Maybe, this happens only if
00058  *   the last buffer from the previous RFD fits exact into the queue and
00059  *   the next RFD can't fetch an initial RBD. Anyone knows more? )
00060  *
00061  * results from ftp performance tests with Linux 1.2.5
00062  *   send and receive about 350-400 KByte/s (peak up to 460 kbytes/s)
00063  *   sending in NOP-mode: peak performance up to 530K/s (but better
00064  *   don't run this mode)
00065  */
00066 
00067 /*
00068  * 29.Sept.96: virt_to_bus changes for new memory scheme
00069  * 19.Feb.96: more Mcast changes, module support (MH)
00070  *
00071  * 18.Nov.95: Mcast changes (AC).
00072  *
00073  * 23.April.95: fixed(?) receiving problems by configuring a RFD more
00074  *              than the number of RBD's. Can maybe cause other problems.
00075  * 18.April.95: Added MODULE support (MH)
00076  * 17.April.95: MC related changes in init586() and set_multicast_list().
00077  *              removed use of 'jiffies' in init586() (MH)
00078  *
00079  * 19.Sep.94: Added Multicast support (not tested yet) (MH)
00080  *
00081  * 18.Sep.94: Workaround for 'EL-Bug'. Removed flexible RBD-handling.
00082  *            Now, every RFD has exact one RBD. (MH)
00083  *
00084  * 14.Sep.94: added promiscuous mode, a few cleanups (MH)
00085  *
00086  * 19.Aug.94: changed request_irq() parameter (MH)
00087  *
00088  * 20.July.94: removed cleanup bugs, removed a 16K-mem-probe-bug (MH)
00089  *
00090  * 19.July.94: lotsa cleanups .. (MH)
00091  *
00092  * 17.July.94: some patches ... verified to run with 1.1.29 (MH)
00093  *
00094  * 4.July.94: patches for Linux 1.1.24  (MH)
00095  *
00096  * 26.March.94: patches for Linux 1.0 and iomem-auto-probe (MH)
00097  *
00098  * 30.Sep.93: Added nop-chain .. driver now runs with only one Xmit-Buff, too (MH)
00099  *
00100  * < 30.Sep.93: first versions
00101  */
00102 
00103 static int debuglevel = 0; /* debug-printk 0: off 1: a few 2: more */
00104 static int automatic_resume = 0; /* experimental .. better should be zero */
00105 static int rfdadd = 0; /* rfdadd=1 may be better for 8K MEM cards */
00106 static int fifo=0x8;    /* don't change */
00107 
00108 /* #define REALLY_SLOW_IO */
00109 
00110 #include <linux/module.h>
00111 #include <linux/kernel.h>
00112 #include <linux/string.h>
00113 #include <linux/errno.h>
00114 #include <linux/ioport.h>
00115 #include <linux/malloc.h>
00116 #include <linux/interrupt.h>
00117 #include <linux/delay.h>
00118 #include <linux/init.h>
00119 #include <asm/bitops.h>
00120 #include <asm/io.h>
00121 
00122 #include <linux/netdevice.h>
00123 #include <linux/etherdevice.h>
00124 #include <linux/skbuff.h>
00125 
00126 #include "ni52.h"
00127 
00128 #define DEBUG       /* debug on */
00129 #define SYSBUSVAL 1 /* 8 Bit */
00130 
00131 #define ni_attn586()  {outb(0,dev->base_addr+NI52_ATTENTION);}
00132 #define ni_reset586() {outb(0,dev->base_addr+NI52_RESET);}
00133 #define ni_disint()   {outb(0,dev->base_addr+NI52_INTDIS);}
00134 #define ni_enaint()   {outb(0,dev->base_addr+NI52_INTENA);}
00135 
00136 #define make32(ptr16) (p->memtop + (short) (ptr16) )
00137 #define make24(ptr32) ( ((char *) (ptr32)) - p->base)
00138 #define make16(ptr32) ((unsigned short) ((unsigned long)(ptr32) - (unsigned long) p->memtop ))
00139 
00140 /******************* how to calculate the buffers *****************************
00141 
00142   * IMPORTANT NOTE: if you configure only one NUM_XMIT_BUFFS, the driver works
00143   * --------------- in a different (more stable?) mode. Only in this mode it's
00144   *                 possible to configure the driver with 'NO_NOPCOMMANDS'
00145 
00146 sizeof(scp)=12; sizeof(scb)=16; sizeof(iscp)=8;
00147 sizeof(scp)+sizeof(iscp)+sizeof(scb) = 36 = INIT
00148 sizeof(rfd) = 24; sizeof(rbd) = 12;
00149 sizeof(tbd) = 8; sizeof(transmit_cmd) = 16;
00150 sizeof(nop_cmd) = 8;
00151 
00152   * if you don't know the driver, better do not change these values: */
00153 
00154 #define RECV_BUFF_SIZE 1524 /* slightly oversized */
00155 #define XMIT_BUFF_SIZE 1524 /* slightly oversized */
00156 #define NUM_XMIT_BUFFS 1    /* config for both, 8K and 16K shmem */
00157 #define NUM_RECV_BUFFS_8  4 /* config for 8K shared mem */
00158 #define NUM_RECV_BUFFS_16 9 /* config for 16K shared mem */
00159 #define NO_NOPCOMMANDS      /* only possible with NUM_XMIT_BUFFS=1 */
00160 
00161 /**************************************************************************/
00162 
00163 /* different DELAYs */
00164 #define DELAY(x) mdelay(32 * x);
00165 #define DELAY_16(); { udelay(16); }
00166 #define DELAY_18(); { udelay(4); }
00167 
00168 /* wait for command with timeout: */
00169 #define WAIT_4_SCB_CMD() \
00170 { int i; \
00171   for(i=0;i<16384;i++) { \
00172     if(!p->scb->cmd_cuc) break; \
00173     DELAY_18(); \
00174     if(i == 16383) { \
00175       printk("%s: scb_cmd timed out: %04x,%04x .. disabling i82586!!\n",dev->name,p->scb->cmd_cuc,p->scb->cus); \
00176        if(!p->reseted) { p->reseted = 1; ni_reset586(); } } } }
00177 
00178 #define WAIT_4_SCB_CMD_RUC() { int i; \
00179   for(i=0;i<16384;i++) { \
00180     if(!p->scb->cmd_ruc) break; \
00181     DELAY_18(); \
00182     if(i == 16383) { \
00183       printk("%s: scb_cmd (ruc) timed out: %04x,%04x .. disabling i82586!!\n",dev->name,p->scb->cmd_ruc,p->scb->rus); \
00184        if(!p->reseted) { p->reseted = 1; ni_reset586(); } } } }
00185 
00186 #define WAIT_4_STAT_COMPL(addr) { int i; \
00187    for(i=0;i<32767;i++) { \
00188      if((addr)->cmd_status & STAT_COMPL) break; \
00189      DELAY_16(); DELAY_16(); } }
00190 
00191 #define NI52_TOTAL_SIZE 16
00192 #define NI52_ADDR0 0x02
00193 #define NI52_ADDR1 0x07
00194 #define NI52_ADDR2 0x01
00195 
00196 static int     ni52_probe1(struct device *dev,int ioaddr);
00197 static void    ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr);
00198 static int     ni52_open(struct device *dev);
00199 static int     ni52_close(struct device *dev);
00200 static int     ni52_send_packet(struct sk_buff *,struct device *);
00201 static struct  net_device_stats *ni52_get_stats(struct device *dev);
00202 static void    set_multicast_list(struct device *dev);
00203 #if 0
00204 static void    ni52_dump(struct device *,void *);
00205 #endif
00206 
00207 /* helper-functions */
00208 static int     init586(struct device *dev);
00209 static int     check586(struct device *dev,char *where,unsigned size);
00210 static void    alloc586(struct device *dev);
00211 static void    startrecv586(struct device *dev);
00212 static void   *alloc_rfa(struct device *dev,void *ptr);
00213 static void    ni52_rcv_int(struct device *dev);
00214 static void    ni52_xmt_int(struct device *dev);
00215 static void    ni52_rnr_int(struct device *dev);
00216 
00217 struct priv
00218 {
00219         struct net_device_stats stats;
00220         unsigned long base;
00221         char *memtop;
00222         int lock,reseted;
00223         volatile struct rfd_struct      *rfd_last,*rfd_top,*rfd_first;
00224         volatile struct scp_struct      *scp;   /* volatile is important */
00225         volatile struct iscp_struct     *iscp;  /* volatile is important */
00226         volatile struct scb_struct      *scb;   /* volatile is important */
00227         volatile struct tbd_struct      *xmit_buffs[NUM_XMIT_BUFFS];
00228         volatile struct transmit_cmd_struct *xmit_cmds[NUM_XMIT_BUFFS];
00229 #if (NUM_XMIT_BUFFS == 1)
00230         volatile struct nop_cmd_struct *nop_cmds[2];
00231 #else
00232         volatile struct nop_cmd_struct *nop_cmds[NUM_XMIT_BUFFS];
00233 #endif
00234         volatile int            nop_point,num_recv_buffs;
00235         volatile char           *xmit_cbuffs[NUM_XMIT_BUFFS];
00236         volatile int            xmit_count,xmit_last;
00237 };
00238 
00239 /**********************************************
00240  * close device
00241  */
00242 static int ni52_close(struct device *dev)
00243 {
00244         free_irq(dev->irq, dev);
00245 
00246         ni_reset586(); /* the hard way to stop the receiver */
00247 
00248         dev->start = 0;
00249         dev->tbusy = 0;
00250 
00251         MOD_DEC_USE_COUNT;
00252 
00253         return 0;
00254 }
00255 
00256 /**********************************************
00257  * open device
00258  */
00259 static int ni52_open(struct device *dev)
00260 {
00261         ni_disint();
00262         alloc586(dev);
00263         init586(dev);
00264         startrecv586(dev);
00265         ni_enaint();
00266 
00267         if(request_irq(dev->irq, &ni52_interrupt,0,"ni5210",dev))
00268         {
00269                 ni_reset586();
00270                 return -EAGAIN;
00271         }
00272 
00273         dev->interrupt = 0;
00274         dev->tbusy = 0;
00275         dev->start = 1;
00276 
00277         MOD_INC_USE_COUNT;
00278 
00279         return 0; /* most done by init */
00280 }
00281 
00282 /**********************************************
00283  * Check to see if there's an 82586 out there.
00284  */
00285 static int check586(struct device *dev,char *where,unsigned size)
00286 {
00287         struct priv pb;
00288         struct priv *p = /* (struct priv *) dev->priv*/ &pb;
00289         char *iscp_addrs[2];
00290         int i;
00291 
00292         p->base = (unsigned long) bus_to_virt((unsigned long)where) + size - 0x01000000;
00293         p->memtop = bus_to_virt((unsigned long)where) + size;
00294         p->scp = (struct scp_struct *)(p->base + SCP_DEFAULT_ADDRESS);
00295         memset((char *)p->scp,0, sizeof(struct scp_struct));
00296         for(i=0;i<sizeof(struct scp_struct);i++) /* memory was writeable? */
00297                 if(((char *)p->scp)[i])
00298                         return 0;
00299         p->scp->sysbus = SYSBUSVAL;                             /* 1 = 8Bit-Bus, 0 = 16 Bit */
00300         if(p->scp->sysbus != SYSBUSVAL)
00301                 return 0;
00302 
00303         iscp_addrs[0] = bus_to_virt((unsigned long)where);
00304         iscp_addrs[1]= (char *) p->scp - sizeof(struct iscp_struct);
00305 
00306         for(i=0;i<2;i++)
00307         {
00308                 p->iscp = (struct iscp_struct *) iscp_addrs[i];
00309                 memset((char *)p->iscp,0, sizeof(struct iscp_struct));
00310 
00311                 p->scp->iscp = make24(p->iscp);
00312                 p->iscp->busy = 1;
00313 
00314                 ni_reset586();
00315                 ni_attn586();
00316                 DELAY(1);       /* wait a while... */
00317 
00318                 if(p->iscp->busy) /* i82586 clears 'busy' after successful init */
00319                         return 0;
00320         }
00321         return 1;
00322 }
00323 
00324 /******************************************************************
00325  * set iscp at the right place, called by ni52_probe1 and open586.
00326  */
00327 void alloc586(struct device *dev)
00328 {
00329         struct priv *p =        (struct priv *) dev->priv;
00330 
00331         ni_reset586();
00332         DELAY(1);
00333 
00334         p->scp  = (struct scp_struct *) (p->base + SCP_DEFAULT_ADDRESS);
00335         p->scb  = (struct scb_struct *) bus_to_virt(dev->mem_start);
00336         p->iscp = (struct iscp_struct *) ((char *)p->scp - sizeof(struct iscp_struct));
00337 
00338         memset((char *) p->iscp,0,sizeof(struct iscp_struct));
00339         memset((char *) p->scp ,0,sizeof(struct scp_struct));
00340 
00341         p->scp->iscp = make24(p->iscp);
00342         p->scp->sysbus = SYSBUSVAL;
00343         p->iscp->scb_offset = make16(p->scb);
00344 
00345         p->iscp->busy = 1;
00346         ni_reset586();
00347         ni_attn586();
00348 
00349         DELAY(1);
00350 
00351         if(p->iscp->busy)
00352                 printk("%s: Init-Problems (alloc).\n",dev->name);
00353 
00354         p->reseted = 0;
00355 
00356         memset((char *)p->scb,0,sizeof(struct scb_struct));
00357 }
00358 
00359 /**********************************************
00360  * probe the ni5210-card
00361  */
00362 __initfunc(int ni52_probe(struct device *dev))
00363 {
00364 #ifndef MODULE
00365         int *port;
00366         static int ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0};
00367 #endif
00368         int base_addr = dev->base_addr;
00369 
00370         if (base_addr > 0x1ff) {                /* Check a single specified location. */
00371                 if( (inb(base_addr+NI52_MAGIC1) == NI52_MAGICVAL1) &&
00372                                 (inb(base_addr+NI52_MAGIC2) == NI52_MAGICVAL2))
00373                         return ni52_probe1(dev, base_addr);
00374         } else if (base_addr > 0)               /* Don't probe at all. */
00375                 return ENXIO;
00376 
00377 #ifdef MODULE
00378         printk("%s: no autoprobing allowed for modules.\n",dev->name);
00379 #else
00380         for (port = ports; *port; port++) {
00381                 int ioaddr = *port;
00382                 if (check_region(ioaddr, NI52_TOTAL_SIZE))
00383                         continue;
00384                 if( !(inb(ioaddr+NI52_MAGIC1) == NI52_MAGICVAL1) ||
00385                                 !(inb(ioaddr+NI52_MAGIC2) == NI52_MAGICVAL2))
00386                         continue;
00387 
00388                 dev->base_addr = ioaddr;
00389                 if (ni52_probe1(dev, ioaddr) == 0)
00390                         return 0;
00391         }
00392 
00393 #ifdef FULL_IO_PROBE
00394         for(dev->base_addr=0x200;dev->base_addr<0x400;dev->base_addr+=8)
00395         {
00396                 int ioaddr = dev->base_addr;
00397                 if (check_region(ioaddr, NI52_TOTAL_SIZE))
00398                         continue;
00399                 if( !(inb(ioaddr+NI52_MAGIC1) == NI52_MAGICVAL1) ||
00400                                 !(inb(ioaddr+NI52_MAGIC2) == NI52_MAGICVAL2))
00401                         continue;
00402                 if (ni52_probe1(dev, ioaddr) == 0)
00403                         return 0;
00404         }
00405 #endif
00406 
00407 #endif
00408 
00409         dev->base_addr = base_addr;
00410         return ENODEV;
00411 }
00412 
00413 __initfunc(static int ni52_probe1(struct device *dev,int ioaddr))
00414 {
00415         int i,size;
00416 
00417         for(i=0;i<ETH_ALEN;i++)
00418                 dev->dev_addr[i] = inb(dev->base_addr+i);
00419 
00420         if(dev->dev_addr[0] != NI52_ADDR0 || dev->dev_addr[1] != NI52_ADDR1
00421                  || dev->dev_addr[2] != NI52_ADDR2)
00422                 return ENODEV;
00423 
00424         printk("%s: NI5210 found at %#3lx, ",dev->name,dev->base_addr);
00425 
00426         request_region(ioaddr,NI52_TOTAL_SIZE,"ni5210");
00427 
00428         /*
00429          * check (or search) IO-Memory, 8K and 16K
00430          */
00431 #ifdef MODULE
00432         size = dev->mem_end - dev->mem_start;
00433         if(size != 0x2000 && size != 0x4000)
00434         {
00435                 printk("\n%s: Illegal memory size %d. Allowed is 0x2000 or 0x4000 bytes.\n",dev->name,size);
00436                 return ENODEV;
00437         }
00438         if(!check586(dev,(char *) dev->mem_start,size))
00439         {
00440                 printk("?memcheck, Can't find memory at 0x%lx with size %d!\n",dev->mem_start,size);
00441                 return ENODEV;
00442         }
00443 #else
00444         if(dev->mem_start != 0) /* no auto-mem-probe */
00445         {
00446                 size = 0x4000; /* check for 16K mem */
00447                 if(!check586(dev,(char *) dev->mem_start,size)) {
00448                         size = 0x2000; /* check for 8K mem */
00449                         if(!check586(dev,(char *) dev->mem_start,size)) {
00450                                 printk("?memprobe, Can't find memory at 0x%lx!\n",dev->mem_start);
00451                                 return ENODEV;
00452                         }
00453                 }
00454         }
00455         else
00456         {
00457                 static long memaddrs[] = { 0xc8000,0xca000,0xcc000,0xce000,0xd0000,0xd2000,
00458                                         0xd4000,0xd6000,0xd8000,0xda000,0xdc000, 0 };
00459                 for(i=0;;i++)
00460                 {
00461                         if(!memaddrs[i]) {
00462                                 printk("?memprobe, Can't find io-memory!\n");
00463                                 return ENODEV;
00464                         }
00465                         dev->mem_start = memaddrs[i];
00466                         size = 0x2000; /* check for 8K mem */
00467                         if(check586(dev,(char *)dev->mem_start,size)) /* 8K-check */
00468                                 break;
00469                         size = 0x4000; /* check for 16K mem */
00470                         if(check586(dev,(char *)dev->mem_start,size)) /* 16K-check */
00471                                 break;
00472                 }
00473         }
00474         dev->mem_end = dev->mem_start + size; /* set mem_end showed by 'ifconfig' */
00475 #endif
00476 
00477         dev->priv = (void *) kmalloc(sizeof(struct priv),GFP_KERNEL);
00478         if(dev->priv == NULL)
00479         {
00480                 printk("%s: Ooops .. can't allocate private driver memory.\n",dev->name);
00481                 return -ENOMEM;
00482         }
00483                                                                                                                                         /* warning: we don't free it on errors */
00484         memset((char *) dev->priv,0,sizeof(struct priv));
00485 
00486         ((struct priv *) (dev->priv))->memtop = bus_to_virt(dev->mem_start) + size;
00487         ((struct priv *) (dev->priv))->base =   (unsigned long) bus_to_virt(dev->mem_start) + size - 0x01000000;
00488         alloc586(dev);
00489 
00490         /* set number of receive-buffs according to memsize */
00491         if(size == 0x2000)
00492                 ((struct priv *) dev->priv)->num_recv_buffs = NUM_RECV_BUFFS_8;
00493         else
00494                 ((struct priv *) dev->priv)->num_recv_buffs = NUM_RECV_BUFFS_16;
00495 
00496         printk("Memaddr: 0x%lx, Memsize: %d, ",dev->mem_start,size);
00497 
00498         if(dev->irq < 2)
00499         {
00500                 autoirq_setup(0);
00501                 ni_reset586();
00502                 ni_attn586();
00503                 if(!(dev->irq = autoirq_report(2)))
00504                 {
00505                         printk("?autoirq, Failed to detect IRQ line!\n");
00506                         return 1;
00507                 }
00508                 printk("IRQ %d (autodetected).\n",dev->irq);
00509         }
00510         else    {
00511                 if(dev->irq == 2)
00512                         dev->irq = 9;
00513                 printk("IRQ %d (assigned and not checked!).\n",dev->irq);
00514         }
00515 
00516         dev->open               = &ni52_open;
00517         dev->stop               = &ni52_close;
00518         dev->get_stats          = &ni52_get_stats;
00519         dev->hard_start_xmit    = &ni52_send_packet;
00520         dev->set_multicast_list = &set_multicast_list;
00521 
00522         dev->if_port            = 0;
00523 
00524         ether_setup(dev);
00525 
00526         dev->tbusy              = 0;
00527         dev->interrupt          = 0;
00528         dev->start              = 0;
00529 
00530         return 0;
00531 }
00532 
00533 /**********************************************
00534  * init the chip (ni52-interrupt should be disabled?!)
00535  * needs a correct 'allocated' memory
00536  */
00537 
00538 static int init586(struct device *dev)
00539 {
00540         void *ptr;
00541         int i,result=0;
00542         struct priv *p = (struct priv *) dev->priv;
00543         volatile struct configure_cmd_struct    *cfg_cmd;
00544         volatile struct iasetup_cmd_struct *ias_cmd;
00545         volatile struct tdr_cmd_struct *tdr_cmd;
00546         volatile struct mcsetup_cmd_struct *mc_cmd;
00547         struct dev_mc_list *dmi=dev->mc_list;
00548         int num_addrs=dev->mc_count;
00549 
00550         ptr = (void *) ((char *)p->scb + sizeof(struct scb_struct));
00551 
00552         cfg_cmd = (struct configure_cmd_struct *)ptr; /* configure-command */
00553         cfg_cmd->cmd_status     = 0;
00554         cfg_cmd->cmd_cmd        = CMD_CONFIGURE | CMD_LAST;
00555         cfg_cmd->cmd_link       = 0xffff;
00556 
00557         cfg_cmd->byte_cnt       = 0x0a; /* number of cfg bytes */
00558         cfg_cmd->fifo           = fifo; /* fifo-limit (8=tx:32/rx:64) */
00559         cfg_cmd->sav_bf         = 0x40; /* hold or discard bad recv frames (bit 7) */
00560         cfg_cmd->adr_len        = 0x2e; /* addr_len |!src_insert |pre-len |loopback */
00561         cfg_cmd->priority       = 0x00;
00562         cfg_cmd->ifs            = 0x60;
00563         cfg_cmd->time_low       = 0x00;
00564         cfg_cmd->time_high      = 0xf2;
00565         cfg_cmd->promisc        = 0;
00566         if(dev->flags & IFF_ALLMULTI) {
00567                 int len = ((char *) p->iscp - (char *) ptr - 8) / 6;
00568                 if(num_addrs > len)     {
00569                         printk("%s: switching to promisc. mode\n",dev->name);
00570                         dev->flags|=IFF_PROMISC;
00571                 }
00572         }
00573         if(dev->flags&IFF_PROMISC)
00574         {
00575                          cfg_cmd->promisc=1;
00576                          dev->flags|=IFF_PROMISC;
00577         }
00578         cfg_cmd->carr_coll      = 0x00;
00579 
00580         p->scb->cbl_offset      = make16(cfg_cmd);
00581         p->scb->cmd_ruc         = 0;
00582 
00583         p->scb->cmd_cuc         = CUC_START; /* cmd.-unit start */
00584         ni_attn586();
00585 
00586         WAIT_4_STAT_COMPL(cfg_cmd);
00587 
00588         if((cfg_cmd->cmd_status & (STAT_OK|STAT_COMPL)) != (STAT_COMPL|STAT_OK))
00589         {
00590                 printk("%s: configure command failed: %x\n",dev->name,cfg_cmd->cmd_status);
00591                 return 1;
00592         }
00593 
00594         /*
00595          * individual address setup
00596          */
00597 
00598         ias_cmd = (struct iasetup_cmd_struct *)ptr;
00599 
00600         ias_cmd->cmd_status     = 0;
00601         ias_cmd->cmd_cmd        = CMD_IASETUP | CMD_LAST;
00602         ias_cmd->cmd_link       = 0xffff;
00603 
00604         memcpy((char *)&ias_cmd->iaddr,(char *) dev->dev_addr,ETH_ALEN);
00605 
00606         p->scb->cbl_offset = make16(ias_cmd);
00607 
00608         p->scb->cmd_cuc = CUC_START; /* cmd.-unit start */
00609         ni_attn586();
00610 
00611         WAIT_4_STAT_COMPL(ias_cmd);
00612 
00613         if((ias_cmd->cmd_status & (STAT_OK|STAT_COMPL)) != (STAT_OK|STAT_COMPL)) {
00614                 printk("%s (ni52): individual address setup command failed: %04x\n",dev->name,ias_cmd->cmd_status);
00615                 return 1;
00616         }
00617 
00618         /*
00619          * TDR, wire check .. e.g. no resistor e.t.c
00620          */
00621          
00622         tdr_cmd = (struct tdr_cmd_struct *)ptr;
00623 
00624         tdr_cmd->cmd_status     = 0;
00625         tdr_cmd->cmd_cmd        = CMD_TDR | CMD_LAST;
00626         tdr_cmd->cmd_link       = 0xffff;
00627         tdr_cmd->status         = 0;
00628 
00629         p->scb->cbl_offset = make16(tdr_cmd);
00630         p->scb->cmd_cuc = CUC_START; /* cmd.-unit start */
00631         ni_attn586();
00632 
00633         WAIT_4_STAT_COMPL(tdr_cmd);
00634 
00635         if(!(tdr_cmd->cmd_status & STAT_COMPL))
00636         {
00637                 printk("%s: Problems while running the TDR.\n",dev->name);
00638         }
00639         else
00640         {
00641                 DELAY_16(); /* wait for result */
00642                 result = tdr_cmd->status;
00643 
00644                 p->scb->cmd_cuc = p->scb->cus & STAT_MASK;
00645                 ni_attn586(); /* ack the interrupts */
00646 
00647                 if(result & TDR_LNK_OK)
00648                         ;
00649                 else if(result & TDR_XCVR_PRB)
00650                         printk("%s: TDR: Transceiver problem. Check the cable(s)!\n",dev->name);
00651                 else if(result & TDR_ET_OPN)
00652                         printk("%s: TDR: No correct termination %d clocks away.\n",dev->name,result & TDR_TIMEMASK);
00653                 else if(result & TDR_ET_SRT)
00654                 {
00655                         if (result & TDR_TIMEMASK) /* time == 0 -> strange :-) */
00656                                 printk("%s: TDR: Detected a short circuit %d clocks away.\n",dev->name,result & TDR_TIMEMASK);
00657                 }
00658                 else
00659                         printk("%s: TDR: Unknown status %04x\n",dev->name,result);
00660         }
00661 
00662         /*
00663          * Multicast setup
00664          */
00665         if(num_addrs && !(dev->flags & IFF_PROMISC) )
00666         {
00667                 mc_cmd = (struct mcsetup_cmd_struct *) ptr;
00668                 mc_cmd->cmd_status = 0;
00669                 mc_cmd->cmd_cmd = CMD_MCSETUP | CMD_LAST;
00670                 mc_cmd->cmd_link = 0xffff;
00671                 mc_cmd->mc_cnt = num_addrs * 6;
00672 
00673                 for(i=0;i<num_addrs;i++,dmi=dmi->next)
00674                         memcpy((char *) mc_cmd->mc_list[i], dmi->dmi_addr,6);
00675 
00676                 p->scb->cbl_offset = make16(mc_cmd);
00677                 p->scb->cmd_cuc = CUC_START;
00678                 ni_attn586();
00679 
00680                 WAIT_4_STAT_COMPL(mc_cmd);
00681 
00682                 if( (mc_cmd->cmd_status & (STAT_COMPL|STAT_OK)) != (STAT_COMPL|STAT_OK) )
00683                         printk("%s: Can't apply multicast-address-list.\n",dev->name);
00684         }
00685 
00686         /*
00687          * alloc nop/xmit-cmds
00688          */
00689 #if (NUM_XMIT_BUFFS == 1)
00690         for(i=0;i<2;i++)
00691         {
00692                 p->nop_cmds[i]                  = (struct nop_cmd_struct *)ptr;
00693                 p->nop_cmds[i]->cmd_cmd         = CMD_NOP;
00694                 p->nop_cmds[i]->cmd_status      = 0;
00695                 p->nop_cmds[i]->cmd_link        = make16((p->nop_cmds[i]));
00696                 ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
00697         }
00698 #else
00699         for(i=0;i<NUM_XMIT_BUFFS;i++)
00700         {
00701                 p->nop_cmds[i]                  = (struct nop_cmd_struct *)ptr;
00702                 p->nop_cmds[i]->cmd_cmd         = CMD_NOP;
00703                 p->nop_cmds[i]->cmd_status      = 0;
00704                 p->nop_cmds[i]->cmd_link        = make16((p->nop_cmds[i]));
00705                 ptr = (char *) ptr + sizeof(struct nop_cmd_struct);
00706         }
00707 #endif
00708 
00709         ptr = alloc_rfa(dev,(void *)ptr); /* init receive-frame-area */
00710 
00711         /*
00712          * alloc xmit-buffs / init xmit_cmds
00713          */
00714         for(i=0;i<NUM_XMIT_BUFFS;i++)
00715         {
00716                 p->xmit_cmds[i] = (struct transmit_cmd_struct *)ptr; /*transmit cmd/buff 0*/
00717                 ptr = (char *) ptr + sizeof(struct transmit_cmd_struct);
00718                 p->xmit_cbuffs[i] = (char *)ptr; /* char-buffs */
00719                 ptr = (char *) ptr + XMIT_BUFF_SIZE;
00720                 p->xmit_buffs[i] = (struct tbd_struct *)ptr; /* TBD */
00721                 ptr = (char *) ptr + sizeof(struct tbd_struct);
00722                 if((void *)ptr > (void *)p->iscp)
00723                 {
00724                         printk("%s: not enough shared-mem for your configuration!\n",dev->name);
00725                         return 1;
00726                 }
00727                 memset((char *)(p->xmit_cmds[i]) ,0, sizeof(struct transmit_cmd_struct));
00728                 memset((char *)(p->xmit_buffs[i]),0, sizeof(struct tbd_struct));
00729                 p->xmit_cmds[i]->cmd_link = make16(p->nop_cmds[(i+1)%NUM_XMIT_BUFFS]);
00730                 p->xmit_cmds[i]->cmd_status = STAT_COMPL;
00731                 p->xmit_cmds[i]->cmd_cmd = CMD_XMIT | CMD_INT;
00732                 p->xmit_cmds[i]->tbd_offset = make16((p->xmit_buffs[i]));
00733                 p->xmit_buffs[i]->next = 0xffff;
00734                 p->xmit_buffs[i]->buffer = make24((p->xmit_cbuffs[i]));
00735         }
00736 
00737         p->xmit_count = 0;
00738         p->xmit_last    = 0;
00739 #ifndef NO_NOPCOMMANDS
00740         p->nop_point    = 0;
00741 #endif
00742 
00743          /*
00744                 * 'start transmitter'
00745                 */
00746 #ifndef NO_NOPCOMMANDS
00747         p->scb->cbl_offset = make16(p->nop_cmds[0]);
00748         p->scb->cmd_cuc = CUC_START;
00749         ni_attn586();
00750         WAIT_4_SCB_CMD();
00751 #else
00752         p->xmit_cmds[0]->cmd_link = make16(p->xmit_cmds[0]);
00753         p->xmit_cmds[0]->cmd_cmd        = CMD_XMIT | CMD_SUSPEND | CMD_INT;
00754 #endif
00755 
00756         /*
00757          * ack. interrupts
00758          */
00759         p->scb->cmd_cuc = p->scb->cus & STAT_MASK;
00760         ni_attn586();
00761         DELAY_16();
00762 
00763         ni_enaint();
00764 
00765         return 0;
00766 }
00767 
00768 /******************************************************
00769  * This is a helper routine for ni52_rnr_int() and init586().
00770  * It sets up the Receive Frame Area (RFA).
00771  */
00772 
00773 static void *alloc_rfa(struct device *dev,void *ptr)
00774 {
00775         volatile struct rfd_struct *rfd = (struct rfd_struct *)ptr;
00776         volatile struct rbd_struct *rbd;
00777         int i;
00778         struct priv *p = (struct priv *) dev->priv;
00779 
00780         memset((char *) rfd,0,sizeof(struct rfd_struct)*(p->num_recv_buffs+rfdadd));
00781         p->rfd_first = rfd;
00782 
00783         for(i = 0; i < (p->num_recv_buffs+rfdadd); i++) {
00784                 rfd[i].next = make16(rfd + (i+1) % (p->num_recv_buffs+rfdadd) );
00785                 rfd[i].rbd_offset = 0xffff;
00786         }
00787         rfd[p->num_recv_buffs-1+rfdadd].last = RFD_SUSP;         /* RU suspend */
00788 
00789         ptr = (void *) (rfd + (p->num_recv_buffs + rfdadd) );
00790 
00791         rbd = (struct rbd_struct *) ptr;
00792         ptr = (void *) (rbd + p->num_recv_buffs);
00793 
00794          /* clr descriptors */
00795         memset((char *) rbd,0,sizeof(struct rbd_struct)*(p->num_recv_buffs));
00796 
00797         for(i=0;i<p->num_recv_buffs;i++)
00798         {
00799                 rbd[i].next = make16((rbd + (i+1) % p->num_recv_buffs));
00800                 rbd[i].size = RECV_BUFF_SIZE;
00801                 rbd[i].buffer = make24(ptr);
00802                 ptr = (char *) ptr + RECV_BUFF_SIZE;
00803         }
00804 
00805         p->rfd_top      = p->rfd_first;
00806         p->rfd_last = p->rfd_first + (p->num_recv_buffs - 1 + rfdadd);
00807 
00808         p->scb->rfa_offset              = make16(p->rfd_first);
00809         p->rfd_first->rbd_offset        = make16(rbd);
00810 
00811         return ptr;
00812 }
00813 
00814 
00815 /**************************************************
00816  * Interrupt Handler ...
00817  */
00818 
00819 static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr)
00820 {
00821         struct device *dev = dev_id;
00822         unsigned short stat;
00823         int cnt=0;
00824         struct priv *p;
00825 
00826         if (!dev) {
00827                 printk ("ni5210-interrupt: irq %d for unknown device.\n",irq);
00828                 return;
00829         }
00830         p = (struct priv *) dev->priv;
00831 
00832         if(debuglevel > 1)
00833                 printk("I");
00834 
00835         dev->interrupt = 1;
00836 
00837         WAIT_4_SCB_CMD(); /* wait for last command      */
00838 
00839         while((stat=p->scb->cus & STAT_MASK))
00840         {
00841                 p->scb->cmd_cuc = stat;
00842                 ni_attn586();
00843 
00844                 if(stat & STAT_FR)       /* received a frame */
00845                         ni52_rcv_int(dev);
00846 
00847                 if(stat & STAT_RNR) /* RU went 'not ready' */
00848                 {
00849                         printk("(R)");
00850                         if(p->scb->rus & RU_SUSPEND) /* special case: RU_SUSPEND */
00851                         {
00852                                 WAIT_4_SCB_CMD();
00853                                 p->scb->cmd_ruc = RUC_RESUME;
00854                                 ni_attn586();
00855                                 WAIT_4_SCB_CMD_RUC();
00856                         }
00857                         else
00858                         {
00859                                 printk("%s: Receiver-Unit went 'NOT READY': %04x/%02x.\n",dev->name,(int) stat,(int) p->scb->rus);
00860                                 ni52_rnr_int(dev);
00861                         }
00862                 }
00863 
00864                 if(stat & STAT_CX)              /* command with I-bit set complete */
00865                          ni52_xmt_int(dev);
00866 
00867 #ifndef NO_NOPCOMMANDS
00868                 if(stat & STAT_CNA)     /* CU went 'not ready' */
00869                 {
00870                         if(dev->start)
00871                                 printk("%s: oops! CU has left active state. stat: %04x/%02x.\n",dev->name,(int) stat,(int) p->scb->cus);
00872                 }
00873 #endif
00874 
00875                 if(debuglevel > 1)
00876                         printk("%d",cnt++);
00877 
00878                 WAIT_4_SCB_CMD(); /* wait for ack. (ni52_xmt_int can be faster than ack!!) */
00879                 if(p->scb->cmd_cuc)      /* timed out? */
00880                 {
00881                         printk("%s: Acknowledge timed out.\n",dev->name);
00882                         ni_disint();
00883                         break;
00884                 }
00885         }
00886 
00887         if(debuglevel > 1)
00888                 printk("i");
00889 
00890         dev->interrupt = 0;
00891 }
00892 
00893 /*******************************************************
00894  * receive-interrupt
00895  */
00896 
00897 static void ni52_rcv_int(struct device *dev)
00898 {
00899         int status,cnt=0;
00900         unsigned short totlen;
00901         struct sk_buff *skb;
00902         struct rbd_struct *rbd;
00903         struct priv *p = (struct priv *) dev->priv;
00904 
00905         if(debuglevel > 0)
00906                 printk("R");
00907 
00908         for(;(status = p->rfd_top->stat_high) & RFD_COMPL;)
00909         {
00910                         rbd = (struct rbd_struct *) make32(p->rfd_top->rbd_offset);
00911 
00912                         if(status & RFD_OK) /* frame received without error? */
00913                         {
00914                                 if( (totlen = rbd->status) & RBD_LAST) /* the first and the last buffer? */
00915                                 {
00916                                         totlen &= RBD_MASK; /* length of this frame */
00917                                         rbd->status = 0;
00918                                         skb = (struct sk_buff *) dev_alloc_skb(totlen+2);
00919                                         if(skb != NULL)
00920                                         {
00921                                                 skb->dev = dev;
00922                                                 skb_reserve(skb,2);
00923                                                 skb_put(skb,totlen);
00924                                                 eth_copy_and_sum(skb,(char *) p->base+(unsigned long) rbd->buffer,totlen,0);
00925                                                 skb->protocol=eth_type_trans(skb,dev);
00926                                                 netif_rx(skb);
00927                                                 p->stats.rx_packets++;
00928                                         }
00929                                         else
00930                                                 p->stats.rx_dropped++;
00931                                 }
00932                                 else
00933                                 {
00934                                         int rstat;
00935                                                  /* free all RBD's until RBD_LAST is set */
00936                                         totlen = 0;
00937                                         while(!((rstat=rbd->status) & RBD_LAST))
00938                                         {
00939                                                 totlen += rstat & RBD_MASK;
00940                                                 if(!rstat)
00941                                                 {
00942                                                         printk("%s: Whoops .. no end mark in RBD list\n",dev->name);
00943                                                         break;
00944                                                 }
00945                                                 rbd->status = 0;
00946                                                 rbd = (struct rbd_struct *) make32(rbd->next);
00947                                         }
00948                                         totlen += rstat & RBD_MASK;
00949                                         rbd->status = 0;
00950                                         printk("%s: received oversized frame! length: %d\n",dev->name,totlen);
00951                                         p->stats.rx_dropped++;
00952                          }
00953                 }
00954                 else /* frame !(ok), only with 'save-bad-frames' */
00955                 {
00956                         printk("%s: oops! rfd-error-status: %04x\n",dev->name,status);
00957                         p->stats.rx_errors++;
00958                 }
00959                 p->rfd_top->stat_high = 0;
00960                 p->rfd_top->last = RFD_SUSP; /* maybe exchange by RFD_LAST */
00961                 p->rfd_top->rbd_offset = 0xffff;
00962                 p->rfd_last->last = 0;                          /* delete RFD_SUSP      */
00963                 p->rfd_last = p->rfd_top;
00964                 p->rfd_top = (struct rfd_struct *) make32(p->rfd_top->next); /* step to next RFD */
00965                 p->scb->rfa_offset = make16(p->rfd_top);
00966 
00967                 if(debuglevel > 0)
00968                         printk("%d",cnt++);
00969         }
00970 
00971         if(automatic_resume)
00972         {
00973                 WAIT_4_SCB_CMD();
00974                 p->scb->cmd_ruc = RUC_RESUME;
00975                 ni_attn586();
00976                 WAIT_4_SCB_CMD_RUC();
00977         }
00978 
00979 #ifdef WAIT_4_BUSY
00980         {
00981                 int i;
00982                 for(i=0;i<1024;i++)
00983                 {
00984                         if(p->rfd_top->status)
00985                                 break;
00986                         DELAY_16();
00987                         if(i == 1023)
00988                                 printk("%s: RU hasn't fetched next RFD (not busy/complete)\n",dev->name);
00989                 }
00990         }
00991 #endif
00992 
00993 #if 0
00994         if(!at_least_one)
00995         {
00996                 int i;
00997                 volatile struct rfd_struct *rfds=p->rfd_top;
00998                 volatile struct rbd_struct *rbds;
00999                 printk("%s: received a FC intr. without having a frame: %04x %d\n",dev->name,status,old_at_least);
01000                 for(i=0;i< (p->num_recv_buffs+4);i++)
01001                 {
01002                         rbds = (struct rbd_struct *) make32(rfds->rbd_offset);
01003                         printk("%04x:%04x ",rfds->status,rbds->status);
01004                         rfds = (struct rfd_struct *) make32(rfds->next);
01005                 }
01006                 printk("\nerrs: %04x %04x stat: %04x\n",(int)p->scb->rsc_errs,(int)p->scb->ovrn_errs,(int)p->scb->status);
01007                 printk("\nerrs: %04x %04x rus: %02x, cus: %02x\n",(int)p->scb->rsc_errs,(int)p->scb->ovrn_errs,(int)p->scb->rus,(int)p->scb->cus);
01008         }
01009         old_at_least = at_least_one;
01010 #endif
01011 
01012         if(debuglevel > 0)
01013                 printk("r");
01014 }
01015 
01016 /**********************************************************
01017  * handle 'Receiver went not ready'.
01018  */
01019 
01020 static void ni52_rnr_int(struct device *dev)
01021 {
01022         struct priv *p = (struct priv *) dev->priv;
01023 
01024         p->stats.rx_errors++;
01025 
01026         WAIT_4_SCB_CMD();               /* wait for the last cmd, WAIT_4_FULLSTAT?? */
01027         p->scb->cmd_ruc = RUC_ABORT; /* usually the RU is in the 'no resource'-state .. abort it now. */
01028         ni_attn586();
01029         WAIT_4_SCB_CMD_RUC();           /* wait for accept cmd. */
01030 
01031         alloc_rfa(dev,(char *)p->rfd_first);
01032 /* maybe add a check here, before restarting the RU */
01033         startrecv586(dev); /* restart RU */
01034 
01035         printk("%s: Receive-Unit restarted. Status: %04x\n",dev->name,p->scb->rus);
01036 
01037 }
01038 
01039 /**********************************************************
01040  * handle xmit - interrupt
01041  */
01042 
01043 static void ni52_xmt_int(struct device *dev)
01044 {
01045         int status;
01046         struct priv *p = (struct priv *) dev->priv;
01047 
01048         if(debuglevel > 0)
01049                 printk("X");
01050 
01051         status = p->xmit_cmds[p->xmit_last]->cmd_status;
01052         if(!(status & STAT_COMPL))
01053                 printk("%s: strange .. xmit-int without a 'COMPLETE'\n",dev->name);
01054 
01055         if(status & STAT_OK)
01056         {
01057                 p->stats.tx_packets++;
01058                 p->stats.collisions += (status & TCMD_MAXCOLLMASK);
01059         }
01060         else
01061         {
01062                 p->stats.tx_errors++;
01063                 if(status & TCMD_LATECOLL) {
01064                         printk("%s: late collision detected.\n",dev->name);
01065                         p->stats.collisions++;
01066                 }
01067                 else if(status & TCMD_NOCARRIER) {
01068                         p->stats.tx_carrier_errors++;
01069                         printk("%s: no carrier detected.\n",dev->name);
01070                 }
01071                 else if(status & TCMD_LOSTCTS)
01072                         printk("%s: loss of CTS detected.\n",dev->name);
01073                 else if(status & TCMD_UNDERRUN) {
01074                         p->stats.tx_fifo_errors++;
01075                         printk("%s: DMA underrun detected.\n",dev->name);
01076                 }
01077                 else if(status & TCMD_MAXCOLL) {
01078                         printk("%s: Max. collisions exceeded.\n",dev->name);
01079                         p->stats.collisions += 16;
01080                 }
01081         }
01082 
01083 #if (NUM_XMIT_BUFFS > 1)
01084         if( (++p->xmit_last) == NUM_XMIT_BUFFS)
01085                 p->xmit_last = 0;
01086 #endif
01087 
01088         dev->tbusy = 0;
01089         mark_bh(NET_BH);
01090 }
01091 
01092 /***********************************************************
01093  * (re)start the receiver
01094  */
01095 
01096 static void startrecv586(struct device *dev)
01097 {
01098         struct priv *p = (struct priv *) dev->priv;
01099 
01100         WAIT_4_SCB_CMD();
01101         WAIT_4_SCB_CMD_RUC();
01102         p->scb->rfa_offset = make16(p->rfd_first);
01103         p->scb->cmd_ruc = RUC_START;
01104         ni_attn586();           /* start cmd. */
01105         WAIT_4_SCB_CMD_RUC();   /* wait for accept cmd. (no timeout!!) */
01106 }
01107 
01108 /******************************************************
01109  * send frame
01110  */
01111 
01112 static int ni52_send_packet(struct sk_buff *skb, struct device *dev)
01113 {
01114         int len,i;
01115 #ifndef NO_NOPCOMMANDS
01116         int next_nop;
01117 #endif
01118         struct priv *p = (struct priv *) dev->priv;
01119 
01120         if(dev->tbusy)
01121         {
01122                 int tickssofar = jiffies - dev->trans_start;
01123                 if (tickssofar < 5)
01124                         return 1;
01125 
01126 #ifndef NO_NOPCOMMANDS
01127                 if(p->scb->cus & CU_ACTIVE) /* COMMAND-UNIT active? */
01128                 {
01129                         dev->tbusy = 0;
01130 #ifdef DEBUG
01131                         printk("%s: strange ... timeout with CU active?!?\n",dev->name);
01132                         printk("%s: X0: %04x N0: %04x N1: %04x %d\n",dev->name,(int)p->xmit_cmds[0]->cmd_status,(int)p->nop_cmds[0]->cmd_status,(int)p->nop_cmds[1]->cmd_status,(int)p->nop_point);
01133 #endif
01134                         p->scb->cmd_cuc = CUC_ABORT;
01135                         ni_attn586();
01136                         WAIT_4_SCB_CMD();
01137                         p->scb->cbl_offset = make16(p->nop_cmds[p->nop_point]);
01138                         p->scb->cmd_cuc = CUC_START;
01139                         ni_attn586();
01140                         WAIT_4_SCB_CMD();
01141                         dev->trans_start = jiffies;
01142                         return 0;
01143                 }
01144                 else
01145 #endif
01146                 {
01147 #ifdef DEBUG
01148                         printk("%s: xmitter timed out, try to restart! stat: %02x\n",dev->name,p->scb->cus);
01149                         printk("%s: command-stats: %04x %04x\n",dev->name,p->xmit_cmds[0]->cmd_status,p->xmit_cmds[1]->cmd_status);
01150                         printk("%s: check, whether you set the right interrupt number!\n",dev->name);
01151 #endif
01152                         ni52_close(dev);
01153                         ni52_open(dev);
01154                 }
01155                 dev->trans_start = jiffies;
01156                 return 0;
01157         }
01158 
01159         if(skb->len > XMIT_BUFF_SIZE)
01160         {
011