Subject: kern/2919: ENI ATM driver (midway.c) will not compile cleanly
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jukka.partanen@research.nokia.com>
List: netbsd-bugs
Date: 11/07/1996 13:53:07
>Number:         2919
>Category:       kern
>Synopsis:       ENI ATM driver (midway.c) will not compile cleanly
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov  7 04:20:02 1996
>Last-Modified:
>Originator:     Jukka Partanen
>Organization:
	
	Nokia Research Center
>Release:        1.2B
>Environment:
	
System: NetBSD tuuletin.research.nokia.com 1.2B NetBSD 1.2B (TUULETIN) #0: Thu Nov 7 13:01:43 EET 1996 partanen@tuuletin.research.nokia.com:/usr/src/current/src/sys/arch/i386/compile/TUULETIN i386


>Description:
	
	The Efficient Networks, Inc. ENI ATM adapter driver (midway.c) in 
	current has small bugs and will not compile cleanly.
>How-To-Repeat:
	
	Configure a kernel with en0 and try to compile it. With these patches
	and also with the NATM patches I was able to use it.
>Fix:
	
--- sys/dev/ic/midway.c.orig	Sat Oct 26 14:20:05 1996
+++ sys/dev/ic/midway.c	Thu Nov  7 13:28:20 1996
@@ -581,7 +581,7 @@
 
   reg = EN_READ(sc, MID_RESID);
 
-  printf("%s: ATM midway v%d, board IDs %d.%d, %s%s%s, %dKB on-board RAM\n",
+  printf("%s: ATM midway v%d, board IDs %d.%d, %s%s%s, %ldKB on-board RAM\n",
 	sc->sc_dev.dv_xname, MID_VER(reg), MID_MID(reg), MID_DID(reg), 
 	(MID_IS_SABRE(reg)) ? "sabre controller, " : "",
 	(MID_IS_SUNI(reg)) ? "SUNI" : "Utopia",
@@ -1491,7 +1491,7 @@
 
   EN_COUNT(sc->mfix);			/* count # of calls */
 #ifdef EN_DEBUG
-  printf("%s: mfix mbuf m_data=0x%x, m_len=%d\n", sc->sc_dev.dv_xname,
+  printf("%s: mfix mbuf m_data=%p, m_len=%d\n", sc->sc_dev.dv_xname,
 	m->m_data, m->m_len);
 #endif
 
@@ -1564,7 +1564,7 @@
   struct mbuf *tmp;
   struct atm_pseudohdr *ap;
   struct en_launch launch;
-  int datalen, dtqneed, len, ncells;
+  int datalen = 0, dtqneed, len, ncells;
   u_int8_t *cp;
 
 #ifdef EN_DEBUG
@@ -1669,7 +1669,7 @@
   if (launch.need > sc->txslot[chan].bfree) {
     EN_COUNT(sc->txoutspace);
 #ifdef EN_DEBUG
-    printf("%s: tx%d: out of trasmit space\n", sc->sc_dev.dv_xname, chan);
+    printf("%s: tx%d: out of transmit space\n", sc->sc_dev.dv_xname, chan);
 #endif
     return;		/* >>> exit here if out of obmem buffer space <<< */
   }
@@ -1685,7 +1685,7 @@
     sc->need_dtqs = 1;
     EN_COUNT(sc->txdtqout);
 #ifdef EN_DEBUG
-    printf("%s: tx%d: out of trasmit DTQs\n", sc->sc_dev.dv_xname, chan);
+    printf("%s: tx%d: out of transmit DTQs\n", sc->sc_dev.dv_xname, chan);
 #endif
     return;		/* >>> exit here if out of dtqs <<< */
   }
@@ -1794,7 +1794,7 @@
 		need);
 #endif
 #ifdef EN_DEBUG
-  printf("%s: tx%d: launch mbuf 0x%x!   cur=0x%x[%d], need=%d, addtail=%d\n",
+  printf("%s: tx%d: launch mbuf %p!   cur=0x%x[%d], need=%d, addtail=%d\n",
 	sc->sc_dev.dv_xname, chan, l->t, cur, (cur-start)/4, need, addtail);
   count = EN_READ(sc, MIDX_PLACE(chan));
   printf("     HW: base_address=0x%x, size=%d, read=%d, descstart=%d\n",
@@ -2230,7 +2230,7 @@
 	  ATM_PH_VPI(&ah) = 0;
 	  ATM_PH_SETVCI(&ah, sc->rxslot[slot].atm_vci);
 #ifdef EN_DEBUG
-	  printf("%s: rx%d: rxvci%d: atm_input, mbuf 0x%x, len %d, hand 0x%x\n",
+	  printf("%s: rx%d: rxvci%d: atm_input, mbuf %p, len %d, hand %p\n",
 		sc->sc_dev.dv_xname, slot, sc->rxslot[slot].atm_vci, m,
 		EN_DQ_LEN(drq), sc->rxslot[slot].rxhand);
 #endif
@@ -2347,6 +2347,7 @@
   u_int32_t start, stop, cnt, needalign;
   int slot, raw, aal5, llc, vci, fill, mlen, tlen, drqneed, need, needfill, end;
 
+  aal5 = 0;		/* Silence gcc */
 next_vci:
   if (sc->swsl_size == 0) {
 #ifdef EN_DEBUG
@@ -2469,7 +2470,7 @@
     sav = mtod(m, u_int32_t *);
     if (sav[0] != cur) {
 #ifdef EN_DEBUG
-      printf("%s: rx%d: q'ed mbuf 0x%x not ours\n", 
+      printf("%s: rx%d: q'ed mbuf %p not ours\n", 
 		sc->sc_dev.dv_xname, slot, m);
 #endif
       m = NULL;			/* wasn't ours */
@@ -2479,8 +2480,8 @@
       IF_DEQUEUE(&sc->rxslot[slot].q, m);
       drqneed = sav[1];
 #ifdef EN_DEBUG
-      printf("%s: rx%d: recovered q'ed mbuf 0x%x (drqneed=%d)\n", 
-	sc->sc_dev.dv_xname, slot, drqneed);
+      printf("%s: rx%d: recovered q'ed mbuf %p (drqneed=%d)\n", 
+	sc->sc_dev.dv_xname, slot, m, drqneed);
 #endif
     }
   }
@@ -2496,13 +2497,13 @@
 #endif
     }
 #ifdef EN_DEBUG
-    printf("%s: rx%d: allocate mbuf 0x%x, mlen=%d, drqneed=%d\n", 
+    printf("%s: rx%d: allocate mbuf %p, mlen=%d, drqneed=%d\n", 
 	sc->sc_dev.dv_xname, slot, m, mlen, drqneed);
 #endif
   }
 
 #ifdef EN_DEBUG
-  printf("%s: rx%d: VCI %d, mbuf_chain 0x%x, mlen %d, fill %d\n",
+  printf("%s: rx%d: VCI %d, mbuf_chain %p, mlen %d, fill %d\n",
 	sc->sc_dev.dv_xname, slot, vci, m, mlen, fill);
 #endif
 
@@ -2556,7 +2557,7 @@
     data = mtod(tmp, u_int32_t *);
 
 #ifdef EN_DEBUG
-    printf("%s: rx%d: load mbuf 0x%x, m_len=%d, m_data=0x%x, tlen=%d\n",
+    printf("%s: rx%d: load mbuf %p, m_len=%d, m_data=%p, tlen=%d\n",
 	sc->sc_dev.dv_xname, slot, tmp, tmp->m_len, tmp->m_data, tlen);
 #endif
     

>Audit-Trail:
>Unformatted: