Merge "feat(morello): implement methods to retrieve soc-id information" into integration

This commit is contained in:
Manish V Badarkhe 2023-03-15 14:27:47 +01:00 committed by TrustedFirmware Code Review
commit 3e8b6f4327
5 changed files with 112 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -191,4 +191,7 @@
/* Number of SCMI channels on the platform */
#define PLAT_ARM_SCMI_CHANNEL_COUNT U(1)
/* Platform ID address */
#define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET)
#endif /* PLATFORM_DEF_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, Arm Limited. All rights reserved.
* Copyright (c) 2021-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -33,6 +33,7 @@ struct morello_plat_info {
* - remote_chip_count
* - multichip mode
* - scc configuration
* - silicon revision
*/
struct morello_plat_info {
uint64_t local_ddr_size;
@ -40,6 +41,7 @@ struct morello_plat_info {
uint8_t remote_chip_count;
bool multichip_mode;
uint32_t scc_config;
uint32_t silicon_revision;
} __packed;
#endif

View file

@ -1,16 +1,57 @@
/*
* Copyright (c) 2020-2022, Arm Limited. All rights reserved.
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <drivers/arm/css/css_mhu_doorbell.h>
#include <drivers/arm/css/scmi.h>
#include <drivers/arm/css/sds.h>
#include <lib/smccc.h>
#include <plat/arm/common/plat_arm.h>
#include <services/arm_arch_svc.h>
#include "morello_def.h"
#include <platform_def.h>
#ifdef TARGET_PLATFORM_FVP
/*
* Platform information structure stored in SDS.
* This structure holds information about platform's DDR
* size
* - Local DDR size in bytes, DDR memory in main board
*/
struct morello_plat_info {
uint64_t local_ddr_size;
} __packed;
#else
/*
* Platform information structure stored in SDS.
* This structure holds information about platform's DDR
* size which is an information about multichip setup
* - Local DDR size in bytes, DDR memory in main board
* - Remote DDR size in bytes, DDR memory in remote board
* - remote_chip_count
* - multichip mode
* - scc configuration
* - silicon revision
*/
struct morello_plat_info {
uint64_t local_ddr_size;
uint64_t remote_ddr_size;
uint8_t remote_chip_count;
bool multichip_mode;
uint32_t scc_config;
uint32_t silicon_revision;
} __packed;
struct morello_plat_info plat_info;
#endif
/* Compile time assertion to ensure the size of structure is of the required bytes */
CASSERT(sizeof(struct morello_plat_info) == MORELLO_SDS_PLATFORM_INFO_SIZE,
assert_invalid_plat_info_size);
static scmi_channel_plat_info_t morello_scmi_plat_info = {
.scmi_mbx_mem = MORELLO_SCMI_PAYLOAD_BASE,
.db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
@ -31,5 +72,63 @@ const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
void bl31_platform_setup(void)
{
#ifdef TARGET_PLATFORM_SOC
int ret;
ret = sds_init();
if (ret != SDS_OK) {
ERROR("SDS initialization failed. ret:%d\n", ret);
panic();
}
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
MORELLO_SDS_PLATFORM_INFO_OFFSET,
&plat_info,
MORELLO_SDS_PLATFORM_INFO_SIZE,
SDS_ACCESS_MODE_NON_CACHED);
if (ret != SDS_OK) {
ERROR("Error getting platform info from SDS. ret:%d\n", ret);
panic();
}
#endif
arm_bl31_platform_setup();
}
#ifdef TARGET_PLATFORM_SOC
/*****************************************************************************
* 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)
{
int ssc_version;
ssc_version = mmio_read_32(SSC_VERSION);
return (int32_t)
(SOC_ID_SET_JEP_106(ARM_SOC_CONTINUATION_CODE,
ARM_SOC_IDENTIFICATION_CODE) |
(GET_SSC_VERSION_PART_NUM(ssc_version) & SOC_ID_IMPL_DEF_MASK));
}
/* Get SOC revision */
int32_t plat_get_soc_revision(void)
{
return (int32_t)plat_info.silicon_revision;
}
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,7 +21,7 @@
#ifdef TARGET_PLATFORM_FVP
# define MORELLO_SDS_PLATFORM_INFO_SIZE U(8)
#else
# define MORELLO_SDS_PLATFORM_INFO_SIZE U(22)
# define MORELLO_SDS_PLATFORM_INFO_SIZE U(26)
#endif
#define MORELLO_MAX_DDR_CAPACITY U(0x1000000000)
#define MORELLO_MAX_REMOTE_CHIP_COUNT U(16)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Arm Limited. All rights reserved.
* Copyright (c) 2021-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -34,6 +34,7 @@ struct morello_plat_info {
* - remote_chip_count
* - multichip mode
* - scc configuration
* - silicon revision
*/
struct morello_plat_info {
uint64_t local_ddr_size;
@ -41,6 +42,7 @@ struct morello_plat_info {
uint8_t remote_chip_count;
bool multichip_mode;
uint32_t scc_config;
uint32_t silicon_revision;
} __packed;
#endif