201027_08
authorhgs
Mon, 12 Jul 2010 14:24:01 +0100
changeset 202 9aca3be14c27
parent 199 189ece41fa29
child 220 14267bc009a6
child 231 75252ea6123b
201027_08
kernel/eka/drivers/medmmc/bgahsmmcptn.cpp
kernel/eka/drivers/medmmc/bgahsmmcptn.h
kernel/eka/drivers/medmmc/bgahsmmcptn.mmp
kernel/eka/drivers/medmmc/toc.cpp
kernel/eka/drivers/medmmc/toc.h
kernel/eka/include/e32ver.h
kernel/eka/release.txt
--- a/kernel/eka/drivers/medmmc/bgahsmmcptn.cpp	Fri Jul 09 13:13:20 2010 +0100
+++ b/kernel/eka/drivers/medmmc/bgahsmmcptn.cpp	Mon Jul 12 14:24:01 2010 +0100
@@ -17,9 +17,10 @@
 
 #include <emmcptn.h>
 #include "bgahsmmcptn.h"
-
-const TInt	  KDiskSectorShift		= 9;
-const TUint32 KPIOffsetFromMediaEnd = 1;
+#include "toc.h"
+//#define __DEBUG_PARTITIONS_
+//#define __DEBUG_CHECK_PARTITION_
+const TInt    KDiskSectorShift          = 9;
 
 class DBB5PartitionInfo : public DEMMCPartitionInfo
 	{
@@ -36,6 +37,7 @@
 	void SetPartitionEntry(TPartitionEntry* aEntry, TUint aFirstSector, TUint aNumSectors);
 
 private:
+	virtual TInt ReadPartition(TUint32 aPtOffset);
 	static void SessionEndCallBack(TAny* aSelf);
 		   void DoSessionEndCallBack();
 	virtual TInt DecodePartitionInfo();
@@ -49,10 +51,13 @@
 	TMMCard*		iCard;
 	TUint8* 		iIntBuf;
 	TUint32 		iPartitionAttributes[KMaxLocalDrives];
+	TBool           iCheckTOC;
+	Toc*            iTocPtr;
 	};
 
 DBB5PartitionInfo::DBB5PartitionInfo()
-  : iSessionEndCallBack(DBB5PartitionInfo::SessionEndCallBack, this)
+  : iSessionEndCallBack(DBB5PartitionInfo::SessionEndCallBack, this),
+    iCheckTOC(EFalse)
 	{
 	}
 
@@ -91,13 +96,19 @@
 	iPartitionInfo = &aInfo;
 	iCallBack = aCallBack;
 
+	// Preferred partition scheme is BB5, which is located in the last block of the media.
+    const TUint32 ptiOffset = (I64LOW(iCard->DeviceSize64() >> KDiskSectorShift)) - KPIOffsetFromMediaEnd;
+	return ReadPartition(ptiOffset);
+	}
+	
+TInt DBB5PartitionInfo::ReadPartition(TUint32 aPtOffset)
+    {
 	// If media driver is persistent (see EMediaDriverPersistent)
 	// the card may have changed since last power down, so reset CID
 	iSession->SetCard(iCard);
 
-	const TUint32 ptiOffset = (I64LOW(iCard->DeviceSize64() >> KDiskSectorShift)) - KPIOffsetFromMediaEnd;
-	iSession->SetupCIMReadBlock(ptiOffset, iIntBuf);
-
+	iSession->SetupCIMReadBlock(aPtOffset, iIntBuf);
+	
 	TInt r = iDriver->InCritical();
 	if (r == KErrNone)
 		r = iSession->Engage();
@@ -117,6 +128,25 @@
 		Info().iFileSystemId = KDriveFileNone;
 		Info().iDriveAtt |= KDriveAttHidden;
 		}
+	else if (aDrive.iPartitionType == KPartitionTypeRofs)
+		{
+		Info().iFileSystemId = KDriveFileSysROFS;
+		Info().iMediaAtt &= ~KMediaAttFormattable;
+		Info().iMediaAtt |= KMediaAttWriteProtected;
+		}
+	else if ((aDrive.iPartitionType == KPartitionTypeROM) ||
+			 (aDrive.iPartitionType == KPartitionTypeEmpty))
+		{
+		Info().iFileSystemId = KDriveFileNone;
+		Info().iMediaAtt &= ~KMediaAttFormattable;
+		Info().iMediaAtt |= KMediaAttWriteProtected;
+		}
+    else if ((aDrive.iPartitionType == KPartitionTypePartitionMagic) || //CPS/PMM
+             (aDrive.iPartitionType == KPartitionTypeSymbianCrashLog))
+        {
+        Info().iFileSystemId = KDriveFileNone;
+        Info().iMediaAtt |= KMediaAttFormattable;
+        }
 	else if ( PartitionIsFAT(aDrive.iPartitionType) || PartitionIsFAT32(aDrive.iPartitionType)	)
 		{		
 		Info().iDriveAtt |= iPartitionAttributes[aDrive.iPartitionNumber];
@@ -140,81 +170,200 @@
 	if (r == KErrNone)
 		r = DecodePartitionInfo();
 
-	iDriver->PartitionInfoComplete(r == KErrNone ? r : KErrNotReady);
+	if (!iCheckTOC)
+	    {        
+	    iDriver->PartitionInfoComplete(r == KErrNone ? r : KErrNotReady);
+	    }
 	}
 
 TInt DBB5PartitionInfo::DecodePartitionInfo()
 //
-// decode partition info that was read into internal buffer
+// Decode partition info that was read into internal buffer
 //
 	{
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">Mmc:PartitionInfo()"));
 	TUint partitionCount = iPartitionInfo->iPartitionCount = 0;
 
-	// For internal devices it is only valid to report up to 1 SWAP partition
-	TBool foundSwap = EFalse;
+	
+	if (iCheckTOC)
+	    {
+        // Try utilising the TOC (Table Of Contents) partitioning scheme 
+        const TText8* KRofsNames[KNoOfROFSPartitions] = { KTocRofs1Generic,
+                                                          KTocRofs2Generic,
+                                                          KTocRofs3Generic,
+                                                          KTocRofs4Generic,
+                                                          KTocRofs5Generic,                                                            
+                                                          KTocRofs6Generic,                                                            
+                                                          };
+                                        
+        STocItem item;
+        iTocPtr = reinterpret_cast<Toc*>(&iIntBuf[0]);
+        iTocPtr->iTocStartSector = KTocStartSector;
+        TInt r = KErrNone;
 
-	BGAHSMMCPTN_PI_STR *partitionTable = (BGAHSMMCPTN_PI_STR*)(&iIntBuf[0]);
+// USER Drive - Only 1        
+        r = iTocPtr->GetItemByName(KTocUserName, item); 
+        if (KErrNone == r)
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%X  Size = 0x%X", item.iFileName, item.iStart, item.iSize));
+            iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypeFAT16;           
+            iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64)item.iStart;                         
+            iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64)item.iSize;
+            iPartitionAttributes[partitionCount] = 0; // No Additional Attributes required.           
+            partitionCount++;
+            }   
+        
+// ROM Drive        
+        r = iTocPtr->GetItemByName(KTocRomGeneric, item); 
+        if (KErrNone == r)
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%x  Size = 0x%x", item.iFileName, item.iStart, item.iSize));
+            iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypeROM;           
+            iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) item.iStart + (KBB5HeaderSizeInSectors << KDiskSectorShift);                         
+            iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) item.iSize - (KBB5HeaderSizeInSectors << KDiskSectorShift);          
+            partitionCount++;
+            }
+        
+// ROFS            
+        for (TUint i = 0; i < KNoOfROFSPartitions; i++)
+            {
+            /* Search ROFSn item */            
+            r = iTocPtr->GetItemByName(KRofsNames[i], item);
+            if (r == KErrNone)
+                {
+                __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%X  Size = 0x%X", item.iFileName, item.iStart, item.iSize));
+                iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypeRofs;           
+                iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) item.iStart + (KBB5HeaderSizeInSectors << KDiskSectorShift);                         
+                iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) item.iSize - (KBB5HeaderSizeInSectors << KDiskSectorShift);
+                partitionCount++;
+                }
+            }         
 
-	// Verify that this is the Nokia partition table
-	if( memcompare( (TUint8*)&(partitionTable->iId[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 )
-		{
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("Nokia partition structure found"));
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->iId ));
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->iSector_size, partitionTable->iSector_size));
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->iMajor_ver));
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->iMinor_ver));
-		__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->iPartition_amount));
-		
-		
-		TUint8 PartitionType = 0;		
-		// Check Supported Version is present
-		if (partitionTable->iMajor_ver <= BGAHSMMCPTN_PI_VER_MAJOR)
-		    {
-            for( TUint8 index = 0; (index < partitionTable->iPartition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ )
-                {
-                if (partitionTable->iMinor_ver >= BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR)
-                    PartitionType = partitionTable->iPartitions[index].iPartition_type;
-                else                    
-                    PartitionType = partitionTable->iPartitions[index].iPartition_id;
+// CPS Drive - Only 1        
+        r = iTocPtr->GetItemByName(KTocCps, item); 
+        if (KErrNone == r)
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%X  Size = 0x%X", item.iFileName, item.iStart, item.iSize));
+            iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypePartitionMagic;           
+            iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) item.iStart;                         
+            iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) item.iSize;
+            partitionCount++;
+            }
+        
+// CRASH Drive - Only 1        
+        r = iTocPtr->GetItemByName(KTocCrashLog, item); 
+        if (KErrNone == r)
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%X  Size = 0x%X", item.iFileName, item.iStart, item.iSize));
+            iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypeSymbianCrashLog;           
+            iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) item.iStart;                         
+            iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) item.iSize;
+            partitionCount++;
+            }
+        
+// SWAP Partition - Only 1        
+        r = iTocPtr->GetItemByName(KTocSwap, item); 
+        if (KErrNone == r)
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("[MD  :   ] (%11s) in TOC found : Start addr = 0x%X  Size = 0x%X", item.iFileName, item.iStart, item.iSize));
+            iPartitionInfo->iEntry[partitionCount].iPartitionType     = KPartitionTypePagedData;           
+            iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) item.iStart;                         
+            iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) item.iSize;
+            partitionCount++;
+            }                
+
+#ifdef __DEBUG_PARTITIONS_
+        for (TInt i = 0; i<partitionCount; i++)
+            {
+            Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[i].iPartitionType);                
+            Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[i].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[i].iPartitionBaseAddr >> KDiskSectorShift));                
+            Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[i].iPartitionLen, iPartitionInfo->iEntry[i].iPartitionLen >> KDiskSectorShift);
+            Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[i]);
+            Kern::Printf(" ");
+            }
+#endif //__DEBUG_PARTITIONS_
+        
+        iCheckTOC = EFalse;
+	    }
+	else
+	    {
+        // Try utilising the BB5 partitioning scheme	
+        BGAHSMMCPTN_PI_STR *partitionTable = (BGAHSMMCPTN_PI_STR*)(&iIntBuf[0]);
+    
+        // Verify that this is the Nokia partition table
+        if( memcompare( (TUint8*)&(partitionTable->iId[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 )
+            {
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("Nokia partition structure found"));
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->iId ));
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->iSector_size, partitionTable->iSector_size));
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->iMajor_ver));
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->iMinor_ver));
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->iPartition_amount));
             
-                if( (partitionTable->iPartitions[index].iSize > 0) &&
-                    ( PartitionIsFAT(PartitionType) ||
-                      PartitionIsFAT32(PartitionType) ||
-                     (KPartitionTypePagedData == PartitionType && !foundSwap) ) )
-                    {                   
-                    iPartitionInfo->iEntry[partitionCount].iPartitionType	  = PartitionType;                    
-                    iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) partitionTable->iPartitions[index].iStart_sector << KDiskSectorShift;
-                    iPartitionInfo->iEntry[partitionCount].iPartitionLen	  = (Int64) partitionTable->iPartitions[index].iSize << KDiskSectorShift;
-                    iPartitionAttributes[partitionCount]					  = partitionTable->iPartitions[index].iPartition_attributes;
-    
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->iPartitions[index].iStart_sector ));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift)));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->iPartitions[index].iSize ));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount]));
-                    __KTRACE_OPT(KPBUSDRV, Kern::Printf(" "));
-    
-                    if(KPartitionTypePagedData == PartitionType)
-                        {
-                        foundSwap = ETrue;
+            TUint8 partitionType = 0;		
+            // Check Supported Version is present
+            if (partitionTable->iMajor_ver <= BGAHSMMCPTN_PI_VER_MAJOR)
+                {
+                for( TUint8 index = 0; (index < partitionTable->iPartition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ )
+                    {
+                    if (partitionTable->iMinor_ver >= BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR)
+                        partitionType = partitionTable->iPartitions[index].iPartition_type;
+                    else                    
+                        partitionType = partitionTable->iPartitions[index].iPartition_id;
+                
+                    // FAT/PMM/CPS/SWAP/CORE/ROFS/CRASH
+                    if( (partitionTable->iPartitions[index].iSize > 0) &&
+                        ( PartitionIsFAT(partitionType) ||
+                          PartitionIsFAT32(partitionType) ||
+                         (KPartitionTypeSymbianCrashLog == partitionType) ||
+                         (KPartitionTypePartitionMagic == partitionType) || //CPS/PMM
+                         (KPartitionTypeRofs == partitionType) || 
+                         (KPartitionTypeEmpty == partitionType) ||
+                         (KPartitionTypeROM == partitionType) ||
+                         (KPartitionTypePagedData == partitionType) ) )
+                        {                   
+                        iPartitionInfo->iEntry[partitionCount].iPartitionType	  = partitionType;
+                        iPartitionAttributes[partitionCount]                      = partitionTable->iPartitions[index].iPartition_attributes;
+                        
+                        // ROM/ROFS partitions have a BB5 checksum header that must be offset for the Symbian OS.
+                        const TUint32 KstartOffset = ((KPartitionTypeROM == partitionType) || (KPartitionTypeRofs == partitionType) || (KPartitionTypeEmpty == partitionType)) ? KBB5HeaderSizeInSectors : 0;
+                        
+                        iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) ((partitionTable->iPartitions[index].iStart_sector + KstartOffset) << KDiskSectorShift);
+                        iPartitionInfo->iEntry[partitionCount].iPartitionLen      = (Int64) ((partitionTable->iPartitions[index].iSize - KstartOffset) << KDiskSectorShift);
+        
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->iPartitions[index].iStart_sector ));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift)));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->iPartitions[index].iSize ));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount]));
+                    	__KTRACE_OPT(KPBUSDRV, Kern::Printf(" "));
+        
+                        partitionCount++;
                         }
-    
-                    partitionCount++;
                     }
-                }
-            } 
-		} 
-
+                } 
+            }
+        else
+            {
+            __KTRACE_OPT(KPBUSDRV, Kern::Printf("BGAHSMMC signature not found - try TOC layout"));
+            iCheckTOC = ETrue;
+            
+            TInt r = ReadPartition(KTocStartSector);
+            return r;
+            }
+	    }
+	
+	
 	// Validate partition address boundaries
 	if(partitionCount == 0)
 		{
 		__KTRACE_OPT(KPBUSDRV, Kern::Printf("Mmc: No supported partitions found!"));
 		return KErrCorrupt;
 		}
+#ifdef __DEBUG_CHECK_PARTITION_	
 	else
 		{
 		// at least one entry for a supported partition found
@@ -242,6 +391,7 @@
 				}
 			}
 		}
+#endif // _DEBUG_CHECK_PARTITION_
 
 	iPartitionInfo->iPartitionCount = partitionCount;
 	iPartitionInfo->iMediaSizeInBytes = iCard->DeviceSize64();
--- a/kernel/eka/drivers/medmmc/bgahsmmcptn.h	Fri Jul 09 13:13:20 2010 +0100
+++ b/kernel/eka/drivers/medmmc/bgahsmmcptn.h	Mon Jul 12 14:24:01 2010 +0100
@@ -33,7 +33,7 @@
 /* Partition type field supported from version 1.1 onwards */
 #define BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR    1
 
-#define BGAHSMMCPTN_LAST_DRIVE		7 /* MMC1_DRIVECOUNT - defined in variantmediadef.h */
+#define BGAHSMMCPTN_LAST_DRIVE		16 /* MMC1_DRIVECOUNT - defined in variantmediadef.h */
 
 typedef struct
 {
@@ -62,4 +62,7 @@
 
 #define BGAHSMMCPTN_PI_STR_SIZE sizeof( BGAHSMMCPTN_PI_STR )
 
+const TUint32 KBB5HeaderSizeInSectors   = 8;
+const TUint32 KPIOffsetFromMediaEnd     = 1;
+
 #endif /*BGAHSMMCPTN_H*/
--- a/kernel/eka/drivers/medmmc/bgahsmmcptn.mmp	Fri Jul 09 13:13:20 2010 +0100
+++ b/kernel/eka/drivers/medmmc/bgahsmmcptn.mmp	Mon Jul 12 14:24:01 2010 +0100
@@ -22,6 +22,7 @@
 systeminclude	../../include/drivers
 
 source			bgahsmmcptn.cpp
+source			toc.cpp
 
 library			epbusmmc.lib
 library			elocd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/medmmc/toc.cpp	Mon Jul 12 14:24:01 2010 +0100
@@ -0,0 +1,71 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// TOC Partition Management for Embedded MMC devices
+// 
+//
+
+#include "toc.h"
+
+
+/*
+ * Search entry in TOC with aName as part of ItemName.
+ */
+TInt Toc::GetItemByName(const TText8* aName, STocItem& aItem)
+    {
+    if ( aName == NULL )
+        {
+        return KErrNotFound;
+        }
+    
+	// calculate length for name to be searched
+    TUint nameLen = 0;
+    for (; nameLen < KMaxItemNameLen && aName[nameLen] != 0; nameLen++) {};
+        
+	if ( !nameLen ) 
+	    return KErrGeneral; // zero length or Blank Name
+
+	// check all items in TOC	 
+	for (TUint i=0; i < KMaxNbrOfTocItems && iTOC[i].iStart != KEndOfToc; i++)
+		{	
+		// calculate length of current item 
+        TUint fileNameLen = 0;
+		for (; fileNameLen < KMaxItemNameLen && iTOC[i].iFileName[fileNameLen] != 0; fileNameLen++) {};
+		    
+		if ( fileNameLen < nameLen ) 
+		    continue;  // file name too short
+	
+		// compare Item with aName
+		for (TUint k = 0; k <= (fileNameLen - nameLen); k++ )				
+			{
+            TUint l=0;
+            for (; l < nameLen; l++ )
+                {
+                if ( aName[l] != iTOC[i].iFileName[k+l] ) 
+                    break;
+                }
+
+            if ( l == nameLen )
+                {
+                // item found
+                aItem = iTOC[i];
+                aItem.iStart += (iTocStartSector << KSectorShift);
+                return KErrNone;
+                }
+			}		
+		}
+	
+	return KErrNotFound;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/medmmc/toc.h	Mon Jul 12 14:24:01 2010 +0100
@@ -0,0 +1,89 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// TOC Partition Management for Embedded MMC devices
+// 
+//
+
+
+#ifndef __EMMC_TOC_H__
+#define __EMMC_TOC_H__
+
+#include <emmcptn.h>
+
+// TOC item
+const TUint  KMaxItemNameLen = 12;
+
+struct STocItem
+    {
+    TUint32 iStart;
+    TUint32 iSize;
+    TUint32 iFlags;
+    TUint32 iAlign;
+    TUint32 iLoadAddress;
+    TText8  iFileName[KMaxItemNameLen];
+	};
+
+//- Constants ---------------------------------------------------------------
+
+const TUint32 KTocStartSector       = 1280; // TOC starts from 0xA0000 / 0x200
+
+const TText8  KTocRofsName[]        = "SOS-ROFS";
+const TText8  KTocRofsName1[]       = "SOS+ROFS"; 
+const TText8  KTocRofsExtName[]     = "SOS-ROFX";
+const TText8  KTocRofsGeneric[]     = "ROFS";  
+const TText8  KTocRomGeneric[]      = "SOS+CORE";  
+
+const TText8  KTocCps[]             = "SOS-CPS";
+const TText8  KTocRofsExtGeneric[]  = "ROFX";    
+const TText8  KTocSwap[]            = "SOS-SWAP";
+const TText8  KTocUserName[]        = "SOS-USER";
+const TText8  KTocCrashLog[]        = "SOS-CRASH";
+const TText8  KTocToc[]             = "TOC";
+const TText8  KTocSosToc[]          = "SOS-TOC";
+
+const TUint8  KMaxNbrOfTocItems     = 16;
+const TUint8  KXMaxNbrOfTocItems    = 16;
+const TUint32 KEndOfToc             = 0xFFFFFFFFUL;
+
+const TText8  KTocRofs1Generic[]    = "ROFS1";
+const TText8  KTocRofs2Generic[]    = "ROFS2";
+const TText8  KTocRofs3Generic[]    = "ROFS3"; 
+const TText8  KTocRofs4Generic[]    = "ROFS4";
+const TText8  KTocRofs5Generic[]    = "ROFS5";
+const TText8  KTocRofs6Generic[]    = "ROFS6";
+const TUint   KNoOfROFSPartitions   = 6;
+
+const TInt    KSectorShift          = 9;
+/**
+TOC access for kernel side clients.
+*/
+class Toc
+    {
+    public:
+        /**
+         *  Search entry in TOC with aName as part of ItemName.
+         *  @return KErrNone if successful 
+         */
+        TInt GetItemByName(const TText8* aName, STocItem& aItem);
+		
+	public:
+		/**	Array for keep whole TOC */
+		STocItem iTOC[KMaxNbrOfTocItems];
+				
+		/** Offset of TOC from beginning*/
+		TUint32  iTocStartSector;
+    };
+
+#endif // __EMMC_TOC_H__
+
--- a/kernel/eka/include/e32ver.h	Fri Jul 09 13:13:20 2010 +0100
+++ b/kernel/eka/include/e32ver.h	Mon Jul 12 14:24:01 2010 +0100
@@ -28,7 +28,7 @@
 
 const TInt KE32MajorVersionNumber=2;
 const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=3106;
+const TInt KE32BuildVersionNumber=3107;
 
 const TInt KMachineConfigurationMajorVersionNumber=1;
 const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/release.txt	Fri Jul 09 13:13:20 2010 +0100
+++ b/kernel/eka/release.txt	Mon Jul 12 14:24:01 2010 +0100
@@ -1,3 +1,11 @@
+Version 2.00.3107
+=================
+(Made by famustaf 07/07/2010)
+
+1.	necliffo
+	1.	REQ 428-72 Partition support for eMMC-only platforms
+
+
 Version 2.00.3106
 =================
 (Made by famustaf 01/07/2010)