Software APIs
rram_ctrl.h File Reference

Device Tables (DT) for IP rram_ctrl and top earlgrey. More...

#include "hw/top/dt/api.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define OPENTITAN_RRAM_CTRL_HAS_ESCALATION   1
 List of supported hardware features.
 
#define OPENTITAN_RRAM_CTRL_HAS_FETCH_CODE   1
 
#define OPENTITAN_RRAM_CTRL_HAS_INFO_CREATOR_PARTITION   1
 
#define OPENTITAN_RRAM_CTRL_HAS_INFO_ISOLATED_PARTITION   1
 
#define OPENTITAN_RRAM_CTRL_HAS_INFO_OWNER_PARTITION   1
 
#define OPENTITAN_RRAM_CTRL_HAS_INIT_ROOT_SEEDS   1
 
#define OPENTITAN_RRAM_CTRL_HAS_INIT_SCRAMBLING_KEYS   1
 
#define OPENTITAN_RRAM_CTRL_HAS_MEM_PROTECTION   1
 
#define OPENTITAN_RRAM_CTRL_HAS_OP_HOST_READ   1
 
#define OPENTITAN_RRAM_CTRL_HAS_OP_PROTOCOL_CTRL   1
 
#define OPENTITAN_RRAM_CTRL_HAS_RMA   1
 

Typedefs

typedef enum dt_rram_ctrl dt_rram_ctrl_t
 List of instances.
 
typedef enum dt_rram_ctrl_reg_block dt_rram_ctrl_reg_block_t
 List of register blocks.
 
typedef enum dt_rram_ctrl_memory dt_rram_ctrl_memory_t
 List of memories.
 
typedef enum dt_rram_ctrl_irq dt_rram_ctrl_irq_t
 List of IRQs.
 
typedef enum dt_rram_ctrl_alert dt_rram_ctrl_alert_t
 List of Alerts.
 
typedef enum dt_rram_ctrl_clock dt_rram_ctrl_clock_t
 List of clock ports.
 
typedef enum dt_rram_ctrl_reset dt_rram_ctrl_reset_t
 List of reset ports.
 

Enumerations

enum  dt_rram_ctrl {
  kDtRramCtrlFirst = 0 ,
  kDtRramCtrl = 0
}
 List of instances. More...
 
enum  { kDtRramCtrlCount = 1 }
 
enum  dt_rram_ctrl_reg_block { kDtRramCtrlRegBlockCore = 0 }
 List of register blocks. More...
 
enum  { kDtRramCtrlRegBlockCount = 1 }
 
enum  dt_rram_ctrl_memory { kDtRramCtrlMemoryHost = 0 }
 List of memories. More...
 
enum  { kDtRramCtrlMemoryCount = 1 }
 
enum  dt_rram_ctrl_irq {
  kDtRramCtrlIrqWrEmpty = 0 ,
  kDtRramCtrlIrqWrLvl = 1 ,
  kDtRramCtrlIrqRdFull = 2 ,
  kDtRramCtrlIrqRdLvl = 3 ,
  kDtRramCtrlIrqOpDone = 4 ,
  kDtRramCtrlIrqCorrErr = 5
}
 List of IRQs. More...
 
enum  { kDtRramCtrlIrqCount = 6 }
 
enum  dt_rram_ctrl_alert {
  kDtRramCtrlAlertRecovErr = 0 ,
  kDtRramCtrlAlertFatalStdErr = 1 ,
  kDtRramCtrlAlertFatalErr = 2 ,
  kDtRramCtrlAlertFatalMacroErr = 3 ,
  kDtRramCtrlAlertRecovMacroErr = 4
}
 List of Alerts. More...
 
enum  { kDtRramCtrlAlertCount = 5 }
 
enum  dt_rram_ctrl_clock {
  kDtRramCtrlClockClk = 0 ,
  kDtRramCtrlClockOtp = 1
}
 List of clock ports. More...
 
enum  { kDtRramCtrlClockCount = 2 }
 
enum  dt_rram_ctrl_reset {
  kDtRramCtrlResetRst = 0 ,
  kDtRramCtrlResetOtp = 1
}
 List of reset ports. More...
 
enum  { kDtRramCtrlResetCount = 2 }
 

Functions

dt_rram_ctrl_t dt_rram_ctrl_from_instance_id (dt_instance_id_t inst_id)
 Get the rram_ctrl instance from an instance ID.
 
dt_instance_id_t dt_rram_ctrl_instance_id (dt_rram_ctrl_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_rram_ctrl_reg_block (dt_rram_ctrl_t dt, dt_rram_ctrl_reg_block_t reg_block)
 Get the register base address of an instance.
 
uint32_t dt_rram_ctrl_memory_base (dt_rram_ctrl_t dt, dt_rram_ctrl_memory_t mem)
 Get the base address of a memory.
 
uint32_t dt_rram_ctrl_memory_size (dt_rram_ctrl_t dt, dt_rram_ctrl_memory_t mem)
 Get the size of a memory.
 
dt_plic_irq_id_t dt_rram_ctrl_irq_to_plic_id (dt_rram_ctrl_t dt, dt_rram_ctrl_irq_t irq)
 Get the PLIC ID of a rram_ctrl IRQ for a given instance.
 
dt_rram_ctrl_irq_t dt_rram_ctrl_irq_from_plic_id (dt_rram_ctrl_t dt, dt_plic_irq_id_t irq)
 Convert a global IRQ ID to a local rram_ctrl IRQ type.
 
dt_alert_id_t dt_rram_ctrl_alert_to_alert_id (dt_rram_ctrl_t dt, dt_rram_ctrl_alert_t alert)
 Get the alert ID of a rram_ctrl alert for a given instance.
 
dt_rram_ctrl_alert_t dt_rram_ctrl_alert_from_alert_id (dt_rram_ctrl_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local rram_ctrl alert type.
 
dt_clock_t dt_rram_ctrl_clock (dt_rram_ctrl_t dt, dt_rram_ctrl_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_rram_ctrl_reset (dt_rram_ctrl_t dt, dt_rram_ctrl_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

Device Tables (DT) for IP rram_ctrl and top earlgrey.

This file contains the type definitions and global functions of the rram_ctrl.

Definition in file rram_ctrl.h.

Macro Definition Documentation

◆ OPENTITAN_RRAM_CTRL_HAS_ESCALATION

#define OPENTITAN_RRAM_CTRL_HAS_ESCALATION   1

List of supported hardware features.

Definition at line 146 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_FETCH_CODE

#define OPENTITAN_RRAM_CTRL_HAS_FETCH_CODE   1

Definition at line 147 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_INFO_CREATOR_PARTITION

#define OPENTITAN_RRAM_CTRL_HAS_INFO_CREATOR_PARTITION   1

Definition at line 148 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_INFO_ISOLATED_PARTITION

#define OPENTITAN_RRAM_CTRL_HAS_INFO_ISOLATED_PARTITION   1

Definition at line 149 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_INFO_OWNER_PARTITION

#define OPENTITAN_RRAM_CTRL_HAS_INFO_OWNER_PARTITION   1

Definition at line 150 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_INIT_ROOT_SEEDS

#define OPENTITAN_RRAM_CTRL_HAS_INIT_ROOT_SEEDS   1

Definition at line 151 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_INIT_SCRAMBLING_KEYS

#define OPENTITAN_RRAM_CTRL_HAS_INIT_SCRAMBLING_KEYS   1

Definition at line 152 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_MEM_PROTECTION

#define OPENTITAN_RRAM_CTRL_HAS_MEM_PROTECTION   1

Definition at line 153 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_OP_HOST_READ

#define OPENTITAN_RRAM_CTRL_HAS_OP_HOST_READ   1

Definition at line 154 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_OP_PROTOCOL_CTRL

#define OPENTITAN_RRAM_CTRL_HAS_OP_PROTOCOL_CTRL   1

Definition at line 155 of file rram_ctrl.h.

◆ OPENTITAN_RRAM_CTRL_HAS_RMA

#define OPENTITAN_RRAM_CTRL_HAS_RMA   1

Definition at line 156 of file rram_ctrl.h.

Typedef Documentation

◆ dt_rram_ctrl_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_rram_ctrl_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_rram_ctrl_irq_t

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

◆ dt_rram_ctrl_memory_t

List of memories.

Memories are guaranteed to start at 0 and to be consecutively numbered.

◆ dt_rram_ctrl_reg_block_t

List of register blocks.

Register blocks are guaranteed to start at 0 and to be consecutively numbered.

◆ dt_rram_ctrl_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlAlertCount 

Number of Alerts.

Definition at line 108 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlIrqCount 

Number of IRQs.

Definition at line 84 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlCount 

Number of instances.

Definition at line 34 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlResetCount 

Number of reset ports.

Definition at line 138 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlClockCount 

Number of clock ports.

Definition at line 123 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlMemoryCount 

Number of memories.

Definition at line 65 of file rram_ctrl.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtRramCtrlRegBlockCount 

Number of register blocks.

Definition at line 48 of file rram_ctrl.h.

◆ dt_rram_ctrl

List of instances.

Enumerator
kDtRramCtrlFirst 

First instance.

kDtRramCtrl 

rram_ctrl

Definition at line 29 of file rram_ctrl.h.

◆ dt_rram_ctrl_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRramCtrlAlertRecovErr 

RRAM recoverable errors.

kDtRramCtrlAlertFatalStdErr 

RRAM standard fatal errors.

kDtRramCtrlAlertFatalErr 

RRAM fatal errors including uncorrectable ECC errors.

Note that this alert is not always fatal. The underlying error bits in the !!FAULT_STATUS register remain set until reset, meaning the alert keeps firing. This doesn't hold for !!FAULT_STATUS.PHY_RELBL_ERR. To enable firmware dealing with multi-bit ECC errors during firmware selection and verification, these error bits can be cleared. After passing this stage, it is recommended that firmware classifies the corresponding alert as fatal on the receiver end, i.e, inside the alert handler.

kDtRramCtrlAlertFatalMacroErr 

Fatal errors triggered inside the RRAM macro, including fatal TL-UL bus integrity faults of the test interface.

kDtRramCtrlAlertRecovMacroErr 

Recoverable errors triggered inside the RRAM macro.

Definition at line 94 of file rram_ctrl.h.

◆ dt_rram_ctrl_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRramCtrlClockClk 

Clock port clk_i.

kDtRramCtrlClockOtp 

Clock port clk_otp_i.

Definition at line 118 of file rram_ctrl.h.

◆ dt_rram_ctrl_irq

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRramCtrlIrqWrEmpty 

Write FIFO empty.

kDtRramCtrlIrqWrLvl 

Write FIFO drained to level.

kDtRramCtrlIrqRdFull 

Read FIFO full.

kDtRramCtrlIrqRdLvl 

Read FIFO filled to level.

kDtRramCtrlIrqOpDone 

Operation complete.

kDtRramCtrlIrqCorrErr 

Correctable error encountered.

Definition at line 75 of file rram_ctrl.h.

◆ dt_rram_ctrl_memory

List of memories.

Memories are guaranteed to start at 0 and to be consecutively numbered.

Definition at line 61 of file rram_ctrl.h.

◆ dt_rram_ctrl_reg_block

List of register blocks.

Register blocks are guaranteed to start at 0 and to be consecutively numbered.

Definition at line 44 of file rram_ctrl.h.

◆ dt_rram_ctrl_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRramCtrlResetRst 

Reset port rst_ni.

kDtRramCtrlResetOtp 

Reset port rst_otp_ni.

Definition at line 133 of file rram_ctrl.h.

Function Documentation

◆ dt_rram_ctrl_alert_from_alert_id()

dt_rram_ctrl_alert_t dt_rram_ctrl_alert_from_alert_id ( dt_rram_ctrl_t dt,
dt_alert_id_t alert )

Convert a global alert ID to a local rram_ctrl alert type.

Parameters
dtInstance of rram_ctrl.
alertA global alert ID that belongs to this instance.
Returns
The rram_ctrl alert, or kDtRramCtrlAlertCount.

Note: This function assumes that the global alert ID belongs to the instance of rram_ctrl passed in parameter. In other words, it must be the case that dt_rram_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert). Otherwise, this function will return kDtRramCtrlAlertCount.

Definition at line 139 of file rram_ctrl.c.

◆ dt_rram_ctrl_alert_to_alert_id()

dt_alert_id_t dt_rram_ctrl_alert_to_alert_id ( dt_rram_ctrl_t dt,
dt_rram_ctrl_alert_t alert )

Get the alert ID of a rram_ctrl alert for a given instance.

Note: This function only makes sense if the instance is connected to the Alert Handler. For any instances where the instance is not connected, the return value is unspecified.

Parameters
dtInstance of rram_ctrl.
alertA rram_ctrl alert.
Returns
The Alert Handler alert ID of the alert of this instance.

Definition at line 133 of file rram_ctrl.c.

◆ dt_rram_ctrl_clock()

Get the clock signal connected to a clock port of an instance.

Parameters
dtInstance of rram_ctrl.
clkClock port.
Returns
Clock signal.

Definition at line 151 of file rram_ctrl.c.

◆ dt_rram_ctrl_from_instance_id()

dt_rram_ctrl_t dt_rram_ctrl_from_instance_id ( dt_instance_id_t inst_id)

Get the rram_ctrl instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A rram_ctrl instance.

Note: This function only makes sense if the instance ID has device type rram_ctrl, otherwise the returned value is unspecified.

Definition at line 75 of file rram_ctrl.c.

◆ dt_rram_ctrl_instance_id()

dt_instance_id_t dt_rram_ctrl_instance_id ( dt_rram_ctrl_t dt)

Get the instance ID of an instance.

Parameters
dtInstance of rram_ctrl.
Returns
The instance ID of that instance.

Definition at line 82 of file rram_ctrl.c.

◆ dt_rram_ctrl_irq_from_plic_id()

dt_rram_ctrl_irq_t dt_rram_ctrl_irq_from_plic_id ( dt_rram_ctrl_t dt,
dt_plic_irq_id_t irq )

Convert a global IRQ ID to a local rram_ctrl IRQ type.

Parameters
dtInstance of rram_ctrl.
irqA PLIC ID that belongs to this instance.
Returns
The rram_ctrl IRQ, or kDtRramCtrlIrqCount.

Note: This function assumes that the PLIC ID belongs to the instance of rram_ctrl passed in parameter. In other words, it must be the case that dt_rram_ctrl_instance_id(dt) == dt_plic_id_to_instance_id(irq). Otherwise, this function will return kDtRramCtrlIrqCount.

Definition at line 118 of file rram_ctrl.c.

◆ dt_rram_ctrl_irq_to_plic_id()

dt_plic_irq_id_t dt_rram_ctrl_irq_to_plic_id ( dt_rram_ctrl_t dt,
dt_rram_ctrl_irq_t irq )

Get the PLIC ID of a rram_ctrl IRQ for a given instance.

If the instance is not connected to the PLIC, this function will return kDtPlicIrqIdNone.

Parameters
dtInstance of rram_ctrl.
irqA rram_ctrl IRQ.
Returns
The PLIC ID of the IRQ of this instance.

Definition at line 108 of file rram_ctrl.c.

◆ dt_rram_ctrl_memory_base()

uint32_t dt_rram_ctrl_memory_base ( dt_rram_ctrl_t dt,
dt_rram_ctrl_memory_t mem )

Get the base address of a memory.

Parameters
dtInstance of rram_ctrl.
memThe memory requested.
Returns
The base address of the requested memory.

Definition at line 94 of file rram_ctrl.c.

◆ dt_rram_ctrl_memory_size()

uint32_t dt_rram_ctrl_memory_size ( dt_rram_ctrl_t dt,
dt_rram_ctrl_memory_t mem )

Get the size of a memory.

Parameters
dtInstance of rram_ctrl.
memThe memory requested.
Returns
The size of the requested memory.

Definition at line 101 of file rram_ctrl.c.

◆ dt_rram_ctrl_reg_block()

Get the register base address of an instance.

Parameters
dtInstance of rram_ctrl.
reg_blockThe register block requested.
Returns
The register base address of the requested block.

Definition at line 87 of file rram_ctrl.c.

◆ dt_rram_ctrl_reset()

Get the reset signal connected to a reset port of an instance.

Parameters
dtInstance of rram_ctrl.
rstReset port.
Returns
Reset signal.

Definition at line 158 of file rram_ctrl.c.