From 303307d25484f3f7179e6967697d28369a73dca9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 Dec 2006 18:03:20 +1100 Subject: fix irq args compatiblity with pre 2.6.19 --- linux-core/drm_compat.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index a1a94399..c4e80e91 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -57,6 +57,12 @@ #define module_param(name, type, perm) #endif +/* older kernels had different irq args */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +#undef DRM_IRQ_ARGS +#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs +#endif + #ifndef list_for_each_safe #define list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ -- cgit v1.2.3 From 86ff2aeb9bfea357d5748b3587ab224e813b37b6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 Dec 2006 20:29:03 +1100 Subject: drm: remove all 2.4 support for drm development tree. Bye bye 2.4 you served us well.. --- linux-core/drm_compat.h | 92 +------------------------------------------------ 1 file changed, 1 insertion(+), 91 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index c4e80e91..13a2ba81 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -86,92 +86,12 @@ pos = n, n = list_entry(n->member.next, typeof(*n), member)) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static inline struct page *vmalloc_to_page(void *vmalloc_addr) -{ - unsigned long addr = (unsigned long)vmalloc_addr; - struct page *page = NULL; - pgd_t *pgd = pgd_offset_k(addr); - pmd_t *pmd; - pte_t *ptep, pte; - - if (!pgd_none(*pgd)) { - pmd = pmd_offset(pgd, addr); - if (!pmd_none(*pmd)) { - preempt_disable(); - ptep = pte_offset_map(pmd, addr); - pte = *ptep; - if (pte_present(pte)) - page = pte_page(pte); - pte_unmap(ptep); - preempt_enable(); - } - } - return page; -} -#endif - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2) -#define down_write down -#define up_write up -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #define DRM_PCI_DEV(pdev) &pdev->dev #else #define DRM_PCI_DEV(pdev) NULL #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static inline unsigned iminor(struct inode *inode) -{ - return MINOR(inode->i_rdev); -} - -#define old_encode_dev(x) (x) - -struct drm_sysfs_class; -struct class_simple; -struct device; - -#define pci_dev_put(x) do {} while (0) -#define pci_get_subsys pci_find_subsys - -static inline struct class_device *DRM(sysfs_device_add) (struct drm_sysfs_class - * cs, dev_t dev, - struct device * - device, - const char *fmt, - ...) { - return NULL; -} - -static inline void DRM(sysfs_device_remove) (dev_t dev) { -} - -static inline void DRM(sysfs_destroy) (struct drm_sysfs_class * cs) { -} - -static inline struct drm_sysfs_class *DRM(sysfs_create) (struct module * owner, - char *name) { - return NULL; -} - -#ifndef pci_pretty_name -#define pci_pretty_name(x) x->name -#endif - -struct drm_device; -static inline int radeon_create_i2c_busses(struct drm_device *dev) -{ - return 0; -}; -static inline void radeon_delete_i2c_busses(struct drm_device *dev) -{ -}; - -#endif - #ifndef __user #define __user #endif @@ -184,18 +104,12 @@ static inline void radeon_delete_i2c_busses(struct drm_device *dev) #define __GFP_COMP 0 #endif -#ifndef REMAP_PAGE_RANGE_5_ARGS -#define DRM_RPR_ARG(vma) -#else -#define DRM_RPR_ARG(vma) vma, -#endif - #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t pgprot) { - return remap_page_range(DRM_RPR_ARG(vma) from, + return remap_page_range(vma, from, pfn << PAGE_SHIFT, size, pgprot); @@ -221,10 +135,6 @@ static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from #define __x86_64__ #endif -#ifndef pci_pretty_name -#define pci_pretty_name(dev) "" -#endif - /* sysfs __ATTR macro */ #ifndef __ATTR #define __ATTR(_name,_mode,_show,_store) { \ -- cgit v1.2.3 From aa07b2ab0e1c8a24fb1694ca3b13eb9ea4618fbe Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 Dec 2006 21:33:47 +1100 Subject: remove drm pci from 2.5 days --- linux-core/drm_compat.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 13a2ba81..fe010ef4 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -86,12 +86,6 @@ pos = n, n = list_entry(n->member.next, typeof(*n), member)) #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#define DRM_PCI_DEV(pdev) &pdev->dev -#else -#define DRM_PCI_DEV(pdev) NULL -#endif - #ifndef __user #define __user #endif -- cgit v1.2.3 From 6333bfdb58b300494b2ec6f7b5a3ea5b392a210a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 Dec 2006 21:37:50 +1100 Subject: fixup inclusion of agp.h --- linux-core/drm_compat.h | 1 - 1 file changed, 1 deletion(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index fe010ef4..49b08865 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -31,7 +31,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include #ifndef _DRM_COMPAT_H_ #define _DRM_COMPAT_H_ -- cgit v1.2.3 From 737c73d1a081823f5c95a6fd68173b56a304eae5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 Dec 2006 22:10:34 +1100 Subject: add kcalloc compat for before 2.6.10 --- linux-core/drm_compat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 49b08865..c7a4a7e3 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -107,6 +107,17 @@ static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from size, pgprot); } + +static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags) +{ + void *addr; + + addr = kmalloc(size * nmemb, flags); + if (addr != NULL) + memset((void *)addr, 0, size * nmemb); + + return addr; +} #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) -- cgit v1.2.3 From 672593f611df484af89e425ff5f1ea0ea074f2bb Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 20 Dec 2006 14:40:36 +0100 Subject: Replace vmalloc_32. The vmalloc_32 function together with the memset to clear the new pages are replaced with a vmalloc_user. A pre-2.6.18 compat vmalloc_user is added. Please replace any breakage on machines with > 1GB of memory. --- linux-core/drm_compat.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index c7a4a7e3..dcda1936 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -148,6 +148,13 @@ static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#define vmalloc_user(_size) ({void * tmp = vmalloc(_size); \ + if (tmp) memset(tmp, 0, size); \ + (tmp);}) +#endif + + #include #include -- cgit v1.2.3 From 975136d6e5adc6b6a03719499cf39fbd3f67dc90 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 27 Dec 2006 15:32:09 +0100 Subject: Proper allocation of AGP pages for ttms. --- linux-core/drm_compat.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index dcda1936..ddc255d3 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -180,16 +180,9 @@ extern void drm_clear_vma(struct vm_area_struct *vma, extern pgprot_t vm_get_page_prot(unsigned long vm_flags); -/* - * These are similar to the current kernel gatt pages allocator, only that we - * want a struct page pointer instead of a virtual address. This allows for pages - * that are not in the kernel linear map. - */ - -#define drm_alloc_gatt_pages(order) ({ \ - void *_virt = alloc_gatt_pages(order); \ - ((_virt) ? virt_to_page(_virt) : NULL);}) -#define drm_free_gatt_pages(pages, order) free_gatt_pages(page_address(pages), order) +#ifndef GFP_DMA32 +#define GFP_DMA32 0 +#endif #if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) -- cgit v1.2.3 From 2dcbf6a59918761cffb27e027b1235c551ed03dd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 1 Jan 2007 11:30:38 +1100 Subject: make build against 2.6.20 hopefully --- linux-core/drm_compat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index ddc255d3..3cb5d202 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -158,7 +158,7 @@ static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags) #include #include -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) && \ +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && \ (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))) #define DRM_ODD_MM_COMPAT #endif @@ -208,7 +208,7 @@ extern struct page *drm_vm_ttm_fault(struct vm_area_struct *vma, #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) /* * Hopefully, real NOPAGE_RETRY functionality will be in 2.6.19. -- cgit v1.2.3