From owner-svn-src-head@freebsd.org Fri Mar 27 18:40:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1A4F27DC31; Fri, 27 Mar 2020 18:40:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48prJd1C52z4ZKm; Fri, 27 Mar 2020 18:40:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 849CB257E9; Fri, 27 Mar 2020 18:01:01 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02RI111h092951; Fri, 27 Mar 2020 18:01:01 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02RI11CS092950; Fri, 27 Mar 2020 18:01:01 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202003271801.02RI11CS092950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 27 Mar 2020 18:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359372 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 359372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2020 18:40:34 -0000 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; }