[Skiboot] [PATCH 3/4] platform: Call generic platform probe and init UART there
Benjamin Herrenschmidt
benh at kernel.crashing.org
Fri Sep 16 14:50:39 AEST 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 | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/core/platform.c b/core/platform.c
index 7672914..4bc01e7 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -98,11 +98,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
@@ -120,8 +124,9 @@ static int64_t generic_cec_power_down(uint64_t request __unused)
return OPAL_UNSUPPORTED;
}
-static struct platform generic_platform = {
+static const struct platform generic_platform = {
.name = "generic",
+ .probe = generic_platform_probe,
.init = generic_platform_init,
.cec_power_down = generic_cec_power_down,
};
@@ -143,13 +148,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