Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 98144 | Differences between
and this patch

Collapse All | Expand All

(-)matroxdriver-1.4.1/kernel/src/mtx_agp.c (-4 / +27 lines)
Lines 7-12 Link Here
7
References:     None.
7
References:     None.
8
8
9
Author:         Karl Lessard    <klessard@matrox.com>
9
Author:         Karl Lessard    <klessard@matrox.com>
10
2.6.x Updates:  Alexander Griesser <matrox@tuxx-home.at>
10
11
11
    Copyright (c) 2001, Matrox Graphics Inc.
12
    Copyright (c) 2001, Matrox Graphics Inc.
12
    All Rights Reserved.
13
    All Rights Reserved.
Lines 23-28 Link Here
23
const drm_agp_t *agp_backend = NULL;
24
const drm_agp_t *agp_backend = NULL;
24
#endif
25
#endif
25
26
27
/* Support multiple agp bridges in newer kernels */
28
#ifdef AGPGART_HAS_BRIDGES
29
  struct agp_bridge_data *bridge;
30
#endif
31
26
void mtx_agp_chipset_info_print( AGP_KernInfo* poAGPInfo );
32
void mtx_agp_chipset_info_print( AGP_KernInfo* poAGPInfo );
27
33
28
/***************************************************************************************
34
/***************************************************************************************
Lines 64-71 Link Here
64
#endif
70
#endif
65
71
66
    /* Copy AGP information */
72
    /* Copy AGP information */
67
    MTX_AGPGART_COPY_INFO( agp_backend, &agp_drv->kern_info);
73
#ifdef AGPGART_HAS_BRIDGES
68
    
74
    MTX_AGPGART_COPY_INFO(agp_bridge, &agp_drv->kern_info);
75
#else
76
    MTX_AGPGART_COPY_INFO(agp_backend, &agp_drv->kern_info);
77
#endif
78
69
    agp_drv->aperture_base = agp_drv->kern_info.aper_base;
79
    agp_drv->aperture_base = agp_drv->kern_info.aper_base;
70
    agp_drv->aperture_size = agp_drv->kern_info.aper_size * 1024L * 1024L;
80
    agp_drv->aperture_size = agp_drv->kern_info.aper_size * 1024L * 1024L;
71
81
Lines 136-145 Link Here
136
    if (!agp_drv || (agp_drv->dev != NULL)) 
146
    if (!agp_drv || (agp_drv->dev != NULL)) 
137
        return -EINVAL;
147
        return -EINVAL;
138
148
149
#ifdef AGPGART_HAS_BRIDGES
150
    /* acquire control of AGP backend */
151
    if(!(bridge = MTX_AGPGART_BACKEND_ACQUIRE(&agp_drv->dev)))
152
      return -ENODEV;
153
#else
139
    /* acquire control of AGP backend */
154
    /* acquire control of AGP backend */
140
    if ((ret = MTX_AGPGART_BACKEND_ACQUIRE(agp_backend)) < 0)
155
    if ((ret = MTX_AGPGART_BACKEND_ACQUIRE(agp_backend)) < 0)
141
        return ret;
156
        return ret;
142
157
#endif
143
    agp_drv->dev = dev;
158
    agp_drv->dev = dev;
144
159
145
    return 0;
160
    return 0;
Lines 164-170 Link Here
164
        return;
179
        return;
165
180
166
    /* release control of AGP backend */
181
    /* release control of AGP backend */
182
#ifdef AGPGART_HAS_BRIDGES
183
    MTX_AGPGART_BACKEND_RELEASE(bridge);
184
#else
167
    MTX_AGPGART_BACKEND_RELEASE(agp_backend);
185
    MTX_AGPGART_BACKEND_RELEASE(agp_backend);
186
#endif
168
187
169
    agp_drv->dev = NULL;
188
    agp_drv->dev = NULL;
170
};
189
};
Lines 234-240 Link Here
234
                  agp_drv->rate;
253
                  agp_drv->rate;
235
254
236
    /* enable AGP controller */
255
    /* enable AGP controller */
237
    MTX_AGPGART_BACKEND_ENABLE(agp_backend,agp_command);
256
#ifdef AGPGART_HAS_BRIDGES
257
    MTX_AGPGART_BACKEND_ENABLE(bridge, agp_command);
258
#else
259
    MTX_AGPGART_BACKEND_ENABLE(agp_backend, agp_command);
260
#endif
238
261
239
    agp_drv->enabled = 1;
262
    agp_drv->enabled = 1;
240
263
(-)matroxdriver-1.4.1/kernel/src/mtx_drv.h (-6 / +26 lines)
Lines 7-12 Link Here
7
References:     None.
7
References:     None.
8
8
9
Author:         Karl Lessard    <klessard@matrox.com>
9
Author:         Karl Lessard    <klessard@matrox.com>
10
2.6.x Updates:  Alexander Griesser <matrox@tuxx-home.at>
10
11
11
    Copyright (c) 2001, Matrox Graphics Inc.
12
    Copyright (c) 2001, Matrox Graphics Inc.
12
    All Rights Reserved.
13
    All Rights Reserved.
Lines 95-116 Link Here
95
96
96
#endif
97
#endif
97
98
98
/* Special macros for linux kernel 2.6.10 and upwards */
99
/* Special macros for linux kernel 2.6.12 and upwards
99
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
100
 * because agp_backend.h has been changed again to support
101
 * multiple agp_bridges, yeah */
102
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
103
104
    #define AGPGART_HAS_BRIDGES
105
106
    #define MTX_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire(o)
107
    #define MTX_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(o,count,type)
108
    #define MTX_AGPGART_COPY_INFO(o,p) agp_copy_info(o,p)
109
    #define MTX_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(o,mode)
110
    #define MTX_AGPGART_BACKEND_RELEASE(o) agp_backend_release(o)
111
    #define MTX_AGPGART_FREE_MEMORY(o) agp_free_memory(o)
112
    #define MTX_AGPGART_BIND_MEMORY(o,offset) agp_bind_memory(o,offset)
113
    #define MTX_AGPGART_UNBIND_MEMORY(o) agp_unbind_memory(o)
114
#endif
115
116
/* Special macros for linux kernel >= 2.6.10 to < 2.6.12 */
117
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
100
118
101
    #define MTX_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire()
119
    #define MTX_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire()
120
    #define MTX_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type)
121
    #define MTX_AGPGART_COPY_INFO(o,p) agp_copy_info(p)
102
    #define MTX_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode)
122
    #define MTX_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode)
103
    #define MTX_AGPGART_BACKEND_RELEASE(o) agp_backend_release()
123
    #define MTX_AGPGART_BACKEND_RELEASE(o) agp_backend_release()
104
    #define MTX_AGPGART_COPY_INFO(o,p) agp_copy_info(p)
105
    #define MTX_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type)
106
    #define MTX_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p)
124
    #define MTX_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p)
107
    #define MTX_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset)
125
    #define MTX_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset)
108
    #define MTX_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p)
126
    #define MTX_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p)
127
#endif
109
128
110
#else
129
/* For kernels < 2.6.10 (including all 2.4 kernels) */
130
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
111
131
112
    #define AGPBACKEND
132
    #define AGPBACKEND
113
    
133
114
    #define MTX_AGPGART_BACKEND_ACQUIRE(o) (o)->acquire() 
134
    #define MTX_AGPGART_BACKEND_ACQUIRE(o) (o)->acquire() 
115
    #define MTX_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode)
135
    #define MTX_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode)
116
    #define MTX_AGPGART_BACKEND_RELEASE(o) (o) ->release()
136
    #define MTX_AGPGART_BACKEND_RELEASE(o) (o) ->release()
(-)matroxdriver-1.4.1/kernel/src/mtx_mem.c (-2 / +24 lines)
Lines 7-12 Link Here
7
References:     None.
7
References:     None.
8
8
9
Author:         Karl Lessard    <klessard@matrox.com>
9
Author:         Karl Lessard    <klessard@matrox.com>
10
2.6.x Updates:  Alexander Griesser <matrox@tuxx-home.at>
10
11
11
    Copyright (c) 2001, Matrox Graphics Inc.
12
    Copyright (c) 2001, Matrox Graphics Inc.
12
    All Rights Reserved.
13
    All Rights Reserved.
Lines 27-32 Link Here
27
extern drm_agp_t *agp_backend;
28
extern drm_agp_t *agp_backend;
28
#endif
29
#endif
29
30
31
/* Support multiple agp bridges in newer kernels */
32
#ifdef AGPGART_HAS_BRIDGES
33
  extern struct agp_bridge_data *bridge;
34
#endif
35
30
/* list of agp memory blocks (first item use as sentinel) */
36
/* list of agp memory blocks (first item use as sentinel) */
31
static AGP_Memory agp_blocks = { 0, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 };
37
static AGP_Memory agp_blocks = { 0, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 };
32
38
Lines 192-198 Link Here
192
        return 0;
198
        return 0;
193
199
194
    /* Alloc AGP memory block */
200
    /* Alloc AGP memory block */
201
#ifdef AGPGART_HAS_BRIDGES
202
    info_block = MTX_AGPGART_ALLOCATE_MEMORY(bridge, pg_count, AGP_NORMAL_MEMORY);
203
#else
195
    info_block = MTX_AGPGART_ALLOCATE_MEMORY(agp_backend, pg_count, AGP_NORMAL_MEMORY);
204
    info_block = MTX_AGPGART_ALLOCATE_MEMORY(agp_backend, pg_count, AGP_NORMAL_MEMORY);
205
#endif
196
206
197
    if (!info_block) {
207
    if (!info_block) {
198
        MTX_ERROR("Failed to allocate AGP memory block\n");
208
        MTX_ERROR("Failed to allocate AGP memory block\n");
Lines 234-241 Link Here
234
    }
244
    }
235
245
236
    /* Bind memory block to GATT */
246
    /* Bind memory block to GATT */
247
#ifdef AGPGART_HAS_BRIDGES
248
    ret = MTX_AGPGART_BIND_MEMORY(info_block, pg_offset);
249
#else
237
    ret = MTX_AGPGART_BIND_MEMORY(agp_backend, info_block, pg_offset);
250
    ret = MTX_AGPGART_BIND_MEMORY(agp_backend, info_block, pg_offset);
238
    
251
#endif
252
239
    if (ret < 0) {
253
    if (ret < 0) {
240
        MTX_ERROR("Failed to bind physical memory to AGP memory block\n");
254
        MTX_ERROR("Failed to bind physical memory to AGP memory block\n");
241
        return 0;
255
        return 0;
Lines 313-319 Link Here
313
    }
327
    }
314
328
315
    /* Unbind memory from AGP driver */
329
    /* Unbind memory from AGP driver */
330
#ifdef AGPGART_HAS_BRIDGES
331
    ret = MTX_AGPGART_UNBIND_MEMORY(ptr_block);
332
#else
316
    ret = MTX_AGPGART_UNBIND_MEMORY(agp_backend, ptr_block);
333
    ret = MTX_AGPGART_UNBIND_MEMORY(agp_backend, ptr_block);
334
#endif
317
335
318
    if (ret < 0) {
336
    if (ret < 0) {
319
        MTX_ERROR("Failed to unbind memory block (returned %d)\n", ret);
337
        MTX_ERROR("Failed to unbind memory block (returned %d)\n", ret);
Lines 321-328 Link Here
321
    }
339
    }
322
340
323
    /* Free memory block */
341
    /* Free memory block */
342
#ifdef AGPGART_HAS_BRIDGES
343
    MTX_AGPGART_FREE_MEMORY(ptr_block);
344
#else
324
    MTX_AGPGART_FREE_MEMORY(agp_backend, ptr_block);
345
    MTX_AGPGART_FREE_MEMORY(agp_backend, ptr_block);
325
    
346
#endif
347
326
  #if MEMORY_STATS
348
  #if MEMORY_STATS
327
    --alloc_agp_count;
349
    --alloc_agp_count;
328
    alloc_agp_mem -= size;
350
    alloc_agp_mem -= size;
(-)matroxdriver-1.4.1/kernel/src/mtx_vm.c (-1 / +1 lines)
Lines 160-166 Link Here
160
    spin_lock(&init_mm.page_table_lock);
160
    spin_lock(&init_mm.page_table_lock);
161
161
162
    pgd = pgd_offset_k(kaddr); if (pgd_none(*pgd)) return NULL;
162
    pgd = pgd_offset_k(kaddr); if (pgd_none(*pgd)) return NULL;
163
    pmd = pmd_offset(pgd, kaddr); if (pmd_none(*pmd)) return NULL;
163
    pmd = pmd_offset( (pud_t*) pgd, kaddr); if (pmd_none(*pmd)) return NULL;
164
  #ifdef pte_offset_map
164
  #ifdef pte_offset_map
165
    pte = pte_offset_map(pmd, kaddr); if (!pte_present(*pte)) return NULL;
165
    pte = pte_offset_map(pmd, kaddr); if (!pte_present(*pte)) return NULL;
166
    page = pte_page(*pte); if (!page) return NOPAGE_SIGBUS;
166
    page = pte_page(*pte); if (!page) return NOPAGE_SIGBUS;

Return to bug 98144