summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2002-11-11 23:33:08 +0000
committerIan Romanick <idr@us.ibm.com>2002-11-11 23:33:08 +0000
commit15e6d94fa3a4c4525b1df3376ae3d803ccc6f708 (patch)
tree63432d5b6f275348852ecef24faea26434846a29
parent1a57f218a7cd358e1b91e2cb43522808411a7f2b (diff)
Massive merge from trunk.texmem-0-0-1-20021127-mesa-4-1-merge
-rw-r--r--bsd-core/drmP.h1
-rw-r--r--bsd-core/drm_dma.c28
-rw-r--r--bsd-core/drm_drv.c4
-rw-r--r--bsd-core/drm_os_freebsd.h2
-rw-r--r--bsd-core/mga/Makefile2
-rw-r--r--bsd-core/r128/Makefile2
-rw-r--r--bsd/Imakefile6
-rw-r--r--bsd/drmP.h1
-rw-r--r--bsd/drm_dma.h28
-rw-r--r--bsd/drm_drv.h4
-rw-r--r--bsd/drm_os_freebsd.h2
-rw-r--r--bsd/mga/Makefile2
-rw-r--r--bsd/r128/Makefile2
-rw-r--r--libdrm/xf86drm.c19
14 files changed, 56 insertions, 47 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 1adaa0e5..b7b21da4 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -448,6 +448,7 @@ struct drm_device {
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
+ int irqrid; /* Interrupt used by board */
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 4593a712..5632b5a2 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -41,12 +41,6 @@
#define __HAVE_SHARED_IRQ 0
#endif
-#if __HAVE_SHARED_IRQ
-#define DRM_IRQ_TYPE SA_SHIRQ
-#else
-#define DRM_IRQ_TYPE 0
-#endif
-
#if __HAVE_DMA
int DRM(dma_setup)( drm_device_t *dev )
@@ -503,7 +497,6 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
int DRM(irq_install)( drm_device_t *dev, int irq )
{
- int rid;
int retcode;
if ( !irq )
@@ -535,18 +528,24 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM(driver_irq_preinstall)( dev );
/* Install handler */
- rid = 0;
- dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid,
+ dev->irqrid = 0;
+ dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
- if (!dev->irqr)
+ if (!dev->irqr) {
+ DRM_LOCK;
+ dev->irq = 0;
+ dev->irqrid = 0;
+ DRM_UNLOCK;
return ENOENT;
+ }
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
DRM_LOCK;
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
return retcode;
}
@@ -560,10 +559,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
int DRM(irq_uninstall)( drm_device_t *dev )
{
int irq;
-
+ int irqrid;
+
DRM_LOCK;
irq = dev->irq;
+ irqrid = dev->irqrid;
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
if ( !irq )
@@ -574,7 +576,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
return 0;
}
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 872f6bc6..4a6fc15f 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -1037,7 +1037,11 @@ int DRM(ioctl)( DRM_IOCTL_ARGS )
case FIOGETOWN:
atomic_dec(&dev->ioctl_count);
+#if (__FreeBSD_version >= 500000)
+ *(int *) data = fgetown(&dev->buf_sigio);
+#else
*(int *) data = fgetown(dev->buf_sigio);
+#endif
return 0;
}
#endif /* __FreeBSD__ */
diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h
index 1206b25f..ff2a6460 100644
--- a/bsd-core/drm_os_freebsd.h
+++ b/bsd-core/drm_os_freebsd.h
@@ -142,7 +142,7 @@ do { \
#define DRM_HZ hz
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
-while (condition) { \
+while (!condition) { \
ret = tsleep( &(queue), PZERO | PCATCH, "drmwtq", (timeout) ); \
if ( ret ) \
return ret; \
diff --git a/bsd-core/mga/Makefile b/bsd-core/mga/Makefile
index 13e43c46..a280e024 100644
--- a/bsd-core/mga/Makefile
+++ b/bsd-core/mga/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/..
KMOD= mga
NOMAN= YES
-SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c
+SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c mga_irq.c
SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h
CFLAGS+= ${DEBUG_FLAGS} -I. -I..
diff --git a/bsd-core/r128/Makefile b/bsd-core/r128/Makefile
index 83f78482..2d2e7e4f 100644
--- a/bsd-core/r128/Makefile
+++ b/bsd-core/r128/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/..
KMOD = r128
NOMAN= YES
-SRCS = r128_cce.c r128_drv.c r128_state.c
+SRCS = r128_cce.c r128_drv.c r128_state.c r128_irq.c
SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
CFLAGS += ${DEBUG_FLAGS} -I. -I..
diff --git a/bsd/Imakefile b/bsd/Imakefile
index 575e72b4..fddf8f53 100644
--- a/bsd/Imakefile
+++ b/bsd/Imakefile
@@ -1,5 +1,4 @@
-
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.8 2001/12/13 00:24:45 alanh Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.9 2002/02/27 22:18:10 tsi Exp $
XCOMM This is a kludge until we determine how best to build the
XCOMM kernel-specific device driver. This allows us to continue
@@ -20,10 +19,12 @@ all::
clean::
$(MAKE) -f Makefile.bsd clean
+LinkSourceFile(drm_sarea.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_dma.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_drm.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_drv.h,$(XF86OSSRC)/shared/drm/kernel)
+LinkSourceFile(mga_irq.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_state.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_ucode.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(mga_warp.c,$(XF86OSSRC)/shared/drm/kernel)
@@ -31,6 +32,7 @@ LinkSourceFile(r128.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(r128_cce.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(r128_drm.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(r128_drv.h,$(XF86OSSRC)/shared/drm/kernel)
+LinkSourceFile(r128_irq.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(r128_state.c,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(radeon.h,$(XF86OSSRC)/shared/drm/kernel)
LinkSourceFile(radeon_cp.c,$(XF86OSSRC)/shared/drm/kernel)
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 1adaa0e5..b7b21da4 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -448,6 +448,7 @@ struct drm_device {
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
+ int irqrid; /* Interrupt used by board */
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 4593a712..5632b5a2 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -41,12 +41,6 @@
#define __HAVE_SHARED_IRQ 0
#endif
-#if __HAVE_SHARED_IRQ
-#define DRM_IRQ_TYPE SA_SHIRQ
-#else
-#define DRM_IRQ_TYPE 0
-#endif
-
#if __HAVE_DMA
int DRM(dma_setup)( drm_device_t *dev )
@@ -503,7 +497,6 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
int DRM(irq_install)( drm_device_t *dev, int irq )
{
- int rid;
int retcode;
if ( !irq )
@@ -535,18 +528,24 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM(driver_irq_preinstall)( dev );
/* Install handler */
- rid = 0;
- dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid,
+ dev->irqrid = 0;
+ dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
- if (!dev->irqr)
+ if (!dev->irqr) {
+ DRM_LOCK;
+ dev->irq = 0;
+ dev->irqrid = 0;
+ DRM_UNLOCK;
return ENOENT;
+ }
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
DRM_LOCK;
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
return retcode;
}
@@ -560,10 +559,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
int DRM(irq_uninstall)( drm_device_t *dev )
{
int irq;
-
+ int irqrid;
+
DRM_LOCK;
irq = dev->irq;
+ irqrid = dev->irqrid;
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
if ( !irq )
@@ -574,7 +576,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
return 0;
}
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 872f6bc6..4a6fc15f 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -1037,7 +1037,11 @@ int DRM(ioctl)( DRM_IOCTL_ARGS )
case FIOGETOWN:
atomic_dec(&dev->ioctl_count);
+#if (__FreeBSD_version >= 500000)
+ *(int *) data = fgetown(&dev->buf_sigio);
+#else
*(int *) data = fgetown(dev->buf_sigio);
+#endif
return 0;
}
#endif /* __FreeBSD__ */
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 1206b25f..ff2a6460 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -142,7 +142,7 @@ do { \
#define DRM_HZ hz
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
-while (condition) { \
+while (!condition) { \
ret = tsleep( &(queue), PZERO | PCATCH, "drmwtq", (timeout) ); \
if ( ret ) \
return ret; \
diff --git a/bsd/mga/Makefile b/bsd/mga/Makefile
index 13e43c46..a280e024 100644
--- a/bsd/mga/Makefile
+++ b/bsd/mga/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/..
KMOD= mga
NOMAN= YES
-SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c
+SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c mga_irq.c
SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h
CFLAGS+= ${DEBUG_FLAGS} -I. -I..
diff --git a/bsd/r128/Makefile b/bsd/r128/Makefile
index 83f78482..2d2e7e4f 100644
--- a/bsd/r128/Makefile
+++ b/bsd/r128/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/..
KMOD = r128
NOMAN= YES
-SRCS = r128_cce.c r128_drv.c r128_state.c
+SRCS = r128_cce.c r128_drv.c r128_state.c r128_irq.c
SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
CFLAGS += ${DEBUG_FLAGS} -I. -I..
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 8d3a20d1..0532a1ec 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -27,13 +27,14 @@
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.25 2001/08/27 17:40:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.28 2002/10/16 01:26:49 dawes Exp $
*
*/
#ifdef XFree86Server
# include "xf86.h"
# include "xf86_OSproc.h"
+# include "drm.h"
# include "xf86_ansic.h"
# define _DRM_MALLOC xalloc
# define _DRM_FREE xfree
@@ -66,6 +67,7 @@ extern int xf86RemoveSIGIOHandler(int fd);
# define _DRM_MALLOC Xmalloc
# define _DRM_FREE Xfree
# endif
+# include "drm.h"
#endif
/* No longer needed with CVS kernel modules on alpha
@@ -81,7 +83,6 @@ extern unsigned long _bus_base(void);
#endif
#include "xf86drm.h"
-#include "drm.h"
#ifndef DRM_MAJOR
#define DRM_MAJOR 226 /* Linux */
@@ -197,7 +198,6 @@ static int drmOpenDevice(long dev, int minor)
stat_t st;
char buf[64];
int fd;
- mode_t dirmode = DRM_DEV_DIRMODE;
mode_t devmode = DRM_DEV_MODE;
int isroot = !geteuid();
#if defined(XFree86Server)
@@ -209,23 +209,16 @@ static int drmOpenDevice(long dev, int minor)
#if defined(XFree86Server)
devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
- dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0;
- dirmode |= (devmode & S_IRGRP) ? S_IXGRP : 0;
- dirmode |= (devmode & S_IROTH) ? S_IXOTH : 0;
- dirmode |= devmode;
devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
#endif
if (stat(DRM_DIR_NAME, &st)) {
if (!isroot) return DRM_ERR_NOT_ROOT;
- remove(DRM_DIR_NAME);
- mkdir(DRM_DIR_NAME, dirmode);
+ mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE);
+ chown(DRM_DIR_NAME, 0, 0); /* root:root */
+ chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE);
}
-#if defined(XFree86Server)
- chown(DRM_DIR_NAME, user, group);
- chmod(DRM_DIR_NAME, dirmode);
-#endif
sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
drmMsg("drmOpenDevice: node name is %s\n", buf);