summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpdbg/p8chip.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 71e6569..cd4a50b 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -278,8 +278,6 @@ static int p8_thread_stop(struct thread *thread)
{
int i = 0;
uint64_t val;
- struct core *chip = target_to_core(
- pdbg_target_require_parent("core", &thread->target));
/* Quiese active thread */
CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP));
@@ -298,20 +296,8 @@ static int p8_thread_stop(struct thread *thread)
}
break;
}
-
- /* We can continue ramming if either the
- * thread is not active or the SRQ/LSU/TS bits
- * are set. */
- } while ((val & RAS_STATUS_THREAD_ACTIVE) &&
- !((val & RAS_STATUS_SRQ_EMPTY)
- && (val & RAS_STATUS_LSU_QUIESCED)
- && (val & RAS_STATUS_TS_QUIESCE)));
-
-
- /* Make the threads RAM thread active */
- CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
- val |= PPC_BIT(8) >> thread->id;
- CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));
+ } while (!(val & RAS_STATUS_INST_COMPLETE) &&
+ !(val & RAS_STATUS_TS_QUIESCE));
thread->status = get_thread_status(thread);
@@ -320,19 +306,9 @@ static int p8_thread_stop(struct thread *thread)
static int p8_thread_start(struct thread *thread)
{
- uint64_t val;
- struct core *chip = target_to_core(
- pdbg_target_require_parent("core", &thread->target));
-
/* Activate thread */
CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START));
- /* Restore thread active */
- CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
- val &= ~(PPC_BIT(8) >> thread->id);
- val |= PPC_BIT(thread->id);
- CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));
-
thread->status = get_thread_status(thread);
return 0;
@@ -369,8 +345,10 @@ static int p8_ram_setup(struct thread *thread)
return 1;
}
- if (!(thread->status.active))
+ if (!(thread->status.active)) {
+ PR_WARNING("Thread is in power save state, can not RAM\n");
return 2;
+ }
/* Activate RAM mode */
CHECK_ERR(pib_read(&chip->target, RAM_MODE_REG, &ram_mode));
@@ -429,7 +407,14 @@ static int p8_ram_destroy(struct thread *thread)
{
struct core *chip = target_to_core(
pdbg_target_require_parent("core", &thread->target));
- uint64_t ram_mode;
+ uint64_t val, ram_mode;
+
+ if (!(get_thread_status(thread).active)) {
+ /* Mark the RAM thread active so GPRs stick */
+ CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val));
+ val |= PPC_BIT(8) >> thread->id;
+ CHECK_ERR(pib_write(&chip->target, THREAD_ACTIVE_REG, val));
+ }
/* Disable RAM mode */
CHECK_ERR(pib_read(&chip->target, RAM_MODE_REG, &ram_mode));
OpenPOWER on IntegriCloud