[Pdbg] [PATCH] pdbg: Fix target selection when using I2C

Alistair Popple alistair at popple.id.au
Thu May 24 13:49:24 AEST 2018


I2C based access is unique in that to access the PIB on secondary processors we
need to traverse the PIB on the primary processor. This confuses our current
selection logic as every core becomes a child of the primary PIB. Hopefully our
selection logic will get rewritten soon, but in the meantime add a check to
ensure a cores immediate parent PIB matches the currently selected processor.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 src/main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 20f5319..4a0b3df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -454,12 +454,16 @@ static int target_selection(void)
 			target_select(pib);
 			pdbg_for_each_target("core", pib, chip) {
 				int chip_index = pdbg_target_index(chip);
-				target_select(chip);
+				if (pdbg_parent_index(chip, "pib") != proc_index)
+					continue;
+
 				if (chipsel[proc_index][chip_index]) {
+					target_select(chip);
 					pdbg_for_each_target("thread", chip, thread) {
 						int thread_index = pdbg_target_index(thread);
-						target_select(thread);
-						if (!threadsel[proc_index][chip_index][thread_index])
+						if (threadsel[proc_index][chip_index][thread_index])
+							target_select(thread);
+						else
 							target_unselect(thread);
 					}
 				} else
-- 
2.11.0



More information about the Pdbg mailing list