diff options
author | vehemens <vehemens@verizon.net> | 2008-08-29 13:18:54 -0400 |
---|---|---|
committer | Robert Noland <rnoland@2hip.net> | 2008-08-29 15:46:05 -0400 |
commit | 2649103bf9c4eb471a10800f4a3161dca6249086 (patch) | |
tree | 2c97d0cc5e4b054e2c24bd07e14a01cadc7c878c /bsd-core | |
parent | 71f0a3e389efb6c92a84299d05beb2a1bfa53469 (diff) |
[FreeBSD] Convert drm_driver to a pointer like linux.
Signed-off-by: Robert Noland <rnoland@2hip.net>
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/drmP.h | 2 | ||||
-rw-r--r-- | bsd-core/drm_agpsupport.c | 4 | ||||
-rw-r--r-- | bsd-core/drm_bufs.c | 10 | ||||
-rw-r--r-- | bsd-core/drm_context.c | 8 | ||||
-rw-r--r-- | bsd-core/drm_dma.c | 4 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 70 | ||||
-rw-r--r-- | bsd-core/drm_fops.c | 4 | ||||
-rw-r--r-- | bsd-core/drm_ioctl.c | 8 | ||||
-rw-r--r-- | bsd-core/drm_irq.c | 20 | ||||
-rw-r--r-- | bsd-core/drm_lock.c | 6 | ||||
-rw-r--r-- | bsd-core/drm_sysctl.c | 2 | ||||
-rw-r--r-- | bsd-core/i915_drv.c | 77 | ||||
-rw-r--r-- | bsd-core/mach64_drv.c | 69 | ||||
-rw-r--r-- | bsd-core/mga_drv.c | 77 | ||||
-rw-r--r-- | bsd-core/r128_drv.c | 73 | ||||
-rw-r--r-- | bsd-core/radeon_drv.c | 85 | ||||
-rw-r--r-- | bsd-core/savage_drv.c | 59 | ||||
-rw-r--r-- | bsd-core/sis_drv.c | 47 | ||||
-rw-r--r-- | bsd-core/tdfx_drv.c | 33 | ||||
-rw-r--r-- | bsd-core/via_drv.c | 71 |
20 files changed, 423 insertions, 306 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 25f71f03..9d797d79 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -728,7 +728,7 @@ struct drm_device { struct device device; /* softc is an extension of struct device */ #endif - struct drm_driver_info driver; + struct drm_driver_info *driver; drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */ u_int16_t pci_device; /* PCI device id */ diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c index 927e5ee8..62fa5d27 100644 --- a/bsd-core/drm_agpsupport.c +++ b/bsd-core/drm_agpsupport.c @@ -90,13 +90,13 @@ drm_device_find_capability(struct drm_device *dev, int cap) int drm_device_is_agp(struct drm_device *dev) { - if (dev->driver.device_is_agp != NULL) { + if (dev->driver->device_is_agp != NULL) { int ret; /* device_is_agp returns a tristate, 0 = not AGP, 1 = definitely * AGP, 2 = fall back to PCI capability */ - ret = (*dev->driver.device_is_agp)(dev); + ret = (*dev->driver->device_is_agp)(dev); if (ret != DRM_MIGHT_BE_AGP) return ret; } diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c index 2d13087a..2b248e47 100644 --- a/bsd-core/drm_bufs.c +++ b/bsd-core/drm_bufs.c @@ -488,7 +488,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque buf->pending = 0; buf->file_priv = NULL; - buf->dev_priv_size = dev->driver.buf_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) { @@ -629,7 +629,7 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque buf->pending = 0; buf->file_priv = NULL; - buf->dev_priv_size = dev->driver.buf_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) { @@ -743,7 +743,7 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques buf->pending = 0; buf->file_priv = NULL; - buf->dev_priv_size = dev->driver.buf_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) { @@ -1061,8 +1061,8 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) if (request->count < dma->buf_count) goto done; - if ((dev->driver.use_agp && (dma->flags & _DRM_DMA_USE_AGP)) || - (dev->driver.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 a621ca52..b85922e1 100644 --- a/bsd-core/drm_context.c +++ b/bsd-core/drm_context.c @@ -255,9 +255,9 @@ int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv) return ENOMEM; } - if (dev->driver.context_ctor && ctx->handle != DRM_KERNEL_CONTEXT) { + if (dev->driver->context_ctor && ctx->handle != DRM_KERNEL_CONTEXT) { DRM_LOCK(); - dev->driver.context_ctor(dev, ctx->handle); + dev->driver->context_ctor(dev, ctx->handle); DRM_UNLOCK(); } @@ -305,9 +305,9 @@ int drm_rmctx(struct drm_device *dev, void *data, struct drm_file *file_priv) DRM_DEBUG( "%d\n", ctx->handle ); if ( ctx->handle != DRM_KERNEL_CONTEXT ) { - if (dev->driver.context_dtor) { + if (dev->driver->context_dtor) { DRM_LOCK(); - dev->driver.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 c2586fa0..cdfb986c 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -125,9 +125,9 @@ void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv) int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv) { - if (dev->driver.dma_ioctl) { + if (dev->driver->dma_ioctl) { /* shared code returns -errno */ - return -dev->driver.dma_ioctl(dev, data, file_priv); + return -dev->driver->dma_ioctl(dev, data, file_priv); } 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 4c03b01d..2ad54b9a 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -343,7 +343,7 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev, id_entry = drm_find_description(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id), idlist); - dev->driver.pci_id_entry = id_entry; + dev->driver->pci_id_entry = id_entry; DRM_INFO("%s", id_entry->name); drm_load(dev); @@ -397,12 +397,12 @@ static int drm_firstopen(struct drm_device *dev) if (i != 0) return i; - if (dev->driver.firstopen) - dev->driver.firstopen(dev); + if (dev->driver->firstopen) + dev->driver->firstopen(dev); dev->buf_use = 0; - if (dev->driver.use_dma) { + if (dev->driver->use_dma) { i = drm_dma_setup(dev); if (i != 0) return i; @@ -440,8 +440,8 @@ static int drm_lastclose(struct drm_device *dev) DRM_DEBUG( "\n" ); - if (dev->driver.lastclose != NULL) - dev->driver.lastclose(dev); + if (dev->driver->lastclose != NULL) + dev->driver->lastclose(dev); if (dev->irq_enabled) drm_irq_uninstall(dev); @@ -545,10 +545,10 @@ static int drm_load(struct drm_device *dev) for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) atomic_set( &dev->counts[i], 0 ); - if (dev->driver.load != NULL) { + if (dev->driver->load != NULL) { DRM_LOCK(); /* Shared code returns -errno. */ - retcode = -dev->driver.load(dev, + retcode = -dev->driver->load(dev, dev->id_entry->driver_private); if (pci_enable_busmaster(dev->device)) DRM_ERROR("Request to enable bus-master failed.\n"); @@ -557,10 +557,10 @@ static int drm_load(struct drm_device *dev) goto error; } - if (dev->driver.use_agp) { + if (dev->driver->use_agp) { if (drm_device_is_agp(dev)) dev->agp = drm_agp_init(); - if (dev->driver.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 = ENOMEM; @@ -586,11 +586,11 @@ static int drm_load(struct drm_device *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); + dev->driver->name, + dev->driver->major, + dev->driver->minor, + dev->driver->patchlevel, + dev->driver->date); return 0; @@ -657,9 +657,9 @@ static void drm_unload(struct drm_device *dev) dev->agp = NULL; } - if (dev->driver.unload != NULL) { + if (dev->driver->unload != NULL) { DRM_LOCK(); - dev->driver.unload(dev); + dev->driver->unload(dev); DRM_UNLOCK(); } @@ -694,13 +694,13 @@ int drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv) return 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); return 0; } @@ -750,8 +750,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) if (--file_priv->refs != 0) goto done; - if (dev->driver.preclose != NULL) - dev->driver.preclose(dev, file_priv); + if (dev->driver->preclose != NULL) + dev->driver->preclose(dev, file_priv); /* ======================================================== * Begin inline drm_release @@ -770,8 +770,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->driver.reclaim_buffers_locked != NULL) - dev->driver.reclaim_buffers_locked(dev, file_priv); + if (dev->driver->reclaim_buffers_locked != NULL) + dev->driver->reclaim_buffers_locked(dev, file_priv); drm_lock_free(dev, &dev->lock.hw_lock->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); @@ -780,7 +780,7 @@ 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->driver.reclaim_buffers_locked != NULL && + } else if (dev->driver->reclaim_buffers_locked != NULL && dev->lock.hw_lock != NULL) { /* The lock is required to reclaim buffers */ for (;;) { @@ -808,13 +808,13 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) break; } if (retcode == 0) { - dev->driver.reclaim_buffers_locked(dev, file_priv); + dev->driver->reclaim_buffers_locked(dev, file_priv); drm_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); } } - if (dev->driver.use_dma && !dev->driver.reclaim_buffers_locked) + if (dev->driver->use_dma && !dev->driver->reclaim_buffers_locked) drm_reclaim_buffers(dev, file_priv); #if defined (__FreeBSD__) && (__FreeBSD_version >= 500000) @@ -825,8 +825,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) dev->buf_pgid = 0; #endif /* __NetBSD__ || __OpenBSD__ */ - if (dev->driver.postclose != NULL) - dev->driver.postclose(dev, file_priv); + if (dev->driver->postclose != NULL) + dev->driver->postclose(dev, file_priv); TAILQ_REMOVE(&dev->files, file_priv, link); free(file_priv, M_DRM); @@ -920,12 +920,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->driver.max_ioctl) { + if (nr > dev->driver->max_ioctl) { DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n", - nr, dev->driver.max_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 062b1d59..248e7937 100644 --- a/bsd-core/drm_fops.c +++ b/bsd-core/drm_fops.c @@ -94,9 +94,9 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p, /* for compatibility root is always authenticated */ priv->authenticated = DRM_SUSER(p); - if (dev->driver.open) { + if (dev->driver->open) { /* shared code returns -errno */ - retcode = -dev->driver.open(dev, priv); + 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 5784be9f..26919982 100644 --- a/bsd-core/drm_ioctl.c +++ b/bsd-core/drm_ioctl.c @@ -245,8 +245,8 @@ int drm_setversion(struct drm_device *dev, void *data, ver = *sv; sv->drm_di_major = DRM_IF_MAJOR; sv->drm_di_minor = DRM_IF_MINOR; - sv->drm_dd_major = dev->driver.major; - sv->drm_dd_minor = dev->driver.minor; + sv->drm_dd_major = dev->driver->major; + sv->drm_dd_minor = dev->driver->minor; if (ver.drm_di_major != -1) { if (ver.drm_di_major != DRM_IF_MAJOR || @@ -265,9 +265,9 @@ int drm_setversion(struct drm_device *dev, void *data, } if (ver.drm_dd_major != -1) { - if (ver.drm_dd_major != dev->driver.major || + if (ver.drm_dd_major != dev->driver->major || ver.drm_dd_minor < 0 || - ver.drm_dd_minor > dev->driver.minor) + ver.drm_dd_minor > dev->driver->minor) { return EINVAL; } diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c index 3d0cfeff..6d7d1265 100644 --- a/bsd-core/drm_irq.c +++ b/bsd-core/drm_irq.c @@ -61,7 +61,7 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS) struct drm_device *dev = arg; DRM_SPINLOCK(&dev->irq_lock); - dev->driver.irq_handler(arg); + dev->driver->irq_handler(arg); DRM_SPINUNLOCK(&dev->irq_lock); } #endif @@ -90,8 +90,8 @@ static void vblank_disable_fn(void *arg) dev->vblank[i].enabled) { DRM_DEBUG("disabling vblank on crtc %d\n", i); dev->vblank[i].last = - dev->driver.get_vblank_counter(dev, i); - dev->driver.disable_vblank(dev, i); + dev->driver->get_vblank_counter(dev, i); + dev->driver->disable_vblank(dev, i); dev->vblank[i].enabled = 0; } } @@ -173,7 +173,7 @@ int drm_irq_install(struct drm_device *dev) dev->context_flag = 0; /* Before installing handler */ - dev->driver.irq_preinstall(dev); + dev->driver->irq_preinstall(dev); DRM_UNLOCK(); /* Install handler */ @@ -211,7 +211,7 @@ int drm_irq_install(struct drm_device *dev) /* After installing handler */ DRM_LOCK(); - dev->driver.irq_postinstall(dev); + dev->driver->irq_postinstall(dev); DRM_UNLOCK(); TASK_INIT(&dev->locked_task, 0, drm_locked_task, dev); @@ -247,7 +247,7 @@ int drm_irq_uninstall(struct drm_device *dev) DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq ); - dev->driver.irq_uninstall(dev); + dev->driver->irq_uninstall(dev); #ifdef __FreeBSD__ DRM_UNLOCK(); @@ -272,14 +272,14 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv) /* Handle drivers whose DRM used to require IRQ setup but the * no longer does. */ - if (!dev->driver.use_irq) + if (!dev->driver->use_irq) return 0; if (dev->if_version < DRM_IF_VERSION(1, 2) && ctl->irq != dev->irq) return EINVAL; return drm_irq_install(dev); case DRM_UNINST_HANDLER: - if (!dev->driver.use_irq) + if (!dev->driver->use_irq) return 0; DRM_LOCK(); err = drm_irq_uninstall(dev); @@ -306,7 +306,7 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) * here if the register is small or we had vblank interrupts off for * a long time. */ - cur_vblank = dev->driver.get_vblank_counter(dev, crtc); + cur_vblank = dev->driver->get_vblank_counter(dev, crtc); diff = cur_vblank - dev->vblank[crtc].last; if (cur_vblank < dev->vblank[crtc].last) { diff += dev->max_vblank_count; @@ -331,7 +331,7 @@ int drm_vblank_get(struct drm_device *dev, int crtc) atomic_add_acq_int(&dev->vblank[crtc].refcount, 1); if (dev->vblank[crtc].refcount == 1 && !dev->vblank[crtc].enabled) { - ret = dev->driver.enable_vblank(dev, crtc); + ret = dev->driver->enable_vblank(dev, crtc); if (ret) atomic_dec(&dev->vblank[crtc].refcount); else { diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c index 0302ca0c..cb8875b8 100644 --- a/bsd-core/drm_lock.c +++ b/bsd-core/drm_lock.c @@ -126,7 +126,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) lock->context, DRM_CURRENTPID, dev->lock.hw_lock->lock, lock->flags); - if (dev->driver.use_dma_queue && lock->context < 0) + if (dev->driver->use_dma_queue && lock->context < 0) return EINVAL; DRM_LOCK(); @@ -157,9 +157,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) /* XXX: Add signal blocking here */ - if (dev->driver.dma_quiescent != NULL && + if (dev->driver->dma_quiescent != NULL && (lock->flags & _DRM_LOCK_QUIESCENT)) - dev->driver.dma_quiescent(dev); + dev->driver->dma_quiescent(dev); return 0; } diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c index a6adf0fc..4c281fe3 100644 --- a/bsd-core/drm_sysctl.c +++ b/bsd-core/drm_sysctl.c @@ -132,7 +132,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 c19ef5db..d2301ddd 100644 --- a/bsd-core/i915_drv.c +++ b/bsd-core/i915_drv.c @@ -68,37 +68,37 @@ static int i915_resume(device_t nbdev) static void i915_configure(struct drm_device *dev) { - dev->driver.buf_priv_size = sizeof(drm_i915_private_t); - dev->driver.load = i915_driver_load; - dev->driver.unload = i915_driver_unload; - dev->driver.firstopen = i915_driver_firstopen; - dev->driver.preclose = i915_driver_preclose; - dev->driver.lastclose = i915_driver_lastclose; - dev->driver.device_is_agp = i915_driver_device_is_agp; - dev->driver.get_vblank_counter = i915_get_vblank_counter; - dev->driver.enable_vblank = i915_enable_vblank; - dev->driver.disable_vblank = i915_disable_vblank; - dev->driver.irq_preinstall = i915_driver_irq_preinstall; - dev->driver.irq_postinstall = i915_driver_irq_postinstall; - dev->driver.irq_uninstall = i915_driver_irq_uninstall; - dev->driver.irq_handler = i915_driver_irq_handler; - - dev->driver.ioctls = i915_ioctls; - dev->driver.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.use_agp = 1; - dev->driver.require_agp = 1; - dev->driver.use_mtrr = 1; - dev->driver.use_irq = 1; - dev->driver.use_vbl_irq = 1; - dev->driver.use_vbl_irq2 = 1; + dev->driver->buf_priv_size = sizeof(drm_i915_private_t); + dev->driver->load = i915_driver_load; + dev->driver->unload = i915_driver_unload; + dev->driver->firstopen = i915_driver_firstopen; + dev->driver->preclose = i915_driver_preclose; + dev->driver->lastclose = i915_driver_lastclose; + dev->driver->device_is_agp = i915_driver_device_is_agp; + dev->driver->get_vblank_counter = i915_get_vblank_counter; + dev->driver->enable_vblank = i915_enable_vblank; + dev->driver->disable_vblank = i915_disable_vblank; + dev->driver->irq_preinstall = i915_driver_irq_preinstall; + dev->driver->irq_postinstall = i915_driver_irq_postinstall; + dev->driver->irq_uninstall = i915_driver_irq_uninstall; + dev->driver->irq_handler = i915_driver_irq_handler; + + dev->driver->ioctls = i915_ioctls; + dev->driver->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->use_agp = 1; + dev->driver->require_agp = 1; + dev->driver->use_mtrr = 1; + dev->driver->use_irq = 1; + dev->driver->use_vbl_irq = 1; + dev->driver->use_vbl_irq2 = 1; } #ifdef __FreeBSD__ @@ -114,17 +114,30 @@ i915_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); i915_configure(dev); + return drm_attach(nbdev, i915_pciidlist); } +static int +i915_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t i915_methods[] = { /* Device interface */ DEVMETHOD(device_probe, i915_probe), DEVMETHOD(device_attach, i915_attach), DEVMETHOD(device_suspend, i915_suspend), DEVMETHOD(device_resume, i915_resume), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, i915_detach), { 0, 0 } }; diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c index 06e0133d..726b7d24 100644 --- a/bsd-core/mach64_drv.c +++ b/bsd-core/mach64_drv.c @@ -46,33 +46,33 @@ static drm_pci_id_list_t mach64_pciidlist[] = { static void mach64_configure(struct drm_device *dev) { - dev->driver.buf_priv_size = 1; /* No dev_priv */ - dev->driver.lastclose = mach64_driver_lastclose; - dev->driver.get_vblank_counter = mach64_get_vblank_counter; - dev->driver.enable_vblank = mach64_enable_vblank; - dev->driver.disable_vblank = mach64_disable_vblank; - 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; + dev->driver->buf_priv_size = 1; /* No dev_priv */ + dev->driver->lastclose = mach64_driver_lastclose; + dev->driver->get_vblank_counter = mach64_get_vblank_counter; + dev->driver->enable_vblank = mach64_enable_vblank; + dev->driver->disable_vblank = mach64_disable_vblank; + 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__ @@ -88,15 +88,28 @@ mach64_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); mach64_configure(dev); + return drm_attach(nbdev, mach64_pciidlist); } +static int +mach64_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t mach64_methods[] = { /* Device interface */ DEVMETHOD(device_probe, mach64_probe), DEVMETHOD(device_attach, mach64_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, mach64_detach), { 0, 0 } }; diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c index 15d8175c..0e434b56 100644 --- a/bsd-core/mga_drv.c +++ b/bsd-core/mga_drv.c @@ -86,37 +86,37 @@ static int mga_driver_device_is_agp(struct drm_device * dev) static void mga_configure(struct drm_device *dev) { - 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.get_vblank_counter = mga_get_vblank_counter; - dev->driver.enable_vblank = mga_enable_vblank; - dev->driver.disable_vblank = mga_disable_vblank; - 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; + 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->get_vblank_counter = mga_get_vblank_counter; + dev->driver->enable_vblank = mga_enable_vblank; + dev->driver->disable_vblank = mga_disable_vblank; + 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; } @@ -134,15 +134,28 @@ mga_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); mga_configure(dev); + return drm_attach(nbdev, mga_pciidlist); } +static int +mga_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t mga_methods[] = { /* Device interface */ DEVMETHOD(device_probe, mga_probe), DEVMETHOD(device_attach, mga_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, mga_detach), { 0, 0 } }; diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c index b149d512..d93c746d 100644 --- a/bsd-core/r128_drv.c +++ b/bsd-core/r128_drv.c @@ -44,35 +44,35 @@ static drm_pci_id_list_t r128_pciidlist[] = { static void r128_configure(struct drm_device *dev) { - 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.get_vblank_counter = r128_get_vblank_counter; - dev->driver.enable_vblank = r128_enable_vblank; - dev->driver.disable_vblank = r128_disable_vblank; - 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->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.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; + 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->get_vblank_counter = r128_get_vblank_counter; + dev->driver->enable_vblank = r128_enable_vblank; + dev->driver->disable_vblank = r128_disable_vblank; + 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->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->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__ @@ -88,15 +88,28 @@ r128_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); r128_configure(dev); + return drm_attach(nbdev, r128_pciidlist); } +static int +r128_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t r128_methods[] = { /* Device interface */ DEVMETHOD(device_probe, r128_probe), DEVMETHOD(device_attach, r128_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, r128_detach), { 0, 0 } }; diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c index 0b4dba18..eea04ff9 100644 --- a/bsd-core/radeon_drv.c +++ b/bsd-core/radeon_drv.c @@ -44,41 +44,41 @@ static drm_pci_id_list_t radeon_pciidlist[] = { static void radeon_configure(struct drm_device *dev) { - 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.get_vblank_counter = radeon_get_vblank_counter; - dev->driver.enable_vblank = radeon_enable_vblank; - dev->driver.disable_vblank = radeon_disable_vblank; - 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->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.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; - dev->driver.use_vbl_irq2 = 1; + 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->get_vblank_counter = radeon_get_vblank_counter; + dev->driver->enable_vblank = radeon_enable_vblank; + dev->driver->disable_vblank = radeon_disable_vblank; + 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->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->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; + dev->driver->use_vbl_irq2 = 1; } #ifdef __FreeBSD__ @@ -94,15 +94,28 @@ radeon_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); radeon_configure(dev); + return drm_attach(nbdev, radeon_pciidlist); } +static int +radeon_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t radeon_methods[] = { /* Device interface */ DEVMETHOD(device_probe, radeon_probe), DEVMETHOD(device_attach, radeon_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, radeon_detach), { 0, 0 } }; diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c index 6235bcd1..ee5166a3 100644 --- a/bsd-core/savage_drv.c +++ b/bsd-core/savage_drv.c @@ -39,28 +39,28 @@ static drm_pci_id_list_t savage_pciidlist[] = { static void savage_configure(struct drm_device *dev) { - dev->driver.buf_priv_size = sizeof(drm_savage_buf_priv_t); - dev->driver.load = savage_driver_load; - dev->driver.firstopen = savage_driver_firstopen; - dev->driver.lastclose = savage_driver_lastclose; - dev->driver.unload = savage_driver_unload; - dev->driver.reclaim_buffers_locked = savage_reclaim_buffers; - dev->driver.dma_ioctl = savage_bci_buffers; - - dev->driver.ioctls = savage_ioctls; - dev->driver.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.use_agp = 1; - dev->driver.use_mtrr = 1; - dev->driver.use_pci_dma = 1; - dev->driver.use_dma = 1; + dev->driver->buf_priv_size = sizeof(drm_savage_buf_priv_t); + dev->driver->load = savage_driver_load; + dev->driver->firstopen = savage_driver_firstopen; + dev->driver->lastclose = savage_driver_lastclose; + dev->driver->unload = savage_driver_unload; + dev->driver->reclaim_buffers_locked = savage_reclaim_buffers; + dev->driver->dma_ioctl = savage_bci_buffers; + + dev->driver->ioctls = savage_ioctls; + dev->driver->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->use_agp = 1; + dev->driver->use_mtrr = 1; + dev->driver->use_pci_dma = 1; + dev->driver->use_dma = 1; } #ifdef __FreeBSD__ @@ -76,15 +76,28 @@ savage_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); savage_configure(dev); + return drm_attach(nbdev, savage_pciidlist); } +static int +savage_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t savage_methods[] = { /* Device interface */ DEVMETHOD(device_probe, savage_probe), DEVMETHOD(device_attach, savage_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, savage_detach), { 0, 0 } }; diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c index 9f76a689..a9637763 100644 --- a/bsd-core/sis_drv.c +++ b/bsd-core/sis_drv.c @@ -38,22 +38,22 @@ static drm_pci_id_list_t sis_pciidlist[] = { static void sis_configure(struct drm_device *dev) { - 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->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.use_agp = 1; - dev->driver.use_mtrr = 1; + 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->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->use_agp = 1; + dev->driver->use_mtrr = 1; } #ifdef __FreeBSD__ @@ -69,15 +69,28 @@ sis_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); sis_configure(dev); + return drm_attach(nbdev, sis_pciidlist); } +static int +sis_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t sis_methods[] = { /* Device interface */ DEVMETHOD(device_probe, sis_probe), DEVMETHOD(device_attach, sis_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, sis_detach), { 0, 0 } }; diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c index 6d4e74b0..e5559999 100644 --- a/bsd-core/tdfx_drv.c +++ b/bsd-core/tdfx_drv.c @@ -43,18 +43,18 @@ static drm_pci_id_list_t tdfx_pciidlist[] = { static void tdfx_configure(struct drm_device *dev) { - dev->driver.buf_priv_size = 1; /* No dev_priv */ + dev->driver->buf_priv_size = 1; /* No dev_priv */ - dev->driver.max_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->driver.use_mtrr = 1; + dev->driver->use_mtrr = 1; } #ifdef __FreeBSD__ @@ -70,15 +70,28 @@ tdfx_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); tdfx_configure(dev); + return drm_attach(nbdev, tdfx_pciidlist); } +static int +tdfx_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t tdfx_methods[] = { /* Device interface */ DEVMETHOD(device_probe, tdfx_probe), DEVMETHOD(device_attach, tdfx_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, tdfx_detach), { 0, 0 } }; diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c index 36b820a9..539e3ef3 100644 --- a/bsd-core/via_drv.c +++ b/bsd-core/via_drv.c @@ -41,34 +41,34 @@ static drm_pci_id_list_t via_pciidlist[] = { static void via_configure(struct drm_device *dev) { - dev->driver.buf_priv_size = 1; - dev->driver.load = via_driver_load; - dev->driver.unload = via_driver_unload; - dev->driver.context_ctor = via_init_context; - dev->driver.context_dtor = via_final_context; - dev->driver.get_vblank_counter = via_get_vblank_counter; - dev->driver.enable_vblank = via_enable_vblank; - dev->driver.disable_vblank = via_disable_vblank; - dev->driver.irq_preinstall = via_driver_irq_preinstall; - dev->driver.irq_postinstall = via_driver_irq_postinstall; - dev->driver.irq_uninstall = via_driver_irq_uninstall; - dev->driver.irq_handler = via_driver_irq_handler; - dev->driver.dma_quiescent = via_driver_dma_quiescent; - - dev->driver.ioctls = via_ioctls; - dev->driver.max_ioctl = via_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_irq = 1; - dev->driver.use_vbl_irq = 1; + dev->driver->buf_priv_size = 1; + dev->driver->load = via_driver_load; + dev->driver->unload = via_driver_unload; + dev->driver->context_ctor = via_init_context; + dev->driver->context_dtor = via_final_context; + dev->driver->get_vblank_counter = via_get_vblank_counter; + dev->driver->enable_vblank = via_enable_vblank; + dev->driver->disable_vblank = via_disable_vblank; + dev->driver->irq_preinstall = via_driver_irq_preinstall; + dev->driver->irq_postinstall = via_driver_irq_postinstall; + dev->driver->irq_uninstall = via_driver_irq_uninstall; + dev->driver->irq_handler = via_driver_irq_handler; + dev->driver->dma_quiescent = via_driver_dma_quiescent; + + dev->driver->ioctls = via_ioctls; + dev->driver->max_ioctl = via_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_irq = 1; + dev->driver->use_vbl_irq = 1; } #ifdef __FreeBSD__ @@ -84,15 +84,28 @@ via_attach(device_t nbdev) struct drm_device *dev = device_get_softc(nbdev); bzero(dev, sizeof(struct drm_device)); + + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO); via_configure(dev); + return drm_attach(nbdev, via_pciidlist); } +static int +via_detach(device_t nbdev) +{ + struct drm_device *dev = device_get_softc(nbdev); + + free(dev->driver, M_DRM); + + return drm_detach(nbdev); +} + static device_method_t via_methods[] = { /* Device interface */ DEVMETHOD(device_probe, via_probe), DEVMETHOD(device_attach, via_attach), - DEVMETHOD(device_detach, drm_detach), + DEVMETHOD(device_detach, via_detach), { 0, 0 } }; |