public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] StandaloneMmPkg: StandaloneMmMemLib: Change max address computation
@ 2023-01-30 16:28 Girish Mahadevan
  2023-02-09 17:35 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Girish Mahadevan @ 2023-01-30 16:28 UTC (permalink / raw)
  To: devel, sami.mujawar, ardb+tianocore, jiewen.yao,
	supreeth.venkatesh, damian.milosek
  Cc: jbrasen, ashishsingha, nramirez, Girish Mahadevan

Currently the standalonemmlibinternal assumes the max physical bits
to be 36 which is causing issues on v8 architectures.
Instead use the MAX_ALLOC_ADDRESS macro to determine the maximum
allowed address rather than recomputing it locally.

Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
---
 .../ArmStandaloneMmMemLibInternal.c               | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
index 297cfae916..fddcecf6da 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
@@ -20,13 +20,6 @@
 //
 extern EFI_PHYSICAL_ADDRESS  mMmMemLibInternalMaximumSupportAddress;
 
-#ifdef MDE_CPU_AARCH64
-#define ARM_PHYSICAL_ADDRESS_BITS  36
-#endif
-#ifdef MDE_CPU_ARM
-#define ARM_PHYSICAL_ADDRESS_BITS  32
-#endif
-
 /**
   Calculate and save the maximum support address.
 
@@ -36,14 +29,8 @@ MmMemLibInternalCalculateMaximumSupportAddress (
   VOID
   )
 {
-  UINT8  PhysicalAddressBits;
-
-  PhysicalAddressBits = ARM_PHYSICAL_ADDRESS_BITS;
+  mMmMemLibInternalMaximumSupportAddress = MAX_ALLOC_ADDRESS;
 
-  //
-  // Save the maximum support address in one global variable
-  //
-  mMmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1);
   DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress));
 }
 
-- 
2.17.1


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

* Re: [PATCH v2 1/1] StandaloneMmPkg: StandaloneMmMemLib: Change max address computation
  2023-01-30 16:28 [PATCH v2 1/1] StandaloneMmPkg: StandaloneMmMemLib: Change max address computation Girish Mahadevan
@ 2023-02-09 17:35 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2023-02-09 17:35 UTC (permalink / raw)
  To: Girish Mahadevan
  Cc: devel, sami.mujawar, ardb+tianocore, jiewen.yao,
	supreeth.venkatesh, damian.milosek, jbrasen, ashishsingha,
	nramirez

On Mon, 30 Jan 2023 at 17:29, Girish Mahadevan <gmahadevan@nvidia.com> wrote:
>
> Currently the standalonemmlibinternal assumes the max physical bits
> to be 36 which is causing issues on v8 architectures.
> Instead use the MAX_ALLOC_ADDRESS macro to determine the maximum
> allowed address rather than recomputing it locally.
>
> Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>

Merged as #4024

Thanks,

> ---
>  .../ArmStandaloneMmMemLibInternal.c               | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
> index 297cfae916..fddcecf6da 100644
> --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
> +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
> @@ -20,13 +20,6 @@
>  //
>  extern EFI_PHYSICAL_ADDRESS  mMmMemLibInternalMaximumSupportAddress;
>
> -#ifdef MDE_CPU_AARCH64
> -#define ARM_PHYSICAL_ADDRESS_BITS  36
> -#endif
> -#ifdef MDE_CPU_ARM
> -#define ARM_PHYSICAL_ADDRESS_BITS  32
> -#endif
> -
>  /**
>    Calculate and save the maximum support address.
>
> @@ -36,14 +29,8 @@ MmMemLibInternalCalculateMaximumSupportAddress (
>    VOID
>    )
>  {
> -  UINT8  PhysicalAddressBits;
> -
> -  PhysicalAddressBits = ARM_PHYSICAL_ADDRESS_BITS;
> +  mMmMemLibInternalMaximumSupportAddress = MAX_ALLOC_ADDRESS;
>
> -  //
> -  // Save the maximum support address in one global variable
> -  //
> -  mMmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1);
>    DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress));
>  }
>
> --
> 2.17.1
>

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

end of thread, other threads:[~2023-02-09 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-30 16:28 [PATCH v2 1/1] StandaloneMmPkg: StandaloneMmMemLib: Change max address computation Girish Mahadevan
2023-02-09 17:35 ` Ard Biesheuvel

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