[OpenBIOS] [commit] r1144 - in trunk/openbios-devel: drivers forth/device libopenbios packages
repository service
svn at openbios.org
Sun Jun 9 14:25:12 CEST 2013
Author: mcayland
Date: Sun Jun 9 14:25:11 2013
New Revision: 1144
URL: http://tracker.coreboot.org/trac/openbios/changeset/1144
Log:
video: Create tcx.fs and vga.fs to simulate Fcode video initialisation code.
The IEEE1275 is-install routine needs to call a basic initialisation routine for
each driver as typically supplied as an Fcode ROM. Provide a suitable set of
basic initialisers for a QEMU host.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Added:
trunk/openbios-devel/drivers/tcx.fs
trunk/openbios-devel/drivers/vga.fs
Modified:
trunk/openbios-devel/drivers/build.xml
trunk/openbios-devel/forth/device/display.fs
trunk/openbios-devel/libopenbios/video_common.c
trunk/openbios-devel/packages/video.c
Modified: trunk/openbios-devel/drivers/build.xml
==============================================================================
--- trunk/openbios-devel/drivers/build.xml Sun Jun 9 14:25:08 2013 (r1143)
+++ trunk/openbios-devel/drivers/build.xml Sun Jun 9 14:25:11 2013 (r1144)
@@ -29,6 +29,8 @@
<object source="pci.fs" condition="DRIVER_PCI"/>
<object source="sbus.fs" condition="DRIVER_SBUS"/>
<object source="esp.fs" condition="DRIVER_ESP"/>
+ <object source="tcx.fs" condition="DRIVER_SBUS"/>
+ <object source="vga.fs" condition="DRIVER_VGA"/>
</dictionary>
</build>
Added: trunk/openbios-devel/drivers/tcx.fs
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/drivers/tcx.fs Sun Jun 9 14:25:11 2013 (r1144)
@@ -0,0 +1,13 @@
+\
+\ Fcode payload for QEMU TCX graphics card
+\
+\ This is the Forth source for an Fcode payload to initialise
+\ the QEMU TCX graphics card.
+\
+
+: qemu-tcx-driver-init ( -- )
+ qemu-video-addr to frame-buffer-adr
+ default-font set-font
+ qemu-video-width qemu-video-height over char-width / over char-height /
+ fb8-install
+;
Added: trunk/openbios-devel/drivers/vga.fs
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/drivers/vga.fs Sun Jun 9 14:25:11 2013 (r1144)
@@ -0,0 +1,13 @@
+\
+\ Fcode payload for QEMU VGA graphics card
+\
+\ This is the Forth source for an Fcode payload to initialise
+\ the QEMU VGA graphics card.
+\
+
+: qemu-vga-driver-init ( -- )
+ qemu-video-addr to frame-buffer-adr
+ default-font set-font
+ qemu-video-width qemu-video-height over char-width / over char-height /
+ fb8-install
+;
Modified: trunk/openbios-devel/forth/device/display.fs
==============================================================================
--- trunk/openbios-devel/forth/device/display.fs Sun Jun 9 14:25:08 2013 (r1143)
+++ trunk/openbios-devel/forth/device/display.fs Sun Jun 9 14:25:11 2013 (r1144)
@@ -44,6 +44,10 @@
0 value foreground-color
0 value background-color
+\ internal values read from QEMU firmware interface
+0 value qemu-video-addr
+0 value qemu-video-height
+0 value qemu-video-width
\ The following wordset is called the "defer word interface" of the
\ terminal-emulator support package. It gets overloaded by fb1-install
@@ -102,6 +106,8 @@
s" open" header
1 , \ colon definition
,
+ ['] (lit) ,
+ -1 ,
['] (semis) ,
reveal
s" : write dup >r bounds do i c@ fb-emit loop r> ; " evaluate
@@ -242,6 +248,10 @@
false to inverse-screen?
0 to foreground-color
d# 15 to background-color
+
+ \ override with OpenBIOS defaults
+ fe to background-color
+ 0 to foreground-color
;
: fb8-toggle-cursor ( -- )
@@ -363,4 +373,9 @@
then
to foreground-color to background-color
+ \ ... but let's override with some better defaults
+ fe to background-color
+ 0 to foreground-color
+
+ fb8-erase-screen
;
Modified: trunk/openbios-devel/libopenbios/video_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/video_common.c Sun Jun 9 14:25:08 2013 (r1143)
+++ trunk/openbios-devel/libopenbios/video_common.c Sun Jun 9 14:25:11 2013 (r1144)
@@ -16,6 +16,8 @@
#include "config.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
+#include "libopenbios/fontdata.h"
#include "libopenbios/ofmem.h"
#include "libopenbios/video.h"
#include "packages/video.h"
@@ -212,6 +214,26 @@
#endif
}
+static void
+video_open(void)
+{
+ PUSH(-1);
+}
+
+/* ( addr len -- actual ) */
+static void
+video_write(void)
+{
+ char *addr;
+ int len;
+
+ len = POP();
+ addr = (char *)cell2pointer(POP());
+
+ console_draw_fstr(addr, len);
+ PUSH(len);
+}
+
void
init_video( unsigned long fb, int width, int height, int depth, int rb )
{
@@ -242,6 +264,15 @@
set_int_property( ph, "address", video.fb.mvirt );
activate_dev(ph);
+
+ if (!find_package_method("open", ph)) {
+ bind_func("open", video_open);
+ }
+
+ if (!find_package_method("write", ph)) {
+ bind_func("write", video_write);
+ }
+
molvideo_init();
}
video.has_video = 1;
@@ -251,6 +282,20 @@
PUSH(video.fb.mvirt);
feval("to frame-buffer-adr");
+ /* Set global variables ready for fb8-install */
+ PUSH((ucell)fontdata);
+ feval("to (romfont)");
+ PUSH(FONT_HEIGHT);
+ feval("to (romfont-height)");
+ PUSH(FONT_WIDTH);
+ feval("to (romfont-width)");
+ PUSH(video.fb.mvirt);
+ feval("to qemu-video-addr");
+ PUSH(video.fb.w);
+ feval("to qemu-video-width");
+ PUSH(video.fb.h);
+ feval("to qemu-video-height");
+
#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI)
size = ((video.fb.h * video.fb.rb) + 0xfff) & ~0xfff;
Modified: trunk/openbios-devel/packages/video.c
==============================================================================
--- trunk/openbios-devel/packages/video.c Sun Jun 9 14:25:08 2013 (r1143)
+++ trunk/openbios-devel/packages/video.c Sun Jun 9 14:25:11 2013 (r1144)
@@ -84,26 +84,11 @@
fill_rect( color_ind, x, y, w, h );
}
-/* ( addr len -- actual ) */
-static void
-video_write(void)
-{
- char *addr;
- int len;
-
- len = POP();
- addr = (char *)cell2pointer(POP());
-
- console_draw_fstr(addr, len);
- PUSH(len);
-}
-
NODE_METHODS( video ) = {
{"dimensions", video_dimensions },
{"set-colors", video_set_colors },
{"fill-rectangle", video_fill_rect },
{"color!", video_color_bang },
- {"write", video_write },
};
More information about the OpenBIOS
mailing list