[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ATi Driver and Kernel 2.6.11
- From: Mauro Romano Trajber <trajber at gmail dot com>
- Date: Sat, 12 Mar 2005 15:26:35 -0300
Hi all,
I know about the big problem that k2.6.11 has dropped the definition
of drm_agp_t structure, and is not exporting variable drm_agp
anymore.
Is there a patch that works ??
Cuz' i applied the patch followed and did not work for me.
With that patch, the module compiles but when i call modprobe fglrx ...
FATAL: Error inserting fglrx (/lib/modules/2.6.11/misc/fglrx.ko):
Invalid module format
Any clue ?
PS: Current package version: 8.10.19-1
THE CURSED PATCH ;-)
--- firegl_public.c-orig 2005-02-17 21:10:34.821182824 +0200
+++ firegl_public.c 2005-02-17 21:11:26.549318952 +0200
@@ -2873,6 +2873,37 @@ int ATI_API_CALL __ke_vm_map(struct file
#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= 0x02060b
+
+typedef struct {
+ void (*free_memory)(struct agp_memory *);
+ struct agp_memory * (*allocate_memory)(size_t, u32);
+ int (*bind_memory)(struct agp_memory *, off_t);
+ int (*unbind_memory)(struct agp_memory *);
+ void (*enable)(u32);
+ int (*acquire)(void);
+ void (*release)(void);
+ int (*copy_info)(struct agp_kern_info *);
+} drm_agp_t;
+
+static const drm_agp_t drm_agp = {
+ &agp_free_memory,
+ &agp_allocate_memory,
+ &agp_bind_memory,
+ &agp_unbind_memory,
+ &agp_enable,
+ &agp_backend_acquire,
+ &agp_backend_release,
+ &agp_copy_info
+};
+#undef DRM_AGP_MODULE_GET
+#undef DRM_AGP_MODULE_PUT
+
+#define DRM_AGP_MODULE_GET &drm_agp
+#define DRM_AGP_MODULE_PUT
+
+#endif
+
static const drm_agp_t *drm_agp_module_stub = NULL;
#define AGP_FUNCTIONS 8
Hide a function and variable definition under x86, because are
used only on AMD64
--- agpgart_be.c-orig 2005-02-17 21:07:10.540238000 +0200
+++ agpgart_be.c 2005-02-17 21:13:09.712635744 +0200
@@ -6503,6 +6503,7 @@ static u8 find_agpv3_capptr(struct pci_d
// FGL - end
+#ifdef __x86_64__
static int agp_check_supported_device(struct pci_dev *dev)
{
@@ -6517,13 +6518,13 @@ static int agp_check_supported_device(st
return 0;
}
+#endif
/* Supported Device Scanning routine */
static int __init agp_find_supported_device(void)
{
struct pci_dev *dev = NULL;
- u8 cap_ptr = 0x00;
// locate host bridge device
#ifdef __x86_64__
@@ -6543,6 +6544,7 @@ static int __init agp_find_supported_dev
PCI_DEVICE_ID_NVIDIA_NFORCE3,
NULL)) {
+ u8 cap_ptr = 0x00;
/* find capndx */
cap_ptr = pci_find_capability(dev, PCI_CAP_ID_AGP);
if (cap_ptr == 0x00)
MODULE_PARM is removed in -mm patch series, and deprecated starting with I
don't remember which version of 2.6.x
--- firegl_public.c-orig 2005-02-17 21:11:26.549318952 +0200
+++ firegl_public.c 2005-02-17 21:16:12.581835400 +0200
@@ -217,7 +217,11 @@ int __ke_moduleflags = 0;
/* global module vars and constants - defined trough macros */
MODULE_AUTHOR("Fire GL - ATI Research GmbH, Germany");
MODULE_DESCRIPTION("ATI Fire GL");
+#if LINUX_VERSION_CODE <= 0x020600
MODULE_PARM(firegl, "s");
+#else
+module_param(firegl, charp, 0);
+#endif
#ifdef MODULE_LICENSE
MODULE_LICENSE("Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY");
#endif
--- firegl_public.c-orig
+++ firegl_public.c
@@ -205,6 +205,7 @@ _syscall3( int, modify_ldt, int, func, v
#ifndef pte_offset_map
#define pte_offset_map pte_offset
+#undef pte_unmap
#define pte_unmap(pte)
#endif
// ============================================================
--- firegl_public.c.orig 2005-02-12 13:30:15.220853088 +0200
+++ firegl_public.c 2005-02-12 13:35:48.226228576 +0200
@@ -1669,13 +1669,22 @@ unsigned long ATI_API_CALL __ke_get_vm_p
{
unsigned long pte_linear;
pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_t* pud_p;
+#endif
pmd_t* pmd_p;
pte_t* pte_p;
pte_t pte;
pte_linear = VMALLOC_VMADDR(virtual_addr); // convert to pte
linear address (x86 => nop)
pgd_p = pgd_offset(mm, pte_linear);
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_p = pud_offset(pgd_p, pte_linear);
+ pmd_p = pmd_offset(pud_p, pte_linear);
+#else
pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
+
#ifndef FGL_ATOMIC_PTE
#if LINUX_VERSION_CODE > 0x020500
pte_p = pte_offset_kernel(pmd_p, pte_linear);
@@ -2105,6 +2114,9 @@ static __inline__ vm_nopage_ret_t do_vm_
unsigned long address)
{
pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_t* pud_p;
+#endif
pmd_t* pmd_p;
pte_t* pte_p;
pte_t pte;
@@ -2205,7 +2217,12 @@ static __inline__ vm_nopage_ret_t do_vm_
/* alternatively we could generate a NOPAGE_OOM "out of memory" */
}
/* locate medium level page table (x86 => nop) */
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_p = pud_offset(pgd_p, pte_linear);
+ pmd_p = pmd_offset(pud_p, pte_linear);
+#else
pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
if (!pmd_present(*pmd_p))
{
__KE_ERROR("FATAL ERROR: User queue buffer not present! (pmd)\n");
@@ -2569,13 +2586,21 @@ char* ATI_API_CALL __ke_vm_phys_addr_str
{
unsigned long pte_linear;
pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_t* pud_p;
+#endif
pmd_t* pmd_p;
pte_t* pte_p;
pte_t pte;
pte_linear = VMALLOC_VMADDR(virtual_addr); // convert to pte
linear address (x86 => nop)
pgd_p = pgd_offset(vma->vm_mm, pte_linear);
+#if LINUX_VERSION_CODE > 0x02060a /* KERNEL_VERSION(2,6,11) */
+ pud_p = pud_offset(pgd_p, pte_linear);
+ pmd_p = pmd_offset(pud_p, pte_linear);
+#else
pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
#ifndef FGL_ATOMIC_PTE
#if LINUX_VERSION_CODE > 0x020500
pte_p = pte_offset_kernel(pmd_p, pte_linear);
Starting with 2.6.10 remap_page_range is deprecated, and removed in 2.6.11rc1
--- firegl_public.c-orig 2005-02-17 21:26:53.552393064 +0200
+++ firegl_public.c 2005-02-17 21:27:01.075249416 +0200
@@ -2749,13 +2749,23 @@ int ATI_API_CALL __ke_vm_map(struct file
#endif /* __ia64__ */
vma->vm_flags |= VM_IO; /* not in core dump */
}
+#if LINUX_VERSION_CODE >= 0x02060b
+ if (remap_pfn_range(FGL_VMA_API_PASS
+ vma->vm_start,
+ vma->vm_pgoff,
+#else
if (remap_page_range(FGL_VMA_API_PASS
vma->vm_start,
__ke_vm_offset(vma),
+#endif
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
{
+#if LINUX_VERSION_CODE >= 0x02060b
+ __KE_DEBUG("remap_pfn_range failed\n");
+#else
__KE_DEBUG("remap_page_range failed\n");
+#endif
return -EAGAIN;
}
vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
@@ -2814,15 +2824,29 @@ int ATI_API_CALL __ke_vm_map(struct file
#else
// else
{
+#if LINUX_VERSION_CODE >= 0x02060b
+ if (vma->vm_pgoff >= __pa(high_memory))
+#else
if (__ke_vm_offset(vma) >= __pa(high_memory))
+#endif
vma->vm_flags |= VM_IO; /* not in core dump */
+#if LINUX_VERSION_CODE >= 0x02060b
+ if (remap_pfn_range(FGL_VMA_API_PASS
+ vma->vm_start,
+ vma->vm_pgoff,
+#else
if (remap_page_range(FGL_VMA_API_PASS
vma->vm_start,
__ke_vm_offset(vma),
+#endif
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
{
+#if LINUX_VERSION_CODE >= 0x02060b
+ __KE_DEBUG("remap_pfn_range failed\n");
+#else
__KE_DEBUG("remap_page_range failed\n");
+#endif
return -EAGAIN;
}
#ifdef __x86_64__
@@ -2851,15 +2875,29 @@ int ATI_API_CALL __ke_vm_map(struct file
// else
#else
{
+#if LINUX_VERSION_CODE >= 0x02060b
+ if (vma->vm_pgoff >= __pa(high_memory))
+#else
if (__ke_vm_offset(vma) >= __pa(high_memory))
+#endif
vma->vm_flags |= VM_IO; /* not in core dump */
+#if LINUX_VERSION_CODE >= 0x02060b
+ if (remap_pfn_range(FGL_VMA_API_PASS
+ vma->vm_start,
+ vma->vm_pgoff,
+#else
if (remap_page_range(FGL_VMA_API_PASS
vma->vm_start,
__ke_vm_offset(vma),
+#endif
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
{
+#if LINUX_VERSION_CODE >= 0x02060b
+ __KE_DEBUG("remap_pfn_range failed\n");
+#else
__KE_DEBUG("remap_page_range failed\n");
+#endif
return -EAGAIN;
}
#ifdef __x86_64__