WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux/x86: retrieve VESA capabilities in dom0

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux/x86: retrieve VESA capabilities in dom0
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Thu, 09 Aug 2007 14:12:14 +0100
Delivery-date: Thu, 09 Aug 2007 06:08:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Subject: Obtain VESA capabilities and attributes of VESA mode

Also, move some more common code to dom0_init_screen_info().

This was tested on 2.6.22.1, and only made apply to 2.6.18 without
further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-08-07/arch/i386/kernel/setup-xen.c
===================================================================
--- head-2007-08-07.orig/arch/i386/kernel/setup-xen.c   2007-08-07 
10:40:43.000000000 +0200
+++ head-2007-08-07/arch/i386/kernel/setup-xen.c        2007-08-09 
12:21:12.000000000 +0200
@@ -1669,23 +1669,12 @@ void __init setup_arch(char **cmdline_p)
        bootloader_type = LOADER_TYPE;
 
        if (is_initial_xendomain()) {
-               /* This is drawn from a dump from vgacon:startup in
-                * standard Linux. */
-               screen_info.orig_video_mode = 3; 
-               screen_info.orig_video_isVGA = 1;
-               screen_info.orig_video_lines = 25;
-               screen_info.orig_video_cols = 80;
-               screen_info.orig_video_ega_bx = 3;
-               screen_info.orig_video_points = 16;
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
-               if (xen_start_info->console.dom0.info_size >=
-                   sizeof(struct dom0_vga_console_info)) {
-                       const struct dom0_vga_console_info *info =
-                               (struct dom0_vga_console_info *)(
-                                       (char *)xen_start_info +
-                                       xen_start_info->console.dom0.info_off);
-                       dom0_init_screen_info(info);
-               }
+               const struct dom0_vga_console_info *info =
+                       (void *)((char *)xen_start_info +
+                                xen_start_info->console.dom0.info_off);
+
+               dom0_init_screen_info(info,
+                                     xen_start_info->console.dom0.info_size);
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
Index: head-2007-08-07/arch/x86_64/kernel/setup-xen.c
===================================================================
--- head-2007-08-07.orig/arch/x86_64/kernel/setup-xen.c 2007-08-07 
10:40:43.000000000 +0200
+++ head-2007-08-07/arch/x86_64/kernel/setup-xen.c      2007-08-09 
12:21:07.000000000 +0200
@@ -594,23 +594,12 @@ void __init setup_arch(char **cmdline_p)
        screen_info = SCREEN_INFO;
 
        if (is_initial_xendomain()) {
-               /* This is drawn from a dump from vgacon:startup in
-                * standard Linux. */
-               screen_info.orig_video_mode = 3;
-               screen_info.orig_video_isVGA = 1;
-               screen_info.orig_video_lines = 25;
-               screen_info.orig_video_cols = 80;
-               screen_info.orig_video_ega_bx = 3;
-               screen_info.orig_video_points = 16;
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
-               if (xen_start_info->console.dom0.info_size >=
-                   sizeof(struct dom0_vga_console_info)) {
-                       const struct dom0_vga_console_info *info =
-                               (struct dom0_vga_console_info *)(
-                                       (char *)xen_start_info +
-                                       xen_start_info->console.dom0.info_off);
-                       dom0_init_screen_info(info);
-               }
+               const struct dom0_vga_console_info *info =
+                       (void *)((char *)xen_start_info +
+                                xen_start_info->console.dom0.info_off);
+
+               dom0_init_screen_info(info,
+                                     xen_start_info->console.dom0.info_size);
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
Index: head-2007-08-07/drivers/xen/console/console.c
===================================================================
--- head-2007-08-07.orig/drivers/xen/console/console.c  2007-08-07 
10:14:35.000000000 +0200
+++ head-2007-08-07/drivers/xen/console/console.c       2007-08-09 
12:54:01.000000000 +0200
@@ -288,13 +288,23 @@
 }
 
 
-void dom0_init_screen_info(const struct dom0_vga_console_info *info)
+void __init dom0_init_screen_info(const struct dom0_vga_console_info *info, 
size_t size)
 {
+       /* This is drawn from a dump from vgacon:startup in
+        * standard Linux. */
+       screen_info.orig_video_mode = 3;
+       screen_info.orig_video_isVGA = 1;
+       screen_info.orig_video_lines = 25;
+       screen_info.orig_video_cols = 80;
+       screen_info.orig_video_ega_bx = 3;
+       screen_info.orig_video_points = 16;
+       screen_info.orig_y = screen_info.orig_video_lines - 1;
+
        switch (info->video_type) {
        case XEN_VGATYPE_TEXT_MODE_3:
-               screen_info.orig_video_mode = 3;
-               screen_info.orig_video_ega_bx = 3;
-               screen_info.orig_video_isVGA = 1;
+               if (size < offsetof(struct dom0_vga_console_info, u.text_mode_3)
+                          + sizeof(info->u.text_mode_3))
+                       break;
                screen_info.orig_video_lines = info->u.text_mode_3.rows;
                screen_info.orig_video_cols = info->u.text_mode_3.columns;
                screen_info.orig_x = info->u.text_mode_3.cursor_x;
@@ -302,7 +312,11 @@ void dom0_init_screen_info(const struct 
                screen_info.orig_video_points =
                        info->u.text_mode_3.font_height;
                break;
+
        case XEN_VGATYPE_VESA_LFB:
+               if (size < offsetof(struct dom0_vga_console_info,
+                                   u.vesa_lfb.capabilities))
+                       break;
                screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;
                screen_info.lfb_width = info->u.vesa_lfb.width;
                screen_info.lfb_height = info->u.vesa_lfb.height;
@@ -318,6 +332,14 @@ void dom0_init_screen_info(const struct 
                screen_info.blue_pos = info->u.vesa_lfb.blue_pos;
                screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size;
                screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos;
+               if (size >= offsetof(struct dom0_vga_console_info,
+                                    u.vesa_lfb.capabilities)
+                           + sizeof(info->u.vesa_lfb.capabilities))
+                       screen_info.capabilities = 
info->u.vesa_lfb.capabilities;
+               if (size >= offsetof(struct dom0_vga_console_info,
+                                    u.vesa_lfb.attributes)
+                           + sizeof(info->u.vesa_lfb.attributes))
+                       screen_info.vesa_attributes = 
info->u.vesa_lfb.attributes;
                break;
        }
 }
Index: head-2007-08-07/include/xen/interface/xen.h
===================================================================
--- head-2007-08-07.orig/include/xen/interface/xen.h    2007-08-07 
09:34:51.000000000 +0200
+++ head-2007-08-07/include/xen/interface/xen.h 2007-08-09 12:29:56.000000000 
+0200
@@ -565,6 +565,12 @@ typedef struct dom0_vga_console_info {
             uint8_t  green_pos, green_size;
             uint8_t  blue_pos, blue_size;
             uint8_t  rsvd_pos, rsvd_size;
+#if __XEN_INTERFACE_VERSION__ >= 0x00030206
+            /* VESA capabilities. */
+            uint32_t capabilities;
+            /* Mode attributes. */
+            uint16_t attributes;
+#endif
         } vesa_lfb;
     } u;
 } dom0_vga_console_info_t;
Index: head-2007-08-07/include/xen/xencons.h
===================================================================
--- head-2007-08-07.orig/include/xen/xencons.h  2007-08-07 10:14:35.000000000 
+0200
+++ head-2007-08-07/include/xen/xencons.h       2007-08-09 12:10:06.000000000 
+0200
@@ -2,7 +2,7 @@
 #define __ASM_XENCONS_H__
 
 struct dom0_vga_console_info;
-void dom0_init_screen_info(const struct dom0_vga_console_info *info);
+void dom0_init_screen_info(const struct dom0_vga_console_info *, size_t);
 
 void xencons_force_flush(void);
 void xencons_resume(void);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux/x86: retrieve VESA capabilities in dom0, Jan Beulich <=