Hi,
On Sat, 12 Mar 2016 10:22:13 +0100
Matthieu Herrb wrote:
> a collegue of mine recently tried to get OpenBSD running on an HP E820
> laptop. Apparently this machine is UEFI only and its BIOS only works
> in a 240x56 text mode.
The original efi_video_init() is to switch the lower resolution mode,
80x25 or 100x31, when it is supported. This is to avoid using tiny
characters selected by the default on some machines.
The diff following is to revert the default mode when switching to the
lower resolution mode fails. If it also fixes his machines problem,
I'd prefer this. So I'd like him to test the diff.
Index: efiboot.c
===
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
retrieving revision 1.11
diff -u -p -r1.11 efiboot.c
--- efiboot.c 4 Feb 2016 09:19:39 - 1.11
+++ efiboot.c 15 Mar 2016 03:14:38 -
@@ -357,7 +357,7 @@ static void
efi_video_init(void)
{
EFI_CONSOLE_CONTROL_PROTOCOL*conctrl = NULL;
- int i, mode80x25, mode100x31;
+ int i, mode80x25, mode100x31, oldmode;
UINTNcols, rows;
EFI_STATUS status;
@@ -367,12 +367,13 @@ efi_video_init(void)
if (status == EFI_SUCCESS)
(void)EFI_CALL(conctrl->SetMode, conctrl,
EfiConsoleControlScreenText);
+ oldmode = conout->Mode->Mode;
mode80x25 = -1;
mode100x31 = -1;
- for (i = 0; ; i++) {
+ for (i = 0; i < conout->Mode->MaxMode; i++) {
status = EFI_CALL(conout->QueryMode, conout, i, , );
if (EFI_ERROR(status))
- break;
+ continue;
if (mode80x25 < 0 && cols == 80 && rows == 25)
mode80x25 = i;
if (mode100x31 < 0 && cols == 100 && rows == 31)
@@ -382,10 +383,15 @@ efi_video_init(void)
efi_video[i].rows = rows;
}
}
- if (mode100x31 >= 0)
- EFI_CALL(conout->SetMode, conout, mode100x31);
- else if (mode80x25 >= 0)
- EFI_CALL(conout->SetMode, conout, mode80x25);
+
+ /* try to use the lower resolution mode */
+ if (mode100x31 >= 0 || mode80x25 >= 0) {
+ EFI_CALL(conout->SetMode, conout,
+ (mode100x31 >= 0)? mode100x31 : mode80x25);
+ if (EFI_ERROR(status))
+ EFI_CALL(conout->SetMode, conout, oldmode);
+ }
+
conin = ST->ConIn;
efi_video_reset();
}