| 1 |
/* |
| 2 |
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <arch_helpers.h> |
| 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> |
| 13 |
#include <lib/smccc.h> |
| 14 |
#include <lib/xlat_tables/xlat_tables.h> |
| 15 |
#include <plat/common/platform.h> |
| 16 |
#include <services/arm_arch_svc.h> |
| 17 |
|
| 18 |
#include <mtk_plat_common.h> |
| 19 |
#include <mtk_sip_svc.h> |
| 20 |
#include <plat_private.h> |
| 21 |
|
| 22 |
void clean_top_32b_of_param(uint32_t smc_fid, |
| 23 |
u_register_t *px1, |
| 24 |
u_register_t *px2, |
| 25 |
u_register_t *px3, |
| 26 |
u_register_t *px4) |
| 27 |
{ |
| 28 |
/* if parameters from SMC32. Clean top 32 bits */ |
| 29 |
if (GET_SMC_CC(smc_fid) == SMC_64) { |
| 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 |
} |
| 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 |
{ |
| 57 |
uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_MTK_BKID, JEDEC_MTK_MFID); |
| 58 |
|
| 59 |
return (int32_t)(manfid | (SOC_CHIP_ID & SOC_ID_IMPL_DEF_MASK)); |
| 60 |
} |
| 61 |
|
| 62 |
int32_t plat_get_soc_revision(void) |
| 63 |
{ |
| 64 |
return 0; |
| 65 |
} |