diff -r ec03b24a2d83 xen/arch/ia64/Rules.mk --- a/xen/arch/ia64/Rules.mk Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/ia64/Rules.mk Wed Aug 16 11:44:31 2006 +0100 @@ -2,6 +2,7 @@ # ia64-specific definitions HAS_ACPI := y +HAS_VGA := y VALIDATE_VT ?= n no_warns ?= n diff -r ec03b24a2d83 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/ia64/xen/domain.c Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/ia64/xen/mm.c Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/arch/powerpc/Makefile --- a/xen/arch/powerpc/Makefile Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/powerpc/Makefile Wed Aug 16 11:44:31 2006 +0100 @@ -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 ec03b24a2d83 xen/arch/x86/Rules.mk --- a/xen/arch/x86/Rules.mk Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/x86/Rules.mk Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/arch/x86/mm.c Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/drivers/Makefile --- a/xen/drivers/Makefile Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/drivers/Makefile Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/drivers/video/vga.c --- a/xen/drivers/video/vga.c Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/drivers/video/vga.c Wed Aug 16 11:44:31 2006 +0100 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -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) @@ -326,6 +323,12 @@ static int detect_video(void *video_base 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. @@ -335,9 +338,26 @@ static int detect_vga(void) * * 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))); + + 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 :-) */ @@ -515,16 +535,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 */ diff -r ec03b24a2d83 xen/include/asm-x86/io.h --- a/xen/include/asm-x86/io.h Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/include/asm-x86/io.h Wed Aug 16 11:44:31 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 ec03b24a2d83 xen/include/xen/mm.h --- a/xen/include/xen/mm.h Tue Aug 15 19:53:55 2006 +0100 +++ b/xen/include/xen/mm.h Wed Aug 16 11:44:31 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 ec03b24a2d83 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 11:44:31 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 + * Copyright (C) 1999 VA Linux Systems + * Copyright (C) 1999 Walt Drummond + * Copyright (C) 1999 Vijay Chander + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +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 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 +#include +#include + +/* 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;