kernel/eka/drivers/medmmc/medmmc.cpp
branchRCL_3
changeset 147 bbf8bed59bcb
parent 117 5b5d147c7838
child 249 a179b74831c9
equal deleted inserted replaced
117:5b5d147c7838 147:bbf8bed59bcb
   757 	
   757 	
   758 	const TInt64 pos(iCurrentReq->Pos());
   758 	const TInt64 pos(iCurrentReq->Pos());
   759 	TUint32 length(I64LOW(iCurrentReq->Length()));
   759 	TUint32 length(I64LOW(iCurrentReq->Length()));
   760 
   760 
   761 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length));
   761 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length));
   762 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=0x%lx; Length=0x%x", (TUint) pos, (TUint) length);
   762 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=%x:%x; Length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
   763 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse));
   763 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse));
   764 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart));
   764 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart));
   765 	__ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive));
   765 	__ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive));
   766 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDREnd));
   766 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDREnd));
   767 
   767 
   828 // read into iIntBuf. iIntBuf can be set to a cached entry or to the minor buffer.  It is
   828 // read into iIntBuf. iIntBuf can be set to a cached entry or to the minor buffer.  It is
   829 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used.
   829 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used.
   830 //
   830 //
   831 	{
   831 	{
   832 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this );
   832 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this );
   833 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=0x%lx; length=0x%x", (TUint) iCurrentReq->Pos(), (TUint) I64LOW(iCurrentReq->Length()));
   833 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=%x:%x; length=0x%x", (TUint) I64HIGH(iCurrentReq->Pos()), (TUint) I64LOW(iCurrentReq->Pos()) ,(TUint) I64LOW(iCurrentReq->Length()));
   834 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength));
   834 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength));
   835 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
   835 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
   836 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
   836 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
   837 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd));
   837 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd));
   838 	__ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached));
   838 	__ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached));
   894 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used.
   894 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used.
   895 //
   895 //
   896 	{
   896 	{
   897 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this );
   897 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this );
   898 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur)));
   898 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur)));
   899 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
   899 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
   900 	__ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart));
   900 	__ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart));
   901 	__ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive));
   901 	__ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive));
   902 	__ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd));
   902 	__ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd));
   903 	__ASSERT_CACHE(GetCachedBlock(iReqCur & ~iBlkMsk) == 0, Panic(ELRCached));
   903 	__ASSERT_CACHE(GetCachedBlock(iReqCur & ~iBlkMsk) == 0, Panic(ELRCached));
   904 	__ASSERT_DEBUG(iSession != NULL, Panic(ECFSessPtrNull));
   904 	__ASSERT_DEBUG(iSession != NULL, Panic(ECFSessPtrNull));
   955 // It is assumed that before this function is called that 
   955 // It is assumed that before this function is called that 
   956 // ReadDataUntilCacheExhausted() has been used.
   956 // ReadDataUntilCacheExhausted() has been used.
   957 //
   957 //
   958 	{
   958 	{
   959 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this );
   959 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this );
   960 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
   960 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
   961 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength));
   961 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength));
   962 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
   962 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
   963 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
   963 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
   964 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd));
   964 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd));
   965 	__ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached));
   965 	__ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached));
  1047 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOWRITE_ENTRY, this );
  1047 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOWRITE_ENTRY, this );
  1048 	const TInt64 pos = iCurrentReq->Pos();
  1048 	const TInt64 pos = iCurrentReq->Pos();
  1049 	const TUint32 length = I64LOW(iCurrentReq->Length());
  1049 	const TUint32 length = I64LOW(iCurrentReq->Length());
  1050 
  1050 
  1051 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length));
  1051 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length));
  1052 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
  1052 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
  1053 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse));
  1053 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse));
  1054 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart));
  1054 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart));
  1055 	__ASSERT_DEBUG(length > 0, Panic(EDWNotPositive));
  1055 	__ASSERT_DEBUG(length > 0, Panic(EDWNotPositive));
  1056 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDWEnd));
  1056 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDWEnd));
  1057 
  1057 
  1082 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOFORMAT_ENTRY, this );
  1082 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOFORMAT_ENTRY, this );
  1083 	const TInt64 pos = iCurrentReq->Pos();
  1083 	const TInt64 pos = iCurrentReq->Pos();
  1084 	const TUint32 length = I64LOW(iCurrentReq->Length());
  1084 	const TUint32 length = I64LOW(iCurrentReq->Length());
  1085 
  1085 
  1086 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length));
  1086 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length));
  1087 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
  1087 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
  1088 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse));
  1088 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse));
  1089 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart));
  1089 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart));
  1090 	__ASSERT_DEBUG(length > 0, Panic(EDFNotPositive));
  1090 	__ASSERT_DEBUG(length > 0, Panic(EDFNotPositive));
  1091 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDFEnd));
  1091 	__ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDFEnd));
  1092 
  1092 
  1123 // starts writes from DoWrite(), DoFormat() and the session end DFC.  This function does not
  1123 // starts writes from DoWrite(), DoFormat() and the session end DFC.  This function does not
  1124 // maintain the iReq* instance variables.  It sets iIntBuf, iPhysStart and iPhysEnd.
  1124 // maintain the iReq* instance variables.  It sets iIntBuf, iPhysStart and iPhysEnd.
  1125 //
  1125 //
  1126 	{
  1126 	{
  1127 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this );
  1127 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this );
  1128 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
  1128 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
  1129 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength));
  1129 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength));
  1130 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart));
  1130 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart));
  1131 	__ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
  1131 	__ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
  1132 	__ASSERT_DEBUG(aLength > 0, Panic(ELFNotPositive));
  1132 	__ASSERT_DEBUG(aLength > 0, Panic(ELFNotPositive));
  1133 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELFEnd));
  1133 	__ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELFEnd));
  1222 // starts writes from DoWrite(), DoFormat() and the session end DFC.  This function does not
  1222 // starts writes from DoWrite(), DoFormat() and the session end DFC.  This function does not
  1223 // maintain the iReq* instance variables.  It sets iIntBuf, iPhysStart and iPhysEnd.
  1223 // maintain the iReq* instance variables.  It sets iIntBuf, iPhysStart and iPhysEnd.
  1224 //
  1224 //
  1225 	{
  1225 	{
  1226 	OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this);
  1226 	OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this);
  1227 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
  1227 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur),(TInt) I64LOW(iReqEnd - iReqCur));
  1228 	__KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq));
  1228 	__KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq));
  1229 	__ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest));
  1229 	__ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest));
  1230 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart));
  1230 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart));
  1231 	__ASSERT_DEBUG(!(aMedReq == EMReqFormat) || (aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
  1231 	__ASSERT_DEBUG(!(aMedReq == EMReqFormat) || (aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
  1232 	__ASSERT_DEBUG(aLength > 0, Panic(ELWNotPositive));
  1232 	__ASSERT_DEBUG(aLength > 0, Panic(ELWNotPositive));
  2894 // This function is linear in the number of blocks in the cache.
  2894 // This function is linear in the number of blocks in the cache.
  2895 //
  2895 //
  2896 	{
  2896 	{
  2897 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
  2897 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
  2898 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
  2898 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
  2899 	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=0x%x; iReqEnd=0x%x", (TUint) iReqCur, (TUint) iReqEnd );
  2899 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
  2900 	
  2900 	
  2901 	if ( iCurrentReq->IsPhysicalAddress()
  2901 	if ( iCurrentReq->IsPhysicalAddress()
  2902 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2902 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2903 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
  2903 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
  2904 #endif //DEMAND_PAGING 
  2904 #endif //DEMAND_PAGING