diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-03-16 22:02:28 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-03-16 22:02:28 +0000 |
commit | 9fb4ee91776c6f44b225daa0cb6ff994326bdf9e (patch) | |
tree | 00579af9b244ee11485f8482e958b8c6dced2d64 /sys/arch | |
parent | 5e26c459549057cc418df046ec5316e68497c560 (diff) |
Make sure that switching the console from serial to framebuffer works
for framebuffer nodes under / and /chosen.
Same change made to arm64 last month.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/armv7/stand/efiboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efiboot.c | 43 |
2 files changed, 25 insertions, 22 deletions
diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c index 696c1de4c11..4b473fc0c83 100644 --- a/sys/arch/armv7/stand/efiboot/conf.c +++ b/sys/arch/armv7/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.29 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.30 2021/03/16 22:02:27 kettenis Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include "efidev.h" #include "efipxe.h" -const char version[] = "1.16"; +const char version[] = "1.17"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/armv7/stand/efiboot/efiboot.c b/sys/arch/armv7/stand/efiboot/efiboot.c index 3784f1653df..71d3db1e945 100644 --- a/sys/arch/armv7/stand/efiboot/efiboot.c +++ b/sys/arch/armv7/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.31 2020/05/17 14:32:12 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.32 2021/03/16 22:02:27 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -107,6 +107,8 @@ static SIMPLE_INPUT_INTERFACE *conin; static dev_t serial = makedev(0, 0); static dev_t framebuffer = makedev(1, 0); +static char framebuffer_path[128]; + void efi_cons_probe(struct consdev *cn) { @@ -351,8 +353,13 @@ efi_framebuffer(void) if (!fdt_node_is_compatible(child, "simple-framebuffer")) continue; if (fdt_node_property(child, "status", &prop) && - strcmp(prop, "okay") == 0) + strcmp(prop, "okay") == 0) { + strlcpy(framebuffer_path, "/chosen/", + sizeof(framebuffer_path)); + strlcat(framebuffer_path, fdt_node_name(child), + sizeof(framebuffer_path)); return; + } } node = fdt_find_node("/"); for (child = fdt_child_node(node); child; @@ -360,8 +367,13 @@ efi_framebuffer(void) if (!fdt_node_is_compatible(child, "simple-framebuffer")) continue; if (fdt_node_property(child, "status", &prop) && - strcmp(prop, "okay") == 0) + strcmp(prop, "okay") == 0) { + strlcpy(framebuffer_path, "/", + sizeof(framebuffer_path)); + strlcat(framebuffer_path, fdt_node_name(child), + sizeof(framebuffer_path)); return; + } } status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, (void **)&gop); @@ -420,35 +432,26 @@ efi_framebuffer(void) fdt_node_add_property(child, "reg", reg, (acells + scells) * 4); fdt_node_add_property(child, "compatible", "simple-framebuffer", strlen("simple-framebuffer") + 1); + + strlcpy(framebuffer_path, "/chosen/framebuffer", + sizeof(framebuffer_path)); } void efi_console(void) { - char path[128]; - void *node, *child; - char *prop; + void *node; if (cn_tab->cn_dev != framebuffer) return; - /* Find the desired framebuffer node. */ - node = fdt_find_node("/chosen"); - for (child = fdt_child_node(node); child; - child = fdt_next_node(child)) { - if (!fdt_node_is_compatible(child, "simple-framebuffer")) - continue; - if (fdt_node_property(child, "status", &prop) && - strcmp(prop, "okay") == 0) - break; - } - if (child == NULL) + if (strlen(framebuffer_path) == 0) return; /* Point stdout-path at the framebuffer node. */ - strlcpy(path, "/chosen/", sizeof(path)); - strlcat(path, fdt_node_name(child), sizeof(path)); - fdt_node_add_property(node, "stdout-path", path, strlen(path) + 1); + node = fdt_find_node("/chosen"); + fdt_node_add_property(node, "stdout-path", + framebuffer_path, strlen(framebuffer_path) + 1); } void *fdt = NULL; |