From owner-freebsd-bugs Wed May 5 1:40: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id CA9EE1583F for ; Wed, 5 May 1999 01:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA96042; Wed, 5 May 1999 01:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 304E215301; Wed, 5 May 1999 01:35:08 -0700 (PDT) Message-Id: <19990505083508.304E215301@hub.freebsd.org> Date: Wed, 5 May 1999 01:35:08 -0700 (PDT) From: max@cca.usart.ru To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: kern/11507: CS89XX (i386/isa/if_cs.c) fails to properly initialize CS8920-based PnP NIC Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 11507 >Category: kern >Synopsis: CS89XX (i386/isa/if_cs.c) fails to properly initialize CS8920-based PnP NIC >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 5 01:40:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Max Gotlib >Release: GreeBSD-CURRENT (05.02.99) (affected starting with 04.16.99) >Organization: The Urals State Academy of Railway Transport >Environment: FreeBSD unxsrv.ks.usart.ru 4.0-CURRENT FreeBSD 4.0-CURRENT #2: Tue Mar 4 10:22:25 ES 1999 root@unxsrv.ks.usart.ru:/usr/src/sys/compile/UNXSRV i386 >Description: See PR kern/11462 for the primary problem description. The proposed (former) patch was built against CURRENT (04.16.99( source tree state, but then there were a number of changes, conserning PnP stuff, so another "bug" was introdused. The simthoms are the following: while booting kernel it correctly locates PnP CS9820-based NIC, but in case of EEPROM driver configuration block checksum mismatch (I've got ten IBM 300GLs with such a "feature"), driver fails to assing media for the NIC and panics. More, since the driver "forgets" to initialize the "id_alive" if "isa_device" structure, PnP code simply throws the driver away during attachment procedure. More, because of the changes in the PnP code, "old" sceme (when it was supposed that "id_unit" could be equil to "id_id") used in PnP interrupt handler became broken and driver gets no IRQs (constant OACTIVE interface state). >How-To-Repeat: Just try to boot :) I've performed tests in IBM 300GL with embedded CS8920M-based NIC >Fix: The solution is the following: simply ignore the EEPROM checksum mismatch (controlled by the oppropriate #define) and introduce oppropriate fixes in the driver's code (for "id_alive" and "id_id" typos). Here the patch (includes proposed in kern/11462 one) for /sys/i386/isa/if_cs.c: ========================= --- if_cs.c.ORIG Mon Apr 19 20:19:57 1999 +++ if_cs.c Wed May 5 13:13:30 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 { @@ -1391,6 +1411,6 @@ printf("failed to pnp card parametars\n"); } } - csintr_pnp_add(sc, dev->id_unit); + csintr_pnp_add(sc, dev->id_id); } #endif /* NPNP */ ========================= And just the same in uue: ========================= begin 644 if_cs.c.diff M+2TM(&EF7V-S+F,N3U))1PE-;VX@07!R(#$Y(#(P.C$Y.C4W(#$Y.3D**RLK M(&EF7V-S+F,)5V5D($UA>2`@-2`Q,SHQ,SHS,"`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"`B+"AU M;G-I9VYE9"!C:&%R*6)U9F9E7!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"@FF5R;RAS8RP@#!?<')O8F4HPH@"2`@("!FRelease-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message