Sync with Linux 2.4.0-test6-pre8
authorRik Faith <faith@alephnull.com>
Tue, 8 Aug 2000 16:04:21 +0000 (16:04 +0000)
committerRik Faith <faith@alephnull.com>
Tue, 8 Aug 2000 16:04:21 +0000 (16:04 +0000)
18 files changed:
linux-core/README.drm
linux-core/drmP.h
linux-core/i810_dma.c
linux-core/i810_drv.c
linux-core/mga_drv.c
linux-core/r128_drv.c
linux-core/tdfx_drv.c
linux/README.drm
linux/drmP.h
linux/gamma_drv.c
linux/i810_dma.c
linux/i810_drv.c
linux/memory.c
linux/mga_dma.c
linux/mga_drv.c
linux/r128_drv.c
linux/tdfx_drv.c
linux/vm.c

index 1cc4c27..6441e01 100644 (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/                          *
+************************************************************
index 516e9b2..4f85d07 100644 (file)
@@ -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
index f3d9db4..19b7bd9 100644 (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;
 }
index 5cab071..275663a 100644 (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,
index 7aae6f3..acc42b8 100644 (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,
index 6b1b19d..fac8824 100644 (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,
index ba8c40c..59f1019 100644 (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,
index 1cc4c27..6441e01 100644 (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/                          *
+************************************************************
index 516e9b2..4f85d07 100644 (file)
@@ -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
index 32b2ba2..13d37c2 100644 (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,
index f3d9db4..19b7bd9 100644 (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;
 }
index 5cab071..275663a 100644 (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,
index 5023de8..bcb674b 100644 (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);
        }
index 28e8811..d02c3b5 100644 (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;
 }
index 7aae6f3..acc42b8 100644 (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,
index 6b1b19d..fac8824 100644 (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,
index ba8c40c..59f1019 100644 (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,
index b1f0d49..d295529 100644 (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
 }