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