Contents of /trunk/ati-drivers/patches/fglrx-833-2620-fixes.patch
Parent Directory | Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (16 years, 11 months ago) by niro
File size: 3284 byte(s)
Tue May 8 20:06:05 2007 UTC (16 years, 11 months ago) by niro
File size: 3284 byte(s)
-import
1 | fglrx-8.33.6 updates for Linux-2.6.20[rc] compatibility: |
2 | |
3 | - 2.6.19 removed third argument from irq handler function. |
4 | - 2.6.20-rc removed the syscall macros from asm-*/unistd.h. |
5 | - 2.6.20-rc6 removed the old SA_* irq flag macros. |
6 | |
7 | last updated: 070206: really fixed syscall_clobber (r11, doh!) |
8 | |
9 | --- firegl_public.c.orig 2007-02-05 16:29:49.891742000 +0100 |
10 | +++ firegl_public.c 2007-02-05 16:31:22.761742000 +0100 |
11 | @@ -194,6 +194,82 @@ |
12 | int errno; |
13 | #endif // __ia64__ |
14 | |
15 | +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) |
16 | +#if defined(__i386__) |
17 | + |
18 | +#define __syscall_return(type, res) \ |
19 | +do { \ |
20 | + if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
21 | + errno = -(res); \ |
22 | + res = -1; \ |
23 | + } \ |
24 | + return (type) (res); \ |
25 | +} while (0) |
26 | + |
27 | +#define _syscall2(type,name,type1,arg1,type2,arg2) \ |
28 | +type name(type1 arg1,type2 arg2) \ |
29 | +{ \ |
30 | +long __res; \ |
31 | +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
32 | + : "=a" (__res) \ |
33 | + : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \ |
34 | + : "memory"); \ |
35 | +__syscall_return(type,__res); \ |
36 | +} |
37 | + |
38 | +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ |
39 | +type name(type1 arg1,type2 arg2,type3 arg3) \ |
40 | +{ \ |
41 | +long __res; \ |
42 | +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
43 | + : "=a" (__res) \ |
44 | + : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \ |
45 | + "d" ((long)(arg3)) : "memory"); \ |
46 | +__syscall_return(type,__res); \ |
47 | +} |
48 | + |
49 | +#elif defined(__x86_64__) |
50 | +#define __syscall_clobber "r11","rcx","memory" |
51 | + |
52 | +#define __syscall_return(type, res) \ |
53 | +do { \ |
54 | + if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
55 | + errno = -(res); \ |
56 | + res = -1; \ |
57 | + } \ |
58 | + return (type) (res); \ |
59 | +} while (0) |
60 | + |
61 | +#define __syscall "syscall" |
62 | + |
63 | +#define _syscall2(type,name,type1,arg1,type2,arg2) \ |
64 | +type name(type1 arg1,type2 arg2) \ |
65 | +{ \ |
66 | +long __res; \ |
67 | +__asm__ volatile (__syscall \ |
68 | + : "=a" (__res) \ |
69 | + : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ |
70 | +__syscall_return(type,__res); \ |
71 | +} |
72 | + |
73 | +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ |
74 | +type name(type1 arg1,type2 arg2,type3 arg3) \ |
75 | +{ \ |
76 | +long __res; \ |
77 | +__asm__ volatile (__syscall \ |
78 | + : "=a" (__res) \ |
79 | + : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ |
80 | + "d" ((long)(arg3)) : __syscall_clobber); \ |
81 | +__syscall_return(type,__res); \ |
82 | +} |
83 | + |
84 | +#else |
85 | + |
86 | +#error "please fix the fglrx syscall mess" |
87 | + |
88 | +#endif /* __i386__ */ |
89 | +#endif /* 2.6.19 */ |
90 | + |
91 | // int mlock(const void *addr, size_t len); |
92 | _syscall2(int, mlock, const void *, addr, size_t, len ) |
93 | // int munlock(const void *addr, size_t len); |
94 | @@ -2561,11 +2637,23 @@ void ATI_API_CALL __ke_free_irq(unsigned |
95 | #else |
96 | static void ATI_API_CALL (*irq_handler_func)(int, void*, void*); /* function pointer variable */ |
97 | |
98 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
99 | static irqreturn_t ke_irq_handler_wrap(int irq, void *arg1, struct pt_regs *regs) |
100 | { |
101 | irq_handler_func(irq, arg1, regs); |
102 | return IRQ_HANDLED; |
103 | } |
104 | +#else |
105 | +static irqreturn_t ke_irq_handler_wrap(int irq, void *arg1) |
106 | +{ |
107 | + irq_handler_func(irq, arg1, get_irq_regs()); |
108 | + return IRQ_HANDLED; |
109 | +} |
110 | +#endif |
111 | + |
112 | +#ifndef SA_SHIRQ |
113 | +#define SA_SHIRQ IRQF_SHARED |
114 | +#endif |
115 | |
116 | int ATI_API_CALL __ke_request_irq(unsigned int irq, |
117 | void (*ATI_API_CALL handler)(int, void *, void *), |