Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: DDB not working with USB keyboard at xhci port
On 08/21/17 14:56, sc dying wrote:
On 2017/08/21 12:00, Nick Hudson wrote:
On 08/16/17 06:42, sc dying wrote:
When ukbd(4) is a console and connected to USB3 port, you can enter
into DDB by pressing ALT+CTRL+ESC but console freezes.
(on HEAD, netbsd-7, netbsd-8)
xhci has two buses, sc->sc_bus is for usb3 and sc->sc_bus2 is for
usb2. ukbd is usually connected at Low-Speed, so usbd_set_polling
sets sc->sc_bus2->ub_usepolling.
However, xhci.c checks only sc->sc_bus->ub_usepolling, that's why
xhci_poll does not call xhci_softintr.
I can show a quick dirty patch.
It assumes ub_usepolling is always set by ukbd at LS/FS/HS.
Can you test this patch please?
It does not work.
This patch helps xhci.c but does not usb_schedsoftintr in usb.c.
How about this? It's still all pretty ugly, but this should now work...
Nick
Index: sys/dev/usb/xhci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/xhci.c,v
retrieving revision 1.72
diff -u -p -r1.72 xhci.c
--- sys/dev/usb/xhci.c 1 Jun 2017 02:45:12 -0000 1.72
+++ sys/dev/usb/xhci.c 22 Aug 2017 14:14:54 -0000
@@ -1211,6 +1212,12 @@ xhci_init(struct xhci_softc *sc)
return rv;
}
+static inline bool
+xhci_polling_p(struct xhci_softc * const sc)
+{
+ return sc->sc_bus.ub_usepolling || sc->sc_bus2.ub_usepolling;
+}
+
int
xhci_intr(void *v)
{
@@ -1228,7 +1235,7 @@ xhci_intr(void *v)
goto done;
/* If we get an interrupt while polling, then just ignore it. */
- if (sc->sc_bus.ub_usepolling) {
+ if (xhci_polling_p(sc)) {
#ifdef DIAGNOSTIC
DPRINTFN(16, "ignored interrupt while polling", 0, 0, 0, 0);
#endif
@@ -1236,6 +1243,9 @@ xhci_intr(void *v)
}
ret = xhci_intr1(sc);
+ if (ret) {
+ usb_schedsoftintr(&sc->sc_bus);
+ }
done:
mutex_spin_exit(&sc->sc_intr_lock);
return ret;
@@ -1270,8 +1280,6 @@ xhci_intr1(struct xhci_softc * const sc)
usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
DPRINTFN(16, "USBSTS %08x", usbsts, 0, 0, 0);
- usb_schedsoftintr(&sc->sc_bus);
-
return 1;
}
@@ -2106,7 +2114,7 @@ xhci_softintr(void *v)
XHCIHIST_FUNC(); XHCIHIST_CALLED();
- KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
+ KASSERT(xhci_polling_p(sc) || mutex_owned(&sc->sc_lock));
i = er->xr_ep;
j = er->xr_cs;
@@ -2150,7 +2158,10 @@ xhci_poll(struct usbd_bus *bus)
XHCIHIST_FUNC(); XHCIHIST_CALLED();
mutex_spin_enter(&sc->sc_intr_lock);
- xhci_intr1(sc);
+ int ret = xhci_intr1(sc);
+ if (ret) {
+ xhci_softintr(bus);
+ }
mutex_spin_exit(&sc->sc_intr_lock);
return;
@@ -3771,7 +3782,7 @@ xhci_device_ctrl_start(struct usbd_xfer
xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
- if (xfer->ux_timeout && !sc->sc_bus.ub_usepolling) {
+ if (xfer->ux_timeout && !xhci_polling_p(sc)) {
callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
xhci_timeout, xfer);
}
@@ -3887,7 +3898,7 @@ xhci_device_bulk_start(struct usbd_xfer
xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
- if (xfer->ux_timeout && !sc->sc_bus.ub_usepolling) {
+ if (xfer->ux_timeout && !xhci_polling_p(sc)) {
callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
xhci_timeout, xfer);
}
@@ -3993,7 +4004,7 @@ xhci_device_intr_start(struct usbd_xfer
xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
- if (xfer->ux_timeout && !sc->sc_bus.ub_usepolling) {
+ if (xfer->ux_timeout && !xhci_polling_p(sc)) {
callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
xhci_timeout, xfer);
}
@@ -4015,7 +4026,7 @@ xhci_device_intr_done(struct usbd_xfer *
DPRINTFN(15, "%p slot %u dci %u", xfer, xs->xs_idx, dci, 0);
- KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
+ KASSERT(xhci_polling_p(sc) || mutex_owned(&sc->sc_lock));
usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
Home |
Main Index |
Thread Index |
Old Index