[Pdbg] [PATCH 4/8] libpdbg: Use thread method to get state

Amitay Isaacs amitay at ozlabs.org
Fri Oct 9 14:59:57 AEDT 2020


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/p8chip.c | 10 +++++-----
 libpdbg/p9chip.c | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 6349a38..3764bd6 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -302,7 +302,7 @@ static int p8_thread_stop(struct thread *thread)
 	} while (!(val & RAS_STATUS_INST_COMPLETE) &&
 		 !(val & RAS_STATUS_TS_QUIESCE));
 
-	thread->status = p8_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -312,7 +312,7 @@ static int p8_thread_start(struct thread *thread)
 	/* Activate thread */
 	CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START));
 
-	thread->status = p8_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -462,7 +462,7 @@ static int p8_ram_destroy(struct thread *thread)
 		pdbg_target_require_parent("core", &thread->target));
 	uint64_t val, ram_mode;
 
-	if (!(p8_thread_state(thread).active)) {
+	if (!(thread->state(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;
@@ -559,7 +559,7 @@ static int p8_thread_sreset(struct thread *thread)
 
 	if (!(thread->status.active)) {
 		CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_SRESET));
-		thread->status = p8_thread_state(thread);
+		thread->status = thread->state(thread);
 
 		return 0;
 	}
@@ -590,7 +590,7 @@ static int p8_thread_probe(struct pdbg_target *target)
 	struct thread *thread = target_to_thread(target);
 
 	thread->id = (pdbg_target_address(target, NULL) >> 4) & 0xf;
-	thread->status = p8_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index e72a16a..05cce7f 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -118,7 +118,7 @@ static int p9_thread_probe(struct pdbg_target *target)
 	struct thread *thread = target_to_thread(target);
 
 	thread->id = pdbg_target_index(target);
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -147,7 +147,7 @@ static int p9_thread_start(struct thread *thread)
 		thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(6 + 8*thread->id));
 	}
 
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -157,14 +157,14 @@ static int p9_thread_stop(struct thread *thread)
 	int i = 0;
 
 	thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(7 + 8*thread->id));
-	while (!(p9_thread_state(thread).quiesced)) {
+	while (!(thread->state(thread).quiesced)) {
 		usleep(1000);
 		if (i++ > RAS_STATUS_TIMEOUT) {
 			PR_ERROR("Unable to quiesce thread\n");
 			break;
 		}
 	}
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -214,7 +214,7 @@ static int p9_thread_sreset(struct thread *thread)
 
 	thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id));
 
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	return 0;
 }
@@ -268,7 +268,7 @@ static int p9_ram_setup(struct thread *thread)
 	CHECK_ERR_GOTO(out_fail,
 		thread_write(thread, P9_SCOMC, 0x0));
 
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	thread->ram_is_setup = true;
 
@@ -398,7 +398,7 @@ static int p9_ram_destroy(struct thread *thread)
 	/* Deactivate thread for ramming */
 	CHECK_ERR(thread_write(thread, P9_THREAD_INFO, 0));
 
-	thread->status = p9_thread_state(thread);
+	thread->status = thread->state(thread);
 
 	thread->ram_is_setup = false;
 
-- 
2.26.2



More information about the Pdbg mailing list