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

Re: [Xen-devel] [PATCH] [POWERPC] fix vga.c compilation

On Tue, 2006-08-15 at 18:08 -0500, Hollis Blanchard wrote:
> # HG changeset patch
> # User Hollis Blanchard <hollisb@xxxxxxxxxx>
> # Date 1155683306 18000
> # Node ID 2250d38aed3854c626bdc642a91884754f9d12d8
> # Parent  6dcd85ea232e0de5445f325abd0829a0ed6d56a1
> [POWERPC] fix vga.c compilation
> - replace vga_readb/writeb with plain readb/writeb
> - add per-arch vga.c and vga.h
> - make detect_video() a per-arch function
> - stop doing void* arithmetic
> - remove i386 ifdef

   Thanks Hollis.  Keir, here's a patch that applies on top of the one
from Hollis that fixes up ia64 support for VGA console.  Included is a
bug fix in the font setup that accessed the legacy VGA MMIO range as
cacheable memory.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r b7cf184c3008 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Aug 15 17:20:11 2006 -0600
+++ b/xen/arch/ia64/xen/domain.c        Tue Aug 15 17:57:48 2006 -0600
@@ -864,6 +864,7 @@ int construct_dom0(struct domain *d,
 {
        int i, rc;
        start_info_t *si;
+       dom0_vga_console_info_t *ci;
        struct vcpu *v = d->vcpu[0];
        unsigned long max_pages;
 
@@ -1000,6 +1001,9 @@ int construct_dom0(struct domain *d,
        //if ( initrd_len != 0 )
        //    memcpy((void *)vinitrd_start, initrd_start, initrd_len);
 
+       BUILD_BUG_ON(sizeof(start_info_t) + sizeof(dom0_vga_console_info_t) +
+                    sizeof(struct ia64_boot_param) > PAGE_SIZE);
+
        /* Set up start info area. */
        d->shared_info->arch.start_info_pfn = pstart_info >> PAGE_SHIFT;
        start_info_page = assign_new_domain_page(d, pstart_info);
@@ -1034,7 +1038,8 @@ int construct_dom0(struct domain *d,
        strncpy((char *)si->cmd_line, dom0_command_line, sizeof(si->cmd_line));
        si->cmd_line[sizeof(si->cmd_line)-1] = 0;
 
-       bp = (struct ia64_boot_param *)(si + 1);
+       bp = (struct ia64_boot_param *)((unsigned char *)si +
+                                       sizeof(start_info_t));
        bp->command_line = pstart_info + offsetof (start_info_t, cmd_line);
 
        /* We assume console has reached the last line!  */
@@ -1048,6 +1053,16 @@ int construct_dom0(struct domain *d,
                     (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
        bp->initrd_size = ia64_boot_param->initrd_size;
 
+       ci = (dom0_vga_console_info_t *)((unsigned char *)si +
+                                        sizeof(start_info_t) +
+                                        sizeof(struct ia64_boot_param));
+
+       if (fill_console_start_info(ci)) {
+               si->console.dom0.info_off = sizeof(start_info_t) +
+                                           sizeof(struct ia64_boot_param);
+               si->console.dom0.info_size = sizeof(dom0_vga_console_info_t);
+       }
+
        vcpu_init_regs (v);
 
        vcpu_regs(v)->r28 = bp_mpa;
diff -r b7cf184c3008 xen/arch/ia64/xen/vga.c
--- a/xen/arch/ia64/xen/vga.c   Tue Aug 15 17:20:11 2006 -0600
+++ b/xen/arch/ia64/xen/vga.c   Tue Aug 15 17:57:48 2006 -0600
@@ -19,9 +19,9 @@
  */
 
 #include <xen/vga.h>
+#include <linux/efi.h>
 
 int detect_vga(void)
 {
-       /* disabled completely for now */
-    return 0;
+    return (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY);
 }
diff -r b7cf184c3008 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c   Tue Aug 15 17:20:11 2006 -0600
+++ b/xen/drivers/video/vga.c   Tue Aug 15 17:57:48 2006 -0600
@@ -472,7 +472,9 @@ int vga_load_font(const struct font_desc
     {
         unsigned i, j;
         const uint8_t *data = font->data;
-        uint8_t *map = (uint8_t *)__va(0xA0000) + font_slot*2*CHAR_MAP_SIZE;
+        uint8_t *map = (uint8_t *)0xA0000 + font_slot*2*CHAR_MAP_SIZE;
+
+        map = ioremap(map, CHAR_MAP_SIZE);
 
         for ( i = j = 0; i < CHAR_MAP_SIZE; )
         {
diff -r b7cf184c3008 xen/include/asm-ia64/vga.h
--- a/xen/include/asm-ia64/vga.h        Tue Aug 15 17:20:11 2006 -0600
+++ b/xen/include/asm-ia64/vga.h        Tue Aug 15 17:57:48 2006 -0600
@@ -24,10 +24,4 @@
 #define vgabase 0
 #define VGA_OUTW_WRITE
 
-static int detect_vga(void)
-{
-       /* disabled completely for now */
-       return 0;
-}
-
 #endif /* _ASM_VGA_H_ */
diff -r b7cf184c3008 linux-2.6-xen-sparse/arch/ia64/dig/setup.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/arch/ia64/dig/setup.c        Tue Aug 15 17:57:48 
2006 -0600
@@ -0,0 +1,110 @@
+/*
+ * Platform dependent support for DIG64 platforms.
+ *
+ * Copyright (C) 1999 Intel Corp.
+ * Copyright (C) 1999, 2001 Hewlett-Packard Co
+ * Copyright (C) 1999, 2001, 2003 David Mosberger-Tang <davidm@xxxxxxxxxx>
+ * Copyright (C) 1999 VA Linux Systems
+ * Copyright (C) 1999 Walt Drummond <drummond@xxxxxxxxxxx>
+ * Copyright (C) 1999 Vijay Chander <vijay@xxxxxxxxxxxx>
+ */
+#include <linux/config.h>
+
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/kdev_t.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+#include <linux/timex.h>
+#include <linux/sched.h>
+#include <linux/root_dev.h>
+
+#include <asm/io.h>
+#include <asm/machvec.h>
+#include <asm/system.h>
+
+void __init
+dig_setup (char **cmdline_p)
+{
+       unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
+
+       /*
+        * Default to /dev/sda2.  This assumes that the EFI partition
+        * is physical disk 1 partition 1 and the Linux root disk is
+        * physical disk 1 partition 2.
+        */
+       ROOT_DEV = Root_SDA2;           /* default to second partition on first 
drive */
+
+#ifdef CONFIG_SMP
+       init_smp_config();
+#endif
+
+       memset(&screen_info, 0, sizeof(screen_info));
+
+       if (!ia64_boot_param->console_info.num_rows
+           || !ia64_boot_param->console_info.num_cols)
+       {
+               printk(KERN_WARNING "dig_setup: warning: invalid screen-info, 
guessing 80x25\n");
+               orig_x = 0;
+               orig_y = 0;
+               num_cols = 80;
+               num_rows = 25;
+               font_height = 16;
+       } else {
+               orig_x = ia64_boot_param->console_info.orig_x;
+               orig_y = ia64_boot_param->console_info.orig_y;
+               num_cols = ia64_boot_param->console_info.num_cols;
+               num_rows = ia64_boot_param->console_info.num_rows;
+               font_height = 400 / num_rows;
+       }
+
+       screen_info.orig_x = orig_x;
+       screen_info.orig_y = orig_y;
+       screen_info.orig_video_cols  = num_cols;
+       screen_info.orig_video_lines = num_rows;
+       screen_info.orig_video_points = font_height;
+       screen_info.orig_video_mode = 3;        /* XXX fake */
+       screen_info.orig_video_isVGA = 1;       /* XXX fake */
+       screen_info.orig_video_ega_bx = 3;      /* XXX fake */
+#ifdef CONFIG_XEN
+       if (!is_running_on_xen())
+               return;
+
+       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);
+               screen_info.orig_video_mode = info->txt_mode;
+               screen_info.orig_video_isVGA = info->video_type;
+               screen_info.orig_video_lines = info->video_height;
+               screen_info.orig_video_cols = info->video_width;
+               screen_info.orig_video_points = info->txt_points;
+               screen_info.lfb_width = info->video_width;
+               screen_info.lfb_height = info->video_height;
+               screen_info.lfb_depth = info->lfb_depth;
+               screen_info.lfb_base = info->lfb_base;
+               screen_info.lfb_size = info->lfb_size;
+               screen_info.lfb_linelength = info->lfb_linelen;
+               screen_info.red_size = info->red_size;
+               screen_info.red_pos = info->red_pos;
+               screen_info.green_size = info->green_size;
+               screen_info.green_pos = info->green_pos;
+               screen_info.blue_size = info->blue_size;
+               screen_info.blue_pos = info->blue_pos;
+               screen_info.rsvd_size = info->rsvd_size;
+               screen_info.rsvd_pos = info->rsvd_pos;
+       }
+       screen_info.orig_y = screen_info.orig_video_lines - 1;
+       xen_start_info->console.domU.mfn = 0;
+       xen_start_info->console.domU.evtchn = 0;
+#endif
+}
+
+void __init
+dig_irq_init (void)
+{
+}



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