summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2018-07-06 07:55:51 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2018-07-06 07:55:51 +0000
commit218111541281dcdd66142d0aad420f19c71f3b61 (patch)
treea9e6e795adf4fb80929ec957bac1cea169291868
parentc4d52483ac1d9620210c7fdc04e1d7f3848f4a36 (diff)
Fix efiboot not to panic when a serial which does not exist actually
is specified as the console. Current implementation can't assume the given device is proved at the callback functions if the system has one serial device at least.
-rw-r--r--sys/arch/amd64/stand/efiboot/efiboot.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index a71d2cf93fb..2f4a01ec7b0 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efiboot.c,v 1.29 2018/03/02 03:11:23 jsg Exp $ */
+/* $OpenBSD: efiboot.c,v 1.30 2018/07/06 07:55:50 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -641,7 +641,8 @@ void
efi_com_init(struct consdev *cn)
{
if (!efi_valid_com(cn->cn_dev))
- panic("com%d is not probed", minor(cn->cn_dev));
+ /* This actually happens if the machine has another serial. */
+ return;
if (com_speed == -1)
comspeed(cn->cn_dev, 9600); /* default speed is 9600 baud */
@@ -657,7 +658,7 @@ efi_com_getc(dev_t dev)
static u_char lastchar = 0;
if (!efi_valid_com(dev & 0x7f))
- panic("com%d is not probed", minor(dev));
+ return (0) ;
serio = serios[minor(dev & 0x7f)];
if (lastchar != 0) {
@@ -692,7 +693,7 @@ efi_com_putc(dev_t dev, int c)
u_char buf;
if (!efi_valid_com(dev))
- panic("com%d is not probed", minor(dev));
+ return;
serio = serios[minor(dev)];
buf = c;
EFI_CALL(serio->Write, serio, &sz, &buf);