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-ppc-devel

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

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] [POWERPC] fix vga.c compilation
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Tue, 15 Aug 2006 18:08:36 -0500
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 15 Aug 2006 16:10:30 -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
# 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

Boot-tested on PowerPC; compile-tested on x86.

Signed-off-by Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/ia64/xen/Makefile
--- a/xen/arch/ia64/xen/Makefile        Tue Aug 15 13:54:09 2006 +0100
+++ b/xen/arch/ia64/xen/Makefile        Tue Aug 15 18:08:26 2006 -0500
@@ -25,5 +25,6 @@ obj-y += xentime.o
 obj-y += xentime.o
 obj-y += flushd.o
 obj-y += privop_stat.o
+obj-y += vga.o
 
 obj-$(crash_debug) += gdbstub.o
diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Tue Aug 15 13:54:09 2006 +0100
+++ b/xen/arch/powerpc/Makefile Tue Aug 15 18:08:26 2006 -0500
@@ -35,6 +35,7 @@ obj-y += smp.o
 obj-y += smp.o
 obj-y += time.o
 obj-y += usercopy.o
+obj-y += vga.o
 
 obj-$(debug) += 0opt.o
 obj-$(crash_debug) += gdbstub.o
diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile     Tue Aug 15 13:54:09 2006 +0100
+++ b/xen/arch/x86/Makefile     Tue Aug 15 18:08:26 2006 -0500
@@ -38,6 +38,7 @@ obj-y += trampoline.o
 obj-y += trampoline.o
 obj-y += traps.o
 obj-y += usercopy.o
+obj-y += vga.o
 obj-y += x86_emulate.o
 
 ifneq ($(pae),n)
diff -r 6dcd85ea232e -r 2250d38aed38 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c   Tue Aug 15 13:54:09 2006 +0100
+++ b/xen/drivers/video/vga.c   Tue Aug 15 18:08:26 2006 -0500
@@ -14,6 +14,7 @@
 #include <xen/console.h>
 #include <xen/font.h>
 #include <xen/vga.h>
+#include <asm/vga.h>
 #include <asm/io.h>
 
 /* Some of the code below is taken from SVGAlib.  The original,
@@ -159,13 +160,6 @@
  * 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
-
 /*
  * generic VGA port read/write
  */
@@ -187,17 +181,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)
@@ -302,43 +296,6 @@ static inline void vga_wattr(void __iome
     vga_w(regbase, VGA_ATT_W, val);
 }
 
-static int detect_video(void *video_base)
-{
-    volatile u16 *p = (volatile u16 *)video_base;
-    u16 saved1 = p[0], saved2 = p[1];
-    int video_found = 1;
-
-    p[0] = 0xAA55;
-    p[1] = 0x55AA;
-    if ( (p[0] != 0xAA55) || (p[1] != 0x55AA) )
-        video_found = 0;
-
-    p[0] = 0x55AA;
-    p[1] = 0xAA55;
-    if ( (p[0] != 0x55AA) || (p[1] != 0xAA55) )
-        video_found = 0;
-
-    p[0] = saved1;
-    p[1] = saved2;
-
-    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)
@@ -519,11 +476,11 @@ int vga_load_font(const struct font_desc
 
         for ( i = j = 0; i < CHAR_MAP_SIZE; )
         {
-            vga_writeb(j < font->count * fontheight ? data[j++] : 0,
+            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++);
         }
     }
 
diff -r 6dcd85ea232e -r 2250d38aed38 xen/include/xen/vga.h
--- a/xen/include/xen/vga.h     Tue Aug 15 13:54:09 2006 +0100
+++ b/xen/include/xen/vga.h     Tue Aug 15 18:08:26 2006 -0500
@@ -11,6 +11,7 @@
 
 struct font_desc;
 
+int detect_vga(void);
 void *setup_vga(void);
 void vga_cursor_off(void);
 int vga_load_font(const struct font_desc *, unsigned rows);
diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/ia64/xen/vga.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/ia64/xen/vga.c   Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,27 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ */
+
+#include <xen/vga.h>
+
+int detect_vga(void)
+{
+       /* disabled completely for now */
+    return 0;
+}
diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/powerpc/vga.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/vga.c    Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,27 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ */
+
+#include <xen/vga.h>
+
+int detect_vga(void)
+{
+       /* disabled completely for now */
+    return 0;
+}
diff -r 6dcd85ea232e -r 2250d38aed38 xen/arch/x86/vga.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/vga.c        Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,59 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (c) 2002-2004, K A Fraser.
+ */
+
+#include <xen/types.h>
+#include <xen/vga.h>
+#include <asm/io.h>
+
+static int detect_video(void *video_base)
+{
+    volatile u16 *p = (volatile u16 *)video_base;
+    u16 saved1 = p[0], saved2 = p[1];
+    int video_found = 1;
+
+    p[0] = 0xAA55;
+    p[1] = 0x55AA;
+    if ( (p[0] != 0xAA55) || (p[1] != 0x55AA) )
+        video_found = 0;
+
+    p[0] = 0x55AA;
+    p[1] = 0xAA55;
+    if ( (p[0] != 0x55AA) || (p[1] != 0xAA55) )
+        video_found = 0;
+
+    p[0] = saved1;
+    p[1] = saved2;
+
+    return video_found;
+}
+
+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)));
+}
diff -r 6dcd85ea232e -r 2250d38aed38 xen/include/asm-ia64/vga.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-ia64/vga.h        Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,33 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ */
+
+#ifndef _ASM_VGA_H_
+#define _ASM_VGA_H_
+
+#define vgabase 0
+#define VGA_OUTW_WRITE
+
+static int detect_vga(void)
+{
+       /* disabled completely for now */
+       return 0;
+}
+
+#endif /* _ASM_VGA_H_ */
diff -r 6dcd85ea232e -r 2250d38aed38 xen/include/asm-powerpc/vga.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-powerpc/vga.h     Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,27 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ */
+
+#ifndef _ASM_VGA_H_
+#define _ASM_VGA_H_
+
+#define vgabase 0
+#define VGA_OUTW_WRITE
+
+#endif /* _ASM_VGA_H_ */
diff -r 6dcd85ea232e -r 2250d38aed38 xen/include/asm-x86/vga.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-x86/vga.h Tue Aug 15 18:08:26 2006 -0500
@@ -0,0 +1,27 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
+ */
+
+#ifndef _ASM_VGA_H_
+#define _ASM_VGA_H_
+
+#define vgabase 0
+#define VGA_OUTW_WRITE
+
+#endif /* _ASM_VGA_H_ */

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