mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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:
@@ -138,20 +138,6 @@ typedef struct osi_fb_info {
|
||||
#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
|
||||
* ****************************************************************** */
|
||||
|
||||
@@ -141,7 +141,7 @@ static void serial_cls(void)
|
||||
#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 @@ typedef struct osi_fb_info {
|
||||
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"
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ arch_init( void )
|
||||
#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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -51,7 +51,7 @@ arch_init( void )
|
||||
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();
|
||||
|
||||
@@ -19,19 +19,6 @@ typedef struct osi_fb_info {
|
||||
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"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void kbd_init(uint64_t base);
|
||||
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
|
||||
|
||||
@@ -150,24 +150,10 @@ rec_char( int ch, int x, int y )
|
||||
static void
|
||||
scroll1( void )
|
||||
{
|
||||
osi_fb_info_t fb;
|
||||
int i, x, offs, size, *dest, *src;
|
||||
int x;
|
||||
|
||||
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++ )
|
||||
cons.buf[(cons.h-1)*cons.w + x] = 0;
|
||||
draw_line(cons.h-1);
|
||||
|
||||
@@ -184,6 +184,25 @@ set_color( int ind, ulong color )
|
||||
#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 @@ NODE_METHODS( video ) = {
|
||||
/************************************************************************/
|
||||
|
||||
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 );
|
||||
|
||||
Reference in New Issue
Block a user