summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
authorvehemens <vehemens@verizon.net>2008-09-08 22:06:09 -0700
committerRobert Noland <rnoland@2hip.net>2008-09-10 23:35:10 -0400
commit973c634eaa54ee4085a72102c690bc643cb2d7a8 (patch)
tree93cf21b7354ce2775621863e98c5302691070377 /bsd-core
parentb54d15d8fd252df5f0914ab245431e66b9a4e8ab (diff)
Remove incomplete and obsolete free/net/open code.
Signed-off-by: Robert Noland <rnoland@2hip.net>
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/drmP.h148
-rw-r--r--bsd-core/drm_agpsupport.c7
-rw-r--r--bsd-core/drm_atomic.h53
-rw-r--r--bsd-core/drm_bufs.c24
-rw-r--r--bsd-core/drm_drv.c231
-rw-r--r--bsd-core/drm_fops.c13
-rw-r--r--bsd-core/drm_irq.c29
-rw-r--r--bsd-core/drm_lock.c5
-rw-r--r--bsd-core/drm_memory.c43
-rw-r--r--bsd-core/drm_pci.c25
-rw-r--r--bsd-core/drm_vm.c18
-rw-r--r--bsd-core/i915_drv.c5
-rw-r--r--bsd-core/mach64_drv.c5
-rw-r--r--bsd-core/mga_drv.c12
-rw-r--r--bsd-core/r128_drv.c10
-rw-r--r--bsd-core/radeon_drv.c10
-rw-r--r--bsd-core/savage_drv.c5
-rw-r--r--bsd-core/sis_drv.c10
-rw-r--r--bsd-core/tdfx_drv.c10
-rw-r--r--bsd-core/via_drv.c10
20 files changed, 8 insertions, 665 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index de59f426..8404df74 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -74,7 +74,6 @@ typedef struct drm_file drm_file_t;
#include <machine/sysarch.h>
#include <sys/endian.h>
#include <sys/mman.h>
-#if defined(__FreeBSD__)
#include <sys/rman.h>
#include <sys/memrange.h>
#if __FreeBSD_version >= 800004
@@ -83,31 +82,9 @@ typedef struct drm_file drm_file_t;
#include <pci/agpvar.h>
#endif /* __FreeBSD_version >= 800004 */
#include <sys/agpio.h>
-#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
#include <dev/pci/pcivar.h>
#include <sys/selinfo.h>
-#else /* __FreeBSD_version >= 500000 */
-#include <pci/pcivar.h>
-#include <sys/select.h>
-#endif /* __FreeBSD_version < 500000 */
-#elif defined(__NetBSD__)
-#include <machine/mtrr.h>
-#include <sys/vnode.h>
-#include <sys/select.h>
-#include <sys/device.h>
-#include <sys/resourcevar.h>
-#include <sys/lkm.h>
-#include <sys/agpio.h>
-#include <sys/ttycom.h>
-#include <uvm/uvm.h>
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/agpvar.h>
-#elif defined(__OpenBSD__)
-#include <sys/lkm.h>
-#include <uvm/uvm.h>
-#endif
#include <sys/bus.h>
#include "drm.h"
@@ -115,13 +92,11 @@ typedef struct drm_file drm_file_t;
#include "drm_atomic.h"
#include "drm_internal.h"
-#ifdef __FreeBSD__
#include <opt_drm.h>
#ifdef DRM_DEBUG
#undef DRM_DEBUG
#define DRM_DEBUG_DEFAULT_ON 1
#endif /* DRM_DEBUG */
-#endif
#if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
#include <sys/file.h>
@@ -195,12 +170,6 @@ MALLOC_DECLARE(M_DRM);
#define DRM_WAKEUP_INT(w) wakeup(w)
#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
-#if defined(__FreeBSD__) && __FreeBSD_version < 502109
-#define bus_alloc_resource_any(dev, type, rid, flags) \
- bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)
-#endif
-
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
#define DRM_CURPROC curthread
#define DRM_STRUCTPROC struct thread
#define DRM_SPINTYPE struct mtx
@@ -218,21 +187,6 @@ MALLOC_DECLARE(M_DRM);
#define DRM_LOCK() mtx_lock(&dev->dev_lock)
#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
-#else /* __FreeBSD__ && __FreeBSD_version >= 500000 */
-#define DRM_CURPROC curproc
-#define DRM_STRUCTPROC struct proc
-#define DRM_SPINTYPE struct simplelock
-#define DRM_SPININIT(l,name)
-#define DRM_SPINUNINIT(l)
-#define DRM_SPINLOCK(l)
-#define DRM_SPINUNLOCK(u)
-#define DRM_SPINLOCK_ASSERT(l)
-#define DRM_CURRENTPID curproc->p_pid
-#define DRM_LOCK()
-#define DRM_UNLOCK()
-#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
-#define spldrm() spltty()
-#endif /* __NetBSD__ || __OpenBSD__ */
#define DRM_IRQ_ARGS void *arg
typedef void irqreturn_t;
@@ -246,16 +200,8 @@ enum {
};
#define DRM_AGP_MEM struct agp_memory_info
-#if defined(__FreeBSD__)
#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
-#elif defined(__NetBSD__)
-#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, minor(_kdev))
-#elif defined(__OpenBSD__)
-#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, \
- minor(_kdev)))->dv_cfdata->cf_driver->cd_devs[minor(_kdev)]
-#endif
-#if defined(__FreeBSD__)
#define PAGE_ALIGN(addr) round_page(addr)
/* DRM_SUSER returns true if the user is superuser */
#if __FreeBSD_version >= 700000
@@ -267,20 +213,6 @@ enum {
#define DRM_MTRR_WC MDF_WRITECOMBINE
#define jiffies ticks
-#else /* __FreeBSD__ */
-
-#define CDEV_MAJOR 34
-#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-/* DRM_SUSER returns true if the user is superuser */
-#define DRM_SUSER(p) (suser(p->p_ucred, &p->p_acflag) == 0)
-#define DRM_AGP_FIND_DEVICE() agp_find_device(0)
-#define DRM_MTRR_WC MTRR_TYPE_WC
-#define jiffies hardclock_ticks
-
-typedef struct drm_device *device_t;
-extern struct cfdriver drm_cd;
-#endif /* !__FreeBSD__ */
-
/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
#ifndef PCIY_AGP
#define PCIY_AGP 0x02
@@ -318,7 +250,6 @@ typedef u_int8_t u8;
"lock; addl $0,0(%%rsp)" : : : "memory");
#endif
-#ifdef __FreeBSD__
#define DRM_READ8(map, offset) \
*(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset))
#define DRM_READ16(map, offset) \
@@ -335,27 +266,6 @@ typedef u_int8_t u8;
#define DRM_VERIFYAREA_READ( uaddr, size ) \
(!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
-#else /* __FreeBSD__ */
-
-typedef vaddr_t vm_offset_t;
-
-#define DRM_READ8(map, offset) \
- bus_space_read_1( (map)->bst, (map)->bsh, (offset))
-#define DRM_READ16(map, offset) \
- bus_space_read_2( (map)->bst, (map)->bsh, (offset))
-#define DRM_READ32(map, offset) \
- bus_space_read_4( (map)->bst, (map)->bsh, (offset))
-#define DRM_WRITE8(map, offset, val) \
- bus_space_write_1((map)->bst, (map)->bsh, (offset), (val))
-#define DRM_WRITE16(map, offset, val) \
- bus_space_write_2((map)->bst, (map)->bsh, (offset), (val))
-#define DRM_WRITE32(map, offset, val) \
- bus_space_write_4((map)->bst, (map)->bsh, (offset), (val))
-
-#define DRM_VERIFYAREA_READ( uaddr, size ) \
- (!uvm_useracc((caddr_t)uaddr, size, VM_PROT_READ))
-#endif /* !__FreeBSD__ */
-
#define DRM_COPY_TO_USER(user, kern, size) \
copyout(kern, user, size)
#define DRM_COPY_FROM_USER(kern, user, size) \
@@ -364,13 +274,8 @@ typedef vaddr_t vm_offset_t;
copyin(arg2, arg1, arg3)
#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
copyout(arg2, arg1, arg3)
-#if __FreeBSD_version > 500000
#define DRM_GET_USER_UNCHECKED(val, uaddr) \
((val) = fuword32(uaddr), 0)
-#else
-#define DRM_GET_USER_UNCHECKED(val, uaddr) \
- ((val) = fuword(uaddr), 0)
-#endif
#define cpu_to_le32(x) htole32(x)
#define le32_to_cpu(x) le32toh(x)
@@ -393,7 +298,6 @@ do { \
} \
} while (0)
-#if defined(__FreeBSD__) && __FreeBSD_version > 500000
/* Returns -errno to shared code */
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
for ( ret = 0 ; !ret && !(condition) ; ) { \
@@ -405,17 +309,6 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \
mtx_unlock(&dev->irq_lock); \
DRM_LOCK(); \
}
-#else
-/* Returns -errno to shared code */
-#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
-for ( ret = 0 ; !ret && !(condition) ; ) { \
- int s = spldrm(); \
- if (!(condition)) \
- ret = -tsleep( &(queue), PZERO | PCATCH, \
- "drmwtq", (timeout) ); \
- splx(s); \
-}
-#endif
#define DRM_ERROR(fmt, arg...) \
printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
@@ -501,12 +394,8 @@ typedef struct drm_freelist {
typedef struct drm_dma_handle {
void *vaddr;
bus_addr_t busaddr;
-#if defined(__FreeBSD__)
bus_dma_tag_t tag;
bus_dmamap_t map;
-#elif defined(__NetBSD__)
- bus_dma_segment_t seg;
-#endif
} drm_dma_handle_t;
typedef struct drm_buf_entry {
@@ -727,10 +616,6 @@ struct drm_driver_info {
* DRM device functions structure
*/
struct drm_device {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- struct device device; /* softc is an extension of struct device */
-#endif
-
struct drm_driver_info *driver;
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
@@ -739,21 +624,17 @@ struct drm_device {
char *unique; /* Unique identifier: e.g., busid */
int unique_len; /* Length of unique field */
-#ifdef __FreeBSD__
device_t device; /* Device instance from newbus */
-#endif
struct cdev *devnode; /* Device number for mknod */
int if_version; /* Highest interface version set */
int flags; /* Flags to open(2) */
/* Locks */
-#if defined(__FreeBSD__) && __FreeBSD_version > 500000
struct mtx vbl_lock; /* protects vblank operations */
struct mtx dma_lock; /* protects dev->dma */
struct mtx irq_lock; /* protects irq condition checks */
struct mtx dev_lock; /* protects everything else */
-#endif
DRM_SPINTYPE drw_lock;
DRM_SPINTYPE tsk_lock;
@@ -784,12 +665,8 @@ struct drm_device {
/* Context support */
int irq; /* Interrupt used by board */
int irq_enabled; /* True if the irq handler is enabled */
-#ifdef __FreeBSD__
int irqrid; /* Interrupt used by board */
struct resource *irqr; /* Resource for interrupt used by board */
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- struct pci_attach_args pa;
-#endif
void *irqh; /* Handle from bus_setup_intr */
/* Storage of resource pointers for drm_get_resource_* */
@@ -811,11 +688,7 @@ struct drm_device {
struct drm_vblank_info *vblank; /* per crtc vblank info */
int num_crtcs;
-#ifdef __FreeBSD__
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
-#elif defined(__NetBSD__)
- pid_t buf_pgid;
-#endif
/* Sysctl support */
struct drm_sysctl_info *sysctl;
@@ -853,7 +726,6 @@ static inline int drm_core_has_AGP(struct drm_device *dev)
extern int drm_debug_flag;
/* Device setup support (drm_drv.c) */
-#ifdef __FreeBSD__
int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist);
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist);
int drm_detach(device_t nbdev);
@@ -863,32 +735,14 @@ d_close_t drm_close;
d_read_t drm_read;
d_poll_t drm_poll;
d_mmap_t drm_mmap;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist);
-int drm_attach(struct pci_attach_args *pa, dev_t kdev, drm_pci_id_list_t *idlist);
-dev_type_ioctl(drm_ioctl);
-dev_type_open(drm_open);
-dev_type_close(drm_close);
-dev_type_read(drm_read);
-dev_type_poll(drm_poll);
-dev_type_mmap(drm_mmap);
-#endif
extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
/* File operations helpers (drm_fops.c) */
-#ifdef __FreeBSD__
extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
DRM_STRUCTPROC *p,
struct drm_device *dev);
extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
DRM_STRUCTPROC *p);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-extern int drm_open_helper(dev_t kdev, int flags, int fmt,
- DRM_STRUCTPROC *p,
- struct drm_device *dev);
-extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
- DRM_STRUCTPROC *p);
-#endif /* __NetBSD__ || __OpenBSD__ */
/* Memory management support (drm_memory.c) */
void drm_mem_init(void);
@@ -980,11 +834,9 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
void drm_sg_cleanup(drm_sg_mem_t *entry);
int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
-#ifdef __FreeBSD__
/* sysctl support (drm_sysctl.h) */
extern int drm_sysctl_init(struct drm_device *dev);
extern int drm_sysctl_cleanup(struct drm_device *dev);
-#endif /* __FreeBSD__ */
/* ATI PCIGART support (ati_pcigart.c) */
int drm_ati_pcigart_init(struct drm_device *dev,
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index 62fa5d27..a568c5a5 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -35,20 +35,17 @@
#include "drmP.h"
-#ifdef __FreeBSD__
#if __FreeBSD_version >= 800004
#include <dev/agp/agpreg.h>
#else /* __FreeBSD_version >= 800004 */
#include <pci/agpreg.h>
#endif /* __FreeBSD_version >= 800004 */
#include <dev/pci/pcireg.h>
-#endif
/* Returns 1 if AGP or 0 if not. */
static int
drm_device_find_capability(struct drm_device *dev, int cap)
{
-#ifdef __FreeBSD__
#if __FreeBSD_version >= 602102
return (pci_find_extcap(dev->device, cap, NULL) == 0);
@@ -82,10 +79,6 @@ drm_device_find_capability(struct drm_device *dev, int cap)
return 0;
#endif
-#else
- /* XXX: fill me in for non-FreeBSD */
- return 1;
-#endif
}
int drm_device_is_agp(struct drm_device *dev)
diff --git a/bsd-core/drm_atomic.h b/bsd-core/drm_atomic.h
index b499fc96..76de7a2f 100644
--- a/bsd-core/drm_atomic.h
+++ b/bsd-core/drm_atomic.h
@@ -33,65 +33,12 @@
typedef u_int32_t atomic_t;
-#ifdef __FreeBSD__
#define atomic_set(p, v) (*(p) = (v))
#define atomic_read(p) (*(p))
#define atomic_inc(p) atomic_add_int(p, 1)
#define atomic_dec(p) atomic_subtract_int(p, 1)
#define atomic_add(n, p) atomic_add_int(p, n)
#define atomic_sub(n, p) atomic_subtract_int(p, n)
-#else /* __FreeBSD__ */
-/* FIXME */
-#define atomic_set(p, v) (*(p) = (v))
-#define atomic_read(p) (*(p))
-#define atomic_inc(p) (*(p) += 1)
-#define atomic_dec(p) (*(p) -= 1)
-#define atomic_add(n, p) (*(p) += (n))
-#define atomic_sub(n, p) (*(p) -= (n))
-/* FIXME */
-#define atomic_add_int(p, v) *(p) += v
-#define atomic_subtract_int(p, v) *(p) -= v
-#define atomic_set_int(p, bits) *(p) |= (bits)
-#define atomic_clear_int(p, bits) *(p) &= ~(bits)
-#endif /* !__FreeBSD__ */
-
-#if !defined(__FreeBSD_version) || (__FreeBSD_version < 500000)
-#if defined(__i386__)
-/* The extra atomic functions from 5.0 haven't been merged to 4.x */
-static __inline int
-atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
-{
- int res = exp;
-
- __asm __volatile (
- " lock ; "
- " cmpxchgl %1,%2 ; "
- " setz %%al ; "
- " movzbl %%al,%0 ; "
- "1: "
- "# atomic_cmpset_int"
- : "+a" (res) /* 0 (result) */
- : "r" (src), /* 1 */
- "m" (*(dst)) /* 2 */
- : "memory");
-
- return (res);
-}
-#else /* __i386__ */
-static __inline int
-atomic_cmpset_int(__volatile__ int *dst, int old, int new)
-{
- int s = splhigh();
- if (*dst==old) {
- *dst = new;
- splx(s);
- return 1;
- }
- splx(s);
- return 0;
-}
-#endif /* !__i386__ */
-#endif /* !__FreeBSD_version || __FreeBSD_version < 500000 */
static __inline atomic_t
test_and_set_bit(int b, volatile void *p)
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index 6b31ad65..c9b5dc4e 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -1016,30 +1016,13 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
const int zero = 0;
vm_offset_t address;
struct vmspace *vms;
-#ifdef __FreeBSD__
vm_ooffset_t foff;
vm_size_t size;
vm_offset_t vaddr;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- struct vnode *vn;
- voff_t foff;
- vsize_t size;
- vaddr_t vaddr;
-#endif /* __NetBSD__ || __OpenBSD__ */
-
struct drm_buf_map *request = data;
int i;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- if (!vfinddev(kdev, VCHR, &vn))
- return 0; /* FIXME: Shouldn't this be EINVAL or something? */
-#endif /* __NetBSD__ || __OpenBSD */
-
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
vms = DRM_CURPROC->td_proc->p_vmspace;
-#else
- vms = DRM_CURPROC->p_vmspace;
-#endif
DRM_SPINLOCK(&dev->dma_lock);
dev->buf_use++; /* Can't allocate more after this call */
@@ -1064,7 +1047,6 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
foff = 0;
}
-#ifdef __FreeBSD__
vaddr = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ);
#if __FreeBSD_version >= 600023
retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE,
@@ -1074,12 +1056,6 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
VM_PROT_ALL, MAP_SHARED, SLIST_FIRST(&dev->devnode->si_hlist),
foff);
#endif
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- vaddr = round_page((vaddr_t)vms->vm_daddr + MAXDSIZ);
- retcode = uvm_mmap(&vms->vm_map, &vaddr, size,
- UVM_PROT_READ | UVM_PROT_WRITE, UVM_PROT_ALL, MAP_SHARED,
- &vn->v_uobj, foff, p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
-#endif /* __NetBSD__ || __OpenBSD */
if (retcode)
goto done;
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index b40d1da4..57a2bbed 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -50,22 +50,13 @@ static void drm_unload(struct drm_device *dev);
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
drm_pci_id_list_t *idlist);
-#ifdef __FreeBSD__
#define DRIVER_SOFTC(unit) \
((struct drm_device *)devclass_get_softc(drm_devclass, unit))
MODULE_VERSION(drm, 1);
MODULE_DEPEND(drm, agp, 1, 1, 1);
MODULE_DEPEND(drm, pci, 1, 1, 1);
-#if __FreeBSD_version > 502127
MODULE_DEPEND(drm, mem, 1, 1, 1);
-#endif
-#endif /* __FreeBSD__ */
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-#define DRIVER_SOFTC(unit) \
- ((struct drm_device *)device_lookup(&drm_cd, unit))
-#endif /* __NetBSD__ || __OpenBSD__ */
static drm_ioctl_desc_t drm_ioctls[256] = {
DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, 0),
@@ -129,11 +120,8 @@ static drm_ioctl_desc_t drm_ioctls[256] = {
DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_update_draw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
};
-#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,
@@ -141,15 +129,7 @@ static struct cdevsw drm_cdevsw = {
.d_poll = drm_poll,
.d_mmap = drm_mmap,
.d_name = "drm",
-#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
+ .d_flags = D_TRACKCLOSE | D_NEEDGIANT
};
int drm_probe(device_t dev, drm_pci_id_list_t *idlist)
@@ -202,13 +182,12 @@ int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
DRM_DEV_GID,
DRM_DEV_MODE,
"dri/card%d", unit);
-#if __FreeBSD_version >= 500000
+
mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF);
mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF);
mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF);
mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF);
mtx_init(&dev->tsk_lock, "drmtsk", NULL, MTX_DEF);
-#endif
id_entry = drm_find_description(pci_get_vendor(dev->device),
pci_get_device(dev->device), idlist);
@@ -229,147 +208,6 @@ int drm_detach(device_t dev)
devclass_t drm_devclass;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-
-static struct cdevsw drm_cdevsw = {
- drm_open,
- drm_close,
- drm_read,
- nowrite,
- drm_ioctl,
- nostop,
- notty,
- drm_poll,
- drm_mmap,
- nokqfilter,
- D_TTY
-};
-
-int drm_refcnt = 0;
-
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106080000
-MOD_DEV("drm", DRIVER_NAME, NULL, -1, &drm_cdevsw, CDEV_MAJOR);
-#else
-MOD_DEV("drm", LM_DT_CHAR, CDEV_MAJOR, &drm_cdevsw);
-#endif
-
-int drm_lkmentry(struct lkm_table *lkmtp, int cmd, int ver);
-static int drm_lkmhandle(struct lkm_table *lkmtp, int cmd);
-
-int drm_modprobe(void);
-int drm_probe(struct pci_attach_args *pa);
-void drm_attach(struct pci_attach_args *pa, dev_t kdev);
-
-int drm_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) {
- DISPATCH(lkmtp, cmd, ver, drm_lkmhandle, drm_lkmhandle, drm_lkmhandle);
-}
-
-static int drm_lkmhandle(struct lkm_table *lkmtp, int cmd)
-{
- int error = 0;
-
- switch(cmd) {
- case LKM_E_LOAD:
- if (lkmexists(lkmtp))
- return EEXIST;
-
- if(drm_modprobe())
- return 0;
-
- return 1;
-
- case LKM_E_UNLOAD:
- if (drm_refcnt > 0)
- return (EBUSY);
- break;
- case LKM_E_STAT:
- break;
-
- default:
- error = EIO;
- break;
- }
-
- return error;
-}
-
-int drm_modprobe(void)
-{
- struct pci_attach_args pa;
- int error;
-
- error = pci_find_device(&pa, drm_probe, idlist);
- if (error != 0)
- drm_attach(&pa, 0);
-
- return error;
-}
-
-int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t idlist)
-{
- const char *desc;
- drm_pci_id_list_t *id_entry;
-
- id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
- PCI_PRODUCT(pa->pa_id), idlist);
- if (id_entry != NULL) {
- return 1;
- }
-
- return 0;
-}
-
-void drm_attach(struct pci_attach_args *pa, dev_t kdev,
- drm_pci_id_list_t *idlist)
-{
- int i;
- struct drm_device *dev;
- drm_pci_id_list_t *id_entry;
-
- config_makeroom(kdev, &drm_cd);
- drm_cd.cd_devs[(kdev)] = malloc(sizeof(struct drm_device),
- M_DRM, M_WAITOK);
- dev = DRIVER_SOFTC(kdev);
-
- memset(dev, 0, sizeof(struct drm_device));
- memcpy(&dev->pa, pa, sizeof(dev->pa));
-
- dev->irq = pa->pa_intrline;
- dev->pci_domain = 0;
- dev->pci_bus = pa->pa_bus;
- dev->pci_slot = pa->pa_device;
- dev->pci_func = pa->pa_function;
- dev->dma_tag = pa->pa_dmat;
-
- id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
- PCI_PRODUCT(pa->pa_id), idlist);
- dev->driver->pci_id_entry = id_entry;
-
- DRM_INFO("%s", id_entry->name);
- drm_load(dev);
-}
-
-int drm_detach(struct device *self, int flags)
-{
- drm_unload((struct drm_device *)self);
- return 0;
-}
-
-int drm_activate(struct device *self, enum devact act)
-{
- switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
- break;
-
- case DVACT_DEACTIVATE:
- /* FIXME */
- break;
- }
- return (0);
-}
-#endif /* __NetBSD__ || __OpenBSD__ */
-
drm_pci_id_list_t *drm_find_description(int vendor, int device,
drm_pci_id_list_t *idlist)
{
@@ -419,11 +257,7 @@ static int drm_firstopen(struct drm_device *dev)
dev->last_context = 0;
dev->if_version = 0;
-#ifdef __FreeBSD__
dev->buf_sigio = NULL;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- dev->buf_pgid = 0;
-#endif
DRM_DEBUG("\n");
@@ -451,7 +285,7 @@ static int drm_lastclose(struct drm_device *dev)
dev->unique = NULL;
dev->unique_len = 0;
}
- /* Clear pid list */
+ /* Clear pid list */
for (i = 0; i < DRM_HASH_SIZE; i++) {
for (pt = dev->magiclist[i].head; pt; pt = next) {
next = pt->next;
@@ -514,7 +348,7 @@ static int drm_load(struct drm_device *dev)
DRM_DEBUG("\n");
dev->irq = pci_get_irq(dev->device);
-#if defined(__FreeBSD__) && __FreeBSD_version >= 700053
+#if __FreeBSD_version >= 700053
dev->pci_domain = pci_get_domain(dev->device);
#else
dev->pci_domain = 0;
@@ -529,9 +363,7 @@ static int drm_load(struct drm_device *dev)
TAILQ_INIT(&dev->maplist);
drm_mem_init();
-#ifdef __FreeBSD__
drm_sysctl_init(dev);
-#endif
TAILQ_INIT(&dev->files);
dev->counters = 6;
@@ -596,22 +428,18 @@ static int drm_load(struct drm_device *dev)
return 0;
error:
-#ifdef __FreeBSD__
drm_sysctl_cleanup(dev);
-#endif
DRM_LOCK();
drm_lastclose(dev);
DRM_UNLOCK();
-#ifdef __FreeBSD__
destroy_dev(dev->devnode);
-#if __FreeBSD_version >= 500000
+
mtx_destroy(&dev->tsk_lock);
mtx_destroy(&dev->drw_lock);
mtx_destroy(&dev->vbl_lock);
mtx_destroy(&dev->irq_lock);
mtx_destroy(&dev->dev_lock);
-#endif
-#endif
+
return retcode;
}
@@ -621,10 +449,8 @@ static void drm_unload(struct drm_device *dev)
DRM_DEBUG("\n");
-#ifdef __FreeBSD__
drm_sysctl_cleanup(dev);
destroy_dev(dev->devnode);
-#endif
drm_ctxbitmap_cleanup(dev);
@@ -671,13 +497,11 @@ static void drm_unload(struct drm_device *dev)
if (pci_disable_busmaster(dev->device))
DRM_ERROR("Request to disable bus-master failed.\n");
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
mtx_destroy(&dev->tsk_lock);
mtx_destroy(&dev->drw_lock);
mtx_destroy(&dev->vbl_lock);
mtx_destroy(&dev->irq_lock);
mtx_destroy(&dev->dev_lock);
-#endif
}
@@ -720,9 +544,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
if (!retcode) {
atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
DRM_LOCK();
-#ifdef __FreeBSD__
device_busy(dev->device);
-#endif
if (!dev->open_count++)
retcode = drm_firstopen(dev);
DRM_UNLOCK();
@@ -758,13 +580,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
* Begin inline drm_release
*/
-#ifdef __FreeBSD__
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
DRM_CURRENTPID, (long)dev->device, dev->open_count);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- DRM_CURRENTPID, (long)&dev->device, dev->open_count);
-#endif
if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
&& dev->lock.file_priv == file_priv) {
@@ -796,14 +613,9 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
break; /* Got lock */
}
- /* Contention */
-#if defined(__FreeBSD__) && __FreeBSD_version > 500000
+ /* Contention */
retcode = mtx_sleep((void *)&dev->lock.lock_queue,
&dev->dev_lock, PZERO | PCATCH, "drmlk2", 0);
-#else
- retcode = tsleep((void *)&dev->lock.lock_queue,
- PZERO | PCATCH, "drmlk2", 0);
-#endif
if (retcode)
break;
}
@@ -817,13 +629,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
!dev->driver->reclaim_buffers_locked)
drm_reclaim_buffers(dev, file_priv);
-#if defined (__FreeBSD__) && (__FreeBSD_version >= 500000)
funsetown(&dev->buf_sigio);
-#elif defined(__FreeBSD__)
- funsetown(dev->buf_sigio);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- dev->buf_pgid = 0;
-#endif /* __NetBSD__ || __OpenBSD__ */
if (dev->driver->postclose != NULL)
dev->driver->postclose(dev, file_priv);
@@ -836,9 +642,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
done:
atomic_inc(&dev->counts[_DRM_STAT_CLOSES]);
-#ifdef __FreeBSD__
device_unbusy(dev->device);
-#endif
if (--dev->open_count == 0) {
retcode = drm_lastclose(dev);
}
@@ -872,42 +676,21 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
++file_priv->ioctl_count;
-#ifdef __FreeBSD__
DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
DRM_CURRENTPID, cmd, nr, (long)dev->device,
file_priv->authenticated);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
- DRM_CURRENTPID, cmd, nr, (long)&dev->device,
- file_priv->authenticated);
-#endif
switch (cmd) {
case FIONBIO:
case FIOASYNC:
return 0;
-#ifdef __FreeBSD__
case FIOSETOWN:
return fsetown(*(int *)data, &dev->buf_sigio);
case FIOGETOWN:
-#if (__FreeBSD_version >= 500000)
*(int *) data = fgetown(&dev->buf_sigio);
-#else
- *(int *) data = fgetown(dev->buf_sigio);
-#endif
- return 0;
-#endif /* __FreeBSD__ */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- case TIOCSPGRP:
- dev->buf_pgid = *(int *)data;
- return 0;
-
- case TIOCGPGRP:
- *(int *)data = dev->buf_pgid;
return 0;
-#endif /* __NetBSD__ */
}
if (IOCGROUP(cmd) != DRM_IOCTL_BASE) {
diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c
index 248e7937..a002d259 100644
--- a/bsd-core/drm_fops.c
+++ b/bsd-core/drm_fops.c
@@ -38,13 +38,8 @@
drm_file_t *drm_find_file_by_proc(struct drm_device *dev, DRM_STRUCTPROC *p)
{
-#if __FreeBSD_version >= 500021
uid_t uid = p->td_ucred->cr_svuid;
pid_t pid = p->td_proc->p_pid;
-#else
- uid_t uid = p->p_cred->p_svuid;
- pid_t pid = p->p_pid;
-#endif
drm_file_t *priv;
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
@@ -79,14 +74,8 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
DRM_UNLOCK();
return ENOMEM;
}
-#if __FreeBSD_version >= 500000
priv->uid = p->td_ucred->cr_svuid;
priv->pid = p->td_proc->p_pid;
-#else
- priv->uid = p->p_cred->p_svuid;
- priv->pid = p->p_pid;
-#endif
-
priv->refs = 1;
priv->minor = m;
priv->ioctl_count = 0;
@@ -110,9 +99,7 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
TAILQ_INSERT_TAIL(&dev->files, priv, link);
}
DRM_UNLOCK();
-#ifdef __FreeBSD__
kdev->si_drv1 = dev;
-#endif
return 0;
}
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index e3a4cb6a..00d4b31e 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -54,7 +54,6 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
return 0;
}
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
static irqreturn_t
drm_irq_handler_wrap(DRM_IRQ_ARGS)
{
@@ -64,7 +63,6 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
dev->driver->irq_handler(arg);
DRM_SPINUNLOCK(&dev->irq_lock);
}
-#endif
static void vblank_disable_fn(void *arg)
{
@@ -154,9 +152,6 @@ err:
int drm_irq_install(struct drm_device *dev)
{
int retcode;
-#ifdef __NetBSD__
- pci_intr_handle_t ih;
-#endif
if (dev->irq == 0 || dev->dev_private == NULL)
return EINVAL;
@@ -177,7 +172,6 @@ int drm_irq_install(struct drm_device *dev)
DRM_UNLOCK();
/* Install handler */
-#ifdef __FreeBSD__
dev->irqrid = 0;
dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ,
&dev->irqrid, RF_SHAREABLE);
@@ -196,18 +190,6 @@ int drm_irq_install(struct drm_device *dev)
#endif
if (retcode != 0)
goto err;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- if (pci_intr_map(&dev->pa, &ih) != 0) {
- retcode = ENOENT;
- goto err;
- }
- dev->irqh = pci_intr_establish(&dev->pa.pa_pc, ih, IPL_TTY,
- (irqreturn_t (*)(void *))dev->irq_handler, dev);
- if (!dev->irqh) {
- retcode = ENOENT;
- goto err;
- }
-#endif
/* After installing handler */
DRM_LOCK();
@@ -219,44 +201,35 @@ int drm_irq_install(struct drm_device *dev)
err:
DRM_LOCK();
dev->irq_enabled = 0;
-#ifdef ___FreeBSD__
if (dev->irqrid != 0) {
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid,
dev->irqr);
dev->irqrid = 0;
}
-#endif
DRM_UNLOCK();
return retcode;
}
int drm_irq_uninstall(struct drm_device *dev)
{
-#ifdef __FreeBSD__
int irqrid;
-#endif
if (!dev->irq_enabled)
return EINVAL;
dev->irq_enabled = 0;
-#ifdef __FreeBSD__
irqrid = dev->irqrid;
dev->irqrid = 0;
-#endif
DRM_DEBUG("irq=%d\n", dev->irq);
dev->driver->irq_uninstall(dev);
-#ifdef __FreeBSD__
DRM_UNLOCK();
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
DRM_LOCK();
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
-#endif
+
drm_vblank_cleanup(dev);
return 0;
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
index 31badd34..685b0ea3 100644
--- a/bsd-core/drm_lock.c
+++ b/bsd-core/drm_lock.c
@@ -78,13 +78,8 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
}
/* Contention */
-#if defined(__FreeBSD__) && __FreeBSD_version > 500000
ret = mtx_sleep((void *)&dev->lock.lock_queue, &dev->dev_lock,
PZERO | PCATCH, "drmlk2", 0);
-#else
- ret = tsleep((void *)&dev->lock.lock_queue, PZERO | PCATCH,
- "drmlk2", 0);
-#endif
if (ret != 0)
break;
}
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
index 272c0874..2dfd2b8e 100644
--- a/bsd-core/drm_memory.c
+++ b/bsd-core/drm_memory.c
@@ -42,9 +42,6 @@ MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures");
void drm_mem_init(void)
{
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- malloc_type_attach(M_DRM);
-#endif
}
void drm_mem_uninit(void)
@@ -87,27 +84,14 @@ void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map)
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
{
-#ifdef __FreeBSD__
return pmap_mapdev(map->offset, map->size);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- map->bst = dev->pa.pa_memt;
- if (bus_space_map(map->bst, map->offset, map->size,
- BUS_SPACE_MAP_LINEAR, &map->bsh))
- return NULL;
- return bus_space_vaddr(map->bst, map->bsh);
-#endif
}
void drm_ioremapfree(drm_local_map_t *map)
{
-#ifdef __FreeBSD__
pmap_unmapdev((vm_offset_t) map->handle, map->size);
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- bus_space_unmap(map->bst, map->bsh, map->size);
-#endif
}
-#ifdef __FreeBSD__
int
drm_mtrr_add(unsigned long offset, size_t size, int flags)
{
@@ -135,30 +119,3 @@ drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
return mem_range_attr_set(&mrdesc, &act);
}
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-int
-drm_mtrr_add(unsigned long offset, size_t size, int flags)
-{
- struct mtrr mtrrmap;
- int one = 1;
-
- mtrrmap.base = offset;
- mtrrmap.len = size;
- mtrrmap.type = flags;
- mtrrmap.flags = MTRR_VALID;
- return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
-}
-
-int
-drm_mtrr_del(unsigned long offset, size_t size, int flags)
-{
- struct mtrr mtrrmap;
- int one = 1;
-
- mtrrmap.base = offset;
- mtrrmap.len = size;
- mtrrmap.type = flags;
- mtrrmap.flags = 0;
- return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
-}
-#endif
diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c
index 16c830ec..e21715b2 100644
--- a/bsd-core/drm_pci.c
+++ b/bsd-core/drm_pci.c
@@ -34,7 +34,6 @@
/** \name PCI memory */
/*@{*/
-#if defined(__FreeBSD__)
static void
drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
{
@@ -46,7 +45,6 @@ drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error
KASSERT(nsegs == 1, ("drm_pci_busdma_callback: bad dma segment count"));
dmah->busaddr = segs[0].ds_addr;
}
-#endif
/**
* \brief Allocate a physically contiguous DMA-accessible consistent
@@ -70,7 +68,6 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
if (dmah == NULL)
return NULL;
-#ifdef __FreeBSD__
/* Make sure we aren't holding locks here */
mtx_assert(&dev->dev_lock, MA_NOTOWNED);
if (mtx_owned(&dev->dev_lock))
@@ -106,24 +103,6 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
free(dmah, M_DRM);
return NULL;
}
-#elif defined(__NetBSD__)
- ret = bus_dmamem_alloc(dev->dma_tag, size, align, PAGE_SIZE,
- &dmah->seg, 1, &nsegs, BUS_DMA_NOWAIT);
- if ((ret != 0) || (nsegs != 1)) {
- free(dmah, M_DRM);
- return NULL;
- }
-
- ret = bus_dmamem_map(dev->dma_tag, &dmah->seg, 1, size, &dmah->addr,
- BUS_DMA_NOWAIT);
- if (ret != 0) {
- bus_dmamem_free(dev->dma_tag, &dmah->seg, 1);
- free(dmah, M_DRM);
- return NULL;
- }
-
- dmah->dmaaddr = h->seg.ds_addr;
-#endif
return dmah;
}
@@ -137,12 +116,8 @@ drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
if (dmah == NULL)
return;
-#if defined(__FreeBSD__)
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
-#elif defined(__NetBSD__)
- bus_dmamem_free(dev->dma_tag, &dmah->seg, 1);
-#endif
free(dmah, M_DRM);
}
diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c
index e9c8702e..7fa33c91 100644
--- a/bsd-core/drm_vm.c
+++ b/bsd-core/drm_vm.c
@@ -28,24 +28,14 @@
#include "drmP.h"
#include "drm.h"
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
int drm_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr,
int prot)
-#elif defined(__FreeBSD__)
-int drm_mmap(dev_t kdev, vm_offset_t offset, int prot)
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
-#endif
{
struct drm_device *dev = drm_get_device_from_kdev(kdev);
drm_local_map_t *map;
drm_file_t *priv;
enum drm_map_type type;
-#ifdef __FreeBSD__
vm_paddr_t phys;
-#else
- paddr_t phys;
-#endif
DRM_LOCK();
priv = drm_find_file_by_proc(dev, DRM_CURPROC);
@@ -68,12 +58,8 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
unsigned long phys = dma->pagelist[page];
DRM_SPINUNLOCK(&dev->dma_lock);
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
*paddr = phys;
return 0;
-#else
- return atop(phys);
-#endif
} else {
DRM_SPINUNLOCK(&dev->dma_lock);
return -1;
@@ -124,11 +110,7 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
return -1; /* This should never happen. */
}
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
*paddr = phys;
return 0;
-#else
- return atop(phys);
-#endif
}
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index 7e745190..def35f0b 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -98,7 +98,6 @@ static void i915_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
i915_probe(device_t dev)
{
@@ -159,7 +158,3 @@ DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0);
DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(i915, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-CFDRIVER_DECL(i915, DV_TTY, NULL);
-#endif
diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c
index 36f3cec7..adb83d3a 100644
--- a/bsd-core/mach64_drv.c
+++ b/bsd-core/mach64_drv.c
@@ -72,7 +72,6 @@ static void mach64_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
mach64_probe(device_t dev)
{
@@ -127,7 +126,3 @@ DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0);
DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(mach64, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-CFDRIVER_DECL(mach64, DV_TTY, NULL);
-#endif
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index 85809609..5554236a 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -116,9 +116,6 @@ static void mga_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-
-
-#ifdef __FreeBSD__
static int
mga_probe(device_t dev)
{
@@ -173,12 +170,3 @@ DRIVER_MODULE(mga, vgapci, mga_driver, drm_devclass, 0, 0);
DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(mga, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(mga, DV_TTY, NULL);
-#else
-CFATTACH_DECL(mga, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
- drm_activate);
-#endif
-#endif
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index 5d4dfed9..4c20af4d 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -71,7 +71,6 @@ static void r128_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
r128_probe(device_t dev)
{
@@ -126,12 +125,3 @@ DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0);
DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(r128, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(r128, DV_TTY, NULL);
-#else
-CFATTACH_DECL(r128, sizeof(struct drm_device), drm_probe, drm_attach,
- drm_detach, drm_activate);
-#endif
-#endif
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
index 50a2f6b5..8ab3e995 100644
--- a/bsd-core/radeon_drv.c
+++ b/bsd-core/radeon_drv.c
@@ -76,7 +76,6 @@ static void radeon_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
radeon_probe(device_t dev)
{
@@ -131,12 +130,3 @@ DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0);
DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(radeon, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(radeon, DV_TTY, NULL);
-#else
-CFATTACH_DECL(radeon, sizeof(struct drm_device), drm_probe, drm_attach,
- drm_detach, drm_activate);
-#endif
-#endif /* __FreeBSD__ */
diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c
index 36dd34a7..35fcdfa3 100644
--- a/bsd-core/savage_drv.c
+++ b/bsd-core/savage_drv.c
@@ -62,7 +62,6 @@ static void savage_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
savage_probe(device_t dev)
{
@@ -117,7 +116,3 @@ DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0);
DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(savage, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-CFDRIVER_DECL(savage, DV_TTY, NULL);
-#endif
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
index bcf4ffd6..2ae1bff0 100644
--- a/bsd-core/sis_drv.c
+++ b/bsd-core/sis_drv.c
@@ -56,7 +56,6 @@ static void sis_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
sis_probe(device_t dev)
{
@@ -111,12 +110,3 @@ DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0);
DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(sis, DV_TTY, NULL);
-#else
-CFATTACH_DECL(sis, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
- drm_activate);
-#endif
-#endif
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
index 8d9e272f..44948b5c 100644
--- a/bsd-core/tdfx_drv.c
+++ b/bsd-core/tdfx_drv.c
@@ -58,7 +58,6 @@ static void tdfx_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
tdfx_probe(device_t dev)
{
@@ -113,12 +112,3 @@ DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0);
DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
#endif
MODULE_DEPEND(tdfx, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(tdfx, DV_TTY, NULL);
-#else
-CFATTACH_DECL(tdfx, sizeof(struct drm_device), drm_probe, drm_attach,
- drm_detach, drm_activate);
-#endif
-#endif
diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c
index 402b374b..e5f7d493 100644
--- a/bsd-core/via_drv.c
+++ b/bsd-core/via_drv.c
@@ -69,7 +69,6 @@ static void via_configure(struct drm_device *dev)
dev->driver->patchlevel = DRIVER_PATCHLEVEL;
}
-#ifdef __FreeBSD__
static int
via_probe(device_t dev)
{
@@ -120,12 +119,3 @@ static driver_t via_driver = {
extern devclass_t drm_devclass;
DRIVER_MODULE(via, pci, via_driver, drm_devclass, 0, 0);
MODULE_DEPEND(via, drm, 1, 1, 1);
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#ifdef _LKM
-CFDRIVER_DECL(via, DV_TTY, NULL);
-#else
-CFATTACH_DECL(via, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
- drm_activate);
-#endif
-#endif