developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 1 | /* |
developer | 72bccc1 | 2022-06-26 21:50:32 +0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved. |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 6 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 7 | #include <arch_helpers.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <common/bl_common.h> |
| 9 | #include <common/debug.h> |
| 10 | #include <drivers/arm/cci.h> |
| 11 | #include <drivers/console.h> |
| 12 | #include <lib/mmio.h> |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 13 | #include <lib/smccc.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 14 | #include <lib/xlat_tables/xlat_tables.h> |
| 15 | #include <plat/common/platform.h> |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 16 | #include <services/arm_arch_svc.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 17 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 18 | #include <mtk_plat_common.h> |
| 19 | #include <mtk_sip_svc.h> |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 20 | #include <plat_private.h> |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 21 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 22 | void clean_top_32b_of_param(uint32_t smc_fid, |
Masahiro Yamada | 5ac9d96 | 2018-04-19 01:18:48 +0900 | [diff] [blame] | 23 | u_register_t *px1, |
| 24 | u_register_t *px2, |
| 25 | u_register_t *px3, |
| 26 | u_register_t *px4) |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 27 | { |
| 28 | /* if parameters from SMC32. Clean top 32 bits */ |
developer | 8c327e8 | 2022-05-29 22:25:44 +0800 | [diff] [blame] | 29 | if (GET_SMC_CC(smc_fid) == SMC_64) { |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 30 | *px1 = *px1 & SMC32_PARAM_MASK; |
| 31 | *px2 = *px2 & SMC32_PARAM_MASK; |
| 32 | *px3 = *px3 & SMC32_PARAM_MASK; |
| 33 | *px4 = *px4 & SMC32_PARAM_MASK; |
| 34 | } |
| 35 | } |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 36 | |
| 37 | /***************************************************************************** |
| 38 | * plat_is_smccc_feature_available() - This function checks whether SMCCC |
| 39 | * feature is availabile for platform. |
| 40 | * @fid: SMCCC function id |
| 41 | * |
| 42 | * Return SMC_OK if SMCCC feature is available and SMC_ARCH_CALL_NOT_SUPPORTED |
| 43 | * otherwise. |
| 44 | *****************************************************************************/ |
| 45 | int32_t plat_is_smccc_feature_available(u_register_t fid) |
| 46 | { |
| 47 | switch (fid) { |
| 48 | case SMCCC_ARCH_SOC_ID: |
| 49 | return SMC_ARCH_CALL_SUCCESS; |
| 50 | default: |
| 51 | return SMC_ARCH_CALL_NOT_SUPPORTED; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | int32_t plat_get_soc_version(void) |
| 56 | { |
Yann Gautier | 9d32718 | 2021-05-20 11:40:13 +0200 | [diff] [blame] | 57 | uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_MTK_BKID, JEDEC_MTK_MFID); |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 58 | |
Yann Gautier | 9d32718 | 2021-05-20 11:40:13 +0200 | [diff] [blame] | 59 | return (int32_t)(manfid | (SOC_CHIP_ID & SOC_ID_IMPL_DEF_MASK)); |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | int32_t plat_get_soc_revision(void) |
| 63 | { |
| 64 | return 0; |
| 65 | } |