public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back
@ 2020-03-05 22:46 andrey.warkentin
  2020-03-06  8:35 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: andrey.warkentin @ 2020-03-05 22:46 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif, pete, philmd

From: Andrei Warkentin <awarkentin@vmware.com>

The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need
an extra 2MB region.

Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP.

Signed-off-by: Andrei Warkentin <awarkentin@vmware.com>
---
 Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 ++++++++++++--------
 Platform/RaspberryPi/RPi4/RPi4.dsc                        |  4 ++--
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
index 901e5e3e..e795a885 100644
--- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
+++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
@@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO   VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP
                        FixedPcdGet32(PcdFdSize) - \
                        VariablesSize)
 
-#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize))
-
 /**
   Return the Virtual Memory Map of your platform
 
@@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
   VirtualMemoryInfo[Index++].Name           = L"FD Variables";
 
-  // TF-A reserved RAM
-  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
-  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
-  VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase;
-  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
-  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
-  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
+  if (BCM2711_SOC_REGISTERS == 0) {
+     //
+     // TF-A reserved RAM only exists for the Pi 3 TF-A.
+     //
+     // This is 2MB that directly follows the FD.
+     //
+     VirtualMemoryTable[Index].PhysicalBase    = (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize));
+     VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
+     VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase;
+     VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+     VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
+     VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
+  }
 
   // Base System RAM
   VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 (PcdSystemMemoryBase);
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 79295729..da62dc5b 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -396,8 +396,8 @@
   # This matches PcdFvBaseAddress, since everything less is ATF, and
   # will be reserved away.
   #
-  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
-  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
+  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000
+  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000
 
   #
   # Device specific addresses
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back
  2020-03-05 22:46 [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back andrey.warkentin
@ 2020-03-06  8:35 ` Philippe Mathieu-Daudé
  2020-03-06 11:42 ` Pete Batard
       [not found] ` <15F9B446FF373668.16592@groups.io>
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-06  8:35 UTC (permalink / raw)
  To: Andrei Warkentin, devel; +Cc: ard.biesheuvel, leif, pete

On 3/5/20 11:46 PM, Andrei Warkentin wrote:
> From: Andrei Warkentin <awarkentin@vmware.com>
> 
> The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need
> an extra 2MB region.
> 

The note ...:

---vvv---

> Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP.

---^^^---

> 
> Signed-off-by: Andrei Warkentin <awarkentin@vmware.com>
> ---

... goes here below the '---' so it is removed by git-am when the patch 
is applied (else it is buried in git history and this is not relevant 
information).

>   Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 ++++++++++++--------
>   Platform/RaspberryPi/RPi4/RPi4.dsc                        |  4 ++--
>   2 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> index 901e5e3e..e795a885 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO   VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP
>                          FixedPcdGet32(PcdFdSize) - \
>                          VariablesSize)
>   
> -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize))
> -
>   /**
>     Return the Virtual Memory Map of your platform
>   
> @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap (
>     VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
>     VirtualMemoryInfo[Index++].Name           = L"FD Variables";
>   
> -  // TF-A reserved RAM

We could let this ^ comment here.

Patch looks good otherwise.

> -  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
> -  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
> -  VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase;
> -  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> -  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
> -  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> +  if (BCM2711_SOC_REGISTERS == 0) {
> +     //
> +     // TF-A reserved RAM only exists for the Pi 3 TF-A.
> +     //
> +     // This is 2MB that directly follows the FD.
> +     //
> +     VirtualMemoryTable[Index].PhysicalBase    = (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize));
> +     VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
> +     VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase;
> +     VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +     VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
> +     VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> +  }
>   
>     // Base System RAM
>     VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 (PcdSystemMemoryBase);
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> index 79295729..da62dc5b 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -396,8 +396,8 @@
>     # This matches PcdFvBaseAddress, since everything less is ATF, and
>     # will be reserved away.
>     #
> -  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
> -  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000
> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000
>   
>     #
>     # Device specific addresses
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back
  2020-03-05 22:46 [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back andrey.warkentin
  2020-03-06  8:35 ` Philippe Mathieu-Daudé
@ 2020-03-06 11:42 ` Pete Batard
       [not found] ` <15F9B446FF373668.16592@groups.io>
  2 siblings, 0 replies; 5+ messages in thread
From: Pete Batard @ 2020-03-06 11:42 UTC (permalink / raw)
  To: Andrei Warkentin, devel; +Cc: ard.biesheuvel, leif, philmd

This currently produces an ASSERT for me:

ASSERT [ArmPlatformPrePiUniCore] 
/usr/src/edk2/ArmPlatformPkg/PrePi/PrePi.c(75): (((UINT64)0x00000000ULL 
 > mSystemMemoryEnd) || ((0x00000000ULL + 0x00200000U) < 0x00200000ULL)) 
|| ((0x00000000ULL >= 0x00200000ULL) && ((UINT64)(0x00000000ULL + 
0x00200000U)

Please hold off integration until we've looked into it further.

Regards,

/Pete


On 2020.03.05 22:46, Andrei Warkentin wrote:
> From: Andrei Warkentin <awarkentin@vmware.com>
> 
> The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need
> an extra 2MB region.
> 
> Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP.
> 
> Signed-off-by: Andrei Warkentin <awarkentin@vmware.com>
> ---
>   Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 ++++++++++++--------
>   Platform/RaspberryPi/RPi4/RPi4.dsc                        |  4 ++--
>   2 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> index 901e5e3e..e795a885 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO   VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP
>                          FixedPcdGet32(PcdFdSize) - \
>                          VariablesSize)
>   
> -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize))
> -
>   /**
>     Return the Virtual Memory Map of your platform
>   
> @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap (
>     VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
>     VirtualMemoryInfo[Index++].Name           = L"FD Variables";
>   
> -  // TF-A reserved RAM
> -  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
> -  VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
> -  VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase;
> -  VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> -  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
> -  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> +  if (BCM2711_SOC_REGISTERS == 0) {
> +     //
> +     // TF-A reserved RAM only exists for the Pi 3 TF-A.
> +     //
> +     // This is 2MB that directly follows the FD.
> +     //
> +     VirtualMemoryTable[Index].PhysicalBase    = (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize));
> +     VirtualMemoryTable[Index].VirtualBase     = VirtualMemoryTable[Index].PhysicalBase;
> +     VirtualMemoryTable[Index].Length          = FixedPcdGet64 (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase;
> +     VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +     VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
> +     VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> +  }
>   
>     // Base System RAM
>     VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 (PcdSystemMemoryBase);
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> index 79295729..da62dc5b 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -396,8 +396,8 @@
>     # This matches PcdFvBaseAddress, since everything less is ATF, and
>     # will be reserved away.
>     #
> -  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
> -  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000
> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000
>   
>     #
>     # Device specific addresses
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back
       [not found] ` <15F9B446FF373668.16592@groups.io>
@ 2020-03-06 11:51   ` Pete Batard
  2020-03-06 16:43     ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Pete Batard @ 2020-03-06 11:51 UTC (permalink / raw)
  To: devel, Andrei Warkentin; +Cc: ard.biesheuvel, leif, philmd

On 2020.03.06 11:42, Pete Batard via Groups.Io wrote:
> This currently produces an ASSERT for me:
> 
> ASSERT [ArmPlatformPrePiUniCore] 
> /usr/src/edk2/ArmPlatformPkg/PrePi/PrePi.c(75): (((UINT64)0x00000000ULL 
>  > mSystemMemoryEnd) || ((0x00000000ULL + 0x00200000U) < 0x00200000ULL)) 
> || ((0x00000000ULL >= 0x00200000ULL) && ((UINT64)(0x00000000ULL + 
> 0x00200000U)
> 
> Please hold off integration until we've looked into it further.

Disregard. I was missing the fix IS_XIP dependency mentioned below.

With this:
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by:  Pete Batard <pete@akeo.ie>

> 
> Regards,
> 
> /Pete
> 
> 
> On 2020.03.05 22:46, Andrei Warkentin wrote:
>> From: Andrei Warkentin <awarkentin@vmware.com>
>>
>> The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need
>> an extra 2MB region.
>>
>> Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP.
>>
>> Signed-off-by: Andrei Warkentin <awarkentin@vmware.com>
>> ---
>>   Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 
>> ++++++++++++--------
>>   Platform/RaspberryPi/RPi4/RPi4.dsc                        |  4 ++--
>>   2 files changed, 15 insertions(+), 11 deletions(-)
>>
>> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c 
>> b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> index 901e5e3e..e795a885 100644
>> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
>> @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO   
>> VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP
>>                          FixedPcdGet32(PcdFdSize) - \
>>                          VariablesSize)
>> -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + 
>> FixedPcdGet32(PcdFdSize))
>> -
>>   /**
>>     Return the Virtual Memory Map of your platform
>> @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap (
>>     VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
>>     VirtualMemoryInfo[Index++].Name           = L"FD Variables";
>> -  // TF-A reserved RAM
>> -  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
>> -  VirtualMemoryTable[Index].VirtualBase     = 
>> VirtualMemoryTable[Index].PhysicalBase;
>> -  VirtualMemoryTable[Index].Length          = FixedPcdGet64 
>> (PcdSystemMemoryBase) - ATFBase;
>> -  VirtualMemoryTable[Index].Attributes      = 
>> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> -  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
>> -  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
>> +  if (BCM2711_SOC_REGISTERS == 0) {
>> +     //
>> +     // TF-A reserved RAM only exists for the Pi 3 TF-A.
>> +     //
>> +     // This is 2MB that directly follows the FD.
>> +     //
>> +     VirtualMemoryTable[Index].PhysicalBase    = 
>> (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize));
>> +     VirtualMemoryTable[Index].VirtualBase     = 
>> VirtualMemoryTable[Index].PhysicalBase;
>> +     VirtualMemoryTable[Index].Length          = FixedPcdGet64 
>> (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase;
>> +     VirtualMemoryTable[Index].Attributes      = 
>> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> +     VirtualMemoryInfo[Index].Type             = 
>> RPI_MEM_RESERVED_REGION;
>> +     VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
>> +  }
>>     // Base System RAM
>>     VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64 
>> (PcdSystemMemoryBase);
>> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc 
>> b/Platform/RaspberryPi/RPi4/RPi4.dsc
>> index 79295729..da62dc5b 100644
>> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
>> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
>> @@ -396,8 +396,8 @@
>>     # This matches PcdFvBaseAddress, since everything less is ATF, and
>>     # will be reserved away.
>>     #
>> -  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
>> -  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
>> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000
>> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000
>>     #
>>     # Device specific addresses
>>
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back
  2020-03-06 11:51   ` [edk2-devel] " Pete Batard
@ 2020-03-06 16:43     ` Ard Biesheuvel
  0 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2020-03-06 16:43 UTC (permalink / raw)
  To: Pete Batard
  Cc: edk2-devel-groups-io, Andrei Warkentin, Leif Lindholm,
	Philippe Mathieu-Daudé

On Fri, 6 Mar 2020 at 12:51, Pete Batard <pete@akeo.ie> wrote:
>
> On 2020.03.06 11:42, Pete Batard via Groups.Io wrote:
> > This currently produces an ASSERT for me:
> >
> > ASSERT [ArmPlatformPrePiUniCore]
> > /usr/src/edk2/ArmPlatformPkg/PrePi/PrePi.c(75): (((UINT64)0x00000000ULL
> >  > mSystemMemoryEnd) || ((0x00000000ULL + 0x00200000U) < 0x00200000ULL))
> > || ((0x00000000ULL >= 0x00200000ULL) && ((UINT64)(0x00000000ULL +
> > 0x00200000U)
> >
> > Please hold off integration until we've looked into it further.
>
> Disregard. I was missing the fix IS_XIP dependency mentioned below.
>
> With this:
> Reviewed-by: Pete Batard <pete@akeo.ie>
> Tested-by:  Pete Batard <pete@akeo.ie>
>

Pushed as f9d42079600c..91ed4f904e16

Thanks all

> >
> > Regards,
> >
> > /Pete
> >
> >
> > On 2020.03.05 22:46, Andrei Warkentin wrote:
> >> From: Andrei Warkentin <awarkentin@vmware.com>
> >>
> >> The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need
> >> an extra 2MB region.
> >>
> >> Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP.
> >>
> >> Signed-off-by: Andrei Warkentin <awarkentin@vmware.com>
> >> ---
> >>   Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22
> >> ++++++++++++--------
> >>   Platform/RaspberryPi/RPi4/RPi4.dsc                        |  4 ++--
> >>   2 files changed, 15 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> >> b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> >> index 901e5e3e..e795a885 100644
> >> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> >> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> >> @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO
> >> VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP
> >>                          FixedPcdGet32(PcdFdSize) - \
> >>                          VariablesSize)
> >> -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) +
> >> FixedPcdGet32(PcdFdSize))
> >> -
> >>   /**
> >>     Return the Virtual Memory Map of your platform
> >> @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap (
> >>     VirtualMemoryInfo[Index].Type             = RPI_MEM_RUNTIME_REGION;
> >>     VirtualMemoryInfo[Index++].Name           = L"FD Variables";
> >> -  // TF-A reserved RAM
> >> -  VirtualMemoryTable[Index].PhysicalBase    = ATFBase;
> >> -  VirtualMemoryTable[Index].VirtualBase     =
> >> VirtualMemoryTable[Index].PhysicalBase;
> >> -  VirtualMemoryTable[Index].Length          = FixedPcdGet64
> >> (PcdSystemMemoryBase) - ATFBase;
> >> -  VirtualMemoryTable[Index].Attributes      =
> >> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> >> -  VirtualMemoryInfo[Index].Type             = RPI_MEM_RESERVED_REGION;
> >> -  VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> >> +  if (BCM2711_SOC_REGISTERS == 0) {
> >> +     //
> >> +     // TF-A reserved RAM only exists for the Pi 3 TF-A.
> >> +     //
> >> +     // This is 2MB that directly follows the FD.
> >> +     //
> >> +     VirtualMemoryTable[Index].PhysicalBase    =
> >> (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize));
> >> +     VirtualMemoryTable[Index].VirtualBase     =
> >> VirtualMemoryTable[Index].PhysicalBase;
> >> +     VirtualMemoryTable[Index].Length          = FixedPcdGet64
> >> (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase;
> >> +     VirtualMemoryTable[Index].Attributes      =
> >> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> >> +     VirtualMemoryInfo[Index].Type             =
> >> RPI_MEM_RESERVED_REGION;
> >> +     VirtualMemoryInfo[Index++].Name           = L"TF-A RAM";
> >> +  }
> >>     // Base System RAM
> >>     VirtualMemoryTable[Index].PhysicalBase    = FixedPcdGet64
> >> (PcdSystemMemoryBase);
> >> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc
> >> b/Platform/RaspberryPi/RPi4/RPi4.dsc
> >> index 79295729..da62dc5b 100644
> >> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> >> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> >> @@ -396,8 +396,8 @@
> >>     # This matches PcdFvBaseAddress, since everything less is ATF, and
> >>     # will be reserved away.
> >>     #
> >> -  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000
> >> -  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000
> >> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000
> >> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000
> >>     #
> >>     # Device specific addresses
> >>
> >
> >
> > 
> >
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-06 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-05 22:46 [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back andrey.warkentin
2020-03-06  8:35 ` Philippe Mathieu-Daudé
2020-03-06 11:42 ` Pete Batard
     [not found] ` <15F9B446FF373668.16592@groups.io>
2020-03-06 11:51   ` [edk2-devel] " Pete Batard
2020-03-06 16:43     ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox