Software APIs
cheriot_mem_sys.h
Go to the documentation of this file.
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
//
5
// Device table API auto-generated by `dtgen`
6
7
#ifndef OPENTITAN_DT_CHERIOT_MEM_SYS_H_
8
#define OPENTITAN_DT_CHERIOT_MEM_SYS_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP cheriot_mem_sys and top earlgrey.
17
*
18
* This file contains the type definitions and global functions of the cheriot_mem_sys.
19
*/
20
21
#include "hw/top/dt/api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_cheriot_mem_sys
{
30
kDtCheriotMemSysFirst
= 0,
/**< First instance */
31
kDtCheriotMemSys
= 0,
/**< cheriot_mem_sys */
32
}
dt_cheriot_mem_sys_t
;
33
34
enum
{
35
kDtCheriotMemSysCount
= 1,
/**< Number of instances */
36
};
37
38
39
/**
40
* List of register blocks.
41
*
42
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
43
*/
44
typedef
enum
dt_cheriot_mem_sys_reg_block
{
45
kDtCheriotMemSysRegBlockRegs = 0,
/**< */
46
}
dt_cheriot_mem_sys_reg_block_t
;
47
48
enum
{
49
kDtCheriotMemSysRegBlockCount
= 1,
/**< Number of register blocks */
50
};
51
52
53
/** Primary register block (associated with the "primary" set of registers that control the IP). */
54
static
const
dt_cheriot_mem_sys_reg_block_t
kDtCheriotMemSysRegBlockPrimary = kDtCheriotMemSysRegBlockRegs;
55
56
/**
57
* List of memories.
58
*
59
* Memories are guaranteed to start at 0 and to be consecutively numbered.
60
*/
61
typedef
enum
dt_cheriot_mem_sys_memory
{
62
kDtCheriotMemSysMemoryRevbm = 0,
/**< */
63
}
dt_cheriot_mem_sys_memory_t
;
64
65
enum
{
66
kDtCheriotMemSysMemoryCount
= 1,
/**< Number of memories */
67
};
68
69
70
/**
71
* List of IRQs.
72
*
73
* IRQs are guaranteed to be numbered consecutively from 0.
74
*/
75
typedef
enum
dt_cheriot_mem_sys_irq
{
76
kDtCheriotMemSysIrqTbreDone
= 0,
/**< Raised when the revocation engine has resolved every capability of a sweep. */
77
}
dt_cheriot_mem_sys_irq_t
;
78
79
enum
{
80
kDtCheriotMemSysIrqCount
= 1,
/**< Number of IRQs */
81
};
82
83
84
/**
85
* List of Alerts.
86
*
87
* Alerts are guaranteed to be numbered consecutively from 0.
88
*/
89
typedef
enum
dt_cheriot_mem_sys_alert
{
90
kDtCheriotMemSysAlertFatalFault
= 0,
/**< This fatal alert is triggered when an integrity fault is detected, when the meta
91
SRAM path returns a device error, when the revocation engine reports a fault, when a
92
capability store to the NVM is partial, or when a request breaks the core's capability
93
store sequence. */
94
}
dt_cheriot_mem_sys_alert_t
;
95
96
enum
{
97
kDtCheriotMemSysAlertCount
= 1,
/**< Number of Alerts */
98
};
99
100
101
/**
102
* List of clock ports.
103
*
104
* Clock ports are guaranteed to be numbered consecutively from 0.
105
*/
106
typedef
enum
dt_cheriot_mem_sys_clock
{
107
kDtCheriotMemSysClockClk
= 0,
/**< Clock port clk_i */
108
}
dt_cheriot_mem_sys_clock_t
;
109
110
enum
{
111
kDtCheriotMemSysClockCount
= 1,
/**< Number of clock ports */
112
};
113
114
115
/**
116
* List of reset ports.
117
*
118
* Reset ports are guaranteed to be numbered consecutively from 0.
119
*/
120
typedef
enum
dt_cheriot_mem_sys_reset
{
121
kDtCheriotMemSysResetRst
= 0,
/**< Reset port rst_ni */
122
}
dt_cheriot_mem_sys_reset_t
;
123
124
enum
{
125
kDtCheriotMemSysResetCount
= 1,
/**< Number of reset ports */
126
};
127
128
129
/**
130
* List of supported hardware features.
131
*/
132
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TAG_SPLIT 1
133
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TAG_READ 1
134
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TAG_WRITE_RMW 1
135
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TAG_CLEAR_ON_DATA_WRITE 1
136
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_NVM_CAP_STORE 1
137
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_REVOCATION_BITMAP 1
138
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_ACCESS_CHECK 1
139
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_MODE_GATING 1
140
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_SWEEP 1
141
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_CORE_WRITE_SNOOP 1
142
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_STATUS 1
143
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_FATAL_ALERT 1
144
145
146
147
/**
148
* Get the cheriot_mem_sys instance from an instance ID
149
*
150
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
151
*
152
* @param inst_id Instance ID.
153
* @return A cheriot_mem_sys instance.
154
*
155
* **Note:** This function only makes sense if the instance ID has device type cheriot_mem_sys,
156
* otherwise the returned value is unspecified.
157
*/
158
dt_cheriot_mem_sys_t
dt_cheriot_mem_sys_from_instance_id
(
dt_instance_id_t
inst_id);
159
160
/**
161
* Get the instance ID of an instance.
162
*
163
* @param dt Instance of cheriot_mem_sys.
164
* @return The instance ID of that instance.
165
*/
166
dt_instance_id_t
dt_cheriot_mem_sys_instance_id
(
dt_cheriot_mem_sys_t
dt);
167
168
/**
169
* Get the register base address of an instance.
170
*
171
* @param dt Instance of cheriot_mem_sys.
172
* @param reg_block The register block requested.
173
* @return The register base address of the requested block.
174
*/
175
uint32_t
dt_cheriot_mem_sys_reg_block
(
176
dt_cheriot_mem_sys_t
dt,
177
dt_cheriot_mem_sys_reg_block_t
reg_block);
178
179
/**
180
* Get the primary register base address of an instance.
181
*
182
* This is just a convenience function, equivalent to
183
* `dt_cheriot_mem_sys_reg_block(dt, kDtCheriotMemSysRegBlockRegs)`
184
*
185
* @param dt Instance of cheriot_mem_sys.
186
* @return The register base address of the primary register block.
187
*/
188
static
inline
uint32_t dt_cheriot_mem_sys_primary_reg_block(
189
dt_cheriot_mem_sys_t
dt) {
190
return
dt_cheriot_mem_sys_reg_block
(dt, kDtCheriotMemSysRegBlockRegs);
191
}
192
193
/**
194
* Get the base address of a memory.
195
*
196
* @param dt Instance of cheriot_mem_sys.
197
* @param mem The memory requested.
198
* @return The base address of the requested memory.
199
*/
200
uint32_t
dt_cheriot_mem_sys_memory_base
(
201
dt_cheriot_mem_sys_t
dt,
202
dt_cheriot_mem_sys_memory_t
mem);
203
204
/**
205
* Get the size of a memory.
206
*
207
* @param dt Instance of cheriot_mem_sys.
208
* @param mem The memory requested.
209
* @return The size of the requested memory.
210
*/
211
uint32_t
dt_cheriot_mem_sys_memory_size
(
212
dt_cheriot_mem_sys_t
dt,
213
dt_cheriot_mem_sys_memory_t
mem);
214
215
/**
216
* Get the PLIC ID of a cheriot_mem_sys IRQ for a given instance.
217
*
218
* If the instance is not connected to the PLIC, this function
219
* will return `kDtPlicIrqIdNone`.
220
*
221
* @param dt Instance of cheriot_mem_sys.
222
* @param irq A cheriot_mem_sys IRQ.
223
* @return The PLIC ID of the IRQ of this instance.
224
*/
225
dt_plic_irq_id_t
dt_cheriot_mem_sys_irq_to_plic_id
(
226
dt_cheriot_mem_sys_t
dt,
227
dt_cheriot_mem_sys_irq_t
irq);
228
229
/**
230
* Convert a global IRQ ID to a local cheriot_mem_sys IRQ type.
231
*
232
* @param dt Instance of cheriot_mem_sys.
233
* @param irq A PLIC ID that belongs to this instance.
234
* @return The cheriot_mem_sys IRQ, or `kDtCheriotMemSysIrqCount`.
235
*
236
* **Note:** This function assumes that the PLIC ID belongs to the instance
237
* of cheriot_mem_sys passed in parameter. In other words, it must be the case that
238
* `dt_cheriot_mem_sys_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
239
* will return `kDtCheriotMemSysIrqCount`.
240
*/
241
dt_cheriot_mem_sys_irq_t
dt_cheriot_mem_sys_irq_from_plic_id
(
242
dt_cheriot_mem_sys_t
dt,
243
dt_plic_irq_id_t
irq);
244
245
246
/**
247
* Get the alert ID of a cheriot_mem_sys alert for a given instance.
248
*
249
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
250
* instances where the instance is not connected, the return value is unspecified.
251
*
252
* @param dt Instance of cheriot_mem_sys.
253
* @param alert A cheriot_mem_sys alert.
254
* @return The Alert Handler alert ID of the alert of this instance.
255
*/
256
dt_alert_id_t
dt_cheriot_mem_sys_alert_to_alert_id
(
257
dt_cheriot_mem_sys_t
dt,
258
dt_cheriot_mem_sys_alert_t
alert);
259
260
/**
261
* Convert a global alert ID to a local cheriot_mem_sys alert type.
262
*
263
* @param dt Instance of cheriot_mem_sys.
264
* @param alert A global alert ID that belongs to this instance.
265
* @return The cheriot_mem_sys alert, or `kDtCheriotMemSysAlertCount`.
266
*
267
* **Note:** This function assumes that the global alert ID belongs to the
268
* instance of cheriot_mem_sys passed in parameter. In other words, it must be the case
269
* that `dt_cheriot_mem_sys_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
270
* this function will return `kDtCheriotMemSysAlertCount`.
271
*/
272
dt_cheriot_mem_sys_alert_t
dt_cheriot_mem_sys_alert_from_alert_id
(
273
dt_cheriot_mem_sys_t
dt,
274
dt_alert_id_t
alert);
275
276
277
278
/**
279
* Get the clock signal connected to a clock port of an instance.
280
*
281
* @param dt Instance of cheriot_mem_sys.
282
* @param clk Clock port.
283
* @return Clock signal.
284
*/
285
dt_clock_t
dt_cheriot_mem_sys_clock
(
286
dt_cheriot_mem_sys_t
dt,
287
dt_cheriot_mem_sys_clock_t
clk);
288
289
/**
290
* Get the reset signal connected to a reset port of an instance.
291
*
292
* @param dt Instance of cheriot_mem_sys.
293
* @param rst Reset port.
294
* @return Reset signal.
295
*/
296
dt_reset_t
dt_cheriot_mem_sys_reset
(
297
dt_cheriot_mem_sys_t
dt,
298
dt_cheriot_mem_sys_reset_t
rst);
299
300
301
302
#ifdef __cplusplus
303
}
// extern "C"
304
#endif
// __cplusplus
305
306
#endif
// OPENTITAN_DT_CHERIOT_MEM_SYS_H_
(earlgrey)
hw
top
dt
cheriot_mem_sys.h
Return to
OpenTitan Documentation