Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 May 2000 13:22:36 +0800
From:      dudin@np.nk.nornik.ru
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/18639: [PATCH] le driver doesn't work with DEPCA
Message-ID:  <200005180522.NAA25798@np.nk.nornik.ru>

next in thread | raw e-mail | index | archive | help

>Number:         18639
>Category:       kern
>Synopsis:       [PATCH] le driver doesn't work with DEPCA
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 17 22:30:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Eugene A. Doudine
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
Institute "Norilskproject"
>Environment:

FreeBSD mom.np.nk.nornik.ru 3.2-RELEASE FreeBSD 3.2-RELEASE #25: Wed May 17 00:31:35 KRAST 2000     root@mom.np.nk.nornik.ru:/usr/src/sys/compile/MOM  i386

Digital DEPCA rev.E  NIC

>Description:

	DEPCA is not detected by driver.
	(it can be sometimes detected, if other drivers probe DEPCA's
	 base address earlier in the boot process but doesn't work anyway)
	The author of driver states, that driver has been tested only with
	DE200 and later cards (/usr/src/sys/i386/isa/README.le), so this
	behaviour is somewhat expected. 

	Unlike DE200 and later cards DEPCA has 8 bit NICSR, not 16 bit
	as driver assumes, so OUTW/INW do not work with DEPCA. The higher
	byte of NICSR is not used by driver, so I changed OUTW/INW to
	OUTB/INB.  This solved problem with detecting the board on boot.

	The other problem was that board could transmit only several
	packets and then transmission stopped. 

	DEPCA is based on AM7990 LANCE chip, which, unlike AM79C96, 
	restricts the sizes of descriptor rings to powers of 2. 
	So I added the check for this for DEPCA. I'm not sure which chip
	DE100 and DE101 use, probably they need this fix as well.
	
	Now driver works with DEPCA, but I have no chance to check
	if it still works with other cards. 

>How-To-Repeat:

	100% reproducible ( if DEPCA fits into your computer case,
		that is :-) )

>Fix:
	
--- i386/isa/if_le.c.orig	Sun May 14 01:12:52 2000
+++ i386/isa/if_le.c	Wed May 17 00:29:56 2000
@@ -1377,8 +1377,8 @@
 #define	DEPCA_NICSR_SHE		0x0080		/* Shared RAM Enabled (ie hide ROM) */
 #define	DEPCA_NICSR_BOOTTMO	0x0100		/* Remote Boot Timeout (ignored) */
 
-#define	DEPCA_RDNICSR(sc)	(LE_INW(sc, DEPCA_REG_NICSR))
-#define	DEPCA_WRNICSR(sc, val)	(LE_OUTW(sc, DEPCA_REG_NICSR, val))
+#define	DEPCA_RDNICSR(sc)	(LE_INB(sc, DEPCA_REG_NICSR))
+#define	DEPCA_WRNICSR(sc, val)	(LE_OUTB(sc, DEPCA_REG_NICSR, val))
 
 #define	DEPCA_IDSTR_OFFSET	0xC006		/* ID String Offset */
 
@@ -1546,10 +1546,17 @@
 	sc->lance_rxbufsize *= rxdescs / LN_DESC_MAX;
 	rxdescs = LN_DESC_MAX;
     }
-    txdescs = sc->lance_ramsize / LN_TXDESC_RATIO;
-    if (txdescs > LN_DESC_MAX)
-	txdescs = LN_DESC_MAX;
-
+    if (!strcmp(sc->le_prodname,"DEPCA")) {
+	txdescs = 1;
+	while (txdescs <= sc->lance_ramsize / LN_TXDESC_RATIO && 
+		txdescs <= LN_DESC_MAX)
+	    txdescs *= 2;
+	txdescs /= 2;
+    } else {
+    	txdescs = sc->lance_ramsize / LN_TXDESC_RATIO;
+    	if (txdescs > LN_DESC_MAX)
+	    txdescs = LN_DESC_MAX;
+    }
     /*
      * Now calculate where everything goes in memory
      */


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005180522.NAA25798>