From owner-freebsd-hackers Tue Jul 23 22:54:14 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id WAA18991 for hackers-outgoing; Tue, 23 Jul 1996 22:54:14 -0700 (PDT) Received: from research.gate.nec.co.jp (research.gate.nec.co.jp [202.32.8.49]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id WAA18985 for ; Tue, 23 Jul 1996 22:54:11 -0700 (PDT) Received: from sbl-gw.sbl.cl.nec.co.jp by research.gate.nec.co.jp (8.7.5+2.6Wbeta6/950912) with ESMTP id OAA14625; Wed, 24 Jul 1996 14:54:04 +0900 (JST) Received: from sirius.sbl.cl.nec.co.jp by sbl-gw.sbl.cl.nec.co.jp (8.7.5+2.6Wbeta6/3.3W6) with ESMTP id OAA07644; Wed, 24 Jul 1996 14:54:03 +0900 (JST) X-Authentication-Warning: sbl-gw.sbl.cl.nec.co.jp: Host nao@sirius [133.207.68.90] claimed to be sirius.sbl.cl.nec.co.jp Received: by sirius.sbl.cl.nec.co.jp (8.7.5+2.6Wbeta6/3.3W6) with UUCP id OAA24904; Wed, 24 Jul 1996 14:54:02 +0900 (JST) Date: Wed, 24 Jul 1996 14:54:02 +0900 (JST) Message-Id: <199607240554.OAA24904@sirius.sbl.cl.nec.co.jp> To: FreeBSD-hackers@freebsd.org From: HAMADA Naoki Subject: ep bug fix Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi. I fixed two bugs of the ep driver. First, the transmit complete interrupt enabling patch which appeared in revision 1.50 makes the ep driver out of order, so I got rid of it. Second, when the adapter uses IRQ 9, the ep driver set the IRQ register of the adapter to IRQ 2. This disables the interrupt generation. From "Ethelink III Parallel Tasking ISA, EISA, Micro Channel, and PCMCIA Adapter Drivers Technical Reference": IRQ: Interrupt Request select (values given in decimal) {3,5,7,9,10,11,12,15} = Enable corresponding IRQ line driver. {0,1,2,4,6,8,13,14} = Disable all IRQ line drivers. I made the ep driver sets the correct IRQ number. Third, not a bug fix. The problem with 'AUTO SELECT' feature is quite frequently asked me, so I made the driver to warn when it finds the 'AUTO SELECT' bit of 3C509B and 3C589[BC] is set. With the following patch, my 3C509B ISA adapter and my 3C589C PCMCIA adapter works greatly. -nao --- if_ep.c- Wed Jul 24 11:26:52 1996 +++ if_ep.c Wed Jul 24 13:23:54 1996 @@ -274,6 +274,7 @@ struct isa_device *is = &dp->isahd; struct ep_softc *sc = ep_softc[is->id_unit]; u_short config; + int acf; sc->ep_connectors = 0; config = inw(IS_BASE + EP_W0_CONFIG_CTRL); @@ -285,7 +286,12 @@ } if (!(sc->ep_connectors & 7)) printf("no connectors!"); - sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS; + acf = inw(BASE + EP_W0_ADDRESS_CFG); + if (acf & ACF_AUTO_SELECT) { + printf("ep%d: WARNING: This driver is not capable of AUTO SELECT.\n", + is->id_unit); + } + sc->ep_connector = acf >> ACF_CONNECTOR_BITS; /* ROM size = 0, ROM base = 0 */ /* For now, ignore AUTO SELECT feature of 3C589B and later. */ @@ -598,6 +604,7 @@ struct ep_softc *sc = ep_softc[is->id_unit]; u_short config; int irq; + int acf; sc->ep_connectors = 0; config = inw(IS_BASE + EP_W0_CONFIG_CTRL); @@ -612,7 +619,12 @@ } if (!(sc->ep_connectors & 7)) printf("no connectors!"); - sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS; + acf = inw(BASE + EP_W0_ADDRESS_CFG); + if (acf & ACF_AUTO_SELECT) { + printf("ep%d: WARNING: This driver is not capable of auto select.\n", + is->id_unit); + } + sc->ep_connector = acf >> ACF_CONNECTOR_BITS; /* * Write IRQ value to board */ @@ -624,8 +636,8 @@ } GO_WINDOW(0); - if(irq == 9) - irq = 2; + if(irq == 2) + irq = 9; SET_IRQ(BASE, irq); ep_attach(sc); @@ -964,7 +976,7 @@ } IF_DEQUEUE(&ifp->if_snd, m); - outw(BASE + EP_W1_TX_PIO_WR_1, len | 0x8000); /* XXX */ + outw(BASE + EP_W1_TX_PIO_WR_1, len); outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */ /* compute the Tx start threshold for this packet */ --- if_epreg.h- Wed Jul 24 11:27:23 1996 +++ if_epreg.h Wed Jul 24 11:32:24 1996 @@ -364,6 +364,7 @@ #define ACF_CONNECTOR_UTP 0 #define ACF_CONNECTOR_AUI 1 #define ACF_CONNECTOR_BNC 3 +#define ACF_AUTO_SELECT 0x0080 /* Resource configuration register. * Window 0/Port 08