[OpenBIOS] [PATCH] vga.fs: install MacOS VGA PPC driver from QEMU fw_cfg interface if available

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon May 1 15:13:38 CEST 2017


If the fw_cfg interface provides a MacOS VGA PPC NDRV binary driver then
install it into the "driver,AAPL,MacOS,PowerPC" property of the QEMU VGA
package.

The installation of the binary is configured via the NVRAM configuration
variable "vga-ndrv?" (which is set to true by default for PPC) and also the
presence of the NDRV binary driver file within the QEMU fw_cfg interface
itself.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/vga.fs       |   14 ++++++++++++++
 forth/admin/nvram.fs |    1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/vga.fs b/drivers/vga.fs
index 29a043a..cbfa46c 100644
--- a/drivers/vga.fs
+++ b/drivers/vga.fs
@@ -34,6 +34,9 @@ fcode-version3
 " fb8-fillrect" (find-xt) value fb8-fillrect-xt
 : fb8-fillrect fb8-fillrect-xt execute ;
 
+" fw-cfg-read-file" (find-xt) value fw-cfg-read-file-xt
+: fw-cfg-read-file fw-cfg-read-file-xt execute ;
+
 \
 \ IO port words
 \
@@ -197,6 +200,17 @@ headerless
   depth-bits encode-int " depth" property
   line-bytes encode-int " linebytes" property
 
+  \ Is the VGA NDRV driver enabled? (PPC only)
+  " /options" find-package drop s" vga-ndrv?" rot get-package-property not if
+    decode-string 2swap 2drop    \ ( addr len )
+    s" true" drop -rot comp 0= if
+      \ Embed NDRV driver via fw-cfg if it exists
+      " ndrv/qemu_vga.ndrv" fw-cfg-read-file if
+        encode-string " driver,AAPL,MacOS,PowerPC" property
+      then
+    then
+  then
+
   ['] qemu-vga-driver-install is-install
 ;
 
diff --git a/forth/admin/nvram.fs b/forth/admin/nvram.fs
index 20f6462..3fbd935 100644
--- a/forth/admin/nvram.fs
+++ b/forth/admin/nvram.fs
@@ -336,6 +336,7 @@ s" -1"       s" real-size"            int-config
 s" 4000000"  s" load-base"          int-config
 s" -1"       s" virt-base"            int-config
 s" -1"       s" virt-size"            int-config
+s" true"     s" vga-ndrv?"            bool-config
 [THEN]
 
 [IFDEF] CONFIG_X86
-- 
1.7.10.4




More information about the OpenBIOS mailing list