Bye bye 2.4 you served us well..
# Check for kernel versions that we don't support.
-BELOW24 := $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 4 ]; then \
+BELOW26 := $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 6 ]; then \
echo y; fi)
-ifeq ($(BELOW24),y)
-$(error Only 2.4.x and later kernels are supported \
+ifeq ($(BELOW26),y)
+$(error Only 2.6.x and later kernels are supported \
($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)))
endif
# This needs to go before all other include paths.
CC += -I$(DRMSRCDIR)
-# Check for Red Hat's 4-argument do_munmap().
-DOMUNMAP := $(shell grep do_munmap $(LINUXDIR)/include/linux/mm.h | \
- grep -c acct)
-
-ifneq ($(DOMUNMAP),0)
-EXTRA_CFLAGS += -DDO_MUNMAP_4_ARGS
-endif
-
-# Check for 5-argument remap_page_range() in RH9 kernel, and 2.5.x kernels
-RPR := $(shell grep remap_page_range $(LINUXDIR)/include/linux/mm.h | \
- grep -c vma)
-
-ifneq ($(RPR),0)
-EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5_ARGS
-endif
-
-# Check for 4-argument vmap() in some 2.5.x and 2.4.x kernels
-VMAP := $(shell grep -A1 'vmap.*count,$$' $(LINUXDIR)/include/linux/vmalloc.h | \
- grep -c prot)
-
-ifneq ($(VMAP),0)
-EXTRA_CFLAGS += -DVMAP_4_ARGS
-endif
-
# Check for PAGE_AGP definition
PAGE_AGP := $(shell cat $(LINUXDIR)/include/asm/agp.h 2>/dev/null | \
grep -c PAGE_AGP)
EXTRA_CFLAGS += -DHAVE_PAGE_AGP
endif
-
# Start with all modules turned off.
CONFIG_DRM_GAMMA := n
CONFIG_DRM_TDFX := n
#include <linux/types.h>
#include <linux/agp_backend.h>
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
-#define HAS_WORKQUEUE 0
-#else
-#define HAS_WORKQUEUE 1
-#endif
-#if !HAS_WORKQUEUE
-#include <linux/tqueue.h>
-#else
#include <linux/workqueue.h>
-#endif
#include <linux/poll.h>
#include <asm/pgalloc.h>
#include "drm.h"
unsigned long last_switch; /**< jiffies at last context switch */
/*@} */
-#if !HAS_WORKQUEUE
- struct tq_struct tq;
-#else
struct work_struct work;
-#endif
+
/** \name VBLANK IRQ support */
/*@{ */
int pci_vendor; /**< PCI vendor id */
int pci_device; /**< PCI device id */
#ifdef __alpha__
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
- struct pci_controler *hose;
-#else
struct pci_controller *hose;
#endif
-#endif
drm_sg_mem_t *sg; /**< Scatter gather memory */
unsigned long *ctx_bitmap; /**< context bitmap */
void *dev_private; /**< device private data */
return -ENODEV;
if (dev->agp->acquired)
return -EBUSY;
-#ifndef VMAP_4_ARGS
- if (dev->agp->cant_use_aperture)
- return -EINVAL;
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)
if ((retcode = agp_backend_acquire()))
return retcode;
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
#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);
#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) { \
*/
/* Need the 4-argument version of vmap(). */
-#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
+#if __OS_HAS_AGP
#include <linux/vmalloc.h>
# endif
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#ifndef pte_offset_kernel
-# define pte_offset_kernel(dir, address) pte_offset(dir, address)
-#endif
-#ifndef pte_pfn
-# define pte_pfn(pte) (pte_page(pte) - mem_map)
-#endif
-#ifndef pfn_to_page
-# define pfn_to_page(pfn) (mem_map + (pfn))
-#endif
-#endif
-
/*
* Find the drm_map that covers the range [offset, offset+size).
*/
static inline void *drm_ioremap(unsigned long offset, unsigned long size,
drm_device_t * dev)
{
-#if defined(VMAP_4_ARGS)
if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
return agp_remap(offset, size, dev);
}
-#endif
return ioremap(offset, size);
}
static inline void *drm_ioremap_nocache(unsigned long offset,
unsigned long size, drm_device_t * dev)
{
-#if defined(VMAP_4_ARGS)
if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
return agp_remap(offset, size, dev);
}
-#endif
return ioremap_nocache(offset, size);
}
static inline void drm_ioremapfree(void *pt, unsigned long size,
drm_device_t * dev)
{
-#if defined(VMAP_4_ARGS)
/*
* This is a bit ugly. It would be much cleaner if the DRM API would use separate
* routines for handling mappings in the AGP space. Hopefully this can be done in
return;
}
}
-#endif
iounmap(pt);
}
#else
/** AGP types */
#if __OS_HAS_AGP
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70)
-#define DRM_AGP_MEM agp_memory
-#define DRM_AGP_KERN agp_kern_info
-#else
#define DRM_AGP_MEM struct agp_memory
#define DRM_AGP_KERN struct agp_kern_info
-#endif
#else
/* define some dummy types for non AGP supporting kernels */
struct no_agp_kern {
if ((ret = drm_get_head(dev, &dev->primary)))
goto err_g1;
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
+ DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
driver->name, driver->major, driver->minor, driver->patchlevel,
- driver->date, dev->primary.minor, pci_pretty_name(dev->pdev));
+ driver->date, dev->primary.minor);
return 0;
return page;
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
-
static struct page *drm_vm_nopage(struct vm_area_struct *vma,
unsigned long address, int *type)
{
}
-#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */
-
-static struct page *drm_vm_nopage(struct vm_area_struct *vma,
- unsigned long address, int unused)
-{
- return drm_do_vm_nopage(vma, address);
-}
-
-static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
- unsigned long address, int unused)
-{
- return drm_do_vm_shm_nopage(vma, address);
-}
-
-static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
- unsigned long address, int unused)
-{
- return drm_do_vm_dma_nopage(vma, address);
-}
-
-static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
- unsigned long address, int unused)
-{
- return drm_do_vm_sg_nopage(vma, address);
-}
-
-#endif
-
/** AGP virtual memory operations */
static struct vm_operations_struct drm_vm_ops = {
.nopage = drm_vm_nopage,
}
vma->vm_ops = &drm_vm_dma_ops;
-
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
- vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#else
vma->vm_flags |= VM_RESERVED; /* Don't swap */
-#endif
vma->vm_file = filp; /* Needed for drm_vm_open() */
drm_vm_open(vma);
vma->vm_private_data = (void *)map;
/* Don't let this area swap. Change when
DRM_KERNEL advisory is supported. */
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
- vma->vm_flags |= VM_LOCKED;
-#else
vma->vm_flags |= VM_RESERVED;
-#endif
break;
case _DRM_SCATTER_GATHER:
vma->vm_ops = &drm_vm_sg_ops;
vma->vm_private_data = (void *)map;
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
- vma->vm_flags |= VM_LOCKED;
-#else
vma->vm_flags |= VM_RESERVED;
-#endif
break;
case _DRM_TTM: {
vma->vm_ops = &drm_vm_ttm_ops;
default:
return -EINVAL; /* This should never happen. */
}
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
- vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#else
vma->vm_flags |= VM_RESERVED; /* Don't swap */
-#endif
vma->vm_file = filp; /* Needed for drm_vm_open() */
drm_vm_open(vma);
#include "sis_drv.h"
#if defined(__linux__)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <video/sisfb.h>
-#else
-#include <linux/sisfb.h>
-#endif
#endif
#define VIDEO_TYPE 0