diff options
author | Benjamin Doron <benjamin.doron@9elements.com> | 2023-06-14 18:43:59 -0400 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2024-05-25 06:55:31 +0000 |
commit | f27b22ab4e7001c4de40d721a5e0be46b8349a06 (patch) | |
tree | d97563fd0e1a0b1da68fe8448003fcbdf408473a /src/arch/arm64/include/armv8 | |
parent | c2ed5eaa12fb3f0da5bdf2acb6f4a688e9b374d3 (diff) |
arch/arm64: Support calling a trusted monitor
Implement support for generating an SMC to call a trusted monitor. Some
functions are provided to read the SoC ID from the monitor, if
supported.
Change-Id: I158db0b971aba722b3995d52162146aa406d1644
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78284
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch/arm64/include/armv8')
-rw-r--r-- | src/arch/arm64/include/armv8/arch/smc.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/arch/arm64/include/armv8/arch/smc.h b/src/arch/arm64/include/armv8/arch/smc.h new file mode 100644 index 0000000000..2e7cc8a3c2 --- /dev/null +++ b/src/arch/arm64/include/armv8/arch/smc.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef ARM_ARM64_SMC_H +#define ARM_ARM64_SMC_H + +#include <types.h> + +uint64_t smc(uint32_t function_id, uint64_t arg1, uint64_t arg2, uint64_t arg3, + uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7); + +#define smc_call0(function_id) smc(function_id, 0, 0, 0, 0, 0, 0, 0) +#define smc_call1(function_id, a1) smc(function_id, a1, 0, 0, 0, 0, 0, 0) +#define smc_call2(function_id, a1, a2) smc(function_id, a1, a2, 0, 0, 0, 0, 0) +#define smc_call3(function_id, a1, a2, a3) smc(function_id, a1, a2, a3, 0, 0, 0, 0) + +/* Documented in https://developer.arm.com/documentation/den0022/ */ +enum psci_return_values { + PSCI_SUCCESS = 0, + PSCI_NOT_SUPPORTED = -1, + PSCI_INVALID_PARAMETERS = -2, + PSCI_DENIED = -3, + PSCI_ALREADY_ON = -4, + PSCI_ON_PENDING = -5, + PSCI_INTERNAL_FAILURE = -6, + PSCI_NOT_PRESENT = -7, + PSCI_DISABLED = -8, + PSCI_INVALID_ADDRESS = -9, +}; + +/* PSCI functions */ +#define PSCI_VERSION 0x84000000 +#define PSCI_FEATURES 0x8400000a + +/* Documented in https://developer.arm.com/documentation/den0028/ */ +enum smccc_return_values { + SMC_SUCCESS = 0, + SMC_NOT_SUPPORTED = -1, + SMC_NOT_REQUIRED = -2, + SMC_INVALID_PARAMETER = -3, +}; + +/* SMCCC functions */ +#define SMCCC_VERSION 0x80000000 +#define SMCCC_ARCH_FEATURES 0x80000001 +#define SMCCC_ARCH_SOC_ID 0x80000002 +#define SMCCC_GET_SOC_VERSION 0 +#define SMCCC_GET_SOC_REVISION 1 + +uint8_t smccc_supports_arch_soc_id(void); +enum cb_err smccc_arch_soc_id(uint32_t *jep106code, uint32_t *soc_revision); + +#endif /* ARM_ARM64_SMC_H */ |