summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/drmP.h25
-rw-r--r--bsd-core/mga/Makefile16
-rw-r--r--bsd-core/tdfx/Makefile4
3 files changed, 38 insertions, 7 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 863836a6..a60ddae2 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -49,7 +49,13 @@
#include <sys/sysctl.h>
#include <sys/select.h>
#include <sys/bus.h>
+#if __FreeBSD_version >= 500005
#include <sys/taskqueue.h>
+#endif
+
+#if __FreeBSD_version >= 500006
+#define DRM_AGP
+#endif
#ifdef DRM_AGP
#include <pci/agpvar.h>
@@ -71,9 +77,11 @@ typedef u_int32_t spinlock_t;
static __inline u_int32_t
test_and_set_bit(int b, volatile u_int32_t *p)
{
+ int s = splhigh();
u_int32_t m = 1<<b;
u_int32_t r = *p & m;
*p |= m;
+ splx(s);
return r;
}
@@ -101,9 +109,9 @@ find_first_zero_bit(volatile u_int32_t *p, int max)
int b;
for (b = 0; b < max; b += 32) {
- if (p[b >> 5]) {
+ if (p[b >> 5] != ~0) {
for (;;) {
- if (p[b >> 5] & (1 << (b & 0x1f)))
+ if ((p[b >> 5] & (1 << (b & 0x1f))) == 0)
return b;
b++;
}
@@ -117,10 +125,15 @@ find_first_zero_bit(volatile u_int32_t *p, int max)
#define memset(p, v, s) bzero(p, s)
/*
- * Software interrupts for DMA pipe feeding. The FreeBSD kernel apis
- * are severely lacking here.
+ * Fake out the module macros for versions of FreeBSD where they don't
+ * exist.
*/
-#define SWI_DRI (SWI_VM+2)
+#if __FreeBSD_version < 500002
+
+#define MODULE_VERSION(a,b) struct __hack
+#define MODULE_DEPEND(a,b,c,d,e) struct __hack
+
+#endif
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
also include looping detection. */
@@ -504,7 +517,9 @@ typedef struct drm_device {
int last_checked; /* Last context checked for DMA */
int last_context; /* Last current context */
int last_switch; /* Time at last context switch */
+#if __FreeBSD_version >= 500005
struct task task;
+#endif
struct timespec ctx_start;
struct timespec lck_start;
#if DRM_DMA_HISTOGRAM
diff --git a/bsd-core/mga/Makefile b/bsd-core/mga/Makefile
new file mode 100644
index 00000000..226728b5
--- /dev/null
+++ b/bsd-core/mga/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+KMOD = mga
+SRCS = mga_drv.c mga_context.c mga_state.c mga_bufs.c mga_dma.c
+SRCS += device_if.h bus_if.h pci_if.h
+CFLAGS += ${DEBUG_FLAGS} -I..
+KERN = /usr/src/sys
+KMODDEPS = drm
+
+@:
+ ln -sf /sys @
+
+machine:
+ ln -sf /sys/i386/include machine
+
+.include <bsd.kmod.mk>
diff --git a/bsd-core/tdfx/Makefile b/bsd-core/tdfx/Makefile
index e0ff8ffa..471a5fbf 100644
--- a/bsd-core/tdfx/Makefile
+++ b/bsd-core/tdfx/Makefile
@@ -4,7 +4,7 @@ KMOD = tdfx
SRCS = tdfx_drv.c tdfx_context.c
SRCS += device_if.h bus_if.h pci_if.h
CFLAGS += ${DEBUG_FLAGS} -I..
-KERN = /usr/src/sys
+KMODDEPS = drm
@:
ln -sf /sys @
@@ -12,4 +12,4 @@ KERN = /usr/src/sys
machine:
ln -sf /sys/i386/include machine
-.include "/usr/src/sys/conf/kmod.mk"
+.include <bsd.kmod.mk>