Am 22.12.2010 um 11:38 schrieb Mark Cave-Ayland:
Andreas Färber wrote:
--verbose please! What is this supposed to do? Seems like a duplicate of ofmem.c:ea_to_phys() but different? Andreas
It's used to convert between physical/virtual addresses. For alignment purposes, we need to ensure that memory allocated to a specific alignment is aligned both physically and virtually and since I couldn't see these functions in the PPC io.h file I just added them.
From what you're saying it sounds like the proper fix would be to rename the PPC functions ea_to_phys() (and also it's reverse mapping function) to match the SPARC definitions so they can be called from OFMEM. Does that sound reasonable?
No. The virtual address on ppc64 is something like 80 bits, whereas the effective address (64 bits) really is what we want, similar differences for 32-bit, so it shouldn't be renamed. It may need to be wrapped.
I don't think it belongs in io.h either. I wouldn't know where virt_offset is initialized, so I assume that during runtime (as opposed to forthstrap) it will be zero and all you're doing there is identity-mapping things, which buys us nothing.
We do have ofmem_arch_translate() or similar for the virtual-to- physical direction. Maybe we need another ofmem_* one for the opposite direction? sparc implementations could then call their *va* macros from there if it suits them. The way we map OpenBIOS into RAM in ea2phys() should guarantee physical alignment of aligned effective addresses, so that there's no need to consider it in other functions (this is an ugly hack, in theory OpenBIOS would need to be fully relocatable and just copied there).
Andreas