summaryrefslogtreecommitdiff
path: root/bsd
diff options
context:
space:
mode:
Diffstat (limited to 'bsd')
-rw-r--r--bsd/drm_drv.h21
-rw-r--r--bsd/drm_irq.h4
-rw-r--r--bsd/drm_os_freebsd.h14
-rw-r--r--bsd/drm_vm.h2
4 files changed, 29 insertions, 12 deletions
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 4fa785a8..8ad130a3 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -211,6 +211,9 @@ const char *DRM(find_description)(int vendor, int device);
#ifdef __FreeBSD__
static struct cdevsw DRM(cdevsw) = {
+#if __FreeBSD_version >= 502103
+ .d_version = D_VERSION,
+#endif
.d_open = DRM( open ),
.d_close = DRM( close ),
.d_read = DRM( read ),
@@ -218,8 +221,12 @@ static struct cdevsw DRM(cdevsw) = {
.d_poll = DRM( poll ),
.d_mmap = DRM( mmap ),
.d_name = DRIVER_NAME,
- .d_maj = CDEV_MAJOR,
- .d_flags = D_TTY | D_TRACKCLOSE,
+#if __FreeBSD_version >= 502103
+ .d_flags = D_TRACKCLOSE | D_NEEDGIANT,
+#else
+ .d_maj = 145,
+ .d_flags = D_TRACKCLOSE,
+#endif
#if __FreeBSD_version < 500000
.d_bmaj = -1
#endif
@@ -830,7 +837,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
drm_file_t *priv;
DRM_DEVICE;
int retcode = 0;
- DRMFILE filp = (void *)(DRM_CURRENTPID);
+ DRMFILE filp = (void *)(uintptr_t)(DRM_CURRENTPID);
DRM_DEBUG( "open_count = %d\n", dev->open_count );
@@ -908,7 +915,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
}
}
#elif __HAVE_DMA
- DRM(reclaim_buffers)( dev, (void *)priv->pid );
+ DRM(reclaim_buffers)( dev, (void *)(uintptr_t)priv->pid );
#endif
#if defined (__FreeBSD__) && (__FreeBSD_version >= 500000)
@@ -953,7 +960,7 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
int nr = DRM_IOCTL_NR(cmd);
drm_file_t *priv;
- DRM_GET_PRIV_WITH_RETURN(priv, (DRMFILE)DRM_CURRENTPID);
+ DRM_GET_PRIV_WITH_RETURN(priv, (DRMFILE)(uintptr_t)DRM_CURRENTPID);
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
++priv->ioctl_count;
@@ -1008,7 +1015,7 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
!priv->authenticated))
return EACCES;
- retcode = func(kdev, cmd, data, flags, p, (void *)DRM_CURRENTPID);
+ retcode = func(kdev, cmd, data, flags, p, (void *)(uintptr_t)DRM_CURRENTPID);
return DRM_ERR(retcode);
}
@@ -1039,7 +1046,7 @@ int DRM(lock)( DRM_IOCTL_ARGS )
DRM_LOCK();
for (;;) {
if (DRM(lock_take)(&dev->lock.hw_lock->lock, lock.context)) {
- dev->lock.filp = (void *)DRM_CURRENTPID;
+ dev->lock.filp = (void *)(uintptr_t)DRM_CURRENTPID;
dev->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
break; /* Got lock */
diff --git a/bsd/drm_irq.h b/bsd/drm_irq.h
index 418e697e..eec6ab93 100644
--- a/bsd/drm_irq.h
+++ b/bsd/drm_irq.h
@@ -97,8 +97,8 @@ int DRM(irq_install)(drm_device_t *dev)
/* Install handler */
#ifdef __FreeBSD__
dev->irqrid = 0;
- dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
- 0, ~0, 1, RF_SHAREABLE);
+ dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ,
+ &dev->irqrid, RF_SHAREABLE);
if (!dev->irqr) {
retcode = ENOENT;
goto err;
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 06079555..073ceb37 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -114,7 +114,6 @@
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0
-#define CDEV_MAJOR 145
#if __FreeBSD_version >= 500000
#define DRM_CURPROC curthread
@@ -179,7 +178,7 @@ typedef void irqreturn_t;
#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) \
do { \
- if (_filp != (DRMFILE)DRM_CURRENTPID) { \
+ if (_filp != (DRMFILE)(intptr_t)DRM_CURRENTPID) { \
DRM_ERROR("filp doesn't match curproc\n"); \
return EINVAL; \
} \
@@ -292,6 +291,12 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \
#define DRM_READMEMORYBARRIER() alpha_mb();
#define DRM_WRITEMEMORYBARRIER() alpha_wmb();
#define DRM_MEMORYBARRIER() alpha_mb();
+#elif defined(__amd64__)
+#define DRM_READMEMORYBARRIER() __asm __volatile( \
+ "lock; addl $0,0(%%rsp)" : : : "memory");
+#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
+#define DRM_MEMORYBARRIER() __asm __volatile( \
+ "lock; addl $0,0(%%rsp)" : : : "memory");
#endif
#define PAGE_ALIGN(addr) round_page(addr)
@@ -305,6 +310,11 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \
MALLOC_DECLARE(malloctype);
#undef malloctype
+#if __FreeBSD_version < 502109
+#define bus_alloc_resource_any(dev, type, rid, flags) \
+ bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)
+#endif
+
#if __FreeBSD_version >= 480000
#define cpu_to_le32(x) htole32(x)
#define le32_to_cpu(x) le32toh(x)
diff --git a/bsd/drm_vm.h b/bsd/drm_vm.h
index e4ae8c7e..6f0c01ea 100644
--- a/bsd/drm_vm.h
+++ b/bsd/drm_vm.h
@@ -65,7 +65,7 @@ paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot)
drm_map_list_entry_t *listentry = NULL;
drm_file_t *priv;
- DRM_GET_PRIV_WITH_RETURN(priv, (DRMFILE)DRM_CURRENTPID);
+ DRM_GET_PRIV_WITH_RETURN(priv, (DRMFILE)(uintptr_t)DRM_CURRENTPID);
if (!priv->authenticated)
return DRM_ERR(EACCES);