Re: PCI DMA Address

From: Robert Hancock
Date: Sat May 01 2004 - 00:20:16 EST


I don't think ioremap is what you want here. ioremap is used to map a PCI
memory region on the card itself. To allocate a DMA region within system
memory to transfer to, you want something like pci_alloc_consistent (but
128MB seems a rather large amount to use for that function, given that it
allocates with GFP_ATOMIC..)


----- Original Message -----
From: "ina" <celina.miranda@xxxxxxxxx>
Newsgroups: fa.linux.kernel
Sent: Thursday, April 29, 2004 12:37 AM
Subject: PCI DMA Address


> Hi,
>
> I need to create a driver for a PCI camera device that uses DMA to
> transfer the captured images. The system that i use is an x86 board
> that has 128M of RAM, I reserved the top of the physical RAM during
> bootup by passing "mem=100".
>
> In my driver i claimed the reserved memory by using ioremap call:
> void* pAdd = ioremap(0x6400000,(1280x1024))
>
> This is the memory where the PCI device should DMA the captured data.
> My question is how do I tell the PCI device the DMA address? I know
> that inorder for the PCI device to access the DMA address correctly, i
> have to convert the return value of ioremap into a bus address. How do
> i do this? I already used:
> virt_to_phys(pAdd)
> but this doesn't seem to work.
>
> I read somewhere that the output of ioremap cannot be directly used
> for virt_to_phys function call, but I'm not really sure...
>
> Thanks,
> Ina

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