kernel/eka/drivers/locmedia/locmedia.cpp
changeset 279 957c583b417b
parent 254 1560c419b176
child 285 ff5437e4337c
equal deleted inserted replaced
275:2b433474f2ba 279:957c583b417b
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   336 			return iDrive;
   336 			return iDrive;
   337 			}
   337 			}
   338 		iIndex++;
   338 		iIndex++;
   339 		}
   339 		}
   340 
   340 
   341 	for (iDrive = NULL; iIndex < KMaxLocalDrives; iIndex++)
   341 	for (iDrive = NULL; Index() < KMaxLocalDrives; iIndex++)
   342 		{
   342 		{
   343 		iDrive = TheDrives[iIndex];
   343 		iDrive = TheDrives[Index()];
   344 		if (iDrive)
   344 		if (iDrive)
   345 			break;
   345 			break;
   346 		}
   346 		}
   347 
   347 
   348 	return iDrive;
   348 	return iDrive;
  1628 		case DMediaPagingDevice::ERomPageInRequest:
  1628 		case DMediaPagingDevice::ERomPageInRequest:
  1629 //          if the ROM was reported to LOCM then it will also need to be adjusted.... 
  1629 //          if the ROM was reported to LOCM then it will also need to be adjusted.... 
  1630 //		    Otherwise the media driver adjust it internally
  1630 //		    Otherwise the media driver adjust it internally
  1631 		case DMediaPagingDevice::ECodePageInRequest:
  1631 		case DMediaPagingDevice::ECodePageInRequest:
  1632 			__KTRACE_OPT(KLOCDPAGING,Kern::Printf("Adjusted Paging read request %lx@%lx",Length(),Pos()));
  1632 			__KTRACE_OPT(KLOCDPAGING,Kern::Printf("Adjusted Paging read request %lx@%lx",Length(),Pos()));
  1633 			OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=%x:%x; position=%x%:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()),  (TUint) I64HIGH (Pos()), (TUint) I64LOW (Pos()));
  1633 			OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()),  (TUint) I64HIGH(Pos()), (TUint) I64LOW(Pos()));
  1634 			if (Pos()+Length()>d.iPartitionLen)
  1634 			if (Pos()+Length()>d.iPartitionLen)
  1635 			    {
  1635 			    {
  1636 				r = KErrArgument;
  1636 				r = KErrArgument;
  1637 				break;
  1637 				break;
  1638 			    }
  1638 			    }
  2028 	OstTraceFunctionEntry1( DPRIMARYMEDIABASE_REQUEST_ENTRY, this );
  2028 	OstTraceFunctionEntry1( DPRIMARYMEDIABASE_REQUEST_ENTRY, this );
  2029 
  2029 
  2030 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::Request(%08x)",iMediaId,&aReq));
  2030 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::Request(%08x)",iMediaId,&aReq));
  2031 	__KTRACE_OPT(KLOCDRV,Kern::Printf("this=%x, ReqId=%d, Pos=%lx, Len=%lx, remote thread %O",this,aReq.Id(),aReq.Pos(),aReq.Length(),aReq.RemoteThread()));
  2031 	__KTRACE_OPT(KLOCDRV,Kern::Printf("this=%x, ReqId=%d, Pos=%lx, Len=%lx, remote thread %O",this,aReq.Id(),aReq.Pos(),aReq.Length(),aReq.RemoteThread()));
  2032 
  2032 
  2033 	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST, "reqId=%d; remote thread=0x%x", (TInt) aReq.Id(), (TUint) aReq.RemoteThread());
  2033 	OstTraceDefExt5(OST_TRACE_CATEGORY_RND, TRACE_PRIMARYMEDIAREQUEST, DPRIMARYMEDIABASE_REQUEST, "Request=0x%x; reqId=%d; remote thread=0x%x; mediaId=%d; driveNum=%d", (TUint) &aReq, (TInt) aReq.Id(), (TUint) aReq.RemoteThread(), iMediaId, (aReq.Drive())->iDriveNumber);
  2034 	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST2, "length=%x:%x; position=%x:%x", (TUint) I64HIGH(aReq.Length()), (TUint) I64LOW(aReq.Length()), (TUint) I64HIGH(aReq.Pos()), (TUint) I64LOW(aReq.Pos()));
  2034 	OstTraceDefExt5(OST_TRACE_CATEGORY_RND, TRACE_PRIMARYMEDIAREQUEST, DPRIMARYMEDIABASE_REQUEST2, "Request=0x%x; length=%x:%x; position=%x:%x", (TUint) &aReq, (TUint) I64HIGH(aReq.Length()), (TUint) I64LOW(aReq.Length()), (TUint) I64HIGH(aReq.Pos()), (TUint) I64LOW(aReq.Pos()));
  2035 	
  2035 	
  2036 	TInt reqId = aReq.Id();
  2036 	TInt reqId = aReq.Id();
  2037 
  2037 
  2038 	TInt r = HandleMediaNotPresent(aReq);
  2038 	TInt r = HandleMediaNotPresent(aReq);
  2039 	if (r != KErrNone)
  2039 	if (r != KErrNone)
  2214 	{
  2214 	{
  2215 	OstTraceExt3(TRACE_FLOW, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE_ENTRY, "> DPrimaryMediaBase::PinFragmentSendReceive;aReq=%x;aLinAddress=%x;aLength=%d;", (TUint) &aReq, (TUint) &aLinAddress, aLength );
  2215 	OstTraceExt3(TRACE_FLOW, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE_ENTRY, "> DPrimaryMediaBase::PinFragmentSendReceive;aReq=%x;aLinAddress=%x;aLength=%d;", (TUint) &aReq, (TUint) &aLinAddress, aLength );
  2216 	
  2216 	
  2217 	TLocDrvRequest fragment = aReq;		// create a request on the stack for use during fragmentation, pre-fill with the original req args, leave original Kernel message as repository (thread will block, message contents won't change)
  2217 	TLocDrvRequest fragment = aReq;		// create a request on the stack for use during fragmentation, pre-fill with the original req args, leave original Kernel message as repository (thread will block, message contents won't change)
  2218 	TInt r = KErrNone;
  2218 	TInt r = KErrNone;
       
  2219 	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_PRIMARYMEDIAREQUEST, DPRIMARYMEDIABASE_PinFragmentSendReceive, "Request=0x%x; FragmentRequest=0x%x", (TUint) &aReq,(TUint) &fragment);
  2219 
  2220 
  2220 //	Kern::Printf(">PFSR %02X aReq %08X aLinAddress %08X aLen %08X offset %08X", aReq.Id(), &aReq, aLinAddress, aLength, aReq.RemoteDesOffset());
  2221 //	Kern::Printf(">PFSR %02X aReq %08X aLinAddress %08X aLen %08X offset %08X", aReq.Id(), &aReq, aLinAddress, aLength, aReq.RemoteDesOffset());
  2221 
  2222 
  2222 	DThread* pT = aReq.RemoteThread();
  2223 	DThread* pT = aReq.RemoteThread();
  2223 	if (!pT)
  2224 	if (!pT)
  3301 
  3302 
  3302 
  3303 
  3303 void DPrimaryMediaBase::CompleteRequest(TLocDrvRequest& aMsg, TInt aResult)
  3304 void DPrimaryMediaBase::CompleteRequest(TLocDrvRequest& aMsg, TInt aResult)
  3304 	{
  3305 	{
  3305 	OstTraceFunctionEntry1( DPRIMARYMEDIABASE_COMPLETEREQUEST_ENTRY, this );
  3306 	OstTraceFunctionEntry1( DPRIMARYMEDIABASE_COMPLETEREQUEST_ENTRY, this );
  3306 	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_COMPLETEREQUEST1, "TLocDrvRequest Object=0x%x; aResult=%d", (TUint) &aMsg, aResult);
  3307 	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_PRIMARYMEDIAREQUEST, DPRIMARYMEDIABASE_COMPLETEREQUEST1, "Request=0x%x; aResult=%d", (TUint) &aMsg, aResult);
  3307 
  3308 
  3308 
  3309 
  3309 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::CompleteRequest(%08x) r %d",iMediaId,&aMsg, aResult));
  3310 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::CompleteRequest(%08x) r %d",iMediaId,&aMsg, aResult));
  3310 
  3311 
  3311 	aMsg.Complete(aResult,EFalse);
  3312 	aMsg.Complete(aResult,EFalse);