kernel/eka/drivers/medmmc/medmmc.cpp
branchRCL_3
changeset 294 039a3e647356
parent 257 3e88ff8f41d5
--- a/kernel/eka/drivers/medmmc/medmmc.cpp	Wed Sep 15 13:42:27 2010 +0300
+++ b/kernel/eka/drivers/medmmc/medmmc.cpp	Wed Oct 13 16:04:24 2010 +0300
@@ -797,8 +797,17 @@
 		}
 	else
 		{
-		TPtrC8 zeroDes(NULL, 0);
-		r = iCurrentReq->WriteRemote(&zeroDes,0);
+#if defined(__DEMAND_PAGING__) && !defined(__WINS__)
+		if (DMediaPagingDevice::PageInRequest(*iCurrentReq))
+			{
+			r = iCurrentReq->WriteToPageHandler(NULL, 0, 0);
+			}
+		else
+#endif	// __DEMAND_PAGING__
+			{
+			TPtrC8 zeroDes(NULL, 0);
+			r = iCurrentReq->WriteRemote(&zeroDes,0);
+			}
 		}
 
 	// error occurred or read all from cache so complete immediately
@@ -2889,7 +2898,7 @@
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
 	
-	if ( (iCurrentReq->DriverFlags() & RLocalDrive::ELocDrvDirectIO) || iCurrentReq->IsPhysicalAddress()
+	if ( iCurrentReq->IsPhysicalAddress()
 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
 #endif //DEMAND_PAGING 
@@ -2950,7 +2959,12 @@
 	TUint usrOfst = I64LOW(iReqCur - iReqStart);
 
 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY1, "Begin writing user data" );
-	r = iCurrentReq->WriteRemote(&extrView,usrOfst);
+#if defined(__DEMAND_PAGING__) && !defined(__WINS__)
+	if (DMediaPagingDevice::PageInRequest(*iCurrentReq))
+		r=iCurrentReq->WriteToPageHandler((TUint8 *)(&extrView[0]), len, usrOfst);
+	else
+#endif	// __DEMAND_PAGING__
+		r = iCurrentReq->WriteRemote(&extrView,usrOfst);
 	
 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY2, "End writing user data" );
 
@@ -2961,10 +2975,19 @@
 TInt DMmcMediaDriverFlash::ReadDataFromUser(TDes8& aDes, TInt aOffset)
 	{
 	OstTraceExt2(TRACE_FLOW, DMMCMEDIADRIVERFLASH_READDATAFROMUSER_ENTRY ,"DMmcMediaDriverFlash::ReadDataFromUser;aOffset=%d;this=%x", aOffset, (TUint) this);
-
-	TInt r = iCurrentReq->ReadRemote(&aDes, aOffset);
-
-	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
+	TInt r = KErrNotSupported;
+#ifndef __WINS__
+	if (DMediaPagingDevice::PageOutRequest(*iCurrentReq))
+	    {
+		r = iCurrentReq->ReadFromPageHandler((TAny*) aDes.Ptr(), aDes.MaxLength(), aOffset);
+		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
+		return r;
+	    }
+	else
+#endif // #ifndef __WINS__
+		r = iCurrentReq->ReadRemote(&aDes, aOffset);
+	
+	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT2, this, r );
 	return r;
 	}
 
@@ -3677,7 +3700,6 @@
 		c.iSize = drive.iPartitionLen;
 		c.iPartitionType = drive.iPartitionType;	
 		c.iHiddenSectors = (TUint) (drive.iPartitionBaseAddr >> KDiskSectorShift);
-		SetTotalSizeInBytes(c);
 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_REQUEST_EXIT1, this, r );
 		return r;
 		}