Software APIs
dt_keymgr.h File Reference

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

#include "dt_api.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define OPENTITAN_KEYMGR_HAS_SIDELOAD_KMAC   1
 List of supported hardware features.
 
#define OPENTITAN_KEYMGR_HAS_SIDELOAD_AES   1
 
#define OPENTITAN_KEYMGR_HAS_SIDELOAD_OTBN   1
 
#define OPENTITAN_KEYMGR_HAS_DERIVE_ATTESTATION   1
 
#define OPENTITAN_KEYMGR_HAS_DERIVE_SEALING   1
 
#define OPENTITAN_KEYMGR_HAS_GENERATE_OUTPUT   1
 
#define OPENTITAN_KEYMGR_HAS_GENERATE_IDENTITY   1
 
#define OPENTITAN_KEYMGR_HAS_KEY_VERSIONING   1
 

Typedefs

typedef enum dt_keymgr dt_keymgr_t
 List of instances.
 
typedef enum dt_keymgr_reg_block dt_keymgr_reg_block_t
 List of register blocks.
 
typedef enum dt_keymgr_irq dt_keymgr_irq_t
 List of IRQs.
 
typedef enum dt_keymgr_alert dt_keymgr_alert_t
 List of Alerts.
 
typedef enum dt_keymgr_clock dt_keymgr_clock_t
 List of clock ports.
 
typedef enum dt_keymgr_reset dt_keymgr_reset_t
 List of reset ports.
 

Enumerations

enum  dt_keymgr {
  kDtKeymgr = 0 ,
  kDtKeymgrFirst = 0 ,
  kDtKeymgrCount = 1
}
 List of instances. More...
 
enum  dt_keymgr_reg_block {
  kDtKeymgrRegBlockCore = 0 ,
  kDtKeymgrRegBlockCount = 1
}
 List of register blocks. More...
 
enum  dt_keymgr_irq {
  kDtKeymgrIrqOpDone = 0 ,
  kDtKeymgrIrqCount = 1
}
 List of IRQs. More...
 
enum  dt_keymgr_alert {
  kDtKeymgrAlertRecovOperationErr = 0 ,
  kDtKeymgrAlertFatalFaultErr = 1 ,
  kDtKeymgrAlertCount = 2
}
 List of Alerts. More...
 
enum  dt_keymgr_clock {
  kDtKeymgrClockClk = 0 ,
  kDtKeymgrClockEdn = 1 ,
  kDtKeymgrClockCount = 2
}
 List of clock ports. More...
 
enum  dt_keymgr_reset {
  kDtKeymgrResetRst = 0 ,
  kDtKeymgrResetEdn = 1 ,
  kDtKeymgrResetCount = 2
}
 List of reset ports. More...
 

Functions

dt_keymgr_t dt_keymgr_from_instance_id (dt_instance_id_t inst_id)
 Get the keymgr instance from an instance ID.
 
dt_instance_id_t dt_keymgr_instance_id (dt_keymgr_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_keymgr_reg_block (dt_keymgr_t dt, dt_keymgr_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_plic_irq_id_t dt_keymgr_irq_to_plic_id (dt_keymgr_t dt, dt_keymgr_irq_t irq)
 Get the PLIC ID of a keymgr IRQ for a given instance.
 
dt_keymgr_irq_t dt_keymgr_irq_from_plic_id (dt_keymgr_t dt, dt_plic_irq_id_t irq)
 Convert a global IRQ ID to a local keymgr IRQ type.
 
dt_alert_id_t dt_keymgr_alert_to_alert_id (dt_keymgr_t dt, dt_keymgr_alert_t alert)
 Get the alert ID of a keymgr alert for a given instance.
 
dt_keymgr_alert_t dt_keymgr_alert_from_alert_id (dt_keymgr_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local keymgr alert type.
 
dt_clock_t dt_keymgr_clock (dt_keymgr_t dt, dt_keymgr_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_keymgr_reset (dt_keymgr_t dt, dt_keymgr_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

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

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

Definition in file dt_keymgr.h.

Macro Definition Documentation

◆ OPENTITAN_KEYMGR_HAS_DERIVE_ATTESTATION

#define OPENTITAN_KEYMGR_HAS_DERIVE_ATTESTATION   1

Definition at line 92 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_DERIVE_SEALING

#define OPENTITAN_KEYMGR_HAS_DERIVE_SEALING   1

Definition at line 93 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_GENERATE_IDENTITY

#define OPENTITAN_KEYMGR_HAS_GENERATE_IDENTITY   1

Definition at line 95 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_GENERATE_OUTPUT

#define OPENTITAN_KEYMGR_HAS_GENERATE_OUTPUT   1

Definition at line 94 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_KEY_VERSIONING

#define OPENTITAN_KEYMGR_HAS_KEY_VERSIONING   1

Definition at line 96 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_SIDELOAD_AES

#define OPENTITAN_KEYMGR_HAS_SIDELOAD_AES   1

Definition at line 90 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_SIDELOAD_KMAC

#define OPENTITAN_KEYMGR_HAS_SIDELOAD_KMAC   1

List of supported hardware features.

Definition at line 89 of file dt_keymgr.h.

◆ OPENTITAN_KEYMGR_HAS_SIDELOAD_OTBN

#define OPENTITAN_KEYMGR_HAS_SIDELOAD_OTBN   1

Definition at line 91 of file dt_keymgr.h.

Typedef Documentation

◆ dt_keymgr_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_keymgr_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_keymgr_irq_t

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

◆ dt_keymgr_reg_block_t

List of register blocks.

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

◆ dt_keymgr_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ dt_keymgr

enum dt_keymgr

List of instances.

Enumerator
kDtKeymgr 

keymgr

Definition at line 23 of file dt_keymgr.h.

◆ dt_keymgr_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtKeymgrAlertRecovOperationErr 

Alert for key manager operation errors.

These errors could have been caused by software

kDtKeymgrAlertFatalFaultErr 

Alert for key manager faults.

These errors cannot be caused by software

Definition at line 57 of file dt_keymgr.h.

◆ dt_keymgr_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtKeymgrClockClk 

Clock port clk_i.

kDtKeymgrClockEdn 

Clock port clk_edn_i.

Definition at line 69 of file dt_keymgr.h.

◆ dt_keymgr_irq

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtKeymgrIrqOpDone 

Operation complete.

Definition at line 47 of file dt_keymgr.h.

◆ dt_keymgr_reg_block

List of register blocks.

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

Definition at line 34 of file dt_keymgr.h.

◆ dt_keymgr_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtKeymgrResetRst 

Reset port rst_ni.

kDtKeymgrResetEdn 

Reset port rst_edn_ni.

Definition at line 80 of file dt_keymgr.h.

Function Documentation

◆ dt_keymgr_alert_from_alert_id()

dt_keymgr_alert_t dt_keymgr_alert_from_alert_id ( dt_keymgr_t dt,
dt_alert_id_t alert )

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

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

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

Definition at line 117 of file dt_keymgr.c.

◆ dt_keymgr_alert_to_alert_id()

dt_alert_id_t dt_keymgr_alert_to_alert_id ( dt_keymgr_t dt,
dt_keymgr_alert_t alert )

Get the alert ID of a keymgr 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 keymgr.
alertA keymgr alert.
Returns
The Alert Handler alert ID of the alert of this instance.

Definition at line 111 of file dt_keymgr.c.

◆ dt_keymgr_clock()

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

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

Definition at line 129 of file dt_keymgr.c.

◆ dt_keymgr_from_instance_id()

dt_keymgr_t dt_keymgr_from_instance_id ( dt_instance_id_t inst_id)

Get the keymgr instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A keymgr instance.

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

Definition at line 67 of file dt_keymgr.c.

◆ dt_keymgr_instance_id()

dt_instance_id_t dt_keymgr_instance_id ( dt_keymgr_t dt)

Get the instance ID of an instance.

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

Definition at line 74 of file dt_keymgr.c.

◆ dt_keymgr_irq_from_plic_id()

dt_keymgr_irq_t dt_keymgr_irq_from_plic_id ( dt_keymgr_t dt,
dt_plic_irq_id_t irq )

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

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

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

Definition at line 96 of file dt_keymgr.c.

◆ dt_keymgr_irq_to_plic_id()

dt_plic_irq_id_t dt_keymgr_irq_to_plic_id ( dt_keymgr_t dt,
dt_keymgr_irq_t irq )

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

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

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

Definition at line 86 of file dt_keymgr.c.

◆ dt_keymgr_reg_block()

Get the register base address of an instance.

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

Definition at line 79 of file dt_keymgr.c.

◆ dt_keymgr_reset()

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

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

Definition at line 136 of file dt_keymgr.c.