aboutsummaryrefslogtreecommitdiff
path: root/module/cmn600/include/mod_cmn600.h
blob: 70d69f575ba2ad413d550cb551d689366a2bb89a (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

/*
 * Arm SCP/MCP Software
 * Copyright (c) 2017-2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef MOD_CMN600_H
#define MOD_CMN600_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/*!
 * \addtogroup GroupModules Modules
 * @{
 */

/*!
 * \defgroup GroupModuleCMN600 CMN600
 *
 * \brief Arm Coherent Mesh Network (CMN) 600 module
 *
 * \details This module adds support for the CMN600 interconnect
 * @{
 */

/*!
 * \brief Max entries of the Memory Map table
 *        for the Home Agent.
 */
#define MAX_HA_MMAP_ENTRIES     4

/*!
 * \brief Module API indices
 */
enum mod_cmn600_api_idx {
    /*! Index of the PPU_V1 power state observer API */
    MOD_CMN600_API_IDX_PPU_OBSERVER,

    /*! Index of the CCIX config setup API */
    MOD_CMN600_API_IDX_CCIX_CONFIG,

    /*! Number of APIs */
    MOD_CMN600_API_COUNT
};

/*!
 * \brief Memory region configuration type
 */
enum mod_cmn600_memory_region_type {
    /*! Input/Output region (serviced by dedicated HN-I and HN-D nodes) */
    MOD_CMN600_MEMORY_REGION_TYPE_IO,

    /*!
     * Region backed by the system cache (serviced by all HN-F nodes in the
     * system)
     */
    MOD_CMN600_MEMORY_REGION_TYPE_SYSCACHE,

    /*!
     * Sub region of the system cache for non-hashed access (serviced by
     * HN-F nodes).
     */
    MOD_CMN600_REGION_TYPE_SYSCACHE_SUB,

    /*!
     * Region used for CCIX access.
     */
    MOD_CMN600_REGION_TYPE_CCIX,

    /*!
     * Non-hash regions in SYSCACHE group.
     */
    MOD_CMN600_REGION_TYPE_SYSCACHE_NONHASH,
};

/*!
 * \brief Memory region map descriptor
 */
struct mod_cmn600_memory_region_map {
    /*! Base address */
    uint64_t base;

    /*! Region size in bytes */
    uint64_t size;

    /*! Region configuration type */
    enum mod_cmn600_memory_region_type type;

    /*!
     * \brief Target node identifier
     *
     * \note Not used for \ref
     *      mod_cmn600_memory_region_type.MOD_CMN600_MEMORY_REGION_TYPE_SYSCACHE
     *      memory regions as it uses the pool of HN-F nodes available in the
     *      system
     */
    unsigned int node_id;
};

/*!
 * \brief CMN600 configuration data
 */
struct mod_cmn600_config {
    /*! Peripheral base address. */
    uintptr_t base;

    /*! Size along x-axis of the interconnect mesh */
    unsigned int mesh_size_x;

    /*! Size along y-axis of the interconnect mesh */
    unsigned int mesh_size_y;

    /*! Default HN-D node identifier containing the global configuration */
    unsigned int hnd_node_id;

    /*!
     * \brief Table of SN-Fs used as targets for the HN-F nodes
     *
     * \details Each entry of this table corresponds to a HN-F node in the
     *      system. The HN-F's logical identifiers are used as indices in this
     *      table
     */
    const unsigned int *snf_table;

    /*! Number of entries in the \ref snf_table */
    size_t snf_count;

    /*! Host SA count */
    unsigned int sa_count;

    /*! Host CXG LA Node id */
    unsigned int cxgla_node_id;

    /*! Table of region memory map entries */
    const struct mod_cmn600_memory_region_map *mmap_table;

    /*! Number of entries in the \ref mmap_table */
    size_t mmap_count;

    /*! Address space of the chip */
    uint64_t chip_addr_space;

    /*! Identifier of the clock that this device depends on */
    fwk_id_t clock_id;

    /*! Module ID for getting chip ID information */
    fwk_id_t chipinfo_mod_id;

    /*! API ID for getting chip ID information */
    fwk_id_t chipinfo_api_id;
};

/*!
 * \brief CCIX HA memory table entry structure
 */
struct mod_cmn600_ccix_ha_mmap {

    /*! HA node ID */
    uint8_t ha_id;

    /*! Base address */
    uint64_t base;

    /*! Region size in bytes */
    uint64_t size;
};


/*!
 * \brief CMN600 CCIX configuration data from remote node
 */
struct mod_cmn600_ccix_remote_node_config {
    /*! Remote RA count */
    uint8_t remote_ra_count;

    /*! Remote HA count */
    uint8_t remote_sa_count;

    /*! Remote HA count */
    uint8_t remote_ha_count;

    /*! PCIe traffic class used for CCIX Virtual Channel */
    uint8_t ccix_tc;

    /*! CCIX message packing flag */
    bool ccix_msg_pack_enable;

    /*! PCIe bus number on which CCIX link is enabled */
    uint8_t pcie_bus_num;

    /*! CCIX link identifier */
    uint8_t ccix_link_id;

    /*! optimised tlp mode */
    bool    ccix_opt_tlp;

    /*! Remote HA memory map table count */
    uint8_t remote_ha_mmap_count;

    /*! Remote HA memory map table */
    struct mod_cmn600_ccix_ha_mmap remote_ha_mmap[MAX_HA_MMAP_ENTRIES];
};

/*!
 * \brief CMN600 CCIX configuration data from host node
 */
struct mod_cmn600_ccix_host_node_config {
    /*! Host RA count */
    uint8_t host_ra_count;

    /*! Host SA count */
    uint8_t host_sa_count;

    /*! Host HA count */
    uint8_t host_ha_count;

    /*! CCIX HA memory map table count for endpoints */
    uint8_t ccix_host_mmap_count;

    /*! CCIX HA memory map table for endpoints */
    struct mod_cmn600_ccix_ha_mmap ccix_host_mmap[MAX_HA_MMAP_ENTRIES];

};

/*!
 * \brief CMN600 CCIX configuration interface
 */
struct mod_cmn600_ccix_config_api {
   /*!
    * \brief Get the CCIX host configuration
    *
    * \param[out] config CCIX host configuration
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*get_config)(struct mod_cmn600_ccix_host_node_config *config);
   /*!
    * \brief set the CCIX endpoint configuration
    *
    * \param[in] config CCIX endpoint configuration
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*set_config)(struct mod_cmn600_ccix_remote_node_config *config);
   /*!
    * \brief Interface to trigger the protocol credit exchange
    *
    * \param  link_id Link on which the protocol credit exchange
    *                 would initiate.
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*exchange_protocol_credit)(uint8_t link_id);
   /*!
    * \brief Interface to configure for system coherency
    *
    * \param  link_id Link on which the coherency has to
    *                 be enabled.
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*enter_system_coherency)(uint8_t link_id);
   /*!
    * \brief Interface to enter DVM domain
    *
    * \param  link_id Link on which DVM domain has to be enabled
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*enter_dvm_domain)(uint8_t link_id);
};

/*!
 * \brief API to read chip information from platform
 */
struct mod_cmn600_chipinfo_api {
   /*!
    * \brief API to be implemented by all platforms using CMN-600.
    *        Used to get multichip mode and chip ID information from platform.
    *
    * \param  chip_id Pointer to storage where chip ID is stored.
    * \param  multichip_enabled Pointer to storage where multichip
    *                           flag is stored.
    *
    * \retval FWK_SUCCESS if the operation succeed.
    * \return one of the error code otherwise.
    */
   int (*get_chipinfo)(uint8_t *chip_id, bool *multichip_enabled);
};

/*!
 * @}
 */

/*!
 * @}
 */

#endif /* MOD_CMN600_H */