git: 339040c40385 - stable/12 - loader.efi: Default to serial if we don't have a ConOut variable

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 01:16:25 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=339040c40385f5aedf0562f3feef637e945dc29b

commit 339040c40385f5aedf0562f3feef637e945dc29b
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2019-11-08 20:08:44 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:58 +0000

    loader.efi: Default to serial if we don't have a ConOut variable
    
    In the EFI implementation in U-Boot no ConOut efi variable is created,
    this cause loader to fallback to TERM_EMU implementation which is very
    very very slow (and uses the ConOut device in the system table anyway).
    The UEFI spec aren't clear as if this variable needs to exists or not.
    
    (cherry picked from commit 14fb9485a4dc9c8212bfae6c2049cb4930f4b8e5)
---
 stand/efi/loader/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 7440018a15db..a2fba0c57184 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -716,8 +716,11 @@ parse_uefi_con_out(void)
 	how = 0;
 	sz = sizeof(buf);
 	rv = efi_global_getenv("ConOut", buf, &sz);
-	if (rv != EFI_SUCCESS)
+	if (rv != EFI_SUCCESS) {
+		/* If we don't have any ConOut default to serial */
+		how = RB_SERIAL;
 		goto out;
+	}
 	ep = buf + sz;
 	node = (EFI_DEVICE_PATH *)buf;
 	while ((char *)node < ep) {