[Skiboot] [PATCH 04/21] platform: Call generic platform probe and init UART there

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Nov 14 13:06:04 AEDT 2016


At the moment the generic platform initializes the UART really late,
which make debugging harder than it needs to be. Most platforms set
it up in their probe() callback but the generic platform doesn't have
one.

This adds one and initializes the UART in it.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 core/platform.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/core/platform.c b/core/platform.c
index 99f1d1c..5878164 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -101,11 +101,15 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag)
 }
 opal_call(OPAL_CEC_REBOOT2, opal_cec_reboot2, 2);
 
-static void generic_platform_init(void)
+static bool generic_platform_probe(void)
 {
-	/* Enable a UART if we find one in the device-tree */
 	uart_init();
 
+	return true;
+}
+
+static void generic_platform_init(void)
+{
 	if (uart_enabled())
 		uart_setup_opal_console();
 	else
@@ -130,6 +134,7 @@ static struct bmc_platform generic_bmc = {
 static struct platform generic_platform = {
 	.name		= "generic",
 	.bmc		= &generic_bmc,
+	.probe          = generic_platform_probe,
 	.init		= generic_platform_init,
 	.cec_power_down	= generic_cec_power_down,
 };
@@ -158,13 +163,17 @@ void probe_platform(void)
 		manufacturing_mode = true;
 	}
 
-	platform = generic_platform;
 	for (i = 0; &platforms[i] < &__platforms_end; i++) {
 		if (platforms[i].probe && platforms[i].probe()) {
 			platform = platforms[i];
 			break;
 		}
 	}
+	if (!platform.name) {
+		platform = generic_platform;
+		if (platform.probe)
+			platform.probe();
+	}
 
 	prlog(PR_NOTICE, "PLAT: Detected %s platform\n", platform.name);
 
-- 
2.7.4



More information about the Skiboot mailing list