Initialize VGA from PCI configuration (Laurent Vivier)

git-svn-id: svn://coreboot.org/openbios/openbios-devel@281 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-12-05 18:31:27 +00:00
parent ce3424579b
commit e338f06ba1
9 changed files with 34 additions and 67 deletions

View File

@@ -138,20 +138,6 @@ typedef struct osi_fb_info {
#include "../../../modules/video.c" #include "../../../modules/video.c"
#include "../../../modules/console.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 * common functions, implementing simple concurrent console
* ****************************************************************** */ * ****************************************************************** */

View File

@@ -141,7 +141,7 @@ static void serial_cls(void)
#define DAC_BASE 0x00200000ULL #define DAC_BASE 0x00200000ULL
#define DAC_SIZE 16 #define DAC_SIZE 16
static unsigned char *vmem; unsigned char *vmem;
static volatile uint32_t *dac; static volatile uint32_t *dac;
typedef struct osi_fb_info { typedef struct osi_fb_info {
@@ -149,19 +149,6 @@ typedef struct osi_fb_info {
int rb, w, h, depth; int rb, w, h, depth;
} osi_fb_info_t; } 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/video.c"
#include "../../modules/console.c" #include "../../modules/console.c"

View File

@@ -122,7 +122,7 @@ arch_init( void )
#endif #endif
#ifdef CONFIG_DRIVER_SBUS #ifdef CONFIG_DRIVER_SBUS
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
init_video(); init_video((unsigned long)vmem, 1024, 768, 8, 1024);
#endif #endif
ob_sbus_init(hwdef->iommu_base + 0x1000ULL, qemu_machine_type); ob_sbus_init(hwdef->iommu_base + 0x1000ULL, qemu_machine_type);
#endif #endif

View File

@@ -20,6 +20,7 @@
int openbios(void); int openbios(void);
/* console.c */ /* console.c */
extern unsigned char *vmem;
extern void cls(void); extern void cls(void);
#ifdef CONFIG_DEBUG_CONSOLE #ifdef CONFIG_DEBUG_CONSOLE
extern int uart_init(uint64_t port, unsigned long speed); extern int uart_init(uint64_t port, unsigned long speed);

View File

@@ -51,7 +51,7 @@ arch_init( void )
ob_floppy_init(); ob_floppy_init();
#endif #endif
#ifdef CONFIG_XBOX #ifdef CONFIG_XBOX
init_video(); init_video(phys_to_virt(0x3C00000), 640, 480, 32, 2560);
node_methods_init(); node_methods_init();
#endif #endif
device_end(); device_end();

View File

@@ -19,19 +19,6 @@ typedef struct osi_fb_info {
int rb, w, h, depth; int rb, w, h, depth;
} osi_fb_info_t; } 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/video.c"
#include "../../../modules/console.c" #include "../../../modules/console.c"

View File

@@ -22,7 +22,7 @@ void kbd_init(uint64_t base);
int keyboard_dataready(void); int keyboard_dataready(void);
unsigned char keyboard_readdata(void); unsigned char keyboard_readdata(void);
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO #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
#endif #endif
#ifdef CONFIG_DRIVER_IDE #ifdef CONFIG_DRIVER_IDE

View File

@@ -150,24 +150,10 @@ rec_char( int ch, int x, int y )
static void static void
scroll1( void ) scroll1( void )
{ {
osi_fb_info_t fb; int x;
int i, x, offs, size, *dest, *src;
openbios_GetFBInfo( &fb ); video_scroll( FONT_ADJ_HEIGHT );
offs = fb.rb * FONT_ADJ_HEIGHT;
size = (fb.h * fb.rb - offs)/16;
dest = (int*)fb.mphys;
src = (int*)(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;
}
for( x=0; x<cons.w; x++ ) for( x=0; x<cons.w; x++ )
cons.buf[(cons.h-1)*cons.w + x] = 0; cons.buf[(cons.h-1)*cons.w + x] = 0;
draw_line(cons.h-1); draw_line(cons.h-1);

View File

@@ -184,6 +184,25 @@ set_color( int ind, ulong color )
#endif #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 */ /* OF methods */
@@ -280,15 +299,16 @@ NODE_METHODS( video ) = {
/************************************************************************/ /************************************************************************/
void void
init_video( void ) init_video( unsigned long fb, int width, int height, int depth, int rb )
{ {
int i, s, size; int i, s, size;
phandle_t ph=0; phandle_t ph=0;
if( openbios_GetFBInfo(&video.fb) ) { video.fb.mphys = fb;
printk("init_video: No video display\n"); video.fb.w = width;
return; video.fb.h = height;
} video.fb.depth = depth;
video.fb.rb = rb;
while( (ph=dt_iterate_type(ph, "display")) ) { while( (ph=dt_iterate_type(ph, "display")) ) {
set_property( ph, "width", (char*)&video.fb.w, 4 ); set_property( ph, "width", (char*)&video.fb.w, 4 );
set_property( ph, "height", (char*)&video.fb.h, 4 ); set_property( ph, "height", (char*)&video.fb.h, 4 );