Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darjeeling updates #57

Merged
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
acdc714
[ot] scripts/opentitan: pyot.py: fix a bug with undefined start delay
rivos-eblot Feb 16, 2024
6611171
[ot] scripts/opentitan: gdbreplay: fix parsing with rust demangled sy…
rivos-eblot Feb 22, 2024
ee8b445
[ot] hw/riscv: rename Darjeeling and EarlGrey symbols
rivos-eblot Feb 8, 2024
5131def
[ot] hw/opentitan: ot_ibex_wrapper: fix call to stop vCPU execution
rivos-eblot Feb 13, 2024
d724b31
[ot] hw/opentitan: flash: don't exit QEMU on flash disable
loiclefort Feb 14, 2024
b4197b0
[ot] hw/riscv: ot-earlgrey: connect lc_ctrl and pwrmgr
loiclefort Feb 14, 2024
136ee0d
[ot] hw/opentitan: ot_flash: fix invalid trace source
rivos-eblot Feb 15, 2024
cc0cf39
[ot] hw/opentitan: ot_csrng: remove command processing delay
loiclefort Feb 14, 2024
ea9d7f4
[ot] hw/opentitan: ot_csrng: fix a race condition
rivos-eblot Feb 15, 2024
fe2d7c9
[ot] hw/opentitan: ot_csrng: add wait time hints from entropy source.
rivos-eblot Feb 16, 2024
ab05081
[ot] hw/opentitan: ot_ast_dj: implement entropy source time hinting
rivos-eblot Feb 16, 2024
d4896f7
[ot] hw/opentitan: ot_entropy_src: implement entropy source time hinting
rivos-eblot Feb 16, 2024
2948486
[ot] hw/opentitan: ot_common: define which virtual clock to use for a…
rivos-eblot Feb 20, 2024
c8663e8
[ot] hw/opentitan: ot_edn: fix a bug with outstanding requests
rivos-eblot Feb 16, 2024
836754b
[ot] hw/opentitan: ot_gpio: fix invalid debug trace
rivos-eblot Feb 20, 2024
fc51aca
[ot] hw/opentitan: ot_devproxy: fix invalid debug traces
rivos-eblot Feb 20, 2024
80fe928
[ot] hw/riscv: ot_darjeeling, ot_earlgrey: document extra reset cycle
rivos-eblot Feb 13, 2024
ef48d3e
[ot] hw/riscv: ibex_irq: add an API to initialize IbexIRQ with custom…
rivos-eblot Feb 20, 2024
9299270
[ot] hw/opentitan: ot_ibex_wrapper_dj: add `lc-ignore-ids` option
rivos-eblot Feb 21, 2024
ae62256
[ot] hw/opentitan: ot_rstmgr: fix a bug on vCPU reset
rivos-eblot Feb 13, 2024
19158d7
[ot] hw/opentitan: ot_pwrmgr: ensure only one reset req. can be sched…
rivos-eblot Feb 13, 2024
f56c332
[ot] hw/opentitan: ot_pwrmgr: rework event management
rivos-eblot Feb 14, 2024
e3cfc32
[ot] hw/opentitan: ot_pwrmgr: add a custom extension to hold on Ibex …
rivos-eblot Feb 16, 2024
64b5074
[ot] hw/opentitan: ot_pwgmgr: use Resettable reset management.
rivos-eblot Feb 20, 2024
eb5e2f8
[ot] hw/opentitan: ot_pwrmgr: handle EarlGrey and Darjeeling variations.
rivos-eblot Feb 20, 2024
dcb5a90
[ot] hw/riscv: Implement resettable interface for OT Darjeeling machine
rivos-eblot Feb 23, 2024
d92079f
[ot] hw/opentitan: ot_mbx: fix host & sys mailbox apertures
rivos-eblot Feb 26, 2024
7c3e107
[ot] hw/riscv: ot_darjeeling: set DMI abits to 12
rivos-eblot Feb 8, 2024
ee761a5
[ot] hw/riscv: ot_darjeeling: use explicit constants
rivos-eblot Feb 26, 2024
2554f96
[ot] hw/riscv: ot_darjeeling: add LC_CTRL DMI
rivos-eblot Feb 26, 2024
735faec
[ot] jtag: jtag_bitbang: fix idcode handling
rivos-eblot Feb 12, 2024
f2627c7
[ot] hw/riscv: add a trace for DTM reset
rivos-eblot Feb 12, 2024
a12f442
[ot] jtag: quit VM on JTAG bitbang request.
rivos-eblot Feb 26, 2024
9ada186
[ot] jtag: use an hash_table for storing data handlers
rivos-eblot Feb 14, 2024
6cf4747
[ot] scripts/opentitan: create a Python module for OpenTitan tools
rivos-eblot Feb 13, 2024
b5f979c
[ot] scripts/opentitan: add a Python module for log utilities
rivos-eblot Feb 13, 2024
f906e33
[ot] scripts/opentitan: factorize log configuration using log utility
rivos-eblot Feb 13, 2024
eeded64
[ot] scripts/opentitan: add a mailbox requester module
rivos-eblot Feb 13, 2024
639d2fb
[ot] scripts/opentitan: move DoE module into a sub-directory
rivos-eblot Feb 15, 2024
402bb74
[ot] scripts/jtag: add a Python module to communicate with JTAG server
rivos-eblot Feb 12, 2024
2c88929
[ot] scripts/opentitan: add a Python module for DTM/DMI implementation.
rivos-eblot Feb 26, 2024
43f1156
[ot] scripts/opentitan: add a mailbox requester JTAG implementation
rivos-eblot Feb 26, 2024
541e7cd
[ot] hw/riscv: rename dmi as dtm
rivos-eblot Feb 26, 2024
97e6544
[ot] hw/opentitan: rename dmi as dtm
rivos-eblot Feb 22, 2024
8d7b539
[ot] jtag: jtag_bitbang: improve trace messages
rivos-eblot Feb 26, 2024
02d4288
[ot] hw/riscv: dtm: fix handling of NOP operations.
rivos-eblot Feb 22, 2024
600aec6
[ot] hw/opentitan: ot_dm_tl: improve trace
rivos-eblot Feb 22, 2024
d7d972a
[ot] scripts/opentitan: add a Python module for LifeCycle Controller …
rivos-eblot Feb 26, 2024
5691cab
[ot] jtag: jtag_bitbang: implement system reset
rivos-eblot Feb 23, 2024
2084aad
[ot] scripts/opentitan: create a small QEMU stream muxer.
rivos-eblot Feb 28, 2024
fdf9830
[ot] hw/opentitan: use qemu_system_shutdown_request_with_code, not exit
rivos-eblot Feb 28, 2024
390279c
[ot] .gitlab-ci.d: update baremetal reference
loiclefort Feb 29, 2024
432f2b2
[ot] .gitlab-ci.d: explicitly select clang version
loiclefort Feb 29, 2024
7ce95d8
[ot] .gitlab-ci.d: fix pyot test filter for EarlGrey
loiclefort Feb 29, 2024
a0f53e5
[ot] .gitlab-ci.d: add jtag to clang-tidy and clang-format config
loiclefort Feb 29, 2024
102e8ef
[ot] scripts/opentitan: add default file list to ot-format/tidy
loiclefort Mar 1, 2024
3f4386a
[ot] .gitlab-ci.d: use --ci option for ot-format/tidy
loiclefort Mar 1, 2024
e5da0ab
[ot] .github: use ot-format/ot-tidy
loiclefort Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ot] jtag: use an hash_table for storing data handlers
Signed-off-by: Emmanuel Blot <[email protected]>
rivos-eblot authored and loiclefort committed Feb 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9ada186fbff3e7b6219825700effd8b74233e2d6
98 changes: 64 additions & 34 deletions jtag/jtag_bitbang.c
Original file line number Diff line number Diff line change
@@ -55,6 +55,8 @@
* Type definitions
*/

/* clang-format off */

typedef enum {
TEST_LOGIC_RESET,
RUN_TEST_IDLE,
@@ -77,6 +79,8 @@ typedef enum {

typedef enum { TAPCTRL_BYPASS = 0, TAPCTRL_IDCODE = 1 } TAPCtrlKnownIrCodes;

/* clang-format on */

typedef TAPDataHandler *tapctrl_data_reg_extender_t(uint64_t value);

typedef struct _TAPController {
@@ -96,7 +100,7 @@ typedef struct _TAPController {
size_t dr_len; /* count of meaningful bits in dr */
/* handlers */
TAPDataHandler *tdh; /* Current data register handler */
TAPDataHandler *tdhs; /* Registered handlers */
GHashTable *tdhtable; /* Registered handlers */
/* buffer */
} TAPController;

@@ -210,6 +214,20 @@ static void tapctrl_dump_register(const char *msg, uint64_t value,
trace_jtag_tapctrl_dump_register(msg, value, length, buf);
}

static bool tapctrl_has_data_handler(TAPController *tap, unsigned code)
{
return (bool)g_hash_table_contains(tap->tdhtable, GINT_TO_POINTER(code));
}

static TAPDataHandler *
tapctrl_get_data_handler(TAPController *tap, unsigned code)
{
TAPDataHandler *tdh;
tdh = (TAPDataHandler *)g_hash_table_lookup(tap->tdhtable,
GINT_TO_POINTER(code));
return tdh;
}

static void tapctrl_idcode_capture(TAPDataHandler *tdh)
{
/* special case for ID code: opaque contains the ID code value */
@@ -229,50 +247,63 @@ static void tapctrl_reset(TAPController *tap)
tap->ir_hold = 0b01;
tap->dr = 0u;
tap->dr_len = 0u;
tap->tdh = &tap->tdhs[tap->ir];
tap->tdh = tapctrl_get_data_handler(tap, TAPCTRL_IDCODE);
g_assert(tap->tdh);
}

static void tapctrl_register_handler(TAPController *tap, unsigned code,
const TAPDataHandler *tdh)
{
memcpy(&tap->tdhs[code], tdh, sizeof(*tdh));
if (code >= (1 << tap->ir_len)) {
error_setg(&error_fatal, "JTAG: Invalid IR code: 0x%x", code);
g_assert_not_reached();
}
if (tapctrl_has_data_handler(tap, code)) {
warn_report("JTAG: IR code already registered: 0x%x", code);
/* resume and override */
}
TAPDataHandler *ltdh = g_new0(TAPDataHandler, 1u);
memcpy(ltdh, tdh, sizeof(*tdh));
ltdh->name = g_strdup(tdh->name);
g_hash_table_insert(tap->tdhtable, GINT_TO_POINTER(code), ltdh);
trace_jtag_tapctrl_register(code, ltdh->name);
}

static void tapctrl_free_data_handler(gpointer entry)
{
TAPDataHandler *tdh = entry;
if (!entry) {
return;
}
tap->tdhs[code].name = g_strdup(tdh->name);
trace_jtag_tapctrl_register(code, tap->tdhs[code].name);
g_free((char *)tdh->name);
g_free(tdh);
}

static void tapctrl_init(TAPController *tap, size_t irlength, uint32_t idcode)
{
trace_jtag_tapctrl_init(irlength, idcode);

tap->ir_len = irlength;
tapctrl_reset(tap);
if (!tap->tdhs) {
if (!tap->tdhtable) {
size_t irslots = 1u << irlength;
tap->tdhs = g_new0(TAPDataHandler, irslots);
tap->tdhtable = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, tapctrl_free_data_handler);
tapctrl_register_handler(tap, TAPCTRL_BYPASS, &tapctrl_bypass);
tapctrl_register_handler(tap, TAPCTRL_IDCODE, &tapctrl_idcode);
tapctrl_register_handler(tap, irslots - 1u, &tapctrl_bypass);
/* special case for ID code: opaque store the constant idcode value */
tap->tdhs[TAPCTRL_IDCODE].opaque = (void *)(uintptr_t)idcode;
TAPDataHandler *tdh = tapctrl_get_data_handler(tap, TAPCTRL_IDCODE);
g_assert(tdh);
tdh->opaque = (void *)(uintptr_t)idcode;
}
tapctrl_reset(tap);
}

static void tapctrl_deinit(TAPController *tap)
{
if (tap->tdhs) {
unsigned irslots = 1 << tap->ir_len;
for (unsigned ix = 0; ix < irslots; ix++) {
if (tap->tdhs[ix].name) {
g_free((char *)tap->tdhs[ix].name);
tap->tdhs[ix].name = NULL;
}
}
if (tap->tdhtable) {
g_hash_table_destroy(tap->tdhtable);
tap->tdhtable = NULL;
}
g_free(tap->tdhs);
tap->tdhs = NULL;
tap->tdh = NULL;
}

@@ -284,7 +315,7 @@ static TAPState tapctrl_get_next_state(TAPController *tap, bool tms)

static void tapctrl_capture_ir(TAPController *tap)
{
tap->ir = 0b01;
tap->ir = TAPCTRL_IDCODE;
}

static void tapctrl_shift_ir(TAPController *tap, bool tdi)
@@ -299,27 +330,26 @@ static void tapctrl_update_ir(TAPController *tap)
tapctrl_dump_register("Update IR", tap->ir_hold, tap->ir_len);
}

static void tapctrl_capture_dr(TAPController *tap, uint64_t value)
static void tapctrl_capture_dr(TAPController *tap)
{
TAPDataHandler *prev = tap->tdh;

if (value >= (1 << tap->ir_len)) {
qemu_log_mask(LOG_UNIMP, "%s: Invalid IR 0x%02x\n", __func__,
(unsigned)value);
abort();
return;
if (tap->ir_hold >= (1 << tap->ir_len)) {
/* internal error, should never happen */
error_setg(&error_fatal, "Invalid IR 0x%02x\n", (unsigned)tap->ir_hold);
g_assert_not_reached();
}

TAPDataHandler *tdh = &tap->tdhs[value];
if (!tdh->length) {
qemu_log_mask(LOG_UNIMP, "%s: Unknown IR 0x%02x\n", __func__,
(unsigned)value);
abort();
TAPDataHandler *tdh = tapctrl_get_data_handler(tap, tap->ir_hold);
if (!tdh) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: Unknown IR 0x%02x\n", __func__,
(unsigned)tap->ir_hold);
tap->dr = 0;
return;
}

if (tdh != prev) {
trace_jtag_tapctrl_select_dr(tdh->name, value);
trace_jtag_tapctrl_select_dr(tdh->name, tap->ir_hold);
}

tap->tdh = tdh;
@@ -379,7 +409,7 @@ static void tapctrl_step(TAPController *tap, bool tck, bool tms, bool tdi)
tapctrl_reset(tap);
break;
case CAPTURE_DR:
tapctrl_capture_dr(tap, tap->ir_hold);
tapctrl_capture_dr(tap);
break;
case SHIFT_DR:
tap->tdo = tap->dr & 0b1;