summaryrefslogtreecommitdiffstats
path: root/abs/core/catalyst/fglrx-2.6.33.patch
blob: 7ba9ecd0eecdb8cb2cf2c669a7d9490ff064c922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Index: ati10.1/common/lib/modules/fglrx/build_mod/drmP.h
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/drmP.h
+++ ati10.1/common/lib/modules/fglrx/build_mod/drmP.h	2010-01-28 19:57:07.562644291 +0200
@@ -42,7 +42,12 @@
  * can build the DRM (part of PI DRI). 4/21/2000 S + B */
 #include <asm/current.h>
 #endif /* __alpha__ */
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
@@ -51,7 +56,6 @@
 #include <linux/init.h>
 #include <linux/file.h>
 #include <linux/pci.h>
-#include <linux/version.h>
 #include <linux/sched.h>
 #include <linux/smp_lock.h>	/* For (un)lock_kernel */
 #include <linux/mm.h>
Index: ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-01-29 14:21:58.687999115 +0200
@@ -28,7 +28,11 @@
 #error Kernel versions older than 2.6.0 are no longer supported by this module.
 #endif 
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 
 #if !defined(CONFIG_X86) 
 #if !defined(CONFIG_X86_PC) 
@@ -163,8 +167,12 @@
 
 //  For 2.6.18 or higher, the UTS_RELEASE is defined in the linux/utsrelease.h. 
 #ifndef UTS_RELEASE 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/utsrelease.h>
+#else
 #include <linux/utsrelease.h>
 #endif
+#endif
 
 #if defined(__i386__)
 #ifndef do_div
@@ -1472,7 +1472,16 @@
 #ifndef __HAVE_ARCH_CMPXCHG
     return __fgl_cmpxchg(ptr,old,new,size);
 #else
-    return __cmpxchg(ptr,old,new,size);
+    switch (size) {
+    case 1: { volatile u8 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
+    case 2: { volatile u16 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
+    case 4: { volatile u32 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
+#ifdef __x86_64__
+    case 8: { volatile u64 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
+#endif
+    default:
+        return old;
+    }
 #endif
 }

 
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c	2010-01-28 19:57:17.897225045 +0200
@@ -15,7 +15,11 @@
  ****************************************************************************/
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/acpi.h>
 
 #include "kcl_config.h"
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c	2010-01-28 19:57:26.104892082 +0200
@@ -31,7 +31,11 @@
  */
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/pci.h>
 #include <linux/agp_backend.h>
 #include <linux/string.h>
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c	2010-01-28 19:57:34.337558105 +0200
@@ -37,7 +37,11 @@
  */
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/poll.h>
 #include <linux/signal.h>
 #include <asm/io.h>
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h	2010-01-28 19:57:43.599182385 +0200
@@ -20,7 +20,11 @@
 #define KCL_OSCONFIG_H
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 
 // Choose modern way to call 32-on-64 IOCTLs if configured in the kernel
 #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c	2010-01-28 19:57:51.295870149 +0200
@@ -31,7 +31,11 @@
  */
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/pci.h>
 
 #include "kcl_config.h"
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c	2010-01-28 19:57:59.728528058 +0200
@@ -30,7 +30,12 @@
  *
  */
 
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/string.h>
 #include <linux/module.h>
 
Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c
+++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-01-28 19:58:08.936154527 +0200
@@ -31,7 +31,11 @@
  */
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+#include <generated/autoconf.h>
+#else
 #include <linux/autoconf.h>
+#endif
 #include <linux/wait.h>
 #include <linux/highmem.h>
 #include <linux/sched.h>
Index: ati10.1/common/lib/modules/fglrx/build_mod/make.sh
===================================================================
--- ati10.1/common/lib/modules/fglrx/build_mod/make.sh
+++ ati10.1/common/lib/modules/fglrx/build_mod/make.sh	2010-01-28 19:55:10.849378991 +0200
@@ -218,8 +218,15 @@
         # UTS-define is in external version-*.h files, i.e. linux-2.2.14-5.0-RedHat does this flaw
         kernel_release=`cat $linuxincludes/linux/version-*.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2` 
     else
-        # For 2.6.18 or higher, UTS-define is defined in utsrelease.h.
-        kernel_release=`cat $linuxincludes/linux/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2` 
+        UTS_REL_COUNT=`cat $linuxincludes/generated/utsrelease.h 2>/dev/null | grep UTS_RELEASE -c`
+
+	if [ $UTS_REL_COUNT -gt 0 ]; then
+	    # 2.6.33+
+	    kernel_release=`cat $linuxincludes/generated/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2`
+	else
+            # For 2.6.18 to 2.6.32, UTS-define is defined in utsrelease.h.
+            kernel_release=`cat $linuxincludes/linux/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2`
+	fi
     fi
   fi
 fi
@@ -302,7 +309,8 @@
 # 3
 # linux/autoconf.h may contain this: #define CONFIG_SMP 1
 
-src_file=$linuxincludes/linux/autoconf.h
+src_file=$linuxincludes/generated/autoconf.h
+[ -e $src_file ] || src_file=$linuxincludes/linux/autoconf.h
 
 if [ ! -e $src_file ]; then
   echo "Warning:"                                                  >> $logfile
@@ -355,7 +363,8 @@
 MODVERSIONS=0
 
 # linux/autoconf.h may contain this: #define CONFIG_MODVERSIONS 1
-src_file=$linuxincludes/linux/autoconf.h
+src_file=$linuxincludes/generated/autoconf.h
+[ -e $src_file ] || src_file=$linuxincludes/linux/autoconf.h
 if [ ! -e $src_file ];
 then
   echo "Warning:"                                                  >> $logfile