Re: PCI Memory Mapping

From: James Simmons (jsimmons@acsu.buffalo.edu)
Date: Tue Aug 08 2000 - 19:07:11 EST


> James Simmons writes:
> > Take a look fb_mmap in drivers/video/fbmem.c in a for example of using
> > mmap for various platforms.
>
> No luck using that either.
>
> I think I'm going to be driven insane from this if I don't get it soon! :)

What kind of harware is this?

> What's odd is that accessing the earlier data in the map is more than
> possible, but when I access an offset near the end (say 15mb, out of 16),
> I get (user-level) segfaults.

Yes. The driver has to clean out the memory contents. As for the segfaults
that is strange. Have to look at the code if possible.

> Using mtrr_add() causes quite a few lockups.

You ahve to be very careful here. You have to work with the physical
memory address. Not the virtual memory address.

> Now, don't yell at me and call me an idiot, I'm just a newbie :)

I remember when I started out :-) Now I manage the fbdev layer for the
kernel with Geert. It takes time and lots of experience.

> Should I not be allocating the RAM on this device somehow?

No, the resource management system does this for you. First are you
devleoping on a 2.4.X or 2.2.X kernel. Their is some difference but the
ideas are the same. The pci_dev struct returns the physical address.
 
> Am I supposed to just plain use it, should it be allocated (and how? :)

Use it. For pci devices you have to register them with the OS and reserve
the memory locations the PCI devices allocate. The reason is to avoid
overlapping regions of different PCI devices.

Innovation, innovate, and the concept of doing what everyone else did 20
years ago are registered trademarks of Microsoft Corporation. Other
buzzwords, euphemisms, and blatant lies are trademarks of their respective
owners.

James Simmons [jsimmons@linux-fbdev.org] ____/|
fbdev/console/gfx developer \ o.O|
http://www.linux-fbdev.org =(_)=
http://linuxgfx.sourceforge.net U
http://linuxconsole.sourceforge.net

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:16 EST