summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/i915_dma.c34
-rw-r--r--shared/i915_drm.h37
-rw-r--r--shared/i915_drv.h24
-rw-r--r--shared/i915_irq.c1
-rw-r--r--shared/i915_mem.c21
-rw-r--r--shared/mach64_dma.c48
-rw-r--r--shared/mach64_drv.h15
-rw-r--r--shared/mach64_irq.c3
-rw-r--r--shared/mach64_state.c3
-rw-r--r--shared/mga_dma.c34
-rw-r--r--shared/mga_drv.h15
-rw-r--r--shared/mga_irq.c3
-rw-r--r--shared/mga_state.c1
-rw-r--r--shared/mga_warp.c1
-rw-r--r--shared/r128_cce.c17
-rw-r--r--shared/r128_drv.h17
-rw-r--r--shared/r128_irq.c3
-rw-r--r--shared/r128_state.c102
-rw-r--r--shared/radeon_cp.c22
-rw-r--r--shared/radeon_drv.h18
-rw-r--r--shared/radeon_irq.c11
-rw-r--r--shared/radeon_mem.c21
-rw-r--r--shared/radeon_state.c32
-rw-r--r--shared/sis_drm.h21
-rw-r--r--shared/sis_drv.h11
-rw-r--r--shared/sis_ds.c17
-rw-r--r--shared/sis_mm.c12
-rw-r--r--shared/via_dma.c1
-rw-r--r--shared/via_drm.h32
-rw-r--r--shared/via_drv.c102
-rw-r--r--shared/via_ds.c16
-rw-r--r--shared/via_ds.h1
-rw-r--r--shared/via_irq.c3
-rw-r--r--shared/via_map.c5
-rw-r--r--shared/via_mm.c53
35 files changed, 419 insertions, 338 deletions
diff --git a/shared/i915_dma.c b/shared/i915_dma.c
index cf0333f6..1b91c60a 100644
--- a/shared/i915_dma.c
+++ b/shared/i915_dma.c
@@ -7,7 +7,6 @@
*
**************************************************************************/
-#include "i915.h"
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
@@ -84,7 +83,7 @@ int i915_dma_cleanup(drm_device_t * dev)
* is freed, it's too late.
*/
if (dev->irq)
- DRM(irq_uninstall) (dev);
+ drm_irq_uninstall (dev);
if (dev->dev_private) {
drm_i915_private_t *dev_priv =
@@ -98,7 +97,7 @@ int i915_dma_cleanup(drm_device_t * dev)
#ifdef __FreeBSD__
#if __FreeBSD_version > 500000
contigfree(dev_priv->hw_status_page, PAGE_SIZE,
- DRM(M_DRM));
+ drm_M_DRM);
#endif
#else
pci_free_consistent(dev->pdev, PAGE_SIZE,
@@ -109,7 +108,7 @@ int i915_dma_cleanup(drm_device_t * dev)
I915_WRITE(0x02080, 0x1ffff000);
}
- DRM(free) (dev->dev_private, sizeof(drm_i915_private_t),
+ drm_free (dev->dev_private, sizeof(drm_i915_private_t),
DRM_MEM_DRIVER);
dev->dev_private = NULL;
@@ -183,7 +182,7 @@ static int i915_initialize(drm_device_t * dev,
/* Program Hardware Status Page */
#ifdef __FreeBSD__
dev_priv->hw_status_page =
- contigmalloc(PAGE_SIZE, DRM(M_DRM), M_NOWAIT, 0ul, 0, 0, 0);
+ contigmalloc(PAGE_SIZE, drm_M_DRM, M_NOWAIT, 0ul, 0, 0, 0);
dev_priv->dma_status_page = vtophys(dev_priv->hw_status_page);
#else
dev_priv->hw_status_page =
@@ -255,7 +254,7 @@ int i915_dma_init(DRM_IOCTL_ARGS)
switch (init.func) {
case I915_INIT_DMA:
- dev_priv = DRM(alloc) (sizeof(drm_i915_private_t),
+ dev_priv = drm_alloc (sizeof(drm_i915_private_t),
DRM_MEM_DRIVER);
if (dev_priv == NULL)
return DRM_ERR(ENOMEM);
@@ -733,7 +732,7 @@ int i915_setparam(DRM_IOCTL_ARGS)
return 0;
}
-static void i915_driver_pretakedown(drm_device_t *dev)
+void i915_driver_pretakedown(drm_device_t *dev)
{
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private;
@@ -742,29 +741,10 @@ static void i915_driver_pretakedown(drm_device_t *dev)
i915_dma_cleanup(dev);
}
-static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
+void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_release(dev, filp, dev_priv->agp_heap);
}
}
-
-void i915_driver_register_fns(drm_device_t *dev)
-{
- dev->driver_features =
- DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
- DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED;
- dev->fn_tbl.pretakedown = i915_driver_pretakedown;
- dev->fn_tbl.prerelease = i915_driver_prerelease;
- dev->fn_tbl.irq_preinstall = i915_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = i915_driver_irq_handler;
-
- dev->counters += 4;
- dev->types[6] = _DRM_STAT_IRQ;
- dev->types[7] = _DRM_STAT_PRIMARY;
- dev->types[8] = _DRM_STAT_SECONDARY;
- dev->types[9] = _DRM_STAT_DMA;
-}
diff --git a/shared/i915_drm.h b/shared/i915_drm.h
index 24f4cd62..7e55edf4 100644
--- a/shared/i915_drm.h
+++ b/shared/i915_drm.h
@@ -61,18 +61,31 @@ typedef struct _drm_i915_sarea {
/* I915 specific ioctls
* The device specific ioctl range is 0x40 to 0x79.
*/
-#define DRM_IOCTL_I915_INIT DRM_IOW( 0x40, drm_i915_init_t)
-#define DRM_IOCTL_I915_FLUSH DRM_IO ( 0x41)
-#define DRM_IOCTL_I915_FLIP DRM_IO ( 0x42)
-#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( 0x43, drm_i915_batchbuffer_t)
-#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(0x44, drm_i915_irq_emit_t)
-#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( 0x45, drm_i915_irq_wait_t)
-#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(0x46, drm_i915_getparam_t)
-#define DRM_IOCTL_I915_SETPARAM DRM_IOW( 0x47, drm_i915_setparam_t)
-#define DRM_IOCTL_I915_ALLOC DRM_IOWR(0x48, drm_i915_mem_alloc_t)
-#define DRM_IOCTL_I915_FREE DRM_IOW( 0x49, drm_i915_mem_free_t)
-#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( 0x4a, drm_i915_mem_init_heap_t)
-#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( 0x4b, drm_i915_cmdbuffer_t)
+#define DRM_I915_INIT 0x00
+#define DRM_I915_FLUSH 0x01
+#define DRM_I915_FLIP 0x02
+#define DRM_I915_BATCHBUFFER 0x03
+#define DRM_I915_IRQ_EMIT 0x04
+#define DRM_I915_IRQ_WAIT 0x05
+#define DRM_I915_GETPARAM 0x06
+#define DRM_I915_SETPARAM 0x07
+#define DRM_I915_ALLOC 0x08
+#define DRM_I915_FREE 0x09
+#define DRM_I915_INIT_HEAP 0x0a
+#define DRM_I915_CMDBUFFER 0x0b
+
+#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
+#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
+#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
+#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
+#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
+#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
+#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
+#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
+#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
+#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
+#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
+#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
/* Allow drivers to submit batchbuffers directly to hardware, relying
* on the security mechanisms provided by hardware.
diff --git a/shared/i915_drv.h b/shared/i915_drv.h
index 7564cd09..f6ca92a5 100644
--- a/shared/i915_drv.h
+++ b/shared/i915_drv.h
@@ -10,6 +10,28 @@
#ifndef _I915_DRV_H_
#define _I915_DRV_H_
+/* General customization:
+ */
+
+#define DRIVER_AUTHOR "Tungsten Graphics, Inc."
+
+#define DRIVER_NAME "i915"
+#define DRIVER_DESC "Intel Graphics"
+#define DRIVER_DATE "20040405"
+
+/* Interface history:
+ *
+ * 1.1: Original.
+ */
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
+/* We use our own dma mechanisms, not the drm template code. However,
+ * the shared IRQ code is useful to us:
+ */
+#define __HAVE_PM 1
+
typedef struct _drm_i915_ring_buffer {
int tail_mask;
unsigned long Start;
@@ -66,6 +88,8 @@ extern int i915_getparam(DRM_IOCTL_ARGS);
extern int i915_setparam(DRM_IOCTL_ARGS);
extern int i915_cmdbuffer(DRM_IOCTL_ARGS);
extern void i915_kernel_lost_context(drm_device_t * dev);
+extern void i915_driver_pretakedown(drm_device_t *dev);
+extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp);
/* i915_irq.c */
extern int i915_irq_emit(DRM_IOCTL_ARGS);
diff --git a/shared/i915_irq.c b/shared/i915_irq.c
index de91aba5..581d3f22 100644
--- a/shared/i915_irq.c
+++ b/shared/i915_irq.c
@@ -7,7 +7,6 @@
*
**************************************************************************/
-#include "i915.h"
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
diff --git a/shared/i915_mem.c b/shared/i915_mem.c
index c6115b7e..d54a3005 100644
--- a/shared/i915_mem.c
+++ b/shared/i915_mem.c
@@ -7,7 +7,6 @@
*
**************************************************************************/
-#include "i915.h"
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
@@ -75,7 +74,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
{
/* Maybe cut off the start of an existing block */
if (start > p->start) {
- struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFLISTS);
+ struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFLISTS);
if (!newblock)
goto out;
newblock->start = start;
@@ -91,7 +90,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
/* Maybe cut off the end of an existing block */
if (size < p->size) {
- struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFLISTS);
+ struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFLISTS);
if (!newblock)
goto out;
newblock->start = start + size;
@@ -148,7 +147,7 @@ static void free_block(struct mem_block *p)
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM(free)(q, sizeof(*q), DRM_MEM_BUFLISTS);
+ drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS);
}
if (p->prev->filp == NULL) {
@@ -156,7 +155,7 @@ static void free_block(struct mem_block *p)
q->size += p->size;
q->next = p->next;
q->next->prev = q;
- DRM(free)(p, sizeof(*q), DRM_MEM_BUFLISTS);
+ drm_free(p, sizeof(*q), DRM_MEM_BUFLISTS);
}
}
@@ -164,14 +163,14 @@ static void free_block(struct mem_block *p)
*/
static int init_heap(struct mem_block **heap, int start, int size)
{
- struct mem_block *blocks = DRM(alloc)(sizeof(*blocks), DRM_MEM_BUFLISTS);
+ struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFLISTS);
if (!blocks)
return -ENOMEM;
- *heap = DRM(alloc)(sizeof(**heap), DRM_MEM_BUFLISTS);
+ *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFLISTS);
if (!*heap) {
- DRM(free)(blocks, sizeof(*blocks), DRM_MEM_BUFLISTS);
+ drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFLISTS);
return -ENOMEM;
}
@@ -211,7 +210,7 @@ void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap)
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM(free)(q, sizeof(*q), DRM_MEM_BUFLISTS);
+ drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS);
}
}
}
@@ -228,10 +227,10 @@ void i915_mem_takedown(struct mem_block **heap)
for (p = (*heap)->next; p != *heap;) {
struct mem_block *q = p;
p = p->next;
- DRM(free)(q, sizeof(*q), DRM_MEM_BUFLISTS);
+ drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS);
}
- DRM(free)(*heap, sizeof(**heap), DRM_MEM_BUFLISTS);
+ drm_free(*heap, sizeof(**heap), DRM_MEM_BUFLISTS);
*heap = NULL;
}
diff --git a/shared/mach64_dma.c b/shared/mach64_dma.c
index 210a6103..c463b6cf 100644
--- a/shared/mach64_dma.c
+++ b/shared/mach64_dma.c
@@ -28,10 +28,9 @@
* Gareth Hughes <gareth@valinux.com>
* Frank C. Earl <fearl@airmail.net>
* Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
+ * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
*/
-#include "mach64.h"
#include "drmP.h"
#include "drm.h"
#include "mach64_drm.h"
@@ -447,7 +446,7 @@ static int mach64_bm_dma_test( drm_device_t *dev )
/* FIXME: get a dma buffer from the freelist here */
DRM_DEBUG( "Allocating data memory ...\n" );
- cpu_addr_data = DRM(pci_alloc)( dev, 0x1000, 0x1000, 0xfffffffful, &data_handle );
+ cpu_addr_data = drm_pci_alloc( dev, 0x1000, 0x1000, 0xfffffffful, &data_handle );
if (!cpu_addr_data || !data_handle) {
DRM_INFO( "data-memory allocation failed!\n" );
return DRM_ERR(ENOMEM);
@@ -481,7 +480,7 @@ static int mach64_bm_dma_test( drm_device_t *dev )
DRM_INFO( "resetting engine ...\n");
mach64_do_engine_reset( dev_priv );
DRM_INFO( "freeing data buffer memory.\n" );
- DRM(pci_free)( dev, 0x1000, cpu_addr_data, data_handle );
+ drm_pci_free( dev, 0x1000, cpu_addr_data, data_handle );
return DRM_ERR(EIO);
}
}
@@ -535,7 +534,7 @@ static int mach64_bm_dma_test( drm_device_t *dev )
MACH64_WRITE( MACH64_PAT_REG0, pat_reg0 );
MACH64_WRITE( MACH64_PAT_REG1, pat_reg1 );
DRM_INFO( "freeing data buffer memory.\n" );
- DRM(pci_free)( dev, 0x1000, cpu_addr_data, data_handle );
+ drm_pci_free( dev, 0x1000, cpu_addr_data, data_handle );
return i;
}
DRM_DEBUG( "waiting for idle...done\n" );
@@ -572,7 +571,7 @@ static int mach64_bm_dma_test( drm_device_t *dev )
MACH64_WRITE( MACH64_PAT_REG0, pat_reg0 );
MACH64_WRITE( MACH64_PAT_REG1, pat_reg1 );
DRM_INFO( "freeing data buffer memory.\n" );
- DRM(pci_free)( dev, 0x1000, cpu_addr_data, data_handle );
+ drm_pci_free( dev, 0x1000, cpu_addr_data, data_handle );
return i;
}
@@ -600,7 +599,7 @@ static int mach64_bm_dma_test( drm_device_t *dev )
MACH64_WRITE( MACH64_PAT_REG1, pat_reg1 );
DRM_DEBUG( "freeing data buffer memory.\n" );
- DRM(pci_free)( dev, 0x1000, cpu_addr_data, data_handle );
+ drm_pci_free( dev, 0x1000, cpu_addr_data, data_handle );
DRM_DEBUG( "returning ...\n" );
return failed;
@@ -615,7 +614,7 @@ static int mach64_do_dma_init( drm_device_t *dev, drm_mach64_init_t *init )
DRM_DEBUG( "%s\n", __FUNCTION__ );
- dev_priv = DRM(alloc)( sizeof(drm_mach64_private_t), DRM_MEM_DRIVER );
+ dev_priv = drm_alloc( sizeof(drm_mach64_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
return DRM_ERR(ENOMEM);
@@ -747,7 +746,7 @@ static int mach64_do_dma_init( drm_device_t *dev, drm_mach64_init_t *init )
dev_priv->ring.size = 0x4000; /* 16KB */
if ( dev_priv->is_pci ) {
- dev_priv->ring.start = DRM(pci_alloc)( dev, dev_priv->ring.size,
+ dev_priv->ring.start = drm_pci_alloc( dev, dev_priv->ring.size,
dev_priv->ring.size, 0xfffffffful,
&dev_priv->ring.handle );
@@ -976,14 +975,14 @@ int mach64_do_cleanup_dma( drm_device_t *dev )
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
- if ( dev->irq ) DRM(irq_uninstall)(dev);
+ if ( dev->irq ) drm_irq_uninstall(dev);
if ( dev->dev_private ) {
drm_mach64_private_t *dev_priv = dev->dev_private;
if ( dev_priv->is_pci ) {
if ( (dev_priv->ring.start != NULL) && dev_priv->ring.handle ) {
- DRM(pci_free)( dev, dev_priv->ring.size,
+ drm_pci_free( dev, dev_priv->ring.size,
dev_priv->ring.start, dev_priv->ring.handle );
}
} else {
@@ -998,7 +997,7 @@ int mach64_do_cleanup_dma( drm_device_t *dev )
mach64_destroy_freelist( dev );
- DRM(free)( dev_priv, sizeof(drm_mach64_private_t),
+ drm_free( dev_priv, sizeof(drm_mach64_private_t),
DRM_MEM_DRIVER );
dev->dev_private = NULL;
}
@@ -1085,7 +1084,7 @@ int mach64_init_freelist( drm_device_t *dev )
for ( i = 0 ; i < dma->buf_count ; i++ ) {
if ((entry =
- (drm_mach64_freelist_t *) DRM(alloc)(sizeof(drm_mach64_freelist_t),
+ (drm_mach64_freelist_t *) drm_alloc(sizeof(drm_mach64_freelist_t),
DRM_MEM_BUFLISTS)) == NULL)
return DRM_ERR(ENOMEM);
memset( entry, 0, sizeof(drm_mach64_freelist_t) );
@@ -1110,20 +1109,20 @@ void mach64_destroy_freelist( drm_device_t *dev )
{
list_del(ptr);
entry = list_entry(ptr, drm_mach64_freelist_t, list);
- DRM(free)(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+ drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
}
list_for_each_safe(ptr, tmp, &dev_priv->placeholders)
{
list_del(ptr);
entry = list_entry(ptr, drm_mach64_freelist_t, list);
- DRM(free)(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+ drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
}
list_for_each_safe(ptr, tmp, &dev_priv->free_list)
{
list_del(ptr);
entry = list_entry(ptr, drm_mach64_freelist_t, list);
- DRM(free)(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+ drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
}
}
@@ -1313,7 +1312,7 @@ int mach64_dma_buffers( DRM_IOCTL_ARGS )
DRM_CURRENTPID, d.request_count, dma->buf_count );
ret = DRM_ERR(EINVAL);
}
-
+
d.granted_count = 0;
if ( d.request_count )
@@ -1326,18 +1325,7 @@ int mach64_dma_buffers( DRM_IOCTL_ARGS )
return ret;
}
-static void mach64_driver_pretakedown(drm_device_t *dev)
-{
- mach64_do_cleanup_dma( dev );
-}
-
-void mach64_driver_register_fns(drm_device_t *dev)
+void mach64_driver_pretakedown(drm_device_t *dev)
{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
- dev->fn_tbl.pretakedown = mach64_driver_pretakedown;
- dev->fn_tbl.vblank_wait = mach64_driver_vblank_wait;
- dev->fn_tbl.irq_preinstall = mach64_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = mach64_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = mach64_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = mach64_driver_irq_handler;
+ mach64_do_cleanup_dma( dev );
}
diff --git a/shared/mach64_drv.h b/shared/mach64_drv.h
index b49e6f65..f047b7ef 100644
--- a/shared/mach64_drv.h
+++ b/shared/mach64_drv.h
@@ -28,12 +28,24 @@
* Gareth Hughes <gareth@valinux.com>
* Frank C. Earl <fearl@airmail.net>
* Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
+ * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
*/
#ifndef __MACH64_DRV_H__
#define __MACH64_DRV_H__
+/* General customization:
+ */
+
+#define DRIVER_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca"
+
+#define DRIVER_NAME "mach64"
+#define DRIVER_DESC "DRM module for the ATI Rage Pro"
+#define DRIVER_DATE "20020904"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 0
+#define DRIVER_PATCHLEVEL 0
/* FIXME: remove these when not needed */
/* Development driver options */
@@ -102,6 +114,7 @@ extern int mach64_dma_idle( DRM_IOCTL_ARGS );
extern int mach64_dma_flush( DRM_IOCTL_ARGS );
extern int mach64_engine_reset( DRM_IOCTL_ARGS );
extern int mach64_dma_buffers( DRM_IOCTL_ARGS );
+extern void mach64_driver_pretakedown(drm_device_t *dev);
extern int mach64_init_freelist( drm_device_t *dev );
extern void mach64_destroy_freelist( drm_device_t *dev );
diff --git a/shared/mach64_irq.c b/shared/mach64_irq.c
index efa0641f..966c3c10 100644
--- a/shared/mach64_irq.c
+++ b/shared/mach64_irq.c
@@ -34,7 +34,6 @@
* Leif Delgass <ldelgass@retinalburn.net>
*/
-#include "mach64.h"
#include "drmP.h"
#include "drm.h"
#include "mach64_drm.h"
@@ -63,7 +62,7 @@ irqreturn_t mach64_driver_irq_handler( DRM_IRQ_ARGS )
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
- DRM(vbl_send_signals)( dev );
+ drm_vbl_send_signals( dev );
return IRQ_HANDLED;
}
return IRQ_NONE;
diff --git a/shared/mach64_state.c b/shared/mach64_state.c
index ef85ffd8..127f67d2 100644
--- a/shared/mach64_state.c
+++ b/shared/mach64_state.c
@@ -26,10 +26,9 @@
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
+ * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
*/
-#include "mach64.h"
#include "drmP.h"
#include "drm.h"
#include "mach64_drm.h"
diff --git a/shared/mga_dma.c b/shared/mga_dma.c
index 0288f1c2..896787be 100644
--- a/shared/mga_dma.c
+++ b/shared/mga_dma.c
@@ -33,7 +33,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "mga.h"
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
@@ -308,7 +307,7 @@ static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv )
int i;
DRM_DEBUG( "count=%d\n", dma->buf_count );
- dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t),
+ dev_priv->head = drm_alloc( sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
return DRM_ERR(ENOMEM);
@@ -320,7 +319,7 @@ static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv )
buf = dma->buflist[i];
buf_priv = buf->dev_private;
- entry = DRM(alloc)( sizeof(drm_mga_freelist_t),
+ entry = drm_alloc( sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER );
if ( entry == NULL )
return DRM_ERR(ENOMEM);
@@ -357,7 +356,7 @@ static void mga_freelist_cleanup( drm_device_t *dev )
entry = dev_priv->head;
while ( entry ) {
next = entry->next;
- DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER );
+ drm_free( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER );
entry = next;
}
@@ -458,7 +457,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
int ret;
DRM_DEBUG( "\n" );
- dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER );
+ dev_priv = drm_alloc( sizeof(drm_mga_private_t), DRM_MEM_DRIVER );
if ( !dev_priv )
return DRM_ERR(ENOMEM);
@@ -634,7 +633,7 @@ int mga_do_cleanup_dma( drm_device_t *dev )
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
- if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
+ if ( dev->irq_enabled ) drm_irq_uninstall(dev);
if ( dev->dev_private ) {
drm_mga_private_t *dev_priv = dev->dev_private;
@@ -652,7 +651,7 @@ int mga_do_cleanup_dma( drm_device_t *dev )
mga_freelist_cleanup( dev );
}
- DRM(free)( dev->dev_private, sizeof(drm_mga_private_t),
+ drm_free( dev->dev_private, sizeof(drm_mga_private_t),
DRM_MEM_DRIVER );
dev->dev_private = NULL;
}
@@ -800,30 +799,13 @@ int mga_dma_buffers( DRM_IOCTL_ARGS )
return ret;
}
-static void mga_driver_pretakedown(drm_device_t *dev)
+void mga_driver_pretakedown(drm_device_t *dev)
{
mga_do_cleanup_dma( dev );
}
-static int mga_driver_dma_quiescent(drm_device_t *dev)
+int mga_driver_dma_quiescent(drm_device_t *dev)
{
drm_mga_private_t *dev_priv = dev->dev_private;
return mga_do_wait_for_idle( dev_priv );
}
-
-void mga_driver_register_fns(drm_device_t *dev)
-{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
- dev->fn_tbl.pretakedown = mga_driver_pretakedown;
- dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent;
- dev->fn_tbl.vblank_wait = mga_driver_vblank_wait;
- dev->fn_tbl.irq_preinstall = mga_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = mga_driver_irq_handler;
-
- dev->counters += 3;
- dev->types[6] = _DRM_STAT_IRQ;
- dev->types[7] = _DRM_STAT_PRIMARY;
- dev->types[8] = _DRM_STAT_SECONDARY;
-}
diff --git a/shared/mga_drv.h b/shared/mga_drv.h
index 75dcb0e9..3d8e9aef 100644
--- a/shared/mga_drv.h
+++ b/shared/mga_drv.h
@@ -31,6 +31,19 @@
#ifndef __MGA_DRV_H__
#define __MGA_DRV_H__
+/* General customization:
+ */
+
+#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
+
+#define DRIVER_NAME "mga"
+#define DRIVER_DESC "Matrox G200/G400"
+#define DRIVER_DATE "20021029"
+
+#define DRIVER_MAJOR 3
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
typedef struct drm_mga_primary_buffer {
u8 *start;
u8 *end;
@@ -104,6 +117,8 @@ extern int mga_dma_init( DRM_IOCTL_ARGS );
extern int mga_dma_flush( DRM_IOCTL_ARGS );
extern int mga_dma_reset( DRM_IOCTL_ARGS );
extern int mga_dma_buffers( DRM_IOCTL_ARGS );
+extern void mga_driver_pretakedown(drm_device_t *dev);
+extern int mga_driver_dma_quiescent(drm_device_t *dev);
extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv );
extern int mga_do_dma_idle( drm_mga_private_t *dev_priv );
diff --git a/shared/mga_irq.c b/shared/mga_irq.c
index c3185b0b..bc0b6b5d 100644
--- a/shared/mga_irq.c
+++ b/shared/mga_irq.c
@@ -30,7 +30,6 @@
* Eric Anholt <anholt@FreeBSD.org>
*/
-#include "mga.h"
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
@@ -50,7 +49,7 @@ irqreturn_t mga_driver_irq_handler( DRM_IRQ_ARGS )
MGA_WRITE( MGA_ICLEAR, MGA_VLINEICLR );
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
- DRM(vbl_send_signals)( dev );
+ drm_vbl_send_signals( dev );
return IRQ_HANDLED;
}
return IRQ_NONE;
diff --git a/shared/mga_state.c b/shared/mga_state.c
index 43659825..f676e974 100644
--- a/shared/mga_state.c
+++ b/shared/mga_state.c
@@ -32,7 +32,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "mga.h"
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
diff --git a/shared/mga_warp.c b/shared/mga_warp.c
index de1b911f..0a3a0cc7 100644
--- a/shared/mga_warp.c
+++ b/shared/mga_warp.c
@@ -27,7 +27,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "mga.h"
#include "drmP.h"
#include "drm.h"
#include "mga_drm.h"
diff --git a/shared/r128_cce.c b/shared/r128_cce.c
index 64c9b8be..809e6c8c 100644
--- a/shared/r128_cce.c
+++ b/shared/r128_cce.c
@@ -28,7 +28,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "r128.h"
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
@@ -355,7 +354,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
DRM_DEBUG( "\n" );
- dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER );
+ dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
return DRM_ERR(ENOMEM);
@@ -544,7 +543,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle
+ init->ring_size / sizeof(u32));
dev_priv->ring.size = init->ring_size;
- dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 );
+ dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 );
dev_priv->ring.tail_mask =
(dev_priv->ring.size / sizeof(u32)) - 1;
@@ -561,7 +560,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
#if __OS_HAS_AGP
if ( dev_priv->is_pci ) {
#endif
- if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart,
+ if (!drm_ati_pcigart_init( dev, &dev_priv->phys_pci_gart,
&dev_priv->bus_pci_gart) ) {
DRM_ERROR( "failed to init PCI GART!\n" );
dev->dev_private = (void *)dev_priv;
@@ -590,7 +589,7 @@ int r128_do_cleanup_cce( drm_device_t *dev )
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
- if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
+ if ( dev->irq_enabled ) drm_irq_uninstall(dev);
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
@@ -608,13 +607,13 @@ int r128_do_cleanup_cce( drm_device_t *dev )
} else
#endif
{
- if (!DRM(ati_pcigart_cleanup)( dev,
+ if (!drm_ati_pcigart_cleanup( dev,
dev_priv->phys_pci_gart,
dev_priv->bus_pci_gart ))
DRM_ERROR( "failed to cleanup PCI GART!\n" );
}
- DRM(free)( dev->dev_private, sizeof(drm_r128_private_t),
+ drm_free( dev->dev_private, sizeof(drm_r128_private_t),
DRM_MEM_DRIVER );
dev->dev_private = NULL;
}
@@ -773,7 +772,7 @@ static int r128_freelist_init( drm_device_t *dev )
drm_r128_freelist_t *entry;
int i;
- dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t),
+ dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t),
DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
return DRM_ERR(ENOMEM);
@@ -785,7 +784,7 @@ static int r128_freelist_init( drm_device_t *dev )
buf = dma->buflist[i];
buf_priv = buf->dev_private;
- entry = DRM(alloc)( sizeof(drm_r128_freelist_t),
+ entry = drm_alloc( sizeof(drm_r128_freelist_t),
DRM_MEM_DRIVER );
if ( !entry ) return DRM_ERR(ENOMEM);
diff --git a/shared/r128_drv.h b/shared/r128_drv.h
index 5b91256c..9cec2f3e 100644
--- a/shared/r128_drv.h
+++ b/shared/r128_drv.h
@@ -28,12 +28,25 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- * Michel Dänzer <daenzerm@student.ethz.ch>
+ * Michel D�zer <daenzerm@student.ethz.ch>
*/
#ifndef __R128_DRV_H__
#define __R128_DRV_H__
+/* General customization:
+ */
+#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
+
+#define DRIVER_NAME "r128"
+#define DRIVER_DESC "ATI Rage 128"
+#define DRIVER_DATE "20030725"
+
+#define DRIVER_MAJOR 2
+#define DRIVER_MINOR 5
+#define DRIVER_PATCHLEVEL 0
+
+
#define GET_RING_HEAD(dev_priv) R128_READ( R128_PM4_BUFFER_DL_RPTR )
typedef struct drm_r128_freelist {
@@ -148,6 +161,8 @@ extern irqreturn_t r128_driver_irq_handler( DRM_IRQ_ARGS );
extern void r128_driver_irq_preinstall( drm_device_t *dev );
extern void r128_driver_irq_postinstall( drm_device_t *dev );
extern void r128_driver_irq_uninstall( drm_device_t *dev );
+extern void r128_driver_pretakedown(drm_device_t *dev);
+extern void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp);
/* Register definitions, register access macros and drmAddMap constants
* for Rage 128 kernel driver.
diff --git a/shared/r128_irq.c b/shared/r128_irq.c
index be1b9dac..643a3078 100644
--- a/shared/r128_irq.c
+++ b/shared/r128_irq.c
@@ -30,7 +30,6 @@
* Eric Anholt <anholt@FreeBSD.org>
*/
-#include "r128.h"
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
@@ -50,7 +49,7 @@ irqreturn_t r128_driver_irq_handler( DRM_IRQ_ARGS )
R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK );
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
- DRM(vbl_send_signals)( dev );
+ drm_vbl_send_signals( dev );
return IRQ_HANDLED;
}
return IRQ_NONE;
diff --git a/shared/r128_state.c b/shared/r128_state.c
index 5b8af9f9..ed643682 100644
--- a/shared/r128_state.c
+++ b/shared/r128_state.c
@@ -27,7 +27,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "r128.h"
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
@@ -926,24 +925,24 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
}
buffer_size = depth->n * sizeof(u32);
- buffer = DRM(alloc)( buffer_size, DRM_MEM_BUFS );
+ buffer = drm_alloc( buffer_size, DRM_MEM_BUFS );
if ( buffer == NULL )
return DRM_ERR(ENOMEM);
if ( DRM_COPY_FROM_USER( buffer, depth->buffer, buffer_size ) ) {
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS);
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS);
return DRM_ERR(EFAULT);
}
mask_size = depth->n * sizeof(u8);
if ( depth->mask ) {
- mask = DRM(alloc)( mask_size, DRM_MEM_BUFS );
+ mask = drm_alloc( mask_size, DRM_MEM_BUFS );
if ( mask == NULL ) {
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
if ( DRM_COPY_FROM_USER( mask, depth->mask, mask_size ) ) {
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
- DRM(free)( mask, mask_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( mask, mask_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
@@ -970,7 +969,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
}
}
- DRM(free)( mask, mask_size, DRM_MEM_BUFS );
+ drm_free( mask, mask_size, DRM_MEM_BUFS );
} else {
for ( i = 0 ; i < count ; i++, x++ ) {
BEGIN_RING( 6 );
@@ -994,7 +993,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
}
}
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
return 0;
}
@@ -1016,54 +1015,54 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
xbuf_size = count * sizeof(*x);
ybuf_size = count * sizeof(*y);
- x = DRM(alloc)( xbuf_size, DRM_MEM_BUFS );
+ x = drm_alloc( xbuf_size, DRM_MEM_BUFS );
if ( x == NULL ) {
return DRM_ERR(ENOMEM);
}
- y = DRM(alloc)( ybuf_size, DRM_MEM_BUFS );
+ y = drm_alloc( ybuf_size, DRM_MEM_BUFS );
if ( y == NULL ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
if ( DRM_COPY_FROM_USER( x, depth->x, xbuf_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
if ( DRM_COPY_FROM_USER( y, depth->y, xbuf_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
buffer_size = depth->n * sizeof(u32);
- buffer = DRM(alloc)( buffer_size, DRM_MEM_BUFS );
+ buffer = drm_alloc( buffer_size, DRM_MEM_BUFS );
if ( buffer == NULL ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
if ( DRM_COPY_FROM_USER( buffer, depth->buffer, buffer_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
if ( depth->mask ) {
mask_size = depth->n * sizeof(u8);
- mask = DRM(alloc)( mask_size, DRM_MEM_BUFS );
+ mask = drm_alloc( mask_size, DRM_MEM_BUFS );
if ( mask == NULL ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
if ( DRM_COPY_FROM_USER( mask, depth->mask, mask_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
- DRM(free)( mask, mask_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( mask, mask_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
@@ -1090,7 +1089,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
}
}
- DRM(free)( mask, mask_size, DRM_MEM_BUFS );
+ drm_free( mask, mask_size, DRM_MEM_BUFS );
} else {
for ( i = 0 ; i < count ; i++ ) {
BEGIN_RING( 6 );
@@ -1114,9 +1113,9 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
}
}
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
- DRM(free)( buffer, buffer_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( buffer, buffer_size, DRM_MEM_BUFS );
return 0;
}
@@ -1184,23 +1183,23 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
xbuf_size = count * sizeof(*x);
ybuf_size = count * sizeof(*y);
- x = DRM(alloc)( xbuf_size, DRM_MEM_BUFS );
+ x = drm_alloc( xbuf_size, DRM_MEM_BUFS );
if ( x == NULL ) {
return DRM_ERR(ENOMEM);
}
- y = DRM(alloc)( ybuf_size, DRM_MEM_BUFS );
+ y = drm_alloc( ybuf_size, DRM_MEM_BUFS );
if ( y == NULL ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
if ( DRM_COPY_FROM_USER( x, depth->x, xbuf_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
if ( DRM_COPY_FROM_USER( y, depth->y, ybuf_size ) ) {
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return DRM_ERR(EFAULT);
}
@@ -1228,8 +1227,8 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
ADVANCE_RING();
}
- DRM(free)( x, xbuf_size, DRM_MEM_BUFS );
- DRM(free)( y, ybuf_size, DRM_MEM_BUFS );
+ drm_free( x, xbuf_size, DRM_MEM_BUFS );
+ drm_free( y, ybuf_size, DRM_MEM_BUFS );
return 0;
}
@@ -1695,7 +1694,7 @@ int r128_getparam( DRM_IOCTL_ARGS )
return 0;
}
-static void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp)
+void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1705,20 +1704,7 @@ static void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp)
}
}
-static void r128_driver_pretakedown(drm_device_t *dev)
+void r128_driver_pretakedown(drm_device_t *dev)
{
r128_do_cleanup_cce( dev );
}
-
-void r128_driver_register_fns(drm_device_t *dev)
-{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
- dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
- dev->fn_tbl.prerelease = r128_driver_prerelease;
- dev->fn_tbl.pretakedown = r128_driver_pretakedown;
- dev->fn_tbl.vblank_wait = r128_driver_vblank_wait;
- dev->fn_tbl.irq_preinstall = r128_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = r128_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = r128_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = r128_driver_irq_handler;
-}
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c
index cbde7ce9..78c41b5d 100644
--- a/shared/radeon_cp.c
+++ b/shared/radeon_cp.c
@@ -28,7 +28,6 @@
* Gareth Hughes <gareth@valinux.com>
*/
-#include "radeon.h"
#include "drmP.h"
#include "drm.h"
#include "radeon_drm.h"
@@ -1216,7 +1215,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle
+ init->ring_size / sizeof(u32));
dev_priv->ring.size = init->ring_size;
- dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 );
+ dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 );
dev_priv->ring.tail_mask =
(dev_priv->ring.size / sizeof(u32)) - 1;
@@ -1230,7 +1229,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
} else
#endif
{
- if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart,
+ if (!drm_ati_pcigart_init( dev, &dev_priv->phys_pci_gart,
&dev_priv->bus_pci_gart)) {
DRM_ERROR( "failed to init PCI GART!\n" );
radeon_do_cleanup_cp(dev);
@@ -1260,7 +1259,7 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
- if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
+ if ( dev->irq_enabled ) drm_irq_uninstall(dev);
#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
@@ -1279,7 +1278,7 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
} else
#endif
{
- if (!DRM(ati_pcigart_cleanup)( dev,
+ if (!drm_ati_pcigart_cleanup( dev,
dev_priv->phys_pci_gart,
dev_priv->bus_pci_gart ))
DRM_ERROR( "failed to cleanup PCI GART!\n" );
@@ -1734,7 +1733,7 @@ int radeon_preinit( struct drm_device *dev, unsigned long flags )
drm_radeon_private_t *dev_priv;
int ret = 0;
- dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
+ dev_priv = drm_alloc( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
return DRM_ERR(ENOMEM);
@@ -1743,12 +1742,12 @@ int radeon_preinit( struct drm_device *dev, unsigned long flags )
dev_priv->flags = flags;
/* registers */
- if( (ret = DRM(initmap)( dev, pci_resource_start( dev->pdev, 2 ),
+ if( (ret = drm_initmap( dev, pci_resource_start( dev->pdev, 2 ),
pci_resource_len( dev->pdev, 2 ), _DRM_REGISTERS, 0 )))
return ret;
/* framebuffer */
- if( (ret = DRM(initmap)( dev, pci_resource_start( dev->pdev, 0 ),
+ if( (ret = drm_initmap( dev, pci_resource_start( dev->pdev, 0 ),
pci_resource_len( dev->pdev, 0 ), _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING )))
return ret;
@@ -1776,11 +1775,6 @@ int radeon_preinit( struct drm_device *dev, unsigned long flags )
return ret;
}
-int radeon_postinit( struct drm_device *dev, unsigned long flags )
-{
- return 0;
-}
-
int radeon_postcleanup( struct drm_device *dev )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -1789,7 +1783,7 @@ int radeon_postcleanup( struct drm_device *dev )
#if defined(__linux__)
radeon_delete_i2c_busses(dev);
#endif
- DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+ drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
return 0;
diff --git a/shared/radeon_drv.h b/shared/radeon_drv.h
index ccb1654f..75c02e7a 100644
--- a/shared/radeon_drv.h
+++ b/shared/radeon_drv.h
@@ -31,6 +31,20 @@
#ifndef __RADEON_DRV_H__
#define __RADEON_DRV_H__
+/* General customization:
+ */
+
+#define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others."
+
+#define DRIVER_NAME "radeon"
+#define DRIVER_DESC "ATI Radeon"
+#define DRIVER_DATE "20020828"
+
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 11
+#define DRIVER_PATCHLEVEL 0
+
+
enum radeon_family {
CHIP_R100,
CHIP_RS100,
@@ -247,6 +261,10 @@ extern irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS );
extern void radeon_driver_irq_preinstall( drm_device_t *dev );
extern void radeon_driver_irq_postinstall( drm_device_t *dev );
extern void radeon_driver_irq_uninstall( drm_device_t *dev );
+extern void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp);
+extern void radeon_driver_pretakedown(drm_device_t *dev);
+extern int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv);
+extern void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv);
/* Flags for stats.boxes
*/
diff --git a/shared/radeon_irq.c b/shared/radeon_irq.c
index bdb3cc16..b7deca73 100644
--- a/shared/radeon_irq.c
+++ b/shared/radeon_irq.c
@@ -27,10 +27,9 @@
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
- * Michel Dänzer <michel@daenzer.net>
+ * Michel D�zer <michel@daenzer.net>
*/
-#include "radeon.h"
#include "drmP.h"
#include "drm.h"
#include "radeon_drm.h"
@@ -78,7 +77,7 @@ irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS )
if (stat & RADEON_CRTC_VBLANK_STAT) {
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
- DRM(vbl_send_signals)( dev );
+ drm_vbl_send_signals( dev );
}
/* Acknowledge interrupts we handle */
@@ -223,7 +222,7 @@ int radeon_irq_wait( DRM_IOCTL_ARGS )
/* drm_dma.h hooks
*/
-void DRM(driver_irq_preinstall)( drm_device_t *dev ) {
+void radeon_driver_irq_preinstall( drm_device_t *dev ) {
drm_radeon_private_t *dev_priv =
(drm_radeon_private_t *)dev->dev_private;
@@ -234,7 +233,7 @@ void DRM(driver_irq_preinstall)( drm_device_t *dev ) {
radeon_acknowledge_irqs( dev_priv );
}
-void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
+void radeon_driver_irq_postinstall( drm_device_t *dev ) {
drm_radeon_private_t *dev_priv =
(drm_radeon_private_t *)dev->dev_private;
@@ -247,7 +246,7 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
RADEON_SW_INT_ENABLE );
}
-void DRM(driver_irq_uninstall)( drm_device_t *dev ) {
+void radeon_driver_irq_uninstall( drm_device_t *dev ) {
drm_radeon_private_t *dev_priv =
(drm_radeon_private_t *)dev->dev_private;
if (!dev_priv)
diff --git a/shared/radeon_mem.c b/shared/radeon_mem.c
index 9d7fded7..17483dd1 100644
--- a/shared/radeon_mem.c
+++ b/shared/radeon_mem.c
@@ -29,7 +29,6 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "radeon.h"
#include "drmP.h"
#include "drm.h"
#include "radeon_drm.h"
@@ -44,7 +43,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
{
/* Maybe cut off the start of an existing block */
if (start > p->start) {
- struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFS );
+ struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFS );
if (!newblock)
goto out;
newblock->start = start;
@@ -60,7 +59,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
/* Maybe cut off the end of an existing block */
if (size < p->size) {
- struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFS );
+ struct mem_block *newblock = drm_alloc(sizeof(*newblock), DRM_MEM_BUFS );
if (!newblock)
goto out;
newblock->start = start + size;
@@ -118,7 +117,7 @@ static void free_block( struct mem_block *p )
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM(free)(q, sizeof(*q), DRM_MEM_BUFS );
+ drm_free(q, sizeof(*q), DRM_MEM_BUFS );
}
if (p->prev->filp == 0) {
@@ -126,7 +125,7 @@ static void free_block( struct mem_block *p )
q->size += p->size;
q->next = p->next;
q->next->prev = q;
- DRM(free)(p, sizeof(*q), DRM_MEM_BUFS );
+ drm_free(p, sizeof(*q), DRM_MEM_BUFS );
}
}
@@ -134,14 +133,14 @@ static void free_block( struct mem_block *p )
*/
static int init_heap(struct mem_block **heap, int start, int size)
{
- struct mem_block *blocks = DRM(alloc)(sizeof(*blocks), DRM_MEM_BUFS );
+ struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS );
if (!blocks)
return DRM_ERR(ENOMEM);
- *heap = DRM(alloc)(sizeof(**heap), DRM_MEM_BUFS );
+ *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS );
if (!*heap) {
- DRM(free)( blocks, sizeof(*blocks), DRM_MEM_BUFS );
+ drm_free( blocks, sizeof(*blocks), DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
@@ -180,7 +179,7 @@ void radeon_mem_release( DRMFILE filp, struct mem_block *heap )
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM(free)(q, sizeof(*q),DRM_MEM_DRIVER);
+ drm_free(q, sizeof(*q),DRM_MEM_DRIVER);
}
}
}
@@ -197,10 +196,10 @@ void radeon_mem_takedown( struct mem_block **heap )
for (p = (*heap)->next ; p != *heap ; ) {
struct mem_block *q = p;
p = p->next;
- DRM(free)(q, sizeof(*q),DRM_MEM_DRIVER);
+ drm_free(q, sizeof(*q),DRM_MEM_DRIVER);
}
- DRM(free)( *heap, sizeof(**heap),DRM_MEM_DRIVER );
+ drm_free( *heap, sizeof(**heap),DRM_MEM_DRIVER );
*heap = NULL;
}
diff --git a/shared/radeon_state.c b/shared/radeon_state.c
index 9675da92..35fb16e9 100644
--- a/shared/radeon_state.c
+++ b/shared/radeon_state.c
@@ -27,7 +27,6 @@
* Kevin E. Martin <martin@valinux.com>
*/
-#include "radeon.h"
#include "drmP.h"
#include "drm.h"
#include "drm_sarea.h"
@@ -1598,7 +1597,7 @@ static int radeon_do_init_pageflip( drm_device_t *dev )
return 0;
}
-/* Called whenever a client dies, from DRM(release).
+/* Called whenever a client dies, from drm_release.
* NOTE: Lock isn't necessarily held when this is called!
*/
int radeon_do_cleanup_pageflip( drm_device_t *dev )
@@ -2560,7 +2559,7 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
*
* DRM infrastructure takes care of reclaiming dma buffers.
*/
-static void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp)
+void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if ( dev->dev_private ) {
drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -2572,17 +2571,17 @@ static void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp)
}
}
-static void radeon_driver_pretakedown(drm_device_t *dev)
+void radeon_driver_pretakedown(drm_device_t *dev)
{
radeon_do_release(dev);
}
-static int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
+int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
struct drm_radeon_driver_file_fields *radeon_priv;
- radeon_priv = (struct drm_radeon_driver_file_fields *)DRM(alloc)(sizeof(*radeon_priv), DRM_MEM_FILES);
+ radeon_priv = (struct drm_radeon_driver_file_fields *)drm_alloc(sizeof(*radeon_priv), DRM_MEM_FILES);
if (!radeon_priv)
return -ENOMEM;
@@ -2596,27 +2595,10 @@ static int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
return 0;
}
-static void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv)
+void radeon_driver_free_filp_priv(drm_device_t *dev, drm_file_t *filp_priv)
{
struct drm_radeon_driver_file_fields *radeon_priv = filp_priv->driver_priv;
- DRM(free)(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES);
+ drm_free(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES);
}
-void radeon_driver_register_fns(struct drm_device *dev)
-{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
- dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
- dev->fn_tbl.preinit = radeon_preinit;
- dev->fn_tbl.postinit = radeon_postinit;
- dev->fn_tbl.postcleanup = radeon_postcleanup;
- dev->fn_tbl.prerelease = radeon_driver_prerelease;
- dev->fn_tbl.pretakedown = radeon_driver_pretakedown;
- dev->fn_tbl.open_helper = radeon_driver_open_helper;
- dev->fn_tbl.vblank_wait = radeon_driver_vblank_wait;
- dev->fn_tbl.irq_preinstall = radeon_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = radeon_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = radeon_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = radeon_driver_irq_handler;
- dev->fn_tbl.free_filp_priv = radeon_driver_free_filp_priv;
-}
diff --git a/shared/sis_drm.h b/shared/sis_drm.h
index 49505719..e99c3a43 100644
--- a/shared/sis_drm.h
+++ b/shared/sis_drm.h
@@ -3,12 +3,21 @@
#define __SIS_DRM_H__
/* SiS specific ioctls */
-#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t)
-#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
-#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t)
-#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t)
-#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t)
-#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( 0x56, drm_sis_fb_t)
+#define NOT_USED_0_3
+#define DRM_SIS_FB_ALLOC 0x04
+#define DRM_SIS_FB_FREE 0x05
+#define NOT_USED_6_12
+#define DRM_SIS_AGP_INIT 0x13
+#define DRM_SIS_AGP_ALLOC 0x14
+#define DRM_SIS_AGP_FREE 0x15
+#define DRM_SIS_FB_INIT 0x16
+
+#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t)
+#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t)
+#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t)
+#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t)
+#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t)
+#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t)
/*
#define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
#define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49)
diff --git a/shared/sis_drv.h b/shared/sis_drv.h
index 1ca618cf..7232b8f3 100644
--- a/shared/sis_drv.h
+++ b/shared/sis_drv.h
@@ -28,6 +28,17 @@
#ifndef _SIS_DRV_H_
#define _SIS_DRV_H_
+/* General customization:
+ */
+
+#define DRIVER_AUTHOR "SIS"
+#define DRIVER_NAME "sis"
+#define DRIVER_DESC "SIS 300/630/540"
+#define DRIVER_DATE "20030826"
+#define DRIVER_MAJOR 1
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
#include "sis_ds.h"
typedef struct drm_sis_private {
diff --git a/shared/sis_ds.c b/shared/sis_ds.c
index 08391554..60bffa69 100644
--- a/shared/sis_ds.c
+++ b/shared/sis_ds.c
@@ -28,7 +28,6 @@
*
*/
-#include "sis.h"
#include "drmP.h"
#include "drm.h"
#include "sis_ds.h"
@@ -42,7 +41,7 @@ set_t *setInit(void)
int i;
set_t *set;
- set = (set_t *)DRM(alloc)(sizeof(set_t), DRM_MEM_DRIVER);
+ set = (set_t *)drm_alloc(sizeof(set_t), DRM_MEM_DRIVER);
if (set != NULL) {
for (i = 0; i < SET_SIZE; i++) {
set->list[i].free_next = i + 1;
@@ -128,7 +127,7 @@ int setNext(set_t *set, ITEM_TYPE *item)
int setDestroy(set_t *set)
{
- DRM(free)(set, sizeof(set_t), DRM_MEM_DRIVER);
+ drm_free(set, sizeof(set_t), DRM_MEM_DRIVER);
return 1;
}
@@ -167,7 +166,7 @@ memHeap_t *mmInit(int ofs,
if (size <= 0)
return NULL;
- blocks = (TMemBlock *)DRM(calloc)(1, sizeof(TMemBlock), DRM_MEM_DRIVER);
+ blocks = (TMemBlock *)drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER);
if (blocks != NULL) {
blocks->ofs = ofs;
blocks->size = size;
@@ -202,7 +201,7 @@ memHeap_t *mmAddRange( memHeap_t *heap,
int size )
{
PMemBlock blocks;
- blocks = (TMemBlock *)DRM(calloc)(2, sizeof(TMemBlock), DRM_MEM_DRIVER);
+ blocks = (TMemBlock *)drm_calloc(2, sizeof(TMemBlock), DRM_MEM_DRIVER);
if (blocks != NULL) {
blocks[0].size = size;
blocks[0].free = 1;
@@ -229,7 +228,7 @@ static TMemBlock* SliceBlock(TMemBlock *p,
/* break left */
if (startofs > p->ofs) {
- newblock = (TMemBlock*) DRM(calloc)(1, sizeof(TMemBlock),
+ newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock),
DRM_MEM_DRIVER);
newblock->ofs = startofs;
newblock->size = p->size - (startofs - p->ofs);
@@ -242,7 +241,7 @@ static TMemBlock* SliceBlock(TMemBlock *p,
/* break right */
if (size < p->size) {
- newblock = (TMemBlock*) DRM(calloc)(1, sizeof(TMemBlock),
+ newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock),
DRM_MEM_DRIVER);
newblock->ofs = startofs + size;
newblock->size = p->size - size;
@@ -295,7 +294,7 @@ static __inline__ int Join2Blocks(TMemBlock *p)
TMemBlock *q = p->next;
p->size += q->size;
p->next = q->next;
- DRM(free)(q, sizeof(TMemBlock), DRM_MEM_DRIVER);
+ drm_free(q, sizeof(TMemBlock), DRM_MEM_DRIVER);
return 1;
}
return 0;
@@ -380,7 +379,7 @@ void mmDestroy(memHeap_t *heap)
p = (TMemBlock *)heap;
while (p != NULL) {
q = p->next;
- DRM(free)(p, sizeof(TMemBlock), DRM_MEM_DRIVER);
+ drm_free(p, sizeof(TMemBlock), DRM_MEM_DRIVER);
p = q;
}
}
diff --git a/shared/sis_mm.c b/shared/sis_mm.c
index 27b904fc..a895e0b8 100644
--- a/shared/sis_mm.c
+++ b/shared/sis_mm.c
@@ -28,7 +28,6 @@
*
*/
-#include "sis.h"
#include "drmP.h"
#include "sis_drm.h"
#include "sis_drv.h"
@@ -163,7 +162,7 @@ int sis_fb_init( DRM_IOCTL_ARGS )
DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t __user *)data, sizeof(fb));
if (dev_priv == NULL) {
- dev->dev_private = DRM(calloc)(1, sizeof(drm_sis_private_t),
+ dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t),
DRM_MEM_DRIVER);
dev_priv = dev->dev_private;
if (dev_priv == NULL)
@@ -251,7 +250,7 @@ int sis_ioctl_agp_init( DRM_IOCTL_ARGS )
drm_sis_agp_t agp;
if (dev_priv == NULL) {
- dev->dev_private = DRM(calloc)(1, sizeof(drm_sis_private_t),
+ dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t),
DRM_MEM_DRIVER);
dev_priv = dev->dev_private;
if (dev_priv == NULL)
@@ -408,10 +407,3 @@ int sis_final_context(struct drm_device *dev, int context)
return 1;
}
-
-void DRM(driver_register_fns)(drm_device_t *dev)
-{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
- dev->fn_tbl.context_ctor = sis_init_context;
- dev->fn_tbl.context_dtor = sis_final_context;
-}
diff --git a/shared/via_dma.c b/shared/via_dma.c
index 4afc5215..493c0b00 100644
--- a/shared/via_dma.c
+++ b/shared/via_dma.c
@@ -10,7 +10,6 @@
*
**************************************************************************/
-#include "via.h"
#include "drmP.h"
#include "drm.h"
#include "via_drm.h"
diff --git a/shared/via_drm.h b/shared/via_drm.h
index ddc89f83..ba94a4fe 100644
--- a/shared/via_drm.h
+++ b/shared/via_drm.h
@@ -62,16 +62,28 @@
#define VIA_UPLOAD_ALL 0xff
/* VIA specific ioctls */
-#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t)
-#define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t)
-#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t)
-#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t)
-#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t)
-#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW(0x45, drm_via_futex_t)
-#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(0x47, drm_via_dma_init_t)
-#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW(0x48, drm_via_cmdbuffer_t)
-#define DRM_IOCTL_VIA_FLUSH DRM_IO(0x49)
-#define DRM_IOCTL_VIA_PCICMD DRM_IOW(0x4A, drm_via_cmdbuffer_t)
+#define DRM_VIA_ALLOCMEM 0x00
+#define DRM_VIA_FREEMEM 0x01
+#define DRM_VIA_AGP_INIT 0x02
+#define DRM_VIA_FB_INIT 0x03
+#define DRM_VIA_MAP_INIT 0x04
+#define DRM_VIA_DEC_FUTEX 0x05
+#define NOT_USED
+#define DRM_VIA_DMA_INIT 0x07
+#define DRM_VIA_CMDBUFFER 0x08
+#define DRM_VIA_FLUSH 0x09
+#define DRM_VIA_PCICMD 0x0a
+
+#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
+#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
+#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
+#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
+#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
+#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
+#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
+#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
+#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
+#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
/* Indices into buf.Setup where various bits of state are mirrored per
diff --git a/shared/via_drv.c b/shared/via_drv.c
index 7b6e1b96..cec14e7a 100644
--- a/shared/via_drv.c
+++ b/shared/via_drv.c
@@ -23,7 +23,6 @@
*/
#include <linux/config.h>
-#include "via.h"
#include "drmP.h"
#include "via_drm.h"
#include "via_drv.h"
@@ -38,18 +37,95 @@
#define DRIVER_MINOR 5
#define DRIVER_PATCHLEVEL 0
+#include "drm_pciids.h"
-#define DRIVER_IOCTLS \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_ALLOCMEM)] = { via_mem_alloc, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_FREEMEM)] = { via_mem_free, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_AGP_INIT)] = { via_agp_init, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_FB_INIT)] = { via_fb_init, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_MAP_INIT)] = { via_map_init, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_DEC_FUTEX)] = { via_decoder_futex, 1, 0}, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_DMA_INIT)] = { via_dma_init, 1, 0}, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_CMDBUFFER)] = { via_cmdbuffer, 1, 0}, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_FLUSH)] = { via_flush_ioctl, 1, 0}, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_PCICMD)] = { via_pci_cmdbuffer, 1, 0}
+static int postinit( struct drm_device *dev, unsigned long flags )
+{
+ DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n",
+ DRIVER_NAME,
+ DRIVER_MAJOR,
+ DRIVER_MINOR,
+ DRIVER_PATCHLEVEL,
+ DRIVER_DATE,
+ dev->minor,
+ pci_pretty_name(dev->pdev)
+ );
+ return 0;
+}
+static int version( drm_version_t *version )
+{
+ int len;
-#include "drm_core.h"
+ version->version_major = DRIVER_MAJOR;
+ version->version_minor = DRIVER_MINOR;
+ version->version_patchlevel = DRIVER_PATCHLEVEL;
+ DRM_COPY( version->name, DRIVER_NAME );
+ DRM_COPY( version->date, DRIVER_DATE );
+ DRM_COPY( version->desc, DRIVER_DESC );
+ return 0;
+}
+
+static struct pci_device_id pciidlist[] = {
+ viadrv_PCI_IDS
+};
+
+static drm_ioctl_desc_t ioctls[] = {
+ [DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = { via_mem_alloc, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = { via_mem_free, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = { via_agp_init, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = { via_fb_init, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = { via_map_init, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = { via_decoder_futex, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = { via_dma_init, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = { via_cmdbuffer, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_FLUSH)] = { via_flush_ioctl, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_PCICMD)] = { via_pci_cmdbuffer, 1, 0}
+};
+
+static struct drm_driver_fn driver_fn = {
+ .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
+ .context_ctor = via_init_context,
+ .context_dtor = via_final_context,
+ .vblank_wait = via_driver_vblank_wait,
+ .irq_preinstall = via_driver_irq_preinstall,
+ .irq_postinstall = via_driver_irq_postinstall,
+ .irq_uninstall = via_driver_irq_uninstall,
+ .irq_handler = via_driver_irq_handler,
+ .reclaim_buffers = drm_core_reclaim_buffers,
+ .get_map_ofs = drm_core_get_map_ofs,
+ .get_reg_ofs = drm_core_get_reg_ofs,
+ .postinit = postinit,
+ .version = version,
+ .ioctls = ioctls,
+ .num_ioctls = DRM_ARRAY_SIZE(ioctls),
+};
+
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ return drm_probe(pdev, ent, &driver_fn);
+}
+
+static struct pci_driver driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+};
+
+static int __init via_init(void)
+{
+ return drm_init(&driver, pciidlist, &driver_fn);
+}
+
+static void __exit via_exit(void)
+{
+ drm_exit(&driver);
+}
+
+module_init(via_init);
+module_exit(via_exit);
+
+MODULE_AUTHOR( DRIVER_AUTHOR );
+MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_LICENSE("GPL and additional rights");
diff --git a/shared/via_ds.c b/shared/via_ds.c
index a29204ce..71af0c9b 100644
--- a/shared/via_ds.c
+++ b/shared/via_ds.c
@@ -38,7 +38,7 @@ set_t *via_setInit(void)
{
int i;
set_t *set;
- set = (set_t *)DRM(alloc)(sizeof(set_t), DRM_MEM_DRIVER);
+ set = (set_t *)drm_alloc(sizeof(set_t), DRM_MEM_DRIVER);
for (i = 0; i < SET_SIZE; i++) {
set->list[i].free_next = i+1;
set->list[i].alloc_next = -1;
@@ -120,7 +120,7 @@ int via_setNext(set_t *set, ITEM_TYPE *item)
int via_setDestroy(set_t *set)
{
- DRM(free)(set, sizeof(set_t), DRM_MEM_DRIVER);
+ drm_free(set, sizeof(set_t), DRM_MEM_DRIVER);
return 1;
}
@@ -161,7 +161,7 @@ memHeap_t *via_mmInit(int ofs,
return 0;
- blocks = (TMemBlock *)DRM(calloc)(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ blocks = (TMemBlock *)drm_calloc(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
if (blocks) {
blocks->ofs = ofs;
@@ -177,7 +177,7 @@ memHeap_t *via_mmAddRange(memHeap_t *heap,
int size)
{
PMemBlock blocks;
- blocks = (TMemBlock *)DRM(calloc)(2,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ blocks = (TMemBlock *)drm_calloc(2,sizeof(TMemBlock),DRM_MEM_DRIVER);
if (blocks) {
blocks[0].size = size;
@@ -206,7 +206,7 @@ static TMemBlock* SliceBlock(TMemBlock *p,
/* break left */
if (startofs > p->ofs) {
- newblock = (TMemBlock*)DRM(calloc)(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ newblock = (TMemBlock*)drm_calloc(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
newblock->ofs = startofs;
newblock->size = p->size - (startofs - p->ofs);
newblock->free = 1;
@@ -218,7 +218,7 @@ static TMemBlock* SliceBlock(TMemBlock *p,
/* break right */
if (size < p->size) {
- newblock = (TMemBlock*)DRM(calloc)(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ newblock = (TMemBlock*)drm_calloc(1,sizeof(TMemBlock),DRM_MEM_DRIVER);
newblock->ofs = startofs + size;
newblock->size = p->size - size;
newblock->free = 1;
@@ -277,7 +277,7 @@ static __inline__ int Join2Blocks(TMemBlock *p)
TMemBlock *q = p->next;
p->size += q->size;
p->next = q->next;
- DRM(free)(q,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ drm_free(q,sizeof(TMemBlock),DRM_MEM_DRIVER);
return 1;
}
@@ -384,7 +384,7 @@ void via_mmDestroy(memHeap_t *heap)
while (p) {
q = p->next;
- DRM(free)(p,sizeof(TMemBlock),DRM_MEM_DRIVER);
+ drm_free(p,sizeof(TMemBlock),DRM_MEM_DRIVER);
p = q;
}
}
diff --git a/shared/via_ds.h b/shared/via_ds.h
index 50ab3e7f..d9a60186 100644
--- a/shared/via_ds.h
+++ b/shared/via_ds.h
@@ -26,7 +26,6 @@
#ifndef _via_ds_h_
#define _via_ds_h_
-#include "via.h"
#include "drmP.h"
/* Set Data Structure */
diff --git a/shared/via_irq.c b/shared/via_irq.c
index eafb1d7d..b0a3349e 100644
--- a/shared/via_irq.c
+++ b/shared/via_irq.c
@@ -33,7 +33,6 @@
* interrupt.
*/
-#include "via.h"
#include "drmP.h"
#include "drm.h"
#include "via_drm.h"
@@ -58,7 +57,7 @@ irqreturn_t via_driver_irq_handler( DRM_IRQ_ARGS )
if(status & VIA_IRQ_VBI_PENDING){
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
- DRM(vbl_send_signals)(dev);
+ drm_vbl_send_signals(dev);
handled = 1;
}
diff --git a/shared/via_map.c b/shared/via_map.c
index f08503d4..b7f0b43b 100644
--- a/shared/via_map.c
+++ b/shared/via_map.c
@@ -21,7 +21,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
-#include "via.h"
#include "drmP.h"
#include "via_drv.h"
@@ -32,7 +31,7 @@ int via_do_init_map(drm_device_t *dev, drm_via_init_t *init)
DRM_DEBUG("%s\n", __FUNCTION__);
- dev_priv = DRM(alloc)(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
+ dev_priv = drm_alloc(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL)
return -ENOMEM;
@@ -84,7 +83,7 @@ int via_do_cleanup_map(drm_device_t *dev)
via_dma_cleanup(dev);
- DRM(free)(dev_priv, sizeof(drm_via_private_t),
+ drm_free(dev_priv, sizeof(drm_via_private_t),
DRM_MEM_DRIVER);
dev->dev_private = NULL;
}
diff --git a/shared/via_mm.c b/shared/via_mm.c
index 2a9be681..706f00d1 100644
--- a/shared/via_mm.c
+++ b/shared/via_mm.c
@@ -21,7 +21,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
-#include "via.h"
#include "drmP.h"
#include "via_drm.h"
#include "via_drv.h"
@@ -175,7 +174,7 @@ int via_final_context(struct drm_device *dev, int context)
/* Linux specific until context tracking code gets ported to BSD */
/* Last context, perform cleanup */
if (dev->ctx_count == 1 && dev->dev_private) {
- if (dev->irq) DRM(irq_uninstall)(dev);
+ if (dev->irq) drm_irq_uninstall(dev);
via_do_cleanup_map(dev);
}
@@ -211,13 +210,13 @@ int via_fb_alloc(drm_via_mem_t* mem)
drm_via_mm_t fb;
PMemBlock block;
int retval = 0;
-
+
if (!FBHeap)
return -1;
fb.size = mem->size;
fb.context = mem->context;
-
+
block = via_mmAllocMem(FBHeap, fb.size, 5, 0);
if (block) {
fb.offset = block->ofs;
@@ -234,13 +233,13 @@ int via_fb_alloc(drm_via_mem_t* mem)
fb.free = 0;
retval = -1;
}
-
+
mem->offset = fb.offset;
mem->index = fb.free;
DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size,
(int)fb.offset);
-
+
return retval;
}
int via_agp_alloc(drm_via_mem_t* mem)
@@ -270,7 +269,7 @@ int via_agp_alloc(drm_via_mem_t* mem)
agp.size = 0;
agp.free = 0;
}
-
+
mem->offset = agp.offset;
mem->index = agp.free;
@@ -282,7 +281,7 @@ int via_agp_alloc(drm_via_mem_t* mem)
int via_mem_free( DRM_IOCTL_ARGS )
{
drm_via_mem_t mem;
-
+
DRM_COPY_FROM_USER_IOCTL(mem, (drm_via_mem_t *)data, sizeof(mem));
switch (mem.type) {
@@ -296,22 +295,23 @@ int via_mem_free( DRM_IOCTL_ARGS )
return 0;
break;
}
-
+
return -EFAULT;
}
+
int via_fb_free(drm_via_mem_t* mem)
{
drm_via_mm_t fb;
int retval = 0;
-
+
if (!FBHeap) {
return -1;
}
fb.free = mem->index;
fb.context = mem->context;
-
+
if (!fb.free)
{
return -1;
@@ -319,50 +319,37 @@ int via_fb_free(drm_via_mem_t* mem)
}
via_mmFreeMem((PMemBlock)fb.free);
-
+
if (!del_alloc_set(fb.context, VIDEO, fb.free))
{
retval = -1;
}
-
+
DRM_DEBUG("free fb, free = %d\n", fb.free);
-
+
return retval;
-}
+}
+
int via_agp_free(drm_via_mem_t* mem)
{
drm_via_mm_t agp;
-
+
int retval = 0;
agp.free = mem->index;
agp.context = mem->context;
-
+
if (!agp.free)
return -1;
via_mmFreeMem((PMemBlock)agp.free);
-
+
if (!del_alloc_set(agp.context, AGP, agp.free)) {
retval = -1;
}
DRM_DEBUG("free agp, free = %d\n", agp.free);
-
+
return retval;
}
-EXPORT_SYMBOL(via_fb_alloc);
-EXPORT_SYMBOL(via_fb_free);
-
-void DRM(driver_register_fns)(drm_device_t *dev)
-{
- dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
- dev->fn_tbl.context_ctor = via_init_context;
- dev->fn_tbl.context_dtor = via_final_context;
- dev->fn_tbl.vblank_wait = via_driver_vblank_wait;
- dev->fn_tbl.irq_preinstall = via_driver_irq_preinstall;
- dev->fn_tbl.irq_postinstall = via_driver_irq_postinstall;
- dev->fn_tbl.irq_uninstall = via_driver_irq_uninstall;
- dev->fn_tbl.irq_handler = via_driver_irq_handler;
-}