[OpenBIOS] r690 - cpu/x86/pc/olpc dev/olpc/kb3700
svn at openbios.org
svn at openbios.org
Sat Oct 20 09:42:32 CEST 2007
Author: wmb
Date: 2007-10-20 09:42:32 +0200 (Sat, 20 Oct 2007)
New Revision: 690
Modified:
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/security.fth
dev/olpc/kb3700/ecio.fth
Log:
OLPC - Use new EC command that permits reflashing after reset-all, without
having to remove all power.
Modified: cpu/x86/pc/olpc/fw.bth
===================================================================
--- cpu/x86/pc/olpc/fw.bth 2007-10-19 07:02:17 UTC (rev 689)
+++ cpu/x86/pc/olpc/fw.bth 2007-10-20 07:42:32 UTC (rev 690)
@@ -336,12 +336,7 @@
fload ${BP}/ofw/gui/ofpong.fth
fload ${BP}/cpu/x86/pc/olpc/life.fth
fload ${BP}/cpu/x86/pc/olpc/sound.fth
-: olpc-power-off ( -- )
- gx-power-off \ Try the nice way first
- d# 20 ms
- ec-power-off \ Then try the hard way
-;
-' olpc-power-off to power-off
+' gx-power-off to power-off
[then]
@@ -388,8 +383,7 @@
2drop 2drop
then
- 1. h# 5140.0017 wrmsr \ DIVIL_SOFT_RESET MSR, 5536 page 367
- begin again
+ ec-reboot \ Tell the EC to reboot us, so the EC can reset too
;
' dcon-reset-all to reset-all
Modified: cpu/x86/pc/olpc/security.fth
===================================================================
--- cpu/x86/pc/olpc/security.fth 2007-10-19 07:02:17 UTC (rev 689)
+++ cpu/x86/pc/olpc/security.fth 2007-10-20 07:42:32 UTC (rev 690)
@@ -647,7 +647,9 @@
ec-indexed-io-off? if
visible
- .ec-ixio-msg
+ ." Restarting to enable SPI FLASH writing." cr
+ d# 3000 ms
+ ec-reboot
security-failure
then
Modified: dev/olpc/kb3700/ecio.fth
===================================================================
--- dev/olpc/kb3700/ecio.fth 2007-10-19 07:02:17 UTC (rev 689)
+++ dev/olpc/kb3700/ecio.fth 2007-10-20 07:42:32 UTC (rev 690)
@@ -189,66 +189,55 @@
\ the port 66 command sequence.
: sci-quiet ( -- ) h# 50 h# ff03 ec! ;
-\ While accessing the SPI FLASH, we have to turn off the keyboard controller,
-\ because it continuously fetches from the SPI FLASH when it's on. That
-\ interferes with our accesses.
-: ec-indexed-io-off? ( -- flag ) h# ff14 ec@ h# ff = ;
-: .ec-ixio-msg ( -- )
- ." Writing to the SPI FLASH is disabled." cr
- ." Disconnect/reconnect the battery and AC and try again." cr
-;
+\ kbc-pause temporarily halts execution of the keyboard controller microcode.
+\ kbc-resume makes it run again, picking up where it left off.
+\ This is useful for accessing the SPI FLASH in cases where you do not
+\ overwrite the keyboard controller microcodes.
+: kbc-pause ( -- ) h# dd ec-cmd66 ;
+: kbc-resume ( -- ) h# df ec-cmd66 ;
+
0 value kbc-off?
-: kbc-off ( -- )
- kbc-off? if exit then \ Fast bail out
- ec-indexed-io-off? if .ec-ixio-msg abort then
- h# d8 ec-cmd66 \ Prepare for reset
- h# ff14 ec@ 1 or h# ff14 ec!
- true to kbc-off?
-;
-: ec-power-off ( -- )
- 1 h# ff14 ec!
- 1 h# ff01 ec! \ Tell the EC to bounce us on restart
- 0 h# ff14 ec!
-;
-
-\ Unfortunately, since the system reset is mediated by the keyboard
-\ controller, turning the keyboard controller back on resets the system.
-
: kbc-on ( -- )
+ \ Release the reset line to the 8051 microcontroller in the EC,
+ \ thus letting it restart with possibly-new microcode.
h# ff14 ec@ 1 invert and h# ff14 ec! \ Innocuous if already on
false to kbc-off?
;
-: fancy-kbc-on ( -- )
- 2 h# ff01 ec! \ Prevent full system reset
- h# ff14 ec@ 1 invert and h# ff14 ec! \ Innocuous if already on
- d# 400 ms \ Give the EC time to start up
- h# 44 h# fc80 ec! \ Re-enable scan code conversion and system flag
- h# 43 h# fc81 ec! \ Re-enable fast gate and ibf/obf interrupts
- h# f h# fe51 ec! \ Clear pending interrupts
- h# f h# fe50 ec! \ Re-enable GPT interrupts
- h# 0 h# fea7 ec! \ Clear FLASH write enable
- h# 4 h# fead ec! \ fast read mode
- h# fe95 ec@ h# 80 or h# fe95 ec! \ Write-protect LPC
- h# 3 h# ff04 ec! \ enable IBF/OBF interrupts
-\ h# 40 h# ff08 ec! \ Clear some interrupt
- h# ff30 ec@ h# 10 or h# ff30 ec! \ Enable interrupt from GPIO04, PCI_RST#
+\ This restarts the EC and the CPU, resetting the EC state to its default.
+\ EC indexed I/O will come up in enabled state.
+: ec-reboot ( -- ) h# db ec-cmd66 begin again ;
- false to kbc-off?
+: ec-indexed-io-off? ( -- flag ) h# ff14 ec@ h# ff = ;
+: ?ixio-restart ( -- )
+ ec-indexed-io-off? if
+ cr red-letters
+ ." Restarting to enable SPI FLASH writing. Try again after the system restarts."
+ black-letters cr
+ d# 5000 ms
+ ec-reboot
+ then
;
-\ kbc-pause temporarily halts execution of the keyboard controller microcode.
-\ kbc-resume makes it run again, picking up where it left off.
-\ This is useful for accessing the SPI FLASH in cases where you do not
-\ overwrite the keyboard controller microcodes.
+\ While accessing the SPI FLASH, we have to turn off the keyboard controller,
+\ because it continuously fetches from the SPI FLASH when it's on. That
+\ interferes with our accesses.
-: kbc-pause ( -- ) h# dd ec-cmd66 ;
-: kbc-resume ( -- ) h# df ec-cmd66 ;
+\ Unfortunately, since the system reset is mediated by the keyboard
+\ controller, turning the keyboard controller back on resets the system.
+: kbc-off ( -- )
+ kbc-off? if exit then \ Fast bail out
+ ?ixio-restart
+ h# d8 ec-cmd66 \ Prepare for reset
+ h# ff14 ec@ 1 or h# ff14 ec!
+ true to kbc-off?
+;
+
: io-spi@ ( reg# -- b ) h# fea8 + ec@ ;
: io-spi! ( b reg# -- ) h# fea8 + ec! ;
@@ -261,9 +250,7 @@
: io-spi-reprogrammed ( -- )
." Restarting..." d# 2000 ms cr
- kbc-on
- begin again
-\ ." Keyboard back on" cr
+ kbc-on begin again
;
: io-spi-start ( -- )
@@ -281,6 +268,7 @@
;
: use-local-ec ( -- ) ['] io-spi-start to spi-start ;
use-local-ec
+
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
More information about the OpenBIOS
mailing list