packaging: update the changelog
[profile/ivi/intel-emgd-kmod.git] / drivers / pvr / services4 / srvkm / env / linux / mutils.h
1 /**********************************************************************
2  Copyright (c) Imagination Technologies Ltd.
3
4  Permission is hereby granted, free of charge, to any person obtaining a copy
5  of this software and associated documentation files (the "Software"), to deal
6  in the Software without restriction, including without limitation the rights
7  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  copies of the Software, and to permit persons to whom the Software is
9  furnished to do so, subject to the following conditions:
10
11  The above copyright notice and this permission notice shall be included in
12  all copies or substantial portions of the Software.
13
14  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  THE SOFTWARE.
21  ******************************************************************************/
22
23 #ifndef __IMG_LINUX_MUTILS_H__
24 #define __IMG_LINUX_MUTILS_H__
25
26 #include <linux/version.h>
27
28 #if !(defined(__i386__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)))
29 #if defined(SUPPORT_LINUX_X86_PAT)
30 #undef SUPPORT_LINUX_X86_PAT
31 #endif
32 #endif
33
34 #if defined(SUPPORT_LINUX_X86_PAT)
35         pgprot_t pvr_pgprot_writecombine(pgprot_t prot);
36         #define PGPROT_WC(pv)   pvr_pgprot_writecombine(pv)
37 #else
38         #if defined(__arm__) || defined(__sh__)
39                 #define PGPROT_WC(pv)   pgprot_writecombine(pv)
40         #else
41                 #if defined(__i386__)
42                         #define PGPROT_WC(pv)   pgprot_noncached(pv)
43                 #else
44                         #define PGPROT_WC(pv)   pgprot_noncached(pv)
45                         #error  Unsupported architecture!
46                 #endif
47         #endif
48 #endif
49
50 #define PGPROT_UC(pv)   pgprot_noncached(pv)
51
52 #if defined(__i386__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
53         #define IOREMAP(pa, bytes)      ioremap_cache(pa, bytes)
54 #else
55         #if defined(__arm__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
56                 #define IOREMAP(pa, bytes)      ioremap_cached(pa, bytes)
57         #else
58                 #define IOREMAP(pa, bytes)      ioremap(pa, bytes)
59         #endif
60 #endif
61
62 #if defined(SUPPORT_LINUX_X86_PAT)
63         #if defined(SUPPORT_LINUX_X86_WRITECOMBINE)
64                 #define IOREMAP_WC(pa, bytes) ioremap_wc(pa, bytes)
65         #else
66                 #define IOREMAP_WC(pa, bytes) ioremap_nocache(pa, bytes)
67         #endif
68 #else
69         #if defined(__arm__)
70                 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
71                         #define IOREMAP_WC(pa, bytes) ioremap_wc(pa, bytes)
72                 #else
73                         #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
74                                 #define IOREMAP_WC(pa, bytes)   ioremap_nocache(pa, bytes)
75                         #else
76                                 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17))
77                                         #define IOREMAP_WC(pa, bytes)   __ioremap(pa, bytes, L_PTE_BUFFERABLE)
78                                 #else
79                                         #define IOREMAP_WC(pa, bytes)   __ioremap(pa, bytes, , L_PTE_BUFFERABLE, 1)
80                                 #endif
81                         #endif
82                 #endif
83         #else
84                 #define IOREMAP_WC(pa, bytes)   ioremap_nocache(pa, bytes)
85         #endif
86 #endif
87
88 #define IOREMAP_UC(pa, bytes)   ioremap_nocache(pa, bytes)
89
90 IMG_VOID PVRLinuxMUtilsInit(IMG_VOID);
91
92 #endif
93