From owner-freebsd-bugs Mon May 3 1:40:11 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 1B13015659 for ; Mon, 3 May 1999 01:40:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA17527; Mon, 3 May 1999 01:40:02 -0700 (PDT) (envelope-from gnats@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 To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: kern/11462: CS network interface driver (for CS89XX based NICs) fils to attach PnP devices Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 3 01:40:01 PDT 1999 >Closed-Date: >Last-Modified: >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+"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