Currently the vga command line gfx- option is ignored when booted
using multboot2 and EFI, as the setting of the GOP mode is done way
before the command line is processed.

Add support for parsing the vga gfx- selection if present in order to
set the selected GOP mode.

Signed-off-by: Roger Pau Monné <roger....@citrix.com>
---
 xen/arch/x86/efi/efi-boot.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 695491a5b7..e791d65213 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -835,7 +835,22 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, 
EFI_SYSTEM_TABLE *SystemTable
 
         if ( vga )
         {
-            gop_mode = efi_find_gop_mode(gop, 0, 0, 0);
+            unsigned int width = 0, height = 0, depth = 0;
+
+            opt = get_option(cmdline, "vga=gfx-");
+            if ( opt )
+            {
+                width = simple_strtoul(opt, &opt, 10);
+                if ( *opt == 'x' )
+                    height = simple_strtoul(opt + 1, &opt, 10);
+                if ( *opt == 'x' )
+                    depth = simple_strtoul(opt + 1, &opt, 10);
+                /* Allow depth to be 0 or unset. */
+                if ( !width || !height )
+                    width = height = depth = 0;
+            }
+
+            gop_mode = efi_find_gop_mode(gop, width, height, depth);
         }
 
         efi_arch_edid(gop_handle);
-- 
2.37.3


Reply via email to