mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-05 11:18:11 +02:00
Adapt to nopage() prototype change in Linux 2.6.1.
Reviewed by: Arjan van de Ven <arjanv@redhat.com>, additional feedback from
William Lee Irwin III and Linus Torvalds.
This commit is contained in:
parent
0dea4de288
commit
2b9c12ef83
4 changed files with 228 additions and 110 deletions
|
|
@ -309,6 +309,19 @@ static inline struct page * vmalloc_to_page(void * vmalloc_addr)
|
|||
DRM(ioremapfree)( (map)->handle, (map)->size, (dev) ); \
|
||||
} while (0)
|
||||
|
||||
#ifndef VMAP_4_ARGS
|
||||
|
||||
#define DRM_IOREMAPAGP(map, dev) \
|
||||
(map)->handle = DRM(ioremap_agp)( (map)->offset, (map)->size, (dev) )
|
||||
|
||||
#define DRM_IOREMAPAGPFREE(map) \
|
||||
do { \
|
||||
if ( (map)->handle && (map)->size ) \
|
||||
DRM(ioremap_agp_free)( (map)->handle, (map)->size ); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find mapping.
|
||||
*
|
||||
|
|
@ -806,18 +819,6 @@ extern int DRM(flush)(struct file *filp);
|
|||
extern int DRM(fasync)(int fd, struct file *filp, int on);
|
||||
|
||||
/* Mapping support (drm_vm.h) */
|
||||
extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
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);
|
||||
|
|
@ -845,6 +846,10 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
|
|||
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
#ifndef VMAP_4_ARGS
|
||||
extern void *DRM(ioremap_agp)(unsigned long offset, unsigned long size, drm_device_t *dev);
|
||||
extern void DRM(ioremap_agp_free)(void *pt, unsigned long size);
|
||||
#endif
|
||||
extern DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type);
|
||||
extern int DRM(free_agp)(DRM_AGP_MEM *handle, int pages);
|
||||
extern int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start);
|
||||
|
|
|
|||
|
|
@ -36,48 +36,19 @@
|
|||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
|
||||
/** AGP virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_ops) = {
|
||||
.nopage = DRM(vm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Shared virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_shm_ops) = {
|
||||
.nopage = DRM(vm_shm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_shm_close),
|
||||
};
|
||||
|
||||
/** DMA virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_dma_ops) = {
|
||||
.nopage = DRM(vm_dma_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Scatter-gather virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_sg_ops) = {
|
||||
.nopage = DRM(vm_sg_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/**
|
||||
* \c nopage method for AGP virtual memory.
|
||||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Find the right map and if it's AGP memory find the real physical page to
|
||||
* map, get the page, increment the use count and return it.
|
||||
*/
|
||||
struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
#if __REALLY_HAVE_AGP
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
|
@ -147,15 +118,13 @@ vm_nopage_error:
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Get the the mapping, find the real physical page to map, get the page, and
|
||||
* return it.
|
||||
*/
|
||||
struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
unsigned long offset;
|
||||
|
|
@ -262,14 +231,12 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Determine the page number from the page offset and get it from drm_device_dma::pagelist.
|
||||
*/
|
||||
struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
|
@ -298,14 +265,12 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
|
||||
*/
|
||||
struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
|
@ -330,6 +295,95 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
|||
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) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_shm_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_dma_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_sg_nopage)(vma, address);
|
||||
}
|
||||
|
||||
#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),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Shared virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_shm_ops) = {
|
||||
.nopage = DRM(vm_shm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_shm_close),
|
||||
};
|
||||
|
||||
/** DMA virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_dma_ops) = {
|
||||
.nopage = DRM(vm_dma_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Scatter-gather virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_sg_ops) = {
|
||||
.nopage = DRM(vm_sg_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \c open method for shared virtual memory.
|
||||
*
|
||||
|
|
|
|||
29
linux/drmP.h
29
linux/drmP.h
|
|
@ -309,6 +309,19 @@ static inline struct page * vmalloc_to_page(void * vmalloc_addr)
|
|||
DRM(ioremapfree)( (map)->handle, (map)->size, (dev) ); \
|
||||
} while (0)
|
||||
|
||||
#ifndef VMAP_4_ARGS
|
||||
|
||||
#define DRM_IOREMAPAGP(map, dev) \
|
||||
(map)->handle = DRM(ioremap_agp)( (map)->offset, (map)->size, (dev) )
|
||||
|
||||
#define DRM_IOREMAPAGPFREE(map) \
|
||||
do { \
|
||||
if ( (map)->handle && (map)->size ) \
|
||||
DRM(ioremap_agp_free)( (map)->handle, (map)->size ); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find mapping.
|
||||
*
|
||||
|
|
@ -806,18 +819,6 @@ extern int DRM(flush)(struct file *filp);
|
|||
extern int DRM(fasync)(int fd, struct file *filp, int on);
|
||||
|
||||
/* Mapping support (drm_vm.h) */
|
||||
extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access);
|
||||
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);
|
||||
|
|
@ -845,6 +846,10 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
|
|||
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
|
||||
|
||||
#if __REALLY_HAVE_AGP
|
||||
#ifndef VMAP_4_ARGS
|
||||
extern void *DRM(ioremap_agp)(unsigned long offset, unsigned long size, drm_device_t *dev);
|
||||
extern void DRM(ioremap_agp_free)(void *pt, unsigned long size);
|
||||
#endif
|
||||
extern DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type);
|
||||
extern int DRM(free_agp)(DRM_AGP_MEM *handle, int pages);
|
||||
extern int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start);
|
||||
|
|
|
|||
140
linux/drm_vm.h
140
linux/drm_vm.h
|
|
@ -36,48 +36,19 @@
|
|||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
|
||||
/** AGP virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_ops) = {
|
||||
.nopage = DRM(vm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Shared virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_shm_ops) = {
|
||||
.nopage = DRM(vm_shm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_shm_close),
|
||||
};
|
||||
|
||||
/** DMA virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_dma_ops) = {
|
||||
.nopage = DRM(vm_dma_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Scatter-gather virtual memory operations */
|
||||
struct vm_operations_struct DRM(vm_sg_ops) = {
|
||||
.nopage = DRM(vm_sg_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/**
|
||||
* \c nopage method for AGP virtual memory.
|
||||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Find the right map and if it's AGP memory find the real physical page to
|
||||
* map, get the page, increment the use count and return it.
|
||||
*/
|
||||
struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
#if __REALLY_HAVE_AGP
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
|
@ -147,15 +118,13 @@ vm_nopage_error:
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Get the the mapping, find the real physical page to map, get the page, and
|
||||
* return it.
|
||||
*/
|
||||
struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
unsigned long offset;
|
||||
|
|
@ -262,14 +231,12 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Determine the page number from the page offset and get it from drm_device_dma::pagelist.
|
||||
*/
|
||||
struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
|
|
@ -298,14 +265,12 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
|||
*
|
||||
* \param vma virtual memory area.
|
||||
* \param address access address.
|
||||
* \param write_access sharing.
|
||||
* \return pointer to the page structure.
|
||||
*
|
||||
* Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
|
||||
*/
|
||||
struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int write_access)
|
||||
static __inline__ struct page *DRM(do_vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address)
|
||||
{
|
||||
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
|
|
@ -330,6 +295,95 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
|||
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) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_shm_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_dma_nopage)(vma, address);
|
||||
}
|
||||
|
||||
static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||
unsigned long address,
|
||||
int *type) {
|
||||
if (type) *type = VM_FAULT_MINOR;
|
||||
return DRM(do_vm_sg_nopage)(vma, address);
|
||||
}
|
||||
|
||||
#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),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Shared virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_shm_ops) = {
|
||||
.nopage = DRM(vm_shm_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_shm_close),
|
||||
};
|
||||
|
||||
/** DMA virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_dma_ops) = {
|
||||
.nopage = DRM(vm_dma_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
/** Scatter-gather virtual memory operations */
|
||||
static struct vm_operations_struct DRM(vm_sg_ops) = {
|
||||
.nopage = DRM(vm_sg_nopage),
|
||||
.open = DRM(vm_open),
|
||||
.close = DRM(vm_close),
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \c open method for shared virtual memory.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue