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_REVOCATION_BITMAP 1
137
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_ACCESS_CHECK 1
138
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_MODE_GATING 1
139
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_SWEEP 1
140
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_CORE_WRITE_SNOOP 1
141
#define OPENTITAN_CHERIOT_MEM_SYS_HAS_TBRE_STATUS 1
142
143
144
145
/**
146
* Get the cheriot_mem_sys instance from an instance ID
147
*
148
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
149
*
150
* @param inst_id Instance ID.
151
* @return A cheriot_mem_sys instance.
152
*
153
* **Note:** This function only makes sense if the instance ID has device type cheriot_mem_sys,
154
* otherwise the returned value is unspecified.
155
*/
156
dt_cheriot_mem_sys_t
dt_cheriot_mem_sys_from_instance_id
(
dt_instance_id_t
inst_id);
157
158
/**
159
* Get the instance ID of an instance.
160
*
161
* @param dt Instance of cheriot_mem_sys.
162
* @return The instance ID of that instance.
163
*/
164
dt_instance_id_t
dt_cheriot_mem_sys_instance_id
(
dt_cheriot_mem_sys_t
dt);
165
166
/**
167
* Get the register base address of an instance.
168
*
169
* @param dt Instance of cheriot_mem_sys.
170
* @param reg_block The register block requested.
171
* @return The register base address of the requested block.
172
*/
173
uint32_t
dt_cheriot_mem_sys_reg_block
(
174
dt_cheriot_mem_sys_t
dt,
175
dt_cheriot_mem_sys_reg_block_t
reg_block);
176
177
/**
178
* Get the primary register base address of an instance.
179
*
180
* This is just a convenience function, equivalent to
181
* `dt_cheriot_mem_sys_reg_block(dt, kDtCheriotMemSysRegBlockRegs)`
182
*
183
* @param dt Instance of cheriot_mem_sys.
184
* @return The register base address of the primary register block.
185
*/
186
static
inline
uint32_t dt_cheriot_mem_sys_primary_reg_block(
187
dt_cheriot_mem_sys_t
dt) {
188
return
dt_cheriot_mem_sys_reg_block
(dt, kDtCheriotMemSysRegBlockRegs);
189
}
190
191
/**
192
* Get the base address of a memory.
193
*
194
* @param dt Instance of cheriot_mem_sys.
195
* @param mem The memory requested.
196
* @return The base address of the requested memory.
197
*/
198
uint32_t
dt_cheriot_mem_sys_memory_base
(
199
dt_cheriot_mem_sys_t
dt,
200
dt_cheriot_mem_sys_memory_t
mem);
201
202
/**
203
* Get the size of a memory.
204
*
205
* @param dt Instance of cheriot_mem_sys.
206
* @param mem The memory requested.
207
* @return The size of the requested memory.
208
*/
209
uint32_t
dt_cheriot_mem_sys_memory_size
(
210
dt_cheriot_mem_sys_t
dt,
211
dt_cheriot_mem_sys_memory_t
mem);
212
213
/**
214
* Get the PLIC ID of a cheriot_mem_sys IRQ for a given instance.
215
*
216
* If the instance is not connected to the PLIC, this function
217
* will return `kDtPlicIrqIdNone`.
218
*
219
* @param dt Instance of cheriot_mem_sys.
220
* @param irq A cheriot_mem_sys IRQ.
221
* @return The PLIC ID of the IRQ of this instance.
222
*/
223
dt_plic_irq_id_t
dt_cheriot_mem_sys_irq_to_plic_id
(
224
dt_cheriot_mem_sys_t
dt,
225
dt_cheriot_mem_sys_irq_t
irq);
226
227
/**
228
* Convert a global IRQ ID to a local cheriot_mem_sys IRQ type.
229
*
230
* @param dt Instance of cheriot_mem_sys.
231
* @param irq A PLIC ID that belongs to this instance.
232
* @return The cheriot_mem_sys IRQ, or `kDtCheriotMemSysIrqCount`.
233
*
234
* **Note:** This function assumes that the PLIC ID belongs to the instance
235
* of cheriot_mem_sys passed in parameter. In other words, it must be the case that
236
* `dt_cheriot_mem_sys_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
237
* will return `kDtCheriotMemSysIrqCount`.
238
*/
239
dt_cheriot_mem_sys_irq_t
dt_cheriot_mem_sys_irq_from_plic_id
(
240
dt_cheriot_mem_sys_t
dt,
241
dt_plic_irq_id_t
irq);
242
243
244
/**
245
* Get the alert ID of a cheriot_mem_sys alert for a given instance.
246
*
247
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
248
* instances where the instance is not connected, the return value is unspecified.
249
*
250
* @param dt Instance of cheriot_mem_sys.
251
* @param alert A cheriot_mem_sys alert.
252
* @return The Alert Handler alert ID of the alert of this instance.
253
*/
254
dt_alert_id_t
dt_cheriot_mem_sys_alert_to_alert_id
(
255
dt_cheriot_mem_sys_t
dt,
256
dt_cheriot_mem_sys_alert_t
alert);
257
258
/**
259
* Convert a global alert ID to a local cheriot_mem_sys alert type.
260
*
261
* @param dt Instance of cheriot_mem_sys.
262
* @param alert A global alert ID that belongs to this instance.
263
* @return The cheriot_mem_sys alert, or `kDtCheriotMemSysAlertCount`.
264
*
265
* **Note:** This function assumes that the global alert ID belongs to the
266
* instance of cheriot_mem_sys passed in parameter. In other words, it must be the case
267
* that `dt_cheriot_mem_sys_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
268
* this function will return `kDtCheriotMemSysAlertCount`.
269
*/
270
dt_cheriot_mem_sys_alert_t
dt_cheriot_mem_sys_alert_from_alert_id
(
271
dt_cheriot_mem_sys_t
dt,
272
dt_alert_id_t
alert);
273
274
275
276
/**
277
* Get the clock signal connected to a clock port of an instance.
278
*
279
* @param dt Instance of cheriot_mem_sys.
280
* @param clk Clock port.
281
* @return Clock signal.
282
*/
283
dt_clock_t
dt_cheriot_mem_sys_clock
(
284
dt_cheriot_mem_sys_t
dt,
285
dt_cheriot_mem_sys_clock_t
clk);
286
287
/**
288
* Get the reset signal connected to a reset port of an instance.
289
*
290
* @param dt Instance of cheriot_mem_sys.
291
* @param rst Reset port.
292
* @return Reset signal.
293
*/
294
dt_reset_t
dt_cheriot_mem_sys_reset
(
295
dt_cheriot_mem_sys_t
dt,
296
dt_cheriot_mem_sys_reset_t
rst);
297
298
299
300
#ifdef __cplusplus
301
}
// extern "C"
302
#endif
// __cplusplus
303
304
#endif
// OPENTITAN_DT_CHERIOT_MEM_SYS_H_
(earlgrey)
hw
top
dt
cheriot_mem_sys.h
Return to
OpenTitan Documentation