summaryrefslogtreecommitdiff
path: root/stand/efi
diff options
context:
space:
mode:
authorToomas Soome <tsoome@FreeBSD.org>2020-03-27 18:01:01 +0000
committerToomas Soome <tsoome@FreeBSD.org>2020-03-27 18:01:01 +0000
commitdb316236605edf9e1beda3f7710f304eb2950dcb (patch)
tree9987f0b569dad6b29bb434bb0a6abc6b47399600 /stand/efi
parent73531a2abd8de866a3581d556b026b278fdedffa (diff)
downloadsrc-test-db316236605edf9e1beda3f7710f304eb2950dcb.tar.gz
src-test-db316236605edf9e1beda3f7710f304eb2950dcb.zip
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.
Notes
Notes: svn path=/head/; revision=359372
Diffstat (limited to 'stand/efi')
-rw-r--r--stand/efi/libefi/efi_console.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c
index deca014999bc5..60b5c0f984c51 100644
--- a/stand/efi/libefi/efi_console.c
+++ b/stand/efi/libefi/efi_console.c
@@ -388,10 +388,18 @@ 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;
}