Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2016 14:33:25 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r304222 - head/sys/boot/efi/libefi
Message-ID:  <201608161433.u7GEXPrP025656@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



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