1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

In efi_cons_poll we check if a key is present (pending) by checking

the signaled state of the apropriate event. As a side-effect of
checking the event, it's signaled state is cleared if it was set.
In efi_cons_getchar we used to wait for the apropriate event to be
signaled before reading a character. This however does not work if
we poll before reading the characteri, such as during autoboot. On
a more compliant EFI implementation this resulted in the behaviour
that hitting a key during autoboot would stop the countdown, but
would then wait for a new character to arrive instead of reading
the already pending key that stopped the countdown.

The correct behaviour for efi_cons_getchar is to try to read a key
and if none is pending, to wait for the apropriate event to signal
the arrival of a new key.

Note that with the previous behaviour, the second key would determine
how the autoboot was interrupted. This would indicate that the first
key got lost. This indicates that EFI does not necessarily maintain
a queue of pending keys. FWIW...

Approved by: re (carte blanche)
French corrected by: various people :-)
This commit is contained in:
Marcel Moolenaar 2002-12-08 19:46:11 +00:00
parent 9b7e3080cf
commit 487d404b1b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107682

View File

@ -69,17 +69,23 @@ int
efi_cons_getchar()
{
EFI_INPUT_KEY key;
EFI_STATUS status;
UINTN junk;
BS->WaitForEvent(1, &conin->WaitForKey, &junk);
conin->ReadKeyStroke(conin, &key);
return key.UnicodeChar;
/* 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);
status = conin->ReadKeyStroke(conin, &key);
}
return (key.UnicodeChar);
}
int
efi_cons_poll()
{
return BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS;
/* This can clear the signaled state. */
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS);
}
struct console efi_console = {