Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sunxi Add 'console=fb' cmdline support.



details:   https://anonhg.NetBSD.org/src/rev/cab6d63db45e
branches:  trunk
changeset: 826428:cab6d63db45e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Sep 03 13:59:17 2017 +0000

description:
Add 'console=fb' cmdline support.

diffstat:

 sys/arch/arm/sunxi/sunxi_platform.c |  32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diffs (89 lines):

diff -r 9891a17665fc -r cab6d63db45e sys/arch/arm/sunxi/sunxi_platform.c
--- a/sys/arch/arm/sunxi/sunxi_platform.c       Sun Sep 03 13:41:19 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_platform.c       Sun Sep 03 13:59:17 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.7 2017/08/25 00:07:03 jmcneill Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.8 2017/09/03 13:59:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.7 2017/08/25 00:07:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.8 2017/09/03 13:59:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -58,6 +58,8 @@
 
 #include <arm/sunxi/sunxi_platform.h>
 
+#include <libfdt.h>
+
 #define        SUNXI_REF_FREQ  24000000
 
 #define        SUN4I_TIMER_BASE        0x01c20c00
@@ -144,8 +146,24 @@
 }
 
 static void
-sunxi_platform_null_bootstrap(void)
+sunxi_platform_bootstrap(void)
 {
+       if (match_bootconf_option(boot_args, "console", "fb")) {
+               void *fdt_data = __UNCONST(fdtbus_get_data());
+               const int chosen_off = fdt_path_offset(fdt_data, "/chosen");
+               const int framebuffer_off =
+                   fdt_path_offset(fdt_data, "/chosen/framebuffer");
+               if (chosen_off >= 0 && framebuffer_off >= 0)
+                       fdt_setprop_string(fdt_data, chosen_off, "stdout-path",
+                           "/chosen/framebuffer");
+       }
+}
+
+static void
+sunxi_platform_psci_bootstrap(void)
+{
+       psci_fdt_bootstrap();
+       sunxi_platform_bootstrap();
 }
 
 static void
@@ -200,7 +218,7 @@
 
 static const struct arm_platform sun5i_platform = {
        .devmap = sunxi_platform_devmap,
-       .bootstrap = sunxi_platform_null_bootstrap,
+       .bootstrap = sunxi_platform_bootstrap,
        .init_attach_args = sunxi_platform_init_attach_args,
        .early_putchar = sunxi_platform_early_putchar,
        .device_register = sunxi_platform_device_register,
@@ -213,7 +231,7 @@
 
 static const struct arm_platform sun6i_platform = {
        .devmap = sunxi_platform_devmap,
-       .bootstrap = psci_fdt_bootstrap,
+       .bootstrap = sunxi_platform_psci_bootstrap,
        .init_attach_args = sunxi_platform_init_attach_args,
        .early_putchar = sunxi_platform_early_putchar,
        .device_register = sunxi_platform_device_register,
@@ -226,7 +244,7 @@
 
 static const struct arm_platform sun8i_platform = {
        .devmap = sunxi_platform_devmap,
-       .bootstrap = psci_fdt_bootstrap,
+       .bootstrap = sunxi_platform_psci_bootstrap,
        .init_attach_args = sunxi_platform_init_attach_args,
        .early_putchar = sunxi_platform_early_putchar,
        .device_register = sunxi_platform_device_register,
@@ -241,7 +259,7 @@
 
 static const struct arm_platform sun50i_platform = {
        .devmap = sunxi_platform_devmap,
-       .bootstrap = sunxi_platform_null_bootstrap,
+       .bootstrap = sunxi_platform_bootstrap,
        .init_attach_args = sunxi_platform_init_attach_args,
        .early_putchar = sunxi_platform_early_putchar,
        .device_register = sunxi_platform_device_register,



Home | Main Index | Thread Index | Old Index