aboutsummaryrefslogtreecommitdiff
path: root/product/tc0/scp_ramfw/config_scmi.c
blob: 21a2d4669161f692a18447b700501bb1064b2f17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Arm SCP/MCP Software
 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "tc0_scmi.h"

#include <mod_scmi.h>
#include <mod_smt.h>

#include <fwk_element.h>
#include <fwk_id.h>
#include <fwk_macros.h>
#include <fwk_module.h>
#include <fwk_module_idx.h>

static const struct fwk_element service_table[] = {
    [SCP_TC0_SCMI_SERVICE_IDX_PSCI] =
        {
            .name = "PSCI",
            .data = &((struct mod_scmi_service_config){
                .transport_id = FWK_ID_ELEMENT_INIT(
                    FWK_MODULE_IDX_SMT,
                    SCP_TC0_SCMI_SERVICE_IDX_PSCI),
                .transport_api_id = FWK_ID_API_INIT(
                    FWK_MODULE_IDX_SMT,
                    MOD_SMT_API_IDX_SCMI_TRANSPORT),
                .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT(
                    FWK_MODULE_IDX_SMT,
                    MOD_SMT_NOTIFICATION_IDX_INITIALIZED),
                .scmi_agent_id = SCP_SCMI_AGENT_ID_PSCI,
                .scmi_p2a_id = FWK_ID_NONE_INIT,
            }),
        },
    [SCP_TC0_SCMI_SERVICE_IDX_OSPM] =
        {
            .name = "OSPM",
            .data = &((struct mod_scmi_service_config){
                .transport_id = FWK_ID_ELEMENT_INIT(
                    FWK_MODULE_IDX_SMT,
                    SCP_TC0_SCMI_SERVICE_IDX_OSPM),
                .transport_api_id = FWK_ID_API_INIT(
                    FWK_MODULE_IDX_SMT,
                    MOD_SMT_API_IDX_SCMI_TRANSPORT),
                .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT(
                    FWK_MODULE_IDX_SMT,
                    MOD_SMT_NOTIFICATION_IDX_INITIALIZED),
                .scmi_agent_id = SCP_SCMI_AGENT_ID_OSPM,
                .scmi_p2a_id = FWK_ID_NONE_INIT,
            }),
        },
    [SCP_TC0_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 = {
    .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_service_table),
    .data = &((struct mod_scmi_config){
        .protocol_count_max = 9,
        .agent_count = FWK_ARRAY_SIZE(agent_table),
        .agent_table = agent_table,
        .vendor_identifier = "arm",
        .sub_vendor_identifier = "arm",
    }),
};