]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(morello): implement methods to retrieve soc-id information
authorChandni Cherukuri <chandni.cherukuri@arm.com>
Thu, 16 Feb 2023 14:52:32 +0000 (20:22 +0530)
committerChandni Cherukuri <chandni.cherukuri@arm.com>
Wed, 15 Mar 2023 05:03:08 +0000 (10:33 +0530)
Added silicon revision in the platform information SDS structure.

Implemented platform functions to retrieve the soc-id information
for the morello SoC platform. SoC revision, which is same as
silicon revision, is fetched from the morello_plat_info structure
and SoC version is populated with the part number from SSC_VERSION
register, and is reflected in bits[0:15] of soc-id.

Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Change-Id: I8e0c5b2bc21e393e6d638858cc2ea9f4638f04b9

plat/arm/board/morello/include/platform_def.h
plat/arm/board/morello/morello_bl2_setup.c
plat/arm/board/morello/morello_bl31_setup.c
plat/arm/board/morello/morello_def.h
plat/arm/board/morello/morello_image_load.c

index 08e2d60ed309f51435ebbbf73924b7a2a283193f..76e63aa78b3c41538f4c99d6a92401547d325c3a 100644 (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
  */
 /* 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 */
index da1f7ae10068197dd7aa1c3c551ae164df4e5a6a..ec87a8e3e60c0a3dd063305028a359801ae61ae3 100644 (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
 
index e04587dd3a438e411876b94b2bb3a611f7005194..8f0159239900c147bbc9127a0cab07a1a2737fd1 100644 (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
index f154924d93ebd90a3ba659d09d0f902bf1419bd2..2898774c54620b61f8d2e868a86336acefb3e45c 100644 (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)
index 52d46f3c5f64ff33ea0eee0ccb4d63c1afba919a..5fc87a05d45747785628cbdabe7092406df529c8 100644 (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