On 09/09/12 19:28, Andreas Tobler wrote:
Hi,
I'm trying to understand how the 'translations' entry (/cpus/PowerPC,G4 for example) for PPC is created. Or is it taken from a template?
When I use qemu and enter into OF I see translations only up to 80000000-800eb000. When I compare with a real PowerBook G4 I see some more above 800eb000, for example one which I'm looking for in OpenBIOS for the OF mapping:
0xff8000000-0xffc00000 -> 0x3fc00000-0x40000000
This mapping describes the OF code mapping/translation of this particular PowerBook.
In the code I was not able to understand the mechanics, so a hint on how to read would really be appreciated.
Hi Andreas,
There is a difference in the contents of the translations property depending upon which architecture you are using, and so for PPC you need to look at ofmem_arch_create_translation_entry() in arch/ppc/qemu/ofmem.c.
Basically OpenBIOS has a memory API called OFMEM shared between (nearly) all architectures in libopenbios/ofmem_common.c. When the various ofmem_* functions are called internally to set up memory allocations/mappings, the OFMEM code updates the translations property for you automatically by calling the architecture-specific OFMEM routines as required.
What should happen is that OpenBIOS should present all the memory mappings it has set up via the translations property, so that when a kernel takes over it can add the bootstrap mappings into its own memory map/page tables to ensure that they are maintained until the kernel has fully taken over the memory management.
HTH,
Mark.