From nobody  Wed Jun 24 03:38:53 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id DAA28903;
          Wed, 24 Jun 1998 03:38:53 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199806241038.DAA28903@hub.freebsd.org>
Date: Wed, 24 Jun 1998 03:38:53 -0700 (PDT)
From: max@cca.usart.ru
To: freebsd-gnats-submit@freebsd.org
Subject: WaveLAN (2.4G, ISA, full-length board) cames UP but not RUNNING
X-Send-Pr-Version: www-1.0

>Number:         7044
>Category:       kern
>Synopsis:       [PATCH] WaveLAN (2.4G, ISA, full-length board) cames UP but not RUNNING
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    johan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 24 03:40:01 PDT 1998
>Closed-Date:    Sat Jun 15 10:28:06 PDT 2002
>Last-Modified:  Sat Jun 15 10:28:06 PDT 2002
>Originator:     Max Gotlib
>Release:        2.2.5-3.0
>Organization:
Urals State Academy Of Railway Transport
>Environment:
FreeBSD stoodg.cca.usart.ru 2.2.5-RELEASE FreeBSD 2.2.5-RELEASE #0: Mon Oct 27 19:19:56 ES 1997     root@stoodg.cca.usart.ru:/usr/src/sys/compile/STOODG  i386

>Description:
With full-length, 2.4G, ISA WaveLAN (Lucent Tech.) board, the wl0
interface cames UP but not RUNNING during ifconfig. With WLDEBUG turned
on, the following diagnostics appears:
wl0: entered wlioctl() 
wl0: entered wlinit()
wl0: enterd wlhwrst()           <- the trouble begins here
wl0: DCE_STATUS: 0x0, Correct NWID's: 0, Wrong NWID's: 0
THR_PRESET: 0xc0, SIGNAL_LVL: 64, SILENCE_LVL: 64
SIGNQUAL: 0x75, NETW_ID: fe:0, DES: 254  <- it's not mine NETWID, nor mine
                                            counterpart's, more - there are no DES
                                            encription chips installed !!! 
wl0: doing wlack()
wl0: entered wldiag()
wl0: wldiag() failed: status=0; inw=0; outw=e0a0
scb_status 8200
scb_command 0
scb_cbl 1608
cu_cmd 8007
   <- THE FINAL BOOH ! 
wl0: wlintr() called

Without WLDEBUG turned on, only
wl0: init(): trouble resetting board
appears.
>How-To-Repeat:
cd /sys/i386/conf
cp LINT WL; vi WL; config WL
cd ../../compile/WL
make depend; make; make install
shutdown -r now
turn the power off; inslatt the WaveLAN board; turn power on
ifconfig wl0 inet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX
:)
>Fix:
In the /sys/i386/include/if_wl_wavelan.h (sibce NtwID is 2-byte value):
- #define WLPSA_NWIDENABLE        0x24
- #define WLPSA_SECURITY          0x25
- #define WLPSA_DESKEY            0x26
+ #define WLPSA_NWIDENABLE        0x25
+ #define WLPSA_SECURITY          0x26
+ #define WLPSA_DESKEY            0x27
In file /sys/i386/isa/if_wl.c:
in function "int wlhwrst(int unit)" just at the beginning :
    /* clear reset command and set PIO#1 in autoincrement mode */
    sc->hacr = HACR_DEFAULT;
    CMD(unit);
+   wlinitmmc(unit);
#ifdef  WLDEBUG
    if (sc->wl_if.if_flags & IFF_DEBUG)
        wlmmcstat(unit);        /* Display MMC registers */
#endif  WLDEBUG
and in function "static int wlconfig(int unit)" just before the return:
    if(wlcmd(unit, "config()-address") == 0)
        return(0);
-    wlinitmmc(unit);
    return(1);
}       
So the jist is: during the attachment of the isa device procedure
the MMC unit is initialized (OK), then, during initialization of the
wl0 inteface (wlinit()) the full hardware reset is performed
and the first unit to be reinitialize is command unit, that (at least
in my board) refuses this attempt until MMC is initialized.
Fix was founded via "instruction by instruction" comparasion
of the command flow in FreeBSD and Linux WaveLAN drivers ...

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Thu Jun 25 00:30:40 PDT 1998 
State-Changed-Why:  
Please submit a context diff patch (diff -u or -c) 

awaiting committer 

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: kern/7044
Date: Thu, 25 Jun 1998 12:21:04 +0200

 From: Max Gotlib <max@cca.usart.ru>
 
 Hi Gurus!
 
 Here the diff is (i've used "diff -r -u sys sys.NEW"
 while being in the /usr/src directory and having
 2.2.6-RELEASE src tree in "sys" and patched
 one in "sys.NEW"):
 
 /*----------------------Start-----------------------------*/
 
 diff -u -r sys/i386/include/if_wl_wavelan.h sys.NEW/i386/include/if_wl_wavelan.h
 - --- sys/i386/include/if_wl_wavelan.h	Sat Mar  7 21:47:01 1998
 +++ sys.NEW/i386/include/if_wl_wavelan.h	Thu Jun 25 15:59:49 1998
 @@ -119,9 +119,9 @@
  #define WLPSA_QUALTHRESH	0x21	/* RF modem quality threshold preset */
  #define WLPSA_HWVERSION		0x22	/* hardware version indicator */
  #define WLPSA_NWID		0x23	/* network ID */
 - -#define WLPSA_NWIDENABLE	0x24	/* network ID enable */
 - -#define WLPSA_SECURITY		0x25	/* datalink security enable */
 - -#define WLPSA_DESKEY		0x26	/* datalink security DES key */
 +#define WLPSA_NWIDENABLE	0x25	/* network ID enable */
 +#define WLPSA_SECURITY		0x26	/* datalink security enable */
 +#define WLPSA_DESKEY		0x27	/* datalink security DES key */
  #define WLPSA_DBWIDTH		0x2f	/* databus width select */
  #define WLPSA_CALLCODE		0x30	/* call code (japan only) */
  #define WLPSA_CONFIGURED	0x3c	/* configuration status */
 diff -u -r sys/i386/isa/if_wl.c sys.NEW/i386/isa/if_wl.c
 - --- sys/i386/isa/if_wl.c	Tue Aug 26 04:34:25 1997
 +++ sys.NEW/i386/isa/if_wl.c	Thu Jun 25 16:01:08 1998
 @@ -733,6 +733,7 @@
      sc->hacr = HACR_DEFAULT;
      CMD(unit);
  
 +    wlinitmmc(unit);
  #ifdef	WLDEBUG
      if (sc->wl_if.if_flags & IFF_DEBUG)
  	wlmmcstat(unit);	/* Display MMC registers */
 @@ -2173,8 +2174,6 @@
  
      if(wlcmd(unit, "config()-address") == 0)
  	return(0);
 - -
 - -    wlinitmmc(unit);
  
      return(1);
  }
 
 /*---------------------The End--------------------------------*/
 
 Since I hava access only to my WaveLAN board, I'm not
 sure if this patch is usable with new (espacially
 new IEEE WaveLAN) boards, but since it was done upon
 Linux driver (that seems to be OK for all kinds)
 I hope it will be usable during 2.2.7 releasing...
 BTW, this patch was applied to the INRIA IPv6
 distribution as well as to ALTQ-1.0.1...
 Everything seems to be OK (our router works
 at least for one month unattended)...
 
 With best regards,
 Max.
 
 On Thu, 25 Jun 1998, Poul-Henning Kamp wrote:
 
 > Date: Thu, 25 Jun 1998 00:31:39 -0700 (PDT)
 > From: Poul-Henning Kamp <phk@FreeBSD.ORG>
 > To: max@cca.usart.ru, phk@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
 > Subject: Re: kern/7044
 > 
 > Old Synopsis: WaveLAN (2.4G, ISA, full-length board) cames UP but not RUNNING
 > New Synopsis: [PATCH] WaveLAN (2.4G, ISA, full-length board) cames UP but not RUNNING
 > 
 > State-Changed-From-To: open->suspended
 > State-Changed-By: phk
 > State-Changed-When: Thu Jun 25 00:30:40 PDT 1998
 > State-Changed-Why: 
 > Please submit a context diff patch (diff -u or -c)
 > 
 > awaiting committer
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 > 
 
 
 
 ------- End of Forwarded Message
 
State-Changed-From-To: suspended->feedback 
State-Changed-By: johan 
State-Changed-When: Thu May 9 19:32:07 PDT 2002 
State-Changed-Why:  
Alot has happened with PCCARD and WaveLAN support since 
you submitted this PR. 
Can you please verify that it works for you now 
in recent releases (e.g 4.5)? 



Responsible-Changed-From-To: freebsd-bugs->johan 
Responsible-Changed-By: johan 
Responsible-Changed-When: Thu May 9 19:32:07 PDT 2002 
Responsible-Changed-Why:  
So I get eventuall feedback and can close this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=7044 
State-Changed-From-To: feedback->closed 
State-Changed-By: johan 
State-Changed-When: Sat Jun 15 10:27:46 PDT 2002 
State-Changed-Why:  
feedback timedout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=7044 
>Unformatted:
