summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-08-05 03:50:23 +0000
committerEric Anholt <anholt@freebsd.org>2005-08-05 03:50:23 +0000
commitc789ea1521ac9e935f2a1c6c043619d89bae9c16 (patch)
treebb8bcecf000f78f71db8dc70484d7ea82cc0b260
parent143622a987745ca2084f7a188e9993ffd5f28fe3 (diff)
Rename the driver hooks in the DRM to something a little more
understandable: preinit -> load postinit -> (removed) presetup -> firstopen postsetup -> (removed) open_helper -> open prerelease -> preclose free_filp_priv -> postclose pretakedown -> lastclose postcleanup -> unload release -> reclaim_buffers_locked version -> (removed) postinit and version were replaced with generic code in the Linux DRM (drivers now set their version numbers and description in the driver structure, like on BSD). postsetup wasn't used at all. Fixes the savage hooks for initializing and tearing down mappings at the right times. Testing involved at least starting X, running glxgears, killing glxgears, exiting X, and repeating. Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4)
-rw-r--r--bsd-core/drmP.h62
-rw-r--r--bsd-core/drm_agpsupport.c4
-rw-r--r--bsd-core/drm_bufs.c10
-rw-r--r--bsd-core/drm_context.c8
-rw-r--r--bsd-core/drm_dma.c4
-rw-r--r--bsd-core/drm_drv.c124
-rw-r--r--bsd-core/drm_fops.c4
-rw-r--r--bsd-core/drm_ioctl.c8
-rw-r--r--bsd-core/drm_irq.c14
-rw-r--r--bsd-core/drm_lock.c7
-rw-r--r--bsd-core/drm_sysctl.c2
-rw-r--r--bsd-core/i915_drv.c40
-rw-r--r--bsd-core/mach64_drv.c50
-rw-r--r--bsd-core/mga_drv.c59
-rw-r--r--bsd-core/r128_drv.c48
-rw-r--r--bsd-core/radeon_drv.c57
-rw-r--r--bsd-core/savage_drv.c36
-rw-r--r--bsd-core/sis_drv.c26
-rw-r--r--bsd-core/tdfx_drv.c18
-rw-r--r--linux-core/drmP.h31
-rw-r--r--linux-core/drm_drv.c29
-rw-r--r--linux-core/drm_fops.c32
-rw-r--r--linux-core/drm_ioctl.c18
-rw-r--r--linux-core/drm_stub.c15
-rw-r--r--linux-core/ffb_context.c14
-rw-r--r--linux-core/ffb_drv.c39
-rw-r--r--linux-core/i810_dma.c18
-rw-r--r--linux-core/i810_drv.c41
-rw-r--r--linux-core/i810_drv.h10
-rw-r--r--linux-core/i830_dma.c18
-rw-r--r--linux-core/i830_drv.c48
-rw-r--r--linux-core/i830_drv.h8
-rw-r--r--linux-core/i915_drv.c47
-rw-r--r--linux-core/imagine_drv.c30
-rw-r--r--linux-core/mach64_drv.c38
-rw-r--r--linux-core/mga_drv.c52
-rw-r--r--linux-core/r128_drv.c40
-rw-r--r--linux-core/radeon_drv.c49
-rw-r--r--linux-core/savage_drv.c44
-rw-r--r--linux-core/sis_drv.c36
-rw-r--r--linux-core/tdfx_drv.c36
-rw-r--r--linux/.cvsignore1
-rw-r--r--shared-core/i915_dma.c16
-rw-r--r--shared-core/i915_drv.h5
-rw-r--r--shared-core/mach64_dma.c2
-rw-r--r--shared-core/mach64_drv.h2
-rw-r--r--shared-core/mga_dma.c15
-rw-r--r--shared-core/mga_drv.h6
-rw-r--r--shared-core/r128_drv.h4
-rw-r--r--shared-core/r128_state.c4
-rw-r--r--shared-core/radeon_cp.c14
-rw-r--r--shared-core/radeon_drv.h18
-rw-r--r--shared-core/radeon_state.c8
-rw-r--r--shared-core/savage_bci.c43
-rw-r--r--shared-core/savage_drv.h6
-rw-r--r--shared-core/via_drv.c35
56 files changed, 601 insertions, 852 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 596e25f4..a42bf16b 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -616,25 +616,15 @@ typedef struct drm_vbl_sig {
int pid;
} drm_vbl_sig_t;
-/**
- * DRM device functions structure
- */
-struct drm_device {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- struct device device; /* softc is an extension of struct device */
-#endif
-
- /* Beginning of driver-config section */
- int (*preinit)(struct drm_device *, unsigned long flags);
- int (*postinit)(struct drm_device *, unsigned long flags);
- void (*prerelease)(struct drm_device *, void *filp);
- void (*pretakedown)(struct drm_device *);
- int (*postcleanup)(struct drm_device *);
- int (*presetup)(struct drm_device *);
- int (*postsetup)(struct drm_device *);
- int (*open_helper)(struct drm_device *, drm_file_t *);
- void (*free_filp_priv)(struct drm_device *, drm_file_t *);
- void (*release)(struct drm_device *, void *filp);
+struct drm_driver_info {
+ int (*load)(struct drm_device *, unsigned long flags);
+ int (*firstopen)(struct drm_device *);
+ int (*open)(struct drm_device *, drm_file_t *);
+ void (*preclose)(struct drm_device *, void *filp);
+ void (*postclose)(struct drm_device *, drm_file_t *);
+ void (*lastclose)(struct drm_device *);
+ int (*unload)(struct drm_device *);
+ void (*reclaim_buffers_locked)(struct drm_device *, void *filp);
int (*dma_ioctl)(DRM_IOCTL_ARGS);
void (*dma_ready)(struct drm_device *);
int (*dma_quiescent)(struct drm_device *);
@@ -666,20 +656,19 @@ struct drm_device {
* card is absolutely \b not AGP (return of 0), absolutely \b is AGP
* (return of 1), or may or may not be AGP (return of 2).
*/
- int (*device_is_agp) (struct drm_device * dev);
+ int (*device_is_agp) (struct drm_device * dev);
+ drm_ioctl_desc_t *ioctls;
+ int max_ioctl;
- drm_ioctl_desc_t *driver_ioctls;
- int max_driver_ioctl;
+ int buf_priv_size;
- int dev_priv_size;
-
- int driver_major;
- int driver_minor;
- int driver_patchlevel;
- const char *driver_name; /* Simple driver name */
- const char *driver_desc; /* Longer driver name */
- const char *driver_date; /* Date of last major changes. */
+ int major;
+ int minor;
+ int patchlevel;
+ const char *name; /* Simple driver name */
+ const char *desc; /* Longer driver name */
+ const char *date; /* Date of last major changes. */
unsigned use_agp :1;
unsigned require_agp :1;
@@ -690,7 +679,18 @@ struct drm_device {
unsigned use_irq :1;
unsigned use_vbl_irq :1;
unsigned use_mtrr :1;
- /* End of driver-config section */
+};
+
+/**
+ * DRM device functions structure
+ */
+struct drm_device {
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ struct device device; /* softc is an extension of struct device */
+#endif
+
+ struct drm_driver_info driver;
+ drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
char *unique; /* Unique identifier: e.g., busid */
int unique_len; /* Length of unique field */
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index 4f3a6f28..a78410a8 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -44,8 +44,8 @@ drm_device_find_capability(drm_device_t *dev, int cap)
{
int ret;
- if (dev->device_is_agp != NULL) {
- ret = (*dev->device_is_agp)(dev);
+ if (dev->driver.device_is_agp != NULL) {
+ ret = (*dev->driver.device_is_agp)(dev);
if (ret != DRM_MIGHT_BE_AGP) {
return ret == 2;
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index 0cc2a0d9..b00ecda2 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -402,7 +402,7 @@ static int drm_do_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = dev->dev_priv_size;
+ buf->dev_priv_size = dev->driver.buf_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
@@ -543,7 +543,7 @@ static int drm_do_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = dev->dev_priv_size;
+ buf->dev_priv_size = dev->driver.buf_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
@@ -657,7 +657,7 @@ static int drm_do_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = dev->dev_priv_size;
+ buf->dev_priv_size = dev->driver.buf_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, M_DRM,
M_NOWAIT | M_ZERO);
if (buf->dev_private == NULL) {
@@ -988,8 +988,8 @@ int drm_mapbufs(DRM_IOCTL_ARGS)
if (request.count < dma->buf_count)
goto done;
- if ((dev->use_agp && (dma->flags & _DRM_DMA_USE_AGP)) ||
- (dev->use_sg && (dma->flags & _DRM_DMA_USE_SG))) {
+ if ((dev->driver.use_agp && (dma->flags & _DRM_DMA_USE_AGP)) ||
+ (dev->driver.use_sg && (dma->flags & _DRM_DMA_USE_SG))) {
drm_local_map_t *map = dev->agp_buffer_map;
if (map == NULL) {
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
index 11e87814..11d23c6f 100644
--- a/bsd-core/drm_context.c
+++ b/bsd-core/drm_context.c
@@ -265,9 +265,9 @@ int drm_addctx(DRM_IOCTL_ARGS)
return DRM_ERR(ENOMEM);
}
- if (dev->context_ctor && ctx.handle != DRM_KERNEL_CONTEXT) {
+ if (dev->driver.context_ctor && ctx.handle != DRM_KERNEL_CONTEXT) {
DRM_LOCK();
- dev->context_ctor(dev, ctx.handle);
+ dev->driver.context_ctor(dev, ctx.handle);
DRM_UNLOCK();
}
@@ -329,9 +329,9 @@ int drm_rmctx(DRM_IOCTL_ARGS)
DRM_DEBUG( "%d\n", ctx.handle );
if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
- if (dev->context_dtor) {
+ if (dev->driver.context_dtor) {
DRM_LOCK();
- dev->context_dtor(dev, ctx.handle);
+ dev->driver.context_dtor(dev, ctx.handle);
DRM_UNLOCK();
}
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 6377d71e..67b3fe2d 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -121,8 +121,8 @@ int drm_dma(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
- if (dev->dma_ioctl) {
- return dev->dma_ioctl(kdev, cmd, data, flags, p, filp);
+ if (dev->driver.dma_ioctl) {
+ return dev->driver.dma_ioctl(kdev, cmd, data, flags, p, filp);
} else {
DRM_DEBUG("DMA ioctl on driver with no dma handler\n");
return EINVAL;
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index a12aac68..fd645163 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -36,8 +36,8 @@
int drm_debug_flag = 0;
-static int drm_init(drm_device_t *dev);
-static void drm_cleanup(drm_device_t *dev);
+static int drm_load(drm_device_t *dev);
+static void drm_unload(drm_device_t *dev);
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
drm_pci_id_list_t *idlist);
@@ -186,12 +186,12 @@ int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
pci_get_device(nbdev), idlist);
dev->id_entry = id_entry;
- return drm_init(dev);
+ return drm_load(dev);
}
int drm_detach(device_t dev)
{
- drm_cleanup(device_get_softc(dev));
+ drm_unload(device_get_softc(dev));
return 0;
}
@@ -296,6 +296,7 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,
{
int i;
drm_device_t *dev;
+ drm_pci_id_list_t *id_entry;
config_makeroom(kdev, &drm_cd);
drm_cd.cd_devs[(kdev)] = malloc(sizeof(drm_device_t), M_DRM, M_WAITOK);
@@ -315,13 +316,13 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,
PCI_PRODUCT(pa->pa_id), idlist);
dev->driver.pci_id_entry = id_entry;
- DRM_INFO("%s", drm_find_description(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id), idlist));
- drm_init(dev);
+ DRM_INFO("%s", id_entry->name);
+ drm_load(dev);
}
int drm_detach(struct device *self, int flags)
{
- drm_cleanup((drm_device_t *)self);
+ drm_unload((drm_device_t *)self);
return 0;
}
@@ -354,19 +355,18 @@ drm_pci_id_list_t *drm_find_description(int vendor, int device,
return NULL;
}
-/* Initialize the DRM on first open. */
-static int drm_setup(drm_device_t *dev)
+static int drm_firstopen(drm_device_t *dev)
{
int i;
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
- if (dev->presetup)
- dev->presetup(dev);
+ if (dev->driver.firstopen)
+ dev->driver.firstopen(dev);
dev->buf_use = 0;
- if (dev->use_dma) {
+ if (dev->driver.use_dma) {
i = drm_dma_setup(dev);
if (i != 0)
return i;
@@ -403,14 +403,10 @@ static int drm_setup(drm_device_t *dev)
DRM_DEBUG( "\n" );
- if (dev->postsetup)
- dev->postsetup(dev);
-
return 0;
}
-/* Free resources associated with the DRM on the last close. */
-static int drm_takedown(drm_device_t *dev)
+static int drm_lastclose(drm_device_t *dev)
{
drm_magic_entry_t *pt, *next;
drm_local_map_t *map, *mapsave;
@@ -420,8 +416,8 @@ static int drm_takedown(drm_device_t *dev)
DRM_DEBUG( "\n" );
- if (dev->pretakedown != NULL)
- dev->pretakedown(dev);
+ if (dev->driver.lastclose != NULL)
+ dev->driver.lastclose(dev);
if (dev->irq_enabled)
drm_irq_uninstall(dev);
@@ -445,8 +441,9 @@ static int drm_takedown(drm_device_t *dev)
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
- /* Remove AGP resources, but leave dev->agp
- intact until drm_cleanup is called. */
+ /* Remove AGP resources, but leave dev->agp intact until
+ * drm_unload is called.
+ */
for ( entry = dev->agp->memory ; entry ; entry = nexte ) {
nexte = entry->next;
if ( entry->bound )
@@ -481,13 +478,10 @@ static int drm_takedown(drm_device_t *dev)
return 0;
}
-/* linux: drm_init is called via init_module at module load time, or via
- * linux/init/main.c (this is not currently supported).
- * bsd: drm_init is called via the attach function per device.
- */
-static int drm_init(drm_device_t *dev)
+static int drm_load(drm_device_t *dev)
{
int retcode;
+
DRM_DEBUG( "\n" );
dev->irq = pci_get_irq(dev->device);
@@ -505,16 +499,16 @@ static int drm_init(drm_device_t *dev)
#endif
TAILQ_INIT(&dev->files);
- if (dev->preinit != NULL) {
- retcode = dev->preinit(dev, dev->id_entry->driver_private);
+ if (dev->driver.load != NULL) {
+ retcode = dev->driver.load(dev, dev->id_entry->driver_private);
if (retcode != 0)
goto error;
}
- if (dev->use_agp) {
+ if (dev->driver.use_agp) {
if (drm_device_is_agp(dev))
dev->agp = drm_agp_init();
- if (dev->require_agp && dev->agp == NULL) {
+ if (dev->driver.require_agp && dev->agp == NULL) {
DRM_ERROR("Card isn't AGP, or couldn't initialize "
"AGP.\n");
retcode = DRM_ERR(ENOMEM);
@@ -534,14 +528,11 @@ static int drm_init(drm_device_t *dev)
}
DRM_INFO("Initialized %s %d.%d.%d %s\n",
- dev->driver_name,
- dev->driver_major,
- dev->driver_minor,
- dev->driver_patchlevel,
- dev->driver_date);
-
- if (dev->postinit != NULL)
- dev->postinit(dev, 0);
+ dev->driver.name,
+ dev->driver.major,
+ dev->driver.minor,
+ dev->driver.patchlevel,
+ dev->driver.date);
return 0;
@@ -550,7 +541,7 @@ error:
drm_sysctl_cleanup(dev);
#endif
DRM_LOCK();
- drm_takedown(dev);
+ drm_lastclose(dev);
DRM_UNLOCK();
#ifdef __FreeBSD__
destroy_dev(dev->devnode);
@@ -561,11 +552,7 @@ error:
return retcode;
}
-/* linux: drm_cleanup is called via cleanup_module at module unload time.
- * bsd: drm_cleanup is called per device at module unload time.
- * FIXME: NetBSD
- */
-static void drm_cleanup(drm_device_t *dev)
+static void drm_unload(drm_device_t *dev)
{
DRM_DEBUG( "\n" );
@@ -585,7 +572,7 @@ static void drm_cleanup(drm_device_t *dev)
}
DRM_LOCK();
- drm_takedown(dev);
+ drm_lastclose(dev);
DRM_UNLOCK();
if ( dev->agp ) {
@@ -594,8 +581,8 @@ static void drm_cleanup(drm_device_t *dev)
dev->agp = NULL;
}
- if (dev->postcleanup != NULL)
- dev->postcleanup(dev);
+ if (dev->driver.unload != NULL)
+ dev->driver.unload(dev);
drm_mem_uninit();
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
@@ -621,13 +608,13 @@ int drm_version(DRM_IOCTL_ARGS)
return DRM_ERR(EFAULT); \
}
- version.version_major = dev->driver_major;
- version.version_minor = dev->driver_minor;
- version.version_patchlevel = dev->driver_patchlevel;
+ version.version_major = dev->driver.major;
+ version.version_minor = dev->driver.minor;
+ version.version_patchlevel = dev->driver.patchlevel;
- DRM_COPY(version.name, dev->driver_name);
- DRM_COPY(version.date, dev->driver_date);
- DRM_COPY(version.desc, dev->driver_desc);
+ DRM_COPY(version.name, dev->driver.name);
+ DRM_COPY(version.date, dev->driver.date);
+ DRM_COPY(version.desc, dev->driver.desc);
DRM_COPY_TO_USER_IOCTL( (drm_version_t *)data, version, sizeof(version) );
@@ -652,7 +639,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_busy(dev->device);
#endif
if ( !dev->open_count++ )
- retcode = drm_setup(dev);
+ retcode = drm_firstopen(dev);
DRM_UNLOCK();
}
@@ -677,8 +664,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
return EINVAL;
}
- if (dev->prerelease != NULL)
- dev->prerelease(dev, filp);
+ if (dev->driver.preclose != NULL)
+ dev->driver.preclose(dev, filp);
/* ========================================================
* Begin inline drm_release
@@ -697,8 +684,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
DRM_DEBUG("Process %d dead, freeing lock for context %d\n",
DRM_CURRENTPID,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
- if (dev->release != NULL)
- dev->release(dev, filp);
+ if (dev->driver.reclaim_buffers_locked != NULL)
+ dev->driver.reclaim_buffers_locked(dev, filp);
drm_lock_free(dev, &dev->lock.hw_lock->lock,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
@@ -707,7 +694,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
hardware at this point, possibly
processed via a callback to the X
server. */
- } else if (dev->release != NULL && dev->lock.hw_lock != NULL) {
+ } else if (dev->driver.reclaim_buffers_locked != NULL &&
+ dev->lock.hw_lock != NULL) {
/* The lock is required to reclaim buffers */
for (;;) {
if ( !dev->lock.hw_lock ) {
@@ -734,14 +722,14 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
break;
}
if (retcode == 0) {
- dev->release(dev, filp);
+ dev->driver.reclaim_buffers_locked(dev, filp);
drm_lock_free(dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT);
}
}
- if (dev->use_dma)
- drm_reclaim_buffers(dev, (void *)(uintptr_t)priv->pid);
+ if (dev->driver.use_dma && !dev->driver.reclaim_buffers_locked)
+ drm_reclaim_buffers(dev, filp);
#if defined (__FreeBSD__) && (__FreeBSD_version >= 500000)
funsetown(&dev->buf_sigio);
@@ -752,8 +740,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
#endif /* __NetBSD__ || __OpenBSD__ */
if (--priv->refs == 0) {
- if (dev->free_filp_priv != NULL)
- dev->free_filp_priv(dev, priv);
+ if (dev->driver.postclose != NULL)
+ dev->driver.postclose(dev, priv);
TAILQ_REMOVE(&dev->files, priv, link);
free(priv, M_DRM);
}
@@ -767,7 +755,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_unbusy(dev->device);
#endif
if (--dev->open_count == 0) {
- retcode = drm_takedown(dev);
+ retcode = drm_lastclose(dev);
}
DRM_UNLOCK();
@@ -846,12 +834,12 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) {
/* The array entries begin at DRM_COMMAND_BASE ioctl nr */
nr -= DRM_COMMAND_BASE;
- if (nr > dev->max_driver_ioctl) {
+ if (nr > dev->driver.max_ioctl) {
DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n",
- nr, dev->max_driver_ioctl);
+ nr, dev->driver.max_ioctl);
return EINVAL;
}
- ioctl = &dev->driver_ioctls[nr];
+ ioctl = &dev->driver.ioctls[nr];
is_driver_ioctl = 1;
}
func = ioctl->func;
diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c
index 18c08e10..b15fd056 100644
--- a/bsd-core/drm_fops.c
+++ b/bsd-core/drm_fops.c
@@ -90,8 +90,8 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
priv->ioctl_count = 0;
priv->authenticated = !DRM_SUSER(p);
- if (dev->open_helper) {
- retcode = dev->open_helper(dev, priv);
+ if (dev->driver.open) {
+ retcode = dev->driver.open(dev, priv);
if (retcode != 0) {
free(priv, M_DRM);
DRM_UNLOCK();
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c
index 9079e69b..e22faa83 100644
--- a/bsd-core/drm_ioctl.c
+++ b/bsd-core/drm_ioctl.c
@@ -261,8 +261,8 @@ int drm_setversion(DRM_IOCTL_ARGS)
retv.drm_di_major = DRM_IF_MAJOR;
retv.drm_di_minor = DRM_IF_MINOR;
- retv.drm_dd_major = dev->driver_major;
- retv.drm_dd_minor = dev->driver_minor;
+ retv.drm_dd_major = dev->driver.major;
+ retv.drm_dd_minor = dev->driver.minor;
DRM_COPY_TO_USER_IOCTL((drm_set_version_t *)data, retv, sizeof(sv));
@@ -281,8 +281,8 @@ int drm_setversion(DRM_IOCTL_ARGS)
}
if (sv.drm_dd_major != -1) {
- if (sv.drm_dd_major != dev->driver_major ||
- sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver_minor)
+ if (sv.drm_dd_major != dev->driver.major ||
+ sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver.minor)
return EINVAL;
}
return 0;
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index b23ba909..5f44f918 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -61,7 +61,7 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
drm_device_t *dev = (drm_device_t *)arg;
DRM_SPINLOCK(&dev->irq_lock);
- dev->irq_handler(arg);
+ dev->driver.irq_handler(arg);
DRM_SPINUNLOCK(&dev->irq_lock);
}
#endif
@@ -90,7 +90,7 @@ int drm_irq_install(drm_device_t *dev)
DRM_SPININIT(dev->irq_lock, "DRM IRQ lock");
/* Before installing handler */
- dev->irq_preinstall(dev);
+ dev->driver.irq_preinstall(dev);
DRM_UNLOCK();
/* Install handler */
@@ -126,7 +126,7 @@ int drm_irq_install(drm_device_t *dev)
/* After installing handler */
DRM_LOCK();
- dev->irq_postinstall(dev);
+ dev->driver.irq_postinstall(dev);
DRM_UNLOCK();
return 0;
@@ -162,7 +162,7 @@ int drm_irq_uninstall(drm_device_t *dev)
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
- dev->irq_uninstall(dev);
+ dev->driver.irq_uninstall(dev);
#ifdef __FreeBSD__
DRM_UNLOCK();
@@ -190,14 +190,14 @@ int drm_control(DRM_IOCTL_ARGS)
/* Handle drivers whose DRM used to require IRQ setup but the
* no longer does.
*/
- if (!dev->use_irq)
+ if (!dev->driver.use_irq)
return 0;
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
ctl.irq != dev->irq)
return DRM_ERR(EINVAL);
return drm_irq_install(dev);
case DRM_UNINST_HANDLER:
- if (!dev->use_irq)
+ if (!dev->driver.use_irq)
return 0;
DRM_LOCK();
err = drm_irq_uninstall(dev);
@@ -248,7 +248,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
ret = EINVAL;
} else {
DRM_LOCK();
- ret = dev->vblank_wait(dev, &vblwait.request.sequence);
+ ret = dev->driver.vblank_wait(dev, &vblwait.request.sequence);
DRM_UNLOCK();
microtime(&now);
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
index 1b2beaa0..d0e61d3a 100644
--- a/bsd-core/drm_lock.c
+++ b/bsd-core/drm_lock.c
@@ -112,7 +112,7 @@ int drm_lock(DRM_IOCTL_ARGS)
DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
lock.context, DRM_CURRENTPID, dev->lock.hw_lock->lock, lock.flags);
- if (dev->use_dma_queue && lock.context < 0)
+ if (dev->driver.use_dma_queue && lock.context < 0)
return EINVAL;
DRM_LOCK();
@@ -143,8 +143,9 @@ int drm_lock(DRM_IOCTL_ARGS)
/* XXX: Add signal blocking here */
- if (dev->dma_quiescent != NULL && (lock.flags & _DRM_LOCK_QUIESCENT))
- dev->dma_quiescent(dev);
+ if (dev->driver.dma_quiescent != NULL &&
+ (lock.flags & _DRM_LOCK_QUIESCENT))
+ dev->driver.dma_quiescent(dev);
return 0;
}
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
index aa6bee41..b2d0cc0c 100644
--- a/bsd-core/drm_sysctl.c
+++ b/bsd-core/drm_sysctl.c
@@ -127,7 +127,7 @@ static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
int retcode;
int hasunique = 0;
- DRM_SYSCTL_PRINT("%s 0x%x", dev->driver_name, dev2udev(dev->devnode));
+ DRM_SYSCTL_PRINT("%s 0x%x", dev->driver.name, dev2udev(dev->devnode));
DRM_LOCK();
if (dev->unique) {
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index e2c58c7f..d9906141 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -45,29 +45,29 @@ extern int i915_max_ioctl;
static void i915_configure(drm_device_t *dev)
{
- dev->dev_priv_size = 1; /* No dev_priv */
- dev->prerelease = i915_driver_prerelease;
- dev->pretakedown = i915_driver_pretakedown;
- dev->device_is_agp = i915_driver_device_is_agp,
- dev->irq_preinstall = i915_driver_irq_preinstall;
- dev->irq_postinstall = i915_driver_irq_postinstall;
- dev->irq_uninstall = i915_driver_irq_uninstall;
- dev->irq_handler = i915_driver_irq_handler;
+ dev->buf_priv_size = 1; /* No dev_priv */
+ dev->preclose = i915_driver_preclose;
+ dev->lastclose = i915_driver_lastclose;
+ dev->device_is_agp = i915_driver_device_is_agp,
+ dev->irq_preinstall = i915_driver_irq_preinstall;
+ dev->irq_postinstall = i915_driver_irq_postinstall;
+ dev->irq_uninstall = i915_driver_irq_uninstall;
+ dev->irq_handler = i915_driver_irq_handler;
- dev->driver_ioctls = i915_ioctls;
- dev->max_driver_ioctl = i915_max_ioctl;
+ dev->ioctls = i915_ioctls;
+ dev->max_ioctl = i915_max_ioctl;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver_name = DRIVER_NAME;
+ dev->driver_desc = DRIVER_DESC;
+ dev->driver_date = DRIVER_DATE;
+ dev->driver_major = DRIVER_MAJOR;
+ dev->driver_minor = DRIVER_MINOR;
+ dev->driver_patchlevel = DRIVER_PATCHLEVEL;
- dev->use_agp = 1;
- dev->require_agp = 1;
- dev->use_mtrr = 1;
- dev->use_irq = 1;
+ dev->use_agp = 1;
+ dev->require_agp = 1;
+ dev->use_mtrr = 1;
+ dev->use_irq = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c
index a1235799..e63f56e5 100644
--- a/bsd-core/mach64_drv.c
+++ b/bsd-core/mach64_drv.c
@@ -49,31 +49,31 @@ extern int mach64_max_ioctl;
static void mach64_configure(drm_device_t *dev)
{
- dev->dev_priv_size = 1; /* No dev_priv */
- dev->pretakedown = mach64_driver_pretakedown;
- dev->vblank_wait = mach64_driver_vblank_wait;
- dev->irq_preinstall = mach64_driver_irq_preinstall;
- dev->irq_postinstall = mach64_driver_irq_postinstall;
- dev->irq_uninstall = mach64_driver_irq_uninstall;
- dev->irq_handler = mach64_driver_irq_handler;
- dev->dma_ioctl = mach64_dma_buffers;
-
- dev->driver_ioctls = mach64_ioctls;
- dev->max_driver_ioctl = mach64_max_ioctl;
-
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
-
- dev->use_agp = 1;
- dev->use_mtrr = 1;
- dev->use_pci_dma = 1;
- dev->use_dma = 1;
- dev->use_irq = 1;
- dev->use_vbl_irq = 1;
+ dev->driver.buf_priv_size = 1; /* No dev_priv */
+ dev->driver.lastclose = mach64_driver_lastclose;
+ dev->driver.vblank_wait = mach64_driver_vblank_wait;
+ dev->driver.irq_preinstall = mach64_driver_irq_preinstall;
+ dev->driver.irq_postinstall = mach64_driver_irq_postinstall;
+ dev->driver.irq_uninstall = mach64_driver_irq_uninstall;
+ dev->driver.irq_handler = mach64_driver_irq_handler;
+ dev->driver.dma_ioctl = mach64_dma_buffers;
+
+ dev->driver.ioctls = mach64_ioctls;
+ dev->driver.max_ioctl = mach64_max_ioctl;
+
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
+
+ dev->driver.use_agp = 1;
+ dev->driver.use_mtrr = 1;
+ dev->driver.use_pci_dma = 1;
+ dev->driver.use_dma = 1;
+ dev->driver.use_irq = 1;
+ dev->driver.use_vbl_irq = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index 04124c06..c95561a8 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -69,36 +69,35 @@ static int mga_driver_device_is_agp(drm_device_t * dev)
static void mga_configure(drm_device_t *dev)
{
- dev->dev_priv_size = sizeof(drm_mga_buf_priv_t);
- /* XXX dev->prerelease = mga_driver_prerelease; */
- dev->preinit = mga_driver_preinit;
- dev->postcleanup = mga_driver_postcleanup;
- dev->vblank_wait = mga_driver_vblank_wait;
- dev->irq_preinstall = mga_driver_irq_preinstall;
- dev->irq_postinstall = mga_driver_irq_postinstall;
- dev->irq_uninstall = mga_driver_irq_uninstall;
- dev->irq_handler = mga_driver_irq_handler;
- dev->dma_ioctl = mga_dma_buffers;
- dev->pretakedown = mga_driver_pretakedown;
- dev->dma_quiescent = mga_driver_dma_quiescent;
- dev->device_is_agp = mga_driver_device_is_agp;
-
- dev->driver_ioctls = mga_ioctls;
- dev->max_driver_ioctl = mga_max_ioctl;
-
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
-
- dev->use_agp = 1;
- dev->require_agp = 1;
- dev->use_mtrr = 1;
- dev->use_dma = 1;
- dev->use_irq = 1;
- dev->use_vbl_irq = 1;
+ dev->driver.buf_priv_size = sizeof(drm_mga_buf_priv_t);
+ dev->driver.load = mga_driver_load;
+ dev->driver.unload = mga_driver_unload;
+ dev->driver.lastclose = mga_driver_lastclose;
+ dev->driver.vblank_wait = mga_driver_vblank_wait;
+ dev->driver.irq_preinstall = mga_driver_irq_preinstall;
+ dev->driver.irq_postinstall = mga_driver_irq_postinstall;
+ dev->driver.irq_uninstall = mga_driver_irq_uninstall;
+ dev->driver.irq_handler = mga_driver_irq_handler;
+ dev->driver.dma_ioctl = mga_dma_buffers;
+ dev->driver.dma_quiescent = mga_driver_dma_quiescent;
+ dev->driver.device_is_agp = mga_driver_device_is_agp;
+
+ dev->driver.ioctls = mga_ioctls;
+ dev->driver.max_ioctl = mga_max_ioctl;
+
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
+
+ dev->driver.use_agp = 1;
+ dev->driver.require_agp = 1;
+ dev->driver.use_mtrr = 1;
+ dev->driver.use_dma = 1;
+ dev->driver.use_irq = 1;
+ dev->driver.use_vbl_irq = 1;
}
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index 94f4ce79..a0e44c20 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -47,33 +47,33 @@ extern int r128_max_ioctl;
static void r128_configure(drm_device_t *dev)
{
- dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
- dev->prerelease = r128_driver_prerelease;
- dev->pretakedown = r128_driver_pretakedown;
- dev->vblank_wait = r128_driver_vblank_wait;
- dev->irq_preinstall = r128_driver_irq_preinstall;
- dev->irq_postinstall = r128_driver_irq_postinstall;
- dev->irq_uninstall = r128_driver_irq_uninstall;
- dev->irq_handler = r128_driver_irq_handler;
- dev->dma_ioctl = r128_cce_buffers;
+ dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
+ dev->driver.preclose = r128_driver_preclose;
+ dev->driver.lastclose = r128_driver_lastclose;
+ dev->driver.vblank_wait = r128_driver_vblank_wait;
+ dev->driver.irq_preinstall = r128_driver_irq_preinstall;
+ dev->driver.irq_postinstall = r128_driver_irq_postinstall;
+ dev->driver.irq_uninstall = r128_driver_irq_uninstall;
+ dev->driver.irq_handler = r128_driver_irq_handler;
+ dev->driver.dma_ioctl = r128_cce_buffers;
- dev->driver_ioctls = r128_ioctls;
- dev->max_driver_ioctl = r128_max_ioctl;
+ dev->driver.ioctls = r128_ioctls;
+ dev->driver.max_ioctl = r128_max_ioctl;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
- dev->use_agp = 1;
- dev->use_mtrr = 1;
- dev->use_pci_dma = 1;
- dev->use_sg = 1;
- dev->use_dma = 1;
- dev->use_irq = 1;
- dev->use_vbl_irq = 1;
+ dev->driver.use_agp = 1;
+ dev->driver.use_mtrr = 1;
+ dev->driver.use_pci_dma = 1;
+ dev->driver.use_sg = 1;
+ dev->driver.use_dma = 1;
+ dev->driver.use_irq = 1;
+ dev->driver.use_vbl_irq = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
index 78079b72..bd59db63 100644
--- a/bsd-core/radeon_drv.c
+++ b/bsd-core/radeon_drv.c
@@ -45,37 +45,38 @@ extern int radeon_max_ioctl;
static void radeon_configure(drm_device_t *dev)
{
- dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
- dev->preinit = radeon_preinit;
- dev->postcleanup = radeon_postcleanup;
- dev->prerelease = radeon_driver_prerelease;
- dev->pretakedown = radeon_driver_pretakedown;
- dev->open_helper = radeon_driver_open_helper;
- dev->free_filp_priv = radeon_driver_free_filp_priv;
- dev->vblank_wait = radeon_driver_vblank_wait;
- dev->irq_preinstall = radeon_driver_irq_preinstall;
- dev->irq_postinstall = radeon_driver_irq_postinstall;
- dev->irq_uninstall = radeon_driver_irq_uninstall;
- dev->irq_handler = radeon_driver_irq_handler;
- dev->dma_ioctl = radeon_cp_buffers;
+ dev->driver.buf_priv_size = sizeof(drm_radeon_buf_priv_t);
+ dev->driver.load = radeon_driver_load;
+ dev->driver.unload = radeon_driver_unload;
+ dev->driver.firstopen = radeon_driver_firstopen;
+ dev->driver.open = radeon_driver_open;
+ dev->driver.preclose = radeon_driver_preclose;
+ dev->driver.postclose = radeon_driver_postclose;
+ dev->driver.lastclose = radeon_driver_lastclose;
+ dev->driver.vblank_wait = radeon_driver_vblank_wait;
+ dev->driver.irq_preinstall = radeon_driver_irq_preinstall;
+ dev->driver.irq_postinstall = radeon_driver_irq_postinstall;
+ dev->driver.irq_uninstall = radeon_driver_irq_uninstall;
+ dev->driver.irq_handler = radeon_driver_irq_handler;
+ dev->driver.dma_ioctl = radeon_cp_buffers;
- dev->driver_ioctls = radeon_ioctls;
- dev->max_driver_ioctl = radeon_max_ioctl;
+ dev->driver.ioctls = radeon_ioctls;
+ dev->driver.max_ioctl = radeon_max_ioctl;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
- dev->use_agp = 1;
- dev->use_mtrr = 1;
- dev->use_pci_dma = 1;
- dev->use_sg = 1;
- dev->use_dma = 1;
- dev->use_irq = 1;
- dev->use_vbl_irq = 1;
+ dev->driver.use_agp = 1;
+ dev->driver.use_mtrr = 1;
+ dev->driver.use_pci_dma = 1;
+ dev->driver.use_sg = 1;
+ dev->driver.use_dma = 1;
+ dev->driver.use_irq = 1;
+ dev->driver.use_vbl_irq = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c
index a75a69ff..c9a2fb10 100644
--- a/bsd-core/savage_drv.c
+++ b/bsd-core/savage_drv.c
@@ -42,26 +42,28 @@ extern int savage_max_ioctl;
static void savage_configure(drm_device_t *dev)
{
- dev->dev_priv_size = sizeof(drm_savage_buf_priv_t);
- dev->preinit = savage_preinit;
- dev->postcleanup = savage_postcleanup;
- dev->reclaim_buffers = savage_reclaim_buffers;
- dev->dma_ioctl = savage_bci_buffers;
+ dev->driver.buf_priv_size = sizeof(drm_savage_buf_priv_t);
+ dev->load = savage_driver_load;
+ dev->firstopen = savage_driver_firstopen;
+ dev->lastclose = savage_driver_lastclose;
+ dev->unload = savage_driver_unload;
+ dev->reclaim_buffers = savage_reclaim_buffers;
+ dev->dma_ioctl = savage_bci_buffers;
- dev->driver_ioctls = savage_ioctls;
- dev->max_driver_ioctl = savage_max_ioctl;
+ dev->ioctls = savage_ioctls;
+ dev->max_ioctl = savage_max_ioctl;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
- dev->use_agp = 1;
- dev->use_mtrr = 1;
- dev->use_pci_dma = 1;
- dev->use_dma = 1;
+ dev->use_agp = 1;
+ dev->use_mtrr = 1;
+ dev->use_pci_dma = 1;
+ dev->use_dma = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
index 6aa25937..342c7385 100644
--- a/bsd-core/sis_drv.c
+++ b/bsd-core/sis_drv.c
@@ -41,22 +41,22 @@ extern int sis_max_ioctl;
static void sis_configure(drm_device_t *dev)
{
- dev->dev_priv_size = 1; /* No dev_priv */
- dev->context_ctor = sis_init_context;
- dev->context_dtor = sis_final_context;
+ dev->driver.buf_priv_size = 1; /* No dev_priv */
+ dev->driver.context_ctor = sis_init_context;
+ dev->driver.context_dtor = sis_final_context;
- dev->driver_ioctls = sis_ioctls;
- dev->max_driver_ioctl = sis_max_ioctl;
+ dev->driver.ioctls = sis_ioctls;
+ dev->driver.max_ioctl = sis_max_ioctl;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
- dev->use_agp = 1;
- dev->use_mtrr = 1;
+ dev->driver.use_agp = 1;
+ dev->driver.use_mtrr = 1;
}
#ifdef __FreeBSD__
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
index 98ae9ae5..40a552b9 100644
--- a/bsd-core/tdfx_drv.c
+++ b/bsd-core/tdfx_drv.c
@@ -46,18 +46,18 @@ extern int tdfx_max_ioctl;
static void tdfx_configure(drm_device_t *dev)
{
- dev->dev_priv_size = 1; /* No dev_priv */
+ dev->driver.buf_priv_size = 1; /* No dev_priv */
- dev->max_driver_ioctl = 0;
+ dev->driver.max_ioctl = 0;
- dev->driver_name = DRIVER_NAME;
- dev->driver_desc = DRIVER_DESC;
- dev->driver_date = DRIVER_DATE;
- dev->driver_major = DRIVER_MAJOR;
- dev->driver_minor = DRIVER_MINOR;
- dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+ dev->driver.name = DRIVER_NAME;
+ dev->driver.desc = DRIVER_DESC;
+ dev->driver.date = DRIVER_DATE;
+ dev->driver.major = DRIVER_MAJOR;
+ dev->driver.minor = DRIVER_MINOR;
+ dev->driver.patchlevel = DRIVER_PATCHLEVEL;
- dev->use_mtrr = 1;
+ dev->driver.use_mtrr = 1;
}
#ifdef __FreeBSD__
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index ca415b8f..2b4dbcf6 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -526,18 +526,14 @@ typedef struct drm_vbl_sig {
*/
struct drm_device;
struct drm_driver {
- int (*preinit) (struct drm_device *, unsigned long flags);
- void (*prerelease) (struct drm_device *, struct file * filp);
- void (*pretakedown) (struct drm_device *);
- int (*postcleanup) (struct drm_device *);
- int (*presetup) (struct drm_device *);
- int (*postsetup) (struct drm_device *);
+ int (*load) (struct drm_device *, unsigned long flags);
+ int (*firstopen) (struct drm_device *);
+ int (*open) (struct drm_device *, drm_file_t *);
+ void (*preclose) (struct drm_device *, struct file * filp);
+ void (*postclose) (struct drm_device *, drm_file_t *);
+ void (*lastclose) (struct drm_device *);
+ int (*unload) (struct drm_device *);
int (*dma_ioctl) (DRM_IOCTL_ARGS);
- /* these are opposites at the moment */
- int (*open_helper) (struct drm_device *, drm_file_t *);
- void (*free_filp_priv) (struct drm_device *, drm_file_t *);
-
- void (*release) (struct drm_device *, struct file * filp);
void (*dma_ready) (struct drm_device *);
int (*dma_quiescent) (struct drm_device *);
int (*context_ctor) (struct drm_device * dev, int context);
@@ -562,16 +558,25 @@ struct drm_driver {
int (*device_is_agp) (struct drm_device * dev);
/* these have to be filled in */
- int (*postinit) (struct drm_device *, unsigned long flags);
irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
void (*irq_preinstall) (struct drm_device * dev);
void (*irq_postinstall) (struct drm_device * dev);
void (*irq_uninstall) (struct drm_device * dev);
void (*reclaim_buffers) (struct drm_device *dev, struct file * filp);
+ void (*reclaim_buffers_locked) (struct drm_device *dev,
+ struct file * filp);
unsigned long (*get_map_ofs) (drm_map_t * map);
unsigned long (*get_reg_ofs) (struct drm_device * dev);
void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
int (*version) (drm_version_t * version);
+
+ int major;
+ int minor;
+ int patchlevel;
+ char *name;
+ char *desc;
+ char *date;
+
/* variables */
u32 driver_features;
int dev_priv_size;
@@ -766,7 +771,7 @@ extern int drm_ioctl(struct inode *inode, struct file *filp,
extern long drm_compat_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_takedown(drm_device_t * dev);
+extern int drm_lastclose(drm_device_t * dev);
/* Device support (drm_fops.h) */
extern int drm_open(struct inode *inode, struct file *filp);
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 4e4648b9..1ff880e1 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -132,7 +132,7 @@ drm_ioctl_desc_t drm_ioctls[] = {
*
* \sa drm_device
*/
-int drm_takedown(drm_device_t * dev)
+int drm_lastclose(drm_device_t * dev)
{
drm_magic_entry_t *pt, *next;
drm_map_list_t *r_list;
@@ -141,9 +141,9 @@ int drm_takedown(drm_device_t * dev)
DRM_DEBUG("\n");
- if (dev->driver->pretakedown)
- dev->driver->pretakedown(dev);
- DRM_DEBUG("driver pretakedown completed\n");
+ if (dev->driver->lastclose)
+ dev->driver->lastclose(dev);
+ DRM_DEBUG("driver lastclose completed\n");
if (dev->unique) {
drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER);
@@ -243,7 +243,7 @@ int drm_takedown(drm_device_t * dev)
}
up(&dev->struct_sem);
- DRM_DEBUG("takedown completed\n");
+ DRM_DEBUG("lastclose completed\n");
return 0;
}
@@ -331,7 +331,7 @@ EXPORT_SYMBOL(drm_init);
/**
* Called via cleanup_module() at module unload time.
*
- * Cleans up all DRM device, calling takedown().
+ * Cleans up all DRM device, calling drm_lastclose().
*
* \sa drm_init
*/
@@ -344,7 +344,7 @@ static void __exit drm_cleanup(drm_device_t * dev)
return;
}
- drm_takedown(dev);
+ drm_lastclose(dev);
if (dev->maplist) {
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
@@ -369,8 +369,8 @@ static void __exit drm_cleanup(drm_device_t * dev)
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
dev->agp = NULL;
}
- if (dev->driver->postcleanup)
- dev->driver->postcleanup(dev);
+ if (dev->driver->unload)
+ dev->driver->unload(dev);
drm_put_head(&dev->primary);
if (drm_put_dev(dev))
@@ -486,14 +486,17 @@ static int drm_version(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->head->dev;
drm_version_t __user *argp = (void __user *)arg;
drm_version_t version;
- int ret;
+ int len;
if (copy_from_user(&version, argp, sizeof(version)))
return -EFAULT;
- /* version is a required function to return the personality module version */
- if ((ret = dev->driver->version(&version)))
- return ret;
+ version.version_major = dev->driver->major;
+ version.version_minor = dev->driver->minor;
+ version.version_patchlevel = dev->driver->patchlevel;
+ DRM_COPY(version.name, dev->driver->name);
+ DRM_COPY(version.date, dev->driver->date);
+ DRM_COPY(version.desc, dev->driver->desc);
if (copy_to_user(argp, &version, sizeof(version)))
return -EFAULT;
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index ca70c2c8..d7befb80 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -46,8 +46,8 @@ static int drm_setup(drm_device_t * dev)
drm_local_map_t *map;
int i;
- if (dev->driver->presetup)
- dev->driver->presetup(dev);
+ if (dev->driver->firstopen)
+ dev->driver->firstopen(dev);
/* prebuild the SAREA */
i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
@@ -115,8 +115,6 @@ static int drm_setup(drm_device_t * dev)
* drm_select_queue fails between the time the interrupt is
* initialized and the time the queues are initialized.
*/
- if (dev->driver->postsetup)
- dev->driver->postsetup(dev);
return 0;
}
@@ -256,8 +254,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t
priv->authenticated = capable(CAP_SYS_ADMIN);
priv->lock_count = 0;
- if (dev->driver->open_helper) {
- ret = dev->driver->open_helper(dev, priv);
+ if (dev->driver->open) {
+ ret = dev->driver->open(dev, priv);
if (ret < 0)
goto out_free;
}
@@ -341,8 +339,8 @@ int drm_release(struct inode *inode, struct file *filp)
DRM_DEBUG("open_count = %d\n", dev->open_count);
- if (dev->driver->prerelease)
- dev->driver->prerelease(dev, filp);
+ if (dev->driver->preclose)
+ dev->driver->preclose(dev, filp);
/* ========================================================
* Begin inline drm_release
@@ -358,8 +356,8 @@ int drm_release(struct inode *inode, struct file *filp)
DRM_DEBUG("File %p released, freeing lock for context %d\n",
filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
- if (dev->driver->release)
- dev->driver->release(dev, filp);
+ if (dev->driver->reclaim_buffers_locked)
+ dev->driver->reclaim_buffers_locked(dev, filp);
drm_lock_free(dev, &dev->lock.hw_lock->lock,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
@@ -368,7 +366,7 @@ int drm_release(struct inode *inode, struct file *filp)
hardware at this point, possibly
processed via a callback to the X
server. */
- } else if (dev->driver->release && priv->lock_count
+ } else if (dev->driver->reclaim_buffers_locked && priv->lock_count
&& dev->lock.hw_lock) {
/* The lock is required to reclaim buffers */
DECLARE_WAITQUEUE(entry, current);
@@ -398,14 +396,14 @@ int drm_release(struct inode *inode, struct file *filp)
current->state = TASK_RUNNING;
remove_wait_queue(&dev->lock.lock_queue, &entry);
if (!retcode) {
- if (dev->driver->release)
- dev->driver->release(dev, filp);
+ dev->driver->reclaim_buffers_locked(dev, filp);
drm_lock_free(dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT);
}
}
- if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && !dev->driver->release) {
+ if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
+ !dev->driver->reclaim_buffers_locked) {
dev->driver->reclaim_buffers(dev, filp);
}
@@ -452,8 +450,8 @@ int drm_release(struct inode *inode, struct file *filp)
}
up(&dev->struct_sem);
- if (dev->driver->free_filp_priv)
- dev->driver->free_filp_priv(dev, priv);
+ if (dev->driver->postclose)
+ dev->driver->postclose(dev, priv);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
/* ========================================================
@@ -472,7 +470,7 @@ int drm_release(struct inode *inode, struct file *filp)
}
spin_unlock(&dev->count_lock);
unlock_kernel();
- return drm_takedown(dev);
+ return drm_lastclose(dev);
}
spin_unlock(&dev->count_lock);
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index 24f6579f..eac89ea6 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -324,23 +324,13 @@ int drm_setversion(DRM_IOCTL_ARGS)
drm_set_version_t retv;
int if_version;
drm_set_version_t __user *argp = (void __user *)data;
- drm_version_t version;
DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv));
- /*
- * version.name etc need to be initialized to zero.
- * If we don't, driver->version() will poke random strings to
- * random locations in user space, causing X server segfaults
- * that are interesting to debug. --eich
- */
- memset(&version, 0, sizeof(version));
-
- dev->driver->version(&version);
retv.drm_di_major = DRM_IF_MAJOR;
retv.drm_di_minor = DRM_IF_MINOR;
- retv.drm_dd_major = version.version_major;
- retv.drm_dd_minor = version.version_minor;
+ retv.drm_dd_major = dev->driver->major;
+ retv.drm_dd_minor = dev->driver->minor;
DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv));
@@ -359,8 +349,8 @@ int drm_setversion(DRM_IOCTL_ARGS)
}
if (sv.drm_dd_major != -1) {
- if (sv.drm_dd_major != version.version_major ||
- sv.drm_dd_minor < 0 || sv.drm_dd_minor > version.version_minor)
+ if (sv.drm_dd_major != dev->driver->major ||
+ sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver->minor)
return EINVAL;
if (dev->driver->set_version)
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 5496ed89..52b5e9c6 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -94,8 +94,8 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
dev->driver = driver;
- if (dev->driver->preinit)
- if ((retcode = dev->driver->preinit(dev, ent->driver_data)))
+ if (dev->driver->load)
+ if ((retcode = dev->driver->load(dev, ent->driver_data)))
goto error_out_unreg;
if (drm_core_has_AGP(dev)) {
@@ -126,7 +126,7 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
return 0;
error_out_unreg:
- drm_takedown(dev);
+ drm_lastclose(dev);
return retcode;
}
@@ -222,15 +222,12 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
if ((ret = drm_get_head(dev, &dev->primary)))
goto err_g1;
- /* postinit is a required function to display the signon banner */
- /* drivers add secondary heads here if needed */
- if ((ret = dev->driver->postinit(dev, ent->driver_data)))
- goto err_g2;
+ DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
+ driver->name, driver->major, driver->minor, driver->patchlevel,
+ driver->date, dev->primary.minor, pci_pretty_name(dev->pdev));
return 0;
-err_g2:
- drm_put_head(&dev->primary);
err_g1:
if (!drm_fb_loaded) {
pci_set_drvdata(pdev, NULL);
diff --git a/linux-core/ffb_context.c b/linux-core/ffb_context.c
index c2b163ea..e6ae60c3 100644
--- a/linux-core/ffb_context.c
+++ b/linux-core/ffb_context.c
@@ -523,7 +523,7 @@ int ffb_rmctx(struct inode * inode, struct file * filp, unsigned int cmd,
return 0;
}
-static void ffb_driver_release(drm_device_t * dev)
+static void ffb_driver_reclaim_buffers_locked(drm_device_t * dev)
{
ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
@@ -537,21 +537,13 @@ static void ffb_driver_release(drm_device_t * dev)
}
}
-static int ffb_driver_presetup(drm_device_t * dev)
-{
- int ret;
- ret = ffb_presetup(dev);
- if (_ret != 0)
- return ret;
-}
-
-static void ffb_driver_pretakedown(drm_device_t * dev)
+static void ffb_driver_lastclose(drm_device_t * dev)
{
if (dev->dev_private)
kfree(dev->dev_private);
}
-static void ffb_driver_postcleanup(drm_device_t * dev)
+static void ffb_driver_unload(drm_device_t * dev)
{
if (ffb_position != NULL)
kfree(ffb_position);
diff --git a/linux-core/ffb_drv.c b/linux-core/ffb_drv.c
index 8122e95e..7b028c86 100644
--- a/linux-core/ffb_drv.c
+++ b/linux-core/ffb_drv.c
@@ -238,7 +238,7 @@ unsigned long ffb_get_unmapped_area(struct file *filp,
/* This functions must be here since it references drm_numdevs)
* which drm_drv.h declares.
*/
-int ffb_presetup(drm_device_t *dev)
+static int ffb_driver_firstopen(drm_device_t *dev)
{
ffb_dev_priv_t *ffb_priv;
drm_device_t *temp_dev;
@@ -274,49 +274,20 @@ int ffb_presetup(drm_device_t *dev)
#include "drm_pciids.h"
-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(pdev)
- );
- return 0;
-}
-
-static int version( drm_version_t *version )
-{
- int len;
-
- 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[] = {
ffb_PCI_IDS
};
static struct drm_driver ffb_driver = {
- .release = ffb_driver_release,
- .presetup = ffb_driver_presetup,
- .pretakedown = ffb_driver_pretakedown,
- .postcleanup = ffb_driver_postcleanup,
+ .release = ffb_driver_reclaim_buffers_locked,
+ .firstopen = ffb_driver_firstopen,
+ .lastclose = ffb_driver_lastclose,
+ .unload = ffb_driver_unload,
.kernel_context_switch = ffb_context_switch,
.kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
.get_map_ofs = ffb_driver_get_map_ofs,
.get_reg_ofs = ffb_driver_get_reg_ofs,
.reclaim_buffers = drm_core_reclaim_buffers,
- .postinit = postinit,
- .version = version,
fops = {
.owner = THIS_MODULE,
.open = drm_open,
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index 32367324..9e0634a5 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -1341,12 +1341,24 @@ static int i810_flip_bufs(struct inode *inode, struct file *filp,
return 0;
}
-void i810_driver_pretakedown(drm_device_t * dev)
+int i810_driver_load(drm_device_t *dev, unsigned long flags)
+{
+ /* i810 has 4 more counters */
+ 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;
+
+ return 0;
+}
+
+void i810_driver_lastclose(drm_device_t * dev)
{
i810_dma_cleanup(dev);
}
-void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp)
+void i810_driver_preclose(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_i810_private_t *dev_priv = dev->dev_private;
@@ -1356,7 +1368,7 @@ void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp)
}
}
-void i810_driver_release(drm_device_t * dev, struct file *filp)
+void i810_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp)
{
i810_reclaim_buffers(dev, filp);
}
diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c
index f043041b..fca04cc6 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -38,38 +38,6 @@
#include "drm_pciids.h"
-static int postinit(struct drm_device *dev, unsigned long flags)
-{
- /* i810 has 4 more counters */
- 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;
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
- DRIVER_NAME,
- DRIVER_MAJOR,
- DRIVER_MINOR,
- DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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 int dri_library_name(struct drm_device * dev, char * buf)
{
return snprintf(buf, PAGE_SIZE, "i830\n");
@@ -88,16 +56,15 @@ static struct drm_driver driver = {
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE,
.dev_priv_size = sizeof(drm_i810_buf_priv_t),
- .pretakedown = i810_driver_pretakedown,
- .prerelease = i810_driver_prerelease,
+ .load = i810_driver_load,
+ .lastclose = i810_driver_lastclose,
+ .preclose = i810_driver_preclose,
.device_is_agp = i810_driver_device_is_agp,
- .release = i810_driver_release,
+ .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
.dma_quiescent = i810_driver_dma_quiescent,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
.dri_library_name = dri_library_name,
- .postinit = postinit,
- .version = version,
.ioctls = i810_ioctls,
.fops = {
.owner = THIS_MODULE,
diff --git a/linux-core/i810_drv.h b/linux-core/i810_drv.h
index 6f06f09e..65bc77dd 100644
--- a/linux-core/i810_drv.h
+++ b/linux-core/i810_drv.h
@@ -116,9 +116,13 @@ typedef struct drm_i810_private {
extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
extern int i810_driver_dma_quiescent(drm_device_t * dev);
-extern void i810_driver_release(drm_device_t * dev, struct file *filp);
-extern void i810_driver_pretakedown(drm_device_t * dev);
-extern void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp);
+extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev,
+ struct file *filp);
+extern int i810_driver_load(struct drm_device *, unsigned long flags);
+extern void i810_driver_lastclose(drm_device_t * dev);
+extern void i810_driver_preclose(drm_device_t * dev, DRMFILE filp);
+extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev,
+ struct file *filp);
extern int i810_driver_device_is_agp(drm_device_t * dev);
#define I810_BASE(reg) ((unsigned long) \
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 10d9dff6..1c44f70d 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -1524,12 +1524,24 @@ static int i830_setparam(struct inode *inode, struct file *filp,
return 0;
}
-void i830_driver_pretakedown(drm_device_t * dev)
+int i830_driver_load(drm_device_t *dev, unsigned long flags)
+{
+ /* i830 has 4 more counters */
+ 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;
+
+ return 0;
+}
+
+void i830_driver_lastclose(drm_device_t * dev)
{
i830_dma_cleanup(dev);
}
-void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp)
+void i830_driver_preclose(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_i830_private_t *dev_priv = dev->dev_private;
@@ -1539,7 +1551,7 @@ void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp)
}
}
-void i830_driver_release(drm_device_t * dev, struct file *filp)
+void i830_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp)
{
i830_reclaim_buffers(dev, filp);
}
diff --git a/linux-core/i830_drv.c b/linux-core/i830_drv.c
index 6b2955fe..b58b842e 100644
--- a/linux-core/i830_drv.c
+++ b/linux-core/i830_drv.c
@@ -41,36 +41,6 @@
#include "drm_pciids.h"
-int postinit(struct drm_device *dev, unsigned long flags)
-{
- 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;
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
- DRIVER_NAME,
- DRIVER_MAJOR,
- DRIVER_MINOR,
- DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
i830_PCI_IDS
@@ -88,10 +58,11 @@ static struct drm_driver driver = {
.driver_features |= DRIVER_HAVE_IRQ | DRIVER_SHARED_IRQ,
#endif
.dev_priv_size = sizeof(drm_i830_buf_priv_t),
- .pretakedown = i830_driver_pretakedown,
- .prerelease = i830_driver_prerelease,
+ .load = i830_driver_load,
+ .lastclose = i830_driver_lastclose,
+ .preclose = i830_driver_preclose,
.device_is_agp = i830_driver_device_is_agp,
- .release = i830_driver_release,
+ .reclaim_buffers_locked = i830_driver_reclaim_buffers_locked,
.dma_quiescent = i830_driver_dma_quiescent,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
@@ -101,8 +72,6 @@ static struct drm_driver driver = {
.irq_uninstall = i830_driver_irq_uninstall,
.irq_handler = i830_driver_irq_handler,
#endif
- .postinit = postinit,
- .version = version,
.ioctls = i830_ioctls,
.fops = {
.owner = THIS_MODULE,
@@ -118,7 +87,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/i830_drv.h b/linux-core/i830_drv.h
index bf384e2a..1ab980b4 100644
--- a/linux-core/i830_drv.h
+++ b/linux-core/i830_drv.h
@@ -133,10 +133,12 @@ extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
extern void i830_driver_irq_preinstall(drm_device_t * dev);
extern void i830_driver_irq_postinstall(drm_device_t * dev);
extern void i830_driver_irq_uninstall(drm_device_t * dev);
-extern void i830_driver_pretakedown(drm_device_t * dev);
-extern void i830_driver_release(drm_device_t * dev, struct file *filp);
+extern int i830_driver_load(struct drm_device *, unsigned long flags);
+extern void i830_driver_preclose(drm_device_t * dev, DRMFILE filp);
+extern void i830_driver_lastclose(drm_device_t * dev);
+extern void i830_driver_reclaim_buffers_locked(drm_device_t * dev,
+ struct file *filp);
extern int i830_driver_dma_quiescent(drm_device_t * dev);
-extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp);
extern int i830_driver_device_is_agp(drm_device_t * dev);
#define I830_BASE(reg) ((unsigned long) \
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index de6780ec..4e3e59b6 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -34,37 +34,6 @@
#include "drm_pciids.h"
-static int postinit(struct drm_device *dev, unsigned long flags)
-{
- 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;
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
- DRIVER_NAME,
- DRIVER_MAJOR,
- DRIVER_MINOR,
- DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
i915_PCI_IDS
};
@@ -77,8 +46,9 @@ static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
- .pretakedown = i915_driver_pretakedown,
- .prerelease = i915_driver_prerelease,
+ .load = i915_driver_load,
+ .lastclose = i915_driver_lastclose,
+ .preclose = i915_driver_preclose,
.device_is_agp = i915_driver_device_is_agp,
.irq_preinstall = i915_driver_irq_preinstall,
.irq_postinstall = i915_driver_irq_postinstall,
@@ -87,8 +57,6 @@ static struct drm_driver driver = {
.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 = i915_ioctls,
.fops = {
.owner = THIS_MODULE,
@@ -106,7 +74,14 @@ static struct drm_driver driver = {
/* .resume = i915_resume, - need BIOS to re-init */
.suspend = i915_suspend,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/imagine_drv.c b/linux-core/imagine_drv.c
index ec5454ce..bec2fae4 100644
--- a/linux-core/imagine_drv.c
+++ b/linux-core/imagine_drv.c
@@ -30,27 +30,6 @@
static struct drm_driver driver;
-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->primary.minor, pci_pretty_name(dev->pdev));
- return 0;
-}
-
-static int version(drm_version_t *version)
-{
- int len;
-
- 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[] = {
imagine_PCI_IDS
};
@@ -65,8 +44,6 @@ static struct drm_driver driver = {
.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,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -82,6 +59,13 @@ static struct drm_driver driver = {
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
},
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int __init imagine_init(void)
diff --git a/linux-core/mach64_drv.c b/linux-core/mach64_drv.c
index 5852c443..bcf60b59 100644
--- a/linux-core/mach64_drv.c
+++ b/linux-core/mach64_drv.c
@@ -35,31 +35,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
mach64_PCI_IDS
};
@@ -72,7 +47,7 @@ static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_HAVE_DMA
| DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
- .pretakedown = mach64_driver_pretakedown,
+ .lastclose = mach64_driver_lastclose,
.vblank_wait = mach64_driver_vblank_wait,
.irq_preinstall = mach64_driver_irq_preinstall,
.irq_postinstall = mach64_driver_irq_postinstall,
@@ -81,8 +56,6 @@ static struct drm_driver driver = {
.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 = mach64_ioctls,
.dma_ioctl = mach64_dma_buffers,
.fops = {
@@ -99,7 +72,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index 61c3ea06..4dc56031 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -38,41 +38,6 @@
#include "drm_pciids.h"
static int mga_driver_device_is_agp(drm_device_t * dev);
-static int postinit(struct drm_device *dev, unsigned long flags)
-{
- drm_mga_private_t * const dev_priv =
- (drm_mga_private_t *) dev->dev_private;
-
- dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
- dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
-
- dev->counters += 3;
- dev->types[6] = _DRM_STAT_IRQ;
- dev->types[7] = _DRM_STAT_PRIMARY;
- dev->types[8] = _DRM_STAT_SECONDARY;
-
- DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
- DRIVER_NAME,
- DRIVER_MAJOR,
- DRIVER_MINOR,
- DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
mga_PCI_IDS
@@ -87,9 +52,9 @@ static struct drm_driver driver = {
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
DRIVER_IRQ_VBL,
- .preinit = mga_driver_preinit,
- .postcleanup = mga_driver_postcleanup,
- .pretakedown = mga_driver_pretakedown,
+ .load = mga_driver_load,
+ .unload = mga_driver_unload,
+ .lastclose = mga_driver_lastclose,
.dma_quiescent = mga_driver_dma_quiescent,
.device_is_agp = mga_driver_device_is_agp,
.vblank_wait = mga_driver_vblank_wait,
@@ -100,8 +65,6 @@ static struct drm_driver driver = {
.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 = mga_ioctls,
.dma_ioctl = mga_dma_buffers,
.fops = {
@@ -121,7 +84,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index 8b4b7447..b6cff4de 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -37,31 +37,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
r128_PCI_IDS
};
@@ -76,8 +51,8 @@ static struct drm_driver driver = {
DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
DRIVER_IRQ_VBL,
.dev_priv_size = sizeof(drm_r128_buf_priv_t),
- .prerelease = r128_driver_prerelease,
- .pretakedown = r128_driver_pretakedown,
+ .preclose = r128_driver_preclose,
+ .lastclose = r128_driver_lastclose,
.vblank_wait = r128_driver_vblank_wait,
.irq_preinstall = r128_driver_irq_preinstall,
.irq_postinstall = r128_driver_irq_postinstall,
@@ -86,8 +61,6 @@ static struct drm_driver driver = {
.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 = r128_ioctls,
.dma_ioctl = r128_cce_buffers,
.fops = {
@@ -107,7 +80,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c
index a79bdf38..41ca7acf 100644
--- a/linux-core/radeon_drv.c
+++ b/linux-core/radeon_drv.c
@@ -37,30 +37,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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 int dri_library_name(struct drm_device * dev, char * buf)
{
@@ -87,24 +63,22 @@ static struct drm_driver driver = {
DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED |
DRIVER_IRQ_VBL,
.dev_priv_size = sizeof(drm_radeon_buf_priv_t),
- .preinit = radeon_preinit,
- .presetup = radeon_presetup,
- .postcleanup = radeon_postcleanup,
- .prerelease = radeon_driver_prerelease,
- .pretakedown = radeon_driver_pretakedown,
- .open_helper = radeon_driver_open_helper,
+ .load = radeon_driver_load,
+ .firstopen = radeon_driver_firstopen,
+ .open = radeon_driver_open,
+ .preclose = radeon_driver_preclose,
+ .postclose = radeon_driver_postclose,
+ .lastclose = radeon_driver_lastclose,
+ .unload = radeon_driver_unload,
.vblank_wait = radeon_driver_vblank_wait,
.dri_library_name = dri_library_name,
.irq_preinstall = radeon_driver_irq_preinstall,
.irq_postinstall = radeon_driver_irq_postinstall,
.irq_uninstall = radeon_driver_irq_uninstall,
.irq_handler = radeon_driver_irq_handler,
- .free_filp_priv = radeon_driver_free_filp_priv,
.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 = radeon_ioctls,
.dma_ioctl = radeon_cp_buffers,
.fops = {
@@ -124,7 +98,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/savage_drv.c b/linux-core/savage_drv.c
index 5006e6ca..be54bd47 100644
--- a/linux-core/savage_drv.c
+++ b/linux-core/savage_drv.c
@@ -30,33 +30,6 @@
#include "drm_pciids.h"
-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->primary.minor,
- pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version( drm_version_t *version )
-{
- int len;
-
- 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[] = {
savage_PCI_IDS
};
@@ -74,13 +47,13 @@ static struct drm_driver driver = {
DRIVER_USE_AGP | DRIVER_USE_MTRR |
DRIVER_HAVE_DMA | DRIVER_PCI_DMA,
.dev_priv_size = sizeof(drm_savage_buf_priv_t),
- .preinit = savage_preinit,
- .postinit = postinit,
- .postcleanup = savage_postcleanup,
+ .load = savage_driver_load,
+ .firstopen = savage_driver_firstopen,
+ .lastclose = savage_driver_lastclose,
+ .unload = savage_driver_unload,
.reclaim_buffers = savage_reclaim_buffers,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
- .version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = savage_bci_buffers,
@@ -98,7 +71,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c
index b38ae201..e524ae2d 100644
--- a/linux-core/sis_drv.c
+++ b/linux-core/sis_drv.c
@@ -32,31 +32,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
sis_PCI_IDS
};
@@ -72,8 +47,6 @@ static struct drm_driver driver = {
.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 = sis_ioctls,
.fops = {
.owner = THIS_MODULE,
@@ -89,7 +62,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index 9062cb0a..ce1b7c5a 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -36,31 +36,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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[] = {
tdfx_PCI_IDS
};
@@ -71,8 +46,6 @@ static struct drm_driver driver = {
.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,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -87,7 +60,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux/.cvsignore b/linux/.cvsignore
index f9f41807..fb0ce5d2 100644
--- a/linux/.cvsignore
+++ b/linux/.cvsignore
@@ -3,3 +3,4 @@
*.o.cmd
*.mod.c
*.flags
+drm_pciids.h
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index fc4548fd..a474f8ad 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -710,7 +710,19 @@ static int i915_setparam(DRM_IOCTL_ARGS)
return 0;
}
-void i915_driver_pretakedown(drm_device_t * dev)
+int i915_driver_load(drm_device_t *dev, unsigned long flags)
+{
+ /* i915 has 4 more counters */
+ 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;
+
+ return 0;
+}
+
+void i915_driver_lastclose(drm_device_t * dev)
{
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private;
@@ -719,7 +731,7 @@ void i915_driver_pretakedown(drm_device_t * dev)
i915_dma_cleanup(dev);
}
-void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp)
+void i915_driver_preclose(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private;
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h
index 51b1beab..dbef27f5 100644
--- a/shared-core/i915_drv.h
+++ b/shared-core/i915_drv.h
@@ -98,8 +98,9 @@ typedef struct drm_i915_private {
/* i915_dma.c */
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);
+extern int i915_driver_load(struct drm_device *, unsigned long flags);
+extern void i915_driver_lastclose(drm_device_t * dev);
+extern void i915_driver_preclose(drm_device_t * dev, DRMFILE filp);
extern int i915_driver_device_is_agp(drm_device_t * dev);
/* i915_irq.c */
diff --git a/shared-core/mach64_dma.c b/shared-core/mach64_dma.c
index d7e97a99..4c8edeab 100644
--- a/shared-core/mach64_dma.c
+++ b/shared-core/mach64_dma.c
@@ -1519,7 +1519,7 @@ int mach64_dma_buffers(DRM_IOCTL_ARGS)
return ret;
}
-void mach64_driver_pretakedown(drm_device_t * dev)
+void mach64_driver_lastclose(drm_device_t * dev)
{
mach64_do_cleanup_dma(dev);
}
diff --git a/shared-core/mach64_drv.h b/shared-core/mach64_drv.h
index fb3deb2f..29c0aba4 100644
--- a/shared-core/mach64_drv.h
+++ b/shared-core/mach64_drv.h
@@ -114,7 +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 void mach64_driver_lastclose(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-core/mga_dma.c b/shared-core/mga_dma.c
index f0404cc0..31df5d6e 100644
--- a/shared-core/mga_dma.c
+++ b/shared-core/mga_dma.c
@@ -391,7 +391,7 @@ int mga_freelist_put(drm_device_t * dev, drm_buf_t * buf)
* DMA initialization, cleanup
*/
-int mga_driver_preinit(drm_device_t *dev, unsigned long flags)
+int mga_driver_load(drm_device_t *dev, unsigned long flags)
{
drm_mga_private_t * dev_priv;
@@ -405,6 +405,14 @@ int mga_driver_preinit(drm_device_t *dev, unsigned long flags)
dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
dev_priv->chipset = flags;
+ dev_priv->mmio_base = drm_get_resource_start(dev, 1);
+ dev_priv->mmio_size = drm_get_resource_len(dev, 1);
+
+ dev->counters += 3;
+ dev->types[6] = _DRM_STAT_IRQ;
+ dev->types[7] = _DRM_STAT_PRIMARY;
+ dev->types[8] = _DRM_STAT_SECONDARY;
+
return 0;
}
@@ -437,7 +445,6 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
drm_agp_mode_t mode;
drm_agp_info_t info;
-
/* Acquire AGP. */
err = drm_agp_acquire(dev);
if (err) {
@@ -1100,7 +1107,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
/**
* Called just before the module is unloaded.
*/
-int mga_driver_postcleanup(drm_device_t * dev)
+int mga_driver_unload(drm_device_t * dev)
{
drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
dev->dev_private = NULL;
@@ -1111,7 +1118,7 @@ int mga_driver_postcleanup(drm_device_t * dev)
/**
* Called when the last opener of the device is closed.
*/
-void mga_driver_pretakedown(drm_device_t * dev)
+void mga_driver_lastclose(drm_device_t * dev)
{
mga_do_cleanup_dma(dev);
}
diff --git a/shared-core/mga_drv.h b/shared-core/mga_drv.h
index d77bd364..2c13acc7 100644
--- a/shared-core/mga_drv.h
+++ b/shared-core/mga_drv.h
@@ -149,14 +149,14 @@ typedef struct drm_mga_private {
} drm_mga_private_t;
/* mga_dma.c */
-extern int mga_driver_preinit(drm_device_t * dev, unsigned long flags);
extern int mga_dma_bootstrap(DRM_IOCTL_ARGS);
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 int mga_driver_postcleanup(drm_device_t * dev);
-extern void mga_driver_pretakedown(drm_device_t * dev);
+extern int mga_driver_load(drm_device_t *dev, unsigned long flags);
+extern int mga_driver_unload(drm_device_t * dev);
+extern void mga_driver_lastclose(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);
diff --git a/shared-core/r128_drv.h b/shared-core/r128_drv.h
index ae740548..c6bdf563 100644
--- a/shared-core/r128_drv.h
+++ b/shared-core/r128_drv.h
@@ -152,8 +152,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);
+extern void r128_driver_lastclose(drm_device_t * dev);
+extern void r128_driver_preclose(drm_device_t * dev, DRMFILE filp);
extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);
diff --git a/shared-core/r128_state.c b/shared-core/r128_state.c
index d8094452..e4079e85 100644
--- a/shared-core/r128_state.c
+++ b/shared-core/r128_state.c
@@ -1670,7 +1670,7 @@ static int r128_getparam(DRM_IOCTL_ARGS)
return 0;
}
-void r128_driver_prerelease(drm_device_t * dev, DRMFILE filp)
+void r128_driver_preclose(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1680,7 +1680,7 @@ void r128_driver_prerelease(drm_device_t * dev, DRMFILE filp)
}
}
-void r128_driver_pretakedown(drm_device_t * dev)
+void r128_driver_lastclose(drm_device_t * dev)
{
r128_do_cleanup_cce(dev);
}
diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c
index 73cc38dc..8694d043 100644
--- a/shared-core/radeon_cp.c
+++ b/shared-core/radeon_cp.c
@@ -1245,7 +1245,9 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL);
if (on) {
- DRM_DEBUG("programming pcie %08X %08X %08X\n", dev_priv->gart_vm_start, dev_priv->bus_pci_gart,dev_priv->gart_size);
+ DRM_DEBUG("programming pcie %08X %08lX %08X\n",
+ dev_priv->gart_vm_start, (long)dev_priv->bus_pci_gart,
+ dev_priv->gart_size);
RADEON_WRITE_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_LO, dev_priv->gart_vm_start);
RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_BASE, dev_priv->bus_pci_gart);
RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_START_LO, dev_priv->gart_vm_start);
@@ -2038,8 +2040,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
return ret;
}
-/* 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 radeon_driver_load(struct drm_device *dev, unsigned long flags)
{
drm_radeon_private_t *dev_priv;
int ret = 0;
@@ -2077,7 +2078,10 @@ int radeon_preinit(struct drm_device *dev, unsigned long flags)
return ret;
}
-int radeon_presetup(struct drm_device *dev)
+/* Create mappings for registers and framebuffer so userland doesn't necessarily
+ * have to find them.
+ */
+int radeon_driver_firstopen(struct drm_device *dev)
{
int ret;
drm_local_map_t *map;
@@ -2098,7 +2102,7 @@ int radeon_presetup(struct drm_device *dev)
return 0;
}
-int radeon_postcleanup(struct drm_device *dev)
+int radeon_driver_unload(struct drm_device *dev)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h
index cb4e0b4b..13cb1231 100644
--- a/shared-core/radeon_drv.h
+++ b/shared-core/radeon_drv.h
@@ -307,12 +307,14 @@ 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);
+
+extern int radeon_driver_load(struct drm_device *dev, unsigned long flags);
+extern int radeon_driver_unload(struct drm_device *dev);
+extern int radeon_driver_firstopen(struct drm_device *dev);
+extern void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp);
+extern void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp);
+extern void radeon_driver_lastclose(drm_device_t * dev);
+extern int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv);
extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);
@@ -931,10 +933,6 @@ do { \
RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \
} while (0)
-extern int radeon_preinit(struct drm_device *dev, unsigned long flags);
-extern int radeon_presetup(struct drm_device *dev);
-extern int radeon_postcleanup(struct drm_device *dev);
-
#define CP_PACKET0( reg, n ) \
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
#define CP_PACKET0_TABLE( reg, n ) \
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 53484641..44719bd9 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -3004,7 +3004,7 @@ static int radeon_cp_setparam(DRM_IOCTL_ARGS)
*
* DRM infrastructure takes care of reclaiming dma buffers.
*/
-void radeon_driver_prerelease(drm_device_t * dev, DRMFILE filp)
+void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -3017,12 +3017,12 @@ void radeon_driver_prerelease(drm_device_t * dev, DRMFILE filp)
}
}
-void radeon_driver_pretakedown(drm_device_t * dev)
+void radeon_driver_lastclose(drm_device_t * dev)
{
radeon_do_release(dev);
}
-int radeon_driver_open_helper(drm_device_t * dev, drm_file_t * filp_priv)
+int radeon_driver_open(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;
@@ -3044,7 +3044,7 @@ int radeon_driver_open_helper(drm_device_t * dev, drm_file_t * filp_priv)
return 0;
}
-void radeon_driver_free_filp_priv(drm_device_t * dev, drm_file_t * filp_priv)
+void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp_priv)
{
struct drm_radeon_driver_file_fields *radeon_priv =
filp_priv->driver_priv;
diff --git a/shared-core/savage_bci.c b/shared-core/savage_bci.c
index bfd760ea..9a604b6e 100644
--- a/shared-core/savage_bci.c
+++ b/shared-core/savage_bci.c
@@ -536,16 +536,31 @@ static void savage_fake_dma_flush(drm_savage_private_t *dev_priv)
dev_priv->first_dma_page = dev_priv->current_dma_page = 0;
}
+int savage_driver_load(drm_device_t *dev, unsigned long chipset)
+{
+ drm_savage_private_t *dev_priv;
+
+ dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
+ if (dev_priv == NULL)
+ return DRM_ERR(ENOMEM);
+
+ memset(dev_priv, 0, sizeof(drm_savage_private_t));
+ dev->dev_private = (void *)dev_priv;
+
+ dev_priv->chipset = (enum savage_family)chipset;
+
+ return 0;
+}
+
/*
* Initalize mappings. On Savage4 and SavageIX the alignment
* and size of the aperture is not suitable for automatic MTRR setup
- * in drm_addmap. Therefore we do it manually before the maps are
- * initialized. We also need to take care of deleting the MTRRs in
- * postcleanup.
+ * in drm_addmap. Therefore we add them manually before the maps are
+ * initialized, and tear them down on last close.
*/
-int savage_preinit(drm_device_t *dev, unsigned long chipset)
+int savage_driver_firstopen(drm_device_t *dev)
{
- drm_savage_private_t *dev_priv;
+ drm_savage_private_t *dev_priv = dev->dev_private;
unsigned long mmio_base, fb_base, fb_size, aperture_base;
/* fb_rsrc and aper_rsrc aren't really used currently, but still exist
* in case we decide we need information on the BAR for BSD in the
@@ -554,14 +569,6 @@ int savage_preinit(drm_device_t *dev, unsigned long chipset)
unsigned int fb_rsrc, aper_rsrc;
int ret = 0;
- dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
- if (dev_priv == NULL)
- return DRM_ERR(ENOMEM);
-
- memset(dev_priv, 0, sizeof(drm_savage_private_t));
- dev->dev_private = (void *)dev_priv;
- dev_priv->chipset = (enum savage_family)chipset;
-
dev_priv->mtrr[0].handle = -1;
dev_priv->mtrr[1].handle = -1;
dev_priv->mtrr[2].handle = -1;
@@ -595,7 +602,8 @@ int savage_preinit(drm_device_t *dev, unsigned long chipset)
DRM_ERROR("strange pci_resource_len %08lx\n",
drm_get_resource_len(dev, 0));
}
- } else if (chipset != S3_SUPERSAVAGE && chipset != S3_SAVAGE2000) {
+ } else if (dev_priv->chipset != S3_SUPERSAVAGE &&
+ dev_priv->chipset != S3_SAVAGE2000) {
mmio_base = drm_get_resource_start(dev, 0);
fb_rsrc = 1;
fb_base = drm_get_resource_start(dev, 1);
@@ -647,7 +655,7 @@ int savage_preinit(drm_device_t *dev, unsigned long chipset)
/*
* Delete MTRRs and free device-private data.
*/
-int savage_postcleanup(drm_device_t *dev)
+void savage_driver_lastclose(drm_device_t *dev)
{
drm_savage_private_t *dev_priv = dev->dev_private;
int i;
@@ -657,6 +665,11 @@ int savage_postcleanup(drm_device_t *dev)
mtrr_del(dev_priv->mtrr[i].handle,
dev_priv->mtrr[i].base,
dev_priv->mtrr[i].size);
+}
+
+int savage_driver_unload(drm_device_t *dev)
+{
+ drm_savage_private_t *dev_priv = dev->dev_private;
drm_free(dev_priv, sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
diff --git a/shared-core/savage_drv.h b/shared-core/savage_drv.h
index a16e7b2b..51266adb 100644
--- a/shared-core/savage_drv.h
+++ b/shared-core/savage_drv.h
@@ -208,8 +208,10 @@ extern void savage_dma_reset(drm_savage_private_t *dev_priv);
extern void savage_dma_wait(drm_savage_private_t *dev_priv, unsigned int page);
extern uint32_t *savage_dma_alloc(drm_savage_private_t *dev_priv,
unsigned int n);
-extern int savage_preinit(drm_device_t *dev, unsigned long chipset);
-extern int savage_postcleanup(drm_device_t *dev);
+extern int savage_driver_load(drm_device_t *dev, unsigned long chipset);
+extern int savage_driver_firstopen(drm_device_t *dev);
+extern void savage_driver_lastclose(drm_device_t *dev);
+extern int savage_driver_unload(drm_device_t *dev);
extern int savage_do_cleanup_bci(drm_device_t *dev);
extern void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp);
diff --git a/shared-core/via_drv.c b/shared-core/via_drv.c
index 13cc2e15..d8d85f5e 100644
--- a/shared-core/via_drv.c
+++ b/shared-core/via_drv.c
@@ -29,30 +29,6 @@
#include "drm_pciids.h"
-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->primary.minor, pci_pretty_name(dev->pdev)
- );
- return 0;
-}
-
-static int version(drm_version_t * version)
-{
- int len;
-
- 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 int dri_library_name(struct drm_device * dev, char * buf)
{
@@ -95,8 +71,6 @@ static struct drm_driver driver = {
.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),
.fops = {
@@ -113,7 +87,14 @@ static struct drm_driver driver = {
.id_table = pciidlist,
.probe = probe,
.remove = __devexit_p(drm_cleanup_pci),
- }
+ },
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)