kernel/eka/drivers/locmedia/locmedia.cpp
changeset 126 2b2a51c87b12
parent 123 fc55edbf3919
child 134 95847726fe57
equal deleted inserted replaced
125:947dd86c44e2 126:2b2a51c87b12
  2498 			}
  2498 			}
  2499 		case DLocalDrive::EForceMediaChange:
  2499 		case DLocalDrive::EForceMediaChange:
  2500 			{
  2500 			{
  2501 			TUint flags = (TUint) m.Pos();
  2501 			TUint flags = (TUint) m.Pos();
  2502 
  2502 
       
  2503 #ifdef __DEMAND_PAGING__
       
  2504 			// if this is a paging media (ROM,code or data), turn off the KMediaRemountForceMediaChange flag 
       
  2505 			// as this normally results in a call to DPBusSocket::ForceMediaChange() which effectively disables 
       
  2506 			// the media for a small time period - which would be disasterous if a paging request arrived
       
  2507 			if (iBody->iPagingDevice)
       
  2508 				flags&= ~KMediaRemountForceMediaChange;
       
  2509 #endif
       
  2510 
  2503 			// For media extension drivers, send a copy of the request to the next drive in the chain and wait for it. 
  2511 			// For media extension drivers, send a copy of the request to the next drive in the chain and wait for it. 
  2504 			TLocDrv* drv = m.Drive();
  2512 			TLocDrv* drv = m.Drive();
  2505 			if (drv->iNextDrive)
  2513 			if (drv->iNextDrive)
  2506 				{
  2514 				{
  2507 				TLocDrvRequest request;
  2515 				TLocDrvRequest request;
  6148 			TLocDrv* attachedDrive = drv->iNextDrive;
  6156 			TLocDrv* attachedDrive = drv->iNextDrive;
  6149 			__ASSERT_DEBUG(attachedDrive, LOCM_FAULT());
  6157 			__ASSERT_DEBUG(attachedDrive, LOCM_FAULT());
  6150 			TLocDrvRequest m;
  6158 			TLocDrvRequest m;
  6151 			memclr(&m, sizeof(m));
  6159 			memclr(&m, sizeof(m));
  6152 
  6160 
       
  6161 			// Get the Caps from the device. NB for MMC/SD we may need to retry as there may have been an earlier 
       
  6162 			// EForceMediaChange request which can result in the cancellation of requests already in the queue
  6153 			TBuf8<KMaxLocalDriveCapsLength> capsBuf;
  6163 			TBuf8<KMaxLocalDriveCapsLength> capsBuf;
  6154 			capsBuf.SetMax();
  6164 			TInt i;
  6155 			capsBuf.FillZ();
  6165 			const TInt KRetries = 5;
  6156 			m.Drive() = attachedDrive;
  6166 			TInt r = KErrNotReady;
  6157 			m.Id() = DLocalDrive::ECaps;
  6167 			for (i=0; r == KErrNotReady && i < KRetries; i++)
  6158 			m.RemoteDes() = (TAny*)capsBuf.Ptr();
  6168 				{
  6159 			m.Length() = KMaxLocalDriveCapsLength;
  6169 				capsBuf.SetMax();
  6160 			TInt r = attachedDrive->iPrimaryMedia->Request(m);
  6170 				capsBuf.FillZ();
       
  6171 				m.Drive() = attachedDrive;
       
  6172 				m.Id() = DLocalDrive::ECaps;
       
  6173 				m.RemoteDes() = (TAny*)capsBuf.Ptr();
       
  6174 				m.Length() = KMaxLocalDriveCapsLength;
       
  6175 				r = attachedDrive->iPrimaryMedia->Request(m);
       
  6176 				}
  6161 
  6177 
  6162 			__KTRACE_OPT2(KBOOT,KLOCDPAGING, Kern::Printf("DMediaDriverExtension::PartitionInfo(ECaps: i %d: r %d ", driveIter.Index(), r));
  6178 			__KTRACE_OPT2(KBOOT,KLOCDPAGING, Kern::Printf("DMediaDriverExtension::PartitionInfo(ECaps: i %d: r %d ", driveIter.Index(), r));
  6163 			
  6179 			
  6164 			// NB The ECaps call might legitimately fail if one of the attached drives is removable
  6180 			// NB The ECaps call might legitimately fail if one of the attached drives is removable
  6165 			// If this happens, just ignore & proceed to the next attached drive
  6181 			// If this happens, just ignore & proceed to the next attached drive