j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: wmb Date: 2008-01-05 23:43:38 +0100 (Sat, 05 Jan 2008) New Revision: 768
Modified: cpu/x86/pc/olpc/copynand.fth dev/olpc/cafenand/badblock.fth Log: OLPC trac 5870 - Improve error handling in NAND driver.
Modified: cpu/x86/pc/olpc/copynand.fth =================================================================== --- cpu/x86/pc/olpc/copynand.fth 2008-01-05 01:06:40 UTC (rev 767) +++ cpu/x86/pc/olpc/copynand.fth 2008-01-05 22:43:38 UTC (rev 768) @@ -269,7 +269,8 @@ #image-eblocks 0 ?do (cr i . read-image-block - load-base /nand-block + " read-next-block" $call-nand ( ) + load-base /nand-block + " read-next-block" $call-nand ( end? ) + " More image file blocks than NAND blocks" ?nand-abort ( ) load-base load-base /nand-block + /nand-block comp if ( ) cr ." Miscompare in block starting at page# " ( ) " scan-page#" $call-nand .x cr ( ) @@ -310,8 +311,8 @@ #crc-records 0 ?do (cr i .
- load-base " read-next-block" $call-nand ( ) - + load-base " read-next-block" $call-nand ( end? ) + " More CRC records than NAND blocks" ?nand-abort ( ) load-base /nand-block $crc i >crc l@ ( actual-crc expected-crc ) 2dup <> if ( actual-crc expected-crc ) cr ." CRC miscompare - expected " . ." got " . ( )
Modified: dev/olpc/cafenand/badblock.fth =================================================================== --- dev/olpc/cafenand/badblock.fth 2008-01-05 01:06:40 UTC (rev 767) +++ dev/olpc/cafenand/badblock.fth 2008-01-05 22:43:38 UTC (rev 768) @@ -162,17 +162,17 @@ ;
\ Read the bad block table from NAND to memory -: read-bbt-pages ( page# -- ) +: read-bbt-pages ( page# -- error? ) bbt swap /bbt /page / ( adr page# #pages ) \ Can't use read-blocks because of block-bad? dependency bounds ?do ( adr ) dup i read-page if ( adr ) ." BBT has uncorrectable errors" cr - abort + drop true unloop exit then ( adr ) /page + ( adr' ) loop ( adr ) - drop + drop false ;
\ Find a bad block table @@ -181,8 +181,8 @@ alloc-bbt find-existing-bbt
- bbt0 if bbt0 read-bbt-pages exit then - bbt1 if bbt1 read-bbt-pages exit then + bbt0 if bbt0 read-bbt-pages 0= if exit then then + bbt1 if bbt1 read-bbt-pages 0= if exit then then
release-bbt ; @@ -348,7 +348,7 @@
headers
-: (next-page#) ( -- true | page# false ) +: next-page# ( -- true | page# false ) partition-size scan-page# pages/eblock + ?do i block-bad? 0= if i to scan-page# @@ -357,9 +357,6 @@ pages/eblock +loop true ; -: next-page# ( -- page# ) - (next-page#) if ." No more good NAND blocks" cr abort then -;
0 value test-page
@@ -397,7 +394,7 @@ ;
: copy-block ( adr -- page# error? ) - begin (next-page#) 0= while ( adr page# ) + begin next-page# 0= while ( adr page# ) 2dup copy&check if nip partition-start + false exit then ( adr page# ) \ Error; retry once dup erase-block ( adr page# ) @@ -417,21 +414,22 @@ r> drop ; : put-cleanmarkers ( show-xt -- ) - begin (next-page#) 0= while ( show-xt page# ) + begin next-page# 0= while ( show-xt page# ) dup put-cleanmarker ( show-xt page# ) partition-start + pages/eblock / over execute ( show-xt ) repeat ( show-xt ) drop ;
-: read-next-block ( adr -- ) - next-page# pages/eblock bounds ?do ( adr ) +: read-next-block ( adr -- no-more? ) + next-page# if drop true exit then ( adr page# ) + pages/eblock bounds ?do ( adr ) dup i read-page if ( adr ) ." Uncorrectable error in page 0x" i .x cr then /page + ( adr' ) loop ( adr ) - drop ( ) + drop false ( flag ) ;
\ : start-verify ( -- )