Subject: Re: mem=XXXM ioremap DMA

From: Sylvain Munaut <[email-masked]>
Date: Mon, 29 Jan 2007 18:13:44 +0100

Eric Nuckols wrote:
>   
>> Eric Nuckols wrote:
>>     
>>> in my driver, I'm calling
>>> my_virt_address =   ioremap( 0x1F800000, 0x800000  );
>>> my_bus_address = virt_to_bus( my_virt_address );
>>>
>>>       
>> You can't use virt_to_bus on address returned by ioremap AFAIK.
>>
>> I think you could do
>> my_bus_address = virt_to_bus(phys_to_virt(0x1f800000));
>>
>> Altough it slightly misuse the functions ... but that should work.
>>
>>
>>         Sylvain
>>
>>     
>
> If I use this approach in a driver, won't I still need to use the ioremap 
> function to make sure the kernel does not reassign the virtual addresses to 
> some other physical memory locations?
mmh, I wasn't clear :
You must do :

my_virt_address =   ioremap( 0x1F800000, 0x800000  );
my_bus_address = virt_to_bus(phys_to_virt(0x1f800000));

The virtual address returned by phys_to_virt won't be really valid ... but it
will be good enough for virt_to_bus. In the end, it will just do
PCI_DRAM_OFFSET + 0x1f800000;

Sylvain