1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (C) 2020 Arm Limited 4 */ 5 6 #define pr_fmt(fmt) "smccc: " fmt 7 8 #include <linux/cache.h> 9 #include <linux/init.h> 10 #include <linux/arm-smccc.h> 11 #include <asm/archrandom.h> 12 13 static u32 smccc_version = ARM_SMCCC_VERSION_1_0; 14 static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE; 15 16 bool __ro_after_init smccc_trng_available = false; 17 18 void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit) 19 { 20 smccc_version = version; 21 smccc_conduit = conduit; 22 23 smccc_trng_available = smccc_probe_trng(); 24 } 25 26 enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void) 27 { 28 if (smccc_version < ARM_SMCCC_VERSION_1_1) 29 return SMCCC_CONDUIT_NONE; 30 31 return smccc_conduit; 32 } 33 EXPORT_SYMBOL_GPL(arm_smccc_1_1_get_conduit); 34 35 u32 arm_smccc_get_version(void) 36 { 37 return smccc_version; 38 } 39 EXPORT_SYMBOL_GPL(arm_smccc_get_version); 40