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-changelog

[Xen-changelog] [xen-unstable] [XEN] vga code cleanups and additions for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] vga code cleanups and additions for other architectures.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Aug 2006 02:40:43 +0000
Delivery-date: Fri, 18 Aug 2006 19:43:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 3e75d9b1d55656eb16823d277c6609753a847ae4
# Parent  87165e688bc5d67d6f0cd0bb8b900b402d9cbb0d
[XEN] vga code cleanups and additions for other architectures.
Based on patches from Hollis Blanchard and Alex Williamson.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/include/xen/font.h                     |   22 --
 linux-2.6-xen-sparse/arch/ia64/dig/setup.c |  110 ++++++++++++++
 xen/arch/ia64/Rules.mk                     |    1 
 xen/arch/ia64/xen/domain.c                 |   17 ++
 xen/arch/ia64/xen/mm.c                     |    5 
 xen/arch/x86/Rules.mk                      |    1 
 xen/arch/x86/mm.c                          |   15 ++
 xen/drivers/Makefile                       |    2 
 xen/drivers/char/console.c                 |  149 --------------------
 xen/drivers/video/font.h                   |   22 ++
 xen/drivers/video/font_8x14.c              |    2 
 xen/drivers/video/font_8x16.c              |    2 
 xen/drivers/video/font_8x8.c               |    2 
 xen/drivers/video/vga.c                    |  214 +++++++++++++++++++++++------
 xen/include/asm-ia64/config.h              |    2 
 xen/include/asm-x86/config.h               |    2 
 xen/include/asm-x86/io.h                   |    1 
 xen/include/xen/mm.h                       |    3 
 xen/include/xen/vga.h                      |   14 +
 19 files changed, 368 insertions(+), 218 deletions(-)

diff -r 87165e688bc5 -r 3e75d9b1d556 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk    Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/arch/ia64/Rules.mk    Wed Aug 16 18:20:03 2006 +0100
@@ -2,6 +2,7 @@
 # ia64-specific definitions
 
 HAS_ACPI := y
+HAS_VGA  := y
 VALIDATE_VT    ?= n
 no_warns ?= n
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/arch/ia64/xen/domain.c        Wed Aug 16 18:20:03 2006 +0100
@@ -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 87165e688bc5 -r 3e75d9b1d556 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/arch/ia64/xen/mm.c    Wed Aug 16 18:20:03 2006 +0100
@@ -1746,6 +1746,11 @@ int get_page_type(struct page_info *page
     return 1;
 }
 
+int memory_is_conventional_ram(paddr_t p)
+{
+    return (efi_mem_type(p) == EFI_CONVENTIONAL_MEMORY);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk     Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/arch/x86/Rules.mk     Wed Aug 16 18:20:03 2006 +0100
@@ -2,6 +2,7 @@
 # x86-specific definitions
 
 HAS_ACPI := y
+HAS_VGA  := y
 
 #
 # If you change any of these configuration options then you must
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/arch/x86/mm.c Wed Aug 16 18:20:03 2006 +0100
@@ -234,6 +234,21 @@ void arch_init_memory(void)
     subarch_init_memory();
 }
 
+int memory_is_conventional_ram(paddr_t p)
+{
+    int i;
+
+    for ( i = 0; i < e820.nr_map; i++ )
+    {
+        if ( (e820.map[i].type == E820_RAM) &&
+             (e820.map[i].addr <= p) &&
+             (e820.map[i].size > p) )
+            return 1;
+    }
+
+    return 0;
+}
+
 void share_xen_page_with_guest(
     struct page_info *page, struct domain *d, int readonly)
 {
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/Makefile
--- a/xen/drivers/Makefile      Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/Makefile      Wed Aug 16 18:20:03 2006 +0100
@@ -1,3 +1,3 @@ subdir-y += char
 subdir-y += char
 subdir-$(HAS_ACPI) += acpi
-subdir-y += video
+subdir-$(HAS_VGA) += video
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/char/console.c        Wed Aug 16 18:20:03 2006 +0100
@@ -22,7 +22,6 @@
 #include <xen/delay.h>
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
-#include <xen/font.h>
 #include <xen/vga.h>
 #include <asm/current.h>
 #include <asm/debugger.h>
@@ -31,10 +30,6 @@
 /* console: comma-separated list of console outputs. */
 static char opt_console[30] = OPT_CONSOLE_STR;
 string_param("console", opt_console);
-
-/* vga: comma-separated options. */
-static char opt_vga[30] = "";
-string_param("vga", opt_vga);
 
 /* conswitch: a character pair controlling console switching. */
 /* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */
@@ -47,9 +42,6 @@ static int opt_sync_console;
 static int opt_sync_console;
 boolean_param("sync_console", opt_sync_console);
 
-static int xpos, ypos;
-static unsigned char *video;
-
 #define CONRING_SIZE 16384
 #define CONRING_IDX_MASK(i) ((i)&(CONRING_SIZE-1))
 static char conring[CONRING_SIZE];
@@ -58,134 +50,8 @@ static char printk_prefix[16] = "";
 static char printk_prefix[16] = "";
 
 static int sercon_handle = -1;
-static int vgacon_enabled = 0;
-static int vgacon_keep    = 0;
-static int vgacon_lines   = 25;
-static const struct font_desc *font;
 
 static DEFINE_SPINLOCK(console_lock);
-
-/*
- * *******************************************************
- * *************** OUTPUT TO VGA CONSOLE *****************
- * *******************************************************
- */
-
-/* VGA text-mode definitions. */
-#define COLUMNS     80
-#define LINES       vgacon_lines
-#define ATTRIBUTE   7
-#define VIDEO_SIZE  (COLUMNS * LINES * 2)
-
-/* Clear the screen and initialize VIDEO, XPOS and YPOS.  */
-static void cls(void)
-{
-    memset(video, 0, VIDEO_SIZE);
-    xpos = ypos = 0;
-    vga_cursor_off();
-}
-
-static void init_vga(void)
-{
-    char *p;
-
-    if ( !vgacon_enabled )
-        return;
-
-    for ( p = opt_vga; p != NULL; p = strchr(p, ',') )
-    {
-        if ( *p == ',' )
-            p++;
-        if ( strncmp(p, "keep", 4) == 0 )
-            vgacon_keep = 1;
-        else if ( strncmp(p, "text-80x", 8) == 0 )
-            vgacon_lines = simple_strtoul(p + 8, NULL, 10);
-    }
-
-    video = setup_vga();
-    if ( !video )
-    {
-        vgacon_enabled = 0;
-        return;
-    }
-
-    switch ( vgacon_lines )
-    {
-    case 25:
-    case 30:
-        font = &font_vga_8x16;
-        break;
-    case 28:
-    case 34:
-        font = &font_vga_8x14;
-        break;
-    case 43:
-    case 50:
-    case 60:
-        font = &font_vga_8x8;
-        break;
-    default:
-        vgacon_lines = 25;
-        break;
-    }
-
-    if ( (font != NULL) && (vga_load_font(font, vgacon_lines) < 0) )
-    {
-        vgacon_lines = 25;
-        font = NULL;
-    }
-    
-    cls();
-}
-
-static void put_newline(void)
-{
-    xpos = 0;
-    ypos++;
-
-    if ( ypos >= LINES )
-    {
-        ypos = LINES-1;
-        memmove((char*)video, 
-                (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
-        memset((char*)video + (LINES-1)*2*COLUMNS, 0, 2*COLUMNS);
-    }
-}
-
-static void putchar_console(int c)
-{
-    if ( !vgacon_enabled )
-        return;
-
-    if ( c == '\n' )
-    {
-        put_newline();
-    }
-    else
-    {
-        if ( xpos >= COLUMNS )
-            put_newline();
-        video[(xpos + ypos * COLUMNS) * 2]     = c & 0xFF;
-        video[(xpos + ypos * COLUMNS) * 2 + 1] = ATTRIBUTE;
-        ++xpos;
-    }
-}
-
-int fill_console_start_info(struct dom0_vga_console_info *ci)
-{
-    memset(ci, 0, sizeof(*ci));
-
-    if ( !vgacon_enabled )
-        return 0;
-
-    ci->video_type   = 1;
-    ci->video_width  = COLUMNS;
-    ci->video_height = LINES;
-    ci->txt_mode     = 3;
-    ci->txt_points   = font ? font->height : 16;
-
-    return 1;
-}
 
 /*
  * ********************************************************
@@ -328,7 +194,7 @@ static long guest_console_write(XEN_GUES
         serial_puts(sercon_handle, kbuf);
 
         for ( kptr = kbuf; *kptr != '\0'; kptr++ )
-            putchar_console(*kptr);
+            vga_putchar(*kptr);
 
         guest_handle_add_offset(buffer, kcount);
         count -= kcount;
@@ -395,7 +261,7 @@ static inline void __putstr(const char *
 
     while ( (c = *str++) != '\0' )
     {
-        putchar_console(c);
+        vga_putchar(c);
         putchar_console_ring(c);
     }
 }
@@ -455,10 +321,8 @@ void init_console(void)
         if ( strncmp(p, "com", 3) == 0 )
             sercon_handle = serial_parse_handle(p);
         else if ( strncmp(p, "vga", 3) == 0 )
-            vgacon_enabled = 1;
-    }
-
-    init_vga();
+            vga_init();
+    }
 
     serial_set_rx_handler(sercon_handle, serial_rx);
 
@@ -510,10 +374,7 @@ void console_endboot(void)
         printk("\n");
     }
 
-    if ( !vgacon_keep )
-        vgacon_enabled = 0;
-    printk("Xen is %s VGA console.\n",
-           vgacon_keep ? "keeping" : "relinquishing");
+    vga_endboot();
 
     /*
      * If user specifies so, we fool the switch routine to redirect input
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/video/font_8x14.c
--- a/xen/drivers/video/font_8x14.c     Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/video/font_8x14.c     Wed Aug 16 18:20:03 2006 +0100
@@ -5,7 +5,7 @@
 /**********************************************/
 
 #include <xen/types.h>
-#include <xen/font.h>
+#include "font.h"
 
 #define FONTDATAMAX (256*14)
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/video/font_8x16.c
--- a/xen/drivers/video/font_8x16.c     Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/video/font_8x16.c     Wed Aug 16 18:20:03 2006 +0100
@@ -5,7 +5,7 @@
 /**********************************************/
 
 #include <xen/types.h>
-#include <xen/font.h>
+#include "font.h"
 
 #define FONTDATAMAX (256*16)
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/video/font_8x8.c
--- a/xen/drivers/video/font_8x8.c      Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/video/font_8x8.c      Wed Aug 16 18:20:03 2006 +0100
@@ -5,7 +5,7 @@
 /**********************************************/
 
 #include <xen/types.h>
-#include <xen/font.h>
+#include "font.h"
 
 #define FONTDATAMAX (256*8)
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c   Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/drivers/video/vga.c   Wed Aug 16 18:20:03 2006 +0100
@@ -8,13 +8,14 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/lib.h>
+#include <xen/mm.h>
 #include <xen/errno.h>
 #include <xen/event.h>
 #include <xen/spinlock.h>
 #include <xen/console.h>
-#include <xen/font.h>
 #include <xen/vga.h>
 #include <asm/io.h>
+#include "font.h"
 
 /* Some of the code below is taken from SVGAlib.  The original,
    unmodified copyright notice for that code is below. */
@@ -159,12 +160,8 @@
  * into a single 16-bit quantity */
 #define VGA_OUT16VAL(v, r)       (((v) << 8) | (r))
 
-#if defined(__i386__) || defined(__x86_64__)
-# define vgabase 0
-# define VGA_OUTW_WRITE
-# define vga_readb(x) (*(x))
-# define vga_writeb(x,y) (*(y) = (x))
-#endif
+#define vgabase 0         /* use in/out port-access macros  */
+#define VGA_OUTW_WRITE    /* can use outw instead of 2xoutb */
 
 /*
  * generic VGA port read/write
@@ -187,17 +184,17 @@ static inline void vga_io_w_fast(uint16_
 
 static inline uint8_t vga_mm_r(void __iomem *regbase, uint16_t port)
 {
-    return readb(regbase + port);
+    return readb((char *)regbase + port);
 }
 
 static inline void vga_mm_w(void __iomem *regbase, uint16_t port, uint8_t val)
 {
-    writeb(val, regbase + port);
+    writeb(val, (char *)regbase + port);
 }
 
 static inline void vga_mm_w_fast(void __iomem *regbase, uint16_t port, uint8_t 
reg, uint8_t val)
 {
-    writew(VGA_OUT16VAL(val, reg), regbase + port);
+    writew(VGA_OUT16VAL(val, reg), (char *)regbase + port);
 }
 
 static inline uint8_t vga_r(void __iomem *regbase, uint16_t port)
@@ -324,24 +321,8 @@ static int detect_video(void *video_base
     return video_found;
 }
 
-static int detect_vga(void)
-{
-    /*
-     * Look at a number of well-known locations. Even if video is not at
-     * 0xB8000 right now, it will appear there when we set up text mode 3.
-     * 
-     * We assume if there is any sign of a video adaptor then it is at least
-     * VGA-compatible (surely noone runs CGA, EGA, .... these days?).
-     * 
-     * These checks are basically to detect headless server boxes.
-     */
-    return (detect_video(ioremap(0xA0000, 0x1000)) || 
-            detect_video(ioremap(0xB0000, 0x1000)) || 
-            detect_video(ioremap(0xB8000, 0x1000)));
-}
-
 /* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
-void *setup_vga(void)
+static void *setup_vga(void)
 {
     /* The following VGA state was saved from a chip in text mode 3. */
     static unsigned char regs[] = {
@@ -358,13 +339,11 @@ void *setup_vga(void)
         0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x0c, 0x00, 0x0f, 0x08, 0x00
     };
 
+    char *video;
     int i, j;
 
-    if ( !detect_vga() )
-    {
-        printk("No VGA adaptor detected!\n");
-        return NULL;
-    }
+    if ( memory_is_conventional_ram(0xB8000) )
+        goto no_vga;
 
     inb(VGA_IS1_RC);
     outb(0x00, VGA_ATT_IW);
@@ -388,12 +367,19 @@ void *setup_vga(void)
     inb(VGA_IS1_RC);
     outb(0x20, VGA_ATT_IW);
 
-    return ioremap(0xB8000, 0x8000);
-}
-
-void vga_cursor_off(void)
-{
-    vga_wcrt(vgabase, VGA_CRTC_CURSOR_START, 0x20);
+    video = ioremap(0xB8000, 0x8000);
+
+    if ( !detect_video(video) )
+    {
+        iounmap(video);
+        goto no_vga;
+    }
+
+    return video;
+
+ no_vga:
+    printk("No VGA adaptor detected!\n");
+    return NULL;
 }
 
 static int vga_set_scanlines(unsigned scanlines)
@@ -473,7 +459,7 @@ static unsigned font_slot = 0;
 static unsigned font_slot = 0;
 integer_param("fontslot", font_slot);
 
-int vga_load_font(const struct font_desc *font, unsigned rows)
+static int vga_load_font(const struct font_desc *font, unsigned rows)
 {
     unsigned fontheight = font ? font->height : 16;
     uint8_t fsr = vga_rcrt(vgabase, VGA_CRTC_MAX_SCAN); /* Font size register 
*/
@@ -515,16 +501,19 @@ 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;
+
+        map = ioremap(0xA0000 + font_slot*2*CHAR_MAP_SIZE, CHAR_MAP_SIZE);
 
         for ( i = j = 0; i < CHAR_MAP_SIZE; )
         {
-            vga_writeb(j < font->count * fontheight ? data[j++] : 0,
-                       map + i++);
+            writeb(j < font->count * fontheight ? data[j++] : 0, map + i++);
             if ( !(j % fontheight) )
                 while ( i & (FONT_HEIGHT_MAX - 1) )
-                    vga_writeb(0, map + i++);
+                    writeb(0, map + i++);
         }
+
+        iounmap(map);
     }
 
     /* First, the sequencer, Synchronous reset */
@@ -560,3 +549,142 @@ int vga_load_font(const struct font_desc
 
     return 0;
 }
+
+
+/*
+ * HIGH-LEVEL INITIALISATION AND TEXT OUTPUT.
+ */
+
+static int vgacon_enabled = 0;
+static int vgacon_keep    = 0;
+static int vgacon_lines   = 25;
+static const struct font_desc *font;
+
+static int xpos, ypos;
+static unsigned char *video;
+
+/* vga: comma-separated options. */
+static char opt_vga[30] = "";
+string_param("vga", opt_vga);
+
+/* VGA text-mode definitions. */
+#define COLUMNS     80
+#define LINES       vgacon_lines
+#define ATTRIBUTE   7
+#define VIDEO_SIZE  (COLUMNS * LINES * 2)
+
+void vga_init(void)
+{
+    char *p;
+
+    for ( p = opt_vga; p != NULL; p = strchr(p, ',') )
+    {
+        if ( *p == ',' )
+            p++;
+        if ( strncmp(p, "keep", 4) == 0 )
+            vgacon_keep = 1;
+        else if ( strncmp(p, "text-80x", 8) == 0 )
+            vgacon_lines = simple_strtoul(p + 8, NULL, 10);
+    }
+
+    video = setup_vga();
+    if ( !video )
+        return;
+
+    switch ( vgacon_lines )
+    {
+    case 25:
+    case 30:
+        font = &font_vga_8x16;
+        break;
+    case 28:
+    case 34:
+        font = &font_vga_8x14;
+        break;
+    case 43:
+    case 50:
+    case 60:
+        font = &font_vga_8x8;
+        break;
+    default:
+        vgacon_lines = 25;
+        break;
+    }
+
+    if ( (font != NULL) && (vga_load_font(font, vgacon_lines) < 0) )
+    {
+        vgacon_lines = 25;
+        font = NULL;
+    }
+    
+    /* Clear the screen. */
+    memset(video, 0, VIDEO_SIZE);
+    xpos = ypos = 0;
+
+    /* Disable cursor. */
+    vga_wcrt(vgabase, VGA_CRTC_CURSOR_START, 0x20);
+
+    vgacon_enabled = 1;
+}
+
+void vga_endboot(void)
+{
+    if ( !vgacon_enabled )
+        return;
+
+    if ( !vgacon_keep )
+        vgacon_enabled = 0;
+        
+    printk("Xen is %s VGA console.\n",
+           vgacon_keep ? "keeping" : "relinquishing");
+}
+
+
+static void put_newline(void)
+{
+    xpos = 0;
+    ypos++;
+
+    if ( ypos >= LINES )
+    {
+        ypos = LINES-1;
+        memmove((char*)video, 
+                (char*)video + 2*COLUMNS, (LINES-1)*2*COLUMNS);
+        memset((char*)video + (LINES-1)*2*COLUMNS, 0, 2*COLUMNS);
+    }
+}
+
+void vga_putchar(int c)
+{
+    if ( !vgacon_enabled )
+        return;
+
+    if ( c == '\n' )
+    {
+        put_newline();
+    }
+    else
+    {
+        if ( xpos >= COLUMNS )
+            put_newline();
+        video[(xpos + ypos * COLUMNS) * 2]     = c & 0xFF;
+        video[(xpos + ypos * COLUMNS) * 2 + 1] = ATTRIBUTE;
+        ++xpos;
+    }
+}
+
+int fill_console_start_info(struct dom0_vga_console_info *ci)
+{
+    memset(ci, 0, sizeof(*ci));
+
+    if ( !vgacon_enabled )
+        return 0;
+
+    ci->video_type   = 1;
+    ci->video_width  = COLUMNS;
+    ci->video_height = LINES;
+    ci->txt_mode     = 3;
+    ci->txt_points   = font ? font->height : 16;
+
+    return 1;
+}
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/include/asm-ia64/config.h     Wed Aug 16 18:20:03 2006 +0100
@@ -36,6 +36,8 @@
 #define supervisor_mode_kernel (0)
 
 #define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31 addressable bits */
+
+#define CONFIG_VGA 1
 
 #ifndef __ASSEMBLY__
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/include/asm-x86/config.h      Wed Aug 16 18:20:03 2006 +0100
@@ -30,6 +30,8 @@
 
 #define CONFIG_ACPI 1
 #define CONFIG_ACPI_BOOT 1
+
+#define CONFIG_VGA 1
 
 #define HZ 100
 
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/asm-x86/io.h
--- a/xen/include/asm-x86/io.h  Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/include/asm-x86/io.h  Wed Aug 16 18:20:03 2006 +0100
@@ -7,6 +7,7 @@
 
 /* We don't need real ioremap() on Xen/x86. */
 #define ioremap(x,l) (__va(x))
+#define iounmap(p)   ((void)0)
 
 #define readb(x) (*(volatile char *)(x))
 #define readw(x) (*(volatile short *)(x))
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/xen/mm.h
--- a/xen/include/xen/mm.h      Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/include/xen/mm.h      Wed Aug 16 18:20:03 2006 +0100
@@ -97,4 +97,7 @@ unsigned long avail_scrub_pages(void);
 
 int guest_remove_page(struct domain *d, unsigned long gmfn);
 
+/* Returns TRUE if the memory at address @p is ordinary RAM. */
+int memory_is_conventional_ram(paddr_t p);
+
 #endif /* __XEN_MM_H__ */
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/xen/vga.h
--- a/xen/include/xen/vga.h     Wed Aug 16 18:11:33 2006 +0100
+++ b/xen/include/xen/vga.h     Wed Aug 16 18:20:03 2006 +0100
@@ -9,10 +9,16 @@
 #ifndef _XEN_VGA_H
 #define _XEN_VGA_H
 
-struct font_desc;
+#include <xen/config.h>
 
-void *setup_vga(void);
-void vga_cursor_off(void);
-int vga_load_font(const struct font_desc *, unsigned rows);
+#ifdef CONFIG_VGA
+void vga_init(void);
+void vga_endboot(void);
+void vga_putchar(int c);
+#else
+#define vga_init()     ((void)0)
+#define vga_endboot()  ((void)0)
+#define vga_putchar(c) ((void)0)
+#endif
 
 #endif /* _XEN_VGA_H */
diff -r 87165e688bc5 -r 3e75d9b1d556 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        Wed Aug 16 18:20:03 
2006 +0100
@@ -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)
+{
+}
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/drivers/video/font.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/drivers/video/font.h  Wed Aug 16 18:20:03 2006 +0100
@@ -0,0 +1,22 @@
+/*
+ *  font.h -- `Soft' font definitions
+ *
+ *  Created 1995 by Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive
+ *  for more details.
+ */
+
+#ifndef _XEN_FONT_H
+#define _XEN_FONT_H
+
+struct font_desc {
+    const char *name;
+    unsigned width, height, count;
+    const void *data;
+};
+
+extern const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16;
+
+#endif /* _XEN_FONT_H */
diff -r 87165e688bc5 -r 3e75d9b1d556 xen/include/xen/font.h
--- a/xen/include/xen/font.h    Wed Aug 16 18:11:33 2006 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
- *  font.h -- `Soft' font definitions
- *
- *  Created 1995 by Geert Uytterhoeven
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive
- *  for more details.
- */
-
-#ifndef _XEN_FONT_H
-#define _XEN_FONT_H
-
-struct font_desc {
-    const char *name;
-    unsigned width, height, count;
-    const void *data;
-};
-
-extern const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16;
-
-#endif /* _XEN_FONT_H */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] vga code cleanups and additions for other architectures., Xen patchbot-unstable <=