[OpenBIOS] [PATCH 11/11] prep: disable VBE extensions when executing client program

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat May 26 21:29:56 CEST 2018


PReP payloads such as Linux expect to be able to set standard VGA modes
on startup, but VBE prevents certain modes such as text-only.

Disable VBE extensions when executing the client program to allow this
behaviour which also matches that of Open HackWare.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 arch/ppc/qemu/init.c | 16 ++++++++++++++++
 drivers/vga.fs       | 11 +++++++++++
 2 files changed, 27 insertions(+)

diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index c113482..06fd08d 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -613,10 +613,26 @@ static void arch_go(void);
 static void
 arch_go(void)
 {
+    phandle_t ph;
+    xt_t xt;
+
     /* Insert copyright property for MacOS 9 and below */
     if (find_dev("/rom/macos")) {
         fword("insert-copyright-property");
     }
+
+    /* PReP machines expect a standard VGA console, so disable
+       VBE extensions just before we transfer control */
+    if (!is_apple()) {
+        ph = dt_iterate_type(find_dev("/"), "display");
+        if (ph != 0) {
+            xt = find_package_method("vbe-deinit", ph);
+            if (xt != 0) {
+                PUSH(xt);
+                fword("execute");
+            }
+        }
+    }
 }
 
 static void kvm_of_init(void)
diff --git a/drivers/vga.fs b/drivers/vga.fs
index 080edf2..53dcff0 100644
--- a/drivers/vga.fs
+++ b/drivers/vga.fs
@@ -226,6 +226,17 @@ defer mol-color!
   loop
 ;
 
+\
+\ Cancel Bochs VBE mode
+\
+
+: vbe-deinit ( -- )
+  \ Switching VBE on and off clears the framebuffer
+  VBE_DISPI_DISABLED VBE_DISPI_INDEX_ENABLE vbe-iow!
+  VBE_DISPI_ENABLED VBE_DISPI_INDEX_ENABLE vbe-iow!
+  VBE_DISPI_DISABLED VBE_DISPI_INDEX_ENABLE vbe-iow!
+;
+
 headerless
 
 \
-- 
2.11.0




More information about the OpenBIOS mailing list