aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/pvr/mutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/pvr/mutils.h')
-rw-r--r--drivers/gpu/pvr/mutils.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/mutils.h b/drivers/gpu/pvr/mutils.h
new file mode 100644
index 00000000000..943c2bd80a3
--- /dev/null
+++ b/drivers/gpu/pvr/mutils.h
@@ -0,0 +1,101 @@
1/**********************************************************************
2 *
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24 *
25 ******************************************************************************/
26
27#ifndef __IMG_LINUX_MUTILS_H__
28#define __IMG_LINUX_MUTILS_H__
29
30#ifndef AUTOCONF_INCLUDED
31#include <linux/config.h>
32#endif
33
34#include <linux/version.h>
35
36#if !(defined(__i386__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)))
37#if defined(SUPPORT_LINUX_X86_PAT)
38#undef SUPPORT_LINUX_X86_PAT
39#endif
40#endif
41
42#if defined(SUPPORT_LINUX_X86_PAT)
43 pgprot_t pvr_pgprot_writecombine(pgprot_t prot);
44 #define PGPROT_WC(pv) pvr_pgprot_writecombine(pv)
45#else
46 #if defined(__arm__) || defined(__sh__)
47 #define PGPROT_WC(pv) pgprot_writecombine(pv)
48 #else
49 #if defined(__i386__)
50 #define PGPROT_WC(pv) pgprot_noncached(pv)
51 #else
52 #define PGPROT_WC(pv) pgprot_noncached(pv)
53 #error Unsupported architecture!
54 #endif
55 #endif
56#endif
57
58#define PGPROT_UC(pv) pgprot_noncached(pv)
59
60#if defined(__i386__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
61 #define IOREMAP(pa, bytes) ioremap_cache(pa, bytes)
62#else
63 #if defined(__arm__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
64 #define IOREMAP(pa, bytes) ioremap_cached(pa, bytes)
65 #else
66 #define IOREMAP(pa, bytes) ioremap(pa, bytes)
67 #endif
68#endif
69
70#if defined(SUPPORT_LINUX_X86_PAT)
71 #if defined(SUPPORT_LINUX_X86_WRITECOMBINE)
72 #define IOREMAP_WC(pa, bytes) ioremap_wc(pa, bytes)
73 #else
74 #define IOREMAP_WC(pa, bytes) ioremap_nocache(pa, bytes)
75 #endif
76#else
77 #if defined(__arm__)
78 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
79 #define IOREMAP_WC(pa, bytes) ioremap_wc(pa, bytes)
80 #else
81 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
82 #define IOREMAP_WC(pa, bytes) ioremap_nocache(pa, bytes)
83 #else
84 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17))
85 #define IOREMAP_WC(pa, bytes) __ioremap(pa, bytes, L_PTE_BUFFERABLE)
86 #else
87 #define IOREMAP_WC(pa, bytes) __ioremap(pa, bytes, , L_PTE_BUFFERABLE, 1)
88 #endif
89 #endif
90 #endif
91 #else
92 #define IOREMAP_WC(pa, bytes) ioremap_nocache(pa, bytes)
93 #endif
94#endif
95
96#define IOREMAP_UC(pa, bytes) ioremap_nocache(pa, bytes)
97
98IMG_VOID PVRLinuxMUtilsInit(IMG_VOID);
99
100#endif
101