1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "platform_scmi.h"
9 
10 #include <mod_scmi.h>
11 #include <mod_transport.h>
12 
13 #include <fwk_element.h>
14 #include <fwk_id.h>
15 #include <fwk_macros.h>
16 #include <fwk_module.h>
17 #include <fwk_module_idx.h>
18 
19 static const struct fwk_element service_table[] = {
20     [SCP_PLATFORM_SCMI_SERVICE_IDX_PSCI] = {
21         .name = "SERVICE0",
22         .data = &((struct mod_scmi_service_config) {
23             .transport_id = FWK_ID_ELEMENT_INIT(
24                 FWK_MODULE_IDX_TRANSPORT,
25                 SCP_PLATFORM_SCMI_SERVICE_IDX_PSCI),
26             .transport_api_id = FWK_ID_API_INIT(
27                 FWK_MODULE_IDX_TRANSPORT,
28                 MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
29             .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT(
30                 FWK_MODULE_IDX_TRANSPORT,
31                 MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
32             .scmi_agent_id = SCP_SCMI_AGENT_ID_PSCI,
33             .scmi_p2a_id = FWK_ID_NONE_INIT,
34         }),
35     },
36     [SCP_PLATFORM_SCMI_SERVICE_IDX_COUNT] = { 0 }
37 };
38 
get_service_table(fwk_id_t module_id)39 static const struct fwk_element *get_service_table(fwk_id_t module_id)
40 {
41     return service_table;
42 }
43 
44 static struct mod_scmi_agent agent_table[] = {
45     [SCP_SCMI_AGENT_ID_PSCI] = {
46         .type = SCMI_AGENT_TYPE_PSCI,
47         .name = "PSCI",
48     },
49 };
50 
51 const struct fwk_module_config config_scmi = {
52     .data = &((struct mod_scmi_config){
53         .protocol_count_max = 9,
54         .agent_count = FWK_ARRAY_SIZE(agent_table) - 1,
55         .agent_table = agent_table,
56         .vendor_identifier = "arm",
57         .sub_vendor_identifier = "arm",
58     }),
59 
60     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_service_table),
61 };
62