[OpenBIOS] [commit] r1246 - trunk/openbios-devel/drivers

repository service svn at openbios.org
Fri Dec 20 11:45:54 CET 2013


Author: mcayland
Date: Fri Dec 20 11:45:54 2013
New Revision: 1246
URL: http://tracker.coreboot.org/trac/openbios/changeset/1246

Log:
tcx/cgthree: remove hard OpenBIOS dependency from driver

Since QEMU 1.7, the OpenBIOS TCX framebuffer FCode ROM is made available to
Open Firmware upon boot. However, this causes a boot failure for people who
use a Sun OBP firmware with QEMU since the FCode throws an exception trying
to access some OpenBIOS-specific variables. This causes an invalid device
node to be created in the tree, causing a crash on boot as reported by Peter
Bartoli and Artyom Tarasenko.

Fix both drivers so that if OpenBIOS is not detected, we fall back to the QEMU
framebuffer defaults of 1024x768x8 which should generate a valid device node
and avoid the crash.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/drivers/cgthree.fs
   trunk/openbios-devel/drivers/tcx.fs

Modified: trunk/openbios-devel/drivers/cgthree.fs
==============================================================================
--- trunk/openbios-devel/drivers/cgthree.fs	Mon Dec 16 19:06:28 2013	(r1245)
+++ trunk/openbios-devel/drivers/cgthree.fs	Fri Dec 20 11:45:54 2013	(r1246)
@@ -18,20 +18,57 @@
   $find if
     exit
   else
+    2drop
     -1
   then
 ;
 
+: (is-openbios)  \ ( -- true | false )
+  " openbios-video-width" (find-xt) -1 <> if
+    -1
+  else
+    0
+  then
+;
+
 " openbios-video-width" (find-xt) cell+ value openbios-video-width-xt
 " openbios-video-height" (find-xt) cell+ value openbios-video-height-xt
 " depth-bits" (find-xt) cell+ value depth-bits-xt
 " line-bytes" (find-xt) cell+ value line-bytes-xt
 " debug-type" (find-xt) value debug-type-xt
 
-: openbios-video-width openbios-video-width-xt @ ;
-: openbios-video-height openbios-video-height-xt @ ;
-: depth-bits depth-bits-xt @ ;
-: line-bytes line-bytes-xt @ ;
+: openbios-video-width
+  (is-openbios) if
+    openbios-video-width-xt @
+  else
+    h# 400
+  then
+;
+
+: openbios-video-height
+  (is-openbios) if
+    openbios-video-height-xt @
+  else
+    h# 300
+  then
+;
+
+: depth-bits
+  (is-openbios) if
+    depth-bits-xt @
+  else
+    h# 8
+  then
+;
+
+: line-bytes
+  (is-openbios) if
+    line-bytes-xt @
+  else
+    h# 400
+  then
+;
+
 : debug-type debug-type-xt execute ;
 
 \
@@ -113,6 +150,12 @@
 : qemu-cg3-driver-install ( -- )
   cg3-dac -1 = if
     map-regs
+
+    \ Initial pallette taken from Sun's "Writing FCode Programs"
+    h# ff h# ff h# ff h# 0  color!    \ Background white
+    h# 0  h# 0  h# 0  h# ff color!    \ Foreground black
+    h# 64 h# 41 h# b4 h# 1  color!    \ SUN-blue logo
+
     fb-addr to frame-buffer-adr
     default-font set-font
 

Modified: trunk/openbios-devel/drivers/tcx.fs
==============================================================================
--- trunk/openbios-devel/drivers/tcx.fs	Mon Dec 16 19:06:28 2013	(r1245)
+++ trunk/openbios-devel/drivers/tcx.fs	Fri Dec 20 11:45:54 2013	(r1246)
@@ -18,19 +18,55 @@
   $find if
     exit
   else
+    2drop
     -1
   then
 ;
 
+: (is-openbios)  \ ( -- true | false )
+  " openbios-video-width" (find-xt) -1 <> if
+    -1
+  else
+    0
+  then
+;
+
 " openbios-video-width" (find-xt) cell+ value openbios-video-width-xt
 " openbios-video-height" (find-xt) cell+ value openbios-video-height-xt
 " depth-bits" (find-xt) cell+ value depth-bits-xt
 " line-bytes" (find-xt) cell+ value line-bytes-xt
 
-: openbios-video-width openbios-video-width-xt @ ;
-: openbios-video-height openbios-video-height-xt @ ;
-: depth-bits depth-bits-xt @ ;
-: line-bytes line-bytes-xt @ ;
+: openbios-video-width
+  (is-openbios) if
+    openbios-video-width-xt @
+  else
+    h# 400
+  then
+;
+
+: openbios-video-height
+  (is-openbios) if
+    openbios-video-height-xt @
+  else
+    h# 300
+  then
+;
+
+: depth-bits
+  (is-openbios) if
+    depth-bits-xt @
+  else
+    h# 8
+  then
+;
+
+: line-bytes
+  (is-openbios) if
+    line-bytes-xt @
+  else
+    h# 400
+  then
+;
 
 \
 \ Registers
@@ -183,6 +219,12 @@
 : qemu-tcx-driver-install ( -- )
   tcx-dac -1 = if
     map-regs
+
+    \ Initial pallette taken from Sun's "Writing FCode Programs"
+    h# ff h# ff h# ff h# 0  color!    \ Background white
+    h# 0  h# 0  h# 0  h# ff color!    \ Foreground black
+    h# 64 h# 41 h# b4 h# 1  color!    \ SUN-blue logo
+
     fb-addr to frame-buffer-adr
     default-font set-font
 



More information about the OpenBIOS mailing list