Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2020 18:01:01 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r359372 - head/stand/efi/libefi
Message-ID:  <202003271801.02RI11CS092950@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Fri Mar 27 18:01:01 2020
New Revision: 359372
URL: https://svnweb.freebsd.org/changeset/base/359372

Log:
  loader.efi: conout->QueryMode() can fail to return screen dimensions
  
  Some systems are reported to fail to report screen dimensions unless the
  screen mode is set first.

Modified:
  head/stand/efi/libefi/efi_console.c

Modified: head/stand/efi/libefi/efi_console.c
==============================================================================
--- head/stand/efi/libefi/efi_console.c	Fri Mar 27 17:37:31 2020	(r359371)
+++ head/stand/efi/libefi/efi_console.c	Fri Mar 27 18:01:01 2020	(r359372)
@@ -388,11 +388,19 @@ efi_cons_probe(struct console *cp)
 	conout = ST->ConOut;
 	conin = ST->ConIn;
 
-	status = BS->OpenProtocol(ST->ConsoleInHandle, &simple_input_ex_guid,
-	    (void **)&coninex, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-	if (status != EFI_SUCCESS)
-		coninex = NULL;
+	/*
+	 * Call SetMode to work around buggy firmware.
+	 */
+	status = conout->SetMode(conout, conout->Mode->Mode);
 
+	if (coninex == NULL) {
+		status = BS->OpenProtocol(ST->ConsoleInHandle,
+		    &simple_input_ex_guid, (void **)&coninex,
+		    IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+		if (status != EFI_SUCCESS)
+			coninex = NULL;
+	}
+
 	cp->c_flags |= C_PRESENTIN | C_PRESENTOUT;
 }
 
@@ -824,7 +832,7 @@ efi_cons_update_mode(void)
 	char env[8];
 
 	status = conout->QueryMode(conout, conout->Mode->Mode, &cols, &rows);
-	if (EFI_ERROR(status)) {
+	if (EFI_ERROR(status) || cols * rows == 0) {
 		cols = 80;
 		rows = 24;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003271801.02RI11CS092950>