1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "config_mhu.h"
9 #include "config_power_domain.h"
10 #include "config_scmi.h"
11 #include "synquacer_core.h"
12 #include "synquacer_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_SYNQUACER_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)MHU_PAYLOAD_S_BASE,
31           .out_band_mailbox_size = 256,
32           .driver_id = FWK_ID_SUB_ELEMENT_INIT(
33               FWK_MODULE_IDX_MHU,
34               SCP_SYNQUACER_MHU_DEVICE_IDX_SCP_AP_S,
35               0),
36           .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_MHU, 0),
37       }) },
38     [SCP_SYNQUACER_SCMI_SERVICE_IDX_COUNT] = { 0 },
39 };
40 
transport_get_element_table(fwk_id_t module_id)41 static const struct fwk_element *transport_get_element_table(fwk_id_t module_id)
42 {
43     unsigned int idx;
44     struct mod_transport_channel_config *config;
45 
46     for (idx = 0; idx < SCP_SYNQUACER_SCMI_SERVICE_IDX_COUNT; idx++) {
47         config =
48             (struct mod_transport_channel_config *)(transport_element_table[idx]
49                                                         .data);
50         config->pd_source_id = FWK_ID_ELEMENT(
51             FWK_MODULE_IDX_POWER_DOMAIN,
52             synquacer_core_get_core_count() +
53                 synquacer_core_get_cluster_count() + PD_STATIC_DEV_IDX_SYSTOP);
54     }
55 
56     return transport_element_table;
57 }
58 
59 const struct fwk_module_config config_transport = {
60     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(transport_get_element_table),
61 };
62