Author: will
Date: Thu Sep 18 17:28:21 2014
New Revision: 271795
URL: http://svnweb.freebsd.org/changeset/base/271795

Log:
  Start the process of cleaning up FreeBSD's firewire driver.
  
  sys/dev/firewire/firewire.c:
  sys/dev/firewire/firewire.h:
  sys/dev/firewire/firewirereg.h:
  sys/dev/firewire/fwcrom.c:
  sys/dev/firewire/fwdev.c:
  sys/dev/firewire/fwdma.c:
  sys/dev/firewire/fwmem.c:
  sys/dev/firewire/fwohci.c:
  sys/dev/firewire/fwohci_pci.c:
  sys/dev/firewire/fwohcivar.h:
  sys/dev/firewire/if_fwe.c:
  sys/dev/firewire/if_fwip.c:
  sys/dev/firewire/sbp.c:
  sys/dev/firewire/sbp_targ.c:
        Unifdef the code, removing support for DragonflyBSD
        and FreeBSD prior to version 5.
  
  Submitted by: gibbs
  MFC after:    1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1081188 on 2014/08/01

Modified:
  head/sys/dev/firewire/firewire.c
  head/sys/dev/firewire/firewire.h
  head/sys/dev/firewire/firewirereg.h
  head/sys/dev/firewire/fwcrom.c
  head/sys/dev/firewire/fwdev.c
  head/sys/dev/firewire/fwdma.c
  head/sys/dev/firewire/fwmem.c
  head/sys/dev/firewire/fwohci.c
  head/sys/dev/firewire/fwohci_pci.c
  head/sys/dev/firewire/fwohcivar.h
  head/sys/dev/firewire/if_fwe.c
  head/sys/dev/firewire/if_fwip.c
  head/sys/dev/firewire/sbp.c
  head/sys/dev/firewire/sbp_targ.c

Modified: head/sys/dev/firewire/firewire.c
==============================================================================
--- head/sys/dev/firewire/firewire.c    Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/firewire.c    Thu Sep 18 17:28:21 2014        
(r271795)
@@ -49,26 +49,14 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/kdb.h>
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#include <machine/clock.h>     /* for DELAY() */
-#endif
-
 #include <sys/bus.h>           /* used by smbus and newbus */
 #include <machine/bus.h>
 
-#ifdef __DragonFly__
-#include "firewire.h"
-#include "firewirereg.h"
-#include "fwmem.h"
-#include "iec13213.h"
-#include "iec68113.h"
-#else
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
 #include <dev/firewire/fwmem.h>
 #include <dev/firewire/iec13213.h>
 #include <dev/firewire/iec68113.h>
-#endif
 
 struct crom_src_buf {
        struct crom_src src;
@@ -99,9 +87,6 @@ static int firewire_attach      (device_
 static int firewire_detach      (device_t);
 static int firewire_resume      (device_t);
 static void firewire_xfer_timeout(void *, int);
-#if 0
-static int firewire_shutdown    (device_t);
-#endif
 static device_t firewire_add_child(device_t, u_int, const char *, int);
 static void fw_try_bmr (void *);
 static void fw_try_bmr_callback (struct fw_xfer *);
@@ -563,14 +548,6 @@ firewire_detach(device_t dev)
        mtx_destroy(&fc->wait_lock);
        return(0);
 }
-#if 0
-static int
-firewire_shutdown( device_t dev )
-{
-       return 0;
-}
-#endif
-
 
 static void
 fw_xferq_drain(struct fw_xferq *xferq)
@@ -1052,7 +1029,7 @@ fw_tl_free(struct firewire_comm *fc, str
                mtx_unlock(&fc->tlabel_lock);
                return;
        }
-#if 1  /* make sure the label is allocated */
+       /* make sure the label is allocated */
        STAILQ_FOREACH(txfer, &fc->tlabels[xfer->tl], tlabel)
                if(txfer == xfer)
                        break;
@@ -1067,7 +1044,6 @@ fw_tl_free(struct firewire_comm *fc, str
                splx(s);
                return;
        }
-#endif
 
        STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel);
        xfer->tl = -1;

Modified: head/sys/dev/firewire/firewire.h
==============================================================================
--- head/sys/dev/firewire/firewire.h    Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/firewire.h    Thu Sep 18 17:28:21 2014        
(r271795)
@@ -454,11 +454,6 @@ struct fw_crom_buf {
 
 #define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#define dev2unit(x)    ((minor(x) & 0xff) | (minor(x) >> 8))
-#define unit2minor(x)  (((x) & 0xff) | (((x) << 8) & ~0xffff))
-#endif
-
 #define MAKEMINOR(f, u, s)     \
        ((f) | (((u) & 0xff) << 8) | (s & 0xff))
 #define DEV2UNIT(x)    ((dev2unit(x) & 0xff00) >> 8)

Modified: head/sys/dev/firewire/firewirereg.h
==============================================================================
--- head/sys/dev/firewire/firewirereg.h Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/firewirereg.h Thu Sep 18 17:28:21 2014        
(r271795)
@@ -75,9 +75,7 @@ struct fw_device{
 };
 
 struct firewire_softc {
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
        struct cdev *dev;
-#endif
        struct firewire_comm *fc;
 };
 
@@ -303,36 +301,9 @@ extern int firewire_debug;
 extern devclass_t firewire_devclass;
 extern int firewire_phydma_enable;
 
-#ifdef __DragonFly__
-#define                FWPRI           PCATCH
-#else
 #define                FWPRI           ((PZERO+8)|PCATCH)
-#endif
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#define CALLOUT_INIT(x) callout_init(x)
-#else
 #define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */)
-#endif
-
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-/* compatibility shim for 4.X */
-#define bio buf
-#define bio_bcount b_bcount
-#define bio_cmd b_flags
-#define bio_count b_count
-#define bio_data b_data
-#define bio_dev b_dev
-#define bio_error b_error
-#define bio_flags b_flags
-#define bio_offset b_offset
-#define bio_resid b_resid
-#define BIO_ERROR B_ERROR
-#define BIO_READ B_READ
-#define BIO_WRITE B_WRITE
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
 
 MALLOC_DECLARE(M_FW);
 MALLOC_DECLARE(M_FWXFER);

Modified: head/sys/dev/firewire/fwcrom.c
==============================================================================
--- head/sys/dev/firewire/fwcrom.c      Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwcrom.c      Thu Sep 18 17:28:21 2014        
(r271795)
@@ -453,11 +453,7 @@ crom_add_simple_text(struct crom_src *sr
 
        len = strlen(buf);
        if (len > MAX_TEXT) {
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-               printf("text(%d) trancated to %d.\n", len, MAX_TEXT);
-#else
                printf("text(%d) trancated to %td.\n", len, MAX_TEXT);
-#endif
                len = MAX_TEXT;
        }
 

Modified: head/sys/dev/firewire/fwdev.c
==============================================================================
--- head/sys/dev/firewire/fwdev.c       Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwdev.c       Thu Sep 18 17:28:21 2014        
(r271795)
@@ -39,11 +39,7 @@
 #include <sys/systm.h>
 #include <sys/types.h>
 #include <sys/mbuf.h>
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#include <sys/buf.h>
-#else
 #include <sys/bio.h>
-#endif
 
 #include <sys/kernel.h>
 #include <sys/malloc.h>
@@ -208,7 +204,6 @@ fw_open (struct cdev *dev, int flags, in
        if (dev->si_drv1 == NULL)
                return (ENOMEM);
 
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
        if ((dev->si_flags & SI_NAMED) == 0) {
                int unit = DEV2UNIT(dev);
                int sub = DEV2SUB(dev);
@@ -217,7 +212,6 @@ fw_open (struct cdev *dev, int flags, in
                        UID_ROOT, GID_OPERATOR, 0660,
                        "fw%d.%d", unit, sub);
        }
-#endif
        d = (struct fw_drv1 *)dev->si_drv1;
        d->fc = sc->fc;
        STAILQ_INIT(&d->binds);
@@ -881,20 +875,12 @@ fw_poll(struct cdev *dev, int events, fw
 }
 
 static int
-#if defined(__DragonFly__) || __FreeBSD_version < 500102
-fw_mmap (struct cdev *dev, vm_offset_t offset, int nproto)
-#else
 fw_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
     int nproto, vm_memattr_t *memattr)
-#endif
 {  
 
        if (DEV_FWMEM(dev))
-#if defined(__DragonFly__) || __FreeBSD_version < 500102
-               return fwmem_mmap(dev, offset, nproto);
-#else
                return fwmem_mmap(dev, offset, paddr, nproto, memattr);
-#endif
 
        return EINVAL;
 }
@@ -921,9 +907,6 @@ fwdev_makedev(struct firewire_softc *sc)
 {
        int err = 0;
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       cdevsw_add(&firewire_cdevsw);
-#else
        struct cdev *d;
        int unit;
 
@@ -938,7 +921,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);
-#endif
 
        return (err);
 }
@@ -948,15 +930,10 @@ fwdev_destroydev(struct firewire_softc *
 {
        int err = 0;
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       cdevsw_remove(&firewire_cdevsw);
-#else
        destroy_dev(sc->dev);
-#endif
        return (err);
 }
 
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
 #define NDEVTYPE 2
 void
 fwdev_clone(void *arg, struct ucred *cred, char *name, int namelen,
@@ -998,4 +975,3 @@ found:
        dev_depends(sc->dev, *dev);
        return;
 }
-#endif

Modified: head/sys/dev/firewire/fwdma.c
==============================================================================
--- head/sys/dev/firewire/fwdma.c       Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwdma.c       Thu Sep 18 17:28:21 2014        
(r271795)
@@ -43,23 +43,15 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#endif
 
 #include <sys/bus.h>
 #include <machine/bus.h>
 
-#ifdef __DragonFly__
-#include <bus/firewire/firewire.h>
-#include <bus/firewire/firewirereg.h>
-#include <bus/firewire/fwdma.h>
-#else
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
 #include <dev/firewire/fwdma.h>
-#endif
 
 static void
 fwdma_map_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
@@ -90,10 +82,8 @@ fwdma_malloc(struct firewire_comm *fc, i
                /*nsegments*/ 1,
                /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
                /*flags*/ BUS_DMA_ALLOCNOW,
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 
                /*lockfunc*/busdma_lock_mutex,
                /*lockarg*/FW_GMTX(fc),
-#endif
                &dma->dma_tag);
        if (err) {
                printf("fwdma_malloc: failed(1)\n");
@@ -188,23 +178,14 @@ fwdma_malloc_multiseg(struct firewire_co
                        /*nsegments*/ 1,
                        /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
                        /*flags*/ BUS_DMA_ALLOCNOW,
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102
                        /*lockfunc*/busdma_lock_mutex,
                        /*lockarg*/FW_GMTX(fc),
-#endif
                        &am->dma_tag)) {
                printf("fwdma_malloc_multiseg: tag_create failed\n");
                free(am, M_FW);
                return(NULL);
        }
 
-#if 0
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       printf("malloc_multi: ssize=%d nseg=%d\n", ssize, nseg);
-#else
-       printf("malloc_multi: ssize=%td nseg=%d\n", ssize, nseg);
-#endif
-#endif
        for (seg = &am->seg[0]; nseg --; seg ++) {
                seg->v_addr = fwdma_malloc_size(am->dma_tag, &seg->dma_map,
                        ssize, &seg->bus_addr, flag);

Modified: head/sys/dev/firewire/fwmem.c
==============================================================================
--- head/sys/dev/firewire/fwmem.c       Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwmem.c       Thu Sep 18 17:28:21 2014        
(r271795)
@@ -46,11 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/conf.h>
 #include <sys/sysctl.h>
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#include <sys/buf.h>
-#else
 #include <sys/bio.h>
-#endif
 
 #include <sys/bus.h>
 #include <machine/bus.h>
@@ -60,15 +56,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/ioccom.h>
 #include <sys/fcntl.h>
 
-#ifdef __DragonFly__
-#include "firewire.h"
-#include "firewirereg.h"
-#include "fwmem.h"
-#else
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
 #include <dev/firewire/fwmem.h>
-#endif
 
 static int fwmem_speed=2, fwmem_debug=0;
 static struct fw_eui64 fwmem_eui64;
@@ -442,12 +432,8 @@ fwmem_poll (struct cdev *dev, int events
        return EINVAL;
 }
 int
-#if defined(__DragonFly__) || __FreeBSD_version < 500102
-fwmem_mmap (struct cdev *dev, vm_offset_t offset, int nproto)
-#else
 fwmem_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
     int nproto, vm_memattr_t *memattr)
-#endif
 {  
        return EINVAL;
 }

Modified: head/sys/dev/firewire/fwohci.c
==============================================================================
--- head/sys/dev/firewire/fwohci.c      Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwohci.c      Thu Sep 18 17:28:21 2014        
(r271795)
@@ -56,25 +56,12 @@
 
 #include <machine/bus.h>
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#include <machine/clock.h>             /* for DELAY() */
-#endif
-
-#ifdef __DragonFly__
-#include "firewire.h"
-#include "firewirereg.h"
-#include "fwdma.h"
-#include "fwohcireg.h"
-#include "fwohcivar.h"
-#include "firewire_phy.h"
-#else
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
 #include <dev/firewire/fwdma.h>
 #include <dev/firewire/fwohcireg.h>
 #include <dev/firewire/fwohcivar.h>
 #include <dev/firewire/firewire_phy.h>
-#endif
 
 #undef OHCI_DEBUG
 

Modified: head/sys/dev/firewire/fwohci_pci.c
==============================================================================
--- head/sys/dev/firewire/fwohci_pci.c  Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwohci_pci.c  Thu Sep 18 17:28:21 2014        
(r271795)
@@ -46,34 +46,12 @@ __FBSDID("$FreeBSD$");
 #include <machine/bus.h>
 #include <sys/rman.h>
 #include <sys/malloc.h>
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#endif
 #include <machine/resource.h>
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-#include <machine/clock.h>             /* for DELAY() */
-#endif
-
-#ifdef __DragonFly__
-#include <bus/pci/pcivar.h>
-#include <bus/pci/pcireg.h>
-
-#include "firewire.h"
-#include "firewirereg.h"
-
-#include "fwdma.h"
-#include "fwohcireg.h"
-#include "fwohcivar.h"
-#else
-#if __FreeBSD_version < 500000
-#include <pci/pcivar.h>
-#include <pci/pcireg.h>
-#else
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>
-#endif
 
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
@@ -81,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/firewire/fwdma.h>
 #include <dev/firewire/fwohcireg.h>
 #include <dev/firewire/fwohcivar.h>
-#endif
 
 static int fwohci_pci_attach(device_t self);
 static int fwohci_pci_detach(device_t self);
@@ -92,7 +69,6 @@ static int fwohci_pci_detach(device_t se
 static int
 fwohci_pci_probe( device_t dev )
 {
-#if 1
        uint32_t id;
 
        id = pci_get_devid(dev);
@@ -213,7 +189,6 @@ fwohci_pci_probe( device_t dev )
                device_set_desc(dev, "Sun PCIO-2");
                return BUS_PROBE_DEFAULT;
        }
-#endif
        if (pci_get_class(dev) == PCIC_SERIALBUS
                        && pci_get_subclass(dev) == PCIS_SERIALBUS_FW
                        && pci_get_progif(dev) == PCI_INTERFACE_OHCI) {
@@ -227,14 +202,6 @@ fwohci_pci_probe( device_t dev )
        return ENXIO;
 }
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-static void
-fwohci_dummy_intr(void *arg)
-{
-       /* XXX do nothing */
-}
-#endif
-
 static int
 fwohci_pci_init(device_t self)
 {
@@ -286,17 +253,6 @@ fwohci_pci_attach(device_t self)
        fwohci_softc_t *sc = device_get_softc(self);
        int err;
        int rid;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       int intr;
-       /* For the moment, put in a message stating what is wrong */
-       intr = pci_read_config(self, PCIR_INTLINE, 1);
-       if (intr == 0 || intr == 255) {
-               device_printf(self, "Invalid irq %d\n", intr);
-#ifdef __i386__
-               device_printf(self, "Please switch PNP-OS to 'No' in BIOS\n");
-#endif
-       }
-#endif
 
 #if 0
        if (bootverbose)
@@ -307,12 +263,7 @@ fwohci_pci_attach(device_t self)
        fwohci_pci_init(self);
 
        rid = PCI_CBMEM;
-#if __FreeBSD_version >= 502109
        sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
-#else
-       sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid,
-           0, ~0, 1, RF_ACTIVE);
-#endif
        if (!sc->bsr) {
                device_printf(self, "Could not map memory\n");
                return ENXIO;
@@ -322,13 +273,8 @@ fwohci_pci_attach(device_t self)
        sc->bsh = rman_get_bushandle(sc->bsr);
 
        rid = 0;
-#if __FreeBSD_version >= 502109
        sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
                                     RF_SHAREABLE | RF_ACTIVE);
-#else
-       sc->irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1,
-                                    RF_SHAREABLE | RF_ACTIVE);
-#endif
        if (sc->irq_res == NULL) {
                device_printf(self, "Could not allocate irq\n");
                fwohci_pci_detach(self);
@@ -340,14 +286,6 @@ fwohci_pci_attach(device_t self)
                                NULL, (driver_intr_t *) fwohci_intr,
                                sc, &sc->ih);
 
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       /* XXX splcam() should mask this irq for sbp.c*/
-       err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM,
-                    (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam);
-       /* XXX splbio() should mask this irq for physio()/fwmem_strategy() */
-       err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO,
-                    (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_bio);
-#endif
        if (err) {
                device_printf(self, "Could not setup irq, %d\n", err);
                fwohci_pci_detach(self);
@@ -355,11 +293,7 @@ fwohci_pci_attach(device_t self)
        }
 
        err = bus_dma_tag_create(
-#if defined(__FreeBSD__) && __FreeBSD_version >= 700020
                                /*parent*/bus_get_dma_tag(self),
-#else
-                               /*parent*/NULL,
-#endif
                                /*alignment*/1,
                                /*boundary*/0,
 #if BOUNCE_BUFFER_TEST
@@ -373,10 +307,8 @@ fwohci_pci_attach(device_t self)
                                /*nsegments*/0x20,
                                /*maxsegsz*/0x8000,
                                /*flags*/BUS_DMA_ALLOCNOW,
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102
                                /*lockfunc*/busdma_lock_mutex,
                                /*lockarg*/FW_GMTX(&sc->fc),
-#endif
                                &sc->fc.dmat);
        if (err != 0) {
                printf("fwohci_pci_attach: Could not allocate DMA tag "
@@ -429,10 +361,6 @@ fwohci_pci_detach(device_t self)
                        if (err)
                                device_printf(self,
                                         "Could not tear down irq, %d\n", err);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-                       bus_teardown_intr(self, sc->irq_res, sc->ih_cam);
-                       bus_teardown_intr(self, sc->irq_res, sc->ih_bio);
-#endif
                        sc->ih = NULL;
                }
                bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);

Modified: head/sys/dev/firewire/fwohcivar.h
==============================================================================
--- head/sys/dev/firewire/fwohcivar.h   Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/fwohcivar.h   Thu Sep 18 17:28:21 2014        
(r271795)
@@ -42,10 +42,6 @@ typedef struct fwohci_softc {
        bus_space_tag_t bst;
        bus_space_handle_t bsh;
        void *ih;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       void *ih_cam;
-       void *ih_bio;
-#endif
        struct resource *bsr;
        struct resource *irq_res;
        struct fwohci_dbch{

Modified: head/sys/dev/firewire/if_fwe.c
==============================================================================
--- head/sys/dev/firewire/if_fwe.c      Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/if_fwe.c      Thu Sep 18 17:28:21 2014        
(r271795)
@@ -57,18 +57,11 @@
 #include <net/if_var.h>
 #include <net/if_arp.h>
 #include <net/if_types.h>
-#ifdef __DragonFly__
-#include <net/vlan/if_vlan_var.h>
-#include <bus/firewire/firewire.h>
-#include <bus/firewire/firewirereg.h>
-#include "if_fwevar.h"
-#else
 #include <net/if_vlan_var.h>
 
 #include <dev/firewire/firewire.h>
 #include <dev/firewire/firewirereg.h>
 #include <dev/firewire/if_fwevar.h>
-#endif
 
 #define FWEDEBUG       if (fwedebug) if_printf
 #define TX_MAX_QUEUE   (FWMAXQUEUE - 1)
@@ -144,11 +137,7 @@ fwe_attach(device_t dev)
        struct fwe_softc *fwe;
        struct ifnet *ifp;
        int unit, s;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       u_char *eaddr;
-#else
        u_char eaddr[6];
-#endif
        struct fw_eui64 *eui;
 
        fwe = ((struct fwe_softc *)device_get_softc(dev));
@@ -175,10 +164,6 @@ fwe_attach(device_t dev)
        /* generate fake MAC address: first and last 3bytes from eui64 */
 #define LOCAL (0x02)
 #define GROUP (0x01)
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       eaddr = &IFP2ENADDR(fwe->eth_softc.ifp)[0];
-#endif
-
 
        eui = &fwe->fd.fc->eui;
        eaddr[0] = (FW_EUI64_BYTE(eui, 0) | LOCAL) & ~GROUP;
@@ -199,36 +184,21 @@ fwe_attach(device_t dev)
        }
        ifp->if_softc = &fwe->eth_softc;
 
-#if __FreeBSD_version >= 501113 || defined(__DragonFly__)
        if_initname(ifp, device_get_name(dev), unit);
-#else
-       ifp->if_unit = unit;
-       ifp->if_name = "fwe";
-#endif
        ifp->if_init = fwe_init;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       ifp->if_output = ether_output;
-#endif
        ifp->if_start = fwe_start;
        ifp->if_ioctl = fwe_ioctl;
        ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
        ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE;
 
        s = splimp();
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       ether_ifattach(ifp, 1);
-#else
        ether_ifattach(ifp, eaddr);
-#endif
        splx(s);
 
         /* Tell the upper layer(s) we support long frames. */
        ifp->if_hdrlen = sizeof(struct ether_vlan_header);
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
        ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_POLLING;
        ifp->if_capenable |= IFCAP_VLAN_MTU;
-#endif
-
 
        FWEDEBUG(ifp, "interface created\n");
        return 0;
@@ -270,11 +240,7 @@ fwe_stop(struct fwe_softc *fwe)
                fwe->dma_ch = -1;
        }
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
-#else
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-#endif
 }
 
 static int
@@ -294,12 +260,8 @@ fwe_detach(device_t dev)
        s = splimp();
 
        fwe_stop(fwe);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       ether_ifdetach(ifp, 1);
-#else
        ether_ifdetach(ifp);
        if_free(ifp);
-#endif
 
        splx(s);
        mtx_destroy(&fwe->mtx);
@@ -379,13 +341,8 @@ fwe_init(void *arg)
        if ((xferq->flag & FWXFERQ_RUNNING) == 0)
                fc->irx_enable(fc, fwe->dma_ch);
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags |= IFF_DRV_RUNNING;
        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
-#endif
 
 #if 0
        /* attempt to start output */
@@ -405,18 +362,10 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd,
                case SIOCSIFFLAGS:
                        s = splimp();
                        if (ifp->if_flags & IFF_UP) {
-#if defined(__FreeBSD__)
                                if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-#else
-                               if (!(ifp->if_flags & IFF_RUNNING))
-#endif
                                        fwe_init(&fwe->eth_softc);
                        } else {
-#if defined(__FreeBSD__)
                                if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-#else
-                               if (ifp->if_flags & IFF_RUNNING)
-#endif
                                        fwe_stop(fwe);
                        }
                        /* XXX keep promiscoud mode */
@@ -463,21 +412,11 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd,
                    }
 #endif /* DEVICE_POLLING */
                        break;
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
                default:
-#else
-               case SIOCSIFADDR:
-               case SIOCGIFADDR:
-               case SIOCSIFMTU:
-#endif
                        s = splimp();
                        error = ether_ioctl(ifp, cmd, data);
                        splx(s);
                        return (error);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-               default:
-                       return (EINVAL);
-#endif
        }
 
        return (0);
@@ -537,20 +476,12 @@ fwe_start(struct ifnet *ifp)
        }
 
        s = splimp();
-#if defined(__FreeBSD__)
        ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags |= IFF_OACTIVE;
-#endif
 
        if (ifp->if_snd.ifq_len != 0)
                fwe_as_output(fwe, ifp);
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags &= ~IFF_OACTIVE;
-#endif
        splx(s);
 }
 
@@ -591,12 +522,7 @@ fwe_as_output(struct fwe_softc *fwe, str
                        FWE_UNLOCK(fwe);
                        break;
                }
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-               if (ifp->if_bpf != NULL)
-                       bpf_mtap(ifp, m);
-#else
                BPF_MTAP(ifp, m);
-#endif
 
                /* keep ip packet alignment for alpha */
                M_PREPEND(m, ETHER_ALIGN, M_NOWAIT);
@@ -634,9 +560,6 @@ fwe_as_input(struct fw_xferq *xferq)
        struct fw_bulkxfer *sxfer;
        struct fw_pkt *fp;
        u_char *c;
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       struct ether_header *eh;
-#endif
 
        fwe = (struct fwe_softc *)xferq->sc;
        ifp = fwe->eth_softc.ifp;
@@ -666,14 +589,7 @@ fwe_as_input(struct fw_xferq *xferq)
 
                m->m_data += HDR_LEN + ETHER_ALIGN;
                c = mtod(m, u_char *);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-               eh = (struct ether_header *)c;
-               m->m_data += sizeof(struct ether_header);
-               m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN
-                   - sizeof(struct ether_header);
-#else
                m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN;
-#endif
                m->m_pkthdr.rcvif = ifp;
 #if 0
                FWEDEBUG(ifp, "%02x %02x %02x %02x %02x %02x\n"
@@ -690,11 +606,7 @@ fwe_as_input(struct fw_xferq *xferq)
                         c[20], c[21], c[22], c[23]
                 );
 #endif
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-               ether_input(ifp, eh, m);
-#else
                (*ifp->if_input)(ifp, m);
-#endif
                ifp->if_ipackets ++;
        }
        if (STAILQ_FIRST(&xferq->stfree) != NULL)
@@ -720,9 +632,6 @@ static driver_t fwe_driver = {
 };
 
 
-#ifdef __DragonFly__
-DECLARE_DUMMY_MODULE(fwe);
-#endif
 DRIVER_MODULE(fwe, firewire, fwe_driver, fwe_devclass, 0, 0);
 MODULE_VERSION(fwe, 1);
 MODULE_DEPEND(fwe, firewire, 1, 1, 1);

Modified: head/sys/dev/firewire/if_fwip.c
==============================================================================
--- head/sys/dev/firewire/if_fwip.c     Thu Sep 18 17:25:20 2014        
(r271794)
+++ head/sys/dev/firewire/if_fwip.c     Thu Sep 18 17:28:21 2014        
(r271795)
@@ -189,12 +189,7 @@ fwip_attach(device_t dev)
        /* fill the rest and attach interface */        
        ifp->if_softc = &fwip->fw_softc;
 
-#if __FreeBSD_version >= 501113 || defined(__DragonFly__)
        if_initname(ifp, device_get_name(dev), unit);
-#else
-       ifp->if_unit = unit;
-       ifp->if_name = "fwip";
-#endif
        ifp->if_init = fwip_init;
        ifp->if_start = fwip_start;
        ifp->if_ioctl = fwip_ioctl;
@@ -255,11 +250,7 @@ fwip_stop(struct fwip_softc *fwip)
                fwip->dma_ch = -1;
        }
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
-#else
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-#endif
 }
 
 static int
@@ -380,13 +371,8 @@ fwip_init(void *arg)
        if ((xferq->flag & FWXFERQ_RUNNING) == 0)
                fc->irx_enable(fc, fwip->dma_ch);
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags |= IFF_DRV_RUNNING;
        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
-#endif
 
 #if 0
        /* attempt to start output */
@@ -404,18 +390,10 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd
        case SIOCSIFFLAGS:
                s = splimp();
                if (ifp->if_flags & IFF_UP) {
-#if defined(__FreeBSD__)
                        if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-#else
-                       if (!(ifp->if_flags & IFF_RUNNING))
-#endif
                                fwip_init(&fwip->fw_softc);
                } else {
-#if defined(__FreeBSD__)
                        if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-#else
-                       if (ifp->if_flags & IFF_RUNNING)
-#endif
                                fwip_stop(fwip);
                }
                splx(s);
@@ -453,21 +431,11 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd
            }
 #endif /* DEVICE_POLLING */
                break;
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
        default:
-#else
-       case SIOCSIFADDR:
-       case SIOCGIFADDR:
-       case SIOCSIFMTU:
-#endif
                s = splimp();
                error = firewire_ioctl(ifp, cmd, data);
                splx(s);
                return (error);
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-       default:
-               return (EINVAL);
-#endif
        }
 
        return (0);
@@ -559,20 +527,12 @@ fwip_start(struct ifnet *ifp)
        }
 
        s = splimp();
-#if defined(__FreeBSD__)
        ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags |= IFF_OACTIVE;
-#endif
 
        if (ifp->if_snd.ifq_len != 0)
                fwip_async_output(fwip, ifp);
 
-#if defined(__FreeBSD__)
        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-#else
-       ifp->if_flags &= ~IFF_OACTIVE;
-#endif
        splx(s);
 }
 

Modified: head/sys/dev/firewire/sbp.c
==============================================================================
--- head/sys/dev/firewire/sbp.c Thu Sep 18 17:25:20 2014        (r271794)
+++ head/sys/dev/firewire/sbp.c Thu Sep 18 17:28:21 2014        (r271795)
@@ -43,30 +43,9 @@
 #include <sys/sysctl.h>
 #include <machine/bus.h>
 #include <sys/malloc.h>
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#endif
-
-#if defined(__DragonFly__) || __FreeBSD_version < 500106
-#include <sys/devicestat.h>    /* for struct devstat */
-#endif
 
-#ifdef __DragonFly__
-#include <bus/cam/cam.h>
-#include <bus/cam/cam_ccb.h>
-#include <bus/cam/cam_sim.h>
-#include <bus/cam/cam_xpt_sim.h>
-#include <bus/cam/cam_debug.h>
-#include <bus/cam/cam_periph.h>
-#include <bus/cam/scsi/scsi_all.h>
-
-#include <bus/firewire/firewire.h>
-#include <bus/firewire/firewirereg.h>
-#include <bus/firewire/fwdma.h>
-#include <bus/firewire/iec13213.h>
-#include "sbp.h"
-#else
 #include <cam/cam.h>
 #include <cam/cam_ccb.h>
 #include <cam/cam_sim.h>
@@ -80,7 +59,6 @@
 #include <dev/firewire/fwdma.h>
 #include <dev/firewire/iec13213.h>
 #include <dev/firewire/sbp.h>
-#endif
 
 #define ccb_sdev_ptr   spriv_ptr0
 #define ccb_sbp_ptr    spriv_ptr1
@@ -1677,11 +1655,7 @@ END_DEBUG
                ocb = sbp_dequeue_ocb(sdev, sbp_status);
                if (ocb == NULL) {
                        device_printf(sdev->target->sbp->fd.dev,
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-                               "%s:%s No ocb(%lx) on the queue\n",
-#else
                                "%s:%s No ocb(%x) on the queue\n",
-#endif
                                __func__,sdev->bustgtlun,
                                ntohl(sbp_status->orb_lo));
                }
@@ -1708,11 +1682,7 @@ END_DEBUG
 SBP_DEBUG(0)
                device_printf(sdev->target->sbp->fd.dev,
                        "%s:%s ORB status src:%x resp:%x dead:%x"
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-                               " len:%x stat:%x orb:%x%08lx\n",
-#else
                                " len:%x stat:%x orb:%x%08x\n",
-#endif
                        __func__, sdev->bustgtlun,
                        sbp_status->src, sbp_status->resp, sbp_status->dead,
                        sbp_status->len, sbp_status->status,
@@ -1949,10 +1919,8 @@ END_DEBUG
                                /*maxsize*/0x100000, /*nsegments*/SBP_IND_MAX,
                                /*maxsegsz*/SBP_SEG_MAX,
                                /*flags*/BUS_DMA_ALLOCNOW,
-#if defined(__FreeBSD__) && __FreeBSD_version >= 501102
                                /*lockfunc*/busdma_lock_mutex,
                                /*lockarg*/&sbp->mtx,
-#endif
                                &sbp->dmat);
        if (error != 0) {
                printf("sbp_attach: Could not allocate DMA tag "
@@ -2463,11 +2431,6 @@ printf("ORB %08x %08x %08x %08x\n", ntoh
        case XPT_CALC_GEOMETRY:
        {
                struct ccb_calc_geometry *ccg;
-#if defined(__DragonFly__) || __FreeBSD_version < 501100
-               uint32_t size_mb;
-               uint32_t secs_per_cylinder;
-               int extended = 1;
-#endif
 
                ccg = &ccb->ccg;
                if (ccg->block_size == 0) {
@@ -2478,37 +2441,14 @@ printf("ORB %08x %08x %08x %08x\n", ntoh
                }
 SBP_DEBUG(1)
                printf("%s:%d:%d:%jx:XPT_CALC_GEOMETRY: "
-#if defined(__DragonFly__) || __FreeBSD_version < 500000
-                       "Volume size = %d\n",
-#else
                        "Volume size = %jd\n",
-#endif
                        device_get_nameunit(sbp->fd.dev),
                        cam_sim_path(sbp->sim),
                        ccb->ccb_h.target_id, (uintmax_t)ccb->ccb_h.target_lun,
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
-                       (uintmax_t)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to