[Pdbg] [PATCH 4/8] libpdbg: Use thread method to get state
Joel Stanley
joel at jms.id.au
Fri Oct 9 23:47:04 AEDT 2020
On Fri, 9 Oct 2020 at 04:00, Amitay Isaacs <amitay at ozlabs.org> wrote:
>
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
If you did this before renaming the functions it would have been less churn?
No matter now that you've written the code.
Reviewed-by: Joel Stanley <joel at jms.id.au>
> ---
> 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
>
> --
> Pdbg mailing list
> Pdbg at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
More information about the Pdbg
mailing list