Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 1998 12:37:54 +0200 (CEST)
From:      Wilko Bulte <wilko@yedi.iaf.nl>
To:        wpaul@skynet.ctr.columbia.edu (Bill Paul)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: pci memory mapping
Message-ID:  <199809031037.MAA00970@yedi.iaf.nl>
In-Reply-To: <199809022156.RAA09174@skynet.ctr.columbia.edu> from Bill Paul at "Sep 2, 98 05:56:21 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809031037.MAA00970>