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
This commit is contained in:
Emmanuel Vadot 2016-08-16 14:33:25 +00:00
parent 5f306327fe
commit 858a3f496f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=304222

View File

@ -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);
}