]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-firmware/system-firmware-image-gen.git/blob - include/common.h
Makefile: Fix HS builds by removing version reporting dependency
[processor-firmware/system-firmware-image-gen.git] / include / common.h
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  */
36 #ifndef COMMON_H
37 #define COMMON_H
39 #include <sysfw_img_cfg.h>
40 #include <devices.h>
41 #include <hosts.h>
42 #include <resasg_types.h>
44 /**
45  * Standard Linux Kernel integer types
46  */
47 typedef signed char s8;
48 typedef unsigned char u8;
50 typedef signed short s16;
51 typedef unsigned short u16;
53 typedef signed int s32;
54 typedef unsigned int u32;
56 typedef signed long long s64;
57 typedef unsigned long long u64;
59 /**
60  * Fault tolerant boolean type (specific to SYSFW)
61  */
62 typedef u8 ftbool;
64 /**
65  * Basic bit operations
66  */
67 #define BIT(n)          (1UL << (n))
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
83 struct boardcfg_substructure_header {
84         u16     magic;
85         u16     size;
86 } __attribute__((__packed__));
88 struct boardcfg_abi_rev {
89         u8      boardcfg_abi_maj;
90         u8      boardcfg_abi_min;
91 } __attribute__((__packed__));
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__));
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__));
109 struct boardcfg_msmc {
110         struct boardcfg_substructure_header     subhdr;
111         u8                                      msmc_cache_size;
112 } __attribute__((__packed__));
115 #define BOARDCFG_TRACE_DST_UART0                BIT(0)
116 #define BOARDCFG_TRACE_DST_ITM                  BIT(2)
117 #define BOARDCFG_TRACE_DST_MEM                  BIT(3)
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)
126 struct boardcfg_dbg_cfg {
127         struct boardcfg_substructure_header     subhdr;
128         u16                                     trace_dst_enables;
129         u16                                     trace_src_enables;
130 } __attribute__((__packed__));
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__));
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__));
149 #define BOARDCFG_RM_HOST_CFG_ENTRIES (32U)
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 };
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 };
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__));
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__));
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__));
189 /**
190  * Definitions, types, etc. as used for the security configuration
191  */
192 #define PROCESSOR_ACL_SECONDARY_MASTERS_MAX     3
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__));
200 #define PROCESSOR_ACL_ENTRIES                   32
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__));
207 struct boardcfg_host_hierarchy_entry {
208         u8                                      host_id;
209         u8                                      supervisor_host_id;
210 } __attribute__((__packed__));
212 #define HOST_HIERARCHY_ENTRIES                  32
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__));
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__));
226 /**
227  * Definitions, types, etc. as used for PM configuration
228  */
229 struct boardcfg_pm {
230         struct boardcfg_abi_rev                 rev;
231 } __attribute__((__packed__));
233 #endif /* COMMON_H */