Module Name: src Committed By: snj Date: Tue Jun 6 16:26:53 UTC 2017
Modified Files: src/sys/arch/arm/fdt [netbsd-8]: plfb_fdt.c src/sys/arch/arm/vexpress [netbsd-8]: vexpress_platform.c src/sys/arch/evbarm/conf [netbsd-8]: VEXPRESS_A15 src/sys/arch/evbarm/fdt [netbsd-8]: fdt_machdep.c src/sys/dev/ic [netbsd-8]: pl050.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #13): sys/arch/arm/fdt/plfb_fdt.c: revision 1.2 sys/arch/arm/vexpress/vexpress_platform.c: revision 1.3 sys/arch/evbarm/conf/VEXPRESS_A15: revision 1.13 sys/arch/evbarm/fdt/fdt_machdep.c: revisions 1.5, 1.6 sys/dev/ic/pl050.c: revision 1.2 Fix spelling of WS_DEFAULT_FG and WS_KERNEL_FG options. -- Attach kbd slot to console -- Allow plfb to be the console device -- Add support for stdout-path= kernel cmdline option to override the console device specified in the FDT. -- Initialize boot_args before bootstrap for the benefit of platform code. -- Allow 'console=fb' to act as a shortcut on vexpress for 'stdout-path=/smb@08000000/motherboard/iofpga@3,00000000/clcd@1f0000' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.2.1 src/sys/arch/arm/fdt/plfb_fdt.c cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/arch/arm/vexpress/vexpress_platform.c cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/evbarm/conf/VEXPRESS_A15 cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r1.1 -r1.1.2.1 src/sys/dev/ic/pl050.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/fdt/plfb_fdt.c diff -u src/sys/arch/arm/fdt/plfb_fdt.c:1.1 src/sys/arch/arm/fdt/plfb_fdt.c:1.1.2.1 --- src/sys/arch/arm/fdt/plfb_fdt.c:1.1 Sat Jun 3 14:50:39 2017 +++ src/sys/arch/arm/fdt/plfb_fdt.c Tue Jun 6 16:26:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $ */ +/* $NetBSD: plfb_fdt.c,v 1.1.2.1 2017/06/06 16:26:53 snj Exp $ */ /*- * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca> @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.1.2.1 2017/06/06 16:26:53 snj Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -68,6 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v #define PLFB_BPP 32 +static int plfb_console_phandle = -1; + struct plfb_softc { struct genfb_softc sc_gen; bus_space_tag_t sc_bst; @@ -170,7 +172,8 @@ plfb_attach(device_t parent, device_t se plfb_init(sc); sc->sc_wstype = WSDISPLAY_TYPE_PLFB; - prop_dictionary_set_bool(dict, "is_console", false); + prop_dictionary_set_bool(dict, "is_console", + phandle == plfb_console_phandle); genfb_init(&sc->sc_gen); @@ -294,3 +297,23 @@ plfb_init(struct plfb_softc *sc) LCDCONTROL_PWR | LCDCONTROL_EN | LCDCONTROL_BPP_24 | LCDCONTROL_BGR); } + +static int +plfb_console_match(int phandle) +{ + return of_match_compatible(phandle, compatible); +} + +static void +plfb_console_consinit(struct fdt_attach_args *faa, u_int uart_freq) +{ + plfb_console_phandle = faa->faa_phandle; + genfb_cnattach(); +} + +static const struct fdt_console plfb_fdt_console = { + .match = plfb_console_match, + .consinit = plfb_console_consinit +}; + +FDT_CONSOLE(plfb, &plfb_fdt_console); Index: src/sys/arch/arm/vexpress/vexpress_platform.c diff -u src/sys/arch/arm/vexpress/vexpress_platform.c:1.2 src/sys/arch/arm/vexpress/vexpress_platform.c:1.2.2.1 --- src/sys/arch/arm/vexpress/vexpress_platform.c:1.2 Fri Jun 2 20:16:05 2017 +++ src/sys/arch/arm/vexpress/vexpress_platform.c Tue Jun 6 16:26:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vexpress_platform.c,v 1.2 2017/06/02 20:16:05 jmcneill Exp $ */ +/* $NetBSD: vexpress_platform.c,v 1.2.2.1 2017/06/06 16:26:53 snj Exp $ */ /*- * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca> @@ -30,7 +30,7 @@ #include "opt_fdt_arm.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vexpress_platform.c,v 1.2 2017/06/02 20:16:05 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vexpress_platform.c,v 1.2.2.1 2017/06/06 16:26:53 snj Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -55,6 +55,10 @@ __KERNEL_RCSID(0, "$NetBSD: vexpress_pla #include <arm/vexpress/vexpress_platform.h> +#include <libfdt.h> + +#define VEXPRESS_CLCD_NODE_PATH \ + "/smb@08000000/motherboard/iofpga@3,00000000/clcd@1f0000" #define VEXPRESS_REF_FREQ 24000000 #define DEVMAP_ALIGN(a) ((a) & ~L1_S_OFFSET) @@ -165,6 +169,14 @@ vexpress_platform_bootstrap(void) arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU); vexpress_a15_smp_init(); + + 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"); + if (chosen_off >= 0) + fdt_setprop_string(fdt_data, chosen_off, "stdout-path", + VEXPRESS_CLCD_NODE_PATH); + } } static void Index: src/sys/arch/evbarm/conf/VEXPRESS_A15 diff -u src/sys/arch/evbarm/conf/VEXPRESS_A15:1.12 src/sys/arch/evbarm/conf/VEXPRESS_A15:1.12.2.1 --- src/sys/arch/evbarm/conf/VEXPRESS_A15:1.12 Sat Jun 3 17:05:23 2017 +++ src/sys/arch/evbarm/conf/VEXPRESS_A15 Tue Jun 6 16:26:53 2017 @@ -1,5 +1,5 @@ # -# $NetBSD: VEXPRESS_A15,v 1.12 2017/06/03 17:05:23 jmcneill Exp $ +# $NetBSD: VEXPRESS_A15,v 1.12.2.1 2017/06/06 16:26:53 snj Exp $ # # ARM Versatile Express A15 # @@ -68,9 +68,9 @@ genfb* at fdt? wsdisplay* at genfb? options VCONS_DRAW_INTR options WSEMUL_VT100 -options WS_DEFAULT_FB=WSCOL_WHITE +options WS_DEFAULT_FG=WSCOL_WHITE options WS_DEFAULT_BG=WSCOL_BLACK -options WS_KERNEL_FB=WSCOL_GREEN +options WS_KERNEL_FG=WSCOL_GREEN options WS_KERNEL_BG=WSCOL_BLACK options WSDISPLAY_COMPAT_PCVT options WSDISPLAY_COMPAT_SYSCONS Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.4 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.4.2.1 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.4 Fri Jun 2 13:53:29 2017 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Tue Jun 6 16:26:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.4 2017/06/02 13:53:29 jmcneill Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.4.2.1 2017/06/06 16:26:53 snj Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.4 2017/06/02 13:53:29 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.4.2.1 2017/06/06 16:26:53 snj Exp $"); #include "opt_machdep.h" #include "opt_ddb.h" @@ -87,6 +87,7 @@ static uint8_t fdt_data[FDT_BUF_SIZE]; extern char KERNEL_BASE_phys[]; #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys) +static void fdt_update_stdout_path(void); static void fdt_device_register(device_t, void *); static void fdt_reset(void); static void fdt_powerdown(void); @@ -167,6 +168,11 @@ initarm(void *arg) DPRINTN((uintptr_t)fdt_addr_r, 16); DPRINT(">"); + const int chosen = OF_finddevice("/chosen"); + if (chosen >= 0) + OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); + boot_args = bootargs; + DPRINT(" devmap"); pmap_devmap_register(plat->devmap()); @@ -178,6 +184,12 @@ initarm(void *arg) if (set_cpufuncs()) panic("cpu not recognized!"); + /* + * If stdout-path is specified on the command line, override the + * value in /chosen/stdout-path before initializing console. + */ + fdt_update_stdout_path(); + DPRINT(" consinit"); consinit(); @@ -243,13 +255,8 @@ initarm(void *arg) arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, plat->devmap(), mapallmem_p); - const int chosen = OF_finddevice("/chosen"); - if (chosen >= 0) - OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); - DPRINTF("bootargs: %s\n", bootargs); - boot_args = bootargs; parse_mi_bootargs(boot_args); #ifdef PMAP_NEED_ALLOC_POOLPAGE @@ -265,6 +272,32 @@ initarm(void *arg) } +static void +fdt_update_stdout_path(void) +{ + char *stdout_path, *ep; + int stdout_path_len; + char buf[256]; + + const int chosen_off = fdt_path_offset(fdt_data, "/chosen"); + if (chosen_off == -1) + return; + + if (get_bootconf_option(boot_args, "stdout-path", + BOOTOPT_TYPE_STRING, &stdout_path) == 0) + return; + + ep = strchr(stdout_path, ' '); + stdout_path_len = ep ? (ep - stdout_path) : strlen(stdout_path); + if (stdout_path_len >= sizeof(buf)) + return; + + strncpy(buf, stdout_path, stdout_path_len); + buf[stdout_path_len] = '\0'; + fdt_setprop(fdt_data, chosen_off, "stdout-path", + buf, stdout_path_len + 1); +} + void consinit(void) { Index: src/sys/dev/ic/pl050.c diff -u src/sys/dev/ic/pl050.c:1.1 src/sys/dev/ic/pl050.c:1.1.2.1 --- src/sys/dev/ic/pl050.c:1.1 Sat Jun 3 17:03:36 2017 +++ src/sys/dev/ic/pl050.c Tue Jun 6 16:26:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pl050.c,v 1.1 2017/06/03 17:03:36 jmcneill Exp $ */ +/* $NetBSD: pl050.c,v 1.1.2.1 2017/06/06 16:26:53 snj Exp $ */ /*- * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pl050.c,v 1.1 2017/06/03 17:03:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pl050.c,v 1.1.2.1 2017/06/06 16:26:53 snj Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -164,6 +164,9 @@ plkmi_attach(struct plkmi_softc *sc) sc->sc_slot = slot; break; } + + if (sc->sc_slot == PCKBPORT_KBD_SLOT) + pckbport_cnattach(sc, &plkmi_ops, sc->sc_slot); } int