diff options
-rw-r--r-- | sys/arch/arm64/stand/efiboot/conf.c | 7 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 68 | ||||
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.h | 6 |
3 files changed, 64 insertions, 17 deletions
diff --git a/sys/arch/arm64/stand/efiboot/conf.c b/sys/arch/arm64/stand/efiboot/conf.c index 201bac31a8d..a0438d9fef3 100644 --- a/sys/arch/arm64/stand/efiboot/conf.c +++ b/sys/arch/arm64/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.36 2022/03/14 19:09:32 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.37 2022/04/06 21:27:03 kettenis Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -46,7 +46,7 @@ #include "efipxe.h" #include "softraid_arm64.h" -const char version[] = "1.8"; +const char version[] = "1.9"; int debug = 0; struct fs_ops file_system[] = { @@ -70,7 +70,8 @@ int ndevs = nitems(devsw); struct consdev constab[] = { { efi_cons_probe, efi_cons_init, efi_cons_getc, efi_cons_putc }, - { efi_fb_probe, efi_fb_init, efi_cons_getc, efi_cons_putc }, + { efi_com_probe, efi_com_init, efi_com_getc, efi_com_putc }, + { efi_fb_probe, efi_fb_init, efi_fb_getc, efi_fb_putc }, { NULL } }; struct consdev *cn_tab; diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index 2767a0c0a37..e49002f45a8 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.40 2022/03/17 00:28:29 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.41 2022/04/06 21:27:03 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -120,8 +120,8 @@ static SIMPLE_INPUT_INTERFACE *conin; * kernel. That's fine. They're just used as an index into the cdevs * array and never passed on to the kernel. */ -static dev_t serial = makedev(0, 0); -static dev_t framebuffer = makedev(1, 0); +static dev_t serial = makedev(1, 0); +static dev_t framebuffer = makedev(2, 0); static char framebuffer_path[128]; @@ -129,7 +129,7 @@ void efi_cons_probe(struct consdev *cn) { cn->cn_pri = CN_MIDPRI; - cn->cn_dev = serial; + cn->cn_dev = makedev(0, 0); } void @@ -191,6 +191,32 @@ efi_cons_putc(dev_t dev, int c) } void +efi_com_probe(struct consdev *cn) +{ + cn->cn_pri = CN_LOWPRI; + cn->cn_dev = serial; +} + +void +efi_com_init(struct consdev *cn) +{ + conin = ST->ConIn; + conout = ST->ConOut; +} + +int +efi_com_getc(dev_t dev) +{ + return efi_cons_getc(dev); +} + +void +efi_com_putc(dev_t dev, int c) +{ + efi_cons_putc(dev, c); +} + +void efi_fb_probe(struct consdev *cn) { cn->cn_pri = CN_LOWPRI; @@ -459,16 +485,32 @@ efi_console(void) { void *node; - if (cn_tab->cn_dev != framebuffer) - return; + if (major(cn_tab->cn_dev) == major(serial)) { + char *serial_path; + char alias[16]; + int len; + + /* Construct alias and resolve it. */ + snprintf(alias, sizeof(alias), "serial%d", + minor(cn_tab->cn_dev)); + node = fdt_find_node("/aliases"); + len = fdt_node_property(node, alias, &serial_path); + if (len <= 0) + return; - if (strlen(framebuffer_path) == 0) - return; + /* Point stdout-path at the serial node. */ + node = fdt_find_node("/chosen"); + fdt_node_add_property(node, "stdout-path", + serial_path, strlen(serial_path) + 1); + } else if (major(cn_tab->cn_dev) == major(framebuffer)) { + if (strlen(framebuffer_path) == 0) + return; - /* Point stdout-path at the framebuffer node. */ - node = fdt_find_node("/chosen"); - fdt_node_add_property(node, "stdout-path", - framebuffer_path, strlen(framebuffer_path) + 1); + /* Point stdout-path at the framebuffer node. */ + node = fdt_find_node("/chosen"); + fdt_node_add_property(node, "stdout-path", + framebuffer_path, strlen(framebuffer_path) + 1); + } } uint64_t dma_constraint[2] = { 0, -1 }; @@ -794,7 +836,7 @@ devboot(dev_t dev, char *p) p[2] = '0' + sd_boot_vol; } -const char cdevs[][4] = { "com", "fb" }; +const char cdevs[][4] = { "cons", "com", "fb" }; const int ncdevs = nitems(cdevs); int diff --git a/sys/arch/arm64/stand/efiboot/efiboot.h b/sys/arch/arm64/stand/efiboot/efiboot.h index 749d309c477..609c640f314 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.h +++ b/sys/arch/arm64/stand/efiboot/efiboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.h,v 1.5 2020/05/10 11:55:42 kettenis Exp $ */ +/* $OpenBSD: efiboot.h,v 1.6 2022/04/06 21:27:03 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -25,6 +25,10 @@ void efi_cons_probe(struct consdev *); void efi_cons_init(struct consdev *); int efi_cons_getc(dev_t); void efi_cons_putc(dev_t, int); +void efi_com_probe(struct consdev *); +void efi_com_init(struct consdev *); +int efi_com_getc(dev_t); +void efi_com_putc(dev_t, int); void efi_fb_probe(struct consdev *); void efi_fb_init(struct consdev *); int efi_fb_getc(dev_t); |