[Pdbg] [PATCH 5/6] libpdbg: Add cronus backend

Amitay Isaacs amitay at ozlabs.org
Wed Jul 3 19:13:53 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/dtb.c     | 19 +++++++++++++++++++
 libpdbg/libpdbg.h |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c
index 998698f..7fd8e4c 100644
--- a/libpdbg/dtb.c
+++ b/libpdbg/dtb.c
@@ -39,6 +39,8 @@
 #include "p9-kernel.dt.h"
 #include "p8-host.dt.h"
 #include "p9-host.dt.h"
+#include "p8-cronus.dt.h"
+#include "p9-cronus.dt.h"
 
 #define AMI_BMC "/proc/ractrends/Helper/FwInfo"
 #define OPENFSI_BMC "/sys/bus/platform/devices/gpio-fsi/fsi0/"
@@ -264,6 +266,23 @@ void *pdbg_default_dtb(void)
 
 		break;
 
+	case PDBG_BACKEND_CRONUS:
+		if (!pdbg_backend_option) {
+			pdbg_log(PDBG_WARNING, "No device type specified, using fake backend\n");
+			return &_binary_fake_dtb_o_start;
+		}
+
+		if (!strncmp(pdbg_backend_option, "p8", 2))
+			return &_binary_p8_cronus_dtb_o_start;
+		else if (!strncmp(pdbg_backend_option, "p9", 2))
+			return &_binary_p9_cronus_dtb_o_start;
+		else {
+			pdbg_log(PDBG_WARNING, "Invalid device type specified, using fake backend\n");
+			return &_binary_fake_dtb_o_start;
+		}
+
+		break;
+
 	default:
 		pdbg_log(PDBG_WARNING, "Unable to determine a valid default backend, using fake backend for testing purposes\n");
 		/* Fall through */
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index ae763e5..d9fd46e 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -53,7 +53,8 @@ enum pdbg_target_status {PDBG_TARGET_UNKNOWN = 0, PDBG_TARGET_ENABLED,
 			 PDBG_TARGET_NONEXISTENT, PDBG_TARGET_RELEASED};
 
 enum pdbg_backend { PDBG_DEFAULT_BACKEND = 0, PDBG_BACKEND_FSI, PDBG_BACKEND_I2C,
-		    PDBG_BACKEND_KERNEL, PDBG_BACKEND_FAKE, PDBG_BACKEND_HOST };
+		    PDBG_BACKEND_KERNEL, PDBG_BACKEND_FAKE, PDBG_BACKEND_HOST,
+		    PDBG_BACKEND_CRONUS };
 
 #define pdbg_for_each_compatible(parent, target, compat)		\
         for (target = NULL;                                             \
-- 
2.21.0



More information about the Pdbg mailing list