[Pdbg] [PATCH 11/14] libpdbg/p9chip.c: Add more steps to ram_setup

Nicholas Piggin npiggin at gmail.com
Mon Apr 9 17:35:19 AEST 2018


---
 libpdbg/p9chip.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 2c6069a..ab0e9a1 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -154,6 +154,7 @@ static int p9_ram_setup(struct thread *thread)
 {
 	struct dt_node *dn;
 	struct core *chip = target_to_core(thread->target.dn->parent->target);
+	uint64_t value;
 
 	/* We can only ram a thread if all the threads on the core/chip are
 	 * quiesced */
@@ -168,6 +169,19 @@ static int p9_ram_setup(struct thread *thread)
 			return 1;
 	}
 
+	/* Wait or NEST_ACTIVE to clear */
+	do {
+		thread_read(thread, P9_RAS_STATUS, &value);
+	} while (value & PPC_BIT(32));
+
+	/* Wait or 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