> On Sep 9, 2015, at 7:38 AM, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote:
> 
> On 9 September 2015 at 16:31, Leif Lindholm <leif.lindh...@linaro.org 
> <mailto:leif.lindh...@linaro.org>> wrote:
>> On Tue, Sep 08, 2015 at 07:35:40PM +0200, Ard Biesheuvel wrote:
>>> Make sure that the PEI memory region is carved out of memory that is
>>> 32-bit addressable, by taking MAX_ADDRESS into account (which is
>>> defined as '4 GB - 1' on ARM)
>>> 
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
>>> ---
>>> ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c 
>>> b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
>>> index 93ab16ca4a74..9f26d26a04d3 100755
>>> --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
>>> +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
>>> @@ -96,7 +96,7 @@ InitializeMemory (
>>> {
>>>   EFI_STATUS                            Status;
>>>   UINTN                                 SystemMemoryBase;
>>> -  UINTN                                 SystemMemoryTop;
>>> +  UINT64                                SystemMemoryTop;
>>>   UINTN                                 FdBase;
>>>   UINTN                                 FdTop;
>>>   UINTN                                 UefiMemoryBase;
>>> @@ -115,7 +115,10 @@ InitializeMemory (
>>>   ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
>>> 
>>>   SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase);
>>> -  SystemMemoryTop = SystemMemoryBase + (UINTN)PcdGet64 
>>> (PcdSystemMemorySize);
>>> +  SystemMemoryTop = SystemMemoryBase + PcdGet64 (PcdSystemMemorySize);
>>> +  if (SystemMemoryTop - 1 > MAX_ADDRESS) {
>>> +    SystemMemoryTop = (UINT64) MAX_ADDRESS + 1;
>>> +  }
>>>   FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress);
>>>   FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize);
>>> 
>>> --
>>> 1.9.1
>> 
>> So, this is mainly an OCD thing on my end, but is there any real
>> benefit to _not_ converting SystemMemoryBase to 64-bit? Doing so would
>> get rid of the other UINTN cast.
>> 
> 
> Not really, other than the fact that UINTN is more suitable for the
> base of DRAM, since you won't be able to run 32-bit UEFI if RAM starts
> above 4 GB anyway, so changing it to UINT64 seemed wrong to me.
> 

We have traditionally use EFI_PHYSICAL_ADDRESS for things that can be a system 
address. On x86 PEI can be 32-bit and DXE 64-bit. Not to mention 32-bit x86 
supports a larger physical address space than virtual address space. So for 
example the EFI memory map for a 32-bit system can return memory > 4GB. 

Thanks,

Andrew Fish


>> Either way:
>> Reviewed-by: Leif Lindholm <leif.lindh...@linaro.org 
>> <mailto:leif.lindh...@linaro.org>>
>> 
> 
> Thanks!
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org <mailto:edk2-devel@lists.01.org>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_mailman_listinfo_edk2-2Ddevel&d=BQICAg&c=eEvniauFctOgLOKGJOplqw&r=1HnUuXD1wDvw67rut5_idw&m=wRwkH_9UpA6VbYV7sByhOHwzStCaABHrZXMc611QIbw&s=wonkQazyiyGXX348zzGwzDdWaTSpa83YZKuqP4TEcfM&e=
>  
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_mailman_listinfo_edk2-2Ddevel&d=BQICAg&c=eEvniauFctOgLOKGJOplqw&r=1HnUuXD1wDvw67rut5_idw&m=wRwkH_9UpA6VbYV7sByhOHwzStCaABHrZXMc611QIbw&s=wonkQazyiyGXX348zzGwzDdWaTSpa83YZKuqP4TEcfM&e=>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to