summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-02-10 23:38:14 +0000
committerMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-02-10 23:38:14 +0000
commitdae1601205871e533cdf3f8402c70bbf3a7f9819 (patch)
treeaadf9df0621e36cbed06c235d77dd021b8402ae2 /sys
parent7c403e2a069557e11eff809df4bef961e13e173b (diff)
Adjust various kernel API differences.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/dwc2/dwc2.c22
-rw-r--r--sys/dev/usb/dwc2/dwc2.h6
-rw-r--r--sys/dev/usb/dwc2/dwc2_hcd.c5
-rw-r--r--sys/dev/usb/dwc2/dwc2_hcdddma.c4
-rw-r--r--sys/dev/usb/dwc2/dwc2var.h19
5 files changed, 35 insertions, 21 deletions
diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c
index bcd66c5ed50..55b3e04a25f 100644
--- a/sys/dev/usb/dwc2/dwc2.c
+++ b/sys/dev/usb/dwc2/dwc2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.c,v 1.14 2015/02/10 23:25:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2.c,v 1.15 2015/02/10 23:38:13 uebayasi Exp $ */
/* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */
/*-
@@ -549,7 +549,7 @@ dwc2_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
DPRINTF("xfer=%p\n", xfer);
KASSERT(mtx_owned(&sc->sc_lock));
- KASSERT(!cpu_intr_p() && !cpu_softintr_p());
+ //KASSERT(!cpu_intr_p() && !cpu_softintr_p());
if (sc->sc_dying) {
xfer->status = status;
@@ -1478,7 +1478,7 @@ int dwc2_intr(void *p)
hsotg = sc->sc_hsotg;
mtx_enter(&hsotg->lock);
- if (sc->sc_dying || !device_has_power(sc->sc_dev))
+ if (sc->sc_dying)
goto done;
if (sc->sc_bus.use_polling) {
@@ -1526,7 +1526,7 @@ dwc2_detach(struct dwc2_softc *sc, int flags)
bool
dwc2_shutdown(struct device *self, int flags)
{
- struct dwc2_softc *sc = device_private(self);
+ struct dwc2_softc *sc = (void *)self;
sc = sc;
@@ -1536,15 +1536,15 @@ dwc2_shutdown(struct device *self, int flags)
void
dwc2_childdet(struct device *self, struct device *child)
{
- struct dwc2_softc *sc = device_private(self);
+ struct dwc2_softc *sc = (void *)self;
sc = sc;
}
int
-dwc2_activate(struct device *self, enum devact act)
+dwc2_activate(struct device *self, int act)
{
- struct dwc2_softc *sc = device_private(self);
+ struct dwc2_softc *sc = (void *)self;
sc = sc;
@@ -1554,7 +1554,7 @@ dwc2_activate(struct device *self, enum devact act)
bool
dwc2_resume(struct device *dv, const pmf_qual_t *qual)
{
- struct dwc2_softc *sc = device_private(dv);
+ struct dwc2_softc *sc = (void *)dv;
sc = sc;
@@ -1564,7 +1564,7 @@ dwc2_resume(struct device *dv, const pmf_qual_t *qual)
bool
dwc2_suspend(struct device *dv, const pmf_qual_t *qual)
{
- struct dwc2_softc *sc = device_private(dv);
+ struct dwc2_softc *sc = (void *)dv;
sc = sc;
@@ -1583,11 +1583,11 @@ dwc2_init(struct dwc2_softc *sc)
sc->sc_bus.pipe_size = sizeof(struct dwc2_pipe);
sc->sc_hcdenabled = false;
- mtx_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
+ mtx_init(&sc->sc_lock, IPL_SOFTUSB);
TAILQ_INIT(&sc->sc_complete);
- sc->sc_rhc_si = softintr_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+ sc->sc_rhc_si = softintr_establish(IPL_SOFTNET,
dwc2_rhc, sc);
usb_setup_reserve(sc->sc_dev, &sc->sc_dma_reserve, sc->sc_bus.dmatag,
diff --git a/sys/dev/usb/dwc2/dwc2.h b/sys/dev/usb/dwc2/dwc2.h
index 2c4223c5f43..0366c4dd5ce 100644
--- a/sys/dev/usb/dwc2/dwc2.h
+++ b/sys/dev/usb/dwc2/dwc2.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.h,v 1.7 2015/02/10 23:10:21 uebayasi Exp $ */
+/* $OpenBSD: dwc2.h,v 1.8 2015/02/10 23:38:13 uebayasi Exp $ */
/* $NetBSD: dwc2.h,v 1.4 2014/12/23 16:20:06 macallan Exp $ */
/*-
@@ -107,7 +107,7 @@ extern int dwc2debug;
#define gfp_t int
#define GFP_KERNEL M_WAITOK
-#define GFP_ATOMIC KM_NOSLEEP
+#define GFP_ATOMIC M_NOWAIT
enum usb_otg_state {
OTG_STATE_RESERVED = 0,
@@ -122,7 +122,7 @@ enum usb_otg_state {
#define usleep_range(l, u) do { DELAY(u); } while (0)
#define spinlock_t struct mutex
-#define spin_lock_init(lock) mtx_init(lock, MUTEX_DEFAULT, IPL_SCHED)
+#define spin_lock_init(lock) mtx_init(lock, IPL_SCHED)
#define spin_lock(l) do { mtx_enter(l); } while (0)
#define spin_unlock(l) do { mtx_leave(l); } while (0)
diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c
index e0a0850dc44..ec74246bed7 100644
--- a/sys/dev/usb/dwc2/dwc2_hcd.c
+++ b/sys/dev/usb/dwc2/dwc2_hcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2_hcd.c,v 1.8 2015/02/10 23:10:21 uebayasi Exp $ */
+/* $OpenBSD: dwc2_hcd.c,v 1.9 2015/02/10 23:38:13 uebayasi Exp $ */
/* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */
/*
@@ -2228,8 +2228,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg,
/* Create new workqueue and init work */
retval = -ENOMEM;
hsotg->wq_otg = taskq_create("dwc2", 1, IPL_USB);
-
- if (err) {
+ if (hsotg->wq_otg == NULL) {
dev_err(hsotg->dev, "Failed to create workqueue\n");
goto error2;
}
diff --git a/sys/dev/usb/dwc2/dwc2_hcdddma.c b/sys/dev/usb/dwc2/dwc2_hcdddma.c
index 52fe8cb6589..baf3358c430 100644
--- a/sys/dev/usb/dwc2/dwc2_hcdddma.c
+++ b/sys/dev/usb/dwc2/dwc2_hcdddma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2_hcdddma.c,v 1.6 2015/02/10 14:34:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2_hcdddma.c,v 1.7 2015/02/10 23:38:13 uebayasi Exp $ */
/* $NetBSD: dwc2_hcdddma.c,v 1.6 2014/04/03 06:34:58 skrll Exp $ */
/*
@@ -106,7 +106,7 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
{
int err;
- KASSERT(!cpu_intr_p() && !cpu_softintr_p());
+ //KASSERT(!cpu_intr_p() && !cpu_softintr_p());
qh->desc_list = NULL;
err = usb_allocmem(&hsotg->hsotg_sc->sc_bus,
diff --git a/sys/dev/usb/dwc2/dwc2var.h b/sys/dev/usb/dwc2/dwc2var.h
index 90ae725fe9d..7152d13fd3a 100644
--- a/sys/dev/usb/dwc2/dwc2var.h
+++ b/sys/dev/usb/dwc2/dwc2var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2var.h,v 1.7 2015/02/10 23:10:21 uebayasi Exp $ */
+/* $OpenBSD: dwc2var.h,v 1.8 2015/02/10 23:38:13 uebayasi Exp $ */
/* $NetBSD: dwc2var.h,v 1.3 2013/10/22 12:57:40 skrll Exp $ */
/*-
@@ -116,9 +116,11 @@ int dwc2_intr(void *);
int dwc2_detach(dwc2_softc_t *, int);
bool dwc2_shutdown(struct device *, int);
void dwc2_childdet(struct device *, struct device *);
-int dwc2_activate(struct device *, enum devact);
+int dwc2_activate(struct device *, int);
+#if 0
bool dwc2_resume(struct device *, const pmf_qual_t *);
bool dwc2_suspend(struct device *, const pmf_qual_t *);
+#endif
void dwc2_worker(struct task *, void *);
@@ -132,6 +134,19 @@ dwc2_root_intr(dwc2_softc_t *sc)
softintr_schedule(sc->sc_rhc_si);
}
+// XXX compat
+
+#define mtx_owned(x) 1
+#define ENOSR 90
+#define EPROTO 96
+
+#ifndef mstohz
+#define mstohz(ms) \
+ (__predict_false((ms) >= 0x20000) ? \
+ ((ms +0u) / 1000u) * hz : \
+ ((ms +0u) * hz) / 1000u)
+#endif
+
#define timeout_reset(x, t, f, a) \
do { \
timeout_set((x), (f), (a)); \