[OpenBIOS] [commit] r1206 - in trunk/openbios-devel: drivers forth/device packages

repository service svn at openbios.org
Mon Aug 19 09:40:05 CEST 2013


Author: mcayland
Date: Mon Aug 19 09:40:04 2013
New Revision: 1206
URL: http://tracker.coreboot.org/trac/openbios/changeset/1206

Log:
video: move all non MOL-specific code from molvideo.c to vga.fs

This now leaves just the MOL code in packages/molvideo.c and so now we no
longer have a mixture of MOL and non-MOL methods in this packages. As a
result of this, we can now conditionally build molvideo.c only if CONFIG_MOL
is defined.

(Note: I have no way of testing this as I gather that OpenBIOS was pulled from
MOL due to compatibility issues at some point in the past. Perhaps one day
someone will try and update and see what happens?)

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/drivers/pci.c
   trunk/openbios-devel/drivers/vga.fs
   trunk/openbios-devel/drivers/vga_vbe.c
   trunk/openbios-devel/forth/device/display.fs
   trunk/openbios-devel/packages/build.xml
   trunk/openbios-devel/packages/molvideo.c

Modified: trunk/openbios-devel/drivers/pci.c
==============================================================================
--- trunk/openbios-devel/drivers/pci.c	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/drivers/pci.c	Mon Aug 19 09:40:04 2013	(r1206)
@@ -24,6 +24,7 @@
 
 #include "drivers/drivers.h"
 #include "drivers/vga.h"
+#include "packages/video.h"
 #include "timer.h"
 #include "pci.h"
 #include "pci_database.h"
@@ -773,6 +774,12 @@
 
 	    /* Currently we don't read FCode from the hardware but execute it directly */
 	    feval("['] vga-driver-fcode 2 cells + 1 byte-load");
+
+#ifdef CONFIG_MOL
+	    /* Install special words for Mac On Linux */
+	    molvideo_init();
+#endif
+
         }
 
 	return 0;

Modified: trunk/openbios-devel/drivers/vga.fs
==============================================================================
--- trunk/openbios-devel/drivers/vga.fs	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/drivers/vga.fs	Mon Aug 19 09:40:04 2013	(r1206)
@@ -33,6 +33,9 @@
 : depth-bits depth-bits-xt @ ;
 : line-bytes line-bytes-xt @ ;
 
+" fb8-fillrect" (find-xt) value fb8-fillrect-xt
+: fb8-fillrect fb8-fillrect-xt execute ;
+
 \
 \ IO port words
 \
@@ -114,6 +117,9 @@
 defer mol-color!
 
 \ Hook for MOL (see packages/molvideo.c)
+\
+\ Perhaps for neatness this there should be a separate molvga.fs
+\ but let's leave it here for now.
 
 : hw-set-color  ( r g b index -- )
   mol-color!
@@ -129,6 +135,31 @@
 
 [THEN]
 
+: color!  ( r g b index -- )
+  hw-set-color
+;
+
+: fill-rectangle  ( color_ind x y width height -- )
+  fb8-fillrect
+;
+
+: dimensions  ( -- width height )
+  openbios-video-width
+  openbios-video-height
+;
+
+: set-colors  ( table start count -- )
+  0 do
+    over dup        \ ( table start table table )
+    c@ swap 1+      \ ( table start r table-g )
+    dup c@ swap 1+  \ ( table start r g table-b )
+    c@ 3 pick       \ ( table start r g b index )
+    hw-set-color    \ ( table start )
+    1+
+    swap 3 + swap   \ ( table+3 start+1 )
+  loop
+;
+
 headerless
 
 \

Modified: trunk/openbios-devel/drivers/vga_vbe.c
==============================================================================
--- trunk/openbios-devel/drivers/vga_vbe.c	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/drivers/vga_vbe.c	Mon Aug 19 09:40:04 2013	(r1206)
@@ -27,7 +27,6 @@
 #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
@@ -75,8 +74,6 @@
     ph = get_cur_dev();
 #endif
 
-	molvideo_init();
-
 	chosen = find_dev("/chosen");
 	push_str(path);
 	fword("open-dev");

Modified: trunk/openbios-devel/forth/device/display.fs
==============================================================================
--- trunk/openbios-devel/forth/device/display.fs	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/forth/device/display.fs	Mon Aug 19 09:40:04 2013	(r1206)
@@ -408,7 +408,7 @@
 
   \ If we have a startup splash then display it
   [IFDEF] CONFIG_MOL
-      startup-splash 2000 ms
+      mol-startup-splash 2000 ms
       fb8-erase-screen
   [THEN]
 ;

Modified: trunk/openbios-devel/packages/build.xml
==============================================================================
--- trunk/openbios-devel/packages/build.xml	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/packages/build.xml	Mon Aug 19 09:40:04 2013	(r1206)
@@ -11,7 +11,7 @@
   <object source="nvram.c"/>
   <object source="pc-parts.c" condition="PC_PARTS"/>
   <object source="sun-parts.c" condition="SUN_PARTS"/>
-  <object source="molvideo.c"/>
+  <object source="molvideo.c" condition="MOL"/>
   <object source="xcoff-loader.c" condition="LOADER_XCOFF"/>
  </library>
 

Modified: trunk/openbios-devel/packages/molvideo.c
==============================================================================
--- trunk/openbios-devel/packages/molvideo.c	Mon Aug 19 09:40:01 2013	(r1205)
+++ trunk/openbios-devel/packages/molvideo.c	Mon Aug 19 09:40:04 2013	(r1206)
@@ -2,7 +2,7 @@
  *   Creation Date: <2002/10/23 20:26:40 samuel>
  *   Time-stamp: <2004/01/07 19:39:15 samuel>
  *
- *	<video.c>
+ *	<molvideo.c>
  *
  *	Mac-on-Linux display node
  *
@@ -30,47 +30,6 @@
 
 DECLARE_NODE( video, 0, 0, "Tdisplay" );
 
-#ifdef CONFIG_MOL
-static void
-molvideo_refresh_palette( void )
-{
-
-	if( VIDEO_DICT_VALUE(video.depth) == 8 )
-		OSI_RefreshPalette();
-}
-
-static void
-molvideo_hw_set_color( void )
-{
-
-	if( VIDEO_DICT_VALUE(video.depth) == 8 )
-		OSI_SetColor( ind, color );
-}
-#endif
-
-/* ( -- width height ) (?) */
-static void
-molvideo_dimensions( void )
-{
-	fword("screen-width");
-	fword("screen-height");
-}
-
-/* ( table start count -- ) (?) */
-static void
-molvideo_set_colors( void )
-{
-	int count = POP();
-	int start = POP();
-	unsigned char *p = (unsigned char*)cell2pointer(POP());
-	int i;
-
-	for( i=0; i<count; i++, p+=3 ) {
-		unsigned long col = (p[0] << 16) | (p[1] << 8) | p[2];
-		video_set_color( i + start, col );
-	}
-}
-
 /* ( r g b index -- ) */
 static void
 molvideo_color_bang( void )
@@ -81,31 +40,26 @@
 	int r = POP();
 	unsigned long col = ((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | (b & 0xff);
 	/* printk("color!: %08lx %08lx %08lx %08lx\n", r, g, b, index ); */
-	video_set_color( index, col );
-}
 
-/* ( color_ind x y width height -- ) (?) */
-static void
-molvideo_fill_rect ( void )
-{
-	video_fill_rect();
+	if( VIDEO_DICT_VALUE(video.depth) == 8 ) {
+		OSI_SetColor( index, col );
+		OSI_RefreshPalette();
+	}
 }
 
 /* ( -- ) - really should be reworked as draw-logo */
 static void
 molvideo_startup_splash( void )
 {
-#ifdef CONFIG_MOL
 	int fd, s, i, y, x, dx, dy;
 	int width, height;
 	char *pp, *p;
 	char buf[64];
-#endif
 
 	/* only draw logo in 24-bit mode (for now) */
 	if( VIDEO_DICT_VALUE(video.depth) < 15 )
 		return;
-#ifdef CONFIG_MOL
+
 	for( i=0; i<2; i++ ) {
 		if( !BootHGetStrResInd("bootlogo", buf, sizeof(buf), 0, i) )
 			return;
@@ -141,23 +95,14 @@
 		}
 		free( p );
 	}
-#else
+
 	/* No bootlogo support yet on other platforms */
 	return;
-#endif
 }
 
 
 NODE_METHODS( video ) = {
-#ifdef CONFIG_MOL
-	{"hw-set-color",	molvideo_hw_set_color   },
-	{"hw-refresh-palette",	molvideo_refresh_palette},
-#endif
-	{"dimensions",		molvideo_dimensions	},
-	{"set-colors",		molvideo_set_colors	},
-	{"fill-rectangle",	molvideo_fill_rect	},
-	{"color!",		molvideo_color_bang	},
-	{"startup-splash",	molvideo_startup_splash },
+	{"mol-startup-splash",	molvideo_startup_splash },
 };
 
 
@@ -168,5 +113,12 @@
 void
 molvideo_init(void)
 {
+	xt_t color_bang;
+
 	REGISTER_NODE( video );
+
+	/* Bind the MOL graphic routines to the mol-color! defer */
+	color_bang = bind_noname_func(molvideo_color_bang);
+	PUSH(color_bang);
+	feval(" to mol-color!");
 }



More information about the OpenBIOS mailing list