diff mbox

generic platform: If /bmc in device tree, attempt to init one

Message ID 20170315074025.20018-1-stewart@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Stewart Smith March 15, 2017, 7:40 a.m. UTC
For the most part, this gets us somewhere on some OpenPOWER systems
before there's a platform file for that machine.

Useful in bringup only, and marked as such with scary looking log
messages.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 core/platform.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox

Patch

diff --git a/core/platform.c b/core/platform.c
index 1d4ae6da3ced..7e3db4586371 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -25,6 +25,7 @@ 
 #include <errorlog.h>
 #include <bt.h>
 #include <nvram.h>
+#include <platforms/astbmc/astbmc.h>
 
 bool manufacturing_mode = false;
 struct platform	platform;
@@ -107,6 +108,16 @@  static bool generic_platform_probe(void)
 {
 	uart_init();
 
+	if (!dt_find_by_path(dt_root, "bmc")) {
+		/* We appear to have a BMC... so let's cross our fingers
+		 * and see if we can do anything!
+		 */
+		prlog(PR_ERR, "GENERIC BMC PLATFORM: **GUESSING** that there's "
+		      "*maybe* a BMC we can talk to.\n");
+		prlog(PR_ERR, "THIS IS ****UNSUPPORTED****, BRINGUP USE ONLY.\n");
+		astbmc_early_init();
+}
+
 	return true;
 }
 
@@ -118,6 +129,11 @@  static void generic_platform_init(void)
 	/* Enable a BT interface if we find one too */
 	bt_init();
 
+	if (!dt_find_by_path(dt_root, "bmc")) {
+		prlog(PR_ERR, "BMC-GUESSWORK: Here be dragons with a taste for human flesh\n");
+		astbmc_init();
+	}
+
 	/* Fake a real time clock */
 	fake_rtc_init();
 }