Author: wmb Date: 2009-10-08 12:46:12 +0200 (Thu, 08 Oct 2009) New Revision: 1405
Modified: cpu/x86/pc/olpc/via/fsupdate.fth cpu/x86/pc/olpc/via/fw.bth dev/mmc/sdhci/sdhci.fth Log: OLPC trac 9474 - buffer conflict was causing fs-update to write bad filesystem data.
Modified: cpu/x86/pc/olpc/via/fsupdate.fth =================================================================== --- cpu/x86/pc/olpc/via/fsupdate.fth 2009-10-08 05:18:17 UTC (rev 1404) +++ cpu/x86/pc/olpc/via/fsupdate.fth 2009-10-08 10:46:12 UTC (rev 1405) @@ -124,8 +124,11 @@ open-nand #image-eblocks show-init get-inflater + \ Separate the two buffers by enough space for both the compressed + \ and uncompressed copies of the data. 4x is overkill, but there + \ is plenty of space at load-base load-base to dma-buffer - load-base /nand-block + to data-buffer + load-base /nand-block 4 * + to data-buffer /nand-block /nand-page / to nand-pages/block ;
@@ -230,7 +233,8 @@ ( eblock# ) \ Asynchronous writes data-buffer over nand-pages/block * nand-pages/block " write-blocks-start" $call-nand ( eblock# ) -\ data-buffer over nand-pages/block * nand-pages/block " write-blocks" $call-nand drop ( eblock# ) +\ data-buffer over nand-pages/block * nand-pages/block " write-blocks" $call-nand ( eblock# #written ) +\ nand-pages/block <> " Write error" ?nand-abort ( eblock# ) swap-buffers ( eblock# )
dup to last-eblock# ( eblock# ) @@ -256,7 +260,7 @@ ['] include-file catch ?dup if ( x error ) nip .error then ( ) - previous + previous definitions show-done ?all-written close-nand-ihs
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2009-10-08 05:18:17 UTC (rev 1404) +++ cpu/x86/pc/olpc/via/fw.bth 2009-10-08 10:46:12 UTC (rev 1405) @@ -480,6 +480,7 @@ [then] fload ${BP}/cpu/x86/pc/olpc/via/padlock.fth \ Via security engine fload ${BP}/cpu/x86/pc/olpc/via/fsupdate.fth +fload ${BP}/cpu/x86/pc/olpc/via/fsverify.fth devalias fsdisk int:0
fload ${BP}/ofw/inet/sntp.fth
Modified: dev/mmc/sdhci/sdhci.fth =================================================================== --- dev/mmc/sdhci/sdhci.fth 2009-10-08 05:18:17 UTC (rev 1404) +++ dev/mmc/sdhci/sdhci.fth 2009-10-08 10:46:12 UTC (rev 1405) @@ -674,14 +674,21 @@ : wait-write-done ( -- ) writing? 0= if exit then ( limit )
- get-msecs d# 1000 + ( limit ) - begin get-status 9 rshift h# f and 7 = while ( limit ) + get-msecs d# 1000 + ( limit ) + begin get-status dup 9 rshift h# f and 7 = while ( limit status ) + drop ( limit ) dup get-msecs - 0< if ." SDHCI: wait-write-done timeout" cr abort then - repeat ( limit ) - drop ( ) + repeat ( limit status ) + nip ( status ) + dup h# fff9.8008 and if ( status ) + cr ." SD Error - status = " . cr + noop + else + drop + then
false to writing? ;
openfirmware@openfirmware.info