Changeset c27b2d0d in rtems


Ignore:
Timestamp:
01/20/99 18:55:50 (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
97d6366
Parents:
f91b8df1
Message:

Update of network driver from Erik Ivanenko <erik.ivanenko@…>.
Comments follow:

Here is the contents of the network directory of the i386ex BSP. The
reset function has been recently added, and tested through a command
line interface. A reset event to the reset thread to reset the NIC.
This is done when the ISR detects that the NIC is in an invalid state.
It has not been tested "in real life" since the board has not seen an
invalid state since the reset function was implemented.

Location:
c/src/lib/libbsp/i386/i386ex
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/i386ex/Makefile.in

    rf91b8df1 rc27b2d0d  
    1212include $(RTEMS_ROOT)/make/directory.cfg
    1313
    14 # # We only build the Network library if HAS_NETWORKING was defined
    15 # NETWORK_yes_V = network
    16 # NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)
     14# We only build the Network library if HAS_NETWORKING was defined
     15NETWORK_yes_V = network
     16NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)
    1717
    1818# wrapup is the one that actually builds and installs the library
  • c/src/lib/libbsp/i386/i386ex/network/netexterns.h

    rf91b8df1 rc27b2d0d  
     1/*
     2 *  $Id$
     3 */
     4
    15#ifndef NET_EXTERNS_H
    26#define NET_EXTERNS_H
     
    1014extern void uti596reset(void);
    1115extern void uti596Diagnose(int);
     16extern void uti596_request_reset(void);
    1217
    1318#endif
  • c/src/lib/libbsp/i386/i386ex/network/network.c

    rf91b8df1 rc27b2d0d  
    1 /* uti596.c: An 82596 ethernet driver for rtems-bsd. */
     1/* uti596.c: An 82596 ethernet driver for rtems-bsd.
     2 *
     3 *  $Id$
     4 */
     5
    26void dump_scb(void);
    37
     
    1115
    1216
    13 int forceResetRX = 0;
    14 int forceResetTX = 0;
    15 
    16 
    1717/*
    1818   
    1919  EII: Oct 16 : Version 0.0
    20 
    2120
    2221*/
     
    3029struct i596_rfd *pISR_Rfd; 
    3130
    32 
    33 #define MY_PRINT_1( msg, p1 ) {  char buffer[80];  int i,j; sprintf(buffer, msg, p1 );j=strlen(buffer); for ( i=0;i<j;i++) outbyte(buffer[i]); }
    34 
    3531void show_buffers (void);
    3632void show_queues(void);
     
    6864#include <asm.h>
    6965
    70 int reset_bit_test = 0;
    7166
    7267/* #include "../misc/utils.h" */
     
    7469static struct uti596_softc uti596_softc;
    7570
    76 void uti596rxStart(int);
    7771int uti596packetNumber = 0;
    7872
     
    109103#define INTERRUPT_EVENT         RTEMS_EVENT_1
    110104#define START_TRANSMIT_EVENT    RTEMS_EVENT_2
     105#define NIC_RESET_EVENT         RTEMS_EVENT_3
    111106
    112107#define RBUF_SIZE       1520
     
    131126void        uti596_txDaemon               (void *);
    132127void        uti596_rxDaemon               (void *);
     128void        uti596_resetDaemon            (void *);
    133129
    134130void        uti596_stop                   (struct uti596_softc *);
     
    140136
    141137void uti596_initialize_hardware(struct uti596_softc *);
     138void uti596_reset_hardware(struct uti596_softc *);
    142139
    143140void uti596clearListStatus(struct i596_rfd *);
     
    173170        } \
    174171}
    175 
    176 
    177 
    178 static void nopOn(const rtems_irq_connect_data* notUsed)
     172/*************************************************************************/
     173
     174void
     175uti596_request_reset(void){
     176   uti596_softc.nic_reset = 0;
     177   sc = rtems_event_send(uti596_softc.resetDaemonTid, NIC_RESET_EVENT);
     178   if ( sc != RTEMS_SUCCESSFUL )
     179     rtems_panic ("Can't notify resetDaemon: %s\n", rtems_status_text (sc));
     180}
     181
     182
     183
     184static void uti596_maskOn(const rtems_irq_connect_data* irq)
    179185{
    180186  /*
     
    182188   * to this location ?
    183189   */
     190  (void) BSP_irq_enable_at_i8259s (irq->name);
     191}
     192
     193static void uti596_maskOff(const rtems_irq_connect_data* irq)
     194{
     195  /*
     196   * code should be moved from initialize_hardware
     197   * to this location ?
     198   */
     199  (void) BSP_irq_disable_at_i8259s (irq->name);
    184200}
    185201
     
    277293   
    278294    uti596_softc.savedCount = 0;
     295
     296    uti596_softc.nop.cmd.command = CmdNOp; /* initialize the nop command */
    279297
    280298    return (i); /* the number of allocated buffers */
     
    327345   pLastRfd -> cmd &= ~CMD_EOL;  /* RESET_EL : reset EL bit to 0  */
    328346   uti596_softc.countRFD++;  /* Lets assume we add it successfully
    329                                     If not, the RFD may be used, and may decrement countRFD < 0 !!*/
    330    /*    if (uti596_softc.countRFD > UTI_596_RFD_NUMBER) {
    331      printf( "Supply: Count too high, count == %d, when adding %p\n",uti596_softc.countRFD, pRfd);
    332      dumpQ();
    333    }
    334    */
     347                                If not, the RFD may be used, and may decrement countRFD < 0 !!*/
    335348   /*
    336349    * Check if the last RFD was used while appending.
     
    354367      */
    355368     if (uti596_softc.pLastUnkRFD != I596_NULL ) {
    356        /*       printf("Before appending\n");
    357        dumpQ(); */
     369   
    358370       uti596append(&uti596_softc.pSavedRfdQueue, pRfd); /* Only here! saved Q */
    359371       uti596_softc.pEndSavedQueue = pRfd;
    360372       uti596_softc.savedCount++;
    361373       uti596_softc.countRFD--;
    362        /*       printf("Last UNK must be NULL: %p\n",uti596_softc.pLastUnkRFD);
    363        dumpQ(); */
     374       
    364375     }
    365376     else {
     
    370381         uti596_softc.pBeginRFA -> cmd &= ~CMD_EOL;  /* Ensure that beginRFA is not EOL */
    371382         
    372          UTI_596_ASSERT(uti596_softc.pEndRFA -> next == I596_NULL, "supply: List is buggered\n");
     383         UTI_596_ASSERT(uti596_softc.pEndRFA -> next == I596_NULL, "supply: List buggered\n");
    373384         UTI_596_ASSERT(uti596_softc.pEndRFA -> cmd & CMD_EOL, "supply: No EOL at end.\n");
    374385         UTI_596_ASSERT(uti596_softc.scb.command == 0, "Supply: scb command must be zero\n");
    375386#ifdef DBG_START
    376          printf("B");
    377 #endif
    378          uti596rxStart(SCB_STAT_RNR);                     /*Ack the RNR interrupt */
    379          
     387         printf("Supply FD: starting receiver");
     388#endif
     389         /* start the receiver */
     390         UTI_596_ASSERT(uti596_softc.pBeginRFA != I596_NULL, "rx start w/ NULL begin! \n");
     391         uti596_softc.scb.pRfd = uti596_softc.pBeginRFA;
     392         uti596_softc.scb.command = RX_START | SCB_STAT_RNR;  /* Don't ack RNR! The receiver should be stopped in this case */
     393         UTI_596_ASSERT( !(uti596_softc.scb.status & SCB_STAT_FR),"FRAME RECEIVED INT COMING!\n");
     394         outport_byte(CHAN_ATTN, 0);
    380395       }
    381396     }
    382        return;
     397     return;
    383398     
    384399   }
     
    399414}
    400415
    401 void uti596rxStart(int cmd)
    402 {
    403   UTI_596_ASSERT(uti596_softc.pBeginRFA != I596_NULL, "rx start w/ NULL begin! \n");
    404   uti596_softc.scb.pRfd = uti596_softc.pBeginRFA;
    405   uti596_softc.scb.command = RX_START | cmd;  /* Don't ack RNR! The receiver should be stopped in this case */
    406   UTI_596_ASSERT( !(uti596_softc.scb.status & SCB_STAT_FR),"FRAME RECEIVED INT COMING!\n");
    407   outport_byte(CHAN_ATTN, 0);
    408 }
    409416
    410417static void
     
    442449 
    443450  /* change the scp address */
    444 
     451#ifdef DBG_INIT
    445452  printf("Change the SCP address\n");
     453#endif
    446454 
    447455  /*
     
    491499  sc->irqInfo.name = UTI_596_IRQ;
    492500  sc->irqInfo.hdl  = ( void * ) uti596DynamicInterruptHandler;
    493   sc->irqInfo.on   = nopOn;
    494   sc->irqInfo.off  = nopOn;
     501  sc->irqInfo.on   = uti596_maskOn;
     502  sc->irqInfo.off  = uti596_maskOff;
    495503  sc->irqInfo.isOn = uti596_isOn;
    496504 
     
    503511  uti596_initMem(sc);
    504512 
    505   /*
    506    * Create a semaphore to guard the critical sections within 596raw
    507    * IS THIS NEEDED W/ FreeBSD?
    508    */
    509   /*  sc->semaphore_name = rtems_build_name('I','5','9','6');
    510   status_code = rtems_semaphore_create(sc->semaphore_name,
    511                                        UTI596_MUTEX,
    512                                        RTEMS_DEFAULT_ATTRIBUTES,
    513                                        RTEMS_NO_PRIORITY,
    514                                        &sc->semaphore_id);
    515                                        */ 
    516513#ifdef DBG_INIT
    517514  printf("After attach, status of board = 0x%x\n", sc->scb.status );
    518515#endif
     516  outport_word(0x380, 0xf); /* reset the LED's */
     517}
     518
     519
     520
     521void
     522uti596_reset_hardware(struct uti596_softc *sc)
     523{
     524  int boguscnt = 1000;
     525 
     526  /* reset the board  */
     527  outport_word( PORT_ADDR, 0 );
     528  outport_word( PORT_ADDR, 0 );
     529
     530#ifdef DBG_RESET
     531  printf("reset_hardware:Scp address %p\n", sc->pScp);
     532#endif
     533  sc->pScp = (struct i596_scp *)
     534    ((((int)uti596_softc.pScp) + 0xf) & 0xfffffff0);
     535 
     536#ifdef DBG_RESET
     537  printf("reset_hardware:change scp address to : %p\n",sc->pScp);
     538#endif
     539
     540 
     541  /* change the scp address */
     542#ifdef DBG_RESET
     543  printf("Change the SCP address\n");
     544#endif
     545 
     546  /*
     547   * Set the DMA mode to enable the 82596 to become a bus-master
     548   */
     549  outport_byte(DMA_MASK_REG,DMA_DISABLE);      /* disable_dma */
     550  outport_byte(DMA_MODE_REG,DMA_MODE_CASCADE); /* set dma mode */
     551  outport_byte(DMA_MASK_REG,DMA_ENABLE);       /* enable dma */
     552
     553  /* reset the board  */
     554  outport_word( PORT_ADDR, 0 );
     555  outport_word( PORT_ADDR, 0 );
     556 
     557  outport_word(PORT_ADDR, ((((int)uti596_softc.pScp) &  0xffff) | 2 ));
     558  outport_word(PORT_ADDR, (( (int)uti596_softc.pScp) >> 16 ) & 0xffff );
     559 
     560  /* This is linear mode, LOCK function is disabled  */
     561 
     562  sc->pScp->sysbus = 0x00540000;
     563  sc->pScp->iscp   = &sc->iscp;
     564  sc->iscp.scb     = &sc->scb;
     565  sc->iscp.stat    = 0x0001;
     566 
     567  sc->pCmdHead     = sc->scb.pCmd = I596_NULL;
     568 
     569#ifdef DBG_596
     570  printf("reset_hardware: starting i82596.\n");
     571#endif
     572 
     573  /* Pass the scb address to the 596 */
     574  outport_word(CHAN_ATTN,0);
     575 
     576  while (sc->iscp.stat)
     577    if (--boguscnt == 0)
     578      {
     579        printf("reset_hardware: timed out with status %4.4lx\n",
     580               sc->iscp.stat );
     581        break;
     582      }
     583 
     584  /* clear the command word */
     585  sc->scb.command = 0;
     586       
     587#ifdef DBG_RESET
     588  printf("After reset_hardware, status of board = 0x%x\n", sc->scb.status );
     589#endif
     590
    519591  outport_word(0x380, 0xf); /* reset the LED's */
    520592}
     
    706778  struct i596_rfd *pRfd;
    707779  ISR_Level level;
    708   int tid,i;
     780  int tid;
    709781  rtems_event_set events;
    710782  struct ether_header *eh;
     
    876948}
    877949
    878 
    879  /* static inline */ void uti596reset_bit_test()
    880  {
    881    reset_bit_test = 1;
    882  }
    883 
    884950void uti596reset(void)
    885951 {
    886    int i;
    887 
    888 #ifdef DBG_596_RESET
    889      printf ("i596reset\n");
    890 #endif
    891 
    892   uti596_initialize_hardware(&uti596_softc); /* resets the ethernet hardware, now must re-config */
    893   uti596Diagnose(1); /* verbose diagnosis */
    894 
    895   uti596_softc.set_conf.cmd.command = CmdConfigure;
    896   memcpy (uti596_softc.set_conf.data, uti596initSetup, 14);
    897   uti596addPolledCmd( (struct i596_cmd *) &uti596_softc.set_conf);
    898  
    899   while( !uti596_softc.set_conf.cmd.status & STAT_C )
     952   int i,count;
     953   struct uti596_softc *sc = &uti596_softc;
     954   /*   struct i596_rfd * pRfd; */
     955
     956#ifdef DBG_RESET
     957     printf ("reset: begins\n");
     958#endif
     959
     960  sc->resetDone = 0;
     961  sc->irqInfo.off(&sc->irqInfo);
     962
     963  UTI_WAIT_COMMAND_ACCEPTED(10000, "reset: wait for previous command complete"); 
     964
     965  /* abort ALL of the current work */
     966  sc->scb.command = CUC_ABORT | RX_ABORT;
     967
     968  outport_word(CHAN_ATTN,0);
     969  UTI_WAIT_COMMAND_ACCEPTED(4000, "reset: abort requested");
     970
     971  uti596_reset_hardware(&uti596_softc); /* reset the ethernet hardware. must re-config */
     972
     973#ifdef DBG_RESET
     974  uti596Diagnose(1);
     975#endif
     976
     977  sc->set_conf.cmd.command = CmdConfigure;
     978  memcpy (sc->set_conf.data, uti596initSetup, 14);
     979  uti596addPolledCmd( (struct i596_cmd *) &sc->set_conf);
     980 
     981  /****
     982   * POLL
     983   ****/
     984 
     985  count = 2000;
     986  while( !( sc->set_conf.cmd.status & STAT_C ) && --count )
    900987    printf(".");
    901 
    902   printf("Configure completed\n");
    903 #ifdef DBG_596
    904   printf("Setting Address\n");
    905 #endif
    906   uti596_softc.set_add.cmd.command = CmdSASetup;
     988 
     989  if ( count )
     990    printf("Configure OK, count = %d\n",count);
     991  else
     992    printf("***reset: Configure failed\n");
     993 
     994  /*
     995   * Create the IA setup command
     996   */
     997 
     998#ifdef DBG_RESET
     999  printf("reset: Setting Address\n");
     1000#endif
     1001  sc->set_add.cmd.command = CmdSASetup;
    9071002  for ( i=0; i<6; i++)
    908     uti596_softc.set_add.data[i]= uti596_softc.arpcom.ac_enaddr[i];
    909  
    910   uti596_softc.cmdOk = 0;
    911   uti596addCmd((struct i596_cmd *)&uti596_softc.set_add);
     1003    sc->set_add.data[i]=sc->arpcom.ac_enaddr[i];
     1004 
     1005  sc->cmdOk = 0;
     1006  uti596addPolledCmd((struct i596_cmd *)&sc->set_add);
     1007 
     1008  count = 2000;
     1009  while( !(sc->set_add.cmd.status & STAT_C ) && --count)
     1010    printf(".");
     1011 
     1012  if ( count )
     1013    printf ("Reset Set Address OK, count= %d\n",count);
     1014  else
     1015    printf("Reset Set Address Failed\n");
    9121016  /*******/
    913   while( !uti596_softc.set_add.cmd.status & STAT_C )
    914     printf(".");
    915   /*******/
    916  
    917 #ifdef DBG_596
    918   printf( "After initialization, status and command: 0x%x, 0x%x\n",
    919           uti596_softc.scb.status, uti596_softc.scb.status);
    920  
    921 #endif
    922   if ( uti596_softc.pLastUnkRFD != I596_NULL ) {
    923     uti596_softc. pEndRFA =  uti596_softc. pLastUnkRFD; /* The end position can be updated */
    924     uti596_softc. pLastUnkRFD = I596_NULL;           
     1017 
     1018#ifdef DBG_RESET
     1019  printf( "After reset, status and command: 0x%x, 0x%x\n",
     1020          sc->scb.status, sc->scb.status);
     1021 
     1022#endif
     1023 
     1024
     1025  /* restore the RFA */
     1026
     1027  dumpQ();
     1028
     1029  if ( sc->pLastUnkRFD != I596_NULL ) {
     1030    sc-> pEndRFA =  sc->pLastUnkRFD; /* The end position can be updated */
     1031    sc-> pLastUnkRFD = I596_NULL;           
    9251032  }
    9261033 
    927   /* clear status in RFA */
    928   uti596clearListStatus(uti596_softc.pBeginRFA );
    929   uti596clearListStatus(uti596_softc.pSavedRfdQueue );
    930   uti596_softc.scb.pRfd =  uti596_softc.pBeginRFA;
    931 
    932   uti596_softc.scb.command = RX_START;
     1034  sc->pEndRFA->next = sc->pSavedRfdQueue;
     1035  if ( sc->pSavedRfdQueue != I596_NULL ) {
     1036    sc->pEndRFA = sc->pEndSavedQueue;
     1037    sc->pSavedRfdQueue = sc->pEndSavedQueue = I596_NULL;
     1038    sc -> countRFD = sc->rxBdCount ;
     1039  }
     1040
     1041  /*   if ( sc->pInboundFrameQueue != I596_NULL ){
     1042    do {
     1043      pRfd = sc->pInboundFrameQueue->next;
     1044      sc->pEndRFA -> next = sc->pInboundFrameQueue;
     1045      sc->pInboundFrameQueue = pRfd;
     1046     } while( pRfd != I596_NULL ) ;
     1047   
     1048  }
     1049  */
     1050
     1051  sc->scb.pRfd =  sc->pBeginRFA; /* readdress the head of the RFA in the SCB */
     1052
     1053  uti596clearListStatus(sc->pBeginRFA );
     1054
     1055  dumpQ(); /* purely for testing */
     1056
     1057  sc->irqInfo.on(&sc->irqInfo);  /* moved here. Was originally after command issued. */
     1058  sc->scb.command = RX_START;
     1059
    9331060  outport_word(CHAN_ATTN,0 );
    934   UTI_WAIT_COMMAND_ACCEPTED(4000, "init");
    935  
    936   uti596_softc.started = 1;
     1061  UTI_WAIT_COMMAND_ACCEPTED(4000, "reset");
     1062   
     1063  sc->resetDone = 1;
     1064 
     1065  sc->started = 1;
     1066
     1067  /* uti596addCmd(&uti506_softc.nop); */ /* just for fun */
     1068 
     1069#ifdef DBG_RESET
     1070  printf("reset: complete\n");
     1071#endif
    9371072 }
    9381073 
     
    9971132     pCmd->status = 0;
    9981133     pCmd->command |= (CMD_EOL | CMD_INTR ); /* all commands last in list & return an interrupt */
    999      if ( reset_bit_test ){
    1000        pCmd->command |= 0x0080;
    1001        printf("Issuing cmd: %#x\n",  pCmd->command);
    1002        reset_bit_test = 0;
    1003      }
    10041134
    10051135     pCmd->next = I596_NULL;
     
    11571287 
    11581288
     1289/*
     1290 * NIC reset daemon.
     1291 */
     1292void
     1293uti596_resetDaemon (void *arg)
     1294{
     1295        struct uti596_softc *sc = (struct uti596_softc *)arg;
     1296        rtems_event_set events;
     1297        /* struct ifnet *ifp = &sc->arpcom.ac_if; */
     1298
     1299        for (;;) {
     1300          /*
     1301           * Wait for reset event from ISR
     1302           */
     1303          rtems_bsdnet_event_receive (NIC_RESET_EVENT,
     1304                                      RTEMS_EVENT_ANY | RTEMS_WAIT,
     1305                                      RTEMS_NO_TIMEOUT, &events);
     1306
     1307          printf("reset daemon: Resetting NIC\n");
     1308
     1309          sc->stats.nic_reset_count++;
     1310          /*
     1311           * Reinitialize the network card
     1312           */
     1313          rtems_bsdnet_semaphore_obtain ();
     1314          uti596reset();
     1315          rtems_bsdnet_semaphore_release ();
     1316        }
     1317}
     1318
     1319 
     1320
    11591321 /***********************************************************************
    11601322  *  Function:   send_packet
     
    11851347  rtems_event_set events;
    11861348
    1187   /*
    1188    * Block all competing threads. IS THIS NOW NEEDED? I THINK NOT
    1189    */
    1190  
    1191   /*   while(1) {
    1192 #ifdef DBG_RAW
    1193     rtems_task_ident (0, 0, &tid);
    1194     printf("0x%x Waiting for semaphore\n", tid);
    1195 #endif
    1196       status = rtems_semaphore_obtain(sc->semaphore_id,
    1197                                     RTEMS_WAIT,
    1198                                     RTEMS_NO_TIMEOUT);
    1199    
    1200     if ( status == RTEMS_SUCCESSFUL ){
    1201 #ifdef DBG_RAW
    1202       printf("0x%x Got semaphore\n", tid);
    1203 #endif
    1204       break;
    1205     }
    1206     else
    1207       {
    1208 #ifdef DBG_RAW
    1209         printf("0x%x Waits on semaphore\n", tid);
    1210 #endif
    1211         sc->txRawWait++;
    1212       }
    1213   }
    1214   */
    12151349  /*
    12161350   * For all mbufs in the chain,
     
    13471481  }
    13481482
    1349   /* We have finished with this critical section */
    1350   /* rtems_semaphore_release(sc->semaphore_id); */
    13511483 
    13521484}
     
    17601892 }
    17611893 
     1894
    17621895
    17631896 /***********************************************************************
     
    17921925   }
    17931926   else {
    1794      printk("\n***INFO:ISR won't wait\n");
     1927     printk("\n***INFO:ISR won't process now\n");
    17951928     return;
    17961929   }
    17971930 }
    17981931 else {
    1799    printk("\n***WARNING: Nothing to ACK\n");
     1932   printk("\n***ERROR: Spurious interrupt. Resetting...\n");
     1933   uti596_softc.nic_reset = 1;
     1934 }
     1935 
     1936 if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) ){
     1937   printk("\n*****ERROR: Command Complete, and CNA available: 0x%x\nResetting...", scbStatus);
     1938   uti596_softc.nic_reset = 1;
    18001939   return;
    18011940 }
    1802  
    1803  if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) )
    1804    printk("\n*****ERROR:Command Complete, CNA available: %#x\n", scbStatus);
     1941
     1942 if ( !(scbStatus & SCB_STAT_CX) && (scbStatus & SCB_STAT_CNA) ) {
     1943   printk("\n*****ERROR: CNA, NO CX:0x%x\nResetting...",scbStatus);
     1944   uti596_softc.nic_reset = 1;
     1945   return;
     1946 }
     1947
     1948 if ( scbStatus & SCB_CUS_SUSPENDED ) {
     1949   printk("\n*****ERROR: Command unit suspended!:0x%x\nResetting...",scbStatus);
     1950   uti596_softc.nic_reset = 1;
     1951   return;
     1952 }
     1953
     1954 if ( scbStatus & RU_SUSPENDED  ) {
     1955   printk("\n*****ERROR: Receive unit suspended!:0x%x\nResetting...",scbStatus);
     1956   uti596_softc.nic_reset = 1;
     1957   return;
     1958 }
    18051959 
    1806  if ( !(scbStatus & SCB_STAT_CX) && (scbStatus & SCB_STAT_CNA) )
    1807    printk("\n*****ERROR: CNA went unavailable, NO CX:%#x\n",scbStatus);
    1808  
    1809  if ( scbStatus & SCB_STAT_RNR )
     1960 if ( scbStatus & SCB_STAT_RNR ) {
    18101961   printk("\n*****WARNING: RNR %x\n",scbStatus);
     1962 }
    18111963 
    18121964 /*
     
    18191971   printk("\nISR:FR\n");
    18201972#endif
    1821    if ( uti596_softc.pBeginRFA == I596_NULL ||  !( uti596_softc.pBeginRFA -> stat & STAT_C ) ||
    1822         forceResetRX ) {
    1823 
    1824      /*      if ( !forceResetRX )
    1825        printk("****ERROR: FR interrupt and NO complete FR!\n");
    1826      else
    1827        printk("****INFO: RX reset requested\n");
    1828        */
    1829      forceResetRX = 0;
    1830      printk("****INFO: Resetting board ( rx ) commented out\n");
     1973   if ( uti596_softc.pBeginRFA == I596_NULL ||  !( uti596_softc.pBeginRFA -> stat & STAT_C)){
    18311974     dump_scb();
    1832      /* uti596reset(); */
     1975     uti596_softc.nic_reset = 1;
    18331976   }
    18341977   else
     
    19062049    * For ALL completed commands
    19072050    */
    1908    if ( pIsrCmd !=  I596_NULL && pIsrCmd->status & STAT_C && !forceResetTX ){
     2051   if ( pIsrCmd !=  I596_NULL && pIsrCmd->status & STAT_C ){
    19092052     
    19102053#ifdef DBG_RAW_ISR
     
    20222165     if ( pIsrCmd != I596_NULL )
    20232166       printk("****WARNING: more commands in list, but no start to NIC\n");
    2024    } /* end if completed */
     2167   } /* end if pIsrCmd != NULL && pIsrCmd->stat & STAT_C */
    20252168   else {
    20262169
    2027      /*     if ( !forceResetTX )
    2028        printk("*****ERROR:CX but no command is completed\n");
    2029      else
    2030        printk("*****INFO:forcing an ethernet card reset\n");
    2031      */
    20322170     /* Reset the ethernet card, and wake the transmitter (if necessary) */
    20332171
    20342172     printk("****INFO: Resetting board ( tx )\n");
    2035      forceResetTX = 0;
    2036      uti596reset();
     2173     uti596_softc.nic_reset = 1;
    20372174     if ( uti596_softc.txDaemonTid){  /* Ensure that a transmitter is waiting */
    20382175       /*  printk("*****INFO:Wake Transmitter\n"); */
     
    22072344#endif
    22082345 count_rx=0;
     2346
     2347 /*
     2348  * Do this last, to ensure that the reset is called at the right time.
     2349  */
     2350 if ( uti596_softc.nic_reset ){
     2351   uti596_softc.nic_reset = 0;
     2352   sc = rtems_event_send(uti596_softc.resetDaemonTid, NIC_RESET_EVENT);
     2353   if ( sc != RTEMS_SUCCESSFUL )
     2354     rtems_panic ("Can't notify resetDaemon: %s\n", rtems_status_text (sc));
     2355 }
     2356
    22092357 return;
    22102358 }
     
    24142562        printf ("Rx Framing Errors:%-8u",    sc->stats.rx_frame_errors);
    24152563        printf ("Rx crc errors:%-8u\n",        sc->stats.rx_crc_errors);
     2564
    24162565        printf ("TX WAITS: %-8lu\n", sc->txRawWait);
    24172566
     2567        printf ("NIC resets: %-8u\n", sc->stats.nic_reset_count);
     2568
    24182569        printf("NIC reports\n");
     2570
    24192571        dump_scb();
    24202572      }
     
    25342686     */
    25352687
    2536     sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 4096, uti596_txDaemon, sc);
    2537     sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 4096, uti596_rxDaemon, sc);
    2538  
     2688    sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 2*4096, uti596_txDaemon, sc);
     2689    sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 2*4096, uti596_rxDaemon, sc);
     2690    sc->resetDaemonTid = rtems_bsdnet_newproc ("UTrt", 2*4096,
     2691                                               uti596_resetDaemon, sc);
    25392692  }
    25402693  /*
  • c/src/lib/libbsp/i386/i386ex/network/uti596.h

    rf91b8df1 rc27b2d0d  
    55 * EII: March 11: Created v. 0.0
    66 *      Jan 12/98 Added STAT bits, s11-=s5 and max_colls.
     7 *
     8 *  $Id$
    79 */
    810
     
    4951  int   tx_heartbeat_errors;
    5052  int   tx_window_errors;
     53
     54  /* NIC reset errors */
     55  int   nic_reset_count;      /* The number of times uti596reset() has been called. */
    5156};
    5257
     
    7984#define SCB_STAT_RNR    0x1000  /* Receiver Not Ready             */
    8085
     86#define SCB_CUS_SUSPENDED 0x0100
     87#define SCB_CUS_ACTIVE    0x0200
     88
     89
    8190#define STAT_C          0x8000  /* Set to 1 after execution              */
    8291#define STAT_B          0x4000  /* 1 : Cmd being executed, 0 : Cmd done. */
     
    106115#define  RX_ABORT       0x0040
    107116
    108 #define  RU_SUSPENDED    0x001
     117#define  RU_SUSPENDED    0x0010
    109118#define  RU_NO_RESOURCES 0x0020
    110119#define  RU_READY        0x0040
    111120
    112        
    113121
    114122#define IO_ADDR         0x360
     
    191199};
    192200
    193 
     201struct i596_nop {
     202  struct i596_cmd cmd;
     203};
     204
     205struct i596_tdr {
     206  struct i596_cmd cmd;
     207  unsigned int data;
     208};
    194209
    195210#define RX_RING_SIZE 8
     
    238253  struct i596_set_add           set_add;
    239254  struct i596_configure         set_conf;
    240   struct i596_cmd               tdr;
     255  struct i596_tdr               tdr;
     256  struct i596_nop               nop;               
    241257  unsigned long                 stat;
    242258  struct tx_cmd                *pTxCmd;
     
    255271  rtems_id              rxDaemonTid;
    256272  rtems_id              txDaemonTid;
     273  rtems_id              resetDaemonTid;
    257274
    258275  struct enet_statistics stats;
     
    273290  char                 zeroes[64];
    274291  unsigned long        rawsndcnt;
     292  int                  nic_reset; /* flag is for requesting that ISR issue a reset quest */
    275293} ;
    276294#endif
  • c/src/lib/libbsp/i386/i386ex/wrapup/Makefile.in

    rf91b8df1 rc27b2d0d  
    1212GENERIC_PIECES=
    1313
    14 # # We only build the Network library if HAS_NETWORKING was defined
    15 # NETWORK_yes_V = network
    16 # NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)
     14# We only build the Network library if HAS_NETWORKING was defined
     15NETWORK_yes_V = network
     16NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)
    1717
    1818# bummer; have to use $foreach since % pattern subst rules only replace 1x
Note: See TracChangeset for help on using the changeset viewer.