Sona Mathew | 0738421 | 2022-11-28 13:19:11 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <tftf.h> |
| 8 | #include <arch_helpers.h> |
| 9 | #include <debug.h> |
| 10 | #include <errata_abi.h> |
| 11 | #include <platform.h> |
| 12 | #include <tftf_lib.h> |
| 13 | |
| 14 | const em_function_t em_functions[TOTAL_ABI_CALLS] = { |
| 15 | DEFINE_EM_FUNC(VERSION, true), |
| 16 | DEFINE_EM_FUNC(FEATURES, true), |
| 17 | DEFINE_EM_FUNC(CPU_ERRATUM_FEATURES, true), |
| 18 | }; |
| 19 | |
| 20 | int32_t tftf_em_abi_version(void) |
| 21 | { |
| 22 | smc_args args = { EM_VERSION }; |
| 23 | smc_ret_values ret_vals; |
| 24 | |
| 25 | ret_vals = tftf_smc(&args); |
| 26 | return ret_vals.ret0; |
| 27 | } |
| 28 | |
| 29 | bool tftf_em_abi_feature_implemented(uint32_t id) |
| 30 | { |
| 31 | smc_args args = { |
| 32 | EM_FEATURES, |
| 33 | id, |
| 34 | }; |
| 35 | smc_ret_values ret_vals; |
| 36 | |
| 37 | ret_vals = tftf_smc(&args); |
| 38 | if (ret_vals.ret0 == EM_SUCCESS) { |
| 39 | return true; |
| 40 | } else { |
| 41 | return false; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | smc_ret_values tftf_em_abi_cpu_feature_implemented(uint32_t cpu_erratum, |
| 46 | uint32_t forward_flag) |
| 47 | { |
| 48 | smc_args args = { |
| 49 | EM_CPU_ERRATUM_FEATURES, |
| 50 | cpu_erratum, |
| 51 | forward_flag |
| 52 | }; |
| 53 | return tftf_smc(&args); |
| 54 | } |