Re: PCI - memory access problems..

Linus Torvalds (Linus.Torvalds@cs.Helsinki.FI)
Wed, 2 Aug 1995 09:06:35 +0300

Jaroslav Kysela: "PCI - memory access problems.." (Jul 29, 20:30):
> I'm working on the net driver for PCI card (HP J2585A) and I want
> use memory mapped access. Memory mapped access work well with ISA version
> of this net adapter, but I cann't access memory area shared with PCI bus
> (by me is it range 0xfbffe000-0xfbffffff) due to general protection.
> Have anyone experience with this problem? Have I do something with
> memory mapping? Examples are welcome..

If you have a very recent kernel, you should be able to use the
"vremap()" functionality to remap an area of physical memory into kernel
memory space. Usage:

void * base = vremap(0xfbffe000,0x2000); /* start, size */

if (!base) {
printk("unable to remap high PCI memory\n");
... access the area relative to "base" ...

Note that the kernel can't directly access all 32 bits of the physical
memory map: that wouldn't leave any virtual memory left for user
processes (we only have a 32-bit virtual address space). So we need to
use vremap() for anything that is mapped high in memory in the kernel.

NOTE! Be _very_ careful if you try to do DMA to this area. You need to
use the real physical address (0xfbffe000), not the virtually re-mapped
address (base).