Sync with Linux 2.4.0-test6-pre8

main
Rik Faith 2000-08-08 16:04:21 +00:00
parent 9199075a6a
commit 8b9363d1b1
18 changed files with 75 additions and 45 deletions

View File

@ -1,3 +1,7 @@
************************************************************
* For the very latest on DRI development, please see: *
* http://dri.sourceforge.net/ *
************************************************************
The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
@ -36,6 +40,7 @@ For specific information about kernel-level support, see:
A Security Analysis of the Direct Rendering Infrastructure
http://precisioninsight.com/dr/security.html
$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $
************************************************************
* For the very latest on DRI development, please see: *
* http://dri.sourceforge.net/ *
************************************************************

View File

@ -137,6 +137,11 @@ typedef struct wait_queue *wait_queue_head_t;
#endif
#ifndef module_exit
#define module_exit(x) void cleanup_module(void) { x(); }
#endif
/* virt_to_page added in 2.4.0-test6 */
#ifndef virt_to_page
#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
#endif
/* Generic cmpxchg added in 2.3.x */

View File

@ -282,8 +282,8 @@ static unsigned long i810_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
atomic_inc(&mem_map[MAP_NR((void *) address)].count);
set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@ -293,9 +293,9 @@ static void i810_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL)
return;
atomic_dec(&mem_map[MAP_NR((void *) page)].count);
clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
wake_up(&mem_map[MAP_NR((void *) page)].wait);
atomic_dec(&virt_to_page(page)->count);
clear_bit(PG_locked, &virt_to_page(page)->flags);
wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}

View File

@ -44,8 +44,8 @@ static drm_device_t i810_device;
drm_ctx_t i810_res_ctx;
static struct file_operations i810_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: i810_open,

View File

@ -45,8 +45,8 @@ static drm_device_t mga_device;
drm_ctx_t mga_res_ctx;
static struct file_operations mga_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: mga_open,

View File

@ -44,8 +44,8 @@ static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
static struct file_operations r128_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: r128_open,

View File

@ -45,8 +45,8 @@ static drm_device_t tdfx_device;
drm_ctx_t tdfx_res_ctx;
static struct file_operations tdfx_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: tdfx_open,

View File

@ -1,3 +1,7 @@
************************************************************
* For the very latest on DRI development, please see: *
* http://dri.sourceforge.net/ *
************************************************************
The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
@ -36,6 +40,7 @@ For specific information about kernel-level support, see:
A Security Analysis of the Direct Rendering Infrastructure
http://precisioninsight.com/dr/security.html
$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $
************************************************************
* For the very latest on DRI development, please see: *
* http://dri.sourceforge.net/ *
************************************************************

View File

@ -137,6 +137,11 @@ typedef struct wait_queue *wait_queue_head_t;
#endif
#ifndef module_exit
#define module_exit(x) void cleanup_module(void) { x(); }
#endif
/* virt_to_page added in 2.4.0-test6 */
#ifndef virt_to_page
#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
#endif
/* Generic cmpxchg added in 2.3.x */

View File

@ -50,8 +50,8 @@
static drm_device_t gamma_device;
static struct file_operations gamma_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: gamma_open,

View File

@ -282,8 +282,8 @@ static unsigned long i810_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
atomic_inc(&mem_map[MAP_NR((void *) address)].count);
set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@ -293,9 +293,9 @@ static void i810_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL)
return;
atomic_dec(&mem_map[MAP_NR((void *) page)].count);
clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
wake_up(&mem_map[MAP_NR((void *) page)].wait);
atomic_dec(&virt_to_page(page)->count);
clear_bit(PG_locked, &virt_to_page(page)->flags);
wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}

View File

@ -44,8 +44,8 @@ static drm_device_t i810_device;
drm_ctx_t i810_res_ctx;
static struct file_operations i810_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: i810_open,

View File

@ -246,7 +246,12 @@ 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;
@ -267,7 +272,12 @@ 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);
}

View File

@ -57,8 +57,8 @@ static unsigned long mga_alloc_page(drm_device_t *dev)
if(address == 0UL) {
return 0;
}
atomic_inc(&mem_map[MAP_NR((void *) address)].count);
set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@ -70,9 +70,9 @@ static void mga_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL) {
return;
}
atomic_dec(&mem_map[MAP_NR((void *) page)].count);
clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
wake_up(&mem_map[MAP_NR((void *) page)].wait);
atomic_dec(&virt_to_page(page)->count);
clear_bit(PG_locked, &virt_to_page(page)->flags);
wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}

View File

@ -45,8 +45,8 @@ static drm_device_t mga_device;
drm_ctx_t mga_res_ctx;
static struct file_operations mga_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: mga_open,

View File

@ -44,8 +44,8 @@ static drm_device_t r128_device;
drm_ctx_t r128_res_ctx;
static struct file_operations r128_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: r128_open,

View File

@ -45,8 +45,8 @@ static drm_device_t tdfx_device;
drm_ctx_t tdfx_res_ctx;
static struct file_operations tdfx_fops = {
#if LINUX_VERSION_CODE >= 0x020322
/* This started being used approx. 2.3.34 */
#if LINUX_VERSION_CODE >= 0x020400
/* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: tdfx_open,

View File

@ -96,13 +96,13 @@ struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start;
physical = (unsigned long)map->handle + offset;
atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
return mem_map + MAP_NR(physical);
return virt_to_page(physical);
#endif
}
@ -129,13 +129,13 @@ struct page *drm_vm_shm_nopage_lock(struct vm_area_struct *vma,
offset = address - vma->vm_start;
page = offset >> PAGE_SHIFT;
physical = (unsigned long)dev->lock.hw_lock + offset;
atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
return mem_map + MAP_NR(physical);
return virt_to_page(physical);
#endif
}
@ -164,13 +164,13 @@ struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
page = offset >> PAGE_SHIFT;
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
return mem_map + MAP_NR(physical);
return virt_to_page(physical);
#endif
}