diff options
Diffstat (limited to 'libpdbg')
-rw-r--r-- | libpdbg/chip.c | 16 | ||||
-rw-r--r-- | libpdbg/operations.h | 1 | ||||
-rw-r--r-- | libpdbg/target.c | 1 |
3 files changed, 5 insertions, 13 deletions
diff --git a/libpdbg/chip.c b/libpdbg/chip.c index 39a5194..14c92b3 100644 --- a/libpdbg/chip.c +++ b/libpdbg/chip.c @@ -172,7 +172,7 @@ uint64_t chiplet_thread_status(struct target *thread) static uint64_t get_thread_status(struct target *thread) { - uint64_t val, mode_reg, thread_status = 0; + uint64_t val, mode_reg, thread_status = thread->status; /* Need to activete debug mode to get complete status */ CHECK_ERR(read_target(thread, RAS_MODE_REG, &mode_reg)); @@ -182,11 +182,8 @@ static uint64_t get_thread_status(struct target *thread) /* Read status */ CHECK_ERR(read_target(thread, RAS_STATUS_REG, &val)); - if (val & RAS_STATUS_THREAD_ACTIVE) - thread_status |= THREAD_STATUS_ACTIVE; - - if (val & RAS_STATUS_TS_QUIESCE) - thread_status |= THREAD_STATUS_QUIESCE; + thread_status = SETFIELD(THREAD_STATUS_ACTIVE, thread_status, !!(val & RAS_STATUS_THREAD_ACTIVE)); + thread_status = SETFIELD(THREAD_STATUS_QUIESCE, thread_status, !!(val & RAS_STATUS_TS_QUIESCE)); /* Read POW status */ CHECK_ERR(read_target(thread, POW_STATUS_REG, &val)); @@ -235,10 +232,6 @@ int ram_stop_thread(struct target *thread) uint64_t val; struct target *chip = thread->next; - /* Skip inactive threads */ - if (!GETFIELD(THREAD_STATUS_ACTIVE, thread->status)) - return -1; - do { /* Quiese active thread */ CHECK_ERR(write_target(thread, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP)); @@ -278,9 +271,6 @@ int ram_start_thread(struct target *thread) struct target *chip = thread->next; int thread_id = (thread->base >> 4) & 0x7; - if (!GETFIELD(THREAD_STATUS_ACTIVE, thread->status)) - return -1; - /* Activate thread */ CHECK_ERR(write_target(thread, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START)); diff --git a/libpdbg/operations.h b/libpdbg/operations.h index a60a4ea..b57aa79 100644 --- a/libpdbg/operations.h +++ b/libpdbg/operations.h @@ -44,6 +44,7 @@ int adu_getmem(struct target *target, uint64_t addr, uint8_t *output, uint64_t s int adu_putmem(struct target *target, uint64_t start_addr, uint8_t *input, uint64_t size); /* Functions to ram instructions */ +#define THREAD_STATUS_DISABLED PPC_BIT(0) #define THREAD_STATUS_ACTIVE PPC_BIT(63) #define THREAD_STATUS_STATE PPC_BITMASK(61, 62) #define THREAD_STATUS_DOZE PPC_BIT(62) diff --git a/libpdbg/target.c b/libpdbg/target.c index 97641ee..228e778 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -16,6 +16,7 @@ void target_init(struct target *target, const char *name, uint64_t base, target->write = write; target->destroy = destroy; target->next = next; + target->status = 0; list_head_init(&target->children); |