1cf906b2aSLeon Chen /* 2*394b9208SLeon Chen * Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved. 3cf906b2aSLeon Chen * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5cf906b2aSLeon Chen */ 609d40e0eSAntonio Nino Diaz 7cf906b2aSLeon Chen #include <arch_helpers.h> 809d40e0eSAntonio Nino Diaz #include <common/bl_common.h> 909d40e0eSAntonio Nino Diaz #include <common/debug.h> 1009d40e0eSAntonio Nino Diaz #include <drivers/arm/cci.h> 1109d40e0eSAntonio Nino Diaz #include <drivers/console.h> 1209d40e0eSAntonio Nino Diaz #include <lib/mmio.h> 1374a34600SHsin-Yi Wang #include <lib/smccc.h> 1409d40e0eSAntonio Nino Diaz #include <lib/xlat_tables/xlat_tables.h> 1509d40e0eSAntonio Nino Diaz #include <plat/common/platform.h> 1674a34600SHsin-Yi Wang #include <services/arm_arch_svc.h> 1709d40e0eSAntonio Nino Diaz 18cf906b2aSLeon Chen #include <mtk_plat_common.h> 19cf906b2aSLeon Chen #include <mtk_sip_svc.h> 20cf906b2aSLeon Chen #include <plat_private.h> 21cf906b2aSLeon Chen 22cf906b2aSLeon Chen void clean_top_32b_of_param(uint32_t smc_fid, 2357d1e5faSMasahiro Yamada u_register_t *px1, 2457d1e5faSMasahiro Yamada u_register_t *px2, 2557d1e5faSMasahiro Yamada u_register_t *px3, 2657d1e5faSMasahiro Yamada u_register_t *px4) 27cf906b2aSLeon Chen { 28cf906b2aSLeon Chen /* if parameters from SMC32. Clean top 32 bits */ 292f3f5939SLeon Chen if (GET_SMC_CC(smc_fid) == SMC_64) { 30cf906b2aSLeon Chen *px1 = *px1 & SMC32_PARAM_MASK; 31cf906b2aSLeon Chen *px2 = *px2 & SMC32_PARAM_MASK; 32cf906b2aSLeon Chen *px3 = *px3 & SMC32_PARAM_MASK; 33cf906b2aSLeon Chen *px4 = *px4 & SMC32_PARAM_MASK; 34cf906b2aSLeon Chen } 35cf906b2aSLeon Chen } 36cf906b2aSLeon Chen 3774a34600SHsin-Yi Wang /***************************************************************************** 3874a34600SHsin-Yi Wang * plat_is_smccc_feature_available() - This function checks whether SMCCC 3974a34600SHsin-Yi Wang * feature is availabile for platform. 4074a34600SHsin-Yi Wang * @fid: SMCCC function id 4174a34600SHsin-Yi Wang * 4274a34600SHsin-Yi Wang * Return SMC_OK if SMCCC feature is available and SMC_ARCH_CALL_NOT_SUPPORTED 4374a34600SHsin-Yi Wang * otherwise. 4474a34600SHsin-Yi Wang *****************************************************************************/ 4574a34600SHsin-Yi Wang int32_t plat_is_smccc_feature_available(u_register_t fid) 4674a34600SHsin-Yi Wang { 4774a34600SHsin-Yi Wang switch (fid) { 4874a34600SHsin-Yi Wang case SMCCC_ARCH_SOC_ID: 4974a34600SHsin-Yi Wang return SMC_ARCH_CALL_SUCCESS; 5074a34600SHsin-Yi Wang default: 5174a34600SHsin-Yi Wang return SMC_ARCH_CALL_NOT_SUPPORTED; 5274a34600SHsin-Yi Wang } 5374a34600SHsin-Yi Wang } 5474a34600SHsin-Yi Wang 5574a34600SHsin-Yi Wang int32_t plat_get_soc_version(void) 5674a34600SHsin-Yi Wang { 5748648c09SYann Gautier uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_MTK_BKID, JEDEC_MTK_MFID); 5874a34600SHsin-Yi Wang 5948648c09SYann Gautier return (int32_t)(manfid | (SOC_CHIP_ID & SOC_ID_IMPL_DEF_MASK)); 6074a34600SHsin-Yi Wang } 6174a34600SHsin-Yi Wang 6274a34600SHsin-Yi Wang int32_t plat_get_soc_revision(void) 6374a34600SHsin-Yi Wang { 6474a34600SHsin-Yi Wang return 0; 6574a34600SHsin-Yi Wang } 66