3613 // For data-paging media, calls DPagingDevice::NotifyBusy() when count goes positive |
3613 // For data-paging media, calls DPagingDevice::NotifyBusy() when count goes positive |
3614 // |
3614 // |
3615 void DPrimaryMediaBase::RequestCountInc() |
3615 void DPrimaryMediaBase::RequestCountInc() |
3616 { |
3616 { |
3617 __ASSERT_DEBUG(iBody, LOCM_FAULT()); |
3617 __ASSERT_DEBUG(iBody, LOCM_FAULT()); |
3618 TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) 1); |
3618 if (iBody->iPagingDevice) |
3619 //Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); |
3619 { |
3620 |
3620 NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); |
3621 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); |
3621 NKern::FMWait(lock); |
3622 |
3622 TInt oldVal = iBody->iRequestCount++; |
3623 if (oldVal == 0 && iBody->iPagingDevice) |
3623 //Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); |
3624 { |
3624 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); |
3625 //Kern::Printf("RCINC: NotifyBusy()"); |
3625 if (oldVal == 0) |
3626 iBody->iPagingDevice->NotifyBusy(); |
3626 { |
|
3627 //Kern::Printf("RCINC: NotifyBusy()"); |
|
3628 iBody->iPagingDevice->NotifyBusy(); |
|
3629 } |
|
3630 NKern::FMSignal(lock); |
3627 } |
3631 } |
3628 } |
3632 } |
3629 |
3633 |
3630 // RequestCountDec() |
3634 // RequestCountDec() |
3631 // |
3635 // |
3633 // For data-paging media, calls DPagingDevice::NotifyIdle() when count reaches zero |
3637 // For data-paging media, calls DPagingDevice::NotifyIdle() when count reaches zero |
3634 // |
3638 // |
3635 void DPrimaryMediaBase::RequestCountDec() |
3639 void DPrimaryMediaBase::RequestCountDec() |
3636 { |
3640 { |
3637 __ASSERT_DEBUG(iBody, LOCM_FAULT()); |
3641 __ASSERT_DEBUG(iBody, LOCM_FAULT()); |
3638 TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) -1); |
3642 if (iBody->iPagingDevice) |
3639 //Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); |
3643 { |
3640 |
3644 NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); |
3641 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); |
3645 NKern::FMWait(lock); |
3642 |
3646 TInt oldVal = iBody->iRequestCount--; |
3643 if (oldVal == 1 && iBody->iPagingDevice) |
3647 //Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); |
3644 { |
3648 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); |
3645 //Kern::Printf("RCDEC: NotifyIdle()"); |
3649 if (oldVal == 1) |
3646 iBody->iPagingDevice->NotifyIdle(); |
3650 { |
3647 } |
3651 //Kern::Printf("RCDEC: NotifyIdle()"); |
3648 __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); |
3652 iBody->iPagingDevice->NotifyIdle(); |
|
3653 } |
|
3654 NKern::FMSignal(lock); |
|
3655 __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); |
|
3656 } |
3649 } |
3657 } |
3650 #endif // __DEMAND_PAGING__ |
3658 #endif // __DEMAND_PAGING__ |
3651 |
3659 |
3652 TPartitionInfo::TPartitionInfo() |
3660 TPartitionInfo::TPartitionInfo() |
3653 // |
3661 // |
4945 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, LOCDRV_REGISTERPAGINGDEVICE4, "Paging device ECaps: i %d retval=%d", i, r); |
4953 OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, LOCDRV_REGISTERPAGINGDEVICE4, "Paging device ECaps: i %d retval=%d", i, r); |
4946 } |
4954 } |
4947 |
4955 |
4948 if (r != KErrNone) |
4956 if (r != KErrNone) |
4949 { |
4957 { |
4950 OstTrace1(TRACE_FLOW, LOCRV_REGISTERPAGINGDEVICE_EXIT9, "< retval=%d",r); |
4958 OstTrace1(TRACE_FLOW, LOCRV_REGISTERPAGINGDEVICE_EXIT9, "< Caps::retval=%d - return KErrNotSupported",r); |
4951 return r; |
4959 // Media driver failure; media maybe recoverable after boot. |
|
4960 // Can't register any page drives so return not supported. |
|
4961 return KErrNotSupported; |
4952 } |
4962 } |
4953 |
4963 |
4954 TLocDrv* drive; |
4964 TLocDrv* drive; |
4955 for (i=0; i<KMaxLocalDrives; ++i) |
4965 for (i=0; i<KMaxLocalDrives; ++i) |
4956 { |
4966 { |
5010 Kern::Printf("iReadUnitShift 0x%x\n", pagingDevice->iReadUnitShift); |
5020 Kern::Printf("iReadUnitShift 0x%x\n", pagingDevice->iReadUnitShift); |
5011 Kern::Printf("iFirstLocalDriveNumber 0x%x\n", pagingDevice->iFirstLocalDriveNumber); |
5021 Kern::Printf("iFirstLocalDriveNumber 0x%x\n", pagingDevice->iFirstLocalDriveNumber); |
5012 Kern::Printf("iRomPagingDriveNumber 0x%x\n", pagingDevice->iRomPagingDriveNumber); |
5022 Kern::Printf("iRomPagingDriveNumber 0x%x\n", pagingDevice->iRomPagingDriveNumber); |
5013 Kern::Printf("iDataPagingDriveNumber 0x%x\n", pagingDevice->iDataPagingDriveNumber); |
5023 Kern::Printf("iDataPagingDriveNumber 0x%x\n", pagingDevice->iDataPagingDriveNumber); |
5014 Kern::Printf("iSwapSize 0x%x\n", pagingDevice->iSwapSize); |
5024 Kern::Printf("iSwapSize 0x%x\n", pagingDevice->iSwapSize); |
5015 #endif |
5025 #endif |
5016 |
5026 |
5017 |
5027 |
5018 // This table is indexed by DPagingDevice::TType |
5028 // This table is indexed by DPagingDevice::TType |
5019 const char* DeviceName[] = |
5029 const char* DeviceName[] = |
5020 { |
5030 { |