[U-Boot] virt to phys mapping function

Wolfgang Denk wd at denx.de
Thu Nov 20 20:27:24 CET 2008


Dear Kumar,

In message <A9E2917C-2AE1-4666-95F7-5F771055EABB at kernel.crashing.org> you wrote:
>
> 1. what should the prototype of this function look like:
> 
> phys_addr_t virt_to_phys (void * addr);

That's what I'd prefer, especially since it can  be  easily  resolved
(for example, by an empty macro) where not really needed.

> int virt_to_phys(void *p, phys_addr_t *addr);
> 
> I think the vast majority of implementations will be just 1:1 mapping,  

That's what I think, too.

> however there is a question in a dynamic mapping case of how to report  
> back not finding a mapping.

Return "(phys_addr_t)(~0)" ?

> 2. what impact is there on existing use on:
> 
> cpu/mips/au1x00_eth.c:	fifo_tx[next_tx].addr = (virt_to_phys(packet))| 
> TX_DMA_ENABLE;
> cpu/mips/au1x00_eth.c:		fifo_rx[next_rx].addr =  
> (virt_to_phys(NetRxPackets[next_rx]))|RX_DMA_ENABLE;
> cpu/mips/au1x00_eth.c:		fifo_tx[i].addr = virt_to_phys(&txbuf[0]);
> cpu/mips/au1x00_eth.c:		fifo_rx[i].addr =  
> (virt_to_phys(NetRxPackets[i]))|RX_DMA_ENABLE;

They have to be checked and fixed, like all other uses of
virt_to_phys and eventually __virt_to_phys, too.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A father doesn't destroy his children.
	-- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
	   stardate 3468.1.


More information about the U-Boot mailing list