Author: blueswirl Date: 2008-12-05 19:31:27 +0100 (Fri, 05 Dec 2008) New Revision: 281
Modified: openbios-devel/arch/ppc/qemu/console.c openbios-devel/arch/sparc32/console.c openbios-devel/arch/sparc32/openbios.c openbios-devel/arch/sparc32/openbios.h openbios-devel/arch/x86/openbios.c openbios-devel/arch/x86/xbox/console.c openbios-devel/include/openbios/drivers.h openbios-devel/modules/console.c openbios-devel/modules/video.c Log: Initialize VGA from PCI configuration (Laurent Vivier)
Modified: openbios-devel/arch/ppc/qemu/console.c =================================================================== --- openbios-devel/arch/ppc/qemu/console.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/ppc/qemu/console.c 2008-12-05 18:31:27 UTC (rev 281) @@ -138,20 +138,6 @@ #include "../../../modules/video.c" #include "../../../modules/console.c"
-static uint32_t vga_phys_mem; -static int vga_width, vga_height, vga_depth; - -int Qemu_GetFBInfo( osi_fb_info_t *fb ) -{ - fb->mphys = vga_phys_mem; - fb->w = vga_width; - fb->h = vga_height; - fb->depth = vga_depth; - fb->rb = fb->w * ((fb->depth + 7) / 8); - - return 0; -} - /* ****************************************************************** * common functions, implementing simple concurrent console * ****************************************************************** */
Modified: openbios-devel/arch/sparc32/console.c =================================================================== --- openbios-devel/arch/sparc32/console.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/sparc32/console.c 2008-12-05 18:31:27 UTC (rev 281) @@ -141,7 +141,7 @@ #define DAC_BASE 0x00200000ULL #define DAC_SIZE 16
-static unsigned char *vmem; +unsigned char *vmem; static volatile uint32_t *dac;
typedef struct osi_fb_info { @@ -149,19 +149,6 @@ int rb, w, h, depth; } osi_fb_info_t;
-static int TCX_GetFBInfo( osi_fb_info_t *fb ) -{ - fb->w = 1024; - fb->h = 768; - fb->depth = 8; - fb->rb = 1024; - fb->mphys = (unsigned long)vmem; - - return 0; -} - -#define openbios_GetFBInfo(x) TCX_GetFBInfo(x) - #include "../../modules/video.c" #include "../../modules/console.c"
Modified: openbios-devel/arch/sparc32/openbios.c =================================================================== --- openbios-devel/arch/sparc32/openbios.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/sparc32/openbios.c 2008-12-05 18:31:27 UTC (rev 281) @@ -122,7 +122,7 @@ #endif #ifdef CONFIG_DRIVER_SBUS #ifdef CONFIG_DEBUG_CONSOLE_VIDEO - init_video(); + init_video((unsigned long)vmem, 1024, 768, 8, 1024); #endif ob_sbus_init(hwdef->iommu_base + 0x1000ULL, qemu_machine_type); #endif
Modified: openbios-devel/arch/sparc32/openbios.h =================================================================== --- openbios-devel/arch/sparc32/openbios.h 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/sparc32/openbios.h 2008-12-05 18:31:27 UTC (rev 281) @@ -20,6 +20,7 @@ int openbios(void);
/* console.c */ +extern unsigned char *vmem; extern void cls(void); #ifdef CONFIG_DEBUG_CONSOLE extern int uart_init(uint64_t port, unsigned long speed);
Modified: openbios-devel/arch/x86/openbios.c =================================================================== --- openbios-devel/arch/x86/openbios.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/x86/openbios.c 2008-12-05 18:31:27 UTC (rev 281) @@ -51,7 +51,7 @@ ob_floppy_init(); #endif #ifdef CONFIG_XBOX - init_video(); + init_video(phys_to_virt(0x3C00000), 640, 480, 32, 2560); node_methods_init(); #endif device_end();
Modified: openbios-devel/arch/x86/xbox/console.c =================================================================== --- openbios-devel/arch/x86/xbox/console.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/arch/x86/xbox/console.c 2008-12-05 18:31:27 UTC (rev 281) @@ -19,19 +19,6 @@ int rb, w, h, depth; } osi_fb_info_t;
-int Xbox_GetFBInfo (osi_fb_info_t *fb) -{ - fb->w = 640; - fb->h = 480; - fb->depth = 32; - fb->rb = fb->w * 4; /* rgb + alpha */ - fb->mphys = phys_to_virt(0x3C00000); /* 60M - 64M */ - - return 0; -} - -#define openbios_GetFBInfo(x) Xbox_GetFBInfo(x) - #include "../../../modules/video.c" #include "../../../modules/console.c"
Modified: openbios-devel/include/openbios/drivers.h =================================================================== --- openbios-devel/include/openbios/drivers.h 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/include/openbios/drivers.h 2008-12-05 18:31:27 UTC (rev 281) @@ -22,7 +22,7 @@ int keyboard_dataready(void); unsigned char keyboard_readdata(void); #ifdef CONFIG_DEBUG_CONSOLE_VIDEO -void init_video(void); +void init_video(unsigned long fb, int width, int height, int depth, int rb); #endif #endif #ifdef CONFIG_DRIVER_IDE
Modified: openbios-devel/modules/console.c =================================================================== --- openbios-devel/modules/console.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/modules/console.c 2008-12-05 18:31:27 UTC (rev 281) @@ -150,24 +150,10 @@ static void scroll1( void ) { - osi_fb_info_t fb; - int i, x, offs, size, *dest, *src; - - openbios_GetFBInfo( &fb ); + int x;
- offs = fb.rb * FONT_ADJ_HEIGHT; - size = (fb.h * fb.rb - offs)/16; - dest = (int*)fb.mphys; - src = (int*)(fb.mphys + offs); + video_scroll( FONT_ADJ_HEIGHT );
- for( i=0; i<size; i++ ) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += 4; - src += 4; - } for( x=0; x<cons.w; x++ ) cons.buf[(cons.h-1)*cons.w + x] = 0; draw_line(cons.h-1);
Modified: openbios-devel/modules/video.c =================================================================== --- openbios-devel/modules/video.c 2008-12-04 20:14:23 UTC (rev 280) +++ openbios-devel/modules/video.c 2008-12-05 18:31:27 UTC (rev 281) @@ -184,7 +184,26 @@ #endif }
+void +video_scroll( int height ) +{ + int i, offs, size, *dest, *src;
+ offs = video.fb.rb * height; + size = (video.fb.h * video.fb.rb - offs)/16; + dest = (int*)video.fb.mphys; + src = (int*)(video.fb.mphys + offs); + + for( i=0; i<size; i++ ) { + dest[0] = src[0]; + dest[1] = src[1]; + dest[2] = src[2]; + dest[3] = src[3]; + dest += 4; + src += 4; + } +} + /************************************************************************/ /* OF methods */ /************************************************************************/ @@ -280,15 +299,16 @@ /************************************************************************/
void -init_video( void ) +init_video( unsigned long fb, int width, int height, int depth, int rb ) { int i, s, size; phandle_t ph=0; - - if( openbios_GetFBInfo(&video.fb) ) { - printk("init_video: No video display\n"); - return; - } + + video.fb.mphys = fb; + video.fb.w = width; + video.fb.h = height; + video.fb.depth = depth; + video.fb.rb = rb; while( (ph=dt_iterate_type(ph, "display")) ) { set_property( ph, "width", (char*)&video.fb.w, 4 ); set_property( ph, "height", (char*)&video.fb.h, 4 ); @@ -308,7 +328,7 @@ ofmem_claim_virt( video.fb.mphys, size, 0 ); ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 ); #endif - + for( i=0; i<256; i++ ) set_color( i, i * 0x010101 );