1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2022, Linaro Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include <fwk_module.h>
9 #include <mod_mock_ppu.h>
10 #include "config_mock_ppu.h"
11
12 uint32_t vppu_regdbg[16];
13 uint32_t vppu_regdpu0[16];
14 uint32_t vppu_regdpu1[16];
15 uint32_t vppu_reggpu[16];
16 uint32_t vppu_regvpu[16];
17 uint32_t vppu_regsys0[16];
18 uint32_t vppu_regsys1[16];
19 uint32_t vppu_regcluster[16];
20 uint32_t vppu_regsys[16];
21
22 static struct fwk_element host_ppu_v0_element_table[] = {
23 [MOCK_PPU_ELEMENT_IDX_CPU0] = {
24 .name = "CPU0",
25 .data = &((struct mod_mock_ppu_pd_config) {
26 .pd_type = MOD_PD_TYPE_DEVICE,
27 .ppu.reg_base = (uintptr_t)vppu_regcluster,
28 }),
29 },
30 [MOCK_PPU_ELEMENT_IDX_CPU1] = {
31 .name = "CPU1",
32 .data = &((struct mod_mock_ppu_pd_config) {
33 .pd_type = MOD_PD_TYPE_DEVICE,
34 .ppu.reg_base = (uintptr_t)vppu_regcluster,
35 }),
36 },
37 [MOCK_PPU_ELEMENT_IDX_CPU2] = {
38 .name = "CPU2",
39 .data = &((struct mod_mock_ppu_pd_config) {
40 .pd_type = MOD_PD_TYPE_DEVICE,
41 .ppu.reg_base = (uintptr_t)vppu_regcluster,
42 }),
43 },
44 [MOCK_PPU_ELEMENT_IDX_CPU3] = {
45 .name = "CPU3",
46 .data = &((struct mod_mock_ppu_pd_config) {
47 .pd_type = MOD_PD_TYPE_DEVICE,
48 .ppu.reg_base = (uintptr_t)vppu_regcluster,
49 }),
50 },
51 [MOCK_PPU_ELEMENT_IDX_CLUSTER0] = {
52 .name = "CLUSTER0",
53 .data = &((struct mod_mock_ppu_pd_config) {
54 .pd_type = MOD_PD_TYPE_DEVICE,
55 .ppu.reg_base = (uintptr_t)vppu_regcluster,
56 }),
57 },
58 [MOCK_PPU_ELEMENT_IDX_CLUSTER1] = {
59 .name = "CLUSTER1",
60 .data = &((struct mod_mock_ppu_pd_config) {
61 .pd_type = MOD_PD_TYPE_DEVICE,
62 .ppu.reg_base = (uintptr_t)vppu_regcluster,
63 }),
64 },
65 [MOCK_PPU_ELEMENT_IDX_DBGTOP] = {
66 .name = "DBGTOP",
67 .data = &((struct mod_mock_ppu_pd_config) {
68 .pd_type = MOD_PD_TYPE_DEVICE_DEBUG,
69 .ppu.reg_base = (uintptr_t)vppu_regdbg,
70 }),
71 },
72 [MOCK_PPU_ELEMENT_IDX_DPU0TOP] = {
73 .name = "DPU0TOP",
74 .data = &((struct mod_mock_ppu_pd_config) {
75 .pd_type = MOD_PD_TYPE_DEVICE,
76 .ppu.reg_base = (uintptr_t)vppu_regdpu0,
77 .default_power_on = true,
78 }),
79 },
80 [MOCK_PPU_ELEMENT_IDX_DPU1TOP] = {
81 .name = "DPU1TOP",
82 .data = &((struct mod_mock_ppu_pd_config) {
83 .pd_type = MOD_PD_TYPE_DEVICE,
84 .ppu.reg_base = (uintptr_t)vppu_regdpu1,
85 .default_power_on = true,
86 }),
87 },
88 [MOCK_PPU_ELEMENT_IDX_GPUTOP] = {
89 .name = "GPUTOP",
90 .data = &((struct mod_mock_ppu_pd_config) {
91 .pd_type = MOD_PD_TYPE_DEVICE,
92 .ppu.reg_base = (uintptr_t)vppu_reggpu,
93 .default_power_on = true,
94 }),
95 },
96 [MOCK_PPU_ELEMENT_IDX_VPUTOP] = {
97 .name = "VPUTOP",
98 .data = &((struct mod_mock_ppu_pd_config) {
99 .pd_type = MOD_PD_TYPE_DEVICE,
100 .ppu.reg_base = (uintptr_t)vppu_regvpu,
101 .default_power_on = true,
102 }),
103 },
104 [MOCK_PPU_ELEMENT_IDX_SYS0] = {
105 .name = "SYS0",
106 .data = &((struct mod_mock_ppu_pd_config) {
107 .pd_type = MOD_PD_TYPE_SYSTEM,
108 .ppu.reg_base = (uintptr_t)vppu_regsys0,
109 }),
110 },
111 [MOCK_PPU_ELEMENT_IDX_SYS1] = {
112 .name = "SYS1",
113 .data = &((struct mod_mock_ppu_pd_config) {
114 .pd_type = MOD_PD_TYPE_SYSTEM,
115 .ppu.reg_base = (uintptr_t)vppu_regsys1,
116 }),
117 },
118 [MOCK_PPU_ELEMENT_IDX_SYSTEM] = {
119 .name = "SYSTEM",
120 .data = &((struct mod_mock_ppu_pd_config) {
121 .pd_type = MOD_PD_TYPE_DEVICE,
122 .ppu.reg_base = (uintptr_t)vppu_regsys,
123 .default_power_on = true,
124 }),
125 },
126 [MOCK_PPU_ELEMENT_IDX_COUNT] = { 0 }, /* Termination entry */
127 };
128
129
mock_ppu_get_element_table(fwk_id_t module_id)130 static const struct fwk_element *mock_ppu_get_element_table(fwk_id_t module_id)
131 {
132 return host_ppu_v0_element_table;
133 }
134
135 /*
136 * Power module configuration data
137 */
138 struct fwk_module_config config_mock_ppu = {
139 .elements = FWK_MODULE_DYNAMIC_ELEMENTS(mock_ppu_get_element_table),
140 };
141