xref: /rk3399_ARM-atf/plat/xilinx/common/versal.c (revision 3a1a2dae10ef3058e3973715fc4406544ff4aad7)
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  */
26079c6e24SAkshay Belsare int32_t plat_is_smccc_feature_available(u_register_t fid)
27079c6e24SAkshay Belsare {
28079c6e24SAkshay Belsare 	switch (fid) {
29079c6e24SAkshay Belsare 	case SMCCC_ARCH_SOC_ID:
30079c6e24SAkshay Belsare 		return SMC_ARCH_CALL_SUCCESS;
31079c6e24SAkshay Belsare 	default:
32079c6e24SAkshay Belsare 		return SMC_ARCH_CALL_NOT_SUPPORTED;
33079c6e24SAkshay Belsare 	}
34079c6e24SAkshay Belsare }
35079c6e24SAkshay Belsare 
36079c6e24SAkshay Belsare /**
37de7ed953SPrasad Kummari  * plat_get_soc_version() - Get the SOC version of the platform.
38de7ed953SPrasad Kummari  *
39de7ed953SPrasad Kummari  * Return: SiP defined SoC version in JEP-106.
40079c6e24SAkshay Belsare  *
41079c6e24SAkshay Belsare  * This function is called when the SoC_ID_type == 0.
42de7ed953SPrasad Kummari  * For further details please refer to section 7.4 of SMC Calling Convention.
43079c6e24SAkshay Belsare  */
44079c6e24SAkshay Belsare int32_t plat_get_soc_version(void)
45079c6e24SAkshay Belsare {
46079c6e24SAkshay Belsare 	uint32_t manfid;
47079c6e24SAkshay Belsare 
48079c6e24SAkshay Belsare 	manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID);
49079c6e24SAkshay Belsare 
50079c6e24SAkshay Belsare 	return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK));
51079c6e24SAkshay Belsare }
52079c6e24SAkshay Belsare 
53079c6e24SAkshay Belsare /**
54de7ed953SPrasad Kummari  * plat_get_soc_revision() - Get the SOC revision for the platform.
55de7ed953SPrasad Kummari  *
56de7ed953SPrasad Kummari  * Return: SiP defined SoC revision.
57079c6e24SAkshay Belsare  *
58079c6e24SAkshay Belsare  * This function is called when the  SoC_ID_type == 1
59079c6e24SAkshay Belsare  * For further details please refer to section 7.4 of SMC Calling Convention
60079c6e24SAkshay Belsare  */
61079c6e24SAkshay Belsare int32_t plat_get_soc_revision(void)
62079c6e24SAkshay Belsare {
63*3a1a2daeSMaheedhar Bollapalli 	return (int32_t)(platform_id & SOC_ID_REV_MASK);
64079c6e24SAkshay Belsare }
65