public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit)
@ 2018-11-02  6:53 Sumit Garg
  2018-11-05 11:05 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Sumit Garg @ 2018-11-02  6:53 UTC (permalink / raw)
  To: edk2-devel

Correct usage of EFI_PHYSICAL_ADDRESS (always 64-bit) vs. pointers
(depending on architecture).

Reported-by: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 ArmPkg/Library/OpteeLib/Optee.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ArmPkg/Library/OpteeLib/Optee.c b/ArmPkg/Library/OpteeLib/Optee.c
index 8ac31cb28266..55dcc7853b59 100644
--- a/ArmPkg/Library/OpteeLib/Optee.c
+++ b/ArmPkg/Library/OpteeLib/Optee.c
@@ -134,7 +134,7 @@ OpteeInit (
 STATIC
 UINT32
 OpteeCallWithArg (
-  IN EFI_PHYSICAL_ADDRESS PhysicalArg
+  IN UINT64 PhysicalArg
   )
 {
   ARM_SMC_ARGS ArmSmcArgs;
@@ -213,7 +213,7 @@ OpteeOpenSession (
 
   MessageArg->NumParams = 2;
 
-  if (OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg)) {
+  if (OpteeCallWithArg ((UINTN)MessageArg)) {
     MessageArg->Return = OPTEE_ERROR_COMMUNICATION;
     MessageArg->ReturnOrigin = OPTEE_ORIGIN_COMMUNICATION;
   }
@@ -246,7 +246,7 @@ OpteeCloseSession (
   MessageArg->Command = OPTEE_MESSAGE_COMMAND_CLOSE_SESSION;
   MessageArg->Session = Session;
 
-  OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg);
+  OpteeCallWithArg ((UINTN)MessageArg);
 
   return EFI_SUCCESS;
 }
@@ -304,7 +304,7 @@ OpteeToMessageParam (
 
       CopyMem (
         (VOID *)ParamSharedMemoryAddress,
-        (VOID *)InParam->Union.Memory.BufferAddress,
+        (VOID *)(UINTN)InParam->Union.Memory.BufferAddress,
         InParam->Union.Memory.Size
         );
       MessageParam->Union.Memory.BufferAddress = (UINT64)ParamSharedMemoryAddress;
@@ -368,8 +368,8 @@ OpteeFromMessageParam (
       }
 
       CopyMem (
-        (VOID *)OutParam->Union.Memory.BufferAddress,
-        (VOID *)MessageParam->Union.Memory.BufferAddress,
+        (VOID *)(UINTN)OutParam->Union.Memory.BufferAddress,
+        (VOID *)(UINTN)MessageParam->Union.Memory.BufferAddress,
         MessageParam->Union.Memory.Size
         );
       OutParam->Union.Memory.Size = MessageParam->Union.Memory.Size;
@@ -417,7 +417,7 @@ OpteeInvokeFunction (
 
   MessageArg->NumParams = OPTEE_MAX_CALL_PARAMS;
 
-  if (OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg)) {
+  if (OpteeCallWithArg ((UINTN)MessageArg)) {
     MessageArg->Return = OPTEE_ERROR_COMMUNICATION;
     MessageArg->ReturnOrigin = OPTEE_ORIGIN_COMMUNICATION;
   }
-- 
2.7.4



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

* Re: [PATCH v1 1/1] ArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit)
  2018-11-02  6:53 [PATCH v1 1/1] ArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit) Sumit Garg
@ 2018-11-05 11:05 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2018-11-05 11:05 UTC (permalink / raw)
  To: Sumit Garg; +Cc: edk2-devel@lists.01.org, Leif Lindholm

On 2 November 2018 at 07:53, Sumit Garg <sumit.garg@linaro.org> wrote:
> Correct usage of EFI_PHYSICAL_ADDRESS (always 64-bit) vs. pointers
> (depending on architecture).
>
> Reported-by: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>

Thanks for the fix

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Pushed as e40f8efb8b06e023689120452e7ed5db199363de

> ---
>  ArmPkg/Library/OpteeLib/Optee.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/ArmPkg/Library/OpteeLib/Optee.c b/ArmPkg/Library/OpteeLib/Optee.c
> index 8ac31cb28266..55dcc7853b59 100644
> --- a/ArmPkg/Library/OpteeLib/Optee.c
> +++ b/ArmPkg/Library/OpteeLib/Optee.c
> @@ -134,7 +134,7 @@ OpteeInit (
>  STATIC
>  UINT32
>  OpteeCallWithArg (
> -  IN EFI_PHYSICAL_ADDRESS PhysicalArg
> +  IN UINT64 PhysicalArg
>    )
>  {
>    ARM_SMC_ARGS ArmSmcArgs;
> @@ -213,7 +213,7 @@ OpteeOpenSession (
>
>    MessageArg->NumParams = 2;
>
> -  if (OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg)) {
> +  if (OpteeCallWithArg ((UINTN)MessageArg)) {
>      MessageArg->Return = OPTEE_ERROR_COMMUNICATION;
>      MessageArg->ReturnOrigin = OPTEE_ORIGIN_COMMUNICATION;
>    }
> @@ -246,7 +246,7 @@ OpteeCloseSession (
>    MessageArg->Command = OPTEE_MESSAGE_COMMAND_CLOSE_SESSION;
>    MessageArg->Session = Session;
>
> -  OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg);
> +  OpteeCallWithArg ((UINTN)MessageArg);
>
>    return EFI_SUCCESS;
>  }
> @@ -304,7 +304,7 @@ OpteeToMessageParam (
>
>        CopyMem (
>          (VOID *)ParamSharedMemoryAddress,
> -        (VOID *)InParam->Union.Memory.BufferAddress,
> +        (VOID *)(UINTN)InParam->Union.Memory.BufferAddress,
>          InParam->Union.Memory.Size
>          );
>        MessageParam->Union.Memory.BufferAddress = (UINT64)ParamSharedMemoryAddress;
> @@ -368,8 +368,8 @@ OpteeFromMessageParam (
>        }
>
>        CopyMem (
> -        (VOID *)OutParam->Union.Memory.BufferAddress,
> -        (VOID *)MessageParam->Union.Memory.BufferAddress,
> +        (VOID *)(UINTN)OutParam->Union.Memory.BufferAddress,
> +        (VOID *)(UINTN)MessageParam->Union.Memory.BufferAddress,
>          MessageParam->Union.Memory.Size
>          );
>        OutParam->Union.Memory.Size = MessageParam->Union.Memory.Size;
> @@ -417,7 +417,7 @@ OpteeInvokeFunction (
>
>    MessageArg->NumParams = OPTEE_MAX_CALL_PARAMS;
>
> -  if (OpteeCallWithArg ((EFI_PHYSICAL_ADDRESS)MessageArg)) {
> +  if (OpteeCallWithArg ((UINTN)MessageArg)) {
>      MessageArg->Return = OPTEE_ERROR_COMMUNICATION;
>      MessageArg->ReturnOrigin = OPTEE_ORIGIN_COMMUNICATION;
>    }
> --
> 2.7.4
>


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

end of thread, other threads:[~2018-11-05 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-02  6:53 [PATCH v1 1/1] ArmPkg/OpteeLib: Fix compilation issues for ARM (32-bit) Sumit Garg
2018-11-05 11:05 ` Ard Biesheuvel

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