blob: 76f74a95bb5086dc670dfac711faafcad1572fe2 [file] [log] [blame]
developer14f3fe32016-04-28 14:07:42 +08001/*
developer72bccc12022-06-26 21:50:32 +08002 * Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
developer14f3fe32016-04-28 14:07:42 +08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
developer14f3fe32016-04-28 14:07:42 +08005 */
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00006
developer14f3fe32016-04-28 14:07:42 +08007#include <arch_helpers.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#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 Wange0bf3052020-08-27 13:48:48 +080013#include <lib/smccc.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000014#include <lib/xlat_tables/xlat_tables.h>
15#include <plat/common/platform.h>
Hsin-Yi Wange0bf3052020-08-27 13:48:48 +080016#include <services/arm_arch_svc.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000017
developer14f3fe32016-04-28 14:07:42 +080018#include <mtk_plat_common.h>
19#include <mtk_sip_svc.h>
developer14f3fe32016-04-28 14:07:42 +080020#include <plat_private.h>
developer14f3fe32016-04-28 14:07:42 +080021
developer14f3fe32016-04-28 14:07:42 +080022void clean_top_32b_of_param(uint32_t smc_fid,
Masahiro Yamada5ac9d962018-04-19 01:18:48 +090023 u_register_t *px1,
24 u_register_t *px2,
25 u_register_t *px3,
26 u_register_t *px4)
developer14f3fe32016-04-28 14:07:42 +080027{
28 /* if parameters from SMC32. Clean top 32 bits */
developer8c327e82022-05-29 22:25:44 +080029 if (GET_SMC_CC(smc_fid) == SMC_64) {
developer14f3fe32016-04-28 14:07:42 +080030 *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 Wange0bf3052020-08-27 13:48:48 +080036
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 *****************************************************************************/
45int32_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
55int32_t plat_get_soc_version(void)
56{
Yann Gautier9d327182021-05-20 11:40:13 +020057 uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_MTK_BKID, JEDEC_MTK_MFID);
Hsin-Yi Wange0bf3052020-08-27 13:48:48 +080058
Yann Gautier9d327182021-05-20 11:40:13 +020059 return (int32_t)(manfid | (SOC_CHIP_ID & SOC_ID_IMPL_DEF_MASK));
Hsin-Yi Wange0bf3052020-08-27 13:48:48 +080060}
61
62int32_t plat_get_soc_revision(void)
63{
64 return 0;
65}