Skip to content

Commit

Permalink
[ot] hw/opentitan: ot_dma: add support for transaction roles
Browse files Browse the repository at this point in the history
Only available when MemTxAttrs is tainted with a role attribute.

Signed-off-by: Emmanuel Blot <[email protected]>
  • Loading branch information
rivos-eblot authored and loiclefort committed Dec 5, 2023
1 parent eca4915 commit 7c7ea28
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions hw/opentitan/ot_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ REG32(INT_SRC_VAL_8, 0xecu)
REG32(INT_SRC_VAL_9, 0xf0u)
REG32(INT_SRC_VAL_10, 0xf4u)

#if defined(MEMTXATTRS_HAS_ROLE) && (MEMTXATTRS_HAS_ROLE != 0)
#define OT_DMA_HAS_ROLE
#else
#undef OT_DMA_HAS_ROLE
#endif

typedef enum {
TRANSACTION_WIDTH_BYTE = 0x0,
TRANSACTION_WIDTH_HALF = 0x1,
Expand Down Expand Up @@ -244,6 +250,9 @@ struct OtDMAState {
char *ctn_as_name; /* externel port AS unique name */
char *sys_as_name; /* external system AS unique name */
char *dma_id;
#ifdef OT_DMA_HAS_ROLE
uint8_t role;
#endif
};

#define R32_OFF(_r_) ((_r_) / sizeof(uint32_t))
Expand Down Expand Up @@ -633,6 +642,9 @@ static bool ot_dma_go(OtDMAState *s)
OtDMAOp *op = &s->op;

op->attrs.unspecified = false;
#ifdef OT_DMA_HAS_ROLE
op->attrs.role = (unsigned)s->role;
#endif
op->size = s->regs[R_TOTAL_DATA_SIZE];

/*
Expand Down Expand Up @@ -1054,6 +1066,9 @@ static Property ot_dma_properties[] = {
DEFINE_PROP_STRING("ot_as_name", OtDMAState, ot_as_name),
DEFINE_PROP_STRING("ctn_as_name", OtDMAState, ctn_as_name),
DEFINE_PROP_STRING("sys_as_name", OtDMAState, sys_as_name),
#ifdef OT_DMA_HAS_ROLE
DEFINE_PROP_UINT8("role", OtDMAState, role, UINT8_MAX),
#endif
DEFINE_PROP_STRING("id", OtDMAState, dma_id),
DEFINE_PROP_END_OF_LIST(),
};
Expand Down

0 comments on commit 7c7ea28

Please sign in to comment.