summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2016-08-30 20:31:10 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2016-08-30 20:31:10 +0000
commit171012ed2e7069e12d2d55211f7c1ab5bf5417f6 (patch)
tree43d1d456ccb52df47ad2406fd35e94359db0e540 /sys/arch/amd64/stand
parent8bcd735c2d786922ca3ed48474bd830a6323ec30 (diff)
Use MaxMode to terminate the mode iteration. Actually the old way
couldn't interate the ConsOut modes properly on qemu. input NONAKA Kimihiro
Diffstat (limited to 'sys/arch/amd64/stand')
-rw-r--r--sys/arch/amd64/stand/efiboot/efiboot.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index 7833a8a25c6..29ea212e758 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.13 2016/06/10 18:36:06 jcs Exp $ */
+/* $OpenBSD: efiboot.c,v 1.14 2016/08/30 20:31:09 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -373,10 +373,10 @@ efi_video_init(void)
EfiConsoleControlScreenText);
mode80x25 = -1;
mode100x31 = -1;
- for (i = 0; ; i++) {
+ for (i = 0; i < conout->Mode->MaxMode; i++) {
status = EFI_CALL(conout->QueryMode, conout, i, &cols, &rows);
if (EFI_ERROR(status))
- break;
+ continue;
if (mode80x25 < 0 && cols == 80 && rows == 25)
mode80x25 = i;
if (mode100x31 < 0 && cols == 100 && rows == 31)
@@ -519,10 +519,10 @@ efi_makebootargs(void)
status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL,
(void **)&gop);
if (!EFI_ERROR(status)) {
- for (i = 0; ; i++) {
+ for (i = 0; i < gop->Mode->MaxMode; i++) {
status = EFI_CALL(gop->QueryMode, gop, i, &sz, &info);
if (EFI_ERROR(status))
- break;
+ continue;
gopsiz = info->HorizontalResolution *
info->VerticalResolution;
if (gopsiz > bestsiz) {
@@ -629,16 +629,17 @@ Xvideo_efi(void)
int i, mode = -1;
char *p;
- for (i = 0; i < nitems(efi_video) && efi_video[i].cols > 0; i++) {
- printf("Mode %d: %d x %d\n", i,
- efi_video[i].cols, efi_video[i].rows);
+ for (i = 0; i < nitems(efi_video) && i < conout->Mode->MaxMode; i++) {
+ if (efi_video[i].cols > 0)
+ printf("Mode %d: %d x %d\n", i,
+ efi_video[i].cols, efi_video[i].rows);
}
if (cmd.argc == 2) {
p = cmd.argv[1];
mode = strtol(p, &p, 10);
}
printf("\nCurrent Mode = %d\n", conout->Mode->Mode);
- if (0 <= mode && mode < i) {
+ if (0 <= mode && mode < i && efi_video[mode].cols > 0) {
EFI_CALL(conout->SetMode, conout, mode);
efi_video_reset();
}