[OpenBIOS] [PATCH 3/5] Alter ofmem_malloc_align() so that the resulting pointer is aligned for both physical and virtual addresses.

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Dec 22 11:30:26 CET 2010


Blue Swirl wrote:

>> diff --git a/openbios-devel/include/arch/ppc/io.h b/openbios-devel/include/arch/ppc/io.h
>> index 3449c5b..20586e4 100644
>> --- a/openbios-devel/include/arch/ppc/io.h
>> +++ b/openbios-devel/include/arch/ppc/io.h
>> @@ -9,6 +9,26 @@
>>  extern char _start, _end;
>>  extern unsigned long virt_offset;
>>
>> +static inline unsigned long
> 
> phys_addr_t?
> 
>> +va2pa(unsigned long va)
>> +{
>> +    if ((va >= (unsigned long)&_start) &&
>> +        (va < (unsigned long)&_end))
>> +        return va - virt_offset;
>> +    else
>> +        return va;
>> +}
>> +
>> +static inline unsigned long
>> +pa2va(unsigned long pa)
> 
> phys_addr_t pa?
> 
>> +{
>> +    if ((pa + virt_offset >= (unsigned long)&_start) &&
>> +        (pa + virt_offset < (unsigned long)&_end))
>> +        return pa + virt_offset;
>> +    else
>> +        return pa;
>> +}

Currently none of the SPARC pa <-> va conversion functions use 
phys_addr_t so I just copied what was already there. Perhaps it would 
make sense to change these to phys_addr_t before this commit?


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the OpenBIOS mailing list