No one's maintaining 2.2.x support - so remove all the cruft.
parent
8aaf82d45c
commit
f4c2f14002
|
@ -103,7 +103,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
|||
goto done;
|
||||
}
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
if ( !dev->pdev ) {
|
||||
DRM_ERROR( "PCI device unknown!\n" );
|
||||
goto done;
|
||||
|
@ -130,7 +130,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
|||
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
|
||||
|
||||
for ( i = 0 ; i < pages ; i++ ) {
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
/* we need to support large memory configurations */
|
||||
entry->busaddr[i] = pci_map_single(dev->pdev,
|
||||
page_address( entry->pagelist[i] ),
|
||||
|
@ -171,7 +171,7 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
|
|||
unsigned long addr,
|
||||
dma_addr_t bus_addr)
|
||||
{
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
unsigned long pages;
|
||||
int i;
|
||||
|
|
|
@ -66,13 +66,8 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/agp_backend.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= 0x020100 /* KERNEL_VERSION(2,1,0) */
|
||||
#include <linux/tqueue.h>
|
||||
#include <linux/poll.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "compat-pre24.h"
|
||||
#endif
|
||||
#include <asm/pgalloc.h>
|
||||
#include "drm.h"
|
||||
|
||||
|
@ -171,12 +166,7 @@ typedef struct wait_queue *wait_queue_head_t;
|
|||
#define _PAGE_PSE _PAGE_4M
|
||||
#endif
|
||||
|
||||
/* vm_offset changed to vm_pgoff in 2.3.25 */
|
||||
#if LINUX_VERSION_CODE < 0x020319
|
||||
#define VM_OFFSET(vma) ((vma)->vm_offset)
|
||||
#else
|
||||
#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
|
||||
#endif
|
||||
|
||||
/* *_nopage return values defined in 2.3.26 */
|
||||
#ifndef NOPAGE_SIGBUS
|
||||
|
@ -629,7 +619,7 @@ typedef struct drm_sg_mem {
|
|||
void *virtual;
|
||||
int pages;
|
||||
struct page **pagelist;
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
dma_addr_t *busaddr;
|
||||
#endif
|
||||
} drm_sg_mem_t;
|
||||
|
@ -772,21 +762,6 @@ extern unsigned int DRM(poll)(struct file *filp,
|
|||
struct poll_table_struct *wait);
|
||||
|
||||
/* Mapping support (drm_vm.h) */
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
extern unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
|
@ -799,7 +774,6 @@ extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
#endif
|
||||
extern void DRM(vm_open)(struct vm_area_struct *vma);
|
||||
extern void DRM(vm_close)(struct vm_area_struct *vma);
|
||||
extern void DRM(vm_shm_close)(struct vm_area_struct *vma);
|
||||
|
|
|
@ -35,12 +35,8 @@
|
|||
|
||||
#if __REALLY_HAVE_AGP
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "agpsupport-pre24.h"
|
||||
#else
|
||||
#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
|
||||
#define DRM_AGP_PUT inter_module_put("drm_agp")
|
||||
#endif
|
||||
|
||||
static const drm_agp_t *drm_agp = NULL;
|
||||
|
||||
|
@ -271,22 +267,18 @@ drm_agp_head_t *DRM(agp_init)(void)
|
|||
case INTEL_GX: head->chipset = "Intel 440GX"; break;
|
||||
case INTEL_I810: head->chipset = "Intel i810"; break;
|
||||
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
case INTEL_I815: head->chipset = "Intel i815"; break;
|
||||
case INTEL_I840: head->chipset = "Intel i840"; break;
|
||||
case INTEL_I850: head->chipset = "Intel i850"; break;
|
||||
#endif
|
||||
|
||||
case VIA_GENERIC: head->chipset = "VIA"; break;
|
||||
case VIA_VP3: head->chipset = "VIA VP3"; break;
|
||||
case VIA_MVP3: head->chipset = "VIA MVP3"; break;
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
case VIA_MVP4: head->chipset = "VIA MVP4"; break;
|
||||
case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133";
|
||||
break;
|
||||
case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro";
|
||||
break;
|
||||
|
|
|
@ -229,11 +229,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp,
|
|||
DRM(free)(list, sizeof(*list), DRM_MEM_MAPS);
|
||||
|
||||
for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
if (pt->vma->vm_private_data == map) found_maps++;
|
||||
#else
|
||||
if (pt->vma->vm_pte == map) found_maps++;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(!found_maps) {
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
#define DRIVER_IOCTLS
|
||||
#endif
|
||||
#ifndef DRIVER_FOPS
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
#define DRIVER_FOPS \
|
||||
static struct file_operations DRM(fops) = { \
|
||||
owner: THIS_MODULE, \
|
||||
|
@ -126,19 +125,6 @@ static struct file_operations DRM(fops) = { \
|
|||
fasync: DRM(fasync), \
|
||||
poll: DRM(poll), \
|
||||
}
|
||||
#else
|
||||
#define DRIVER_FOPS \
|
||||
static struct file_operations DRM(fops) = { \
|
||||
open: DRM(open), \
|
||||
flush: DRM(flush), \
|
||||
release: DRM(release), \
|
||||
ioctl: DRM(ioctl), \
|
||||
mmap: DRM(mmap), \
|
||||
read: DRM(read), \
|
||||
fasync: DRM(fasync), \
|
||||
poll: DRM(poll), \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -731,9 +717,6 @@ int DRM(open)( struct inode *inode, struct file *filp )
|
|||
|
||||
retcode = DRM(open_helper)( inode, filp, dev );
|
||||
if ( !retcode ) {
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
|
||||
spin_lock( &dev->count_lock );
|
||||
if ( !dev->open_count++ ) {
|
||||
|
@ -852,9 +835,6 @@ int DRM(release)( struct inode *inode, struct file *filp )
|
|||
* End inline drm_release
|
||||
*/
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
|
||||
spin_lock( &dev->count_lock );
|
||||
if ( !--dev->open_count ) {
|
||||
|
|
|
@ -191,24 +191,8 @@ int DRM(write_string)(drm_device_t *dev, const char *s)
|
|||
send -= count;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS)
|
||||
/* The extra parameter to kill_fasync was added in 2.3.21, and is
|
||||
_not_ present in _stock_ 2.2.14 and 2.2.15. However, some
|
||||
distributions patch 2.2.x kernels to add this parameter. The
|
||||
Makefile.linux attempts to detect this addition and defines
|
||||
KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */
|
||||
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
|
||||
#else
|
||||
|
||||
/* Parameter added in 2.3.21. */
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
|
||||
#else
|
||||
/* Type of first parameter changed in
|
||||
Linux 2.4.0-test2... */
|
||||
if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DRM_DEBUG("waking\n");
|
||||
wake_up_interruptible(&dev->buf_readers);
|
||||
return 0;
|
||||
|
|
|
@ -85,12 +85,7 @@ void DRM(mem_init)(void)
|
|||
}
|
||||
|
||||
si_meminfo(&si);
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
/* Changed to page count in 2.3.23 */
|
||||
DRM(ram_available) = si.totalram >> PAGE_SHIFT;
|
||||
#else
|
||||
DRM(ram_available) = si.totalram;
|
||||
#endif
|
||||
DRM(ram_used) = 0;
|
||||
}
|
||||
|
||||
|
@ -257,12 +252,7 @@ unsigned long DRM(alloc_pages)(int order, int area)
|
|||
for (addr = address, sz = bytes;
|
||||
sz > 0;
|
||||
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
/* Argument type changed in 2.4.0-test6/pre8 */
|
||||
mem_map_reserve(virt_to_page(addr));
|
||||
#else
|
||||
mem_map_reserve(MAP_NR(addr));
|
||||
#endif
|
||||
}
|
||||
|
||||
return address;
|
||||
|
@ -283,12 +273,7 @@ void DRM(free_pages)(unsigned long address, int order, int area)
|
|||
for (addr = address, sz = bytes;
|
||||
sz > 0;
|
||||
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
/* Argument type changed in 2.4.0-test6/pre8 */
|
||||
mem_map_unreserve(virt_to_page(addr));
|
||||
#else
|
||||
mem_map_unreserve(MAP_NR(addr));
|
||||
#endif
|
||||
}
|
||||
free_pages(address, order);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry )
|
|||
|
||||
vfree( entry->virtual );
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
|
@ -99,7 +99,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
if ( !entry->busaddr ) {
|
||||
|
@ -116,7 +116,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
|
||||
entry->virtual = vmalloc_32( pages << PAGE_SHIFT );
|
||||
if ( !entry->virtual ) {
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "stubsupport-pre24.h"
|
||||
#endif
|
||||
|
||||
#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */
|
||||
|
||||
static struct drm_stub_list {
|
||||
|
@ -70,9 +66,7 @@ static int DRM(stub_open)(struct inode *inode, struct file *filp)
|
|||
}
|
||||
|
||||
static struct file_operations DRM(stub_fops) = {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
owner: THIS_MODULE,
|
||||
#endif
|
||||
open: DRM(stub_open)
|
||||
};
|
||||
|
||||
|
|
|
@ -56,16 +56,9 @@ struct vm_operations_struct DRM(vm_sg_ops) = {
|
|||
close: DRM(vm_close),
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if defined(__alpha__) && __REALLY_HAVE_AGP
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
@ -122,32 +115,17 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
|||
baddr, __va(agpmem->memory->memory[offset]), offset);
|
||||
#endif
|
||||
get_page(page);
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
#else
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||
#endif
|
||||
unsigned long offset;
|
||||
unsigned long i;
|
||||
pgd_t *pgd;
|
||||
|
@ -174,11 +152,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
|||
get_page(page);
|
||||
|
||||
DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page));
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Special close routine which deletes map information if we are the last
|
||||
|
@ -197,25 +171,14 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_dec(&dev->vma_count);
|
||||
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
map = vma->vm_private_data;
|
||||
#else
|
||||
map = vma->vm_pte;
|
||||
#endif
|
||||
|
||||
down(&dev->struct_sem);
|
||||
for (pt = dev->vmalist, prev = NULL; pt; pt = next) {
|
||||
next = pt->next;
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
if (pt->vma->vm_private_data == map) found_maps++;
|
||||
#else
|
||||
if (pt->vma->vm_pte == map) found_maps++;
|
||||
#endif
|
||||
if (pt->vma == vma) {
|
||||
if (prev) {
|
||||
prev->next = pt->next;
|
||||
|
@ -268,16 +231,9 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
up(&dev->struct_sem);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
@ -299,29 +255,14 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
|
||||
DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr,
|
||||
page_to_bus(page));
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
#else
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||
#endif
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
|
@ -341,11 +282,7 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
|||
page = entry->pagelist[page_offset];
|
||||
get_page(page);
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRM(vm_open)(struct vm_area_struct *vma)
|
||||
|
@ -357,10 +294,6 @@ void DRM(vm_open)(struct vm_area_struct *vma)
|
|||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
atomic_inc(&dev->vma_count);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
/* The map can exist after the fd is closed. */
|
||||
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
|
||||
vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS);
|
||||
if (vma_entry) {
|
||||
|
@ -381,9 +314,6 @@ void DRM(vm_close)(struct vm_area_struct *vma)
|
|||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_dec(&dev->vma_count);
|
||||
|
||||
down(&dev->struct_sem);
|
||||
|
@ -424,11 +354,6 @@ int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma)
|
|||
vma->vm_ops = &DRM(vm_dma_ops);
|
||||
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
|
||||
/* In Linux 2.2.3 and above, this is
|
||||
handled in do_mmap() in mm/mmap.c. */
|
||||
++filp->f_count;
|
||||
#endif
|
||||
vma->vm_file = filp; /* Needed for drm_vm_open() */
|
||||
DRM(vm_open)(vma);
|
||||
return 0;
|
||||
|
@ -543,22 +468,14 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
break;
|
||||
case _DRM_SHM:
|
||||
vma->vm_ops = &DRM(vm_shm_ops);
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
vma->vm_private_data = (void *)map;
|
||||
#else
|
||||
vma->vm_pte = (unsigned long)map;
|
||||
#endif
|
||||
/* Don't let this area swap. Change when
|
||||
DRM_KERNEL advisory is supported. */
|
||||
vma->vm_flags |= VM_LOCKED;
|
||||
break;
|
||||
case _DRM_SCATTER_GATHER:
|
||||
vma->vm_ops = &DRM(vm_sg_ops);
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
vma->vm_private_data = (void *)map;
|
||||
#else
|
||||
vma->vm_pte = (unsigned long)map;
|
||||
#endif
|
||||
vma->vm_flags |= VM_LOCKED;
|
||||
break;
|
||||
default:
|
||||
|
@ -566,11 +483,6 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
}
|
||||
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
|
||||
/* In Linux 2.2.3 and above, this is
|
||||
handled in do_mmap() in mm/mmap.c. */
|
||||
++filp->f_count;
|
||||
#endif
|
||||
vma->vm_file = filp; /* Needed for drm_vm_open() */
|
||||
DRM(vm_open)(vma);
|
||||
return 0;
|
||||
|
|
|
@ -227,14 +227,9 @@ static int i810_unmap_buffer(drm_buf_t *buf)
|
|||
#else
|
||||
down_write( ¤t->mm->mmap_sem );
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < 0x020399
|
||||
retcode = do_munmap((unsigned long)buf_priv->virtual,
|
||||
(size_t) buf->total);
|
||||
#else
|
||||
retcode = do_munmap(current->mm,
|
||||
(unsigned long)buf_priv->virtual,
|
||||
(size_t) buf->total);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE <= 0x020402
|
||||
up( ¤t->mm->mmap_sem );
|
||||
#else
|
||||
|
|
|
@ -53,7 +53,7 @@ LIBS =
|
|||
DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \
|
||||
drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_lists.h \
|
||||
drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h
|
||||
DRMHEADERS = drm.h drmP.h compat-pre24.h
|
||||
DRMHEADERS = drm.h drmP.h
|
||||
|
||||
GAMMAOBJS = gamma_drv.o gamma_dma.o
|
||||
GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES)
|
||||
|
@ -145,7 +145,6 @@ endif
|
|||
ifeq ($(AGP),1)
|
||||
MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE
|
||||
DRMTEMPLATES += drm_agpsupport.h
|
||||
DRMHEADERS += agpsupport-pre24.h
|
||||
MODS += mga.o
|
||||
ifeq ($(MACHINE),i386)
|
||||
MODS += i810.o
|
||||
|
@ -185,7 +184,7 @@ all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${A
|
|||
all::;@echo === kill_fasync has $(PARAMS) parameters
|
||||
all::;@echo === Compiling for machine $(MACHINE)
|
||||
all::;@echo === WARNING
|
||||
all::;@echo === WARNING 2.4.0 kernels before 2.4.0-test11 DO NOT WORK
|
||||
all::;@echo === WARNING Use 2.4.x kernels ONLY !
|
||||
all::;@echo === WARNING
|
||||
|
||||
ifeq ($(MODULES),0)
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/* agpsupport-pre24.h -- Support for pre-2.4.0 kernels -*- linux-c -*-
|
||||
* Created: Mon Nov 13 10:54:15 2000 by faith@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AGPSUPPORT_PRE24_H_
|
||||
#define _AGPSUPPORT_PRE24_H_
|
||||
typedef struct {
|
||||
void (*free_memory)(agp_memory *);
|
||||
agp_memory *(*allocate_memory)(size_t, u32);
|
||||
int (*bind_memory)(agp_memory *, off_t);
|
||||
int (*unbind_memory)(agp_memory *);
|
||||
void (*enable)(u32);
|
||||
int (*acquire)(void);
|
||||
void (*release)(void);
|
||||
void (*copy_info)(agp_kern_info *);
|
||||
} drm_agp_t;
|
||||
|
||||
static drm_agp_t drm_agp_struct = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/* The C standard says that 'void *' is not guaranteed to hold a function
|
||||
pointer, so we use this union to define a generic pointer that is
|
||||
guaranteed to hold any of the function pointers we care about. */
|
||||
typedef union {
|
||||
void (*free_memory)(agp_memory *);
|
||||
agp_memory *(*allocate_memory)(size_t, u32);
|
||||
int (*bind_memory)(agp_memory *, off_t);
|
||||
int (*unbind_memory)(agp_memory *);
|
||||
void (*enable)(u32);
|
||||
int (*acquire)(void);
|
||||
void (*release)(void);
|
||||
void (*copy_info)(agp_kern_info *);
|
||||
unsigned long address;
|
||||
} drm_agp_func_u;
|
||||
|
||||
typedef struct drm_agp_fill {
|
||||
const char *name;
|
||||
drm_agp_func_u *f;
|
||||
} drm_agp_fill_t;
|
||||
|
||||
static drm_agp_fill_t drm_agp_fill[] = {
|
||||
{ __MODULE_STRING(agp_free_memory),
|
||||
(drm_agp_func_u *)&drm_agp_struct.free_memory },
|
||||
{ __MODULE_STRING(agp_allocate_memory),
|
||||
(drm_agp_func_u *)&drm_agp_struct.allocate_memory },
|
||||
{ __MODULE_STRING(agp_bind_memory),
|
||||
(drm_agp_func_u *)&drm_agp_struct.bind_memory },
|
||||
{ __MODULE_STRING(agp_unbind_memory),
|
||||
(drm_agp_func_u *)&drm_agp_struct.unbind_memory },
|
||||
{ __MODULE_STRING(agp_enable),
|
||||
(drm_agp_func_u *)&drm_agp_struct.enable },
|
||||
{ __MODULE_STRING(agp_backend_acquire),
|
||||
(drm_agp_func_u *)&drm_agp_struct.acquire },
|
||||
{ __MODULE_STRING(agp_backend_release),
|
||||
(drm_agp_func_u *)&drm_agp_struct.release },
|
||||
{ __MODULE_STRING(agp_copy_info),
|
||||
(drm_agp_func_u *)&drm_agp_struct.copy_info },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#define DRM_AGP_GET _drm_agp_get()
|
||||
#define DRM_AGP_PUT _drm_agp_put()
|
||||
|
||||
static drm_agp_t *_drm_agp_get(void)
|
||||
{
|
||||
drm_agp_fill_t *fill;
|
||||
int agp_available = 1;
|
||||
|
||||
for (fill = &drm_agp_fill[0]; fill->name; fill++) {
|
||||
char *n = (char *)fill->name;
|
||||
*fill->f = (drm_agp_func_u)get_module_symbol(NULL, n);
|
||||
DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address);
|
||||
if (!(*fill->f).address) agp_available = 0;
|
||||
}
|
||||
return &drm_agp_struct;
|
||||
}
|
||||
|
||||
static void _drm_agp_put(void)
|
||||
{
|
||||
drm_agp_fill_t *fill;
|
||||
|
||||
for (fill = &drm_agp_fill[0]; fill->name; fill++) {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
if ((*fill->f).address) put_module_symbol((*fill->f).address);
|
||||
#endif
|
||||
(*fill->f).address = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -103,7 +103,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
|||
goto done;
|
||||
}
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
if ( !dev->pdev ) {
|
||||
DRM_ERROR( "PCI device unknown!\n" );
|
||||
goto done;
|
||||
|
@ -130,7 +130,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
|||
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
|
||||
|
||||
for ( i = 0 ; i < pages ; i++ ) {
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
/* we need to support large memory configurations */
|
||||
entry->busaddr[i] = pci_map_single(dev->pdev,
|
||||
page_address( entry->pagelist[i] ),
|
||||
|
@ -171,7 +171,7 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
|
|||
unsigned long addr,
|
||||
dma_addr_t bus_addr)
|
||||
{
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
unsigned long pages;
|
||||
int i;
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/* compat-pre24.h -- Linux pre-2.4.0 compatibility
|
||||
* Created: Mon Aug 28 15:31:43 2000 by faith@acm.org
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_PRE24_H_
|
||||
#define _COMPAT_PRE24_H_
|
||||
|
||||
/* virt_to_page added in 2.4.0-test6 */
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
|
||||
#endif
|
||||
|
||||
#define block_all_signals(a,b,c)
|
||||
#define unblock_all_signals()
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
|
||||
#define __exit
|
||||
#endif
|
||||
|
||||
/* This is a hack that only works for
|
||||
this code base -- because we always
|
||||
call this with dev->tq.* */
|
||||
#undef INIT_LIST_HEAD
|
||||
#define INIT_LIST_HEAD(pointer) dev->tq.next = NULL
|
||||
|
||||
#endif
|
28
linux/drmP.h
28
linux/drmP.h
|
@ -66,13 +66,8 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/agp_backend.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= 0x020100 /* KERNEL_VERSION(2,1,0) */
|
||||
#include <linux/tqueue.h>
|
||||
#include <linux/poll.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "compat-pre24.h"
|
||||
#endif
|
||||
#include <asm/pgalloc.h>
|
||||
#include "drm.h"
|
||||
|
||||
|
@ -171,12 +166,7 @@ typedef struct wait_queue *wait_queue_head_t;
|
|||
#define _PAGE_PSE _PAGE_4M
|
||||
#endif
|
||||
|
||||
/* vm_offset changed to vm_pgoff in 2.3.25 */
|
||||
#if LINUX_VERSION_CODE < 0x020319
|
||||
#define VM_OFFSET(vma) ((vma)->vm_offset)
|
||||
#else
|
||||
#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
|
||||
#endif
|
||||
|
||||
/* *_nopage return values defined in 2.3.26 */
|
||||
#ifndef NOPAGE_SIGBUS
|
||||
|
@ -629,7 +619,7 @@ typedef struct drm_sg_mem {
|
|||
void *virtual;
|
||||
int pages;
|
||||
struct page **pagelist;
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
dma_addr_t *busaddr;
|
||||
#endif
|
||||
} drm_sg_mem_t;
|
||||
|
@ -772,21 +762,6 @@ extern unsigned int DRM(poll)(struct file *filp,
|
|||
struct poll_table_struct *wait);
|
||||
|
||||
/* Mapping support (drm_vm.h) */
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
extern unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
|
@ -799,7 +774,6 @@ extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
#endif
|
||||
extern void DRM(vm_open)(struct vm_area_struct *vma);
|
||||
extern void DRM(vm_close)(struct vm_area_struct *vma);
|
||||
extern void DRM(vm_shm_close)(struct vm_area_struct *vma);
|
||||
|
|
|
@ -35,12 +35,8 @@
|
|||
|
||||
#if __REALLY_HAVE_AGP
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "agpsupport-pre24.h"
|
||||
#else
|
||||
#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
|
||||
#define DRM_AGP_PUT inter_module_put("drm_agp")
|
||||
#endif
|
||||
|
||||
static const drm_agp_t *drm_agp = NULL;
|
||||
|
||||
|
@ -271,22 +267,18 @@ drm_agp_head_t *DRM(agp_init)(void)
|
|||
case INTEL_GX: head->chipset = "Intel 440GX"; break;
|
||||
case INTEL_I810: head->chipset = "Intel i810"; break;
|
||||
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
case INTEL_I815: head->chipset = "Intel i815"; break;
|
||||
case INTEL_I840: head->chipset = "Intel i840"; break;
|
||||
case INTEL_I850: head->chipset = "Intel i850"; break;
|
||||
#endif
|
||||
|
||||
case VIA_GENERIC: head->chipset = "VIA"; break;
|
||||
case VIA_VP3: head->chipset = "VIA VP3"; break;
|
||||
case VIA_MVP3: head->chipset = "VIA MVP3"; break;
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
case VIA_MVP4: head->chipset = "VIA MVP4"; break;
|
||||
case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133";
|
||||
break;
|
||||
case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro";
|
||||
break;
|
||||
|
|
|
@ -229,11 +229,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp,
|
|||
DRM(free)(list, sizeof(*list), DRM_MEM_MAPS);
|
||||
|
||||
for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
if (pt->vma->vm_private_data == map) found_maps++;
|
||||
#else
|
||||
if (pt->vma->vm_pte == map) found_maps++;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(!found_maps) {
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
#define DRIVER_IOCTLS
|
||||
#endif
|
||||
#ifndef DRIVER_FOPS
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
#define DRIVER_FOPS \
|
||||
static struct file_operations DRM(fops) = { \
|
||||
owner: THIS_MODULE, \
|
||||
|
@ -126,19 +125,6 @@ static struct file_operations DRM(fops) = { \
|
|||
fasync: DRM(fasync), \
|
||||
poll: DRM(poll), \
|
||||
}
|
||||
#else
|
||||
#define DRIVER_FOPS \
|
||||
static struct file_operations DRM(fops) = { \
|
||||
open: DRM(open), \
|
||||
flush: DRM(flush), \
|
||||
release: DRM(release), \
|
||||
ioctl: DRM(ioctl), \
|
||||
mmap: DRM(mmap), \
|
||||
read: DRM(read), \
|
||||
fasync: DRM(fasync), \
|
||||
poll: DRM(poll), \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -731,9 +717,6 @@ int DRM(open)( struct inode *inode, struct file *filp )
|
|||
|
||||
retcode = DRM(open_helper)( inode, filp, dev );
|
||||
if ( !retcode ) {
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
|
||||
spin_lock( &dev->count_lock );
|
||||
if ( !dev->open_count++ ) {
|
||||
|
@ -852,9 +835,6 @@ int DRM(release)( struct inode *inode, struct file *filp )
|
|||
* End inline drm_release
|
||||
*/
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
|
||||
spin_lock( &dev->count_lock );
|
||||
if ( !--dev->open_count ) {
|
||||
|
|
|
@ -191,24 +191,8 @@ int DRM(write_string)(drm_device_t *dev, const char *s)
|
|||
send -= count;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS)
|
||||
/* The extra parameter to kill_fasync was added in 2.3.21, and is
|
||||
_not_ present in _stock_ 2.2.14 and 2.2.15. However, some
|
||||
distributions patch 2.2.x kernels to add this parameter. The
|
||||
Makefile.linux attempts to detect this addition and defines
|
||||
KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */
|
||||
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
|
||||
#else
|
||||
|
||||
/* Parameter added in 2.3.21. */
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
|
||||
#else
|
||||
/* Type of first parameter changed in
|
||||
Linux 2.4.0-test2... */
|
||||
if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DRM_DEBUG("waking\n");
|
||||
wake_up_interruptible(&dev->buf_readers);
|
||||
return 0;
|
||||
|
|
|
@ -85,12 +85,7 @@ void DRM(mem_init)(void)
|
|||
}
|
||||
|
||||
si_meminfo(&si);
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
/* Changed to page count in 2.3.23 */
|
||||
DRM(ram_available) = si.totalram >> PAGE_SHIFT;
|
||||
#else
|
||||
DRM(ram_available) = si.totalram;
|
||||
#endif
|
||||
DRM(ram_used) = 0;
|
||||
}
|
||||
|
||||
|
@ -257,12 +252,7 @@ unsigned long DRM(alloc_pages)(int order, int area)
|
|||
for (addr = address, sz = bytes;
|
||||
sz > 0;
|
||||
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
/* Argument type changed in 2.4.0-test6/pre8 */
|
||||
mem_map_reserve(virt_to_page(addr));
|
||||
#else
|
||||
mem_map_reserve(MAP_NR(addr));
|
||||
#endif
|
||||
}
|
||||
|
||||
return address;
|
||||
|
@ -283,12 +273,7 @@ void DRM(free_pages)(unsigned long address, int order, int area)
|
|||
for (addr = address, sz = bytes;
|
||||
sz > 0;
|
||||
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
/* Argument type changed in 2.4.0-test6/pre8 */
|
||||
mem_map_unreserve(virt_to_page(addr));
|
||||
#else
|
||||
mem_map_unreserve(MAP_NR(addr));
|
||||
#endif
|
||||
}
|
||||
free_pages(address, order);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry )
|
|||
|
||||
vfree( entry->virtual );
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
|
@ -99,7 +99,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
if ( !entry->busaddr ) {
|
||||
|
@ -116,7 +116,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
|||
|
||||
entry->virtual = vmalloc_32( pages << PAGE_SHIFT );
|
||||
if ( !entry->virtual ) {
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020400
|
||||
#include "stubsupport-pre24.h"
|
||||
#endif
|
||||
|
||||
#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */
|
||||
|
||||
static struct drm_stub_list {
|
||||
|
@ -70,9 +66,7 @@ static int DRM(stub_open)(struct inode *inode, struct file *filp)
|
|||
}
|
||||
|
||||
static struct file_operations DRM(stub_fops) = {
|
||||
#if LINUX_VERSION_CODE >= 0x020400
|
||||
owner: THIS_MODULE,
|
||||
#endif
|
||||
open: DRM(stub_open)
|
||||
};
|
||||
|
||||
|
|
|
@ -56,16 +56,9 @@ struct vm_operations_struct DRM(vm_sg_ops) = {
|
|||
close: DRM(vm_close),
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if defined(__alpha__) && __REALLY_HAVE_AGP
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
@ -122,32 +115,17 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
|||
baddr, __va(agpmem->memory->memory[offset]), offset);
|
||||
#endif
|
||||
get_page(page);
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
#else
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||
#endif
|
||||
unsigned long offset;
|
||||
unsigned long i;
|
||||
pgd_t *pgd;
|
||||
|
@ -174,11 +152,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
|||
get_page(page);
|
||||
|
||||
DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page));
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Special close routine which deletes map information if we are the last
|
||||
|
@ -197,25 +171,14 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_dec(&dev->vma_count);
|
||||
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
map = vma->vm_private_data;
|
||||
#else
|
||||
map = vma->vm_pte;
|
||||
#endif
|
||||
|
||||
down(&dev->struct_sem);
|
||||
for (pt = dev->vmalist, prev = NULL; pt; pt = next) {
|
||||
next = pt->next;
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
if (pt->vma->vm_private_data == map) found_maps++;
|
||||
#else
|
||||
if (pt->vma->vm_pte == map) found_maps++;
|
||||
#endif
|
||||
if (pt->vma == vma) {
|
||||
if (prev) {
|
||||
prev->next = pt->next;
|
||||
|
@ -268,16 +231,9 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
up(&dev->struct_sem);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
@ -299,29 +255,14 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
|
||||
DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr,
|
||||
page_to_bus(page));
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#else
|
||||
/* Return type changed in 2.3.23 */
|
||||
struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
#else
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||
#endif
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
|
@ -341,11 +282,7 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
|||
page = entry->pagelist[page_offset];
|
||||
get_page(page);
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020317
|
||||
return page_address(page);
|
||||
#else
|
||||
return page;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRM(vm_open)(struct vm_area_struct *vma)
|
||||
|
@ -357,10 +294,6 @@ void DRM(vm_open)(struct vm_area_struct *vma)
|
|||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
atomic_inc(&dev->vma_count);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
/* The map can exist after the fd is closed. */
|
||||
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
|
||||
vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS);
|
||||
if (vma_entry) {
|
||||
|
@ -381,9 +314,6 @@ void DRM(vm_close)(struct vm_area_struct *vma)
|
|||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||
#if LINUX_VERSION_CODE < 0x020333
|
||||
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||
#endif
|
||||
atomic_dec(&dev->vma_count);
|
||||
|
||||
down(&dev->struct_sem);
|
||||
|
@ -424,11 +354,6 @@ int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma)
|
|||
vma->vm_ops = &DRM(vm_dma_ops);
|
||||
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
|
||||
/* In Linux 2.2.3 and above, this is
|
||||
handled in do_mmap() in mm/mmap.c. */
|
||||
++filp->f_count;
|
||||
#endif
|
||||
vma->vm_file = filp; /* Needed for drm_vm_open() */
|
||||
DRM(vm_open)(vma);
|
||||
return 0;
|
||||
|
@ -543,22 +468,14 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
break;
|
||||
case _DRM_SHM:
|
||||
vma->vm_ops = &DRM(vm_shm_ops);
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
vma->vm_private_data = (void *)map;
|
||||
#else
|
||||
vma->vm_pte = (unsigned long)map;
|
||||
#endif
|
||||
/* Don't let this area swap. Change when
|
||||
DRM_KERNEL advisory is supported. */
|
||||
vma->vm_flags |= VM_LOCKED;
|
||||
break;
|
||||
case _DRM_SCATTER_GATHER:
|
||||
vma->vm_ops = &DRM(vm_sg_ops);
|
||||
#if LINUX_VERSION_CODE >= 0x020300
|
||||
vma->vm_private_data = (void *)map;
|
||||
#else
|
||||
vma->vm_pte = (unsigned long)map;
|
||||
#endif
|
||||
vma->vm_flags |= VM_LOCKED;
|
||||
break;
|
||||
default:
|
||||
|
@ -566,11 +483,6 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
|
|||
}
|
||||
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
||||
|
||||
#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
|
||||
/* In Linux 2.2.3 and above, this is
|
||||
handled in do_mmap() in mm/mmap.c. */
|
||||
++filp->f_count;
|
||||
#endif
|
||||
vma->vm_file = filp; /* Needed for drm_vm_open() */
|
||||
DRM(vm_open)(vma);
|
||||
return 0;
|
||||
|
|
|
@ -227,14 +227,9 @@ static int i810_unmap_buffer(drm_buf_t *buf)
|
|||
#else
|
||||
down_write( ¤t->mm->mmap_sem );
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < 0x020399
|
||||
retcode = do_munmap((unsigned long)buf_priv->virtual,
|
||||
(size_t) buf->total);
|
||||
#else
|
||||
retcode = do_munmap(current->mm,
|
||||
(unsigned long)buf_priv->virtual,
|
||||
(size_t) buf->total);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE <= 0x020402
|
||||
up( ¤t->mm->mmap_sem );
|
||||
#else
|
||||
|
|
|
@ -350,7 +350,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev,
|
|||
tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle;
|
||||
page_ofs = tmp_ofs >> PAGE_SHIFT;
|
||||
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
|
||||
entry->busaddr[page_ofs]);
|
||||
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
|
||||
|
|
|
@ -622,7 +622,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
|
|||
|
||||
tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle;
|
||||
page_ofs = tmp_ofs >> PAGE_SHIFT;
|
||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||
#if defined(__alpha__)
|
||||
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
|
||||
entry->busaddr[page_ofs]);
|
||||
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/* stubsupport.h -- -*- linux-c -*-
|
||||
* Created: Fri Jan 19 10:48:35 2001 by faith@acm.org
|
||||
*
|
||||
* Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _STUBSUPPORT_PRE24_H_
|
||||
#define _STUBSUPPORT_PRE24_H_
|
||||
struct drm_stub_info *DRM(_stub_pointer) = NULL;
|
||||
#define inter_module_put(x)
|
||||
#define inter_module_unregister(x)
|
||||
#define inter_module_get(x) DRM(_stub_pointer)
|
||||
#define inter_module_register(x,y,z) do { DRM(_stub_pointer) = z; } while (0)
|
||||
|
||||
/* This is a kludge for backward compatibility
|
||||
that is only useful in DRM(stub_open) */
|
||||
#define fops_put(fops) MOD_DEC_USE_COUNT
|
||||
#define fops_get(fops) (fops); MOD_INC_USE_COUNT
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue