From owner-freebsd-alpha Tue Jan 9 9:50:28 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 96C9437B6D4 for ; Tue, 9 Jan 2001 09:50:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f09Ho2V05557; Tue, 9 Jan 2001 09:50:02 -0800 (PST) (envelope-from gnats) Date: Tue, 9 Jan 2001 09:50:02 -0800 (PST) Message-Id: <200101091750.f09Ho2V05557@freefall.freebsd.org> To: freebsd-alpha@freebsd.org Cc: From: Matthew Jacob Subject: Re: alpha/24177: Patch for fxp on Alpha Reply-To: Matthew Jacob Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR alpha/24177; it has been noted by GNATS. From: Matthew Jacob To: dutchman@tccn.cs.kun.nl Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: alpha/24177: Patch for fxp on Alpha Date: Tue, 9 Jan 2001 09:41:02 -0800 (PST) You don't say which specific platform this is. It's unusual that I/O space works better than Memory space. It's also true that various flavors of EEPRO are known to work. I sure wish I knew whether the maintainer for this card s active or not on this. I think your patches are in the right direction, but aren't really quite what we should be looking for- they could be a lot tighter and should be runtime as opposed to compile time settable- see isp_pci.c for an example (not the best, granted) of this. I sure would like to know which platform this was. -matt > > >Number: 24177 > >Category: alpha > >Synopsis: Workaround patch for fxp on Alpha > >Confidential: no > >Severity: non-critical > >Priority: medium > >Responsible: freebsd-alpha > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: change-request > >Submitter-Id: current-users > >Arrival-Date: Tue Jan 09 02:10:01 PST 2001 > >Closed-Date: > >Last-Modified: > >Originator: Kees Jan Koster > >Release: FreeBSD 4.2-RC1 alpha > >Organization: > >Environment: > > FreeBSD slugout.kjkoster.org 4.2-RC1 FreeBSD 4.2-RC1 #1: Sat Jan 6 16:34:31 CET 2001 root@:/usr/src/sys/compile/SLUGOUT alpha > > >Description: > > The current fxp driver does not see some of the cards. In particular it does > not see mine (Asus L101 card). It probes af follows: > > Jan 6 12:06:08 /kernel: fxp0: port 0x10100-0x1011f mem 0x81100000-0x811fffff,0x88000000-0x88000fff irq 5 at device 8.0 on pci0 > Jan 6 12:06:08 /kernel: fxp0: interrupting at ISA irq 5 > Jan 6 12:06:08 /kernel: fxp0: Ethernet address ff:ff:ff:ff:ff:ff, 10Mbps > > After the workaround that someone suggested (I plucked it off freebsd-alpha a > while ago) the card probes as follows: > > Jan 6 19:39:04 /kernel: fxp0: port 0x10100-0x1011f mem 0x81100000-0x811fffff,0x88000000-0x88000fff irq 5 at device 8.0 on pci0 > Jan 6 19:39:04 /kernel: fxp0: using i/o space access > Jan 6 19:39:04 /kernel: fxp0: interrupting at ISA irq 5 > Jan 6 19:39:04 /kernel: fxp0: Ethernet address 00:e0:18:00:2b:98 > > I realize that the workaround is not a complete fix. However, the current state > of affairs means that I cannot install FreeBSD/alpha without special tricks. I > was hoping that this workaround might be put into the kernel anyway, with > proper warning comments. > > >How-To-Repeat: > > Use an fxp-driven card in an Alpha. > > >Fix: > > Index: if_fxp.c > =================================================================== > RCS file: /home/ncvs/src/sys/pci/if_fxp.c,v > retrieving revision 1.77.2.6 > diff -u -r1.77.2.6 if_fxp.c > --- if_fxp.c 2000/07/19 14:36:36 1.77.2.6 > +++ if_fxp.c 2000/07/25 18:53:08 > @@ -515,6 +515,8 @@ > return ENXIO; > } > > +#define FXP_PREFER_IOSPACE > + > static int > fxp_attach(device_t dev) > { > @@ -533,12 +535,31 @@ > * Enable bus mastering. > */ > val = pci_read_config(dev, PCIR_COMMAND, 2); > +#ifdef FXP_PREFER_IOSPACE /*XXX*/ > + val |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN); > +#else > val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); > +#endif > pci_write_config(dev, PCIR_COMMAND, val, 2); > > /* > * Map control/status registers. > */ > +#ifdef FXP_PREFER_IOSPACE /*XXX*/ > + device_printf(dev, "using i/o space access\n"); > + rid = FXP_PCI_IOBA; > + sc->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, > + 0, ~0, 1, RF_ACTIVE); > + if (!sc->io) { > + device_printf(dev, "could not map memory\n"); > + error = ENXIO; > + goto fail; > + } > + > + sc->sc_st = rman_get_bustag(sc->io); > + sc->sc_sh = rman_get_bushandle(sc->io); > + > +#else > rid = FXP_PCI_MMBA; > sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, > 0, ~0, 1, RF_ACTIVE); > @@ -550,7 +571,7 @@ > > sc->sc_st = rman_get_bustag(sc->mem); > sc->sc_sh = rman_get_bushandle(sc->mem); > - > +#endif > /* > * Allocate our interrupt. > */ > @@ -575,7 +596,11 @@ > /* Failed! */ > bus_teardown_intr(dev, sc->irq, sc->ih); > bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); > +#ifdef FXP_PREFER_IOSPACE /* XXX */ > bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem); > +#else > + bus_release_resource(dev, SYS_RES_IOPORT, FXP_PCI_IOBA, sc->io); > +#endif > error = ENXIO; > goto fail; > } > @@ -639,8 +664,11 @@ > */ > bus_teardown_intr(dev, sc->irq, sc->ih); > bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); > +#ifdef FXP_PREFER_IOSPACE /* XXX */ > + bus_release_resource(dev, SYS_RES_IOPORT, FXP_PCI_IOBA, sc->io); > +#else > bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem); > - > +#endif > /* > * Free all the receive buffers. > */ > Index: if_fxpvar.h > =================================================================== > RCS file: /home/ncvs/src/sys/pci/if_fxpvar.h,v > retrieving revision 1.9.2.1 > diff -u -r1.9.2.1 if_fxpvar.h > --- if_fxpvar.h 2000/03/29 02:02:39 1.9.2.1 > +++ if_fxpvar.h 2000/07/25 18:28:23 > @@ -46,6 +46,7 @@ > #else > struct arpcom arpcom; /* per-interface network data */ > struct resource *mem; /* resource descriptor for registers */ > + struct resource *io; /* resource descriptor for registers */ > struct resource *irq; /* resource descriptor for interrupt */ > void *ih; /* interrupt handler cookie */ > #endif /* __NetBSD__ */ > > > >Release-Note: > >Audit-Trail: > >Unformatted: > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-alpha" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message