diff mbox series

[1/4] libpdbg: Add fake processor

Message ID 20200624043856.175528-2-amitay@ozlabs.org
State New
Headers show
Series Test improvements | expand

Commit Message

Amitay Isaacs June 24, 2020, 4:38 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/fake.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/libpdbg/fake.c b/libpdbg/fake.c
index ae02463..5320305 100644
--- a/libpdbg/fake.c
+++ b/libpdbg/fake.c
@@ -20,6 +20,15 @@ 
 #include "operations.h"
 #include "hwunit.h"
 
+static struct proc fake_proc = {
+	.target = {
+		.name =	"Fake Processor",
+		.compatible = "ibm,fake-proc",
+		.class = "proc",
+	},
+};
+DECLARE_HW_UNIT(fake_proc);
+
 static int fake_fsi_read(struct fsi *fsi, uint32_t addr, uint32_t *value)
 {
 	*value = 0xfeed0cfa;
@@ -90,6 +99,7 @@  DECLARE_HW_UNIT(fake_thread);
 __attribute__((constructor))
 static void register_fake(void)
 {
+	pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_proc_hw_unit);
 	pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_fsi_hw_unit);
 	pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_pib_hw_unit);
 	pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_core_hw_unit);