Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 1998 17:56:21 -0400 (EDT)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        wilko@yedi.iaf.nl (Wilko Bulte)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: pci memory mapping
Message-ID:  <199809022156.RAA09174@skynet.ctr.columbia.edu>
In-Reply-To: <199809021734.TAA10258@yedi.iaf.nl> from "Wilko Bulte" at Sep 2, 98 07:34:00 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the towns in all the world, Wilko Bulte had 
to walk into mine and say:
 
> > > I'm trying to get a Mylex DAC960PD to work with a driver skeleton Ulf
> > > wrote. As I have a different Mylex board than Ulf (a PD iso a PG) I need
> > > to make some changes.
> > > 
> > > 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.

> > First of all, bear in mind that not every PCI device supports memory
> > mapping of its registers. To find out if yours does or not, you need
> > to check the device's manual or datasheet.
> 
> 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.

> > 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.

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness"
=============================================================================

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?199809022156.RAA09174>