From owner-svn-src-all@freebsd.org Tue Aug 16 14:33:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E84C7BBC8F6; Tue, 16 Aug 2016 14:33:26 +0000 (UTC) (envelope-from manu@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 mx1.freebsd.org (Postfix) with ESMTPS id B876115BE; Tue, 16 Aug 2016 14:33:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GEXPKF025657; Tue, 16 Aug 2016 14:33:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7GEXPrP025656; Tue, 16 Aug 2016 14:33:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201608161433.u7GEXPrP025656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 16 Aug 2016 14:33:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304222 - head/sys/boot/efi/libefi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 14:33:27 -0000 Author: manu Date: Tue Aug 16 14:33:25 2016 New Revision: 304222 URL: https://svnweb.freebsd.org/changeset/base/304222 Log: Only use WaitForKeys event if it exists, this is not the case in u-boot efi implementation. Reviewed by: jhb, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6781 Modified: head/sys/boot/efi/libefi/efi_console.c Modified: head/sys/boot/efi/libefi/efi_console.c ============================================================================== --- head/sys/boot/efi/libefi/efi_console.c Tue Aug 16 14:23:35 2016 (r304221) +++ head/sys/boot/efi/libefi/efi_console.c Tue Aug 16 14:33:25 2016 (r304222) @@ -438,8 +438,10 @@ efi_cons_getchar() /* Try to read a key stroke. We wait for one if none is pending. */ status = conin->ReadKeyStroke(conin, &key); - if (status == EFI_NOT_READY) { - BS->WaitForEvent(1, &conin->WaitForKey, &junk); + while (status == EFI_NOT_READY) { + /* Some EFI implementation (u-boot for example) do not support WaitForKey */ + if (conin->WaitForKey != NULL) + BS->WaitForEvent(1, &conin->WaitForKey, &junk); status = conin->ReadKeyStroke(conin, &key); } switch (key.ScanCode) { @@ -454,6 +456,9 @@ efi_cons_getchar() int efi_cons_poll() { + + if (conin->WaitForKey == NULL) + return (1); /* This can clear the signaled state. */ return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS); }