Hollis Blanchard
2006-Aug-15 23:08 UTC
[Xen-devel] [PATCH] [POWERPC] fix vga.c compilation
# HG changeset patch # User Hollis Blanchard <hollisb@us.ibm.com> # 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@us.ibm.com> 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@us.ibm.com> + */ + +#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@us.ibm.com> + */ + +#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@us.ibm.com> + */ + +#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@us.ibm.com> + */ + +#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@us.ibm.com> + */ + +#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@lists.xensource.com http://lists.xensource.com/xen-devel
Alex Williamson
2006-Aug-16 00:03 UTC
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@us.ibm.com> > # 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 ifdefThanks 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@hp.com> --- 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@hpl.hp.com> + * Copyright (C) 1999 VA Linux Systems + * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> + * Copyright (C) 1999 Vijay Chander <vijay@engr.sgi.com> + */ +#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@lists.xensource.com http://lists.xensource.com/xen-devel
Hollis Blanchard
2006-Aug-16 00:30 UTC
[Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On Tue, 2006-08-15 at 18:08 -0500, Hollis Blanchard wrote:> 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...> + > +#include <xen/vga.h> > + > +int detect_vga(void) > +{ > + /* disabled completely for now */ > + return 0; > +}Looks like I bungled this whitespace; could you fix when you commit please? It would probably be best to combine this patch with the ia64 patch and put both our signed-off lines on it. (I''ll sign off on Alex''s changes, FWIW.) -- Hollis Blanchard IBM Linux Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-16 09:15 UTC
[Xen-ia64-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On 16/8/06 1:30 am, "Hollis Blanchard" <hollisb@us.ibm.com> wrote:> Looks like I bungled this whitespace; could you fix when you commit > please? > > It would probably be best to combine this patch with the ia64 patch and > put both our signed-off lines on it. (I''ll sign off on Alex''s changes, > FWIW.)I don''t think the diffs between the arches should be sufficient to warrant whole new header files. I''ll cook up a combined patch and post it,. -- Keir _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Keir Fraser
2006-Aug-16 10:49 UTC
Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On 16/8/06 10:15 am, "Keir Fraser" <Keir.Fraser@cl.cam.ac.uk> wrote:>> Looks like I bungled this whitespace; could you fix when you commit >> please? >> >> It would probably be best to combine this patch with the ia64 patch and >> put both our signed-off lines on it. (I''ll sign off on Alex''s changes, >> FWIW.) > > I don''t think the diffs between the arches should be sufficient to warrant > whole new header files. I''ll cook up a combined patch and post it,.Here you go. Arch/powerpc/vga.c isn''t great but I assume it''s temporary until vga support is fixed properly. If you think it looks okay I''ll apply it. Also Sign-off or Ack if you like. -- Keir _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Alex Williamson
2006-Aug-16 13:59 UTC
Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On Wed, 2006-08-16 at 11:49 +0100, Keir Fraser wrote:> Here you go. Arch/powerpc/vga.c isn''t great but I assume it''s > temporary > until vga support is fixed properly. > > If you think it looks okay I''ll apply it. Also Sign-off or Ack if you > like.Hi Keir, In general this looks a lot better, but I think ia64 is still going to have trouble with the chunk below. It seems that a VGA card operating in a standard text mode doesn''t necessarily respond to all of these addresses. On some ia64 platforms that causes a hard fail response (the bus goes fatal and a reboot follows). On my system, the 0xB8000 test looks like it will probably work, but we never get there because either the 0xA0000 or the 0xB0000 test will cause the hardfail. Do we need to poke the card through I/O port space to get it into the right mode before probing it in MMIO space? I don''t know enough about the VGA programming model to be able to do that. The card works once we start talking to it correctly, but this probe is a little too brute force. Thanks, Alex> + > + p = ioremap(0xA0000, 0x1000); > + detected = detect_video(p); > + iounmap(p); > + if ( detected ) > + return 1; > + > + p = ioremap(0xB0000, 0x1000); > + detected = detect_video(p); > + iounmap(p); > + if ( detected ) > + return 1; > + > + p = ioremap(0xB8000, 0x1000); > + detected = detect_video(p); > + iounmap(p); > + if ( detected ) > + return 1; > +-- Alex Williamson HP Open Source & Linux Org. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Aug-16 14:24 UTC
Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On 16/8/06 2:59 pm, "Alex Williamson" <alex.williamson@hp.com> wrote:> In general this looks a lot better, but I think ia64 is still going > to have trouble with the chunk below. It seems that a VGA card > operating in a standard text mode doesn''t necessarily respond to all of > these addresses. On some ia64 platforms that causes a hard fail > response (the bus goes fatal and a reboot follows). On my system, the > 0xB8000 test looks like it will probably work, but we never get there > because either the 0xA0000 or the 0xB0000 test will cause the hardfail. > Do we need to poke the card through I/O port space to get it into the > right mode before probing it in MMIO space? I don''t know enough about > the VGA programming model to be able to do that. The card works once we > start talking to it correctly, but this probe is a little too brute > force. Thanks,Actually I''m not sure this is particularly necessary for headless x86 either. I could move the test to the end of setup_vga(), and only probe 0xb8000? x86 is more ''resilient'' to random memory and port accesses. I don''t think it''ll matter that we do lots of port accesses even if a vga adapter isn''t present. If we keep the conventional-ram test as well, then that''ll be the same level of checking that Linux does on ia64. -- Keir _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Alex Williamson
2006-Aug-16 14:48 UTC
Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation
On Wed, 2006-08-16 at 15:24 +0100, Keir Fraser wrote:> Actually I''m not sure this is particularly necessary for headless x86 > either. I could move the test to the end of setup_vga(), and only probe > 0xb8000?Hi Keir, Yeah, I think something like the below change to your previous patch would be fine. Thanks! Alex Signed-off-by: Alex Williamson <alex.williamson@hp.com> --- diff -r aa9ed07f34a5 xen/drivers/video/vga.c --- a/xen/drivers/video/vga.c Wed Aug 16 08:38:18 2006 -0600 +++ b/xen/drivers/video/vga.c Wed Aug 16 08:46:30 2006 -0600 @@ -321,45 +321,6 @@ static int detect_video(void *video_base return video_found; } -static int detect_vga(void) -{ - int detected; - void *p; - - if ( memory_is_conventional_ram(0xA0000) ) - return 0; - - /* - * 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. - */ - - p = ioremap(0xA0000, 0x1000); - detected = detect_video(p); - iounmap(p); - if ( detected ) - return 1; - - p = ioremap(0xB0000, 0x1000); - detected = detect_video(p); - iounmap(p); - if ( detected ) - return 1; - - p = ioremap(0xB8000, 0x1000); - detected = detect_video(p); - iounmap(p); - if ( detected ) - return 1; - - return 0; -} - /* This is actually code from vgaHWRestore in an old version of XFree86 :-) */ void *setup_vga(void) { @@ -378,9 +339,10 @@ void *setup_vga(void) 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x0c, 0x00, 0x0f, 0x08, 0x00 }; - int i, j; - - if ( !detect_vga() ) + int i, j, detected; + void *p; + + if ( memory_is_conventional_ram(0xA0000) ) { printk("No VGA adaptor detected!\n"); return NULL; @@ -407,6 +369,12 @@ void *setup_vga(void) inb(VGA_IS1_RC); outb(0x20, VGA_ATT_IW); + + p = ioremap(0xB8000, 0x1000); + detected = detect_video(p); + iounmap(p); + if ( !detected ) + return NULL; return ioremap(0xB8000, 0x8000); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Wed, 2006-08-16 at 11:49 +0100, Keir Fraser wrote:> @@ -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 */When would you redefine vgabase?> diff -r ec03b24a2d83 xen/arch/powerpc/vga.c > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/xen/arch/powerpc/vga.c Wed Aug 16 11:44:31 2006 +0100 > @@ -0,0 +1,21 @@ > +#include <xen/types.h> > +#include <xen/font.h> > +#include <xen/vga.h> > + > +/* Temporary dummy versions until the VGA driver is fixed. */ > + > +void *setup_vga(void) > +{ > + return NULL; > +} > + > +void vga_cursor_off(void) > +{ > +} > + > +int vga_load_font(const struct font_desc *desc, unsigned rows) > +{ > + return -1; > +} > + > +const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16;I think there could be a cleaner separation between console.c and vga.c, and that would avoid needing to redefine these symbols. For example, right now cls(), init_vga(), and others still live in console.c, most of them manually testing vgacon_enabled. What would be better is a system where console drivers (i.e. serial and vga) register themselves at boot time, so console.c putchar() becomes: void __putstr(char *str) { struct console_driver *d; for (d = console_list; d != NULL; d = d->next) d->putstr(str); } Then all that serial-specific and vga-specific code can be removed from console.c, and that would make disabling VGA at compile time much more clean. -- Hollis Blanchard IBM Linux Technology Center _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
On 16/8/06 4:35 pm, "Hollis Blanchard" <hollisb@us.ibm.com> wrote:> On Wed, 2006-08-16 at 11:49 +0100, Keir Fraser wrote: >> @@ -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 */ > > When would you redefine vgabase?Right there, with ifdef''s, when an arch comes along that requires it.>> +const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16; > > I think there could be a cleaner separation between console.c and vga.c, > and that would avoid needing to redefine these symbols. For example, > right now cls(), init_vga(), and others still live in console.c, most of > them manually testing vgacon_enabled. > > What would be better is a system where console drivers (i.e. serial and > vga) register themselves at boot time, so console.c putchar() becomes:Well, that''d be more important if it were likely that the powerpc dummy versions were going to stick around. Since they''re not, I don''t think we need to over-engineer a solution looking for a problem. -- Keir _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
On Wed, 2006-08-16 at 16:40 +0100, Keir Fraser wrote:> > On 16/8/06 4:35 pm, "Hollis Blanchard" <hollisb@us.ibm.com> wrote: > > > On Wed, 2006-08-16 at 11:49 +0100, Keir Fraser wrote: > >> @@ -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 */ > > > > When would you redefine vgabase? > > Right there, with ifdef''s, when an arch comes along that requires it.(By "when" I meant "under what conditions", not "where in the code".) OK, I was getting confused between readb/writeb and inb/outb. PowerPC already applies its own offset to inb/outb accesses, but that doesn''t include memory accesses via readb/writeb. So we will need a ''vgabase''. However, it will need to be a variable, not a #define, since our physical memory map depends on northbridge configuration. When we do add support, wouldn''t asm/vga.h be a better place to do that than ifdefs in vga.c?> >> +const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16; > > > > I think there could be a cleaner separation between console.c and vga.c, > > and that would avoid needing to redefine these symbols. For example, > > right now cls(), init_vga(), and others still live in console.c, most of > > them manually testing vgacon_enabled. > > > > What would be better is a system where console drivers (i.e. serial and > > vga) register themselves at boot time, so console.c putchar() becomes: > > Well, that''d be more important if it were likely that the powerpc dummy > versions were going to stick around. Since they''re not, I don''t think we > need to over-engineer a solution looking for a problem.serial.c is already designed this way, and currently we have exactly one serial backend driver in the tree. I don''t think it''s over-engineering; it''s a well-understood model and easy to follow in code, even via cscope. Also, I should add that VGA is a very low priority for PowerPC. Only one of our supported platforms has video in the first place, and since it''s a blade, network-accessible serial console is far more useful than video anyways. So the dummy versions may live longer than you''re thinking... -- Hollis Blanchard IBM Linux Technology Center _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel