mphys

I’m having problems with mphys on PPC (I think).
I’m trying to get the physical address for DMA of a buffer. For example,
mphys gives me

virtual: 0x4804d000
physical: 0x1d07000

for a user buffer. But my DMA controller fails on reads and writes to
0x1d07000+ (I used a PCI bus analyser to find out).

Is there a “bus address” which is different than the virtual address on
this platform?

This all works great on intel. The buffer is being mmap’d… I am writing
to the buffer in my application (so the mmap isn’t failing and it
actually exists before I try mphys()).

Any ideas?

Thanks.
Dan.

Perhaps it’s my options to mmap()?

addr = mmap(0,
size,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
MAP_PHYS | MAP_ANON | MAP_SHARED,
NOFD,
0);


I’m having problems with mphys on PPC (I think). I’m trying to get the
physical address for DMA of a buffer. For example, mphys gives me
virtual: 0x4804d000
physical: 0x1d07000
for a user buffer. But my DMA controller fails on reads and writes to
0x1d07000+ (I used a PCI bus analyser to find out). Is there a “bus
address” which is different than the virtual address on this platform?
This all works great on intel. The buffer is being mmap’d… I am
writing to the buffer in my application (so the mmap isn’t failing and
it actually exists before I try mphys()). Any ideas?
Thanks.
Dan.

No. I am definately getting the wrong physical address from mphys.
I have verified this using DMAs to the address mphys gives.

I am back to my original question. How do I get the DMAable address of
this buffer on PowerPC?

Perhaps it’s my options to mmap()?
addr = mmap(0,
size,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
MAP_PHYS | MAP_ANON | MAP_SHARED,
NOFD,
0);

Daniel S. Chivers <dchivers@systran.com> wrote:

No. I am definately getting the wrong physical address from mphys.
I have verified this using DMAs to the address mphys gives.

I am back to my original question. How do I get the DMAable address of
this buffer on PowerPC?

Try get rid of “MAP_SHARED”

-xtang

Perhaps it’s my options to mmap()?
addr = mmap(0,
size,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
MAP_PHYS | MAP_ANON | MAP_SHARED,
NOFD,
0);

Try get rid of “MAP_SHARED”
-xtang

Thanks, but this didn’t seem to help.

Any other ideas?

Dan.

We had a very similar problem when trying to DMA under PPC. After getting a
physical address, you then have to map that address into the PCI address
space. Use the CpuBmstrTranslation value from the pci_dev_info structure to
offset the physical address.

Wayne

“Daniel S. Chivers” <dchivers@systran.com> wrote in message
news:9ull8r$1f1$1@inn.qnx.com

No. I am definately getting the wrong physical address from mphys.
I have verified this using DMAs to the address mphys gives.

I am back to my original question. How do I get the DMAable address of
this buffer on PowerPC?
Perhaps it’s my options to mmap()?
addr = mmap(0,
size,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
MAP_PHYS | MAP_ANON | MAP_SHARED,
NOFD,
0);

We had a very similar problem when trying to DMA under PPC. After
getting a physical address, you then have to map that address into the
PCI address space. Use the CpuBmstrTranslation value from the
pci_dev_info structure to offset the physical address.
Wayne

This was the solution. Thanks… you rock :wink:

Dan.