]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class
authorPierre Gondois <Pierre.Gondois@arm.com>
Fri, 28 Oct 2022 15:32:42 +0000 (17:32 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 6 Nov 2022 16:32:28 +0000 (16:32 +0000)
The ArmMonitorLib provides an abstract interface to issue
an HyperVisor Call (HVC) or System Monitor Call (SMC) depending
on the default conduit.
The PcdMonitorConduitHvc PCD allows to select the default conduit.

The new library relies on the ArmHvcLib and ArmSmcLib libraries.
A Null instance of these libraries can be used for the unused conduit.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
ArmPkg/ArmPkg.dec
ArmPkg/Include/Library/ArmMonitorLib.h [new file with mode: 0644]

index 99cb024d0f939ac5313fd6c22fb9c71c5107a0d7..f17ba913e6de1326d49b93d6a15378ff2f522d24 100644 (file)
   #\r
   ArmSvcLib|Include/Library/ArmSvcLib.h\r
 \r
+  ##  @libraryclass  Provides a Monitor Call interface that will use the\r
+  #   default conduit (HVC or SMC).\r
+  #\r
+  ArmMonitorLib|Include/Library/ArmMonitorLib.h\r
+\r
   ##  @libraryclass  Provides a default exception handler.\r
   #\r
   DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h\r
diff --git a/ArmPkg/Include/Library/ArmMonitorLib.h b/ArmPkg/Include/Library/ArmMonitorLib.h
new file mode 100644 (file)
index 0000000..d6e13b6
--- /dev/null
@@ -0,0 +1,42 @@
+/** @file\r
+\r
+  Copyright (c) 2022, Arm Limited. All rights reserved.<BR>\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef ARM_MONITOR_LIB_H_\r
+#define ARM_MONITOR_LIB_H_\r
+\r
+/** The size of the SMC arguments is different between AArch64 and AArch32.\r
+\r
+  The native size is used for the arguments.\r
+  It will be casted to either HVC or SMC args.\r
+*/\r
+typedef struct {\r
+  UINTN    Arg0;\r
+  UINTN    Arg1;\r
+  UINTN    Arg2;\r
+  UINTN    Arg3;\r
+  UINTN    Arg4;\r
+  UINTN    Arg5;\r
+  UINTN    Arg6;\r
+  UINTN    Arg7;\r
+} ARM_MONITOR_ARGS;\r
+\r
+/** Monitor call.\r
+\r
+  An HyperVisor Call (HVC) or System Monitor Call (SMC) will be issued\r
+  depending on the default conduit. PcdMonitorConduitHvc determines the type\r
+  of the call: if true, do an HVC.\r
+\r
+  @param [in,out]  Args    Arguments for the HVC/SMC.\r
+**/\r
+VOID\r
+EFIAPI\r
+ArmMonitorCall (\r
+  IN OUT ARM_MONITOR_ARGS  *Args\r
+  );\r
+\r
+#endif // ARM_MONITOR_LIB_H_\r