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
11extern "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 */
29typedef enum dt_cheriot_mem_sys {
30 kDtCheriotMemSysFirst = 0, /**< First instance */
31 kDtCheriotMemSys = 0, /**< cheriot_mem_sys */
33
34enum {
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 */
45 kDtCheriotMemSysRegBlockRegs = 0, /**< */
47
48enum {
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). */
54static 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 */
62 kDtCheriotMemSysMemoryRevbm = 0, /**< */
64
65enum {
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 */
76 kDtCheriotMemSysIrqTbreDone = 0, /**< Raised when the revocation engine has resolved every capability of a sweep. */
78
79enum {
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 */
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. */
95
96enum {
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 */
109
110enum {
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 */
123
124enum {
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 */
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 */
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 */
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 */
186static inline uint32_t dt_cheriot_mem_sys_primary_reg_block(
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
297
298
299
300#ifdef __cplusplus
301} // extern "C"
302#endif // __cplusplus
303
304#endif // OPENTITAN_DT_CHERIOT_MEM_SYS_H_