summaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-11-05 08:13:52 +0000
committerEric Anholt <anholt@freebsd.org>2003-11-05 08:13:52 +0000
commit66c9e3053f857df340a982edaa8ea57b229efeed (patch)
treef1ba7392f422b2687952f0242c6916d1ac766fea /bsd-core/drm_drv.c
parent19ee64add26773f4436440f8fa405a1011eea4c4 (diff)
- Tie the DRM to a specific device: setunique no longer succeeds when given
a busid that doesn't correspond to the device the DRM is attached to. This is a breaking of backwards-compatibility only for the multiple-DRI-head case with X Servers that don't use interface 1.1. - Move irq_busid to drm_irq.h and make it only return the IRQ for the current device. Retains compatibility with previous X Servers, cleans up unnecessary code. This means no irq_busid on !__HAVE_IRQ, but can be changed if necessary. - Bump interface version to 1.2. This version when set signifies that the control ioctl should ignore the irq number passed in and enable the interrupt handler for the attached device. Otherwise it errors out when the passed-in irq is not equal to the device's. - Store the highest version the interface has been set to in the device. - Fix a recursion on DRM_LOCK in irq_uninstall on FreeBSD. This leaves irq_uninstall being done without the lock in some cases, but it was racey anyways.
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 0cbc1083..1083f9f9 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -134,7 +134,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 },
@@ -477,9 +479,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;
@@ -507,7 +510,7 @@ static int DRM(takedown)( drm_device_t *dev )
DRIVER_PRETAKEDOWN();
#if __HAVE_IRQ
- if (dev->irq != 0)
+ if (dev->irq_enabled)
DRM(irq_uninstall)( dev );
#endif
@@ -644,6 +647,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;