Add patches from Nick Banes for compatability
authorcharles <charles>
Wed, 16 Mar 2005 04:00:36 +0000 (04:00 +0000)
committercharles <charles>
Wed, 16 Mar 2005 04:00:36 +0000 (04:00 +0000)
yaffs_ecc.c
yaffs_fs.c
yaffs_guts.c
yaffs_tagscompat.c

index 8eaffa012941d08f32e219d120c1b7f007b3df68..820041a2b633deeaa60029f1f43668f6fcd8a815 100644 (file)
@@ -29,7 +29,7 @@
 // Bit 0 of each entry indicates whether the entry has an odd or even parity, and therefore
 // this bytes influence on the line parity.
 
 // Bit 0 of each entry indicates whether the entry has an odd or even parity, and therefore
 // this bytes influence on the line parity.
 
-const char *yaffs_ecc_c_version = "$Id: yaffs_ecc.c,v 1.1 2004-11-03 08:14:07 charles Exp $";
+const char *yaffs_ecc_c_version = "$Id: yaffs_ecc.c,v 1.2 2005-03-16 04:00:36 charles Exp $";
 
 
 #include "yaffs_ecc.h"
 
 
 #include "yaffs_ecc.h"
@@ -265,9 +265,15 @@ int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes, yaffs_ECCOther *
                // swap the bytes to correct for the wrong order
                unsigned char t;
                
                // swap the bytes to correct for the wrong order
                unsigned char t;
                
+#if 0 // NCB
                t = d0;
                d0 = d1;
                d1 = t;
                t = d0;
                d0 = d1;
                d1 = t;
+#else
+               t = cDelta;
+               cDelta = lDelta;
+               lDelta = t;
+#endif
 #endif
                
                bit = 0;
 #endif
                
                bit = 0;
index f25bccc944518da0581ec9fe8cc112d49c139ba3..569f22518604fe8cb1a44239c25877667d32b92e 100644 (file)
  */
 
 
  */
 
 
-const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.1 2004-12-17 04:39:04 charles Exp $";
+const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.2 2005-03-16 04:00:36 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 
 extern const char *yaffs_guts_c_version;
 
 
+
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -63,7 +64,6 @@ extern const char *yaffs_guts_c_version;
 
 #endif
 
 
 #endif
 
-
 #include <asm/uaccess.h>
 
 #include "yportenv.h"
 #include <asm/uaccess.h>
 
 #include "yportenv.h"
@@ -72,8 +72,8 @@ extern const char *yaffs_guts_c_version;
 
 
 
 
 
 
-//unsigned yaffs_traceMask = YAFFS_TRACE_ALWAYS | YAFFS_TRACE_BAD_BLOCKS;
-unsigned yaffs_traceMask = 0xFFFFFFFF;
+unsigned yaffs_traceMask = YAFFS_TRACE_ALWAYS | YAFFS_TRACE_BAD_BLOCKS;
+//unsigned yaffs_traceMask = 0xFFFFFFFF;
 
 
 #ifdef CONFIG_YAFFS_RAM_ENABLED
 
 
 #ifdef CONFIG_YAFFS_RAM_ENABLED
index 2f899f3ec516e21eca987ce8e2e064404cf1701b..740a2563dd9ed3261e631d2bee0eb7cd62a5647a 100644 (file)
@@ -14,7 +14,7 @@
  */
  //yaffs_guts.c
 
  */
  //yaffs_guts.c
 
-const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.4 2004-12-17 04:39:04 charles Exp $";
+const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.5 2005-03-16 04:00:36 charles Exp $";
 
 #include "yportenv.h"
 
 
 #include "yportenv.h"
 
@@ -489,7 +489,8 @@ static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev,int chunkInNAND
        __u8 *data = yaffs_GetTempBuffer(dev,__LINE__);
        yaffs_ExtendedTags tags;
 
        __u8 *data = yaffs_GetTempBuffer(dev,__LINE__);
        yaffs_ExtendedTags tags;
 
-       dev->readChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
+// NCB         dev->readChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
+       yaffs_ReadChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
        
        if(!yaffs_CheckFF(data,dev->nBytesPerChunk) || tags.chunkUsed)
        {
        
        if(!yaffs_CheckFF(data,dev->nBytesPerChunk) || tags.chunkUsed)
        {
index d7c0fd1144540320fef6ce62418fa885267c9d89..98b7b0420a89b1d072ab7d163cdcf92ae7161eb1 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
- * $Id: yaffs_tagscompat.c,v 1.1 2004-11-03 08:14:07 charles Exp $
+ * $Id: yaffs_tagscompat.c,v 1.2 2005-03-16 04:00:36 charles Exp $
  */
 
 #include "yaffs_guts.h"
  */
 
 #include "yaffs_guts.h"
@@ -587,6 +587,13 @@ int yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkI
                tags.byteCount = eTags->byteCount;
                tags.serialNumber = eTags->serialNumber;
                
                tags.byteCount = eTags->byteCount;
                tags.serialNumber = eTags->serialNumber;
                
+// NCB
+               if (!dev->useNANDECC && data)
+               {
+                   yaffs_CalcECC(data,&spare);
+               }
+
+// /NCB
                 yaffs_LoadTagsIntoSpare(&spare,&tags);
                
        }
                 yaffs_LoadTagsIntoSpare(&spare,&tags);
                
        }
@@ -602,8 +609,21 @@ int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunk
        yaffs_Tags tags;
        yaffs_ECCResult eccResult;
        
        yaffs_Tags tags;
        yaffs_ECCResult eccResult;
        
+// NCB
+     static yaffs_Spare spareFF;
+     static int init;
+     
+     if(!init)
+     {
+            memset(&spareFF,0xFF,sizeof(spareFF));
+            init = 1;
+     }
+// /NCB
        if(yaffs_ReadChunkFromNAND(dev,chunkInNAND,data,&spare,&eccResult,1))
        {
        if(yaffs_ReadChunkFromNAND(dev,chunkInNAND,data,&spare,&eccResult,1))
        {
+// added NCB - eTags may be NULL
+               if (eTags) {
+
                 int deleted = (yaffs_CountBits(spare.pageStatus) < 7) ? 1 : 0;
                        
                 yaffs_GetTagsFromSpare(dev,&spare,&tags);
                 int deleted = (yaffs_CountBits(spare.pageStatus) < 7) ? 1 : 0;
                        
                 yaffs_GetTagsFromSpare(dev,&spare,&tags);
@@ -616,6 +636,10 @@ int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunk
                 eTags->eccResult = eccResult;
                 eTags->blockBad = 0; // We're reading it therefore it is not a bad block
                 
                 eTags->eccResult = eccResult;
                 eTags->blockBad = 0; // We're reading it therefore it is not a bad block
                 
+// NCB added 18/2/2005
+                eTags->chunkUsed = (memcmp(&spareFF,&spare,sizeof(spareFF)) != 0) ? 1:0;
+               }
+                
                 return YAFFS_OK;
        }
        else
                 return YAFFS_OK;
        }
        else