diff -r 2d65c2f76d7b -r 947f0dc9f7a8 kernel/eka/drivers/locmedia/locmedia.cpp --- a/kernel/eka/drivers/locmedia/locmedia.cpp Tue Feb 02 01:24:03 2010 +0200 +++ b/kernel/eka/drivers/locmedia/locmedia.cpp Fri Apr 16 16:24:37 2010 +0300 @@ -3615,15 +3615,19 @@ void DPrimaryMediaBase::RequestCountInc() { __ASSERT_DEBUG(iBody, LOCM_FAULT()); - TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) 1); -//Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); - - OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); - - if (oldVal == 0 && iBody->iPagingDevice) + if (iBody->iPagingDevice) { -//Kern::Printf("RCINC: NotifyBusy()"); - iBody->iPagingDevice->NotifyBusy(); + NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); + NKern::FMWait(lock); + TInt oldVal = iBody->iRequestCount++; + //Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); + OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); + if (oldVal == 0) + { + //Kern::Printf("RCINC: NotifyBusy()"); + iBody->iPagingDevice->NotifyBusy(); + } + NKern::FMSignal(lock); } } @@ -3635,17 +3639,21 @@ void DPrimaryMediaBase::RequestCountDec() { __ASSERT_DEBUG(iBody, LOCM_FAULT()); - TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) -1); -//Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); - - OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); - - if (oldVal == 1 && iBody->iPagingDevice) + if (iBody->iPagingDevice) { -//Kern::Printf("RCDEC: NotifyIdle()"); - iBody->iPagingDevice->NotifyIdle(); + NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); + NKern::FMWait(lock); + TInt oldVal = iBody->iRequestCount--; + //Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); + OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); + if (oldVal == 1) + { + //Kern::Printf("RCDEC: NotifyIdle()"); + iBody->iPagingDevice->NotifyIdle(); + } + NKern::FMSignal(lock); + __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); } - __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); } #endif // __DEMAND_PAGING__ @@ -4947,8 +4955,10 @@ if (r != KErrNone) { - OstTrace1(TRACE_FLOW, LOCRV_REGISTERPAGINGDEVICE_EXIT9, "< retval=%d",r); - return r; + OstTrace1(TRACE_FLOW, LOCRV_REGISTERPAGINGDEVICE_EXIT9, "< Caps::retval=%d - return KErrNotSupported",r); + // Media driver failure; media maybe recoverable after boot. + // Can't register any page drives so return not supported. + return KErrNotSupported; } TLocDrv* drive; @@ -5012,7 +5022,7 @@ Kern::Printf("iRomPagingDriveNumber 0x%x\n", pagingDevice->iRomPagingDriveNumber); Kern::Printf("iDataPagingDriveNumber 0x%x\n", pagingDevice->iDataPagingDriveNumber); Kern::Printf("iSwapSize 0x%x\n", pagingDevice->iSwapSize); - #endif +#endif // This table is indexed by DPagingDevice::TType