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> 1016c611f8SMaheedhar Bollapalli #include <plat/common/platform.h> 11079c6e24SAkshay Belsare #include <services/arm_arch_svc.h> 12079c6e24SAkshay Belsare 13079c6e24SAkshay Belsare #include <plat_private.h> 14079c6e24SAkshay Belsare #include <plat_startup.h> 15079c6e24SAkshay Belsare #include <pm_api_sys.h> 16079c6e24SAkshay Belsare 17079c6e24SAkshay Belsare /** 18079c6e24SAkshay Belsare * plat_is_smccc_feature_available() - This function checks whether SMCCC 19079c6e24SAkshay Belsare * feature is availabile for platform. 20de7ed953SPrasad Kummari * @fid: SMCCC function id. 21079c6e24SAkshay Belsare * 22de7ed953SPrasad Kummari * Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available. 23de7ed953SPrasad Kummari * SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise. 24de7ed953SPrasad Kummari * 25079c6e24SAkshay Belsare */ plat_is_smccc_feature_available(u_register_t fid)26079c6e24SAkshay Belsareint32_t plat_is_smccc_feature_available(u_register_t fid) 27079c6e24SAkshay Belsare { 28906d5892SNithin G int32_t ret = 0; 29906d5892SNithin G 30*325949f1SSaivardhan Thatikonda if (fid == SMCCC_ARCH_SOC_ID) { 31906d5892SNithin G ret = SMC_ARCH_CALL_SUCCESS; 32*325949f1SSaivardhan Thatikonda } else { 33906d5892SNithin G ret = SMC_ARCH_CALL_NOT_SUPPORTED; 34079c6e24SAkshay Belsare } 35906d5892SNithin G 36906d5892SNithin G return ret; 37079c6e24SAkshay Belsare } 38079c6e24SAkshay Belsare 39079c6e24SAkshay Belsare /** 40de7ed953SPrasad Kummari * plat_get_soc_version() - Get the SOC version of the platform. 41de7ed953SPrasad Kummari * 42de7ed953SPrasad Kummari * Return: SiP defined SoC version in JEP-106. 43079c6e24SAkshay Belsare * 44079c6e24SAkshay Belsare * This function is called when the SoC_ID_type == 0. 45de7ed953SPrasad Kummari * For further details please refer to section 7.4 of SMC Calling Convention. 46079c6e24SAkshay Belsare */ plat_get_soc_version(void)47079c6e24SAkshay Belsareint32_t plat_get_soc_version(void) 48079c6e24SAkshay Belsare { 49079c6e24SAkshay Belsare uint32_t manfid; 50079c6e24SAkshay Belsare 51079c6e24SAkshay Belsare manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID); 52079c6e24SAkshay Belsare 53079c6e24SAkshay Belsare return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK)); 54079c6e24SAkshay Belsare } 55079c6e24SAkshay Belsare 56079c6e24SAkshay Belsare /** 57de7ed953SPrasad Kummari * plat_get_soc_revision() - Get the SOC revision for the platform. 58de7ed953SPrasad Kummari * 59de7ed953SPrasad Kummari * Return: SiP defined SoC revision. 60079c6e24SAkshay Belsare * 61079c6e24SAkshay Belsare * This function is called when the SoC_ID_type == 1 62079c6e24SAkshay Belsare * For further details please refer to section 7.4 of SMC Calling Convention 63079c6e24SAkshay Belsare */ plat_get_soc_revision(void)64079c6e24SAkshay Belsareint32_t plat_get_soc_revision(void) 65079c6e24SAkshay Belsare { 663a1a2daeSMaheedhar Bollapalli return (int32_t)(platform_id & SOC_ID_REV_MASK); 67079c6e24SAkshay Belsare } 68