Skip to content

Commit 5cd20fa

Browse files
committed
[ot] hw/opentitan: ot_dm_tl: use new DTM API
also add a property to register a new DM-TL bridge as either enabled or not Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
1 parent 460db99 commit 5cd20fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hw/opentitan/ot_dm_tl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct OtDMTLState {
5353
uint64_t tl_base;
5454
uint32_t dmi_addr;
5555
unsigned dmi_size;
56+
bool enable;
5657
uint8_t role;
5758
};
5859

@@ -136,6 +137,7 @@ static Property ot_dm_tl_properties[] = {
136137
DEFINE_PROP_UINT64("tl_addr", OtDMTLState, tl_base, 0),
137138
DEFINE_PROP_LINK("tl_dev", OtDMTLState, tl_dev, TYPE_SYS_BUS_DEVICE,
138139
SysBusDevice *),
140+
DEFINE_PROP_BOOL("enable", OtDMTLState, enable, true),
139141
DEFINE_PROP_UINT8("role", OtDMTLState, role, UINT8_MAX),
140142
DEFINE_PROP_END_OF_LIST(),
141143
};
@@ -148,9 +150,10 @@ static void ot_dm_tl_reset(DeviceState *dev)
148150
g_assert(dmtl->dmi_size);
149151

150152
if (!dmtl->dtm_ok) {
153+
RISCVDTMClass *dtmc = RISCV_DTM_GET_CLASS(OBJECT(dmtl->dtm));
151154
dmtl->dtm_ok =
152-
riscv_dtm_register_dm(DEVICE(dmtl->dtm), RISCV_DEBUG_DEVICE(dev),
153-
dmtl->dmi_addr, dmtl->dmi_size);
155+
(*dtmc->register_dm)(DEVICE(dmtl->dtm), RISCV_DEBUG_DEVICE(dev),
156+
dmtl->dmi_addr, dmtl->dmi_size, dmtl->enable);
154157
}
155158

156159
if (dmtl->dtm_ok) {

0 commit comments

Comments
 (0)