Index: c/src/lib/libbsp/m68k/mvme167/network/network.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme167/network/network.c	(revision df49c60c9671e4a28e636964d744c1f59fb6cb68)
+++ c/src/lib/libbsp/m68k/mvme167/network/network.c	(revision 8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52)
@@ -41,4 +41,6 @@
 #define UTI_596_ETH_MIN_SIZE  60
 
+#define INET_ADDR_MAX_BUF_SIZE (sizeof "255.255.255.255")
+
 /*
  * RTEMS events
@@ -58,7 +60,9 @@
 #include <sys/socket.h>
 #include <sys/sockio.h>
+#include <sys/types.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <netinet/if_ether.h>
+#include <arpa/inet.h>
 
 #include "uti596.h"
@@ -80,8 +84,8 @@
 
 /* Types of waiting for commands */
-#define UTI596_NO_WAIT  				0
-#define UTI596_WAIT_FOR_CU_ACCEPT  		1
-#define UTI596_WAIT_FOR_INITIALIZATION  2
-#define UTI596_WAIT_FOR_STAT_C 			3
+#define UTI596_NO_WAIT									0
+#define UTI596_WAIT_FOR_CU_ACCEPT				1
+#define UTI596_WAIT_FOR_INITIALIZATION	2
+#define UTI596_WAIT_FOR_STAT_C					3
 
 /* Device dependent data structure */
@@ -418,4 +422,5 @@
  *    sc - pointer to the uti596_softc struct
  *    wait_type - UTI596_NO_WAIT
+ *    						UTI596_WAIT
  *                UTI596_WAIT_FOR_CU_ACCEPT
  *                UTI596_WAIT_FOR_INITIALIZATION
@@ -433,14 +438,16 @@
 {
   rtems_interval ticks_per_second, start_ticks, end_ticks;
+
+  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
+	rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
+	end_ticks = start_ticks + ticks_per_second;
+
+  switch( waitType ) {
   
-  switch( waitType ) {
     case UTI596_NO_WAIT:
       return 0;
 
+
     case UTI596_WAIT_FOR_CU_ACCEPT:
-      rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
-		  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
-		  end_ticks = start_ticks + ticks_per_second;
-
 		  do {
 			  if (sc->scb.command == 0)
@@ -460,8 +467,4 @@
  
     case UTI596_WAIT_FOR_INITIALIZATION:
-      rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
-		  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
-		  end_ticks = start_ticks + ticks_per_second;
-
 		  do {
 		    if( !sc->iscp.busy )
@@ -485,8 +488,4 @@
 
 	 case UTI596_WAIT_FOR_STAT_C:
-	   rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
-		 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
-		 end_ticks = start_ticks + ticks_per_second;
-
 		 do {
 		   if( *sc->pCurrent_command_status & STAT_C )
@@ -1551,10 +1550,4 @@
   } while( m != NULL && ++bd_count < 16 );
 
-  /* This should never happen */
-  if ( bd_count == 16 ) {
-    printk(("TX ERROR:Too many mbufs in the packet!!!\n"))
-    printk(("Must coalesce!\n"))
-  }
-
   if ( length < UTI_596_ETH_MIN_SIZE ) {
     pTbd->data = (char *) word_swap ((unsigned long) sc->zeroes); /* add padding to pTbd */
@@ -1662,7 +1655,8 @@
   uti596_softc_ *sc = &uti596_softc;				/* device dependent data structure */
   struct ifnet * ifp = &sc->arpcom.ac_if;   /* ifnet structure */
-
-        int unitNumber;
-        char *unitName;
+	int unitNumber;
+	char *unitName;
+	char *pAddr;
+	int addr;
 
 	#ifdef DBG_ATTACH
@@ -1690,9 +1684,34 @@
     ifp->if_mtu = ETHERMTU;
 
-  /* Ethernet address can be specified in the ifconfig structure or
-   * it can be read in from BBRAM at $FFFC1F2C (6 bytes)
-   * mvme167 manual p. 1-47
+  /* 
+   * If an IP address and netmask are provided in NVRAM, cheat,
+   * and stuff them into the ifconfig structure, overriding any
+   * existing or NULL values.
+   * 
+   * Warning: If values are provided in NVRAM, the ifconfig entries
+   * should be NULL because buffer memory allocated to hold the
+   * structure values is unrecoverable and would be lost here.
    */
-  if ( pConfig->hardware_address) {
+  if ( addr = nvram->ipaddr ) {
+  	if ( pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT ) )
+			pConfig->ip_address = inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
+		else
+			rtems_panic("Can't allocate ip_address buffer!\n");
+  }
+  if ( addr = nvram->netmask ) {
+  	if ( pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT ) )
+			pConfig->ip_netmask = inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
+		else
+			rtems_panic("Can't allocate ip_netmask buffer!\n");
+  }
+
+  /* Ethernet address can be specified in NVRAM, or in the ifconfig
+   * structure. It will be read by default from BBRAM at $FFFC1F2C
+   * (6 bytes) mvme167 manual p. 1-47
+   */
+  if ( nvram->enaddr ) {
+  	memcpy (sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
+  }
+  else if ( pConfig->hardware_address) {
     memcpy (sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
   }
@@ -1700,4 +1719,8 @@
     memcpy (sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
   }
+
+  /* Possibly override default acceptance of broadcast packets */
+  if (pConfig->ignore_broadcast)
+  	uti596initSetup[8] |= 0x02;
 
   /* Assign requested receive buffer descriptor count */
@@ -1716,5 +1739,5 @@
   ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
   ifp->if_snd.ifq_maxlen = ifqmaxlen;
-        ifp->if_init = uti596_init;
+  ifp->if_init = uti596_init;
   ifp->if_ioctl = uti596_ioctl;
   ifp->if_start = uti596_start;
