[OpenBIOS] r769 - dev/olpc/cafenand

svn at openbios.org svn at openbios.org
Sun Jan 6 00:37:48 CET 2008


Author: wmb
Date: 2008-01-06 00:37:48 +0100 (Sun, 06 Jan 2008)
New Revision: 769

Modified:
   dev/olpc/cafenand/badblock.fth
   dev/olpc/cafenand/redboot.fth
Log:
OLPC trac 5870 - More NAND error handling improvements.


Modified: dev/olpc/cafenand/badblock.fth
===================================================================
--- dev/olpc/cafenand/badblock.fth	2008-01-05 22:43:38 UTC (rev 768)
+++ dev/olpc/cafenand/badblock.fth	2008-01-05 23:37:48 UTC (rev 769)
@@ -27,6 +27,7 @@
 
 \ Returns true if the block containing page# is bad
 : block-bad?  ( page# -- flag )
+   bbt 0=  if  drop false exit  then
    >bbt              ( adr mask )
    tuck swap c@ and  ( mask masked-byte )
    <>
@@ -184,6 +185,9 @@
    bbt0  if  bbt0  read-bbt-pages 0=  if  exit  then  then
    bbt1  if  bbt1  read-bbt-pages 0=  if  exit  then  then
 
+   bbt0 bbt1 or  if
+      ." Both bad block tables are unreadable" cr
+   then
    release-bbt
 ;
 
@@ -234,7 +238,7 @@
 \ Get the existing bad block table, or make a new one if necessary
 : get-bbt  ( -- )
    get-existing-bbt
-   bbt 0=  if
+   bbt0 bbt1 or  0=  if
       ." No bad block table; making one" cr
       make-bbt
    then
@@ -306,7 +310,7 @@
 : (wipe)  ( 'show-bad 'show-erased 'show-bbt -- )
    partition# 0=  if
       get-existing-bbt
-      bbt 0=  if
+      bbt0 bbt1 or  0=  if
          \ If there is no existing bad block table, make one from factory info
          make-bbt
       then                    ( 'show-bad 'show-erased 'show-bbt )

Modified: dev/olpc/cafenand/redboot.fth
===================================================================
--- dev/olpc/cafenand/redboot.fth	2008-01-05 22:43:38 UTC (rev 768)
+++ dev/olpc/cafenand/redboot.fth	2008-01-05 23:37:48 UTC (rev 769)
@@ -17,23 +17,12 @@
 d# 256 constant /partition-entry
 d# 8 constant max#partitions
 
-: partition-map-page#  ( -- page# )
-[ifdef] notdef
-   bbt1  if
-      bbt1  bbt0  if  bbt0 min  then           ( bbtn )
-   else                                        ( )
-      bbt0 dup 0= abort" No Bad Block Table"   ( bbt0 )
-   then                                        ( last-bbt-page# )
-   begin  pages/eblock - dup  while            ( part-page# )
-      dup block-bad?  0=  if  exit  then       ( part-page# )
-   repeat
-[else]
+: partition-map-page#  ( -- true | page# false )
    h# 10 pages/eblock *  0  do
-      i block-bad? 0=  if  i unloop exit  then
+      i block-bad? 0=  if  i false unloop exit  then
    pages/eblock +loop
-[then]
-
-   true abort" No place for partition map"
+   ." No place for partition map"
+   true
 ;
 
 : (#partitions)  ( adr -- n )
@@ -55,11 +44,11 @@
 
 0 instance value #partitions
 : read-partmap  ( -- )
-   part-buf  partition-map-page#
+   part-buf  partition-map-page#  if  exit  then
    partition-start >r  0 to partition-start
    read-page
    r> to partition-start
-   if  true exit  then
+   if  exit  then
    part-buf (#partitions)  to #partitions
 ;
 




More information about the OpenBIOS mailing list