Memory mapping PCI memory region to user space

David Hawkins dwh at ovro.caltech.edu
Tue Mar 28 15:55:21 EST 2006


Phil Nitschke wrote:
> On Mon, 2006-03-27 at 08:05 -0800, David Hawkins wrote:
> 
>>Try building an insmodding the pci_io driver I posted, it'll pick
>>up the two BAR regions and allow you to access them, and you can
>>add more debugging comments to that code fairly easily.
> 
> 
>>http://www.ovro.caltech.edu/~dwh/pci_io.tar.gz
> 
> 
> Hi Dave,
> 
> I tried your program briefly, but (I guess) since I'm not using udev,
> the program failed rather early, and I didn't persist for too long.
> I've attached a log of the session below.  
> 
> (I used it on a commercial VME carrier board with a PmPPC7448 PMC module
> and a PMC FPDP module, and a recent 2.6.16 kernel.org kernel built for
> PPC. I used the ELDK4 NFS filesystem.)
> 

Sorry, I should have metioned. If udev is not installed then
the scripts that create the /dev nodes do not exist, so
you need to create them manually.

I don't see any probe calls in the driver log, so I'm not sure
that the driver has been told to register for that device ID.
You can either add your device ID to the pci IDs list in the
driver, or echo to a sysfs node ... let me see ... yeah

echo "129a:dd11" > /sys/bus/pci/drivers/pci_io/new_id

should do the trick.

Then you'll see probe callbacks and comments about
what major and start minor is assigned to each device.

Then create your dev nodes, eg major=254, minor=0, count=3

mknod /dev/pci_00:02.0_0 c 254 0
mknod /dev/pci_00:02.0_1 c 254 1
mknod /dev/pci_00:02.0_2 c 254 2

which is what you were trying already.

Give that a shot.

Dave












More information about the Linuxppc-embedded mailing list