summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsd-core/drm_context.c1
-rw-r--r--bsd-core/drm_drv.c6
-rw-r--r--bsd-core/drm_memory.c4
-rw-r--r--bsd-core/drm_os_freebsd.h12
-rw-r--r--bsd-core/i915_drv.c6
-rw-r--r--bsd/drm_context.h1
-rw-r--r--bsd/drm_drv.h6
-rw-r--r--bsd/drm_memory.h4
-rw-r--r--bsd/drm_os_freebsd.h12
-rw-r--r--bsd/i915_drv.c6
-rw-r--r--libdrm/xf86drm.c4
-rw-r--r--linux-core/Makefile4
-rw-r--r--linux-core/drmP.h6
-rw-r--r--linux-core/drm_compat.h8
-rw-r--r--linux-core/drm_drv.c35
-rw-r--r--linux-core/drm_stub.c13
-rw-r--r--linux/Makefile4
-rw-r--r--linux/drmP.h6
-rw-r--r--linux/drm_compat.h8
-rw-r--r--linux/drm_drv.h35
-rw-r--r--linux/drm_stub.h13
-rw-r--r--linux/gamma_dma.c2
-rw-r--r--scripts/create_bsd_pci_lists.sh4
-rw-r--r--scripts/create_linux_pci_lists.sh4
-rw-r--r--shared-core/drm_pciids.txt338
-rw-r--r--shared-core/radeon_cp.c165
-rw-r--r--shared-core/radeon_drm.h2
-rw-r--r--shared-core/radeon_drv.h31
-rw-r--r--shared-core/radeon_state.c3
-rw-r--r--shared-core/sis_drv.h3
-rw-r--r--shared-core/via_drv.h4
-rw-r--r--shared/drm_pciids.txt338
-rw-r--r--shared/radeon_cp.c165
-rw-r--r--shared/radeon_drm.h2
-rw-r--r--shared/radeon_drv.h31
-rw-r--r--shared/radeon_state.c3
-rw-r--r--shared/sis_drv.h3
-rw-r--r--shared/via_drv.h4
38 files changed, 739 insertions, 557 deletions
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
index 8988ee22e..aa6552977 100644
--- a/bsd-core/drm_context.c
+++ b/bsd-core/drm_context.c
@@ -341,6 +341,7 @@ int DRM(rmctx)( DRM_IOCTL_ARGS )
if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
if (dev->fn_tbl.context_dtor)
dev->fn_tbl.context_dtor(dev, ctx.handle);
+
DRM(ctxbitmap_free)( dev, ctx.handle );
}
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 4474f250b..865bcde63 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -256,8 +256,12 @@ static device_method_t DRM(methods)[] = {
{ 0, 0 }
};
+#ifndef DRM_DEV_NAME
+#define DRM_DEV_NAME "drm"
+#endif
+
static driver_t DRM(driver) = {
- "drm",
+ DRM_DEV_NAME,
DRM(methods),
sizeof(drm_device_t),
};
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
index c871274ee..26adb0856 100644
--- a/bsd-core/drm_memory.c
+++ b/bsd-core/drm_memory.c
@@ -138,7 +138,7 @@ DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
mrdesc.mr_len = size;
mrdesc.mr_flags = flags;
act = MEMRANGE_SET_UPDATE;
- bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME));
+ strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
@@ -152,7 +152,7 @@ DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
mrdesc.mr_len = size;
mrdesc.mr_flags = flags;
act = MEMRANGE_SET_REMOVE;
- bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME));
+ strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
#elif defined(__NetBSD__)
diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h
index 7d750dba0..dd95d9cb1 100644
--- a/bsd-core/drm_os_freebsd.h
+++ b/bsd-core/drm_os_freebsd.h
@@ -84,6 +84,8 @@
#ifdef __i386__
#define __REALLY_HAVE_MTRR (__HAVE_MTRR) && (__FreeBSD_version >= 460000)
+#elif defined(__amd64__)
+#define __REALLY_HAVE_MTRR (__HAVE_MTRR)
#else
#define __REALLY_HAVE_MTRR 0
#endif
@@ -204,15 +206,7 @@ do { \
} \
} while (0)
-#define DRM_UDELAY( udelay ) \
-do { \
- struct timeval tv1, tv2; \
- microtime(&tv1); \
- do { \
- microtime(&tv2); \
- } \
- while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \
-} while (0)
+#define DRM_UDELAY(udelay) DELAY(udelay)
#define DRM_GETSAREA() \
do { \
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index 5fbbfb2bd..15ef406c2 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -28,14 +28,13 @@
*
*/
+#define DRM_DEV_NAME "drmsub"
+
#include "i915.h"
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
#include "i915_drv.h"
-#if __REALLY_HAVE_SG
-#include "ati_pcigart.h"
-#endif
#include "drm_agpsupport.h"
#include "drm_auth.h"
@@ -52,7 +51,6 @@
#include "drm_pci.h"
#include "drm_vm.h"
#include "drm_sysctl.h"
-#include "drm_scatter.h"
#ifdef __FreeBSD__
DRIVER_MODULE(DRIVER_NAME, agp, DRM(driver), DRM(devclass), 0, 0);
diff --git a/bsd/drm_context.h b/bsd/drm_context.h
index 8988ee22e..aa6552977 100644
--- a/bsd/drm_context.h
+++ b/bsd/drm_context.h
@@ -341,6 +341,7 @@ int DRM(rmctx)( DRM_IOCTL_ARGS )
if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
if (dev->fn_tbl.context_dtor)
dev->fn_tbl.context_dtor(dev, ctx.handle);
+
DRM(ctxbitmap_free)( dev, ctx.handle );
}
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 4474f250b..865bcde63 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -256,8 +256,12 @@ static device_method_t DRM(methods)[] = {
{ 0, 0 }
};
+#ifndef DRM_DEV_NAME
+#define DRM_DEV_NAME "drm"
+#endif
+
static driver_t DRM(driver) = {
- "drm",
+ DRM_DEV_NAME,
DRM(methods),
sizeof(drm_device_t),
};
diff --git a/bsd/drm_memory.h b/bsd/drm_memory.h
index c871274ee..26adb0856 100644
--- a/bsd/drm_memory.h
+++ b/bsd/drm_memory.h
@@ -138,7 +138,7 @@ DRM(mtrr_add)(unsigned long offset, size_t size, int flags)
mrdesc.mr_len = size;
mrdesc.mr_flags = flags;
act = MEMRANGE_SET_UPDATE;
- bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME));
+ strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
@@ -152,7 +152,7 @@ DRM(mtrr_del)(unsigned long offset, size_t size, int flags)
mrdesc.mr_len = size;
mrdesc.mr_flags = flags;
act = MEMRANGE_SET_REMOVE;
- bcopy(DRIVER_NAME, &mrdesc.mr_owner, strlen(DRIVER_NAME));
+ strlcpy(mrdesc.mr_owner, DRIVER_NAME, sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
#elif defined(__NetBSD__)
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 7d750dba0..dd95d9cb1 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -84,6 +84,8 @@
#ifdef __i386__
#define __REALLY_HAVE_MTRR (__HAVE_MTRR) && (__FreeBSD_version >= 460000)
+#elif defined(__amd64__)
+#define __REALLY_HAVE_MTRR (__HAVE_MTRR)
#else
#define __REALLY_HAVE_MTRR 0
#endif
@@ -204,15 +206,7 @@ do { \
} \
} while (0)
-#define DRM_UDELAY( udelay ) \
-do { \
- struct timeval tv1, tv2; \
- microtime(&tv1); \
- do { \
- microtime(&tv2); \
- } \
- while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \
-} while (0)
+#define DRM_UDELAY(udelay) DELAY(udelay)
#define DRM_GETSAREA() \
do { \
diff --git a/bsd/i915_drv.c b/bsd/i915_drv.c
index 5fbbfb2bd..15ef406c2 100644
--- a/bsd/i915_drv.c
+++ b/bsd/i915_drv.c
@@ -28,14 +28,13 @@
*
*/
+#define DRM_DEV_NAME "drmsub"
+
#include "i915.h"
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
#include "i915_drv.h"
-#if __REALLY_HAVE_SG
-#include "ati_pcigart.h"
-#endif
#include "drm_agpsupport.h"
#include "drm_auth.h"
@@ -52,7 +51,6 @@
#include "drm_pci.h"
#include "drm_vm.h"
#include "drm_sysctl.h"
-#include "drm_scatter.h"
#ifdef __FreeBSD__
DRIVER_MODULE(DRIVER_NAME, agp, DRM(driver), DRM(devclass), 0, 0);
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 2b0b1b9cc..251bbcea7 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -106,10 +106,6 @@ extern unsigned long _bus_base(void);
#define DRM_MAX_MINOR 16
#endif
-#ifdef __linux__
-#include <sys/sysmacros.h> /* for makedev() */
-#endif
-
#ifndef makedev
/* This definition needs to be changed on
some systems if dev_t is a structure.
diff --git a/linux-core/Makefile b/linux-core/Makefile
index 066766a77..1bb131d8c 100644
--- a/linux-core/Makefile
+++ b/linux-core/Makefile
@@ -38,7 +38,9 @@ SHELL=/bin/sh
ifndef LINUXDIR
RUNNING_REL := $(shell uname -r)
-LINUXDIR := /lib/modules/$(RUNNING_REL)/build
+LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
+ echo /lib/modules/$(RUNNING_REL)/source; \
+ else echo /lib/modules/$(RUNNING_REL)/build; fi)
endif
ifndef O
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 2f5bc8fdc..75fb999a5 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -521,8 +521,8 @@ typedef struct drm_vbl_sig {
struct drm_device;
struct drm_driver_fn {
- int (*preinit)(struct drm_device *);
- int (*postinit)(struct drm_device *);
+ int (*preinit)(struct drm_device *, unsigned long flags);
+ int (*postinit)(struct drm_device *, unsigned long flags);
void (*prerelease)(struct drm_device *, struct file *filp);
void (*pretakedown)(struct drm_device *);
int (*postcleanup)(struct drm_device *);
@@ -544,6 +544,7 @@ struct drm_driver_fn {
int (*freelist_put)(struct drm_device *dev, drm_freelist_t *bl, drm_buf_t *buf);
int (*freelist_destroy)(drm_freelist_t *bl);
};
+
/**
* DRM device structure.
*/
@@ -706,6 +707,7 @@ extern int DRM(lock)(struct inode *inode, struct file *filp,
extern int DRM(unlock)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(fb_loaded);
+extern struct file_operations DRM(fops);
/* Device support (drm_fops.h) */
extern int DRM(open_helper)(struct inode *inode, struct file *filp,
diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h
index 3bb0b7090..f6c113a9b 100644
--- a/linux-core/drm_compat.h
+++ b/linux-core/drm_compat.h
@@ -120,12 +120,16 @@ struct device;
#define class_simple_device_add(...) do {} while (0)
-static inline void class_simple_device_remove(dev_t dev){};
+static inline void class_simple_device_remove(dev_t dev){}
-static inline void class_simple_destroy(struct class_simple *cs){};
+static inline void class_simple_destroy(struct class_simple *cs){}
static inline struct class_simple *class_simple_create(struct module *owner, char *name) { return (struct class_simple *)owner; }
+static inline void drm_hotplug(void) {}
+
+static inline void class_simple_set_hotplug(struct class_simple *cs, void (*fn)(void)) {}
+
#ifndef pci_pretty_name
#define pci_pretty_name(x) x->name
#endif
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 1d5bb86ed..744fd14cb 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -522,13 +522,6 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
sema_init( &dev->struct_sem, 1 );
sema_init( &dev->ctxlist_sem, 1 );
- if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
- {
- retcode = -EPERM;
- goto error_out;
- }
-
- dev->device = MKDEV(DRM_MAJOR, dev->minor );
dev->name = DRIVER_NAME;
dev->pdev = pdev;
@@ -549,7 +542,7 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
DRM(driver_register_fns)(dev);
if (dev->fn_tbl.preinit)
- if ((retcode = dev->fn_tbl.preinit(dev)))
+ if ((retcode = dev->fn_tbl.preinit(dev, ent->driver_data)))
goto error_out_unreg;
#if __REALLY_HAVE_AGP
@@ -577,6 +570,14 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto error_out_unreg;
}
#endif
+ if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
+ {
+ retcode = -EPERM;
+ goto error_out;
+ }
+
+ dev->device = MKDEV(DRM_MAJOR, dev->minor );
+
DRM(numdevs)++; /* no errors, mark it reserved */
DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n",
@@ -589,17 +590,11 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_pretty_name(pdev)
);
+ /* drivers add secondary heads here if needed */
if (dev->fn_tbl.postinit)
- if ((retcode = dev->fn_tbl.postinit(dev)))
+ if ((retcode = dev->fn_tbl.postinit(dev, ent->driver_data)))
goto error_out_unreg;
-
- /*
- * don't move this earlier, for upcoming hotplugging support
- */
- class_simple_device_add(DRM(stub_info).drm_class,
- MKDEV(DRM_MAJOR, dev->minor), &pdev->dev, "card%d", dev->minor);
-
return 0;
error_out_unreg:
@@ -699,11 +694,9 @@ static void __exit drm_cleanup( drm_device_t *dev )
} else {
DRM_DEBUG( "minor %d unregistered\n", dev->minor);
}
-
#if __HAVE_CTX_BITMAP
DRM(ctxbitmap_cleanup)( dev );
#endif
-
#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
if ( dev->agp && dev->agp->agp_mtrr >= 0) {
int retval;
@@ -713,8 +706,6 @@ static void __exit drm_cleanup( drm_device_t *dev )
DRM_DEBUG( "mtrr_del=%d\n", retval );
}
#endif
-
-
#if __REALLY_HAVE_AGP
if ( dev->agp ) {
DRM(agp_uninit)();
@@ -722,8 +713,8 @@ static void __exit drm_cleanup( drm_device_t *dev )
dev->agp = NULL;
}
#endif
-
- class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor));
+ if (dev->fn_tbl.postcleanup)
+ dev->fn_tbl.postcleanup(dev);
}
static void __exit drm_exit (void)
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index d61f73ee7..b94e6a708 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -76,10 +76,10 @@ static struct file_operations DRM(stub_fops) = {
.open = DRM(stub_open)
};
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
- drm_device_t *ddev;
struct pci_dev *pdev;
char *scratch;
int i = 0;
@@ -128,7 +128,8 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
return -ENOMEM;
++length;
scratch += length;
-
+#if 0
+ drm_device_t *ddev;
ddev = pci_get_drvdata(pdev);
if (ddev) {
envp[i++] = scratch;
@@ -137,11 +138,12 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
if ((buffer_size - length <= 0) || (i >= num_envp))
return -ENOMEM;
}
+#endif
envp[i] = 0;
- DRM_DEBUG(" - ok\n");
return 0;
}
+#endif
/**
* Get a device minor number.
@@ -177,6 +179,7 @@ static int DRM(stub_getminor)(const char *name, struct file_operations *fops,
&DRM(stub_list)[i].dev_root);
(*DRM(stub_info).info_count)++;
DRM_DEBUG("info count increased %d\n", *DRM(stub_info).info_count);
+
return i;
}
}
@@ -301,7 +304,10 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
DRM_DEBUG("info_register failed, deregistered everything\n");
}
DRM_DEBUG("info_register failed\n");
+ return ret2;
}
+ class_simple_device_add(DRM(stub_info).drm_class,
+ MKDEV(DRM_MAJOR, ret2), &dev->pdev->dev, "card%d", ret2);
return ret2;
}
return -1;
@@ -317,6 +323,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
int DRM(stub_unregister)(int minor)
{
DRM_DEBUG("%d\n", minor);
+ class_simple_device_remove(MKDEV(DRM_MAJOR, minor));
if (DRM(stub_info).info_unregister)
return DRM(stub_info).info_unregister(minor);
return -1;
diff --git a/linux/Makefile b/linux/Makefile
index 066766a77..1bb131d8c 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -38,7 +38,9 @@ SHELL=/bin/sh
ifndef LINUXDIR
RUNNING_REL := $(shell uname -r)
-LINUXDIR := /lib/modules/$(RUNNING_REL)/build
+LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
+ echo /lib/modules/$(RUNNING_REL)/source; \
+ else echo /lib/modules/$(RUNNING_REL)/build; fi)
endif
ifndef O
diff --git a/linux/drmP.h b/linux/drmP.h
index 2f5bc8fdc..75fb999a5 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -521,8 +521,8 @@ typedef struct drm_vbl_sig {
struct drm_device;
struct drm_driver_fn {
- int (*preinit)(struct drm_device *);
- int (*postinit)(struct drm_device *);
+ int (*preinit)(struct drm_device *, unsigned long flags);
+ int (*postinit)(struct drm_device *, unsigned long flags);
void (*prerelease)(struct drm_device *, struct file *filp);
void (*pretakedown)(struct drm_device *);
int (*postcleanup)(struct drm_device *);
@@ -544,6 +544,7 @@ struct drm_driver_fn {
int (*freelist_put)(struct drm_device *dev, drm_freelist_t *bl, drm_buf_t *buf);
int (*freelist_destroy)(drm_freelist_t *bl);
};
+
/**
* DRM device structure.
*/
@@ -706,6 +707,7 @@ extern int DRM(lock)(struct inode *inode, struct file *filp,
extern int DRM(unlock)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(fb_loaded);
+extern struct file_operations DRM(fops);
/* Device support (drm_fops.h) */
extern int DRM(open_helper)(struct inode *inode, struct file *filp,
diff --git a/linux/drm_compat.h b/linux/drm_compat.h
index 3bb0b7090..f6c113a9b 100644
--- a/linux/drm_compat.h
+++ b/linux/drm_compat.h
@@ -120,12 +120,16 @@ struct device;
#define class_simple_device_add(...) do {} while (0)
-static inline void class_simple_device_remove(dev_t dev){};
+static inline void class_simple_device_remove(dev_t dev){}
-static inline void class_simple_destroy(struct class_simple *cs){};
+static inline void class_simple_destroy(struct class_simple *cs){}
static inline struct class_simple *class_simple_create(struct module *owner, char *name) { return (struct class_simple *)owner; }
+static inline void drm_hotplug(void) {}
+
+static inline void class_simple_set_hotplug(struct class_simple *cs, void (*fn)(void)) {}
+
#ifndef pci_pretty_name
#define pci_pretty_name(x) x->name
#endif
diff --git a/linux/drm_drv.h b/linux/drm_drv.h
index 1d5bb86ed..744fd14cb 100644
--- a/linux/drm_drv.h
+++ b/linux/drm_drv.h
@@ -522,13 +522,6 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
sema_init( &dev->struct_sem, 1 );
sema_init( &dev->ctxlist_sem, 1 );
- if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
- {
- retcode = -EPERM;
- goto error_out;
- }
-
- dev->device = MKDEV(DRM_MAJOR, dev->minor );
dev->name = DRIVER_NAME;
dev->pdev = pdev;
@@ -549,7 +542,7 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
DRM(driver_register_fns)(dev);
if (dev->fn_tbl.preinit)
- if ((retcode = dev->fn_tbl.preinit(dev)))
+ if ((retcode = dev->fn_tbl.preinit(dev, ent->driver_data)))
goto error_out_unreg;
#if __REALLY_HAVE_AGP
@@ -577,6 +570,14 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto error_out_unreg;
}
#endif
+ if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
+ {
+ retcode = -EPERM;
+ goto error_out;
+ }
+
+ dev->device = MKDEV(DRM_MAJOR, dev->minor );
+
DRM(numdevs)++; /* no errors, mark it reserved */
DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n",
@@ -589,17 +590,11 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_pretty_name(pdev)
);
+ /* drivers add secondary heads here if needed */
if (dev->fn_tbl.postinit)
- if ((retcode = dev->fn_tbl.postinit(dev)))
+ if ((retcode = dev->fn_tbl.postinit(dev, ent->driver_data)))
goto error_out_unreg;
-
- /*
- * don't move this earlier, for upcoming hotplugging support
- */
- class_simple_device_add(DRM(stub_info).drm_class,
- MKDEV(DRM_MAJOR, dev->minor), &pdev->dev, "card%d", dev->minor);
-
return 0;
error_out_unreg:
@@ -699,11 +694,9 @@ static void __exit drm_cleanup( drm_device_t *dev )
} else {
DRM_DEBUG( "minor %d unregistered\n", dev->minor);
}
-
#if __HAVE_CTX_BITMAP
DRM(ctxbitmap_cleanup)( dev );
#endif
-
#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
if ( dev->agp && dev->agp->agp_mtrr >= 0) {
int retval;
@@ -713,8 +706,6 @@ static void __exit drm_cleanup( drm_device_t *dev )
DRM_DEBUG( "mtrr_del=%d\n", retval );
}
#endif
-
-
#if __REALLY_HAVE_AGP
if ( dev->agp ) {
DRM(agp_uninit)();
@@ -722,8 +713,8 @@ static void __exit drm_cleanup( drm_device_t *dev )
dev->agp = NULL;
}
#endif
-
- class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor));
+ if (dev->fn_tbl.postcleanup)
+ dev->fn_tbl.postcleanup(dev);
}
static void __exit drm_exit (void)
diff --git a/linux/drm_stub.h b/linux/drm_stub.h
index d61f73ee7..b94e6a708 100644
--- a/linux/drm_stub.h
+++ b/linux/drm_stub.h
@@ -76,10 +76,10 @@ static struct file_operations DRM(stub_fops) = {
.open = DRM(stub_open)
};
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
- drm_device_t *ddev;
struct pci_dev *pdev;
char *scratch;
int i = 0;
@@ -128,7 +128,8 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
return -ENOMEM;
++length;
scratch += length;
-
+#if 0
+ drm_device_t *ddev;
ddev = pci_get_drvdata(pdev);
if (ddev) {
envp[i++] = scratch;
@@ -137,11 +138,12 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp,
if ((buffer_size - length <= 0) || (i >= num_envp))
return -ENOMEM;
}
+#endif
envp[i] = 0;
- DRM_DEBUG(" - ok\n");
return 0;
}
+#endif
/**
* Get a device minor number.
@@ -177,6 +179,7 @@ static int DRM(stub_getminor)(const char *name, struct file_operations *fops,
&DRM(stub_list)[i].dev_root);
(*DRM(stub_info).info_count)++;
DRM_DEBUG("info count increased %d\n", *DRM(stub_info).info_count);
+
return i;
}
}
@@ -301,7 +304,10 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
DRM_DEBUG("info_register failed, deregistered everything\n");
}
DRM_DEBUG("info_register failed\n");
+ return ret2;
}
+ class_simple_device_add(DRM(stub_info).drm_class,
+ MKDEV(DRM_MAJOR, ret2), &dev->pdev->dev, "card%d", ret2);
return ret2;
}
return -1;
@@ -317,6 +323,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
int DRM(stub_unregister)(int minor)
{
DRM_DEBUG("%d\n", minor);
+ class_simple_device_remove(MKDEV(DRM_MAJOR, minor));
if (DRM(stub_info).info_unregister)
return DRM(stub_info).info_unregister(minor);
return -1;
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 9b58a44a3..2a79f71b8 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -912,7 +912,7 @@ void DRM(driver_irq_uninstall)( drm_device_t *dev ) {
extern drm_ioctl_desc_t DRM(ioctls)[];
-static int gamma_driver_preinit(drm_device_t *dev)
+static int gamma_driver_preinit(drm_device_t *dev, unsigned long flags)
{
/* reset the finish ioctl */
DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_FINISH)].func = DRM(finish);
diff --git a/scripts/create_bsd_pci_lists.sh b/scripts/create_bsd_pci_lists.sh
index 6666760bf..64a1fcb4f 100644
--- a/scripts/create_bsd_pci_lists.sh
+++ b/scripts/create_bsd_pci_lists.sh
@@ -14,7 +14,7 @@ cat > $OUTFILE <<EOF
*/
EOF
-while read pcivend pcidev pciname
+while read pcivend pcidev attribs pciname
do
if [ "x$pcivend" = "x" ]; then
if [ "$finished" = "0" ]; then
@@ -27,7 +27,7 @@ do
cardtype=`echo "$pcivend" | cut -s -f2 -d'[' | cut -s -f1 -d']'`
if [ "x$cardtype" = "x" ];
then
- echo " {$pcivend, $pcidev, 0, $pciname}, \\" >> $OUTFILE
+ echo " {$pcivend, $pcidev, $attribs, $pciname}, \\" >> $OUTFILE
else
echo "#define "$cardtype"_PCI_IDS \\" >> $OUTFILE
finished=0
diff --git a/scripts/create_linux_pci_lists.sh b/scripts/create_linux_pci_lists.sh
index bcba2b839..bb0e68782 100644
--- a/scripts/create_linux_pci_lists.sh
+++ b/scripts/create_linux_pci_lists.sh
@@ -14,7 +14,7 @@ cat > $OUTFILE <<EOF
*/
EOF
-while read pcivend pcidev pciname
+while read pcivend pcidev attribs pciname
do
if [ "x$pcivend" = "x" ]; then
if [ "$finished" = "0" ]; then
@@ -27,7 +27,7 @@ do
cardtype=`echo "$pcivend" | cut -s -f2 -d'[' | cut -s -f1 -d']'`
if [ "x$cardtype" = "x" ];
then
- echo " {$pcivend, $pcidev, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \\" >> $OUTFILE
+ echo " {$pcivend, $pcidev, PCI_ANY_ID, PCI_ANY_ID, 0, 0, $attribs}, \\" >> $OUTFILE
else
echo "#define "$cardtype"_PCI_IDS \\" >> $OUTFILE
finished=0
diff --git a/shared-core/drm_pciids.txt b/shared-core/drm_pciids.txt
index 6eb05693c..0b97b2239 100644
--- a/shared-core/drm_pciids.txt
+++ b/shared-core/drm_pciids.txt
@@ -1,195 +1,195 @@
[radeon]
-0x1002 0x4136 "ATI Radeon RS100 IGP 320M"
-0x1002 0x4137 "ATI Radeon RS200 IGP"
-0x1002 0x4237 "ATI Radeon RS250 IGP"
-0x1002 0x4242 "ATI Radeon BB R200 AIW 8500DV"
-0x1002 0x4242 "ATI Radeon BC R200"
-0x1002 0x4336 "ATI Radeon RS100 Mobility U1"
-0x1002 0x4337 "ATI Radeon RS200 Mobility IGP 340M"
-0x1002 0x4437 "ATI Radeon RS250 Mobility IGP"
-0x1002 0x4964 "ATI Radeon Id R250 9000"
-0x1002 0x4965 "ATI Radeon Ie R250 9000"
-0x1002 0x4966 "ATI Radeon If R250 9000"
-0x1002 0x4967 "ATI Radeon Ig R250 9000"
-0x1002 0x4C57 "ATI Radeon LW Mobility 7500 M7"
-0x1002 0x4C58 "ATI Radeon LX RV200 Mobility FireGL 7800 M7"
-0x1002 0x4C59 "ATI Radeon LY Mobility M6"
-0x1002 0x4C5A "ATI Radeon LZ Mobility M6"
-0x1002 0x4C64 "ATI Radeon Ld R250 Mobility 9000 M9"
-0x1002 0x4C65 "ATI Radeon Le R250 Mobility 9000 M9"
-0x1002 0x4C66 "ATI Radeon Lf R250 Mobility 9000 M9"
-0x1002 0x4C67 "ATI Radeon Lg R250 Mobility 9000 M9"
-0x1002 0x5144 "ATI Radeon QD R100"
-0x1002 0x5145 "ATI Radeon QE R100"
-0x1002 0x5146 "ATI Radeon QF R100"
-0x1002 0x5147 "ATI Radeon QG R100"
-0x1002 0x5148 "ATI Radeon QH R200 8500"
-0x1002 0x5149 "ATI Radeon QI R200"
-0x1002 0x514A "ATI Radeon QJ R200"
-0x1002 0x514B "ATI Radeon QK R200"
-0x1002 0x514C "ATI Radeon QL R200 8500 LE"
-0x1002 0x514D "ATI Radeon QM R200 9100"
-0x1002 0x514E "ATI Radeon QN R200 8500 LE"
-0x1002 0x514F "ATI Radeon QO R200 8500 LE"
-0x1002 0x5157 "ATI Radeon QW RV200 7500"
-0x1002 0x5158 "ATI Radeon QX RV200 7500"
-0x1002 0x5159 "ATI Radeon QY RV100 7000/VE"
-0x1002 0x515A "ATI Radeon QZ RV100 7000/VE"
-0x1002 0x5168 "ATI Radeon Qh R200"
-0x1002 0x5169 "ATI Radeon Qi R200"
-0x1002 0x516A "ATI Radeon Qj R200"
-0x1002 0x516B "ATI Radeon Qk R200"
-0x1002 0x516C "ATI Radeon Ql R200"
-0x1002 0x5834 "ATI Radeon RS300 IGP"
-0x1002 0x5835 "ATI Radeon RS300 Mobility IGP"
-0x1002 0x5836 "ATI Radeon RS300 IGP"
-0x1002 0x5837 "ATI Radeon RS300 IGP"
-0x1002 0x5960 "ATI Radeon RV280 9200"
-0x1002 0x5961 "ATI Radeon RV280 9200 SE"
-0x1002 0x5962 "ATI Radeon RV280 9200"
-0x1002 0x5963 "ATI Radeon RV280 9200"
-0x1002 0x5964 "ATI Radeon RV280 9200 SE"
-0x1002 0x5968 "ATI Radeon RV280 9200"
-0x1002 0x5969 "ATI Radeon RV280 9200"
-0x1002 0x596A "ATI Radeon RV280 9200"
-0x1002 0x596B "ATI Radeon RV280 9200"
-0x1002 0x5c61 "ATI Radeon RV280 Mobility"
-0x1002 0x5c62 "ATI Radeon RV280"
-0x1002 0x5c63 "ATI Radeon RV280 Mobility"
-0x1002 0x5c64 "ATI Radeon RV280"
+0x1002 0x4136 CHIP_IS_IGP "ATI Radeon RS100 IGP 320M"
+0x1002 0x4137 CHIP_IS_IGP "ATI Radeon RS200 IGP"
+0x1002 0x4237 CHIP_IS_IGP "ATI Radeon RS250 IGP"
+0x1002 0x4242 0 "ATI Radeon BB R200 AIW 8500DV"
+0x1002 0x4242 0 "ATI Radeon BC R200"
+0x1002 0x4336 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS100 Mobility U1"
+0x1002 0x4337 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS200 Mobility IGP 340M"
+0x1002 0x4437 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS250 Mobility IGP"
+0x1002 0x4964 0 "ATI Radeon Id R250 9000"
+0x1002 0x4965 0 "ATI Radeon Ie R250 9000"
+0x1002 0x4966 0 "ATI Radeon If R250 9000"
+0x1002 0x4967 0 "ATI Radeon Ig R250 9000"
+0x1002 0x4C57 CHIP_IS_MOBILITY "ATI Radeon LW Mobility 7500 M7"
+0x1002 0x4C58 CHIP_IS_MOBILITY "ATI Radeon LX RV200 Mobility FireGL 7800 M7"
+0x1002 0x4C59 CHIP_IS_MOBILITY "ATI Radeon LY Mobility M6"
+0x1002 0x4C5A CHIP_IS_MOBILITY "ATI Radeon LZ Mobility M6"
+0x1002 0x4C64 CHIP_IS_MOBILITY "ATI Radeon Ld R250 Mobility 9000 M9"
+0x1002 0x4C65 CHIP_IS_MOBILITY "ATI Radeon Le R250 Mobility 9000 M9"
+0x1002 0x4C66 CHIP_IS_MOBILITY "ATI Radeon Lf R250 Mobility 9000 M9"
+0x1002 0x4C67 CHIP_IS_MOBILITY "ATI Radeon Lg R250 Mobility 9000 M9"
+0x1002 0x5144 CHIP_SINGLE_CRTC "ATI Radeon QD R100"
+0x1002 0x5145 CHIP_SINGLE_CRTC "ATI Radeon QE R100"
+0x1002 0x5146 CHIP_SINGLE_CRTC "ATI Radeon QF R100"
+0x1002 0x5147 CHIP_SINGLE_CRTC "ATI Radeon QG R100"
+0x1002 0x5148 0 "ATI Radeon QH R200 8500"
+0x1002 0x5149 0 "ATI Radeon QI R200"
+0x1002 0x514A 0 "ATI Radeon QJ R200"
+0x1002 0x514B 0 "ATI Radeon QK R200"
+0x1002 0x514C 0 "ATI Radeon QL R200 8500 LE"
+0x1002 0x514D 0 "ATI Radeon QM R200 9100"
+0x1002 0x514E 0 "ATI Radeon QN R200 8500 LE"
+0x1002 0x514F 0 "ATI Radeon QO R200 8500 LE"
+0x1002 0x5157 0 "ATI Radeon QW RV200 7500"
+0x1002 0x5158 0 "ATI Radeon QX RV200 7500"
+0x1002 0x5159 0 "ATI Radeon QY RV100 7000/VE"
+0x1002 0x515A 0 "ATI Radeon QZ RV100 7000/VE"
+0x1002 0x5168 0 "ATI Radeon Qh R200"
+0x1002 0x5169 0 "ATI Radeon Qi R200"
+0x1002 0x516A 0 "ATI Radeon Qj R200"
+0x1002 0x516B 0 "ATI Radeon Qk R200"
+0x1002 0x516C 0 "ATI Radeon Ql R200"
+0x1002 0x5834 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5835 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS300 Mobility IGP"
+0x1002 0x5836 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5837 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5960 0 "ATI Radeon RV280 9200"
+0x1002 0x5961 0 "ATI Radeon RV280 9200 SE"
+0x1002 0x5962 0 "ATI Radeon RV280 9200"
+0x1002 0x5963 0 "ATI Radeon RV280 9200"
+0x1002 0x5964 0 "ATI Radeon RV280 9200 SE"
+0x1002 0x5968 0 "ATI Radeon RV280 9200"
+0x1002 0x5969 0 "ATI Radeon RV280 9200"
+0x1002 0x596A 0 "ATI Radeon RV280 9200"
+0x1002 0x596B 0 "ATI Radeon RV280 9200"
+0x1002 0x5c61 CHIP_IS_MOBILITY "ATI Radeon RV280 Mobility"
+0x1002 0x5c62 0 "ATI Radeon RV280"
+0x1002 0x5c63 CHIP_IS_MOBILITY "ATI Radeon RV280 Mobility"
+0x1002 0x5c64 0 "ATI Radeon RV280"
[r128]
-0x1002 0x4c45 "ATI Rage 128 Mobility LE (PCI)"
-0x1002 0x4c46 "ATI Rage 128 Mobility LF (AGP)"
-0x1002 0x4d46 "ATI Rage 128 Mobility MF (AGP)"
-0x1002 0x4d4c "ATI Rage 128 Mobility ML (AGP)"
-0x1002 0x5041 "ATI Rage 128 Pro PA (PCI)"
-0x1002 0x5042 "ATI Rage 128 Pro PB (AGP)"
-0x1002 0x5043 "ATI Rage 128 Pro PC (AGP)"
-0x1002 0x5044 "ATI Rage 128 Pro PD (PCI)"
-0x1002 0x5045 "ATI Rage 128 Pro PE (AGP)"
-0x1002 0x5046 "ATI Rage 128 Pro PF (AGP)"
-0x1002 0x5047 "ATI Rage 128 Pro PG (PCI)"
-0x1002 0x5048 "ATI Rage 128 Pro PH (AGP)"
-0x1002 0x5049 "ATI Rage 128 Pro PI (AGP)"
-0x1002 0x504A "ATI Rage 128 Pro PJ (PCI)"
-0x1002 0x504B "ATI Rage 128 Pro PK (AGP)"
-0x1002 0x504C "ATI Rage 128 Pro PL (AGP)"
-0x1002 0x504D "ATI Rage 128 Pro PM (PCI)"
-0x1002 0x504E "ATI Rage 128 Pro PN (AGP)"
-0x1002 0x504F "ATI Rage 128 Pro PO (AGP)"
-0x1002 0x5050 "ATI Rage 128 Pro PP (PCI)"
-0x1002 0x5051 "ATI Rage 128 Pro PQ (AGP)"
-0x1002 0x5052 "ATI Rage 128 Pro PR (PCI)"
-0x1002 0x5053 "ATI Rage 128 Pro PS (PCI)"
-0x1002 0x5054 "ATI Rage 128 Pro PT (AGP)"
-0x1002 0x5055 "ATI Rage 128 Pro PU (AGP)"
-0x1002 0x5056 "ATI Rage 128 Pro PV (PCI)"
-0x1002 0x5057 "ATI Rage 128 Pro PW (AGP)"
-0x1002 0x5058 "ATI Rage 128 Pro PX (AGP)"
-0x1002 0x5245 "ATI Rage 128 RE (PCI)"
-0x1002 0x5246 "ATI Rage 128 RF (AGP)"
-0x1002 0x5247 "ATI Rage 128 RG (AGP)"
-0x1002 0x524b "ATI Rage 128 RK (PCI)"
-0x1002 0x524c "ATI Rage 128 RL (AGP)"
-0x1002 0x534d "ATI Rage 128 SM (AGP)"
-0x1002 0x5446 "ATI Rage 128 Pro Ultra TF (AGP)"
-0x1002 0x544C "ATI Rage 128 Pro Ultra TL (AGP)"
-0x1002 0x5452 "ATI Rage 128 Pro Ultra TR (AGP)"
+0x1002 0x4c45 0 "ATI Rage 128 Mobility LE (PCI)"
+0x1002 0x4c46 0 "ATI Rage 128 Mobility LF (AGP)"
+0x1002 0x4d46 0 "ATI Rage 128 Mobility MF (AGP)"
+0x1002 0x4d4c 0 "ATI Rage 128 Mobility ML (AGP)"
+0x1002 0x5041 0 "ATI Rage 128 Pro PA (PCI)"
+0x1002 0x5042 0 "ATI Rage 128 Pro PB (AGP)"
+0x1002 0x5043 0 "ATI Rage 128 Pro PC (AGP)"
+0x1002 0x5044 0 "ATI Rage 128 Pro PD (PCI)"
+0x1002 0x5045 0 "ATI Rage 128 Pro PE (AGP)"
+0x1002 0x5046 0 "ATI Rage 128 Pro PF (AGP)"
+0x1002 0x5047 0 "ATI Rage 128 Pro PG (PCI)"
+0x1002 0x5048 0 "ATI Rage 128 Pro PH (AGP)"
+0x1002 0x5049 0 "ATI Rage 128 Pro PI (AGP)"
+0x1002 0x504A 0 "ATI Rage 128 Pro PJ (PCI)"
+0x1002 0x504B 0 "ATI Rage 128 Pro PK (AGP)"
+0x1002 0x504C 0 "ATI Rage 128 Pro PL (AGP)"
+0x1002 0x504D 0 "ATI Rage 128 Pro PM (PCI)"
+0x1002 0x504E 0 "ATI Rage 128 Pro PN (AGP)"
+0x1002 0x504F 0 "ATI Rage 128 Pro PO (AGP)"
+0x1002 0x5050 0 "ATI Rage 128 Pro PP (PCI)"
+0x1002 0x5051 0 "ATI Rage 128 Pro PQ (AGP)"
+0x1002 0x5052 0 "ATI Rage 128 Pro PR (PCI)"
+0x1002 0x5053 0 "ATI Rage 128 Pro PS (PCI)"
+0x1002 0x5054 0 "ATI Rage 128 Pro PT (AGP)"
+0x1002 0x5055 0 "ATI Rage 128 Pro PU (AGP)"
+0x1002 0x5056 0 "ATI Rage 128 Pro PV (PCI)"
+0x1002 0x5057 0 "ATI Rage 128 Pro PW (AGP)"
+0x1002 0x5058 0 "ATI Rage 128 Pro PX (AGP)"
+0x1002 0x5245 0 "ATI Rage 128 RE (PCI)"
+0x1002 0x5246 0 "ATI Rage 128 RF (AGP)"
+0x1002 0x5247 0 "ATI Rage 128 RG (AGP)"
+0x1002 0x524b 0 "ATI Rage 128 RK (PCI)"
+0x1002 0x524c 0 "ATI Rage 128 RL (AGP)"
+0x1002 0x534d 0 "ATI Rage 128 SM (AGP)"
+0x1002 0x5446 0 "ATI Rage 128 Pro Ultra TF (AGP)"
+0x1002 0x544C 0 "ATI Rage 128 Pro Ultra TL (AGP)"
+0x1002 0x5452 0 "ATI Rage 128 Pro Ultra TR (AGP)"
[mga]
-0x102b 0x0521 "Matrox G200 (AGP)"
-0x102b 0x0525 "Matrox G400/G450 (AGP)"
-0x102b 0x2527 "Matrox G550 (AGP)"
+0x102b 0x0521 0 "Matrox G200 (AGP)"
+0x102b 0x0525 0 "Matrox G400/G450 (AGP)"
+0x102b 0x2527 0 "Matrox G550 (AGP)"
[mach64]
-0x1002 0x4749 "3D Rage Pro"
-0x1002 0x4750 "3D Rage Pro 215GP"
-0x1002 0x4751 "3D Rage Pro 215GQ"
-0x1002 0x4742 "3D Rage Pro AGP 1X/2X"
-0x1002 0x4744 "3D Rage Pro AGP 1X"
-0x1002 0x4c49 "3D Rage LT Pro"
-0x1002 0x4c50 "3D Rage LT Pro"
-0x1002 0x4c51 "3D Rage LT Pro"
-0x1002 0x4c42 "3D Rage LT Pro AGP-133"
-0x1002 0x4c44 "3D Rage LT Pro AGP-66"
-0x1002 0x474c "Rage XC"
-0x1002 0x474f "Rage XL"
-0x1002 0x4752 "Rage XL"
-0x1002 0x4753 "Rage XC"
-0x1002 0x474d "Rage XL AGP 2X"
-0x1002 0x474e "Rage XC AGP"
-0x1002 0x4c52 "Rage Mobility P/M"
-0x1002 0x4c53 "Rage Mobility L"
-0x1002 0x4c4d "Rage Mobility P/M AGP 2X"
-0x1002 0x4c4e "Rage Mobility L AGP 2X"
+0x1002 0x4749 0 "3D Rage Pro"
+0x1002 0x4750 0 "3D Rage Pro 215GP"
+0x1002 0x4751 0 "3D Rage Pro 215GQ"
+0x1002 0x4742 0 "3D Rage Pro AGP 1X/2X"
+0x1002 0x4744 0 "3D Rage Pro AGP 1X"
+0x1002 0x4c49 0 "3D Rage LT Pro"
+0x1002 0x4c50 0 "3D Rage LT Pro"
+0x1002 0x4c51 0 "3D Rage LT Pro"
+0x1002 0x4c42 0 "3D Rage LT Pro AGP-133"
+0x1002 0x4c44 0 "3D Rage LT Pro AGP-66"
+0x1002 0x474c 0 "Rage XC"
+0x1002 0x474f 0 "Rage XL"
+0x1002 0x4752 0 "Rage XL"
+0x1002 0x4753 0 "Rage XC"
+0x1002 0x474d 0 "Rage XL AGP 2X"
+0x1002 0x474e 0 "Rage XC AGP"
+0x1002 0x4c52 0 "Rage Mobility P/M"
+0x1002 0x4c53 0 "Rage Mobility L"
+0x1002 0x4c4d 0 "Rage Mobility P/M AGP 2X"
+0x1002 0x4c4e 0 "Rage Mobility L AGP 2X"
[sisdrv]
-0x1039 0x0300 "SiS 300/305"
-0x1039 0x5300 "SiS 540"
-0x1039 0x6300 "SiS 630"
-0x1039 0x7300 "SiS 730"
+0x1039 0x0300 0 "SiS 300/305"
+0x1039 0x5300 0 "SiS 540"
+0x1039 0x6300 0 "SiS 630"
+0x1039 0x7300 0 "SiS 730"
[tdfx]
-0x121a 0x0003 "3dfx Voodoo Banshee"
-0x121a 0x0004 "3dfx Voodoo3 2000"
-0x121a 0x0005 "3dfx Voodoo3 3000"
-0x121a 0x0007 "3dfx Voodoo4 4500"
-0x121a 0x0009 "3dfx Voodoo5 5500"
-0x121a 0x000b "3dfx Voodoo4 4200"
+0x121a 0x0003 0 "3dfx Voodoo Banshee"
+0x121a 0x0004 0 "3dfx Voodoo3 2000"
+0x121a 0x0005 0 "3dfx Voodoo3 3000"
+0x121a 0x0007 0 "3dfx Voodoo4 4500"
+0x121a 0x0009 0 "3dfx Voodoo5 5500"
+0x121a 0x000b 0 "3dfx Voodoo4 4200"
[viadrv]
-0x1106 0x3022 "VIA CLE266 3022"
-0x1106 0x3118 "VIA CN400"
-0x1106 0x3122 "VIA CLE266"
-0x1106 0x7205 "VIA KM400"
-0x1106 0x7204 "VIA K8M800"
+0x1106 0x3022 0 "VIA CLE266 3022"
+0x1106 0x3118 0 "VIA CN400"
+0x1106 0x3122 0 "VIA CLE266"
+0x1106 0x7205 0 "VIA KM400"
+0x1106 0x7204 0 "VIA K8M800"
[i810]
-0x8086 0x7121 "Intel i810 GMCH"
-0x8086 0x7123 "Intel i810-DC100 GMCH"
-0x8086 0x7125 "Intel i810E GMCH"
-0x8086 0x1132 "Intel i815 GMCH"
+0x8086 0x7121 0 "Intel i810 GMCH"
+0x8086 0x7123 0 "Intel i810-DC100 GMCH"
+0x8086 0x7125 0 "Intel i810E GMCH"
+0x8086 0x1132 0 "Intel i815 GMCH"
[i830]
-0x8086 0x3577 "Intel i830M GMCH"
-0x8086 0x2562 "Intel i845G GMCH"
-0x8086 0x3582 "Intel i852GM/i855GM GMCH"
-0x8086 0x2572 "Intel i865G GMCH"
+0x8086 0x3577 0 "Intel i830M GMCH"
+0x8086 0x2562 0 "Intel i845G GMCH"
+0x8086 0x3582 0 "Intel i852GM/i855GM GMCH"
+0x8086 0x2572 0 "Intel i865G GMCH"
[gamma]
-0x3d3d 0x0008 "3DLabs GLINT Gamma G1"
+0x3d3d 0x0008 0 "3DLabs GLINT Gamma G1"
[savage]
-0x5333 0x8a22 "Savage4"
-0x5333 0x8a23 "Savage4"
-0x5333 0x8c10 "Savage/MX-MV"
-0x5333 0x8c11 "Savage/MX"
-0x5333 0x8c12 "Savage/IX-MV"
-0x5333 0x8c13 "Savage/IX"
-0x5333 0x8c20 "Savage 3D"
-0x5333 0x8c21 "Savage 3D/MV"
-0x5333 0x8c22 "SuperSavage MX/128"
-0x5333 0x8c24 "SuperSavage MX/64"
-0x5333 0x8c26 "SuperSavage MX/64C"
-0x5333 0x8c2a "SuperSavage IX/128 SDR"
-0x5333 0x8c2b "SuperSavage IX/128 DDR"
-0x5333 0x8c2c "SuperSavage IX/64 SDR"
-0x5333 0x8c2d "SuperSavage IX/64 DDR"
-0x5333 0x8c2e "SuperSavage IX/C SDR"
-0x5333 0x8c2f "SuperSavage IX/C DDR"
-0x5333 0x8a25 "ProSavage PM133"
-0x5333 0x8a26 "ProSavage KM133"
-0x5333 0x8d01 "ProSavage PN133"
-0x5333 0x8d02 "ProSavage KN133"
-0x5333 0x8d04 "ProSavage DDR"
+0x5333 0x8a22 0 "Savage4"
+0x5333 0x8a23 0 "Savage4"
+0x5333 0x8c10 0 "Savage/MX-MV"
+0x5333 0x8c11 0 "Savage/MX"
+0x5333 0x8c12 0 "Savage/IX-MV"
+0x5333 0x8c13 0 "Savage/IX"
+0x5333 0x8c20 0 "Savage 3D"
+0x5333 0x8c21 0 "Savage 3D/MV"
+0x5333 0x8c22 0 "SuperSavage MX/128"
+0x5333 0x8c24 0 "SuperSavage MX/64"
+0x5333 0x8c26 0 "SuperSavage MX/64C"
+0x5333 0x8c2a 0 "SuperSavage IX/128 SDR"
+0x5333 0x8c2b 0 "SuperSavage IX/128 DDR"
+0x5333 0x8c2c 0 "SuperSavage IX/64 SDR"
+0x5333 0x8c2d 0 "SuperSavage IX/64 DDR"
+0x5333 0x8c2e 0 "SuperSavage IX/C SDR"
+0x5333 0x8c2f 0 "SuperSavage IX/C DDR"
+0x5333 0x8a25 0 "ProSavage PM133"
+0x5333 0x8a26 0 "ProSavage KM133"
+0x5333 0x8d01 0 "ProSavage PN133"
+0x5333 0x8d02 0 "ProSavage KN133"
+0x5333 0x8d04 0 "ProSavage DDR"
[ffb]
[i915]
-0x8086 0x3577 "Intel i830M GMCH"
-0x8086 0x2562 "Intel i845G GMCH"
-0x8086 0x3582 "Intel i852GM/i855GM GMCH"
-0x8086 0x2572 "Intel i865G GMCH"
-0x8086 0x2582 "Intel i915G"
+0x8086 0x3577 0 "Intel i830M GMCH"
+0x8086 0x2562 0 "Intel i845G GMCH"
+0x8086 0x3582 0 "Intel i852GM/i855GM GMCH"
+0x8086 0x2572 0 "Intel i865G GMCH"
+0x8086 0x2582 0 "Intel i915G"
diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c
index fc859825a..f12e526eb 100644
--- a/shared-core/radeon_cp.c
+++ b/shared-core/radeon_cp.c
@@ -859,7 +859,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
| ( dev_priv->fb_location >> 16 ) );
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
RADEON_WRITE( RADEON_MC_AGP_LOCATION,
(((dev_priv->gart_vm_start - 1 +
dev_priv->gart_size) & 0xffff0000) |
@@ -868,7 +868,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
ring_start = (dev_priv->cp_ring->offset
- dev->agp->base
+ dev_priv->gart_vm_start);
- } else
+ } else
#endif
ring_start = (dev_priv->cp_ring->offset
- dev->sg->handle
@@ -886,7 +886,9 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
dev_priv->ring.tail = cur_read_ptr;
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
+ /* set RADEON_AGP_BASE here instead of relying on X from user space */
+ RADEON_WRITE( RADEON_AGP_BASE, (unsigned int)dev->agp->base );
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
dev_priv->ring_rptr->offset
- dev->agp->base
@@ -1003,20 +1005,11 @@ static void radeon_set_pcigart( drm_radeon_private_t *dev_priv, int on )
static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
{
- drm_radeon_private_t *dev_priv;
+ drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
- dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
- if ( dev_priv == NULL )
- return DRM_ERR(ENOMEM);
-
- memset( dev_priv, 0, sizeof(drm_radeon_private_t) );
-
- dev_priv->is_pci = init->is_pci;
-
- if ( dev_priv->is_pci && !dev->sg ) {
+ if ( (!(dev_priv->flags & CHIP_IS_AGP)) && !dev->sg ) {
DRM_ERROR( "PCI GART memory not allocated!\n" );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1025,7 +1018,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if ( dev_priv->usec_timeout < 1 ||
dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) {
DRM_DEBUG( "TIMEOUT problem!\n" );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1041,7 +1033,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) &&
( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) {
DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1113,7 +1104,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if(!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1121,28 +1111,24 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
if(!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset);
if(!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
if(!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
if(!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1151,7 +1137,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->gart_textures = drm_core_findmap(dev, init->gart_textures_offset);
if ( !dev_priv->gart_textures ) {
DRM_ERROR("could not find GART texture region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1162,7 +1147,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
init->sarea_priv_offset);
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if ( dev_priv->flags & CHIP_IS_AGP ) {
drm_core_ioremap( dev_priv->cp_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
drm_core_ioremap( dev->agp_buffer_map, dev );
@@ -1170,7 +1155,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
!dev_priv->ring_rptr->handle ||
!dev->agp_buffer_map->handle) {
DRM_ERROR("could not find ioremap agp regions!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1212,7 +1196,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
+ RADEON_READ( RADEON_CONFIG_APER_SIZE );
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci )
+ if (dev_priv->flags & CHIP_IS_AGP)
dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
- dev->agp->base
+ dev_priv->gart_vm_start);
@@ -1241,7 +1225,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
} else
@@ -1250,7 +1234,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
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;
radeon_do_cleanup_cp(dev);
return DRM_ERR(ENOMEM);
}
@@ -1264,8 +1247,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->last_buf = 0;
- dev->dev_private = (void *)dev_priv;
-
radeon_do_engine_reset( dev );
return 0;
@@ -1273,6 +1254,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
int radeon_do_cleanup_cp( drm_device_t *dev )
{
+ drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
#if __HAVE_IRQ
@@ -1283,29 +1265,27 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
#endif
- if ( dev->dev_private ) {
- drm_radeon_private_t *dev_priv = dev->dev_private;
-
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
- if ( dev_priv->cp_ring != NULL )
- drm_core_ioremapfree( dev_priv->cp_ring, dev );
- if ( dev_priv->ring_rptr != NULL )
- drm_core_ioremapfree( dev_priv->ring_rptr, dev );
- if ( dev->agp_buffer_map != NULL )
- drm_core_ioremapfree( dev->agp_buffer_map, dev );
- } else
+ if (dev_priv->flags & CHIP_IS_AGP) {
+ if ( dev_priv->cp_ring != NULL )
+ drm_core_ioremapfree( dev_priv->cp_ring, dev );
+ if ( dev_priv->ring_rptr != NULL )
+ drm_core_ioremapfree( dev_priv->ring_rptr, dev );
+ if ( dev->agp_buffer_map != NULL )
+ drm_core_ioremapfree( dev->agp_buffer_map, dev );
+ } else
#endif
- {
- 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_radeon_private_t),
- DRM_MEM_DRIVER );
- dev->dev_private = NULL;
+ {
+ if (!DRM(ati_pcigart_cleanup)( dev,
+ dev_priv->phys_pci_gart,
+ dev_priv->bus_pci_gart ))
+ DRM_ERROR( "failed to cleanup PCI GART!\n" );
+ }
+
+ {
+ int flags = dev_priv->flags;
+ memset(dev_priv, 0, sizeof(*dev_priv));
+ dev_priv->flags = flags;
}
return 0;
@@ -1330,7 +1310,7 @@ static int radeon_do_resume_cp( drm_device_t *dev )
DRM_DEBUG("Starting radeon_do_resume_cp()\n");
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
} else
@@ -1444,8 +1424,10 @@ void radeon_do_release( drm_device_t *dev )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
int ret;
+ DRM_DEBUG("dev_priv %ptr\n", dev_priv);
if (dev_priv) {
+
if (dev_priv->cp_running) {
/* Stop the cp */
while ((ret = radeon_do_cp_idle( dev_priv )) != 0) {
@@ -1461,7 +1443,8 @@ void radeon_do_release( drm_device_t *dev )
}
/* Disable *all* interrupts */
- RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 );
+ if (dev_priv->mmio) /* remove this after permanent addmaps */
+ RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 );
/* Free memory heap structures */
radeon_mem_takedown( &(dev_priv->gart_heap) );
@@ -1745,3 +1728,81 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
return ret;
}
+
+static int radeon_register_regions(struct pci_dev *pdev) {
+ int retcode = -EINVAL;
+
+ /* request the mem regions */
+ if (!request_mem_region (pci_resource_start( pdev, 2 ),
+ pci_resource_len(pdev, 2), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve MMIO region\n");
+ return retcode;
+ }
+ if (!request_mem_region (pci_resource_start( pdev, 0 ),
+ pci_resource_len(pdev, 0), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve FB region\n");
+ return retcode;
+ }
+ return 0;
+}
+
+static void radeon_release_regions(struct pci_dev *pdev) {
+ release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
+ release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
+}
+
+/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
+int radeon_preinit( struct drm_device *dev, unsigned long flags )
+{
+ int retcode = -EINVAL;
+ u32 save, temp;
+ drm_radeon_private_t *dev_priv;
+
+ dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
+ if ( dev_priv == NULL )
+ return DRM_ERR(ENOMEM);
+ DRM_DEBUG("dev_priv %ptr\n", dev_priv);
+
+ memset( dev_priv, 0, sizeof(drm_radeon_private_t) );
+ dev->dev_private = (void *)dev_priv;
+ dev_priv->flags = flags;
+
+ /* request the mem regions */
+ if (!DRM(fb_loaded))
+ if ((retcode = radeon_register_regions(dev->pdev)) != 0)
+ return retcode;
+
+ /* There are signatures in BIOS and PCI-SSID for a PCI card, but they are not very reliable.
+ Following detection method works for all cards tested so far.
+ Note, checking AGP_ENABLE bit after drmAgpEnable call can also give the correct result.
+ However, calling drmAgpEnable on a PCI card can cause some strange lockup when the server
+ restarts next time.
+ */
+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &save);
+ pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save | RADEON_AGP_ENABLE);
+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &temp);
+ if (temp & RADEON_AGP_ENABLE)
+ dev_priv->flags |= CHIP_IS_AGP;
+ DRM_DEBUG("%s card detected\n", ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : "PCI"));
+ pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save);
+
+ return 0;
+}
+
+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;
+
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+
+ if (!DRM(fb_loaded))
+ radeon_release_regions(dev->pdev);
+
+ dev->dev_private = NULL;
+ return 0;
+}
diff --git a/shared-core/radeon_drm.h b/shared-core/radeon_drm.h
index e447308b7..207a0c00f 100644
--- a/shared-core/radeon_drm.h
+++ b/shared-core/radeon_drm.h
@@ -433,7 +433,7 @@ typedef struct drm_radeon_init {
RADEON_INIT_R200_CP = 0x03
} func;
unsigned long sarea_priv_offset;
- int is_pci;
+ int is_pci; /* not used, driver asks hardware */
int cp_mode;
int gart_size;
int ring_size;
diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h
index f0aa0dc23..4b66e5be9 100644
--- a/shared-core/radeon_drv.h
+++ b/shared-core/radeon_drv.h
@@ -31,6 +31,18 @@
#ifndef __RADEON_DRV_H__
#define __RADEON_DRV_H__
+/*
+ * Chip flags
+ */
+enum radeon_chip_flags {
+ CHIP_FAMILY_MASK = 0x0000ffffUL,
+ CHIP_FLAGS_MASK = 0xffff0000UL,
+ CHIP_IS_MOBILITY = 0x00010000UL,
+ CHIP_IS_IGP = 0x00020000UL,
+ CHIP_SINGLE_CRTC = 0x00040000UL,
+ CHIP_IS_AGP = 0x00080000UL,
+};
+
#define GET_RING_HEAD(dev_priv) DRM_READ32( (dev_priv)->ring_rptr, 0 )
#define SET_RING_HEAD(dev_priv,val) DRM_WRITE32( (dev_priv)->ring_rptr, 0, (val) )
@@ -70,6 +82,9 @@ struct mem_block {
};
typedef struct drm_radeon_private {
+
+ uint32_t flags; /* see radeon_chip_flags */
+
drm_radeon_ring_buffer_t ring;
drm_radeon_sarea_t *sarea_priv;
@@ -92,7 +107,6 @@ typedef struct drm_radeon_private {
int is_r200;
- int is_pci;
unsigned long phys_pci_gart;
dma_addr_t bus_pci_gart;
@@ -211,13 +225,13 @@ extern void radeon_do_release(drm_device_t *dev);
#define RADEON_BOX_WAIT_IDLE 0x8
#define RADEON_BOX_TEXTURE_LOAD 0x10
-
-
/* Register definitions, register access macros and drmAddMap constants
* for Radeon kernel driver.
*/
-
#define RADEON_AGP_COMMAND 0x0f60
+#define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config*/
+# define RADEON_AGP_ENABLE (1<<8)
+
#define RADEON_AUX_SCISSOR_CNTL 0x26f0
# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24)
# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25)
@@ -240,6 +254,11 @@ extern void radeon_do_release(drm_device_t *dev);
#define RADEON_CRTC2_OFFSET 0x0324
#define RADEON_CRTC2_OFFSET_CNTL 0x0328
+#define RADEON_MPP_TB_CONFIG 0x01c0
+#define RADEON_MEM_CNTL 0x0140
+#define RADEON_MEM_SDRAM_MODE_REG 0x0158
+#define RADEON_AGP_BASE 0x0170
+
#define RADEON_RB3D_COLOROFFSET 0x1c40
#define RADEON_RB3D_COLORPITCH 0x1c48
@@ -718,7 +737,9 @@ do { \
} while (0)
extern int RADEON_READ_PLL( drm_device_t *dev, int addr );
-
+extern int radeon_preinit( struct drm_device *dev, unsigned long flags );
+extern int radeon_postinit( struct drm_device *dev, unsigned long flags );
+extern int radeon_postcleanup( struct drm_device *dev );
#define CP_PACKET0( reg, n ) \
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 57274174d..4a7bfd2d3 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -2583,6 +2583,9 @@ static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
void radeon_driver_register_fns(struct drm_device *dev)
{
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;
diff --git a/shared-core/sis_drv.h b/shared-core/sis_drv.h
index a87001819..1ca618cf5 100644
--- a/shared-core/sis_drv.h
+++ b/shared-core/sis_drv.h
@@ -42,4 +42,7 @@ extern int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS );
extern int sis_ioctl_agp_free( DRM_IOCTL_ARGS );
extern int sis_fb_init( DRM_IOCTL_ARGS );
+extern int sis_init_context(drm_device_t *dev, int context);
+extern int sis_final_context(drm_device_t *dev, int context);
+
#endif
diff --git a/shared-core/via_drv.h b/shared-core/via_drv.h
index ee3852c35..9677b7f30 100644
--- a/shared-core/via_drv.h
+++ b/shared-core/via_drv.h
@@ -45,7 +45,9 @@ typedef struct drm_via_private {
#define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg)
#define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val)
-
+extern int via_init_context(drm_device_t *dev, int context);
+extern int via_final_context(drm_device_t *dev, int context);
+
extern int via_do_init_map(drm_device_t *dev, drm_via_init_t *init);
extern int via_do_cleanup_map(drm_device_t *dev);
extern int via_map_init(struct inode *inode, struct file *filp,
diff --git a/shared/drm_pciids.txt b/shared/drm_pciids.txt
index 6eb05693c..0b97b2239 100644
--- a/shared/drm_pciids.txt
+++ b/shared/drm_pciids.txt
@@ -1,195 +1,195 @@
[radeon]
-0x1002 0x4136 "ATI Radeon RS100 IGP 320M"
-0x1002 0x4137 "ATI Radeon RS200 IGP"
-0x1002 0x4237 "ATI Radeon RS250 IGP"
-0x1002 0x4242 "ATI Radeon BB R200 AIW 8500DV"
-0x1002 0x4242 "ATI Radeon BC R200"
-0x1002 0x4336 "ATI Radeon RS100 Mobility U1"
-0x1002 0x4337 "ATI Radeon RS200 Mobility IGP 340M"
-0x1002 0x4437 "ATI Radeon RS250 Mobility IGP"
-0x1002 0x4964 "ATI Radeon Id R250 9000"
-0x1002 0x4965 "ATI Radeon Ie R250 9000"
-0x1002 0x4966 "ATI Radeon If R250 9000"
-0x1002 0x4967 "ATI Radeon Ig R250 9000"
-0x1002 0x4C57 "ATI Radeon LW Mobility 7500 M7"
-0x1002 0x4C58 "ATI Radeon LX RV200 Mobility FireGL 7800 M7"
-0x1002 0x4C59 "ATI Radeon LY Mobility M6"
-0x1002 0x4C5A "ATI Radeon LZ Mobility M6"
-0x1002 0x4C64 "ATI Radeon Ld R250 Mobility 9000 M9"
-0x1002 0x4C65 "ATI Radeon Le R250 Mobility 9000 M9"
-0x1002 0x4C66 "ATI Radeon Lf R250 Mobility 9000 M9"
-0x1002 0x4C67 "ATI Radeon Lg R250 Mobility 9000 M9"
-0x1002 0x5144 "ATI Radeon QD R100"
-0x1002 0x5145 "ATI Radeon QE R100"
-0x1002 0x5146 "ATI Radeon QF R100"
-0x1002 0x5147 "ATI Radeon QG R100"
-0x1002 0x5148 "ATI Radeon QH R200 8500"
-0x1002 0x5149 "ATI Radeon QI R200"
-0x1002 0x514A "ATI Radeon QJ R200"
-0x1002 0x514B "ATI Radeon QK R200"
-0x1002 0x514C "ATI Radeon QL R200 8500 LE"
-0x1002 0x514D "ATI Radeon QM R200 9100"
-0x1002 0x514E "ATI Radeon QN R200 8500 LE"
-0x1002 0x514F "ATI Radeon QO R200 8500 LE"
-0x1002 0x5157 "ATI Radeon QW RV200 7500"
-0x1002 0x5158 "ATI Radeon QX RV200 7500"
-0x1002 0x5159 "ATI Radeon QY RV100 7000/VE"
-0x1002 0x515A "ATI Radeon QZ RV100 7000/VE"
-0x1002 0x5168 "ATI Radeon Qh R200"
-0x1002 0x5169 "ATI Radeon Qi R200"
-0x1002 0x516A "ATI Radeon Qj R200"
-0x1002 0x516B "ATI Radeon Qk R200"
-0x1002 0x516C "ATI Radeon Ql R200"
-0x1002 0x5834 "ATI Radeon RS300 IGP"
-0x1002 0x5835 "ATI Radeon RS300 Mobility IGP"
-0x1002 0x5836 "ATI Radeon RS300 IGP"
-0x1002 0x5837 "ATI Radeon RS300 IGP"
-0x1002 0x5960 "ATI Radeon RV280 9200"
-0x1002 0x5961 "ATI Radeon RV280 9200 SE"
-0x1002 0x5962 "ATI Radeon RV280 9200"
-0x1002 0x5963 "ATI Radeon RV280 9200"
-0x1002 0x5964 "ATI Radeon RV280 9200 SE"
-0x1002 0x5968 "ATI Radeon RV280 9200"
-0x1002 0x5969 "ATI Radeon RV280 9200"
-0x1002 0x596A "ATI Radeon RV280 9200"
-0x1002 0x596B "ATI Radeon RV280 9200"
-0x1002 0x5c61 "ATI Radeon RV280 Mobility"
-0x1002 0x5c62 "ATI Radeon RV280"
-0x1002 0x5c63 "ATI Radeon RV280 Mobility"
-0x1002 0x5c64 "ATI Radeon RV280"
+0x1002 0x4136 CHIP_IS_IGP "ATI Radeon RS100 IGP 320M"
+0x1002 0x4137 CHIP_IS_IGP "ATI Radeon RS200 IGP"
+0x1002 0x4237 CHIP_IS_IGP "ATI Radeon RS250 IGP"
+0x1002 0x4242 0 "ATI Radeon BB R200 AIW 8500DV"
+0x1002 0x4242 0 "ATI Radeon BC R200"
+0x1002 0x4336 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS100 Mobility U1"
+0x1002 0x4337 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS200 Mobility IGP 340M"
+0x1002 0x4437 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS250 Mobility IGP"
+0x1002 0x4964 0 "ATI Radeon Id R250 9000"
+0x1002 0x4965 0 "ATI Radeon Ie R250 9000"
+0x1002 0x4966 0 "ATI Radeon If R250 9000"
+0x1002 0x4967 0 "ATI Radeon Ig R250 9000"
+0x1002 0x4C57 CHIP_IS_MOBILITY "ATI Radeon LW Mobility 7500 M7"
+0x1002 0x4C58 CHIP_IS_MOBILITY "ATI Radeon LX RV200 Mobility FireGL 7800 M7"
+0x1002 0x4C59 CHIP_IS_MOBILITY "ATI Radeon LY Mobility M6"
+0x1002 0x4C5A CHIP_IS_MOBILITY "ATI Radeon LZ Mobility M6"
+0x1002 0x4C64 CHIP_IS_MOBILITY "ATI Radeon Ld R250 Mobility 9000 M9"
+0x1002 0x4C65 CHIP_IS_MOBILITY "ATI Radeon Le R250 Mobility 9000 M9"
+0x1002 0x4C66 CHIP_IS_MOBILITY "ATI Radeon Lf R250 Mobility 9000 M9"
+0x1002 0x4C67 CHIP_IS_MOBILITY "ATI Radeon Lg R250 Mobility 9000 M9"
+0x1002 0x5144 CHIP_SINGLE_CRTC "ATI Radeon QD R100"
+0x1002 0x5145 CHIP_SINGLE_CRTC "ATI Radeon QE R100"
+0x1002 0x5146 CHIP_SINGLE_CRTC "ATI Radeon QF R100"
+0x1002 0x5147 CHIP_SINGLE_CRTC "ATI Radeon QG R100"
+0x1002 0x5148 0 "ATI Radeon QH R200 8500"
+0x1002 0x5149 0 "ATI Radeon QI R200"
+0x1002 0x514A 0 "ATI Radeon QJ R200"
+0x1002 0x514B 0 "ATI Radeon QK R200"
+0x1002 0x514C 0 "ATI Radeon QL R200 8500 LE"
+0x1002 0x514D 0 "ATI Radeon QM R200 9100"
+0x1002 0x514E 0 "ATI Radeon QN R200 8500 LE"
+0x1002 0x514F 0 "ATI Radeon QO R200 8500 LE"
+0x1002 0x5157 0 "ATI Radeon QW RV200 7500"
+0x1002 0x5158 0 "ATI Radeon QX RV200 7500"
+0x1002 0x5159 0 "ATI Radeon QY RV100 7000/VE"
+0x1002 0x515A 0 "ATI Radeon QZ RV100 7000/VE"
+0x1002 0x5168 0 "ATI Radeon Qh R200"
+0x1002 0x5169 0 "ATI Radeon Qi R200"
+0x1002 0x516A 0 "ATI Radeon Qj R200"
+0x1002 0x516B 0 "ATI Radeon Qk R200"
+0x1002 0x516C 0 "ATI Radeon Ql R200"
+0x1002 0x5834 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5835 CHIP_IS_IGP|CHIP_IS_MOBILITY "ATI Radeon RS300 Mobility IGP"
+0x1002 0x5836 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5837 CHIP_IS_IGP "ATI Radeon RS300 IGP"
+0x1002 0x5960 0 "ATI Radeon RV280 9200"
+0x1002 0x5961 0 "ATI Radeon RV280 9200 SE"
+0x1002 0x5962 0 "ATI Radeon RV280 9200"
+0x1002 0x5963 0 "ATI Radeon RV280 9200"
+0x1002 0x5964 0 "ATI Radeon RV280 9200 SE"
+0x1002 0x5968 0 "ATI Radeon RV280 9200"
+0x1002 0x5969 0 "ATI Radeon RV280 9200"
+0x1002 0x596A 0 "ATI Radeon RV280 9200"
+0x1002 0x596B 0 "ATI Radeon RV280 9200"
+0x1002 0x5c61 CHIP_IS_MOBILITY "ATI Radeon RV280 Mobility"
+0x1002 0x5c62 0 "ATI Radeon RV280"
+0x1002 0x5c63 CHIP_IS_MOBILITY "ATI Radeon RV280 Mobility"
+0x1002 0x5c64 0 "ATI Radeon RV280"
[r128]
-0x1002 0x4c45 "ATI Rage 128 Mobility LE (PCI)"
-0x1002 0x4c46 "ATI Rage 128 Mobility LF (AGP)"
-0x1002 0x4d46 "ATI Rage 128 Mobility MF (AGP)"
-0x1002 0x4d4c "ATI Rage 128 Mobility ML (AGP)"
-0x1002 0x5041 "ATI Rage 128 Pro PA (PCI)"
-0x1002 0x5042 "ATI Rage 128 Pro PB (AGP)"
-0x1002 0x5043 "ATI Rage 128 Pro PC (AGP)"
-0x1002 0x5044 "ATI Rage 128 Pro PD (PCI)"
-0x1002 0x5045 "ATI Rage 128 Pro PE (AGP)"
-0x1002 0x5046 "ATI Rage 128 Pro PF (AGP)"
-0x1002 0x5047 "ATI Rage 128 Pro PG (PCI)"
-0x1002 0x5048 "ATI Rage 128 Pro PH (AGP)"
-0x1002 0x5049 "ATI Rage 128 Pro PI (AGP)"
-0x1002 0x504A "ATI Rage 128 Pro PJ (PCI)"
-0x1002 0x504B "ATI Rage 128 Pro PK (AGP)"
-0x1002 0x504C "ATI Rage 128 Pro PL (AGP)"
-0x1002 0x504D "ATI Rage 128 Pro PM (PCI)"
-0x1002 0x504E "ATI Rage 128 Pro PN (AGP)"
-0x1002 0x504F "ATI Rage 128 Pro PO (AGP)"
-0x1002 0x5050 "ATI Rage 128 Pro PP (PCI)"
-0x1002 0x5051 "ATI Rage 128 Pro PQ (AGP)"
-0x1002 0x5052 "ATI Rage 128 Pro PR (PCI)"
-0x1002 0x5053 "ATI Rage 128 Pro PS (PCI)"
-0x1002 0x5054 "ATI Rage 128 Pro PT (AGP)"
-0x1002 0x5055 "ATI Rage 128 Pro PU (AGP)"
-0x1002 0x5056 "ATI Rage 128 Pro PV (PCI)"
-0x1002 0x5057 "ATI Rage 128 Pro PW (AGP)"
-0x1002 0x5058 "ATI Rage 128 Pro PX (AGP)"
-0x1002 0x5245 "ATI Rage 128 RE (PCI)"
-0x1002 0x5246 "ATI Rage 128 RF (AGP)"
-0x1002 0x5247 "ATI Rage 128 RG (AGP)"
-0x1002 0x524b "ATI Rage 128 RK (PCI)"
-0x1002 0x524c "ATI Rage 128 RL (AGP)"
-0x1002 0x534d "ATI Rage 128 SM (AGP)"
-0x1002 0x5446 "ATI Rage 128 Pro Ultra TF (AGP)"
-0x1002 0x544C "ATI Rage 128 Pro Ultra TL (AGP)"
-0x1002 0x5452 "ATI Rage 128 Pro Ultra TR (AGP)"
+0x1002 0x4c45 0 "ATI Rage 128 Mobility LE (PCI)"
+0x1002 0x4c46 0 "ATI Rage 128 Mobility LF (AGP)"
+0x1002 0x4d46 0 "ATI Rage 128 Mobility MF (AGP)"
+0x1002 0x4d4c 0 "ATI Rage 128 Mobility ML (AGP)"
+0x1002 0x5041 0 "ATI Rage 128 Pro PA (PCI)"
+0x1002 0x5042 0 "ATI Rage 128 Pro PB (AGP)"
+0x1002 0x5043 0 "ATI Rage 128 Pro PC (AGP)"
+0x1002 0x5044 0 "ATI Rage 128 Pro PD (PCI)"
+0x1002 0x5045 0 "ATI Rage 128 Pro PE (AGP)"
+0x1002 0x5046 0 "ATI Rage 128 Pro PF (AGP)"
+0x1002 0x5047 0 "ATI Rage 128 Pro PG (PCI)"
+0x1002 0x5048 0 "ATI Rage 128 Pro PH (AGP)"
+0x1002 0x5049 0 "ATI Rage 128 Pro PI (AGP)"
+0x1002 0x504A 0 "ATI Rage 128 Pro PJ (PCI)"
+0x1002 0x504B 0 "ATI Rage 128 Pro PK (AGP)"
+0x1002 0x504C 0 "ATI Rage 128 Pro PL (AGP)"
+0x1002 0x504D 0 "ATI Rage 128 Pro PM (PCI)"
+0x1002 0x504E 0 "ATI Rage 128 Pro PN (AGP)"
+0x1002 0x504F 0 "ATI Rage 128 Pro PO (AGP)"
+0x1002 0x5050 0 "ATI Rage 128 Pro PP (PCI)"
+0x1002 0x5051 0 "ATI Rage 128 Pro PQ (AGP)"
+0x1002 0x5052 0 "ATI Rage 128 Pro PR (PCI)"
+0x1002 0x5053 0 "ATI Rage 128 Pro PS (PCI)"
+0x1002 0x5054 0 "ATI Rage 128 Pro PT (AGP)"
+0x1002 0x5055 0 "ATI Rage 128 Pro PU (AGP)"
+0x1002 0x5056 0 "ATI Rage 128 Pro PV (PCI)"
+0x1002 0x5057 0 "ATI Rage 128 Pro PW (AGP)"
+0x1002 0x5058 0 "ATI Rage 128 Pro PX (AGP)"
+0x1002 0x5245 0 "ATI Rage 128 RE (PCI)"
+0x1002 0x5246 0 "ATI Rage 128 RF (AGP)"
+0x1002 0x5247 0 "ATI Rage 128 RG (AGP)"
+0x1002 0x524b 0 "ATI Rage 128 RK (PCI)"
+0x1002 0x524c 0 "ATI Rage 128 RL (AGP)"
+0x1002 0x534d 0 "ATI Rage 128 SM (AGP)"
+0x1002 0x5446 0 "ATI Rage 128 Pro Ultra TF (AGP)"
+0x1002 0x544C 0 "ATI Rage 128 Pro Ultra TL (AGP)"
+0x1002 0x5452 0 "ATI Rage 128 Pro Ultra TR (AGP)"
[mga]
-0x102b 0x0521 "Matrox G200 (AGP)"
-0x102b 0x0525 "Matrox G400/G450 (AGP)"
-0x102b 0x2527 "Matrox G550 (AGP)"
+0x102b 0x0521 0 "Matrox G200 (AGP)"
+0x102b 0x0525 0 "Matrox G400/G450 (AGP)"
+0x102b 0x2527 0 "Matrox G550 (AGP)"
[mach64]
-0x1002 0x4749 "3D Rage Pro"
-0x1002 0x4750 "3D Rage Pro 215GP"
-0x1002 0x4751 "3D Rage Pro 215GQ"
-0x1002 0x4742 "3D Rage Pro AGP 1X/2X"
-0x1002 0x4744 "3D Rage Pro AGP 1X"
-0x1002 0x4c49 "3D Rage LT Pro"
-0x1002 0x4c50 "3D Rage LT Pro"
-0x1002 0x4c51 "3D Rage LT Pro"
-0x1002 0x4c42 "3D Rage LT Pro AGP-133"
-0x1002 0x4c44 "3D Rage LT Pro AGP-66"
-0x1002 0x474c "Rage XC"
-0x1002 0x474f "Rage XL"
-0x1002 0x4752 "Rage XL"
-0x1002 0x4753 "Rage XC"
-0x1002 0x474d "Rage XL AGP 2X"
-0x1002 0x474e "Rage XC AGP"
-0x1002 0x4c52 "Rage Mobility P/M"
-0x1002 0x4c53 "Rage Mobility L"
-0x1002 0x4c4d "Rage Mobility P/M AGP 2X"
-0x1002 0x4c4e "Rage Mobility L AGP 2X"
+0x1002 0x4749 0 "3D Rage Pro"
+0x1002 0x4750 0 "3D Rage Pro 215GP"
+0x1002 0x4751 0 "3D Rage Pro 215GQ"
+0x1002 0x4742 0 "3D Rage Pro AGP 1X/2X"
+0x1002 0x4744 0 "3D Rage Pro AGP 1X"
+0x1002 0x4c49 0 "3D Rage LT Pro"
+0x1002 0x4c50 0 "3D Rage LT Pro"
+0x1002 0x4c51 0 "3D Rage LT Pro"
+0x1002 0x4c42 0 "3D Rage LT Pro AGP-133"
+0x1002 0x4c44 0 "3D Rage LT Pro AGP-66"
+0x1002 0x474c 0 "Rage XC"
+0x1002 0x474f 0 "Rage XL"
+0x1002 0x4752 0 "Rage XL"
+0x1002 0x4753 0 "Rage XC"
+0x1002 0x474d 0 "Rage XL AGP 2X"
+0x1002 0x474e 0 "Rage XC AGP"
+0x1002 0x4c52 0 "Rage Mobility P/M"
+0x1002 0x4c53 0 "Rage Mobility L"
+0x1002 0x4c4d 0 "Rage Mobility P/M AGP 2X"
+0x1002 0x4c4e 0 "Rage Mobility L AGP 2X"
[sisdrv]
-0x1039 0x0300 "SiS 300/305"
-0x1039 0x5300 "SiS 540"
-0x1039 0x6300 "SiS 630"
-0x1039 0x7300 "SiS 730"
+0x1039 0x0300 0 "SiS 300/305"
+0x1039 0x5300 0 "SiS 540"
+0x1039 0x6300 0 "SiS 630"
+0x1039 0x7300 0 "SiS 730"
[tdfx]
-0x121a 0x0003 "3dfx Voodoo Banshee"
-0x121a 0x0004 "3dfx Voodoo3 2000"
-0x121a 0x0005 "3dfx Voodoo3 3000"
-0x121a 0x0007 "3dfx Voodoo4 4500"
-0x121a 0x0009 "3dfx Voodoo5 5500"
-0x121a 0x000b "3dfx Voodoo4 4200"
+0x121a 0x0003 0 "3dfx Voodoo Banshee"
+0x121a 0x0004 0 "3dfx Voodoo3 2000"
+0x121a 0x0005 0 "3dfx Voodoo3 3000"
+0x121a 0x0007 0 "3dfx Voodoo4 4500"
+0x121a 0x0009 0 "3dfx Voodoo5 5500"
+0x121a 0x000b 0 "3dfx Voodoo4 4200"
[viadrv]
-0x1106 0x3022 "VIA CLE266 3022"
-0x1106 0x3118 "VIA CN400"
-0x1106 0x3122 "VIA CLE266"
-0x1106 0x7205 "VIA KM400"
-0x1106 0x7204 "VIA K8M800"
+0x1106 0x3022 0 "VIA CLE266 3022"
+0x1106 0x3118 0 "VIA CN400"
+0x1106 0x3122 0 "VIA CLE266"
+0x1106 0x7205 0 "VIA KM400"
+0x1106 0x7204 0 "VIA K8M800"
[i810]
-0x8086 0x7121 "Intel i810 GMCH"
-0x8086 0x7123 "Intel i810-DC100 GMCH"
-0x8086 0x7125 "Intel i810E GMCH"
-0x8086 0x1132 "Intel i815 GMCH"
+0x8086 0x7121 0 "Intel i810 GMCH"
+0x8086 0x7123 0 "Intel i810-DC100 GMCH"
+0x8086 0x7125 0 "Intel i810E GMCH"
+0x8086 0x1132 0 "Intel i815 GMCH"
[i830]
-0x8086 0x3577 "Intel i830M GMCH"
-0x8086 0x2562 "Intel i845G GMCH"
-0x8086 0x3582 "Intel i852GM/i855GM GMCH"
-0x8086 0x2572 "Intel i865G GMCH"
+0x8086 0x3577 0 "Intel i830M GMCH"
+0x8086 0x2562 0 "Intel i845G GMCH"
+0x8086 0x3582 0 "Intel i852GM/i855GM GMCH"
+0x8086 0x2572 0 "Intel i865G GMCH"
[gamma]
-0x3d3d 0x0008 "3DLabs GLINT Gamma G1"
+0x3d3d 0x0008 0 "3DLabs GLINT Gamma G1"
[savage]
-0x5333 0x8a22 "Savage4"
-0x5333 0x8a23 "Savage4"
-0x5333 0x8c10 "Savage/MX-MV"
-0x5333 0x8c11 "Savage/MX"
-0x5333 0x8c12 "Savage/IX-MV"
-0x5333 0x8c13 "Savage/IX"
-0x5333 0x8c20 "Savage 3D"
-0x5333 0x8c21 "Savage 3D/MV"
-0x5333 0x8c22 "SuperSavage MX/128"
-0x5333 0x8c24 "SuperSavage MX/64"
-0x5333 0x8c26 "SuperSavage MX/64C"
-0x5333 0x8c2a "SuperSavage IX/128 SDR"
-0x5333 0x8c2b "SuperSavage IX/128 DDR"
-0x5333 0x8c2c "SuperSavage IX/64 SDR"
-0x5333 0x8c2d "SuperSavage IX/64 DDR"
-0x5333 0x8c2e "SuperSavage IX/C SDR"
-0x5333 0x8c2f "SuperSavage IX/C DDR"
-0x5333 0x8a25 "ProSavage PM133"
-0x5333 0x8a26 "ProSavage KM133"
-0x5333 0x8d01 "ProSavage PN133"
-0x5333 0x8d02 "ProSavage KN133"
-0x5333 0x8d04 "ProSavage DDR"
+0x5333 0x8a22 0 "Savage4"
+0x5333 0x8a23 0 "Savage4"
+0x5333 0x8c10 0 "Savage/MX-MV"
+0x5333 0x8c11 0 "Savage/MX"
+0x5333 0x8c12 0 "Savage/IX-MV"
+0x5333 0x8c13 0 "Savage/IX"
+0x5333 0x8c20 0 "Savage 3D"
+0x5333 0x8c21 0 "Savage 3D/MV"
+0x5333 0x8c22 0 "SuperSavage MX/128"
+0x5333 0x8c24 0 "SuperSavage MX/64"
+0x5333 0x8c26 0 "SuperSavage MX/64C"
+0x5333 0x8c2a 0 "SuperSavage IX/128 SDR"
+0x5333 0x8c2b 0 "SuperSavage IX/128 DDR"
+0x5333 0x8c2c 0 "SuperSavage IX/64 SDR"
+0x5333 0x8c2d 0 "SuperSavage IX/64 DDR"
+0x5333 0x8c2e 0 "SuperSavage IX/C SDR"
+0x5333 0x8c2f 0 "SuperSavage IX/C DDR"
+0x5333 0x8a25 0 "ProSavage PM133"
+0x5333 0x8a26 0 "ProSavage KM133"
+0x5333 0x8d01 0 "ProSavage PN133"
+0x5333 0x8d02 0 "ProSavage KN133"
+0x5333 0x8d04 0 "ProSavage DDR"
[ffb]
[i915]
-0x8086 0x3577 "Intel i830M GMCH"
-0x8086 0x2562 "Intel i845G GMCH"
-0x8086 0x3582 "Intel i852GM/i855GM GMCH"
-0x8086 0x2572 "Intel i865G GMCH"
-0x8086 0x2582 "Intel i915G"
+0x8086 0x3577 0 "Intel i830M GMCH"
+0x8086 0x2562 0 "Intel i845G GMCH"
+0x8086 0x3582 0 "Intel i852GM/i855GM GMCH"
+0x8086 0x2572 0 "Intel i865G GMCH"
+0x8086 0x2582 0 "Intel i915G"
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c
index fc859825a..f12e526eb 100644
--- a/shared/radeon_cp.c
+++ b/shared/radeon_cp.c
@@ -859,7 +859,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
| ( dev_priv->fb_location >> 16 ) );
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
RADEON_WRITE( RADEON_MC_AGP_LOCATION,
(((dev_priv->gart_vm_start - 1 +
dev_priv->gart_size) & 0xffff0000) |
@@ -868,7 +868,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
ring_start = (dev_priv->cp_ring->offset
- dev->agp->base
+ dev_priv->gart_vm_start);
- } else
+ } else
#endif
ring_start = (dev_priv->cp_ring->offset
- dev->sg->handle
@@ -886,7 +886,9 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
dev_priv->ring.tail = cur_read_ptr;
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
+ /* set RADEON_AGP_BASE here instead of relying on X from user space */
+ RADEON_WRITE( RADEON_AGP_BASE, (unsigned int)dev->agp->base );
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
dev_priv->ring_rptr->offset
- dev->agp->base
@@ -1003,20 +1005,11 @@ static void radeon_set_pcigart( drm_radeon_private_t *dev_priv, int on )
static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
{
- drm_radeon_private_t *dev_priv;
+ drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
- dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
- if ( dev_priv == NULL )
- return DRM_ERR(ENOMEM);
-
- memset( dev_priv, 0, sizeof(drm_radeon_private_t) );
-
- dev_priv->is_pci = init->is_pci;
-
- if ( dev_priv->is_pci && !dev->sg ) {
+ if ( (!(dev_priv->flags & CHIP_IS_AGP)) && !dev->sg ) {
DRM_ERROR( "PCI GART memory not allocated!\n" );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1025,7 +1018,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if ( dev_priv->usec_timeout < 1 ||
dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) {
DRM_DEBUG( "TIMEOUT problem!\n" );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1041,7 +1033,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) &&
( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) {
DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode );
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1113,7 +1104,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
if(!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1121,28 +1111,24 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
if(!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset);
if(!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
if(!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
if(!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1151,7 +1137,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->gart_textures = drm_core_findmap(dev, init->gart_textures_offset);
if ( !dev_priv->gart_textures ) {
DRM_ERROR("could not find GART texture region!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1162,7 +1147,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
init->sarea_priv_offset);
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if ( dev_priv->flags & CHIP_IS_AGP ) {
drm_core_ioremap( dev_priv->cp_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
drm_core_ioremap( dev->agp_buffer_map, dev );
@@ -1170,7 +1155,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
!dev_priv->ring_rptr->handle ||
!dev->agp_buffer_map->handle) {
DRM_ERROR("could not find ioremap agp regions!\n");
- dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL);
}
@@ -1212,7 +1196,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
+ RADEON_READ( RADEON_CONFIG_APER_SIZE );
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci )
+ if (dev_priv->flags & CHIP_IS_AGP)
dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
- dev->agp->base
+ dev_priv->gart_vm_start);
@@ -1241,7 +1225,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
} else
@@ -1250,7 +1234,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
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;
radeon_do_cleanup_cp(dev);
return DRM_ERR(ENOMEM);
}
@@ -1264,8 +1247,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->last_buf = 0;
- dev->dev_private = (void *)dev_priv;
-
radeon_do_engine_reset( dev );
return 0;
@@ -1273,6 +1254,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
int radeon_do_cleanup_cp( drm_device_t *dev )
{
+ drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
#if __HAVE_IRQ
@@ -1283,29 +1265,27 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
#endif
- if ( dev->dev_private ) {
- drm_radeon_private_t *dev_priv = dev->dev_private;
-
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
- if ( dev_priv->cp_ring != NULL )
- drm_core_ioremapfree( dev_priv->cp_ring, dev );
- if ( dev_priv->ring_rptr != NULL )
- drm_core_ioremapfree( dev_priv->ring_rptr, dev );
- if ( dev->agp_buffer_map != NULL )
- drm_core_ioremapfree( dev->agp_buffer_map, dev );
- } else
+ if (dev_priv->flags & CHIP_IS_AGP) {
+ if ( dev_priv->cp_ring != NULL )
+ drm_core_ioremapfree( dev_priv->cp_ring, dev );
+ if ( dev_priv->ring_rptr != NULL )
+ drm_core_ioremapfree( dev_priv->ring_rptr, dev );
+ if ( dev->agp_buffer_map != NULL )
+ drm_core_ioremapfree( dev->agp_buffer_map, dev );
+ } else
#endif
- {
- 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_radeon_private_t),
- DRM_MEM_DRIVER );
- dev->dev_private = NULL;
+ {
+ if (!DRM(ati_pcigart_cleanup)( dev,
+ dev_priv->phys_pci_gart,
+ dev_priv->bus_pci_gart ))
+ DRM_ERROR( "failed to cleanup PCI GART!\n" );
+ }
+
+ {
+ int flags = dev_priv->flags;
+ memset(dev_priv, 0, sizeof(*dev_priv));
+ dev_priv->flags = flags;
}
return 0;
@@ -1330,7 +1310,7 @@ static int radeon_do_resume_cp( drm_device_t *dev )
DRM_DEBUG("Starting radeon_do_resume_cp()\n");
#if __REALLY_HAVE_AGP
- if ( !dev_priv->is_pci ) {
+ if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
} else
@@ -1444,8 +1424,10 @@ void radeon_do_release( drm_device_t *dev )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
int ret;
+ DRM_DEBUG("dev_priv %ptr\n", dev_priv);
if (dev_priv) {
+
if (dev_priv->cp_running) {
/* Stop the cp */
while ((ret = radeon_do_cp_idle( dev_priv )) != 0) {
@@ -1461,7 +1443,8 @@ void radeon_do_release( drm_device_t *dev )
}
/* Disable *all* interrupts */
- RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 );
+ if (dev_priv->mmio) /* remove this after permanent addmaps */
+ RADEON_WRITE( RADEON_GEN_INT_CNTL, 0 );
/* Free memory heap structures */
radeon_mem_takedown( &(dev_priv->gart_heap) );
@@ -1745,3 +1728,81 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
return ret;
}
+
+static int radeon_register_regions(struct pci_dev *pdev) {
+ int retcode = -EINVAL;
+
+ /* request the mem regions */
+ if (!request_mem_region (pci_resource_start( pdev, 2 ),
+ pci_resource_len(pdev, 2), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve MMIO region\n");
+ return retcode;
+ }
+ if (!request_mem_region (pci_resource_start( pdev, 0 ),
+ pci_resource_len(pdev, 0), DRIVER_NAME)) {
+ printk(KERN_ERR DRIVER_NAME ": cannot reserve FB region\n");
+ return retcode;
+ }
+ return 0;
+}
+
+static void radeon_release_regions(struct pci_dev *pdev) {
+ release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
+ release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
+}
+
+/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
+int radeon_preinit( struct drm_device *dev, unsigned long flags )
+{
+ int retcode = -EINVAL;
+ u32 save, temp;
+ drm_radeon_private_t *dev_priv;
+
+ dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
+ if ( dev_priv == NULL )
+ return DRM_ERR(ENOMEM);
+ DRM_DEBUG("dev_priv %ptr\n", dev_priv);
+
+ memset( dev_priv, 0, sizeof(drm_radeon_private_t) );
+ dev->dev_private = (void *)dev_priv;
+ dev_priv->flags = flags;
+
+ /* request the mem regions */
+ if (!DRM(fb_loaded))
+ if ((retcode = radeon_register_regions(dev->pdev)) != 0)
+ return retcode;
+
+ /* There are signatures in BIOS and PCI-SSID for a PCI card, but they are not very reliable.
+ Following detection method works for all cards tested so far.
+ Note, checking AGP_ENABLE bit after drmAgpEnable call can also give the correct result.
+ However, calling drmAgpEnable on a PCI card can cause some strange lockup when the server
+ restarts next time.
+ */
+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &save);
+ pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save | RADEON_AGP_ENABLE);
+ pci_read_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, &temp);
+ if (temp & RADEON_AGP_ENABLE)
+ dev_priv->flags |= CHIP_IS_AGP;
+ DRM_DEBUG("%s card detected\n", ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : "PCI"));
+ pci_write_config_dword(dev->pdev, RADEON_AGP_COMMAND_PCI_CONFIG, save);
+
+ return 0;
+}
+
+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;
+
+ DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
+
+ if (!DRM(fb_loaded))
+ radeon_release_regions(dev->pdev);
+
+ dev->dev_private = NULL;
+ return 0;
+}
diff --git a/shared/radeon_drm.h b/shared/radeon_drm.h
index e447308b7..207a0c00f 100644
--- a/shared/radeon_drm.h
+++ b/shared/radeon_drm.h
@@ -433,7 +433,7 @@ typedef struct drm_radeon_init {
RADEON_INIT_R200_CP = 0x03
} func;
unsigned long sarea_priv_offset;
- int is_pci;
+ int is_pci; /* not used, driver asks hardware */
int cp_mode;
int gart_size;
int ring_size;
diff --git a/shared/radeon_drv.h b/shared/radeon_drv.h
index f0aa0dc23..4b66e5be9 100644
--- a/shared/radeon_drv.h
+++ b/shared/radeon_drv.h
@@ -31,6 +31,18 @@
#ifndef __RADEON_DRV_H__
#define __RADEON_DRV_H__
+/*
+ * Chip flags
+ */
+enum radeon_chip_flags {
+ CHIP_FAMILY_MASK = 0x0000ffffUL,
+ CHIP_FLAGS_MASK = 0xffff0000UL,
+ CHIP_IS_MOBILITY = 0x00010000UL,
+ CHIP_IS_IGP = 0x00020000UL,
+ CHIP_SINGLE_CRTC = 0x00040000UL,
+ CHIP_IS_AGP = 0x00080000UL,
+};
+
#define GET_RING_HEAD(dev_priv) DRM_READ32( (dev_priv)->ring_rptr, 0 )
#define SET_RING_HEAD(dev_priv,val) DRM_WRITE32( (dev_priv)->ring_rptr, 0, (val) )
@@ -70,6 +82,9 @@ struct mem_block {
};
typedef struct drm_radeon_private {
+
+ uint32_t flags; /* see radeon_chip_flags */
+
drm_radeon_ring_buffer_t ring;
drm_radeon_sarea_t *sarea_priv;
@@ -92,7 +107,6 @@ typedef struct drm_radeon_private {
int is_r200;
- int is_pci;
unsigned long phys_pci_gart;
dma_addr_t bus_pci_gart;
@@ -211,13 +225,13 @@ extern void radeon_do_release(drm_device_t *dev);
#define RADEON_BOX_WAIT_IDLE 0x8
#define RADEON_BOX_TEXTURE_LOAD 0x10
-
-
/* Register definitions, register access macros and drmAddMap constants
* for Radeon kernel driver.
*/
-
#define RADEON_AGP_COMMAND 0x0f60
+#define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config*/
+# define RADEON_AGP_ENABLE (1<<8)
+
#define RADEON_AUX_SCISSOR_CNTL 0x26f0
# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24)
# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25)
@@ -240,6 +254,11 @@ extern void radeon_do_release(drm_device_t *dev);
#define RADEON_CRTC2_OFFSET 0x0324
#define RADEON_CRTC2_OFFSET_CNTL 0x0328
+#define RADEON_MPP_TB_CONFIG 0x01c0
+#define RADEON_MEM_CNTL 0x0140
+#define RADEON_MEM_SDRAM_MODE_REG 0x0158
+#define RADEON_AGP_BASE 0x0170
+
#define RADEON_RB3D_COLOROFFSET 0x1c40
#define RADEON_RB3D_COLORPITCH 0x1c48
@@ -718,7 +737,9 @@ do { \
} while (0)
extern int RADEON_READ_PLL( drm_device_t *dev, int addr );
-
+extern int radeon_preinit( struct drm_device *dev, unsigned long flags );
+extern int radeon_postinit( struct drm_device *dev, unsigned long flags );
+extern int radeon_postcleanup( struct drm_device *dev );
#define CP_PACKET0( reg, n ) \
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
diff --git a/shared/radeon_state.c b/shared/radeon_state.c
index 57274174d..4a7bfd2d3 100644
--- a/shared/radeon_state.c
+++ b/shared/radeon_state.c
@@ -2583,6 +2583,9 @@ static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
void radeon_driver_register_fns(struct drm_device *dev)
{
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;
diff --git a/shared/sis_drv.h b/shared/sis_drv.h
index a87001819..1ca618cf5 100644
--- a/shared/sis_drv.h
+++ b/shared/sis_drv.h
@@ -42,4 +42,7 @@ extern int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS );
extern int sis_ioctl_agp_free( DRM_IOCTL_ARGS );
extern int sis_fb_init( DRM_IOCTL_ARGS );
+extern int sis_init_context(drm_device_t *dev, int context);
+extern int sis_final_context(drm_device_t *dev, int context);
+
#endif
diff --git a/shared/via_drv.h b/shared/via_drv.h
index ee3852c35..9677b7f30 100644
--- a/shared/via_drv.h
+++ b/shared/via_drv.h
@@ -45,7 +45,9 @@ typedef struct drm_via_private {
#define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg)
#define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val)
-
+extern int via_init_context(drm_device_t *dev, int context);
+extern int via_final_context(drm_device_t *dev, int context);
+
extern int via_do_init_map(drm_device_t *dev, drm_via_init_t *init);
extern int via_do_cleanup_map(drm_device_t *dev);
extern int via_map_init(struct inode *inode, struct file *filp,