Allows for the conditional inclusion of VGA driver on the x86 platform
rather than having it always enabled.

The default configuration for the CONFIG_VGA option remains 'y' on x86, so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the VGA driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/arch/x86/Kconfig        | 1 -
 xen/arch/x86/efi/efi-boot.h | 7 +++++++
 xen/arch/x86/setup.c        | 5 +++++
 xen/drivers/video/Kconfig   | 3 ++-
 xen/include/asm-x86/setup.h | 5 +++++
 xen/include/xen/console.h   | 8 ++++++++
 6 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 265fd79..9e10591 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -20,7 +20,6 @@ config X86
        select HAS_PCI
        select HAS_PDX
        select NUMA
-       select VGA
 
 config ARCH_DEFCONFIG
        string
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 10985721..911fdfd 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -476,6 +476,7 @@ static void __init efi_arch_edd(void)
         boot_edd_info_nr = EDD_INFO_MAX;
 }
 
+#ifdef CONFIG_VGA
 static void __init efi_arch_console_init(UINTN cols, UINTN rows)
 {
     vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;
@@ -550,6 +551,12 @@ static void __init 
efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
             (gop->Mode->FrameBufferSize + 0xffff) >> 16;
     }
 }
+#else
+static inline void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL 
*gop,
+                                       UINTN info_size,
+                                       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION 
*mode_info) {}
+static inline void __init efi_arch_console_init(UINTN cols, UINTN rows) {}
+#endif
 
 static void __init efi_arch_memory_setup(void)
 {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ae897a..6358336 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -433,10 +433,12 @@ struct boot_video_info {
     u16 vesapm_off;         /* 0x26 */
     u16 vesa_attrib;        /* 0x28 */
 };
+
 extern struct boot_video_info boot_vid_info;
 
 static void __init parse_video_info(void)
 {
+#ifdef CONFIG_VGA
     struct boot_video_info *bvi = &bootsym(boot_vid_info);
 
     /* The EFI loader fills vga_console_info directly. */
@@ -472,6 +474,7 @@ static void __init parse_video_info(void)
         vga_console_info.u.vesa_lfb.gbl_caps = bvi->capabilities;
         vga_console_info.u.vesa_lfb.mode_attrs = bvi->vesa_attrib;
     }
+#endif
 }
 
 static void __init kexec_reserve_area(struct e820map *e820)
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
     printk("Video information:\n");
 
     /* Print VGA display mode information. */
@@ -694,6 +698,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         printk(" No VGA detected\n");
         break;
     }
+#endif
 
     /* Print VBE/DDC EDID information. */
     if ( bootsym(boot_edid_caps) != 0x1313 )
diff --git a/xen/drivers/video/Kconfig b/xen/drivers/video/Kconfig
index 0ffbbd9..0f208fe 100644
--- a/xen/drivers/video/Kconfig
+++ b/xen/drivers/video/Kconfig
@@ -3,7 +3,8 @@ config VIDEO
        bool
 
 config VGA
-       bool
+       bool "VGA"
+       default y if X86
        select VIDEO
 
 config HAS_ARM_HDLCD
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index c65b79c..02e9b12 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -28,8 +28,13 @@ void arch_init_memory(void);
 void subarch_init_memory(void);
 
 void init_IRQ(void);
+#ifdef CONFIG_VGA
 void vesa_init(void);
 void vesa_mtrr_init(void);
+#else
+static inline void vesa_init(void) {}
+static inline void vesa_mtrr_init(void) {}
+#endif
 
 int construct_dom0(
     struct domain *d,
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index ea06fd8..2e7c22c 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -19,7 +19,15 @@ void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 
+#ifdef CONFIG_VGA
 int fill_console_start_info(struct dom0_vga_console_info *);
+#else
+#include <xen/string.h>
+static inline int fill_console_start_info(struct dom0_vga_console_info *ci) {
+    (void) memset(ci, 0, sizeof(*ci));
+    return 1;
+}
+#endif
 
 unsigned long console_lock_recursive_irqsave(void);
 void console_unlock_recursive_irqrestore(unsigned long flags);
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to