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 "morello_scp_scmi.h"
9
10 #include <internal/scmi.h>
11
12 #include <mod_scmi.h>
13 #include <mod_transport.h>
14
15 #include <fwk_element.h>
16 #include <fwk_id.h>
17 #include <fwk_macros.h>
18 #include <fwk_module.h>
19 #include <fwk_module_idx.h>
20
21 static const struct fwk_element service_table[] = {
22 [SCP_MORELLO_SCMI_SERVICE_IDX_PSCI] =
23 {
24 .name = "SERVICE0",
25 .data =
26 &(struct mod_scmi_service_config){
27 .transport_id = FWK_ID_ELEMENT_INIT(
28 FWK_MODULE_IDX_TRANSPORT,
29 SCP_MORELLO_SCMI_SERVICE_IDX_PSCI),
30 .transport_api_id = FWK_ID_API_INIT(
31 FWK_MODULE_IDX_TRANSPORT,
32 MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
33 .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT(
34 FWK_MODULE_IDX_TRANSPORT,
35 MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
36 .scmi_agent_id = SCP_SCMI_AGENT_ID_PSCI,
37 .scmi_p2a_id = FWK_ID_NONE_INIT,
38 },
39 },
40 [SCP_MORELLO_SCMI_SERVICE_IDX_OSPM] =
41 {
42 .name = "SERVICE1",
43 .data =
44 &(struct mod_scmi_service_config){
45 .transport_id = FWK_ID_ELEMENT_INIT(
46 FWK_MODULE_IDX_TRANSPORT,
47 SCP_MORELLO_SCMI_SERVICE_IDX_OSPM),
48 .transport_api_id = FWK_ID_API_INIT(
49 FWK_MODULE_IDX_TRANSPORT,
50 MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
51 .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT(
52 FWK_MODULE_IDX_TRANSPORT,
53 MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
54 .scmi_agent_id = SCP_SCMI_AGENT_ID_OSPM,
55 .scmi_p2a_id = FWK_ID_NONE_INIT,
56 },
57 },
58 [SCP_MORELLO_SCMI_SERVICE_IDX_MCP] =
59 {
60 .name = "SERVICE2",
61 .data =
62 &(struct mod_scmi_service_config){
63 .transport_id = FWK_ID_ELEMENT_INIT(
64 FWK_MODULE_IDX_TRANSPORT,
65 SCP_MORELLO_SCMI_SERVICE_IDX_MCP),
66 .transport_api_id = FWK_ID_API_INIT(
67 FWK_MODULE_IDX_TRANSPORT,
68 MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
69 .transport_notification_init_id = FWK_ID_NONE_INIT,
70 .scmi_agent_id = SCP_SCMI_AGENT_ID_MCP,
71 .scmi_p2a_id = FWK_ID_NONE_INIT,
72 },
73 },
74 [SCP_MORELLO_SCMI_SERVICE_IDX_COUNT] = { 0 }
75 };
76
get_service_table(fwk_id_t module_id)77 static const struct fwk_element *get_service_table(fwk_id_t module_id)
78 {
79 return service_table;
80 }
81
82 static struct mod_scmi_agent agent_table[] = {
83 [SCP_SCMI_AGENT_ID_OSPM] =
84 {
85 .type = SCMI_AGENT_TYPE_OSPM,
86 .name = "OSPM",
87 },
88 [SCP_SCMI_AGENT_ID_PSCI] =
89 {
90 .type = SCMI_AGENT_TYPE_PSCI,
91 .name = "PSCI",
92 },
93 [SCP_SCMI_AGENT_ID_MCP] =
94 {
95 .type = SCMI_AGENT_TYPE_MANAGEMENT,
96 .name = "MANAGEMENT",
97 },
98 };
99
100 const struct fwk_module_config config_scmi = {
101 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_service_table),
102 .data = &((struct mod_scmi_config){
103 .protocol_count_max = 8,
104 .agent_count = FWK_ARRAY_SIZE(agent_table) - 1,
105 .agent_table = agent_table,
106 .vendor_identifier = "arm",
107 .sub_vendor_identifier = "arm",
108 }),
109 };
110