2791 { |
2791 { |
2792 EDriveRomPaging = -1, /**< Special drive number to indicate rom paging. */ |
2792 EDriveRomPaging = -1, /**< Special drive number to indicate rom paging. */ |
2793 EDriveDataPaging = -2, /**< Special drive number to indicate data paging. */ |
2793 EDriveDataPaging = -2, /**< Special drive number to indicate data paging. */ |
2794 }; |
2794 }; |
2795 |
2795 |
|
2796 /** Additional flags. */ |
|
2797 enum TFlags |
|
2798 { |
|
2799 ESupportsPhysicalAccess = 1<<0, /**< Supports ReadPhysical and WritePhysical methods. */ |
|
2800 }; |
|
2801 |
2796 /** |
2802 /** |
2797 Called by the paging system to read data from the media represented by this |
2803 Called by the paging system to read data from the media represented by this |
2798 device. |
2804 device. |
2799 |
2805 |
2800 @param aBuffer The location where the read data should be stored. |
2806 @param aBuffer The location where the read data should be stored. |
2836 @return KErrNone or standard error code. |
2842 @return KErrNone or standard error code. |
2837 */ |
2843 */ |
2838 inline virtual TInt DeleteNotify(TThreadMessage* aReq,TUint aOffset,TUint aSize); |
2844 inline virtual TInt DeleteNotify(TThreadMessage* aReq,TUint aOffset,TUint aSize); |
2839 |
2845 |
2840 /** |
2846 /** |
|
2847 Called by the paging system to read data from the media represented by this device using |
|
2848 physical addresses, if the device supports it. |
|
2849 |
|
2850 This is intended to allow reading pages from swap without needing to map them first, and should |
|
2851 be implemented by media drivers that support DMA access. |
|
2852 |
|
2853 If this method is implemented, the ESupportsPhysicalAccess flag in iFlags must be set as well. |
|
2854 |
|
2855 The default implementation of this method just returns KErrNotSupported. |
|
2856 |
|
2857 @param aPageArray Pointer to array of physical address to write to. |
|
2858 @param aPageCount Number of physical pages to read. |
|
2859 @param aOffset The offset from the media start, in read units, from where data should be read. |
|
2860 |
|
2861 @param aDrvNumber The drive number for code paging or a member of TSpecialDrives for rom or data |
|
2862 paging. |
|
2863 |
|
2864 @return KErrNone or standard error code. |
|
2865 */ |
|
2866 inline virtual TInt ReadPhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TInt aDrvNumber); |
|
2867 |
|
2868 /** |
|
2869 Called by the paging system to write data to the media represented by this device using physical |
|
2870 addresses, if the device supports it. |
|
2871 |
|
2872 This is only used in the implementation of data paging to write to the swap partition. |
|
2873 |
|
2874 This method takes a pointer to an array of physical addresses and the number of pages to write, |
|
2875 in contrast to #Write which takes a logical address and a number of read units. |
|
2876 |
|
2877 This is intended to allow writing pages to swap without needing to map them first, and should be |
|
2878 implelemented by media drivers that support DMA access. |
|
2879 |
|
2880 If this method is implemented, the ESupportsPhysicalAccess flag in iFlags must be set as well. |
|
2881 |
|
2882 The default implementation of this method just returns KErrNotSupported. |
|
2883 |
|
2884 @param aPageArray Pointer to array of physical address to read from. |
|
2885 @param aPageCount Number of physical pages to write. |
|
2886 @param aOffset The offset from the media start, in read units, to where data should be |
|
2887 written. |
|
2888 @param aBackground If set, this indicates that the request should not count as making the |
|
2889 device busy. |
|
2890 |
|
2891 @return KErrNone or standard error code. |
|
2892 */ |
|
2893 inline virtual TInt WritePhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TBool aBackground); |
|
2894 |
|
2895 /** |
2841 Return the lock that should be used to synchronise calculation of the idle/busy state and |
2896 Return the lock that should be used to synchronise calculation of the idle/busy state and |
2842 subsequent calls to #NotifyIdle and #NotifyBusy. |
2897 subsequent calls to #NotifyIdle and #NotifyBusy. |
2843 */ |
2898 */ |
2844 IMPORT_C NFastMutex* NotificationLock(); |
2899 IMPORT_C NFastMutex* NotificationLock(); |
2845 |
2900 |
2865 */ |
2920 */ |
2866 IMPORT_C void NotifyBusy(); |
2921 IMPORT_C void NotifyBusy(); |
2867 |
2922 |
2868 public: |
2923 public: |
2869 /** The type of device this represents. */ |
2924 /** The type of device this represents. */ |
2870 TUint32 iType; |
2925 TUint16 iType; |
|
2926 |
|
2927 /** Flags bitfield made up of members of TFlags. */ |
|
2928 TUint16 iFlags; |
2871 |
2929 |
2872 /** The local drives supported for code paging. |
2930 /** The local drives supported for code paging. |
2873 This is a bitmask containing one bit set for each local drive supported, where the bit set |
2931 This is a bitmask containing one bit set for each local drive supported, where the bit set |
2874 is 1 << the local drive number. If this device does not support code paging, this should be |
2932 is 1 << the local drive number. If this device does not support code paging, this should be |
2875 zero. */ |
2933 zero. */ |
2900 /** The pool of DPagingRequest objects used to issue requests for this device. |
2958 /** The pool of DPagingRequest objects used to issue requests for this device. |
2901 This is setup and used internally by the kernel. |
2959 This is setup and used internally by the kernel. |
2902 */ |
2960 */ |
2903 DPagingRequestPool* iRequestPool; |
2961 DPagingRequestPool* iRequestPool; |
2904 |
2962 |
|
2963 /** Log2 of the media's preferred write size in bytes. |
|
2964 |
|
2965 E.g. if the preferred write size is 16KB, this should be set 14. |
|
2966 |
|
2967 Some media may exhibit poor performance unless writes happen in multiples of the superpage |
|
2968 size. In this case the media driver would set this field to indicate the write size, and |
|
2969 the kernel will attempt to: |
|
2970 |
|
2971 - write in multiples of the preferred size |
|
2972 - align writes to multiples of the preferred size |
|
2973 |
|
2974 Note that this value cannot be less the size of a page (eg 12) and there may be a maximum |
|
2975 limit to what the kernel will write as well. |
|
2976 */ |
|
2977 TUint32 iPreferredWriteShift; |
|
2978 |
2905 /** Reserved for future use. |
2979 /** Reserved for future use. |
2906 */ |
2980 */ |
2907 TInt iSpare[4]; |
2981 TInt iSpare[3]; |
2908 }; |
2982 }; |
2909 |
2983 |
2910 inline TInt DPagingDevice::Write(TThreadMessage*,TLinAddr,TUint,TUint,TBool) |
2984 inline TInt DPagingDevice::Write(TThreadMessage*, TLinAddr, TUint, TUint, TBool) |
2911 { |
2985 { |
2912 // Default implementation, may be overriden by dervied classes |
2986 // Default implementation, may be overriden by derived classes |
2913 return KErrNotSupported; |
2987 return KErrNotSupported; |
2914 } |
2988 } |
2915 |
2989 |
|
2990 inline TInt DPagingDevice::ReadPhysical(TThreadMessage*, TPhysAddr*, TUint, TUint, TInt) |
|
2991 { |
|
2992 // Default implementation, may be overriden by derived classes |
|
2993 return KErrNotSupported; |
|
2994 } |
|
2995 |
|
2996 inline TInt DPagingDevice::WritePhysical(TThreadMessage*, TPhysAddr*, TUint, TUint, TBool) |
|
2997 { |
|
2998 // Default implementation, may be overriden by derived classes |
|
2999 return KErrNotSupported; |
|
3000 } |
|
3001 |
2916 inline TInt DPagingDevice::DeleteNotify(TThreadMessage*,TUint,TUint) |
3002 inline TInt DPagingDevice::DeleteNotify(TThreadMessage*,TUint,TUint) |
2917 { |
3003 { |
2918 // Default implementation, may be overriden by dervied classes |
3004 // Default implementation, may be overriden by derived classes |
2919 return KErrNotSupported; |
3005 return KErrNotSupported; |
2920 } |
3006 } |
2921 |
3007 |
2922 extern "C" { extern TInt __Variant_Flags__; } |
3008 extern "C" { extern TInt __Variant_Flags__; } |
2923 |
3009 |