summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/if_aue.c24
-rw-r--r--sys/dev/usb/if_auereg.h2
-rw-r--r--sys/dev/usb/if_cue.c26
-rw-r--r--sys/dev/usb/if_cuereg.h2
-rw-r--r--sys/dev/usb/if_kue.c24
-rw-r--r--sys/dev/usb/if_kuereg.h2
-rw-r--r--sys/dev/usb/if_rue.c24
-rw-r--r--sys/dev/usb/if_ruereg.h2
-rw-r--r--sys/dev/usb/ubsa.c12
-rw-r--r--sys/dev/usb/ufm.c4
-rw-r--r--sys/dev/usb/uhid.c10
-rw-r--r--sys/dev/usb/ukbd.c4
-rw-r--r--sys/dev/usb/ums.c4
-rw-r--r--sys/dev/usb/usb_port.h25
14 files changed, 159 insertions, 6 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 0ce45d8..b584b6f 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -83,6 +83,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
+#if __FreeBSD_version < 500000
+#include <machine/clock.h>
+#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -558,7 +561,12 @@ aue_setmulti(struct aue_softc *sc)
aue_csr_write_1(sc, AUE_MAR0 + i, 0);
/* now program new ones */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+#if __FreeBSD_version >= 500000
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#else
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#endif
+ {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
h = aue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
@@ -708,8 +716,10 @@ USB_ATTACH(aue)
}
}
+#if __FreeBSD_version >= 500000
mtx_init(&sc->aue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+#endif
AUE_LOCK(sc);
/* Reset the adapter. */
@@ -758,7 +768,9 @@ USB_ATTACH(aue)
aue_ifmedia_upd, aue_ifmedia_sts)) {
printf("aue%d: MII without any PHY!\n", sc->aue_unit);
AUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->aue_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
@@ -768,7 +780,11 @@ USB_ATTACH(aue)
/*
* Call MI attach routine.
*/
+#if __FreeBSD_version >= 500000
ether_ifattach(ifp, eaddr);
+#else
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+#endif
callout_handle_init(&sc->aue_stat_ch);
usb_register_netisr();
sc->aue_dying = 0;
@@ -789,7 +805,11 @@ aue_detach(device_ptr_t dev)
sc->aue_dying = 1;
untimeout(aue_tick, sc, sc->aue_stat_ch);
+#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+#else
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+#endif
if (sc->aue_ep[AUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_TX]);
@@ -801,7 +821,9 @@ aue_detach(device_ptr_t dev)
#endif
AUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->aue_mtx);
+#endif
return (0);
}
diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h
index 97480e5..c297f2b 100644
--- a/sys/dev/usb/if_auereg.h
+++ b/sys/dev/usb/if_auereg.h
@@ -242,7 +242,9 @@ struct aue_softc {
int aue_if_flags;
struct aue_cdata aue_cdata;
struct callout_handle aue_stat_ch;
+#if __FreeBSD_version >= 500000
struct mtx aue_mtx;
+#endif
u_int16_t aue_flags;
char aue_dying;
struct timeval aue_rx_notice;
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 72f0ded..d3a5c49 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
+#if __FreeBSD_version < 500000
+#include <machine/clock.h>
+#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -365,7 +368,12 @@ cue_setmulti(struct cue_softc *sc)
sc->cue_mctab[i] = 0;
/* now program new ones */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+#if __FreeBSD_version >= 500000
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#else
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#endif
+ {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
h = cue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
@@ -377,7 +385,11 @@ cue_setmulti(struct cue_softc *sc)
* so we can receive broadcast frames.
*/
if (ifp->if_flags & IFF_BROADCAST) {
+#if __FreeBSD_version >= 500000
h = cue_crc(ifp->if_broadcastaddr);
+#else
+ h = cue_crc(etherbroadcastaddr);
+#endif
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
}
@@ -484,8 +496,10 @@ USB_ATTACH(cue)
}
}
+#if __FreeBSD_version >= 500000
mtx_init(&sc->cue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+#endif
CUE_LOCK(sc);
#ifdef notdef
@@ -524,7 +538,11 @@ USB_ATTACH(cue)
/*
* Call MI attach routine.
*/
+#if __FreeBSD_version >= 500000
ether_ifattach(ifp, eaddr);
+#else
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+#endif
callout_handle_init(&sc->cue_stat_ch);
usb_register_netisr();
sc->cue_dying = 0;
@@ -545,7 +563,11 @@ cue_detach(device_ptr_t dev)
sc->cue_dying = 1;
untimeout(cue_tick, sc, sc->cue_stat_ch);
+#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+#else
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+#endif
if (sc->cue_ep[CUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_TX]);
@@ -555,7 +577,9 @@ cue_detach(device_ptr_t dev)
usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_INTR]);
CUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->cue_mtx);
+#endif
return(0);
}
diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h
index ae72d4f..4182aee 100644
--- a/sys/dev/usb/if_cuereg.h
+++ b/sys/dev/usb/if_cuereg.h
@@ -177,7 +177,9 @@ struct cue_softc {
u_int16_t cue_rxfilt;
struct cue_cdata cue_cdata;
struct callout_handle cue_stat_ch;
+#if __FreeBSD_version >= 500000
struct mtx cue_mtx;
+#endif
char cue_dying;
struct timeval cue_rx_notice;
};
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 49b72bb..28140d8 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
+#if __FreeBSD_version < 500000
+#include <machine/clock.h>
+#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -330,7 +333,12 @@ kue_setmulti(struct kue_softc *sc)
sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI;
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+#if __FreeBSD_version >= 500000
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#else
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+#endif
+ {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
/*
@@ -445,14 +453,18 @@ USB_ATTACH(kue)
}
}
+#if __FreeBSD_version >= 500000
mtx_init(&sc->kue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+#endif
KUE_LOCK(sc);
/* Load the firmware into the NIC. */
if (kue_load_fw(sc)) {
KUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->kue_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
@@ -495,7 +507,11 @@ USB_ATTACH(kue)
/*
* Call MI attach routine.
*/
+#if __FreeBSD_version >= 500000
ether_ifattach(ifp, sc->kue_desc.kue_macaddr);
+#else
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+#endif
usb_register_netisr();
sc->kue_dying = 0;
@@ -517,7 +533,11 @@ kue_detach(device_ptr_t dev)
sc->kue_dying = 1;
if (ifp != NULL)
+#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+#else
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+#endif
if (sc->kue_ep[KUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_TX]);
@@ -530,7 +550,9 @@ kue_detach(device_ptr_t dev)
free(sc->kue_mcfilters, M_USBDEV);
KUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->kue_mtx);
+#endif
return(0);
}
diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h
index 1755e5c..24a990c 100644
--- a/sys/dev/usb/if_kuereg.h
+++ b/sys/dev/usb/if_kuereg.h
@@ -169,7 +169,9 @@ struct kue_softc {
u_int16_t kue_rxfilt;
u_int8_t *kue_mcfilters;
struct kue_cdata kue_cdata;
+#if __FreeBSD_version >= 500000
struct mtx kue_mtx;
+#endif
char kue_dying;
struct timeval kue_rx_notice;
};
diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c
index d5f8c3a..53b3b77 100644
--- a/sys/dev/usb/if_rue.c
+++ b/sys/dev/usb/if_rue.c
@@ -53,6 +53,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
+#if __FreeBSD_version < 500000
+#include <machine/clock.h>
+#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -488,7 +491,12 @@ rue_setmulti(struct rue_softc *sc)
rue_csr_write_4(sc, RUE_MAR4, 0);
/* now program new ones */
- TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link) {
+#if __FreeBSD_version >= 500000
+ TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link)
+#else
+ LIST_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link)
+#endif
+ {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
h = rue_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
@@ -629,8 +637,10 @@ USB_ATTACH(rue)
}
}
+#if __FreeBSD_version >= 500000
mtx_init(&sc->rue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+#endif
RUE_LOCK(sc);
/* Reset the adapter */
@@ -674,7 +684,11 @@ USB_ATTACH(rue)
rue_qdat.if_rxstart = rue_rxstart;
/* Call MI attach routine */
+#if __FreeBSD_version >= 500000
ether_ifattach(ifp, eaddr);
+#else
+ ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+#endif
callout_handle_init(&sc->rue_stat_ch);
usb_register_netisr();
sc->rue_dying = 0;
@@ -685,7 +699,9 @@ USB_ATTACH(rue)
error1:
RUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->rue_mtx);
+#endif
error:
free(devinfo, M_USBDEV);
USB_ATTACH_ERROR_RETURN;
@@ -703,7 +719,11 @@ rue_detach(device_ptr_t dev)
sc->rue_dying = 1;
untimeout(rue_tick, sc, sc->rue_stat_ch);
+#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+#else
+ ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+#endif
if (sc->rue_ep[RUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->rue_ep[RUE_ENDPT_TX]);
@@ -715,7 +735,9 @@ rue_detach(device_ptr_t dev)
#endif
RUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
mtx_destroy(&sc->rue_mtx);
+#endif
return (0);
}
diff --git a/sys/dev/usb/if_ruereg.h b/sys/dev/usb/if_ruereg.h
index ec8b0e6..a12154f 100644
--- a/sys/dev/usb/if_ruereg.h
+++ b/sys/dev/usb/if_ruereg.h
@@ -223,7 +223,9 @@ struct rue_softc {
int rue_if_flags;
struct rue_cdata rue_cdata;
struct callout_handle rue_stat_ch;
+#if __FreeBSD_version >= 500000
struct mtx rue_mtx;
+#endif
char rue_dying;
struct timeval rue_rx_notice;
};
diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c
index 53fee20..1548e1d 100644
--- a/sys/dev/usb/ubsa.c
+++ b/sys/dev/usb/ubsa.c
@@ -181,7 +181,9 @@ struct ubsa_softc {
u_char sc_lsr; /* Local status register */
u_char sc_msr; /* ubsa status register */
+#if __FreeBSD_version >= 500000
void *sc_swicookie;
+#endif
};
Static void ubsa_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
@@ -253,7 +255,9 @@ MODULE_DEPEND(ubsa, usb, 1, 1, 1);
MODULE_DEPEND(ubsa, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(ubsa, UBSA_MODVER);
+#if __FreeBSD_version >= 500000
static struct ithd *ucom_ithd;
+#endif
USB_MATCH(ubsa)
{
@@ -409,8 +413,10 @@ USB_ATTACH(ubsa)
DPRINTF(("ubsa: in = 0x%x, out = 0x%x, intr = 0x%x\n",
ucom->sc_bulkin_no, ucom->sc_bulkout_no, sc->sc_intr_number));
+#if __FreeBSD_version >= 500000
swi_add(&ucom_ithd, "ucom", ubsa_notify, sc, SWI_TTY, 0,
&sc->sc_swicookie);
+#endif
ucom_attach(ucom);
@@ -441,7 +447,9 @@ USB_DETACH(ubsa)
rv = ucom_detach(&sc->sc_ucom);
+#if __FreeBSD_version >= 500000
ithread_remove_handler(sc->sc_swicookie);
+#endif
return (rv);
}
@@ -734,7 +742,11 @@ ubsa_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
DPRINTF(("%s: ubsa lsr = 0x%02x, msr = 0x%02x\n",
USBDEVNAME(sc->sc_ucom.sc_dev), sc->sc_lsr, sc->sc_msr));
+#if __FreeBSD_version >= 500000
swi_sched(sc->sc_swicookie, 0);
+#else
+ ubsa_notify(sc);
+#endif
}
/* Handle delayed events. */
diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c
index 89d7501..a86e494 100644
--- a/sys/dev/usb/ufm.c
+++ b/sys/dev/usb/ufm.c
@@ -89,7 +89,11 @@ d_open_t ufmopen;
d_close_t ufmclose;
d_ioctl_t ufmioctl;
+#if __FreeBSD_version >= 500000
#define UFM_CDEV_MAJOR MAJOR_AUTO
+#else
+#define UFM_CDEV_MAJOR 200
+#endif
Static struct cdevsw ufm_cdevsw = {
.d_open = ufmopen,
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index 1a2c42b..c61e4ba 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
+#endif
#include <sys/signalvar.h>
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
@@ -611,8 +613,12 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, int flag,
if (*(int *)addr) {
if (sc->sc_async != NULL)
return (EBUSY);
- sc->sc_async = p->td_proc; /* XXXKSE */
- DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p->td_proc));
+#if __FreeBSD_version >= 500000
+ sc->sc_async = p->td_proc;
+#else
+ sc->sc_async = p;
+#endif
+ DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", sc->sc_async));
} else
sc->sc_async = NULL;
break;
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index c5bb084..2d36c2f 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -53,7 +53,11 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/file.h>
+#if __FreeBSD_version >= 500000
#include <sys/limits.h>
+#else
+#include <machine/limits.h>
+#endif
#if __FreeBSD_version >= 500014
#include <sys/selinfo.h>
#else
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index d3acf92..f09fba7 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -71,7 +71,11 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_quirks.h>
#include <dev/usb/hid.h>
+#if __FreeBSD_version >= 500000
#include <sys/mouse.h>
+#else
+#include <machine/mouse.h>
+#endif
#ifdef USB_DEBUG
#define DPRINTF(x) if (umsdebug) logprintf x
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index c48c582..373baa3 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -368,6 +368,7 @@ MALLOC_DECLARE(M_USBHC);
u_int len; \
} usb_dma_t
+#if __FreeBSD_version >= 500000
typedef struct thread *usb_proc_ptr;
#define uio_procp uio_td
@@ -385,6 +386,30 @@ typedef struct callout usb_callout_t;
#define usb_callout_init(h) callout_init(&(h), 0)
#define usb_callout(h, t, f, d) callout_reset(&(h), (t), (f), (d))
#define usb_uncallout(h, f, d) callout_stop(&(h))
+#else
+typedef struct proc *usb_proc_ptr;
+
+#define PROC_LOCK(p)
+#define PROC_UNLOCK(p)
+
+#define usb_kthread_create1(f, s, p, a0, a1) \
+ kthread_create((f), (s), (p), (a0), (a1))
+#define usb_kthread_create2(f, s, p, a0) \
+ kthread_create((f), (s), (p), (a0))
+#define usb_kthread_create kthread_create
+
+#define config_pending_incr()
+#define config_pending_decr()
+
+typedef struct callout usb_callout_t;
+#define usb_callout_init(h) callout_init(&(h))
+#define usb_callout(h, t, f, d) callout_reset(&(h), (t), (f), (d))
+#define usb_uncallout(h, f, d) callout_stop(&(h))
+
+#define BUS_DMA_COHERENT 0
+#define ETHER_ALIGN 2
+#define BPF_MTAP(ifp, m) if ((ifp)->if_bpf) bpf_mtap((ifp), (m));
+#endif
#define clalloc(p, s, x) (clist_alloc_cblocks((p), (s), (s)), 0)
#define clfree(p) clist_free_cblocks((p))
OpenPOWER on IntegriCloud