Thread (40 messages) flat view 40 messages, 6 authors, 2007-02-10

RE: [PATCH 1/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

From: Li Yang-r58472 <hidden>
Date: 2007-02-08 07:05:13
Also in: netdev

quoted
quoted
quoted
quoted
quoted
If its been mapped with ioremap() you know the physical address
already
quoted
quoted
so why do you need iopa().
That's what the original function immrbar_virt_to_phys() does.
We're
quoted
quoted
trying to
quoted
get rid of it, because we thought is redundant with iopa().

static inline unsigned long immrbar_virt_to_phys(volatile void *
address)
quoted
{
	if ( ((u32)address >=3D (u32)qe_immr) &&
			((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE))
)
quoted
		return (unsigned long)(address - (u32)qe_immr +
				(u32)get_qe_base());
	return (unsigned long)virt_to_phys(address);
}

get_qe_base() does a search of the OF tree the first time it's
called.

Here's the code that calls immrbar_virt_to_phys():

	out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
		 (u32) immrbar_virt_to_phys(ugeth->
					    p_tx_bd_ring[i]));


Would it be better to replace this code with something like this:

out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
	get_qe_base() + ((void *) ugeth->p_tx_bd_ring[i] - (void *)
qe_immr));

No, we don't know if the BD ring is in MURAM or main memory as it
is
quoted
quoted
quoted
configurable.  iopa() is best choice to handle both case, IMHO.
Does MURAM behave differently than normal memory?
MURAM is a mmio region so it don't share the characteristic of main
memory that phy_addr =3D virt_addr - PAGE_OFFSET.  While they can
both be
mapped through page table using iopa().
=20
Right, so when do you know if you'll be using MURAM or normal
memory?  Why not just keep around a token that is the physical
address at the point you make the decision of MURAM vs normal memory.
Yes, that can be a way.  But as the virt to phy mapping is only used
once, it's nothing bad to do it this way.

- Leo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help