Author: wmb Date: 2008-03-05 21:50:35 +0100 (Wed, 05 Mar 2008) New Revision: 817
Modified: cpu/x86/pc/olpc/security.fth dev/olpc/kb3700/battery.fth Log: OLPC Trac #5422 - continue booting if the firmware update is deferred due to insufficient power.
Modified: cpu/x86/pc/olpc/security.fth =================================================================== --- cpu/x86/pc/olpc/security.fth 2008-02-27 04:40:24 UTC (rev 816) +++ cpu/x86/pc/olpc/security.fth 2008-03-05 20:50:35 UTC (rev 817) @@ -652,6 +652,51 @@ drop ;
+: do-firmware-update ( img$ -- ) + visible + + tuck flash-buf swap move ( len ) + + ['] ?image-valid catch ?dup if ( ) + visible + red-letters + ." Bad firmware image file - " .error + ." Continuing with old firmware" cr + black-letters + exit + then + + true to file-loaded? + + d# 12,000 wait-until \ Wait for EC to notice the battery + + ['] ?enough-power catch ?dup if + visible + red-letters + ." Unsafe to update firmware now - " .error + ." Continuing with old firmware" cr + black-letters + exit + then + + " Updating firmware" ?lease-debug-cr + + ec-indexed-io-off? if + visible + ." Restarting to enable SPI FLASH writing." cr + d# 3000 ms + ec-ixio-reboot + security-failure + then + + \ Latch alternate? flag for next startup + alternate? if [char] A h# 82 cmos! then + + reflash \ Should power-off and reboot + show-x + " Reflash returned, unexpectedly" .security-failure +; + : load-from-device ( devname$ -- done? )
d# 16 0 +icon-xy show-dot @@ -667,36 +712,7 @@ " new - " ?lease-debug fwkey$ to pubkey$ img$ sig$ fw-valid? if - visible - - img$ tuck flash-buf swap move ( len ) - - ?image-valid ( ) - true to file-loaded? - " Updating firmware" ?lease-debug-cr - - ec-indexed-io-off? if - visible - ." Restarting to enable SPI FLASH writing." cr - d# 3000 ms - ec-ixio-reboot - security-failure - then - - d# 12,000 wait-until \ Wait for EC to notice the battery - - ['] ?enough-power catch ?dup if - visible - red-letters .error black-letters - security-failure - then - - \ Latch alternate? flag for next startup - alternate? if [char] A h# 82 cmos! then - - reflash \ Should power-off and reboot - show-x - " Reflash returned, unexpectedly" .security-failure + img$ do-firmware-update then show-lock then
Modified: dev/olpc/kb3700/battery.fth =================================================================== --- dev/olpc/kb3700/battery.fth 2008-02-27 04:40:24 UTC (rev 816) +++ dev/olpc/kb3700/battery.fth 2008-03-05 20:50:35 UTC (rev 817) @@ -105,9 +105,9 @@ ;
: ?enough-power ( ) - bat-status@ ( stat ) - dup h# 10 and 0= abort" AC not present" ( stat ) - dup 1 and 0= abort" Battery not present" ( stat ) + bat-status@ ( stat ) + dup h# 10 and 0= abort" No external power" ( stat ) + dup 1 and 0= abort" No battery" ( stat ) 4 and abort" Battery low" ;