[Pdbg] [PATCH 09/10] libpdbg/p9chip.c: Add more steps to ram_setup

Nicholas Piggin npiggin at gmail.com
Tue May 1 22:00:44 AEST 2018


These come from the workbook.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 libpdbg/p9chip.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 3a68ea8..259d958 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -166,6 +166,7 @@ static int p9_ram_setup(struct thread *thread)
 {
 	struct pdbg_target *target;
 	struct core *chip = target_to_core(thread->target.parent);
+	uint64_t value;
 
 	/* We can only ram a thread if all the threads on the core/chip are
 	 * quiesced */
@@ -180,6 +181,19 @@ static int p9_ram_setup(struct thread *thread)
 			return 1;
 	}
 
+	/* Wait for NEST_ACTIVE to clear */
+	do {
+		thread_read(thread, P9_RAS_STATUS, &value);
+	} while (value & PPC_BIT(32));
+
+	/* Wait for THREAD_ACTION_IN_PROGRESS to clear */
+	do {
+		thread_read(thread, P9_THREAD_INFO, &value);
+	} while (value & PPC_BIT(23));
+
+	/* Activate thread */
+	CHECK_ERR(thread_write(thread, P9_THREAD_INFO, PPC_BIT(18 + thread->id)));
+
  	/* Enable ram mode */
 	CHECK_ERR(thread_write(thread, P9_RAM_MODEREG, PPC_BIT(0)));
 
-- 
2.17.0



More information about the Pdbg mailing list