diff options
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h new file mode 100644 index 000000000..83c900cab --- /dev/null +++ b/include/common.h | |||
@@ -0,0 +1,233 @@ | |||
1 | /* | ||
2 | * K3 System Firmware Board Configuration Data Structures | ||
3 | * | ||
4 | * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * Andreas Dannenberg <dannenberg@ti.com> | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions | ||
9 | * are met: | ||
10 | * | ||
11 | * Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * | ||
14 | * Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in the | ||
16 | * documentation and/or other materials provided with the | ||
17 | * distribution. | ||
18 | * | ||
19 | * Neither the name of Texas Instruments Incorporated nor the names of | ||
20 | * its contributors may be used to endorse or promote products derived | ||
21 | * from this software without specific prior written permission. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
34 | */ | ||
35 | |||
36 | #ifndef COMMON_H | ||
37 | #define COMMON_H | ||
38 | |||
39 | #include <sysfw_img_cfg.h> | ||
40 | #include <devices.h> | ||
41 | #include <hosts.h> | ||
42 | #include <resasg_types.h> | ||
43 | |||
44 | /** | ||
45 | * Standard Linux Kernel integer types | ||
46 | */ | ||
47 | typedef signed char s8; | ||
48 | typedef unsigned char u8; | ||
49 | |||
50 | typedef signed short s16; | ||
51 | typedef unsigned short u16; | ||
52 | |||
53 | typedef signed int s32; | ||
54 | typedef unsigned int u32; | ||
55 | |||
56 | typedef signed long long s64; | ||
57 | typedef unsigned long long u64; | ||
58 | |||
59 | /** | ||
60 | * Fault tolerant boolean type (specific to SYSFW) | ||
61 | */ | ||
62 | typedef u8 ftbool; | ||
63 | |||
64 | /** | ||
65 | * Basic bit operations | ||
66 | */ | ||
67 | #define BIT(n) (1UL << (n)) | ||
68 | |||
69 | /** | ||
70 | * Various definitions as expected by the 'struct' declarations below | ||
71 | */ | ||
72 | #define BOARDCFG_RM_HOST_CFG_MAGIC_NUM 0x4C41 | ||
73 | #define BOARDCFG_RM_RESASG_MAGIC_NUM 0x7B25 | ||
74 | #define BOARDCFG_CONTROL_MAGIC_NUM 0xC1D3 | ||
75 | #define BOARDCFG_SECPROXY_MAGIC_NUM 0x1207 | ||
76 | #define BOARDCFG_MSMC_MAGIC_NUM 0xA5C3 | ||
77 | #define BOARDCFG_PROC_ACL_MAGIC_NUM 0xF1EA | ||
78 | #define BOARDCFG_HOST_HIERARCHY_MAGIC_NUM 0x8D27 | ||
79 | #define BOARDCFG_RESASG_MAGIC_NUM 0x4C41 | ||
80 | #define BOARDCFG_DBG_CFG_MAGIC_NUM 0x020C | ||
81 | #define BOARDCFG_PMIC_CFG_MAGIC_NUM 0x3172 | ||
82 | |||
83 | struct boardcfg_substructure_header { | ||
84 | u16 magic; | ||
85 | u16 size; | ||
86 | } __attribute__((__packed__)); | ||
87 | |||
88 | struct boardcfg_abi_rev { | ||
89 | u8 boardcfg_abi_maj; | ||
90 | u8 boardcfg_abi_min; | ||
91 | } __attribute__((__packed__)); | ||
92 | |||
93 | /** | ||
94 | * Definitions, types, etc. as used for general board configuration | ||
95 | */ | ||
96 | struct boardcfg_control { | ||
97 | struct boardcfg_substructure_header subhdr; | ||
98 | ftbool main_isolation_enable; | ||
99 | u16 main_isolation_hostid; | ||
100 | } __attribute__((__packed__)); | ||
101 | |||
102 | struct boardcfg_secproxy { | ||
103 | struct boardcfg_substructure_header subhdr; | ||
104 | u8 scaling_factor; | ||
105 | u8 scaling_profile; | ||
106 | u8 disable_main_nav_secure_proxy; | ||
107 | } __attribute__((__packed__)); | ||
108 | |||
109 | struct boardcfg_msmc { | ||
110 | struct boardcfg_substructure_header subhdr; | ||
111 | u8 msmc_cache_size; | ||
112 | } __attribute__((__packed__)); | ||
113 | |||
114 | |||
115 | #define BOARDCFG_TRACE_DST_UART0 BIT(0) | ||
116 | #define BOARDCFG_TRACE_DST_ITM BIT(2) | ||
117 | #define BOARDCFG_TRACE_DST_MEM BIT(3) | ||
118 | |||
119 | #define BOARDCFG_TRACE_SRC_PM BIT(0) | ||
120 | #define BOARDCFG_TRACE_SRC_RM BIT(1) | ||
121 | #define BOARDCFG_TRACE_SRC_SEC BIT(2) | ||
122 | #define BOARDCFG_TRACE_SRC_BASE BIT(3) | ||
123 | #define BOARDCFG_TRACE_SRC_USER BIT(4) | ||
124 | #define BOARDCFG_TRACE_SRC_SUPR BIT(5) | ||
125 | |||
126 | struct boardcfg_dbg_cfg { | ||
127 | struct boardcfg_substructure_header subhdr; | ||
128 | u16 trace_dst_enables; | ||
129 | u16 trace_src_enables; | ||
130 | } __attribute__((__packed__)); | ||
131 | |||
132 | struct boardcfg { | ||
133 | struct boardcfg_abi_rev rev; | ||
134 | struct boardcfg_control control; | ||
135 | struct boardcfg_secproxy secproxy; | ||
136 | struct boardcfg_msmc msmc; | ||
137 | struct boardcfg_dbg_cfg debug_cfg; | ||
138 | } __attribute__((__packed__)); | ||
139 | |||
140 | struct boardcfg_rm_host_cfg_entry { | ||
141 | u8 host_id; | ||
142 | u8 allowed_atype; | ||
143 | u16 allowed_qos; | ||
144 | u32 allowed_orderid; | ||
145 | u16 allowed_priority; | ||
146 | u8 allowed_sched_priority; | ||
147 | } __attribute__((__packed__)); | ||
148 | |||
149 | #define BOARDCFG_RM_HOST_CFG_ENTRIES (32U) | ||
150 | |||
151 | struct boardcfg_rm_host_cfg { | ||
152 | struct boardcfg_substructure_header subhdr; | ||
153 | struct boardcfg_rm_host_cfg_entry | ||
154 | host_cfg_entries[BOARDCFG_RM_HOST_CFG_ENTRIES]; | ||
155 | }; | ||
156 | |||
157 | struct boardcfg_rm_resasg_entry { | ||
158 | u16 start_resource; | ||
159 | u16 num_resource; | ||
160 | u16 type; | ||
161 | u8 host_id; | ||
162 | u8 reserved; | ||
163 | }; | ||
164 | |||
165 | struct boardcfg_rm_resasg { | ||
166 | struct boardcfg_substructure_header subhdr; | ||
167 | u16 resasg_entries_size; | ||
168 | u16 reserved; | ||
169 | struct boardcfg_rm_resasg_entry resasg_entries[]; | ||
170 | } __attribute__((__packed__)); | ||
171 | |||
172 | struct boardcfg_rm { | ||
173 | struct boardcfg_abi_rev rev; | ||
174 | struct boardcfg_rm_host_cfg host_cfg; | ||
175 | struct boardcfg_rm_resasg resasg; | ||
176 | } __attribute__((__packed__)); | ||
177 | |||
178 | /* | ||
179 | * This is essentially 'struct boardcfg_rm', but modified to pull | ||
180 | * .resasg_entries which is a member of 'struct boardcfg_rm_resasg' into | ||
181 | * the outer structure for easier explicit initialization. | ||
182 | */ | ||
183 | struct boardcfg_rm_local { | ||
184 | struct boardcfg_rm rm_boardcfg; | ||
185 | struct boardcfg_rm_resasg_entry | ||
186 | resasg_entries[BOARDCFG_RM_RESASG_ENTRIES]; | ||
187 | } __attribute__((__packed__)); | ||
188 | |||
189 | /** | ||
190 | * Definitions, types, etc. as used for the security configuration | ||
191 | */ | ||
192 | #define PROCESSOR_ACL_SECONDARY_MASTERS_MAX 3 | ||
193 | |||
194 | struct boardcfg_proc_acl_entry { | ||
195 | u8 processor_id; | ||
196 | u8 proc_access_master; | ||
197 | u8 proc_access_secondary[PROCESSOR_ACL_SECONDARY_MASTERS_MAX]; | ||
198 | } __attribute__((__packed__)); | ||
199 | |||
200 | #define PROCESSOR_ACL_ENTRIES 32 | ||
201 | |||
202 | struct boardcfg_proc_acl { | ||
203 | struct boardcfg_substructure_header subhdr; | ||
204 | struct boardcfg_proc_acl_entry proc_acl_entries[PROCESSOR_ACL_ENTRIES]; | ||
205 | } __attribute__((__packed__)); | ||
206 | |||
207 | struct boardcfg_host_hierarchy_entry { | ||
208 | u8 host_id; | ||
209 | u8 supervisor_host_id; | ||
210 | } __attribute__((__packed__)); | ||
211 | |||
212 | #define HOST_HIERARCHY_ENTRIES 32 | ||
213 | |||
214 | struct boardcfg_host_hierarchy { | ||
215 | struct boardcfg_substructure_header subhdr; | ||
216 | struct boardcfg_host_hierarchy_entry | ||
217 | host_hierarchy_entries[HOST_HIERARCHY_ENTRIES]; | ||
218 | } __attribute__((__packed__)); | ||
219 | |||
220 | struct boardcfg_security { | ||
221 | struct boardcfg_abi_rev rev; | ||
222 | struct boardcfg_proc_acl processor_acl_list; | ||
223 | struct boardcfg_host_hierarchy host_hierarchy; | ||
224 | } __attribute__((__packed__)); | ||
225 | |||
226 | /** | ||
227 | * Definitions, types, etc. as used for PM configuration | ||
228 | */ | ||
229 | struct boardcfg_pm { | ||
230 | struct boardcfg_abi_rev rev; | ||
231 | } __attribute__((__packed__)); | ||
232 | |||
233 | #endif /* COMMON_H */ | ||