[Skiboot] [PATCH 2/6] plat/astbmc: introduce astbmc_get_primary_lpc()

Cédric Le Goater clg at fr.ibm.com
Thu Apr 7 02:30:08 AEST 2016


Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
 platforms/astbmc/astbmc.h |  1 +
 platforms/astbmc/common.c |  9 ++++++++-
 platforms/astbmc/qemu.c   | 12 +++---------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index 23c31c7cae38..cc85d477c92e 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -36,6 +36,7 @@ struct slot_table_entry {
 extern void astbmc_early_init(void);
 extern int64_t astbmc_ipmi_reboot(void);
 extern int64_t astbmc_ipmi_power_down(uint64_t request);
+extern struct dt_node *astbmc_get_primary_lpc(void);
 extern void astbmc_init(void);
 extern void astbmc_ext_irq_serirq_cpld(unsigned int chip_id);
 extern int pnor_init(void);
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 1ed7d42dd836..99acde9e88c1 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -263,7 +263,7 @@ static void astbmc_fixup_bmc_sensors(void)
 	}
 }
 
-static void astbmc_fixup_dt(void)
+struct dt_node *astbmc_get_primary_lpc(void)
 {
 	struct dt_node *n, *primary_lpc = NULL;
 
@@ -275,6 +275,13 @@ static void astbmc_fixup_dt(void)
 			break;
 	}
 
+	return primary_lpc;
+}
+
+static void astbmc_fixup_dt(void)
+{
+	struct dt_node *primary_lpc = astbmc_get_primary_lpc();
+
 	if (!primary_lpc)
 		return;
 
diff --git a/platforms/astbmc/qemu.c b/platforms/astbmc/qemu.c
index 66a6aa3970c2..07903eb03b89 100644
--- a/platforms/astbmc/qemu.c
+++ b/platforms/astbmc/qemu.c
@@ -22,6 +22,8 @@
 #include <opal.h>
 #include <psi.h>
 
+#include "astbmc.h"
+
 static void qemu_init(void)
 {
 	/* Setup UART console for use by Linux via OPAL API */
@@ -98,15 +100,7 @@ static void qemu_dt_fixup_rtc(struct dt_node *lpc)
 
 static void qemu_dt_fixup(void)
 {
-	struct dt_node *n, *primary_lpc = NULL;
-
-	/* Find the primary LPC bus */
-	dt_for_each_compatible(dt_root, n, "ibm,power8-lpc") {
-		if (!primary_lpc || dt_has_node_property(n, "primary", NULL))
-			primary_lpc = n;
-		if (dt_has_node_property(n, "#address-cells", NULL))
-			break;
-	}
+	struct dt_node *primary_lpc = astbmc_get_primary_lpc();
 
 	if (!primary_lpc)
 		return;
-- 
2.1.4



More information about the Skiboot mailing list