From owner-svn-src-head@FreeBSD.ORG Sat Mar 28 04:56:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47BC0106564A; Sat, 28 Mar 2009 04:56:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 359F78FC12; Sat, 28 Mar 2009 04:56:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2S4uujZ084957; Sat, 28 Mar 2009 04:56:56 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2S4uugP084954; Sat, 28 Mar 2009 04:56:56 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903280456.n2S4uugP084954@svn.freebsd.org> From: Warner Losh Date: Sat, 28 Mar 2009 04:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190483 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2009 04:56:57 -0000 Author: imp Date: Sat Mar 28 04:56:56 2009 New Revision: 190483 URL: http://svn.freebsd.org/changeset/base/190483 Log: It turns out that the Toshiba LANCT00A PC Card is really like the Toshiba PCETC ISA card, and even has the same board type code in the card ID (0x14). So, for this card, call ed_probe_WD80x3_generic after setting things up apropriately. This makes the card attach and kinda work (I'm seeing panics in sbdrop). Since history has shown that the WD80x3 probe routine is dangerous, only do it for this card. Also, disable the memory range check to make sure it is an valid ISA memory. I think that it is bogus, but I'm not 100% sure, for these cards. I removed probing for the WD80x3 in 2005 when I added support for the AX88x90 and DL100xx cards since none of my cards had ever matched it and PAO3 removed it and none of the cards in their database died. It is possible there are other quirks about this card too, since no other open source OS supports it, or even claims to support it. But it was a fun half hour hack... Modified: head/sys/dev/ed/if_ed_pccard.c head/sys/dev/ed/if_ed_wd80x3.c head/sys/dev/ed/if_edvar.h Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Sat Mar 28 04:00:46 2009 (r190482) +++ head/sys/dev/ed/if_ed_pccard.c Sat Mar 28 04:56:56 2009 (r190483) @@ -126,6 +126,7 @@ static const struct ed_product { #define NE2000DVF_DL100XX 0x0001 /* chip is D-Link DL10019/22 */ #define NE2000DVF_AX88X90 0x0002 /* chip is ASIX AX88[17]90 */ #define NE2000DVF_TC5299J 0x0004 /* chip is Tamarack TC5299J */ +#define NE2000DVF_TOSHIBA 0x0008 /* Toshiba DP83902A */ #define NE2000DVF_ENADDR 0x0100 /* Get MAC from attr mem */ #define NE2000DVF_ANYFUNC 0x0200 /* Allow any function type */ #define NE2000DVF_MODEM 0x0400 /* Has a modem/serial */ @@ -226,7 +227,7 @@ static const struct ed_product { { PCMCIA_CARD(TELECOMDEVICE, LM5LT), 0 }, { PCMCIA_CARD(TELECOMDEVICE, TCD_HPC100), NE2000DVF_AX88X90}, { PCMCIA_CARD(TJ, PTJ_LAN_T), 0 }, - { PCMCIA_CARD(TOSHIBA2, LANCT00A), NE2000DVF_ANYFUNC}, /* NG */ + { PCMCIA_CARD(TOSHIBA2, LANCT00A), NE2000DVF_ANYFUNC | NE2000DVF_TOSHIBA}, { PCMCIA_CARD(ZONET, ZEN), 0}, { { NULL } } }; @@ -434,9 +435,10 @@ ed_pccard_attach(device_t dev) u_char sum; u_char enaddr[ETHER_ADDR_LEN]; const struct ed_product *pp; - int error, i; + int error, i, flags; struct ed_softc *sc = device_get_softc(dev); u_long size; + static uint16_t *intr_vals[] = {NULL, NULL}; if ((pp = (const struct ed_product *) pccard_product_lookup(dev, (const struct pccard_product *) ed_pccard_products, @@ -474,6 +476,7 @@ ed_pccard_attach(device_t dev) sc->asic_offset = ED_NOVELL_ASIC_OFFSET; sc->nic_offset = ED_NOVELL_NIC_OFFSET; error = ENXIO; + flags = device_get_flags(dev); if (error != 0) error = ed_pccard_dl100xx(dev, pp); if (error != 0) @@ -481,7 +484,15 @@ ed_pccard_attach(device_t dev) if (error != 0) error = ed_pccard_tc5299j(dev, pp); if (error != 0) - error = ed_probe_Novell_generic(dev, device_get_flags(dev)); + error = ed_probe_Novell_generic(dev, flags); + if (error != 0) { + if (pp->flags & NE2000DVF_TOSHIBA) + flags |= ED_FLAGS_TOSH_ETHER; + flags |= ED_FLAGS_PCCARD; + sc->asic_offset = ED_WD_ASIC_OFFSET; + sc->nic_offset = ED_WD_NIC_OFFSET; + error = ed_probe_WD80x3_generic(dev, flags, intr_vals); + } if (error) goto bad; @@ -502,7 +513,9 @@ ed_pccard_attach(device_t dev) * default value. In all fails, we should fail the attach, * but don't right now. */ - if (sc->chip_type == ED_CHIP_TYPE_DP8390) { + for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) + sum |= sc->enaddr[i]; + if (sc->chip_type == ED_CHIP_TYPE_DP8390 && sum == 0) { pccard_get_ether(dev, enaddr); if (bootverbose) device_printf(dev, "CIS MAC %6D\n", enaddr, ":"); Modified: head/sys/dev/ed/if_ed_wd80x3.c ============================================================================== --- head/sys/dev/ed/if_ed_wd80x3.c Sat Mar 28 04:00:46 2009 (r190482) +++ head/sys/dev/ed/if_ed_wd80x3.c Sat Mar 28 04:56:56 2009 (r190483) @@ -119,7 +119,6 @@ ed_probe_WD80x3_generic(device_t dev, in sum += ed_asic_inb(sc, ED_WD_PROM + i); if (sum != totalsum) { - /* * Checksum is invalid. This often happens with cheap WD8003E * clones. In this case, the checksum byte (the eighth byte) @@ -268,9 +267,11 @@ ed_probe_WD80x3_generic(device_t dev, in printf("%x -> %x\n", i, ed_asic_inb(sc, i)); #endif pmem = rman_get_start(sc->mem_res); - error = ed_isa_mem_ok(dev, pmem, memsize); - if (error) - return (error); + if (!(flags & ED_FLAGS_PCCARD)) { + error = ed_isa_mem_ok(dev, pmem, memsize); + if (error) + return (error); + } /* * (note that if the user specifies both of the following flags that Modified: head/sys/dev/ed/if_edvar.h ============================================================================== --- head/sys/dev/ed/if_edvar.h Sat Mar 28 04:00:46 2009 (r190482) +++ head/sys/dev/ed/if_edvar.h Sat Mar 28 04:56:56 2009 (r190483) @@ -267,6 +267,11 @@ extern devclass_t ed_devclass; #define ED_FLAGS_FORCE_PIO 0x0010 /* + * This forces a PC Card, and disables ISA memory range checks + */ +#define ED_FLAGS_PCCARD 0x0020 + +/* * These are flags describing the chip type. */ #define ED_FLAGS_TOSH_ETHER 0x10000