1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2017-2022, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include "config_power_domain.h"
9 #include "rdn1e1_core.h"
10 #include "scp_rdn1e1_mhu.h"
11 #include "scp_rdn1e1_scmi.h"
12 #include "scp_software_mmap.h"
13
14 #include <mod_transport.h>
15
16 #include <fwk_element.h>
17 #include <fwk_id.h>
18 #include <fwk_module.h>
19 #include <fwk_module_idx.h>
20
21 #include <stdint.h>
22
23 static const struct fwk_element transport_element_table[] = {
24 /* SCP_RDN1E1_SCMI_SERVICE_IDX_PSCI */
25 { .name = "PSCI",
26 .data = &((struct mod_transport_channel_config){
27 .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_COMPLETER,
28 .policies =
29 MOD_TRANSPORT_POLICY_INIT_MAILBOX | MOD_TRANSPORT_POLICY_SECURE,
30 .out_band_mailbox_address = (uintptr_t)SCP_SCMI_PAYLOAD_S_A2P_BASE,
31 .out_band_mailbox_size = SCP_SCMI_PAYLOAD_SIZE,
32 .driver_id = FWK_ID_SUB_ELEMENT_INIT(
33 FWK_MODULE_IDX_MHU2,
34 SCP_RDN1E1_MHU_DEVICE_IDX_SCP_AP_S_CLUS0,
35 0),
36 .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MHU2, 0),
37 }) },
38 /* SCP_RDN1E1_SCMI_SERVICE_IDX_OSPM */
39 { .name = "OSPM",
40 .data = &((struct mod_transport_channel_config){
41 .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_COMPLETER,
42 .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX,
43 .out_band_mailbox_address = (uintptr_t)SCP_SCMI_PAYLOAD_NS_A2P_BASE,
44 .out_band_mailbox_size = SCP_SCMI_PAYLOAD_SIZE,
45 .driver_id = FWK_ID_SUB_ELEMENT_INIT(
46 FWK_MODULE_IDX_MHU2,
47 SCP_RDN1E1_MHU_DEVICE_IDX_SCP_AP_NS_CLUS0,
48 0),
49 .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MHU2, 0),
50 }) },
51 [SCP_RDN1E1_SCMI_SERVICE_IDX_COUNT] = { 0 },
52 };
53
transport_get_element_table(fwk_id_t module_id)54 static const struct fwk_element *transport_get_element_table(fwk_id_t module_id)
55 {
56 unsigned int idx;
57 struct mod_transport_channel_config *config;
58
59 for (idx = 0; idx < SCP_RDN1E1_SCMI_SERVICE_IDX_COUNT; idx++) {
60 config =
61 (struct mod_transport_channel_config *)(transport_element_table[idx]
62 .data);
63 config->pd_source_id = FWK_ID_ELEMENT(
64 FWK_MODULE_IDX_POWER_DOMAIN,
65 rdn1e1_core_get_core_count() + rdn1e1_core_get_cluster_count() +
66 PD_STATIC_DEV_IDX_SYSTOP);
67 }
68
69 return transport_element_table;
70 }
71
72 const struct fwk_module_config config_transport = {
73 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(transport_get_element_table),
74 };
75