[OpenBIOS] [PATCH 3/4] SPARC32: switch TCX driver over to FCode
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Mon Jun 24 17:06:22 CEST 2013
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 at 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
--
1.7.10.4
More information about the OpenBIOS
mailing list