diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2017-10-06 04:52:23 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2017-10-06 04:52:23 +0000 |
commit | 498edcf7f44462d8563305c89450d29992394fd4 (patch) | |
tree | 456cbf37c497c36e90c1d8954ac9d34330d148c3 /sys | |
parent | 43f5dcd8f0e7f507a93c1bdb45fb27f2803cb790 (diff) |
Revert previous video mode when setting GOP SetMode is failed. This
prevents the video output problem on ThinkPad X121e and so on.
diff from Klemens Nanni, test by Andrew Daugherity
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/stand/efiboot/efiboot.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c index 085a2c768ae..7151e22a16a 100644 --- a/sys/arch/amd64/stand/efiboot/efiboot.c +++ b/sys/arch/amd64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.23 2017/08/07 19:34:53 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.24 2017/10/06 04:52:22 yasuoka Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -59,6 +59,8 @@ static void efi_heap_init(void); static void efi_memprobe_internal(void); static void efi_video_init(void); static void efi_video_reset(void); +static EFI_STATUS + efi_gop_setmode(EFI_GRAPHICS_OUTPUT *gop, int mode); EFI_STATUS efi_main(EFI_HANDLE, EFI_SYSTEM_TABLE *); void (*run_i386)(u_long, u_long, int, int, int, int, int, int, int, int) @@ -699,6 +701,18 @@ static EFI_GUID smbios_guid = SMBIOS_TABLE_GUID; #define efi_guidcmp(_a, _b) memcmp((_a), (_b), sizeof(EFI_GUID)) +static EFI_STATUS +efi_gop_setmode(EFI_GRAPHICS_OUTPUT *gop, int mode) +{ + EFI_STATUS status; + + status = EFI_CALL(gop->SetMode, gop, mode); + if (EFI_ERROR(status) || gop->Mode->Mode != mode) + printf("GOP SetMode() failed (%d)\n", status); + + return (status); +} + void efi_makebootargs(void) { @@ -708,7 +722,7 @@ efi_makebootargs(void) EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi; bios_efiinfo_t ei; - int bestmode = -1; + int curmode, bestmode = -1; UINTN sz, gopsiz, bestsiz = 0; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; @@ -746,9 +760,9 @@ efi_makebootargs(void) } } if (bestmode >= 0) { - status = EFI_CALL(gop->SetMode, gop, bestmode); - if (EFI_ERROR(status) && gop->Mode->Mode != bestmode) - printf("GOP setmode failed(%d)\n", status); + curmode = gop->Mode->Mode; + if (efi_gop_setmode(gop, bestmode) != EFI_SUCCESS) + (void)efi_gop_setmode(gop, curmode); } gopi = gop->Mode->Info; |