blob: dc0ae10426e0c3f11732b988ed3470d4d2621d78 [file] [log] [blame]
Akshay Belsare589ccce2023-05-08 19:00:53 +05301/*
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>
Maheedhar Bollapalli86d6d702024-10-07 09:27:58 +000010#include <plat/common/platform.h>
Akshay Belsare589ccce2023-05-08 19:00:53 +053011#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
Prasad Kummari7d0623a2023-06-09 14:32:00 +053019 * feature is availabile for platform.
20 * @fid: SMCCC function id.
Akshay Belsare589ccce2023-05-08 19:00:53 +053021 *
Prasad Kummari7d0623a2023-06-09 14:32:00 +053022 * Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available.
23 * SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise.
24 *
Akshay Belsare589ccce2023-05-08 19:00:53 +053025 */
26int32_t plat_is_smccc_feature_available(u_register_t fid)
27{
Nithin G1a986952024-04-25 19:10:06 +053028 int32_t ret = 0;
29
Akshay Belsare589ccce2023-05-08 19:00:53 +053030 switch (fid) {
31 case SMCCC_ARCH_SOC_ID:
Nithin G1a986952024-04-25 19:10:06 +053032 ret = SMC_ARCH_CALL_SUCCESS;
33 break;
Akshay Belsare589ccce2023-05-08 19:00:53 +053034 default:
Nithin G1a986952024-04-25 19:10:06 +053035 ret = SMC_ARCH_CALL_NOT_SUPPORTED;
Akshay Belsare589ccce2023-05-08 19:00:53 +053036 }
Nithin G1a986952024-04-25 19:10:06 +053037
38 return ret;
Akshay Belsare589ccce2023-05-08 19:00:53 +053039}
40
41/**
Prasad Kummari7d0623a2023-06-09 14:32:00 +053042 * plat_get_soc_version() - Get the SOC version of the platform.
Akshay Belsare589ccce2023-05-08 19:00:53 +053043 *
Prasad Kummari7d0623a2023-06-09 14:32:00 +053044 * Return: SiP defined SoC version in JEP-106.
Akshay Belsare589ccce2023-05-08 19:00:53 +053045 *
Prasad Kummari7d0623a2023-06-09 14:32:00 +053046 * This function is called when the SoC_ID_type == 0.
47 * For further details please refer to section 7.4 of SMC Calling Convention.
Akshay Belsare589ccce2023-05-08 19:00:53 +053048 */
49int32_t plat_get_soc_version(void)
50{
51 uint32_t manfid;
52
53 manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID);
54
55 return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK));
56}
57
58/**
Prasad Kummari7d0623a2023-06-09 14:32:00 +053059 * plat_get_soc_revision() - Get the SOC revision for the platform.
60 *
61 * Return: SiP defined SoC revision.
Akshay Belsare589ccce2023-05-08 19:00:53 +053062 *
63 * This function is called when the SoC_ID_type == 1
64 * For further details please refer to section 7.4 of SMC Calling Convention
Akshay Belsare589ccce2023-05-08 19:00:53 +053065 */
66int32_t plat_get_soc_revision(void)
67{
Maheedhar Bollapallicc3c1002024-04-24 16:51:22 +053068 return (int32_t)(platform_id & SOC_ID_REV_MASK);
Akshay Belsare589ccce2023-05-08 19:00:53 +053069}