Mon Oct 3 00:32:37 2016 UTC ()
Improve diagnostic print seen in PR 51524.


(dholland)
diff -r1.253 -r1.254 src/sys/dev/usb/ehci.c

cvs diff -r1.253 -r1.254 src/sys/dev/usb/ehci.c (expand / switch to unified diff)

--- src/sys/dev/usb/ehci.c 2016/08/14 14:42:22 1.253
+++ src/sys/dev/usb/ehci.c 2016/10/03 00:32:37 1.254
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehci.c,v 1.253 2016/08/14 14:42:22 skrll Exp $ */ 1/* $NetBSD: ehci.c,v 1.254 2016/10/03 00:32:37 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum, 8 * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum,
9 * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill 9 * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill
10 * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au). 10 * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au).
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -43,27 +43,27 @@ @@ -43,27 +43,27 @@
43 43
44/* 44/*
45 * TODO: 45 * TODO:
46 * 1) hold off explorations by companion controllers until ehci has started. 46 * 1) hold off explorations by companion controllers until ehci has started.
47 * 47 *
48 * 2) The hub driver needs to handle and schedule the transaction translator, 48 * 2) The hub driver needs to handle and schedule the transaction translator,
49 * to assign place in frame where different devices get to go. See chapter 49 * to assign place in frame where different devices get to go. See chapter
50 * on hubs in USB 2.0 for details. 50 * on hubs in USB 2.0 for details.
51 * 51 *
52 * 3) Command failures are not recovered correctly. 52 * 3) Command failures are not recovered correctly.
53 */ 53 */
54 54
55#include <sys/cdefs.h> 55#include <sys/cdefs.h>
56__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.253 2016/08/14 14:42:22 skrll Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.254 2016/10/03 00:32:37 dholland Exp $");
57 57
58#include "ohci.h" 58#include "ohci.h"
59#include "uhci.h" 59#include "uhci.h"
60 60
61#ifdef _KERNEL_OPT 61#ifdef _KERNEL_OPT
62#include "opt_usb.h" 62#include "opt_usb.h"
63#endif 63#endif
64 64
65#include <sys/param.h> 65#include <sys/param.h>
66 66
67#include <sys/bus.h> 67#include <sys/bus.h>
68#include <sys/cpu.h> 68#include <sys/cpu.h>
69#include <sys/device.h> 69#include <sys/device.h>
@@ -2158,28 +2158,31 @@ ehci_sync_hc(ehci_softc_t *sc) @@ -2158,28 +2158,31 @@ ehci_sync_hc(ehci_softc_t *sc)
2158 DPRINTF("dying", 0, 0, 0, 0); 2158 DPRINTF("dying", 0, 0, 0, 0);
2159 return; 2159 return;
2160 } 2160 }
2161 /* ask for doorbell */ 2161 /* ask for doorbell */
2162 EOWRITE4(sc, EHCI_USBCMD, EOREAD4(sc, EHCI_USBCMD) | EHCI_CMD_IAAD); 2162 EOWRITE4(sc, EHCI_USBCMD, EOREAD4(sc, EHCI_USBCMD) | EHCI_CMD_IAAD);
2163 DPRINTF("cmd = 0x%08x sts = 0x%08x", 2163 DPRINTF("cmd = 0x%08x sts = 0x%08x",
2164 EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS), 0, 0); 2164 EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS), 0, 0);
2165 2165
2166 error = cv_timedwait(&sc->sc_doorbell, &sc->sc_lock, hz); /* bell wait */ 2166 error = cv_timedwait(&sc->sc_doorbell, &sc->sc_lock, hz); /* bell wait */
2167 2167
2168 DPRINTF("cmd = 0x%08x sts = 0x%08x ... done", 2168 DPRINTF("cmd = 0x%08x sts = 0x%08x ... done",
2169 EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS), 0, 0); 2169 EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS), 0, 0);
2170#ifdef DIAGNOSTIC 2170#ifdef DIAGNOSTIC
2171 if (error) 2171 if (error == EWOULDBLOCK) {
2172 printf("ehci_sync_hc: cv_timedwait() = %d\n", error); 2172 printf("ehci_sync_hc: timed out\n");
 2173 } else if (error) {
 2174 printf("ehci_sync_hc: cv_timedwait: error %d\n", error);
 2175 }
2173#endif 2176#endif
2174} 2177}
2175 2178
2176Static void 2179Static void
2177ehci_remove_itd_chain(ehci_softc_t *sc, struct ehci_soft_itd *itd) 2180ehci_remove_itd_chain(ehci_softc_t *sc, struct ehci_soft_itd *itd)
2178{ 2181{
2179 2182
2180 KASSERT(mutex_owned(&sc->sc_lock)); 2183 KASSERT(mutex_owned(&sc->sc_lock));
2181 2184
2182 for (; itd != NULL; itd = itd->xfer_next) { 2185 for (; itd != NULL; itd = itd->xfer_next) {
2183 struct ehci_soft_itd *prev = itd->frame_list.prev; 2186 struct ehci_soft_itd *prev = itd->frame_list.prev;
2184 2187
2185 /* Unlink itd from hardware chain, or frame array */ 2188 /* Unlink itd from hardware chain, or frame array */