svn commit: r331474 - head/stand/efi/loader
Kyle Evans
kevans at FreeBSD.org
Sat Mar 24 01:53:44 UTC 2018
Author: kevans
Date: Sat Mar 24 01:53:43 2018
New Revision: 331474
URL: https://svnweb.freebsd.org/changeset/base/331474
Log:
efi loader: Choose a console mode instead if hw.vga.textmode is set
Not all systems use efifb; pull hw.vga.textmode and choose a good console
mode instead if it's set to something non-zero. This is basically a revival
of the code that used to live in boot1, but instead rebased onto this
different way of doing mode selection in loader.efi.
Interestingly enough, the regression that was previously introduced where
GOP would not reflect the console setting does not seem to exist when
console mode selection is done here. I've not done any investigation as to
why this is the case. Nevertheless, boot1.efi is still not the best place to
do mode selection.
Modified:
head/stand/efi/loader/framebuffer.c
Modified: head/stand/efi/loader/framebuffer.c
==============================================================================
--- head/stand/efi/loader/framebuffer.c Sat Mar 24 01:15:38 2018 (r331473)
+++ head/stand/efi/loader/framebuffer.c Sat Mar 24 01:53:43 2018 (r331474)
@@ -588,6 +588,29 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop)
}
static int
+text_autoresize()
+{
+ SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
+ EFI_STATUS status;
+ UINTN i, max_dim, best_mode, cols, rows;
+
+ conout = ST->ConOut;
+ max_dim = best_mode = 0;
+ for (i = 0; i < conout->Mode->MaxMode; i++) {
+ status = conout->QueryMode(conout, i, &cols, &rows);
+ if (EFI_ERROR(status))
+ continue;
+ if (cols * rows > max_dim) {
+ max_dim = cols * rows;
+ best_mode = i;
+ }
+ }
+ if (max_dim > 0)
+ conout->SetMode(conout, best_mode);
+ return (CMD_OK);
+}
+
+static int
uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop)
{
@@ -601,8 +624,14 @@ command_autoresize(int argc, char *argv[])
{
EFI_GRAPHICS_OUTPUT *gop;
EFI_UGA_DRAW_PROTOCOL *uga;
+ char *textmode;
EFI_STATUS status;
u_int mode;
+
+ textmode = getenv("hw.vga.textmode");
+ /* If it's set and non-zero, we'll select a console mode instead */
+ if (textmode != NULL && strcmp(textmode, "0") != 0)
+ return (text_autoresize());
gop = NULL;
uga = NULL;
More information about the svn-src-head
mailing list