Date: Thu, 3 Sep 1998 12:49:56 -0700 From: Ulf Zimmermann <ulf@Alameda.net> To: Wilko Bulte <wilko@yedi.iaf.nl>, Bill Paul <wpaul@skynet.ctr.columbia.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: pci memory mapping Message-ID: <19980903124956.D198@Alameda.net> In-Reply-To: <199809031037.MAA00970@yedi.iaf.nl>; from Wilko Bulte on Thu, Sep 03, 1998 at 12:37:54PM %2B0200 References: <199809022156.RAA09174@skynet.ctr.columbia.edu> <199809031037.MAA00970@yedi.iaf.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
Take a look at the pseudo code at the end of the manual. It says
use detection method 1, if fails, use 2.
But this manual is only for firmware 4.x
On Thu, Sep 03, 1998 at 12:37:54PM +0200, Wilko Bulte wrote:
> As Bill Paul wrote...
> > Of all the gin joints in all the towns in all the world, Wilko Bulte had
> > to walk into mine and say:
> >
> > > > > For some reason the followin code in attach() fails:
> > > > >
> > > > > if (!pci_map_mem(config_id, PCI_MAP_REG_START, &mp->vbase,
> > > > > &mp->pbase)) {
> > > > > printf("myx%d: couldn't map memory\n", unit);
> > > > > goto fail;
> > > > > }
> >
> > Okay, Ulf has sent me a copy of his source code so I could look at it.
> >
> > This doesn't seem quite right somehow. The constant PCI_MAP_REG_START
> > is #define in /sys/pci/pcireg.h:
> >
> > #define PCI_MAP_REG_START 0x10
> >
> > On the two devices that I've fiddled with so far, namely the ThunderLAN
> > chip and the 3Com chip, 0x10 has always been the I/O base address, i.e.
> > the address used for inb/outb PIO access, and 0x14 is the memory base
> > address used for memory mapped access. My impression is that these two
> > registers are standar, so it's unlikely that their meanings would be
> > reversed unless the chip designer is up to no good.
> >
> > In any case, I would try to use 0x14 instead of PCI_MAP_REG_START and
> > see if that makes a difference.
>
> It makes a difference allright: I now get a trap12 panic ;-) No 'cannot
> map mem' anymore.
>
> Suppose this is a strong indication of the kernel telling me
> "you get that *manual* before experimenting" 8)
>
> > > Right.... manual...... I'm still trying to convince Mylex that handing me
> > > a copy of the DAC960 V2.xx programming manual will not wipe all life from
> > > Planet Earth. Sigh. Sample code from Linux and Ulf's driver are based on
> > > firmware V4.xx which is different in it's interface to the OS.
> >
> > Do not read sample Linux code without a barf bag nearby.
>
> This code is not bad as far as I can tell.
>
> > > > If the bit doesn't come on after you write to the command register, it
> > > > probably means the device doesn't actually support memory mapped access.
> > >
> > > Well, the bit comes on because the printf() is not triggered. But still I
> > > get the 'cannot map memory' from the code sample at the top of this mail.
> >
> > Then I'm probably right about the register that you need to supply
> > to pci_map_mep(). This is just idle speculation, but maybe the other
> > cards only support memory mapped mode, and the I/O base and mem base
> > registers have the same values in them.
>
> Let's hope I can get programming docs somehow.
>
> Wilko
> _ ______________________________________________________________________
> | / o / / _ Bulte email: wilko@yedi.iaf.nl
> |/|/ / / /( (_) Arnhem, The Netherlands WWW : http://www.tcja.nl
> ______________________________________________ Powered by FreeBSD __________
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
--
Regards, Ulf.
---------------------------------------------------------------------
Ulf Zimmermann, 1525 Pacific Ave., Alameda, CA-94501, #: 510-769-2936
Alameda Networks, Inc. | http://www.Alameda.net | Fax#: 510-521-5073
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980903124956.D198>
