summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jrfonseca@users.sourceforge.net>2003-04-10 14:58:53 +0000
committerJose Fonseca <jrfonseca@users.sourceforge.net>2003-04-10 14:58:53 +0000
commit95795c2b96a941b590ffa2d53b21d304b884f86d (patch)
treed76bc3ccc238db528dd01b3907eb18cd7a97a993
parent5838120527d037edd27adf60981de3cc6b43c068 (diff)
Add the PCI relevent part of the new DRM API patch, i.e, no AGP/scattermach64-0-0-5-branch
function renaming to avoid interfering with the ongoing BSD port.
-rw-r--r--linux-core/drmP.h29
-rw-r--r--linux-core/drm_drv.c2
-rw-r--r--linux-core/drm_pci.c232
-rw-r--r--linux-core/mach64_drv.c3
-rw-r--r--linux/drm.h10
-rw-r--r--linux/drmP.h29
-rw-r--r--linux/drm_drv.h2
-rw-r--r--linux/drm_pci.h232
-rw-r--r--linux/mach64_drv.c3
-rw-r--r--shared-core/drm.h10
-rw-r--r--shared/drm.h10
11 files changed, 558 insertions, 4 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index d770d2ae..b63dfc07 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -474,6 +474,16 @@ typedef struct drm_device_dma {
wait_queue_head_t waiting; /* Processes waiting on free bufs */
} drm_device_dma_t;
+/**
+ * \brief PCI consistent memory block, for DMA.
+ */
+typedef struct drm_pci_mem {
+ struct list_head list; /**< \brief Linux list */
+ size_t size; /**< \brief size */
+ void *cpuaddr; /**< \brief kernel virtual address */
+ dma_addr_t busaddr; /**< \brief associated bus address */
+} drm_pci_mem_t;
+
#if __REALLY_HAVE_AGP
typedef struct drm_agp_mem {
unsigned long handle;
@@ -607,6 +617,8 @@ typedef struct drm_device {
void *dev_private;
drm_sigdata_t sigdata; /* For block_all_signals */
sigset_t sigmask;
+
+ struct list_head pci_mem; /**< \brief PCI consistent memory */
} drm_device_t;
@@ -832,6 +844,23 @@ extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block);
#endif
#endif /* __HAVE_DMA */
+ /* PCI memory support (drm_pci.h) */
+extern void *DRM(pci_alloc)(drm_device_t *dev, size_t size,
+ dma_addr_t *busaddr);
+extern void DRM(pci_free)(drm_device_t *dev, size_t size, void *cpuaddr,
+ dma_addr_t busaddr);
+extern void *DRM(pci_pool_create)(drm_device_t *dev, size_t size,
+ size_t align);
+extern void DRM(pci_pool_destroy)(drm_device_t *dev, void *entry);
+extern void *DRM(pci_pool_alloc)(void *entry, dma_addr_t *busaddr);
+extern void DRM(pci_pool_free)(void *entry, void *cpuaddr,
+ dma_addr_t busaddr);
+extern int DRM(pci_alloc_ioctl)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(pci_free_ioctl)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern void DRM(pci_cleanup)(drm_device_t *dev);
+
#if __REALLY_HAVE_AGP
/* AGP/GART support (drm_agpsupport.h) */
extern drm_agp_head_t *DRM(agp_init)(void);
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index b124c422..2c5c5988 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -650,6 +650,8 @@ static void __exit drm_cleanup( void )
dev->agp = NULL;
}
#endif
+
+ DRM(pci_cleanup( dev ));
}
DRIVER_POSTCLEANUP();
kfree(DRM(minor));
diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c
new file mode 100644
index 00000000..e6237499
--- /dev/null
+++ b/linux-core/drm_pci.c
@@ -0,0 +1,232 @@
+/**
+ * \file drm_pci.h
+ * \brief ioctl's to manage PCI memory
+ *
+ * \warning These interfaces aren't stable yet.
+ *
+ * \todo Implement the remaining ioctl's for the PCI pools.
+ * \todo Add support to map these buffers.
+ * \todo The wrappers here are so thin that they would be better off inlined..
+ *
+ * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+/*
+ * Copyright 2003 José Fonseca.
+ * 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 THE
+ * AUTHOR 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.
+ */
+
+
+#define __NO_VERSION__
+#include <linux/pci.h>
+#include "drmP.h"
+
+
+/**********************************************************************/
+/** \name PCI memory */
+/*@{*/
+
+/**
+ * \brief Allocate a PCI consistent memory block, for DMA.
+ */
+void * DRM(pci_alloc)( drm_device_t *dev, size_t size,
+ dma_addr_t *busaddr )
+{
+ return pci_alloc_consistent( dev->pdev, size, busaddr );
+}
+
+/**
+ * \brief Free a PCI consistent memory block.
+ */
+void DRM(pci_free)( drm_device_t *dev, size_t size, void *cpuaddr,
+ dma_addr_t busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_free_consistent( dev->pdev, size, cpuaddr, busaddr );
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name PCI memory pool */
+/*@{*/
+
+/**
+ * \brief Create a pool of PCI consistent memory blocks, for DMA.
+ *
+ * \return a handle on success, or NULL on failure.
+ *
+ * \note This is a minimalistic wrapper around Linux's pci_pool_create()
+ * function to ease porting to other OS's. More functionality can be exposed
+ * later if actually required by the drivers.
+ */
+void *DRM(pci_pool_create)( drm_device_t *dev, size_t size, size_t align )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ return pci_pool_create( "DRM", dev->pdev, size, align, 0, 0);
+}
+
+/**
+ * \brief Destroy a pool of PCI consistent memory blocks.
+ */
+void DRM(pci_pool_destroy)( drm_device_t *dev, void *entry )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_pool_destroy( (struct pci_pool *)entry );
+}
+
+/**
+ * \brief Allocate a block from a PCI consistent memory block pool.
+ *
+ * \return the virtual address of a block on success, or NULL on failure.
+ */
+void *DRM(pci_pool_alloc)( void *entry, dma_addr_t *busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ return pci_pool_alloc( (struct pci_pool *)entry, 0, busaddr );
+}
+
+/**
+ * \brief Free a block back into a PCI consistent memory block pool.
+ */
+void DRM(pci_pool_free)( void *entry, void *cpuaddr, dma_addr_t busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_pool_free( (struct pci_pool *)entry, cpuaddr, busaddr );
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Ioctl's */
+/*@{*/
+
+int DRM(pci_alloc_ioctl)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_pci_mem_ioctl_t request;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ if ( copy_from_user( &request,
+ (drm_pci_mem_ioctl_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ entry = DRM(alloc)( sizeof(*entry), DRM_MEM_DRIVER );
+ if ( !entry )
+ return -ENOMEM;
+
+ memset( entry, 0, sizeof(*entry) );
+
+ entry->cpuaddr = DRM(pci_alloc)( dev, request.size,
+ &entry->busaddr );
+
+ if ( !entry->cpuaddr ) {
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return -ENOMEM;
+ }
+
+ entry->size = request.size;
+ request.busaddr = entry->busaddr;
+
+ if ( copy_to_user( (drm_pci_mem_ioctl_t *)arg,
+ &request,
+ sizeof(request) ) ) {
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return -EFAULT;
+ }
+
+ list_add( (struct list_head *)entry, &dev->pci_mem );
+
+ return 0;
+}
+
+int DRM(pci_free_ioctl)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_pci_mem_ioctl_t request;
+ struct list_head *ptr;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ if ( copy_from_user( &request,
+ (drm_pci_mem_ioctl_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ list_for_each(ptr, &dev->pci_mem)
+ {
+ entry = list_entry(ptr, drm_pci_mem_t, list);
+ if( entry->busaddr == request.busaddr ) {
+ list_del(ptr);
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return 0;
+ }
+ }
+
+ return -EFAULT;
+}
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Cleanup */
+/*@{*/
+
+/**
+ * \brief Called on driver exit to free the PCI memory allocated by userspace.
+ */
+void DRM(pci_cleanup)( drm_device_t *dev )
+{
+ struct list_head *ptr, *tmp;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ list_for_each_safe(ptr, tmp, &dev->pci_mem)
+ {
+ entry = list_entry(ptr, drm_pci_mem_t, list);
+ list_del(ptr);
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ }
+}
+
+/*@}*/
diff --git a/linux-core/mach64_drv.c b/linux-core/mach64_drv.c
index b0822e59..ab1d5266 100644
--- a/linux-core/mach64_drv.c
+++ b/linux-core/mach64_drv.c
@@ -33,7 +33,6 @@
#include "drm.h"
#include "mach64_drm.h"
#include "mach64_drv.h"
-#include "ati_pcigart.h"
#define DRIVER_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca"
@@ -72,6 +71,6 @@
#include "drm_lock.h"
#include "drm_memory.h"
#include "drm_proc.h"
+#include "drm_pci.h"
#include "drm_vm.h"
#include "drm_stub.h"
-#include "drm_scatter.h"
diff --git a/linux/drm.h b/linux/drm.h
index 6ab295c4..7006fc42 100644
--- a/linux/drm.h
+++ b/linux/drm.h
@@ -365,6 +365,16 @@ typedef struct drm_scatter_gather {
unsigned long handle; /* Used for mapping / unmapping */
} drm_scatter_gather_t;
+/**
+ * \brief PCI consistent memory block, for DMA.
+ *
+ * \warning Not stable.
+ */
+typedef struct drm_pci_mem_ioctl {
+ unsigned long size; /**< \brief size */
+ unsigned long busaddr; /**< \brief associated bus address */
+} drm_pci_mem_ioctl_t;
+
#define DRM_IOCTL_BASE 'd'
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size)
diff --git a/linux/drmP.h b/linux/drmP.h
index d770d2ae..b63dfc07 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -474,6 +474,16 @@ typedef struct drm_device_dma {
wait_queue_head_t waiting; /* Processes waiting on free bufs */
} drm_device_dma_t;
+/**
+ * \brief PCI consistent memory block, for DMA.
+ */
+typedef struct drm_pci_mem {
+ struct list_head list; /**< \brief Linux list */
+ size_t size; /**< \brief size */
+ void *cpuaddr; /**< \brief kernel virtual address */
+ dma_addr_t busaddr; /**< \brief associated bus address */
+} drm_pci_mem_t;
+
#if __REALLY_HAVE_AGP
typedef struct drm_agp_mem {
unsigned long handle;
@@ -607,6 +617,8 @@ typedef struct drm_device {
void *dev_private;
drm_sigdata_t sigdata; /* For block_all_signals */
sigset_t sigmask;
+
+ struct list_head pci_mem; /**< \brief PCI consistent memory */
} drm_device_t;
@@ -832,6 +844,23 @@ extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block);
#endif
#endif /* __HAVE_DMA */
+ /* PCI memory support (drm_pci.h) */
+extern void *DRM(pci_alloc)(drm_device_t *dev, size_t size,
+ dma_addr_t *busaddr);
+extern void DRM(pci_free)(drm_device_t *dev, size_t size, void *cpuaddr,
+ dma_addr_t busaddr);
+extern void *DRM(pci_pool_create)(drm_device_t *dev, size_t size,
+ size_t align);
+extern void DRM(pci_pool_destroy)(drm_device_t *dev, void *entry);
+extern void *DRM(pci_pool_alloc)(void *entry, dma_addr_t *busaddr);
+extern void DRM(pci_pool_free)(void *entry, void *cpuaddr,
+ dma_addr_t busaddr);
+extern int DRM(pci_alloc_ioctl)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern int DRM(pci_free_ioctl)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+extern void DRM(pci_cleanup)(drm_device_t *dev);
+
#if __REALLY_HAVE_AGP
/* AGP/GART support (drm_agpsupport.h) */
extern drm_agp_head_t *DRM(agp_init)(void);
diff --git a/linux/drm_drv.h b/linux/drm_drv.h
index b124c422..2c5c5988 100644
--- a/linux/drm_drv.h
+++ b/linux/drm_drv.h
@@ -650,6 +650,8 @@ static void __exit drm_cleanup( void )
dev->agp = NULL;
}
#endif
+
+ DRM(pci_cleanup( dev ));
}
DRIVER_POSTCLEANUP();
kfree(DRM(minor));
diff --git a/linux/drm_pci.h b/linux/drm_pci.h
new file mode 100644
index 00000000..e6237499
--- /dev/null
+++ b/linux/drm_pci.h
@@ -0,0 +1,232 @@
+/**
+ * \file drm_pci.h
+ * \brief ioctl's to manage PCI memory
+ *
+ * \warning These interfaces aren't stable yet.
+ *
+ * \todo Implement the remaining ioctl's for the PCI pools.
+ * \todo Add support to map these buffers.
+ * \todo The wrappers here are so thin that they would be better off inlined..
+ *
+ * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+/*
+ * Copyright 2003 José Fonseca.
+ * 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 THE
+ * AUTHOR 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.
+ */
+
+
+#define __NO_VERSION__
+#include <linux/pci.h>
+#include "drmP.h"
+
+
+/**********************************************************************/
+/** \name PCI memory */
+/*@{*/
+
+/**
+ * \brief Allocate a PCI consistent memory block, for DMA.
+ */
+void * DRM(pci_alloc)( drm_device_t *dev, size_t size,
+ dma_addr_t *busaddr )
+{
+ return pci_alloc_consistent( dev->pdev, size, busaddr );
+}
+
+/**
+ * \brief Free a PCI consistent memory block.
+ */
+void DRM(pci_free)( drm_device_t *dev, size_t size, void *cpuaddr,
+ dma_addr_t busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_free_consistent( dev->pdev, size, cpuaddr, busaddr );
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name PCI memory pool */
+/*@{*/
+
+/**
+ * \brief Create a pool of PCI consistent memory blocks, for DMA.
+ *
+ * \return a handle on success, or NULL on failure.
+ *
+ * \note This is a minimalistic wrapper around Linux's pci_pool_create()
+ * function to ease porting to other OS's. More functionality can be exposed
+ * later if actually required by the drivers.
+ */
+void *DRM(pci_pool_create)( drm_device_t *dev, size_t size, size_t align )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ return pci_pool_create( "DRM", dev->pdev, size, align, 0, 0);
+}
+
+/**
+ * \brief Destroy a pool of PCI consistent memory blocks.
+ */
+void DRM(pci_pool_destroy)( drm_device_t *dev, void *entry )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_pool_destroy( (struct pci_pool *)entry );
+}
+
+/**
+ * \brief Allocate a block from a PCI consistent memory block pool.
+ *
+ * \return the virtual address of a block on success, or NULL on failure.
+ */
+void *DRM(pci_pool_alloc)( void *entry, dma_addr_t *busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ return pci_pool_alloc( (struct pci_pool *)entry, 0, busaddr );
+}
+
+/**
+ * \brief Free a block back into a PCI consistent memory block pool.
+ */
+void DRM(pci_pool_free)( void *entry, void *cpuaddr, dma_addr_t busaddr )
+{
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ pci_pool_free( (struct pci_pool *)entry, cpuaddr, busaddr );
+}
+
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Ioctl's */
+/*@{*/
+
+int DRM(pci_alloc_ioctl)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_pci_mem_ioctl_t request;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ if ( copy_from_user( &request,
+ (drm_pci_mem_ioctl_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ entry = DRM(alloc)( sizeof(*entry), DRM_MEM_DRIVER );
+ if ( !entry )
+ return -ENOMEM;
+
+ memset( entry, 0, sizeof(*entry) );
+
+ entry->cpuaddr = DRM(pci_alloc)( dev, request.size,
+ &entry->busaddr );
+
+ if ( !entry->cpuaddr ) {
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return -ENOMEM;
+ }
+
+ entry->size = request.size;
+ request.busaddr = entry->busaddr;
+
+ if ( copy_to_user( (drm_pci_mem_ioctl_t *)arg,
+ &request,
+ sizeof(request) ) ) {
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return -EFAULT;
+ }
+
+ list_add( (struct list_head *)entry, &dev->pci_mem );
+
+ return 0;
+}
+
+int DRM(pci_free_ioctl)( struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg )
+{
+ drm_file_t *priv = filp->private_data;
+ drm_device_t *dev = priv->dev;
+ drm_pci_mem_ioctl_t request;
+ struct list_head *ptr;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ if ( copy_from_user( &request,
+ (drm_pci_mem_ioctl_t *)arg,
+ sizeof(request) ) )
+ return -EFAULT;
+
+ list_for_each(ptr, &dev->pci_mem)
+ {
+ entry = list_entry(ptr, drm_pci_mem_t, list);
+ if( entry->busaddr == request.busaddr ) {
+ list_del(ptr);
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ return 0;
+ }
+ }
+
+ return -EFAULT;
+}
+/*@}*/
+
+
+/**********************************************************************/
+/** \name Cleanup */
+/*@{*/
+
+/**
+ * \brief Called on driver exit to free the PCI memory allocated by userspace.
+ */
+void DRM(pci_cleanup)( drm_device_t *dev )
+{
+ struct list_head *ptr, *tmp;
+ drm_pci_mem_t *entry;
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
+ list_for_each_safe(ptr, tmp, &dev->pci_mem)
+ {
+ entry = list_entry(ptr, drm_pci_mem_t, list);
+ list_del(ptr);
+ DRM(pci_free)( dev, entry->size, entry->cpuaddr,
+ entry->busaddr );
+ DRM(free)( entry, sizeof(*entry), DRM_MEM_DRIVER );
+ }
+}
+
+/*@}*/
diff --git a/linux/mach64_drv.c b/linux/mach64_drv.c
index b0822e59..ab1d5266 100644
--- a/linux/mach64_drv.c
+++ b/linux/mach64_drv.c
@@ -33,7 +33,6 @@
#include "drm.h"
#include "mach64_drm.h"
#include "mach64_drv.h"
-#include "ati_pcigart.h"
#define DRIVER_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca"
@@ -72,6 +71,6 @@
#include "drm_lock.h"
#include "drm_memory.h"
#include "drm_proc.h"
+#include "drm_pci.h"
#include "drm_vm.h"
#include "drm_stub.h"
-#include "drm_scatter.h"
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 6ab295c4..7006fc42 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -365,6 +365,16 @@ typedef struct drm_scatter_gather {
unsigned long handle; /* Used for mapping / unmapping */
} drm_scatter_gather_t;
+/**
+ * \brief PCI consistent memory block, for DMA.
+ *
+ * \warning Not stable.
+ */
+typedef struct drm_pci_mem_ioctl {
+ unsigned long size; /**< \brief size */
+ unsigned long busaddr; /**< \brief associated bus address */
+} drm_pci_mem_ioctl_t;
+
#define DRM_IOCTL_BASE 'd'
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size)
diff --git a/shared/drm.h b/shared/drm.h
index 6ab295c4..7006fc42 100644
--- a/shared/drm.h
+++ b/shared/drm.h
@@ -365,6 +365,16 @@ typedef struct drm_scatter_gather {
unsigned long handle; /* Used for mapping / unmapping */
} drm_scatter_gather_t;
+/**
+ * \brief PCI consistent memory block, for DMA.
+ *
+ * \warning Not stable.
+ */
+typedef struct drm_pci_mem_ioctl {
+ unsigned long size; /**< \brief size */
+ unsigned long busaddr; /**< \brief associated bus address */
+} drm_pci_mem_ioctl_t;
+
#define DRM_IOCTL_BASE 'd'
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size)