summaryrefslogtreecommitdiff
path: root/sys/dev/firewire/fwdev.c
diff options
context:
space:
mode:
authorHidetoshi Shimokawa <simokawa@FreeBSD.org>2004-03-26 23:17:10 +0000
committerHidetoshi Shimokawa <simokawa@FreeBSD.org>2004-03-26 23:17:10 +0000
commit10d3ed645940a41ec5505ae38b6522471207e913 (patch)
treed9df20a1b244e854f2dbc94fb002b9471a60e817 /sys/dev/firewire/fwdev.c
parent2754e7333eb0ead4fe08401be9e1ad474284b394 (diff)
downloadsrc-test2-10d3ed645940a41ec5505ae38b6522471207e913.tar.gz
src-test2-10d3ed645940a41ec5505ae38b6522471207e913.zip
Notes
Diffstat (limited to 'sys/dev/firewire/fwdev.c')
-rw-r--r--sys/dev/firewire/fwdev.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c
index c07be112e085..ae736c2969ba 100644
--- a/sys/dev/firewire/fwdev.c
+++ b/sys/dev/firewire/fwdev.c
@@ -39,7 +39,7 @@
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/mbuf.h>
-#if __FreeBSD_version < 500000
+#if defined(__DragonFly__) || __FreeBSD_version < 500000
#include <sys/buf.h>
#else
#include <sys/bio.h>
@@ -56,11 +56,19 @@
#include <sys/ioccom.h>
+#ifdef __DragonFly__
+#include "firewire.h"
+#include "firewirereg.h"
+#include "fwdma.h"
+#include "fwmem.h"
+#include "iec68113.h"
+#else
#include <dev/firewire/firewire.h>
#include <dev/firewire/firewirereg.h>
#include <dev/firewire/fwdma.h>
#include <dev/firewire/fwmem.h>
#include <dev/firewire/iec68113.h>
+#endif
#define FWNODE_INVAL 0xffff
@@ -74,7 +82,12 @@ static d_mmap_t fw_mmap;
static d_strategy_t fw_strategy;
struct cdevsw firewire_cdevsw = {
-#if __FreeBSD_version >= 500104
+#ifdef __DragonFly__
+#define CDEV_MAJOR 127
+ "fw", CDEV_MAJOR, D_MEM, NULL, 0,
+ fw_open, fw_close, fw_read, fw_write, fw_ioctl,
+ fw_poll, fw_mmap, fw_strategy, nodump, nopsize,
+#elif __FreeBSD_version >= 500104
.d_version = D_VERSION,
.d_open = fw_open,
.d_close = fw_close,
@@ -87,6 +100,7 @@ struct cdevsw firewire_cdevsw = {
.d_name = "fw",
.d_flags = D_MEM | D_NEEDGIANT
#else
+#define CDEV_MAJOR 127
fw_open, fw_close, fw_read, fw_write, fw_ioctl,
fw_poll, fw_mmap, fw_strategy, "fw", CDEV_MAJOR,
nodump, nopsize, D_MEM, -1
@@ -174,7 +188,7 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td)
if (dev->si_drv1 != NULL)
return (EBUSY);
-#if __FreeBSD_version >= 500000
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
if ((dev->si_flags & SI_NAMED) == 0) {
int unit = DEV2UNIT(dev);
int sub = DEV2SUB(dev);
@@ -737,7 +751,7 @@ fw_poll(dev_t dev, int events, fw_proc *td)
}
static int
-#if __FreeBSD_version < 500102
+#if defined(__DragonFly__) || __FreeBSD_version < 500102
fw_mmap (dev_t dev, vm_offset_t offset, int nproto)
#else
fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto)
@@ -747,7 +761,7 @@ fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto)
int unit = DEV2UNIT(dev);
if (DEV_FWMEM(dev))
-#if __FreeBSD_version < 500102
+#if defined(__DragonFly__) || __FreeBSD_version < 500102
return fwmem_mmap(dev, offset, nproto);
#else
return fwmem_mmap(dev, offset, paddr, nproto);
@@ -780,7 +794,9 @@ fwdev_makedev(struct firewire_softc *sc)
{
int err = 0;
-#if __FreeBSD_version >= 500000
+#if defined(__DragonFly__) || __FreeBSD_version < 500000
+ cdevsw_add(&firewire_cdevsw);
+#else
dev_t d;
int unit;
@@ -795,8 +811,6 @@ fwdev_makedev(struct firewire_softc *sc)
dev_depends(sc->dev, d);
make_dev_alias(sc->dev, "fw%d", unit);
make_dev_alias(d, "fwmem%d", unit);
-#else
- cdevsw_add(&firewire_cdevsw);
#endif
return (err);
@@ -807,15 +821,15 @@ fwdev_destroydev(struct firewire_softc *sc)
{
int err = 0;
-#if __FreeBSD_version >= 500000
- destroy_dev(sc->dev);
-#else
+#if defined(__DragonFly__) || __FreeBSD_version < 500000
cdevsw_remove(&firewire_cdevsw);
+#else
+ destroy_dev(sc->dev);
#endif
return (err);
}
-#if __FreeBSD_version >= 500000
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
#define NDEVTYPE 2
void
fwdev_clone(void *arg, char *name, int namelen, dev_t *dev)