fix vga.c compilation
PATCH 1/1 fix vga.c compilation
# HG changeset patch
# User Hollis Blanchard <[email protected]> # 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 <[email protected]>
xen/arch/ia64/xen/Makefile +1 -0
@@ -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
xen/arch/powerpc/Makefile +1 -0
@@ -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
xen/arch/x86/Makefile +1 -0
@@ -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)
xen/drivers/video/vga.c +6 -49
96 lines not on this page · raw message
xen/include/xen/vga.h +1 -0
@@ -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);
xen/arch/ia64/xen/vga.c new file +27 -0
@@ -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 <[email protected]> +*/ + +#include <xen/vga.h> + +int detect_vga (void ) +{ +/* disabled completely for now */ +return 0 ; +}
xen/arch/powerpc/vga.c new file +27 -0
@@ -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 <[email protected]> +*/ + +#include <xen/vga.h> + +int detect_vga (void ) +{ +/* disabled completely for now */ +return 0 ; +}
xen/arch/x86/vga.c new file +59 -0
59 lines not on this page · raw message
xen/include/asm-ia64/vga.h new file +33 -0
@@ -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 <[email protected]> +*/ + +#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_ */
xen/include/asm-powerpc/vga.h new file +27 -0
@@ -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 <[email protected]> +*/ + +#ifndef _ASM_VGA_H_ +#define _ASM_VGA_H_ + +#define vgabase 0 +#define VGA_OUTW_WRITE + +#endif /* _ASM_VGA_H_ */
xen/include/asm-x86/vga.h new file +27 -0
@@ -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 <[email protected]> +*/ + +#ifndef _ASM_VGA_H_ +#define _ASM_VGA_H_ + +#define vgabase 0 +#define VGA_OUTW_WRITE + +#endif /* _ASM_VGA_H_ */
Quoted 11 lines · Hollis Blanchard
# HG changeset patch
# User Hollis Blanchard <[email protected]> # Date 1155683306 18000
# Node ID2250d38aed3854c626bdc642a91884754f9d12d8# Parent6dcd85ea232e0de5445f325abd0829a0ed6d56a1[POWERPC] fixvga.ccompilation
- replace vga_readb/writeb with plain readb/writeb
- add per-archvga.candvga.h
- makedetect_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
---
xen/arch/ia64/xen/domain.c +16 -1
@@ -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;
xen/arch/ia64/xen/vga.c +2 -2
@@ -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 ); }
xen/drivers/video/vga.c +3 -1
@@ -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 ; ) {
xen/include/asm-ia64/vga.h +0 -6
@@ -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_ */
linux-2.6-xen-sparse/arch/ia64/dig/setup.c new file +110 -0
110 lines not on this page · raw message
Quoted 3 lines · Hollis Blanchard
diff -r
6dcd85ea232e-r2250d38aed38xen/arch/powerpc/vga.cxen/arch/powerpc/vga.c Tue Aug 15 18:08:26 2006 -0500 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0
-0
...
xen/arch/powerpc/vga.c Tue Aug 15 18:08:26 2006 -0500
Quoted 8 lines
xen/arch/powerpc/vga.c Tue Aug 15 18:08:26 2006 -0500 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +8
-0+ +#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.)
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 6 lines · Hollis Blanchard
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
Quoted 9 lines · Keir Fraser
Quoted 6 lines
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/arch/ia64/Rules.mk +1 -0
@@ -2,6 +2,7 @@ # ia64-specific definitions HAS_ACPI := y +HAS_VGA := y VALIDATE_VT ?= n no_warns ?= n
xen/arch/ia64/xen/domain.c +16 -1
@@ -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;
xen/arch/ia64/xen/mm.c +5 -0
@@ -1746,6 +1746,11 @@ int get_page_type(struct page_info *pagereturn 1 ; } +int memory_is_conventional_ram (paddr_t p) +{ +return (efi_mem_type (p) ==EFI_CONVENTIONAL_MEMORY ); +} +/* * Local variables: * mode: C
xen/arch/powerpc/Makefile +1 -0
@@ -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
xen/arch/x86/Rules.mk +1 -0
@@ -2,6 +2,7 @@ # x86-specific definitions HAS_ACPI := y +HAS_VGA := y # # If you change any of these configuration options then you must
xen/arch/x86/mm.c +15 -0
@@ -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) {
xen/drivers/Makefile +1 -1
@@ -1,3 +1,3 @@ subdir-y += char subdir-y += char subdir-$(HAS_ACPI) += acpi -subdir-y += video +subdir-$(HAS_VGA) += video
xen/drivers/video/vga.c +39 -16
105 lines not on this page · raw message
xen/include/asm-x86/io.h +1 -0
@@ -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))
xen/include/xen/mm.h +3 -0
@@ -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__ */
linux-2.6-xen-sparse/arch/ia64/dig/setup.c new file +110 -0
110 lines not on this page · raw message
xen/arch/powerpc/vga.c new file +21 -0
@@ -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;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Keir Fraser
Here you go.
Arch/powerpc/vga.cisn'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
Quoted 19 lines
xen/drivers/video/vga.c +19
-0+ + 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 ; +
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.
Quoted 4 lines · Alex Williamson
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
Quoted 8 lines
response (the bus goes fatal and a reboot follows). On my system, the
0xB8000test looks like it will probably work, but we never get there because either the0xA0000or the0xB0000test 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
Quoted 3 lines · Keir Fraser
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 probe0xb8000?
Hi Keir,
Yeah, I think something like the below change to your previous patch
would be fine. Thanks!
Alex
---
xen/drivers/video/vga.c +10 -42
@@ -321,45 +321,6 @@ static int detect_video(void *video_basereturn 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/drivers/video/vga.c line 164
Quoted 12 lines · Keir Fraser
xen/drivers/video/vga.c +2
-6@@ -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?
Quoted 15 lines
diff -r
ec03b24a2d83xen/arch/powerpc/vga.cxen/arch/powerpc/vga.c Wed Aug 16 11:44:31 2006 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +11
-0@@ -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; +} +
xen/arch/powerpc/vga.c Wed Aug 16 11:44:31 2006 +0100 line 21
Quoted 10 lines
xen/arch/powerpc/vga.c Wed Aug 16 11:44:31 2006 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +10
-0+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.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 5 lines · Hollis Blanchard
Quoted 4 lines · Keir Fraser
xen/drivers/video/vga.c +0
-0@@ -159,12 +160,8 @@* into a single 16-bit quantity */ #define VGA_OUT16VAL (v, r) (((v) << 8) | (r))
Quoted 10 lines
xen/drivers/video/vga.c line 164
Quoted 8 lines
xen/drivers/video/vga.c +2
-6-#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.
Quoted 9 lines
xen/arch/powerpc/vga.c line 21
Quoted 1 line
xen/arch/powerpc/vga.c new file +1
-0+const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16;I think there could be a cleaner separation between
console.candvga.c, and that would avoid needing to redefine these symbols. For example, right nowcls(),init_vga(), and others still live inconsole.c, most of them manually testingvgacon_enabled.What would be better is a system where console drivers (i.e. serial and vga) register themselves at boot time, so
console.cputchar()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
Quoted 19 lines · Keir Fraser
Quoted 5 lines · Hollis Blanchard
Quoted 4 lines · Keir Fraser
xen/drivers/video/vga.c +0
-0@@ -159,12 +160,8 @@* into a single 16-bit quantity */ #define VGA_OUT16VAL (v, r) (((v) << 8) | (r))Quoted 10 lines
xen/drivers/video/vga.c line 164
Quoted 8 lines
xen/drivers/video/vga.c +2
-6-#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?
Quoted 1 line
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?
Quoted 7 lines
Quoted 7 lines
xen/arch/powerpc/vga.c line 21
Quoted 1 line
xen/arch/powerpc/vga.c new file +1
-0+const struct font_desc font_vga_8x8, font_vga_8x14, font_vga_8x16;I think there could be a cleaner separation between
console.candvga.c, and that would avoid needing to redefine these symbols. For example, right nowcls(),init_vga(), and others still live inconsole.c, most of them manually testingvgacon_enabled.
Quoted 6 lines
Quoted 2 lines
What would be better is a system where console drivers (i.e. serial and vga) register themselves at boot time, so
console.cputchar()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...
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center