diff mbox series

libpdbg: Add a hardware unit for the processor module

Message ID 20200320050336.26745-1-alistair@popple.id.au
State Superseded
Headers show
Series libpdbg: Add a hardware unit for the processor module | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (8b4611b5d8e7e2279fe4aa80c892fcfe10aa398d)
snowpatch_ozlabs/build-multiarch fail Test build-multiarch on branch master

Commit Message

Alistair Popple March 20, 2020, 5:03 a.m. UTC
The processor target is a purely logical target but it can be useful
for storing processor wide properties. This means an easy way of
iterating over the processor targets is required, so add a hardware
unit which assigns them to a specific class.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 libpdbg/chip.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 908b20d..b45cffa 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -666,3 +666,18 @@  int thread_getregs(struct pdbg_target *thread, struct thread_regs *regs)
 
 	return 0;
 }
+
+static struct proc proc = {
+	.target = {
+		.name = "Processor Module",
+		.compatible = "ibm,processor",
+		.class = "proc",
+	},
+};
+DECLARE_HW_UNIT(proc);
+
+__attribute__((constructor))
+static void register_proc(void)
+{
+	pdbg_hwunit_register(&proc_hw_unit);
+}