diff --git a/plat/arm/board/fvp/fvp_common.c b/plat/arm/board/fvp/fvp_common.c index 6f439b8e2..6e479ac4f 100644 --- a/plat/arm/board/fvp/fvp_common.c +++ b/plat/arm/board/fvp/fvp_common.c @@ -13,16 +13,18 @@ #include #include #include +#include #include -#include -#include -#include #include - +#include #if SPM_MM #include #endif +#include +#include +#include + #include "fvp_private.h" /* Defines for GIC Driver build time selection */ @@ -437,3 +439,40 @@ void fvp_timer_init(void) CNTCR_FCREQ(0U) | CNTCR_EN); #endif /* USE_SP804_TIMER */ } + +/***************************************************************************** + * plat_is_smccc_feature_available() - This function checks whether SMCCC + * feature is availabile for platform. + * @fid: SMCCC function id + * + * Return SMC_ARCH_CALL_SUCCESS if SMCCC feature is available and + * SMC_ARCH_CALL_NOT_SUPPORTED otherwise. + *****************************************************************************/ +int32_t plat_is_smccc_feature_available(u_register_t fid) +{ + switch (fid) { + case SMCCC_ARCH_SOC_ID: + return SMC_ARCH_CALL_SUCCESS; + default: + return SMC_ARCH_CALL_NOT_SUPPORTED; + } +} + +/* Get SOC version */ +int32_t plat_get_soc_version(void) +{ + return (int32_t) + ((ARM_SOC_IDENTIFICATION_CODE << ARM_SOC_IDENTIFICATION_SHIFT) + | (ARM_SOC_CONTINUATION_CODE << ARM_SOC_CONTINUATION_SHIFT) + | FVP_SOC_ID); +} + +/* Get SOC revision */ +int32_t plat_get_soc_revision(void) +{ + unsigned int sys_id; + + sys_id = mmio_read_32(V2M_SYSREGS_BASE + V2M_SYS_ID); + return (int32_t)((sys_id >> V2M_SYS_ID_REV_SHIFT) & + V2M_SYS_ID_REV_MASK); +} diff --git a/plat/arm/board/fvp/fvp_def.h b/plat/arm/board/fvp/fvp_def.h index c5d156858..4efe69258 100644 --- a/plat/arm/board/fvp/fvp_def.h +++ b/plat/arm/board/fvp/fvp_def.h @@ -27,6 +27,11 @@ #define FVP_CCI 1 #define FVP_CCN 2 +/****************************************************************************** + * Definition of platform soc id + *****************************************************************************/ +#define FVP_SOC_ID 0 + /******************************************************************************* * FVP memory map related constants ******************************************************************************/ diff --git a/plat/arm/board/juno/juno_common.c b/plat/arm/board/juno/juno_common.c index 9570d2d4c..da4918cf2 100644 --- a/plat/arm/board/juno/juno_common.c +++ b/plat/arm/board/juno/juno_common.c @@ -1,10 +1,13 @@ /* - * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ +#include #include +#include + #include /* @@ -91,3 +94,40 @@ const mmap_region_t plat_arm_mmap[] = { #endif ARM_CASSERT_MMAP + +/***************************************************************************** + * plat_is_smccc_feature_available() - This function checks whether SMCCC + * feature is availabile for platform. + * @fid: SMCCC function id + * + * Return SMC_ARCH_CALL_SUCCESS if SMCCC feature is available and + * SMC_ARCH_CALL_NOT_SUPPORTED otherwise. + *****************************************************************************/ +int32_t plat_is_smccc_feature_available(u_register_t fid) +{ + switch (fid) { + case SMCCC_ARCH_SOC_ID: + return SMC_ARCH_CALL_SUCCESS; + default: + return SMC_ARCH_CALL_NOT_SUPPORTED; + } +} + +/* Get SOC version */ +int32_t plat_get_soc_version(void) +{ + return (int32_t) + ((ARM_SOC_IDENTIFICATION_CODE << ARM_SOC_IDENTIFICATION_SHIFT) + | (ARM_SOC_CONTINUATION_CODE << ARM_SOC_CONTINUATION_SHIFT) + | JUNO_SOC_ID); +} + +/* Get SOC revision */ +int32_t plat_get_soc_revision(void) +{ + unsigned int sys_id; + + sys_id = mmio_read_32(V2M_SYSREGS_BASE + V2M_SYS_ID); + return (int32_t)((sys_id >> V2M_SYS_ID_REV_SHIFT) & + V2M_SYS_ID_REV_MASK); +} diff --git a/plat/arm/board/juno/juno_def.h b/plat/arm/board/juno/juno_def.h index 3b34a9f6a..ddf99dcdb 100644 --- a/plat/arm/board/juno/juno_def.h +++ b/plat/arm/board/juno/juno_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,6 +9,11 @@ #include +/****************************************************************************** + * Definition of platform soc id + *****************************************************************************/ +#define JUNO_SOC_ID 1 + /******************************************************************************* * Juno memory map related constants ******************************************************************************/ diff --git a/plat/arm/common/arm_common.c b/plat/arm/common/arm_common.c index e2b99a3d6..f7ee7a8e4 100644 --- a/plat/arm/common/arm_common.c +++ b/plat/arm/common/arm_common.c @@ -237,38 +237,3 @@ int plat_sdei_validate_entry_point(uintptr_t ep, unsigned int client_mode) } #endif -/***************************************************************************** - * plat_is_smccc_feature_available() - This function checks whether SMCCC - * feature is availabile for platform. - * @fid: SMCCC function id - * - * Return SMC_OK if SMCCC feature is available and SMC_ARCH_CALL_NOT_SUPPORTED - * otherwise. - *****************************************************************************/ -int32_t plat_is_smccc_feature_available(u_register_t fid) -{ - switch (fid) { - case SMCCC_ARCH_SOC_ID: - default: - return SMC_ARCH_CALL_NOT_SUPPORTED; - } -} - -/* - * Weak function to get ARM platform SOC-ID, Always return SOC-ID=0 - * ToDo: Get proper SOC-ID for every ARM platform and define this - * function separately for every ARM platform. - */ -uint32_t plat_arm_get_soc_id(void) -{ - return 0U; -} - -/* Get SOC version */ -int32_t plat_get_soc_version(void) -{ - return (int32_t) - ((ARM_SOC_IDENTIFICATION_CODE << ARM_SOC_IDENTIFICATION_SHIFT) - | (ARM_SOC_CONTINUATION_CODE << ARM_SOC_CONTINUATION_SHIFT) - | plat_arm_get_soc_id()); -}