1079c6e24SAkshay Belsare /* 2079c6e24SAkshay Belsare * Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved. 3079c6e24SAkshay Belsare * 4079c6e24SAkshay Belsare * SPDX-License-Identifier: BSD-3-Clause 5079c6e24SAkshay Belsare */ 6079c6e24SAkshay Belsare 7079c6e24SAkshay Belsare #include <common/debug.h> 8079c6e24SAkshay Belsare #include <lib/mmio.h> 9079c6e24SAkshay Belsare #include <lib/smccc.h> 10079c6e24SAkshay Belsare #include <services/arm_arch_svc.h> 11079c6e24SAkshay Belsare 12079c6e24SAkshay Belsare #include <plat_private.h> 13079c6e24SAkshay Belsare #include <plat_startup.h> 14079c6e24SAkshay Belsare #include <pm_api_sys.h> 15079c6e24SAkshay Belsare 16079c6e24SAkshay Belsare /** 17079c6e24SAkshay Belsare * plat_is_smccc_feature_available() - This function checks whether SMCCC 18079c6e24SAkshay Belsare * feature is availabile for platform. 19*de7ed953SPrasad Kummari * @fid: SMCCC function id. 20079c6e24SAkshay Belsare * 21*de7ed953SPrasad Kummari * Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available. 22*de7ed953SPrasad Kummari * SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise. 23*de7ed953SPrasad Kummari * 24079c6e24SAkshay Belsare */ 25079c6e24SAkshay Belsare int32_t plat_is_smccc_feature_available(u_register_t fid) 26079c6e24SAkshay Belsare { 27079c6e24SAkshay Belsare switch (fid) { 28079c6e24SAkshay Belsare case SMCCC_ARCH_SOC_ID: 29079c6e24SAkshay Belsare return SMC_ARCH_CALL_SUCCESS; 30079c6e24SAkshay Belsare default: 31079c6e24SAkshay Belsare return SMC_ARCH_CALL_NOT_SUPPORTED; 32079c6e24SAkshay Belsare } 33079c6e24SAkshay Belsare } 34079c6e24SAkshay Belsare 35079c6e24SAkshay Belsare /** 36*de7ed953SPrasad Kummari * plat_get_soc_version() - Get the SOC version of the platform. 37*de7ed953SPrasad Kummari * 38*de7ed953SPrasad Kummari * Return: SiP defined SoC version in JEP-106. 39079c6e24SAkshay Belsare * 40079c6e24SAkshay Belsare * This function is called when the SoC_ID_type == 0. 41*de7ed953SPrasad Kummari * For further details please refer to section 7.4 of SMC Calling Convention. 42079c6e24SAkshay Belsare */ 43079c6e24SAkshay Belsare int32_t plat_get_soc_version(void) 44079c6e24SAkshay Belsare { 45079c6e24SAkshay Belsare uint32_t manfid; 46079c6e24SAkshay Belsare 47079c6e24SAkshay Belsare manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID); 48079c6e24SAkshay Belsare 49079c6e24SAkshay Belsare return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK)); 50079c6e24SAkshay Belsare } 51079c6e24SAkshay Belsare 52079c6e24SAkshay Belsare /** 53*de7ed953SPrasad Kummari * plat_get_soc_revision() - Get the SOC revision for the platform. 54*de7ed953SPrasad Kummari * 55*de7ed953SPrasad Kummari * Return: SiP defined SoC revision. 56079c6e24SAkshay Belsare * 57079c6e24SAkshay Belsare * This function is called when the SoC_ID_type == 1 58079c6e24SAkshay Belsare * For further details please refer to section 7.4 of SMC Calling Convention 59079c6e24SAkshay Belsare */ 60079c6e24SAkshay Belsare int32_t plat_get_soc_revision(void) 61079c6e24SAkshay Belsare { 62079c6e24SAkshay Belsare return (platform_id & SOC_ID_REV_MASK); 63079c6e24SAkshay Belsare } 64