Finally we now have a set of common video routines in video_common.c with per bus initialisers for SBus and PCI. Hence we can remove the now obsolete init_video() function.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/openbios.c | 1 - openbios-devel/drivers/vga_vbe.c | 13 +++++++-- openbios-devel/include/libopenbios/video.h | 3 -- openbios-devel/libopenbios/video_common.c | 41 +++------------------------- 4 files changed, 15 insertions(+), 43 deletions(-)
diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c index 84dd3f6..0437b9c 100644 --- a/openbios-devel/arch/sparc32/openbios.c +++ b/openbios-devel/arch/sparc32/openbios.c @@ -876,7 +876,6 @@ arch_init( void ) #ifdef CONFIG_DRIVER_SBUS #ifdef CONFIG_DEBUG_CONSOLE_VIDEO setup_video(hwdef->tcx_base + 0x00800000ULL, (unsigned long)vmem); - init_video(); #endif ob_sbus_init(hwdef->iommu_base + 0x1000ULL, qemu_machine_type); #endif diff --git a/openbios-devel/drivers/vga_vbe.c b/openbios-devel/drivers/vga_vbe.c index 33765b6..75b232e 100644 --- a/openbios-devel/drivers/vga_vbe.c +++ b/openbios-devel/drivers/vga_vbe.c @@ -27,6 +27,7 @@ #include "drivers/vga.h" #include "libopenbios/video.h" #include "libopenbios/ofmem.h" +#include "packages/video.h"
/* VGA init. We use the Bochs VESA VBE extensions */ #define VBE_DISPI_INDEX_ID 0x0 @@ -125,6 +126,7 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, phys_addr_t phys; phandle_t ph, chosen, aliases, options; char buf[6]; + int size;
phys = fb;
@@ -152,6 +154,8 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, set_int_property(ph, "linebytes", VIDEO_DICT_VALUE(video.rb)); set_int_property(ph, "address", (u32)(fb & ~0x0000000F));
+ molvideo_init(); + chosen = find_dev("/chosen"); push_str(path); fword("open-dev"); @@ -168,7 +172,6 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size,
if (rom_size >= 8) { const char *p; - int size;
p = (const char *)rom; if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') { @@ -178,5 +181,11 @@ void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size, } }
- init_video(); +#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI) + size = ((VIDEO_DICT_VALUE(video.h) * VIDEO_DICT_VALUE(video.rb)) + 0xfff) & ~0xfff; + + ofmem_claim_phys( video.mphys, size, 0 ); + ofmem_claim_virt( VIDEO_DICT_VALUE(video.mvirt), size, 0 ); + ofmem_map( video.mphys, VIDEO_DICT_VALUE(video.mvirt), size, ofmem_arch_io_translation_mode(video.mphys) ); +#endif } diff --git a/openbios-devel/include/libopenbios/video.h b/openbios-devel/include/libopenbios/video.h index cf2b5db..5e9abb7 100644 --- a/openbios-devel/include/libopenbios/video.h +++ b/openbios-devel/include/libopenbios/video.h @@ -20,7 +20,6 @@ #define VGA_DEFAULT_LINEBYTES (VGA_DEFAULT_WIDTH*((VGA_DEFAULT_DEPTH+7)/8))
void setup_video(phys_addr_t phys, ucell virt); -void init_video(void); unsigned long video_get_color(int col_ind); void video_set_color(int ind, unsigned long color); void video_mask_blit(void); @@ -28,8 +27,6 @@ void video_invert_rect(void); void video_fill_rect(void);
extern struct video_info { - int has_video; - volatile ihandle_t *ih; volatile phys_addr_t mphys; volatile ucell *mvirt; diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c index 83270a0..748742f 100644 --- a/openbios-devel/libopenbios/video_common.c +++ b/openbios-devel/libopenbios/video_common.c @@ -31,7 +31,7 @@ unsigned long video_get_color( int col_ind ) { unsigned long col; - if( !video.has_video || col_ind < 0 || col_ind > 255 ) + if( !VIDEO_DICT_VALUE(video.ih) || col_ind < 0 || col_ind > 255 ) return 0; if( VIDEO_DICT_VALUE(video.depth) == 8 ) return col_ind; @@ -48,7 +48,7 @@ video_set_color( int ind, unsigned long color ) { xt_t hw_xt = 0;
- if( !video.has_video || ind < 0 || ind > 255 ) + if( !VIDEO_DICT_VALUE(video.ih) || ind < 0 || ind > 255 ) return; video.pal[ind] = color;
@@ -138,7 +138,7 @@ video_invert_rect( void ) bgcolor = video_get_color(bgcolor); fgcolor = video_get_color(fgcolor);
- if (!video.has_video || x < 0 || y < 0 || w <= 0 || h <= 0 || + if (!VIDEO_DICT_VALUE(video.ih) || x < 0 || y < 0 || w <= 0 || h <= 0 || x + w > VIDEO_DICT_VALUE(video.w) || y + h > VIDEO_DICT_VALUE(video.h)) return;
@@ -190,7 +190,7 @@ video_fill_rect(void) char *pp; unsigned long col = video_get_color(col_ind);
- if (!video.has_video || x < 0 || y < 0 || w <= 0 || h <= 0 || + if (!VIDEO_DICT_VALUE(video.ih) || x < 0 || y < 0 || w <= 0 || h <= 0 || x + w > VIDEO_DICT_VALUE(video.w) || y + h > VIDEO_DICT_VALUE(video.h)) return;
@@ -279,36 +279,3 @@ void setup_video(phys_addr_t phys, ucell virt) } #endif } - -void -init_video(void) -{ -#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI) - int size; -#endif - phandle_t ph=0, saved_ph=0; - - saved_ph = get_cur_dev(); - while( (ph=dt_iterate_type(ph, "display")) ) { - video.has_video = 1; - - set_int_property( ph, "width", VIDEO_DICT_VALUE(video.w) ); - set_int_property( ph, "height", VIDEO_DICT_VALUE(video.h) ); - set_int_property( ph, "depth", VIDEO_DICT_VALUE(video.depth) ); - set_int_property( ph, "linebytes", VIDEO_DICT_VALUE(video.rb) ); - set_int_property( ph, "address", VIDEO_DICT_VALUE(video.mvirt) ); - - activate_dev(ph); - - molvideo_init(); - } - activate_dev(saved_ph); - -#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI) - size = ((VIDEO_DICT_VALUE(video.h) * VIDEO_DICT_VALUE(video.rb)) + 0xfff) & ~0xfff; - - ofmem_claim_phys( video.mphys, size, 0 ); - ofmem_claim_virt( VIDEO_DICT_VALUE(video.mvirt), size, 0 ); - ofmem_map( video.mphys, VIDEO_DICT_VALUE(video.mvirt), size, ofmem_arch_io_translation_mode(video.mphys) ); -#endif -}