[OpenBIOS] OFMEM and physical addresses

Alexander Graf agraf at suse.de
Sun Nov 7 01:38:59 CET 2010


On 06.11.2010, at 08:24, Andreas Färber wrote:

> Am 06.11.2010 um 13:05 schrieb Mark Cave-Ayland:
> 
>> Andreas Färber wrote:
>> 
>>> I was planning to do the same thing for ppc64, please go ahead.
>>> The alternative would've been to create separate range structs - cleaner API-wise, but then the range logic would need to be duplicated, which I consider a big con. ;)
>> 
>> Yeah, that's what I was thinking. I know that the old SPARC64 code used to reference addresses in the translation_t struct linked list directly in the MMU miss handlers, but that section has now been replaced with C code. Are there any similar gotchas on PPC?
> 
> Not that I'm aware of. Alex?

The MMU miss handler code is very simple:

static ucell
ea_to_phys( ucell ea, ucell *mode )
{
        ucell phys;

        if (ea >= OF_CODE_START) {
                /* ROM into RAM */
                ea -= OF_CODE_START;
                phys = get_rom_base() + ea;
                *mode = 0x02;
                return phys;
        }

        phys = ofmem_translate(ea, mode);
        if( phys == -1 ) {
                phys = ea;
                *mode = ofmem_arch_default_translation_mode( phys );

                /* print_virt_range(); */
                /* print_phys_range(); */
                /* print_trans(); */
        }
        return phys;
}

[...]

        phys = ea_to_phys(nip, &mode);
        hash_page( nip, phys, mode );


So as long as you're in openBIOS code or no ofmem map is available, it maps linearly, otherwise it uses normal ofmem handlers. I don't see any list involved here :).


Alex




More information about the OpenBIOS mailing list