Re: efiboot 240x56 mode

2016-03-14 Thread YASUOKA Masahiko
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();
 }



efiboot 240x56 mode

2016-03-12 Thread Matthieu Herrb
Hi,

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.

So he did the patch below to add support for this mode to efiboot.

I've asked him to provide us a dmesg and acpidump for this machine
too. In the mean time here is his patch. I've tried it on the NUC that
I have been using with efiboot, it doesn't break it.

Index: efiboot.c
===
RCS file: /cvs/OpenBSD/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 efiboot.c
--- efiboot.c   4 Feb 2016 09:19:39 -   1.11
+++ efiboot.c   12 Mar 2016 09:16:05 -
@@ -357,7 +357,7 @@ static void
 efi_video_init(void)
 {
EFI_CONSOLE_CONTROL_PROTOCOL*conctrl = NULL;
-   int  i, mode80x25, mode100x31;
+   int  i, mode80x25, mode100x31, mode240x56;
UINTNcols, rows;
EFI_STATUS   status;
 
@@ -369,20 +369,25 @@ efi_video_init(void)
EfiConsoleControlScreenText);
mode80x25 = -1;
mode100x31 = -1;
-   for (i = 0; ; i++) {
+   mode240x56 = -1;
+   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)
mode100x31 = i;
+   if (mode240x56 < 0 && cols == 240 && rows == 56)
+   mode240x56 = i;
if (i < nitems(efi_video)) {
efi_video[i].cols = cols;
efi_video[i].rows = rows;
}
}
-   if (mode100x31 >= 0)
+   if (mode240x56 >= 0)
+   EFI_CALL(conout->SetMode, conout, mode240x56);
+   else if (mode100x31 >= 0)
EFI_CALL(conout->SetMode, conout, mode100x31);
else if (mode80x25 >= 0)
EFI_CALL(conout->SetMode, conout, mode80x25);

-- 
Matthieu Herrb


signature.asc
Description: PGP signature