[openfirmware] r1339 - cpu/x86/pc cpu/x86/pc/olpc cpu/x86/pc/olpc/via dev/olpc/spiflash ofw/core

svn at openfirmware.info svn at openfirmware.info
Sun Aug 30 03:33:46 CEST 2009


Author: wmb
Date: 2009-08-30 03:33:45 +0200 (Sun, 30 Aug 2009)
New Revision: 1339

Modified:
   cpu/x86/pc/biosints.fth
   cpu/x86/pc/olpc/biosresume.fth
   cpu/x86/pc/olpc/devices.fth
   cpu/x86/pc/olpc/fw.bth
   cpu/x86/pc/olpc/gui.fth
   cpu/x86/pc/olpc/via/devices.fth
   cpu/x86/pc/olpc/via/fw.bth
   dev/olpc/spiflash/recover.fth
   ofw/core/muxdev.fth
Log:
Fixed some residual dependencies on the dualconsole scheme, hopefully
completing the transition to full console multiplexing.


Modified: cpu/x86/pc/biosints.fth
===================================================================
--- cpu/x86/pc/biosints.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/biosints.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -126,7 +126,7 @@
 ;
 
 : set-mode3  ( -- )
-   stdout off  \ Stop using OFW driver
+   text-off  \ Stop using OFW screen output
    " text-mode3" screen-ih $call-method
 ;
 \ VBE status: AL = 4f -> function supported  else not supported
@@ -419,7 +419,7 @@
 
 : set-mode12  ( -- )
    " graphics-mode12" " screen-ih" eval $call-method
-   stdout off
+   text-off  \ Stop using OFW output to screen
 ;
 : set-video-mode  ( mode -- )
    case
@@ -846,17 +846,17 @@
 ;
 
 0 value the-key
-0 value kbd-ih
 
+: $call-keyboard  ( ?? method-name$ -- ?? )  keyboard-ih $call-method  ;
 : poll-key  ( -- false | scan,ascii true )
    the-key  ?dup  if  true exit  then
    d# 50 ms   \ I don't know why this is necessary, but without it, you don't see the key
-   0 " get-scancode" kbd-ih $call-method  if    ( scancode )
+   0 " get-scancode" $call-keyboard  if         ( scancode )
       dup h# 80 and  if                         ( scancode )
          \ Discard release events and escapes (e0)
          drop false                             ( false )
       else
-         dup " scancode->char" kbd-ih $call-method  0=  if  0  then  ( scancode ascii )
+         dup " scancode->char" $call-keyboard  0=  if  0  then  ( scancode ascii )
          dup h# 80 and  if  drop 0  then        \ Don't return e.g. 9B for arrows
          swap bwjoin to the-key
          the-key true
@@ -1000,7 +1000,7 @@
 : #hard-drives  ( -- n )  1  ;
 
 : make-bda  ( -- )
-   h# 400 h# 200 erase
+   h# 400 h# 101 erase
    'ebda h# 400 erase
    h# 3f8 h# 400 w!
    'ebda 4 rshift h# 40e w!
@@ -1058,9 +1058,6 @@
 
    'ebda 4 rshift  h# 40e w!   \ Extended BIOS data area segment address
 
-   \ The USB keyboard is unsuitable for this purpose, as USB is
-   \ turned off when control is transferred to the Windows booter.
-   " /isa/keyboard"   open-dev to kbd-ih
    populate-memory-map
    rm-platform-fixup
 ;

Modified: cpu/x86/pc/olpc/biosresume.fth
===================================================================
--- cpu/x86/pc/olpc/biosresume.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/biosresume.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -51,14 +51,14 @@
 [then]
 
 : suspend-ps2  ( -- )
-   " default-disable-kbd" kbd-ih $call-method   \ Stop keyboard
-   1 " set-port" kbd-ih $call-method    \ Select mouse (touchpad) port
-   " default-disable-kbd" kbd-ih $call-method   \ Stop mouse
+   " default-disable-kbd" $call-keyboard   \ Stop keyboard
+   1 " set-port" $call-keyboard    \ Select mouse (touchpad) port
+   " default-disable-kbd" $call-keyboard   \ Stop mouse
 ;
 : resume-ps2  ( -- )
-   " enable-scan" kbd-ih $call-method   \ Restart mouse
-   0 " set-port" kbd-ih $call-method    \ Select keyboard port
-   " enable-scan" kbd-ih $call-method   \ Restart keyboard
+   " enable-scan" $call-keyboard   \ Restart mouse
+   0 " set-port" $call-keyboard    \ Select keyboard port
+   " enable-scan" $call-keyboard   \ Restart keyboard
 ;
 
 : enable-uoc  ( -- )

Modified: cpu/x86/pc/olpc/devices.fth
===================================================================
--- cpu/x86/pc/olpc/devices.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/devices.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -241,6 +241,11 @@
 h# 3f8 is uart-base
 fload ${BP}/forth/lib/sysuart.fth	\ Use UART for key and emit
 
+0 value keyboard-ih
+0 value screen-ih
+
+fload ${BP}/ofw/core/muxdev.fth          \ I/O collection/distribution device
+
 [ifndef] save-flash
 : save-flash ;
 : restore-flash ;

Modified: cpu/x86/pc/olpc/fw.bth
===================================================================
--- cpu/x86/pc/olpc/fw.bth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/fw.bth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -222,11 +222,6 @@
 fload ${BP}/cpu/x86/pc/boot.fth
 fload ${BP}/cpu/x86/pc/linux.fth
 
-0 value keyboard-ih
-0 value screen-ih
-
-fload ${BP}/ofw/core/muxdev.fth          \ I/O collection/distribution device
-
 : usb-port-power-map  ( -- n )
    board-revision  h# b10  h# b2f between  if  \ B1 and B2
       h# 3ab   \ USB4:PWR1  USB3:PWR1  USB2:PWR1  USB1:PWR2
@@ -325,13 +320,13 @@
 true value text-on?
 : text-off  ( -- )
    text-on?  if
-      screen-ih remove-mux
+      screen-ih remove-output
       false to text-on?
    then
 ;
 : text-on   ( -- )
    text-on? 0=  if
-      screen-ih add-mux
+      screen-ih add-output
       cursor-on
       true to text-on?
    then
@@ -375,11 +370,11 @@
 
 [ifdef] use-ega
 : ega-output  ( -- )
-   \ This only works if stdout is currently /display
-   stdout @  if
-      " text-mode3" screen-ih $call-method
+   screen-ih  if
+      screen-ih remove-output
+      " text-mode3" screen-ih ['] $call-method catch  if  3drop  then
    then
-   " /ega-text" output
+   " /ega-text" open-dev add-output
 ;
 [then]
 

Modified: cpu/x86/pc/olpc/gui.fth
===================================================================
--- cpu/x86/pc/olpc/gui.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/gui.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -297,7 +297,7 @@
 ;
 
 : logo-banner  ( -- error? )
-   display?  0=  if  true exit  then
+   screen-ih  0=  if  true exit  then
 
 \ Do this later...
 \   diagnostic-mode?  0=  if  ['] visual-error to .error  then

Modified: cpu/x86/pc/olpc/via/devices.fth
===================================================================
--- cpu/x86/pc/olpc/via/devices.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/via/devices.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -197,6 +197,11 @@
 h# 3f8 is uart-base
 fload ${BP}/forth/lib/sysuart.fth	\ Use UART for key and emit
 
+0 value keyboard-ih
+0 value screen-ih
+
+fload ${BP}/ofw/core/muxdev.fth          \ I/O collection/distribution device
+
 [ifndef] save-flash
 : save-flash ;
 : restore-flash ;

Modified: cpu/x86/pc/olpc/via/fw.bth
===================================================================
--- cpu/x86/pc/olpc/via/fw.bth	2009-08-28 21:54:40 UTC (rev 1338)
+++ cpu/x86/pc/olpc/via/fw.bth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -233,11 +233,6 @@
 fload ${BP}/cpu/x86/pc/boot.fth
 fload ${BP}/cpu/x86/pc/linux.fth
 
-0 value keyboard-ih
-0 value screen-ih
-
-fload ${BP}/ofw/core/muxdev.fth          \ I/O collection/distribution device
-
 fload ${BP}/cpu/x86/pc/olpc/via/usb.fth
 
 false to stand-init-debug?
@@ -325,13 +320,13 @@
 true value text-on?
 : text-off  ( -- )
    text-on?  if
-      screen-ih remove-mux
+      screen-ih out-mux-ih remove-mux
       false to text-on?
    then
 ;
 : text-on   ( -- )
    text-on? 0=  if
-      screen-ih add-mux
+      screen-ih out-mux-ih add-mux
       cursor-on
       true to text-on?
    then

Modified: dev/olpc/spiflash/recover.fth
===================================================================
--- dev/olpc/spiflash/recover.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ dev/olpc/spiflash/recover.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -17,8 +17,10 @@
 \    ok recover disk:\file.rom  \ Copies a ROM file to the dead one
 
 : (serial-flash)  ( -- )
-   stdin @ 0=  stdout @ 0=  or  abort" Can't use a serial console for this"
-   console-io
+   \ Disconnect serial port from console multiplexor
+   ." Disconnecting serial port from OFW console" cr
+   fallback-in-ih  remove-input
+   fallback-out-ih remove-output
 
    ." Connecting to dead machine.  (Merging will take about 25 seconds.)" cr
    use-serial-ec

Modified: ofw/core/muxdev.fth
===================================================================
--- ofw/core/muxdev.fth	2009-08-28 21:54:40 UTC (rev 1338)
+++ ofw/core/muxdev.fth	2009-08-30 01:33:45 UTC (rev 1339)
@@ -137,42 +137,53 @@
 finish-device
 device-end
 
-0 value mux-ih
+0 value in-mux-ih
+0 value out-mux-ih
 
-: open-mux  ( -- )
-   mux-ih 0=  if
-      " "  " mux" $open-package
-      dup 0= abort" Can't open mux package"
-      to mux-ih
-   then
+: new-mux  ( -- ih )
+   " "  " mux" $open-package
+   dup 0= abort" Can't open mux package"
 ;
 
-: add-mux   ( ih -- )
-   ?dup  if  " add-device" mux-ih  $call-method  then
+: add-mux   ( ih mux-ih -- )
+   over  if  >r " add-device" r>  $call-method  else  2drop  then
 ;
 
-: remove-mux  ( ih -- )  " remove-device" mux-ih $call-method  ;
+: remove-mux  ( ih mux-ih -- )  >r " remove-device" r> $call-method  ;
 
+: add-output  ( ih -- )  out-mux-ih add-mux  ;
+: remove-output  ( ih -- )  out-mux-ih remove-mux  ;
+: add-input  ( ih -- )  in-mux-ih add-mux  ;
+: remove-input  ( ih -- )  in-mux-ih remove-mux  ;
+
 : .mux  ( -- )
-   mux-ih  if
-      " show-devices" mux-ih $call-method
-   else
-      ." Mux isn't open" cr
+   in-mux-ih  if
+      ." Input mux:" cr
+      " show-devices" in-mux-ih $call-method
    then
+   out-mux-ih  if
+      ." Output mux:" cr
+      " show-devices" out-mux-ih $call-method
+   then
 ;
 
+0 value fallback-in-ih
+0 value fallback-out-ih
+
 : install-mux-io  ( -- )
-   open-mux
+   new-mux to in-mux-ih
+   new-mux to out-mux-ih
 
-   fallback-device open-dev add-mux
+   fallback-device open-dev  dup to fallback-in-ih   add-input
+   fallback-device open-dev  dup to fallback-out-ih  add-output
 
    screen open-dev to screen-ih
-   screen-ih add-mux
+   screen-ih add-output
 
    keyboard open-dev to keyboard-ih
-   keyboard-ih add-mux
+   keyboard-ih add-input
 
-   mux-ih set-stdin  mux-ih set-stdout
+   in-mux-ih set-stdin  out-mux-ih set-stdout
 
    console-io
 ;




More information about the openfirmware mailing list