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 #include "clock_soc.h"
9 #include "scp_css_mmap.h"
10 
11 #include <mod_cmn_booker.h>
12 
13 #include <fwk_id.h>
14 #include <fwk_macros.h>
15 #include <fwk_module.h>
16 #include <fwk_module_idx.h>
17 
18 /*
19  * CMN_BOOKER nodes
20  */
21 #define MEM_CNTRL0_ID 2
22 #define MEM_CNTRL1_ID 14
23 #define MEM_CNTRL2_ID 38
24 #define MEM_CNTRL3_ID 46
25 #define NODE_ID_HND 4
26 
27 static const unsigned int snf_table[] = {
28     MEM_CNTRL0_ID, /* Maps to HN-F logical node 0 */
29     MEM_CNTRL1_ID, /* Maps to HN-F logical node 1 */
30     MEM_CNTRL2_ID, /* Maps to HN-F logical node 2 */
31     MEM_CNTRL3_ID, /* Maps to HN-F logical node 3 */
32 };
33 
34 static const struct mod_cmn_booker_mem_region_map mmap[] = {
35     {
36         /*
37          * System cache backed region
38          * Map: 0x0000_0000_0000 - 0x003FF_FFFF_FFFF (4 TB)
39          */
40         .base = UINT64_C(0x000000000000),
41         .size = UINT64_C(1) * FWK_TIB,
42         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_SYSCACHE,
43     },
44     {
45         /*
46          * Boot region
47          * Map: 0x0000_0000_0000 - 0x0000_07FF_FFFF (128 MB)
48          */
49         .base = UINT64_C(0x000000000000),
50         .size = UINT64_C(128) * FWK_MIB,
51         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
52         .node_id = NODE_ID_HND,
53     },
54     {
55         /*
56          * Peripherals
57          * Map: 0x00_0800_0000 - 0x00_0FFF_FFFF (128 MB)
58          */
59         .base = UINT64_C(0x0008000000),
60         .size = UINT64_C(128) * FWK_MIB,
61         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
62         .node_id = NODE_ID_HND,
63     },
64     {
65         /*
66          * Peripherals
67          * Map: 0x00_1000_0000 - 0x00_1FFF_FFFF (256 MB)
68          */
69         .base = UINT64_C(0x0010000000),
70         .size = UINT64_C(256) * FWK_MIB,
71         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
72         .node_id = NODE_ID_HND,
73     },
74     {
75         /*
76          * Peripherals
77          * Map: 0x00_2000_0000 - 0x00_3FFF_FFFF (512 MB)
78          */
79         .base = UINT64_C(0x0020000000),
80         .size = UINT64_C(512) * FWK_MIB,
81         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
82         .node_id = NODE_ID_HND,
83     },
84     {
85         /*
86          * Peripherals
87          * Map: 0x00_4000_0000 - 0x00_7FFF_FFFF (1 GB)
88          */
89         .base = UINT64_C(0x0040000000),
90         .size = UINT64_C(1) * FWK_GIB,
91         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
92         .node_id = NODE_ID_HND,
93     },
94     {
95         /*
96          * Peripherals
97          * Map: 0x01_0000_0000 - 0x01_03FF_FFFF (64 MB)
98          */
99         .base = UINT64_C(0x0100000000),
100         .size = UINT64_C(64) * FWK_MIB,
101         .type = MOD_CMN_BOOKER_MEM_REGION_TYPE_IO,
102         .node_id = NODE_ID_HND,
103     },
104 };
105 
106 const struct fwk_module_config config_cmn_booker = {
107     .data = &((struct mod_cmn_booker_config){
108         .base = SCP_CMN_BOOKER_BASE,
109         .mesh_size_x = 2,
110         .mesh_size_y = 2,
111         .hnd_node_id = NODE_ID_HND,
112         .snf_table = snf_table,
113         .snf_count = FWK_ARRAY_SIZE(snf_table),
114         .mmap_table = mmap,
115         .mmap_count = FWK_ARRAY_SIZE(mmap),
116         .clock_id = FWK_ID_ELEMENT_INIT(
117             FWK_MODULE_IDX_CLOCK,
118             CLOCK_IDX_CPU_GROUP_KLEIN),
119         .hnf_cal_mode = false,
120         .ports_per_xp = 4,
121     }),
122 };
123