From nobody@FreeBSD.ORG Mon May  3 01:37:42 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 527F114C40; Mon,  3 May 1999 01:37:42 -0700 (PDT)
Message-Id: <19990503083742.527F114C40@hub.freebsd.org>
Date: Mon,  3 May 1999 01:37:42 -0700 (PDT)
From: max@cca.usart.ru
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: CS network interface driver (for CS89XX based NICs) fils to attach PnP devices
X-Send-Pr-Version: www-1.0

>Number:         11462
>Category:       kern
>Synopsis:       CS network interface driver (for CS89XX based NICs) fils to attach PnP devices
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May  3 01:40:01 PDT 1999
>Closed-Date:    Mon Nov 03 18:40:20 MST 2003
>Last-Modified:  Mon Nov 03 18:40:20 MST 2003
>Originator:     Max Gotlib
>Release:        affects 2.2.5 ... current (05.02.99)
>Organization:
The Urals State Academy of Railway Transport
>Environment:
FreeBSD relay.usart.ru 4.0-CURRENT FreeBSD 4.0-CURRNT #0: Mon May 02 17:03:16 ESS 1999     root@relay.usart.ru:/usr/src/sys/compile/RELAY  i386
>Description:
Majority of CS8920 based NICs are implemented as PnP devices (the "solid"
initilization is done by the driver properly). During PnP card initialization,
the driver correctly locates the card, assignes the parameters, attaches the
ethernet interface, attaches itself to the BPF, but fails to attach itself
to the list of alive PnP devices (it "forgets" to initialize the id_alive
field of struct isa_device, leaving it filled with zeroes). Really it seems to
be a typo in the driver code...
>How-To-Repeat:
Just bye and try :)
>Fix:
Here is a small patch (by the way, it fixes another problem, i've faced with:
i've got a series (10) IBM 300GLs and the cs driver complains (and more
it seems to be true) about EEPROM checksum mismatch in the driver configuration
block on every of these boxes):

--- if_cs.c.ORIG        Thu Apr 22 14:00:46 1999
+++ if_cs.c     Thu Apr 22 15:27:29 1999
@@ -34,6 +34,8 @@
  */
 
 /* #define      CS_DEBUG */
+#define  IGNORE_CHKSUM_MISMATCH
+
 #include "cs.h"
 #include "bpfilter.h"
 
@@ -165,7 +167,7 @@
 
 #ifdef CS_DEBUG
                printf("%02x %02x ",(unsigned char)buffer[i],
-                                       (unsigned char)buffer[i+1]);
+                                       (unsigned char)(buffer[i] >> 8));
 #endif
        }
 
@@ -186,7 +188,12 @@
        cksum &= 0xffff;
        if (cksum==0)
                return 0;
+#ifdef IGNORE_CHKSUM_MISMATCH
+       printf ("cs: checksum mismatched, ignoring\n");
+       return (0);
+#else
        return -1;
+#endif
 }
 
 static int
@@ -599,6 +606,18 @@
 
                 if (sc->adapter_cnf & A_CNF_MEDIA)
                         ifmedia_add(&sc->media, IFM_ETHER|IFM_AUTO, 0, NULL);
+               else {
+                       printf (CS_NAME"%d: adapter reports no media"
+                               ", assuming 10baseT\n", unit);
+                       sc->adapter_cnf |= A_CNF_10B_T;
+                       ifmedia_add(&sc->media, IFM_ETHER|IFM_10_T, 0, NULL);
+                       if (sc->chip_type != CS8900) {
+                               ifmedia_add(&sc->media,
+                                       IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
+                               ifmedia_add(&sc->media,
+                                       IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
+                       }
+               }
 
                 /* Set default media from EEPROM */
                 switch (sc->adapter_cnf & A_CNF_MEDIA_TYPE) {
@@ -1307,11 +1326,11 @@
 {
     struct csintr_list *intr;
 
-    for (intr=csintr_head; intr; intr=intr->next) {
-           if (intr->unit == unit)
+    for (intr=csintr_head; intr; intr=intr->next)
+           if (intr->unit == unit) {
                csintr_sc(intr->sc, unit);
                break;
-       }
+           }
 }
 
 static char *
@@ -1378,7 +1397,8 @@
     if (!sc) return;
 
     bzero(sc, sizeof *sc);
-    if (cs_cs89x0_probe(sc, &irq, &drq, iobase, unit, flags) == 0
+    if ((dev->id_alive = 
+        cs_cs89x0_probe(sc, &irq, &drq, iobase, unit, flags)) == 0
        || cs_attach(sc, unit, flags) == 0) {
            free(sc, M_DEVBUF);
     } else {

-------------------
and to be sure the patch is readable, here is the uuencoded one:

begin 644 http://relay.usart.ru/pub/unix/os/FreeBSD/patches/if_cs.c.diff
M+2TM(&EF7V-S+F,N3U))1PE4:'4@07!R(#(R(#$T.C`P.C0V(#$Y.3D**RLK
M(&EF7V-S+F,)5&AU($%P<B`R,B`Q-3HR-SHR.2`Q.3DY"D!`("TS-"PV("LS
M-"PX($!`"B`@*B\*(`H@+RH@(V1E9FEN90D@0U-?1$5"54<@*B\**R-D969I
M;F4@($E'3D]215]#2$M354U?34E334%40T@**PH@(VEN8VQU9&4@(F-S+F@B
M"B`C:6YC;'5D92`B8G!F:6QT97(N:"(*(`I`0"`M,38U+#<@*S$V-RPW($!`
M"B`*("-I9F1E9B!#4U]$14)51PH@"0EP<FEN=&8H(B4P,G@@)3`R>"`B+"AU
M;G-I9VYE9"!C:&%R*6)U9F9E<EMI72P*+0D)"0D)*'5N<VEG;F5D(&-H87(I
M8G5F9F5R6VDK,5TI.PHK"0D)"0DH=6YS:6=N960@8VAA<BDH8G5F9F5R6VE=
M(#X^(#@I*3L*("-E;F1I9@H@"7T*(`I`0"`M,3@V+#<@*S$X."PQ,B!`0`H@
M"6-K<W5M("8](#!X9F9F9CL*(`EI9B`H8VMS=6T]/3`I"B`)"7)E='5R;B`P
M.PHK(VEF9&5F($E'3D]215]#2$M354U?34E334%40T@**PEP<FEN=&8@*")C
M<SH@8VAE8VMS=6T@;6ES;6%T8VAE9"P@:6=N;W)I;F=<;B(I.PHK"7)E='5R
M;B`H,"D["BLC96QS90H@"7)E='5R;B`M,3L**R-E;F1I9@H@?0H@"B!S=&%T
M:6,@:6YT"D!`("TU.3DL-B`K-C`V+#$X($!`"B`*("`@("`@("`@("`@("`@
M("!I9B`H<V,M/F%D87!T97)?8VYF("8@05]#3D9?345$24$I"B`@("`@("`@
M("`@("`@("`@("`@("`@("!I9FUE9&EA7V%D9"@F<V,M/FUE9&EA+"!)1DU?
M151(15)\249-7T%55$\L(#`L($Y53$PI.PHK"0EE;'-E('L**PD)"7!R:6YT
M9B`H0U-?3D%-12(E9#H@861A<'1E<B!R97!O<G1S(&YO(&UE9&EA(@HK"0D)
M"2(L(&%S<W5M:6YG(#$P8F%S951<;B(L('5N:70I.PHK"0D)<V,M/F%D87!T
M97)?8VYF('P]($%?0TY&7S$P0E]4.PHK"0D):69M961I85]A9&0H)G-C+3YM
M961I82P@249-7T542$52?$E&35\Q,%]4+"`P+"!.54Q,*3L**PD)"6EF("AS
M8RT^8VAI<%]T>7!E("$]($-3.#DP,"D@>PHK"0D)"6EF;65D:6%?861D*"9S
M8RT^;65D:6$L"BL)"0D)"4E&35]%5$A%4GQ)1DU?,3!?5'Q)1DU?1D18+"`P
M+"!.54Q,*3L**PD)"0EI9FUE9&EA7V%D9"@F<V,M/FUE9&EA+`HK"0D)"0E)
M1DU?151(15)\249-7S$P7U1\249-7TA$6"P@,"P@3E5,3"D["BL)"0E]"BL)
M"7T*(`H@("`@("`@("`@("`@("`@("\J(%-E="!D969A=6QT(&UE9&EA(&9R
M;VT@14504D]-("HO"B`@("`@("`@("`@("`@("`@<W=I=&-H("AS8RT^861A
M<'1E<E]C;F8@)B!!7T-.1E]-141)05]465!%*2!["D!`("TQ,S`W+#$Q("LQ
M,S(V+#$Q($!`"B!["B`@("`@<W1R=6-T(&-S:6YT<E]L:7-T("II;G1R.PH@
M"BT@("`@9F]R("AI;G1R/6-S:6YT<E]H96%D.R!I;G1R.R!I;G1R/6EN='(M
M/FYE>'0I('L*+0D@("`@:68@*&EN='(M/G5N:70@/3T@=6YI="D**R`@("!F
M;W(@*&EN='(]8W-I;G1R7VAE860[(&EN='([(&EN='(]:6YT<BT^;F5X="D*
M*PD@("`@:68@*&EN='(M/G5N:70@/3T@=6YI="D@>PH@"0EC<VEN=')?<V,H
M:6YT<BT^<V,L('5N:70I.PH@"0EB<F5A:SL*+0E]"BL)("`@('T*('T*(`H@
M<W1A=&EC(&-H87(@*@I`0"`M,3,W."PW("LQ,SDW+#@@0$`*("`@("!I9B`H
M(7-C*2!R971U<FX["B`*("`@("!B>F5R;RAS8RP@<VEZ96]F("IS8RD["BT@
M("`@:68@*&-S7V-S.#EX,%]P<F]B92AS8RP@)FER<2P@)F1R<2P@:6]B87-E
M+"!U;FET+"!F;&%G<RD@/3T@,`HK("`@(&EF("@H9&5V+3YI9%]A;&EV92`]
M(`HK"2!C<U]C<S@Y>#!?<')O8F4H<V,L("9I<G$L("9D<G$L(&EO8F%S92P@
M=6YI="P@9FQA9W,I*2`]/2`P"B`)?'P@8W-?871T86-H*'-C+"!U;FET+"!F
M;&%G<RD@/3T@,"D@>PH@"2`@("!F<F5E*'-C+"!-7T1%5D)51BD["B`@("`@
)?2!E;'-E('L*
`
end


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: imp 
Responsible-Changed-When: Fri Jun 1 12:48:07 MDT 2001 
Responsible-Changed-Why:  
I'm the nominal maintainer of cs these days. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=11462 
State-Changed-From-To: open->closed 
State-Changed-By: imp 
State-Changed-When: Mon Nov 3 18:38:28 MST 2003 
State-Changed-Why:  
These patches have been integrated into the current tree.  id_alive is 
no longer relevant, but the isa attachment does the right thing wrt 
plug and play. 


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