Note: this patchset should be applied on top of my last display patchset here: http://www.openfirmware.info/pipermail/openbios/2013-June/007753.html.
At the moment the IEEE1275 initialisers for TCX/VGA are setup by calling is-install directly; in actual fact what we need to do is convert the drivers over to FCode and execute them during a bus probe.
This patchset switches the tcx.fs and vga.fs drivers over to FCode from Forth, includes the FCode binaries as part of the OpenBIOS image, and executes the drivers using byte-load during probe.
Currently both drivers are reasonably bare (with most of the work still being done in C), however it is a starting point for moving more functionality into the FCode drivers and makes it possible to implement a "probe-self" word in the near future.
This patch shouldn't alter any functionality, but the most significant change is that it does introduce "toke" from the OpenFirmware fcode-utils suite as a mandatory dependency for building OpenBIOS.
Mark Cave-Ayland (4): switch-arch: make the fcode-utils tokeniser "toke" mandatory for the build config: add new fcode tag and support for building Fcode into dictionaries SPARC32: switch TCX driver over to FCode x86/SPARC64/PPC/amd64: switch VGA driver over to FCode
openbios-devel/Makefile.target | 3 ++ openbios-devel/arch/amd64/build.xml | 1 + openbios-devel/arch/amd64/init.fs | 7 ++++ openbios-devel/arch/ppc/build.xml | 5 +++ openbios-devel/arch/ppc/ppc.fs | 11 ++++++ openbios-devel/arch/sparc32/build.xml | 1 + openbios-devel/arch/sparc32/init.fs | 6 +++ openbios-devel/arch/sparc32/tree.fs | 1 + openbios-devel/arch/sparc64/build.xml | 1 + openbios-devel/arch/sparc64/init.fs | 6 +++ openbios-devel/arch/sparc64/tree.fs | 2 + openbios-devel/arch/x86/build.xml | 1 + openbios-devel/arch/x86/init.fs | 8 ++++ openbios-devel/config/examples/amd64_config.xml | 1 + openbios-devel/config/scripts/switch-arch | 12 ++++++ openbios-devel/config/xml/dictionary.xsl | 40 ++++++++++++++++--- openbios-devel/config/xml/fcode.xsl | 48 +++++++++++++++++++++++ openbios-devel/config/xml/makefile.xsl | 2 + openbios-devel/config/xml/rules.xml | 3 ++ openbios-devel/drivers/build.xml | 5 ++- openbios-devel/drivers/pci.c | 3 +- openbios-devel/drivers/sbus.c | 5 ++- openbios-devel/drivers/tcx.fs | 35 ++++++++++++++++- openbios-devel/drivers/vga.fs | 35 ++++++++++++++++- 24 files changed, 230 insertions(+), 12 deletions(-) create mode 100644 openbios-devel/config/xml/fcode.xsl
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/config/scripts/switch-arch | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/openbios-devel/config/scripts/switch-arch b/openbios-devel/config/scripts/switch-arch index dccf5c0..44f2df4 100755 --- a/openbios-devel/config/scripts/switch-arch +++ b/openbios-devel/config/scripts/switch-arch @@ -117,6 +117,11 @@ config_set_boolean() echo "<option name="$option" type="boolean" value="true" />" }
+exists() +{ + type "$1" >/dev/null 2>&1 +} +
SRCDIR=`dirname "$0"`/../.. BUILDDIR=`pwd` @@ -132,6 +137,13 @@ VERSION=`head $SRCDIR/VERSION`
echo "Configuring OpenBIOS on $HOSTARCH for $*"
+if exists toke; then + : +else + echo "Unable to locate toke executable from the fcode-utils package - aborting" + exit 1 +fi + target_list="" for target in $*; do case $target in
Here we introduce a new <fcode> tag which will tokenise the specified source file into Fcode using the toke utility. Similarly add a new type attribute to the dictionary <object> tag which when set to "fcode" will add the fcode binary as a dependency for the specified target dictionary.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/Makefile.target | 3 ++ openbios-devel/config/xml/dictionary.xsl | 40 +++++++++++++++++++++---- openbios-devel/config/xml/fcode.xsl | 48 ++++++++++++++++++++++++++++++ openbios-devel/config/xml/makefile.xsl | 2 ++ openbios-devel/config/xml/rules.xml | 3 ++ 5 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 openbios-devel/config/xml/fcode.xsl
diff --git a/openbios-devel/Makefile.target b/openbios-devel/Makefile.target index 913fb13..a7363e6 100644 --- a/openbios-devel/Makefile.target +++ b/openbios-devel/Makefile.target @@ -35,6 +35,9 @@ CFLAGS+= -MMD -MP -MT $@ -MF '$(*D)/$(*F).d' INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include AS_FLAGS+= -g
+# FCode tokeniser +TOKE := toke + quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
VPATH_SUFFIXES = %.c %.h %.S %.fs diff --git a/openbios-devel/config/xml/dictionary.xsl b/openbios-devel/config/xml/dictionary.xsl index 664df0f..61f62d8 100644 --- a/openbios-devel/config/xml/dictionary.xsl +++ b/openbios-devel/config/xml/dictionary.xsl @@ -53,16 +53,23 @@ </xsl:variable>
<xsl:if test="$conditions=0"> - <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY:=$(</xsl:text> - <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY) </xsl:text>
- <xsl:value-of select="$path"/> - <xsl:value-of select="@source"/> - xsl:text </xsl:text> + <xsl:variable name="source"><xsl:value-of select="@source" /></xsl:variable> + + <!-- Handle just Forth source, not FCode --> + <xsl:if test="not(@target = 'fcode')"> + <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY:=$(</xsl:text> + <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY) </xsl:text> + + <xsl:value-of select="$path"/> + <xsl:value-of select="$source"/> + xsl:text </xsl:text> + </xsl:if> + </xsl:if> </xsl:for-each>
- xsl:text </xsl:text> + xsl:text </xsl:text>
<!-- Create targets for all dictionaries --> <xsl:for-each select="//dictionary"> @@ -92,6 +99,27 @@ <xsl:if test="$init!=''"> xsl:text $(ODIR)/</xsl:text><xsl:value-of select="$init"/>xsl:text.dict</xsl:text> </xsl:if> + + <!-- Check for Fcode dependency --> + <xsl:for-each select="object[@target = 'fcode']"> + + <xsl:variable name="conditions"> + xsl:text0</xsl:text> + <xsl:for-each select="(ancestor-or-self::*)[@condition!='']"> + <xsl:call-template name="resolve-condition"> + <xsl:with-param select="@condition" name="expression"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <xsl:if test="$conditions = 0"> + + xsl:text $(ODIR)/</xsl:text> + <xsl:value-of select="@source"/> + + </xsl:if> + </xsl:for-each> + xsl:text </xsl:text> <!-- rule --> xsl:text	$(call quiet-command,$(ODIR)/forthstrap</xsl:text> diff --git a/openbios-devel/config/xml/fcode.xsl b/openbios-devel/config/xml/fcode.xsl new file mode 100644 index 0000000..ccc7e6e --- /dev/null +++ b/openbios-devel/config/xml/fcode.xsl @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="ISO-8859-15" ?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <xsl:template match="/" mode="fcode"> + + xsl:text # # fcode rules # </xsl:text> + + <!-- Create linker targets for FCode roms --> + <xsl:for-each select="//fcode"> + <xsl:variable name="outer-conditions"> + xsl:text0</xsl:text> + <xsl:for-each select="(ancestor-or-self::*)[@condition!='']"> + <xsl:call-template name="resolve-condition"> + <xsl:with-param select="@condition" name="expression"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <xsl:if test="$outer-conditions = 0"> + <xsl:if test="(ancestor-or-self::*)"> + + <xsl:variable name="path"> + <xsl:for-each select="ancestor::build"> + <xsl:call-template name="get-dirname"> + <xsl:with-param select="@base" name="path"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <!-- Fcode name --> + xsl:text$(ODIR)/</xsl:text> + <xsl:value-of select="@name"/> + xsl:text:</xsl:text> + + xsl:text $(SRCDIR)/</xsl:text> + <xsl:value-of select="$path"/> + <xsl:value-of select="@source"/> + + <!-- FIXME this requires strict spaces in rules.xml --> + <xsl:value-of select="document('rules.xml',.)//rule[@target='host'][@entity='fcode']"/> + xsl:text </xsl:text> + </xsl:if> + </xsl:if> + </xsl:for-each> + + </xsl:template> +</xsl:stylesheet> diff --git a/openbios-devel/config/xml/makefile.xsl b/openbios-devel/config/xml/makefile.xsl index 8589274..56c494c 100644 --- a/openbios-devel/config/xml/makefile.xsl +++ b/openbios-devel/config/xml/makefile.xsl @@ -5,10 +5,12 @@ <xsl:include href="util.xsl"/> <xsl:include href="dictionary.xsl"/> <xsl:include href="object.xsl"/> + <xsl:include href="fcode.xsl"/>
<xsl:template match="/"> <xsl:value-of select="document('rules.xml',.)/rules/pre"/> <xsl:apply-templates select="." mode="dictionaries"/> + <xsl:apply-templates select="." mode="fcode"/> <xsl:apply-templates select="." mode="objects"/> </xsl:template>
diff --git a/openbios-devel/config/xml/rules.xml b/openbios-devel/config/xml/rules.xml index 86a3b6b..29a720a 100644 --- a/openbios-devel/config/xml/rules.xml +++ b/openbios-devel/config/xml/rules.xml @@ -13,6 +13,9 @@ <rule target="host" entity="library"> $(call quiet--command,$(AR) cru $@ $^; $(RANLIB) $@," HOSTAR $(TARGET_DIR)$@") </rule> +<rule target="host" entity="fcode"> + $(call quiet-command,$(TOKE) -o $@ $^," TOKE $(TARGET_DIR)$@") +</rule>
<!-- target/cross compiler build rules --> <rule target="target" entity="executable">
Currently we cannot read the FCode from the card, so for the moment simply execute the bytecode directly.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/build.xml | 1 + openbios-devel/arch/sparc32/init.fs | 6 ++++++ openbios-devel/arch/sparc32/tree.fs | 1 + openbios-devel/drivers/build.xml | 3 ++- openbios-devel/drivers/sbus.c | 5 ++++- openbios-devel/drivers/tcx.fs | 35 ++++++++++++++++++++++++++++++++- 6 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/sparc32/build.xml b/openbios-devel/arch/sparc32/build.xml index 47ad01a..035c25c 100644 --- a/openbios-devel/arch/sparc32/build.xml +++ b/openbios-devel/arch/sparc32/build.xml @@ -3,6 +3,7 @@ <dictionary name="openbios-sparc32" init="openbios"> <object source="tree.fs" target="forth"/> <object source="init.fs" target="forth"/> + <object source="QEMU,tcx.bin" target="fcode" condition="DRIVER_SBUS"/> </dictionary>
<library name="sparc32" type="static" target="target"> diff --git a/openbios-devel/arch/sparc32/init.fs b/openbios-devel/arch/sparc32/init.fs index 26ffa05..e2cd571 100644 --- a/openbios-devel/arch/sparc32/init.fs +++ b/openbios-devel/arch/sparc32/init.fs @@ -45,3 +45,9 @@ device-end : obmem ( -- space ) 0 ; + +\ Load TCX FCode driver blob +[IFDEF] CONFIG_DRIVER_SBUS + -1 value tcx-driver-fcode + " QEMU,tcx.bin" $encode-file to tcx-driver-fcode +[THEN] diff --git a/openbios-devel/arch/sparc32/tree.fs b/openbios-devel/arch/sparc32/tree.fs index f9a0406..0f31f4f 100644 --- a/openbios-devel/arch/sparc32/tree.fs +++ b/openbios-devel/arch/sparc32/tree.fs @@ -1,3 +1,4 @@ +include config.fs
" /" find-device 2 encode-int " #address-cells" property diff --git a/openbios-devel/drivers/build.xml b/openbios-devel/drivers/build.xml index e564292..f144782 100644 --- a/openbios-devel/drivers/build.xml +++ b/openbios-devel/drivers/build.xml @@ -29,8 +29,9 @@ <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>
+ <fcode source="tcx.fs" name="QEMU,tcx.bin" condition="DRIVER_SBUS" /> + </build> diff --git a/openbios-devel/drivers/sbus.c b/openbios-devel/drivers/sbus.c index 8cc0bf9..5f2592f 100644 --- a/openbios-devel/drivers/sbus.c +++ b/openbios-devel/drivers/sbus.c @@ -342,7 +342,10 @@ ob_tcx_init(unsigned int slot, const char *path) }
bind_func("hw-set-color", tcx_hw_set_color); - feval("['] qemu-tcx-driver-init is-install"); + + /* Currently we don't have an SBus probe routine, so execute FCode + directly */ + feval("['] tcx-driver-fcode 2 cells + 1 byte-load");
chosen = find_dev("/chosen"); push_str(path); diff --git a/openbios-devel/drivers/tcx.fs b/openbios-devel/drivers/tcx.fs index 4035b45..1948ff8 100644 --- a/openbios-devel/drivers/tcx.fs +++ b/openbios-devel/drivers/tcx.fs @@ -5,9 +5,42 @@ \ the QEMU TCX graphics card. \
-: qemu-tcx-driver-init ( -- ) +fcode-version3 + +\ +\ Instead of using fixed values for the framebuffer address and the width +\ and height, grab the ones passed in by QEMU/generated by OpenBIOS +\ + +: qemu-video-addr + " qemu-video-addr" $find if + cell+ @ + then +; + +: qemu-video-width + " qemu-video-width" $find if + cell+ @ + then +; + +: qemu-video-height + " qemu-video-height" $find if + cell+ @ + then +; + +: qemu-tcx-driver-install ( -- ) 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 ; + +: qemu-tcx-driver-init + ['] qemu-tcx-driver-install is-install +; + +qemu-tcx-driver-init + +end0
Currently we cannot read the FCode from the card, so for the moment simply execute the bytecode directly.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/amd64/build.xml | 1 + openbios-devel/arch/amd64/init.fs | 7 +++++ openbios-devel/arch/ppc/build.xml | 5 ++++ openbios-devel/arch/ppc/ppc.fs | 11 +++++++ openbios-devel/arch/sparc64/build.xml | 1 + openbios-devel/arch/sparc64/init.fs | 6 ++++ openbios-devel/arch/sparc64/tree.fs | 2 ++ openbios-devel/arch/x86/build.xml | 1 + openbios-devel/arch/x86/init.fs | 8 ++++++ openbios-devel/config/examples/amd64_config.xml | 1 + openbios-devel/drivers/build.xml | 2 +- openbios-devel/drivers/pci.c | 3 +- openbios-devel/drivers/vga.fs | 35 ++++++++++++++++++++++- 13 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/amd64/build.xml b/openbios-devel/arch/amd64/build.xml index 595f41f..8f436d0 100644 --- a/openbios-devel/arch/amd64/build.xml +++ b/openbios-devel/arch/amd64/build.xml @@ -1,5 +1,6 @@ <build condition="AMD64"> <dictionary name="openbios-amd64" init="openbios" target="forth"> <object source="init.fs"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA" /> </dictionary> </build> diff --git a/openbios-devel/arch/amd64/init.fs b/openbios-devel/arch/amd64/init.fs index 5b65dd1..fda3acd 100644 --- a/openbios-devel/arch/amd64/init.fs +++ b/openbios-devel/arch/amd64/init.fs @@ -1,3 +1,5 @@ +include config.fs + :noname ." Type 'help' for detailed information" cr \ ." boot secondary slave cdrom: " cr @@ -74,3 +76,8 @@ finish-device " keyboard" input ; CONSOLE-IN-initializer
+\ Load VGA FCode driver blob +[IFDEF] CONFIG_DRIVER_VGA + -1 value vga-driver-fcode + " QEMU,VGA.bin" $encode-file to vga-driver-fcode +[THEN] diff --git a/openbios-devel/arch/ppc/build.xml b/openbios-devel/arch/ppc/build.xml index 8468799..279de84 100644 --- a/openbios-devel/arch/ppc/build.xml +++ b/openbios-devel/arch/ppc/build.xml @@ -5,24 +5,29 @@ <object source="ppc.fs"/> <object source="briq/tree.fs"/> <object source="briq/briq.fs"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<dictionary name="openbios-pearpc" init="openbios" target="forth" condition="PEARPC"> <object source="ppc.fs"/> <object source="pearpc/tree.fs"/> <object source="pearpc/pearpc.fs"/> + <object source="pearpc/pearpc.fs"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<dictionary name="openbios-qemu" init="openbios" target="forth" condition="QEMU"> <object source="ppc.fs"/> <object source="qemu/tree.fs"/> <object source="qemu/qemu.fs"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<dictionary name="openbios-mol" init="openbios" target="forth" condition="MOL"> <object source="ppc.fs"/> <object source="mol/tree.fs"/> <object source="mol/mol.fs"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<!-- HACK ALERT --> diff --git a/openbios-devel/arch/ppc/ppc.fs b/openbios-devel/arch/ppc/ppc.fs index 6995ba9..0414f22 100644 --- a/openbios-devel/arch/ppc/ppc.fs +++ b/openbios-devel/arch/ppc/ppc.fs @@ -1,3 +1,5 @@ +include config.fs + \ ------------------------------------------------------------------------- \ registers \ ------------------------------------------------------------------------- @@ -50,6 +52,15 @@ 0 value %sprg3
\ ------------------------------------------------------------------------- +\ Load VGA FCode driver blob +\ ------------------------------------------------------------------------- + +[IFDEF] CONFIG_DRIVER_VGA + -1 value vga-driver-fcode + " QEMU,VGA.bin" $encode-file to vga-driver-fcode +[THEN] + +\ ------------------------------------------------------------------------- \ other \ -------------------------------------------------------------------------
diff --git a/openbios-devel/arch/sparc64/build.xml b/openbios-devel/arch/sparc64/build.xml index 54807c5..3a1cd34 100644 --- a/openbios-devel/arch/sparc64/build.xml +++ b/openbios-devel/arch/sparc64/build.xml @@ -3,6 +3,7 @@ <dictionary name="openbios-sparc64" init="openbios"> <object source="tree.fs" target="forth"/> <object source="init.fs" target="forth"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<library name="sparc64" type="static" target="target"> diff --git a/openbios-devel/arch/sparc64/init.fs b/openbios-devel/arch/sparc64/init.fs index a1cadc1..eb6c9da 100644 --- a/openbios-devel/arch/sparc64/init.fs +++ b/openbios-devel/arch/sparc64/init.fs @@ -53,3 +53,9 @@ device-end : rmap@ ( virt -- rmentry ) drop 0 ; + +\ Load VGA FCode driver blob +[IFDEF] CONFIG_DRIVER_VGA + -1 value vga-driver-fcode + " QEMU,VGA.bin" $encode-file to vga-driver-fcode +[THEN] diff --git a/openbios-devel/arch/sparc64/tree.fs b/openbios-devel/arch/sparc64/tree.fs index e15c0b5..e034b59 100644 --- a/openbios-devel/arch/sparc64/tree.fs +++ b/openbios-devel/arch/sparc64/tree.fs @@ -1,3 +1,5 @@ +include config.fs + \ ------------------------------------------------------------------------- \ UPA encode/decode unit \ ------------------------------------------------------------------------- diff --git a/openbios-devel/arch/x86/build.xml b/openbios-devel/arch/x86/build.xml index 02cecce..260a332 100644 --- a/openbios-devel/arch/x86/build.xml +++ b/openbios-devel/arch/x86/build.xml @@ -2,6 +2,7 @@
<dictionary name="openbios-x86" init="openbios"> <object source="init.fs" target="forth"/> + <object source="QEMU,VGA.bin" target="fcode" condition="DRIVER_VGA"/> </dictionary>
<library name="x86" type="static" target="target"> diff --git a/openbios-devel/arch/x86/init.fs b/openbios-devel/arch/x86/init.fs index 9607824..eef72e9 100644 --- a/openbios-devel/arch/x86/init.fs +++ b/openbios-devel/arch/x86/init.fs @@ -1,3 +1,5 @@ +include config.fs + :noname ." Type 'help' for detailed information" cr \ ." boot secondary slave cdrom: " cr @@ -74,3 +76,9 @@ finish-device :noname " keyboard" input ; CONSOLE-IN-initializer + +\ Load VGA FCode driver blob +[IFDEF] CONFIG_DRIVER_VGA + -1 value vga-driver-fcode + " QEMU,VGA.bin" $encode-file to vga-driver-fcode +[THEN] diff --git a/openbios-devel/config/examples/amd64_config.xml b/openbios-devel/config/examples/amd64_config.xml index 33d4267..e8904b7 100644 --- a/openbios-devel/config/examples/amd64_config.xml +++ b/openbios-devel/config/examples/amd64_config.xml @@ -58,3 +58,4 @@ <option name="CONFIG_DRIVER_IDE" type="boolean" value="true"/> <option name="CONFIG_IDE_NUM_CHANNELS" type="integer" value="4"/> <option name="CONFIG_DEBUG_IDE" type="boolean" value="false"/> + <option name="CONFIG_DRIVER_VGA" type="boolean" value="false"/> diff --git a/openbios-devel/drivers/build.xml b/openbios-devel/drivers/build.xml index f144782..5d7e769 100644 --- a/openbios-devel/drivers/build.xml +++ b/openbios-devel/drivers/build.xml @@ -29,9 +29,9 @@ <object source="pci.fs" condition="DRIVER_PCI"/> <object source="sbus.fs" condition="DRIVER_SBUS"/> <object source="esp.fs" condition="DRIVER_ESP"/> - <object source="vga.fs" condition="DRIVER_VGA"/> </dictionary>
<fcode source="tcx.fs" name="QEMU,tcx.bin" condition="DRIVER_SBUS" /> + <fcode source="vga.fs" name="QEMU,VGA.bin" condition="DRIVER_VGA" />
</build> diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 8157f14..1b4628e 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -771,7 +771,8 @@ int vga_config_cb (const pci_config_t *config) pci_bus_addr_to_host_addr(config->assigned[1] & ~0x0000000F), config->sizes[1]);
- feval("['] qemu-vga-driver-init is-install"); + /* Currently we don't read FCode from the hardware but execute it directly */ + feval("['] vga-driver-fcode 2 cells + 1 byte-load"); }
return 0; diff --git a/openbios-devel/drivers/vga.fs b/openbios-devel/drivers/vga.fs index 632cca0..c36ed57 100644 --- a/openbios-devel/drivers/vga.fs +++ b/openbios-devel/drivers/vga.fs @@ -5,9 +5,42 @@ \ the QEMU VGA graphics card. \
-: qemu-vga-driver-init ( -- ) +fcode-version3 + +\ +\ Instead of using fixed values for the framebuffer address and the width +\ and height, grab the ones passed in by QEMU/generated by OpenBIOS +\ + +: qemu-video-addr + " qemu-video-addr" $find if + cell+ @ + then +; + +: qemu-video-width + " qemu-video-width" $find if + cell+ @ + then +; + +: qemu-video-height + " qemu-video-height" $find if + cell+ @ + then +; + +: qemu-vga-driver-install ( -- ) 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 ; + +: qemu-vga-driver-init + ['] qemu-vga-driver-install is-install + ; + +qemu-vga-driver-init + +end0