summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2007-06-14 16:23:31 +0000
committerWarner Losh <imp@FreeBSD.org>2007-06-14 16:23:31 +0000
commit200d9c860df37cefee9e6fdae2f739e7fcda6ec6 (patch)
treeec525c9070af5c82dfae2f6fc8a4d379c0149819
parenta73530728e7ce93af816b2263de39ce6039e677b (diff)
Notes
-rw-r--r--sys/dev/usb/ehci.c36
-rw-r--r--sys/dev/usb/ehcivar.h7
-rw-r--r--sys/dev/usb/ohci.c22
-rw-r--r--sys/dev/usb/ohcivar.h2
-rw-r--r--sys/dev/usb/uhci.c27
-rw-r--r--sys/dev/usb/uhcivar.h2
-rw-r--r--sys/dev/usb/ukbd.c8
-rw-r--r--sys/dev/usb/usbdivar.h2
8 files changed, 49 insertions, 57 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index c0363c8f414fa..89db9531fe32e 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -476,8 +476,8 @@ ehci_init(ehci_softc_t *sc)
sc->sc_async_head = sqh;
EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
- usb_callout_init(sc->sc_tmo_pcd);
- usb_callout_init(sc->sc_tmo_intrlist);
+ callout_init(&sc->sc_tmo_pcd, 0);
+ callout_init(&sc->sc_tmo_intrlist, 0);
lockinit(&sc->sc_doorbell_lock, PZERO, "ehcidb", 0, 0);
@@ -594,7 +594,7 @@ ehci_intr1(ehci_softc_t *sc)
*/
ehci_pcd_able(sc, 0);
/* Do not allow RHSC interrupts > 1 per second */
- usb_callout(sc->sc_tmo_pcd, hz, ehci_pcd_enable, sc);
+ callout_reset(&sc->sc_tmo_pcd, hz, ehci_pcd_enable, sc);
eintrs &= ~EHCI_STS_PCD;
}
@@ -684,8 +684,8 @@ ehci_softintr(void *v)
/* Schedule a callout to catch any dropped transactions. */
if ((sc->sc_flags & EHCI_SCFLG_LOSTINTRBUG) &&
!LIST_EMPTY(&sc->sc_intrhead))
- usb_callout(sc->sc_tmo_intrlist, hz / 5, ehci_intrlist_timeout,
- sc);
+ callout_reset(&sc->sc_tmo_intrlist, hz / 5,
+ ehci_intrlist_timeout, sc);
#ifdef USB_USE_SOFTINTR
if (sc->sc_softwake) {
@@ -742,7 +742,7 @@ ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex)
}
done:
DPRINTFN(12, ("ehci_check_intr: ex=%p done\n", ex));
- usb_uncallout(ex->xfer.timeout_handle, ehci_timeout, ex);
+ callout_stop(&ex->xfer.timeout_handle);
usb_rem_task(ex->xfer.pipe->device, &ex->abort_task);
ehci_idone(ex);
}
@@ -929,8 +929,8 @@ ehci_detach(struct ehci_softc *sc, int flags)
EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
EOWRITE4(sc, EHCI_USBCMD, 0);
EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
- usb_uncallout(sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
- usb_uncallout(sc->sc_tmo_pcd, ehci_pcd_enable, sc);
+ callout_stop(&sc->sc_tmo_intrlist);
+ callout_stop(&sc->sc_tmo_pcd);
#if defined(__NetBSD__) || defined(__OpenBSD__)
if (sc->sc_powerhook != NULL)
@@ -969,9 +969,7 @@ ehci_power(int why, void *v)
s = splhardusb();
switch (why) {
case PWR_SUSPEND:
-#if defined(__NetBSD__) || defined(__OpenBSD__)
case PWR_STANDBY:
-#endif
sc->sc_bus.use_polling++;
for (i = 1; i <= sc->sc_noport; i++) {
@@ -1069,12 +1067,10 @@ ehci_power(int why, void *v)
sc->sc_bus.use_polling--;
break;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
case PWR_SOFTSUSPEND:
case PWR_SOFTSTANDBY:
case PWR_SOFTRESUME:
break;
-#endif
}
splx(s);
@@ -2523,7 +2519,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(epipe->pipe.device, &exfer->abort_task);
usb_transfer_complete(xfer);
splx(s);
@@ -2557,7 +2553,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
s = splusb();
exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(epipe->pipe.device, &exfer->abort_task);
splx(s);
@@ -2932,8 +2928,8 @@ ehci_device_request(usbd_xfer_handle xfer)
s = splusb();
ehci_activate_qh(sqh, setup);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
- ehci_timeout, xfer);
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ ehci_timeout, xfer);
}
ehci_add_intr_list(sc, exfer);
xfer->status = USBD_IN_PROGRESS;
@@ -3059,8 +3055,8 @@ ehci_device_bulk_start(usbd_xfer_handle xfer)
s = splusb();
ehci_activate_qh(sqh, data);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
- ehci_timeout, xfer);
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ ehci_timeout, xfer);
}
ehci_add_intr_list(sc, exfer);
xfer->status = USBD_IN_PROGRESS;
@@ -3244,7 +3240,7 @@ ehci_device_intr_start(usbd_xfer_handle xfer)
s = splusb();
ehci_activate_qh(sqh, data);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
ehci_timeout, xfer);
}
ehci_add_intr_list(sc, exfer);
@@ -3354,7 +3350,7 @@ ehci_device_intr_done(usbd_xfer_handle xfer)
s = splusb();
ehci_activate_qh(sqh, data);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle,
+ callout_reset(&xfer->timeout_handle,
MS_TO_TICKS(xfer->timeout), ehci_timeout, xfer);
}
splx(s);
diff --git a/sys/dev/usb/ehcivar.h b/sys/dev/usb/ehcivar.h
index d93b8a84561f5..7b22845380214 100644
--- a/sys/dev/usb/ehcivar.h
+++ b/sys/dev/usb/ehcivar.h
@@ -154,12 +154,9 @@ typedef struct ehci_softc {
struct lock sc_doorbell_lock;
- usb_callout_t sc_tmo_pcd;
- usb_callout_t sc_tmo_intrlist;
+ struct callout sc_tmo_pcd;
+ struct callout sc_tmo_intrlist;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- device_t sc_child; /* /dev/usb# device */
-#endif
char sc_dying;
#if defined(__NetBSD__)
struct usb_dma_reserve sc_dma_reserve;
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 293f42d973f33..40836e7805770 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -338,7 +338,7 @@ ohci_detach(struct ohci_softc *sc, int flags)
int i, rv = 0;
sc->sc_dying = 1;
- usb_uncallout(sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
+ callout_stop(&sc->sc_tmo_rhsc);
#if defined(__NetBSD__) || defined(__OpenBSD__)
powerhook_disestablish(sc->sc_powerhook);
@@ -793,7 +793,7 @@ ohci_init(ohci_softc_t *sc)
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
#endif
- usb_callout_init(sc->sc_tmo_rhsc);
+ callout_init(&sc->sc_tmo_rhsc, 0);
return (USBD_NORMAL_COMPLETION);
@@ -1212,7 +1212,7 @@ ohci_intr1(ohci_softc_t *sc)
*/
ohci_rhsc_able(sc, 0);
/* Do not allow RHSC interrupts > 1 per second */
- usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
+ callout_reset(&sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
eintrs &= ~OHCI_RHSC;
}
@@ -1384,7 +1384,7 @@ ohci_softintr(void *v)
DPRINTFN(15,("ohci_process_done: error cc=%d (%s)\n",
OHCI_TD_GET_CC(le32toh(std->td.td_flags)),
ohci_cc_strs[OHCI_TD_GET_CC(le32toh(std->td.td_flags))]));
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(OXFER(xfer)->xfer.pipe->device,
&OXFER(xfer)->abort_task);
@@ -1424,7 +1424,7 @@ ohci_softintr(void *v)
continue;
/* Normal transfer completion */
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(OXFER(xfer)->xfer.pipe->device,
&OXFER(xfer)->abort_task);
for (p = xfer->hcpriv; p->xfer == xfer; p = n) {
@@ -1753,8 +1753,8 @@ ohci_device_request(usbd_xfer_handle xfer)
opipe->tail.td = tail;
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
- ohci_timeout, xfer);
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ ohci_timeout, xfer);
}
splx(s);
@@ -2211,7 +2211,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(xfer->pipe->device, &OXFER(xfer)->abort_task);
usb_transfer_complete(xfer);
splx(s);
@@ -2245,7 +2245,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
s = splusb();
oxfer->ohci_xfer_flags |= OHCI_XFER_ABORTING;
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(xfer->pipe->device, &OXFER(xfer)->abort_task);
splx(s);
DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed));
@@ -2967,8 +2967,8 @@ ohci_device_bulk_start(usbd_xfer_handle xfer)
sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP);
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
- ohci_timeout, xfer);
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ ohci_timeout, xfer);
}
#if 0
diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h
index 23855f4a9addc..48f99e769f4cb 100644
--- a/sys/dev/usb/ohcivar.h
+++ b/sys/dev/usb/ohcivar.h
@@ -142,7 +142,7 @@ typedef struct ohci_softc {
u_int sc_overrun_cnt;
struct timeval sc_overrun_ntc;
- usb_callout_t sc_tmo_rhsc;
+ struct callout sc_tmo_rhsc;
char sc_dying;
} ohci_softc_t;
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 8b84c2720635f..4d4c61bf65c94 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -507,7 +507,7 @@ uhci_init(uhci_softc_t *sc)
STAILQ_INIT(&sc->sc_free_xfers);
- usb_callout_init(sc->sc_poll_handle);
+ callout_init(&sc->sc_poll_handle, 0);
/* Set up the bus struct. */
sc->sc_bus.methods = &uhci_bus_methods;
@@ -661,8 +661,7 @@ uhci_power(int why, void *v)
uhci_dumpregs(sc);
#endif
if (sc->sc_intr_xfer != NULL)
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub,
- sc->sc_intr_xfer);
+ callout_stop(&sc->sc_poll_handle);
sc->sc_bus.use_polling++;
uhci_run(sc, 0); /* stop the controller */
cmd &= ~UHCI_CMD_RS;
@@ -709,8 +708,8 @@ uhci_power(int why, void *v)
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
sc->sc_bus.use_polling--;
if (sc->sc_intr_xfer != NULL)
- usb_callout(sc->sc_poll_handle, sc->sc_ival,
- uhci_poll_hub, sc->sc_intr_xfer);
+ callout_reset(&sc->sc_poll_handle, sc->sc_ival,
+ uhci_poll_hub, sc->sc_intr_xfer);
#ifdef USB_DEBUG
if (uhcidebug > 2)
uhci_dumpregs(sc);
@@ -924,7 +923,7 @@ uhci_poll_hub(void *addr)
DPRINTFN(20, ("uhci_poll_hub\n"));
- usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+ callout_reset(&sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
p = xfer->buffer;
p[0] = 0;
@@ -1320,7 +1319,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
}
done:
DPRINTFN(12, ("uhci_check_intr: ii=%p done\n", ii));
- usb_uncallout(ii->xfer->timeout_handle, uhci_timeout, ii);
+ callout_stop(&ii->xfer->timeout_handle);
usb_rem_task(ii->xfer->pipe->device, &UXFER(ii->xfer)->abort_task);
uhci_idone(ii);
}
@@ -1941,7 +1940,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
uhci_add_intr_info(sc, ii);
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
uhci_timeout, ii);
}
xfer->status = USBD_IN_PROGRESS;
@@ -1994,7 +1993,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, uhci_timeout, xfer);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
uhci_transfer_complete(xfer);
splx(s);
@@ -2028,7 +2027,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
s = splusb();
uxfer->uhci_xfer_flags |= UHCI_XFER_ABORTING;
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, uhci_timeout, ii);
+ callout_stop(&xfer->timeout_handle);
usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
DPRINTFN(1,("uhci_abort_xfer: stop ii=%p\n", ii));
for (std = ii->stdstart; std != NULL; std = std->link.std)
@@ -2432,7 +2431,7 @@ uhci_device_request(usbd_xfer_handle xfer)
}
#endif
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+ callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
uhci_timeout, ii);
}
xfer->status = USBD_IN_PROGRESS;
@@ -3643,7 +3642,7 @@ uhci_root_intr_abort(usbd_xfer_handle xfer)
{
uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, xfer);
+ callout_stop(&sc->sc_poll_handle);
sc->sc_intr_xfer = NULL;
if (xfer->pipe->intrxfer == xfer) {
@@ -3688,7 +3687,7 @@ uhci_root_intr_start(usbd_xfer_handle xfer)
return (USBD_IOERROR);
sc->sc_ival = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
- usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+ callout_reset(&sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
sc->sc_intr_xfer = xfer;
return (USBD_IN_PROGRESS);
}
@@ -3699,7 +3698,7 @@ uhci_root_intr_close(usbd_pipe_handle pipe)
{
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
- usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, sc->sc_intr_xfer);
+ callout_stop(&sc->sc_poll_handle);
sc->sc_intr_xfer = NULL;
DPRINTF(("uhci_root_intr_close\n"));
}
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index 9c86d368492c5..0df23f186ae7d 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -187,7 +187,7 @@ typedef struct uhci_softc {
/* Info for the root hub interrupt channel. */
int sc_ival; /* time between root hub intrs */
usbd_xfer_handle sc_intr_xfer; /* root hub interrupt transfer */
- usb_callout_t sc_poll_handle;
+ struct callout sc_poll_handle;
char sc_vendor[16]; /* vendor string for root hub */
int sc_id_vendor; /* vendor ID for root hub */
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index cbd536b5d0e03..039bb94140ada 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -340,7 +340,7 @@ typedef struct ukbd_state {
#define INTRENABLED (1 << 0)
#define DISCONNECTED (1 << 1)
- usb_callout_t ks_timeout_handle;
+ struct callout ks_timeout_handle;
int ks_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */
int ks_flags; /* flags */
@@ -569,7 +569,7 @@ ukbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
state->ks_iface = uaa->iface;
state->ks_uaa = uaa;
state->ks_ifstate = 0;
- usb_callout_init(state->ks_timeout_handle);
+ callout_init(&state->ks_timeout_handle, 0);
/*
* FIXME: set the initial value for lock keys in ks_state
* according to the BIOS data?
@@ -639,7 +639,7 @@ ukbd_term(keyboard_t *kbd)
state = (ukbd_state_t *)kbd->kb_data;
DPRINTF(("ukbd_term: ks_ifstate=0x%x\n", state->ks_ifstate));
- usb_uncallout(state->ks_timeout_handle, ukbd_timeout, kbd);
+ callout_stop(&state->ks_timeout_handle);
if (state->ks_ifstate & INTRENABLED)
ukbd_enable_intr(kbd, FALSE, NULL);
@@ -680,7 +680,7 @@ ukbd_timeout(void *arg)
state = (ukbd_state_t *)kbd->kb_data;
s = splusb();
(*kbdsw[kbd->kb_index]->intr)(kbd, (void *)USBD_NORMAL_COMPLETION);
- usb_callout(state->ks_timeout_handle, hz / 40, ukbd_timeout, arg);
+ callout_reset(&state->ks_timeout_handle, hz / 40, ukbd_timeout, arg);
splx(s);
}
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h
index eeb386c6f4b94..95d8e0eff1fee 100644
--- a/sys/dev/usb/usbdivar.h
+++ b/sys/dev/usb/usbdivar.h
@@ -237,7 +237,7 @@ struct usbd_xfer {
void *hcpriv; /* private use by the HC driver */
- usb_callout_t timeout_handle;
+ struct callout timeout_handle;
};
void usbd_init(void);