View Single Post
Old Jan 17, 2005, 07:27 PM   #17
Diffie
BSD daemon
 
Join Date: Nov 2003
Location: New York City
Posts: 292
Diffie is still being judged by the masses


Default

patch for 2.6.11-rc1-mm1 (module loads but did not work for me)

Code:
   diffstat:
   
   agpgart_be.c	|   65 +++++++++++++++++++++++++++++++++++++++++++++++++-------
   firegl_public.c |   51 ++++++++++++++++++++++---------------------
   2 files changed, 84 insertions(+), 32 deletions(-)
   
   diff -Nur fglrx-o/build_mod/agpgart_be.c fglrx/build_mod/agpgart_be.c
   --- fglrx-o/build_mod/agpgart_be.c	2004-12-14 12:55:47.000000000 -0500
   +++ fglrx/build_mod/agpgart_be.c	2005-01-17 17:26:57.000000000 -0500
   @@ -116,7 +116,14 @@
    #include <linux/pagemap.h>
    #include <linux/miscdevice.h>
    #include <linux/pm.h>
   +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
   +#define pci_find_class pci_get_class
    
   +
   +
   +
   +
   +#endif
    #if (LINUX_VERSION_CODE >= 0x020400)
    #define FGL_PM_PRESENT
    #else
   @@ -255,6 +262,12 @@
    }
    #endif
    
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
   +#define firegl_pci_find_class(class,from) pci_get_class(class,from)
   +#else
   +#define firegl_pci_find_class(class,from) pci_find_class(class,from)
   +#endif
   +
    int agp_backend_acquire(void)
    {
   	 if (agp_bridge.type == NOT_SUPPORTED) {
   @@ -718,7 +731,7 @@
   	  *		AGP devices and collect their data.
   	  */
    
   -	while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
   +	while ((device = firegl_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
 					 device)) != NULL) {
   		 pci_read_config_dword(device, 0x04, &scratch);
    
   @@ -794,6 +807,13 @@
   				 command &= ~0x00000001;
   		 }
   	 }
   +
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
 +			// the reference count has been increased in agp_backend_initialize.
   +		if (device)
   +			pci_dev_put(device); 
   +#endif
   +
   	 /*
   	  * PASS2: Figure out the 4X/2X/1X setting and enable the
   	  *		target (our motherboard chipset).
   @@ -839,8 +859,9 @@
   	  *		command registers.
   	  */
    
   -	while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
   +	while ((device = firegl_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
 					 device)) != NULL) {
   +
   		 pci_read_config_dword(device, 0x04, &scratch);
    
   		 if (!(scratch & 0x00100000))
   @@ -871,6 +892,12 @@
   		 }
   	 }
    
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
 +			// the reference count has been increased in agp_backend_initialize.
   +		if (device)
   +			pci_dev_put(device); 
   +#endif
   +
   	 return 0; /* success */
    }
    
   @@ -5119,8 +5146,9 @@
   	  *		AGP devices and collect their data.
   	  */
    
   -	while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
   +	while ((device = firegl_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
 					 device)) != NULL) {
   +
   		 pci_read_config_dword(device, 0x04, &scratch);
    
   		 if (!(scratch & 0x00100000))
   @@ -5187,6 +5215,13 @@
   				 command &= ~0x00000001;
   		 }
   	 }
   +
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
 +			// the reference count has been increased in agp_backend_initialize.
   +		if (device)
   +			pci_dev_put(device); 
   +#endif
   +
   	 /*
   	  * PASS2: Figure out the 4X/2X/1X setting and enable the
   	  *		target (our motherboard chipset).
   @@ -5217,8 +5252,9 @@
   	  *		command registers.
   	  */
    
   -	while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
   +	while ((device = firegl_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
 					 device)) != NULL) {
   +
   		 pci_read_config_dword(device, 0x04, &scratch);
    
   		 if (!(scratch & 0x00100000))
   @@ -5249,6 +5285,12 @@
   		 }
   	 }
    
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
 +			// the reference count has been increased in agp_backend_initialize.
   +		if (device)
   +			pci_dev_put(device); 
   +#endif
   +
   	 return(0); /* success */
    }
    
   @@ -6494,10 +6536,10 @@
   	 // locate host bridge device
    #ifdef __x86_64__
   	 do {
   -		dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, dev);
   +		dev = firegl_pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, dev);
   	 } while((dev) && !agp_check_supported_device(dev));
    #else
   -	if ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, NULL)) == NULL)
   +	if ((dev = firegl_pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, NULL)) == NULL)
   		 return -ENODEV;
    #endif
    
   @@ -7040,8 +7082,12 @@
 					 &agp_bridge.mode);
   				 return hp_zx1_setup(dev);
   			 }
 -			dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, dev);
 +			dev = firegl_pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, dev);
   		 } while (dev);
   +
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) 
   +				if(dev) pci_dev_put(dev);
   +#endif
   		 return -ENODEV;
   	 }
    #endif	/* __ia64__ */
   @@ -7462,6 +7508,11 @@
   	 agp_bridge.free_gatt_table();
   	 vfree(agp_bridge.key_list);
    
   +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
   +		// decrease the reference count.
   +		pci_dev_put(agp_bridge.dev);
   +#endif
   +
   	 if (agp_bridge.needs_scratch_page == TRUE) {
   		 agp_bridge.scratch_page &= ~(0x00000fff);
   		 agp_bridge.agp_destroy_page((unsigned long)
   diff -Nur fglrx-o/build_mod/firegl_public.c fglrx/build_mod/firegl_public.c
   --- fglrx-o/build_mod/firegl_public.c	2005-01-04 20:05:05.000000000 -0500
   +++ fglrx/build_mod/firegl_public.c	2005-01-17 17:30:44.000000000 -0500
   @@ -88,6 +88,7 @@
    #include <linux/smp_lock.h>
    // newer SuSE kernels need this
    #include <linux/highmem.h>
   +#include <linux/pagemap.h> // for lock_page and unlock_page
    
    #if defined(__ia64__)
    #include <linux/vmalloc.h>
   @@ -2590,13 +2591,13 @@
    #endif /* __ia64__ */
 				 vma->vm_flags |= VM_IO; /* not in core dump */
   			 }
   -			if (remap_page_range(FGL_VMA_API_PASS
   +			if (remap_pfn_range(FGL_VMA_API_PASS
 								 vma->vm_start,
 -								 __ke_vm_offset(vma),
 +								 vma->vm_pgoff,
 								 vma->vm_end - vma->vm_start,
 								 vma->vm_page_prot))
   			 {
   -			    __KE_DEBUG("remap_page_range failed\n");
   +			    __KE_DEBUG("remap_pfn_range failed\n");
   				 return -EAGAIN;
   			 }
 			 vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
   @@ -2657,7 +2658,7 @@
   			 {
 			 	if (__ke_vm_offset(vma) >= __pa(high_memory))
 			 		vma->vm_flags |= VM_IO; /* not in core dump */
 -				if (remap_page_range(FGL_VMA_API_PASS
 +				if (remap_pfn_range(FGL_VMA_API_PASS
 			 		 		 vma->vm_start,
 			 		 		 __ke_vm_offset(vma),
 			 		 		 vma->vm_end - vma->vm_start,
   @@ -2694,7 +2695,7 @@
   			 {
 			 	if (__ke_vm_offset(vma) >= __pa(high_memory))
 			 		vma->vm_flags |= VM_IO; /* not in core dump */
 -				if (remap_page_range(FGL_VMA_API_PASS
 +				if (remap_pfn_range(FGL_VMA_API_PASS
 			 		 		 vma->vm_start,
 			 		 		 __ke_vm_offset(vma),
 			 		 		 vma->vm_end - vma->vm_start,
   @@ -3057,10 +3058,10 @@
    
    struct _agp_memory* ATI_API_CALL __ke_agp_allocate_memory(__ke_size_t pages, unsigned long type)
    {
   -#ifdef __AGP__
   -	if (AGP_AVAILABLE(allocate_memory))
   -		return AGP_FUNC(allocate_memory)(pages, type);
   -#endif /* __AGP__ */
   +//#ifdef __AGP__
   +//	if (AGP_AVAILABLE(allocate_memory))
   +//		return AGP_FUNC(allocate_memory)(pages, type);
   +//#endif /* __AGP__ */
   	 if (firegl_agp)
   		 return (struct _agp_memory*)FIREGL_agp_allocate_memory(pages, type);
   	 return NULL;
   @@ -3090,13 +3091,13 @@
    
    int ATI_API_CALL __ke_agp_enable(unsigned long mode)
    {
   -#ifdef __AGP__
   -	if (AGP_AVAILABLE(enable))
   -	{
   -		AGP_FUNC(enable)(mode);
   -		return 0;
   -	}
   -#endif /* __AGP__ */
   +//#ifdef __AGP__
   +//	if (AGP_AVAILABLE(enable))
   +//	{
   +//		AGP_FUNC(enable)(mode);
   +//		return 0;
   +//	}
   +//#endif /* __AGP__ */
   	 if (firegl_agp)
   	 {
   		 FIREGL_agp_enable(mode);
   @@ -3138,10 +3139,10 @@
    
    int ATI_API_CALL __ke_agp_acquire(void)
    {
   -#ifdef __AGP__
   -	if (AGP_AVAILABLE(acquire))
   -		return AGP_FUNC(acquire)();
   -#endif /* __AGP__ */
   +//#ifdef __AGP__
   +//	if (AGP_AVAILABLE(acquire))
   +//		return AGP_FUNC(acquire)();
   +//#endif /* __AGP__ */
   	 if (firegl_agp)
   		 return FIREGL_agp_backend_acquire();
   	 return -EINVAL;
   @@ -3149,10 +3150,10 @@
    
    void ATI_API_CALL __ke_agp_release(void)
    {
   -#ifdef __AGP__
   -	if (AGP_AVAILABLE(release))
   -		AGP_FUNC(release)();
   -#endif /* __AGP__ */
   +//#ifdef __AGP__
   +//	if (AGP_AVAILABLE(release))
   +//		AGP_FUNC(release)();
   +//#endif /* __AGP__ */
   	 if (firegl_agp)
   		 FIREGL_agp_backend_release();
    }
   @@ -3171,7 +3172,7 @@
    #endif
   		 agp_kern_info kern;	
    
   -		AGP_FUNC(copy_info)(&kern);
   +//		AGP_FUNC(copy_info)(&kern);
   		 device = kern.device;
    
   		 info->version.major = kern.version.major;
__________________
FreeBSD
the Power to Serve!

Diffie is offline   Reply With Quote