diff mbox series

[v5,18/19] libpdbg: Enable sbefifo backend

Message ID 20200430023440.225504-19-amitay@ozlabs.org
State Accepted
Headers show
Series Add sbefifo backend | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (6c10b68bf774a9fe21affd5ef0b40084cd49800d)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Amitay Isaacs April 30, 2020, 2:34 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Alistair Popple <alistair@popple.id.au>
---
 libpdbg/dtb.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c
index 6a75de4..a549c2f 100644
--- a/libpdbg/dtb.c
+++ b/libpdbg/dtb.c
@@ -43,6 +43,7 @@ 
 #include "p9-host.dt.h"
 #include "p8-cronus.dt.h"
 #include "p9-cronus.dt.h"
+#include "p9-sbefifo.dt.h"
 
 #include "p8.dt.h"
 #include "p9.dt.h"
@@ -93,6 +94,8 @@  static enum pdbg_backend default_backend(void)
 			return PDBG_BACKEND_HOST;
 		else if (!strcmp(tmp, "cronus"))
 			return PDBG_BACKEND_CRONUS;
+		else if (!strcmp(tmp, "sbefifo"))
+			return PDBG_BACKEND_SBEFIFO;
 	}
 
 	rc = access(XSCOM_BASE_PATH, F_OK);
@@ -419,6 +422,24 @@  struct pdbg_dtb *pdbg_default_dtb(void *system_fdt)
 		}
 		break;
 
+	case PDBG_BACKEND_SBEFIFO:
+		if (!pdbg_backend_option) {
+			pdbg_log(PDBG_ERROR, "No system type specified\n");
+			pdbg_log(PDBG_ERROR, "Use p9\n");
+			return NULL;
+		}
+
+		if (!strcmp(pdbg_backend_option, "p9")) {
+			if (!dtb->backend.fdt)
+				dtb->backend.fdt = &_binary_p9_sbefifo_dtb_o_start;
+			if (!dtb->system.fdt)
+				dtb->system.fdt = &_binary_p9_dtb_o_start;
+		} else {
+			pdbg_log(PDBG_ERROR, "Invalid system type %s\n", pdbg_backend_option);
+			pdbg_log(PDBG_ERROR, "Use p9\n");
+		}
+		break;
+
 	default:
 		pdbg_log(PDBG_WARNING, "Unable to determine a valid default backend, using fake backend for testing purposes\n");
 		/* Fall through */