aboutsummaryrefslogtreecommitdiff
path: root/product/n1sdp
diff options
context:
space:
mode:
authorManoj Kumar <manoj.kumar3@arm.com>2018-10-26 11:33:31 +0530
committerdavidcunado-arm <david.cunado@arm.com>2018-10-30 16:58:33 +0000
commit29dd7b65049e418be19d8f11eb39257ef1913177 (patch)
tree155fb74c3338fec4e871f6bcce7ae59ffa190287 /product/n1sdp
parent6e7eb5b397a6154d8991bb1b34b4f85beb147635 (diff)
n1sdp: scp_ramfw - add mhu/smt/sds/scmi config files
Change-Id: I95aef53be5c1c9ecf8e3a57e402eb3a8130e7e64 Signed-off-by: Manoj Kumar <manoj.kumar3@arm.com>
Diffstat (limited to 'product/n1sdp')
-rw-r--r--product/n1sdp/scp_ramfw/config_mhu.c54
-rw-r--r--product/n1sdp/scp_ramfw/config_scmi.c71
-rw-r--r--product/n1sdp/scp_ramfw/config_scmi_system_power.c17
-rw-r--r--product/n1sdp/scp_ramfw/config_sds.c102
-rw-r--r--product/n1sdp/scp_ramfw/config_smt.c66
5 files changed, 310 insertions, 0 deletions
diff --git a/product/n1sdp/scp_ramfw/config_mhu.c b/product/n1sdp/scp_ramfw/config_mhu.c
new file mode 100644
index 00000000..d63ad538
--- /dev/null
+++ b/product/n1sdp/scp_ramfw/config_mhu.c
@@ -0,0 +1,54 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <fwk_element.h>
+#include <fwk_id.h>
+#include <fwk_module.h>
+#include <mod_mhu.h>
+#include <n1sdp_scp_irq.h>
+#include <n1sdp_scp_mhu.h>
+#include <n1sdp_scp_mmap.h>
+
+static const struct fwk_element mhu_element_table[] = {
+ [N1SDP_MHU_DEVICE_IDX_S_CLUS0] = {
+ .name = "MHU_S_CLUSTER_0",
+ .sub_element_count = 1,
+ .data = &((struct mod_mhu_device_config) {
+ .irq = MHU_AP_SEC_IRQ,
+ .in = MHU_AP_TO_SCP_S(0),
+ .out = MHU_SCP_TO_AP_S(0),
+ })
+ },
+ [N1SDP_MHU_DEVICE_IDX_NS_CLUS0] = {
+ .name = "MHU_NS_CLUSTER_0",
+ .sub_element_count = 1,
+ .data = &((struct mod_mhu_device_config) {
+ .irq = MHU_AP_NONSEC_IRQ,
+ .in = MHU_AP_TO_SCP_NS(0),
+ .out = MHU_SCP_TO_AP_NS(0),
+ })
+ },
+ [N1SDP_MHU_DEVICE_IDX_S_MCP] = {
+ .name = "MHU_S_MCP",
+ .sub_element_count = 1,
+ .data = &((struct mod_mhu_device_config) {
+ .irq = MHU_MCP_SEC_IRQ,
+ .in = MHU_MCP_TO_SCP_S,
+ .out = MHU_SCP_TO_MCP_S,
+ })
+ },
+ [N1SDP_MHU_DEVICE_IDX_COUNT] = { 0 },
+};
+
+static const struct fwk_element *mhu_get_element_table(fwk_id_t module_id)
+{
+ return mhu_element_table;
+}
+
+struct fwk_module_config config_mhu = {
+ .get_element_table = mhu_get_element_table,
+};
diff --git a/product/n1sdp/scp_ramfw/config_scmi.c b/product/n1sdp/scp_ramfw/config_scmi.c
new file mode 100644
index 00000000..73e4963d
--- /dev/null
+++ b/product/n1sdp/scp_ramfw/config_scmi.c
@@ -0,0 +1,71 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <fwk_element.h>
+#include <fwk_id.h>
+#include <fwk_macros.h>
+#include <fwk_module.h>
+#include <fwk_module_idx.h>
+#include <mod_scmi.h>
+#include <internal/scmi.h>
+#include <mod_smt.h>
+#include <n1sdp_scp_scmi.h>
+
+static const struct fwk_element service_table[] = {
+ [SCP_N1SDP_SCMI_SERVICE_IDX_PSCI] = {
+ .name = "SERVICE0",
+ .data = &((struct mod_scmi_service_config) {
+ .transport_id = FWK_ID_ELEMENT_INIT(
+ FWK_MODULE_IDX_SMT,
+ SCP_N1SDP_SCMI_SERVICE_IDX_PSCI),
+ .transport_api_id = FWK_ID_API_INIT(
+ FWK_MODULE_IDX_SMT,
+ MOD_SMT_API_IDX_SCMI_TRANSPORT),
+ .scmi_agent_id = SCP_SCMI_AGENT_ID_PSCI,
+ }),
+ },
+ [SCP_N1SDP_SCMI_SERVICE_IDX_OSPM] = {
+ .name = "SERVICE1",
+ .data = &((struct mod_scmi_service_config) {
+ .transport_id = FWK_ID_ELEMENT_INIT(
+ FWK_MODULE_IDX_SMT,
+ SCP_N1SDP_SCMI_SERVICE_IDX_OSPM),
+ .transport_api_id = FWK_ID_API_INIT(
+ FWK_MODULE_IDX_SMT,
+ MOD_SMT_API_IDX_SCMI_TRANSPORT),
+ .scmi_agent_id = SCP_SCMI_AGENT_ID_OSPM,
+ }),
+ },
+ [SCP_N1SDP_SCMI_SERVICE_IDX_COUNT] = { 0 }
+};
+
+static const struct fwk_element *get_service_table(fwk_id_t module_id)
+{
+ return service_table;
+}
+
+static struct mod_scmi_agent agent_table[] = {
+ [SCP_SCMI_AGENT_ID_OSPM] = {
+ .type = SCMI_AGENT_TYPE_OSPM,
+ .name = "OSPM",
+ },
+ [SCP_SCMI_AGENT_ID_PSCI] = {
+ .type = SCMI_AGENT_TYPE_PSCI,
+ .name = "PSCI",
+ },
+};
+
+const struct fwk_module_config config_scmi = {
+ .get_element_table = get_service_table,
+ .data = &((struct mod_scmi_config) {
+ .protocol_count_max = 8,
+ .agent_count = FWK_ARRAY_SIZE(agent_table) - 1,
+ .agent_table = agent_table,
+ .vendor_identifier = "arm",
+ .sub_vendor_identifier = "arm",
+ }),
+};
diff --git a/product/n1sdp/scp_ramfw/config_scmi_system_power.c b/product/n1sdp/scp_ramfw/config_scmi_system_power.c
new file mode 100644
index 00000000..30408ae7
--- /dev/null
+++ b/product/n1sdp/scp_ramfw/config_scmi_system_power.c
@@ -0,0 +1,17 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <fwk_module.h>
+#include <mod_scmi_system_power.h>
+#include <mod_system_power.h>
+
+const struct fwk_module_config config_scmi_system_power = {
+ .data = &((struct mod_scmi_system_power_config) {
+ .system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
+ }),
+};
diff --git a/product/n1sdp/scp_ramfw/config_sds.c b/product/n1sdp/scp_ramfw/config_sds.c
new file mode 100644
index 00000000..d8832eb4
--- /dev/null
+++ b/product/n1sdp/scp_ramfw/config_sds.c
@@ -0,0 +1,102 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <fwk_element.h>
+#include <fwk_macros.h>
+#include <fwk_module.h>
+#include <fwk_module_idx.h>
+#include <mod_sds.h>
+#include <n1sdp_sds.h>
+#include <n1sdp_scp_mmap.h>
+#include <n1sdp_scp_pik.h>
+#include <n1sdp_scp_software_mmap.h>
+#include <config_clock.h>
+
+static const uint32_t version_packed = FWK_BUILD_VERSION;
+static const uint32_t feature_flags = (N1SDP_SDS_FEATURE_FIRMWARE_MASK |
+ N1SDP_SDS_FEATURE_DMC_MASK |
+ N1SDP_SDS_FEATURE_MESSAGING_MASK);
+
+const struct mod_sds_config sds_module_config = {
+ .region_base_address = SCP_SDS_MEM_BASE,
+ .region_size = SCP_SDS_MEM_SIZE,
+ .clock_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_CLOCK,
+ CLOCK_IDX_INTERCONNECT)
+};
+
+static struct fwk_element sds_element_table[] = {
+ {
+ .name = "CPU Info",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_CPU_INFO,
+ .size = N1SDP_SDS_CPU_INFO_SIZE,
+ .finalize = true,
+ }),
+ },
+ {
+ .name = "Firmware version",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_FIRMWARE_VERSION,
+ .size = N1SDP_SDS_FIRMWARE_VERSION_SIZE,
+ .payload = &version_packed,
+ .finalize = true,
+ }),
+ },
+ {
+ .name = "Reset Syndrome",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_RESET_SYNDROME,
+ .size = N1SDP_SDS_RESET_SYNDROME_SIZE,
+ .payload = (void *)(&PIK_SCP->RESET_SYNDROME),
+ .finalize = true,
+ }),
+ },
+ {
+ .name = "Feature Availability",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_FEATURE_AVAILABILITY,
+ .size = N1SDP_SDS_FEATURE_AVAILABILITY_SIZE,
+ .payload = &feature_flags,
+ .finalize = true,
+ }),
+ },
+#ifdef MODE_DEBUG
+ {
+ .name = "Boot Counters",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_CPU_BOOTCTR,
+ .size = N1SDP_SDS_CPU_BOOTCTR_SIZE,
+ .finalize = true,
+ }),
+ },
+ {
+ .name = "CPU Flags",
+ .data = &((struct mod_sds_structure_desc) {
+ .id = N1SDP_SDS_CPU_FLAGS,
+ .size = N1SDP_SDS_CPU_FLAGS_SIZE,
+ .finalize = true,
+ }),
+ },
+#endif
+ { 0 }, /* Termination description. */
+};
+
+static const struct fwk_element *sds_get_element_table(fwk_id_t module_id)
+{
+ static_assert(BUILD_VERSION_MAJOR < UINT8_MAX, "Invalid version size");
+ static_assert(BUILD_VERSION_MINOR < UINT8_MAX, "Invalid version size");
+ static_assert(BUILD_VERSION_PATCH < UINT16_MAX, "Invalid version size");
+
+ return sds_element_table;
+}
+
+struct fwk_module_config config_sds = {
+ .get_element_table = sds_get_element_table,
+ .data = &sds_module_config,
+};
diff --git a/product/n1sdp/scp_ramfw/config_smt.c b/product/n1sdp/scp_ramfw/config_smt.c
new file mode 100644
index 00000000..ad68948c
--- /dev/null
+++ b/product/n1sdp/scp_ramfw/config_smt.c
@@ -0,0 +1,66 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stdint.h>
+#include <fwk_element.h>
+#include <fwk_id.h>
+#include <fwk_module.h>
+#include <fwk_module_idx.h>
+#include <mod_smt.h>
+#include <n1sdp_core.h>
+#include <n1sdp_scp_mhu.h>
+#include <n1sdp_scp_mmap.h>
+#include <n1sdp_scp_scmi.h>
+#include <n1sdp_scp_software_mmap.h>
+#include <config_power_domain.h>
+
+static const struct fwk_element smt_element_table[] = {
+ [SCP_N1SDP_SCMI_SERVICE_IDX_PSCI] = {
+ .name = "PSCI",
+ .data = &((struct mod_smt_channel_config) {
+ .type = MOD_SMT_CHANNEL_TYPE_SLAVE,
+ .policies = MOD_SMT_POLICY_INIT_MAILBOX | MOD_SMT_POLICY_SECURE,
+ .mailbox_address = SCP_MHU_SECURE_RAM,
+ .mailbox_size = SCP_SCMI_PAYLOAD_SIZE,
+ .driver_id = FWK_ID_SUB_ELEMENT_INIT(FWK_MODULE_IDX_MHU,
+ N1SDP_MHU_DEVICE_IDX_S_CLUS0, 0),
+ .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MHU, 0),
+ })
+ },
+ [SCP_N1SDP_SCMI_SERVICE_IDX_OSPM] = {
+ .name = "OSPM",
+ .data = &((struct mod_smt_channel_config) {
+ .type = MOD_SMT_CHANNEL_TYPE_SLAVE,
+ .policies = MOD_SMT_POLICY_INIT_MAILBOX,
+ .mailbox_address = SCP_MHU_NONSECURE_RAM,
+ .mailbox_size = SCP_SCMI_PAYLOAD_SIZE,
+ .driver_id = FWK_ID_SUB_ELEMENT_INIT(FWK_MODULE_IDX_MHU,
+ N1SDP_MHU_DEVICE_IDX_NS_CLUS0, 0),
+ .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MHU, 0),
+ })
+ },
+ [SCP_N1SDP_SCMI_SERVICE_IDX_COUNT] = { 0 },
+};
+
+static const struct fwk_element *smt_get_element_table(fwk_id_t module_id)
+{
+ unsigned int idx;
+ struct mod_smt_channel_config *config;
+
+ for (idx = 0; idx < SCP_N1SDP_SCMI_SERVICE_IDX_COUNT; idx++) {
+ config =
+ (struct mod_smt_channel_config *)(smt_element_table[idx].data);
+ config->pd_source_id = FWK_ID_ELEMENT(FWK_MODULE_IDX_POWER_DOMAIN,
+ n1sdp_core_get_core_count() + PD_STATIC_DEV_IDX_SYSTOP);
+ }
+
+ return smt_element_table;
+}
+
+const struct fwk_module_config config_smt = {
+ .get_element_table = smt_get_element_table,
+};