Author: wmb Date: 2008-08-08 23:15:13 +0200 (Fri, 08 Aug 2008) New Revision: 873
Modified: cpu/x86/pc/olpc/fsupdate.fth dev/olpc/cafenand/methods.fth dev/olpc/cafenand/redboot.fth Log: OLPC trac 7880 - fixed glitches in NAND partition support.
Modified: cpu/x86/pc/olpc/fsupdate.fth =================================================================== --- cpu/x86/pc/olpc/fsupdate.fth 2008-08-08 07:05:51 UTC (rev 872) +++ cpu/x86/pc/olpc/fsupdate.fth 2008-08-08 21:15:13 UTC (rev 873) @@ -62,7 +62,7 @@ vocabulary nand-commands also nand-commands definitions
-: set-partition: ( "partition#" -- ) +: set-partition: ( "partitionid" -- ) \ partitionid is number or name safe-parse-word " $set-partition" $call-nand abort" Nonexistent partition#" ;
@@ -139,11 +139,11 @@
: do-fs-update ( img$ -- ) tuck load-base h# 100000 + swap move ( len ) - load-base h# 100000 + swap - open-nand + load-base h# 100000 + swap ( adr len ) + open-nand ( adr len )
- ['] noop to show-progress - #nand-pages >eblock# show-init + ['] noop to show-progress ( adr len ) + #nand-pages >eblock# show-init ( adr len )
\ clear-context nand-commands also nand-commands @@ -189,6 +189,15 @@ update-devices fs-update-from-list ;
+: $update-nand ( devspec$ -- ) + load-crypto abort" Can't load the crypto functions" + null$ cn-buf place null$ pn-buf place ( devspec$ ) + 2dup [char] \ split-string 2drop dn-buf place ( devspec$ ) + boot-read + loaded do-fs-update +; +: update-nand ( "devspec" -- ) safe-parse-word $fs-update ; + \ LICENSE_BEGIN \ Copyright (c) 2007 FirmWorks \
Modified: dev/olpc/cafenand/methods.fth =================================================================== --- dev/olpc/cafenand/methods.fth 2008-08-08 07:05:51 UTC (rev 872) +++ dev/olpc/cafenand/methods.fth 2008-08-08 21:15:13 UTC (rev 873) @@ -60,7 +60,7 @@ then ( error? ) dup if ( error? ) ." NAND: No such partition" cr ( error? ) - then + then ;
: open ( -- okay? )
Modified: dev/olpc/cafenand/redboot.fth =================================================================== --- dev/olpc/cafenand/redboot.fth 2008-08-08 07:05:51 UTC (rev 872) +++ dev/olpc/cafenand/redboot.fth 2008-08-08 21:15:13 UTC (rev 873) @@ -15,7 +15,7 @@ [then]
d# 256 constant /partition-entry -d# 8 constant max#partitions +d# 7 constant max#partitions \ Not counting the FIS directory entry
: partition-map-page# ( -- true | page# false ) h# 10 pages/eblock * 0 do @@ -27,10 +27,10 @@
: (#partitions) ( adr -- n ) 0 swap ( seen adr ) - max#partitions 0 ?do ( seen adr ) + max#partitions 1+ 0 ?do ( seen adr ) dup i /partition-entry * + ( seen adr padr ) dup w@ h# ffff = if ( seen adr padr ) - 2drop if i else -1 then ( n ) + 2drop if i 1- else -1 then ( n ) unloop exit ( n ) then ( seen adr padr ) " FIS directory" rot swap comp 0= if ( seen adr ) @@ -63,8 +63,9 @@
dup to partition# ( partition# )
- \ Partition 1 (the FIS directory entry) begins at offset 0 - 1- /partition-entry * part-buf + ( adr ) + \ "Real" partitions are numbered starting at 1 + \ The partition buffer entry at offset 0 is the FIS directory + /partition-entry * part-buf + ( adr ) dup d# 16 + l@ /page / to partition-start ( adr ) d# 24 + l@ /page / to partition-size ( ) false @@ -85,13 +86,13 @@
: set-partition-name ( name$ -- error? ) #partitions dup 0< if 2drop false exit then ( name$ #partitions ) - /partition-entry * ( name$ len ) + 1+ /partition-entry * ( name$ part-buf-len ) part-buf swap bounds ?do ( name$ ) 2dup i d# 16 ncstr $= if ( name$ ) 2drop ( ) i d# 16 + l@ /page / to partition-start ( ) i d# 24 + l@ /page / to partition-size ( ) - i part-buf - /partition-entry / 1+ to partition# + i part-buf - /partition-entry / to partition# start-scan false unloop exit then ( name$ )