aboutsummaryrefslogtreecommitdiffstats
blob: 08b9b4bdaaa7bf3e9b322c37a2723074519543ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
 * K3 System Firmware Board Configuration Data Structures
 *
 * Copyright (C) 2018-2020 Texas Instruments Incorporated - http://www.ti.com/
 *	Andreas Dannenberg <dannenberg@ti.com>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *    Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the
 *    distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef COMMON_H
#define COMMON_H

#include <sysfw_img_cfg.h>
#include <devices.h>
#include <hosts.h>
#include <resasg_types.h>

/**
 * Standard Linux Kernel integer types
 */
typedef signed char s8;
typedef unsigned char u8;

typedef signed short s16;
typedef unsigned short u16;

typedef signed int s32;
typedef unsigned int u32;

typedef signed long long s64;
typedef unsigned long long u64;

/**
 * Fault tolerant boolean type (specific to SYSFW)
 */
typedef u8 ftbool;

/**
 * Basic bit operations
 */
#define BIT(n)		(1UL << (n))

/**
 * Various definitions as expected by the 'struct' declarations below
 */
#define BOARDCFG_RM_HOST_CFG_MAGIC_NUM		0x4C41
#define BOARDCFG_RM_RESASG_MAGIC_NUM		0x7B25
#define BOARDCFG_CONTROL_MAGIC_NUM		0xC1D3
#define BOARDCFG_SECPROXY_MAGIC_NUM		0x1207
#define BOARDCFG_MSMC_MAGIC_NUM			0xA5C3
#define BOARDCFG_PROC_ACL_MAGIC_NUM		0xF1EA
#define BOARDCFG_HOST_HIERARCHY_MAGIC_NUM       0x8D27
#define BOARDCFG_RESASG_MAGIC_NUM		0x4C41
#define BOARDCFG_DBG_CFG_MAGIC_NUM		0x020C
#define BOARDCFG_PMIC_CFG_MAGIC_NUM		0x3172
#define BOARDCFG_OTP_CFG_MAGIC_NUM		0x4081
#define BOARDCFG_DKEK_CFG_MAGIC_NUM		0x5170
#define BOARDCFG_SA2UL_CFG_MAGIC_NUM_RSVD	0x23BE

struct boardcfg_substructure_header {
	u16	magic;
	u16	size;
} __attribute__((__packed__));

struct boardcfg_abi_rev {
	u8	boardcfg_abi_maj;
	u8	boardcfg_abi_min;
} __attribute__((__packed__));

/**
 * Definitions, types, etc. as used for general board configuration
 */
struct boardcfg_control {
	struct boardcfg_substructure_header	subhdr;
	ftbool					main_isolation_enable;
	u16					main_isolation_hostid;
} __attribute__((__packed__));

struct boardcfg_secproxy {
	struct boardcfg_substructure_header	subhdr;
	u8					scaling_factor;
	u8					scaling_profile;
	u8					disable_main_nav_secure_proxy;
} __attribute__((__packed__));

struct boardcfg_msmc {
	struct boardcfg_substructure_header	subhdr;
	u8					msmc_cache_size;
} __attribute__((__packed__));


#define BOARDCFG_TRACE_DST_UART0                BIT(0)
#define BOARDCFG_TRACE_DST_ITM                  BIT(2)
#define BOARDCFG_TRACE_DST_MEM                  BIT(3)

#define BOARDCFG_TRACE_SRC_PM                   BIT(0)
#define BOARDCFG_TRACE_SRC_RM                   BIT(1)
#define BOARDCFG_TRACE_SRC_SEC                  BIT(2)
#define BOARDCFG_TRACE_SRC_BASE                 BIT(3)
#define BOARDCFG_TRACE_SRC_USER                 BIT(4)
#define BOARDCFG_TRACE_SRC_SUPR                 BIT(5)

struct boardcfg_dbg_cfg {
	struct boardcfg_substructure_header	subhdr;
	u16					trace_dst_enables;
	u16					trace_src_enables;
} __attribute__((__packed__));

struct boardcfg {
	struct boardcfg_abi_rev			rev;
	struct boardcfg_control			control;
	struct boardcfg_secproxy		secproxy;
	struct boardcfg_msmc			msmc;
	struct boardcfg_dbg_cfg			debug_cfg;
} __attribute__((__packed__));

struct boardcfg_rm_host_cfg_entry {
	u8	host_id;
	u8	allowed_atype;
	u16	allowed_qos;
	u32	allowed_orderid;
	u16	allowed_priority;
	u8	allowed_sched_priority;
} __attribute__((__packed__));

#define BOARDCFG_RM_HOST_CFG_ENTRIES (32U)

struct boardcfg_rm_host_cfg {
	struct boardcfg_substructure_header	subhdr;
	struct boardcfg_rm_host_cfg_entry
				 host_cfg_entries[BOARDCFG_RM_HOST_CFG_ENTRIES];
};

struct boardcfg_rm_resasg_entry {
	u16					start_resource;
	u16					num_resource;
	u16					type;
	u8					host_id;
	u8					reserved;
};

struct boardcfg_rm_resasg {
	struct boardcfg_substructure_header	subhdr;
	u16					resasg_entries_size;
	u16					reserved;
	struct boardcfg_rm_resasg_entry		resasg_entries[];
} __attribute__((__packed__));

struct boardcfg_rm {
	struct boardcfg_abi_rev			rev;
	struct boardcfg_rm_host_cfg		host_cfg;
	struct boardcfg_rm_resasg		resasg;
} __attribute__((__packed__));

/*
 * This is essentially 'struct boardcfg_rm', but modified to pull
 * .resasg_entries which is a member of 'struct boardcfg_rm_resasg' into
 * the outer structure for easier explicit initialization.
 */
struct boardcfg_rm_local {
	struct boardcfg_rm			rm_boardcfg;
	struct boardcfg_rm_resasg_entry
				resasg_entries[BOARDCFG_RM_RESASG_ENTRIES];
} __attribute__((__packed__));

/**
 * Definitions, types, etc. as used for the security configuration
 */
#define PROCESSOR_ACL_SECONDARY_MASTERS_MAX	3

struct boardcfg_proc_acl_entry {
	u8					processor_id;
	u8					proc_access_master;
	u8	     proc_access_secondary[PROCESSOR_ACL_SECONDARY_MASTERS_MAX];
} __attribute__((__packed__));

#define PROCESSOR_ACL_ENTRIES			32

struct boardcfg_proc_acl {
	struct boardcfg_substructure_header	subhdr;
	struct boardcfg_proc_acl_entry  proc_acl_entries[PROCESSOR_ACL_ENTRIES];
} __attribute__((__packed__));

struct boardcfg_host_hierarchy_entry {
	u8					host_id;
	u8					supervisor_host_id;
} __attribute__((__packed__));

#define HOST_HIERARCHY_ENTRIES			32

struct boardcfg_host_hierarchy {
	struct boardcfg_substructure_header	subhdr;
	struct boardcfg_host_hierarchy_entry
				 host_hierarchy_entries[HOST_HIERARCHY_ENTRIES];
} __attribute__((__packed__));

struct boardcfg_extended_otp_entry {
	u8	host_id;
	u8	host_perms;
} __attribute__((__packed__));

#define MAX_NUM_EXT_OTP_MMRS			32

struct boardcfg_extended_otp {
	struct boardcfg_substructure_header	subhdr;
	struct boardcfg_extended_otp_entry	otp_entry[MAX_NUM_EXT_OTP_MMRS];
	u8					write_host_id;
} __attribute__((__packed__));

#define MAX_NUM_DKEK_ALLOWED_HOSTS		4

struct boardcfg_dkek {
	struct boardcfg_substructure_header	subhdr;
	u8					allowed_hosts[MAX_NUM_DKEK_ALLOWED_HOSTS];
	u8					allow_dkek_export_tisci;
	u8					rsvd[3];
} __attribute__((__packed__));

struct boardcfg_sa2ul_cfg {
	struct boardcfg_substructure_header	subhdr;
	u8					rsvd[4];
};

struct boardcfg_security {
	struct boardcfg_abi_rev			rev;
	struct boardcfg_proc_acl		processor_acl_list;
	struct boardcfg_host_hierarchy		host_hierarchy;
	struct boardcfg_extended_otp		otp_config;
	struct boardcfg_dkek			dkek_config;
	struct boardcfg_sa2ul_cfg		sa2ul_cfg;
} __attribute__((__packed__));

/**
 * Definitions, types, etc. as used for PM configuration
 */
struct boardcfg_pm {
	struct boardcfg_abi_rev			rev;
} __attribute__((__packed__));

#endif /* COMMON_H */