diff options
Diffstat (limited to 'drivers/gpu/pvr/osfunc.c')
-rw-r--r-- | drivers/gpu/pvr/osfunc.c | 179 |
1 files changed, 107 insertions, 72 deletions
diff --git a/drivers/gpu/pvr/osfunc.c b/drivers/gpu/pvr/osfunc.c index ba3bf01bcf9..c72dd561410 100644 --- a/drivers/gpu/pvr/osfunc.c +++ b/drivers/gpu/pvr/osfunc.c | |||
@@ -83,9 +83,6 @@ | |||
83 | 83 | ||
84 | #define EVENT_OBJECT_TIMEOUT_MS (100) | 84 | #define EVENT_OBJECT_TIMEOUT_MS (100) |
85 | 85 | ||
86 | #define HOST_ALLOC_MEM_USING_KMALLOC ((IMG_HANDLE)0) | ||
87 | #define HOST_ALLOC_MEM_USING_VMALLOC ((IMG_HANDLE)1) | ||
88 | |||
89 | #if !defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 86 | #if !defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
90 | PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID *ppvCpuVAddr, IMG_HANDLE *phBlockAlloc) | 87 | PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID *ppvCpuVAddr, IMG_HANDLE *phBlockAlloc) |
91 | #else | 88 | #else |
@@ -93,40 +90,26 @@ PVRSRV_ERROR OSAllocMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOI | |||
93 | #endif | 90 | #endif |
94 | { | 91 | { |
95 | PVR_UNREFERENCED_PARAMETER(ui32Flags); | 92 | PVR_UNREFERENCED_PARAMETER(ui32Flags); |
93 | PVR_UNREFERENCED_PARAMETER(phBlockAlloc); | ||
96 | 94 | ||
97 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 95 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
98 | *ppvCpuVAddr = _KMallocWrapper(ui32Size, pszFilename, ui32Line); | 96 | *ppvCpuVAddr = _KMallocWrapper(ui32Size, GFP_KERNEL | __GFP_NOWARN, pszFilename, ui32Line); |
99 | #else | 97 | #else |
100 | *ppvCpuVAddr = KMallocWrapper(ui32Size); | 98 | *ppvCpuVAddr = KMallocWrapper(ui32Size, GFP_KERNEL | __GFP_NOWARN); |
101 | #endif | 99 | #endif |
102 | if(*ppvCpuVAddr) | 100 | |
103 | { | 101 | if(!*ppvCpuVAddr) |
104 | if (phBlockAlloc) | ||
105 | { | 102 | { |
106 | 103 | ||
107 | *phBlockAlloc = HOST_ALLOC_MEM_USING_KMALLOC; | ||
108 | } | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | if (!phBlockAlloc) | ||
113 | { | ||
114 | return PVRSRV_ERROR_OUT_OF_MEMORY; | ||
115 | } | ||
116 | |||
117 | |||
118 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 104 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
119 | *ppvCpuVAddr = _VMallocWrapper(ui32Size, PVRSRV_HAP_CACHED, pszFilename, ui32Line); | 105 | *ppvCpuVAddr = _VMallocWrapper(ui32Size, PVRSRV_HAP_CACHED, pszFilename, ui32Line); |
120 | #else | 106 | #else |
121 | *ppvCpuVAddr = VMallocWrapper(ui32Size, PVRSRV_HAP_CACHED); | 107 | *ppvCpuVAddr = VMallocWrapper(ui32Size, PVRSRV_HAP_CACHED); |
122 | #endif | 108 | #endif |
123 | if (!*ppvCpuVAddr) | 109 | if (!*ppvCpuVAddr) |
124 | { | 110 | { |
125 | return PVRSRV_ERROR_OUT_OF_MEMORY; | 111 | return PVRSRV_ERROR_OUT_OF_MEMORY; |
126 | } | 112 | } |
127 | |||
128 | |||
129 | *phBlockAlloc = HOST_ALLOC_MEM_USING_VMALLOC; | ||
130 | } | 113 | } |
131 | 114 | ||
132 | return PVRSRV_OK; | 115 | return PVRSRV_OK; |
@@ -138,22 +121,23 @@ PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID | |||
138 | #else | 121 | #else |
139 | PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID pvCpuVAddr, IMG_HANDLE hBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line) | 122 | PVRSRV_ERROR OSFreeMem_Impl(IMG_UINT32 ui32Flags, IMG_UINT32 ui32Size, IMG_PVOID pvCpuVAddr, IMG_HANDLE hBlockAlloc, IMG_CHAR *pszFilename, IMG_UINT32 ui32Line) |
140 | #endif | 123 | #endif |
141 | { | 124 | { |
142 | PVR_UNREFERENCED_PARAMETER(ui32Flags); | 125 | PVR_UNREFERENCED_PARAMETER(ui32Flags); |
143 | PVR_UNREFERENCED_PARAMETER(ui32Size); | 126 | PVR_UNREFERENCED_PARAMETER(ui32Size); |
127 | PVR_UNREFERENCED_PARAMETER(hBlockAlloc); | ||
144 | 128 | ||
145 | if (hBlockAlloc == HOST_ALLOC_MEM_USING_VMALLOC) | 129 | if (is_vmalloc_addr(pvCpuVAddr)) |
146 | { | 130 | { |
147 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 131 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
148 | _VFreeWrapper(pvCpuVAddr, pszFilename, ui32Line); | 132 | _VFreeWrapper(pvCpuVAddr, pszFilename, ui32Line); |
149 | #else | 133 | #else |
150 | VFreeWrapper(pvCpuVAddr); | 134 | VFreeWrapper(pvCpuVAddr); |
151 | #endif | 135 | #endif |
152 | } | 136 | } |
153 | else | 137 | else |
154 | { | 138 | { |
155 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 139 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
156 | _KFreeWrapper(pvCpuVAddr, pszFilename, ui32Line); | 140 | _KFreeWrapper(pvCpuVAddr, pszFilename, ui32Line); |
157 | #else | 141 | #else |
158 | KFreeWrapper(pvCpuVAddr); | 142 | KFreeWrapper(pvCpuVAddr); |
159 | #endif | 143 | #endif |
@@ -305,7 +289,7 @@ OSGetSubMemHandle(IMG_HANDLE hOSMemHandle, | |||
305 | 289 | ||
306 | eError = PVRMMapRegisterArea(psLinuxMemArea); | 290 | eError = PVRMMapRegisterArea(psLinuxMemArea); |
307 | if(eError != PVRSRV_OK) | 291 | if(eError != PVRSRV_OK) |
308 | { | 292 | { |
309 | goto failed_register_area; | 293 | goto failed_register_area; |
310 | } | 294 | } |
311 | 295 | ||
@@ -524,6 +508,25 @@ IMG_VOID OSSleepms(IMG_UINT32 ui32Timems) | |||
524 | } | 508 | } |
525 | 509 | ||
526 | 510 | ||
511 | |||
512 | IMG_HANDLE OSFuncHighResTimerCreate(IMG_VOID) | ||
513 | { | ||
514 | |||
515 | return (IMG_HANDLE) 1; | ||
516 | } | ||
517 | |||
518 | |||
519 | IMG_UINT32 OSFuncHighResTimerGetus(IMG_HANDLE hTimer) | ||
520 | { | ||
521 | return (IMG_UINT32) jiffies_to_usecs(jiffies); | ||
522 | } | ||
523 | |||
524 | |||
525 | IMG_VOID OSFuncHighResTimerDestroy(IMG_HANDLE hTimer) | ||
526 | { | ||
527 | PVR_UNREFERENCED_PARAMETER(hTimer); | ||
528 | } | ||
529 | |||
527 | IMG_UINT32 OSGetCurrentProcessIDKM(IMG_VOID) | 530 | IMG_UINT32 OSGetCurrentProcessIDKM(IMG_VOID) |
528 | { | 531 | { |
529 | if (in_interrupt()) | 532 | if (in_interrupt()) |
@@ -1002,7 +1005,7 @@ PVRSRV_ERROR OSUnlockResource (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) | |||
1002 | if(psResource->ui32ID == ui32ID) | 1005 | if(psResource->ui32ID == ui32ID) |
1003 | { | 1006 | { |
1004 | psResource->ui32ID = 0; | 1007 | psResource->ui32ID = 0; |
1005 | smp_mb(); | 1008 | smp_mb(); |
1006 | *pui32Access = 0; | 1009 | *pui32Access = 0; |
1007 | } | 1010 | } |
1008 | else | 1011 | else |
@@ -1032,6 +1035,18 @@ IMG_BOOL OSIsResourceLocked (PVRSRV_RESOURCE *psResource, IMG_UINT32 ui32ID) | |||
1032 | } | 1035 | } |
1033 | 1036 | ||
1034 | 1037 | ||
1038 | #if !defined(SYS_CUSTOM_POWERLOCK_WRAP) | ||
1039 | PVRSRV_ERROR OSPowerLockWrap (IMG_VOID) | ||
1040 | { | ||
1041 | return PVRSRV_OK; | ||
1042 | } | ||
1043 | |||
1044 | IMG_VOID OSPowerLockUnwrap (IMG_VOID) | ||
1045 | { | ||
1046 | } | ||
1047 | #endif | ||
1048 | |||
1049 | |||
1035 | IMG_CPU_PHYADDR OSMapLinToCPUPhys(IMG_HANDLE hOSMemHandle, | 1050 | IMG_CPU_PHYADDR OSMapLinToCPUPhys(IMG_HANDLE hOSMemHandle, |
1036 | IMG_VOID *pvLinAddr) | 1051 | IMG_VOID *pvLinAddr) |
1037 | { | 1052 | { |
@@ -1382,9 +1397,9 @@ PVRSRV_ERROR OSBaseAllocContigMemory(IMG_UINT32 ui32Size, IMG_CPU_VIRTADDR *pvLi | |||
1382 | IMG_VOID *pvKernLinAddr; | 1397 | IMG_VOID *pvKernLinAddr; |
1383 | 1398 | ||
1384 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) | 1399 | #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS) |
1385 | pvKernLinAddr = _KMallocWrapper(ui32Size, __FILE__, __LINE__); | 1400 | pvKernLinAddr = _KMallocWrapper(ui32Size, GFP_KERNEL, __FILE__, __LINE__); |
1386 | #else | 1401 | #else |
1387 | pvKernLinAddr = KMallocWrapper(ui32Size); | 1402 | pvKernLinAddr = KMallocWrapper(ui32Size, GFP_KERNEL); |
1388 | #endif | 1403 | #endif |
1389 | if (!pvKernLinAddr) | 1404 | if (!pvKernLinAddr) |
1390 | { | 1405 | { |
@@ -1952,7 +1967,11 @@ PVRSRV_ERROR OSDisableTimer (IMG_HANDLE hTimer) | |||
1952 | } | 1967 | } |
1953 | 1968 | ||
1954 | 1969 | ||
1955 | PVRSRV_ERROR OSEventObjectCreate(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT *psEventObject) | 1970 | #if defined (SUPPORT_SID_INTERFACE) |
1971 | PVRSRV_ERROR OSEventObjectCreateKM(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT_KM *psEventObject) | ||
1972 | #else | ||
1973 | PVRSRV_ERROR OSEventObjectCreateKM(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT *psEventObject) | ||
1974 | #endif | ||
1956 | { | 1975 | { |
1957 | 1976 | ||
1958 | PVRSRV_ERROR eError = PVRSRV_OK; | 1977 | PVRSRV_ERROR eError = PVRSRV_OK; |
@@ -1968,7 +1987,11 @@ PVRSRV_ERROR OSEventObjectCreate(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT *ps | |||
1968 | { | 1987 | { |
1969 | 1988 | ||
1970 | static IMG_UINT16 ui16NameIndex = 0; | 1989 | static IMG_UINT16 ui16NameIndex = 0; |
1990 | #if defined (SUPPORT_SID_INTERFACE) | ||
1991 | snprintf(psEventObject->szName, EVENTOBJNAME_MAXLENGTH, "PVRSRV_EVENTOBJECT_KM_%d", ui16NameIndex++); | ||
1992 | #else | ||
1971 | snprintf(psEventObject->szName, EVENTOBJNAME_MAXLENGTH, "PVRSRV_EVENTOBJECT_%d", ui16NameIndex++); | 1993 | snprintf(psEventObject->szName, EVENTOBJNAME_MAXLENGTH, "PVRSRV_EVENTOBJECT_%d", ui16NameIndex++); |
1994 | #endif | ||
1972 | } | 1995 | } |
1973 | 1996 | ||
1974 | if(LinuxEventObjectListCreate(&psEventObject->hOSEventKM) != PVRSRV_OK) | 1997 | if(LinuxEventObjectListCreate(&psEventObject->hOSEventKM) != PVRSRV_OK) |
@@ -1979,7 +2002,7 @@ PVRSRV_ERROR OSEventObjectCreate(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT *ps | |||
1979 | } | 2002 | } |
1980 | else | 2003 | else |
1981 | { | 2004 | { |
1982 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreate: psEventObject is not a valid pointer")); | 2005 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreateKM: psEventObject is not a valid pointer")); |
1983 | eError = PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT; | 2006 | eError = PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT; |
1984 | } | 2007 | } |
1985 | 2008 | ||
@@ -1988,7 +2011,11 @@ PVRSRV_ERROR OSEventObjectCreate(const IMG_CHAR *pszName, PVRSRV_EVENTOBJECT *ps | |||
1988 | } | 2011 | } |
1989 | 2012 | ||
1990 | 2013 | ||
1991 | PVRSRV_ERROR OSEventObjectDestroy(PVRSRV_EVENTOBJECT *psEventObject) | 2014 | #if defined (SUPPORT_SID_INTERFACE) |
2015 | PVRSRV_ERROR OSEventObjectDestroyKM(PVRSRV_EVENTOBJECT_KM *psEventObject) | ||
2016 | #else | ||
2017 | PVRSRV_ERROR OSEventObjectDestroyKM(PVRSRV_EVENTOBJECT *psEventObject) | ||
2018 | #endif | ||
1992 | { | 2019 | { |
1993 | PVRSRV_ERROR eError = PVRSRV_OK; | 2020 | PVRSRV_ERROR eError = PVRSRV_OK; |
1994 | 2021 | ||
@@ -2000,20 +2027,20 @@ PVRSRV_ERROR OSEventObjectDestroy(PVRSRV_EVENTOBJECT *psEventObject) | |||
2000 | } | 2027 | } |
2001 | else | 2028 | else |
2002 | { | 2029 | { |
2003 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroy: hOSEventKM is not a valid pointer")); | 2030 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroyKM: hOSEventKM is not a valid pointer")); |
2004 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2031 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2005 | } | 2032 | } |
2006 | } | 2033 | } |
2007 | else | 2034 | else |
2008 | { | 2035 | { |
2009 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroy: psEventObject is not a valid pointer")); | 2036 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroyKM: psEventObject is not a valid pointer")); |
2010 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2037 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2011 | } | 2038 | } |
2012 | 2039 | ||
2013 | return eError; | 2040 | return eError; |
2014 | } | 2041 | } |
2015 | 2042 | ||
2016 | PVRSRV_ERROR OSEventObjectWait(IMG_HANDLE hOSEventKM) | 2043 | PVRSRV_ERROR OSEventObjectWaitKM(IMG_HANDLE hOSEventKM) |
2017 | { | 2044 | { |
2018 | PVRSRV_ERROR eError; | 2045 | PVRSRV_ERROR eError; |
2019 | 2046 | ||
@@ -2023,14 +2050,18 @@ PVRSRV_ERROR OSEventObjectWait(IMG_HANDLE hOSEventKM) | |||
2023 | } | 2050 | } |
2024 | else | 2051 | else |
2025 | { | 2052 | { |
2026 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectWait: hOSEventKM is not a valid handle")); | 2053 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectWaitKM: hOSEventKM is not a valid handle")); |
2027 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2054 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2028 | } | 2055 | } |
2029 | 2056 | ||
2030 | return eError; | 2057 | return eError; |
2031 | } | 2058 | } |
2032 | 2059 | ||
2033 | PVRSRV_ERROR OSEventObjectOpen(PVRSRV_EVENTOBJECT *psEventObject, | 2060 | #if defined (SUPPORT_SID_INTERFACE) |
2061 | PVRSRV_ERROR OSEventObjectOpenKM(PVRSRV_EVENTOBJECT_KM *psEventObject, | ||
2062 | #else | ||
2063 | PVRSRV_ERROR OSEventObjectOpenKM(PVRSRV_EVENTOBJECT *psEventObject, | ||
2064 | #endif | ||
2034 | IMG_HANDLE *phOSEvent) | 2065 | IMG_HANDLE *phOSEvent) |
2035 | { | 2066 | { |
2036 | PVRSRV_ERROR eError = PVRSRV_OK; | 2067 | PVRSRV_ERROR eError = PVRSRV_OK; |
@@ -2046,14 +2077,18 @@ PVRSRV_ERROR OSEventObjectOpen(PVRSRV_EVENTOBJECT *psEventObject, | |||
2046 | } | 2077 | } |
2047 | else | 2078 | else |
2048 | { | 2079 | { |
2049 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreate: psEventObject is not a valid pointer")); | 2080 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectCreateKM: psEventObject is not a valid pointer")); |
2050 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2081 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2051 | } | 2082 | } |
2052 | 2083 | ||
2053 | return eError; | 2084 | return eError; |
2054 | } | 2085 | } |
2055 | 2086 | ||
2056 | PVRSRV_ERROR OSEventObjectClose(PVRSRV_EVENTOBJECT *psEventObject, | 2087 | #if defined (SUPPORT_SID_INTERFACE) |
2088 | PVRSRV_ERROR OSEventObjectCloseKM(PVRSRV_EVENTOBJECT_KM *psEventObject, | ||
2089 | #else | ||
2090 | PVRSRV_ERROR OSEventObjectCloseKM(PVRSRV_EVENTOBJECT *psEventObject, | ||
2091 | #endif | ||
2057 | IMG_HANDLE hOSEventKM) | 2092 | IMG_HANDLE hOSEventKM) |
2058 | { | 2093 | { |
2059 | PVRSRV_ERROR eError = PVRSRV_OK; | 2094 | PVRSRV_ERROR eError = PVRSRV_OK; |
@@ -2069,7 +2104,7 @@ PVRSRV_ERROR OSEventObjectClose(PVRSRV_EVENTOBJECT *psEventObject, | |||
2069 | } | 2104 | } |
2070 | else | 2105 | else |
2071 | { | 2106 | { |
2072 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroy: psEventObject is not a valid pointer")); | 2107 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectDestroyKM: psEventObject is not a valid pointer")); |
2073 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2108 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2074 | } | 2109 | } |
2075 | 2110 | ||
@@ -2077,7 +2112,7 @@ PVRSRV_ERROR OSEventObjectClose(PVRSRV_EVENTOBJECT *psEventObject, | |||
2077 | 2112 | ||
2078 | } | 2113 | } |
2079 | 2114 | ||
2080 | PVRSRV_ERROR OSEventObjectSignal(IMG_HANDLE hOSEventKM) | 2115 | PVRSRV_ERROR OSEventObjectSignalKM(IMG_HANDLE hOSEventKM) |
2081 | { | 2116 | { |
2082 | PVRSRV_ERROR eError; | 2117 | PVRSRV_ERROR eError; |
2083 | 2118 | ||
@@ -2087,7 +2122,7 @@ PVRSRV_ERROR OSEventObjectSignal(IMG_HANDLE hOSEventKM) | |||
2087 | } | 2122 | } |
2088 | else | 2123 | else |
2089 | { | 2124 | { |
2090 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectSignal: hOSEventKM is not a valid handle")); | 2125 | PVR_DPF((PVR_DBG_ERROR, "OSEventObjectSignalKM: hOSEventKM is not a valid handle")); |
2091 | eError = PVRSRV_ERROR_INVALID_PARAMS; | 2126 | eError = PVRSRV_ERROR_INVALID_PARAMS; |
2092 | } | 2127 | } |
2093 | 2128 | ||
@@ -2684,7 +2719,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, | |||
2684 | psLinuxMemArea = psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea; | 2719 | psLinuxMemArea = psLinuxMemArea->uData.sSubAlloc.psParentLinuxMemArea; |
2685 | } | 2720 | } |
2686 | 2721 | ||
2687 | 2722 | ||
2688 | PVR_ASSERT(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC); | 2723 | PVR_ASSERT(psLinuxMemArea->eAreaType != LINUX_MEM_AREA_SUB_ALLOC); |
2689 | 2724 | ||
2690 | switch(psLinuxMemArea->eAreaType) | 2725 | switch(psLinuxMemArea->eAreaType) |
@@ -2695,7 +2730,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, | |||
2695 | { | 2730 | { |
2696 | pvMinVAddr = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + ui32AreaOffset; | 2731 | pvMinVAddr = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + ui32AreaOffset; |
2697 | 2732 | ||
2698 | 2733 | ||
2699 | if(pvRangeAddrStart < pvMinVAddr) | 2734 | if(pvRangeAddrStart < pvMinVAddr) |
2700 | goto err_blocked; | 2735 | goto err_blocked; |
2701 | 2736 | ||
@@ -2703,8 +2738,8 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, | |||
2703 | } | 2738 | } |
2704 | else | 2739 | else |
2705 | { | 2740 | { |
2706 | 2741 | ||
2707 | 2742 | ||
2708 | 2743 | ||
2709 | pvMinVAddr = FindMMapBaseVAddr(psMMapOffsetStructList, | 2744 | pvMinVAddr = FindMMapBaseVAddr(psMMapOffsetStructList, |
2710 | pvRangeAddrStart, ui32Length); | 2745 | pvRangeAddrStart, ui32Length); |
@@ -2714,21 +2749,21 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, | |||
2714 | pfnInnerCacheOp(pvRangeAddrStart, pvRangeAddrStart + ui32Length); | 2749 | pfnInnerCacheOp(pvRangeAddrStart, pvRangeAddrStart + ui32Length); |
2715 | 2750 | ||
2716 | #if defined(CONFIG_OUTER_CACHE) | 2751 | #if defined(CONFIG_OUTER_CACHE) |
2717 | 2752 | ||
2718 | pvRangeAddrStart = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + | 2753 | pvRangeAddrStart = psLinuxMemArea->uData.sVmalloc.pvVmallocAddress + |
2719 | (ui32AreaOffset & PAGE_MASK) + (pvRangeAddrStart - pvMinVAddr); | 2754 | (ui32AreaOffset & PAGE_MASK) + (pvRangeAddrStart - pvMinVAddr); |
2720 | } | 2755 | } |
2721 | 2756 | ||
2722 | pfnMemAreaToPhys = VMallocAreaToPhys; | 2757 | pfnMemAreaToPhys = VMallocAreaToPhys; |
2723 | #else | 2758 | #else |
2724 | } | 2759 | } |
2725 | #endif | 2760 | #endif |
2726 | break; | 2761 | break; |
2727 | } | 2762 | } |
2728 | 2763 | ||
2729 | case LINUX_MEM_AREA_EXTERNAL_KV: | 2764 | case LINUX_MEM_AREA_EXTERNAL_KV: |
2730 | { | 2765 | { |
2731 | 2766 | ||
2732 | if (psLinuxMemArea->uData.sExternalKV.bPhysContig == IMG_TRUE) | 2767 | if (psLinuxMemArea->uData.sExternalKV.bPhysContig == IMG_TRUE) |
2733 | { | 2768 | { |
2734 | PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush contiguous external memory", __func__)); | 2769 | PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush contiguous external memory", __func__)); |
@@ -2736,7 +2771,7 @@ IMG_BOOL CheckExecuteCacheOp(IMG_HANDLE hOSMemHandle, | |||
2736 | goto err_blocked; | 2771 | goto err_blocked; |
2737 | } | 2772 | } |
2738 | 2773 | ||
2739 | 2774 | ||
2740 | if (psLinuxMemArea->uData.sExternalKV.pvExternalKV != IMG_NULL) | 2775 | if (psLinuxMemArea->uData.sExternalKV.pvExternalKV != IMG_NULL) |
2741 | { | 2776 | { |
2742 | PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush external memory with a kernel virtual address", __func__)); | 2777 | PVR_DPF((PVR_DBG_WARNING, "%s: Attempt to flush external memory with a kernel virtual address", __func__)); |
@@ -2865,7 +2900,7 @@ IMG_BOOL OSFlushCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, | |||
2865 | IMG_VOID *pvRangeAddrStart, | 2900 | IMG_VOID *pvRangeAddrStart, |
2866 | IMG_UINT32 ui32Length) | 2901 | IMG_UINT32 ui32Length) |
2867 | { | 2902 | { |
2868 | 2903 | ||
2869 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, | 2904 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, |
2870 | x86_flush_cache_range, IMG_NULL); | 2905 | x86_flush_cache_range, IMG_NULL); |
2871 | } | 2906 | } |
@@ -2874,7 +2909,7 @@ IMG_BOOL OSCleanCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, | |||
2874 | IMG_VOID *pvRangeAddrStart, | 2909 | IMG_VOID *pvRangeAddrStart, |
2875 | IMG_UINT32 ui32Length) | 2910 | IMG_UINT32 ui32Length) |
2876 | { | 2911 | { |
2877 | 2912 | ||
2878 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, | 2913 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, |
2879 | x86_flush_cache_range, IMG_NULL); | 2914 | x86_flush_cache_range, IMG_NULL); |
2880 | } | 2915 | } |
@@ -2883,12 +2918,12 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, | |||
2883 | IMG_VOID *pvRangeAddrStart, | 2918 | IMG_VOID *pvRangeAddrStart, |
2884 | IMG_UINT32 ui32Length) | 2919 | IMG_UINT32 ui32Length) |
2885 | { | 2920 | { |
2886 | 2921 | ||
2887 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, | 2922 | return CheckExecuteCacheOp(hOSMemHandle, pvRangeAddrStart, ui32Length, |
2888 | x86_flush_cache_range, IMG_NULL); | 2923 | x86_flush_cache_range, IMG_NULL); |
2889 | } | 2924 | } |
2890 | 2925 | ||
2891 | #else | 2926 | #else |
2892 | 2927 | ||
2893 | #if defined(__arm__) | 2928 | #if defined(__arm__) |
2894 | 2929 | ||
@@ -2900,7 +2935,7 @@ static void per_cpu_cache_flush(void *arg) | |||
2900 | 2935 | ||
2901 | IMG_VOID OSCleanCPUCacheKM(IMG_VOID) | 2936 | IMG_VOID OSCleanCPUCacheKM(IMG_VOID) |
2902 | { | 2937 | { |
2903 | 2938 | ||
2904 | ON_EACH_CPU(per_cpu_cache_flush, NULL, 1); | 2939 | ON_EACH_CPU(per_cpu_cache_flush, NULL, 1); |
2905 | #if defined(CONFIG_OUTER_CACHE) && !defined(PVR_NO_FULL_CACHE_OPS) | 2940 | #if defined(CONFIG_OUTER_CACHE) && !defined(PVR_NO_FULL_CACHE_OPS) |
2906 | outer_clean_all(); | 2941 | outer_clean_all(); |
@@ -2939,18 +2974,18 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, | |||
2939 | dmac_inv_range, outer_inv_range); | 2974 | dmac_inv_range, outer_inv_range); |
2940 | } | 2975 | } |
2941 | 2976 | ||
2942 | #else | 2977 | #else |
2943 | 2978 | ||
2944 | #if defined(__mips__) | 2979 | #if defined(__mips__) |
2945 | IMG_VOID OSCleanCPUCacheKM(IMG_VOID) | 2980 | IMG_VOID OSCleanCPUCacheKM(IMG_VOID) |
2946 | { | 2981 | { |
2947 | 2982 | ||
2948 | dma_cache_wback(0, 0x100000); | 2983 | dma_cache_wback(0, 0x100000); |
2949 | } | 2984 | } |
2950 | 2985 | ||
2951 | IMG_VOID OSFlushCPUCacheKM(IMG_VOID) | 2986 | IMG_VOID OSFlushCPUCacheKM(IMG_VOID) |
2952 | { | 2987 | { |
2953 | 2988 | ||
2954 | dma_cache_wback_inv(0, 0x100000); | 2989 | dma_cache_wback_inv(0, 0x100000); |
2955 | } | 2990 | } |
2956 | 2991 | ||
@@ -2978,15 +3013,15 @@ IMG_BOOL OSInvalidateCPUCacheRangeKM(IMG_HANDLE hOSMemHandle, | |||
2978 | return IMG_TRUE; | 3013 | return IMG_TRUE; |
2979 | } | 3014 | } |
2980 | 3015 | ||
2981 | #else | 3016 | #else |
2982 | 3017 | ||
2983 | #error "Implement CPU cache flush/clean/invalidate primitives for this CPU!" | 3018 | #error "Implement CPU cache flush/clean/invalidate primitives for this CPU!" |
2984 | 3019 | ||
2985 | #endif | 3020 | #endif |
2986 | 3021 | ||
2987 | #endif | 3022 | #endif |
2988 | 3023 | ||
2989 | #endif | 3024 | #endif |
2990 | 3025 | ||
2991 | PVRSRV_ERROR PVROSFuncInit(IMG_VOID) | 3026 | PVRSRV_ERROR PVROSFuncInit(IMG_VOID) |
2992 | { | 3027 | { |
@@ -2995,7 +3030,7 @@ PVRSRV_ERROR PVROSFuncInit(IMG_VOID) | |||
2995 | psTimerWorkQueue = create_workqueue("pvr_timer"); | 3030 | psTimerWorkQueue = create_workqueue("pvr_timer"); |
2996 | if (psTimerWorkQueue == NULL) | 3031 | if (psTimerWorkQueue == NULL) |
2997 | { | 3032 | { |
2998 | PVR_DPF((PVR_DBG_ERROR, "%s: couldn't create timer workqueue", __FUNCTION__)); | 3033 | PVR_DPF((PVR_DBG_ERROR, "%s: couldn't create timer workqueue", __FUNCTION__)); |
2999 | return PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD; | 3034 | return PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD; |
3000 | 3035 | ||
3001 | } | 3036 | } |