xref: /rk3399_ARM-atf/plat/xilinx/common/versal.c (revision 8c37540524a16dc564b6758c6c62d51d3a9487f3)
1 /*
2  * Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <common/debug.h>
8 #include <lib/mmio.h>
9 #include <lib/smccc.h>
10 #include <plat/common/platform.h>
11 #include <services/arm_arch_svc.h>
12 
13 #include <plat_private.h>
14 #include <plat_startup.h>
15 #include <pm_api_sys.h>
16 
17 /**
18  * plat_is_smccc_feature_available() - This function checks whether SMCCC
19  *                                     feature is availabile for platform.
20  * @fid: SMCCC function id.
21  *
22  * Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available.
23  *         SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise.
24  *
25  */
26 int32_t plat_is_smccc_feature_available(u_register_t fid)
27 {
28 	int32_t ret = 0;
29 
30 	if (fid == SMCCC_ARCH_SOC_ID) {
31 		ret = SMC_ARCH_CALL_SUCCESS;
32 	} else {
33 		ret = SMC_ARCH_CALL_NOT_SUPPORTED;
34 	}
35 
36 	return ret;
37 }
38 
39 /**
40  * plat_get_soc_version() - Get the SOC version of the platform.
41  *
42  * Return: SiP defined SoC version in JEP-106.
43  *
44  * This function is called when the SoC_ID_type == 0.
45  * For further details please refer to section 7.4 of SMC Calling Convention.
46  */
47 int32_t plat_get_soc_version(void)
48 {
49 	uint32_t manfid;
50 
51 	manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID);
52 
53 	return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK));
54 }
55 
56 /**
57  * plat_get_soc_revision() - Get the SOC revision for the platform.
58  *
59  * Return: SiP defined SoC revision.
60  *
61  * This function is called when the  SoC_ID_type == 1
62  * For further details please refer to section 7.4 of SMC Calling Convention
63  */
64 int32_t plat_get_soc_revision(void)
65 {
66 	return (int32_t)(platform_id & SOC_ID_REV_MASK);
67 }
68