mirror of
https://github.com/acidanthera/audk.git
synced 2025-08-20 17:18:11 +02:00
The SMCCC protocol stipulates the following: - on AARCH64, 18 arguments can be passed, and 18 values can be returned, via registers X0-x17; - on ARM, 8 arguments can be passed, and 8 values can be returned. This makes ArmSmcLib and ArmHvcLib as implemented currently unsuitable for use with SMCCC services in general, although for PSCI in particular, they work fine. The dependency on both ArmSmcLib and ArmHvcLib is also impractical because it requires every platform that consumes ArmMonitorLib to provide resolutions for each, even though most platforms will only ever need one of these (and the choice is made at compile time) So let's drop these dependencies, and re-implement the asm helpers from scratch. Note that the only difference is the actual instruction used -HVC vs SMC- and so all other code can be shared. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/** @file
|
|
|
|
Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#ifndef ARM_MONITOR_LIB_H_
|
|
#define ARM_MONITOR_LIB_H_
|
|
|
|
/** The size of the SMC arguments is different between AArch64 and AArch32.
|
|
|
|
The native size is used for the arguments.
|
|
It will be casted to either HVC or SMC args.
|
|
*/
|
|
typedef struct {
|
|
UINTN Arg0;
|
|
UINTN Arg1;
|
|
UINTN Arg2;
|
|
UINTN Arg3;
|
|
UINTN Arg4;
|
|
UINTN Arg5;
|
|
UINTN Arg6;
|
|
UINTN Arg7;
|
|
#ifdef MDE_CPU_AARCH64
|
|
UINTN Arg8;
|
|
UINTN Arg9;
|
|
UINTN Arg10;
|
|
UINTN Arg11;
|
|
UINTN Arg12;
|
|
UINTN Arg13;
|
|
UINTN Arg14;
|
|
UINTN Arg15;
|
|
UINTN Arg16;
|
|
UINTN Arg17;
|
|
#endif
|
|
} ARM_MONITOR_ARGS;
|
|
|
|
/** Monitor call.
|
|
|
|
An HyperVisor Call (HVC) or System Monitor Call (SMC) will be issued
|
|
depending on the default conduit. PcdMonitorConduitHvc determines the type
|
|
of the call: if true, do an HVC.
|
|
|
|
@param [in,out] Args Arguments for the HVC/SMC.
|
|
**/
|
|
VOID
|
|
EFIAPI
|
|
ArmMonitorCall (
|
|
IN OUT ARM_MONITOR_ARGS *Args
|
|
);
|
|
|
|
#endif // ARM_MONITOR_LIB_H_
|