Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 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 <services/arm_arch_svc.h> |
| 11 | |
| 12 | #include <plat_private.h> |
| 13 | #include <plat_startup.h> |
| 14 | #include <pm_api_sys.h> |
| 15 | |
| 16 | /** |
| 17 | * plat_is_smccc_feature_available() - This function checks whether SMCCC |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 18 | * feature is availabile for platform. |
| 19 | * @fid: SMCCC function id. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 20 | * |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 21 | * Return: SMC_ARCH_CALL_SUCCESS - if SMCCC feature is available. |
| 22 | * SMC_ARCH_CALL_NOT_SUPPORTED - Otherwise. |
| 23 | * |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 24 | */ |
| 25 | int32_t plat_is_smccc_feature_available(u_register_t fid) |
| 26 | { |
| 27 | switch (fid) { |
| 28 | case SMCCC_ARCH_SOC_ID: |
| 29 | return SMC_ARCH_CALL_SUCCESS; |
| 30 | default: |
| 31 | return SMC_ARCH_CALL_NOT_SUPPORTED; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /** |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 36 | * plat_get_soc_version() - Get the SOC version of the platform. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 37 | * |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 38 | * Return: SiP defined SoC version in JEP-106. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 39 | * |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 40 | * This function is called when the SoC_ID_type == 0. |
| 41 | * For further details please refer to section 7.4 of SMC Calling Convention. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 42 | */ |
| 43 | int32_t plat_get_soc_version(void) |
| 44 | { |
| 45 | uint32_t manfid; |
| 46 | |
| 47 | manfid = SOC_ID_SET_JEP_106(JEDEC_XILINX_BKID, JEDEC_XILINX_MFID); |
| 48 | |
| 49 | return (int32_t)(manfid | (platform_version & SOC_ID_IMPL_DEF_MASK)); |
| 50 | } |
| 51 | |
| 52 | /** |
Prasad Kummari | 7d0623a | 2023-06-09 14:32:00 +0530 | [diff] [blame] | 53 | * plat_get_soc_revision() - Get the SOC revision for the platform. |
| 54 | * |
| 55 | * Return: SiP defined SoC revision. |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 56 | * |
| 57 | * This function is called when the SoC_ID_type == 1 |
| 58 | * For further details please refer to section 7.4 of SMC Calling Convention |
Akshay Belsare | 589ccce | 2023-05-08 19:00:53 +0530 | [diff] [blame] | 59 | */ |
| 60 | int32_t plat_get_soc_revision(void) |
| 61 | { |
| 62 | return (platform_id & SOC_ID_REV_MASK); |
| 63 | } |