summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_drv.h
diff options
context:
space:
mode:
authoranholt <anholt@FreeBSD.org>2003-11-12 20:56:30 +0000
committeranholt <anholt@FreeBSD.org>2003-11-12 20:56:30 +0000
commit6a52a51a4490ccf15281df6dbd3ae35c26c166d5 (patch)
tree1255ca85a955cae45fb9e6254d7546e2e94cb09a /sys/dev/drm/drm_drv.h
parent3f57e25aebf74440eeb330bfd415b42a33d4872d (diff)
downloadFreeBSD-src-6a52a51a4490ccf15281df6dbd3ae35c26c166d5.zip
FreeBSD-src-6a52a51a4490ccf15281df6dbd3ae35c26c166d5.tar.gz
Update from DRI CVS. Includes locking fixes (including PR 59202), changes for
Radeon IGP support (still lacking PCI IDs), and DRM interface 1.2 updates which include finally tying the DRM instances to specific devices rather than relying on the X Server.
Diffstat (limited to 'sys/dev/drm/drm_drv.h')
-rw-r--r--sys/dev/drm/drm_drv.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h
index 191dc9f..395ba0b 100644
--- a/sys/dev/drm/drm_drv.h
+++ b/sys/dev/drm/drm_drv.h
@@ -102,6 +102,9 @@
#ifndef DRIVER_IOCTLS
#define DRIVER_IOCTLS
#endif
+#ifndef DRIVER_OPEN_HELPER
+#define DRIVER_OPEN_HELPER( priv, dev )
+#endif
#ifndef DRIVER_FOPS
#endif
@@ -132,7 +135,9 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_busid), 0, 1 },
+#if __HAVE_IRQ
+ [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_by_busid), 0, 1 },
+#endif
[DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 },
@@ -413,14 +418,15 @@ const char *DRM(find_description)(int vendor, int device) {
return NULL;
}
-/* Initialize the DRM on first open. Called with device's lock held */
+/* Initialize the DRM on first open. */
static int DRM(setup)( drm_device_t *dev )
{
int i;
+ DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
DRIVER_PRESETUP();
dev->buf_use = 0;
- dev->buf_alloc = 0;
#if __HAVE_DMA
i = DRM(dma_setup)( dev );
@@ -476,9 +482,10 @@ static int DRM(setup)( drm_device_t *dev )
dev->lock.hw_lock = NULL;
dev->lock.lock_queue = 0;
- dev->irq = 0;
+ dev->irq_enabled = 0;
dev->context_flag = 0;
dev->last_context = 0;
+ dev->if_version = 0;
#ifdef __FreeBSD__
dev->buf_sigio = NULL;
@@ -492,9 +499,7 @@ static int DRM(setup)( drm_device_t *dev )
return 0;
}
-/* Free resources associated with the DRM on the last close.
- * Called with the device's lock held.
- */
+/* Free resources associated with the DRM on the last close. */
static int DRM(takedown)( drm_device_t *dev )
{
drm_magic_entry_t *pt, *next;
@@ -502,11 +507,13 @@ static int DRM(takedown)( drm_device_t *dev )
drm_map_list_entry_t *list;
int i;
+ DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
DRM_DEBUG( "\n" );
DRIVER_PRETAKEDOWN();
#if __HAVE_IRQ
- if (dev->irq != 0)
+ if (dev->irq_enabled)
DRM(irq_uninstall)( dev );
#endif
@@ -643,6 +650,13 @@ static int DRM(init)( device_t nbdev )
unit = minor(dev->device.dv_unit);
#endif
+ dev->irq = pci_get_irq(dev->device);
+ /* XXX Fix domain number (alpha hoses) */
+ dev->pci_domain = 0;
+ dev->pci_bus = pci_get_bus(dev->device);
+ dev->pci_slot = pci_get_slot(dev->device);
+ dev->pci_func = pci_get_function(dev->device);
+
dev->maplist = DRM(calloc)(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
if (dev->maplist == NULL) {
retcode = ENOMEM;
OpenPOWER on IntegriCloud