From 0362a39e44d04fea00398d45e41932b9319e6fae Mon Sep 17 00:00:00 2001 From: will Date: Thu, 18 Sep 2014 17:28:21 +0000 Subject: 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 --- sys/dev/firewire/firewire.c | 26 +----------- sys/dev/firewire/firewire.h | 5 --- sys/dev/firewire/firewirereg.h | 29 -------------- sys/dev/firewire/fwcrom.c | 4 -- sys/dev/firewire/fwdev.c | 24 ----------- sys/dev/firewire/fwdma.c | 19 --------- sys/dev/firewire/fwmem.c | 14 ------- sys/dev/firewire/fwohci.c | 13 ------ sys/dev/firewire/fwohci_pci.c | 72 --------------------------------- sys/dev/firewire/fwohcivar.h | 4 -- sys/dev/firewire/if_fwe.c | 91 ------------------------------------------ sys/dev/firewire/if_fwip.c | 40 ------------------- sys/dev/firewire/sbp.c | 90 +---------------------------------------- sys/dev/firewire/sbp_targ.c | 3 -- 14 files changed, 2 insertions(+), 432 deletions(-) diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index cf98698..ef4758c 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -49,26 +49,14 @@ __FBSDID("$FreeBSD$"); #include -#if defined(__DragonFly__) || __FreeBSD_version < 500000 -#include /* for DELAY() */ -#endif - #include /* used by smbus and newbus */ #include -#ifdef __DragonFly__ -#include "firewire.h" -#include "firewirereg.h" -#include "fwmem.h" -#include "iec13213.h" -#include "iec68113.h" -#else #include #include #include #include #include -#endif struct crom_src_buf { struct crom_src src; @@ -99,9 +87,6 @@ static int firewire_attach (device_t); 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, struct fw_xfer *xfer) 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, struct fw_xfer *xfer) splx(s); return; } -#endif STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel); xfer->tl = -1; diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index f147f61..0a512e1 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -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) diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 73445e0..ba58f28 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -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); diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index 8a53bc7..4ee0f11 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -453,11 +453,7 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, 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; } diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index d26810d..20d89a4 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -39,11 +39,7 @@ #include #include #include -#if defined(__DragonFly__) || __FreeBSD_version < 500000 -#include -#else #include -#endif #include #include @@ -208,7 +204,6 @@ fw_open (struct cdev *dev, int flags, int fmt, fw_proc *td) 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, int fmt, fw_proc *td) 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_proc *td) } 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 *sc) { 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 diff --git a/sys/dev/firewire/fwdma.c b/sys/dev/firewire/fwdma.c index bf3bb6f..d63966d 100644 --- a/sys/dev/firewire/fwdma.c +++ b/sys/dev/firewire/fwdma.c @@ -43,23 +43,15 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include -#endif #include #include -#ifdef __DragonFly__ -#include -#include -#include -#else #include #include #include -#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, int alignment, bus_size_t size, /*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_comm *fc, int alignment, /*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); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index a342d14..4cd24d0 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -46,11 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__DragonFly__) || __FreeBSD_version < 500000 -#include -#else #include -#endif #include #include @@ -60,15 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __DragonFly__ -#include "firewire.h" -#include "firewirereg.h" -#include "fwmem.h" -#else #include #include #include -#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, fw_proc *td) 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; } diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 0179012..06321f0 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -56,25 +56,12 @@ #include -#if defined(__DragonFly__) || __FreeBSD_version < 500000 -#include /* 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 #include #include #include #include #include -#endif #undef OHCI_DEBUG diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index e1e20b5..77cb586 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -46,34 +46,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include -#endif #include -#if defined(__DragonFly__) || __FreeBSD_version < 500000 -#include /* for DELAY() */ -#endif - -#ifdef __DragonFly__ -#include -#include - -#include "firewire.h" -#include "firewirereg.h" - -#include "fwdma.h" -#include "fwohcireg.h" -#include "fwohcivar.h" -#else -#if __FreeBSD_version < 500000 -#include -#include -#else #include #include -#endif #include #include @@ -81,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#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 self); 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); diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 6f97290..3c9b242 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -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{ diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 5797cc7..d6db477 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -57,18 +57,11 @@ #include #include #include -#ifdef __DragonFly__ -#include -#include -#include -#include "if_fwevar.h" -#else #include #include #include #include -#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, caddr_t data) 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, caddr_t data) } #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, struct ifnet *ifp) 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); diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index df3e1f6..8928ee4 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -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, caddr_t data) 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, caddr_t data) } #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); } diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index eeca4c7..d66933a 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -43,30 +43,9 @@ #include #include #include -#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include -#endif - -#if defined(__DragonFly__) || __FreeBSD_version < 500106 -#include /* for struct devstat */ -#endif -#ifdef __DragonFly__ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "sbp.h" -#else #include #include #include @@ -80,7 +59,6 @@ #include #include #include -#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", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), 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", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), 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) -#endif - ccg->volume_size); + (uintmax_t)ccg->volume_size); END_DEBUG -#if defined(__DragonFly__) || __FreeBSD_version < 501100 - size_mb = ccg->volume_size - / ((1024L * 1024L) / ccg->block_size); - - if (size_mb > 1024 && extended) { - ccg->heads = 255; - ccg->secs_per_track = 63; - } else { - ccg->heads = 64; - ccg->secs_per_track = 32; - } - secs_per_cylinder = ccg->heads * ccg->secs_per_track; - ccg->cylinders = ccg->volume_size / secs_per_cylinder; - ccb->ccb_h.status = CAM_REQ_CMP; -#else cam_calc_geometry(ccg, /*extended*/1); -#endif xpt_done(ccb); break; } @@ -2611,12 +2551,8 @@ sbp_execute_ocb(void *arg, bus_dma_segment_t *segments, int seg, int error) SBP_DEBUG(2) printf("sbp_execute_ocb: seg %d", seg); for (i = 0; i < seg; i++) -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - printf(", %x:%d", segments[i].ds_addr, segments[i].ds_len); -#else printf(", %jx:%jd", (uintmax_t)segments[i].ds_addr, (uintmax_t)segments[i].ds_len); -#endif printf("\n"); END_DEBUG @@ -2635,11 +2571,7 @@ SBP_DEBUG(0) /* XXX LSI Logic "< 16 byte" bug might be hit */ if (s->ds_len < 16) printf("sbp_execute_ocb: warning, " -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - "segment length(%d) is less than 16." -#else "segment length(%zd) is less than 16." -#endif "(seg=%d/%d)\n", (size_t)s->ds_len, i+1, seg); END_DEBUG if (s->ds_len > SBP_SEG_MAX) @@ -2694,11 +2626,7 @@ sbp_dequeue_ocb(struct sbp_dev *sdev, struct sbp_status *sbp_status) SBP_DEBUG(1) device_printf(sdev->target->sbp->fd.dev, -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - "%s:%s 0x%08lx src %d\n", -#else "%s:%s 0x%08x src %d\n", -#endif __func__, sdev->bustgtlun, ntohl(sbp_status->orb_lo), sbp_status->src); END_DEBUG SBP_LOCK_ASSERT(sdev->target->sbp); @@ -2765,11 +2693,7 @@ sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) SBP_LOCK_ASSERT(sdev->target->sbp); SBP_DEBUG(1) device_printf(sdev->target->sbp->fd.dev, -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - "%s:%s 0x%08x\n", __func__, sdev->bustgtlun, ocb->bus_addr); -#else "%s:%s 0x%08jx\n", __func__, sdev->bustgtlun, (uintmax_t)ocb->bus_addr); -#endif END_DEBUG prev2 = prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb); STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb); @@ -2783,13 +2707,8 @@ END_DEBUG if (prev2 != NULL && (ocb->sdev->flags & ORB_LINK_DEAD) == 0) { SBP_DEBUG(1) -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - printf("linking chain 0x%x -> 0x%x\n", - prev2->bus_addr, ocb->bus_addr); -#else printf("linking chain 0x%jx -> 0x%jx\n", (uintmax_t)prev2->bus_addr, (uintmax_t)ocb->bus_addr); -#endif END_DEBUG /* * Suppress compiler optimization so that orb[1] must be written first. @@ -2847,11 +2766,7 @@ sbp_abort_ocb(struct sbp_ocb *ocb, int status) SBP_LOCK_ASSERT(sdev->target->sbp); SBP_DEBUG(0) device_printf(sdev->target->sbp->fd.dev, -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - "%s:%s 0x%x\n", __func__, sdev->bustgtlun, ocb->bus_addr); -#else "%s:%s 0x%jx\n", __func__, sdev->bustgtlun, (uintmax_t)ocb->bus_addr); -#endif END_DEBUG SBP_DEBUG(1) if (ocb->ccb != NULL) @@ -2909,9 +2824,6 @@ static driver_t sbp_driver = { sbp_methods, sizeof(struct sbp_softc), }; -#ifdef __DragonFly__ -DECLARE_DUMMY_MODULE(sbp); -#endif DRIVER_MODULE(sbp, firewire, sbp_driver, sbp_devclass, 0, 0); MODULE_VERSION(sbp, 1); MODULE_DEPEND(sbp, firewire, 1, 1, 1); diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c index 8026b79..f8f3063 100644 --- a/sys/dev/firewire/sbp_targ.c +++ b/sys/dev/firewire/sbp_targ.c @@ -42,9 +42,6 @@ #include #include #include -#if __FreeBSD_version < 500000 -#include -#endif #include #include -- cgit v1.1