summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/README.drm11
-rw-r--r--linux-core/drmP.h5
-rw-r--r--linux-core/i810_dma.c10
-rw-r--r--linux-core/i810_drv.c4
-rw-r--r--linux-core/mga_drv.c4
-rw-r--r--linux-core/r128_drv.c4
-rw-r--r--linux-core/tdfx_drv.c4
-rw-r--r--linux/README.drm11
-rw-r--r--linux/drmP.h5
-rw-r--r--linux/gamma_drv.c4
-rw-r--r--linux/i810_dma.c10
-rw-r--r--linux/i810_drv.c4
-rw-r--r--linux/memory.c10
-rw-r--r--linux/mga_dma.c10
-rw-r--r--linux/mga_drv.c4
-rw-r--r--linux/r128_drv.c4
-rw-r--r--linux/tdfx_drv.c4
-rw-r--r--linux/vm.c12
18 files changed, 75 insertions, 45 deletions
diff --git a/linux-core/README.drm b/linux-core/README.drm
index 1cc4c277..6441e01e 100644
--- a/linux-core/README.drm
+++ b/linux-core/README.drm
@@ -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/ *
+************************************************************
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 516e9b22..4f85d07c 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -139,6 +139,11 @@ typedef struct wait_queue *wait_queue_head_t;
#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 */
#ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index f3d9db43..19b7bd92 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -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;
}
diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c
index 5cab071e..275663a1 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -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,
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index 7aae6f3e..acc42b83 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -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,
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index 6b1b19d5..fac88247 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -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,
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index ba8c40ce..59f10197 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -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,
diff --git a/linux/README.drm b/linux/README.drm
index 1cc4c277..6441e01e 100644
--- a/linux/README.drm
+++ b/linux/README.drm
@@ -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/ *
+************************************************************
diff --git a/linux/drmP.h b/linux/drmP.h
index 516e9b22..4f85d07c 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -139,6 +139,11 @@ typedef struct wait_queue *wait_queue_head_t;
#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 */
#ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c
index 32b2ba2b..13d37c24 100644
--- a/linux/gamma_drv.c
+++ b/linux/gamma_drv.c
@@ -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,
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index f3d9db43..19b7bd92 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -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;
}
diff --git a/linux/i810_drv.c b/linux/i810_drv.c
index 5cab071e..275663a1 100644
--- a/linux/i810_drv.c
+++ b/linux/i810_drv.c
@@ -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,
diff --git a/linux/memory.c b/linux/memory.c
index 5023de80..bcb674b5 100644
--- a/linux/memory.c
+++ b/linux/memory.c
@@ -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);
}
diff --git a/linux/mga_dma.c b/linux/mga_dma.c
index 28e8811c..d02c3b58 100644
--- a/linux/mga_dma.c
+++ b/linux/mga_dma.c
@@ -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;
}
diff --git a/linux/mga_drv.c b/linux/mga_drv.c
index 7aae6f3e..acc42b83 100644
--- a/linux/mga_drv.c
+++ b/linux/mga_drv.c
@@ -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,
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index 6b1b19d5..fac88247 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -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,
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index ba8c40ce..59f10197 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -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,
diff --git a/linux/vm.c b/linux/vm.c
index b1f0d49a..d295529b 100644
--- a/linux/vm.c
+++ b/linux/vm.c
@@ -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
}