git: 9d2f548bbebd - stable/13 - loader: For EFI, if we don't have ConOut, try ConIn

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 07 Feb 2024 00:14:43 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d2f548bbebdd4ecac1d9d75cdff82f84119984d

commit 9d2f548bbebdd4ecac1d9d75cdff82f84119984d
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-04 21:09:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-07 00:12:40 +0000

    loader: For EFI, if we don't have ConOut, try ConIn
    
    Try ConIn if we don't have a ConOut variable. ConIn will contain HID
    devices and/or serial devices. We currently just search for serial
    devices and will use them instead of video with the current code. While
    ConIn w/o ConOut is fairly common on laptops, is kinda rare on servers.
    Some refinement may be needed in the future if servers come to
    light. This is also minimal to allow possible integration into 13.3
    release.
    
    MFC After:              1 week
    Sponsored by:           Netflix
    Reviewed by:            dab, tsoome
    Differential Revision:  https://reviews.freebsd.org/D43714
    
    (cherry picked from commit 064fa628ce375028f2510182f4edbafa7f469ecb)
---
 stand/efi/loader/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 3aee6cd3eb8e..e8a5b738aef9 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -724,7 +724,10 @@ setenv_int(const char *key, int val)
  * Parse ConOut (the list of consoles active) and see if we can find a
  * serial port and/or a video port. It would be nice to also walk the
  * ACPI name space to map the UID for the serial port to a port. The
- * latter is especially hard.
+ * latter is especially hard. Also check for ConIn as well. This will
+ * be enough to determine if we have serial, and if we don't, we default
+ * to video. If there's a dual-console situation with ConIn, this will
+ * currently fail.
  */
 int
 parse_uefi_con_out(void)
@@ -743,6 +746,8 @@ parse_uefi_con_out(void)
 	rv = efi_global_getenv("ConOut", buf, &sz);
 	if (rv != EFI_SUCCESS)
 		rv = efi_global_getenv("ConOutDev", buf, &sz);
+	if (rv != EFI_SUCCESS)
+		rv = efi_global_getenv("ConIn", buf, &sz);
 	if (rv != EFI_SUCCESS) {
 		/*
 		 * If we don't have any ConOut default to both. If we have GOP