1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef MOD_CMN_BOOKER_H
9 #define MOD_CMN_BOOKER_H
10 
11 #include <fwk_id.h>
12 
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 /*!
18  * \addtogroup GroupModules Modules
19  * \{
20  */
21 
22 /*!
23  * \defgroup GroupModuleCMN_BOOKER CMN_BOOKER
24  *
25  * \brief Arm Coherent Mesh Network (CMN) BOOKER module
26  *
27  * \details This module adds support for the CMN_BOOKER interconnect
28  * \{
29  */
30 
31 /*!
32  * \brief Module API indices
33  */
34 enum mod_cmn_booker_api_idx {
35     /*! Index of the PPU_V1 power state observer API */
36     MOD_CMN_BOOKER_API_IDX_PPU_OBSERVER,
37 
38     /*! Number of APIs */
39     MOD_CMN_BOOKER_API_COUNT
40 };
41 
42 /*!
43  * \brief Memory region configuration type
44  */
45 enum mod_cmn_booker_mem_region_type {
46     /*! Input/Output region (serviced by dedicated HN-I and HN-D nodes) */
47     MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
48 
49     /*!
50      * Region backed by the system cache (serviced by all HN-F nodes in the
51      * system)
52      */
53     MOD_CMN_BOOKER_MEM_REGION_TYPE_SYSCACHE,
54 
55     /*!
56      * Sub region of the system cache for non-hashed access (serviced by
57      * dedicated SN-F nodes).
58      */
59     MOD_CMN_BOOKER_REGION_TYPE_SYSCACHE_SUB,
60 };
61 
62 /*!
63  * \brief Memory region map descriptor
64  */
65 struct mod_cmn_booker_mem_region_map {
66     /*! Base address */
67     uint64_t base;
68 
69     /*! Region size in bytes */
70     uint64_t size;
71 
72     /*! Region configuration type */
73     enum mod_cmn_booker_mem_region_type type;
74 
75     /*!
76      * \brief Target node identifier
77      *
78      * \note Not used for ::mod_cmn_booker_mem_region_type.
79      *      MOD_CMN_BOOKER_MEM_REGION_TYPE_SYSCACHE
80      *      memory regions as it uses the pool of HN-F nodes available in the
81      *      system
82      */
83     unsigned int node_id;
84 };
85 
86 /*!
87  * \brief CMN_BOOKER configuration data
88  */
89 struct mod_cmn_booker_config {
90     /*! Peripheral base address. */
91     uintptr_t base;
92 
93     /*! Size along x-axis of the interconnect mesh */
94     unsigned int mesh_size_x;
95 
96     /*! Size along y-axis of the interconnect mesh */
97     unsigned int mesh_size_y;
98 
99     /*! Default HN-D node identifier containing the global configuration */
100     unsigned int hnd_node_id;
101 
102     /*!
103      * \brief Table of SN-Fs used as targets for the HN-F nodes
104      *
105      * \details Each entry of this table corresponds to a HN-F node in the
106      *      system. The HN-F's logical identifiers are used as indices in this
107      *      table
108      */
109     const unsigned int *snf_table;
110 
111     /*! Number of entries in the ::mod_cmn_booker_config::snf_table */
112     size_t snf_count;
113 
114     /*! Table of region memory map entries */
115     const struct mod_cmn_booker_mem_region_map *mmap_table;
116 
117     /*! Number of entries in the ::mod_cmn_booker_config::mmap_table */
118     size_t mmap_count;
119 
120     /*! Identifier of the clock that this device depends on */
121     fwk_id_t clock_id;
122 
123     /*!
124      * \brief HN-F with CAL support flag
125      * \details When set to true, enables HN-F with CAL support. This flag will
126      *      be used only if HN-F is found to be connected to CAL (When connected
127      *      to a CAL port, node id of HN-F will be a odd number).
128      */
129     bool hnf_cal_mode;
130 
131     /*! \
132      * \brief Number of device ports per XP
133      * \details The calculation for CFGM base address depends on the number of
134      *      ports per cross point
135      */
136     unsigned int ports_per_xp;
137 };
138 
139 /*!
140  * \}
141  */
142 
143 /*!
144  * \}
145  */
146 
147 #endif /* MOD_CMN_BOOKER_H */
148